/* Shared look for every bus map on maps.reclaim.city (Delhi, APSRTC, TGSRTC, ...).
   Taken verbatim from the Delhi bus map, which is the reference design: glass panels,
   the search roll-out, route cards, the busrouter-style stop rail, timings dial,
   map buttons, and the live-bus pill and card styles that delhi/live.js used to inject.
   Network pages only bring their own bus models; colours, fills and translucency live here. */
:root {
  --cream:#f9f5ed; --ink:#1c1c1e; --muted:#8a8a8e; --line:#e7e2d6;
  --red:#f01b48; --teal:#00454d;
  --c-route:#2f9a3e; --c-small:#16a34a; --c-feeder:#db2777; --c-cluster:#ec7a1c; --c-devi:#e2561b;
  --panel:rgba(255,255,255,.82);
  /* one material, used by every floating surface: a translucent scrim that
     the heavy backdrop blur sits behind, plus the hairline + shadow pair
     that gives it an edge without a hard border */
  --glass:linear-gradient(180deg, rgba(255,255,255,.90), rgba(255,255,255,.78));
  --glass-inner:rgba(255,255,255,.62);
  --hair:rgba(255,255,255,.80);
  --lift:0 1px 0 rgba(255,255,255,.9) inset,
         0 12px 40px -8px rgba(40,34,22,.28),
         0 2px 10px -2px rgba(40,34,22,.14);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--cream); }
#map { position: fixed; inset: 0; background: var(--cream); }
.maplibregl-canvas { outline: 0; }

/* One control stack, top-left: the bus badge (home) and, under it, search.
   The search surface used to be a permanent 350px sidebar that covered the
   western third of the city on every screen. It is now summoned from here
   and rolls away again, so the default state of the page is the map. */
#fabs { position: fixed; z-index: 600; top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 8px; }
#logo, #search-fab { width: 46px; height: 46px; border-radius: 14px; background: var(--red);
  color: #fff; display: grid; place-items: center; border: 0; padding: 0; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.20); text-decoration: none;
  transition: transform .16s ease, background .18s ease, color .18s ease; }
#logo:active, #search-fab:active { transform: scale(.93); }
#logo svg { width: 34px; height: 34px; } #search-fab svg { width: 19px; height: 19px; }
body.search-open #search-fab { background: #fff; color: var(--red); }

/* Rolls out from under the search button: scaled down and clipped to nothing
   at the top-left corner, then unrolled. Sized to its content rather than
   to the viewport, so it never becomes a wall down the side of the map. */
#panel { position: fixed; z-index: 590; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(255,255,255,.94));
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid var(--hair); box-shadow: var(--lift); border-radius: 18px;
  overflow: hidden; transform-origin: 0 0; opacity: 0; pointer-events: none;
  transform: translate(-8px, -10px) scale(.90);
  transition: transform .34s cubic-bezier(.32,.72,0,1), opacity .2s ease; }
body.search-open #panel { opacity: 1; pointer-events: auto; transform: none; }
@media (min-width: 700px) {
  /* beside the control stack, not under it: at 70px down the search button
     itself sat on top of the card's own title */
  #panel { top: calc(12px + env(safe-area-inset-top)); left: calc(70px + env(safe-area-inset-left));
    width: 342px; max-height: calc(100vh - 24px);
    transform-origin: 0 54px; transform: translateX(-10px) scale(.92); }
}
@media (max-width: 699px) {
  /* the same idea, unrolling up from the bottom where a thumb can reach it */
  /* --kb / --vvh (set from visualViewport in app.js) keep it above the on-screen
     keyboard: lifted by the keyboard's height and no taller than what is left */
  #panel { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom) + var(--kb, 0px)); top: auto;
    max-height: min(62vh, calc(var(--vvh, 100vh) - 132px)); transform-origin: 50% 100%; transform: translateY(16px) scale(.97);
    transition: transform .34s cubic-bezier(.32,.72,0,1), opacity .2s ease, bottom .18s ease, max-height .18s ease; }
}
#panel .ptop { padding: 12px; flex: 0 0 auto; -webkit-user-select: none; user-select: none; }
#panel h1 { margin: 0 0 10px; font-size: calc(15px * var(--bm-fs, 1)); font-weight: 800; letter-spacing: -.01em;
  min-height: 22px; display: flex; align-items: center; gap: 6px; }
#searchbox { position: relative; }
#q { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 40px 0 14px; font-size: calc(15px * var(--bm-fs, 1)); background: #fff; outline: none; color: var(--ink); }
#q:focus { border-color: var(--red); }
#searchbox .si { position: absolute; right: 13px; top: 13px; width: 18px; height: 18px; color: var(--muted); }
#results { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
#results .grp { font-size: calc(10.5px * var(--bm-fs, 1)); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 12px 14px 5px; font-weight: 700; }
#results .it { padding: 10px 14px; cursor: pointer; border-top: 1px solid var(--line); font-size: calc(14px * var(--bm-fs, 1)); display: flex; gap: 10px; align-items: center; }
/* let the destination text shrink/ellipsis instead of crushing the pill */
#results .it > span:not(.service-tag) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: calc(12.5px * var(--bm-fs, 1)); }
#results .it:hover { background: rgba(0,0,0,.035); }
#results .it .sub { color: var(--muted); font-size: calc(11.5px * var(--bm-fs, 1)); margin-top: 2px; }
#results .hint { padding: 16px 14px; color: var(--muted); font-size: calc(13px * var(--bm-fs, 1)); line-height: 1.55; }

/* Variant names ("21G (2)", "21GCT (8)") are wider than a bare route number.
   The pill sits in a flex row, so without these it gets squeezed by its
   sibling text and the label wraps inside a fixed-height box and clips. */
.service-tag { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 22px;
  flex: 0 0 auto; white-space: nowrap; padding: 2px 8px; line-height: 1.15;
  border-radius: 6px; background: var(--c-route); color: #fff; font-weight: 800; font-size: calc(12.5px * var(--bm-fs, 1)); }
.service-tag { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }
.service-tag .vsuffix { font-weight: 600; opacity: .82; margin-left: 3px; font-size: calc(11.5px * var(--bm-fs, 1)); }
.service-tag.small { background: var(--c-small); } .service-tag.feeder { background: var(--c-feeder); }
#tilt-btn.on { background: var(--ink); color: #fff; }
.service-tag.ncr { background: #5b5bd6; } .service-tag.cluster { background: var(--c-cluster); } .service-tag.devi { background: var(--c-devi); }
.service-tag.premium { background: linear-gradient(180deg, #e0c27a, #b8892f); color: #121212; }

/* Layered translucency: a light scrim over a heavy blur, a hairline top
   highlight and a soft ambient shadow — the material reads as glass over the
   map rather than a flat sheet on top of it. */
#card { position: fixed; z-index: 595; display: none; flex-direction: column;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border: 0.5px solid var(--hair); box-shadow: var(--lift); }
#card.open { display: flex; animation: cardin .28s cubic-bezier(.32,.72,0,1); }
/* Collapsed: the header stays, the body is clipped away. max-height animates
   where height:auto cannot, and the scroller is faded so its content does
   not flash through during the transition. */
#card { transition: max-height .34s cubic-bezier(.32,.72,0,1); }
#card.min .cscroll { opacity: 0; pointer-events: none; }
#card .cscroll { transition: opacity .18s ease; }
#card .chead::after { content: ""; position: absolute; left: 15px; bottom: 4px;
  width: 26px; height: 3px; border-radius: 2px; background: var(--muted);
  opacity: 0; transition: opacity .2s ease; }
#card.min .chead::after { opacity: .45; }
@keyframes cardin { from { opacity: 0; transform: translateY(10px) scale(.985); } }
/* Docked right, clear of the city: Chennai sits on the west of the viewport
   and the Bay of Bengal on the east, so the panel covers water, not streets. */
@media (min-width: 700px) {
  /* below the three map buttons (layers, 3D, locate) so the card's own close
     button is never under one of them */
  #card { right: 16px; top: 172px; width: 372px;
    max-height: calc(100vh - 188px); border-radius: 20px; }
  #card.min { max-height: 78px; }
}
@media (max-width: 699px) {
  #card { left: 0; right: 0; bottom: 0; max-height: 62vh; border-radius: 16px 16px 0 0; box-shadow: 0 -4px 24px rgba(0,0,0,.18); }
  #card.min { max-height: 86px; }
}
#card .chead { padding: 14px 44px 11px 15px; position: relative; flex: 0 0 auto;
  border-bottom: 0.5px solid rgba(0,0,0,.07);
  cursor: pointer; -webkit-user-select: none; user-select: none; }
#card .chead:active { opacity: .8; }
@media (max-width:699px){ #card .chead::before{ content:""; position:absolute; top:6px; left:50%; transform:translateX(-50%); width:38px; height:4px; border-radius:2px; background:#cdc7b8; } }
#card .cclose { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  border: 0.5px solid rgba(0,0,0,.06); background: rgba(120,110,90,.10); color: #6b6355; font-size: calc(17px * var(--bm-fs, 1));
  cursor: pointer; line-height: 1; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .15s ease, transform .15s ease; }
#card .cclose:hover { background: rgba(120,110,90,.18); }
#card .cclose:active { transform: scale(.92); }
/* Terminus names are long - "Thyagaraya Nagar Bus Terminus" alone is 29
   characters - and one 17px line fitted about half of one. Origin and
   destination now get a line each at a smaller size, each free to wrap
   once more before the clamp cuts it with an ellipsis. */
#card h2 { margin: 0; font-size: calc(14px * var(--bm-fs, 1)); font-weight: 800; display: flex; gap: 9px;
  align-items: flex-start; line-height: 1.3; }
