:root {
  --bg: #faf6f5;
  --surface: #ffffff;
  --ink: #221417;
  --ink2: #6a585b;
  --line: #ebdfe1;
  --soft: #f1e8e9;
  --bar: #d9cbcd;
  --accent: #7b1e30;
  --accent-ink: #ffffff;
  --accent-fg: #7b1e30;
  --thumb: #ffffff;
  --tint: #f6e8eb;
  --tint-ink: #5c1523;
  --amber-bg: #fbf1e4;
  --amber-ink: #7a4508;
  --radius: 16px;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #161012;
  --surface: #221a1c;
  --ink: #f2e9ea;
  --ink2: #b9a8ab;
  --line: #3a2d30;
  --soft: #2e2326;
  --bar: #4a3b3e;
  --accent: #b8435a;
  --accent-ink: #ffffff;
  --accent-fg: #e08497;
  --thumb: #46383b;
  --tint: #3a2028;
  --tint-ink: #f0c4cd;
  --amber-bg: #3a2a12;
  --amber-ink: #f2c98a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.4 "IBM Plex Sans", system-ui, sans-serif;
  padding-bottom: 150px;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-fg); }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }

#view { max-width: 560px; margin: 0 auto; padding: 16px 16px 24px; display: flex; flex-direction: column; gap: 14px; }

/* header */
/* grid: subtitle above the title, the back button on the title's first line */
.head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 4px; align-items: start; margin: 2px 0 0; }
.head-text { display: contents; }
.head h1, .head .sub { grid-column: 2; min-width: 0; }
.head h1 { margin: 0; font-size: 24px; line-height: 1.15; letter-spacing: -0.3px; }
.head .sub { color: var(--ink2); font-size: 14px; }
.head:has(.sub) .back { grid-row: 2; }
.back { grid-column: 1; width: 44px; height: 44px; margin: -8px 0 -8px -12px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--ink); border-radius: 12px; cursor: pointer; }
.brand { display: flex; align-items: center; justify-content: space-between; }
.pill { padding: 5px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; color: var(--ink2); }
.pill b { font-family: var(--mono); color: var(--ink); font-weight: 600; }

/* cards and fields */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card.hl { border: 2px solid var(--accent); }
.card.flush { padding: 4px 16px; gap: 0; }
.card h2, .section-title { margin: 0; font-size: 15px; font-weight: 700; }
.section-title { font-size: 12px; font-weight: 600; color: var(--ink2); text-transform: uppercase; letter-spacing: 0.6px; padding: 4px 4px 0; }
.muted { color: var(--ink2); }
.group { display: flex; flex-direction: column; gap: 8px; }
.hint { padding: 0 4px; font-size: 13px; color: var(--ink2); }
.grid2 + .hint { margin-top: -6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.route { position: relative; }
.route .field { padding: 12px 52px 12px 0; }
.route .field + .field { border-top: 1px solid var(--soft); }
.field { display: flex; flex-direction: column; gap: 2px; position: relative; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink2); text-transform: uppercase; letter-spacing: 0.5px; }
.field input { border: 0; padding: 0; background: transparent; font-size: 18px; font-weight: 600; outline: none; width: 100%; }
.swap { position: absolute; right: 14px; top: 50%; margin-top: -22px; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.box { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.box > span:first-child { font-size: 12px; font-weight: 600; color: var(--ink2); }
.field input::placeholder, .box input::placeholder { color: var(--ink2); opacity: 0.7; font-weight: 400; }
.box input { border: 0; padding: 0; background: transparent; font-size: 18px; font-weight: 600; outline: none; width: 100%; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,0.12); overflow: hidden; }
.suggest button { display: block; width: 100%; text-align: left; padding: 12px 14px; border: 0; background: none; font-size: 15px; cursor: pointer; }
.suggest button + button { border-top: 1px solid var(--soft); }
.recent { min-height: 44px; padding: 10px 0; gap: 12px; }
.recent > a { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; text-decoration: none; color: inherit; }
.icon-btn { flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
.again { padding: 4px 2px; }
.again .btn svg { width: 16px; height: 16px; margin-right: 4px; }
.refresh-row { padding-bottom: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.recent + .recent { border-top: 1px solid var(--soft); }

/* segmented control and chips */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; background: var(--soft); border-radius: 12px; }
.seg::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px - (var(--n, 1) - 1) * 4px) / var(--n, 1)); transform: translateX(calc(var(--i, 0) * (100% + 4px))); background: var(--thumb); border-radius: 9px; box-shadow: 0 1px 2px rgba(0,0,0,0.12); transition: transform 0.28s cubic-bezier(0.3, 0.8, 0.2, 1); }
.seg[data-thumb="off"]::before { opacity: 0; }
.seg.still::before { transition: none; }
.seg button { position: relative; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--ink2); font-weight: 500; cursor: pointer; transition: color 0.2s; }
.seg button[aria-pressed="true"] { color: var(--accent-fg); font-weight: 600; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::after { content: ""; flex: 0 0 8px; }
.chips .chips { margin: 0; padding: 0; overflow: visible; }
.chips .chips::after { content: none; }
.chip-sep { flex: 0 0 1px; align-self: center; height: 20px; background: var(--line); }
.chip { flex-shrink: 0; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); white-space: nowrap; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--amber-bg); color: var(--amber-ink); font-size: 13px; }
.note svg { width: 18px; height: 18px; margin-top: 1px; }
.banner > span { flex: 1; }
.banner { display: flex; gap: 10px; align-items: center; min-height: 44px; padding: 12px 14px; border-radius: 14px; background: var(--tint); color: var(--tint-ink); font-size: 14px; text-decoration: none; }

