/* TrainWala - original dark UI, mobile-first, no frameworks */
:root {
  --bg: #0b0e14;
  --bg-soft: #11151f;
  --card: #161b28;
  --card-2: #1c2333;
  --line: #262f45;
  --text: #e8ecf4;
  --muted: #8b94ab;
  --accent: #6d7cff;
  --accent-soft: rgba(109, 124, 255, .14);
  --green: #2fbf71;
  --green-soft: rgba(47, 191, 113, .15);
  --red: #e5484d;
  --red-soft: rgba(229, 72, 77, .14);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, .14);
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.45;
  min-height: 100vh;
}
.hidden { display: none !important; }
a { color: var(--accent); }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, #141a29, var(--bg));
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #9a6dff);
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #fff;
  box-shadow: none;
}
.topbar h1 { font-size: 19px; letter-spacing: .2px; }
.tagline { font-size: 11.5px; color: var(--muted); }
.icon-btn {
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  width: 40px; height: 40px; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn:active { transform: scale(.94); }
/* theme toggle glyph: sun in the light theme, moon in the dark theme
   (app.js flips data-theme on <html>; the button itself is unchanged) */
#themeBtn .ic-moon { display: none; }
html:not([data-theme="light"]) #themeBtn .ic-sun { display: none; }
html:not([data-theme="light"]) #themeBtn .ic-moon { display: block; }

/* ---------- layout ---------- */
main { max-width: 760px; margin: 0 auto; padding: 16px 14px 40px; }

/* ---------- search ---------- */
.search-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
#searchForm { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.field input, .field select {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 11px 12px; font-size: 16px; width: 100%;
  color-scheme: dark;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.field:nth-child(3) { grid-column: 1 / -1; }
.field-hint { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.fx-wrap { position: relative; }
.fx-wrap input { width: 100%; padding-right: 38px; }
.fx-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: none; border: 0; background: none; color: var(--muted); font-size: 20px; font-weight: 700; line-height: 1; padding: 7px 9px; cursor: pointer; }
.fx-x:hover, .fx-x:focus-visible { color: var(--text); }
.fx-x.on { display: block; }
.go-btn {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--accent), #9a6dff);
  color: #fff; border: 0; border-radius: 12px;
  padding: 13px; font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: none;
}
.go-btn:disabled { opacity: .55; cursor: wait; box-shadow: none; }
.go-btn:active:not(:disabled) { transform: scale(.98); }
.hint { margin-top: 10px; font-size: 13px; color: var(--muted); }
.hint b { color: var(--text); }

/* ---------- status / errors ---------- */
#statusArea { margin-top: 14px; }
.notice {
  border-radius: var(--radius); padding: 16px; font-size: 14.5px;
  border: 1px solid var(--line); background: var(--card);
  display: flex; gap: 12px; align-items: flex-start;
}
.notice .n-icon { font-size: 22px; line-height: 1.2; }
.notice.error { background: var(--red-soft); border-color: rgba(229,72,77,.4); }
.notice.warn { background: var(--amber-soft); border-color: rgba(245,165,36,.4); }
.notice h3 { font-size: 15px; margin-bottom: 4px; }
.notice p { color: var(--muted); font-size: 13.5px; }
.notice.error p { color: #f0b5b7; }
.notice.warn p { color: #f0d6a3; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite; margin-top: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tabs ---------- */
.tab-bar {
  display: flex; gap: 8px; margin-top: 18px;
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 6px; border-radius: 14px;
  position: sticky; top: 69px; z-index: 10;
  overflow-x: auto;
}
.tab {
  flex: 1; white-space: nowrap;
  background: transparent; border: 0; color: var(--muted);
  padding: 9px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- generic cards ---------- */
.content { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.card h2 { font-size: 15px; margin-bottom: 10px; letter-spacing: .2px; }
.card h2 .sub { color: var(--muted); font-weight: 500; font-size: 12.5px; margin-left: 6px; }

/* ---------- overview ---------- */
.train-head { display: flex; flex-direction: column; gap: 4px; }
.train-head .tname { font-size: 19px; font-weight: 700; }
.train-head .troute { color: var(--muted); font-size: 14px; }
.train-head .troute b { color: var(--text); }
.day-bubbles { display: flex; gap: 5px; margin-top: 8px; }
.day-bubbles span {
  width: 26px; height: 26px; border-radius: 8px; font-size: 11px;
  display: grid; place-items: center; color: var(--muted);
  background: var(--bg-soft); border: 1px solid var(--line);
}
.day-bubbles span.on { background: var(--accent-soft); color: var(--accent); border-color: rgba(109,124,255,.4); font-weight: 700; }
.day-bubbles span.unk { border-style: dashed; opacity: .55; }
.day-bubbles span.jday { border: 2px solid var(--accent); color: var(--accent); font-weight: 800; }
.day-bubbles span.jday.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px;
}
.stat .s-val { font-size: 22px; font-weight: 800; }
.stat .s-val.small { font-size: 16px; }
.stat .s-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .s-val.good { color: var(--green); }
.stat .s-val.bad { color: var(--red); }
.stat .s-val.wait { color: var(--amber); }
.class-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px; border-bottom: 1px dashed var(--line);
}
.class-row:last-child { border-bottom: 0; }
.class-tag {
  font-weight: 800; font-size: 13px; background: var(--accent-soft); color: var(--accent);
  border-radius: 8px; padding: 3px 9px; min-width: 42px; text-align: center;
}
.class-row .cr-info { font-size: 13.5px; color: var(--muted); }
.class-row .cr-free { font-weight: 700; font-size: 15px; }
.cr-free.good { color: var(--green); }
.cr-free.bad { color: var(--red); }

/* ---------- coach chips ---------- */
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.rake-strip { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; padding: 2px 30px 10px 2px; scroll-snap-type: x proximity; scroll-padding: 0 30px 0 2px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%); mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%); }
.rake-strip .coach-chip { flex: 0 0 auto; scroll-snap-align: start; }
.rake-strip:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
/* Glance rake only: a "+N more" jump chip pinned to the strip's trailing
   edge (renderOverview adds it when coaches overflow the strip). */