#card h2 > .service-tag { margin-top: 1px; }
#card h2 .ttl { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
#card h2 .ttl > span { display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
#card h2 .ttl .ar { color: var(--muted); margin-right: 4px; }
#card .csub { margin: 7px 0 0; font-size: calc(12.5px * var(--bm-fs, 1)); color: var(--muted); } #card .csub b { color: var(--ink); font-weight: 700; }
#card .cscroll { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 14px 16px; flex: 1; }
#card .seclbl { font-size: calc(10.5px * var(--bm-fs, 1)); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 14px 0 8px; }
.pillwrap { display: flex; flex-wrap: wrap; gap: 7px; } .pillwrap .service-tag { cursor: pointer; } .pillwrap .service-tag:active { transform: scale(.94); }
.wklist { border: 1px solid rgba(0,0,0,.06); border-radius: 12px; overflow: hidden; background: var(--glass-inner);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.wklist .it { display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 9px 11px; font-size: calc(12.5px * var(--bm-fs, 1)); cursor: pointer; border-top: 1px solid rgba(0,0,0,.055); }
.wklist .it:first-child { border-top: 0; }
.wklist .it:hover { background: rgba(0,0,0,.035); }
.wklist .it.on { background: rgba(37,99,235,.10); font-weight: 700; }
/* Two lines rather than one hard truncation: "GUDUVANCHERI B.T -> THYAGARA…"
   told a rider nothing about where the working actually ends. */
.wklist .it > span:first-child { min-width: 0; overflow: hidden; white-space: normal;
  font-size: calc(12px * var(--bm-fs, 1)); line-height: 1.32; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
.wklist .it { align-items: flex-start; }
.wklist .wkmeta { padding-top: 1px; }
.wkac { display: none; }
.wkac.on { display: inline-flex; vertical-align: -2px; width: 13px; height: 13px;
  margin-right: 5px; color: #2b8cba; }
.wkac.on svg { width: 13px; height: 13px; }
.wklist .wkmeta { flex: 0 0 auto; color: var(--muted); font-size: calc(11px * var(--bm-fs, 1)); font-variant-numeric: tabular-nums; }
/* Route diagram, busrouter.sg style: a rail per direction, joined by a U-turn
   at the terminus, dotted links between paired stops, arrows for travel
   direction. The rail line and its dots live in the SAME grid cell (.rl) and
   are both centred in it — deriving rail x from the row centre instead put
   them 14.5px apart, because the grid's column gaps shift the dot columns. */
.rail { --dot: 11px; --rail: 16px; --mid: 26px; --pad: 7px; margin-top: 2px; }
.rail .grid { display: grid; grid-template-columns: 1fr var(--rail) var(--mid) var(--rail) 1fr;
  column-gap: 9px; align-items: center; }
.rail .hdr { font-size: calc(10px * var(--bm-fs, 1)); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 2px 0 2px; align-items: end; }
.rail .hdr .l { text-align: right; } .rail .hdr .r { text-align: left; }

/* the rail cell: line and dot share one box, so they cannot drift apart */
.rail .rl { position: relative; align-self: stretch; display: grid; place-items: center; }
.rail .rl::before { content: ""; position: absolute; left: 50%;
  top: calc(-1 * var(--pad)); bottom: calc(-1 * var(--pad));
  transform: translateX(-50%); width: 2.5px; background: var(--red); }
.rail .rl.stop-end::before { bottom: 50%; }
.rail .rl.stop-start::before { top: 50%; }
.rail .dot { position: relative; z-index: 1; width: var(--dot); height: var(--dot);
  border-radius: 50%; border: 2.5px solid var(--red); background: #fff; box-sizing: border-box; }
/* a terminus is a bolder ring, not a filled dot: filled means the bus has been there (live rails) */
.rail li.term .dot { border-width: 3.5px; }
.rail .dot.blank { border-color: #dcd6c8; }

/* terminus U-turn, spanning the two rail columns, with the terminus itself
   as a dot at the top of the loop. Drawn twice: grey for the whole loop and
   red over its left half, so only the outbound side is red. */
.rail { --back: #d4cec2; }
.rail .cap { grid-column: 2 / 5; height: 24px; position: relative; }
.rail .cap::before, .rail .cap::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  width: calc(var(--rail) + var(--mid) + 18px - 2.5px); height: 20px; bottom: 0;
  border: 2.5px solid var(--back); border-bottom: 0; border-radius: 999px 999px 0 0; }
.rail .cap::after { border-color: var(--red); clip-path: inset(0 50% 0 0); }
/* the same U-turn at the far terminus, so both ends read alike */
.rail .cap.btm::before, .rail .cap.btm::after { bottom: auto; top: 0; border: 2.5px solid var(--back);
  border-top: 0; border-radius: 0 0 999px 999px; }
.rail .cap.btm::after { border-color: var(--red); }
.rail .capdot { position: absolute; z-index: 2; left: 50%; top: -4px; transform: translateX(-50%); width: 13px; height: 13px;
  border-radius: 50%; background: var(--red); border: 2.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.08); box-sizing: border-box; }
.rail .cap.btm .capdot { top: auto; bottom: -4px; }
.rail .capname { grid-column: 1 / 6; text-align: center; font-size: calc(12.5px * var(--bm-fs, 1)); font-weight: 800;
  color: var(--ink); padding: 0 0 4px; cursor: pointer; }
.rail .capname:hover { color: var(--red); }
.rail .grid:last-child .capname { padding: 4px 0 0; }
/* the return leg is the other direction: grey like its stop names */
.rail li .rl:nth-of-type(4)::before { background: var(--back); }
.rail li .rl:nth-of-type(4) .dot { border-color: var(--back); }
.rail li .rl:nth-of-type(4) .arw.up { border-bottom-color: var(--back); }

/* One-way services: CUMTA publishes no return working for them, and drawing
   an empty second rail with a U-turn cap into it implied a round trip that
   does not exist. One straight line, names on the right. */
.rail.single .grid { grid-template-columns: var(--rail) 1fr; column-gap: 12px; }
.rail.single .lbl { text-align: left; }
.rail.single .hdr { margin-bottom: 6px; }

.rail ul { list-style: none; margin: 0; padding: 0; }
.rail li { padding: var(--pad) 0; cursor: pointer; border-radius: 8px; transition: background .12s ease; }
.rail li:hover { background: rgba(240,27,72,.06); }
.rail li:hover .lbl.l .nm { color: var(--red); }
.rail .link { height: 0; border-top: 1.5px dotted #8ab4f8; }
.rail .link.none { border-top-color: transparent; }

.rail .lbl { min-width: 0; }
.rail .lbl.l { text-align: right; }
.rail .lbl .nm { display: block; font-size: calc(12.5px * var(--bm-fs, 1)); line-height: 1.32; letter-spacing: -.005em; }
.rail .lbl.r .nm { color: var(--muted); }
.rail li.term .lbl .nm { font-weight: 800; }
.rail .lbl .none { font-size: calc(12.5px * var(--bm-fs, 1)); color: #cfc9bb; }

/* Travel direction, drawn as a solid arrowhead sitting ON the rail in the
   gap between two stops — a disc big enough to read would collide with the
   11px dots once rows tighten, so the triangle rides the line instead.
   Same chevron idea as the map layer, so card and map agree. */
.rail .arw { position: absolute; z-index: 2; left: 50%; width: 0; height: 0; font-size: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  /* a ring of white shadows, not one blur: the arrowhead is red on a red
     rail, so it needs a hard outline to separate from the line it rides */
  filter: drop-shadow(0 1px 0 #fff) drop-shadow(0 -1px 0 #fff)
          drop-shadow(1px 0 0 #fff) drop-shadow(-1px 0 0 #fff); }
/* centred in the gap between two dots: the element is 9px tall and the gap
   midpoint is the row boundary, so it sits 4.5px past the cell edge */
.rail .arw.dn { transform: translateX(-50%); bottom: calc(-1 * var(--pad) - 4.5px); border-top: 9px solid var(--red); }
.rail .arw.up { transform: translateX(-50%); top: calc(-1 * var(--pad) - 4.5px); border-bottom: 9px solid var(--red); }

.stopline { list-style: none; margin: 0; padding: 0; }
.stopline li { position: relative; padding: 8px 0 8px 22px; font-size: calc(13.5px * var(--bm-fs, 1)); cursor: pointer; }
.stopline li:hover { color: var(--red); }
.stopline li::before { content:""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: currentColor; opacity: .25; }
/* dot centred on the same x as the line: outer width 14px -> left = 6 - 7 */
.stopline li::after { content:""; position: absolute; left: -1px; top: 50%; transform: translateY(-50%); width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--red); }
/* terminus dot outer width 17px -> left = 6 - 8.5 */
.stopline li.term::after { width: 13px; height: 13px; left: -2.5px; background: var(--red); }
.stopline li.term { font-weight: 700; }
.stopline.coded li { padding-top: 6px; padding-bottom: 6px; }
.stopline li .code { display: block; font-size: calc(10px * var(--bm-fs, 1)); color: var(--red); font-weight: 700; line-height: 1.2; }
.stopline li .nm { display: block; }
.dirhead b { color: var(--ink); } .dirgap { height: 6px; }

.timings-btn { width: 100%; background: var(--glass-inner); border: 1px solid rgba(0,0,0,.07); border-radius: 12px; padding: 11px; font-size: calc(13px * var(--bm-fs, 1));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font-weight: 700; color: var(--ink); cursor: pointer; display: flex; gap: 7px; align-items: center; justify-content: center; margin-top: 8px;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease; }
.timings-btn:hover { background: rgba(255,255,255,.92); border-color: var(--red); color: var(--red); }
.timings-btn:active { transform: scale(.99); }
#timings-box:not(:empty) { margin: 8px 0 4px; background: var(--glass-inner); border: 1px solid rgba(0,0,0,.06); border-radius: 12px; padding: 4px 12px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.trow { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: calc(13.5px * var(--bm-fs, 1)); }
.trow:last-child { border-bottom: 0; } .trow b { font-variant-numeric: tabular-nums; }

/* Board-type chips. AC is the only one that gets colour — it is the
   distinction a rider is actually choosing between, and colouring all six
   would turn the card into a paint chart. */
.tiers { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 2px;
  border-top: 1px solid var(--line); }
.tier { display: inline-flex; align-items: center; gap: 5px; font-size: calc(11.5px * var(--bm-fs, 1));
  font-weight: 600; padding: 4px 9px 4px 7px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,.7); color: var(--ink); }
.tier svg { width: 13px; height: 13px; flex: 0 0 auto; opacity: .85; }
.tier b { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted);
  font-size: calc(11px * var(--bm-fs, 1)); }
.tier.ac { border-color: #7cc3e8; background: rgba(124,195,232,.16); color: #14607f; }
.tier.ac svg { opacity: 1; color: #2b8cba; }
.tier.ac b { color: #14607f; opacity: .7; }

/* departures-by-hour: 24 bars, so the shape of the working is visible at a
   glance — an all-day service, a peak-only one, or the two clumps at either
   end of the day that mark a depot run */
.hwrap { padding: 10px 0 4px; border-top: 1px solid var(--line); }
.hlbl { font-size: calc(10.5px * var(--bm-fs, 1)); color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; font-weight: 700; margin-bottom: 7px; }
.hlbl b { color: var(--red); text-transform: none; letter-spacing: 0; font-size: calc(11px * var(--bm-fs, 1)); }
/* A 24-hour dial rather than a bar chart: midnight at the top, noon at the
   bottom, each hour its own sector. A depot run reads instantly as two
   wedges at opposite ends of the face. */
.dnclock { padding: 4px 0 0; text-align: center; }
.dn1 svg { width: 100%; max-width: 230px; height: auto; overflow: visible; }
.dn-face { fill: none; stroke: rgba(0,0,0,.08); stroke-dasharray: 2 3; }
.dn-tick { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.dn-split { stroke: rgba(0,0,0,.14); stroke-width: 1; stroke-dasharray: 2 2; }
.dn-w { opacity: .92; } .dn-w.dy { fill: #e09400; } .dn-w.nt { fill: #3d33a0; }
.dn-w.z.dy { fill: #fbe7bd; opacity: .7; } .dn-w.z.nt { fill: #d9d6f4; opacity: .7; }
.dn-w:hover { opacity: 1; stroke: var(--ink); stroke-width: .8; }
.dn-num { fill: var(--muted); font-size: calc(9px * var(--bm-fs, 1)); font-weight: 700; text-anchor: middle; }
.dn-hub { fill: #fff; stroke: #e8e2d4; stroke-width: 1.5; }
.dn-ic { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dn-ic.day { stroke: #e09400; } .dn-ic.night { stroke: #3d33a0; }
.dn-caps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 2px; }
.dn-cap { font-size: calc(11.5px * var(--bm-fs, 1)); color: var(--muted); line-height: 1.35; }
.dn-cap b { font-weight: 800; margin-right: 3px; } .dn-cap.day b { color: #e09400; } .dn-cap.night b { color: #3d33a0; }
.dn-cap span { display: block; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.dn-peak { text-align: center; font-size: calc(11.5px * var(--bm-fs, 1)); color: var(--muted); padding: 8px 0 2px; }
.dn-peak b { color: var(--ink); font-variant-numeric: tabular-nums; }
.hclock { display: grid; place-items: center; padding: 2px 0 0; }
.hclock svg { width: 146px; height: 146px; overflow: visible; }
.hclock .seg { fill: var(--red); }
.hclock .seg.z { fill: #e7e2d6; }
.hclock .face { fill: none; stroke: rgba(0,0,0,.07); stroke-width: 1; }
.hclock .hr { fill: var(--muted); font-size: calc(8.5px * var(--bm-fs, 1)); font-weight: 700;
  text-anchor: middle; dominant-baseline: middle; font-variant-numeric: tabular-nums; }
.hclock .cn { fill: var(--ink); font-size: calc(15px * var(--bm-fs, 1)); font-weight: 800; text-anchor: middle;
  font-variant-numeric: tabular-nums; }
.hclock .cl { fill: var(--muted); font-size: calc(7.5px * var(--bm-fs, 1)); font-weight: 700; text-anchor: middle;
  letter-spacing: .1em; }
.tmsg { padding: 10px 0; color: var(--muted); font-size: calc(12.5px * var(--bm-fs, 1)); line-height: 1.55; }

.mapbtns { position: fixed; z-index: 600; right: calc(12px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 8px; }
.mapbtn { width: 44px; height: 44px; border-radius: 14px; background: #fff; border: 0; box-shadow: 0 2px 10px rgba(0,0,0,.18); display: grid; place-items: center; cursor: pointer; color: #333; }
.mapbtn svg { width: 20px; height: 20px; }
#layer-menu { position: fixed; z-index: 601; right: calc(64px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); background: #fff; border-radius: 12px; box-shadow: 0 8px 26px rgba(0,0,0,.2); padding: 7px; display: none; min-width: 176px; }
#layer-menu.open { display: block; }
#layer-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; padding: 8px 11px; border-radius: 8px; font-size: calc(13px * var(--bm-fs, 1));
  cursor: pointer; color: var(--muted); }
#layer-menu button:hover { background: #f1eee6; }
#layer-menu .lyr.on { color: var(--red); font-weight: 600; }
#layer-menu button svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .75; }
#layer-menu .lyr.on svg { opacity: 1; }
.pin-marker { filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); cursor: pointer; }
.maplibregl-ctrl-attrib { font-size: calc(10px * var(--bm-fs, 1)); }
#loading { position: fixed; inset: 0; z-index: 700; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: var(--cream); color: var(--muted); font-size: calc(13px * var(--bm-fs, 1)); transition: opacity .4s; }
#loading.done { opacity: 0; pointer-events: none; }
/* A double-decker in DTC green, drawn on a 60x40 pixel grid. crispEdges keeps the pixels square at
   any size; the wheels are octagons rather than circles so they stay in the
   same idiom while they spin. */
#pxbus { width: 176px; height: 118px; shape-rendering: crispEdges; }
#pxbus .whl { transform-box: fill-box; transform-origin: 50% 50%;
  animation: pxspin .5s linear infinite; }
#pxbus .body { transform-box: fill-box; animation: pxhop .34s steps(2, end) infinite alternate; }
#pxbus .road { animation: pxroad .5s linear infinite; }
@keyframes pxspin { to { transform: rotate(360deg); } }
@keyframes pxhop  { to { transform: translateY(-.7px); } }
@keyframes pxroad { to { transform: translateX(-12px); } }
@media (prefers-reduced-motion: reduce) {
  #pxbus .whl, #pxbus .body, #pxbus .road { animation: none; }
}

/* ── live buses (was injected by delhi/live.js) ── */
#live-pill { position: fixed; z-index: 590; left: 50%; transform: translateX(-50%); top: calc(14px + env(safe-area-inset-top));
  display: none; align-items: center; gap: 8px; padding: 6px 11px 6px 9px; border-radius: 999px;
  background: rgba(255,255,255,.94); box-shadow: 0 2px 10px rgba(0,0,0,.16); font-size: calc(12px * var(--bm-fs, 1)); color: #333;
  font-variant-numeric: tabular-nums; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#live-pill.show { display: flex; }
#live-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #1fa85a; box-shadow: 0 0 0 0 rgba(31,168,90,.55); animation: lpulse 1.8s infinite; }
#live-pill.wait .dot { background: #aaa; animation: none; }
#live-pill.down { background: rgba(255,240,242,.96); color: #8c1028; }
#live-pill.down .dot { background: #e0173f; animation: lpulsered 1.4s infinite; }
#live-pill b { font-weight: 700; letter-spacing: .04em; }
@keyframes lpulse { 70% { box-shadow: 0 0 0 7px rgba(31,168,90,0); } 100% { box-shadow: 0 0 0 0 rgba(31,168,90,0); } }
@keyframes lpulsered { 0% { box-shadow: 0 0 0 0 rgba(224,23,63,.55); } 70% { box-shadow: 0 0 0 7px rgba(224,23,63,0); } 100% { box-shadow: 0 0 0 0 rgba(224,23,63,0); } }
@media (prefers-reduced-motion: reduce) { #live-pill .dot { animation: none; } }
.lv-row { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; padding: 7px 2px; border-bottom: 1px solid #efe9de; }
.lv-row:last-child { border-bottom: 0; }
.lv-row .when { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.lv-row .when small { display: block; font-weight: 400; color: var(--muted); font-size: calc(11px * var(--bm-fs, 1)); }
.lv-row .meta { font-size: calc(12px * var(--bm-fs, 1)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-row .meta b { color: #333; font-weight: 600; }
.lv-chip { display: inline-block; font-size: calc(10.5px * var(--bm-fs, 1)); font-weight: 700; padding: 1px 6px; border-radius: 5px; margin-right: 4px; color: #fff; vertical-align: 1px; }
.lv-hero { display: grid; place-items: center; padding: 4px 0 2px; }
.lv-hero img { width: min(300px, 86%); height: auto; }
.lv-hero:has(.lv-mv) { position: relative; min-height: 150px; }
/* the bus's 3D model in the card (rtc.js hero3D): fades in over the drawn portrait once it has loaded */
.lv-mv { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .35s; background: transparent; --poster-color: transparent; --progress-bar-color: transparent; }
.lv-mv.in { position: relative; opacity: 1; height: 180px; cursor: grab; }
.lv-mv.in:active { cursor: grabbing; }
.lv-crowd { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: calc(13px * var(--bm-fs, 1)); padding: 2px 2px 8px; }
.lv-crowd span:last-child { color: var(--muted); font-size: calc(12px * var(--bm-fs, 1)); }
.lv-bars { display: flex; align-items: flex-end; gap: 2px; height: 46px; padding: 0 2px; }
.lv-bars i { flex: 1; border-radius: 2px 2px 0 0; min-height: 2px; }
.lv-axis { display: flex; justify-content: space-between; font-size: calc(10px * var(--bm-fs, 1)); color: var(--muted); padding: 3px 2px 0; font-variant-numeric: tabular-nums; }
.lv-hero img { width: min(230px, 66%); margin: -14px 0 -10px; }
#card .chead { padding-right: 84px; }
#card .lv-share { right: 48px; display: none; place-items: center; }
#card .lv-share.on { display: grid; }
#lv-toast { position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 950;
  background: #1c1c1e; color: #fff; font-size: calc(13px * var(--bm-fs, 1)); padding: 9px 14px; border-radius: 999px; transition: opacity .2s, transform .2s; pointer-events: none; }
#lv-toast.show { opacity: 1; transform: translate(-50%, 0); }
.lv-busline { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; }
#lv-busbar { margin-bottom: 10px; }
#lv-busbar .lv-report { margin-top: 0; }
.rail.lv-live li.passed .rl.out .dot { background: var(--red); }
.rail.lv-live li.passed .lbl.out .nm { color: #9a958b; }
.rail.lv-live li.next .rl.out .dot { background: var(--red); animation: lvblink 1.1s ease-in-out infinite; }
.rail.lv-live li.next .lbl.out .nm { color: var(--red); font-weight: 800; }
@keyframes lvblink { 0%, 100% { box-shadow: 0 0 0 0 rgba(240,27,72,.55); background: var(--red); } 50% { box-shadow: 0 0 0 7px rgba(240,27,72,0); background: #fff; } }
.rail.lv-live .cap.next .capdot { animation: lvblink 1.1s ease-in-out infinite; }
.lv-eta { display: block; font-size: calc(11px * var(--bm-fs, 1)); font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; margin-top: 1px; }
.rail.lv-live li:not(.next) .lv-eta { color: var(--muted); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .rail.lv-live li.next .rl.out .dot, .rail.lv-live .cap.next .capdot { animation: none; } }
.lv-ico { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; color: #fff; margin-right: 4px; vertical-align: -4px; }
.lv-ico.ac { color: #1677d2; box-shadow: inset 0 0 0 1.2px #8cc6f5; }
.lv-ico.ac svg { stroke-width: 2.4; }
.lv-f[data-g="dieselAC"] i { background: #e4f3ff !important; color: #1677d2; box-shadow: inset 0 0 0 1px #8cc6f5; }
.lv-f[data-g="dieselAC"].off i { background: #cfcac0 !important; color: #fff; box-shadow: none; }
#live-pill { pointer-events: auto; max-width: calc(100vw - 150px); }
#live-pill .lv-live { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
#live-pill .key { display: flex; gap: 3px; margin-left: 2px; color: #555; overflow-x: auto; scrollbar-width: none; }
#live-pill .key::-webkit-scrollbar { display: none; }
.lv-f { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; font: inherit; font-size: calc(12px * var(--bm-fs, 1)); color: #444; padding: 3px 6px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.lv-f:hover { background: #f1ece2; }
.lv-f i { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 5px; color: #fff; }
.lv-f.off { color: #aaa; text-decoration: line-through; }
.lv-f.off i { background: #cfcac0 !important; }
.lv-f.wc { border: 1px solid #d9e3f7; }
.lv-f.wc.on { background: #1f5fd6; color: #fff; border-color: #1f5fd6; }
@media (max-width: 640px) { .lv-f span { display: none; } .lv-f { padding: 3px 4px; } }
.lv-stop { cursor: pointer; border-radius: 8px; transition: background .15s; }
.lv-stop:hover, .lv-stop:focus-visible { background: #f3eee4; outline: none; }
.lv-pin { color: #f01b48; display: inline-flex; }
.lv-report { display: inline-flex; align-items: center; gap: 5px; float: right; margin: -6px 0 0; border: 1px solid #e3dccd; background: #fff; color: #444;
  font: inherit; font-size: calc(12px * var(--bm-fs, 1)); font-weight: 600; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.lv-report:hover { border-color: #f01b48; color: #f01b48; }
.lv-stophead { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 2px 0 6px; }
.lv-backbtn { display: inline-flex; align-items: center; gap: 5px; border: 0; background: #f3eee4; color: #333; font: inherit; font-size: calc(12.5px * var(--bm-fs, 1)); font-weight: 600; border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.lv-said { display: flex; align-items: center; gap: 6px; font-size: calc(12.5px * var(--bm-fs, 1)); padding: 4px 2px; color: #333; }
.lv-said span { margin-left: auto; color: var(--muted); font-size: calc(11.5px * var(--bm-fs, 1)); white-space: nowrap; }
#card { transition: opacity .17s ease, transform .17s ease; }
#card.lv-out { opacity: 0; transform: translateX(14px); }
#card.lv-in { animation: lvin .26s cubic-bezier(.32,.72,0,1); }
@keyframes lvin { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
#lv-sheet { position: fixed; inset: 0; z-index: 900; background: rgba(20,20,24,.32); display: none; align-items: flex-end; justify-content: center; }
#lv-sheet.open { display: flex; animation: lvfade .18s ease; }
@keyframes lvfade { from { opacity: 0; } }
.lv-sheetbox { width: min(440px, 100%); max-height: 86vh; overflow: auto; background: #fffdf8; border-radius: 20px 20px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(0,0,0,.2); animation: lvup .26s cubic-bezier(.32,.72,0,1); }
@media (min-width: 700px) { #lv-sheet { align-items: center; } .lv-sheetbox { border-radius: 20px; } }
@keyframes lvup { from { transform: translateY(40px); opacity: 0; } }
.lv-sheethead { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; text-align: center; font-size: calc(16px * var(--bm-fs, 1)); }
.lv-x { border: 0; background: #f3eee4; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; font-size: calc(14px * var(--bm-fs, 1)); color: #444; }
.lv-sub { text-align: center; font-size: calc(12.5px * var(--bm-fs, 1)); color: var(--muted); margin: 6px 0 10px; }
.lv-lbls { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lv-lbls span { position: absolute; left: 0; top: 0; font: 700 calc(11px * var(--bm-fs, 1))/1 "Noto Sans", system-ui, sans-serif; white-space: nowrap; will-change: transform;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.lv-lbls span.dim { opacity: .75; }
.lv-glabel { font-size: calc(11px * var(--bm-fs, 1)); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 2px 6px; }
.lv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.lv-tiles.two { grid-template-columns: 1fr 1fr; margin-top: 12px; }
.lv-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 84px; padding: 10px 8px; border: 1.5px solid #e7e0d2;
  background: #fff; border-radius: 14px; font: inherit; font-size: calc(13px * var(--bm-fs, 1)); font-weight: 600; color: #222; cursor: pointer; text-align: center; transition: transform .08s, border-color .15s; }
.lv-tile:hover { border-color: #f01b48; }
.lv-tile:active { transform: scale(.96); }
.lv-tile svg { color: #f01b48; }
.lv-thanks { display: flex; gap: 12px; align-items: center; font-size: calc(13.5px * var(--bm-fs, 1)); color: #333; padding: 6px 2px; }
.lv-thanks svg { color: #2fa35a; flex: none; }
.lv-note { font-size: calc(12px * var(--bm-fs, 1)); color: var(--muted); padding: 6px 2px 2px; }
.lv-btn { margin-top: 6px; border: 0; background: #f6f1e7; color: #333; font-weight: 600; border-radius: 9px; padding: 8px 12px; cursor: pointer; font-size: calc(13px * var(--bm-fs, 1)); }
.lv-btn:hover { background: #efe8da; }

/* ── shared additions (all networks) ── */

/* Timetable delay notes beside a stop: how late this service usually runs there,
   or how far the bus is from its timetable now. Same three colours everywhere. */
.bm-d { font-size: calc(10.5px * var(--bm-fs, 1)); font-weight: 700; margin-left: 5px; font-variant-numeric: tabular-nums; }
.bm-d.late { color: #c2410c; } .bm-d.early { color: #1d6fb8; } .bm-d.ok { color: #15803d; }
.lv-eta .bm-d { font-weight: 700; }
.lv-eta.sched { color: var(--muted); font-weight: 600; }

/* A city route that ends where it starts: one rail, and the last stop curls back
   into the first instead of a U-turn into a second rail. */
.rail.loop .loopback { display: grid; grid-template-columns: var(--rail) 1fr; column-gap: 12px;
  align-items: center; font-size: calc(12px * var(--bm-fs, 1)); color: var(--muted); padding: 2px 0 0; cursor: pointer; }
.rail.loop .loopback svg { width: 16px; height: 16px; color: var(--red); justify-self: center; }
.rail.loop .loopback b { color: var(--ink); font-weight: 800; }
/* both ends named once, with the two-way arrow, for a single-line intercity route */
.rail .bothways { font-size: calc(10.5px * var(--bm-fs, 1)); font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 0 0 6px; }

/* bus card: the facts under the coach portrait */
.bm-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: calc(12.5px * var(--bm-fs, 1)); margin: 2px 0 6px; }
.bm-facts dt { color: var(--muted); } .bm-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.timings-btn.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.bm-deps .lv-row { cursor: pointer; }
.bm-deps .lv-row:hover { background: rgba(0,0,0,.03); }
.bm-live { font-size: calc(10px * var(--bm-fs, 1)); font-weight: 800; color: #1fa85a; letter-spacing: .04em; }

/* the moon item in the layers menu */
#layer-menu .lyr.dark.on { color: var(--ink); }

/* ── dark map ──
   The same glass, inverted: a smoked scrim over the blur instead of a milky one.
   Toggled from the layers menu (body.bm-dark); the basemap is recoloured to match. */
body.bm-dark {
  --cream:#15171b; --ink:#eceae4; --muted:#9a9ca3; --line:#2c2f36;
  --glass:linear-gradient(180deg, rgba(30,32,38,.88), rgba(24,26,31,.80));
  --glass-inner:rgba(255,255,255,.06);
  --hair:rgba(255,255,255,.10);
  --lift:0 1px 0 rgba(255,255,255,.06) inset, 0 12px 40px -8px rgba(0,0,0,.6), 0 2px 10px -2px rgba(0,0,0,.4);
  color-scheme: dark;
}
body.bm-dark #panel { background: linear-gradient(180deg, rgba(30,32,38,.96), rgba(24,26,31,.94)); }
body.bm-dark #q { background: #1d2025; color: var(--ink); }
body.bm-dark .mapbtn, body.bm-dark #layer-menu, body.bm-dark #live-pill { background: rgba(30,32,38,.94); color: var(--ink); }
body.bm-dark #layer-menu button:hover, body.bm-dark .lv-f:hover { background: rgba(255,255,255,.07); }
body.bm-dark #tilt-btn.on { background: var(--ink); color: #15171b; }
body.bm-dark #card .cclose { background: rgba(255,255,255,.08); color: #c9c6bd; border-color: rgba(255,255,255,.08); }
body.bm-dark #card .chead { border-bottom-color: rgba(255,255,255,.07); }
body.bm-dark .wklist .it, body.bm-dark .lv-row { border-color: rgba(255,255,255,.06); }
body.bm-dark .wklist .it.on { background: rgba(96,140,255,.16); }
body.bm-dark .rail .dot, body.bm-dark .stopline li::after { background: #1d2025; }
body.bm-dark .rail { --back: #4a4d55; }
body.bm-dark .rail .dot.blank { border-color: #3a3d44; }
body.bm-dark .rail .capdot { border-color: #1d2025; }
body.bm-dark .rail .arw { filter: drop-shadow(0 1px 0 #1d2025) drop-shadow(0 -1px 0 #1d2025) drop-shadow(1px 0 0 #1d2025) drop-shadow(-1px 0 0 #1d2025); }
body.bm-dark .timings-btn:hover { background: rgba(255,255,255,.1); }
body.bm-dark .tier { background: rgba(255,255,255,.06); color: var(--ink); }
body.bm-dark .dn-hub { fill: #1d2025; stroke: #33363d; }
body.bm-dark .dn-face { stroke: rgba(255,255,255,.12); }
body.bm-dark .lv-lbls span { text-shadow: 0 0 2px #111, 0 0 2px #111, 0 0 3px #111, 0 0 3px #111; }
body.bm-dark .lv-f { color: #cfcdc6; }
body.bm-dark .lv-backbtn, body.bm-dark .lv-btn { background: rgba(255,255,255,.08); color: var(--ink); }
body.bm-dark .maplibregl-ctrl-group { background: #24262c; }
body.bm-dark .maplibregl-ctrl-group button span { filter: invert(1); }
body.bm-dark .maplibregl-ctrl-attrib { background: rgba(30,32,38,.8); color: #aaa; }
body.bm-dark .maplibregl-ctrl-attrib a { color: #ccc; }
body.bm-dark .rail.lv-live li.passed .rl.out .dot { background: var(--red); }

/* loading screen: the network's fleet, one coach after another */
#loading .fleetname { font-size: calc(13px * var(--bm-fs, 1)); font-weight: 800; letter-spacing: .02em; margin-top: -10px; min-height: 18px; transition: color .2s; }

/* the live pill: four kinds of bus, the rest (and Off duty) in a dropdown under it */
#live-pill { flex-wrap: wrap; }
#live-pill .lv-n { font-weight: 600; color: var(--muted); font-size: calc(10.5px * var(--bm-fs, 1)); margin-left: 1px; }
#live-pill .lv-more { font-weight: 700; color: var(--ink); border: 1px solid var(--line); }
#live-pill .lv-more.on { background: var(--ink); color: #fff; border-color: var(--ink); }
#live-pill .lv-drop { position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); min-width: 240px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 6px; border-radius: 14px;
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 0.5px solid var(--hair); box-shadow: var(--lift); max-height: 60vh; overflow-y: auto; animation: cardin .2s cubic-bezier(.32,.72,0,1); }
#live-pill .lv-drop .lv-f { justify-content: flex-start; padding: 6px 9px; }
#live-pill .lv-drop .lv-f span { display: inline !important; }
#live-pill .lv-drop .lv-n { margin-left: auto; }
#live-pill .lv-ghost { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 3px; padding-top: 8px; }
#live-pill .lv-ghost:not(.on) { color: #aaa; }

/* ── route editor (editor.js) ── */
#card .lv-editbtn { right: 84px; display: none; place-items: center; }
#card .lv-editbtn.on { display: grid; }
#card .chead:has(.lv-editbtn.on) { padding-right: 120px; }
body.bm-editing #card .lv-editbtn, body.bm-editing #card .lv-share { display: none; }
body.bm-editing #card .chead { padding-right: 44px; }
/* the card grows into the editor; its sections slide in one after another */
@media (min-width: 700px) { #card { transition: max-height .34s cubic-bezier(.32,.72,0,1), width .34s cubic-bezier(.32,.72,0,1); }
  #card.bm-edit-card { width: 430px; } }
@media (max-width: 699px) { #card.bm-edit-card { max-height: 78vh; } }
.bm-edit-sub { color: var(--muted); font-weight: 600; font-size: calc(12px * var(--bm-fs, 1)); }
.bm-sec { animation: bmin .38s cubic-bezier(.32,.72,0,1) both; animation-delay: calc(var(--i) * 60ms); }
@keyframes bmin { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .bm-sec { animation: none; } }
.bm-field { display: block; margin: 0 0 8px; }
.bm-field > span { display: block; font-size: calc(11px * var(--bm-fs, 1)); font-weight: 700; color: var(--muted); margin: 0 0 3px; }
.bm-edit input, .bm-edit textarea { width: 100%; font: inherit; font-size: calc(13.5px * var(--bm-fs, 1)); color: var(--ink); background: var(--glass-inner);
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; outline: none; transition: border-color .15s, box-shadow .15s; }
.bm-edit input:focus, .bm-edit textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(240,27,72,.12); }
.bm-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bm-hint { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: calc(11px * var(--bm-fs, 1)); margin-left: 6px; }
.bm-stops { list-style: none; margin: 0; padding: 0; }
.bm-stops li { display: grid; grid-template-columns: 24px 1fr repeat(4, 28px); gap: 4px; align-items: center; padding: 3px 0;
  border-radius: 9px; transition: background .4s ease; }
.bm-stops li.bm-flash { background: rgba(240,27,72,.10); }
.bm-n { width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font-size: calc(11px * var(--bm-fs, 1)); font-weight: 800; display: grid; place-items: center; }
.bm-ib { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.bm-ib:hover:not(:disabled) { background: rgba(0,0,0,.06); color: var(--ink); }
.bm-ib:disabled { opacity: .25; cursor: default; }
.bm-del:hover:not(:disabled) { color: var(--red); }
.bm-group { border: 1px solid var(--line); border-radius: 12px; padding: 8px; margin: 0 0 8px; background: var(--glass-inner); animation: bmin .3s cubic-bezier(.32,.72,0,1); }
.bm-ghead { display: grid; grid-template-columns: 1fr auto 28px; gap: 6px; align-items: center; }
.bm-ghead b { font-size: calc(12px * var(--bm-fs, 1)); color: var(--muted); }
.bm-times { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0; }
.bm-t { display: inline-flex; align-items: center; gap: 2px; font-size: calc(12px * var(--bm-fs, 1)); font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 2px 4px 2px 7px; border-radius: 6px; background: rgba(240,27,72,.08); color: var(--ink); animation: bmin .2s ease; }
.bm-t button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: calc(13px * var(--bm-fs, 1)); padding: 0 2px; line-height: 1; }
.bm-t button:hover { color: var(--red); }
.bm-tt .bm-t { padding: 2px 7px; }
.bm-tadd { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: calc(12px * var(--bm-fs, 1)); color: var(--muted); }
.bm-tadd input[type=time] { width: auto; padding: 4px 6px; font-size: calc(12.5px * var(--bm-fs, 1)); }
.bm-tadd input[type=number] { width: 54px; padding: 4px 6px; font-size: calc(12.5px * var(--bm-fs, 1)); }
.bm-tadd .lv-btn { margin: 0; padding: 5px 9px; font-size: calc(12px * var(--bm-fs, 1)); display: inline-flex; gap: 4px; align-items: center; }
.bm-every { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.bm-addgrp { display: flex; flex-wrap: wrap; gap: 5px; }
.bm-addgrp .lv-btn { margin: 0; font-size: calc(12px * var(--bm-fs, 1)); padding: 6px 10px; }
.bm-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin: 16px 0 4px; position: sticky; bottom: 0;
  padding: 8px 0 2px; background: linear-gradient(180deg, transparent, var(--cream) 40%); }
.bm-send { background: var(--red) !important; color: #fff !important; border-color: var(--red) !important; }
.bm-send:disabled { opacity: .6; }
/* the stops on the map while editing: numbered, draggable */
.bm-pin { display: flex; align-items: center; gap: 5px; cursor: grab; }    /* no transition on the pin itself: MapLibre positions it with transform */
.bm-pin b { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2.5px solid var(--red); color: var(--red);
  font-size: calc(11px * var(--bm-fs, 1)); font-weight: 800; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.bm-pin.term b { background: var(--red); color: #fff; }
.bm-pin span { font-size: calc(11.5px * var(--bm-fs, 1)); font-weight: 700; color: #222; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.bm-pin b { transition: transform .2s ease, box-shadow .2s ease; }
.bm-pin.on { z-index: 2; }
.bm-pin.on b { transform: scale(1.25); }
.bm-pin:active { cursor: grabbing; }
.bm-pin.on b { box-shadow: 0 0 0 6px rgba(240,27,72,.2); }
body.bm-dark .bm-pin span { color: #eee; text-shadow: 0 0 2px #000, 0 0 3px #000; }

/* report sheet: free-text "something else" */
.lv-other textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: calc(14px * var(--bm-fs, 1)); padding: 10px 12px; border: 1.5px solid #e7e0d2; border-radius: 12px; background: #fff; resize: vertical; min-height: 70px; }
.lv-other textarea:focus { outline: none; border-color: #f01b48; }
.lv-otherrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.lv-otherrow span { font-size: calc(11.5px * var(--bm-fs, 1)); color: var(--muted); }
.lv-otherrow .timings-btn { width: auto; margin: 0; padding: 8px 16px; display: inline-flex; align-items: center; gap: 6px; }
.lv-otherrow .timings-btn:disabled { opacity: .45; cursor: default; }
body.bm-dark .lv-other textarea { background: #23252b; color: #eee; border-color: #3a3d45; }

/* bus editor */
.bm-chks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.bm-chk { white-space: nowrap; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1.5px solid #e7e0d2; border-radius: 999px; font-size: calc(13px * var(--bm-fs, 1)); cursor: pointer; background: #fff; }
.bm-chk:has(input:checked) { border-color: #f01b48; background: #fff1f4; }
.bm-chk input { accent-color: #f01b48; margin: 0; }
.bm-wide { width: 100%; justify-content: center; display: inline-flex; align-items: center; gap: 6px; }
body.bm-dark .bm-chk { background: #23252b; border-color: #3a3d45; }
body.bm-dark .bm-chk:has(input:checked) { background: #3a1820; border-color: #f01b48; }

.bm-calc { color: var(--muted); font-size: calc(12px * var(--bm-fs, 1)); }

/* live buses on a route card */
.lv-onr { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: thin; }
.lv-onb { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px 6px 7px; border: 1px solid #e7e0d2; border-radius: 12px; background: #fff; cursor: pointer; font: inherit; color: inherit; text-align: left; }
.lv-onb:hover { border-color: #f01b48; }
.lv-onb i { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: #fff; }
.lv-onb span { display: flex; flex-direction: column; line-height: 1.15; }
.lv-onb b { font-size: calc(12.5px * var(--bm-fs, 1)); }
.lv-onb small { font-size: calc(10.5px * var(--bm-fs, 1)); color: var(--muted); }
.bm-rinfo { margin: 4px 0 10px; }
.bm-rinfo dd { font-size: calc(12.5px * var(--bm-fs, 1)); line-height: 1.35; }
.lv-untr.on i { box-shadow: 0 0 0 2px #fff, 0 0 0 3px #7b6cd9; }
body.bm-dark .lv-onb { background: #23252b; border-color: #3a3d45; }

/* ── mobile-first chrome (rtc.js): live count on top, filter strip at the bottom, no sideways scrolling ── */
#live-pill { max-width: calc(100vw - 140px); }
#lv-strip { position: fixed; z-index: 590; display: none; left: calc(12px + env(safe-area-inset-left)); bottom: calc(14px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 84px); }
#lv-strip.show { display: block; }
#lv-strip .key { display: flex; align-items: center; gap: 4px; padding: 5px; border-radius: 16px; background: rgba(255,253,248,.96);
  box-shadow: 0 2px 14px rgba(0,0,0,.16); backdrop-filter: blur(6px); }
#lv-strip .lv-f { flex: 0 0 auto; }
#lv-strip .lv-n { font-weight: 600; color: var(--muted); font-size: calc(10.5px * var(--bm-fs, 1)); margin-left: 1px; font-variant-numeric: tabular-nums; }
#lv-strip .lv-drop .lv-n { margin-left: auto; }
#lv-strip .lv-more { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 11px; background: var(--red, #f01b48); color: #fff; font-weight: 700; }
#lv-strip .lv-more em { font-style: normal; font-size: calc(12.5px * var(--bm-fs, 1)); }
#lv-strip .lv-more .chev { display: inline !important; font-size: calc(10px * var(--bm-fs, 1)); opacity: .85; }
#lv-strip .lv-dotn { min-width: 16px; height: 16px; border-radius: 8px; background: #fff; color: var(--red, #f01b48); font-size: calc(10.5px * var(--bm-fs, 1)); display: inline-grid; place-items: center; padding: 0 4px; }
#lv-strip .lv-drop { position: absolute; left: 0; bottom: calc(100% + 8px); width: min(300px, calc(100vw - 24px)); max-height: min(60vh, 460px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 16px; background: #fffdf8; box-shadow: 0 8px 30px rgba(0,0,0,.22); }
#lv-strip .lv-drop.anim { animation: cardin .2s ease; }
#lv-strip .lv-drop .lv-f { width: 100%; justify-content: flex-start; padding: 8px 10px; border-radius: 10px; gap: 9px; }
#lv-strip .lv-drop .lv-f span { display: inline !important; flex: 1; min-width: 0; text-align: left; font-size: calc(13.5px * var(--bm-fs, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#lv-strip .lv-drop .lv-f b { flex: 0 0 auto; }
#lv-strip .lv-drop .lv-f i { width: 22px; height: 22px; border-radius: 6px; }
#lv-strip .lv-dh { font-size: calc(10.5px * var(--bm-fs, 1)); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 3px; }
@media (min-width: 700px) {
  #lv-strip { left: 50%; transform: translateX(-50%); max-width: calc(100vw - 200px); }
  #lv-strip .lv-drop { left: 50%; transform: translateX(-50%); }
}
/* a phone with a card open: the sheet owns the screen — the map buttons and the filter strip step aside,
   so nothing sits over the card's close button */
@media (max-width: 699px) {
  body:has(#card.open:not(.min)) .mapbtns, body:has(#card.open:not(.min)) #layer-menu,
  body:has(#card.open:not(.min)) #lv-strip, body.search-open #lv-strip { opacity: 0; pointer-events: none; }
  .mapbtns, #lv-strip { transition: opacity .2s ease; }
}
body.bm-dark #lv-strip .key, body.bm-dark #lv-strip .lv-drop { background: rgba(30,32,38,.96); color: var(--ink); }
/* on/off rows in the Filters list (Accessible only, Off duty, Not tracked) are plain cells, as on MTC's map (Hide buses
   not on a trip): icon, label, count, with a light outline. A row in force (Off duty or Not tracked hidden) is filled
   grey, white text and icon, as Accessible only is filled blue, and its label says the result */
.lv-f.lv-ghost { border: 1px solid #e2ddd2; }
body.bm-dark .lv-f.lv-ghost { border-color: #3a3d45; }
#lv-strip .lv-drop .lv-f.lv-ghost.force { border-color: #8a8a8e; }
#lv-strip .lv-drop .lv-f.lv-ghost.force { background: #8a8a8e; color: #fff; }
#lv-strip .lv-drop .lv-f.lv-ghost.force span, #lv-strip .lv-drop .lv-f.lv-ghost.force .lv-n, #lv-strip .lv-f.wc.on .lv-n { color: #fff; }
#lv-strip .lv-drop .lv-f.lv-ghost.force i { background: rgba(255,255,255,.22) !important; color: #fff; }
#lv-strip .lv-drop .lv-f.lv-ghost.force:hover { background: #7a7a7e; }
body.bm-dark #lv-strip .lv-drop .lv-f.lv-ghost.force { background: #6c6c72; }
/* City / District / All */
.lv-seg { display: inline-flex; flex: 0 0 auto; gap: 2px; padding: 2px; border-radius: 12px; background: rgba(0,0,0,.06); margin-right: 2px; }
.lv-s { border: 0; background: none; font: inherit; font-size: calc(12.5px * var(--bm-fs, 1)); font-weight: 700; color: #6b665c; padding: 5px 10px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.lv-s.on { background: #fff; color: #1c1c1e; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
@media (max-width: 640px) { .lv-s { padding: 5px 7px; font-size: calc(12px * var(--bm-fs, 1)); } }
body.bm-dark .lv-seg { background: rgba(255,255,255,.08); }
body.bm-dark .lv-s { color: #a9a7a0; }
body.bm-dark .lv-s.on { background: #f3f1ea; color: #1c1c1e; }
@media (max-width: 359px) { #lv-strip .lv-more em { display: none; } .lv-s { padding: 5px 6px; } }

/* folded bus card: the next stop on its last line (live.js miniNext) */
.lv-mnext { display: none; }
#card.min.lv-hasnext .lv-mnext { display: flex; align-items: center; gap: 7px; margin-top: 5px; font-size: calc(13px * var(--bm-fs, 1)); font-weight: 600; color: #1c1c1e; min-width: 0; }
#card.min.lv-hasnext { max-height: 110px; }
@media (min-width:700px){ #card.min.lv-hasnext { max-height: 102px; } }
.lv-mnext > i { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #9a958a; }
.lv-mtrack { overflow: hidden; white-space: nowrap; min-width: 0; flex: 1; mask-image: linear-gradient(90deg, #000 92%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent); }
.lv-mtxt { display: inline-block; }
.lv-mtxt.scroll { animation: lv-mscroll var(--dur, 8s) ease-in-out infinite; }
@keyframes lv-mscroll { 0%, 18% { transform: translateX(0); } 70%, 88% { transform: translateX(var(--dx)); } 100% { transform: translateX(0); } }
.lv-mnext.appr > i { background: #f0a000; animation: lv-blink 1.4s ease-in-out infinite; }
.lv-mnext.appr .lv-mtrack b { animation: lv-blink 1.4s ease-in-out infinite; }
.lv-mnext.near > i { background: #f01b48; animation: lv-blink .5s steps(2, jump-none) infinite; }
.lv-mnext.near .lv-mtrack b { color: #d3123b; animation: lv-blink .5s steps(2, jump-none) infinite; }
.lv-mnext.at > i { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.lv-mnext.at .lv-mtrack b { color: #15803d; }
@keyframes lv-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .lv-mnext .lv-mtrack b, .lv-mnext > i { animation: none !important; } .lv-mtxt.scroll { animation-duration: 20s; } }
body.bm-dark #card.min.lv-hasnext .lv-mnext { color: #f2f2f2; }

/* installed app (pwa.js): install banner, "new timetables" chip, Install / Refresh in the layers menu */
.bm-install { position: fixed; z-index: 700; left: calc(12px + env(safe-area-inset-left)); right: calc(64px + env(safe-area-inset-right));
  top: calc(70px + env(safe-area-inset-top)); transform: translateY(-12px); opacity: 0;
  transition: opacity .25s ease, transform .25s ease; display: flex; align-items: center; gap: 11px;
  padding: 10px 10px 10px 12px; border-radius: 16px; background: rgba(255,253,248,.97); box-shadow: 0 8px 30px rgba(0,0,0,.22); backdrop-filter: blur(8px); color: #1c1c1e; }
.bm-install.in { opacity: 1; transform: none; }
/* a phone: under the search button, clear of the map buttons on the right; wider screens: centred, as wide as it needs */
@media (min-width: 700px) { .bm-install { left: 50%; right: auto; width: 420px; top: calc(60px + env(safe-area-inset-top)); transform: translate(-50%, -12px); } .bm-install.in { transform: translate(-50%, 0); } }
.bm-install img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.bm-install div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.bm-install div > b { font-size: calc(14px * var(--bm-fs, 1)); }
.bm-install div > span { font-size: calc(12.5px * var(--bm-fs, 1)); color: #6b665c; }
.bm-install .go { flex: none; border: 0; border-radius: 11px; padding: 9px 14px; background: var(--red, #f01b48); color: #fff; font: inherit; font-weight: 700; font-size: calc(13.5px * var(--bm-fs, 1)); cursor: pointer; }
.bm-install .x { flex: none; border: 0; background: none; color: #8a857a; font-size: calc(15px * var(--bm-fs, 1)); padding: 6px 7px; cursor: pointer; border-radius: 8px; }
.bm-newdata { position: fixed; z-index: 700; left: 50%; top: calc(70px + env(safe-area-inset-top)); max-width: calc(100vw - 140px); transform: translate(-50%, -12px); opacity: 0; transition: opacity .25s, transform .25s;
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 20px; padding: 8px 8px 8px 12px; background: #1c1c1e; color: #fff; font: inherit; font-size: calc(13px * var(--bm-fs, 1)); font-weight: 600;
  box-shadow: 0 6px 22px rgba(0,0,0,.25); cursor: pointer; }
.bm-newdata.in { opacity: 1; transform: translate(-50%, 0); }
.bm-newdata svg { width: 15px; height: 15px; }
.bm-newdata b { background: var(--red, #f01b48); border-radius: 14px; padding: 4px 11px; }
#layer-menu .bm-appbox { border-top: 1px solid var(--line, #e7e0d2); margin-top: 4px; padding-top: 4px; }
#layer-menu .bm-appbox button:disabled { opacity: .7; }
#layer-menu .bm-ref.spin svg { animation: bm-spin 1s linear infinite; }
@keyframes bm-spin { to { transform: rotate(360deg); } }
body.bm-dark .bm-install { background: rgba(30,32,38,.97); color: #f2f2f2; }
body.bm-dark .bm-install div > span { color: #a9a7a0; }

/* ── accessibility (a11y.js): text size, high contrast, reduced motion, focus, target sizes, settings sheet ── */
/* every control shows where the keyboard is: a 2 px ring in the accent with a white halo (3:1 on map and panels) */
:where(button, a, input, select, [tabindex]):focus-visible { outline: 2.5px solid #0b57d0 !important; outline-offset: 2px; box-shadow: 0 0 0 4.5px rgba(255,255,255,.9); }
body.bm-dark :where(button, a, input, select, [tabindex]):focus-visible { outline-color: #8ab4f8 !important; box-shadow: 0 0 0 4.5px rgba(0,0,0,.7); }
#card-title:focus { outline: none; }
#card-title:focus-visible { outline: 2.5px solid #0b57d0; outline-offset: 3px; border-radius: 6px; }
/* targets: at least 24 x 24 px everywhere, 40 px tall on touch screens (2.5.8) */
.lv-f, .lv-s, .lv-onb, .cclose, .mapbtn, #layer-menu button { min-height: 24px; min-width: 24px; }
@media (pointer: coarse) { #lv-strip .lv-f, #lv-strip .lv-more, .lv-s { min-height: 40px; } #layer-menu button, #layer-menu a { min-height: 44px; } .cclose { min-width: 40px; min-height: 40px; } }
/* larger text: lines may wrap rather than clip */
html.bm-big #card-title, html.bm-big .lv-busline, html.bm-big #lv-strip .lv-drop .lv-f span { white-space: normal; }
html.bm-big #lv-strip .lv-drop { width: min(360px, calc(100vw - 24px)); }
/* high contrast: solid panels, near-black text, outlined controls (1.4.3, 1.4.11) */
html.bm-hc { --muted: #3d3a33; --line: #6b665c; }
html.bm-hc #panel, html.bm-hc #card, html.bm-hc #lv-strip .key, html.bm-hc #lv-strip .lv-drop, html.bm-hc #layer-menu, html.bm-hc #live-pill, html.bm-hc .bm-install {
  background: #fff !important; backdrop-filter: none !important; border: 1.5px solid #1c1c1e; color: #111; }
html.bm-hc .lv-f, html.bm-hc .lv-s, html.bm-hc .mapbtn, html.bm-hc .timings-btn { border: 1.5px solid #1c1c1e !important; color: #111; }
html.bm-hc .lv-n, html.bm-hc .bm-calc, html.bm-hc .csub, html.bm-hc .lv-note, html.bm-hc .tmsg { color: #2b2925 !important; }
html.bm-hc body.bm-dark #panel, html.bm-hc body.bm-dark #card, html.bm-hc body.bm-dark #lv-strip .key, html.bm-hc body.bm-dark #lv-strip .lv-drop,
html.bm-hc body.bm-dark #layer-menu, html.bm-hc body.bm-dark #live-pill { background: #000 !important; color: #fff; border-color: #fff; }
html.bm-hc body.bm-dark { --muted: #d6d4ce; --line: #cfcdc6; }
html.bm-hc body.bm-dark .lv-f, html.bm-hc body.bm-dark .lv-s, html.bm-hc body.bm-dark .mapbtn { border-color: #fff !important; color: #fff; }
/* reduced motion: nothing slides, blinks or bobs */
html.bm-calm *, html.bm-calm *::before, html.bm-calm *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
/* the settings sheet */
.bm-a11y { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.35); display: grid; place-items: end center; }
@media (min-width: 700px) { .bm-a11y { place-items: center; } }
.bm-a11y-box { width: min(440px, 100vw); max-height: min(88vh, 720px); overflow-y: auto; background: #fffdf8; color: #1c1c1e; border-radius: 20px 20px 0 0; padding: 16px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
@media (min-width: 700px) { .bm-a11y-box { border-radius: 20px; } }
.bm-a11y-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.bm-a11y-top h2 { font-size: calc(19px * var(--bm-fs, 1)); margin: 0; }
.bm-a11y-x { border: 0; background: rgba(0,0,0,.06); border-radius: 50%; width: 40px; height: 40px; font-size: 16px; cursor: pointer; color: inherit; }
.bm-a11y-g { border: 0; margin: 12px 0 0; padding: 0; }
.bm-a11y-g legend { font-size: calc(12px * var(--bm-fs, 1)); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #5b574e; padding: 0; margin-bottom: 6px; }
.bm-a11y-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.bm-a11y-opts label { position: relative; }
.bm-a11y-opts input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.bm-a11y-opts span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid #cfc8b8; font-size: calc(14.5px * var(--bm-fs, 1)); font-weight: 600; }
.bm-a11y-opts input:checked + span { background: #1c1c1e; color: #fff; border-color: #1c1c1e; }
.bm-a11y-opts input:focus-visible + span { outline: 2.5px solid #0b57d0; outline-offset: 2px; }
.bm-a11y-note { font-size: calc(13px * var(--bm-fs, 1)); color: #5b574e; margin: 6px 0 0; line-height: 1.4; }
body.bm-dark .bm-a11y-box { background: #1e2026; color: #f2f2f2; }
body.bm-dark .bm-a11y-g legend, body.bm-dark .bm-a11y-note { color: #b5b3ac; }
body.bm-dark .bm-a11y-opts span { border-color: #4a4d55; }
body.bm-dark .bm-a11y-opts input:checked + span { background: #f2f2f2; color: #1c1c1e; border-color: #f2f2f2; }
body.bm-dark .bm-a11y-x { background: rgba(255,255,255,.1); }

/* languages (i18n.js): the round button with the current language's letter, the scripts' fonts, Urdu right to left */
.bm-langbtn { font: 800 calc(15px * var(--bm-fs, 1))/1 "Noto Sans", "Noto Sans Telugu", "Noto Naskh Arabic", system-ui, sans-serif; color: var(--ink, #1c1c1e); }
.bm-langbtn:lang(te) { font-size: calc(14px * var(--bm-fs, 1)); }
.bm-langbtn:lang(ur) { font-size: calc(19px * var(--bm-fs, 1)); padding-bottom: 4px; }
html.bm-te body, html.bm-te button, html.bm-te input { font-family: "Noto Sans", "Noto Sans Telugu", system-ui, -apple-system, sans-serif; }
html.bm-ur body, html.bm-ur button, html.bm-ur input { font-family: "Noto Naskh Arabic", "Noto Sans", system-ui, -apple-system, sans-serif; }
html.bm-ur #q { text-align: right; }
html.bm-ur .lv-n, html.bm-ur .tag, html.bm-ur [translate="no"] { unicode-bidi: isolate; }

/* estimated load on a bus card (rtc.js occFill): five bars, the words, "Estimate" */
.lv-occ:empty { display: none; }
.lv-occ { margin: 2px 0 10px; }
.lv-occ-row { display: flex; align-items: center; gap: 9px; font-size: calc(13.5px * var(--bm-fs, 1)); }
.lv-occ-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.lv-occ-bars i { width: 5px; border-radius: 1.5px; background: #d9d4c8; }
.lv-occ-bars i:nth-child(1) { height: 6px; } .lv-occ-bars i:nth-child(2) { height: 8.5px; } .lv-occ-bars i:nth-child(3) { height: 11px; } .lv-occ-bars i:nth-child(4) { height: 13.5px; } .lv-occ-bars i:nth-child(5) { height: 16px; }
.lv-occ[data-level="0"] .lv-occ-bars i.on, .lv-occ[data-level="1"] .lv-occ-bars i.on { background: #1f9d55; }
.lv-occ[data-level="2"] .lv-occ-bars i.on { background: #d99a00; }
.lv-occ[data-level="3"] .lv-occ-bars i.on, .lv-occ[data-level="4"] .lv-occ-bars i.on { background: #d33a2c; }
.lv-occ-est { font-size: calc(11px * var(--bm-fs, 1)); font-weight: 700; color: var(--muted); border: 1px solid var(--line, #e7e0d2); border-radius: 6px; padding: 1px 6px; }
.lv-occ-src { font-size: calc(11.5px * var(--bm-fs, 1)); color: var(--muted); margin-top: 3px; }
.lv-occ-src a { color: inherit; }
body.bm-dark .lv-occ-bars i { background: #3a3d45; }

/* the card's buttons (close, share, edit): one size, evenly spaced, never over each other or the title; mirrored
   right to left (Urdu) */
#card .cclose { width: 34px; height: 34px; min-width: 0; min-height: 0; top: 10px; }
#card #card-close { right: 10px; }
#card .lv-share { right: 50px; }
#card .lv-editbtn { right: 90px; }
#card .chead { padding-right: 52px; }
#card .chead:has(.lv-share.on) { padding-right: 92px; }
#card .chead:has(.lv-editbtn.on) { padding-right: 132px; }
body.bm-editing #card .chead { padding-right: 52px; }
html[dir="rtl"] #card .cclose { right: auto; }
html[dir="rtl"] #card #card-close { left: 10px; right: auto; }
html[dir="rtl"] #card .lv-share, html[dir="rtl"] #card .lv-editbtn { right: auto; }
html[dir="rtl"] #card .lv-share { left: 50px; }
html[dir="rtl"] #card .lv-editbtn { left: 90px; }
html[dir="rtl"] #card .chead { padding-right: 15px; padding-left: 52px; }
html[dir="rtl"] #card .chead:has(.lv-share.on) { padding-right: 15px; padding-left: 92px; }
html[dir="rtl"] #card .chead:has(.lv-editbtn.on) { padding-right: 15px; padding-left: 132px; }
html[dir="rtl"] #card .chead::after { left: auto; right: 15px; }
html[dir="rtl"] #card-title { text-align: right; }
html[dir="rtl"] #card-title .tag { unicode-bidi: isolate; direction: ltr; }

/* pages with a11y.js (the RTC maps): the location button and, under it, the layers button at the bottom right,
   where the zoom buttons were; the zoom buttons only when Accessibility asks for them; the language button alone
   at the top right; the layers menu opens upward from its button */
html.bm-a11y-on .mapbtns:not(.bm-topright) { top: auto; bottom: calc(44px + env(safe-area-inset-bottom)); }
html.bm-a11y-on .mapbtns:not(.bm-topright) #loc-btn { order: -1; }
html.bm-a11y-on .bm-topright { top: calc(12px + env(safe-area-inset-top)); bottom: auto; }
html.bm-a11y-on #layer-menu { top: auto; bottom: calc(44px + env(safe-area-inset-bottom)); }
html.bm-a11y-on:not(.bm-zoom) .maplibregl-ctrl-group:has(.maplibregl-ctrl-zoom-in) { display: none; }
html.bm-a11y-on.bm-zoom .mapbtns:not(.bm-topright) { bottom: calc(118px + env(safe-area-inset-bottom)); }
html.bm-a11y-on.bm-zoom #layer-menu { bottom: calc(118px + env(safe-area-inset-bottom)); }
html[dir="rtl"].bm-a11y-on .mapbtns { right: calc(12px + env(safe-area-inset-right)); left: auto; }

/* a phone with the card folded at the bottom: the map buttons stand above it, not on it */
@media (max-width: 699px) {
  html.bm-a11y-on body:has(#card.open.min) .mapbtns:not(.bm-topright) { bottom: calc(var(--bm-card-min, 112px) + 14px + env(safe-area-inset-bottom)); }
  html.bm-a11y-on body:has(#card.open.min.lv-hasnext) .mapbtns:not(.bm-topright) { --bm-card-min: 124px; }
}

/* place names written in Telugu or Urdu over the map, where the map placed their (hidden) English labels (i18n.js) */
#bm-maplabels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.bm-mlabel { position: absolute; left: 0; top: 0; white-space: nowrap; color: #1c1c1e; line-height: 1.15;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff, 0 0 4px rgba(255,255,255,.9); will-change: transform; }
.bm-mlabel:lang(te) { font-family: "Noto Sans Telugu", "Noto Sans", system-ui, sans-serif; }
.bm-mlabel:lang(ur) { font-family: "Noto Naskh Arabic", "Noto Sans", system-ui, sans-serif; direction: rtl; }
body.bm-dark .bm-mlabel { color: #e9e7e1; text-shadow: 0 0 2px #111, 0 0 2px #111, 0 0 3px #111, 0 0 4px rgba(0,0,0,.9); }

/* one search box: the journey planner is reached from it ("Koti to Hitech City"), not from a button of its own */
html.bm-a11y-on #jp-btn { display: none; }

/* route editor drawing tools (editor.js): a toolbar over the map while editing, the pen's points as dots */
.bm-tools { position: fixed; z-index: 640; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 4px; padding: 5px; border-radius: 14px; background: rgba(255,253,248,.97); box-shadow: 0 4px 18px rgba(0,0,0,.2); max-width: calc(100vw - 24px); }
.bm-tools button { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: calc(13px * var(--bm-fs, 1)); font-weight: 700; color: #3d3a33; cursor: pointer; }
.bm-tools button[aria-pressed="true"] { background: var(--red, #f01b48); color: #fff; }
.bm-tools button:disabled { opacity: .4; cursor: default; }
.bm-toolhint { flex-basis: 100%; text-align: center; font-size: calc(12px * var(--bm-fs, 1)); color: #6b665c; min-height: 0; }
.bm-toolhint:empty { display: none; }
@media (max-width: 699px) { .bm-tools button span { display: none; } .bm-tools button { padding: 0 11px; } .bm-toolhint { display: block; } .bm-toolhint:empty { display: none; } }
.bm-dot { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 3px solid var(--red, #f01b48); box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: grab; }
body.bm-tool-erase .bm-dot { border-color: #1c1c1e; cursor: pointer; }
body.bm-tool-pen .maplibregl-canvas { cursor: crosshair; }
body.bm-tool-erase .maplibregl-canvas { cursor: cell; }
body.bm-dark .bm-tools { background: rgba(30,32,38,.97); }
body.bm-dark .bm-tools button { color: #e9e7e1; }

/* the stop / terminus editor (editor.js openStop): the routes that stop here, as chips to remove or put back */
.bm-rts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.bm-rt { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: calc(13px * var(--bm-fs, 1)); font-weight: 700; padding: 5px 9px; border-radius: 8px; border: 1px solid rgba(127,127,127,.35); background: rgba(127,127,127,.12); color: inherit; cursor: pointer; }
.bm-rt span { opacity: .55; font-weight: 600; }
.bm-rt:hover span, .bm-rt:focus-visible span { opacity: 1; }
.bm-rt.gone { text-decoration: line-through; opacity: .55; }
.bm-rt.new { border-color: var(--red, #f01b48); color: var(--red, #f01b48); }
.bm-addrt { display: flex; gap: 6px; }
.bm-addrt input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(127,127,127,.35); background: rgba(127,127,127,.08); color: inherit; }
.bm-stoppin b { width: 26px; height: 26px; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
body.bm-editing-stop .maplibregl-canvas { cursor: crosshair; }
.lv-link { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* ── Multimodal Journey Planner UI (Phase 4) ── */
.panel-tabs { display: flex; gap: 6px; margin: 8px 0 10px; background: rgba(0,0,0,.05); padding: 3px; border-radius: 9px; }
.ptab { flex: 1; border: none; background: transparent; padding: 6px 12px; font-size: calc(13px * var(--bm-fs, 1)); font-weight: 600; color: var(--muted); border-radius: 7px; cursor: pointer; transition: all .15s ease; }
.ptab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.ptab:hover:not(.active) { color: var(--ink); }

.plan-inputs { display: flex; flex-direction: column; gap: 8px; position: relative; }
.plan-field { position: relative; display: flex; align-items: center; }
.plan-field input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 30px 0 32px; font-size: calc(13px * var(--bm-fs, 1)); background: #fff; outline: none; color: var(--ink); }
.plan-field input:focus { border-color: var(--red); }
.plan-field .dot-from { position: absolute; left: 11px; width: 10px; height: 10px; border-radius: 50%; background: #16a34a; }
.plan-field .dot-to { position: absolute; left: 11px; width: 10px; height: 10px; border-radius: 50%; background: #f01b48; }
.plan-field .field-clear { position: absolute; right: 8px; background: none; border: none; font-size: 16px; color: var(--muted); cursor: pointer; padding: 0 4px; }

.plan-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mode-chips { display: flex; gap: 6px; }
.mchip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; }
.mchip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.plan-btn { width: 100%; height: 38px; background: var(--red); color: #fff; border: none; border-radius: 9px; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: opacity .15s ease; }
.plan-btn:hover { opacity: .9; }
.plan-btn:active { transform: scale(.99); }

#plan-results { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; padding-bottom: 20px; }
.itin-card { padding: 12px 14px; border-top: 1px solid var(--line); cursor: pointer; transition: background .15s ease; }
.itin-card:hover { background: rgba(0,0,0,.035); }
.itin-card.selected { background: rgba(37,99,235,.08); border-left: 3px solid var(--red); }
.itin-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.itin-dur { font-size: 17px; font-weight: 800; color: var(--ink); }
.itin-times { font-size: 12px; color: var(--muted); font-weight: 600; }
.itin-legs { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 6px; }
.leg-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 700; color: #fff; }
.leg-arrow { color: var(--muted); font-size: 11px; }
.itin-bottom { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); }
.itin-meta-pill { display: inline-flex; align-items: center; gap: 4px; }
.plan-autocomplete { position: absolute; top: 40px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.15); z-index: 100; max-height: 200px; overflow-y: auto; }
.plan-ac-item { padding: 8px 12px; cursor: pointer; font-size: 12.5px; border-bottom: 0.5px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.plan-ac-item:hover { background: rgba(0,0,0,.04); }
.plan-ac-agency { font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 4px; }
.plan-ac-agency.BMTC { background: #dbeafe; color: #1e40af; }
.plan-ac-agency.BMRCL { background: #fce7f3; color: #831843; }
.journey-step { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.4; }
.journey-step-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.journey-step-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.itin-rank-bar { display: flex; gap: 6px; padding: 10px 14px 6px; background: #fff; border-bottom: 1px solid var(--line); }
.rank-btn { flex: 1; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; font-size: 11px; font-weight: 700; color: var(--muted); cursor: pointer; transition: all .15s ease; text-align: center; }
.rank-btn:hover { background: #f1f5f9; color: var(--ink); }
.rank-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; box-shadow: 0 1px 3px rgba(37,99,235,.25); }
.itin-rank-tag { display: inline-flex; align-items: center; padding: 1.5px 6px; border-radius: 4px; font-size: 9.5px; font-weight: 800; background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; margin-left: 6px; letter-spacing: 0.02em; }
.honesty-notice { font-size: 11px; color: var(--muted); background: rgba(0,0,0,.03); padding: 6px 10px; border-radius: 6px; margin: 10px 0; }
.honesty-notice.live-notice { background: rgba(22,163,74,.08); color: #15803d; border-left: 3px solid #16a34a; }
.itin-rt-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 800; letter-spacing: 0.02em; }
.itin-rt-pill.live { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.itin-rt-pill.mixed { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.itin-rt-pill.stale { background: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
.itin-rt-pill.sched { background: #f1f5f9; color: #64748b; }
.conf-pill.conf-exact_trip { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.conf-pill.conf-route_candidate { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.conf-pill.conf-unmatched { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.badge-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 4px #22c55e; }
.journey-live-status { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 10px; background: rgba(22,163,74,.08); border: 1px solid rgba(22,163,74,.2); border-radius: 6px; font-size: 11.5px; }
.journey-live-status .live-pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,.5); animation: livePulse 1.8s infinite; flex-shrink: 0; }
.journey-live-status .live-delay-tag { font-weight: 700; padding: 1.5px 5px; border-radius: 4px; font-size: 10.5px; }
.journey-live-status .live-delay-tag.delayed { background: #fee2e2; color: #b91c1c; }
.journey-live-status .live-delay-tag.ontime { background: #dcfce7; color: #15803d; }
.journey-live-status .live-speed { margin-left: auto; color: var(--muted); font-size: 11px; }
.journey-sched-status { margin-top: 5px; padding: 4px 8px; background: rgba(0,0,0,.025); border-radius: 5px; font-size: 11px; color: var(--muted); }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 6px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }

/* ── Phase 4.5: Vehicle Freshness, Progress & Direction Tabs ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; vertical-align: middle; }
.badge.live { background: #16a34a; color: #fff; box-shadow: 0 0 0 1px rgba(22,163,74,.25); }
.badge.stale { background: #d97706; color: #fff; box-shadow: 0 0 0 1px rgba(217,119,6,.25); }
.t-live { color: #16a34a !important; font-weight: 700; }
.t-stale { color: #d97706 !important; font-weight: 700; }

#live-pill.stale { background: #fef3c7; color: #92400e; border-color: #fde68a; }
#live-pill.stale .dot { background: #d97706; }

.lv-pos { font-size: 11.5px; color: var(--muted); margin: 6px 0 10px; line-height: 1.4; padding: 4px 8px; background: rgba(0,0,0,.03); border-radius: 6px; }
.lv-pos b { color: var(--ink); }

.dir-tabs { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 10px 0 8px; background: #fff; }
.dir-tab { flex: 1; padding: 7px 10px; border: none; background: none; font-size: 11.5px; font-weight: 700; color: var(--muted); cursor: pointer; text-align: center; transition: all .15s ease; }
.dir-tab:hover { background: rgba(0,0,0,.03); color: var(--ink); }
.dir-tab.active { background: var(--ink); color: #fff; }

.stop-passed { opacity: 0.55; text-decoration: line-through var(--muted); }
.stop-current { font-weight: 800; color: var(--red); }
.stop-current::before { content: '● '; color: var(--red); }

/* ── Phase 4.6: Vehicle Classification & 3D Interactive Models ── */
.lv-catline { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.cat-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2.5px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.01em; }
.conf-pill { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; }
.conf-pill.conf-high { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.conf-pill.conf-medium { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.conf-pill.conf-low, .conf-pill.conf-unknown { background: #f3f4f6; color: #4b5563; border: 1px solid #e5e7eb; }

#lv-hero { width: 100%; height: 210px; background: #f6f8fa; border-radius: 10px; overflow: hidden; position: relative; margin-bottom: 12px; border: 1px solid rgba(0,0,0,0.06); }
#lv-hero canvas { display: block; width: 100% !important; height: 100% !important; outline: none; }

.lv-unclassified-banner { display: flex; align-items: flex-start; gap: 8px; font-size: 11px; line-height: 1.4; color: #854d0e; background: #fefce8; border: 1px solid #fef08a; padding: 8px 10px; border-radius: 6px; margin: 8px 0 12px; }
.lv-unclassified-banner svg { flex-shrink: 0; margin-top: 2px; color: #ca8a04; }

.cnt-live { color: #16a34a; font-weight: 800; }
.cnt-sep { color: #94a3b8; font-weight: 400; margin: 0 1.5px; }
.cnt-stale { color: #d97706; font-weight: 600; }

/* ── Namma AI Intelligence Dashboard & Vehicle Audit Styles (Phase 3.2 Redesign) ── */
body.ai-tab-active #panel {
  width: 440px;
  max-width: calc(100vw - 84px);
}
@media (max-width: 699px) {
  body.ai-tab-active #panel {
    width: 100%;
    max-width: 100%;
  }
}

#ai-fab { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, #0ea5e9, #4f46e5);
  color: #fff; display: grid; place-items: center; border: 0; padding: 0; cursor: pointer;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35); text-decoration: none;
  transition: transform .16s ease, background .18s ease; }
#ai-fab:active { transform: scale(.92); }
body.ai-open #ai-fab { background: #38bdf8; color: #0f172a; }

.ai-badge-count { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 5px; font-size: 10px; font-weight: 800; border-radius: 999px; background: #ef4444; color: #fff; margin-left: 4px; }

#ai-view {
  background: #0b0f19;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 16px 36px rgba(0,0,0,0.45);
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-subtabs { display: flex; gap: 4px; padding: 3px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; margin-bottom: 2px; }
.ai-stab { flex: 1; border: none; background: transparent; padding: 7px 5px; font-size: 11px; font-weight: 700; color: #94a3b8; border-radius: 7px; cursor: pointer; transition: all .15s ease; text-align: center; white-space: nowrap; }
.ai-stab:hover:not(.active) { color: #f8fafc; background: rgba(255,255,255,0.04); }
.ai-stab.active { background: #1e293b; color: #38bdf8; border: 1px solid rgba(56,189,248,0.25); box-shadow: 0 2px 8px rgba(0,0,0,0.35); }

#ai-content { display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 215px); overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
#ai-content::-webkit-scrollbar { width: 5px; }
#ai-content::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 4px; }
#ai-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 4px; }

/* Dashboard Metrics Grid (6 cards) */
.ai-grid-6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
@media (max-width: 440px) {
  .ai-grid-6 { grid-template-columns: repeat(2, 1fr); }
}
.ai-stat-card { background: rgba(30, 41, 59, 0.65); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 10px; padding: 9px 10px; display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; backdrop-filter: blur(8px); }
.ai-stat-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: #64748b; }
.ai-stat-card.card-cyan::before { background: #38bdf8; }
.ai-stat-card.card-green::before { background: #4ade80; }
.ai-stat-card.card-amber::before { background: #fbbf24; }
.ai-stat-card.card-blue::before { background: #60a5fa; }
.ai-stat-card.card-slate::before { background: #94a3b8; }
.ai-stat-card.card-purple::before { background: #c084fc; }

.ai-stat-num { font-size: 19px; font-weight: 800; color: #f8fafc; line-height: 1.15; font-feature-settings: 'tnum'; }
.ai-stat-lbl { font-size: 9px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }
.ai-stat-sub { font-size: 10px; color: #64748b; margin-top: 1px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Category distribution bars */
.ai-cat-card { background: rgba(30, 41, 59, 0.55); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 12px; padding: 12px 13px; display: flex; flex-direction: column; gap: 8px; }
.ai-card-title { font-size: 12px; font-weight: 700; color: #f8fafc; display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.ai-cat-row { display: flex; align-items: center; gap: 8px; font-size: 11px; padding: 2px 0; }
.ai-cat-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.ai-cat-name { width: 120px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #cbd5e1; }
.ai-cat-bar-bg { flex: 1; height: 6px; background: rgba(255, 255, 255, 0.06); border-radius: 999px; overflow: hidden; }
.ai-cat-bar-fill { height: 100%; border-radius: 999px; transition: width .3s ease; }
.ai-cat-count { width: 48px; text-align: right; font-weight: 700; font-size: 10.5px; color: #94a3b8; font-feature-settings: 'tnum'; }

/* Review Queue List */
.ai-review-item { background: rgba(30, 41, 59, 0.7); border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.ai-review-top { display: flex; justify-content: space-between; align-items: center; }
.ai-review-reg { font-size: 13.5px; font-weight: 800; color: #f8fafc; letter-spacing: 0.03em; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ai-review-badge { font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; }
.ai-badge-warn { background: rgba(251, 191, 36, 0.15); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.ai-badge-err { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.ai-badge-ok { background: rgba(74, 222, 128, 0.15); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.ai-badge-live { background: rgba(74, 222, 128, 0.15); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.ai-badge-stale { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.ai-review-reason { font-size: 11px; color: #cbd5e1; line-height: 1.45; background: rgba(15, 23, 42, 0.6); padding: 7px 9px; border-radius: 6px; border-left: 2.5px solid #38bdf8; }
.ai-review-actions { display: flex; gap: 6px; margin-top: 3px; }

.ai-btn-sm { flex: 1; padding: 7px 10px; border-radius: 7px; font-size: 11.5px; font-weight: 700; border: none; cursor: pointer; transition: all .15s ease; display: inline-flex; align-items: center; justify-content: center; gap: 5px; text-align: center; }
.ai-btn-approve { background: #16a34a; color: #fff; box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25); }
.ai-btn-approve:hover { background: #15803d; }
.ai-btn-reject { background: rgba(255, 255, 255, 0.07); color: #94a3b8; border: 1px solid rgba(255, 255, 255, 0.12); }
.ai-btn-reject:hover { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.ai-btn-inspect { background: #2563eb; color: #fff; box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25); }
.ai-btn-inspect:hover { background: #1d4ed8; }

/* Audit Trail */
.ai-audit-item { background: rgba(30, 41, 59, 0.55); border: 1px solid rgba(255, 255, 255, 0.07); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; font-size: 11.5px; color: #e2e8f0; }
.ai-audit-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-weight: 700; }
.ai-audit-action { padding: 2px 6px; border-radius: 4px; font-size: 9.5px; text-transform: uppercase; font-weight: 800; }
.action-approve { background: rgba(74, 222, 128, 0.15); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.action-reject { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.action-ai { background: rgba(192, 132, 252, 0.15); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.3); }
.ai-audit-detail { color: #94a3b8; font-size: 11px; margin-top: 2px; }

/* Vehicle Detail Card Intelligence Section */
.lv-ai-box { margin-top: 10px; padding: 13px; background: linear-gradient(180deg, #0f172a, #0b0f19); border: 1px solid rgba(255,255,255,0.12); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; color: #f1f5f9; box-shadow: 0 4px 14px rgba(0,0,0,0.3); }
.lv-ai-head { display: flex; justify-content: space-between; align-items: center; }
.lv-ai-title { font-size: 12px; font-weight: 800; color: #38bdf8; display: flex; align-items: center; gap: 6px; }
.lv-ai-rto { font-size: 11px; color: #94a3b8; font-weight: 600; }
.lv-ai-evidence { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.lv-ai-ev-item { font-size: 11px; color: #cbd5e1; line-height: 1.35; display: flex; align-items: flex-start; gap: 6px; }
.lv-ai-ev-item svg { flex-shrink: 0; margin-top: 2px; color: #38bdf8; }
.lv-ai-confbar { height: 5px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; margin: 4px 0; }
.lv-ai-confbar-fill { height: 100%; border-radius: 999px; background: #16a34a; transition: width .3s ease; }
.lv-ai-btn { width: 100%; padding: 9px 12px; border: none; border-radius: 8px; background: linear-gradient(135deg, #4f46e5, #0ea5e9); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25); transition: opacity .15s ease, transform .15s ease; }
.lv-ai-btn:hover:not(:disabled) { opacity: 0.94; transform: translateY(-1px); }
.lv-ai-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.lv-ai-result { background: rgba(30, 41, 59, 0.8); border: 1px solid rgba(56, 189, 248, 0.35); border-radius: 8px; padding: 11px; margin-top: 6px; font-size: 11.5px; }
.lv-ai-result-hdr { font-weight: 800; color: #38bdf8; margin-bottom: 4px; display: flex; justify-content: space-between; }
.lv-ai-result-body { color: #cbd5e1; line-height: 1.45; }

/* Modal overlay */
.ai-modal-scrim { position: fixed; inset: 0; z-index: 99999; background: rgba(0,0,0,0.7); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ai-modal { background: #0f172a; border-radius: 16px; width: 100%; max-width: 410px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6); padding: 22px; display: flex; flex-direction: column; gap: 13px; border: 1px solid rgba(255,255,255,0.15); color: #f8fafc; }
.ai-modal-h { font-size: 16px; font-weight: 800; color: #f8fafc; margin: 0; }
.ai-modal-desc { font-size: 12px; color: #94a3b8; line-height: 1.45; margin: 0; }
.ai-select, .ai-input { width: 100%; height: 38px; border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; padding: 0 10px; font-size: 12.5px; color: #f8fafc; outline: none; background: #1e293b; }
.ai-textarea { width: 100%; min-height: 65px; border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: #f8fafc; outline: none; resize: none; font-family: inherit; background: #1e293b; }
.ai-modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }


