:root {
  color-scheme: light;
  --bg: #f7f8f6;
  --ink: #17201b;
  --muted: #667069;
  --line: #d9ded8;
  --panel: #ffffff;
  --blue: #2166a5;
  --deep: #14324a;
  --green: #1f7a55;
  --coral: #c7523b;
  --sun: #e9b949;
  --night: #223047;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.hero {
  background: var(--deep);
  color: white;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px clamp(16px, 5vw, 36px) 12px;
  width: min(860px, 100%);
  margin: 0 auto;
}

.hero-copy {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 0 clamp(16px, 5vw, 36px) 18px;
}

.hero-copy p {
  max-width: 560px;
  color: #d5e3e0;
  line-height: 1.45;
}

.top-actions {
  display: flex;
  gap: 8px;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1;
}

h2 {
  font-size: 24px;
  line-height: 1.1;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #9fc0bd;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  position: sticky;
  top: 0;
  z-index: 5;
  gap: 6px;
  padding: 8px clamp(16px, 5vw, 36px);
  background: color-mix(in srgb, var(--bg) 92%, white);
  border-bottom: 1px solid var(--line);
}

.tab, .secondary, .icon-btn, .primary {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  background: var(--panel);
  color: var(--ink);
}

.tab.active {
  border-color: var(--blue);
  color: var(--blue);
  font-weight: 750;
}

.icon-btn {
  padding: 0 12px;
}

.hero .icon-btn {
  border-color: rgba(255,255,255,.22);
  background: rgba(255,255,255,.08);
  color: white;
}

.primary {
  width: 100%;
  border: 0;
  background: var(--blue);
  color: white;
  font-weight: 800;
}

.secondary {
  padding: 0 14px;
}

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

main {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 18px clamp(16px, 5vw, 36px) 40px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel, .day-card, .note, .stats > div, .summary > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

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

.check input {
  width: 20px;
  height: 20px;
}

.note {
  margin-top: 14px;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.timeline {
  display: grid;
  grid-template-columns: 1fr .7fr 3fr .7fr 1fr;
  height: 12px;
  overflow: hidden;
  border-radius: 8px;
  margin-bottom: 14px;
}

.summary {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.summary > div {
  padding: 12px;
}

.summary strong {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  margin-top: 5px;
}

.now-card {
  background: #edf7f2;
  border: 1px solid #cfe4d9;
  border-radius: 8px;
  color: var(--ink);
  margin-bottom: 14px;
  padding: 14px;
}

.now-card strong {
  display: block;
  font-size: 18px;
  margin: 3px 0;
}

.now-card span, .history-item span {
  color: var(--muted);
  display: block;
  font-size: 13px;
}

.now-card p:last-child {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  margin-top: 6px;
}

.timeline span:nth-child(1), .timeline span:nth-child(5) { background: var(--night); }
.timeline .dawn { background: var(--coral); }
.timeline .day { background: var(--sun); }
.timeline .dusk { background: var(--green); }

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

.empty {
  color: var(--muted);
  padding: 18px 0;
}

.day-card {
  padding: 14px;
}

.day-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  background: #edf3f8;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tasks {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.task {
  display: grid;
  grid-template-columns: 24px 72px 1fr;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.task input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.task strong {
  display: block;
}

.task-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.task-title em {
  border-radius: 999px;
  background: #edf3f8;
  color: var(--blue);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  padding: 2px 6px;
  text-transform: uppercase;
}

.task p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.slider {
  display: grid;
  gap: 8px;
}

.slider label {
  display: flex;
  justify-content: space-between;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stats > div {
  padding: 14px;
}

.stats strong {
  display: block;
  font-size: 24px;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.chart {
  display: grid;
  gap: 10px;
}

.history {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.history-item {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}

.history-item b {
  color: var(--blue);
  white-space: nowrap;
}

.bar {
  display: grid;
  grid-template-columns: 86px 1fr 36px;
  gap: 8px;
  align-items: center;
}

.bar span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track {
  height: 12px;
  border-radius: 999px;
  background: #e8ece7;
  overflow: hidden;
}

.fill {
  height: 100%;
  background: var(--coral);
}

@media (max-width: 760px), (max-width: 900px) and (orientation: portrait) {
  h1 { font-size: 28px; }
  h2 { font-size: 21px; }
  main {
    padding-top: 12px;
    padding-bottom: 88px;
  }
  .top {
    align-items: center;
    padding: 12px clamp(14px, 4vw, 24px) 10px;
  }
  .hero-copy {
    display: none;
  }
  .hero .eyebrow {
    font-size: 10px;
  }
  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .icon-btn {
    min-height: 34px;
    padding: 0 9px;
  }
  .tabs {
    position: fixed;
    inset: auto 0 0;
    gap: 4px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 0 -8px 24px rgba(20, 50, 74, .08);
  }
  .tab {
    min-height: 44px;
  }
  .section-head {
    align-items: end;
    margin-bottom: 10px;
  }
  .section-head .secondary {
    min-height: 36px;
  }
  .grid { grid-template-columns: 1fr; }
  .summary, .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
  }
  .summary > div, .stats > div {
    min-width: 0;
    padding: 8px;
  }
  .summary strong, .stats strong {
    font-size: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .summary span, .stats span {
    font-size: 10px;
    margin-top: 3px;
  }
  .now-card {
    margin-bottom: 10px;
    padding: 10px;
  }
  .now-card strong {
    font-size: 16px;
  }
  .timeline {
    height: 8px;
    margin-bottom: 10px;
  }
  .day-card {
    padding: 10px;
  }
  .day-head {
    align-items: center;
    padding-bottom: 8px;
  }
  .day-head h2 {
    font-size: 22px;
  }
  .tag {
    font-size: 11px;
    padding: 3px 7px;
  }
  .tasks {
    gap: 0;
    margin-top: 8px;
  }
  .task {
    grid-template-columns: 22px 68px 1fr;
    gap: 6px;
    padding: 8px 0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }
  .task:last-child {
    border-bottom: 0;
  }
  .task input {
    width: 18px;
    height: 18px;
  }
  .time {
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
  }
  .task-title {
    gap: 4px;
  }
  .task-title strong {
    font-size: 14px;
    line-height: 1.2;
  }
  .task-title em {
    font-size: 9px;
    padding: 1px 5px;
  }
  .task p {
    font-size: 12px;
    line-height: 1.25;
  }
  .history-item {
    align-items: start;
    flex-direction: column;
  }
  .bar { grid-template-columns: 72px 1fr 28px; }
}
