:root {
  --bg: #f5f6fa;
  --bg2: #eceef5;
  --card: #ffffff;
  --text: #121826;
  --muted: #5b6475;
  --faint: #8a93a6;
  --line: #e2e5ee;
  --primary: #4f46e5;
  --primary-2: #6366f1;
  --primary-soft: #eef0ff;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --warn: #b45309;
  --warn-soft: #fff5e1;
  --ok: #15803d;
  --ok-soft: #e7f7ec;
  --info-soft: #e9f4ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 14px rgba(16, 24, 40, 0.06);
  --radius: 16px;
  --radius-sm: 11px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #0d1117;
  --bg2: #161b24;
  --card: #171d28;
  --text: #eef1f7;
  --muted: #a3acbd;
  --faint: #778197;
  --line: #273041;
  --primary: #8b8cff;
  --primary-2: #a5a6ff;
  --primary-soft: #23264a;
  --danger: #f87171;
  --danger-soft: #3a1c1f;
  --warn: #fbbf24;
  --warn-soft: #3a2e14;
  --ok: #4ade80;
  --ok-soft: #133021;
  --info-soft: #14273c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
:root[data-contrast='high'] {
  --muted: #3a4150;
  --line: #b9c0cf;
}
:root[data-theme='dark'][data-contrast='high'] {
  --muted: #d6dbe6;
  --line: #4a5569;
}

.c-amber { --c: #d97706; --cs: #fff4e0; }
.c-rose { --c: #e11d48; --cs: #ffe8ee; }
.c-teal { --c: #0d9488; --cs: #e0f7f4; }
.c-sky { --c: #0284c7; --cs: #e3f3fc; }
.c-indigo { --c: #4f46e5; --cs: #eceeff; }
.c-violet { --c: #7c3aed; --cs: #f1eaff; }
.c-slate { --c: #475569; --cs: #eef1f5; }
.c-pink { --c: #db2777; --cs: #fde8f3; }
.c-green { --c: #15803d; --cs: #e5f6ea; }
.c-orange { --c: #ea580c; --cs: #ffeddf; }
.c-blue { --c: #2563eb; --cs: #e7efff; }
.c-red { --c: #dc2626; --cs: #fde9e9; }
:root[data-theme='dark'] [class*='c-'] { --cs: color-mix(in srgb, var(--c) 22%, var(--card)); }
:root[data-theme='dark'] .c-slate { --c: #94a3b8; }
:root[data-theme='dark'] .c-indigo { --c: #8b8cff; }
:root[data-theme='dark'] .c-violet { --c: #a78bfa; }
:root[data-theme='dark'] .c-green { --c: #4ade80; }
:root[data-theme='dark'] .c-sky { --c: #38bdf8; }
:root[data-theme='dark'] .c-blue { --c: #60a5fa; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.45 var(--font); background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: contain;
}
:root[data-size='large'] body { font-size: 18px; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--primary-2); outline-offset: 2px; border-radius: 6px; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-t)) 12px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line);
}
.trip-switch {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 4px; text-align: left; cursor: pointer;
}
.trip-switch .logo { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #4f46e5, #0ea5e9); display: grid; place-items: center; color: #fff; font-size: 17px; flex: none; }
.trip-switch .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-switch .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trip-switch > div { min-width: 0; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; font-size: 19px; cursor: pointer; flex: none;
}
.icon-btn.sos { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .03em; width: auto; padding: 0 11px; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); cursor: pointer; white-space: nowrap; }
.sync-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sync-pill[data-state='synced'] i { background: #22c55e; }
.sync-pill[data-state='pending'] i, .sync-pill[data-state='syncing'] i { background: #f59e0b; }
.sync-pill[data-state='syncing'] i { animation: pulse 1s infinite; }
.sync-pill[data-state='offline'] i { background: #94a3b8; }
.sync-pill[data-state='error'] i, .sync-pill[data-state='signed_out'] i { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

main#view:focus { outline: none; }
main#view { padding: 14px 14px calc(var(--nav-h) + 90px + var(--safe-b)); max-width: 860px; margin: 0 auto; min-height: 70vh; }
@media (min-width: 900px) { main#view { padding-left: 24px; padding-right: 24px; } }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(7, 1fr);
  background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b); height: calc(var(--nav-h) + var(--safe-b));
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted);
  font-size: 10.5px; font-weight: 600; letter-spacing: .01em; min-width: 0;
}
.bottom-nav a span.i { font-size: 21px; line-height: 1; filter: grayscale(.5); opacity: .8; }
.bottom-nav a[aria-current='page'] { color: var(--primary); }
.bottom-nav a[aria-current='page'] span.i { filter: none; opacity: 1; transform: scale(1.08); }
.bottom-nav a span.l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
@media (min-width: 900px) {
  .bottom-nav { left: 50%; transform: translateX(-50%); bottom: 14px; width: 720px; border-radius: 20px; border: 1px solid var(--line); box-shadow: var(--shadow); height: var(--nav-h); padding: 0; }
}

.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px + var(--safe-b)); z-index: 45; width: 60px; height: 60px; border-radius: 20px;
  border: 0; background: linear-gradient(135deg, var(--primary), #0ea5e9); color: #fff; font-size: 32px; line-height: 1; cursor: pointer;
  box-shadow: 0 8px 24px rgba(79, 70, 229, .4); display: grid; place-items: center;
}
.fab:active { transform: scale(.95); }
@media (min-width: 900px) { .fab { right: calc(50% - 420px); bottom: 96px; } }

/* ---------- Primitives ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.card + .card, .card + .section, .section + .card, .section + .section, .stack > * + * { margin-top: 12px; }
.section { margin-top: 18px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 2px 8px; }
.section-title h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.section-title a, .section-title button { font-size: 14px; }
.page-title { display: flex; align-items: center; gap: 10px; margin: 4px 2px 14px; }
.page-title h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.big { font-size: 20px; font-weight: 700; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; } .grid-auto > * + * { margin-top: 0 !important; } }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden, [hidden] { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); font-weight: 650; cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.lg { min-height: 54px; font-size: 17px; border-radius: 14px; padding: 0 20px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.actions.grid .btn, .btn.block { white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; }
.welcome-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--cs, var(--bg2)); color: var(--c, var(--muted)); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--text); text-decoration: none; }
.chip[aria-pressed='true'], .chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; background: none; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; }
.item:last-child { border-bottom: 0; }
.item:active { background: var(--bg2); }
.item .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--cs, var(--bg2)); font-size: 20px; flex: none; }
.item .t { font-weight: 650; }
.item .s { color: var(--muted); font-size: 13.5px; }
.item .r { text-align: right; flex: none; }
.item.done .t { text-decoration: line-through; color: var(--faint); }
.chev::after { content: '›'; color: var(--faint); font-size: 22px; margin-left: 4px; }

.kv { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 12px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; word-break: break-word; }
.copyable { cursor: copy; border-bottom: 1px dashed var(--faint); }
.secret { font-family: var(--mono); background: var(--bg2); border-radius: 6px; padding: 1px 6px; }

.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty .e { font-size: 42px; margin-bottom: 6px; }

.alert { display: flex; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--info-soft); font-size: 14.5px; align-items: flex-start; }
.alert.warn { background: var(--warn-soft); }
.alert.error { background: var(--danger-soft); }
.alert.ok { background: var(--ok-soft); }
.alert + .alert { margin-top: 8px; }
.alert .ai { font-size: 18px; line-height: 1.2; }

.progress { height: 10px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.progress.warn > i { background: #f59e0b; }
.progress.over > i { background: var(--danger); }

/* ---------- Hero / Today ---------- */
.hero { position: relative; border-radius: 22px; padding: 18px; color: #fff; overflow: hidden; background: linear-gradient(135deg, #312e81, #4f46e5 45%, #0ea5e9); box-shadow: 0 10px 30px rgba(49, 46, 129, .25); }
.hero.cover { background-size: cover; background-position: center; }
.hero.cover::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.65)); }
.hero > * { position: relative; }
.hero .where { font-size: 30px; font-weight: 850; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.hero .meta { opacity: .92; font-weight: 600; margin-top: 2px; }
.hero .stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hero .stat { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); border-radius: 12px; padding: 6px 10px; font-size: 13.5px; font-weight: 650; }
.hero .stat b { font-size: 16px; }
.countdown { font-size: 54px; font-weight: 900; line-height: 1; letter-spacing: -.03em; }

.next-card { border-radius: 20px; padding: 16px; background: var(--card); border: 2px solid var(--c, var(--primary)); box-shadow: var(--shadow); }
.next-card .lbl { font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .1em; color: var(--c, var(--primary)); }
.next-card .what { font-size: 22px; font-weight: 800; margin-top: 6px; display: flex; gap: 8px; align-items: center; }
.next-card .when { font-size: 34px; font-weight: 900; letter-spacing: -.02em; margin-top: 4px; }
.next-card .where { color: var(--muted); font-weight: 600; }
.next-card .advice { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--cs, var(--primary-soft)); font-weight: 750; }
.next-card .facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.next-card .fact { background: var(--bg2); border-radius: 10px; padding: 5px 10px; font-weight: 700; font-size: 14px; }
.next-card .fact small { color: var(--muted); font-weight: 600; margin-right: 4px; }

.timeline { position: relative; }
.tl-item { display: grid; grid-template-columns: 54px 16px 1fr; gap: 0 10px; align-items: start; text-decoration: none; color: inherit; padding: 4px 0; cursor: pointer; }
.tl-time { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; padding-top: 10px; font-size: 15px; }
.tl-time small { display: block; font-weight: 600; color: var(--faint); font-size: 12px; }
.tl-dot { position: relative; height: 100%; }
.tl-dot::before { content: ''; position: absolute; left: 7px; top: 0; bottom: -8px; width: 2px; background: var(--line); }
.tl-item:last-child .tl-dot::before { bottom: 50%; }
.tl-dot::after { content: ''; position: absolute; left: 1px; top: 14px; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3px solid var(--c, var(--primary)); }
.tl-item.past { opacity: .55; }
.tl-item.done .tl-dot::after { background: var(--c, var(--primary)); }
.tl-item.now .tl-dot::after { box-shadow: 0 0 0 5px color-mix(in srgb, var(--c) 25%, transparent); }
.tl-body { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--c, var(--primary)); border-radius: 13px; padding: 9px 12px; margin-bottom: 4px; box-shadow: var(--shadow); min-width: 0; }
.tl-body .t { font-weight: 700; display: flex; gap: 6px; align-items: center; }
.tl-body .s { font-size: 13.5px; color: var(--muted); }
.tl-gap { grid-column: 3; font-size: 12.5px; color: var(--faint); padding: 2px 0 6px 4px; }
.tl-gap.warn { color: var(--warn); font-weight: 700; }

.check-list .ck { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-list .ck:last-child { border-bottom: 0; }
.ckbox { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--faint); display: grid; place-items: center; flex: none; font-size: 15px; color: #fff; background: var(--card); }
.ck.on .ckbox { background: var(--ok); border-color: var(--ok); }
.ck.on .t { color: var(--faint); text-decoration: line-through; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-grid button, .quick-grid a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 86px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13.5px; cursor: pointer; text-decoration: none; color: var(--text); text-align: center; padding: 6px; }
.quick-grid .qi { font-size: 28px; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.tile .v { font-size: 22px; font-weight: 850; margin-top: 2px; letter-spacing: -.01em; }
.tile .d { font-size: 12.5px; color: var(--muted); }

/* ---------- Itinerary ---------- */
.itin { display: flex; flex-direction: column; }
.itin-stop { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; }
.itin-stop .pin { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.itin-stop.home .pin { background: var(--text); }
.itin-stop.current .pin { box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 30%, transparent); }
.itin-leg { display: grid; grid-template-columns: 34px 1fr; gap: 10px; }
.itin-leg .line { width: 3px; margin: 0 auto; min-height: 34px; background: repeating-linear-gradient(to bottom, var(--primary) 0 6px, transparent 6px 10px); }
.itin-leg .how { font-size: 13.5px; color: var(--muted); align-self: center; font-weight: 650; }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .h { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.cal a { min-height: 64px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); padding: 4px; text-decoration: none; color: inherit; font-size: 12px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.cal a.out { opacity: .35; }
.cal a.today { border: 2px solid var(--primary); }
.cal a .n { font-weight: 800; }
.cal a .dots { display: flex; flex-wrap: wrap; gap: 2px; }
.cal a .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.cal a .st { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.week { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 8px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.week > div { scroll-snap-align: start; background: var(--bg2); border-radius: 14px; padding: 8px; min-height: 180px; }
.week .wi { background: var(--card); border-left: 3px solid var(--c); border-radius: 9px; padding: 5px 7px; font-size: 12.5px; margin-top: 6px; display: block; text-decoration: none; color: inherit; }
.day-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-strip a { flex: none; width: 58px; padding: 7px 0; text-align: center; border-radius: 14px; border: 1px solid var(--line); background: var(--card); text-decoration: none; color: inherit; }
.day-strip a .w { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.day-strip a .n { font-size: 20px; font-weight: 850; }
.day-strip a .x { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; }
.day-strip a[aria-current='true'] { background: var(--primary); border-color: var(--primary); color: #fff; }
.day-strip a[aria-current='true'] .w, .day-strip a[aria-current='true'] .x { color: #e0e7ff; }
.day-strip a.is-today { border: 2px solid var(--primary); }

/* ---------- Boarding pass ---------- */
.pass { border-radius: 20px; overflow: hidden; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pass .top { background: var(--c); color: #fff; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; font-weight: 750; }
.pass .route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 16px; gap: 8px; }
.pass .code { font-size: 38px; font-weight: 900; letter-spacing: -.02em; line-height: 1; }
.pass .time { font-size: 22px; font-weight: 800; }
.pass .mid { text-align: center; color: var(--muted); font-size: 13px; font-weight: 650; }
.pass .mid .plane { font-size: 22px; }
.pass .grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 2px dashed var(--line); }
.pass .grid > div { padding: 10px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pass .grid > div:nth-child(3n) { border-right: 0; }
.pass .grid small { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.pass .grid b { font-size: 18px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.field label, .field .lbl { display: block; font-size: 13px; font-weight: 750; color: var(--muted); margin: 0 0 5px 2px; }
.field .req { color: var(--danger); }
.input, .field input:not([type='checkbox']):not([type='radio']), .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 16px;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--primary-2); border-color: transparent; }
.field .hint { font-size: 12.5px; color: var(--faint); margin: 4px 2px 0; }
.field .err { font-size: 13px; color: var(--danger); margin: 4px 2px 0; font-weight: 650; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.switch input { appearance: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { left: 23px; }
.drop-on { outline: 3px dashed var(--primary-2); outline-offset: 3px; }
.geo-box { border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: var(--bg2); }
.geo-box .gl { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.geo-results { margin-top: 6px; }
.geo-results button { display: block; width: 100%; text-align: left; padding: 8px; border: 0; border-bottom: 1px solid var(--line); background: var(--card); font-size: 14px; cursor: pointer; }
.stars { display: flex; gap: 4px; }
.stars label { font-size: 28px; cursor: pointer; filter: grayscale(1); opacity: .45; }
.stars input { display: none; }
.stars label.on { filter: none; opacity: 1; }
details.adv > summary { cursor: pointer; color: var(--primary); font-weight: 700; padding: 6px 2px; }
details.adv[open] > summary { margin-bottom: 8px; }
.form-actions { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 8px; display: flex; gap: 8px; z-index: 5; }
.amount-input { font-size: 40px !important; font-weight: 850; text-align: center; min-height: 72px !important; letter-spacing: -.02em; }

/* ---------- Sheet / modal ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(8, 12, 22, .45); z-index: 80; animation: fade .15s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; background: var(--bg); border-radius: 22px 22px 0 0; max-height: 92vh; max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(18px + var(--safe-b)); animation: up .2s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -10px 40px rgba(0,0,0,.2);
}
@media (min-width: 700px) { .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 560px; border-radius: 22px; animation: fade .15s; max-height: 86vh; } }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 2px auto 10px; }
.sheet .sh-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sheet .sh-head h2 { flex: 1; font-size: 20px; font-weight: 800; }
@keyframes up { from { transform: translateY(40%); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 90px + var(--safe-b)); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #111827; color: #fff; padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 14.5px; box-shadow: 0 8px 24px rgba(0,0,0,.25); pointer-events: auto; max-width: 520px; animation: up .2s; display: flex; gap: 10px; align-items: center; }
.toast.error { background: var(--danger); }
.toast button { background: none; border: 0; color: #a5b4fc; font-weight: 800; cursor: pointer; }

/* ---------- Lock / auth ---------- */
.fullscreen { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { text-align: center; margin-bottom: 18px; }
.auth-card .brand .logo { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 20px; background: linear-gradient(135deg, #4f46e5, #0ea5e9); display: grid; place-items: center; font-size: 34px; }
.auth-card h1 { font-size: 28px; font-weight: 900; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 20px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots i.on { background: var(--text); border-color: var(--text); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px; justify-content: center; }
.pin-pad button { height: 76px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 28px; font-weight: 600; cursor: pointer; }

/* ---------- Map ---------- */
.map-wrap { position: relative; margin: -14px -14px 0; height: calc(100vh - 128px - var(--nav-h) - var(--safe-b) - var(--safe-t)); height: calc(100dvh - 128px - var(--nav-h) - var(--safe-b) - var(--safe-t)); min-height: 360px; }
@media (min-width: 900px) { .map-wrap { margin: 0; border-radius: var(--radius); overflow: hidden; height: calc(100vh - 220px); } }
#map { position: absolute; inset: 0; background: var(--bg2); }
.map-filters { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 500; }
.map-filters .chip { box-shadow: var(--shadow); }
.map-marker { width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); display: grid; place-items: center; }
.map-marker span { transform: rotate(45deg); font-size: 16px; }
.map-marker.fav { outline: 3px solid gold; }
.map-sheet { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 600; }
.leaflet-container { font: inherit; }
:root[data-theme='dark'] .leaflet-tile-pane { filter: brightness(.75) invert(1) contrast(.9) hue-rotate(200deg) saturate(.35) brightness(.9); }

/* ---------- Charts ---------- */
.bars .bar { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; margin: 9px 0; }
.bars .bar .track { position: relative; height: 12px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.bars .bar .track i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c, var(--primary)); border-radius: 99px; }
.bars .bar .track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .55; }
.bars .bar .nm { font-size: 13.5px; font-weight: 650; grid-column: 2 / 4; margin-bottom: -6px; display: flex; justify-content: space-between; }
.cols-chart { display: flex; align-items: flex-end; gap: 4px; height: 130px; padding-top: 10px; }
.cols-chart > div { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.cols-chart i { width: 100%; max-width: 30px; background: var(--primary); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.cols-chart i.over { background: var(--danger); }
.cols-chart i.today { outline: 2px solid var(--text); }
.cols-chart span { font-size: 10px; color: var(--muted); margin-top: 3px; }
.donut { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.donut > div { width: 96px; height: 96px; border-radius: 50%; background: var(--card); display: grid; place-items: center; text-align: center; font-weight: 850; font-size: 17px; line-height: 1.1; }

/* ---------- Gallery / docs ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(5, 1fr); } }
.gallery a { aspect-ratio: 1; background: var(--bg2); border-radius: 8px; overflow: hidden; display: block; position: relative; }
.gallery img, .gallery video { width: 100%; height: 100%; object-fit: cover; }
.doc-preview { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; min-height: 200px; }
.doc-full { position: fixed; inset: 0; background: #000; z-index: 150; display: flex; flex-direction: column; }
.doc-full .bar { display: flex; justify-content: space-between; align-items: center; padding: calc(10px + var(--safe-t)) 12px 10px; color: #fff; gap: 8px; }
.doc-full .body { flex: 1; overflow: auto; display: grid; place-items: center; background: #fff; }
.doc-full img { max-width: 100%; max-height: 100%; }
.doc-full iframe, .doc-full object { width: 100%; height: 100%; border: 0; }
.doc-full .body.pdf { display: block; background: #525659; }
.pdf-page { display: block; width: 100%; height: auto; background: #fff; border-radius: 8px; margin-bottom: 8px; }
.doc-full .pdf-page { border-radius: 0; margin-bottom: 4px; }

/* ---------- Markdown / assistant ---------- */
.md p { margin: .4em 0; }
.md ul, .md ol { margin: .3em 0; padding-left: 1.2em; }
.chat { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 88%; padding: 10px 13px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.bubble.me { align-self: flex-end; background: var(--primary); color: #fff; border-color: var(--primary); }
.bubble .src { font-size: 11px; color: var(--faint); margin-top: 4px; }

.sos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sos-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px; border-radius: 16px; text-decoration: none; color: #fff; background: var(--danger); font-weight: 800; min-height: 88px; }
.sos-btn small { font-weight: 600; opacity: .9; }
.sos-btn.alt { background: var(--card); color: var(--text); border: 1px solid var(--line); }

/* ---------- Responsive ---------- */
.row, .actions, .chips, .kv, .pass .route { min-width: 0; }
.card, .list, .tl-body, .bubble, .alert > span { overflow-wrap: anywhere; }
.bars .bar > div { min-width: 0; }
.bars .bar .nm { gap: 8px; }
.bars .bar .nm > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-title h1 { min-width: 0; overflow-wrap: anywhere; }
.page-title .actions, .page-title > .btn { margin-top: 0; }
.doc-preview, iframe, video { max-width: 100%; }

@media (hover: hover) and (pointer: fine) {
  .item:hover, .check-list .ck:hover, .geo-results button:hover { background: var(--bg2); }
  .btn:hover { filter: brightness(.97); border-color: color-mix(in srgb, var(--primary) 30%, var(--line)); }
  .btn.primary:hover, .btn.danger:hover { filter: brightness(1.08); }
  .chip:hover:not(.on):not([aria-pressed='true']), .quick-grid button:hover, .quick-grid a:hover, .tile:hover, .day-strip a:hover:not([aria-current='true']), .cal a:hover { border-color: var(--primary-2); }
  .bottom-nav a:hover { color: var(--primary); }
  .fab:hover { filter: brightness(1.08); }
}

@media (max-width: 400px) {
  main#view { padding-left: 10px; padding-right: 10px; }
  .map-wrap { margin: -14px -10px 0; }
  .topbar { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .icon-btn { width: 38px; height: 38px; font-size: 17px; }
  .icon-btn.sos { padding: 0 9px; }
  .sync-pill { padding: 0; width: 30px; height: 30px; justify-content: center; }
  .sync-pill span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sync-pill i { width: 10px; height: 10px; }
  .page-title { flex-wrap: wrap; }
  .page-title h1 { font-size: 22px; }
  .card { padding: 12px; }
  .item { padding: 11px 12px; gap: 10px; }
  .item .ic { width: 36px; height: 36px; font-size: 18px; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { font-size: 13px; margin-top: 8px; }
  .kv dt:first-child { margin-top: 0; }
  .field-row, .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .quick-grid { gap: 8px; }
  .quick-grid button, .quick-grid a { min-height: 76px; font-size: 12.5px; }
  .hero { padding: 15px; border-radius: 18px; }
  .hero .where { font-size: 24px; }
  .countdown { font-size: 42px; }
  .next-card .what { font-size: 19px; }
  .next-card .when { font-size: 28px; }
  .tl-item { grid-template-columns: 46px 16px 1fr; gap: 0 8px; }
  .tl-time { font-size: 14px; }
  .pass .route { padding: 14px 12px; }
  .pass .code { font-size: 30px; }
  .pass .time { font-size: 18px; }
  .pass .grid > div { padding: 8px 10px; }
  .pass .grid b { font-size: 15px; }
  .cal { gap: 2px; }
  .cal a { min-height: 52px; padding: 3px; border-radius: 8px; }
  .cal a .st { display: none; }
  .pin-pad { grid-template-columns: repeat(3, 68px); gap: 12px; }
  .pin-pad button { height: 68px; font-size: 26px; }
  .amount-input { font-size: 32px !important; }
  .donut { width: 120px; height: 120px; }
  .donut > div { width: 82px; height: 82px; font-size: 15px; }
  .sos-grid { gap: 8px; }
  .sheet { padding-left: 12px; padding-right: 12px; }
  .bubble { max-width: 94%; }
  .fullscreen { padding: 16px; }
}
@media (max-width: 340px) {
  .bottom-nav a span.l { font-size: 9.5px; }
  .bottom-nav a span.i { font-size: 19px; }
  .trip-switch .logo { display: none; }
  .quick-grid, .grid3 { grid-template-columns: 1fr 1fr; }
  .pass .grid { grid-template-columns: 1fr 1fr; }
  .pass .grid > div:nth-child(3n) { border-right: 1px solid var(--line); }
  .pass .grid > div:nth-child(2n) { border-right: 0; }
  .sos-grid { grid-template-columns: 1fr; }
}

@media (max-height: 500px) and (orientation: landscape) {
  :root { --nav-h: 50px; }
  .bottom-nav a { flex-direction: row; gap: 6px; }
  .bottom-nav a span.i { font-size: 18px; }
  .topbar { position: static; }
  .fab { width: 50px; height: 50px; border-radius: 16px; font-size: 26px; }
  main#view { padding-bottom: calc(var(--nav-h) + 70px + var(--safe-b)); padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .bottom-nav { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .map-wrap { height: calc(100dvh - 70px - var(--nav-h) - var(--safe-b)); min-height: 220px; }
  .sheet { max-height: 96dvh; }
  .sheet .grab { display: none; }
  .fullscreen { align-items: flex-start; }
}

@media (min-width: 640px) {
  .quick-grid { grid-template-columns: repeat(6, 1fr); }
  .sos-grid { grid-template-columns: repeat(3, 1fr); }
  .sheet .form-actions { bottom: 0; }
}

@media (min-width: 1100px) {
  :root { --rail: 232px; }
  body:has(.bottom-nav:not([hidden])) { padding-left: var(--rail); }
  .bottom-nav {
    left: 0; top: 0; bottom: 0; right: auto; transform: none; width: var(--rail); height: auto; border-radius: 0; box-shadow: none;
    border: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; padding: calc(78px + var(--safe-t)) 12px 16px;
    background: var(--card);
  }
  .bottom-nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; border-radius: 12px; font-size: 15px; letter-spacing: 0; }
  .bottom-nav a span.i { font-size: 20px; }
  .bottom-nav a[aria-current='page'] { background: var(--primary-soft); }
  .bottom-nav a[aria-current='page'] span.i { transform: none; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  main#view { max-width: 980px; padding: 22px 32px calc(110px + var(--safe-b)); }
  .fab { right: 32px; bottom: 32px; }
  .form-actions { bottom: 0; }
  .toast-wrap { bottom: 100px; padding-left: calc(var(--rail) + 16px); }
  .map-wrap { height: calc(100vh - 160px); }
  .grid-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
  .sheet { left: calc(50% + var(--rail) / 2); }
}
@media (min-width: 900px) and (max-width: 1099px) {
  .toast-wrap { bottom: calc(var(--nav-h) + 110px); }
  .form-actions { bottom: calc(var(--nav-h) + 14px); }
}

@media print {
  .topbar, .bottom-nav, .fab, .no-print { display: none !important; }
  main#view { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