/* buttons */
.btn { height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.outline { border: 1.5px solid var(--accent); color: var(--accent-fg); background: var(--surface); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink2); font-weight: 500; }
.btn.block { width: 100%; height: 50px; font-size: 16px; }
.btn.small-btn { position: relative; height: 36px; padding: 0 6px 0 10px; font-size: 13px; flex-shrink: 0; }
.btn.small-btn::before { content: ""; position: absolute; inset: -4px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 0; white-space: nowrap; }
.actions .btn.primary { flex-basis: 100%; }

/* bottom: main button (outside Telegram) and tab bar */
#bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; }
#mainbar { padding: 8px 16px 10px; background: var(--surface); border-top: 1px solid var(--line); }
#mainbar .btn { max-width: 528px; margin: 0 auto; display: flex; }
#mainbar:not([hidden]) { animation: bar-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
#tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
#tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: var(--ink2); font-size: 11px; font-weight: 500; }
#tabs a[aria-current="page"] { color: var(--accent-fg); font-weight: 600; }
.tab-badge { position: absolute; top: 2px; left: 56%; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* progress */
.progress { background: var(--accent); color: var(--accent-ink); border-radius: 20px; padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.progress .big { font-size: 52px; font-weight: 700; line-height: 1; letter-spacing: -1.5px; }
.track { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.25); overflow: hidden; }
.track i { display: block; height: 100%; background: #fff; border-radius: 4px; transition: width 0.4s; }
.track.indeterminate i { width: 30% !important; animation: slide 1.2s infinite ease-in-out; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.steps { list-style: none; margin: 0; padding: 6px 16px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.steps li + li { border-top: 1px solid var(--soft); }
.dot { width: 24px; height: 24px; border-radius: 12px; border: 2px solid var(--bar); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dot.done { border: 0; background: var(--tint); color: var(--accent-fg); }
.dot.done svg { width: 14px; height: 14px; stroke-width: 3; }
.dot.now { border: 2.5px solid var(--accent); }
.dot.now::after { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.steps .now-label { font-weight: 600; }

/* result cards */
.times { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: -0.5px; }
.trains { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.train { padding: 3px 8px; border-radius: 6px; background: var(--soft); font-weight: 600; }
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 12px; border-top: 1px solid var(--soft); }
.figures div { display: flex; flex-direction: column; gap: 2px; }
.figures span { font-size: 12px; color: var(--ink2); }
.figures b { font-size: 18px; }
.figures .accent { color: var(--accent-fg); }
.p-total { font-size: 28px; color: var(--accent-fg); }
.tag { white-space: nowrap; flex-shrink: 0; padding: 4px 8px; border-radius: 6px; background: var(--soft); font-size: 12px; font-weight: 600; }
.tag.lm { background: var(--amber-bg); color: var(--amber-ink); }
.tag.status { border-radius: 999px; padding: 4px 10px; }
.tag.lifted { background: var(--tint); color: var(--tint-ink); }
.tag.solid { background: var(--accent); color: var(--accent-ink); }

/* details */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 10px; background: var(--bg); }
.tiles span { font-size: 12px; color: var(--ink2); }
.tiles b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; font-size: 14px; }
.kv b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; align-items: end; height: 120px; border-bottom: 1px solid var(--bar); }
.bars.short { height: 90px; }
.bars div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; font-size: 11px; color: var(--ink2); }
.bars i { display: block; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--bar); }
.bars .lift { color: var(--accent-fg); font-weight: 600; }
.bars .lift i { background: var(--accent); }
.bar-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; font-size: 10px; color: var(--ink2); text-align: center; }
figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
figcaption { font-size: 12px; font-weight: 600; color: var(--ink2); }
.ranges { display: grid; grid-template-columns: minmax(88px, 1.2fr) minmax(0, 2fr) auto; gap: 8px 10px; align-items: center; font-size: 13px; }
.range { position: relative; height: 8px; border-radius: 4px; background: var(--soft); }
.range i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--bar); }
.range b { position: absolute; top: -3px; width: 3px; height: 14px; background: var(--accent); }
.wf { display: flex; flex-direction: column; gap: 12px; }
.wf-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.wf-row > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wf-row small { font-size: 12px; }
.wf-row > b { font-variant-numeric: tabular-nums; text-align: right; }
.wf-row > b.up { color: var(--accent-fg); }
.wf-row > b.down { color: var(--ink2); }
.wf-row.base, .wf-row.total { font-weight: 600; }
.wf-row.total { padding-top: 10px; border-top: 1px solid var(--soft); }
.wf-bar { grid-column: 1 / -1; position: relative; height: 8px; border-radius: 4px; background: var(--soft); }
.wf-bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; transform-origin: left; animation: grow-x 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--d, 0) * 60ms + 150ms); }
.wf-bar i.up { background: var(--accent); }
.wf-bar i.down { background: var(--ink2); transform-origin: right; }
.wf-bar i.mark { width: 3px; top: -3px; bottom: -3px; margin-left: -1px; background: var(--ink); animation: none; }
.wf-more { grid-column: 1 / -1; }
.wf-more summary { cursor: pointer; color: var(--accent-fg); padding: 2px 0; }
.wf-more .kv { padding-top: 8px; }
.kv.chain { font-size: 13px; }
.kv-link { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--soft); text-decoration: none; font-weight: 600; }
.kv-link svg { width: 18px; height: 18px; }
.nowrap { white-space: nowrap; }
@keyframes grow-x { from { transform: scaleX(0); } }

