/* design-ios – Knutpunkt as an iPhone app. That layer sits at the end of the file and gives the page its system
   typeface, its grouped lists, its tab bar and its light and dark colours; the rules before it are the shared structure. */
/* Knutpunkt – white and yellow on black, and little else.
   – a box: black with a thin edge. Everything on the page stands in one, or directly on the page.
   – text: white. What matters less is grey.
   – yellow: a large heading's second language (as "Avgående Departures" on a station's board), what is chosen,
     a new time, the one button that starts something – and what is a little late or at some risk. One yellow.
   – red only where something is late or at serious risk. Both always with words or a mark. On time has no colour,
     except where how a departure has gone is drawn day by day: there a day on time is green.
   – one typeface, the system's; figures in its bold.
   – a line's own colour (purple Pågatåg, grey Öresundståg) marks the train's type and is never a status colour.
   – every size is a step on a scale: seven sizes of text (--t-…), distances in fours (--s-…), three corners (--r-…).
     What can be pressed is at least 44 px high (--hit), and answers when the pointer is over it, when it is
     pressed, and when the keyboard stands on it. */
:root {
  color-scheme: dark;
  --bar-h: 64px;
  --page: #050507;
  --sign: #0a0a0c;
  --edge: rgba(255, 255, 255, 0.1);
  --field: #17171a;
  --field-hi: #25252a;
  --field-down: #303036;
  --text: #f5f5f7;
  --text-2: #c7c7cf;
  --muted: #8e8e93;
  --yellow: #ffd60a;
  --yellow-hi: #ffe566;
  --yellow-down: #e6c009;
  --yellow-ink: #1a1500;
  --warning: #ffd60a;
  --critical: #ff453a;
  --warning-ink: #ffd60a;
  --critical-ink: #ff6961;
  --ok: #30d158;
  /* the names the scripts read for maps and charts: the forecast is drawn in yellow, what was measured in white,
     history and what is compared with in grey; "good" is no colour at all */
  --surface: #0a0a0c;
  --surface-2: #25252a;
  --border: rgba(255, 255, 255, 0.1);
  --grid: rgba(255, 255, 255, 0.08);
  --track: #77777f;
  --series-1: #ffd60a;
  --series-2: #636366;
  --hist: #c7c7cf;
  --good: #8e8e93;
  /* risk from low to high: grey through yellow to red; 0 is "no trains" */
  --seq-0: #101012; --seq-1: #222226; --seq-2: #34343a; --seq-3: #5a4f12;
  --seq-4: #9a7f0c; --seq-5: #d98a0a; --seq-6: #f0652a; --seq-7: #ff453a;
  --line-pagatag: #a35ce0; --line-oresund: #80838e; --line-other: #5a8fd6;
  /* text: 12, 14, 16, 18, 20, 24 and 32 px */
  --t-xs: 0.75rem; --t-sm: 0.875rem; --t-md: 1rem; --t-lg: 1.125rem; --t-xl: 1.25rem; --t-2xl: 1.5rem; --t-3xl: 2rem;
  /* distances, in fours; --s0 is the half step between a figure and its label */
  --s0: 2px; --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px; --s9: 64px;
  /* one corner for a box, one for what is inside it, one for a control */
  --r-box: 16px;
  --r-in: 12px;
  --r-ctl: 8px;
  --pad: var(--s5);
  --board-w: 920px;
  --hit: 44px;
  --ease: 0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--page); -webkit-text-size-adjust: 100%; scrollbar-color: var(--field-down) transparent; }
html, body { margin: 0; }
body { min-height: 100vh; min-height: 100svh; color: var(--text); font: 400 var(--t-md)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
body.sheet-open, body.map-open { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1, h2, h3, summary { font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-md); }
h4 { font-size: var(--t-xs); font-weight: 600; color: var(--muted); margin: var(--s4) 0 var(--s2); }
/* the second language of a large heading, or where a train or a journey is going: yellow */
h1 em, h2 em, h3 em { font-style: normal; color: var(--yellow); margin-left: 0.25em; }
/* a label in two languages, as over a board's columns: Swedish, and English in yellow under it */
.both b { display: block; font: 600 var(--t-sm)/1.2 var(--font); color: var(--text); }
.both i { display: block; font: normal 500 var(--t-xs)/1.2 var(--font); color: var(--yellow); }
p { margin: 0; text-wrap: pretty; }
button { font: inherit; color: inherit; }
input, select { font: inherit; color: inherit; accent-color: var(--yellow); }
a { color: var(--yellow); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: var(--t-sm); padding: 0 var(--s1); border-radius: var(--s1); background: var(--field); }
s { text-decoration-thickness: 1px; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.num { font-variant-numeric: tabular-nums; }
.footnote { font-size: var(--t-xs); color: var(--muted); max-width: 80ch; padding: 0 var(--s1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
/* status: only what is late or at risk has a colour */
.warn { --tone-ink: var(--warning-ink); }
.bad { --tone-ink: var(--critical-ink); }

/* ---------- a box ---------- */
.card, .sign, .widgets, .metric-grid, .grid.kpis, .warn-card { background: var(--sign); border: 1px solid var(--edge); border-radius: var(--r-box); }
.card, .sign { padding: var(--pad); }
.card-head, .sign-head { display: flex; align-items: baseline; gap: var(--s1) var(--s4); flex-wrap: wrap; margin-bottom: var(--s4); }
.card-head > .muted, .sign-head > .muted, .sign-head > .more { margin-left: auto; text-align: right; max-width: 60ch; }
/* a board has the board's own large heading, and what it is for in capitals */
.sign-title { font-size: var(--t-2xl); line-height: 1.1; }
.sign-place { margin-left: auto; font: 700 var(--t-md)/1.2 var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); text-align: right; }
.sign-foot { padding-top: var(--s4); font-size: var(--t-xs); color: var(--muted); }
.sign-foot:empty { display: none; }
/* a board that can be asked for more: a line closes the last row, and the button under it has the row's width */
.sign-foot:has(.btn) { margin: 0 calc(-1 * var(--pad)); padding: var(--s2) var(--pad) 0; border-top: 1px solid var(--edge); }
.sign-foot .btn.wide { margin-top: 0; }
.empty { color: var(--muted); }
.announced { color: var(--warning-ink); }
.explain { color: var(--text-2); max-width: 78ch; }
.explain p + p { margin-top: var(--s3); }
.banner { padding: var(--s3) var(--s4); font-size: var(--t-sm); margin-bottom: var(--s3); border: 1px solid var(--warning); border-radius: var(--r-in); }
/* a state of the page, not news: one short line */
.banner.slim { padding: var(--s2) var(--s3); font-size: var(--t-xs); }
.banner.slim #offline-age { color: var(--muted); }

/* something folded away until it is asked for */
details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s3); min-height: var(--hit); font-size: var(--t-md); }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: translateY(-2px) rotate(45deg); transition: transform var(--ease), border-color var(--ease); }
details > summary:hover::after { border-color: var(--text); }
details[open] > summary::after { transform: translateY(2px) rotate(225deg); }
details.fold[open] > summary { margin-bottom: var(--s3); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 900; height: var(--bar-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s5);
  padding: 0 var(--s6); background: var(--sign); border-bottom: 1px solid var(--edge); }
.brand { display: inline-flex; align-items: center; min-height: var(--hit); justify-self: start; color: var(--text); }
.brand:hover { text-decoration: none; }
/* the logo's size and colours are its own (src/visualization/brand.py); its word takes the colour of .brand */
.brand svg { flex: none; }
.hall { display: flex; align-items: center; gap: var(--s3); justify-self: end; }
.feed { display: inline-block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.feed.waiting { color: var(--warning-ink); }
/* the clock: hours and minutes, and the seconds smaller in yellow on the same line */
.clock { flex: none; height: var(--hit); padding: 0 var(--s3); border-radius: var(--r-ctl); background: var(--field);
  font-size: var(--t-xl); font-weight: 700; line-height: var(--hit); color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock .sec { margin-left: var(--s1); font-size: var(--t-sm); font-weight: 600; color: var(--yellow); }

/* ---------- what can be pressed or typed in ----------
   One shape: a dark grey field, lighter under the pointer and lighter still when pressed. What is chosen is written
   in yellow; the one button that starts something is yellow all through. */
.btn, .icon-btn, .toggle span, .filters select, .filters input[type="search"], .time-field, nav.tabs button, nav.subtabs button, .map-full-btn {
  border: none; border-radius: var(--r-ctl); background-color: var(--field); color: var(--text-2); font-size: var(--t-sm); font-weight: 600; cursor: pointer;
  transition: background-color var(--ease), color var(--ease), transform var(--ease); }
.btn:hover, .icon-btn:hover, .toggle:hover span, .filters select:hover, nav.tabs button:hover, nav.subtabs button:hover, .map-full-btn:hover { background-color: var(--field-hi); color: var(--text); }
.btn:active, .icon-btn:active, .toggle input:active + span, .filters select:active, nav.tabs button:active, nav.subtabs button:active, .map-full-btn:active { background-color: var(--field-down); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); white-space: nowrap; height: var(--hit); padding: 0 var(--s4); color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background-color: var(--yellow); color: var(--yellow-ink); height: 48px; padding: 0 var(--s6); font-size: var(--t-md); font-weight: 700; }
.btn.primary:hover { background-color: var(--yellow-hi); color: var(--yellow-ink); }
.btn.primary:active { background-color: var(--yellow-down); transform: translateY(1px); }
.btn.primary:disabled { background-color: var(--yellow); transform: none; }
.btn.quiet { background-color: transparent; color: var(--yellow); padding: 0 var(--s3); }
.btn.quiet:hover { background-color: var(--field); color: var(--yellow-hi); }
.btn.quiet:active { background-color: var(--field-hi); }
.btn.wide { width: 100%; margin-top: var(--s3); }
button.link { background: none; border: none; padding: 0; color: var(--yellow); font-weight: 600; cursor: pointer; }
button.link:hover { color: var(--yellow-hi); text-decoration: underline; }
button.link:active, a:active { color: var(--yellow-down); }
/* a link among the text keeps its size, and takes a press in a full-height zone around it */
a.more, button.link { position: relative; display: inline-block; }
a.more::before, button.link::before { content: ""; position: absolute; inset: min(0px, calc((100% - var(--hit)) / 2)); }
.icon-btn { width: var(--hit); height: var(--hit); flex: none; display: grid; place-items: center; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn svg *, nav.tabs svg * { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* a small button is drawn small, but takes a press in the same square as the others */
.icon-btn.sm { position: relative; width: 32px; height: 32px; line-height: 1; font-size: var(--t-md); }
.icon-btn.sm::after { content: ""; position: absolute; inset: calc((32px - var(--hit)) / 2); }
.chev { display: inline-block; width: 8px; height: 8px; flex: none; border-right: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); }
.chev.back { transform: rotate(-135deg); margin-right: calc(-1 * var(--s0)); }
nav.tabs, nav.subtabs { display: inline-flex; gap: var(--s1); max-width: 100%; }
nav.subtabs { overflow-x: auto; scrollbar-width: none; }
nav.subtabs::-webkit-scrollbar { display: none; }
nav.tabs button, nav.subtabs button { display: flex; align-items: center; gap: var(--s2); height: var(--hit); padding: 0 var(--s4); white-space: nowrap; }
nav.subtabs button:focus-visible { outline-offset: -2px; }  /* the row of tabs scrolls sideways and would cut a ring outside it */
nav.tabs svg { width: 20px; height: 20px; flex: none; }
nav.tabs button[aria-selected="true"], nav.subtabs button[aria-selected="true"], .toggle input:checked + span { background-color: var(--field-hi); color: var(--yellow); }
.toggle { position: relative; display: inline-flex; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle span { display: inline-flex; align-items: center; height: var(--hit); padding: 0 var(--s3); }
.toggle input:focus-visible + span { outline: 2px solid var(--yellow); outline-offset: 2px; }
.filters { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s2); }
.filter-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.filters input[type="search"] { width: 100%; height: var(--hit); outline: none; padding: 0 var(--s4); font-size: var(--t-md); font-weight: 400; color: var(--text); cursor: text;
  transition: background-color var(--ease), box-shadow var(--ease); }
.filters input[type="search"]:hover { background-color: var(--field-hi); }
.filters input[type="search"]:focus-visible, .time-field:focus-within { box-shadow: 0 0 0 2px var(--yellow); }
.filters select { -webkit-appearance: none; appearance: none; height: var(--hit); padding: 0 var(--s7) 0 var(--s3); background-repeat: no-repeat; background-position: right var(--s3) center; background-size: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5l4.5 4.5 4.5-4.5' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

/* the search: a line from one station to the other, the fields along it */
.planner { padding-top: var(--s2); padding-bottom: var(--s2); }
.planner-route { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: var(--s4); align-items: center; }
.rail { position: relative; align-self: stretch; display: grid; grid-template-rows: 1fr 1fr; justify-items: center; align-items: center; }
.rail .ln { position: absolute; top: 25%; bottom: 25%; width: 4px; background: var(--yellow); }
.rail .st, .jline .st { position: relative; z-index: 1; width: 16px; height: 16px; flex: none; border-radius: 50%; border: 4px solid var(--text); background: var(--sign); }
.rail .st.sq, .jline .st.last { border-radius: var(--s1); }
.rail .st.sm { width: 12px; height: 12px; border-width: 3px; }
/* the field that is typed in is underlined in yellow */
.prow { display: flex; align-items: center; gap: var(--s3); min-height: 56px; border-bottom: 1px solid var(--edge); cursor: text; transition: box-shadow var(--ease); }
.prow:last-child { border-bottom: none; }
.prow:focus-within { box-shadow: inset 0 -2px 0 var(--yellow); }
.prow > span { width: 72px; flex: none; }
/* the journey search's labels are short (Från, Till, Via): a narrow column leaves the station names more room */
.planner-fields .prow > span { width: 2.9rem; }
/* Avgångar's labels are longer (Station): both fields start in the same column, clear of the word */
#station-form .planner-fields .prow > span { width: 4.25rem; }
.prow input { flex: 1; min-width: 0; border: none; background: none; outline: none; padding: var(--s2) 0; font-size: var(--t-lg); font-weight: 600; color: var(--text); }
.prow input::placeholder { color: var(--muted); font-weight: 400; }
.planner-actions { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s3) 0 var(--s4); flex-wrap: wrap; }
.time-field { display: inline-flex; align-items: center; gap: var(--s3); height: 48px; padding: 0 var(--s4); cursor: text; transition: background-color var(--ease), box-shadow var(--ease); }
.time-field:hover { background-color: var(--field-hi); }
.time-field input { width: 136px; border: none; background: none; outline: none; font-size: var(--t-md); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.time-field input::placeholder { color: var(--text-2); }
.time-field input { cursor: pointer; }
/* the departure time on two wheels: the hour and the minute in the lit band in the middle are the time chosen; the
   rows above and below fade out, as on a phone's alarm */
.time-wheel { position: absolute; z-index: 1000; padding: var(--s3); background: var(--field); border: 1px solid var(--edge); border-radius: var(--r-in); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); }
.wheels { position: relative; display: flex; justify-content: center; align-items: center; gap: var(--s1); height: 200px; }
.wheels .band { position: absolute; left: 0; right: 0; top: 80px; height: 40px; border-radius: var(--r-ctl); background: var(--field-hi); pointer-events: none; }
.wheel { position: relative; width: 64px; height: 200px; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; padding: 80px 0; outline: none; border-radius: var(--r-ctl);
  -webkit-mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent); mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent); }
