:root {
  --bg: #f6f3ee;
  --panel: #ffffff;
  --ink: #1a1a1c;
  --muted: #6b6b70;
  --rule: #e2ded6;
  --s1: #1e6fe8;
  --s2: #d2431a;
  --accent: #d2431a;
  --accent-ink: #ffffff;
  --done: #1f8a3b;
  --done-bg: #e6f4ea;
  --warn: #9a6400;
  --warn-bg: #fff3d6;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --chip: #ecebe6;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --panel: #1c1c20; --ink: #f2f0ea; --muted: #9a9aa2; --rule: #2c2c33;
    --s1: #5b9bff; --s2: #ff7a4d; --accent: #ff7a4d; --accent-ink: #1a1a1c;
    --done: #4fc36f; --done-bg: #16301d; --warn: #f0b84a; --warn-bg: #33270c;
    --danger: #ff7b72; --danger-bg: #3a1815; --chip: #2a2a30; --shadow: none;
  }
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.num { font-variant-numeric: tabular-nums; }

/* header */
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  min-height: 56px; padding: 0 16px; background: var(--bg); border-bottom: 1px solid var(--rule);
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -.01em; text-decoration: none; }
#who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
#who button { min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--muted); text-decoration: underline; }

/* layout */
main { max-width: 600px; margin: 0 auto; padding: 16px 16px 24px; }
section + section, .card + .card, h2 + .card { margin-top: 14px; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 14px; }
h2 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 10px; }
h2:first-of-type { margin-top: 4px; }
.empty { color: var(--muted); padding: 24px 0; }
.back { display: inline-flex; align-items: center; min-height: 44px; margin: -8px 0 4px -6px; padding: 0 6px; color: var(--muted); text-decoration: none; font-weight: 600; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow); padding: 16px; }
.card-main { display: block; text-decoration: none; }
.card-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.card-sub { color: var(--muted); margin-top: 3px; font-size: 15px; }
.card-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 14px; }
.row-card { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; }
.row-card .card-main { flex: 1; min-width: 0; }
.row-card .card-title { font-size: 18px; }
.label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.big { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.note { color: var(--muted); font-size: 15px; margin-top: 6px; }
.caution { display: inline-block; margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 15px; }

/* due + chips */
.due { margin-top: 8px; font-weight: 700; }
.due-soon { color: var(--warn); }
.due-over { color: var(--danger); }
.chip { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 999px; font-size: 14px; font-weight: 600; background: var(--chip); color: var(--muted); }
.chip-offered { background: var(--warn-bg); color: var(--warn); }
.chip-accepted { background: #e3edff; color: var(--s1); }
.chip-declined { background: var(--danger-bg); color: var(--danger); }
.chip-done { background: var(--done-bg); color: var(--done); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip-accepted { background: #1a2a4a; } }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 18px;
  border-radius: 12px; border: 2px solid transparent; font-weight: 700; font-size: 17px; text-decoration: none; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-outline { background: var(--panel); border-color: var(--rule); color: var(--ink); }
.btn-done { background: var(--done); color: #fff; }
.btn-small { width: auto; min-height: 44px; padding: 0 14px; font-size: 15px; background: var(--panel); border-color: var(--rule); }
.btn-google { background: var(--panel); border-color: var(--rule); }
.btn-google .g { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #4285f4; font-weight: 800; border: 1px solid #ddd; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.btn-row .btn { font-size: 15px; padding: 0 8px; margin-top: 0; }
.card .btn { margin-top: 12px; }

/* sign in */
.signin { max-width: 380px; margin: 20px auto 0; text-align: center; }
.splash { border-radius: 16px; overflow: hidden; border: 1px solid var(--rule); background: var(--panel); box-shadow: var(--shadow); margin-bottom: 22px; }
.splash img { display: block; width: 100%; height: auto; }
.wordmark { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.lede { color: var(--muted); margin: 6px 0 28px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.signin form { display: grid; gap: 10px; text-align: left; }
.signin label { font-weight: 600; font-size: 15px; }
.hint { color: var(--muted); font-size: 14px; margin-top: 14px; }
input[type=email], input[type=text], input[type=date] {
  width: 100%; min-height: 52px; padding: 0 14px; font: inherit; color: var(--ink); background: var(--panel);
  border: 2px solid var(--rule); border-radius: 12px;
}
input:focus-visible, .btn:focus-visible, .line:focus-visible { outline: 2.5px solid var(--s1); outline-offset: 2px; }

/* route page */
.route-head { padding: 4px 0 14px; }
.route-id { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.s1 .route-id { color: var(--s1); } .s2 .route-id { color: var(--s2); }
.route-head h1 { margin-bottom: 4px; }
.route-meta { color: var(--muted); font-size: 15px; }
.map { display: block; aspect-ratio: 1734 / 962; border-radius: 14px; overflow: hidden; border: 1px solid var(--rule); background: #fff; margin-bottom: 14px; }
.map img { display: block; width: 100%; height: 100%; object-fit: contain; }
.map img:not([src]) { visibility: hidden; }
.map-hint { display: block; text-align: center; color: var(--muted); font-size: 13px; margin: -8px 0 14px; }

/* progress */
.progress { display: flex; align-items: center; gap: 12px; margin: 6px 0 10px; }
.progress .track { flex: 1; height: 10px; border-radius: 999px; background: var(--rule); overflow: hidden; }
.progress .fill { height: 100%; background: var(--done); border-radius: 999px; transition: width .2s; }
@media (prefers-reduced-motion: reduce) { .progress .fill { transition: none; } }
.progress .count { font-weight: 700; white-space: nowrap; }

/* street list */
.lines { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; }
.lines li + li { border-top: 1px solid var(--rule); }
.line {
  display: grid; grid-template-columns: 28px 27px 1fr; grid-template-areas: "idx tick street" "idx tick range";
  align-items: center; column-gap: 12px; row-gap: 1px;
  width: 100%; min-height: 58px; padding: 9px 14px; border: 0; background: none; text-align: left; cursor: pointer;
}
.line .idx { grid-area: idx; color: var(--muted); font-size: 14px; font-weight: 600; }
.line .tick { grid-area: tick; width: 27px; height: 27px; border: 2px solid var(--muted); border-radius: 7px; position: relative; }
.line .street { grid-area: street; font-size: 19px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.line .range { grid-area: range; font-size: 16px; font-variant-numeric: tabular-nums; line-height: 1.25; }
.line.done .tick { background: var(--done); border-color: var(--done); }
.line.done .tick::after { content: ""; position: absolute; left: 8px; top: 3px; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.line.done .street { text-decoration: line-through; color: var(--muted); }
.line.conn { cursor: default; }
.line.conn .tick { visibility: hidden; }
.line.conn .street, .line.conn .range { color: var(--muted); font-style: italic; font-weight: 500; font-size: 16px; }
.line:disabled { cursor: default; }

/* action bar */
.actionbar {
  position: sticky; bottom: 0; z-index: 4; background: var(--bg); border-top: 1px solid var(--rule);
  margin: 16px -16px -24px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.actionbar .inner { max-width: 600px; margin: 0 auto; display: grid; gap: 10px; }
.actionbar .inner.two { grid-template-columns: 1fr 1.6fr; }
.banner { background: var(--done-bg); color: var(--done); font-weight: 700; text-align: center; padding: 14px; border-radius: 12px; }

/* sheet */
#sheet { position: fixed; inset: 0; z-index: 10; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 600px; margin: 0 auto; background: var(--panel);
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.2);
}
.sheet h2 { margin: 0 0 14px; font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.sheet form { display: grid; gap: 10px; }
.sheet label { font-weight: 600; font-size: 15px; display: grid; gap: 4px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; margin-top: 6px; }
.sheet .stack { display: grid; gap: 10px; }
.sheet p { margin: 0 0 12px; color: var(--muted); }

.session-title { display: flex; align-items: baseline; gap: 8px; }
.session-title small { font-weight: 500; text-transform: none; letter-spacing: 0; }