/* tickets */
.ticket-today { background: var(--accent); color: var(--accent-ink); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; text-decoration: none; }
.ticket-card { text-decoration: none; color: var(--ink); }
.ticket-head { display: flex; flex-direction: column; gap: 2px; }
.ticket-head > b { font-size: 17px; }
.ticket-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 0 10px; padding: 6px 0; font-size: 14px; }
.timeline .t { font-family: var(--mono); font-weight: 600; }
.timeline .arr { text-align: right; color: var(--ink2); font-weight: 500; }
.timeline li.timeline-head { padding-top: 0; font-size: 12px; font-weight: 600; color: var(--ink2); }
.timeline-head span:last-child { text-align: right; }
.files { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.files img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.files figure { gap: 4px; }

#toast { position: fixed; left: 16px; right: 16px; bottom: 160px; max-width: 528px; margin: 0 auto; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14px; z-index: 20; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
#toast.show { opacity: 1; transform: none; }
.error { background: var(--tint); color: var(--tint-ink); border-radius: 12px; padding: 12px 14px; }
.empty { text-align: center; color: var(--ink2); padding: 24px 8px; }

/* start: splash, state screens, welcome */
.splash { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--accent-fg); }
.splash-mark { width: 48px; height: 48px; stroke-width: 1.6; }
.splash-name { font-size: 20px; font-weight: 700; color: var(--ink); letter-spacing: -0.2px; }
.splash-bar { width: 120px; height: 4px; border-radius: 2px; background: var(--soft); overflow: hidden; }
.splash-bar i { display: block; width: 40%; height: 100%; border-radius: 2px; background: var(--accent); animation: slide 1.2s infinite ease-in-out; }
.state { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 0 12px; }
.state h1 { margin: 6px 0 0; font-size: 22px; }
.state p { margin: 0 0 8px; color: var(--ink2); max-width: 34ch; }
.state-icon { width: 64px; height: 64px; border-radius: 20px; background: var(--tint); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; }
.state-icon svg { width: 30px; height: 30px; }
.prose p, .prose ul { margin: 0; }
.prose ul { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.prose h2 + p { margin-top: -4px; }
.lead { margin: 0; color: var(--ink2); padding: 0 4px; }
.how { list-style: none; margin: 0; padding: 4px 16px; }
.how li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding: 12px 0; align-items: start; }
.how li + li { border-top: 1px solid var(--soft); }
.how .num { width: 28px; height: 28px; border-radius: 14px; background: var(--tint); color: var(--accent-fg); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.empty-state { align-items: center; text-align: center; padding: 24px 16px; }
.chat-hint { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 0; }
.chat-hint .hint { padding: 0; }
.link-card { text-decoration: none; color: inherit; flex-direction: row; }
.btn svg + * { margin-left: 0; }

/* watches */
.watch-summary { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--ink); color: var(--bg); }
.watch-summary div { display: flex; flex-direction: column; gap: 2px; }
.watch-summary span { font-size: 13px; opacity: 0.85; }
.watch-card { gap: 10px; }
.watch-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.watch-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 44px; text-decoration: none; color: inherit; }
.watch-main b { font-size: 17px; }
.watch-card.paused .watch-main b, .watch-card.paused .limit-chips { color: var(--ink2); }
.limit-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.watch-next { display: flex; align-items: center; gap: 6px; color: var(--ink2); }
.watch-next svg { width: 16px; height: 16px; }
.watch-last { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; margin-bottom: -6px; padding-top: 8px; border-top: 1px solid var(--soft); font-size: 13px; color: var(--ink); text-decoration: none; }
.watch-last svg { width: 18px; height: 18px; color: var(--ink2); }
.switch { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 44px; flex-shrink: 0; cursor: pointer; }
.switch input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch .track { position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--bar); transition: background 0.2s; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: transform 0.22s cubic-bezier(0.3, 0.8, 0.2, 1); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent-fg); outline-offset: 2px; }
.switch input:disabled + .track { opacity: 0.6; }
.switch-row { flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; }
.daychips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.daychips .chip { height: 44px; padding: 0; border-radius: 12px; font-weight: 500; }
.select { position: relative; display: flex; align-items: center; }
.select svg { position: absolute; right: 0; width: 18px; height: 18px; pointer-events: none; color: var(--ink2); }
.box select { border: 0; padding: 0 22px 0 0; background: transparent; font-size: 18px; font-weight: 600; outline: none; width: 100%; appearance: none; cursor: pointer; }