.rake-wrap { position: relative; }
.rake-more { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); z-index: 2; font: inherit; font-size: 12.5px; font-weight: 800; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); cursor: pointer; box-shadow: 0 2px 10px rgba(15,23,42,.30); }
.rake-more[hidden] { display: none; }
.rake-more:active { transform: translateY(-50%) scale(.96); }
.coach-chip {
  position: relative; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 9px 12px 9px 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px;
  font-size: 14px; font-weight: 700;
}
.coach-chip::before { content:""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #f0a13c; }
.coach-chip.ac::before { background: #5f8bff; }
.coach-chip .cc-sub { font-size: 10.5px; color: var(--muted); font-weight: 700; }
.coach-chip .cc-free { font-size: 10.5px; font-weight: 700; }
.cc-free.good { color: var(--green); }
.cc-free.bad { color: var(--red); }
.coach-chip.active { border-color: var(--accent); background: var(--accent-soft); }
.coach-chip:active { transform: scale(.96); }

/* ---------- effects layer (Revamp Phase 1, js/fx.js) ----------
   Everything in this section is presentation only, and every
   animation/transition it declares is switched off wholesale by
   the Lite kill at the bottom: html.fx-lite is one class on the
   root element, applied by TwFx from the stored choice or the
   OS reduced-motion setting. The hidden pre-reveal state
   (.rv-arm) is only ever applied by JS, never by default CSS,
   so no-JS / Lite / observer failure can never hide content. */
.fx-pill {
  font: inherit; font-size: 12px; font-weight: 700; white-space: nowrap;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
}
.fx-pill:active { transform: scale(.96); }
.fx-pill.fx-pill-lite { color: var(--muted); }
.rv-arm { opacity: 0; transform: translateY(14px); }
.rv-arm.rv-in { opacity: 1; transform: translateY(0); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.8,.3,1); }
#content.fx-tabin { animation: fxTabIn .22s ease both; }
@keyframes fxTabIn { from { opacity: .2; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* The assembling rake strip (Glance): one wagon per coach, in the
   class's livery, filling in as its map lands. Read-only view of
   state - colours and badges mirror coachLoaded / coachNoMap /
   coachFreeCount exactly; nothing here computes a new number. */
.fx-rake { display: flex; gap: 8px; }
.fx-wagon {
  position: relative; flex: 0 0 auto; scroll-snap-align: start;
  min-width: 76px; padding: 8px 10px 7px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--bg-soft); color: var(--text);
  font: inherit; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px;
}
.fx-wagon .fx-wname { font-size: 15px; font-weight: 800; line-height: 1.1; }
.fx-wagon .fx-wsub { font-size: 10px; font-weight: 700; color: var(--muted); }
.fx-wagon .fx-win { display: flex; gap: 3px; margin-top: 3px; }
.fx-wagon .fx-win i { width: 9px; height: 7px; border-radius: 2px; background: rgba(127,140,170,.35); }
.fx-wagon .fx-badge { font-size: 10.5px; font-weight: 700; margin-top: 2px; }
.fx-wagon .fx-badge.good { color: var(--green); }
.fx-wagon .fx-badge.bad { color: var(--red); }
.fx-wagon .fx-badge.unk { color: var(--muted); }
/* loaded: filled livery, lit windows in proportion to free berths */
.fx-wagon.st-loaded { color: #fff; border-color: transparent; background: var(--lv); }
.fx-wagon.st-loaded .fx-wsub { color: rgba(255,255,255,.75); }
.fx-wagon.st-loaded .fx-badge { color: #fff; }
.fx-wagon.st-loaded .fx-win i { background: rgba(255,255,255,.28); }
.fx-wagon.st-loaded .fx-win i.lit { background: #ffe066; box-shadow: 0 0 5px rgba(255,224,102,.8); }
.fx-wagon.lv-1a { --lv: #8e2f3c; } .fx-wagon.lv-2a { --lv: #2e6fb7; }
.fx-wagon.lv-3a { --lv: #2a9d8f; } .fx-wagon.lv-3e { --lv: #7b5ea7; }
.fx-wagon.lv-sl { --lv: #e4572e; }
.fx-wagon.lv-gen { --lv: #5b6678; }
.fx-wagon.st-pending, .fx-wagon.st-retry { border-color: var(--lv, var(--line)); border-style: dashed; background: transparent; }
.fx-wagon.st-nomap {
  background: repeating-linear-gradient(45deg, rgba(127,140,170,.16) 0 6px, rgba(127,140,170,.05) 6px 12px);
  border-color: var(--line); color: var(--muted);
}
.fx-wagon.st-nomap .fx-wsub { color: var(--muted); }
.fx-wagon.st-retry { animation: fxWagonPulse 1.4s ease-in-out infinite; }
@keyframes fxWagonPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.fx-wagon.fx-enter { animation: fxWagonIn .45s cubic-bezier(.2,.8,.3,1) both; }
@keyframes fxWagonIn { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: translateX(0); } }
.fx-wagon.fx-changed { animation: fxWagonSettle .6s ease; }
@keyframes fxWagonSettle { 0% { filter: brightness(1.6); } 100% { filter: brightness(1); } }
.fx-wagon:active { transform: scale(.96); }

/* ---------- vacant fill gauges (Revamp Phase 3) ----------
   A free count gains a fill: a green wash behind the number
   (.fx-gauge), or a thin bar under a wagon badge (.fx-gbar).
   The fill is painted at its final width by the render, so the
   static state is always the true share; the width transition
   is only what the first-paint rise animates through. */
.fx-gauge { position: relative; overflow: hidden; }
.fx-gauge .fx-gfill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: color-mix(in srgb, var(--green) 20%, transparent); transition: width .8s cubic-bezier(.2,.8,.3,1); }
.fx-gauge .fx-gtxt { position: relative; z-index: 1; }
.cr-free.fx-gauge, .cc-free.fx-gauge, .vb-coach-h .cnt.fx-gauge { padding: 2px 6px; border-radius: 6px; }
.chip.fx-gauge .fx-gfill { background: color-mix(in srgb, var(--green) 22%, transparent); }
.vac-summary.fx-gauge .fx-gfill { background: color-mix(in srgb, var(--green) 14%, transparent); }
.fx-gbar { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,.28); overflow: hidden; margin-top: 3px; }
.fx-gbar .fx-gfill { position: static; display: block; height: 100%; background: #ffe066; transition: width .8s cubic-bezier(.2,.8,.3,1); }

/* ---------- scroll-scrubbed journey scene (Revamp Phase 3) ----------
   A drawn train crossing a dawn-to-night sky, scrubbed by the
   stop list's scroll: sticky at the top of the Route card, the
   train advances station to station and the sky follows the
   time of day at the stop under the scroll. Pure CSS/SVG; the
   JS only moves layers and the HUD text. Lite removes it
   entirely (below), so the Stops tab is exactly today's view. */
.fx-scene { position: sticky; top: 60px; z-index: 6; height: 118px; border-radius: 12px; overflow: hidden; margin: 10px 0 12px; background: #7ec8f7; }
.fx-sky { position: absolute; inset: 0; }
.fx-sky-day { background: linear-gradient(#6db9f2, #cfeeff 70%, #eaf7ff); }
.fx-sky-warm { background: linear-gradient(#ff9e57, #ffc98a 55%, #ffe3c2); opacity: 0; }
.fx-sky-night { background: linear-gradient(#0b1026, #1b2a4a 60%, #2c3e63); opacity: 0; }
.fx-stars { position: absolute; inset: 0; opacity: 0; background-image: radial-gradient(1px 1px at 12% 22%, #fff, transparent), radial-gradient(1px 1px at 28% 12%, #fff, transparent), radial-gradient(1.5px 1.5px at 44% 30%, #fff, transparent), radial-gradient(1px 1px at 63% 16%, #fff, transparent), radial-gradient(1px 1px at 78% 28%, #fff, transparent), radial-gradient(1.5px 1.5px at 90% 12%, #fff, transparent), radial-gradient(1px 1px at 55% 8%, #fff, transparent), radial-gradient(1px 1px at 33% 38%, #fff, transparent); }
.fx-sun { position: absolute; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, #fff8c4, #ffd94d 60%, #ffb830); box-shadow: 0 0 18px rgba(255,200,60,.8); left: 4%; top: 62%; transform: translate(-50%,-50%); }
.fx-hills { position: absolute; left: 0; right: -60px; bottom: 16px; height: 40px; }
.fx-hills svg { width: 100%; height: 100%; display: block; }
.fx-hills-far svg path { fill: #6da86e; opacity: .55; }
.fx-hills-near svg path { fill: #4e8a52; }
.fx-dim { position: absolute; inset: 0; background: linear-gradient(rgba(11,16,38,.55), rgba(11,16,38,.25)); opacity: 0; }
.fx-track { position: absolute; left: 0; right: 0; bottom: 14px; height: 3px; background: rgba(40,45,60,.55); }
.fx-track i { position: absolute; top: -3px; width: 5px; height: 9px; border-radius: 2px; background: rgba(255,255,255,.85); transform: translateX(-50%); }
.fx-train { position: absolute; bottom: 17px; left: 0; width: 132px; height: 34px; }
.fx-train svg { width: 100%; height: auto; display: block; }
.fx-hud { position: absolute; left: 8px; top: 8px; max-width: 82%; background: rgba(255,255,255,.88); color: #1c2430; border-radius: 8px; padding: 4px 8px; font-size: 11px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fx-hud b { display: block; font-size: 12px; }

/* Lite: every animation and transition off, and anything caught
   mid-reveal is forced fully visible. This is the whole point of
   the mode - the static site, exactly as it was before Phase 1. */
html.fx-lite *, html.fx-lite *::before, html.fx-lite *::after { animation: none !important; transition: none !important; }
html.fx-lite .rv-arm { opacity: 1 !important; transform: none !important; }
html.fx-lite .fx-scene { display: none; }
.chip {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.clr-x { flex: 0 0 auto; align-self: center; padding: 7px 12px; font-size: 17px; font-weight: 700; line-height: 1; }
.chip.active { background: var(--accent-soft); border-color: rgba(109,124,255,.5); color: var(--accent); }

/* ---------- seat map ---------- */
.bay {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; margin-bottom: 10px;
}
.bay .bay-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.bay .bay-free { font-size: 10.5px; letter-spacing: 0; text-transform: none; }
.bay .bay-free.good { color: var(--green); }
.bay .bay-free.bad { color: var(--red); }
.bay-grid { --aisle: 18px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
/* True bays (Revamp Phase 2): the bay header takes the class
   livery (same colours as the rake strip's wagons), and the
   first paint of a coach's map pops its bays in with a light
   stagger (inline delay per bay). The tb-pop class is only
   ever added by JS in Full mode, and the Lite kill in the
   effects section stops the animation regardless. */
.tbay.lv-1a { --lv: #8e2f3c; } .tbay.lv-2a { --lv: #2e6fb7; }
.tbay.lv-3a { --lv: #2a9d8f; } .tbay.lv-3e { --lv: #7b5ea7; }
.tbay.lv-sl { --lv: #e4572e; }
.tbay.lv-cc { --lv: #ff8fb1; } .tbay.lv-ec { --lv: #ff8f6b; }
.tbay .bay-label { color: var(--lv, var(--muted)); }
.bay.tb-pop, .tchair-row.tb-pop { animation: fxBayPop .38s cubic-bezier(.2,.8,.3,1) both; }
@keyframes fxBayPop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
/* Design 1 (Ravi's pick, 24 Nov): berth-shaped cells in the TRUE
   BAY view only - every rule here is scoped under .tbay, so the
   fallback grid, the all-coaches view and the mxMap sheet keep
   the current cell design untouched. Bottom-row cells (.pill-b,
   set by the bay renderer) mirror the berth: the headrest pill
   moves below the cell and the rounded end follows it, so the
   two rows visibly face each other; side-section cells keep the
   pill at the top. A free berth's headrest is filled with the
   app's free colour (its frame is already the 2px free-colour
   border of the v34 palette block, its tint the same soft fill);
   part-way, booked (hatching + cross) and no-data (dotted) keep
   their current treatments on the mirrored shape. The hop bar
   keeps every block and colour - it only reads cleaner: a touch
   taller, blocks visibly separated with rounded corners, and
   the existing out-of-segment muting (.legbar i.out) unchanged.
   Size (Ravi, 24 Nov: "the actual seat is small and not able to
   see hop progress"): true-bay cells are taller, the berth
   number bigger and the hop bar taller again (12px), so the
   hop progress reads at a glance at phone widths; the grid
   columns are untouched, so bays grow downward, never sideways.
   Trim (Ravi, 25 Nov, from the preview: "Height is more"): 92px
   overshot - cells come down to 79px, still taller than the old
   64px and with the 12px hop bar and 17px number untouched. */
.tbay .berth { min-height: 79px; }
.tbay .berth .b-num { font-size: 17px; }
.tbay .berth.pill-b { margin-bottom: 12px; border-radius: 13px 13px 5px 5px !important; }
.tbay .berth.pill-b::before { top: auto; bottom: -13px; border-top: 0; border-bottom: 1.5px solid var(--sc); border-radius: 0 0 10px 10px; }
.tbay .berth.free::before { background: var(--sc); }
.tbay .berth .legbar { height: 12px; gap: 2px; overflow: visible; border-radius: 0; }
.tbay .berth .legbar i { border-radius: 2px; }
/* Chair-car rows (Revamp chair-car layouts): CC/EC coaches render
   as the rows WIMT draws them - left block, an 18px aisle, right
   block, with a clear break after the middle row (the mid-coach
   gap). Each row is a grid (left block / aisle / right block) so
   a 2-seat block and a 3-seat block share the same aisle line;
   the blocks are grids of equal seats. The row gap is 16px, the
   same as the bay grid's, so the headrest pill above each cell
   never overlaps the row above. Scoped under .tchair (inside
   .tbay), so the fallback grid and the berth bays are untouched;
   the 79px cells, 17px numbers and 12px hop bar come from .tbay. */
.tchair-row { display: grid; margin-bottom: 16px; }
.tchair-row:last-child { margin-bottom: 0; }
.tchair-blk { display: grid; gap: 8px; min-width: 0; }
.tchair-blk.b3 { grid-template-columns: repeat(3, 1fr); }
.tchair-blk.b2 { grid-template-columns: repeat(2, 1fr); }
.tchair-gap { border-top: 2px solid var(--line); margin: 14px 0; }
/* Current-coach indicator (Ravi, 25 Nov): the Coach map tab says
   plainly which coach is on screen - tapping A2/B2 lands at the
   start of that coach's map, and with no label nothing said which
   coach it was. Sticky under the tab bar so it stays visible while
   scrolling the bays; the berth count appears once that coach's
   map has loaded (the renderer already holds it), never a new
   call. Reuses the card background and muted text - no new
   colour family, no extra legend line. */
.coach-now { position: sticky; top: 60px; z-index: 5; margin-top: 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 15px; }
.coach-now b { font-weight: 800; }
.coach-now span { color: var(--muted); font-weight: 600; }
.berth {
  border-radius: 10px; padding: 8px 6px 7px; text-align: center;
  border: 1px solid var(--line); background: var(--card-2);
}
.berth .b-num { font-size: 14px; font-weight: 800; }
.berth .b-code { font-size: 9.5px; color: var(--muted); font-weight: 700; letter-spacing: .3px; }
.berth.free { border-color: rgba(47,191,113,.55); background: var(--green-soft); }
.berth.free .b-code { color: var(--green); }
.berth.partial { border-color: rgba(245,165,36,.5); background: var(--amber-soft); }
.berth.partial .b-code { color: var(--amber); }
.berth .legbar { display: flex; gap: 1px; margin-top: 6px; height: 5px; border-radius: 3px; overflow: hidden; }
.berth .legbar i { flex: 1; background: rgba(255,255,255,.3); }
.berth .legbar i.free { background: var(--green); }
.berth .legbar i.occ { background: var(--red); }
.berth .legbar i.unk { background: rgba(255,255,255,.3); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.legend .l-free { background: var(--green); }
.legend .l-occ { background: var(--red); }
.legend .l-unk { background: rgba(255,255,255,.3); }
.quota-line { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quota-pill {
  font-size: 12px; font-weight: 700; border-radius: 8px; padding: 4px 9px;
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--muted);
}
.quota-pill b { color: var(--text); }

/* ---------- vacancies ---------- */
.leg-block { margin-bottom: 14px; }
.leg-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 10px; font-size: 14px; font-weight: 700; margin-bottom: 8px;
}
.leg-head .lc { color: var(--green); font-size: 12.5px; }
.vac-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.vac-item {
  background: var(--green-soft); border: 1px solid rgba(47,191,113,.4);
  border-radius: 10px; padding: 7px 10px; font-size: 13px; font-weight: 700;
  display: flex; flex-direction: column; align-items: center; min-width: 62px;
}
.vac-item .v-sub { font-size: 10.5px; color: var(--muted); font-weight: 600; }

/* ---------- route ---------- */
.route-list { display: flex; flex-direction: column; }
.stop {
  display: grid; grid-template-columns: 52px 20px 1fr auto; gap: 10px;
  padding: 9px 0; align-items: center; position: relative;
}
.stop .stime { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.stop .stime .arr { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.stop .sdot { display: flex; flex-direction: column; align-items: center; align-self: stretch; }
.stop .sdot::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--line); margin: 5px 0; flex: 0 0 auto; }
.stop .sdot::after { content: ""; width: 2px; flex: 1; background: var(--line); }
.stop:last-child .sdot::after { display: none; }
.stop.board .sdot::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stop.charted .sdot::before { background: var(--green); }
.stop .sname { font-size: 14px; font-weight: 600; }
.stop .sname small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.stop .smeta { font-size: 11.5px; color: var(--muted); text-align: right; }
.flag-pill {
  display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .3px;
  padding: 2px 8px; border-radius: 999px; margin-top: 3px;
}
.flag-pill.board { background: var(--accent-soft); color: var(--accent); }
.flag-pill.chart { background: var(--green-soft); color: var(--green); }
.flag-pill.pending { background: var(--amber-soft); color: var(--amber); }

/* ---------- analysis table ---------- */
.ana-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ana-table th, .ana-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.ana-table th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.ana-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.pbar { height: 6px; border-radius: 3px; background: var(--bg-soft); overflow: hidden; min-width: 60px; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--amber), var(--red)); }

/* ---------- misc ---------- */
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-ghost {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.btn-ghost:disabled { opacity: .5; cursor: wait; }
.mini-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
footer {
  max-width: 760px; margin: 0 auto; padding: 0 14px 34px;
  color: var(--muted); font-size: 12px; text-align: center;
}
@media (min-width: 640px) {
  #searchForm { grid-template-columns: 1fr 1fr 1fr auto; }
  .field:nth-child(3) { grid-column: auto; }
  .go-btn { grid-column: auto; align-self: end; padding: 11px 26px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .bay-grid { grid-template-columns: repeat(4, 1fr); }
}

/* berth tap + bottom sheet */
.berth { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.berth:active, .berth:focus-visible { outline: 2px solid var(--accent); }
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 14px 14px 22px; animation: sheetUp .18s ease-out; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.sheet-head b { display: block; font-size: 15px; }
.sheet-head span { color: var(--muted); font-size: 12px; }
.sheet-x { background: var(--card-2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; width: 34px; height: 34px; font-size: 20px; line-height: 1; }
.run { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; margin-bottom: 6px; border: 1px solid var(--line); background: var(--card-2); font-size: 13px; }
.run small { color: var(--muted); }
.run .run-tag { flex: none; min-width: 58px; text-align: center; font-size: 11px; font-weight: 800; padding: 3px 6px; border-radius: 6px; }
.run.free .run-tag { background: var(--green-soft); color: var(--green); }
.run.occ .run-tag { background: var(--red-soft); color: var(--red); }
.run.unk .run-tag { background: rgba(255,255,255,.3); color: var(--muted); }

/* train autocomplete */
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,.45); }
.suggest.hidden { display: none; }
.sug-item { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 10px 12px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 13px; cursor: pointer; }
.sug-item:last-child { border-bottom: 0; }
.sug-item b { color: var(--accent); font-variant-numeric: tabular-nums; }
.sug-item span { color: var(--muted); }

/* ---------- v5 additions ---------- */
.tab-bar { overflow-x: auto; scrollbar-width: none; }
.tab-bar::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; padding: 9px 14px; }
.hidden { display: none !important; }
#stationText { width: 100%; }
.verdict { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; margin-bottom: 12px; border: 1px solid var(--line); }
.verdict.yes { background: var(--green-soft); border-color: rgba(47,191,113,.45); }
.verdict.no { background: var(--red-soft); border-color: rgba(229,72,77,.45); }
.verdict .v-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 18px; }
.verdict.yes .v-ico { background: var(--green); color: #06210f; }
.verdict.no .v-ico { background: var(--red); color: #2a0608; }
.verdict b { display: block; font-size: 15px; }
.verdict span { font-size: 12.5px; color: var(--muted); }
.chart-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.cs { border: 1px solid var(--line); background: var(--card-2); border-radius: 12px; padding: 10px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; }
.cs b { font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.cs span { font-weight: 700; }
.cs.done span { color: var(--green); } .cs.pend span { color: var(--amber); }
.cs small { color: var(--muted); }
.snap-lines { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.snap-lines div { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; padding: 8px 10px; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; }
.snap-lines span { color: var(--muted); flex-basis: 100%; font-size: 11.5px; }
.snap-lines em { font-style: normal; color: var(--muted); font-size: 12px; }
/* route timeline */
.stop.tappable { cursor: pointer; }
.stop.sel .sname b, .stop.sel .sname { color: var(--accent); }
.stop.sel .sdot::before { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.lv-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 8px; align-items: center; }
.lv { display: inline-block; width: 18px; height: 6px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.lv.g, .leg.g .lrail { background: var(--green); } .lv.a, .leg.a .lrail { background: var(--amber); } .lv.r, .leg.r .lrail { background: var(--red); }
.lv-note { margin-left: auto; font-size: 11px; }
.leg { display: grid; grid-template-columns: 52px 20px 1fr; gap: 10px; align-items: stretch; }
.leg .lrail { width: 4px; border-radius: 2px; justify-self: center; min-height: 34px; }
.leg.dim { opacity: .38; } .leg.dim .lrail { background: var(--line); }
.leg .lbody { padding: 6px 0; }
.leg .lbar { height: 8px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.leg .lbar i { display: block; height: 100%; border-radius: 4px; }
.leg.g .lbar i { background: var(--green); } .leg.a .lbar i { background: var(--amber); } .leg.r .lbar i { background: var(--red); }
.leg .ltxt { display: flex; justify-content: space-between; font-size: 12px; margin-top: 4px; }
.leg .ltxt b { font-size: 13px; } .leg .ltxt span { color: var(--muted); }
.sflow { margin-top: 5px; display: flex; flex-direction: column; gap: 3px; font-weight: 500; }
.sflow > div { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sflow .up, .sflow .dn { font-size: 11px; font-weight: 800; margin-right: 2px; }
.sflow .up, .mini-h.up { color: var(--green); } .sflow .dn, .mini-h.dn { color: var(--red); }
.cchip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); color: var(--text); }
.cchip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.qpill { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin: 0 4px 3px 0; }
.qpill b { color: var(--text); }
.cls-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.flow-svg { width: 100%; height: auto; display: block; }
.flow-svg .ax { fill: var(--muted); font-size: 9px; }
.mini-h { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin: 14px 0 6px; color: var(--muted); }
.rank-row { display: flex; gap: 8px; margin-bottom: 8px; }
.rk { flex: none; width: 18px; color: var(--muted); font-size: 12px; font-weight: 800; text-align: right; padding-top: 1px; }
.rk-main { flex: 1; min-width: 0; }
.rk-top { display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.rk-top small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-n { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.rk-sub { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sbar { height: 8px; border-radius: 4px; background: var(--card-2); margin-top: 4px; overflow: hidden; }
.sbar-in { display: flex; height: 100%; border-radius: 4px; overflow: hidden; }
.sbar-in i { display: block; height: 100%; }
.sbar-in.q i { background: var(--accent); }
.q-line { margin-top: 10px; }
.link-btn { background: none; border: 0; color: var(--accent); text-decoration: underline; font-size: inherit; padding: 0; cursor: pointer; }
.qbar-row { margin-bottom: 9px; }
.qb-top { display: flex; gap: 6px; align-items: baseline; font-size: 13px; }
.qb-top small { color: var(--muted); font-size: 11px; }
.st-det { border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); margin-bottom: 8px; overflow: hidden; }
.st-det summary { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; cursor: pointer; font-size: 14px; list-style: none; }
.st-det summary::-webkit-details-marker { display: none; }
.st-det summary small { color: var(--muted); font-size: 11.5px; }
.st-n { font-weight: 800; background: var(--accent-soft); color: var(--accent); padding: 1px 10px; border-radius: 999px; }
.st-q { padding: 0 12px 8px; font-size: 12px; color: var(--muted); }
.st-q b { color: var(--text); }
.st-coach { padding: 8px 12px; border-top: 1px solid var(--line); }
.st-ch { font-size: 13px; margin-bottom: 5px; } .st-ch small { color: var(--muted); } .st-ch em { font-style: normal; color: var(--muted); margin-left: 4px; }
.st-berths { display: flex; flex-wrap: wrap; gap: 5px; }
.st-b { font-size: 11.5px; padding: 3px 8px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
.st-b i { font-style: normal; color: var(--accent); font-weight: 800; }
.st-b small { color: var(--muted); }
.qlegend { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); padding: 8px 10px; font-size: 12px; }
.qlegend summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.qrow { display: flex; gap: 10px; padding: 4px 0; }
.qrow b { flex: none; width: 44px; color: var(--accent); }
.qrow span { color: var(--text); }
.run-tag em { display: block; font-style: normal; font-size: 10px; opacity: .85; }
/* vacancies */
.range-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; margin-top: 12px; align-items: end; }
.vac-range-summary { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 12px; min-height: 40px; padding: 8px 12px; background: var(--card-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font-family: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.vac-range-summary .vrs-names { flex: 1; min-width: 0; }
.vac-range-summary .vrs-act { color: var(--accent); font-weight: 700; white-space: nowrap; }
.range-row .clr-x { margin-bottom: 4px; }
.range-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.range-row select { width: 100%; min-width: 0; background: var(--card-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; font-size: 13px; text-transform: none; letter-spacing: 0; }
.vac-summary { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); font-size: 13px; }
.vac-summary b { color: var(--green); font-size: 16px; }
.corr { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.corr-t { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; flex-basis: 100%; }
.corr-chip { background: var(--green-soft); border: 1px solid rgba(47,191,113,.45); color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.corr-chip b { color: var(--green); }
.split-box { margin-top: 16px; }
.split-box h3 { font-size: 14px; margin-bottom: 8px; } .split-box h3 .sub { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.split-opt { border: 1px solid var(--line); background: var(--card-2); border-radius: 12px; padding: 10px; margin-bottom: 8px; font-size: 13px; }
.split-mid { margin-bottom: 6px; } .split-mid small { color: var(--muted); }
.split-leg { padding: 3px 0; } .split-leg small { color: var(--muted); }
.sl-tag { display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; margin-right: 6px; }
.conf-list { display: flex; flex-direction: column; gap: 5px; }
.conf-item { font-size: 12.5px; padding: 7px 10px; border-radius: 8px; background: var(--card-2); border: 1px solid var(--line); }
.conf-item span { color: var(--muted); } .conf-item small { display: block; color: var(--muted); margin-top: 2px; }

/* ---------- date picker ---------- */
.date-wrap { position: relative; }
.date-wrap #dateInput, .date-wrap input[type=text] { padding-right: 46px; width: 100%; }
.date-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; color: #fff; border-radius: 9px; background: linear-gradient(135deg, #ff7a59, #ff4fa3); overflow: hidden; }
.date-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; font-size: 16px; }
.date-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }

/* ---------- colourful theme ---------- */
:root {
  --bg: #0a0c18; --bg-soft: #10132a; --card: #151934; --card-2: #1c2142; --line: #2c3361;
  --accent: #7b8cff; --accent-soft: rgba(123, 140, 255, .18);
  --green: #38d47f; --green-soft: rgba(56, 212, 127, .17);
  --amber: #ffb02e; --amber-soft: rgba(255, 176, 46, .17);
  --red: #ff5a67; --red-soft: rgba(255, 90, 103, .17);
  --c-overview: #7b8cff; --c-vac: #38d47f; --c-coach: #ffb02e; --c-route: #2fd7e0; --c-quota: #ff6fb5;
  --tab-c: var(--c-overview);
}
body {
  background:
    radial-gradient(900px 420px at 0% -5%, rgba(123, 140, 255, .28), transparent 60%),
    radial-gradient(700px 380px at 100% 8%, rgba(255, 111, 181, .20), transparent 60%),
    radial-gradient(800px 500px at 50% 105%, rgba(47, 215, 224, .16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
#content[data-tab="overview"] { --tab-c: var(--c-overview); }
#content[data-tab="vacancies"] { --tab-c: var(--c-vac); }
#content[data-tab="coaches"] { --tab-c: var(--c-coach); }
#content[data-tab="route"] { --tab-c: var(--c-route); }
#content[data-tab="quota"] { --tab-c: var(--c-quota); }
#content .card { border-top: 3px solid var(--tab-c); background-image: linear-gradient(180deg, color-mix(in srgb, var(--tab-c) 9%, transparent), transparent 90px); }
#content .card:nth-child(3n+2) { border-top-color: color-mix(in srgb, var(--tab-c) 55%, #ff6fb5); }
#content .card:nth-child(3n+3) { border-top-color: color-mix(in srgb, var(--tab-c) 55%, #ffb02e); }
#content .card h2 { color: color-mix(in srgb, var(--tab-c) 55%, #fff); }
.tab[data-tab="overview"].active { background: rgba(123,140,255,.22); color: var(--c-overview); }
.tab[data-tab="vacancies"].active { background: rgba(56,212,127,.2); color: var(--c-vac); }
.tab[data-tab="coaches"].active { background: rgba(255,176,46,.2); color: var(--c-coach); }
.tab[data-tab="route"].active { background: rgba(47,215,224,.2); color: var(--c-route); }
.tab[data-tab="quota"].active { background: rgba(255,111,181,.2); color: var(--c-quota); }
.tab[data-tab="overview"] { box-shadow: inset 0 -2px 0 var(--c-overview); }
.tab[data-tab="vacancies"] { box-shadow: inset 0 -2px 0 var(--c-vac); }
.tab[data-tab="coaches"] { box-shadow: inset 0 -2px 0 var(--c-coach); }
.tab[data-tab="route"] { box-shadow: inset 0 -2px 0 var(--c-route); }
.tab[data-tab="quota"] { box-shadow: inset 0 -2px 0 var(--c-quota); }
.chip.active { background: color-mix(in srgb, var(--tab-c, #7b8cff) 25%, transparent); border-color: var(--tab-c, #7b8cff); color: #fff; }
.go-btn { background: linear-gradient(120deg, #6d7cff, #b06cff 45%, #ff6fb5 80%, #ffb02e); }
.logo, .brand-mark, header .mark { background: linear-gradient(135deg, #6d7cff, #ff6fb5 60%, #ffb02e) !important; }
.stat:nth-child(4n+1) { border-left: 3px solid #7b8cff; } .stat:nth-child(4n+2) { border-left: 3px solid #2fd7e0; }
.stat:nth-child(4n+3) { border-left: 3px solid #ffb02e; } .stat:nth-child(4n+4) { border-left: 3px solid #ff6fb5; }
.stat { background: var(--card-2); }
.class-tag { background: linear-gradient(135deg, rgba(123,140,255,.3), rgba(255,111,181,.25)); }
.cs.done { border-color: rgba(56,212,127,.5); } .cs.pend { border-color: rgba(255,176,46,.5); }
.qpill { background: rgba(255,111,181,.16); color: #ff9fd0; }
.st-n { background: rgba(255,111,181,.18); color: #ff9fd0; }
.qrow b { color: #ff9fd0; } .st-b i { color: #ff9fd0; }
.sbar-in.q i { background: linear-gradient(90deg, #7b8cff, #ff6fb5); }
.berth.free { background: linear-gradient(180deg, rgba(56,212,127,.28), rgba(56,212,127,.1)); }
.berth.partial { background: linear-gradient(180deg, rgba(255,176,46,.26), rgba(255,176,46,.09)); }
.sheet { border-top: 3px solid var(--c-coach); }
.verdict.yes { background: linear-gradient(120deg, rgba(56,212,127,.28), rgba(47,215,224,.14)); }
.verdict.no { background: linear-gradient(120deg, rgba(255,90,103,.28), rgba(255,176,46,.12)); }
.split-opt { border-left: 3px solid var(--c-vac); }
.corr-chip { background: rgba(56,212,127,.16); }

.link-a { display: inline-block; text-decoration: none; text-align: center; }

.ntes-lines { display: flex; flex-direction: column; gap: 5px; }
.ntes-lines div { font-size: 12.5px; padding: 7px 10px; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; }

/* v8 */
.fq-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.fq-sum div { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.fq-sum b { display: block; font-size: 20px; color: #ff9fd0; }
.fq-sum span { font-size: 11px; color: var(--muted); }
.cls-chip { font-size: 12px; padding: 3px 10px; border: 1.5px solid; border-radius: 999px; }
.fq-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.fq-actions .btn-ghost { flex: 1; }
.fq-det { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--card-2); }
.fq-det summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; }
.fq-det summary::-webkit-details-marker { display: none; }
.fq-det summary::after { content: '+'; color: var(--muted); font-weight: 800; }
.fq-det[open] summary::after { content: '\2212'; }
.fq-name { flex: none; min-width: 64px; }
.fq-name i { font-style: normal; font-size: 12px; font-weight: 700; }
.fq-bar { flex: 1; height: 8px; background: rgba(255,255,255,.07); border-radius: 6px; overflow: hidden; }
.fq-bar u { display: block; height: 100%; border-radius: 6px; }
.fq-n { font-weight: 800; min-width: 38px; text-align: right; }
.fq-n small { color: var(--muted); font-weight: 600; }
.fq-body { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 10px; }
.fq-berth { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 12px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.fq-berth b { color: #fff; font-size: 14px; }
.fq-berth small { color: var(--muted); }
.fq-berth span { color: var(--muted); }
.fq-berth i { font-style: normal; color: #ff9fd0; font-weight: 700; }
.flow-svg { display: block; margin: 6px 0; overflow: visible; }
.flow-heads { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 6px; }
.flow-list h3 { font-size: 14px; margin: 12px 0 6px; display: flex; align-items: center; gap: 8px; }
.flow-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 7px 10px; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 5px; font-size: 13px; }
.flow-row em { font-style: normal; font-weight: 800; color: #ff9fd0; }
.flow-row small { grid-column: 1 / -1; color: var(--muted); }
.brand-mark { padding: 0 !important; overflow: hidden; display: block; }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.credit { margin-top: 8px; font-weight: 700; color: var(--text); }
.confirm-line { color: #fff; }

.stop .stime .tl { display: block; font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.stop .stime .tl em { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-right: 3px; }
.mode-card { display: flex; flex-direction: column; gap: 10px; }
.seg { display: flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; padding: 9px 6px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: linear-gradient(135deg, #ffb02e, #ff6fb5); color: #fff; }
.fq-map { padding: 0 10px 10px; }
.fq-fail { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.berth.qm { border-color: #ff6fb5; background: rgba(255,111,181,.22); box-shadow: 0 0 0 1px #ff6fb5 inset; }
.berth.qm .b-code { color: #ffd0e8; font-weight: 800; }
.berth.qdim { opacity: .28; }


/* ---------- live running status ---------- */
.live-card { border-color: rgba(47,191,113,.35); background: linear-gradient(160deg, rgba(47,191,113,.08), var(--card) 55%); }
.live-hero { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--green-soft); border: 1px solid rgba(47,191,113,.4); }
.live-hero.late { background: var(--amber-soft); border-color: rgba(245,165,36,.5); }
.live-pos { font-weight: 700; font-size: 15px; }
.live-delay { font-weight: 600; font-size: 13px; margin-top: 2px; }
.live-next { font-size: 13px; margin-top: 4px; color: var(--text); }
.live-bar { margin-top: 10px; height: 8px; }
.live-bar i { background: linear-gradient(90deg, #2fbf71, #6d7cff); }
.live-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.live-err { color: var(--amber); }
.live-stops { margin-top: 12px; }
.live-stops summary { cursor: pointer; font-size: 13px; color: var(--accent); padding: 6px 0; }
.lv-list { margin-top: 6px; }
.lv-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.lv-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.lv-row.done .lv-dot { background: var(--green); border-color: var(--green); }
.lv-row.here .lv-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.lv-row.done { opacity: .75; }
.lv-main { flex: 1; min-width: 0; }
.lv-main small { color: var(--muted); display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-main small.lv-rev { color: var(--amber); font-weight: 600; }
.rev-note { margin-top: 12px; }
.sug-item em.sug-rev { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 600; color: var(--amber); white-space: nowrap; }
.lv-t { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.lv-t em { display: block; font-style: normal; font-size: 11.5px; font-weight: 600; }
.lv-t em.ok { color: var(--green); }
.lv-t em.late { color: var(--amber); }
.lv-t small { display: block; color: var(--muted); font-size: 11px; }
.live-name { margin-top: 10px; }
.live-name-en { font-weight: 700; font-size: 14.5px; }
.live-name-hi { color: var(--muted); font-size: 13px; margin-top: 1px; }
.live-wtt { margin-top: 12px; }
.live-wtt summary { cursor: pointer; font-size: 13px; color: var(--accent); padding: 6px 0; }
.lv-row.pass { color: var(--muted); }
.lv-row.pass .lv-dot { width: 8px; height: 8px; border-style: dashed; }
.lv-row.pass .lv-main b { color: var(--text); font-weight: 600; }

/* ---------- fare, route search, run-day ---------- */
.route-search { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.route-search summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.rs-grid { display: grid; gap: 10px; margin-top: 10px; }
.rs-pos { position: relative; }
.rs-train { display: block; width: 100%; text-align: left; margin-top: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font: inherit; cursor: pointer; }
.rs-train:active { transform: scale(.99); }
.rs-top { font-size: 14px; }
.rs-times { margin-top: 4px; font-size: 14px; font-weight: 600; }
.rs-times small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.rs-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.rs-cls i { font-style: normal; font-size: 11.5px; padding: 2px 7px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); margin-left: 4px; }
.fare-card { border-color: rgba(255,176,46,.35); background: linear-gradient(160deg, rgba(255,176,46,.07), var(--card) 55%); }
.fare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fare-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; min-width: 0; }
.fare-grid select, .fare-grid input { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); font: inherit; font-size: 14px; text-transform: none; min-width: 0; }
.fare-date { grid-column: 1 / -1; }
.fare-box { margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); }
.fare-top b { display: block; font-size: 14px; }
.fare-top span { font-size: 12px; color: var(--muted); }
.fare-lines { margin-top: 8px; }
.fare-lines > div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.fare-lines .fare-total { border-bottom: 0; font-size: 16px; font-weight: 700; color: var(--amber); padding-top: 8px; }
.avl-list { margin-top: 10px; }
.avl-row { display: flex; justify-content: space-between; padding: 8px 10px; margin-top: 6px; border-radius: 10px; background: var(--bg-soft); font-size: 13.5px; }
.avl.ok { color: var(--green); } .avl.rac { color: var(--amber); } .avl.wl { color: var(--red); }
.nd-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; }
.nd-chip .avl { font-size: 12.5px; font-weight: 700; }
.runday { border-color: rgba(245,165,36,.5); background: var(--amber-soft); }
.runday h2 { color: var(--amber); }

.berth { position: relative; }
.berth .b-share { position: absolute; top: 2px; right: 3px; min-width: 14px; height: 14px; line-height: 14px; border-radius: 7px; background: var(--amber); color: #111; font-size: 9px; font-weight: 800; text-align: center; }
.shared-box { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--amber); border-radius: 10px; background: var(--amber-soft); }
.shared-box > b { display: block; margin-bottom: 6px; font-size: 13px; }
.shared-row { font-size: 13px; padding: 4px 0; }
.shared-row span { font-weight: 700; }
.shared-row em { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 8px; background: var(--amber); color: #111; margin-right: 4px; }
.mx-table td, .mx-table th { white-space: nowrap; padding: 6px 8px; }
.mx-table .mx-0 { color: var(--muted); opacity: .8; font-weight: 700; }
.mx-table tr.mx-tot td { border-top: 1px solid var(--line, rgba(255,255,255,.3)); }
.fare-card > summary { cursor: pointer; list-style: none; }
.fare-card > summary::-webkit-details-marker { display: none; }
.fare-card > summary h2 { margin-bottom: 0; }
.fare-card[open] > summary h2 { margin-bottom: 10px; }
.mx-b { background: none; border: 0; color: inherit; font: inherit; font-weight: 700; padding: 6px 8px; border-radius: 8px; cursor: pointer; text-decoration: underline dotted; }
.mx-b.on { background: var(--amber); color: #111 !important; text-decoration: none; }
.mx-list { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line, rgba(255,255,255,.3)); border-radius: 10px; }
.mx-list > b { display: block; margin-bottom: 6px; font-size: 13px; }
.mx-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.07); font-size: 13px; }
.mx-row .mx-leg { grid-column: 1 / 3; color: var(--muted); font-size: 12px; }
.mx-row .mx-q { font-size: 11px; font-weight: 700; color: var(--amber); }
.mx-sum { margin-top: 10px; font-size: 13px; }
.mx-list { margin-top: 10px; }
.mx-list > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); }
#mxChips { margin-top: 8px; }

.recent-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.recent-h { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-right: 2px; }
.recent-chip small { color: var(--muted); }
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.share-row .mini-note { margin: 0; }
#iosHint { margin-top: 10px; }
.pnr-box { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line, rgba(255,255,255,.3)); border-radius: 10px; }
.pnr-top { font-size: 14px; margin-bottom: 6px; }
.pnr-lines > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: 13px; }
.pnr-lines span { color: var(--muted); }
.pnr-pax { margin-top: 8px; }
.pnr-p { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; padding: 7px 0; border-top: 1px solid rgba(255,255,255,.07); font-size: 13px; }
.pnr-p > span { grid-column: 1 / 3; font-weight: 700; }
.pnr-p small { color: var(--muted); }
.pnr-p em { font-style: normal; color: var(--muted); font-size: 12px; }

/* ================= v21 refresh: brighter theme, clear tap affordances, train loader ================= */
:root {
  --bg: #2b2478;
  --bg-soft: #372f8f;
  --card: #41399f;
  --card-2: #4d44b4;
  --line: rgba(255,255,255,.24);
  --text: #ffffff;
  --muted: #d6d1ff;
  --accent: #a3b2ff;
  --accent-soft: rgba(163,178,255,.26);
  --green: #3bf09a; --green-soft: rgba(59,240,154,.2);
  --amber: #ffc43d; --amber-soft: rgba(255,196,61,.22);
  --red: #ff6b7a; --red-soft: rgba(255,107,122,.22);
  --c-overview: #a3b2ff; --c-vac: #3bf09a; --c-coach: #ffc43d; --c-route: #3ee8f2; --c-quota: #ff7cc4;
  --raise: 0 3px 0 rgba(10,6,50,.45);
}
body {
  background:
    radial-gradient(900px 480px at 0% -5%, rgba(255,111,181,.50), transparent 60%),
    radial-gradient(800px 460px at 100% 6%, rgba(62,232,242,.38), transparent 60%),
    radial-gradient(900px 560px at 50% 108%, rgba(255,196,61,.34), transparent 60%),
    linear-gradient(180deg, #2f2788, #231d66);
  background-attachment: fixed;
}
.topbar { background: linear-gradient(180deg, #5246c9, #3a31a0); border-bottom: 1px solid rgba(255,255,255,.25); }
.tagline { color: #e4e0ff; }
.notice.error p { color: #ffd2d6; } .notice.warn p { color: #ffeab8; }
.tab-bar { background: rgba(20,12,80,.35); }
.tab { color: #e4e0ff; }
input, select { background: #2a2377; color: #fff; border-color: rgba(255,255,255,.35); }
.recent-h, .mini-note, .hint { color: var(--muted); }

/* --- tappable things look raised, static things stay flat --- */
.tab, .chip, .btn-ghost, .coach-chip, .mx-b, .fq-berth, .rs-train, .icon-btn, .go-btn, .berth, .flow-node {
  cursor: pointer; -webkit-tap-highlight-color: rgba(255,255,255,.25);
}
.chip, .btn-ghost, .coach-chip, .rs-train, .icon-btn, .fq-berth {
  border: 1.5px solid rgba(255,255,255,.5); box-shadow: var(--raise);
  background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.08));
  color: #fff; font-weight: 700;
}
.chip:active, .btn-ghost:active, .coach-chip:active, .rs-train:active, .icon-btn:active, .fq-berth:active, .go-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(10,6,50,.45); }
.go-btn { box-shadow: 0 4px 0 rgba(10,6,50,.5), 0 8px 18px rgba(255,111,181,.35); border: 1.5px solid rgba(255,255,255,.45); color: #fff; font-weight: 800; }
.chip.active, .coach-chip.active { color: #fff; box-shadow: 0 0 0 2px var(--tab-c, #fff) inset, var(--raise); }
.berth { box-shadow: 0 2px 0 rgba(10,6,50,.4); border: 1.5px solid rgba(255,255,255,.4); }
.berth:active { transform: translateY(1px); }
.tab { border: 1.5px solid rgba(255,255,255,.25); }
.mx-b { text-decoration: underline; text-underline-offset: 3px; }
.link-btn { color: #fff; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* static info: flat, no shadow, no border-lift */
.stat, .stat-box, .quota-pill, .flag-pill, .qpill, .class-tag, .cs, .fare-box, .pnr-box, .ntes-lines div, .fq-sum div {
  box-shadow: none; cursor: default;
}
.quota-pill, .flag-pill, .qpill, .st-n { border-style: dashed; }
/* tappable route stops get an arrow */
.stop.tappable { cursor: pointer; }
.stop.tappable .smeta::after { content: ' \203A'; font-weight: 900; font-size: 18px; color: var(--tab-c); }

/* --- every expandable gets the same chevron pill --- */
details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after, .fq-det summary::after, .fq-det[open] summary::after {
  content: ''; flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255,255,255,.22) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/16px no-repeat;
  box-shadow: none; transition: transform .18s ease; color: inherit; font-weight: 400;
}
details[open] > summary::after, .fq-det[open] summary::after { transform: rotate(180deg); }
details.route-search > summary, .mx-list > summary {
  padding: 10px 12px; border: 1.5px solid rgba(255,255,255,.45); border-radius: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.06)); box-shadow: var(--raise);
}
details.route-search[open] > summary { margin-bottom: 10px; }
.fare-card > summary h2 .sub { display: block; margin: 2px 0 0; }

/* --- train loader: a little train rolling along a track --- */
.spinner {
  width: 112px; height: 34px; border: 0; border-radius: 0; margin-top: 0; position: relative; flex: 0 0 auto; animation: none;
  background:
    linear-gradient(#fff, #fff) 0 27px / 100% 2px no-repeat,
    repeating-linear-gradient(90deg, rgba(255,255,255,.75) 0 3px, transparent 3px 11px) 0 31px / 100% 3px repeat-x;
  animation: sleepers .45s linear infinite;
}
.spinner::before {
  content: ''; position: absolute; left: 4px; top: 1px; width: 104px; height: 28px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 104 28'%3E%3Crect x='2' y='7' width='22' height='15' rx='3' fill='%23ff6fb5'/%3E%3Crect x='5' y='10' width='6' height='5' rx='1' fill='%23fff'/%3E%3Crect x='14' y='10' width='6' height='5' rx='1' fill='%23fff'/%3E%3Crect x='27' y='7' width='22' height='15' rx='3' fill='%23ffc43d'/%3E%3Crect x='30' y='10' width='6' height='5' rx='1' fill='%23fff'/%3E%3Crect x='39' y='10' width='6' height='5' rx='1' fill='%23fff'/%3E%3Cpath d='M24 17h3M49 17h5' stroke='%23fff' stroke-width='2'/%3E%3Crect x='54' y='5' width='20' height='17' rx='3' fill='%233ee8f2'/%3E%3Crect x='52' y='2' width='24' height='4' rx='2' fill='%23fff'/%3E%3Crect x='58' y='9' width='9' height='7' rx='1.5' fill='%232b2478'/%3E%3Crect x='72' y='10' width='28' height='12' rx='5' fill='%2316b8c9'/%3E%3Crect x='88' y='3' width='7' height='8' rx='1.5' fill='%232b2478'/%3E%3Crect x='86' y='1' width='11' height='3' rx='1.5' fill='%23fff'/%3E%3Ccircle cx='80' cy='9' r='3.2' fill='%23ffc43d'/%3E%3Ccircle cx='99' cy='14' r='2' fill='%23fff7a8'/%3E%3Cpath d='M98 22h6l-6 -5z' fill='%23fff'/%3E%3Ccircle cx='9' cy='24' r='2.6' fill='%23fff'/%3E%3Ccircle cx='18' cy='24' r='2.6' fill='%23fff'/%3E%3Ccircle cx='32' cy='24' r='2.6' fill='%23fff'/%3E%3Ccircle cx='43' cy='24' r='2.6' fill='%23fff'/%3E%3Ccircle cx='61' cy='24' r='3.4' fill='%23fff'/%3E%3Ccircle cx='75' cy='24' r='2.8' fill='%23fff'/%3E%3Ccircle cx='85' cy='24' r='2.8' fill='%23fff'/%3E%3Ccircle cx='95' cy='24' r='2.8' fill='%23fff'/%3E%3C/svg%3E") no-repeat 0 0 / 104px 28px;
  animation: rock .5s ease-in-out infinite alternate;
}
.spinner::after {
  content: ''; position: absolute; left: 96px; top: -2px; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.85); animation: puff 1.1s ease-out infinite;
}
@keyframes puff { from { transform: translate(0,0) scale(.5); opacity: .9; } to { transform: translate(-14px,-10px) scale(1.5); opacity: 0; } }
@keyframes sleepers { to { background-position: 0 27px, -11px 31px; } }
@keyframes rock { from { transform: translateY(0); } to { transform: translateY(-1.5px); } }
@media (prefers-reduced-motion: reduce) { .spinner, .spinner::before, .spinner::after { animation: none; } }
#slowNote:empty { display: none; }

/* v21b */
body { background:
    radial-gradient(900px 480px at 0% -5%, rgba(255,111,181,.55), transparent 60%),
    radial-gradient(800px 460px at 100% 6%, rgba(62,232,242,.42), transparent 60%),
    radial-gradient(900px 560px at 50% 108%, rgba(255,196,61,.38), transparent 60%),
    linear-gradient(180deg, #3d34ad, #2d2689); background-attachment: fixed; }
:root { --card: #4a41b4; --card-2: #5850c6; --bg-soft: #4036a8; }
.tab-bar { background: #3a30a0; box-shadow: 0 6px 14px rgba(20,10,80,.35); }
.quota-pill, .flag-pill, .qpill, .st-n { border-style: solid; border-color: transparent; }
.credit { margin-top: 12px; }
.credit a, footer a { color: #fff; font-weight: 700; text-underline-offset: 3px; }
.upd-row { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; }
.ver { color: var(--muted); opacity: .8; }
footer { text-align: center; }

/* v24: flatter look - borders carry the tappable cue, shadows nearly gone */
:root { --raise: none; }
.chip, .btn-ghost, .coach-chip, .rs-train, .icon-btn, .fq-berth { box-shadow: none; border: 1.5px solid rgba(255,255,255,.4); }
.chip:active, .btn-ghost:active, .coach-chip:active, .rs-train:active, .icon-btn:active, .fq-berth:active, .go-btn:active { transform: none; box-shadow: none; opacity: .8; }
.go-btn { box-shadow: none; }
.chip.active, .coach-chip.active { box-shadow: 0 0 0 2px var(--tab-c, #fff) inset; }
.berth { box-shadow: none; }
.berth:active { transform: none; opacity: .8; }
.berth.qm { box-shadow: 0 0 0 1px #ff6fb5 inset; }
details > summary .chev, .chev { box-shadow: none; }
details summary::after, details > summary::before { box-shadow: none; }
.tab-bar { box-shadow: 0 1px 0 rgba(255,255,255,.15); }
.suggest { box-shadow: 0 4px 10px rgba(10,6,50,.25); }
/* Option A: seat with backrest and armrests */
.bay-grid{gap:16px 8px!important}
.berth{--sc:rgba(255,255,255,.5);--sf:rgba(255,255,255,.08);background:var(--sf)!important;border:1.5px solid var(--sc)!important;border-left-width:4px!important;border-right-width:4px!important;border-radius:5px 5px 13px 13px!important;margin-top:12px;padding:7px 4px 7px!important;position:relative}
.berth::before{content:"";position:absolute;left:8%;right:8%;top:-13px;height:12px;background:var(--sf);border:1.5px solid var(--sc);border-bottom:0;border-radius:10px 10px 0 0}
.berth.free{--sc:#38d47f;--sf:rgba(56,212,127,.2)}
.berth.partial{--sc:#ffb02e;--sf:rgba(255,176,46,.2)}
.berth.qm{--sc:#ff6fb5;--sf:rgba(255,111,181,.25)}
.berth.free .b-code,.berth.partial .b-code{color:inherit}

/* mini train for button loading text */
.mini-train { display: inline-block; width: 28px; height: 10px; vertical-align: -1px; margin-right: 6px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 104 28'%3E%3Crect x='2' y='7' width='22' height='15' rx='3' fill='%23ff6fb5'/%3E%3Crect x='5' y='10' width='6' height='5' rx='1' fill='%23fff'/%3E%3Crect x='14' y='10' width='6' height='5' rx='1' fill='%23fff'/%3E%3Crect x='27' y='7' width='22' height='15' rx='3' fill='%23ffc43d'/%3E%3Crect x='30' y='10' width='6' height='5' rx='1' fill='%23fff'/%3E%3Crect x='39' y='10' width='6' height='5' rx='1' fill='%23fff'/%3E%3Cpath d='M24 17h3M49 17h5' stroke='%23fff' stroke-width='2'/%3E%3Crect x='54' y='5' width='20' height='17' rx='3' fill='%233ee8f2'/%3E%3Crect x='52' y='2' width='24' height='4' rx='2' fill='%23fff'/%3E%3Crect x='58' y='9' width='9' height='7' rx='1.5' fill='%232b2478'/%3E%3Crect x='72' y='10' width='28' height='12' rx='5' fill='%2316b8c9'/%3E%3Crect x='88' y='3' width='7' height='8' rx='1.5' fill='%232b2478'/%3E%3Crect x='86' y='1' width='11' height='3' rx='1.5' fill='%23fff'/%3E%3Ccircle cx='80' cy='9' r='3.2' fill='%23ffc43d'/%3E%3Ccircle cx='99' cy='14' r='2' fill='%23fff7a8'/%3E%3Cpath d='M98 22h6l-6 -5z' fill='%23fff'/%3E%3Ccircle cx='9' cy='24' r='2.6' fill='%23fff'/%3E%3Ccircle cx='18' cy='24' r='2.6' fill='%23fff'/%3E%3Ccircle cx='32' cy='24' r='2.6' fill='%23fff'/%3E%3Ccircle cx='43' cy='24' r='2.6' fill='%23fff'/%3E%3Ccircle cx='61' cy='24' r='3.4' fill='%23fff'/%3E%3Ccircle cx='75' cy='24' r='2.8' fill='%23fff'/%3E%3Ccircle cx='85' cy='24' r='2.8' fill='%23fff'/%3E%3Ccircle cx='95' cy='24' r='2.8' fill='%23fff'/%3E%3C/svg%3E") no-repeat 0 0 / 28px 8px; animation: rock .5s ease-in-out infinite alternate; }

/* ===== v26: TrainWala theme - calm slate (night) + light (day), few gradients, almost no shadows ===== */
:root{--bg:#151c2c;--bg-soft:#1c2539;--card:#232d47;--card-2:#2b3654;--line:rgba(255,255,255,.2);--text:#f1f4fb;--muted:#b6c0d8;--accent:#8fb4ff;--accent-soft:rgba(143,180,255,.2);--green:#4be39a;--green-soft:rgba(75,227,154,.18);--amber:#ffbf47;--amber-soft:rgba(255,191,71,.18);--red:#ff7a85;--red-soft:rgba(255,122,133,.18);--c-overview:#8fb4ff;--c-vac:#4be39a;--c-coach:#ffbf47;--c-route:#5ed6e8;--c-quota:#f5a0d0;--raise:none}
body{background:#151c2c!important;color:var(--text)}
.topbar{background:#1c2539!important;border-bottom:1px solid rgba(255,255,255,.14)!important;box-shadow:none!important}
.tab-bar{background:#151c2c!important;box-shadow:0 1px 0 rgba(255,255,255,.12)!important}
.go-btn{background:#4f7be8!important;box-shadow:none!important;border:0!important;color:#fff!important}
.date-btn{background:#4f7be8!important;box-shadow:none!important}
.brand-mark,.logo,header .mark{background:#4f7be8!important}
#content .card{background-image:none!important}
.class-tag{background:var(--accent-soft)!important}
.sbar-in.q i{background:var(--accent)!important}
.verdict.yes{background:var(--green-soft)!important}
.verdict.no{background:var(--red-soft)!important}
.seg button.on{background:var(--accent)!important;color:#10182b!important}
.live-card,.fare-card{background:var(--card)!important}
.chip,.btn-ghost,.coach-chip,.rs-train,.icon-btn,.fq-berth,.tab:not(.active),.mx-b{background:rgba(255,255,255,.07)!important;box-shadow:none!important}
.tab.active{background:var(--accent-soft)!important}
.chip.active,.coach-chip.active{background:var(--accent-soft)!important}
details.route-search>summary,.mx-list>summary{background:rgba(255,255,255,.07)!important;box-shadow:none!important}
.suggest{box-shadow:none!important;border:1px solid rgba(255,255,255,.3)!important}
.berth.free{--sc:#4be39a;--sf:rgba(75,227,154,.2)}
.berth.partial{--sc:#ffbf47;--sf:rgba(255,191,71,.2)}
.berth.qm{--sc:#f5a0d0;--sf:rgba(245,160,208,.25)}
.top-actions{display:flex;gap:8px;align-items:center}
.chip:disabled{opacity:.45;cursor:default}
.top-clock{font:600 12px/1 ui-monospace,SFMono-Regular,Menlo,monospace;font-variant-numeric:tabular-nums;color:var(--muted);letter-spacing:.04em;padding:0 2px;white-space:nowrap}
html[data-theme="light"] .top-clock{color:var(--muted)!important}
.top-actions .icon-btn.hidden{display:none}

/* light (day) mode */
html[data-theme="light"]{--bg:#f2f6fb;--bg-soft:#e8eef7;--card:#ffffff;--card-2:#f3f7fc;--line:rgba(30,50,90,.22);--text:#1b2638;--muted:#55627a;--accent:#2563d8;--accent-soft:rgba(37,99,216,.14);--green:#0f9d58;--green-soft:rgba(15,157,88,.14);--amber:#c77700;--amber-soft:rgba(224,140,0,.16);--red:#d93a4a;--red-soft:rgba(217,58,74,.14);--c-overview:#2563d8;--c-vac:#0f9d58;--c-coach:#d98200;--c-route:#0891b2;--c-quota:#d6338a}
html[data-theme="light"] body{color:var(--text);background:#f2f6fb!important}
html[data-theme="light"] .topbar{background:linear-gradient(180deg,#ffffff,#eef3fa)!important;border-bottom:1px solid rgba(30,50,90,.2)!important;color:var(--text)}
html[data-theme="light"] .topbar *{color:var(--text)}
html[data-theme="light"] .topbar .sub,html[data-theme="light"] .topbar p{color:var(--muted)!important}
html[data-theme="light"] .tab-bar{background:#f2f6fb!important;box-shadow:0 1px 0 rgba(30,50,90,.15)!important}
html[data-theme="light"] .card,html[data-theme="light"] .bay,html[data-theme="light"] .notice{color:var(--text)}
html[data-theme="light"] h1,html[data-theme="light"] h2,html[data-theme="light"] h3,html[data-theme="light"] h4,html[data-theme="light"] b,html[data-theme="light"] strong,html[data-theme="light"] label,html[data-theme="light"] summary,html[data-theme="light"] .b-num,html[data-theme="light"] .chip,html[data-theme="light"] .btn-ghost,html[data-theme="light"] .coach-chip,html[data-theme="light"] .tab,html[data-theme="light"] .rs-train,html[data-theme="light"] .icon-btn,html[data-theme="light"] .fq-berth,html[data-theme="light"] .mx-b,html[data-theme="light"] .credit,html[data-theme="light"] .credit a,html[data-theme="light"] footer a,html[data-theme="light"] .stop,html[data-theme="light"] .sname{color:var(--text)!important}
html[data-theme="light"] .chip,html[data-theme="light"] .btn-ghost,html[data-theme="light"] .coach-chip,html[data-theme="light"] .rs-train,html[data-theme="light"] .icon-btn,html[data-theme="light"] .fq-berth,html[data-theme="light"] .tab,html[data-theme="light"] .mx-b{background:#fff!important;border:1.5px solid rgba(30,50,90,.35)!important}
html[data-theme="light"] .chip.active,html[data-theme="light"] .coach-chip.active{background:var(--accent-soft)!important}
html[data-theme="light"] .tab.active{background:var(--accent-soft)!important;color:var(--accent)!important;border-color:var(--accent)!important}
html[data-theme="light"] input,html[data-theme="light"] select{background:#fff!important;color:var(--text)!important;border-color:rgba(30,50,90,.35)!important}
html[data-theme="light"] .go-btn{background:#2563d8!important;color:#fff!important}
html[data-theme="light"] .go-btn *{color:#fff!important}
html[data-theme="light"] .date-btn{background:#2563d8!important}
html[data-theme="light"] .berth{--sc:rgba(30,50,90,.5);--sf:rgba(30,50,90,.06)}
html[data-theme="light"] .berth.free{--sc:#0f9d58;--sf:rgba(15,157,88,.16)}
html[data-theme="light"] .berth.partial{--sc:#d98200;--sf:rgba(224,140,0,.18)}
html[data-theme="light"] .berth.qm{--sc:#d6338a;--sf:rgba(214,51,138,.16)}
html[data-theme="light"] .berth .b-code{color:var(--muted)}
html[data-theme="light"] .berth .legbar i{background:rgba(30,50,90,.2)}
html[data-theme="light"] .legend,html[data-theme="light"] .mini-note,html[data-theme="light"] .bay .bay-label{color:var(--muted)!important}
html[data-theme="light"] .mx-b{color:var(--text)!important}
html[data-theme="light"] details > summary::after,html[data-theme="light"] .fq-det summary::after,html[data-theme="light"] .fq-det[open] summary::after{background-color:rgba(30,50,90,.14)!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231b2638' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")!important}
html[data-theme="light"] details.route-search>summary,html[data-theme="light"] .mx-list>summary{background:#fff!important;border:1.5px solid rgba(30,50,90,.35)!important;color:var(--text)!important}
html[data-theme="light"] .legend .l-unk{background:rgba(30,50,90,.3)}
html[data-theme="light"] .topbar{background:#fff!important}
html[data-theme="light"] .brand-mark{background:#2563d8!important}
html[data-theme="light"] .tab-bar{background:#f2f6fb!important}
html[data-theme="light"] .seg button.on{background:#2563d8!important;color:#fff!important}
html[data-theme="light"] .spinner{background-color:#243050;border-radius:8px}
html[data-theme="light"] .suggest{border:1px solid rgba(30,50,90,.3)!important}
html[data-theme="light"] .top-actions .icon-btn{color:var(--text)!important}
html[data-theme="light"] .berth .legbar i.free{background:var(--green)}
html[data-theme="light"] .berth .legbar i.occ{background:var(--red)}
.brand-mark,html[data-theme="light"] .brand-mark{background:#243050!important;border-radius:10px}
html[data-theme="light"] .link-btn{color:var(--accent)!important;font-weight:700}
html[data-theme="light"] .qpill,html[data-theme="light"] .st-n,html[data-theme="light"] .qrow b,html[data-theme="light"] .st-b i,html[data-theme="light"] .fq-sum b,html[data-theme="light"] .fq-berth i,html[data-theme="light"] .flow-row em{color:#b3206f!important}

/* v30: tab bar scroll hint - arrows get their own slots beside the tabs, never over labels */
.tab-wrap { position: sticky; top: 0; z-index: 10; margin-top: 18px; display: flex; align-items: center; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: #151c2c; }
.tab-wrap:has(.tab-bar.hidden) { display: none; }
.tab-wrap .tab-bar { position: static; margin-top: 0; flex: 1 1 auto; min-width: 0; background: transparent !important; border: 0 !important; padding: 0 !important; box-shadow: none !important; border-radius: 0; }
.tab-arrow { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.55); background: var(--accent); color: #10182b; font-size: 21px; line-height: 1; font-weight: 800; display: grid; place-items: center; padding: 0 0 3px; cursor: pointer; }
.tab-arrow.off { display: grid; visibility: hidden; pointer-events: none; }
html[data-theme="light"] .tab-wrap { background: #f2f6fb; border-color: rgba(30,50,90,.22); }
html[data-theme="light"] .tab-arrow { background: #2563d8; color: #fff; border-color: #fff; }

/* v30: coach view - free berths stand out, with a shape cue as well as colour */
.berth.free { --sf: color-mix(in srgb, var(--green) 34%, transparent); border-width: 2px; }
.berth.partial { --sf: color-mix(in srgb, var(--amber) 30%, transparent); }
.berth:not(.free):not(.partial):not(.qm) { opacity: .62; }
.berth.free::after, .berth.partial::after { position: absolute; left: 7px; top: 3px; font-size: 11px; font-weight: 900; line-height: 1; }
.berth.free::after { content: "\2713"; color: var(--green); }
.berth.partial::after { content: "\25D0"; color: var(--amber); }
.focus-free .berth:not(.free):not(.partial) { opacity: .18; }
.berth.flash { animation: bflash .6s ease-in-out 3; }
@keyframes bflash { 0%,100% { transform: none; } 50% { transform: scale(1.12); } }
.free-sum { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.fs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.fs-head span { color: var(--muted); font-size: 12.5px; flex: 1 1 140px; }
.fs-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.fs-tag { flex: 0 0 auto; font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 8px; white-space: nowrap; }
.fs-tag.full { background: var(--green-soft); color: var(--green); }
.fs-tag.part { background: var(--amber-soft); color: var(--amber); }
.fs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fchip { border: 1.5px solid var(--line); background: transparent; color: var(--text); border-radius: 10px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.fchip b { font-size: 13px; }
.fchip small { color: var(--muted); font-size: 10.5px; }
.fchip.full { border-color: var(--green); }
.fchip.part { border-color: var(--amber); }
.legend .l-bfull, .legend .l-bpart, .legend .l-bocc { width: 12px; height: 12px; border-radius: 3px 3px 6px 6px; border: 2px solid; background: transparent; }
.legend .l-bfull { border-color: var(--green); background: var(--green-soft); }
.legend .l-bpart { border-color: var(--amber); background: var(--amber-soft); }
.legend .l-bocc { border-color: rgba(255,255,255,.45); opacity: .6; }
html[data-theme="light"] .legend .l-bocc { border-color: rgba(30,50,90,.5); }
html[data-theme="light"] .berth.free::after { color: #0b7a43; }
html[data-theme="light"] .berth.partial::after { color: #a35f00; }
html[data-theme="light"] .fchip { color: var(--text); }
.cc-free.unk, .cr-free.unk { color: var(--muted, #8a94a8); font-weight: 600; }
.cr-free.unk { font-size: 13px; }
.warn-note { margin: 8px 0 0; padding: 6px 8px; border-left: 3px solid #d99a1c; background: rgba(217,154,28,.12); border-radius: 4px; }
.berth.inc { border-style: dashed; }
.berth.inc::after { content: "?"; color: var(--amber); }
html[data-theme="light"] .berth.inc::after { color: #a35f00; }
.fchip.inc { border-color: var(--amber); border-style: dashed; }
.fs-tag.inc { background: rgba(139,148,171,.2); color: var(--muted); }
.legend .l-binc { width: 12px; height: 12px; border-radius: 3px 3px 6px 6px; border: 2px dashed var(--amber); background: transparent; }


/* v34: the header scrolls away, only the tab bar stays pinned. Anchors and jumps leave room for it. */
html { scroll-padding-top: 74px; }
.tab-wrap { top: 0; margin-top: 14px; border-top-left-radius: 0; border-top-right-radius: 0; margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px; border-left: 0; border-right: 0; }
.tab-wrap::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; background: var(--bg); pointer-events: none; display: none; }
.berth, .fchip { scroll-margin-top: 90px; }

/* v34: free-berth filter */
.free-sum { padding: 12px; }
.fs-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; align-items: baseline; }
.fs-route { font-size: 11.5px; color: var(--muted); }
.fs-filter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.fsf { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 58px; padding: 6px 4px; border: 1.5px solid var(--line); border-radius: 12px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.fsf .fsf-i { font-size: 13px; font-weight: 900; line-height: 1; min-height: 13px; }
.fsf .fsf-n { font-size: 18px; font-weight: 800; line-height: 1.1; }
.fsf .fsf-l { font-size: 10.5px; line-height: 1.15; color: var(--muted); text-align: center; }
.fsf.full .fsf-i, .fsf.full .fsf-n { color: var(--green); }
.fsf.part .fsf-i, .fsf.part .fsf-n { color: var(--amber); }
.fsf.inc .fsf-i, .fsf.inc .fsf-n { color: var(--muted); }
.fsf.inc { border-style: dashed; }
.fsf[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #10182b; }
.fsf[aria-pressed="true"] .fsf-i, .fsf[aria-pressed="true"] .fsf-n, .fsf[aria-pressed="true"] .fsf-l { color: #10182b; }
.fsf:disabled { opacity: .45; cursor: default; }
.fsf:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.fs-explain { font-size: 12.5px; line-height: 1.45; color: var(--muted); margin: 10px 0 0; padding: 8px 10px; border-left: 3px solid var(--line); border-radius: 4px; }
#seatWrap.ff-full .berth:not(.free) { opacity: .16; }
#seatWrap.ff-part .berth:not(.partial), #seatWrap.ff-part .berth.partial.inc { opacity: .16; }
#seatWrap.ff-inc .berth:not(.inc) { opacity: .16; }
#seatWrap.ff-full .berth.free, #seatWrap.ff-part .berth.partial:not(.inc), #seatWrap.ff-inc .berth.inc { opacity: 1; }
html[data-theme="light"] .fsf[aria-pressed="true"] { background: #2563d8; border-color: #2563d8; color: #fff; }
html[data-theme="light"] .fsf[aria-pressed="true"] .fsf-i, html[data-theme="light"] .fsf[aria-pressed="true"] .fsf-n, html[data-theme="light"] .fsf[aria-pressed="true"] .fsf-l { color: #fff; }
html[data-theme="light"] .fsf.full .fsf-i, html[data-theme="light"] .fsf.full .fsf-n { color: #0b7a43; }
html[data-theme="light"] .fsf.part .fsf-i, html[data-theme="light"] .fsf.part .fsf-n { color: #a35f00; }
html[data-theme="light"] .fsf.inc .fsf-i, html[data-theme="light"] .fsf.inc .fsf-n { color: #4a5670; }
html[data-theme="light"] .fs-explain { color: #3b4760; border-left-color: rgba(30,50,90,.3); }


/* v34: colour-blind-safe berth states (Okabe-Ito blue / orange), with a symbol and a pattern per state */
:root { --cb-free: #56b4e9; --cb-free-f: rgba(86,180,233,.30); --cb-part: #e69f00; --cb-part-f: rgba(230,159,0,.26); --cb-occ: #9aa6c4; --cb-ink: #e8ecf8; --cb-no: #c9d1e6; }
html[data-theme="light"] { --cb-free: #0072b2; --cb-free-f: rgba(0,114,178,.18); --cb-part: #b35f00; --cb-part-f: rgba(213,128,0,.22); --cb-occ: #4a5670; --cb-ink: #1b2540; --cb-no: #4a5670; }
.berth.free, html[data-theme="light"] .berth.free { --sc: var(--cb-free); --sf: var(--cb-free-f); border-width: 2px !important; }
.berth.partial, html[data-theme="light"] .berth.partial { --sc: var(--cb-part); --sf: var(--cb-part-f); }
.berth.occ, .berth.nodata { --sc: var(--cb-occ); --sf: transparent; opacity: 1 !important; }
.berth.occ { background-image: repeating-linear-gradient(135deg, color-mix(in srgb, var(--cb-occ) 55%, transparent) 0 2px, transparent 2px 6px) !important; }
/* Coach map tab, one-coach seat map only (#seatWrap - the true
   bays and the fallback grid alike; Ravi, 24 Nov: "remove cross
   strikes... it is overshadowing the inside actual hop"): a
   booked berth there drops the diagonal hatch for a plain muted
   fill in the same booked slate, so the hop bar inside the cell
   stays fully legible. The border keeps the booked colour and
   the small cross corner marker above stays - it is the booked
   symbol the legend names. Everywhere else (all-coaches view,
   mxMap, the berth sheet) the hatch treatment is unchanged. */
#seatWrap .berth.occ:not(.qm) { --sf: color-mix(in srgb, var(--cb-occ) 35%, transparent); background-image: none !important; }
.berth.nodata { border-style: dotted !important; }
.berth.free::after, .berth.partial::after, .berth.inc::after, .berth.occ::after, .berth.nodata::after { position: absolute; left: 7px; top: 3px; font-size: 11px; font-weight: 900; line-height: 1; }
.berth.free::after, html[data-theme="light"] .berth.free::after { content: "\2713"; color: var(--cb-free); }
.berth.partial::after, html[data-theme="light"] .berth.partial::after { content: "\25D0"; color: var(--cb-part); }
.berth.inc { border-style: dashed !important; }
.berth.inc::after, html[data-theme="light"] .berth.inc::after { content: "?"; color: var(--cb-part); }
.berth.occ::after { content: "\2715"; color: var(--cb-occ); }
.berth .b-num { color: var(--cb-ink) !important; }
.berth .b-code { color: var(--cb-ink) !important; opacity: .85; }
/* leg bar: free = solid blue, booked = striped dark, no data = hollow dotted */
.berth .legbar { height: 7px; gap: 1px; background: transparent; }
.berth .legbar i, html[data-theme="light"] .berth .legbar i { background: transparent; box-shadow: inset 0 0 0 1px var(--cb-no); }
.berth .legbar i.free, html[data-theme="light"] .berth .legbar i.free { background: var(--cb-free); box-shadow: none; }
.berth .legbar i.occ, html[data-theme="light"] .berth .legbar i.occ { background: repeating-linear-gradient(135deg, var(--cb-ink) 0 2px, var(--cb-occ) 2px 4px); box-shadow: none; }
.berth .legbar i.unk, html[data-theme="light"] .berth .legbar i.unk { background: radial-gradient(circle, var(--cb-no) 0 .8px, transparent 1px) 0 0/3px 3px; }
.legend .l-bfull { border-color: var(--cb-free); background: var(--cb-free-f); }
.legend .l-bpart { border-color: var(--cb-part); background: var(--cb-part-f); }
.legend .l-bocc, html[data-theme="light"] .legend .l-bocc { border-color: var(--cb-occ); opacity: 1; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--cb-occ) 55%, transparent) 0 2px, transparent 2px 5px); }
.legend .l-binc { border: 2px dashed var(--cb-part); }
.legend .l-free { background: var(--cb-free); }
.legend .l-occ { background: repeating-linear-gradient(135deg, var(--cb-ink) 0 2px, var(--cb-occ) 2px 4px); }
.legend .l-unk, html[data-theme="light"] .legend .l-unk { background: radial-gradient(circle, var(--cb-no) 0 .8px, transparent 1px) 0 0/3px 3px; box-shadow: inset 0 0 0 1px var(--cb-no); }
.legend.lg-berth, .legend.lg-leg { flex-wrap: wrap; gap: 6px 12px; }
.legend.lg-leg b { font-size: 11.5px; width: 100%; color: var(--muted); font-weight: 700; }
.fsf.full .fsf-i, .fsf.full .fsf-n, html[data-theme="light"] .fsf.full .fsf-i, html[data-theme="light"] .fsf.full .fsf-n { color: var(--cb-free); }
.fsf.part .fsf-i, .fsf.part .fsf-n, html[data-theme="light"] .fsf.part .fsf-i, html[data-theme="light"] .fsf.part .fsf-n { color: var(--cb-part); }
.fsf[aria-pressed="true"] .fsf-i, .fsf[aria-pressed="true"] .fsf-n { color: inherit !important; }
.fchip.full { border-color: var(--cb-free); } .fchip.part { border-color: var(--cb-part); } .fchip.inc { border-color: var(--cb-part); border-style: dashed; }
.fchip.inc small { white-space: normal; }
.fs-tag.full { color: var(--cb-free); } .fs-tag.part, .fs-tag.inc { color: var(--cb-part); }
/* bottom-sheet runs */
.run.free .run-tag { background: var(--cb-free-f); color: var(--cb-free); box-shadow: inset 0 0 0 1.5px var(--cb-free); }
.run.occ .run-tag { background: repeating-linear-gradient(135deg, rgba(150,160,190,.28) 0 2px, transparent 2px 6px); color: var(--cb-ink); box-shadow: inset 0 0 0 1.5px var(--cb-occ); }
.run.unk .run-tag { border: 1.5px dotted var(--cb-no); color: var(--cb-no); background: transparent; }
.run.free .run-tag::before { content: "\2713 "; } .run.occ .run-tag::before { content: "\2715 "; } .run.unk .run-tag::before { content: "? "; }

.fs-row { flex-wrap: wrap; } .fs-chips { flex: 1 1 100%; }

.home-link { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.home-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.home-link.home-mark { display: block; flex: none; }
h1 .home-link { display: inline-block; padding: 8px 0; margin: -8px 0; }

/* v0.1: journey grid (replaces the ribbon diagram) */
.jg-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px -4px 0; border-radius: 10px; border: 1px solid var(--line); }
.jg { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.jg th, .jg td { padding: 0; text-align: center; }
.jg-corner { position: sticky; left: 0; z-index: 3; background: var(--card); min-width: 62px; height: 40px; font-size: 9.5px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.jg-col { height: 40px; min-width: 34px; font-size: 10.5px; font-weight: 800; color: var(--text); cursor: pointer; border-bottom: 1px solid var(--line); background: var(--card); }
.jg-col.on, .jg-row.on { box-shadow: inset 0 0 0 2px var(--cb-free); }
.jg-row { position: sticky; left: 0; z-index: 2; background: var(--card); width: 62px; min-width: 62px; height: 34px; text-align: left !important; padding: 0 6px !important; cursor: pointer; border-right: 1px solid var(--line); white-space: nowrap; }
.jg-row b { font-size: 11px; color: var(--text); } .jg-row small { color: var(--muted); font-size: 10px; margin-left: 5px; }
.jg-c { min-width: 34px; height: 34px; font-weight: 800; font-size: 11px; border: 1px solid transparent; }
.jg-c.has { background: color-mix(in srgb, var(--cb-free) calc(var(--a) * 100%), transparent); color: var(--text); cursor: pointer; border-color: color-mix(in srgb, var(--cb-free) 40%, transparent); }
.jg-c.has.hi { color: var(--jg-hi, #fff); }
.jg-c.has.on { outline: 2px solid var(--text); outline-offset: -2px; }
.jg-c.has.dim { opacity: .3; }
.jg-c.has:focus-visible, .jg-row:focus-visible, .jg-col:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.jg-no { background: repeating-linear-gradient(135deg, transparent 0 4px, rgba(150,160,190,.12) 4px 5px); }
.jg-foot .jg-row b { color: var(--cb-part); font-size: 10.5px; }
.jg-t { height: 28px; font-size: 10.5px; font-weight: 700; color: var(--cb-part); border-top: 1px solid var(--line); }
.jg-detail { margin-top: 10px; border: 1.5px solid var(--cb-free); border-radius: 12px; padding: 10px 12px; }
.jg-dh { font-size: 13.5px; } .jg-dn { font-size: 20px; font-weight: 800; margin: 2px 0 6px; }
html[data-theme="light"] .jg-c.has { border-color: color-mix(in srgb, var(--cb-free) 55%, transparent); }
html[data-theme="light"] .jg-c.has.hi { --jg-hi: #fff; }

/* v0.1: phone-GPS speedometer */
.spd-svg { display: block; width: 100%; max-width: 300px; margin: 6px auto 0; }
.spd-track { fill: none; stroke: var(--line); stroke-width: 12; stroke-linecap: round; }
.spd-fill { fill: none; stroke: var(--cb-free); stroke-width: 12; stroke-linecap: round; }
.spd-tk { stroke: var(--muted); stroke-width: 1.5; }
.spd-tt { fill: var(--muted); font-size: 9px; font-weight: 700; }
.spd-needle { stroke: var(--cb-part); stroke-width: 3; stroke-linecap: round; }
.spd-hub { fill: var(--cb-part); }
.spd-read { text-align: center; margin-top: -4px; line-height: 1; }
.spd-read b { font-size: 44px; font-weight: 800; font-variant-numeric: tabular-nums; }
.spd-read span { font-size: 14px; color: var(--muted); margin-left: 6px; font-weight: 700; }
.spd-stat { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; min-height: 18px; }
.spd-top { text-align: center; font-size: 12.5px; margin-top: 4px; }
.spd-ctl { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 4px; flex-wrap: wrap; }
.spd-btn { min-height: 44px; min-width: 96px; font-weight: 800; }
.spd-keep { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; }
.spd-keep input { width: 20px; height: 20px; }

.rake-hint { margin-top: 8px; font-size: 12px; color: var(--muted); }
.rake-hint:empty { display: none; }
.rake-chip { display: inline-block; font-weight: 800; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1.5px solid var(--cb-free); color: var(--text); margin-right: 6px; }
.rake-chip.rk-q { border-style: dashed; border-color: var(--muted); }

/* v0.1: From/To swap */
.swap-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-soft); color: var(--text); cursor: pointer; padding: 0; }
.swap-btn:hover { border-color: var(--cb-free); }
.swap-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.swap-row { display: flex; justify-content: flex-end; margin: -4px 0; position: relative; z-index: 1; }
.fare-ft { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); gap: 8px; align-items: end; }
.fare-ft .swap-btn { margin-bottom: 0; }

.home-link.home-mark { padding: 2px; margin: -2px; }

html[data-theme="light"] .jg-c.has.hi { background: var(--cb-free); }
html[data-theme="light"] .jg-c.has { color: #050b16; }
html[data-theme="light"] .jg-c.has.hi { color: #fff; }

.rake-hint { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.rake-chip { white-space: nowrap; margin-right: 0; }
.rake-hint small { font-size: 12px; line-height: 1.35; }
.fare-ft { gap: 6px; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); }
.fare-ft .swap-btn { width: 40px; }
.fare-ft select { padding-left: 8px; padding-right: 2px; font-size: 12.5px; }
.about-line { margin-bottom: 14px; }

/* Secondary official assistance link. No passenger or journey data is passed. */
.rail-help { margin: 0 0 18px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.rail-help a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 13px; font-weight: 700; text-decoration: none; }
.rail-help a:hover { border-color: var(--accent); }
.rail-help a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.rail-help > span { font-size: 12px; line-height: 1.5; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* advance booking dates */
.bk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.bk-card { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card-2); display: flex; flex-direction: column; gap: 4px; }
.bk-card .bk-k { font-size: 12px; color: var(--muted); }
.bk-card b { font-size: 15px; color: var(--text); }
.bk-card.bk-done { border-color: var(--green); }
.bk-card.bk-soon { border-color: var(--amber); }
@media (max-width: 360px) { .bk-grid { grid-template-columns: 1fr; } }

/* cancellation check (no chart) + journey postcard */
.cx-box { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.cx-card { border-radius: 12px; padding: 12px 14px; margin-top: 4px; }
.cx-red { background: var(--red-soft); border: 1px solid rgba(229, 72, 77, .55); }
.cx-red .cx-title { color: var(--red); font-weight: 800; font-size: 18px; }
.cx-red .cx-line { color: var(--text); margin-top: 4px; font-size: 13.5px; }
.cx-info { background: var(--card-2); border: 1px solid var(--line); }
.cx-info .cx-title { font-weight: 800; font-size: 16px; }
.cx-info .cx-line { margin-top: 4px; color: var(--muted); font-size: 13px; }
.pc-cta { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.pc-canvas { display: block; width: 100%; max-width: 430px; height: auto; border-radius: 12px; margin: 10px 0; border: 1px solid var(--line); }
.pc-dl { margin-bottom: 6px; }
html[data-theme="light"] .notice.warn p { color: #7a5a12 !important; }
html[data-theme="light"] .notice.error p { color: #8f2a30 !important; }

/* v46: My stretch mode on the coach map */
.map-mode { margin: 2px 0 12px; }
.stretch-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.stretch-row .sr-lab { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; flex: 0 0 auto; }
.stretch-row select { flex: 1 1 0; min-width: 0; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 10px 8px; font-size: 15px; }
.stretch-arrow { color: var(--muted); font-size: 17px; flex: 0 0 auto; }
.berth .legbar i.out { opacity: .18; }
.fs-lists { margin-top: 8px; }
.fs-lists summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--accent); }
.fs-lists summary .sub { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.sheet-verdict { border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); }
.sheet-verdict b { font-size: 13.5px; }
.sheet-verdict span { color: var(--muted); font-size: 12px; }
.sheet-verdict.free { background: var(--green-soft); border-color: var(--green); }
.sheet-verdict.part { background: var(--amber-soft); border-color: var(--amber); }
.sheet-verdict.occ { background: var(--red-soft); border-color: var(--red); }
.sheet-verdict.inc { background: var(--amber-soft); border: 1px dashed var(--amber); }

/* ---------- live station board ---------- */
.ls-head { margin: 12px 0 2px; font-size: 14px; font-weight: 700; }
.ls-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); margin-left: 6px; color: var(--muted); }
.ls-tag.stale { color: var(--amber); }
.ls-times { margin-top: 4px; font-size: 13px; color: var(--muted); }
.ls-times b { color: var(--text); font-weight: 600; }
.ls-src { color: var(--green); font-weight: 600; }
.rs-train.ls-static { cursor: default; }
.rs-train.ls-static:active { transform: none; }
.rs-train.ls-static.ls-tap { cursor: pointer; }
.rs-train.ls-static.ls-tap:active { transform: scale(.99); }
.ls-check { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--accent); }
.btn-spin { display: inline-block; width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 5px; }
@media (prefers-reduced-motion: reduce) { .btn-spin { animation: none; } }

/* v47: regrouped home - chart search card plus a separate tools card */
.grp-label { margin: 18px 0 0; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.tools-card { margin-top: 14px; }
.tools-card h2 { margin: 0 0 2px; font-size: 15px; }

/* v0.5: unknown-state honesty */
.sheet-verdict.unk { background: rgba(255,255,255,.06); border-color: var(--line); }
.legend .l-bunk { width: 12px; height: 12px; border-radius: 3px 3px 6px 6px; border: 2px dashed rgba(255,255,255,.45); background: transparent; }
html[data-theme="light"] .legend .l-bunk { border-color: rgba(30,50,90,.5); }
/* A disputed segment is never drawn as free. */
.run.conflict .run-tag { border: 1px dashed var(--amber); color: var(--amber); }
.berth.nodata { border-style: dashed; }
.berth.disputed { border: 2px dashed var(--amber); }

/* ---- Route map (Stops tab, v0.6) ---- */
.map-live{margin:2px 0 10px;font-size:.85rem;color:var(--muted);display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.map-live-txt b{color:var(--text)}
.map-live-upd{opacity:.75;font-size:.78rem}
.map-live-btn{font-size:.78rem;padding:3px 10px}
.map-stretch{display:none;margin:0 0 10px;font-size:.85rem;color:var(--muted)}
.map-stretch.on{display:block}
.map-stretch b{color:var(--c-route)}
.map-box{height:340px;border-radius:12px;overflow:hidden;border:1px solid var(--line);position:relative;z-index:0}
.leaflet-container{background:#0e1320;font:inherit}
html:not([data-theme="light"]) .leaflet-tile-pane{filter:invert(.92) hue-rotate(190deg) brightness(.85) contrast(.95) saturate(.45)}
html[data-theme="light"] .leaflet-container{background:#dde5ef}
.tw-dotw{background:transparent;border:0}
.tw-dot{display:block;border-radius:50%;border:2px solid}
.leaflet-tooltip.tw-lblw{background:transparent;border:0;box-shadow:none;color:#e8ecf8;font-weight:600;font-size:11px;text-shadow:0 1px 3px rgba(0,0,0,.9),0 0 6px rgba(0,0,0,.6);pointer-events:none}
.leaflet-tooltip.tw-lblw::before{display:none}
.leaflet-tooltip.tw-lblw.tw-lbl-end{font-size:12px;color:#2fd7e0}
.leaflet-tooltip.tw-lblw.tw-dim{opacity:.35}
.leaflet-tooltip.tw-lblw.tw-train-lbl{color:#ffe08a;font-size:11px;background:rgba(16,21,34,.88);border:1px solid #ffd166;border-radius:8px;padding:2px 7px;text-shadow:none}
html[data-theme="light"] .leaflet-tooltip.tw-lblw{color:#1b2638;text-shadow:0 1px 3px rgba(255,255,255,.9),0 0 6px rgba(255,255,255,.7)}
html[data-theme="light"] .leaflet-tooltip.tw-lblw.tw-lbl-end{color:#0891b2}
html[data-theme="light"] .leaflet-tooltip.tw-lblw.tw-train-lbl{color:#5c3d00;background:rgba(255,248,220,.94);border-color:#9a6b00}
.tw-trainw{background:transparent;border:0}
.tw-trainw .tw-pin{display:block;position:absolute;left:7px;bottom:2px;width:16px;height:16px;border-radius:50%;background:#ffd166;border:2.5px solid #101522;box-shadow:0 0 0 3px rgba(255,209,102,.35)}
.tw-trainw .tw-engine{position:absolute;top:-4px;left:0;right:0;text-align:center;font-size:16px;filter:drop-shadow(0 1px 2px rgba(0,0,0,.8))}
.leaflet-popup-content-wrapper{background:var(--card);color:var(--text);border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 30px rgba(0,0,0,.5)}
.leaflet-popup-tip{background:var(--card)}
.leaflet-popup-content{margin:12px 14px;font-size:.85rem;line-height:1.4}
.leaflet-container a.leaflet-popup-close-button{color:var(--muted)}
.tw-pop-head{margin-bottom:6px}
.tw-pop-code{color:var(--muted);font-size:.75rem;margin-left:6px}
.tw-pop-day{color:var(--muted);font-size:.75rem}
.tw-pop-t{border-collapse:collapse}
.tw-pop-t td{padding:2px 8px 2px 0;color:var(--muted)}
.tw-pop-t td b{color:var(--text)}
.map-legend{display:flex;gap:14px;align-items:center;flex-wrap:wrap;margin:10px 2px 0;font-size:.78rem;color:var(--muted)}
.map-legend .lg-major,.map-legend .lg-minor{display:inline-block;border-radius:50%;border:2px solid #101522;margin-right:5px;vertical-align:-2px}
.map-legend .lg-major{width:10px;height:10px;background:#fff}
.map-legend .lg-minor{width:7px;height:7px;background:#9fb2d8;margin-left:4px}
.map-legend .lg-covered{display:inline-block;width:16px;height:4px;border-radius:2px;background:#2fbf71;margin-right:5px;vertical-align:3px}
.lg-zoom{opacity:.7}
.map-note{margin:8px 2px 0;font-size:.78rem;color:var(--muted)}
.map-credit{margin:8px 2px 0;font-size:.72rem;color:var(--muted);opacity:.8}
.map-credit a{color:var(--accent)}
@media (max-width:480px){.map-box{height:300px}}

/* Footer service status (IRCTC/NTES): fed by real call outcomes, no pings */
.svc-line { font-size: 12px; color: var(--muted); margin: 0 0 14px; display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; column-gap: 6px; }
.svc-text { min-width: 0; }
.svc { font-weight: 700; }
.svc.up { color: var(--green); }
.svc.down { color: var(--red); }
.svc-when { opacity: .8; }
.svc-refresh { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.svc-refresh:hover { color: var(--text); border-color: var(--muted); }
.svc-refresh:disabled { opacity: .55; cursor: default; }
.svc-refresh.checking svg { animation: svcspin 1s linear infinite; }
@keyframes svcspin { to { transform: rotate(360deg); } }

/* Boarding/live-station helpers (v0.11.6) */
.loc-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.loc-btn:hover { color: var(--text); }
.loc-btn:disabled { opacity: .5; cursor: default; }
#lsStation { padding-right: 38px; }
.sug-head { padding: 7px 10px 3px; font-size: 11px; font-weight: 600; color: var(--muted); }

/* Have feedback? mailto form */
.fb-box { margin: 0 0 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.fb-toggle { margin: 0 auto; align-self: center; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: none; color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; }
.fb-toggle:hover { border-color: var(--accent); }
.fb-form[hidden] { display: none; }
.fb-form { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-align: left; }
.fb-form label { font-size: 13px; font-weight: 600; color: var(--text); }
.fb-form textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 90px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; }
.fb-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.fb-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fb-send { text-decoration: none; }
.fb-send.disabled { opacity: .45; pointer-events: auto; cursor: not-allowed; }

.bk-pick{margin-top:12px}.bk-pick label{display:block;font-size:13px;margin-bottom:6px;opacity:.85}.bk-date{width:100%;box-sizing:border-box;padding:12px;font-size:16px;border-radius:10px;border:1px solid var(--line,#3a4660);background:transparent;color:inherit}.bk-pick-out{margin-top:10px}
.rake-engine{scroll-snap-align:start;display:inline-flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;flex:0 0 auto;padding:6px 10px;color:var(--muted);pointer-events:none;user-select:none}
.rake-engine small{font-size:10.5px;font-weight:700;letter-spacing:.3px}
.bk-cal{margin-top:8px}.bk-cal .btn-ghost{display:inline-block;margin:0 6px 6px 0;text-decoration:none;color:inherit;cursor:pointer}
.bk-cal .btn-ghost{width:auto!important;display:inline-block!important}
.sq{margin-top:6px;font-size:12px}.sq summary{cursor:pointer;font-weight:700;color:var(--accent);list-style:none;display:inline-block;padding:2px 10px;border:1px solid var(--line);border-radius:999px}
.sq summary::-webkit-details-marker{display:none}.sq summary::after{content:" \25BE"}.sq[open] summary::after{content:" \25B4"}
.sq-body{margin-top:6px;padding:6px 8px;border:1px solid var(--line);border-radius:12px}
.sq-row{display:grid;grid-template-columns:42px 1fr auto;gap:8px;align-items:baseline;padding:3px 0;border-bottom:1px solid var(--line)}.sq-row:last-of-type{border-bottom:0}
.sq-row b{color:var(--accent)}.sq-row span{color:var(--muted)}.sq-row em{font-style:normal;font-weight:800}
.rake-engine.at-end svg{transform:scaleX(-1)}
.sq-row{grid-template-columns:1fr auto;grid-template-areas:"c e" "n n";gap:0 8px}
.sq-row b{grid-area:c}.sq-row em{grid-area:e}.sq-row span{grid-area:n;font-size:11px;line-height:1.25}
.sq summary{white-space:nowrap}
.sq summary{display:inline-flex;align-items:center;gap:6px;position:relative;padding:3px 12px}
.sq summary::after{content:"\25BE";position:static;transform:none;margin:0;float:none;width:auto;height:auto;border:0;background:none}
.sq[open] summary::after{content:"\25B4"}
html[data-theme="light"] .sq summary::after,html[data-theme="light"] .sq[open] summary::after{background:none!important;background-color:transparent!important;-webkit-mask:none!important;mask:none!important;width:auto!important;height:auto!important;min-width:0!important;border:0!important;border-radius:0!important}
.tw-pop-st{margin:2px 0 6px;font-size:.85rem}
.tw-pop-sub{margin:4px 0;font-size:.8rem;line-height:1.35}

/* ---------- Find trains: result groups ---------- */
.rs-ends { color: var(--muted); font-weight: 600; margin-left: 4px; }
.route-only-btn { width: 100%; margin-top: 8px; min-height: 44px; }

.rs-group { margin: 16px 0 6px; font-size: 14px; line-height: 1.35; color: var(--text); }
.rs-group small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.rs-group-main { padding-left: 8px; border-left: 3px solid var(--accent); }

/* Full-train coach-data load progress: sits under the tab bar, outside #content,
   so it stays visible whichever tab is open. Real counts only (coaches done of total). */
.ana-progress { margin: 2px 14px 10px; padding: 9px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 13px; line-height: 1.35; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ana-progress .ana-bar { flex: 1 1 110px; height: 6px; border-radius: 3px; background: rgba(120,120,160,.28); overflow: hidden; }
.ana-progress .ana-bar span { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(135deg, var(--accent), #9a6dff); transition: width .3s ease; }

.run.nlv .run-tag { border: 1.5px dashed var(--amber); color: var(--amber); }
.legbar i.nlv { background: repeating-linear-gradient(135deg, var(--amber) 0 2px, transparent 2px 5px); }
.legbar i.conflict { background: var(--amber); }

/* ---------------- background steam loco (v0.12) ----------------
   A flat steam-loco silhouette chugging along the bottom of the page:
   nostalgia shape, modern minimal motion. Pure CSS, transform/opacity only,
   no layout work, no images. In-flow after the footer so it never covers
   content; honors reduced-motion with a parked loco instead of a run. */
.loco-strip { position: relative; height: 84px; overflow: hidden; margin-top: 18px; opacity: .5; }
/* Header placement (v0.12: Ravi's pick - motion lives in the header background,
   not a stacked strip). Same markup works in both places; moving the
   #locoStrip block back after the footer restores the footer variant. */
.topbar { overflow: hidden; }
.topbar .loco-strip { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; margin-top: 0; opacity: .42; pointer-events: none; z-index: 0; }
.topbar .loco { transform: scale(.72); transform-origin: bottom left; }
.topbar .brand, .topbar .top-actions { position: relative; z-index: 1; }
.loco-run { position: absolute; bottom: 6px; left: 0; animation: locoRun 60s linear infinite; will-change: transform; }
.loco { position: relative; width: 120px; height: 64px; }
.loco svg { display: block; }
.loco-body { fill: var(--muted, #8b94ab); } /* svg faces left: the run animation drives right-to-left (user pick 14 Nov) */
.loco-glass { fill: var(--card, #161b28); }
.loco-wheels .wheel circle { fill: var(--muted, #8b94ab); }
.loco-wheels .spoke { stroke: var(--card, #161b28); stroke-width: 2; }
.wheel { animation: locoSpin 2.4s linear infinite; }
.puff { position: absolute; left: 58px; bottom: 44px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted, #8b94ab); opacity: 0; animation: locoPuff 3.6s ease-out infinite; }
.puff.p2 { animation-delay: 1.2s; }
.puff.p3 { animation-delay: 2.4s; }
@keyframes locoRun { from { transform: translateX(100vw); } to { transform: translateX(-160px); } }
@keyframes locoSpin { to { transform: rotate(-360deg); } } /* wheels roll leftward */
@keyframes locoPuff {
  0% { transform: translate(0, 0) scale(.5); opacity: 0; }
  15% { opacity: .55; }
  100% { transform: translate(-26px, -46px) scale(1.9); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .loco-run, .wheel, .puff { animation: none; }
  .loco-run { left: 50%; transform: translateX(-50%); }
}

/* ---------------- v0.12: live board grouping + pins ---------------- */
.ls-view { display: flex; gap: 8px; margin: 8px 0 4px; }
.chip.on { background: var(--accent, #3b82f6); color: #fff; border-color: transparent; }
.ls-pf { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 14px 0 6px; }
.ls-pf small { font-weight: 500; text-transform: none; letter-spacing: 0; }
.pin-chip b { color: var(--accent, #3b82f6); }

/* ---------------- v0.12: rail diary ---------------- */
.dj-stats { margin: 4px 0 10px; font-size: 13.5px; color: var(--muted); }
.dj-stats b { color: var(--text); }
.dj-entry { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: var(--card); }
.dj-entry.dj-conf { border-color: var(--accent); }
.dj-top { font-size: 14.5px; }
.dj-badge { float: right; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }
.dj-badge.dj-yes { color: #fff; background: var(--accent); border-color: transparent; }
.dj-badge.dj-up { color: var(--accent); border-color: var(--accent); }
.dj-line { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.dj-note { font-size: 12.5px; color: var(--text); margin-top: 5px; font-style: italic; }
.dj-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.dj-actions .chip { font-size: 12px; padding: 4px 10px; }
.dj-note-edit { display: flex; gap: 6px; margin-top: 8px; }
.dj-status { margin-top: 8px; }
.dj-status .cx-card { margin-top: 0; }
.dj-note-edit input { flex: 1; min-width: 0; }
.diary-add { margin-top: 6px; }
.diary-add-sum { font-size: 13px; color: var(--accent); cursor: pointer; margin: 8px 0; }
.diary-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.diary-map { height: 320px; border-radius: 12px; margin-top: 10px; background: #0d1320; }
.dj-year-out { margin-top: 12px; }

/* ---------------- v0.12: overview tools + print summary ---------------- */
.ov-tools { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; }
#printArea { display: none; }
/* v0.12: report-level options sheet (screen only; print CSS shows only #printArea) */
.ps-ovl { position: fixed; inset: 0; background: rgba(6,9,16,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 90; }
.ps-sheet { background: var(--card); color: var(--text); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; width: 100%; max-width: 460px; padding: 16px 16px 20px; }
.ps-sheet h2 { font-size: 16px; margin: 0 0 10px; }
.ps-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 8px; cursor: pointer; }
.ps-opt:has(input:checked) { border-color: var(--accent, #7b8cff); background: var(--accent-soft, rgba(109,124,255,.12)); }
.ps-opt input { margin-top: 3px; accent-color: var(--accent, #7b8cff); }
.ps-opt span b { display: block; font-size: 14px; }
.ps-opt span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.ps-opt span b { color: var(--text); }
.ps-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.ps-actions .chip.active { border-radius: 999px; padding: 9px 16px; }

@media print {
  body > *:not(#printArea) { display: none !important; }
  html, body { background: #fff !important; }
  body::before, body::after { display: none !important; }
  #printArea { display: block; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #111; padding: 12px 4px; }
  #printArea .ps-head { font-size: 13px; color: #555; letter-spacing: 0.08em; text-transform: uppercase; }
  #printArea h1 { font-size: 24px; margin: 8px 0 4px; }
  #printArea .ps-route { font-size: 14px; margin-bottom: 12px; }
  #printArea .ps-verdict { font-size: 16px; font-weight: 700; border: 2px solid #111; border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
  #printArea .ps-table { width: 100%; border-collapse: collapse; margin: 0 0 12px; }
  #printArea .ps-table th, #printArea .ps-table td { border: 1px solid #999; padding: 6px 10px; font-size: 13px; text-align: left; }
  #printArea .ps-table th { background: #eee; }
  #printArea .ps-charts { font-size: 13px; margin: 0 0 10px; }
  #printArea .ps-note { font-size: 11px; color: #555; margin: 6px 0 0; }
  #printArea .ps-h2 { font-size: 16px; margin: 18px 0 6px; page-break-after: avoid; }
  #printArea .ps-h2 span { display: block; font-size: 11px; font-weight: 400; color: #555; }
  #printArea .ps-cls { font-size: 13px; margin: 8px 0 2px; page-break-after: avoid; }
  #printArea .ps-coach { font-size: 12px; margin: 2px 0 2px 12px; line-height: 1.5; }
  #printArea .ps-coach b { display: inline-block; min-width: 34px; }
  #printArea .ps-table { page-break-inside: auto; }
  #printArea .ps-table tr { page-break-inside: avoid; }
}

/* unpin control on pinned-train chips */
.pin-chip .pin-x { margin-left: 7px; padding: 0 2px; opacity: .5; font-weight: 700; cursor: pointer; border-radius: 50%; }
.pin-chip .pin-x:hover, .pin-chip .pin-x:focus-visible { opacity: 1; }

/* ---------------- route flow table (v0.13.2) ---------------- */
.flow-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;margin:0 -4px;padding:0 4px}
.flow-table{width:100%;min-width:640px;border-collapse:collapse;font-size:12.5px}
.flow-table th{font-size:10px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);text-align:left;padding:4px 6px;border-bottom:1px solid var(--line,#e4e8f2)}
.flow-table td{padding:5px 6px;border-bottom:1px solid var(--line,#e4e8f2);white-space:nowrap}
.flow-table th.n,.flow-table td.n{text-align:right}
.flow-table .fl-name{color:var(--muted);font-size:11px}
.flow-table .fl-time{font-size:11.5px;white-space:nowrap}
.flow-table .mut{color:var(--muted)}
.flow-table .up{color:var(--good,#0a7d4f)}
.flow-table .dn{color:var(--bad,#b3261e)}
.flow-table .wt{color:var(--wait,#8a6d00)}
.flow-table .fl-p{font-weight:700}
html[data-theme="light"] .flow-table th{color:var(--muted)!important}

/* ---------------- UI redesign (approved mockups, 18 Nov) ----------------
   Final rules for the components this pass touches: the tab bar fits all
   five tabs with no sideways scroll and no arrow buttons; the verdict
   gains a third, amber "unknown" state; the charting station gets a
   strip on the Chart timing card; Vacant berths render as coach-grouped
   rows with stretch bars; the printed report gets @page rules, a
   chart-facts strip and real tables. Older layers above stay untouched
   for everything else. */

/* tabs: five equal-flex tabs, >=44px targets, arrows gone */
.tab-arrow { display: none !important; }
.tab-wrap .tab-bar { overflow: visible; }
.tab { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 11px 2px; font-size: 13px; display: flex; align-items: center; justify-content: center; }

/* running days: 3-letter pills instead of ambiguous single letters */
.day-bubbles span { flex: 1; width: auto; height: auto; padding: 6px 0; font-weight: 600; }

/* verdict: amber unknown state; quick count lives inside the one card */
.verdict.unknown { background: var(--amber-soft); border-color: rgba(245,165,36,.5); }
.verdict.unknown .v-ico { background: var(--amber); color: #2a1c00; }
.verdict .v-quick { display: block; margin-top: 6px; }
.verdict .v-link { display: inline-block; margin-top: 8px; font: inherit; font-size: 13px; font-weight: 700; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }

/* chart timing: charting-station segment strip */
.seg-strip { display: flex; align-items: center; gap: 8px; background: var(--accent-soft); border-radius: 10px; padding: 9px 11px; font-size: 13px; margin-bottom: 12px; }
.seg-strip b { color: var(--accent); }

/* glance per-class rows: the count carries the weight, right-aligned;
   the map-only label becomes an amber basis pill */
.class-row { gap: 10px; }
.class-row .cr-free { font-size: 18px; font-weight: 800; margin-left: auto; text-align: right; }
.class-row .cr-free.unk { color: var(--amber); }
.class-row .cr-free.unk + .cr-info { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(245,165,36,.45); border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
html[data-theme="light"] .class-row .cr-free.unk + .cr-info { color: #7a5a12; }
/* a map-only row (tag + coaches + count + the nowrap basis pill) is wider
   than a phone card: let the pill wrap to its own line instead of running
   past the card edge, and at phone widths keep it under the count */
.class-row.map-only { flex-wrap: wrap; }
@media (max-width: 480px) {
  .class-row.map-only .cr-free.unk + .cr-info { margin-left: auto; }
}

/* notice icon becomes a filled disc in the warn (amber) state - the
   Vacant tab's list-unavailable card uses it */
.notice .n-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; font-weight: 900; flex: none; }
.notice.warn .n-icon { background: var(--amber); color: #2a1c00; }

/* vacant: pickers get a swap button and a readable size */
.range-row { grid-template-columns: 1fr auto 1fr auto; }
.range-row select { font-size: 14px; }
.range-row .swap-btn { width: 38px; height: 38px; border-radius: 50%; margin-bottom: 4px; }

/* vacant: summary boxes + coach-grouped berth rows with stretch bars */
.vb-sum { display: flex; gap: 8px; margin-top: 14px; }
.vb-sum .vb-box { flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--bg-soft); }
.vb-box .n { font-size: 20px; font-weight: 800; }
.vb-box .l { font-size: 11.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.vb-sec { font-size: 13px; font-weight: 800; margin: 18px 0 8px; }
.vb-sec small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 2px; }
.vb-coach { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
.vb-coach-h { display: flex; justify-content: space-between; align-items: center; background: var(--bg-soft); padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.vb-coach-h .cnt { font-size: 12px; font-weight: 700; color: var(--green); }
.vb-coach-h .cnt.amber { color: var(--amber); }
.vb-row { display: flex; gap: 11px; align-items: center; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.vb-row:last-child { border-bottom: 0; }
.vb-no { flex: none; width: 52px; text-align: center; }
.vb-no .num { font-size: 19px; font-weight: 800; line-height: 1; }
.vb-no .typ { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-top: 3px; }
.vb-main { flex: 1; min-width: 0; }
.vb-stretch { font-size: 14px; font-weight: 700; }
.vb-stretch .arr { color: var(--accent); padding: 0 2px; }
.vb-bar { position: relative; height: 6px; border-radius: 3px; background: var(--line); margin-top: 7px; }
.vb-bar i { position: absolute; top: 0; height: 6px; border-radius: 3px; background: var(--green); }
.vb-bar.amber i { background: var(--amber); }
.vb-ends { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: var(--muted); margin-top: 3px; }
.vb-ends .mid { text-align: center; }
.vb-badge { flex: none; font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; border-radius: 999px; padding: 3px 8px; }
.vb-badge.list { background: var(--green-soft); color: var(--green); border: 1px solid rgba(47,191,113,.45); }
.vb-badge.map { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(245,165,36,.45); }
html[data-theme="light"] .vb-badge.map, html[data-theme="light"] .vb-coach-h .cnt.amber { color: #7a5a12; }
.vb-more { display: block; width: 100%; text-align: center; font: inherit; font-size: 13px; font-weight: 700; color: var(--accent); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px; cursor: pointer; margin-top: 4px; }

/* print report: page setup, chart-facts strip, table polish */
@page { size: A4; margin: 12mm; }
@media print {
  #printArea { padding: 0; }
  #printArea .ps-facts { width: 100%; border-collapse: collapse; margin: 0 0 12px; }
  #printArea .ps-facts td { border: 1px solid #c9d3e2; padding: 7px 10px; width: 25%; vertical-align: top; font-size: 13px; }
  #printArea .ps-facts .k { display: block; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #555; margin-bottom: 2px; }
  #printArea .ps-verdict .ps-tag { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: #fdf3d7; border: 1px solid #b98a00; color: #6d5200; border-radius: 999px; padding: 2px 8px; margin-right: 8px; vertical-align: 2px; }
  #printArea .ps-table th { background: #eef2f8; border: 0; border-bottom: 2px solid #c9d3e2; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: #33415e; padding: 7px 10px; }
  #printArea .ps-table td { border: 0; border-bottom: 1px solid #e3e9f2; padding: 7px 10px; }
  #printArea .ps-table tbody tr:nth-child(even) td { background: #f8fafd; }
  #printArea .ps-table td.num, #printArea .ps-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
  #printArea .ps-foot { font-size: 11px; color: #555; margin: 4px 0 10px; line-height: 1.5; }
  #printArea .ps-coach-t { page-break-inside: avoid; margin: 0 0 10px; }
  #printArea .ps-coach-t .ps-table { margin: 0; }
}
