:root {
  --bg: #0e1118;
  --bg-elev: #161b26;
  --card: #1a2030;
  --card-2: #222a3d;
  --ink: #eef1f8;
  --ink-dim: #98a1ba;
  --ink-faint: #6b7590;
  --line: #2a3350;
  --accent: #ff7a45;
  --accent-ink: #1a0e06;
  --blue: #4aa8ff;
  --green: #3ecf8e;
  --amber: #f5c04e;
  --red: #ff6b6b;
  --purple: #a78bfa;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --shadow: 0 4px 20px rgba(0, 0, 0, .35);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --bg-elev: #ffffff;
    --card: #ffffff;
    --card-2: #f0f2f8;
    --ink: #131826;
    --ink-dim: #5b6480;
    --ink-faint: #8992a8;
    --line: #e0e4ee;
    --accent: #e2571f;
    --accent-ink: #ffffff;
    --blue: #1d76d6;
    --green: #17936a;
    --amber: #a9720a;
    --red: #d33;
    --purple: #6d47d9;
    --shadow: 0 2px 14px rgba(20, 25, 45, .08);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body {
  padding-bottom: calc(72px + var(--safe-b));
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.25; }

.wrap { max-width: 680px; margin: 0 auto; padding: 0 14px; }

/* ------------------------------------------------------------------ header */

header.top {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-inner { max-width: 680px; margin: 0 auto; padding: 10px 14px; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand h1 { font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.brand .sub { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }
.brand-right { text-align: right; font-size: 11px; color: var(--ink-faint); }

.net-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); margin-right: 5px; vertical-align: middle;
}
.net-dot.off { background: var(--amber); }

/* ------------------------------------------------------------------- hero */

.hero {
  margin-top: 10px; border-radius: var(--r-lg); padding: 15px 16px;
  background: linear-gradient(135deg, var(--card-2), var(--card));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.hero .kicker {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 800; color: var(--accent);
}
.hero .headline { font-size: 19px; font-weight: 750; margin-top: 3px; letter-spacing: -.015em; }
.hero .detail { font-size: 13px; color: var(--ink-dim); margin-top: 5px; }
.hero.urgent { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.hero.urgent .kicker { color: var(--red); }

/* Compact variant — the countdown is pinned above every screen, so it is
   kept to a single row to leave the content below room to breathe. */
.hero.compact { padding: 10px 13px; margin-top: 8px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-main { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.hero.compact .headline {
  font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin: 0;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.hero.compact .headline .u {
  font-size: 12px; font-weight: 650; color: var(--ink-faint); margin-left: 1px; margin-right: 3px;
}
.hero.compact .detail { font-size: 11.5px; margin: 0; white-space: nowrap; }
.hero-side { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; flex: 0 0 auto; }

/* ------------------------------------------------------------------- tabs */

nav.tabs { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs button {
  flex: 0 0 auto; background: var(--card); border: 1px solid var(--line);
  color: var(--ink-dim); padding: 7px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 650; white-space: nowrap;
}
nav.tabs button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

main { max-width: 680px; margin: 0 auto; padding: 14px; }
section.view { display: none; animation: fade .18s ease; }
section.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; margin-bottom: 12px;
}
.card > h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-faint); font-weight: 750; margin-bottom: 10px;
}
.muted { color: var(--ink-dim); }
.small { font-size: 12.5px; }
.tiny { font-size: 11px; }

/* ------------------------------------------------------------- prep tasks */

.group-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 18px 0 8px;
}
.group-head h2 { font-size: 15px; font-weight: 750; }
.group-head .prog { font-size: 11.5px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.group-done { opacity: .5; }

.bar { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.bar > i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }

.task {
  display: flex; gap: 11px; padding: 12px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  transition: opacity .2s, border-color .2s;
}
.task.overdue { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.task.soon { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.task.done, .task.skipped { opacity: .42; }
.task.done .t-title { text-decoration: line-through; }

.tick {
  flex: 0 0 24px; width: 24px; height: 24px; margin-top: 1px;
  border-radius: 8px; border: 2px solid var(--line); background: transparent;
  display: grid; place-items: center; font-size: 13px; color: transparent;
  transition: all .15s;
}
.task.done .tick { background: var(--green); border-color: var(--green); color: #04150d; }
.task.skipped .tick { background: var(--ink-faint); border-color: var(--ink-faint); color: var(--bg); }

.t-body { flex: 1; min-width: 0; }
.t-title { font-weight: 680; font-size: 14px; }
.t-why { font-size: 12.5px; color: var(--ink-dim); margin-top: 3px; }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; align-items: center; }

.pill {
  font-size: 10px; font-weight: 750; letter-spacing: .03em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 6px; background: var(--card-2); color: var(--ink-dim);
}
.pill.red { background: color-mix(in srgb, var(--red) 20%, transparent); color: var(--red); }
.pill.amber { background: color-mix(in srgb, var(--amber) 20%, transparent); color: var(--amber); }
.pill.green { background: color-mix(in srgb, var(--green) 20%, transparent); color: var(--green); }
.pill.blue { background: color-mix(in srgb, var(--blue) 20%, transparent); color: var(--blue); }
.pill.purple { background: color-mix(in srgb, var(--purple) 22%, transparent); color: var(--purple); }

.t-expand {
  margin-top: 9px; padding: 10px; border-radius: var(--r-sm);
  background: var(--card-2); font-size: 12.5px; line-height: 1.55;
}
.t-expand p { margin: 0 0 7px; }
.t-expand p:last-child { margin-bottom: 0; }
.t-expand .lbl { font-weight: 750; color: var(--ink); }

.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.btn {
  border: 1px solid var(--line); background: var(--card-2); color: var(--ink);
  border-radius: 9px; padding: 6px 11px; font-size: 12px; font-weight: 650;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.wide { flex: 1; text-align: center; }

.warn {
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; line-height: 1.5;
  background: color-mix(in srgb, var(--amber) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
  color: color-mix(in srgb, var(--amber) 85%, var(--ink));
  margin-top: 8px;
}
.warn.danger {
  background: color-mix(in srgb, var(--red) 12%, transparent);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
  color: color-mix(in srgb, var(--red) 85%, var(--ink));
}

/* ---------------------------------------------------------- timeline items */

.item {
  display: flex; gap: 10px; padding: 11px; border-radius: var(--r);
  border: 1px solid transparent; background: var(--card); margin-bottom: 7px;
}
.item.past { opacity: .4; }
.item.now {
  border-color: var(--accent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--card)), var(--card));
}
.item.next { border-color: var(--blue); }
.item.done { opacity: .42; }
.item.done .i-title { text-decoration: line-through; }

.i-time {
  flex: 0 0 52px; font-size: 12.5px; font-weight: 750; color: var(--ink-faint);
  padding-top: 2px; font-variant-numeric: tabular-nums;
}
.item.now .i-time { color: var(--accent); }
.item.next .i-time { color: var(--blue); }
.i-body { flex: 1; min-width: 0; }
.i-title { font-weight: 680; font-size: 14px; }
.i-note { font-size: 12.5px; color: var(--ink-dim); margin-top: 3px; }

.cat { font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; padding: 2px 6px; border-radius: 5px; }
.cat.flight  { background: color-mix(in srgb, var(--blue) 22%, transparent); color: var(--blue); }
.cat.transit { background: color-mix(in srgb, var(--ink-faint) 25%, transparent); color: var(--ink-dim); }
.cat.sight   { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); }
.cat.food    { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.cat.hotel   { background: color-mix(in srgb, var(--green) 22%, transparent); color: var(--green); }
.cat.free    { background: color-mix(in srgb, var(--purple) 22%, transparent); color: var(--purple); }
.cat.routine { background: var(--card-2); color: var(--ink-faint); }
.cat.admin   { background: var(--card-2); color: var(--ink-faint); }

/* ------------------------------------------------------------- place cards */

.place-card {
  border-radius: var(--r-lg); overflow: hidden; background: var(--card);
  border: 1px solid var(--line); margin-bottom: 12px; box-shadow: var(--shadow);
}
.place-hero { position: relative; aspect-ratio: 16 / 9; background: var(--card-2); }
.place-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.place-hero .fallback {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 40px; opacity: .3;
}
.place-hero .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 11px;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent); color: #fff;
}
.place-hero .cap h3 { font-size: 18px; font-weight: 750; letter-spacing: -.015em; }
.place-hero .cap .loc { font-size: 11.5px; opacity: .85; margin-top: 1px; }

.place-body { padding: 13px 14px 14px; }
.place-hook { font-size: 14px; font-weight: 650; line-height: 1.45; }
.place-story { font-size: 13.5px; line-height: 1.62; color: var(--ink-dim); margin-top: 9px; }

.sect { margin-top: 13px; }
.sect h4 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-faint); font-weight: 800; margin: 0 0 6px;
}
.sect ul { margin: 0; padding-left: 17px; font-size: 12.8px; line-height: 1.62; color: var(--ink-dim); }
.sect ul li { margin-bottom: 4px; }
.sect ul.watch li { color: color-mix(in srgb, var(--amber) 75%, var(--ink)); }

.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }

.phrase {
  display: flex; justify-content: space-between; gap: 10px; padding: 6px 0;
  border-bottom: 1px dashed var(--line); font-size: 12.5px;
}
.phrase:last-child { border-bottom: none; }
.phrase .it { font-weight: 650; font-style: italic; }
.phrase .en { color: var(--ink-faint); }

/* ------------------------------------------------------------- info tables */

.row {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
  border-bottom: 1px dashed var(--line); font-size: 13px;
}
.row:last-child { border-bottom: none; }
.row .k { color: var(--ink-dim); flex: 0 0 auto; }
.row .v { text-align: right; font-weight: 650; word-break: break-word; }
.row .v.mono { font-variant-numeric: tabular-nums; letter-spacing: .01em; }

/* ------------------------------------------------------------------ chat */

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 8px 14px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--line);
}
.dock-inner { max-width: 680px; margin: 0 auto; display: flex; gap: 7px; }
.dock button {
  flex: 1; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 10px 6px; font-size: 11.5px; font-weight: 650;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.dock button .ic { font-size: 17px; line-height: 1; }
.dock button:disabled { opacity: .38; }
.dock button.hot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.sheet {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: color-mix(in srgb, #000 55%, transparent);
  backdrop-filter: blur(3px);
}
.sheet.open { display: block; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 88vh; display: flex; flex-direction: column;
  background: var(--bg-elev); border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  animation: rise .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.sheet-head h3 { font-size: 15px; font-weight: 750; }
.sheet-head .sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }
.sheet-close {
  border: none; background: var(--card-2); color: var(--ink-dim);
  width: 30px; height: 30px; border-radius: 50%; font-size: 17px; line-height: 1;
}

.chat-log { flex: 1; overflow-y: auto; padding: 14px 16px; -webkit-overflow-scrolling: touch; }
.msg { margin-bottom: 13px; font-size: 14px; line-height: 1.6; }
.msg.you { text-align: right; }
.msg.you .bubble {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  padding: 8px 13px; border-radius: 15px 15px 4px 15px; max-width: 85%; text-align: left;
  font-weight: 600;
}
.msg.guide .bubble {
  background: var(--card); border: 1px solid var(--line);
  padding: 11px 13px; border-radius: 15px 15px 15px 4px;
}
.msg .who {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-faint); font-weight: 800; margin-bottom: 4px;
}
.msg .srcs { margin-top: 7px; font-size: 11px; }
.msg .srcs a { display: block; color: var(--blue); margin-top: 2px; }

.typing { display: flex; gap: 4px; padding: 4px 0; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint);
  animation: blink 1.3s infinite;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 9px 16px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-dim); border-radius: 999px; padding: 6px 12px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}

