:root {
  color-scheme: dark light;
  --bg: #09121e;
  --bg-grad-1: #09121e;
  --bg-grad-2: #12283b;
  --bg-grad-3: #0b1826;
  --card: #132337;
  --text: #f2f6fa;
  --muted: #adc0d2;
  --desc: #d7e3eb;
  --line: #30455b;
  --accent: #96e8d2;
  --accent-fg: #092026;
  --gold: #ffd68a;
  --toolbar-bg: #09121eea;
  --pill-fg: #d3e3ee;
  --btn-bg: #1c3349;
  --note-bg: #162c41;
  --note-fg: #d9e8f1;
  --near-bg: #152b3f;
  --break-bg: #152837;
  --link: #a6f0db;
  --hours: #b2c5d4;
  --meter-bg: #274056;
  --optional-bar: #84a2bc;
  --theme-color: #0c1725;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f7fa;
    --bg-grad-1: #eef3f8;
    --bg-grad-2: #e3ecf4;
    --bg-grad-3: #f8fafc;
    --card: #ffffff;
    --text: #0f1c2a;
    --muted: #4a6278;
    --desc: #2a4054;
    --line: #c5d4e0;
    --accent: #0d7a66;
    --accent-fg: #ffffff;
    --gold: #b45309;
    --toolbar-bg: #f4f7fae6;
    --pill-fg: #334155;
    --btn-bg: #e8eef4;
    --note-bg: #e8f0f7;
    --note-fg: #1e3347;
    --near-bg: #e8f0f7;
    --break-bg: #f0f4f8;
    --link: #0d6b5c;
    --hours: #526880;
    --meter-bg: #d0dde8;
    --optional-bar: #7a96ad;
    --theme-color: #eef3f8;
  }
}

:root[data-theme="light"] {
  --bg: #f4f7fa;
  --bg-grad-1: #eef3f8;
  --bg-grad-2: #e3ecf4;
  --bg-grad-3: #f8fafc;
  --card: #ffffff;
  --text: #0f1c2a;
  --muted: #4a6278;
  --desc: #2a4054;
  --line: #c5d4e0;
  --accent: #0d7a66;
  --accent-fg: #ffffff;
  --gold: #b45309;
  --toolbar-bg: #f4f7fae6;
  --pill-fg: #334155;
  --btn-bg: #e8eef4;
  --note-bg: #e8f0f7;
  --note-fg: #1e3347;
  --near-bg: #e8f0f7;
  --break-bg: #f0f4f8;
  --link: #0d6b5c;
  --hours: #526880;
  --meter-bg: #d0dde8;
  --optional-bar: #7a96ad;
  --theme-color: #eef3f8;
}

:root[data-theme="dark"] {
  --bg: #09121e;
  --bg-grad-1: #09121e;
  --bg-grad-2: #12283b;
  --bg-grad-3: #0b1826;
  --card: #132337;
  --text: #f2f6fa;
  --muted: #adc0d2;
  --desc: #d7e3eb;
  --line: #30455b;
  --accent: #96e8d2;
  --accent-fg: #092026;
  --gold: #ffd68a;
  --toolbar-bg: #09121eea;
  --pill-fg: #d3e3ee;
  --btn-bg: #1c3349;
  --note-bg: #162c41;
  --note-fg: #d9e8f1;
  --near-bg: #152b3f;
  --break-bg: #152837;
  --link: #a6f0db;
  --hours: #b2c5d4;
  --meter-bg: #274056;
  --optional-bar: #84a2bc;
  --theme-color: #0c1725;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(
    145deg,
    var(--bg-grad-1),
    var(--bg-grad-2) 65%,
    var(--bg-grad-3)
  );
  font: 15px/1.55 system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  color: var(--text);
}

main {
  max-width: 820px;
  margin: auto;
  padding: 20px 16px 70px;
}