/* admin */
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.stat > span:first-child { font-size: 12px; font-weight: 600; color: var(--ink2); }
.stat b { font-size: 17px; overflow-wrap: anywhere; }
.stat .small { color: var(--ink2); }
.stat.wide { grid-column: 1 / -1; }
.stat.warn { background: var(--amber-bg); border-color: transparent; color: var(--amber-ink); }
.stat.warn > span:first-child, .stat.warn .small { color: var(--amber-ink); }
.meter { height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transform-origin: left; animation: widen 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.daybars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; align-items: end; height: 120px; border-bottom: 1px solid var(--bar); }
.daybars > div { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; gap: 2px; height: 100%; font-size: 11px; color: var(--ink2); text-align: center; }
.daybars i { display: block; border-radius: 4px 4px 0 0; background: var(--bar); transform-origin: bottom; animation: grow 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.daybars i.bad { border-radius: 4px 4px 0 0; background: var(--amber-ink); }
.daybars i.bad + i { border-radius: 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--bar); }
.legend i.bad { background: var(--amber-ink); }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; }
.user-row + .user-row { border-top: 1px solid var(--soft); }
.user-row > div:first-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-row b { overflow-wrap: anywhere; }
.user-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-actions { display: flex; gap: 6px; flex-shrink: 0; }
.user-actions .btn { height: 40px; padding: 0 12px; font-size: 14px; }
.scan-row { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; }
.scan-row + .scan-row { border-top: 1px solid var(--soft); }
.log { display: flex; flex-direction: column; }
.log details { padding: 10px 0; }
.log details + details { border-top: 1px solid var(--soft); }
.log summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; min-height: 24px; cursor: pointer; list-style: none; }
.log summary::-webkit-details-marker { display: none; }
.log summary .msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log details[open] summary .msg { white-space: normal; overflow-wrap: anywhere; }
.log .lvl { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink2); }
.log .lvl.lvl-error { color: var(--accent-fg); }
.log pre { margin: 6px 0 0; font: 12px/1.4 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink2); }
.refresh { height: 36px; }

