:root {
  color-scheme: light;
  --paper: #f4f7f6;
  --ink: #17231f;
  --muted: #64716c;
  --line: #d6dfdc;
  --panel: #ffffff;
  --green: #23403a;
  --green-2: #315f54;
  --clay: #d95f43;
  --gold: #c59432;
  --blue: #3c6e91;
  --shadow: 0 14px 34px rgba(31, 44, 39, .12);
  --soft-shadow: 0 8px 22px rgba(31, 44, 39, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(35, 64, 58, .12), transparent 280px),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 750;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: .68;
}

.app {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: 0;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--clay);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

.notice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px solid rgba(217, 95, 67, .35);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff8f1;
  color: #6b321f;
}

.notice code {
  border-radius: 6px;
  padding: 2px 5px;
  background: rgba(217, 95, 67, .12);
}

.auth {
  min-height: 58vh;
  display: grid;
  align-items: center;
}

.workspace {
  display: grid;
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid rgba(35, 64, 58, .12);
  border-radius: 8px;
  padding: clamp(18px, 4vw, 28px);
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}

.auth .panel {
  width: min(460px, 100%);
  margin: 0 auto;
}

.panelHead {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.checkRow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.checkRow input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

label {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 12px;
  background: white;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green-2);
  box-shadow: 0 0 0 3px rgba(49, 95, 84, .14);
}

.grid {
  display: grid;
  gap: 12px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three {
  grid-template-columns: 1fr .8fr .75fr;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.primary {
  background: var(--green);
  color: white;
}

.primary:active {
  transform: translateY(1px);
}

.secondary {
  background: #e5ece9;
  color: var(--green);
}

.ghost {
  border: 1px solid rgba(35, 64, 58, .2);
  background: rgba(255, 255, 255, .72);
  color: var(--green);
}

.smallButton {
  min-height: 38px;
  padding: 0 12px;
}

.appTabs {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border: 1px solid rgba(35, 64, 58, .12);
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.tab {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  background: var(--green);
  color: white;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.heroPanel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid rgba(35, 64, 58, .12);
  border-radius: 8px;
  padding: clamp(18px, 4vw, 30px);
  background:
    linear-gradient(135deg, rgba(35, 64, 58, .96), rgba(49, 95, 84, .9)),
    var(--green);
  color: white;
  box-shadow: var(--shadow);
}

.heroPanel .eyebrow,
.heroPanel p {
  color: rgba(255, 255, 255, .78);
}

.heroPanel .syncBadge {
  background: rgba(255, 255, 255, .16);
  color: white;
}

.heroPanel h2 {
  margin-bottom: 8px;
  font-size: clamp(1.85rem, 5vw, 3rem);
  line-height: 1;
}

.homeGrid {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(320px, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.compactPanel,
.listPanel,
.timetablePanel,
.capture {
  box-shadow: var(--soft-shadow);
}

.timetablePanel,
.capture {
  max-width: 760px;
  margin: 0 auto;
}

.dayPicker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
}

.dayButton {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: white;
  color: var(--muted);
}

.dayButton.active {
  border-color: var(--green);
  background: rgba(35, 64, 58, .1);
  color: var(--green);
}

.wide {
  width: 100%;
  margin-top: 18px;
}

.syncBadge {
  white-space: nowrap;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(60, 110, 145, .13);
  color: var(--blue);
  font-size: .8rem;
  font-weight: 850;
}

.syncBadge.pending {
  background: rgba(197, 148, 50, .18);
  color: #795817;
}

.tasks {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(35, 64, 58, .12);
  border-radius: 8px;
  padding: 13px;
  background: white;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timelineItem {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.timelineTime {
  padding-top: 12px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 850;
  text-align: right;
}

.timelineCard {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 66px;
  border: 1px solid rgba(35, 64, 58, .12);
  border-radius: 8px;
  padding: 12px 14px;
  background: white;
}

.timelineCard::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: -8px;
  width: 4px;
  border-radius: 999px;
  background: var(--blue);
  opacity: .42;
}

.timelineItem.current .timelineCard {
  border-color: rgba(217, 95, 67, .34);
  background: #fff7f4;
}

.timelineItem.current .timelineCard::before {
  background: var(--clay);
  opacity: 1;
}

.timelineTitle {
  overflow-wrap: anywhere;
  font-weight: 900;
}

.timelineMeta {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 700;
}

.miniTimeline .timelineItem {
  grid-template-columns: 54px minmax(0, 1fr);
}

.miniTimeline .timelineItem:nth-child(n+6) {
  display: none;
}

.taskTop,
.taskMeta,
.taskActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.taskTop {
  justify-content: space-between;
}

.taskTitle {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.taskMeta {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 700;
}

.pill {
  border-radius: 999px;
  padding: 4px 8px;
  background: #f1eadf;
  color: #4f5b56;
}

.priorityHigh {
  background: rgba(217, 95, 67, .14);
  color: #943c29;
}

.priorityLow {
  background: rgba(60, 110, 145, .14);
  color: #27536f;
}

.taskActions button {
  min-height: 36px;
  padding: 0 11px;
  font-size: .86rem;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .app {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .three,
  .two {
    grid-template-columns: 1fr;
  }

  .actions,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .appTabs {
    position: fixed;
    top: auto;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
  }

  .homeGrid {
    grid-template-columns: 1fr;
  }

  .heroPanel {
    flex-direction: column;
  }

  .dayPicker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .timelineItem {
    grid-template-columns: 56px minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  button {
    padding: 0 14px;
  }

  .panelHead {
    align-items: stretch;
    flex-direction: column;
  }

  .taskTop,
  .taskActions {
    align-items: flex-start;
    flex-direction: column;
  }
}
