/* ============================================================
   TankTracker
   Monochrome light. One accent. Glass through depth, not hue.

   There is deliberately no coloured wash behind the page. In a
   monochrome theme translucency reads through layering — a soft
   ground, panes a shade apart from it, a bright rim and a shadow.

   Dark is defined twice on purpose: once behind prefers-color-scheme
   for people on "System", and once behind [data-theme="dark"] for a
   deliberate choice. The media query is guarded so an explicit
   "Light" wins over a dark device.
   ============================================================ */

:root {
  color-scheme: light dark;

  /* ---- ground & panes ---- */
  --ground:      #f2f2f4;
  --ground-2:    #e9e9ec;
  --pane:        rgba(255, 255, 255, 0.72);
  --pane-strong: rgba(255, 255, 255, 0.88);
  --pane-solid:  #ffffff;
  --rim:         rgba(255, 255, 255, 0.90);
  --hairline:    rgba(0, 0, 0, 0.08);
  --hairline-2:  rgba(0, 0, 0, 0.14);
  --blur:        saturate(140%) blur(20px);

  /* ---- ink ---- */
  --ink:    #1d1d1f;
  --ink-2:  #55555a;
  --ink-3:  #86868b;   /* meta only, never body copy */

  /* ---- the one accent ---- */
  --accent:      #0071e3;
  --accent-ink:  #0058b0;   /* accent as small text, AA on white */
  --accent-wash: rgba(0, 113, 227, 0.10);
  --accent-rim:  rgba(0, 113, 227, 0.28);

  /* ---- reserved status ramp ----
     Not brand colour: cheap/typical/steep is semantic, the same
     licence an error has to be red. Muted to sit against grey. */
  --cheap:   #1c7a4d;  --cheap-2:   #35a86d;  --cheap-wash:   rgba(28,122,77,.10);
  --typical: #8a6413;  --typical-2: #bb8c28;  --typical-wash: rgba(138,100,19,.10);
  --steep:   #a3342b;  --steep-2:   #cc6259;  --steep-wash:   rgba(163,52,43,.10);
  --none:    #9a9aa0;  --none-2:    #b4b4b9;  --none-wash:    rgba(0,0,0,.05);

  --danger: #c0392f;

  /* ---- geometry ---- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;
  --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.05);
  --shadow-2: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px -12px rgba(0,0,0,.18);
  --shadow-3: 0 2px 6px rgba(0,0,0,.07), 0 28px 56px -20px rgba(0,0,0,.30);
  /* the bright top edge that makes a pane read as glass */
  --gloss: inset 0 1px 0 var(--rim), inset 0 0 0 1px var(--hairline);

  /* ---- rhythm ---- */
  --gutter: 20px;
  --rail: 64px;
  --content: 1200px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
}


/* ============================================================
   dark
   In dark, glass stops being "white, less opaque". A pane lifts by
   being lighter than the ground, the rim is a faint highlight rather
   than white, and shadows do most of the separation.
   ============================================================ */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground:      #101114;
    --ground-2:    #191b1f;
    --pane:        rgba(38, 41, 47, 0.72);
    --pane-strong: rgba(44, 48, 55, 0.88);
    --pane-solid:  #22252a;
    --rim:         rgba(255, 255, 255, 0.10);
    --hairline:    rgba(255, 255, 255, 0.10);
    --hairline-2:  rgba(255, 255, 255, 0.18);

    --ink:    #f2f3f5;
    --ink-2:  #b6bac1;
    --ink-3:  #8b9098;

    --accent:      #4da3ff;
    --accent-ink:  #7cbcff;
    --accent-wash: rgba(77, 163, 255, 0.16);
    --accent-rim:  rgba(77, 163, 255, 0.34);

    --cheap:   #4ecb87;  --cheap-2:   #8fe3b4;  --cheap-wash:   rgba(78,203,135,.14);
    --typical: #e0b055;  --typical-2: #f0cf92;  --typical-wash: rgba(224,176,85,.14);
    --steep:   #f4776c;  --steep-2:   #f9a49b;  --steep-wash:   rgba(244,119,108,.14);
    --none:    #7c828b;  --none-2:    #969ca4;  --none-wash:    rgba(255,255,255,.06);

    --danger: #f4776c;

    --shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --shadow-2: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.8);
    --shadow-3: 0 2px 8px rgba(0,0,0,.5), 0 30px 60px -22px rgba(0,0,0,.95);
  }
}

:root[data-theme="dark"] {
  --ground:      #101114;
  --ground-2:    #191b1f;
  --pane:        rgba(38, 41, 47, 0.72);
  --pane-strong: rgba(44, 48, 55, 0.88);
  --pane-solid:  #22252a;
  --rim:         rgba(255, 255, 255, 0.10);
  --hairline:    rgba(255, 255, 255, 0.10);
  --hairline-2:  rgba(255, 255, 255, 0.18);

  --ink:    #f2f3f5;
  --ink-2:  #b6bac1;
  --ink-3:  #8b9098;

  --accent:      #4da3ff;
  --accent-ink:  #7cbcff;
  --accent-wash: rgba(77, 163, 255, 0.16);
  --accent-rim:  rgba(77, 163, 255, 0.34);

  --cheap:   #4ecb87;  --cheap-2:   #8fe3b4;  --cheap-wash:   rgba(78,203,135,.14);
  --typical: #e0b055;  --typical-2: #f0cf92;  --typical-wash: rgba(224,176,85,.14);
  --steep:   #f4776c;  --steep-2:   #f9a49b;  --steep-wash:   rgba(244,119,108,.14);
  --none:    #7c828b;  --none-2:    #969ca4;  --none-wash:    rgba(255,255,255,.06);

  --danger: #f4776c;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.8);
  --shadow-3: 0 2px 8px rgba(0,0,0,.5), 0 30px 60px -22px rgba(0,0,0,.95);
}

/* A few places assume a light ground and need nudging in dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .segmented,
  :root:not([data-theme="light"]) .place-bar,
  :root:not([data-theme="light"]) .grade { background: rgba(255,255,255,.08); }
  :root:not([data-theme="light"]) .rail-nav a:hover,
  :root:not([data-theme="light"]) .icon-btn:hover { background: rgba(255,255,255,.07); }
  :root:not([data-theme="light"]) .btn-quiet:hover { background: #2a2e34; }
  :root:not([data-theme="light"]) .leaflet-popup-content-wrapper,
  :root:not([data-theme="light"]) .leaflet-popup-tip { background: #22252a; color: #f2f3f5; }
  :root:not([data-theme="light"]) .pop span { color: #b6bac1; }
}
:root[data-theme="dark"] .segmented,
:root[data-theme="dark"] .place-bar,
:root[data-theme="dark"] .grade { background: rgba(255,255,255,.08); }
:root[data-theme="dark"] .rail-nav a:hover,
:root[data-theme="dark"] .icon-btn:hover { background: rgba(255,255,255,.07); }
:root[data-theme="dark"] .btn-quiet:hover { background: #2a2e34; }
:root[data-theme="dark"] .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .leaflet-popup-tip { background: #22252a; color: #f2f3f5; }
:root[data-theme="dark"] .pop span { color: #b6bac1; }

/* ============================================================
   base
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Numbers must not jitter as they change. */
.num, .figure-value, .record-value, .league-price, .fill-money, .sheet-value,
table td { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 1.75rem; letter-spacing: -0.03em; }
h2 { font-size: 1.0625rem; }
h3 { font-size: 0.9375rem; }
p { margin: 0; }

.eyebrow {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-3);
}
.meta { font-size: 0.8125rem; color: var(--ink-3); }
.sub  { font-size: 0.875rem; color: var(--ink-2); }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs);
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--pane-solid); color: var(--ink);
  padding: .75rem 1rem; border-radius: 0 0 var(--r-sm) 0; box-shadow: var(--shadow-2);
}
.skip:focus { left: 0; }

.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
      overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ============================================================
   shell — rail (desktop) / icon strip (tablet) / tabs (phone)
   ============================================================ */

.shell { min-height: 100vh; }

.rail {
  position: fixed; inset-block: 0; inset-inline-start: 0;
  width: var(--rail); z-index: 60;
  display: none; flex-direction: column; gap: 2px;
  padding: 18px 10px 14px;
  background: var(--pane);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-inline-end: 1px solid var(--hairline);
}
.rail-brand {
  display: flex; align-items: center; gap: .6rem; justify-content: center;
  padding-bottom: 18px; color: var(--ink); font-weight: 600; letter-spacing: -.02em;
}
.rail-brand:hover { text-decoration: none; }
.logo { width: 26px; height: 26px; color: var(--accent); flex: none; }
.rail-brand .label { display: none; }

.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.rail-nav a {
  display: flex; align-items: center; gap: .7rem; justify-content: center;
  min-height: 44px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: .9375rem; font-weight: 500;
}
.rail-nav a:hover { background: rgba(0,0,0,.04); color: var(--ink); text-decoration: none; }
.rail-nav a[aria-current="page"] {
  background: var(--accent-wash); color: var(--accent-ink); font-weight: 600;
}
.rail-nav .ico { width: 20px; text-align: center; font-size: 1.05rem; flex: none; }
.rail-nav .label { display: none; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.rail-foot .label { display: none; }

@media (min-width: 640px) { .rail { display: flex; } .shell { padding-inline-start: var(--rail); } }

@media (min-width: 1024px) {
  :root { --rail: 232px; --gutter: 32px; }
  .rail { padding-inline: 12px; }
  .rail-brand { justify-content: flex-start; padding-inline: 10px; }
  .rail-brand .label,
  .rail-nav .label,
  .rail-foot .label { display: inline; }
  .rail-nav a { justify-content: flex-start; padding: 0 10px; }
}

/* phone: floating tab bar */
.tabs {
  position: fixed; inset-inline: 10px; bottom: 10px; z-index: 60;
  display: flex; justify-content: space-around;
  padding: 4px;
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
  border-radius: var(--r-lg);
  background: var(--pane-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: var(--gloss), var(--shadow-3);
}
.tabs a {
  flex: 1; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; font-size: .625rem; font-weight: 500; color: var(--ink-3);
  border-radius: var(--r-sm);
}
.tabs a:hover { text-decoration: none; }
.tabs .ico { font-size: 1.15rem; line-height: 1; }
.tabs a[aria-current="page"] { color: var(--accent-ink); }
.tabs a.primary .ico {
  background: var(--accent); color: #fff; border-radius: var(--r-full);
  width: 30px; height: 30px; display: grid; place-items: center;
  font-size: 1rem; margin-top: -3px;
}
@media (min-width: 640px) { .tabs { display: none; } }

/* ============================================================
   page header + content column
   ============================================================ */

.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ground) 82%, transparent);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hairline);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: var(--content); margin-inline: auto;
  padding: 12px var(--gutter);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.topbar h1 { font-size: 1.25rem; }
.topbar .spacer { margin-inline-start: auto; }

.page { max-width: var(--content); margin-inline: auto;
        padding: var(--gutter) var(--gutter) 96px; }
@media (min-width: 640px) { .page { padding-bottom: 48px; } }

.stack-lg > * + * { margin-top: 20px; }

/* ============================================================
   pane
   ============================================================ */

.pane {
  background: var(--pane);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-radius: var(--r);
  box-shadow: var(--gloss), var(--shadow-2);
}
.pane-pad { padding: 20px; }
.pane > header { display: flex; align-items: baseline; justify-content: space-between;
                 gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* ============================================================
   asymmetric grid — deliberately not 6/6
   ============================================================ */

.grid { display: grid; gap: 20px; grid-template-columns: repeat(12, 1fr); }
.grid > * { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .col-4 { grid-column: span 4; }
  .col-5 { grid-column: span 5; }
  .col-7 { grid-column: span 7; }
  .col-8 { grid-column: span 8; }
}

/* ============================================================
   hero figures
   ============================================================ */

.figures { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 900px) { .figures { grid-template-columns: repeat(4, 1fr); } }

.figure {
  position: relative; display: flex; flex-direction: column; gap: 2px;
  min-height: 108px; width: 100%; padding: 16px 18px;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--pane);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: none; border-radius: var(--r);
  box-shadow: var(--gloss), var(--shadow-1);
  transition: box-shadow .18s ease, transform .18s ease;
}
.figure:hover { box-shadow: var(--gloss), var(--shadow-2); transform: translateY(-1px); }
.figure:active { transform: none; }
.figure-value { font-size: 1.75rem; font-weight: 600; letter-spacing: -.03em;
                line-height: 1.15; margin-top: 2px; }
.figure-value .unit { font-size: .8125rem; font-weight: 500; color: var(--ink-3);
                      letter-spacing: 0; margin-inline-start: 2px; }
.figure-sub { font-size: .8125rem; color: var(--ink-3); margin-top: auto; }
.figure-go { position: absolute; top: 14px; inset-inline-end: 14px;
             color: var(--ink-3); font-size: .75rem; opacity: 0; transition: opacity .18s; }
.figure:hover .figure-go, .figure:focus-visible .figure-go { opacity: 1; }

/* ============================================================
   charts
   ============================================================ */

.chart { position: relative; height: 240px; }
@media (min-width: 900px) { .chart { height: 260px; } }
.chart-note { font-size: .8125rem; color: var(--ink-3); margin-top: 14px; }

details.data { margin-top: 12px; }
details.data > summary {
  font-size: .8125rem; color: var(--ink-3); cursor: pointer; list-style: none;
  display: inline-flex; align-items: center; gap: .3rem; min-height: 32px;
}
details.data > summary::-webkit-details-marker { display: none; }
details.data > summary::before { content: "\203A"; display: inline-block; transition: transform .15s; }
details.data[open] > summary::before { transform: rotate(90deg); }
details.data .scroll { max-height: 260px; overflow: auto; margin-top: 8px; }
details.data table { font-size: .8125rem; }

/* ============================================================
   status ramp
   ============================================================ */

.b-cheap     { --band: var(--cheap);   --band-2: var(--cheap-2);   --band-wash: var(--cheap-wash); }
.b-typical   { --band: var(--typical); --band-2: var(--typical-2); --band-wash: var(--typical-wash); }
.b-expensive { --band: var(--steep);   --band-2: var(--steep-2);   --band-wash: var(--steep-wash); }
.b-unknown   { --band: var(--none);    --band-2: var(--none-2);    --band-wash: var(--none-wash); }

.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: 2px 8px; border-radius: var(--r-full);
  background: var(--band-wash); color: var(--band);
  font-size: .6875rem; font-weight: 600; white-space: nowrap;
}
.chip .glyph { font-size: .625rem; line-height: 1; }
.chip .delta { font-weight: 500; opacity: .8; font-variant-numeric: tabular-nums; }

@keyframes flow { from { transform: translate3d(0,0,0); } to { transform: translate3d(0,-50%,0); } }
.rail-band {
  position: relative; overflow: hidden; isolation: isolate;
  width: 3px; border-radius: var(--r-full); align-self: stretch;
  min-height: 2.2rem; background: var(--band);
}
.rail-band::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 200%;
  background: linear-gradient(180deg, var(--band) 0%, var(--band-2) 25%,
              var(--band) 50%, var(--band-2) 75%, var(--band) 100%);
}
.is-live::before { animation: flow 9s linear infinite; }

/* ============================================================
   station league
   ============================================================ */

.league { list-style: none; margin: 0; padding: 0; }
.league li {
  display: grid; align-items: center; gap: 6px 14px;
  grid-template-columns: 3px 1fr auto;
  grid-template-areas: "bar name price" "bar chip price";
  padding: 12px 0; border-top: 1px solid var(--hairline);
}
.league li:first-child { border-top: none; padding-top: 0; }
.league .rail-band { grid-area: bar; }
.league-name { grid-area: name; min-width: 0; }
.league-name strong { display: block; font-weight: 600; font-size: .9375rem; }
.league li .chip { grid-area: chip; justify-self: start; }
.league-price { grid-area: price; text-align: right; font-weight: 600; }
.league-price .unit { color: var(--ink-3); font-weight: 500; font-size: .75rem; }
@media (min-width: 560px) {
  .league li { grid-template-columns: 3px 1fr auto auto;
               grid-template-areas: "bar name chip price"; }
  .league li .chip { justify-self: end; }
}

/* ============================================================
   fill-up list — editorial, not tabular
   ============================================================ */