header {
  padding: 20px 0 16px;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.theme-picker {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  background: var(--btn-bg);
}

.theme-picker button {
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
}

.theme-picker button.active {
  background: var(--accent);
  color: var(--accent-fg);
}

.eyebrow {
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 750;
  letter-spacing: 0.16em;
  font-size: 11px;
}

h1 {
  font-size: clamp(28px, 6vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.04em;
  margin: 8px 0 10px;
}

p {
  margin: 5px 0;
}

.sub {
  color: var(--muted);
  max-width: 600px;
}

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 5px 10px;
  color: var(--pill-fg);
  font-size: 12px;
}

.toolbar {
  position: sticky;
  top: 0;
  background: var(--toolbar-bg);
  backdrop-filter: blur(16px);
  z-index: 4;
  margin: 12px -16px;
  padding: 12px 16px;
  display: flex;
  gap: 9px;
  border-bottom: 1px solid var(--line);
}

button,
a.action {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  border-radius: 11px;
  border: 1px solid var(--line);
  padding: 10px 13px;
  background: var(--btn-bg);
  color: var(--text);
}

button.tab.active {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.tab {
  flex: 1;
}

.progress {
  margin: 14px 0 20px;
}

.meter {
  height: 8px;
  background: var(--meter-bg);
  border-radius: 20px;
  overflow: hidden;
  margin-top: 9px;
}

.bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s;
}

h2 {
  margin: 24px 0 5px;
  font-size: 24px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.stop {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 16px 16px 16px 18px;
  margin: 11px 0;
  box-shadow: 0 8px 22px #0002;
}

.stop:before {
  content: "";
  position: absolute;
  left: -1px;
  top: 24px;
  bottom: 24px;
  width: 4px;
  background: var(--accent);
  border-radius: 4px;
}

.stop.optional:before {
  background: var(--optional-bar);
}

.stop.done {
  opacity: 0.56;
}

.stop.done .name {
  text-decoration: line-through;
}

.stop.break {
  background: var(--break-bg);
}

.stop.break:before {
  background: var(--gold);
}

.topline {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.time {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--accent);
  font-weight: 800;
}

.duration {
  font-size: 12px;
  color: var(--muted);
}

.name {
  font-size: 19px;
  font-weight: 780;
  letter-spacing: -0.015em;
  margin: 4px 0;
}

.address {
  color: var(--muted);
  font-size: 12px;
}

.desc {
  margin: 11px 0 13px;
  color: var(--desc);
}

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

.action.map {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.action.detail {
  background: transparent;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.check input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
}

.badge {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-fg);
  background: var(--gold);
  border-radius: 5px;
  padding: 2px 5px;
}

.optional .badge {
  background: var(--optional-bar);
}

.badge-closed {
  background: #6b7f94;
  color: var(--text);
}

.hours {
  color: var(--hours);
  font-size: 12px;
  margin-top: 9px;
}

.note {
  background: var(--note-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  margin: 18px 0;
  color: var(--note-fg);
}

.near-panel {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px;
  background: var(--near-bg);
  margin: 14px 0;
}

.near-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 11px 0;
}

.near-row:first-of-type {
  border-top: 0;
}

.near-meta {
  font-size: 12px;
  color: var(--muted);
}

.distance {
  font-weight: 750;
  color: var(--accent);
  font-size: 12px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.loc-button {
  width: 100%;
  margin-top: 10px;
}

.near-filters {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.near-map-wrap {
  margin-top: 14px;
}

.near-map {
  height: 280px;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.dev-banner {
  background: var(--gold);
  color: #1a1a1a;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
}

.dev-banner.hidden {
  display: none;
}

.dev-banner code {
  font-size: 11px;
}

.backup {
  border-left: 4px solid var(--gold);
}

footer {
  font-size: 12px;
  color: var(--muted);
  margin-top: 26px;
}

a {
  color: var(--link);
}

@media print {
  body {
    background: white;
    color: black;
  }
  .toolbar,
  .actions,
  .check,
  .theme-picker,
  .near-panel {
    display: none !important;
  }
  .stop {
    break-inside: avoid;
    box-shadow: none;
    color: black;
    background: white;
    border-color: #ccc;
  }
  .sub,
  .desc,
  .address,
  .hours,
  .hint {
    color: #555;
  }
}
