:root {
  --paper: #F2F5F4;
  --surface: #FFFFFF;
  --ink: #13233A;
  --muted: #56657A;
  --rule: #D3DCDF;
  --ship: #1F6E8C;
  --family: #3E7B4F;
  --hotel: #B98A2E;
  --flight: #13233A;
  --home: #8A96A3;
  --signal: #F2C230;
  --signal-ink: #3A2E00;
  --risk: #B3261E;
  --ok: #3E7B4F;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  --measure: 72ch;
  --radius: 6px;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1A26; --surface: #152433; --ink: #E8EEF2; --muted: #9AA8B6; --rule: #2A3C4E;
    --ship: #4FA3C4; --family: #6FB07F; --hotel: #D9AE55; --flight: #C9D3DC; --home: #6E7B88;
    --signal: #E8B923; --signal-ink: #1F1800; --risk: #F2766B; --ok: #6FB07F;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1A26; --surface: #152433; --ink: #E8EEF2; --muted: #9AA8B6; --rule: #2A3C4E;
  --ship: #4FA3C4; --family: #6FB07F; --hotel: #D9AE55; --flight: #C9D3DC; --home: #6E7B88;
  --signal: #E8B923; --signal-ink: #1F1800; --risk: #F2766B; --ok: #6FB07F;
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 12px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.55 var(--body); font-variant-numeric: tabular-nums;
}
main { max-width: 64rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 700; }
h2 { font-size: 1.45rem; font-weight: 700; margin: 3rem 0 1rem; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 .75rem; max-width: var(--measure); }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* Header */
.masthead p { margin: .35rem 0 0; }
.masthead .countdown { margin-top: 1rem; font-size: 1.05rem; }
.masthead .countdown strong { font-family: var(--display); font-size: 1.35rem; }

/* Checks */
.checks { margin-top: 1.5rem; border-left: 4px solid var(--risk); background: var(--surface); padding: .9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; }
.checks h3 { color: var(--risk); margin-bottom: .4rem; }
.checks ul { margin: 0; padding-left: 1.1rem; }