.fills { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fill {
  display: grid; align-items: center; gap: 6px 16px;
  grid-template-columns: 52px 1fr auto;
  grid-template-areas: "date main money" "date chip money";
  padding: 14px 16px;
  background: var(--pane);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-radius: var(--r); box-shadow: var(--gloss), var(--shadow-1);
}
.fill-date { grid-area: date; text-align: center; line-height: 1.15;
             padding-inline-end: 14px; border-inline-end: 1px solid var(--hairline); }
.fill-date .d { display: block; font-size: 1.125rem; font-weight: 600; letter-spacing: -.02em; }
.fill-date .m { display: block; font-size: .6875rem; color: var(--ink-3);
                text-transform: uppercase; letter-spacing: .05em; }
.fill-main { grid-area: main; min-width: 0; }
.fill-main strong { display: block; font-weight: 600; font-size: .9375rem;
                    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fill .chip { grid-area: chip; justify-self: start; }
.fill-money { grid-area: money; text-align: right; }
.fill-money .amount { display: block; font-weight: 600; }
.fill-money .per { font-size: .8125rem; color: var(--ink-3); }
.fill-act { grid-area: act; justify-self: end; }
@media (min-width: 700px) {
  .fill { grid-template-columns: 52px 1fr auto auto 32px;
          grid-template-areas: "date main chip money act"; }
  .fill .chip { justify-self: end; }
}

/* ============================================================
   map
   ============================================================ */

.map-pane { padding: 0; overflow: hidden; }
.map-pane > header { padding: 20px 20px 0; }
#map { height: 380px; width: 100%; background: var(--ground-2); }
@media (min-width: 900px) { #map { height: 440px; } }
.map-foot { padding: 14px 20px 18px; display: flex; gap: 14px;
            flex-wrap: wrap; align-items: center; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .75rem; color: var(--ink-3); }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block;
            margin-inline-end: 5px; }
.leaflet-container { font: inherit; background: var(--ground-2); }
.leaflet-popup-content-wrapper { border-radius: var(--r-sm); box-shadow: var(--shadow-3); }
.pop b { display: block; font-size: .9375rem; }
.pop span { display: block; color: #6b6b70; font-size: .8125rem; }

/* ============================================================
   cross-border
   ============================================================ */

.arb { list-style: none; margin: 0; padding: 0; }
.arb li { display: grid; gap: 6px 14px; grid-template-columns: 1fr auto 1fr;
          grid-template-areas: "a vs b" "note note note";
          padding: 14px 0; border-top: 1px solid var(--hairline); }
.arb li:first-child { border-top: none; padding-top: 0; }
.arb .side { display: flex; flex-direction: column; min-width: 0; }
.arb .side.a { grid-area: a; }
.arb .side.b { grid-area: b; text-align: right; }
.arb .side strong { font-weight: 600; }
.arb .side.a strong { color: var(--cheap); }
.arb .side.b strong { color: var(--steep); }
.arb .vs { grid-area: vs; color: var(--ink-3); font-size: .75rem; align-self: center; }
.arb .note { grid-area: note; font-size: .8125rem; color: var(--ink-3); }
.arb .note strong { color: var(--ink); font-weight: 600; }

/* ============================================================
   records / insight
   ============================================================ */

.record-value { font-size: 1.5rem; font-weight: 600; letter-spacing: -.03em; margin: 2px 0 1px; }
.record-value .unit { font-size: .8125rem; color: var(--ink-3); font-weight: 500; }

.insight { display: flex; gap: 14px; align-items: flex-start;
           padding: 18px 20px; border-radius: var(--r);
           background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--accent-rim); }
.insight h2 { font-size: 1.125rem; color: var(--accent-ink); }
.insight p { margin-top: 4px; font-size: .875rem; color: var(--ink-2); }
.insight .mark { color: var(--accent); font-size: 1.25rem; line-height: 1.3; }

/* ============================================================
   controls
   ============================================================ */

.segmented { display: inline-flex; padding: 2px; gap: 2px;
             background: rgba(0,0,0,.05); border-radius: var(--r-full); }
.segmented a, .segmented button {
  min-height: 32px; padding: 0 12px; display: inline-flex; align-items: center;
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: .8125rem; font-weight: 500; color: var(--ink-2);
  border-radius: var(--r-full); white-space: nowrap;
}
.segmented a:hover, .segmented button:hover { color: var(--ink); text-decoration: none; }
.segmented .on, .segmented [aria-current="true"] {
  background: var(--pane-solid); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border: none; border-radius: var(--r-full);
  background: var(--accent); color: #fff;
  font: inherit; font-size: .9375rem; font-weight: 600; cursor: pointer;
  transition: background .15s ease, transform .08s ease;
}
.btn:hover { background: #0062c4; text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn-quiet { background: var(--pane-solid); color: var(--ink);
             box-shadow: inset 0 0 0 1px var(--hairline-2); }
.btn-quiet:hover { background: #fafafa; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: .8125rem; }
.btn-block { width: 100%; }

.linkbtn { background: none; border: none; padding: 0; cursor: pointer; font: inherit;
           font-size: .875rem; color: var(--accent-ink); text-decoration: underline;
           text-underline-offset: 3px; min-height: 44px; }
.linkbtn.danger { color: var(--danger); }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--ink-3);
            width: 32px; height: 32px; border-radius: var(--r-full);
            display: grid; place-items: center; font-size: 1.1rem; line-height: 1; }
.icon-btn:hover { background: rgba(0,0,0,.05); color: var(--danger); }

/* ============================================================
   forms
   ============================================================ */

.form { display: flex; flex-direction: column; gap: 18px; max-width: 30rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > .label { font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: .75rem; color: var(--ink-3); }
.field .help.good { color: var(--accent-ink); font-weight: 500; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.row .field:last-child { grid-column: 1 / -1; }
@media (min-width: 560px) {
  .row { grid-template-columns: 1fr 1fr .75fr; }
  .row .field:last-child { grid-column: auto; }
}

input, select, textarea {
  font: inherit; font-size: 16px;      /* 16px or iOS zooms on focus */
  width: 100%; min-height: 44px; padding: 10px 12px;
  color: var(--ink); background: var(--pane-solid);
  border: 1px solid var(--hairline-2); border-radius: var(--r-sm);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
input::placeholder { color: var(--ink-3); }
.check { flex-direction: row; align-items: flex-start; gap: 10px; }
.check input { width: auto; min-height: 0; margin-top: 5px; }

.derived { font-size: .875rem; color: var(--ink-2); min-height: 1.35rem;
           font-variant-numeric: tabular-nums; }
.derived strong { color: var(--ink); }
.derived.bad { color: var(--steep); }

.inset { background: var(--pane-solid); border-radius: var(--r);
         box-shadow: var(--gloss), var(--shadow-1); overflow: hidden; }
.inset > * { padding: 14px 18px; border-top: 1px solid var(--hairline); }
.inset > *:first-child { border-top: none; }

/* ============================================================
   capture tiles
   ============================================================ */

.shots { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .shots { grid-template-columns: 1fr 1fr; } }
.shot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center; cursor: pointer;
  min-height: 170px; padding: 24px 16px;
  background: var(--pane); border-radius: var(--r);
  box-shadow: var(--gloss), var(--shadow-1);
  outline: 2px dashed var(--hairline-2); outline-offset: -8px;
  transition: outline-color .15s ease, background .15s ease;
}
.shot:hover { outline-color: var(--accent); }
.shot.has { outline: 2px solid var(--accent); background: var(--accent-wash); }
.shot .ico { font-size: 1.9rem; }
.shot strong { font-size: .9375rem; }
.shot .state { font-size: .75rem; color: var(--accent-ink); word-break: break-all; margin-top: 4px; }
form.busy { opacity: .55; pointer-events: none; }

/* ============================================================
   confirm screen
   ============================================================ */

.confirm { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 960px) {
  .confirm { grid-template-columns: minmax(0,1fr) 300px; align-items: start; }
  .proof { position: sticky; top: 76px; }
}
.proof img { border-radius: var(--r-sm); margin-top: 10px;
             box-shadow: inset 0 0 0 1px var(--hairline); }

/* ============================================================
   drill-down sheet
   ============================================================ */

.sheet { position: fixed; inset: 0; z-index: 80; display: none;
         align-items: center; justify-content: center; padding: 16px; }
.sheet.open { display: flex; }
.sheet-veil { position: absolute; inset: 0; background: rgba(0,0,0,.28);
              -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet-panel {
  position: relative; width: min(56rem, 100%);
  max-height: min(90vh, 42rem); overflow: auto; padding: 22px;
  background: var(--pane-strong);
  -webkit-backdrop-filter: saturate(160%) blur(30px);
  backdrop-filter: saturate(160%) blur(30px);
  border-radius: var(--r-lg); box-shadow: var(--gloss), var(--shadow-3);
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.sheet-value { font-size: 2rem; font-weight: 600; letter-spacing: -.03em; margin-top: 8px; }
.sheet-chart { position: relative; height: 320px; margin-top: 16px; }
@media (max-width: 560px) { .sheet-chart { height: 250px; } }

/* ============================================================
   misc
   ============================================================ */

.notice { padding: 12px 16px; border-radius: var(--r-sm); font-size: .875rem;
          background: var(--pane-solid); box-shadow: inset 0 0 0 1px var(--hairline); }
.notice.warn  { background: var(--typical-wash); color: var(--typical);
                box-shadow: inset 0 0 0 1px rgba(138,100,19,.25); }
.notice.error { background: var(--steep-wash); color: var(--steep);
                box-shadow: inset 0 0 0 1px rgba(163,52,43,.25); }
.notice.ok    { background: var(--cheap-wash); color: var(--cheap);
                box-shadow: inset 0 0 0 1px rgba(28,122,77,.25); }

.blank { text-align: center; padding: 64px 20px; }
.blank h1 { margin-bottom: 6px; }
.blank .btn { margin-top: 20px; }

.centre-page { min-height: 100vh; display: grid; place-items: center; padding: var(--gutter); }
.centre-card { width: min(26rem, 100%); padding: 32px; }
.centre-card .logo { width: 40px; height: 40px; margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--hairline); }
th { font-size: .6875rem; text-transform: uppercase; letter-spacing: .06em;
     color: var(--ink-3); font-weight: 600; white-space: nowrap; }

.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, 1fr); } }

/* ============================================================
   when glass is unavailable or unwanted
   ============================================================ */

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --pane: #fff; --pane-strong: #fff; }
  .topbar { background: var(--ground); }
}