.wheel::-webkit-scrollbar { display: none; }
.wheel:focus-visible .w-item[aria-selected="true"] { color: var(--yellow); }  /* the wheel the arrow keys turn */
.wheel.days { width: 128px; }
.wheel.days .w-item { font-size: var(--t-md); }
.w-item { height: 40px; display: grid; place-items: center; scroll-snap-align: center; font-size: var(--t-xl); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; cursor: pointer; }
.w-item[aria-selected="true"] { color: var(--text); }
.wheels .colon { position: relative; font-size: var(--t-xl); font-weight: 700; color: var(--text); }
.w-actions { display: flex; gap: var(--s2); margin-top: var(--s3); }
.w-actions .btn { flex: 1; }
.w-actions .btn.primary { height: var(--hit); padding: 0 var(--s4); font-size: var(--t-sm); }

/* the stations that answer to what is typed: a list under the field, the best first. What is typed is white in each
   name; the one the arrows stand on, or the pointer, is lit like any other thing that can be pressed. */
.suggest { position: absolute; z-index: 1000; padding: var(--s1); background: var(--field); border: 1px solid var(--edge); border-radius: var(--r-in); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); }
.suggest .opt { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--hit); padding: 0 var(--s3); border-radius: var(--r-ctl); cursor: pointer;
  transition: background-color var(--ease); }
.suggest .opt .hit { color: var(--text-2); }
.suggest .opt .hit b { color: var(--text); font-weight: 700; }
.suggest .opt i { font-style: normal; font-size: var(--t-xs); color: var(--muted); }
.suggest .opt:hover, .suggest .opt[aria-selected="true"] { background: var(--field-hi); }
.suggest .opt:active { background: var(--field-down); }
.suggest .none { padding: var(--s3); font-size: var(--t-sm); color: var(--muted); }

/* ---------- layout ---------- */
main { max-width: 1560px; margin: 0 auto; padding: var(--s7) var(--s6) var(--s9); }
section.view { display: none; }
section.view.active { display: block; animation: view-in 0.25s ease-out; }
@keyframes view-in { from { transform: translateY(8px); } }
section.view > * + *, .split > * + *, .split-main > * + *, .split-side > * + *, .statpane > * + *, .subview > * + * { margin-top: var(--s5); }
.statpane { display: none; }
.statpane.active { display: block; }
.subview { display: none; }
.subview.active { display: block; }
/* "Resa" is two views that share a place: the search with its board, and the journey that is picked. */
#resa { display: none; }
body[data-view="search"] #resa, body[data-view="journey"] #resa { display: block; }
body[data-view="search"] #resa-side { display: none; }
/* a board with nothing beside it keeps a board's width and stands in the middle: the room is at the sides of the
   page, not between the columns of the board */
body[data-view="search"] #view-search, .split:has(> .split-side[hidden]) > .split-main { max-width: var(--board-w); margin-left: auto; margin-right: auto; }
.large-title { line-height: 1.1; margin: 0 0 var(--s5); }
.view-head, .section-head { display: flex; align-items: baseline; gap: var(--s2) var(--s4); flex-wrap: wrap; }
.view-head { align-items: center; margin-bottom: var(--s5); }
.view-head .large-title { margin: 0; }
.view-head nav.subtabs { margin-left: auto; }
.section-head { margin-top: var(--s7) !important; }
.section-head + * { margin-top: var(--s3) !important; }
.section-head > .more, .section-head > .rail-nav { margin-left: auto; }
.more { font-size: var(--t-sm); font-weight: 600; }
.more::after { content: " ›"; }
.grid { display: grid; gap: var(--s5); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid.two.tight { gap: var(--s2) var(--s7); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.grid.two.tight h3 { margin-bottom: var(--s2); }

/* ---------- a figure: a number and what it counts ---------- */
.widgets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-grid, .grid.kpis { display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); padding: var(--s2) var(--s1); }
.kpi { padding: var(--s4) var(--pad); min-width: 0; }
.widgets .kpi + .kpi { border-left: 1px solid var(--edge); }
.kpi .label { font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
.kpi .value { font-size: var(--t-3xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin-top: var(--s1); color: var(--text); font-variant-numeric: tabular-nums; }
.kpi .value small, .kpi .value .small { font-size: var(--t-sm); font-weight: 600; letter-spacing: 0; margin-left: var(--s1); }
.kpi .hint { font-size: var(--t-xs); color: var(--muted); margin-top: var(--s1); line-height: 1.4; }
.kpi.alert .value { color: var(--critical-ink); }
.metric-grid .kpi .value, .grid.kpis .kpi .value { font-size: var(--t-2xl); }

/* ---------- status, in words ---------- */
.st, .chip, .delay { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.st.warn, .chip.medium, .delay.d1 { color: var(--warning-ink); }
.st.bad, .chip.high, .delay.d2 { color: var(--critical-ink); }
/* never colour alone: a dot before what is at risk, a triangle before what is late or serious */
.st.warn::before, .st.bad::before, .chip.medium::before, .chip.high::before, .c-prog.warn .p-main::before, .c-prog.bad .p-main::before, .lvl::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: var(--s1); vertical-align: 0.08em; border-radius: 50%; background: currentColor; }
.st.bad::before, .chip.high::before, .c-prog.bad .p-main::before, .lvl.l3::before { border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.chip { font-size: var(--t-sm); }
/* a line's number, on the colour of its trains – darkened, so that the figures are easy to read */
.line-badge { display: inline-block; min-width: 40px; padding: var(--s0) var(--s2); border-radius: var(--s1); text-align: center; vertical-align: 1px;
  font: 700 var(--t-xs)/1.4 var(--font); font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--line, var(--field-hi)) 78%, #000); color: var(--text); }
/* a share as a bar, with its figure */
.risk { display: flex; align-items: center; gap: var(--s3); min-width: 120px; }
.risk .bar, .stat-row .bar, .seg { height: 4px; border-radius: 2px; background: var(--field-hi); overflow: hidden; }
.risk .bar { flex: 1; }
.risk .bar span, .stat-row .bar span, .seg i { display: block; height: 100%; border-radius: 2px; }
.risk .pct { width: 48px; text-align: right; font-variant-numeric: tabular-nums; font-size: var(--t-sm); }

/* ---------- a board ----------
   A heading, the columns in two languages, and a row per train: white on black with a thin line between. */
.board { --cols: 76px minmax(0, 1fr) 56px 96px 84px 132px; }
.board.timetable { container: sign / inline-size; }
.board.compact { --cols: 48px minmax(0, 1fr) 84px 108px; container: list / inline-size; }
.cols, .board .row { display: grid; grid-template-columns: var(--cols); column-gap: var(--s4); align-items: center; }
.cols { padding-bottom: var(--s3); }
.board .row { width: calc(100% + 2 * var(--pad)); margin: 0 calc(-1 * var(--pad)); padding: var(--s4) var(--pad); border: none; border-top: 1px solid var(--edge);
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background-color var(--ease), box-shadow var(--ease); }
.board .row:hover { background: var(--field); }
.board .row:active { background: var(--field-hi); }
.board .row:focus-visible { outline-offset: -2px; }
.board .row.sel, .board .row[aria-expanded="true"] { background: var(--field); box-shadow: inset 4px 0 0 var(--yellow); }
.board .row.static { cursor: default; }
.board .row.static:hover, .board .row.static:active { background: none; }
.board .row > span { display: flex; flex-direction: column; gap: var(--s0); min-width: 0; }
.row .t, .row .ny { font-size: var(--t-xl); font-weight: 700; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; }
.row .ny { color: var(--yellow); }
.row .t.no { color: var(--muted); }
.row .c-tid .narrow { display: none; }  /* a new time has its own column; only a narrow board writes it over the old */
.row .dest { font-size: var(--t-lg); font-weight: 700; line-height: 1.2; color: var(--text); overflow-wrap: break-word; }
.row .via, .row .meta, .p-sub { font-size: var(--t-sm); line-height: 1.4; color: var(--muted); }
.row .via .new { font-weight: 600; color: var(--yellow); }  /* an arrival that is not the timetable's */
.row .meta { display: none; }
.row .c-spar, .row .c-tag, .row .c-now, .row .fig { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.p-main { font-size: var(--t-lg); font-weight: 700; line-height: 1.2; color: var(--tone-ink, var(--text)); font-variant-numeric: tabular-nums; }
.p-sub .warn { color: var(--warning-ink); }
.p-sub .bad { color: var(--critical-ink); }
.board .row.canceled .t, .board .row.canceled .dest { text-decoration: line-through; color: var(--muted); }
.board .row.canceled .t.no { text-decoration: none; }
.board-msg { padding: var(--s4) 0 var(--s1); border-top: 1px solid var(--edge); color: var(--text-2); }
/* where the departures pass midnight: the new day, written as the board writes its place */
.day-break { margin: 0 calc(-1 * var(--pad)); padding: var(--s5) var(--pad) var(--s2); border-top: 1px solid var(--edge); font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
/* what folds out of a journey's row where the journey has no room beside the board */
.detail { padding: 0 0 var(--s5); }
.detail > * + * { margin-top: var(--s4); }
.actions { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.legs-brief { display: grid; gap: var(--s2); }
.leg-line { display: flex; align-items: baseline; gap: var(--s3); font-size: var(--t-sm); color: var(--text-2); }
.leg-line b { color: var(--text); }
.leg-line.transfer { color: var(--tone-ink, var(--text-2)); }
/* a narrow board: time, the train and its forecast; track and train number move under the destination */
@container sign (max-width: 760px) {
  .board .cols, .board .row > .c-spar, .board .row > .c-tag, .board .row > .c-ber { display: none; }
  .board .row { grid-template-columns: 64px minmax(0, 1fr) auto; column-gap: var(--s3); align-items: start; }
  /* one column of time: the timetable's – and when the train is expected to leave at another time, that time with
     the timetable's small and struck out under it */
  .row .c-tid .narrow { display: block; }
  .row .c-tid .was { font-size: var(--t-xs); font-weight: 400; color: var(--muted); text-decoration: line-through; }
  .row .meta { display: block; }
  .row .c-prog { text-align: right; align-items: flex-end; }
  .p-sub .arr-word { display: none; }  /* no expected departure beside it to be mistaken for: the room goes to the destination */
}
@container list (max-width: 420px) {
  .board .cols, .board .row > .c-now { display: none; }
  .board .row { grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: var(--s3); align-items: start; }
  .row .c-prog { text-align: right; align-items: flex-end; }
}
.board.compact .row .dest { font-size: var(--t-md); }
.seg { flex: none; width: 64px; }
.seg i { background: var(--hist); }

/* ---------- what the model believes, in a sentence ---------- */
.plabel { font-size: var(--t-xs); font-weight: 600; color: var(--muted); }
.fc-main, .hero-value { font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-top: var(--s0); color: var(--tone-ink, var(--text)); }
.fc-main.dim { color: var(--muted); }
.fc-more, .hero-sub { margin-top: var(--s1); font-size: var(--t-sm); color: var(--text-2); }
.fc-more .warn { color: var(--warning-ink); }
.fc-more .bad { color: var(--critical-ink); }
.jv-card .fc { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--edge); }
.hero { padding-bottom: var(--s4); margin-bottom: var(--s4); border-bottom: 1px solid var(--edge); }
.hero.d1 { --tone-ink: var(--warning-ink); }
.hero.d2 { --tone-ink: var(--critical-ink); }
.hero-label:empty { display: none; }

/* trains to keep an eye on: one row to swipe or step through, so the view stays short */
.warn-rail { --rail-edge: var(--s6); display: flex; gap: var(--s3); overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 0 var(--rail-edge); scrollbar-width: none;
  padding: 0 var(--rail-edge); margin-left: calc(-1 * var(--rail-edge)); margin-right: calc(-1 * var(--rail-edge));
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--rail-edge), #000 calc(100% - var(--rail-edge)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--rail-edge), #000 calc(100% - var(--rail-edge)), transparent); }
.warn-rail::-webkit-scrollbar { display: none; }
.warn-rail > .empty { flex: 1 0 100%; }
.rail-nav { display: inline-flex; gap: var(--s3); }
@media (hover: none) { .rail-nav { display: none; } }
.warn-card { --tone-ink: var(--critical-ink); flex: 0 0 min(72vw, 220px); scroll-snap-align: start; display: flex; flex-direction: column; gap: var(--s0);
  text-align: left; cursor: pointer; padding: var(--s4) var(--s5); color: inherit; transition: background-color var(--ease); }
.warn-card.warn { --tone-ink: var(--warning-ink); }
.warn-card:hover { background: var(--field); }
.warn-card:active { background: var(--field-hi); }
.warn-card:focus-visible { outline-offset: -2px; }
.wc-top { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.wc-dest { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-est { font-size: var(--t-2xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--tone-ink); margin-top: var(--s3); font-variant-numeric: tabular-nums; }
.wc-line { font-size: var(--t-sm); color: var(--muted); }

/* ---------- what the operator says: a heading, and the rest when it is asked for ---------- */
.notice { border-top: 1px solid var(--edge); }
.notice > summary { padding: var(--s3) 0; font-size: var(--t-sm); font-weight: 600; letter-spacing: 0; }
/* the heading, and after it which train it is about */
.n-text { min-width: 0; }
.n-train { font-weight: 400; color: var(--muted); margin-left: var(--s2); }
.notice > p { padding: 0 0 var(--s4) var(--s6); font-size: var(--t-sm); color: var(--text-2); }
.notice > .n-links { display: flex; flex-wrap: wrap; gap: 0 var(--s5); padding-bottom: var(--s2); }
.n-links .link { display: inline-flex; align-items: center; min-height: var(--hit); text-align: left; }
.n-links .link::before { content: none; }  /* several links in a row: each its own height instead of zones that overlap */
.notice-line { padding: var(--s3) 0; border-top: 1px solid var(--edge); font-size: var(--t-sm); color: var(--text-2); }
.notices .more { margin-top: var(--s3); }
.notices details.fold { border-top: 1px solid var(--edge); }
/* how serious a message is, with the same marks as a late train: red, yellow, or grey for plain information */
.lvl { flex: none; display: inline-grid; place-items: center; width: 12px; height: 12px; color: var(--muted); }
.lvl::before { margin: 0; }
.lvl.l2 { color: var(--warning-ink); }
.lvl.l3 { color: var(--critical-ink); }
/* weather that has gone with late trains: a heading with the same marks, and under it what it has meant */
#weather-note:empty { display: none; }
.wx-item { display: flex; align-items: baseline; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--edge); font-size: var(--t-sm); color: var(--text-2); }
.wx-item b { color: var(--text); }
.wx-item p { margin-top: var(--s1); }
.notices > .footnote { max-width: none; padding: var(--s3) 0 0; border-top: 1px solid var(--edge); }
.canceled-list { display: grid; gap: 0 var(--s7); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.canceled-item { display: flex; flex-direction: column; gap: var(--s0); padding: var(--s2) 0; border-top: 1px solid var(--edge); }

/* ---------- one journey ---------- */
.back { margin-left: calc(-1 * var(--s3)); }
.jv-card { position: relative; padding-right: var(--s9); }
#jv-close { position: absolute; top: var(--s4); right: var(--s4); }
.route-title { font-size: var(--t-2xl); line-height: 1.15; }
.jv-head .times { margin-top: var(--s2); font-variant-numeric: tabular-nums; color: var(--text-2); }
.jv-head .times b { color: var(--text); }
.jv-head .times .ny { color: var(--yellow); }
/* the journey drawn as a line: a coloured stretch per train, a station at every change */
.jline { display: flex; align-items: center; margin: var(--s4) 0 var(--s0); max-width: 520px; }
.jline .seg { flex: 1 1 0; width: auto; min-width: 56px; height: 4px; border-radius: 0; margin: 0 calc(-1 * var(--s1)); background: var(--line); display: flex; align-items: center; justify-content: center; overflow: visible; }
/* the stops of a train, drawn as a line: a coloured track with ringed stations */
.stoplist { list-style: none; margin: 0; padding: 0; --tcol: 52px; }
.stoplist li { position: relative; display: grid; grid-template-columns: var(--tcol) 24px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s2) 0; }
.stoplist li::before { content: ""; position: absolute; left: calc(var(--tcol) + var(--s3) + 10px); width: 4px; top: 0; bottom: 0; background: var(--line, var(--track)); }
.stoplist li:first-child::before { top: 50%; }
.stoplist li:last-child::before { bottom: 50%; }
.stoplist li:only-child::before { display: none; }
.stoplist li > .small, .stoplist li > .delay { text-align: right; color: var(--muted); }
.stoplist li > .delay.d1 { color: var(--warning-ink); }
.stoplist li > .delay.d2 { color: var(--critical-ink); }
.stoplist .dot { position: relative; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--text); background: var(--sign); justify-self: center; }
.stoplist li.passed .dot { background: var(--text); }
.stoplist li.passed .name, .stoplist li.passed .t { color: var(--muted); }
.stoplist li.end .dot { width: 20px; height: 20px; border-width: 4px; }
.stoplist li.end .name { font-weight: 700; color: var(--text); }
.stoplist .name .small { font-weight: 400; }
/* the stop the sheet was opened about */
.stoplist li.here .name { font-weight: 700; color: var(--text); }
tr.here td { font-weight: 600; color: var(--text); }
.stoplist .t { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.stoplist .t .s { display: block; font-size: var(--t-xs); font-weight: 400; color: var(--muted); text-decoration: line-through; }
.stoplist .r-high { color: var(--critical-ink); font-weight: 600; }
.stoplist .r-medium { color: var(--warning-ink); font-weight: 600; }
/* a change of trains, between the two */
.transfer-box { padding: 0 var(--pad); font-size: var(--t-sm); color: var(--tone-ink, var(--text-2)); }
.transfer-box b { color: var(--text); }
.cause { display: flex; justify-content: space-between; gap: var(--s4); align-items: baseline; padding: var(--s3) 0; border-bottom: 1px solid var(--edge); font-size: var(--t-sm); color: var(--text-2); }
.cause b { color: var(--text); }
.cause:last-child { border-bottom: none; }
/* how the same departure has gone: one bar per day, sharing the whole width however many days there are. Green on
   time, yellow and red late – and the later the taller, so that the days can be told apart without the colours. */
.hist-strip { display: flex; align-items: flex-end; gap: var(--s0); height: 20px; margin: var(--s1) 0 var(--s3); }
.hist-strip span { flex: 1 1 0; min-width: 2px; height: 12px; border-radius: 2px; background: var(--ok); }
.hist-strip span.d1 { height: 16px; background: var(--warning); }
.hist-strip span.d2 { height: 20px; background: var(--critical); }

/* ---------- maps ---------- */
.traffic-top { display: grid; gap: var(--s5); }
.traffic-left { min-width: 0; }
.traffic-grid { display: grid; grid-template-columns: minmax(0, 1fr) 472px; gap: var(--s5); align-items: start; margin-top: var(--s5) !important; }
.map-card { position: sticky; top: calc(var(--bar-h) + var(--s5)); }
.map-wrap { position: relative; }
.map { height: 480px; border-radius: var(--r-in); z-index: 0; overflow: hidden; background: var(--field); }
.map.small { height: 320px; }
.map-card .map { height: clamp(380px, calc(100vh - 200px), 760px); height: clamp(380px, calc(100svh - 200px), 760px); }
.legend { display: flex; gap: var(--s2) var(--s4); flex-wrap: wrap; font-size: var(--t-xs); color: var(--muted); margin-top: var(--s3); align-items: center; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: var(--s2); vertical-align: -1px; }
.legend .ring { background: var(--muted); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--critical) 45%, transparent); margin-left: var(--s1); }
.legend .late { background: transparent; border: 3.5px solid var(--c); width: 13px; height: 13px; vertical-align: -2px; }
.legend .station { background: var(--sign); border: 3px solid var(--yellow); width: 13px; height: 13px; vertical-align: -2px; }
.legend .bar { width: 20px; height: 4px; border-radius: 0; vertical-align: 3px; background: linear-gradient(90deg, var(--warning) 50%, var(--critical) 50%); }
.legend .dash { width: 24px; height: 0; border-radius: 0; vertical-align: 3px; border-top: 3px dashed var(--text-2); }
.leaflet-tooltip, .tooltip-html { padding: var(--s1) var(--s2); background: var(--sign); border: 1px solid var(--edge); border-radius: var(--r-ctl); color: var(--text); font-size: var(--t-xs); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5); }
.leaflet-tooltip::before { display: none; }
.tooltip-html { position: absolute; pointer-events: none; z-index: 3000; display: none; }
.map-full-btn { display: grid; place-items: center; width: var(--hit); height: var(--hit); color: var(--text); }
.map-full-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map-full-btn .close, .map-full .map-full-btn .open { display: none; }
.map-full .map-full-btn .close { display: inline; }
.leaflet-bar { border: none !important; border-radius: var(--r-ctl) !important; overflow: hidden; box-shadow: none !important; }
.leaflet-bar a { width: var(--hit) !important; height: var(--hit) !important; line-height: var(--hit) !important; background: var(--field) !important; color: var(--text) !important; border-color: var(--edge) !important;
  transition: background-color var(--ease); }
.leaflet-bar a:hover { background: var(--field-hi) !important; }
.leaflet-bar a:active { background: var(--field-down) !important; }
.leaflet-control-attribution { background: rgba(10, 10, 12, 0.7) !important; color: var(--muted) !important; font-size: var(--t-xs) !important; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.leaflet-container { background: var(--field); font-family: var(--font); }
.leaflet-interactive { cursor: pointer; }
/* the base map steps back a little, so the lines and the trains carry the map */
.base-tiles { filter: brightness(0.82) contrast(1.05); }
.card.map-full { position: fixed; inset: 0; z-index: 1500; display: flex; flex-direction: column; margin: 0 !important; border: none; border-radius: 0;
  padding: max(var(--s4), env(safe-area-inset-top)) var(--s4) max(var(--s4), env(safe-area-inset-bottom)); }
.card.map-full .map-wrap, .card.map-full > .map { flex: 1; min-height: 0; }
.card.map-full .map { height: 100% !important; }
.card.map-full > .map { height: auto !important; }
/* a train on the map: the middle has the colour of its type (purple Pågatåg, grey Öresundståg); around a late
   train, with a gap between, a ring that says how late (yellow, red); and a red halo when a delay is expected */
.train-dot { --type: var(--line-other); --late: var(--warning); display: block; width: 26px; height: 26px; border-radius: 50%;
  border: 3.5px solid var(--late); padding: 2.5px; background: linear-gradient(var(--type), var(--type)) content-box, var(--sign);
  box-shadow: 0 0 0 1.5px var(--sign), 0 1px 5px rgba(0, 0, 0, 0.6); cursor: pointer; transition: transform var(--ease); }
.train-dot.pagatag { --type: var(--line-pagatag); }
.train-dot.oresund { --type: var(--line-oresund); }
/* on time: no ring at all, just the train in the colour of its type */
.train-dot.d0 { border-color: transparent; padding: 0.5px; box-shadow: none; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
  background: radial-gradient(circle closest-side, var(--type) calc(100% - 1.5px), var(--text) calc(100% - 1.5px) 100%) content-box; }
.train-dot.d2 { --late: var(--critical); }
.train-dot.high { box-shadow: 0 0 0 1.5px var(--sign), 0 0 0 7px color-mix(in srgb, var(--critical) 45%, transparent); }
.train-dot.d0.high { border-color: color-mix(in srgb, var(--critical) 50%, transparent); box-shadow: none; }  /* on time now, a delay expected */
.train-wrap:hover .train-dot { transform: scale(1.25); }
.legend .train-dot { display: inline-block; width: 13px; height: 13px; border: none; padding: 0; background: var(--type); box-shadow: 0 0 0 1.5px var(--text); filter: none; margin-right: var(--s2); vertical-align: -2px; cursor: default; }
/* between two updates a train glides to its new place instead of jumping there, and a tooltip that is always shown follows it */
.glide .train-wrap, .glide .leaflet-tooltip.follow { transition: transform var(--glide, 30s) linear; }

/* ---------- statistics ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s5); align-items: start; }
.side-list { margin: 0 calc(-1 * var(--pad)); }
.late-item { display: block; width: 100%; border: none; border-top: 1px solid var(--edge); background: none; text-align: left; cursor: pointer; padding: var(--s3) var(--pad); transition: background-color var(--ease); }
.late-item:hover { background: var(--field); }
.late-item:active { background: var(--field-hi); }
.late-item:focus-visible { outline-offset: -2px; }
.late-item .row1 { display: flex; justify-content: space-between; gap: var(--s2); align-items: center; font-weight: 600; color: var(--text); }
.late-item .route { color: var(--muted); font-size: var(--t-sm); margin-top: var(--s1); }
.late-item .est { font-weight: 700; color: var(--critical-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.side-list > .empty { padding: var(--s1) var(--pad); }
.replay-bar { display: flex; gap: var(--s3); align-items: center; margin-top: var(--s3); flex-wrap: wrap; }
.replay-bar input[type=range] { flex: 1; min-width: 160px; height: var(--hit); margin: 0; cursor: pointer; }
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th, td { padding: var(--s3) var(--s2); text-align: left; border-top: 1px solid var(--edge); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { border-top: none; color: var(--muted); font-weight: 600; font-size: var(--t-xs); white-space: nowrap; }
.only-mobile { display: none; }
.heatmap { display: grid; gap: var(--s0); font-size: var(--t-xs); overflow-x: auto; }
.heatmap .hlabel { color: var(--text-2); white-space: nowrap; padding-right: var(--s2); align-self: center; overflow: hidden; text-overflow: ellipsis; }
.heatmap .col { color: var(--muted); text-align: center; }
.heatmap .cell { height: 28px; border-radius: var(--s1); display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; cursor: default; }
.seq-scale { display: flex; align-items: center; gap: var(--s1); font-size: var(--t-xs); color: var(--muted); margin-top: var(--s3); }
.seq-scale span.box { width: 24px; height: 12px; border-radius: 2px; display: inline-block; }
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 340px; }
/* chain tree */
.tree-wrap { overflow-x: auto; }
.tree { position: relative; }
.tree svg { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.tree-cols { display: flex; gap: 72px; position: relative; }
.tree-col { display: flex; flex-direction: column; gap: var(--s3); min-width: 232px; justify-content: center; }
.tree-col h3 { color: var(--muted); font-size: var(--t-xs); font-weight: 600; letter-spacing: 0; margin-bottom: var(--s0); }
.node { padding: var(--s3); background: var(--field); border-radius: var(--r-ctl); font-size: var(--t-sm); }
.node.root { box-shadow: inset 4px 0 0 var(--critical); }
.node .added { font-weight: 700; color: var(--critical-ink); }
.edge-label { font-size: 12px; fill: var(--text-2); }
/* punctuality: a name, a bar and a number per row */
.stat-row { display: grid; grid-template-columns: minmax(0, 1fr) 88px 48px; gap: var(--s3); align-items: center; padding: var(--s1) 0; font-size: var(--t-sm); }
.stat-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-row .bar span { background: var(--hist); }
.stat-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.trend-up { color: var(--critical-ink); }
.trend-down { color: var(--muted); }
#stats-period { flex: none; margin-left: auto; }

/* ---------- the sheet: one train ---------- */
.drawer-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(0, 0, 0, 0.6); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; z-index: 2001; top: var(--s3); right: var(--s3); bottom: var(--s3); width: min(560px, calc(100% - 2 * var(--s3)));
  overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--pad) var(--s7); background: var(--sign); border: 1px solid var(--edge); border-radius: var(--r-box);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7); transform: translateX(calc(100% + 2 * var(--s3))); visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), visibility 0s 0.35s; }
.drawer.open { transform: none; visibility: visible; transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1); }
.sheet-grab { display: none; }
.sheet-head { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3);
  margin: 0 calc(-1 * var(--pad)) var(--s2); padding: var(--pad) var(--pad) var(--s4); background: var(--sign); }
.sheet-head p { margin-top: var(--s1); }
.notes { list-style: none; margin: 0 0 var(--s4); padding: 0; font-size: var(--t-sm); color: var(--text-2); display: grid; gap: var(--s1); }
/* a long message from the operator is three lines here; the whole text is under Trafik */
.notes li { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sheet-sec { margin-top: var(--s6); }
.sheet-sec > h3 { margin-bottom: var(--s2); }
details.sheet-sec { border-top: 1px solid var(--edge); padding-top: var(--s1); margin-top: var(--s4); }
.drawer .card { padding: 0; border: none; border-radius: 0; }
.drawer .grid.kpis { border: none; border-radius: 0; padding: 0; margin: 0 calc(-1 * var(--pad)); grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.drawer .grid.kpis .kpi { padding-top: var(--s2); padding-bottom: var(--s2); }
.drawer #drawer-history { margin-top: var(--s6); }
.drawer .btn.quiet { margin-top: var(--s2); margin-left: calc(-1 * var(--s3)); }

/* ---------- a wide window: the board and what belongs to it side by side ---------- */
@media (min-width: 720px) {
  /* the search on one line: the stations to the left, the time and the button to the right */
  .planner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s6); align-items: center; }
  .planner-actions { flex-direction: column; align-items: stretch; margin: 0; min-width: 192px; }
}
@media (min-width: 1180px) {
  .split, body[data-view="journey"] #resa { display: grid; grid-template-columns: minmax(0, 1fr) minmax(392px, 34%); gap: var(--s6); align-items: start; }
  .split > * + * { margin-top: 0; }
  .split:has(> .split-side[hidden]) { grid-template-columns: minmax(0, 1fr); }
  body[data-view="journey"] #view-search { display: block; }
  #view-search.active { animation: none; }
  /* the side keeps its place while the board is scrolled, and scrolls on its own */
  .split-side { position: sticky; top: calc(var(--bar-h) + var(--s5)); max-height: calc(100vh - var(--bar-h) - 2 * var(--s5)); max-height: calc(100svh - var(--bar-h) - 2 * var(--s5)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; border-radius: var(--r-box); }
  .split-side::-webkit-scrollbar { display: none; }
  .split-side:has(.map-full) { z-index: 1600; overflow: visible; max-height: none; }
  #jv-back { display: none; }
  .traffic-top { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
  .grid.two.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
}
@media (max-width: 1179px) {
  #jv-close { display: none; }
  .jv-card { padding-right: var(--pad); }
}
@media (max-width: 1100px) {
  .traffic-grid, .map-layout { grid-template-columns: 1fr; }
  .map-card { position: static; }
  .map, .map-card .map { height: 400px; }
}

/* ---------- phones and narrow windows: the tabs lie at the bottom of the screen ---------- */
@media (max-width: 920px) {
  .topbar { position: relative; grid-template-columns: 1fr auto; height: 56px; padding: 0 var(--s4); }
  nav.tabs { position: fixed; bottom: calc(var(--s3) + env(safe-area-inset-bottom)); left: var(--s3); right: var(--s3); z-index: 950; max-width: 480px; margin: 0 auto;
    justify-content: space-around; padding: var(--s1); background: var(--sign); border: 1px solid var(--edge); border-radius: var(--r-box); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6); }
  nav.tabs button { flex: 1; flex-direction: column; justify-content: center; gap: var(--s1); height: 52px; padding: 0 var(--s1); background-color: transparent; }
  nav.tabs .both b { font-size: var(--t-xs); }
  nav.tabs svg { width: 24px; height: 24px; }
  main { padding: var(--s4) var(--s4) calc(112px + env(safe-area-inset-bottom)); }
  .warn-rail { --rail-edge: var(--s4); }
}
@media (max-width: 860px) {
  .hide-mobile { display: none; }
  .only-mobile { display: block; }
  .view-head nav.subtabs { margin-left: 0; }
  .card-head > .muted { margin-left: 0; text-align: left; flex-basis: 100%; }
  /* the sheet comes up from the bottom, with a handle to pull it down by */
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92vh; max-height: 92svh; max-height: 92dvh; border-radius: var(--r-box) var(--r-box) 0 0; border-bottom: none;
    padding-bottom: calc(var(--s7) + env(safe-area-inset-bottom)); transform: translateY(105%); }
  .sheet-grab { display: block; position: sticky; top: 0; z-index: 4; height: 0; }
  .sheet-grab::before { content: ""; position: absolute; top: var(--s2); left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--field-hi); }
}
@media (max-width: 640px) {
  :root { --pad: var(--s4); }
  h1 { font-size: var(--t-2xl); }
  .feed { max-width: 40vw; }
  .feed:not(.waiting) { display: none; }  /* on a phone the clock says enough; a feed that is waiting still shows */
  .sign-title { font-size: var(--t-xl); }
  .sign-place { font-size: var(--t-sm); margin-left: 0; text-align: left; flex-basis: 100%; }
  .planner-actions .btn.primary { flex: 1; }
  .kpi { padding: var(--s4) var(--s3); }
  .widgets .kpi .value { font-size: var(--t-2xl); }
  .widgets .kpi .hint { display: none; }
  .route-title { font-size: var(--t-xl); }
  .stat-row { grid-template-columns: minmax(0, 1fr) 60px 48px; }
  .map, .map.small, .map-card .map { height: 340px; }
}
/* ---------- waiting for a search: a train rolls in from the left, stands while the answer is worked out, and
   drives off to the right when it has come. Without motion (reduced motion) it simply stands in the middle. */
.train-loader { padding-top: var(--s7); overflow: hidden; }
.tl-stage { position: relative; height: 64px; container-type: inline-size; }
.tl-train { position: absolute; left: 0; bottom: 3px; width: 220px; height: auto;
  transform: translateX(calc(50cqw - 50%)); }
/* the Pågatåg's own colours, the same in light and dark: they belong to the train, not to the page */
.tl-body { fill: #a9b3ec; }
.tl-roof { fill: #c3caf3; }
.tl-skirt { fill: #8f99de; }
.tl-cab { fill: #4a4db0; }
.tl-screen { fill: #16182e; }
.tl-window { fill: #3a4068; }
.tl-door { fill: none; stroke: #7f89d2; stroke-width: 1; }
.tl-frame { fill: #3b3d47; }
.tl-bogie { fill: #2c2e35; }
.tl-wheel { fill: #26272c; stroke: #6d707a; stroke-width: 1.2; }
.tl-coupler { fill: #2c2e35; }
.tl-lamp { fill: #fff; }
.tl-track { position: absolute; left: 0; right: 0; bottom: 0; height: 8px;
  border-top: 2px solid var(--track);
  background: repeating-linear-gradient(90deg, var(--field-hi) 0 6px, transparent 6px 22px); }
.tl-text { margin: var(--s4) 0 0; text-align: center; color: var(--text-2); font-size: var(--t-sm); }
/* in: accelerates away from the left edge and brakes to a stop in the middle */
.train-loader.is-in .tl-train { animation: tl-in 1.4s cubic-bezier(0.65, 0, 0.35, 1) both; }
/* standing: the headlamp shows that something is still being worked on */
.train-loader.is-in .tl-lamp { animation: tl-lamp 1.2s ease-in-out 1.4s infinite alternate; }
/* out: pulls away and keeps gathering speed until it has left on the right (started by the script, from wherever
   the train is) */
.train-loader.is-out .tl-text { opacity: 0; transition: opacity 0.3s ease-out; }
@keyframes tl-in { from { transform: translateX(-100%); } to { transform: translateX(calc(50cqw - 50%)); } }
@keyframes tl-lamp { from { opacity: 1; } to { opacity: 0.25; } }
/* the board waits, out of sight, until the train has left – then it fades in */
#journey-results.is-waiting { display: none; }
#journey-results.fade-in { animation: results-in 0.45s ease-out both; }
@keyframes results-in { from { opacity: 0; transform: translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* Watching a journey (app.js, "watching a journey"): the button on the journey, a pill in the corner while it is
   watched, and the notices of what has changed. */
.watch-btn { margin-top: var(--s3); border: 1px solid var(--edge); }
.watch-btn.on { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); }
.watch-pill { position: fixed; left: var(--s4); bottom: var(--s4); z-index: 60; display: flex; align-items: center; gap: var(--s2);
  max-width: min(520px, calc(100vw - 2 * var(--s4))); min-height: var(--hit); padding: var(--s2) var(--s4); border: 1px solid var(--edge);
  border-radius: 999px; background: var(--sign); color: var(--text); box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, 0.3));
  font-size: var(--t-sm); text-align: left; cursor: pointer; }
.watch-pill .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); animation: watch-beat 2s ease-in-out infinite; }
.watch-pill.warn .dot { background: var(--warning); }
.watch-pill.bad .dot { background: var(--critical); }
@keyframes watch-beat { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .watch-pill .dot { animation: none; } }
#toasts { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 70; display: flex; flex-direction: column; gap: var(--s2);
  width: min(380px, calc(100vw - 2 * var(--s4))); }
.toast { position: relative; padding: var(--s3) var(--s8) var(--s3) var(--s4); border: 1px solid var(--edge); border-left: 4px solid var(--yellow);
  border-radius: var(--r-box); background: var(--sign); color: var(--text); box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, 0.3)); }
.toast b { display: block; font-size: var(--t-sm); }
.toast p { margin: var(--s1) 0 0; font-size: var(--t-sm); color: var(--text-2); }
.toast .icon-btn { position: absolute; top: var(--s2); right: var(--s2); }
/* on a narrow screen the tabs stand at the bottom (62 px): the pill and the notices above them */
@media (max-width: 920px) {
  .watch-pill { bottom: calc(var(--s3) + 62px + var(--s3) + env(safe-area-inset-bottom)); }
  #toasts { bottom: calc(var(--s3) + 62px + var(--s3) + 60px + var(--s3) + env(safe-area-inset-bottom)); }
}

/* The routes one travels (app.js): one press each, with the next train. */
.recent-routes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: var(--s3) 0 var(--s4); }
.recent-routes .plabel { width: 100%; }
.route-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: var(--s0); min-height: var(--hit);
  padding: var(--s2) var(--s3); border: 1px solid var(--edge); border-radius: var(--r-ctl); background: var(--sign); color: var(--text);
  font-size: var(--t-sm); text-align: left; cursor: pointer; }
.route-chip:hover { background: var(--field-hi); }
.route-chip .rc-next { color: var(--muted); font-variant-numeric: tabular-nums; }
.route-chip .rc-next:empty::after { content: "…"; }

/* A disruption Trafikverket reports, on the maps (app.js renderMap) */
.dis-mark { display: flex; align-items: center; justify-content: center; border: 2px solid #fff; border-radius: 50%;
  background: var(--critical); color: #fff; font: 800 14px/1 var(--font, sans-serif); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
/* Om Knutpunkt */
#pane-about { display: none; }
#pane-about.active { display: grid; gap: var(--s5); }
.about-steps, .about-list { padding-left: 1.2em; display: grid; gap: var(--s2); }
.about-steps li::marker { font-weight: 700; color: var(--yellow); }
.about-list { list-style: square; }
/* the same train every weekday (app.js, commute) */
.watch-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.watch-row .watch-btn { margin-top: 0; }
.commutes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 0 0 var(--s4); }
.commutes .plabel { width: 100%; }
.commute-chip { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--hit); padding: 0 var(--s1) 0 var(--s3);
  background: var(--field); border-left: 3px solid var(--yellow); font-variant-numeric: tabular-nums; }
/* links inside running text are underlined, not told apart by colour alone */
.footnote a, .explain a { text-decoration: underline; text-underline-offset: 2px; }

/* a table that can be sorted: the heading is a button, the chosen one marked with which way it runs */
th button.sort { display: inline-flex; align-items: center; gap: var(--s1); min-height: 32px; padding: 0; border: none; background: none;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; white-space: nowrap; }
th button.sort:hover { color: var(--text); }
th button.sort::after { content: ""; width: 0; height: 0; border: 4px solid transparent; opacity: 0; }
th[aria-sort="descending"] button.sort, th[aria-sort="ascending"] button.sort { color: var(--text); }
th[aria-sort="descending"] button.sort::after { opacity: 1; border-top-color: currentColor; transform: translateY(2px); }
th[aria-sort="ascending"] button.sort::after { opacity: 1; border-bottom-color: currentColor; transform: translateY(-2px); }

/* ---------- comments: the button at the foot of every page and its dialog (app.js: feedback) ---------- */
.site-foot { display: flex; justify-content: center; padding: var(--s6) var(--pad) calc(var(--s7) + env(safe-area-inset-bottom, 0px)); }
dialog.fb { width: min(560px, calc(100vw - 2 * var(--s4))); padding: var(--s6); border: 1px solid var(--edge); border-radius: var(--r-box);
  background: var(--sign); color: var(--text); }
dialog.fb::backdrop { background: rgba(24, 32, 27, 0.45); }
dialog.fb form { display: flex; flex-direction: column; gap: var(--s3); }
dialog.fb h2 { margin: 0; }
dialog.fb textarea { width: 100%; min-height: 9rem; resize: vertical; padding: var(--s3); border: 1px solid var(--field-down); border-radius: var(--r-in);
  background: var(--field); color: var(--text); font: inherit; }
dialog.fb textarea:focus-visible { outline: 2px solid var(--yellow); outline-offset: 1px; }
.fb-status:empty { display: none; }
.fb-status.bad { color: var(--critical-ink); }
.fb-actions { display: flex; justify-content: flex-end; gap: var(--s2); flex-wrap: wrap; }
/* ---------- iPhone and iPad ---------- */
/* a tap answers at once: no grey flash (the pressed states show it) and no wait to see whether it was a double tap */
html { -webkit-tap-highlight-color: transparent; }
a, button, input, select, textarea, label, summary, [role="tab"] { touch-action: manipulation; }
/* sideways on a phone with a notch the page keeps clear of it, as Safari would without viewport-fit=cover;
   the insets are 0 everywhere else */
body { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
@media (max-width: 920px) {
  nav.tabs { left: calc(var(--s3) + env(safe-area-inset-left, 0px)); right: calc(var(--s3) + env(safe-area-inset-right, 0px)); }
}
/* on a phone the tab bar lies over the foot of the page: the button comes right after the content, and it is the
   button, not the content, that keeps clear of the bar */
@media (max-width: 920px) {
  main { padding-bottom: 0; }
  .site-foot { padding: var(--s3) var(--s4) calc(112px + env(safe-area-inset-bottom, 0px)); }
}


/* =====================================================================================================================
   design-ios – Knutpunkt as an iPhone app, after Apple's Human Interface Guidelines.
   – the system's typeface (San Francisco on Apple devices) in the iOS sizes: 34 large title, 28, 22, 20, 17 body,
     15, 12. Figures in tabular widths.
   – the system's greys for ground, rows and fills; one colour of our own, the logo's: dark green #134633 in light,
     its mint #a2d4b7 in dark. It marks what can be pressed, what is chosen, and the risk.
   – the risk has one mark everywhere: the logo's dot, small, middle or large, always with its figure beside it.
     Red is only for a time that has moved and a train that is late or cancelled, always with words.
   – everything stands in grouped lists: white rows with hairlines between, 12 px corners, no borders, no shadows.
   – a large title opens every tab; on a phone the tabs are a bar at the bottom, on a wide window a segmented control.
   – at least 44 px for whatever is pressed; light and dark follow the device.
   ===================================================================================================================== */
:root {
  color-scheme: light;
  --page: #f2f2f7; --sign: #ffffff; --edge: rgba(60, 60, 67, 0.18);
  --field: #eeeef2; --field-hi: #e3e3e8; --field-down: #d6d6dc;
  --text: #000000; --text-2: #3c3c43; --muted: #6c6c70;
  /* the accent, under the name the rest of the file knows it by: the logo's green */
  --yellow: #134633; --yellow-hi: #1d5c44; --yellow-down: #0c3324; --yellow-ink: #ffffff;
  --tint-soft: rgba(19, 70, 51, 0.1); --tint-soft-hi: rgba(19, 70, 51, 0.16);
  --warning: #ff9500; --critical: #ff3b30; --warning-ink: #9a5300; --critical-ink: #d70015; --ok: #248a3d;
  --surface: #ffffff; --surface-2: #e3e3e8; --border: rgba(60, 60, 67, 0.18); --grid: rgba(60, 60, 67, 0.1); --track: #aeaeb2;
  --series-1: #134633; --series-2: #aeaeb2; --hist: #6c6c70; --good: #aeaeb2;
  --seq-0: #f2f2f7; --seq-1: #e4ebe7; --seq-2: #c9d9cf; --seq-3: #ffe2b0; --seq-4: #ffc46b; --seq-5: #ff9f43; --seq-6: #ff6b3d; --seq-7: #d70015;
  --line-pagatag: #7a3fb0; --line-oresund: #6c7280; --line-other: #3b6aa8;
  --bar: rgba(249, 249, 249, 0.86); --sheet-shadow: 0 10px 40px rgba(0, 0, 0, 0.16);
  --seg-on: #ffffff; --tiles-filter: none;
  /* iOS sizes: 12 caption, 15 subheadline, 17 body, 20, 22, 28 and 34 the large title */
  --t-xs: 0.75rem; --t-sm: 0.9375rem; --t-md: 1.0625rem; --t-lg: 1.0625rem; --t-xl: 1.25rem; --t-2xl: 1.375rem; --t-3xl: 2.125rem;
  --r-box: 12px; --r-in: 10px; --r-ctl: 10px;
  --pad: var(--s4);
  --bar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, system-ui, sans-serif;
}
/* dark: after the device until the person chooses (the appearance button sets data-theme on <html>, i18n.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #000000; --sign: #1c1c1e; --edge: rgba(84, 84, 88, 0.6);
    --field: #2c2c2e; --field-hi: #3a3a3c; --field-down: #48484a;
    --text: #ffffff; --text-2: #ebebf5; --muted: #98989f;
    --yellow: #a2d4b7; --yellow-hi: #b7dfc8; --yellow-down: #8cc4a3; --yellow-ink: #0b2a1f;
    --tint-soft: rgba(162, 212, 183, 0.14); --tint-soft-hi: rgba(162, 212, 183, 0.22);
    --warning: #ff9f0a; --critical: #ff453a; --warning-ink: #ffb340; --critical-ink: #ff6961; --ok: #30d158;
    --surface: #1c1c1e; --surface-2: #3a3a3c; --border: rgba(84, 84, 88, 0.6); --grid: rgba(84, 84, 88, 0.4); --track: #636366;
    --series-1: #a2d4b7; --series-2: #636366; --hist: #98989f; --good: #636366;
    --seq-0: #1c1c1e; --seq-1: #233128; --seq-2: #2f4a3a; --seq-3: #5a4415; --seq-4: #8a5a10; --seq-5: #b8650c; --seq-6: #d9502a; --seq-7: #ff453a;
    --line-pagatag: #a35ce0; --line-oresund: #8e93a0;
    --bar: rgba(22, 22, 24, 0.86); --sheet-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    --seg-on: #636366; --tiles-filter: brightness(0.62) saturate(0.7) contrast(1.08);
    --chrome: #161618; --chrome-edge: rgba(255, 255, 255, 0.16); --tab-idle: #98989f;
  }
}
:root[data-theme="dark"] {
    color-scheme: dark;
  --page: #000000; --sign: #1c1c1e; --edge: rgba(84, 84, 88, 0.6);
  --field: #2c2c2e; --field-hi: #3a3a3c; --field-down: #48484a;
  --text: #ffffff; --text-2: #ebebf5; --muted: #98989f;
  --yellow: #a2d4b7; --yellow-hi: #b7dfc8; --yellow-down: #8cc4a3; --yellow-ink: #0b2a1f;
  --tint-soft: rgba(162, 212, 183, 0.14); --tint-soft-hi: rgba(162, 212, 183, 0.22);
  --warning: #ff9f0a; --critical: #ff453a; --warning-ink: #ffb340; --critical-ink: #ff6961; --ok: #30d158;
  --surface: #1c1c1e; --surface-2: #3a3a3c; --border: rgba(84, 84, 88, 0.6); --grid: rgba(84, 84, 88, 0.4); --track: #636366;
  --series-1: #a2d4b7; --series-2: #636366; --hist: #98989f; --good: #636366;
  --seq-0: #1c1c1e; --seq-1: #233128; --seq-2: #2f4a3a; --seq-3: #5a4415; --seq-4: #8a5a10; --seq-5: #b8650c; --seq-6: #d9502a; --seq-7: #ff453a;
  --line-pagatag: #a35ce0; --line-oresund: #8e93a0;
  --bar: rgba(22, 22, 24, 0.86); --sheet-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  --seg-on: #636366; --tiles-filter: brightness(0.62) saturate(0.7) contrast(1.08);
  --chrome: #161618; --chrome-edge: rgba(255, 255, 255, 0.16); --tab-idle: #98989f;
}
html { overflow-x: clip; background: var(--page); }
body { font-size: var(--t-md); line-height: 1.35; letter-spacing: -0.01em; }
h1, h2, h3, summary { letter-spacing: -0.01em; }
h2 { font-size: var(--t-xl); font-weight: 600; }
h3 { font-size: var(--t-md); font-weight: 600; }
/* the boards' second language belongs to the station hall, not to this design */
h1 em[aria-hidden], .sign-title em, .both i { display: none; }
.both b { font-size: inherit; font-weight: inherit; color: inherit; }
a { color: var(--yellow); }
.muted, .footnote { color: var(--muted); }
.footnote { font-size: var(--t-xs); padding: 0 var(--s4); line-height: 1.4; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--yellow) 55%, transparent); outline-offset: 2px; }

/* ---------- the top bar: the material Apple's bars are made of ---------- */
.topbar { position: sticky; top: 0; height: var(--bar-h); padding: 0 var(--s5); padding-top: env(safe-area-inset-top, 0px); height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  background: transparent; border-bottom: 0.5px solid var(--edge); isolation: isolate; }
/* the frosted ground lies in a layer of its own: a blur on the bar itself would hold the tab bar (fixed, inside it)
   to the bar instead of to the screen */
.topbar::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.clock { height: auto; padding: 0; background: none; font-size: var(--t-md); font-weight: 600; line-height: 1; }
.clock .sec { color: var(--muted); font-size: var(--t-xs); }
.feed { font-size: var(--t-xs); }

/* the tabs: a segmented control in the middle of the bar on a wide window */
nav.tabs { gap: 0; padding: 2px; background: var(--field); border-radius: 9px; }
nav.tabs button { height: 32px; padding: 0 var(--s4); border-radius: 7px; background: transparent; color: var(--text); font-size: var(--t-sm); font-weight: 500; }
nav.tabs button:hover { background: transparent; color: var(--text); }
nav.tabs button[aria-selected="true"] { background: var(--seg-on); color: var(--text); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.2); }
nav.tabs svg { display: none; }
/* a 32 px segment takes a press in a 44 px zone */
nav.tabs button { position: relative; }
nav.tabs button::after { content: ""; position: absolute; inset: -6px 0; }

/* ---------- the page ---------- */
main { max-width: 1240px; padding: var(--s2) var(--s6) var(--s9); }
/* the large title that opens every tab */
.large-title { font-size: var(--t-3xl); font-weight: 700; line-height: 41px; letter-spacing: 0.01em; margin: var(--s3) 0 var(--s4); padding: 0 var(--s1); }
.large-title + * { margin-top: 0 !important; }
section.view > * + *, .split > * + *, .split-main > * + *, .split-side > * + *, .statpane > * + *, .subview > * + * { margin-top: var(--s5); }
.grid { gap: var(--s5); }
section.view.active { animation: view-in 0.2s ease-out; }
@keyframes view-in { from { opacity: 0.4; } }

/* ---------- a grouped list: white rows on the grey ground ---------- */
.card, .sign, .widgets, .metric-grid, .grid.kpis, .warn-card { background: var(--sign); border: none; border-radius: var(--r-box); box-shadow: none; }
.card, .sign { padding: var(--s4); }
.card-head, .sign-head { margin-bottom: var(--s3); align-items: baseline; }
.card-head > .muted, .sign-head > .muted { font-size: var(--t-xs); }
/* a heading over a list stands outside it, as a list's section header does */
.section-head { margin-top: var(--s7) !important; padding: 0 var(--s1); }
.section-head h2 { font-size: var(--t-xl); font-weight: 700; }
.sign-title { font-size: var(--t-xl); font-weight: 700; }
.sign-place { font-size: var(--t-sm); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); }
.explain { color: var(--text-2); font-size: var(--t-sm); line-height: 1.45; }
.empty, .board-msg { color: var(--muted); }

/* ---------- what can be pressed ---------- */
.btn, .icon-btn, .toggle span, .filters select, .filters input[type="search"], .time-field, nav.subtabs button, .map-full-btn {
  border-radius: var(--r-ctl); background-color: var(--field); color: var(--text); font-size: var(--t-sm); font-weight: 600; }
.btn { height: var(--hit); padding: 0 var(--s4); background-color: var(--tint-soft); color: var(--yellow); font-size: var(--t-md); }
.btn:hover { background-color: var(--tint-soft-hi); color: var(--yellow); }
.btn:active { background-color: var(--tint-soft-hi); opacity: 0.7; }
/* the one that starts something: filled, 50 px, as iOS's large prominent button */
.btn.primary { height: 50px; border-radius: 12px; padding: 0 var(--s6); background-color: var(--yellow); color: var(--yellow-ink); font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; text-transform: none; }
.btn.primary:hover { background-color: var(--yellow-hi); color: var(--yellow-ink); }
.btn.primary:active { background-color: var(--yellow-down); transform: none; opacity: 1; }
.btn.quiet, button.link { background-color: transparent; color: var(--yellow); }
.btn.quiet:hover { background-color: var(--tint-soft); color: var(--yellow); }
.icon-btn { border-radius: 50%; background-color: var(--field); color: var(--yellow); }
.icon-btn:hover { background-color: var(--field-hi); }
.icon-btn.sm { color: var(--muted); }
.chev { border-width: 2.5px; }
.toggle span { border-radius: 999px; padding: 0 var(--s4); font-weight: 500; }
.toggle input:checked + span { background-color: var(--yellow); color: var(--yellow-ink); }
.toggle:hover span { background-color: var(--field-hi); }
.toggle input:checked:hover + span { background-color: var(--yellow-hi); }
.filters input[type="search"] { height: 36px; border-radius: 10px; padding-left: 34px; font-size: var(--t-md);
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='8.5' cy='8.5' r='5.5' fill='none' stroke='%238e8e93' stroke-width='2'/%3E%3Cpath d='M13 13l4 4' stroke='%238e8e93' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 10px center / 16px; }
.filters input[type="search"]:hover { background-color: var(--field-hi); }
.filters input[type="search"]:focus-visible, .time-field:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 45%, transparent); }
.filters select { height: 36px; border-radius: 999px; font-weight: 500; }

/* the tabs inside a page: a segmented control */
nav.subtabs { gap: 0; padding: 2px; background: var(--field); border-radius: 9px; }
nav.subtabs button { position: relative; height: 32px; padding: 0 var(--s4); border-radius: 7px; background: transparent; font-size: var(--t-sm); font-weight: 500; color: var(--text); }
nav.subtabs button::after { content: ""; position: absolute; inset: -6px 0; }
nav.subtabs button:hover { background: transparent; color: var(--text); }
nav.subtabs button[aria-selected="true"] { background: var(--seg-on); color: var(--text); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.2); }
.view-head { margin-bottom: var(--s4); }
.view-head nav.subtabs { margin-left: 0; max-width: 100%; }

/* ---------- the searches: a grouped list of fields ---------- */
.card.planner { padding: 0; overflow: hidden; }
.planner-route { grid-template-columns: minmax(0, 1fr) auto; gap: 0; padding-right: var(--s3); }
.rail { display: none; }
.prow { min-height: 50px; padding: 0 var(--s4); gap: var(--s3); border-bottom: 0.5px solid var(--edge); }
.planner-fields .prow:last-child { border-bottom: none; }
.planner-fields .prow + .prow { position: relative; }
.prow:focus-within { box-shadow: none; background: var(--tint-soft); }
.planner-fields .prow > span, #station-form .planner-fields .prow > span { width: 4.4rem; color: var(--muted); font-size: var(--t-md); font-weight: 400; }
.prow input { font-size: var(--t-md); font-weight: 600; }
.prow input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); font-weight: 400; }
#j-swap { width: var(--hit); height: var(--hit); }
.planner-actions { margin: 0; padding: var(--s3) var(--s4) var(--s4); border-top: 0.5px solid var(--edge); }
.time-field { height: 50px; border-radius: 12px; padding: 0 var(--s4); background: var(--field); font-weight: 400; }
.time-field .both b { color: var(--muted); font-weight: 400; font-size: var(--t-md); }
.time-field input { font-size: var(--t-md); font-weight: 600; width: 112px; }
@media (min-width: 720px) {
  .card.planner { display: block; }
  .planner-actions { flex-direction: row; align-items: center; min-width: 0; }
  .planner-actions .btn.primary { flex: 1; }
}
/* the lists that come up from a field */
.suggest, .time-wheel { border: none; border-radius: 14px; background: var(--sign); box-shadow: var(--sheet-shadow); }
.suggest .opt { min-height: var(--hit); border-radius: 8px; font-size: var(--t-md); }
.suggest .opt:hover, .suggest .opt[aria-selected="true"] { background: var(--tint-soft); }
.wheels .band { background: var(--field); }
.w-item { font-weight: 400; }
.w-item[aria-selected="true"] { font-weight: 600; }

/* ---------- a board: one row per train or journey ---------- */
.sign.board { padding: 0; overflow: hidden; }
.sign.board .sign-head { padding: var(--s4) var(--s4) 0; margin-bottom: var(--s3); }
.sign.board .cols { padding: 0 var(--s4) var(--s2); font-size: var(--t-xs); color: var(--muted); }
.cols .both b { font-size: var(--t-xs); font-weight: 400; color: var(--muted); }
.board .row { position: relative; width: 100%; margin: 0; padding: var(--s3) var(--s4); border-top: none; min-height: var(--hit); }
/* a hairline between rows, from where the text starts, as in iOS's lists */
.board .row::before { content: ""; position: absolute; top: 0; left: var(--s4); right: 0; border-top: 0.5px solid var(--edge); }
.board .row:hover { background: var(--field); }
.board .row:active { background: var(--field-hi); }
.board .row.sel, .board .row[aria-expanded="true"] { background: var(--tint-soft); box-shadow: none; }
.row .t, .row .ny { font-size: var(--t-md); font-weight: 600; line-height: 1.25; }
.board .row .t, .board .row .ny, .board .row .c-ber b { font-size: var(--t-md); font-weight: 600; }
.row .ny { color: var(--critical-ink); }
.row .dest { font-size: var(--t-md); font-weight: 600; line-height: 1.25; }
.row .via, .row .meta, .p-sub { font-size: var(--t-sm); color: var(--muted); line-height: 1.35; }
.row .via .new { color: var(--critical-ink); }
.row .c-spar, .row .c-tag, .row .c-now, .row .fig { font-weight: 400; color: var(--text-2); }
.sign-foot { padding: 0 var(--s4) var(--s4); }
.sign-foot:has(.btn) { margin: 0; padding: var(--s2) var(--s4) var(--s3); border-top: 0.5px solid var(--edge); }
.sign-foot .btn.wide { background: transparent; }
.day-break { margin: 0; padding: var(--s5) var(--s4) var(--s2); border-top: none; font-size: var(--t-xs); font-weight: 400; letter-spacing: 0; text-transform: uppercase; color: var(--muted); background: var(--page); }
.detail { padding: 0 var(--s4) var(--s4); }
.canceled-item, .notice, .notice-line, .wx-item, .cause, .late-item, .notices details.fold { border-top-width: 0.5px; }

/* ---------- the risk: the logo's dot in three sizes, the figure always beside it ----------
   The size follows the site's own marks (low, raised from 25 %, high from 50 %), so that it says the same as the
   words. Red is not the risk's colour: it is kept for a time that has moved and a train that is late. */
.p-main { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--s2); font-size: var(--t-md); font-weight: 600; color: var(--text); }
.c-prog .p-main::before, .c-prog.warn .p-main::before, .c-prog.bad .p-main::before { content: ""; flex: none; display: block; width: 8px; height: 8px; margin: 0;
  border-radius: 50%; clip-path: none; background: var(--yellow); opacity: 0.35; }
.c-prog:not(.ok):not(.warn):not(.bad) .p-main::before, .c-prog.nodot .p-main::before { display: none; }
.c-prog.warn .p-main::before { width: 13px; height: 13px; opacity: 1; }
.c-prog.bad .p-main::before { width: 20px; height: 20px; opacity: 1; }
.c-prog.bad .p-main { color: var(--critical-ink); }
.c-prog.nodot.bad .p-main { color: var(--critical-ink); }
/* the same dot as a chip in the tables and on a train's sheet */
.chip { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--t-sm); font-weight: 600; color: var(--muted); }
.chip.medium, .chip.high { color: var(--text); }
.chip.low::before, .chip.medium::before, .chip.high::before { content: ""; flex: none; display: block; margin: 0; border-radius: 50%; clip-path: none; background: var(--yellow); }
.chip.low::before { width: 8px; height: 8px; opacity: 0.35; }
.chip.medium::before { width: 12px; height: 12px; }
.chip.high::before { width: 16px; height: 16px; }
.chip.neutral { color: var(--critical-ink); }
.risk .bar { height: 6px; border-radius: 3px; }
.risk .bar span { border-radius: 3px; }
/* status in words keeps its own marks: a small dot before what is a little late, a triangle before what is late */
.st, .delay { font-weight: 600; }
/* a line's number on its trains' colour */
.line-badge { min-width: 36px; padding: 1px var(--s2); border-radius: 5px; font-size: var(--t-xs); color: #fff; background: var(--line, var(--muted)); }

/* ---------- figures ---------- */
.widgets, .metric-grid, .grid.kpis { padding: 0; }
.kpi { padding: var(--s3) var(--s4); }
.kpi .label { font-size: var(--t-xs); font-weight: 400; color: var(--muted); }
.kpi .value { font-size: var(--t-2xl); font-weight: 700; letter-spacing: -0.01em; }
.metric-grid .kpi .value, .grid.kpis .kpi .value { font-size: var(--t-xl); }
.widgets .kpi + .kpi { border-left: 0.5px solid var(--edge); }
.metric-grid, .grid.kpis { gap: 0; }

/* ---------- notices: a status in one line, on a tinted ground ---------- */
.banner { border: none; border-radius: var(--r-in); background: color-mix(in srgb, var(--warning) 14%, var(--sign)); color: var(--text); font-size: var(--t-sm); }
.banner.slim { padding: var(--s2) var(--s4); font-size: var(--t-sm); }
#demo-banner { background: var(--tint-soft); }
.warn-card { padding: var(--s4); }
.warn-card:hover { background: var(--field); }
.wc-est { font-size: var(--t-2xl); }
.notice > summary { font-weight: 500; }
details > summary::after { border-color: var(--muted); }

/* ---------- one journey ---------- */
.route-title { font-size: var(--t-2xl); font-weight: 700; }
.jv-head .times .ny { color: var(--critical-ink); }
.fc-main, .hero-value { font-size: var(--t-2xl); font-weight: 700; color: var(--text); }
.fc.bad .fc-main, .hero.d2 .hero-value { color: var(--critical-ink); }
.fc.warn .fc-main { color: var(--text); }
.plabel { font-size: var(--t-xs); font-weight: 400; color: var(--muted); }
.stoplist .dot { border-color: var(--text); background: var(--sign); }
.stoplist li.passed .dot { background: var(--muted); border-color: var(--muted); }
.stoplist .r-high, .stoplist .r-medium { color: var(--text); }
.stoplist .r-high::before, .stoplist .r-medium::before { content: ""; display: inline-block; border-radius: 50%; background: var(--yellow); margin-right: var(--s1); vertical-align: 0; }
.stoplist .r-high::before { width: 12px; height: 12px; }
.stoplist .r-medium::before { width: 9px; height: 9px; }
.jline .seg { height: 4px; border-radius: 2px; }

/* ---------- maps, tables, charts ---------- */
.map { border-radius: var(--r-in); background: var(--field); }
.card.map-full { background: var(--page); }
.leaflet-bar a { background: var(--sign) !important; color: var(--text) !important; }
.leaflet-tooltip, .tooltip-html { border: none; border-radius: 8px; background: var(--sign); box-shadow: var(--sheet-shadow); font-size: var(--t-xs); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--sign) 70%, transparent) !important; }
.base-tiles { filter: var(--tiles-filter); }
.train-dot { box-shadow: 0 0 0 1.5px var(--sign), 0 1px 4px rgba(0, 0, 0, 0.3); }
.list-fold { display: none; }
.list-sign.folded #train-list-body { display: block; }
th, td { border-top: 0.5px solid var(--edge); }
thead th { font-size: var(--t-xs); font-weight: 400; color: var(--muted); }
.node { background: var(--field); border-radius: 8px; }
.node.root { box-shadow: inset 3px 0 0 var(--critical); }
.heatmap .cell { border-radius: 4px; }

/* ---------- a train's sheet: the iOS sheet, its handle and its corners ---------- */
.drawer-backdrop { background: rgba(0, 0, 0, 0.3); }
.drawer { border: none; border-radius: 14px; background: var(--sign); box-shadow: var(--sheet-shadow); }
.sheet-head { background: var(--sign); }
.sheet-grab::before { width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--field-down); }
.drawer .card { background: transparent; }

/* ---------- watching, notices that pop up, the dialog ---------- */
.watch-btn { border: none; }
.watch-btn.on { background: var(--yellow); color: var(--yellow-ink); }
.watch-pill, .toast { border: none; border-radius: 14px; background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: var(--sheet-shadow); }
.watch-pill { border-radius: 999px; }
.watch-pill .dot { background: var(--yellow); }
.toast { border-left: none; }
.route-chip { border: none; border-radius: 12px; background: var(--sign); }
.route-chip:hover { background: var(--field); }
.commute-chip { border-left: none; border-radius: 12px; background: var(--sign); }
.recent-routes .plabel, .commutes .plabel { padding: 0 var(--s1); }
dialog.fb { border: none; border-radius: 14px; box-shadow: var(--sheet-shadow); }
dialog.fb::backdrop { background: rgba(0, 0, 0, 0.3); }
dialog.fb textarea { border: none; border-radius: 10px; background: var(--field); }
.site-foot .btn.quiet { font-size: var(--t-sm); font-weight: 500; }
.about-steps li::marker { color: var(--yellow); }

/* ---------- a wide window: the bar holds the logo, the tabs and the clock ---------- */
@media (min-width: 921px) {
  .topbar { grid-template-columns: 1fr auto 1fr; }
}

/* ---------- a phone: iOS's tab bar at the foot of the screen ---------- */
@media (max-width: 920px) {
  .topbar { height: calc(48px + env(safe-area-inset-top, 0px)); padding-left: max(var(--s4), env(safe-area-inset-left, 0px)); padding-right: max(var(--s4), env(safe-area-inset-right, 0px)); }
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; max-width: none; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
    padding: 6px max(var(--s2), env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 4px) max(var(--s2), env(safe-area-inset-left, 0px));
    background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
    border: none; border-top: 0.5px solid var(--edge); border-radius: 0; box-shadow: none; }
  nav.tabs button, nav.tabs button[aria-selected="true"] { height: 46px; flex-direction: column; justify-content: center; gap: 2px; padding: 0; border-radius: 0;
    background: transparent; box-shadow: none; color: #8e8e93; font-size: 10px; font-weight: 500; }
  nav.tabs button::after { inset: 0; }
  nav.tabs button[aria-selected="true"] { color: var(--yellow); }
  nav.tabs svg { display: block; width: 26px; height: 26px; }
  nav.tabs .both b { font-size: 10px; font-weight: 500; letter-spacing: 0.01em; }
  main { padding: 0 var(--s4) var(--s4); }
  .large-title { margin-top: var(--s2); }
  .site-foot { padding: var(--s3) var(--s4) calc(76px + env(safe-area-inset-bottom, 0px)); }
  .watch-pill { bottom: calc(66px + var(--s3) + env(safe-area-inset-bottom, 0px)); }
  #toasts { bottom: calc(66px + var(--s3) + 60px + var(--s3) + env(safe-area-inset-bottom, 0px)); }
  .hall .feed { display: none; }
}
@media (max-width: 860px) {
  .drawer { border-radius: 14px 14px 0 0; }
}
@media (max-width: 640px) {
  :root { --pad: var(--s4); }
  .large-title { font-size: var(--t-3xl); }
  .card, .sign { padding: var(--s4); }
  .sign.board { padding: 0; }
  .kpi { padding: var(--s3); }
}

/* the routes one travels, and the trains watched every weekday: a grouped list, one row each */
.recent-routes, .commutes { display: block; margin: 0; }
.recent-routes .plabel, .commutes .plabel { display: block; margin: 0 0 var(--s2); padding: 0 var(--s4); font-size: var(--t-xs); text-transform: uppercase; color: var(--muted); }
.route-chip { position: relative; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: var(--s3); width: 100%;
  min-height: var(--hit); padding: var(--s3) var(--s4); border-radius: 0; font-size: var(--t-md); font-weight: 600; }