.chat-input { display: flex; gap: 8px; padding: 11px 16px 14px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; background: var(--card); border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; padding: 11px 13px; font-size: 16px; font-family: inherit;
}
.chat-input input:focus { outline: none; border-color: var(--accent); }
.chat-input button {
  border: none; background: var(--accent); color: var(--accent-ink);
  border-radius: 12px; padding: 0 17px; font-size: 15px; font-weight: 750;
}
.chat-input button:disabled { opacity: .4; }

/* ---------------------------------------------------------------- day pick */

/* Day picker — a wrapping grid, not a scroller. All 9 days must be visible
   at once on a phone; a horizontal scroller hid days 6-9 off-screen with
   no affordance that they existed. */
.days {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  margin-bottom: 12px;
}
@media (min-width: 480px) { .days { grid-template-columns: repeat(9, 1fr); } }

.day-chip {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 2px; text-align: center;
  min-width: 0; overflow: hidden;
}
.day-chip.active { background: var(--accent); border-color: var(--accent); }
.day-chip.active .dn, .day-chip.active .dd { color: var(--accent-ink); }
.day-chip.today { box-shadow: inset 0 0 0 2px var(--blue); }
.day-chip .dn { font-size: 11px; font-weight: 750; white-space: nowrap; }
.day-chip .dd { font-size: 9.5px; color: var(--ink-faint); white-space: nowrap; }