@media (prefers-reduced-transparency: reduce) {
  :root { --pane: #fff; --pane-strong: #fff; --blur: none; }
  .topbar { background: var(--ground); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .pane, .figure, .fill, .tabs, .sheet-panel, .inset {
    background: Canvas; border: 1px solid CanvasText; box-shadow: none;
  }
  .chip { border: 1px solid CanvasText; }
}


/* ---------- transactions ---------- */
.grade {
  display: inline-block; padding: 0 5px; border-radius: 4px;
  background: rgba(0,0,0,.06); color: var(--ink-2);
  font-size: .6875rem; font-weight: 600; letter-spacing: .02em;
}
.fill-act { display: flex; gap: 2px; align-items: center; }
.fill-act .icon-btn { text-decoration: none; }
.fill-act .icon-btn:hover { color: var(--accent-ink); }
.fill-act form button:hover { color: var(--danger); }

/* ---------- grade comparison ---------- */
.versus { list-style: none; margin: 0; padding: 0; }
.versus li { display: grid; gap: 4px 14px;
             grid-template-columns: 1fr auto auto auto;
             grid-template-areas: "name fills eco price";
             padding: 12px 0; border-top: 1px solid var(--hairline);
             align-items: baseline; }
.versus li:first-child { border-top: none; padding-top: 0; }
.versus .name { grid-area: name; font-weight: 600; font-size: .9375rem; }
.versus .name .tag { font-weight: 500; color: var(--ink-3); font-size: .8125rem; }
.versus .fills { grid-area: fills; color: var(--ink-3); font-size: .8125rem; }
.versus .eco   { grid-area: eco; font-variant-numeric: tabular-nums; min-width: 6.5rem;
                 text-align: right; }
.versus .price { grid-area: price; font-variant-numeric: tabular-nums; min-width: 5.5rem;
                 text-align: right; font-weight: 600; }
.versus .none  { color: var(--ink-3); }

/* ---------- records, and their drill-downs ---------- */
.record {
  position: relative; display: flex; flex-direction: column;
  text-align: left; width: 100%; font: inherit; color: inherit;
  border: none; cursor: pointer;
  transition: box-shadow .18s ease, transform .18s ease;
}
.record:hover { box-shadow: var(--gloss), var(--shadow-2); transform: translateY(-1px); }
.record:active { transform: none; }
.record .figure-go { top: 14px; inset-inline-end: 14px; }
.record:hover .figure-go, .record:focus-visible .figure-go { opacity: 1; }

.facts { list-style: none; margin: 18px 0 0; padding: 0;
         display: flex; flex-direction: column; gap: 10px; }
.facts li {
  position: relative; padding-inline-start: 18px;
  font-size: .875rem; line-height: 1.5; color: var(--ink-2);
}
.facts li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: .55em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}

/* ---------- stations ---------- */
.places { list-style: none; margin: 0; padding: 0; }
.places li {
  display: grid; align-items: center; gap: 6px 16px;
  grid-template-columns: 3px 1fr auto auto;
  grid-template-areas: "bar name visits spend" "bar chip price price"
                       "bar meter meter meter";
  padding: 14px 0; border-top: 1px solid var(--hairline);
}
.places li:first-child { border-top: none; padding-top: 0; }
.places .rail-band { grid-area: bar; }
.place-name { grid-area: name; min-width: 0; }
.place-name strong { display: block; font-weight: 600; font-size: .9375rem; }
.place-visits { grid-area: visits; text-align: right; }
.place-spend  { grid-area: spend; text-align: right; }
.place-price  { grid-area: price; text-align: right; }
.places strong { font-variant-numeric: tabular-nums; }
.places .unit { display: block; font-size: .6875rem; color: var(--ink-3); }
.places .chip { grid-area: chip; justify-self: start; }

/* a quiet share-of-spend meter under each row */
.place-bar { grid-area: meter; height: 3px; border-radius: var(--r-full);
             background: rgba(0,0,0,.06); overflow: hidden; }
.place-bar span { display: block; height: 100%; border-radius: var(--r-full);
                  background: var(--band, var(--accent)); opacity: .55; }

@media (min-width: 720px) {
  .places li {
    grid-template-columns: 3px 1fr auto auto auto auto;
    grid-template-areas: "bar name visits spend price chip"
                         "bar meter meter meter meter meter";
  }
  .places .chip { justify-self: end; }
  .place-visits, .place-spend, .place-price { min-width: 5.5rem; }
}

.places.thin li { grid-template-columns: 1fr auto auto;
                  grid-template-areas: "name spend price"; padding: 12px 0; }
.places-toggle { cursor: pointer; font-weight: 600; font-size: .9375rem;
                 list-style: none; min-height: 32px;
                 display: inline-flex; align-items: center; gap: .35rem; }
.places-toggle::-webkit-details-marker { display: none; }
.places-toggle::before { content: "\203A"; display: inline-block; transition: transform .15s; }
details[open] .places-toggle::before { transform: rotate(90deg); }

/* ---------- map popup ---------- */
.pop { font: inherit; line-height: 1.45; }
.pop b { display: block; font-size: 1rem; font-weight: 650; color: var(--ink);
         letter-spacing: -.01em; }
.pop span { display: block; font-size: .8125rem; color: var(--ink-2); }
.pop span b { display: inline; font-size: .8125rem; font-weight: 650; }
.pop .pop-spend { color: var(--ink-3); }
.leaflet-popup-content { margin: 12px 14px; min-width: 190px; }

/* radio-backed segmented control (Appearance) */
.segmented label {
  min-height: 32px; padding: 0 12px; display: inline-flex; align-items: center;
  font-size: .8125rem; font-weight: 500; color: var(--ink-2);
  border-radius: var(--r-full); cursor: pointer; white-space: nowrap;
}
.segmented label.on { background: var(--pane-solid); color: var(--ink);
                      font-weight: 600; box-shadow: var(--shadow-1); }
.segmented label:has(:focus-visible) { outline: 2px solid var(--accent);
                                       outline-offset: 2px; }

/* ---------- compare ---------- */
.versus-rows { list-style: none; margin: 0; padding: 0; }
.versus-rows li {
  display: grid; align-items: baseline; gap: 4px 16px;
  grid-template-columns: 1fr auto auto auto;
  grid-template-areas: "label mine theirs diff";
  padding: 14px 0; border-top: 1px solid var(--hairline);
}
.versus-rows li:first-child { border-top: none; padding-top: 0; }
.v-label  { grid-area: label; font-weight: 600; font-size: .9375rem; }
.v-mine   { grid-area: mine; text-align: right; font-weight: 600;
            font-variant-numeric: tabular-nums; min-width: 6rem; }
.v-theirs { grid-area: theirs; text-align: right; color: var(--ink-2);
            font-variant-numeric: tabular-nums; min-width: 6rem; }
.versus-rows .unit { display: block; font-size: .6875rem; color: var(--ink-3);
                     font-weight: 500; }
.v-diff { grid-area: diff; text-align: right; font-size: .8125rem;
          font-weight: 600; min-width: 5rem; font-variant-numeric: tabular-nums; }
.v-better .v-diff { color: var(--cheap); }
.v-worse  .v-diff { color: var(--steep); }
.v-same .v-diff, .v-more .v-diff, .v-less .v-diff { color: var(--ink-3); }
@media (max-width: 560px) {
  .versus-rows li { grid-template-columns: 1fr auto auto;
                    grid-template-areas: "label mine theirs" "diff diff diff"; }
  .v-diff { text-align: left; }
}

/* ---------- standings ---------- */
.board { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.board li {
  display: grid; align-items: center; gap: 4px 16px;
  grid-template-columns: 2rem 1fr repeat(4, auto);
  grid-template-areas: "rank name fuel spend eco cost";
  padding: 14px 0; border-top: 1px solid var(--hairline);
}
.board li:first-child { border-top: none; padding-top: 0; }
.board li.you { background: var(--accent-wash); border-radius: var(--r-sm);
                padding-inline: 12px; margin-inline: -12px; }
.board-rank { grid-area: rank; font-size: 1.125rem; font-weight: 650;
              color: var(--ink-3); font-variant-numeric: tabular-nums;
              display: flex; align-items: center; gap: 3px; }
.board li.you .board-rank { color: var(--accent-ink); }
/* One crown, on whoever is first for the current sort - not a badge for
   everyone, just a quiet mark on the single row that earned it. */
.board-rank .crown { color: var(--accent); font-size: .8em; line-height: 1; }
/* A month-over-month move, read from typography rather than a red/green
   pair - those colours already mean "cheap/steep" elsewhere on the site,
   and borrowing them here would blur that vocabulary. */
.board-rank .trend { font-size: .55em; line-height: 1; }
.board-rank .trend.up { color: var(--accent); }
.board-rank .trend.down { color: var(--ink-3); }
.board-name { grid-area: name; min-width: 0; }
.board-name strong { display: block; font-size: .9375rem; }
.board-name .tag { font-size: .6875rem; font-weight: 600; color: var(--accent-ink);
                   background: var(--pane-solid); padding: 1px 6px;
                   border-radius: var(--r-full); }
.board-fuel  { grid-area: fuel;  text-align: right; min-width: 5rem; }
.board-spend { grid-area: spend; text-align: right; min-width: 5.5rem; }
.board-eco   { grid-area: eco;   text-align: right; min-width: 5rem; }
.board-cost  { grid-area: cost;  text-align: right; min-width: 5rem; }
.board strong { font-variant-numeric: tabular-nums; }
.board .unit { display: block; font-size: .6875rem; color: var(--ink-3); }
/* Sorting controls sit between the heading and the list. Two groups
   rather than one: what to order by, and which way round. */
.board-filters { display: flex; flex-wrap: wrap; gap: 8px;
                 margin: 4px 0 18px; }
.board-more { margin-top: 16px; }
.board-more .meta { margin-inline-start: 6px; }

/* Six columns only fit on a wide rail. Below that the four figures fall
   into a 2x2 block under the name, which keeps them aligned with each
   other instead of wrapping into a ragged row. */
@media (max-width: 900px) {
  .board li { grid-template-columns: 2rem 1fr 1fr;
              grid-template-areas: "rank name name"
                                   "rank eco  cost"
                                   "rank fuel spend"; }
  .board-fuel, .board-spend, .board-eco, .board-cost {
    text-align: left; min-width: 0; }
}
@media (max-width: 380px) {
  .board li { grid-template-columns: 1.6rem 1fr 1fr; gap: 6px 10px; }
}
.field.check.nested { margin-inline-start: 26px; padding-inline-start: 14px;
                      border-inline-start: 2px solid var(--hairline); }

/* ---------- vehicle comparison ---------- */
.compare-table th, .compare-table td { padding: 10px 16px 10px 0; white-space: nowrap; }
.compare-table td { font-size: .9375rem; }
.compare-table tbody tr:first-child td { font-weight: 500; }

/* the tab bar carries every destination, so let it scroll when narrow */
.tabs { overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
        justify-content: flex-start; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 0 auto; min-width: 54px; padding-inline: 2px; }

/* ---------- per-vehicle spec list ---------- */
.spec { list-style: none; margin: 14px 0 0; padding: 0; }
.spec li { display: flex; justify-content: space-between; gap: 12px;
           padding: 8px 0; border-top: 1px solid var(--hairline);
           font-size: .875rem; }
.spec li:first-child { border-top: none; }
.spec span { color: var(--ink-3); }
.spec strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