.route-chip .rc-next { font-size: var(--t-sm); font-weight: 400; }
.route-chip + .route-chip::before { content: ""; position: absolute; top: 0; left: var(--s4); right: 0; border-top: 0.5px solid var(--edge); }
.route-chip:first-of-type { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.route-chip:last-of-type { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.commute-chip { display: flex; width: 100%; justify-content: space-between; border-radius: 0; padding: 0 var(--s1) 0 var(--s4); }
.commutes .plabel + .commute-chip { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.commute-chip:last-of-type { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.commute-chip + .commute-chip { box-shadow: inset 0 0.5px 0 var(--edge); }
/* one width for the whole page on a wide window, so that the title, the notices and every list start and end
   in the same place */
main { max-width: 1100px; }
:root { --board-w: 100%; }
/* a figure that is a risk (class ai) takes the risk's dot when it is high, not the red of a late train */
.kpi.ai.alert .value { color: var(--text); display: flex; align-items: center; gap: var(--s2); }
.kpi.ai.alert .value::before { content: ""; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--yellow); }

/* ---------- the bars: iOS's classic opaque chrome, not glass ----------
   The top bar and the tab bar are solid, with a hairline towards the page: nothing of the page shows through. */
:root { --chrome: #f9f9f9; --chrome-edge: rgba(0, 0, 0, 0.28); --tab-idle: #6c6c70; }
.topbar { border-bottom: 0.5px solid var(--chrome-edge); }
.topbar::before { background: var(--chrome); -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (max-width: 920px) {
  nav.tabs { background: var(--chrome); -webkit-backdrop-filter: none; backdrop-filter: none; border-top: 0.5px solid var(--chrome-edge); }
  nav.tabs button, nav.tabs button:hover { color: var(--tab-idle); }
  nav.tabs button[aria-selected="true"] { color: var(--yellow); }
  /* the open tab's symbol is filled, as iOS fills a tab's symbol when it is chosen; what is cut out of it takes the
     bar's colour, and the bars of Statistik grow heavier */
  nav.tabs button[aria-selected="true"] svg .f { fill: currentColor; }
  nav.tabs button[aria-selected="true"] svg .c { stroke: var(--chrome); }
  nav.tabs button[aria-selected="true"][data-view="stats"] svg .f { stroke-width: 3.6; }
}

/* ---------- the top bar's two buttons: the appearance and the language (i18n.js) ----------
   Round grey buttons as iOS draws a bar's buttons. The language is the device's own picker: a select laid
   invisibly over the button, so that a press opens the phone's list of languages. */
.prefs { display: flex; align-items: center; gap: var(--s2); justify-self: end; }
.pref-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s1); height: 36px; min-width: 36px;
  padding: 0 var(--s2); border: none; border-radius: 999px; background: var(--field); color: var(--text); font: 600 var(--t-sm)/1 var(--font); cursor: pointer;
  transition: background-color var(--ease); }
.pref-btn:hover { background: var(--field-hi); }
.pref-btn:active { background: var(--field-down); }
.pref-btn::after { content: ""; position: absolute; inset: -4px; }   /* a 44 px press */
.pref-btn svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pref-btn svg .f { fill: currentColor; stroke: none; }
#theme-btn svg { display: none; }
:root[data-theme-choice="auto"] #theme-btn .ic-auto, :root[data-theme-choice="light"] #theme-btn .ic-light, :root[data-theme-choice="dark"] #theme-btn .ic-dark { display: block; }
.pref-btn.lang { padding: 0 var(--s3) 0 var(--s2); }
.pref-btn.lang select { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: pointer; }
.pref-btn.lang:focus-within { outline: 3px solid color-mix(in srgb, var(--yellow) 55%, transparent); outline-offset: 2px; }
.hall { justify-self: start; }
@media (min-width: 921px) {
  .topbar { grid-template-columns: 1fr auto 1fr; }
}
/* a phone: no bar at the top; the two buttons stand to the right of the large title, as an iOS bar's buttons do */
@media (max-width: 920px) {
  .topbar { position: absolute; top: calc(env(safe-area-inset-top, 0px) + var(--s2)); left: auto; right: max(var(--s4), env(safe-area-inset-right, 0px));
    z-index: 5; display: flex; align-items: center; height: 41px; padding: 0; border: none; background: none; }
  .topbar::before { display: none; }
  .hall { display: none; }
  main { padding-top: env(safe-area-inset-top, 0px); }
  .large-title { padding-right: 156px; }   /* the three buttons beside it: the profile, the appearance, the language */
}

/* =====================================================================================================================
   The proposal's parts ("Knutpunkt som resesida", v2): every list a grouped list of rows with a title and one line
   under it, the risk as the dot with its figure, a section header in small grey capitals over each list, a segmented
   control for when, the journey's answer first as on the proposal's sheet, and Trafik as a map with what is going on
   beside it (under it on a phone).
   ===================================================================================================================== */
/* a list's section header, outside the list */
.sh, .recent-routes .plabel, .commutes .plabel { display: block; margin: var(--s6) 0 7px !important; padding: 0 var(--s4); font-size: 13px; font-weight: 400;
  line-height: 18px; letter-spacing: 0.01em; text-transform: uppercase; color: var(--muted); }
.sh + * { margin-top: 0 !important; }

/* ---------- the rows ---------- */
:is(.board, .now-card, .grp-card) .row { position: relative; display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: var(--hit); margin: 0;
  padding: 11px var(--s4); border: none; border-radius: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
:is(.board, .now-card, .grp-card) .row:hover { background: var(--field); }
:is(.board, .now-card, .grp-card) .row:active { background: var(--field-hi); }
:is(.now-card, .grp-card) .row + .row::before, .now-head + .rows > .row:first-child::before {
  content: ""; position: absolute; top: 0; left: var(--s4); right: 0; border-top: 0.5px solid var(--edge); }
.board .rows > .row-wrap:first-child > .row::before, .board .day-break + .row::before { display: none; }
.cx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cx-t { font-size: var(--t-md); font-weight: 600; line-height: 22px; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cx-s { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--t-sm); font-weight: 400; line-height: 20px; color: var(--muted); }
.cx s, .jv-answer s { font-weight: 400; color: var(--muted); }
.cx em, .jv-answer em { font-style: normal; color: var(--critical-ink); }
.cx em.early, .jv-answer em.early { color: var(--ok); }   /* a new time earlier than the timetable's (app.js, movedTime) */
.cx-s em { font-weight: 500; }
.cx-s .warn { color: var(--muted); }
/* a line's colour: a small square before its name */
.ln { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: 0; background: var(--line, var(--muted)); }
/* the risk: the logo's dot, small under 25 %, middle to 50 %, large from 50 %, the figure always beside it */
.rk, .board .row > .rk { flex: none; display: inline-flex; flex-direction: row; align-items: center; justify-content: flex-end; gap: 7px; min-width: 66px;
  font-size: var(--t-sm); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.rk i { flex: none; border-radius: 50%; background: var(--yellow); }
.rk.lo, .board .row > .rk.lo { color: var(--muted); font-weight: 500; }
.rk.lo i { width: 8px; height: 8px; opacity: 0.45; }
.rk.md i { width: 13px; height: 13px; }
.rk.hi i { width: 20px; height: 20px; }
.rk.none, .board .row > .rk.none { color: var(--muted); font-weight: 400; }
.rk.x, .board .row > .rk.x { color: var(--critical-ink); }
.chev-r, .board .row > .chev-r { flex: none; display: block; width: 8px; height: 8px; margin: 0 2px 0 -2px; border-top: 2px solid var(--muted); border-right: 2px solid var(--muted);
  transform: rotate(45deg); opacity: 0.6; }

/* ---------- Resa: the stations in a list, then when, then the button ---------- */
.planner { display: block; padding: 0; background: none; }
.planner-route { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0; padding: 0 var(--s3) 0 0; background: var(--sign); border-radius: 12px; overflow: hidden; }
.prow input { font-weight: 400; }
.planner-actions { display: grid; gap: var(--s4); justify-content: stretch; align-items: stretch; margin: var(--s4) 0 0; padding: 0; border: none; }
.planner-actions .btn.primary { width: 100%; }
@media (min-width: 720px) {
  .planner-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
}
/* a segmented control, as iOS draws one */
.segc { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); padding: 2px; border-radius: 9px; background: var(--field); }
.seg-btn { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; height: 32px; padding: 0 var(--s2); border: none; border-radius: 7px;
  background: transparent; color: var(--text); font: 500 13px/1.2 var(--font); cursor: pointer; white-space: nowrap; }
.seg-btn::after { content: ""; position: absolute; inset: -6px 0; }   /* a 44 px press */
.seg-btn[aria-pressed="true"], .time-seg:has(#j-time:placeholder-shown) #j-now, .time-seg:not(:has(#j-time:placeholder-shown)) .time-field {
  background: var(--seg-on); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.2); }
.time-seg .time-field { height: 32px; padding: 0; gap: 0; border-radius: 7px; background-color: transparent; }
.time-seg .time-field:hover { background-color: transparent; }
.time-seg .time-field input { width: 100%; height: 32px; padding: 0 var(--s2); text-align: center; font: inherit; color: var(--text); }
.time-seg .time-field input::placeholder { color: var(--text); opacity: 1; }
.time-seg .time-field:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 45%, transparent); }

/* the routes one travels and the trains watched every weekday */
.route-chip { justify-content: flex-start; font-weight: 400; }
.route-chip .cx { align-items: flex-start; }
.route-chip .rc-next { font-size: var(--t-sm); font-weight: 400; color: var(--muted); }
.rc-risk:empty { display: none; }
.commute-chip { align-items: center; gap: var(--s3); }
.commute-chip .cx { padding: 11px 0; }

/* ---------- the journeys ---------- */
.board.trips { padding: 0; background: none; }
.trips .grp { background: var(--sign); border-radius: 12px; overflow: hidden; }
.trips .board-msg { margin: 0; padding: var(--s4); border: none; color: var(--muted); }
.trips .sign-foot:has(.btn) { margin: 0; padding: 0; border-top: 0.5px solid var(--edge); }
.trips .sign-foot:not(:has(.btn)) { padding: var(--s3) var(--s4); }
.trips .sign-foot .btn.wide { width: 100%; height: var(--hit); border-radius: 0; }
.trips .day-break { margin: 0; padding: var(--s5) var(--s4) 7px; border: none; font-size: 13px; font-weight: 400; letter-spacing: 0.01em; }
.trips .row.canceled .cx-t { color: var(--muted); }

/* ---------- one journey: the navigation bar, then the answer as on the proposal's sheet ---------- */
.nav-bar { position: relative; display: flex; align-items: center; min-height: var(--hit); }
.nav-back { display: inline-flex; align-items: center; gap: var(--s2); height: var(--hit); padding: 0 var(--s3) 0 var(--s1); border: none; background: none;
  color: var(--yellow); font: 400 var(--t-md)/1 var(--font); cursor: pointer; }
.nav-back .chev { border-width: 2.5px; }
.nav-title { position: absolute; left: 96px; right: 96px; overflow: hidden; text-align: center; white-space: nowrap; text-overflow: ellipsis;
  font-size: var(--t-md); font-weight: 600; pointer-events: none; }
@media (min-width: 1180px) { .nav-bar { display: none; } }
@media (max-width: 1179px) { .jv-route { display: none; } }
.nav-bar + .jv-card { margin-top: var(--s2) !important; }
.jv-card { padding: var(--s4) var(--s4) var(--s4); }
.jv-route { margin: 0 var(--s7) var(--s3) 0; font-size: var(--t-md); font-weight: 600; }
.jv-answer { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.jv-answer small { display: block; font-size: var(--t-sm); line-height: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.jv-answer h2 { margin: 2px 0 0; font-size: 22px; font-weight: 700; line-height: 28px; letter-spacing: -0.01em; }
.fc-main.bad { color: var(--critical-ink); }
.big-risk { flex: none; display: inline-flex; align-items: center; gap: var(--s2); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.big-risk i { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--yellow); }
.big-risk.md i { width: 20px; height: 20px; }
.big-risk.lo { color: var(--muted); }
.big-risk.lo i { width: 12px; height: 12px; opacity: 0.45; }
.jv-card .fc-more { margin: var(--s2) 0 0; font-size: var(--t-sm); line-height: 1.4; color: var(--muted); }
.jv-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); margin-top: var(--s4); }
.jv-actions .btn { width: 100%; height: 50px; border-radius: 12px; }
.jv-actions .btn.primary.on { background-color: var(--tint-soft); color: var(--yellow); }
.jv-card [data-commute] { width: 100%; margin-top: var(--s2); }
.jv-card [data-commute].on { color: var(--muted); }

/* ---------- Trafik: the map, and what is going on ---------- */
.traffic-grid { margin-top: 0 !important; }
.traffic-side { min-width: 0; }
.traffic-side > * + * { margin-top: var(--s5); }
.map-card { padding: 0; overflow: hidden; }
.map-card .map { border-radius: 0; }
.map-legend { margin: 0; padding: var(--s2) var(--s4) var(--s3); }
.now-card, .grp-card { padding: 0; overflow: hidden; }
.now-head { padding: 14px var(--s4) 12px; }
.now-head small { display: block; font-size: var(--t-sm); line-height: 20px; color: var(--muted); }
.now-head h2 { margin: 2px 0 0; font-size: 22px; font-weight: 700; line-height: 28px; }
.late-rows > .empty, .grp-card .empty { margin: 0; padding: 0 var(--s4) var(--s4); }
.grp-card .empty { padding-top: var(--s4); }
.notices { padding: var(--s1) var(--s4); overflow: hidden; }
/* the button under the first five messages, from edge to edge as the one under "Just nu" (app.js, NOTICE_FIRST) */
.notices .notice-more { width: calc(100% + 2 * var(--s4)); height: var(--hit); margin: 0 calc(-1 * var(--s4)); border-radius: 0; border-top: 0.5px solid var(--edge); }
.notices:has(> #canceled-card[hidden]) .notice-more { margin-bottom: calc(-1 * var(--s1)); }   /* the last in the card: down to its edge */
.notices > .empty { margin: 0; padding: var(--s3) 0; }
.list-sign .filters { gap: var(--s3); margin: 0 0 var(--s3); }
.list-sign .filter-row { gap: var(--s2); }
.grp-card #train-more { width: 100%; height: var(--hit); margin: 0; border-radius: 0; border-top: 0.5px solid var(--edge); }
.cx-s em, .cx-s s { white-space: nowrap; }
/* a list's header with a count: the count to the right, as it is written */
.sh:has(> span) { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.sh > span { text-transform: none; }
/* the choices over the list of trains: the order across the card, and the two switches side by side under it – the
   row never scrolls sideways, so it does not move under a finger */
.list-sign .filter-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2); overflow: visible; }
.list-sign .filter-row > select { grid-column: 1 / -1; width: 100%; }
.list-sign .filter-row .toggle span { width: 100%; justify-content: center; }
/* the journey's three parts: a segmented control across the page, as the proposal's */
#view-journey nav.subtabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
#view-journey nav.subtabs button { justify-content: center; padding: 0 var(--s2); }
.trips .sh.sign-place { margin-left: 0; text-align: left; flex-basis: auto; font-size: 13px; text-transform: uppercase; color: var(--muted); }
/* "Just nu" lists the five most likely stations; the rest behind a button at its foot */
.late-rows .late-more { width: 100%; height: var(--hit); margin: 0; border-radius: 0; border-top: 0.5px solid var(--edge); }
/* a list of journeys that has no route yet has no header either */
.trips .sh:empty { display: none; }

/* ---------- the base map: OpenFreeMap's vector map under Leaflet's layers (app.js, vectorBase) ----------
   The railways of the map in one quiet grey (--rail); the lines the trains run on are drawn over them in colour. */
:root { --rail: #a1a1a6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --rail: #5c5c61; } }
:root[data-theme="dark"] { --rail: #5c5c61; }
.leaflet-tile-pane > .vector-base { position: absolute; left: 0; top: 0; pointer-events: none; }
.leaflet-tile-pane > .vector-base canvas { outline: none; }

/* ---------- the trains on the map: small, as Apple marks a vehicle ----------
   The dot 16 px (11 px for a train on time), the ring that says how late 2.5 px, and the red halo of a delay to come
   4 px – where they were 26, 3.5 and 7. The marker around the dot stays 28 px for a finger (app.js, trainMarker). */
.train-wrap { display: grid; place-items: center; }
.train-dot { width: 16px; height: 16px; border-width: 2.5px; padding: 1.5px; box-shadow: 0 0 0 1.5px var(--sign), 0 1px 3px rgba(0, 0, 0, 0.35); }
.train-dot.d0 { width: 11px; height: 11px; border-width: 0; padding: 0; box-shadow: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.train-dot.high { box-shadow: 0 0 0 1.5px var(--sign), 0 0 0 4px color-mix(in srgb, var(--critical) 40%, transparent); }
.train-dot.d0.high { width: 15px; height: 15px; border-width: 2px; box-shadow: none; }
.train-wrap:hover .train-dot { transform: scale(1.3); }

/* =====================================================================================================================
   Statistik without loose parts: nothing in a list or a table moves sideways under a finger, nothing scrolls inside a
   card, and no text is cut off. A long list grows with the page – its first rows, the rest behind a button at its
   foot; a table is a block per row on a phone; the risk per station and time fits the card; the chain of trains
   stands one under the other where the card is narrow.
   ===================================================================================================================== */
/* the segmented controls fit their row, so none of them scrolls: a row that could scroll moved a few pixels up and
   down under a finger, as the 44 px press around its buttons stood out of it */
nav.subtabs { overflow: visible; }
@media (max-width: 720px) {
  #stats-tabs { display: flex; width: 100%; }
  #stats-tabs button { flex: 1 1 auto; min-width: 0; justify-content: center; padding: 0 var(--s1); font-size: 13px; }   /* as iOS writes a segment */
}
@media (max-width: 374px) { #stats-tabs button { padding: 0 3px; font-size: 12px; } }
/* the period over the punctuality: across the card on a phone, under its heading, as the journey's three parts are */
@media (max-width: 720px) {
  #stats-period { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; margin-left: 0; }
  #stats-period button { justify-content: center; padding: 0 var(--s2); }
}
@media (max-width: 339px) { #stats-tabs { overflow: auto hidden; } }   /* the narrowest phones: sideways, as the last resort */

/* a card that is a list of rows: its heading, then the rows from edge to edge, as Trafik's lists */
.list-card { padding: 0; overflow: hidden; }
.list-card > .card-head { margin: 0; padding: var(--s4) var(--s4) var(--s3); }
.list-card .row:first-child::before { content: ""; position: absolute; top: 0; left: var(--s4); right: 0; border-top: 0.5px solid var(--edge); }
.list-card .row.static { cursor: default; }
.list-card .row.static:hover, .list-card .row.static:active { background: none; }
.list-card .list-more { width: 100%; height: var(--hit); margin: 0; border-radius: 0; border-top: 0.5px solid var(--edge); }
.list-card .side-list { margin: 0; }
.list-card .late-item { padding: var(--s3) var(--s4); }
/* a line's share late, and its arrow under it */
.row > .lv { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row > .lv b { font-size: var(--t-md); font-weight: 600; color: var(--text); }
.row > .lv .small { font-size: var(--t-xs); }
.cx-t .line-badge { margin-right: 2px; }
.list-card .cx-t { text-wrap: balance; }   /* "Kristianstad C – Trelleborg C" breaks after the dash, not before the last C */

/* the risk per station and time: the columns share the card's width; where it is narrow the stations' names take two
   lines, and every other time is written over the columns (app.js, renderForecast) */
.card:has(> .heatmap) { container: heat / inline-size; }
.heatmap { grid-template-columns: minmax(90px, 140px) repeat(var(--bins, 9), minmax(34px, 1fr)); overflow: visible; }
.heatmap .col { display: flex; justify-content: center; white-space: nowrap; }
@container heat (max-width: 440px) {
  .heatmap { grid-template-columns: 88px repeat(var(--bins, 9), minmax(0, 1fr)); }
  .heatmap .hlabel { overflow: visible; white-space: normal; overflow-wrap: break-word; line-height: 1.2; text-overflow: clip; }
  .heatmap .col.alt { visibility: hidden; }
  .heatmap .cell { font-size: 11px; }
}
.seq-scale { flex-wrap: wrap; row-gap: var(--s1); }
.seq-scale .nw { white-space: nowrap; }
.seq-scale .boxes { display: inline-flex; gap: var(--s1); }
.seq-scale .nw:last-child { flex-basis: 100%; }

/* the chain of trains (app.js, drawChainTree): across – the columns side by side, shrinking to the room – or down,
   where a card is too narrow for them: each train a step in from the one that delays it, the lines in the margin, and
   the reason written in the train */
.tree-wrap { overflow: visible; }
.tree svg { width: 100%; height: 100%; }
.tree-col { flex: 0 1 232px; min-width: 0; }
.tree[data-layout="across"] .via { display: none; }
.tree-down { position: relative; display: flex; flex-direction: column; gap: var(--s3); }
.tree-step { padding-left: calc(var(--depth, 0) * 32px); }
.tree-down .node { padding: var(--s2) var(--s3); }

/* the bars of the stations and the causes: a long name takes two lines instead of ending in an ellipsis */
.stat-row .name { overflow: visible; white-space: normal; overflow-wrap: break-word; text-overflow: clip; line-height: 1.3; }
#stats-worst .stat-row, #stats-best .stat-row { grid-template-columns: minmax(0, 1fr) 48px 44px; }
/* the model's groups in two lines each on a phone (app.js, renderModel): room for every one of them */
@media (max-width: 639px) { .chart-box.tall:has(> #chart-importance) { height: 440px; } }

/* a table on a phone: a block per row – what the row is about first, then each figure under its column's name
   (app.js, stackLabels). A table that can be sorted keeps its headings as a row of buttons over the rows. */
@media (max-width: 640px) {
  .table-wrap:has(> table.stack) { overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack thead { display: none; }
  table.stack tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2) var(--s4); padding: var(--s3) 0;
    border-top: 0.5px solid var(--edge); }
  table.stack td { padding: 0; border: none; text-align: left; }
  table.stack td:first-child { grid-column: 1 / -1; font-size: var(--t-md); font-weight: 600; color: var(--text); }
  table.stack td:not(:first-child)::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: var(--t-xs); font-weight: 400; color: var(--muted); }
  table.stack.lead td:first-child::before { content: attr(data-label) " "; font-weight: 400; color: var(--muted); }
  table.stack thead:has(button.sort) { display: block; }
  table.stack thead:has(button.sort) tr { display: flex; flex-wrap: wrap; gap: var(--s2); padding-bottom: var(--s3); }
  table.stack thead:has(button.sort) th { display: block; padding: 0; border: none; }
  table.stack th button.sort { position: relative; min-height: 36px; padding: 0 var(--s3); border-radius: 18px; background: var(--field); color: var(--text); }
  table.stack th button.sort::before { content: ""; position: absolute; inset: -4px 0; }   /* a 44 px press */
  table.stack th[aria-sort] button.sort { background: var(--tint-soft); color: var(--yellow); }
}

/* =====================================================================================================================
   The profile (app.js, "the profile"; the button beside the appearance's): the account, then what is watched and
   saved, each a grouped list as everywhere else, with a red "Sluta bevaka" or "Ta bort" on its rows.
   ===================================================================================================================== */
.profile { max-width: 640px; }
.profile > .sh:first-child { margin-top: 0 !important; }
.profile .cx-t { text-wrap: balance; }
.pref-btn[aria-current="page"] { background: var(--tint-soft); color: var(--yellow); }
.acc-card { display: grid; gap: var(--s4); padding: var(--s4); }
.acc-lead { margin: 0; font-size: var(--t-sm); line-height: 1.45; color: var(--muted); }
.acc-form { display: grid; gap: var(--s3); }
.acc-field { display: grid; gap: var(--s1); font-size: var(--t-xs); color: var(--muted); }
.acc-field input { width: 100%; height: var(--hit); padding: 0 var(--s3); border: none; border-radius: 10px; background: var(--field);
  color: var(--text); font: 400 var(--t-md)/1.2 var(--font); outline: none; }
.acc-field input:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--yellow) 45%, transparent); }
.acc-names { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s3); }
.acc-names[hidden] { display: none; }
.acc-hint { margin: calc(-1 * var(--s1)) 0 0; font-size: var(--t-xs); color: var(--muted); }
.acc-msg { margin: 0; font-size: var(--t-sm); line-height: 1.4; color: var(--critical-ink); }
.acc-msg.ok { color: var(--text); }
.acc-msg:empty { display: none; }
.acc-form .btn.primary { width: 100%; }
.acc-form .btn.quiet { justify-self: center; }
.acc-row-btn { width: 100%; height: var(--hit); margin: 0; border-radius: 0; border-top: 0.5px solid var(--edge); }
.grp-card .row .prof-stop { flex: none; height: 36px; margin: -4px 0; padding: 0 var(--s2); color: var(--critical-ink); font-weight: 500; }
.grp-card .row .prof-stop::after { content: ""; position: absolute; inset: -4px 0; }   /* a 44 px press */
.grp-card .row .prof-stop { position: relative; }
.profile .grp-card > .empty { margin: 0; padding: var(--s4); font-size: var(--t-sm); line-height: 1.45; color: var(--muted); }
#acc-danger { margin-top: var(--s6); }
.btn.acc-remove { width: 100%; height: var(--hit); margin: 0; border-radius: 12px; background: var(--sign); color: var(--critical-ink); }
.btn.acc-remove:hover { background: var(--field); color: var(--critical-ink); }
.btn.danger { width: 100%; height: 48px; background: var(--critical); color: #fff; font-weight: 700; }
.btn.danger:hover { background: color-mix(in srgb, var(--critical) 88%, #000); color: #fff; }

/* =====================================================================================================================
   Statistics, only with a yes (app.js, "statistics"): the question once, as a box about cookies at the foot of the
   page – over the tab bar on a phone – with "Neka" and "Godkänn" alike, so that neither is the easy one, and "Läs mer";
   and the same two where the choice can be changed (Profil, Om).
   ===================================================================================================================== */
.stat-ask { position: fixed; z-index: 1200; left: max(var(--s3), env(safe-area-inset-left, 0px)); right: max(var(--s3), env(safe-area-inset-right, 0px));
  bottom: calc(var(--s4) + env(safe-area-inset-bottom, 0px)); max-width: 520px; margin: 0 auto; display: grid; gap: var(--s3);
  padding: var(--s4); border: 0.5px solid var(--edge); border-radius: 16px; background: var(--sign); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); }
@media (max-width: 920px) { .stat-ask { bottom: calc(66px + var(--s3) + env(safe-area-inset-bottom, 0px)); } }
.stat-ask h2 { margin: 0; font-size: var(--t-md); font-weight: 700; line-height: 1.3; }
.stat-ask p { margin: 0; font-size: var(--t-sm); line-height: 1.45; color: var(--text-2); }
.stat-btns { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s2); }
.stat-btns .btn { width: 100%; height: var(--hit); margin: 0; border-radius: 12px; background: var(--field); color: var(--text); font-weight: 600; }
.stat-btns .btn:hover { background: var(--field-hi); color: var(--text); }
.stat-btns .btn.quiet { background: transparent; color: var(--yellow); }   /* "Läs mer": not one of the two answers */
.stat-btns .btn.quiet:hover { background: var(--field); color: var(--yellow-hi); }
.stat-choice { display: grid; gap: var(--s3); }
.stat-choice > p { margin: 0; }
.explain .stat-choice { margin-top: var(--s4); }

/* =====================================================================================================================
   The admins' dashboard (app.js, "the dashboard"): figures in tiles, the diagrams in cards, the lists as bars.
   ===================================================================================================================== */
.dash { max-width: 1100px; }
.dash-msg { margin: 0; padding: var(--s4); color: var(--muted); }
.dash-kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.dash .sh > .muted { margin-left: var(--s2); text-transform: none; }
.dash-note { margin: var(--s6) 0 0; padding: 0 var(--s4); font-size: var(--t-sm); line-height: 1.45; color: var(--muted); }
.dash .card > .empty { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.dash-h3 { margin: 0 0 var(--s2); font-size: var(--t-sm); font-weight: 600; }
.dash-choices { margin-top: 0; }
.dash-cohorts td.empty { color: var(--muted); }
.dash-badge { display: inline-block; margin-left: var(--s1); padding: 1px 7px; border-radius: 999px; background: var(--tint-soft); color: var(--yellow);
  font-size: var(--t-xs); font-weight: 600; vertical-align: 1px; }
#dash-accounts .cx-s { -webkit-line-clamp: 3; }

/* the profile's button: "Logga in" in words while no one is signed in here, the person when someone is */
#profile-btn .pref-label { display: none; }
#profile-btn.signed-out { padding: 0 10px; font-size: 13px; }
/* on a phone the words take room from the large title beside them: the title a little smaller when it needs to be */
@media (max-width: 920px) {
  :root:has(#profile-btn.signed-out) .large-title { padding-right: 190px; font-size: min(var(--t-3xl), 8.4vw); }
}
#profile-btn.signed-out svg { display: none; }
#profile-btn.signed-out .pref-label { display: inline; white-space: nowrap; }
/* the narrowest phones (an iPhone SE of the first kind): the language button is the globe alone, so that the title fits */
@media (max-width: 340px) {
  :root:has(#profile-btn.signed-out) #lang-code { display: none; }
  :root:has(#profile-btn.signed-out) .pref-btn.lang { padding: 0; }
}