/* ------------------------------------------------------------- day tiles */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(3, 1fr); } }

.tile {
  display: block; padding: 0; text-align: left; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--ink);
  transition: transform .12s, border-color .12s;
}
.tile:active { transform: scale(.975); }
.tile.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tile.past { opacity: .5; }

.tile-img {
  position: relative; aspect-ratio: 3 / 2; background: var(--card-2);
  display: grid; place-items: center;
}
/* The emoji sits underneath as a placeholder; the photo fades in over it
   once decoded. Avoids an empty grey box while lazy images load. */
.tile-img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .25s;
}
.tile-img img.on { opacity: 1; }
.tile-emoji { font-size: 26px; opacity: .5; }

.tile-txt { padding: 8px 9px 10px; }
.tile-day {
  font-size: 10px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
}
.tile.past .tile-day { color: var(--ink-faint); }
.tile-title {
  font-size: 12.5px; font-weight: 680; line-height: 1.3; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-date { font-size: 10.5px; color: var(--ink-faint); margin-top: 3px; }

.acc-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 13px 4px; border-bottom: 1px solid var(--line);
}
.acc-head h3 { font-size: 14px; font-weight: 680; }
.acc-head .arrow { color: var(--ink-faint); transition: transform .2s; }
.acc-head.open .arrow { transform: rotate(90deg); }
.acc-body { display: none; padding: 10px 0; }
.acc-body.open { display: block; }

.empty { text-align: center; padding: 34px 16px; color: var(--ink-faint); }
.empty .ic { font-size: 34px; opacity: .5; margin-bottom: 8px; }

footer.foot {
  max-width: 680px; margin: 22px auto 0; padding: 0 14px 10px;
  color: var(--ink-faint); font-size: 10.5px; text-align: center; line-height: 1.6;
}

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--line); color: var(--ink);
  padding: 9px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 650;
  box-shadow: var(--shadow); z-index: 70; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