/* Next up + money */
.overview { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; margin-top: 2rem; }
@media (max-width: 760px) { .overview { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.panel h2 { margin: 0 0 .75rem; font-size: 1.2rem; }
.next { list-style: none; margin: 0; padding: 0; }
.next li { display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; padding: .6rem 0; border-top: 1px solid var(--rule); }
.next li:first-child { border-top: 0; padding-top: 0; }
.due { font-size: .875rem; color: var(--muted); }
.due strong { display: block; color: var(--ink); }
.due .rel { display: block; margin-top: .15rem; }
.due.soon strong { background: var(--signal); color: var(--signal-ink); display: inline-block; padding: 0 .35rem; border-radius: 3px; }
.due.late strong { color: var(--risk); }
.kind { font-size: .8rem; font-weight: 700; color: var(--ship); margin-right: .35rem; }
.why { display: block; font-size: .875rem; color: var(--muted); margin-top: .15rem; }
.money dl { margin: 0; display: grid; grid-template-columns: 1fr auto; row-gap: .35rem; }
.money dt { color: var(--muted); }
.money dd { margin: 0; text-align: right; font-weight: 700; }
.money .big { font-family: var(--display); font-size: 1.6rem; }
.money .foot { margin-top: .9rem; font-size: .875rem; color: var(--muted); }

/* Trip strip: the one bold element */
.strip-wrap { overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem .5rem; }
.strip { display: grid; grid-template-columns: repeat(var(--n), minmax(3.1rem, 1fr)); min-width: calc(var(--n) * 3.1rem); }
.cell { appearance: none; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: .4rem 0 .5rem; text-align: center; border-left: 1px solid var(--rule); }
.cell:first-child { border-left: 0; }
.cell .wd { display: block; font-size: .75rem; color: var(--muted); }
.cell .dn { display: block; font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.cell .mo { display: block; font-size: .7rem; color: var(--muted); min-height: 1em; }
.cell .obs { display: block; height: 6px; margin: .3rem auto 0; width: 6px; border-radius: 50%; }
.cell .obs.on { background: var(--hotel); }
.cell.today .dn { text-decoration: underline 3px var(--signal); text-underline-offset: 4px; }
.cell:hover .dn { color: var(--ship); }
.band { height: 44px; display: flex; align-items: center; padding: 0 .6rem; color: #fff; font-weight: 700; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 2px solid var(--paper); }
.band.ship { background: var(--ship); } .band.family { background: var(--family); } .band.hotel { background: var(--hotel); color: #1E1500; }
.band.flight { background: var(--flight); color: var(--paper); } .band.home { background: var(--home); }
.strip-key { margin-top: .6rem; font-size: .875rem; color: var(--muted); }
.strip-key i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--hotel); margin-right: .35rem; vertical-align: middle; }

/* Day by day */
.phase { margin-top: 2rem; }
.phase h3 { padding-bottom: .4rem; border-bottom: 2px solid var(--ink); }
.day { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 1rem; }
.day.is-today { background: color-mix(in srgb, var(--signal) 14%, transparent); margin: 0 -.75rem; padding-left: .75rem; padding-right: .75rem; }
.day .date { font-family: var(--display); font-weight: 600; }
.day .date span { display: block; font-family: var(--body); font-weight: 400; font-size: .8rem; color: var(--muted); }
.day .meta { font-size: .875rem; color: var(--muted); margin-bottom: .3rem; }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.swatch.ship { background: var(--ship); } .swatch.family { background: var(--family); } .swatch.hotel { background: var(--hotel); } .swatch.flight { background: var(--flight); } .swatch.home { background: var(--home); }
.obs-note { color: var(--hotel); font-weight: 700; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 3.4rem 1fr; gap: .5rem; padding: .15rem 0; }
.events .t { color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }
.chip { display: inline-block; margin-top: .25rem; font-size: .8rem; padding: .1rem .5rem; border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; color: var(--muted); }
.chip:hover { color: var(--ink); border-color: var(--ink); }
@media (max-width: 560px) { .day { grid-template-columns: 1fr; gap: .25rem; } }

/* Bookings */
.bookings { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; }
.booking { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1rem 1.1rem; scroll-margin-top: 1rem; }
.booking:target { outline: 3px solid var(--signal); }
.booking h3 { font-size: 1.02rem; }
.booking .prov { font-size: .85rem; color: var(--muted); margin: .15rem 0 .6rem; }
.booking dl { margin: 0; display: grid; grid-template-columns: 5.5rem 1fr; gap: .2rem .6rem; font-size: .9rem; }
.booking dt { color: var(--muted); }
.booking dd { margin: 0; }
.booking .cost { margin-top: .75rem; padding-top: .6rem; border-top: 1px solid var(--rule); font-size: .9rem; }
.booking .cost strong { font-size: 1.05rem; }
.status-paid { color: var(--ok); font-weight: 700; }
.status-owed { color: var(--muted); }
.cancel { margin-top: .4rem; font-size: .85rem; }
.cancel.warn { color: var(--risk); font-weight: 700; }

/* To do */
.month { margin-top: 1.5rem; }
.month h3 { font-size: 1rem; color: var(--muted); font-family: var(--body); font-weight: 700; }
.tasks { list-style: none; margin: .4rem 0 0; padding: 0; }
.tasks li { display: grid; grid-template-columns: 5.5rem 1fr; gap: .75rem; padding: .45rem 0; border-top: 1px solid var(--rule); }
.tasks .d { color: var(--muted); font-size: .875rem; }
details { margin-top: 1.25rem; }
summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.done li { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--rule); }

/* Decisions */
.decisions { margin: 0; display: grid; grid-template-columns: 10rem minmax(0, 1fr); }
.decisions dt, .decisions dd { padding: .55rem 0; border-top: 1px solid var(--rule); margin: 0; }
.decisions dt { font-weight: 700; }
.decisions dd span { display: block; color: var(--muted); font-size: .875rem; }
@media (max-width: 560px) { .decisions { grid-template-columns: 1fr; } .decisions dd { border-top: 0; padding-top: 0; } }

/* Prices */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .6rem .55rem 0; border-top: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 700; color: var(--muted); border-top: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.pill { font-size: .78rem; font-weight: 700; padding: .05rem .45rem; border-radius: 3px; white-space: nowrap; }
.pill.bought { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.deciding { background: var(--signal); color: var(--signal-ink); }
.pill.not_planned { color: var(--muted); border: 1px solid var(--rule); }

.extras { margin-top: 1rem; }
.extra { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(0, 1.6fr) minmax(11rem, 1fr); gap: 1.25rem; padding: 1.1rem 0; border-top: 1px solid var(--rule); align-items: start; }
.extra:last-child { border-bottom: 1px solid var(--rule); }
.extra h3 { font-size: 1.02rem; }
.extra .unit { font-size: .82rem; color: var(--muted); }
.extra .price { font-family: var(--display); font-weight: 700; font-size: 1.6rem; margin-top: .35rem; line-height: 1.1; }
.extra .price small { font-family: var(--body); font-weight: 400; font-size: .8rem; color: var(--muted); }
.extra .delta { font-size: .85rem; color: var(--muted); }
.extra .delta.down { color: var(--ok); } .extra .delta.up { color: var(--risk); }
.extra .trip { font-size: .85rem; margin-top: .3rem; }
.spark { width: 100%; height: auto; display: block; overflow: visible; }
.spark .line { fill: none; stroke: var(--ship); stroke-width: 2.25; stroke-linejoin: round; }
.spark .target { stroke: var(--hotel); stroke-width: 1.5; stroke-dasharray: 5 4; }
.spark .paidline { stroke: var(--ok); stroke-width: 1.5; }
.spark .win { fill: color-mix(in srgb, var(--signal) 22%, transparent); }
.spark .dot { fill: var(--surface); stroke: var(--ship); stroke-width: 2; }
.spark .dot.last { fill: var(--ship); }
.spark text { font: 700 10px var(--body); }
.spark .tl { fill: var(--hotel); } .spark .pl { fill: var(--ok); } .spark .ax { fill: var(--muted); font-weight: 400; }
.extra .range { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.extra .notes { list-style: none; padding: 0; margin: .4rem 0 0; font-size: .82rem; color: var(--muted); }
.extra .notes b { color: var(--ink); font-weight: 700; margin-right: .3rem; }
.extra .side p { font-size: .88rem; margin: .45rem 0 0; }
.pill.alert { background: var(--risk); color: #fff; }
.pill.hit { background: var(--signal); color: var(--signal-ink); }
@media (max-width: 760px) { .extra { grid-template-columns: 1fr; gap: .6rem; } }
.tracker-meta { font-size: .875rem; color: var(--muted); }
footer { margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: .85rem; color: var(--muted); }
.error { background: var(--surface); border: 1px solid var(--risk); padding: 1rem; border-radius: var(--radius); }

/* Generic data-driven sections (notes) */
.note-block { margin-top: .5rem; }
.note-block ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.note-block li { padding: .15rem 0; }
.note-block .note-text { white-space: pre-line; max-width: var(--measure); }