/* travel-day tracking */
.live { display: flex; flex-direction: column; gap: 14px; }
.live-alert { background: var(--accent); color: var(--accent-ink); border-radius: 20px; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.live-alert ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.live-title { font-size: 28px; font-weight: 700; line-height: 1.1; letter-spacing: -0.5px; }
.live-updated { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; opacity: 0.9; }
.pulse { width: 8px; height: 8px; border-radius: 4px; background: currentColor; animation: pulse 2s ease-in-out infinite; }
.live-note { padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,0.14); font-size: 14px; }
.btn.on-accent { background: #fff; border-color: #fff; color: #7b1e30; }
.live-ok { gap: 6px; }
.live-big { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; }
.live-legs { list-style: none; margin: 0; padding: 4px 16px; }
.live-leg { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 0 12px; padding: 12px 0; align-items: start; }
.live-legs > li + li.live-leg { border-top: 1px solid var(--soft); }
.live-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.live-main s { color: var(--ink2); }
.live-delay { text-align: right; padding-top: 2px; }
.late { color: var(--accent-fg); font-weight: 600; }
.live-dot { width: 12px; height: 12px; margin: 5px 0 0 2px; border-radius: 6px; border: 2.5px solid var(--bar); }
.live-leg.past .live-dot { border: 0; background: var(--bar); }
.live-leg.past .live-main b { color: var(--ink2); }
.live-leg.now .live-dot { border: 0; background: var(--accent); box-shadow: 0 0 0 4px var(--tint); }
.live-leg.cancelled .live-main b { text-decoration: line-through; }
.live-change { display: flex; align-items: center; gap: 8px; margin: 0 0 10px 28px; padding: 8px 10px; border-radius: 10px; background: var(--tint); color: var(--tint-ink); font-size: 13px; font-weight: 600; }
.live-change svg { width: 16px; height: 16px; }
.live-start { display: flex; align-items: center; gap: 6px; padding-top: 10px; border-top: 1px solid var(--soft); }
.live-start svg { width: 16px; height: 16px; }
.today-live:empty { display: none; }
.today-live.likely { padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,0.16); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* motion */
.list { display: flex; flex-direction: column; gap: 14px; }
@keyframes enter-forward { from { opacity: 0; transform: translateX(28px); } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-28px); } }
@keyframes enter-fade { from { opacity: 0; transform: translateY(6px); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes widen { from { transform: scaleX(0); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { 0% { transform: scale(0.5); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes bar-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* progress screen: exactly one screen high, nothing to scroll */
body.fit { padding-bottom: 0; height: var(--tg-viewport-stable-height, 100dvh); overflow: hidden; }
body.fit #view { height: 100%; box-sizing: border-box; overflow: hidden; }
body.fit #phases { flex: 0 1 auto; min-height: 0; overflow: hidden; }
#view.enter-forward { animation: enter-forward 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
#view.enter-back { animation: enter-back 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
#view.enter-fade { animation: enter-fade 0.22s ease-out; }
.stagger > * { animation: rise 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.stagger > :nth-child(2) { animation-delay: 40ms; }
.stagger > :nth-child(3) { animation-delay: 80ms; }
.stagger > :nth-child(4) { animation-delay: 120ms; }
.stagger > :nth-child(5) { animation-delay: 160ms; }
.stagger > :nth-child(6) { animation-delay: 200ms; }
.stagger > :nth-child(n + 7) { animation-delay: 240ms; }
.bars i { transform-origin: bottom; animation: grow 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; animation-delay: calc(var(--d, 0) * 35ms + 150ms); }
.range i { transform-origin: left; animation: widen 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both; }
.range b { animation: fade 0.3s 0.5s both; }
.dot.pop { animation: pop 0.4s cubic-bezier(0.3, 1.4, 0.5, 1); }
.suggest:not([hidden]) { animation: drop 0.15s ease-out; }
.skeleton { border-radius: var(--radius); background: linear-gradient(90deg, var(--soft) 25%, var(--surface) 50%, var(--soft) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.btn, .chip, .seg button, .swap, .back, #tabs a, .ticket-card, .ticket-today, .banner { transition: transform 0.12s ease-out; }
.btn:active, .chip:active, .seg button:active, .swap:active, .back:active, #tabs a:active { transform: scale(0.96); }
.ticket-card:active, .ticket-today:active, .banner:active { transform: scale(0.985); }
.swap svg { transition: transform 0.3s cubic-bezier(0.3, 0.8, 0.2, 1); }
.swap:active svg { transform: rotate(180deg); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
