/* The app's names for the brand's semantic tokens (nt-tokens.css, from the brand kit). Light is the kit's
   default, dark follows the system, [data-theme] forces one. The kit decides both; nothing here is a colour. */
:root {
  --bg: var(--nt-bg);
  --panel: var(--nt-bg);
  --panel-2: var(--nt-surface);
  --ele-plot: var(--nt-surface); /* the climb profile's plot follows the theme */
  --grade-0: color-mix(in srgb, var(--link) 12%, var(--panel-2)); /* the five grade bands of a profile at its line: under 3 %, 3-6, 6-9, 9-12, 12 and over; the Signal Text over the ground, steeper = stronger */
  --grade-1: color-mix(in srgb, var(--link) 30%, var(--panel-2));
  --grade-2: color-mix(in srgb, var(--link) 50%, var(--panel-2));
  --grade-3: color-mix(in srgb, var(--link) 70%, var(--panel-2));
  --grade-4: color-mix(in srgb, var(--link) 92%, var(--panel-2));
  --map-ground: var(--nt-nebel); /* what shows behind the tiles before they arrive: calm Nebel on light, the page ground on dark */
  --border: var(--nt-border);
  --border-strong: var(--nt-border-strong);
  --text: var(--nt-fg);
  --muted: var(--nt-fg-muted);
  --accent: var(--nt-accent); /* a fill: the one primary action, a selection */
  --on-accent: var(--nt-on-accent);
  --link: var(--nt-link); /* accent as text, a line or an icon on the page ground */
  --btn-neutral: var(--nt-nebel); /* tonal buttons, bar pills, chips and segment tracks: Nebel on light, Graphit on dark */
  --btn-neutral-raised: var(--btn-neutral); /* a neutral control on a raised surface (a --panel-2 card): one tier above the card, like Material's surface-container steps */
  --nt-disabled-bg-raised: var(--nt-disabled-bg);
  --layer-hover: color-mix(in srgb, currentColor 8%, transparent); /* the state layers of every control: its own content colour over its fill */
  --layer-press: color-mix(in srgb, currentColor 10%, transparent);
  --sel-bg: var(--nt-accent-subtle); /* everything selected is tonal: a tint of Signal, a 1.5 px Signal edge and the orange content that reads on the tint, in both themes (tokens in nt-tokens.css) */
  --sel-fg: var(--nt-accent-subtle-fg);
  --sel-border: var(--nt-accent-subtle-border);
  --sel-ring: inset 0 0 0 1.5px var(--sel-border); /* the edge, drawn inside the control so nothing moves */
  --text-soft: var(--nt-fg-secondary); /* the action bar's items: quieter than --text, lighter than --muted */
  --success: var(--nt-success);
  --success-text: var(--nt-success-text);
  --danger: var(--nt-error-text);
  --warn: var(--nt-warning-text);
  --surf-ink: color-mix(in srgb, var(--text) 78%, var(--panel)); /* the one grey of every kind of ground: the kinds differ by pattern, not hue (surfaces bar, swatches) */
  --scrim: var(--nt-overlay);
  --snack-action: var(--nt-signal); /* on the inverse surface (--text): dark in light mode (Signal 7:1), light in dark mode (Signal Text, set below) */
  --flag-dark: var(--nt-tiefschwarz);
  --flag-light: var(--nt-kreide);
  --shadow: 0 6px 20px color-mix(in srgb, var(--nt-tiefschwarz) 12%, transparent);
  --r-xs: 4px; /* a swatch, a hairline bar */
  --r-s: 8px; /* chips, fields */
  --r-m: 12px; /* cards, profile */
  --r-l: 16px; /* sheet top corners */
  --r-xl: 28px; /* modal corners */
  --r-full: 999px; /* pills, discs, FAB */
  --t-title: 17px; /* sheet, dialog and page title, line 1.25 */
  --t-label: 13px; /* button labels */
  --t-figure: var(--nt-weight-body-strong) 1rem/1.2 var(--nt-font-body); /* a number of the data line; its unit is muted (docs/design/foundations/stats.md) */
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --map-ground: var(--nt-tiefschwarz); --btn-neutral: var(--nt-graphit); --btn-neutral-raised: var(--nt-schiefer); --nt-disabled-bg-raised: var(--nt-schiefer); --snack-action: var(--nt-signal-text); --grade-0: color-mix(in srgb, var(--link) 14%, var(--panel-2)); --grade-1: color-mix(in srgb, var(--link) 34%, var(--panel-2)); --grade-2: color-mix(in srgb, var(--link) 54%, var(--panel-2)); --grade-3: color-mix(in srgb, var(--link) 74%, var(--panel-2)); --grade-4: color-mix(in srgb, var(--link) 95%, var(--panel-2)); --shadow: 0 6px 20px color-mix(in srgb, var(--nt-tiefschwarz) 35%, transparent); } }
:root[data-theme="dark"] { --map-ground: var(--nt-tiefschwarz); --btn-neutral: var(--nt-graphit); --btn-neutral-raised: var(--nt-schiefer); --nt-disabled-bg-raised: var(--nt-schiefer); --snack-action: var(--nt-signal-text); --grade-0: color-mix(in srgb, var(--link) 14%, var(--panel-2)); --grade-1: color-mix(in srgb, var(--link) 34%, var(--panel-2)); --grade-2: color-mix(in srgb, var(--link) 54%, var(--panel-2)); --grade-3: color-mix(in srgb, var(--link) 74%, var(--panel-2)); --grade-4: color-mix(in srgb, var(--link) 95%, var(--panel-2)); --shadow: 0 6px 20px color-mix(in srgb, var(--nt-tiefschwarz) 35%, transparent); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--nt-font-body);
  font-weight: var(--nt-weight-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

body { display: flex; flex-direction: column; }

.brand { font-weight: var(--nt-weight-body-strong); font-size: 1.05rem; white-space: nowrap; display: flex; align-items: center; gap: var(--nt-space-2); color: inherit; text-decoration: none; }
.brand-icon { width: 1.4rem; height: 1.4rem; flex: none; }

/* -- login page -- */
.login-body { align-items: center; justify-content: center; padding: var(--nt-space-4); }
.login-card {
  flex: 0 0 auto;
  width: min(100%, 22rem);
  display: grid;
  align-content: start;
  gap: var(--nt-space-4);
  padding: var(--nt-space-6);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
  text-align: center;
}
.login-text { margin: 0; color: var(--muted); line-height: 1.45; }
.login-message {
  margin: 0;
  padding: var(--nt-space-2) var(--nt-space-3);
  border: 1px solid var(--danger);
  border-radius: var(--r-s);
  color: var(--danger);
  background: color-mix(in srgb, var(--nt-error) 8%, transparent);
}

/* -- Edge koppeln (/pair, garmin_pairing.py): the login card, left-aligned, with 48 px targets -- */
.pair-card { text-align: left; }
.pair-title { margin: 0; font-family: var(--nt-font-display); font-size: var(--t-title); line-height: 1.25; font-weight: var(--nt-weight-heading); }
.pair-form { display: grid; gap: var(--nt-space-2); }
.pair-label { color: var(--muted); font-size: 0.85rem; }
.pair-input {
  height: 48px; min-height: 48px; padding: 0 var(--nt-space-3); border: 1px solid var(--border-strong); border-radius: var(--r-s);
  background: var(--bg); color: var(--text); font: 500 1.25rem/1 var(--nt-font-mono);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.pair-input:focus-visible { outline: 2px solid var(--nt-focus-ring); outline-offset: 1px; }
.pair-facts { display: grid; grid-template-columns: auto 1fr; gap: var(--nt-space-2) var(--nt-space-4); margin: 0; }
.pair-facts dt { color: var(--muted); }
.pair-facts dd { margin: 0; overflow-wrap: anywhere; }
.pair-name { font-weight: var(--nt-weight-body-strong); }
.pair-code { font: 500 1.4rem/1.1 var(--nt-font-mono); letter-spacing: 0.08em; }
.pair-warning {
  margin: 0; padding: var(--nt-space-2) var(--nt-space-3); border: 1px solid var(--warn); border-radius: var(--r-s); color: var(--warn);
  line-height: 1.4;
}
.pair-note { margin: 0; color: var(--muted); font-size: 0.875rem; }
.pair-message { margin: 0; padding: var(--nt-space-2) var(--nt-space-3); border-radius: var(--r-s); line-height: 1.4; }
.pair-message-error { border: 1px solid var(--danger); color: var(--danger); }
.pair-message-done { border: 1px solid var(--border); background: var(--panel-2); color: var(--text); }
.pair-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--nt-space-3); }

main {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
}

/* -- generic layout -- */
.page { padding: var(--nt-space-4); height: 100%; }
.page.full { padding: 0; }
/* List pages: the content column is only as wide as its widest child (the table)
   and is centred on wide screens, so a narrow table is not stranded on the left
   while heading/filters stay flush-left with it. */
.page:not(.full) { width: fit-content; max-width: 100%; margin-inline: auto; }

/* Drafts: a full-width batch-controls bar above the drafts collection table.
   Fields grow to share the row so no empty space is left beside them; the page
   shrinks to its widest child (the table) and is centred via the rule above. */
.gen-controls { margin: var(--nt-space-2) 0 var(--nt-space-5); }
.gen-controls h2 { margin: 0 0 var(--nt-space-2); font-size: 1rem; }
.gen-controls .gen-field { flex: 1 1 8rem; }
.gen-controls .gen-field select, .gen-controls .gen-field input { width: 100%; }
.gen-collection { margin-top: var(--nt-space-2); }
.split { display: grid; grid-template-columns: 340px 1fr; height: 100%; min-height: 0; }
.panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow: auto;
  padding: var(--nt-space-4);
}
.panel h2 { margin: 0 0 var(--nt-space-3); font-size: 1rem; }
.map-wrap { position: relative; height: 100%; }
.map-wrap > div { height: 100%; width: 100%; }
#map, .leaflet-map { height: 100%; width: 100%; }
#map .map-tour-route { transition: opacity 120ms ease; }
.map-start-marker, .map-end-marker { background: transparent; border: 0; transition: opacity 120ms ease; }
.route-direction-arrow { background: transparent; border: 0; pointer-events: none; }
.route-direction-arrow span {
  display: block;
  height: 18px;
  position: relative;
  transform-origin: center;
  width: 22px;
}
.route-direction-arrow span::before,
.route-direction-arrow span::after {
  background: var(--route-arrow-color);
  border-radius: var(--r-xs);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--nt-white) 85%, transparent), 0 1px 2px color-mix(in srgb, var(--nt-tiefschwarz) 55%, transparent);
  content: "";
  height: 3px;
  position: absolute;
  right: 2px;
  top: 8px;
  transform-origin: right center;
  width: 14px;
}
.route-direction-arrow span::before { transform: rotate(32deg); }
.route-direction-arrow span::after { transform: rotate(-32deg); }
/* The avoided spot: a dot like the canvas one it replaced (7 px radius, white 1.5 px halo), with a 48 px reach for a thumb. */
.map-nogo-marker { background: transparent; border: 0; }
.map-nogo-marker span { display: block; width: 100%; height: 100%; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--nt-white); opacity: 0.95; }
.map-nogo-marker::before { content: ""; position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; transform: translate(-50%, -50%); }
.map-start-marker { width: 16px !important; height: 16px !important; border-radius: 50%; background: var(--success); border: 2px solid var(--nt-white); box-shadow: 0 1px 4px color-mix(in srgb, var(--nt-tiefschwarz) 55%, transparent); }
.map-end-marker { width: 18px !important; height: 18px !important; border-radius: 50%; background-color: var(--flag-light); background-image: linear-gradient(45deg, var(--flag-dark) 25%, transparent 25%, transparent 75%, var(--flag-dark) 75%), linear-gradient(45deg, var(--flag-dark) 25%, transparent 25%, transparent 75%, var(--flag-dark) 75%); background-position: 0 0, 4px 4px; background-size: 8px 8px; border: 2px solid var(--nt-white); box-shadow: 0 1px 4px color-mix(in srgb, var(--nt-tiefschwarz) 55%, transparent); }

h2, h3, h4, b, strong, th { font-weight: var(--nt-weight-body-strong); }
h1 { font-family: var(--nt-font-display); font-weight: var(--nt-weight-heading); font-size: var(--t-title); line-height: 1.25; margin: 0 0 var(--nt-space-4); }
h3 { margin: var(--nt-space-4) 0 var(--nt-space-2); font-size: 0.95rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.settings-page { width: min(760px, 100%); }
.settings-eyebrow { margin: 0 0 var(--nt-space-1); color: var(--muted); font-size: 0.72rem; font-weight: var(--nt-weight-body-strong); text-transform: uppercase; }
.settings-section { border-top: 1px solid var(--border); padding-top: var(--nt-space-4); margin-top: var(--nt-space-5); }
.settings-section h2 { margin: 0 0 var(--nt-space-3); font-size: 1rem; }
.settings-section .checkline { color: var(--text); font-size: 0.9rem; }
.settings-section p { margin: var(--nt-space-1) 0 0; }

/* -- forms -- */
label { display: block; margin: var(--nt-space-2) 0 var(--nt-space-1); color: var(--muted); font-size: 0.8rem; }
input, select, textarea {
  font-family: inherit;
  width: 100%;
  padding: var(--nt-space-2) var(--nt-space-2);
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-s);
  color: var(--text);
  font-size: 0.85rem;
}
/* One checkbox (docs/design/components/controls.md): an empty box in --border-strong, ticked it is the selected look (the 2 px border takes the edge) with the tick in --sel-fg.
   The switch of a table's toggle draws its own track and is not one. */
input[type="checkbox"]:not(.route-climbs-switch-input) {
  appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; flex: none; box-sizing: border-box; width: 18px; height: 18px; margin: 0;
  border: 2px solid var(--border-strong); border-radius: var(--r-xs); background: transparent; color: var(--sel-fg); vertical-align: middle; cursor: pointer;
}
input[type="checkbox"]:not(.route-climbs-switch-input)::after { content: ""; width: 4px; height: 9px; margin-top: -2px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform 90ms ease; }
input[type="checkbox"]:not(.route-climbs-switch-input):checked { border-color: var(--sel-border); background: var(--sel-bg); }
input[type="checkbox"]:not(.route-climbs-switch-input):checked::after { transform: rotate(45deg) scale(1); }
input[type="checkbox"]:not(.route-climbs-switch-input):disabled { border-color: var(--nt-disabled-fg); cursor: default; }
input[type="checkbox"]:not(.route-climbs-switch-input):checked:disabled { border-color: var(--nt-disabled-bg); background: var(--nt-disabled-bg); color: var(--nt-disabled-fg); }
@media (prefers-reduced-motion: reduce) { input[type="checkbox"]::after { transition: none; } }
.row { display: flex; gap: var(--nt-space-2); }
.row > * { flex: 1; }
/* The whole line is the target (48 px), the box big enough to see it ticked. */
.checkline { display: flex; align-items: center; gap: var(--nt-space-3); margin: var(--nt-space-1) 0; min-height: 48px; cursor: pointer; }
.checkline input[type="checkbox"] { width: 22px; height: 22px; }
.checkline label { margin: 0; color: var(--text); }
.checkline.disabled, .checkline.disabled label { color: var(--nt-disabled-fg); cursor: default; }

/* Compact inline drafts form (drafts page): fields keep a fixed width
   instead of stretching across the full-width page. */
.gen-form { margin-bottom: var(--nt-space-3); }
.gen-form summary { cursor: pointer; font-weight: var(--nt-weight-body-strong); }
.gen-grid { display: flex; flex-wrap: wrap; gap: var(--nt-space-2) var(--nt-space-4); align-items: end; margin-top: var(--nt-space-2); }
.gen-field { display: flex; flex-direction: column; }
.gen-field label { margin: 0 0 0.15rem; }
.gen-field select { width: 9rem; }
.gen-field input { width: 6rem; }
.gen-field.wide select, .gen-field.wide input { width: 12rem; }
.gen-actions { display: flex; align-items: center; gap: var(--nt-space-3); margin-top: var(--nt-space-3); flex-wrap: wrap; }
.gen-progress { display: flex; align-items: center; gap: var(--nt-space-2); margin-top: var(--nt-space-2); }
.gen-progress-bar { width: 16rem; max-width: 100%; }
.advanced { margin-top: var(--nt-space-2); }
.advanced summary { font-weight: var(--nt-weight-body); color: var(--muted); font-size: 0.8rem; }

/* A bare button draws no box: a component styles its own, and a plain action names one of the three kinds below
   (docs/design/components/buttons.md). tests/test_webui_buttons.py holds that no <button> stays without either. */
button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  border-radius: 0;
  font-weight: var(--nt-weight-body-strong);
  font-size: 0.85rem;
}
.btn-filled, .btn-tonal, .btn-text {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--nt-space-2); min-height: 40px; padding: 0 var(--nt-space-5); position: relative;
  border: 0; border-radius: var(--r-full); font: inherit; font-size: var(--t-label); font-weight: var(--nt-weight-body-strong); text-decoration: none; cursor: pointer;
}
/* The pill is 40 px; the touch target is 48 px (a transparent strip above and below). Every pill is built this way on every width and in
   every dialog: no rule makes one 48 px to see. */
.btn-filled::after, .btn-tonal::after, .btn-text::after, .chip::after, .filter-chip::after, .order-toggle::after { content: ""; position: absolute; inset: min(0px, calc((100% - 48px) / 2)) 0; }
/* A pill never stretches to a taller neighbour (a 48 px field, an icon button): it stays 40 px and centres. */
.btn-filled, .btn-tonal, .btn-text, .chip, .filter-chip, .order-toggle { align-self: center; }
.btn-filled[hidden], .btn-tonal[hidden], .btn-text[hidden], .btn-filled.hidden, .btn-tonal.hidden, .btn-text.hidden { display: none; }
.btn-filled { background: var(--accent); color: var(--on-accent); }
.btn-tonal { background: var(--btn-neutral); color: var(--text); }
.btn-text { padding: 0 var(--nt-space-3); background: transparent; color: var(--link); }
.btn-text.btn-danger { color: var(--danger); }
.btn-text.btn-neutral { color: var(--text); }
.btn-small { min-height: 36px; padding: 0 var(--nt-space-3); font-size: var(--t-label); }

/* -- the state model: one rule set for every control (docs/design/components/controls.md#one-state-model) --
   Hover (a pointer only) is a layer of the control's own content colour at 8 % over its fill, pressed and keyboard focus 10 %, drawn as a
   background image so the fill underneath stays whatever the control's kind gives it. A filled accent control presses to --nt-accent-hover.
   The focus ring is the one :focus-visible rule of nt-tokens.css. A disabled control keeps its size and place and wears the disabled
   tokens at full opacity: a dimmed colour changes with the ground under it, a token does not. No component sets a hover or pressed colour. */
@media (hover: hover) {
  :is(.btn-filled, .btn-tonal, .btn-text, .chip, .filter-chip, .segmented > .segment, .order-toggle, .row-item, .row-btn, .map-menu-row,
    .tool-row, .search-hit, .rt-opt, .update-go, .update-close, .snackbar-action, .chooser-row, .col-climb-row, .surfaces-jump, .desc-add, .share-copy,
    .tour-title-pencil, .speed-chip:not(.static) .speed-pill, .round-btn:not(:is(.map-tools, .locate-col, .map-search) .round-btn),
    a.card, button.card, .coll-card, .surfaces-stretch-row, tbody tr):not(:disabled, [aria-disabled="true"]):hover {
    background-image: linear-gradient(var(--layer-hover), var(--layer-hover));
  }
  :is(.icon-btn, .surfaces-legend > button.surfaces-chip, :is(.map-tools, .locate-col, .map-search) .round-btn):not(:disabled, [aria-disabled="true"]):hover::before { background-image: linear-gradient(var(--layer-hover), var(--layer-hover)); }
  .action-tile:not(:disabled, [aria-disabled="true"]):hover .action-tile-icon { background-image: linear-gradient(var(--layer-hover), var(--layer-hover)); }
  .leaflet-bar.leaflet-control-zoom a:not(.leaflet-disabled):hover { background-image: linear-gradient(var(--layer-hover), var(--layer-hover)); }
}
:is(.btn-filled, .btn-tonal, .btn-text, .chip, .filter-chip, .segmented > .segment, .order-toggle, .row-item, .row-btn, .map-menu-row,
    .tool-row, .search-hit, .rt-opt, .update-go, .update-close, .snackbar-action, .chooser-row, .col-climb-row, .surfaces-jump, .desc-add, .share-copy,
    .tour-title-pencil, .speed-chip:not(.static) .speed-pill, .round-btn:not(:is(.map-tools, .locate-col, .map-search) .round-btn),
    a.card, button.card, .coll-card, .surfaces-stretch-row, tbody tr, .stage-card, .week-card):not(:disabled, [aria-disabled="true"]):is(:active, :focus-visible) {
  background-image: linear-gradient(var(--layer-press), var(--layer-press));
}
:is(.icon-btn, .surfaces-legend > button.surfaces-chip, :is(.map-tools, .locate-col, .map-search) .round-btn):not(:disabled, [aria-disabled="true"]):is(:active, :focus-visible)::before { background-image: linear-gradient(var(--layer-press), var(--layer-press)); }
.action-tile:not(:disabled, [aria-disabled="true"]):is(:active, :focus-visible) .action-tile-icon { background-image: linear-gradient(var(--layer-press), var(--layer-press)); }
.btn-filled:not(:disabled, [aria-disabled="true"]):active { background-image: none; background-color: var(--nt-accent-hover); }
/* A map disc's ring sits just outside the 40 px disc inside its 48 px box. */
:is(.map-tools, .locate-col, .map-search) .round-btn:focus-visible { outline-offset: -2px; }
button:disabled, :is(a, input, select, [role="button"], [role="menuitem"], [role="tab"], [role="radio"], [role="switch"])[aria-disabled="true"] { color: var(--nt-disabled-fg); cursor: default; }
.btn-filled:disabled, .btn-tonal:disabled, .btn-filled[aria-disabled="true"], .btn-tonal[aria-disabled="true"] { background-color: var(--nt-disabled-bg); color: var(--nt-disabled-fg); }
.btn-text:disabled, .btn-text.btn-danger:disabled, .btn-text[aria-disabled="true"], .btn-text.btn-danger[aria-disabled="true"] { color: var(--nt-disabled-fg); }

/* -- tables -- */
/* Responsive: the wrapper shrinks to the table's content but never exceeds the
   available width; only the title column is capped and truncated when long. */
.table-wrap {
  overflow: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  width: fit-content;
  max-width: 100%;
}
/* The sentinel of a long table (util.js sortableTable): it only has to exist to be seen near the viewport. */
.table-more { height: 1px; }
table { width: auto; border-collapse: collapse; }
th, td { padding: var(--nt-space-2) var(--nt-space-3); text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tours-table { width: 72rem; table-layout: fixed; }
.tours-table th:nth-child(1), .tours-table td:nth-child(1) { width: 6rem; }
.tours-table th:nth-child(2), .tours-table td:nth-child(2) { width: 5rem; }
.tours-table th:nth-child(3), .tours-table td:nth-child(3) { width: 24rem; }
.tours-table th:nth-child(4), .tours-table td:nth-child(4) { width: 7rem; }
.tours-table th:nth-child(5), .tours-table td:nth-child(5) { width: 8.5rem; }
.tours-table th:nth-child(6), .tours-table td:nth-child(6) { width: 6rem; }
.tours-table th:nth-child(7), .tours-table td:nth-child(7) { width: 9.5rem; }
.tours-table th:nth-child(8), .tours-table td:nth-child(8) { width: 6.5rem; }
.id-cell { color: var(--muted); font-family: var(--nt-font-mono); font-size: 0.72rem; }
th.title-cell, td.title-cell { max-width: 24rem; overflow-wrap: anywhere; }
th {
  position: sticky; top: 0;
  background: var(--panel);
  cursor: pointer;
  user-select: none;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.filter-row td {
  position: sticky; top: 2.1rem;
  background: var(--panel);
  padding: var(--nt-space-1) var(--nt-space-2);
  cursor: default;
}
.filter-row input[type="search"], .filter-row select {
  width: 100%;
  min-width: 5.5rem;
  font-size: 0.78rem;
  padding: var(--nt-space-1) var(--nt-space-1);
}
.filter-row .checkline { margin: 0; font-size: 0.75rem; white-space: nowrap; }
.toolbar { display: flex; gap: var(--nt-space-2); align-items: center; margin-bottom: var(--nt-space-3); flex-wrap: wrap; }
.toolbar input[type="search"] { max-width: 260px; }
.spacer { flex: 1; }

/* Row selection + bulk-action bar (drafts table). */
.select-cell { width: 1%; white-space: nowrap; text-align: center; cursor: default; }
.summary-row { display: flex; align-items: center; gap: var(--nt-space-3); margin: var(--nt-space-1) 0 var(--nt-space-2); min-height: 1.9rem; }
.bulk-bar { display: flex; align-items: center; gap: var(--nt-space-2); }

/* -- badges & chips -- */
.badge {
  display: inline-block;
  padding: 0.1rem var(--nt-space-2);
  border-radius: var(--r-full);
  font-size: 0.72rem;
  font-weight: var(--nt-weight-body-strong);
}
.badge.g1 { background: var(--btn-neutral); color: var(--text); }
.badge.g2, .badge.moderate { background: var(--nt-info-subtle); color: var(--nt-info-text); }
.badge.easy, .badge.ok { background: var(--nt-success-subtle); color: var(--nt-success-text); }
.badge.hard, .badge.warn { background: var(--nt-warning-subtle); color: var(--nt-warning-text); }
.badge.very_hard, .badge.no { background: var(--nt-error-subtle); color: var(--nt-error-text); }
.badge.used { background: var(--border); color: var(--muted); }
.badge.incidental { background: var(--panel-2); color: var(--muted); font-weight: var(--nt-weight-body-strong); }

/* -- surface breakdown (draft detail): asphalt vs. loose ground, from BRouter way tags -- */
.surfaces-body.muted { font-size: 0.85rem; }
.surfaces-ok-badge,
.surfaces-unsuitable-badge,
.surfaces-push-badge {
  display: block;
  width: fit-content;
  margin: 0 0 var(--nt-space-2);
  padding: var(--nt-space-1) var(--nt-space-2);
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.78rem;
}
/* The road-bike verdict speaks in words and a warning icon, in neutral ink: red, amber and green were the colours of a traffic light on a
   sheet that is already orange (his word, 2026-11-23). Only "all rideable" is quieter still. */
.surfaces-ok-badge { border-color: var(--border); color: var(--muted); }
/* A badge that frames its stretches in the map (surface-marks.js): 44 px to hit, the look stays the badge's. */
.surfaces-jump {
  display: flex; align-items: center; gap: var(--nt-space-2); width: 100%; min-height: 44px; padding: 0;
  background: none; border: 0; border-radius: var(--r-s); color: inherit; font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.surfaces-jump .badge { margin: 0; }
.surfaces-jump.active { background: var(--sel-bg); color: var(--sel-fg); box-shadow: var(--sel-ring); }
.surfaces-jump-count { margin-left: auto; padding-right: var(--nt-space-2); font-size: 0.8rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.surfaces-jump.active .surfaces-jump-count { color: var(--sel-fg); font-weight: var(--nt-weight-body-strong); }
/* The stretch just framed: its segments of the route line itself (surface-marks.js cuts them out of the line) swell and fade into the
   casing under them, three times, 1.5 s. `--flash-w` is the line's width at the zoom, set by the script. */
@keyframes surface-pulse {
  0%, 100% { stroke-opacity: 1; stroke-width: var(--flash-w); }
  50% { stroke-opacity: 0.2; stroke-width: calc(var(--flash-w) * 1.5); }
}
.surface-pulse { animation: surface-pulse 0.5s ease-in-out 3; }
@media (prefers-reduced-motion: reduce) { .surface-pulse { animation: none; } }
.surfaces-bar {
  display: flex;
  width: 100%;
  height: 0.85rem;
  border-radius: var(--r-full);
  overflow: hidden;
  border: 1px solid var(--border);
}
.surfaces-bar-seg { height: 100%; }
/* Grey and a pattern, never a hue: paved solid, cobbles dotted, firm hatched, loose cross-hatched, unknown hollow. The list speaks in
   grey; the map does not: the route line shows the ground in its own dashes (surface-marks.js). */
.surfaces-paved { background: var(--surf-ink); }
.surfaces-cobbles { background: radial-gradient(circle at 50% 50%, var(--surf-ink) 0 1.1px, transparent 1.5px) 0 0 / 4px 4px, var(--panel-2); }
.surfaces-firm { background: repeating-linear-gradient(45deg, var(--surf-ink) 0 1.5px, transparent 1.5px 4px), var(--panel-2); }
.surfaces-loose {
  background:
    repeating-linear-gradient(45deg, var(--surf-ink) 0 1.5px, transparent 1.5px 4px),
    repeating-linear-gradient(-45deg, var(--surf-ink) 0 1.5px, transparent 1.5px 4px),
    var(--panel-2);
}
.surfaces-unknown { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--surf-ink); }
/* Below the bar, the kinds of ground side by side as chips (colour, name, km), not a list under each other (his call). A chip
   is 32 px to see and 44 px to hit; one with stretches on the line is a button with an outline and, after a tap, "2/5". */
.surfaces-legend { display: flex; flex-wrap: wrap; gap: 0 var(--nt-space-2); margin-top: var(--nt-space-1); font-size: 0.82rem; }
.surfaces-chip-body { display: inline-flex; align-items: center; gap: var(--nt-space-2); }
.surfaces-legend > .surfaces-chip {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: var(--nt-space-2); width: auto; min-height: 44px; padding: 0 var(--nt-space-3);
  border: 0; border-radius: 0; background: none; color: var(--muted); font: inherit; white-space: nowrap;
}
.surfaces-legend > .surfaces-chip::before { content: ""; position: absolute; inset: 6px 0; z-index: -1; border-radius: var(--r-m); }
.surfaces-chip-value { color: var(--text); font-weight: var(--nt-weight-body-strong); font-variant-numeric: tabular-nums; }
.surfaces-legend > button.surfaces-chip { color: var(--text); cursor: pointer; }
.surfaces-legend > button.surfaces-chip::before { border: 1px solid var(--border); background: var(--panel); }
.surfaces-legend > button.surfaces-chip.active { background: none; }
.surfaces-legend > button.surfaces-chip.active { color: var(--sel-fg); }
.surfaces-legend > button.surfaces-chip.active::before { background: var(--sel-bg); border-color: var(--sel-border); box-shadow: inset 0 0 0 0.5px var(--sel-border); }
.surfaces-legend > button.surfaces-chip.active .surfaces-chip-value { color: var(--sel-fg); }
.surfaces-legend > .surfaces-chip .surfaces-jump-count { margin: 0; padding: 0; color: var(--text); font-weight: var(--nt-weight-body-strong); }
.surfaces-legend > button.surfaces-chip.active .surfaces-jump-count { color: var(--sel-fg); }
.surfaces-legend > .surfaces-chip .surfaces-jump-count:empty { display: none; }
.surfaces-swatch {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: var(--r-xs);
  flex: none;
}
.surfaces-stretches { display: grid; gap: var(--nt-space-1); margin-top: var(--nt-space-2); }
.surfaces-stretch-row {
  display: flex;
  align-items: center;
  gap: var(--nt-space-2);
  padding: var(--nt-space-1) var(--nt-space-2);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  font-size: 0.8rem;
  cursor: pointer;
}
.surfaces-stretch-row::after { content: "\2192"; margin-left: auto; color: var(--muted); }
.surfaces-stale {
  margin-top: var(--nt-space-2);
  padding: var(--nt-space-1) var(--nt-space-2);
  border-left: 2px solid var(--warn);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* -- a draft that did not clear the release gates -- */
.gate-notice {
  margin: var(--nt-space-2) 0 0;
  padding: var(--nt-space-2) var(--nt-space-3);
  border: 1px solid var(--warn);
  border-left-width: 3px;
  border-radius: var(--r-s);
  background: var(--panel-2);
  color: var(--warn);
  font-size: 0.8rem;
  line-height: 1.45;
}
.gate-notice strong { font-weight: var(--nt-weight-body-strong); }
.gate-notice ul { margin: var(--nt-space-1) 0 0; padding-left: var(--nt-space-4); }
.gate-notice li { margin: 0.1rem 0; }
.catalog-gap { margin: 0 0 var(--nt-space-2); line-height: 1.45; }
.catalog-gap strong { color: var(--warn); }

/* -- catalog health: a road written down twice -- */
.catalog-health {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--nt-space-2) var(--nt-space-3);
  margin: 0 0 var(--nt-space-3); padding: var(--nt-space-3) var(--nt-space-4); line-height: 1.45;
  background: var(--panel-2);
  border: 1px solid var(--warn); border-left-width: 4px; border-radius: var(--r-s);
}
.catalog-health strong { color: var(--warn); }
.gen-scope { margin: calc(-1 * var(--nt-space-1)) 0 var(--nt-space-3); line-height: 1.45; }
.start-collection { align-items: center; gap: var(--nt-space-2); margin-bottom: var(--nt-space-1); }
.start-collection label { min-width: 8rem; }
.start-collection select { flex: 0 1 20rem; }
.catalog-health span { flex: 1 1 22rem; color: var(--muted); font-size: 0.9rem; }
.catalog-health button { flex: none; }

.twin-modal .twin-lede { margin: 0 0 var(--nt-space-4); color: var(--muted); line-height: 1.5; }
.twin-sides { display: grid; grid-template-columns: 1fr 1fr; gap: var(--nt-space-3); }
.twin-side {
  display: flex; gap: var(--nt-space-2); align-items: flex-start;
  padding: var(--nt-space-2) var(--nt-space-3); border: 1px solid var(--border);
  border-radius: var(--r-s); background: var(--panel-2);
}
.twin-swatch { width: 12px; height: 12px; border-radius: var(--r-xs); margin-top: var(--nt-space-1); flex: none; }
.twin-name { font-weight: var(--nt-weight-body-strong); }
.twin-facts { font-size: 0.82rem; margin-top: 0.15rem; }
.twin-why { font-size: 0.78rem; margin-top: var(--nt-space-1); color: var(--muted); }
.twin-legend { display: flex; flex-wrap: wrap; gap: var(--nt-space-2) var(--nt-space-4); margin: calc(-1 * var(--nt-space-1)) 0 var(--nt-space-1); font-size: 0.82rem; color: var(--muted); }
.twin-legend-item { display: inline-flex; align-items: center; gap: var(--nt-space-1); }
.twin-legend .twin-swatch { margin-top: 0; }
.twin-evidence {
  margin: var(--nt-space-3) 0 0; padding: var(--nt-space-2) var(--nt-space-3);
  background: var(--panel-2); border-radius: var(--r-s);
  font-size: 0.88rem; color: var(--text);
}
.twin-note { margin: var(--nt-space-2) 0 0; color: var(--warn); font-size: 0.88rem; line-height: 1.45; }
.twin-modal .modal-actions { flex-wrap: wrap; }
@media (max-width: 700px) {
  .twin-sides { grid-template-columns: 1fr; }
}

/* -- layer control -- */
.layer-toggle { display: flex; align-items: center; gap: var(--nt-space-2); padding: var(--nt-space-1) 0; }
.layer-toggle .swatch { width: 14px; height: 14px; border-radius: var(--r-xs); flex: none; border: 1px solid color-mix(in srgb, var(--nt-tiefschwarz) 25%, transparent); }
.layer-toggle .count { margin-left: auto; color: var(--muted); font-size: 0.75rem; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--nt-space-3); }
.legend .layer-toggle { padding: var(--nt-space-1) 0; }
.legend label { margin: 0; font-size: 0.78rem; }

/* Permanent climb name labels on the map. */
.leaflet-tooltip.climb-label {
  background: color-mix(in srgb, var(--nt-asphalt) 85%, transparent);
  color: var(--nt-white);
  border: none;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--nt-tiefschwarz) 40%, transparent);
  font-weight: var(--nt-weight-body-strong);
  font-size: 0.72rem;
  padding: 1px var(--nt-space-1);
}
.leaflet-tooltip.climb-label::before { display: none; }

/* Permanent col name labels: rectangular speech bubble whose corner tail
   touches the col dot below-left. */
.leaflet-tooltip.col-label {
  background: color-mix(in srgb, var(--nt-asphalt) 85%, transparent);
  color: var(--nt-white);
  border: none;
  box-shadow: 0 1px 4px color-mix(in srgb, var(--nt-tiefschwarz) 40%, transparent);
  font-weight: var(--nt-weight-body-strong);
  font-size: 0.72rem;
  padding: 1px var(--nt-space-1);
  cursor: pointer;
}
.leaflet-tooltip.col-label::before { display: none; }
.leaflet-tooltip.col-label::after {
  content: "";
  position: absolute;
  left: -5px;
  bottom: -8px;
  border-width: 8px 9px 0 0;
  border-style: solid;
  border-color: color-mix(in srgb, var(--nt-asphalt) 85%, transparent) transparent transparent transparent;
}
.hide-col-labels .leaflet-tooltip.col-label { display: none; }

/* A scan area's label ("Scan 42 % · noch etwa 6 min") and the popup of a failed one. */
.leaflet-tooltip.scan-label {
  background: color-mix(in srgb, var(--nt-asphalt) 88%, transparent);
  color: var(--nt-white);
  border: 1px solid var(--c-scan);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--nt-tiefschwarz) 40%, transparent);
  font-weight: var(--nt-weight-body-strong);
  font-size: 0.78rem;
  padding: 2px var(--nt-space-2);
  white-space: nowrap;
}
.leaflet-tooltip.scan-label::before { display: none; }
.scan-popup p { margin: 0 0 var(--nt-space-2); }
.scan-popup .scan-retry { width: 100%; }

/* Small round color marker inline in a row (e.g. climb color in a col's climb list). */
.climb-swatch { flex: none; align-self: center; width: 10px; height: 10px; border-radius: 50%; }
.col-climb-entry { border-top: 1px solid var(--border); padding: var(--nt-space-2) 0; }
.col-climb-jump { flex: 0 0 auto; }

/* Read-only climb row (draft detail): name without the tour's edit inputs. */
.climb-row-name { align-self: center; font-weight: var(--nt-weight-body-strong); }

/* Route climbs are a compact, clickable data table. */
.route-climbs-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--nt-space-2); }
.route-climbs-heading h3 { margin: 0; }
.route-climbs-switch { display: inline-flex; align-items: center; gap: var(--nt-space-1); color: var(--muted); font-size: 0.72rem; cursor: pointer; white-space: nowrap; }
.route-climbs-switch-input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.route-climbs-switch-track { position: relative; inline-size: 32px; block-size: 16px; border: 2px solid var(--border-strong); border-radius: var(--r-full); background: var(--panel-2); transition: background 150ms ease, border-color 150ms ease; }
.route-climbs-switch-track::after { content: ""; position: absolute; inset: 2px auto auto 2px; inline-size: 8px; block-size: 8px; border-radius: var(--r-full); background: var(--muted); transition: transform 150ms ease, background 150ms ease; }
.route-climbs-switch-input:checked + .route-climbs-switch-track { border-color: var(--link); background: var(--link); }
.route-climbs-switch-input:checked + .route-climbs-switch-track::after { background: var(--bg); transform: translateX(16px); }
.route-climbs-switch-input:focus-visible + .route-climbs-switch-track { outline: 2px solid var(--nt-focus-ring); outline-offset: 2px; }

.ride-history-scroll { max-height: 10rem; overflow-y: auto; scrollbar-gutter: stable; }
.ride-history-table { width: 100%; table-layout: fixed; font-size: 0.78rem; }
.ride-history-table th, .ride-history-table td { padding: var(--nt-space-1) var(--nt-space-2); }
.ride-history-table th { position: sticky; top: 0; z-index: 1; font-size: 0.68rem; }
.ride-history-table th:first-child, .ride-history-table td:first-child { width: 52%; }
.ride-direction { display: flex; align-items: center; gap: var(--nt-space-2); font-weight: var(--nt-weight-body-strong); }
.ride-direction.up { color: var(--c-climb); }
.ride-direction.down { color: var(--success-text); }


/* -- cards / stats -- */
.entity-id { color: var(--muted); font-family: var(--nt-font-mono); font-size: 0.72rem; margin: var(--nt-space-1) 0 var(--nt-space-3); }
.detail-header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--nt-space-2) var(--nt-space-4); margin: var(--nt-space-1) 0 var(--nt-space-2); }
.detail-header .entity-id { margin: 0; }
/* An icon of the set in a line of text: the size of the letters, the colour of the text. */
.inline-icon { display: inline-flex; line-height: 0; vertical-align: -0.2em; margin: 0 0.25em; }
.inline-icon:first-child { margin-left: 0; }
.inline-icon svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.row-chevron { display: inline-flex; line-height: 0; color: var(--muted); }
.row-chevron svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.entity-link { color: var(--link); text-decoration: none; font-weight: var(--nt-weight-body-strong); font-size: 0.85rem; }
@media (hover: hover) { .entity-link:hover { text-decoration: underline; } }
.quality-pass { color: var(--success-text); }
.quality-fail { color: var(--danger); }

/* -- detail drawer / modal -- */
/* The action sheet (docs/design/components/action-sheet.md): a bottom sheet with a scrim on a phone, a centred dialog
   400 px wide on the desktop. A grabber and the title with its X head it; the footer sits at the foot. */
.overlay {
  position: fixed; inset: 0;
  background: var(--scrim);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow);
  width: min(100vw, 560px);
  max-height: 90dvh;
  overflow: auto;
  padding: 0 var(--nt-space-4) calc(var(--nt-space-4) + var(--safe-b, 0px));
}
.modal-grabber, .modal-head { touch-action: none; }
.modal-grabber { display: block; width: 32px; height: 4px; margin: var(--nt-space-2) auto 0; border-radius: var(--r-xs); background: var(--border); }
.modal-head { display: flex; align-items: center; gap: var(--nt-space-2); min-height: 64px; }
.modal-head > h2 { flex: 1; min-width: 0; margin: 0; }
.modal-head > h2 { font-family: var(--nt-font-display); font-size: var(--t-title); line-height: 1.25; font-weight: var(--nt-weight-heading); }
.modal-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-right: calc(-1 * var(--nt-space-3)); padding: 0; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.modal-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 760px) and (min-height: 560px) {
  .overlay { align-items: center; }
  .modal { width: min(400px, 94vw); border-radius: var(--r-xl); }
  .modal.twin-modal { width: min(560px, 94vw); }
}
/* A phone's sheet rises from the bottom edge (Material 3 modal bottom sheet); the scrim fades in with it. */
@media (max-width: 759px), (max-height: 559px) {
  .overlay { animation: scrim-in 0.18s ease-out; }
  .overlay > .modal { animation: sheet-up 0.22s cubic-bezier(0.2, 0, 0, 1); }
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes scrim-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .overlay, .overlay > .modal { animation: none; } }
/* Only the Confirm is a dialog on the desktop: no grabber (a mouse has none) and no X, its footer answers (confirm.md). */
@media (min-width: 760px) and (min-height: 560px) {
  .overlay .modal-grabber, .overlay .modal-close { display: none; }
  .overlay .modal-head { min-height: 56px; padding-top: var(--nt-space-2); }
}
/* The desktop's anchored surface (docs/design/components/popover.md, surface.js): an element of the Popover API, in the top
   layer above the map, placed by CSS anchor positioning at the control that opened it. No scrim, no grabber, no X. Without
   anchoring (or without a trigger) it stands centred. A menu has rows and no title, a popover a title and a footer. */
.modal.anchored {
  position: fixed; inset: 0; margin: auto; box-sizing: border-box; height: fit-content;
  width: min(360px, calc(100vw - 16px)); max-height: calc(100dvh - 96px); padding: 0 var(--nt-space-4) var(--nt-space-4); overflow: auto;
  border: 1px solid var(--border); border-radius: var(--r-m); background: var(--panel); color: var(--text); box-shadow: var(--shadow);
  overscroll-behavior: contain;
}
.modal.anchored.anchored-menu { width: min(280px, calc(100vw - 16px)); padding: var(--nt-space-2) 0; }
.modal.anchored.speed-picker { width: min(320px, calc(100vw - 16px)); }
/* The panel it replaces was 340 px of content in a content box: four style chips stand on one row. */
.modal.anchored.layers-popover { width: min(372px, calc(100vw - 16px)); }
.modal.anchored.desc-sheet { width: min(480px, calc(100vw - 16px)); height: fit-content; display: block; }
.modal.anchored .modal-head { min-height: 48px; }
.modal.anchored .row-list { margin: 0 calc(-1 * var(--nt-space-4)); }
.modal.anchored-menu .row-list { margin: 0; }
.modal.anchored-menu .row-item { min-height: 48px; }
.modal.anchored .desc-area { height: 240px; flex: none; }
.modal.anchored.layers-popover h3 { margin: var(--nt-space-3) 0 var(--nt-space-1); }
@supports (position-area: top) {
  .modal.anchored[data-place] { position-anchor: --nt-anchor; inset: auto; margin: 0; position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline; }
  .modal.anchored[data-place="up"] { position-area: top span-right; margin-bottom: var(--nt-space-2); }
  .modal.anchored[data-place="below"] { position-area: bottom span-right; margin-top: var(--nt-space-2); }
  .modal.anchored[data-place="left"] { position-area: bottom span-left; margin-top: var(--nt-space-2); }
}
.modal-actions { display: flex; flex-wrap: wrap; gap: var(--nt-space-2); justify-content: flex-start; margin-top: var(--nt-space-4); }
.modal-actions > .btn-filled, .modal-actions > :only-child, .modal-actions > .btn-text.btn-danger { margin-left: auto; }
.confirm-body { margin: var(--nt-space-2) 0 0; color: var(--text); overflow-wrap: anywhere; }
.modal .mini-map { height: 380px; border-radius: var(--r-m); margin: var(--nt-space-3) 0; }
.entity-detail-section { min-width: 0; }
.entity-detail-section + .entity-detail-section { border-top: 1px solid var(--border); padding-top: var(--nt-space-4); }

/* -- elevation profile -- */
.elevation {
  position: relative;
  width: 100%;
  margin: var(--nt-space-3) 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: var(--nt-space-2) var(--nt-space-1) var(--nt-space-1);
  user-select: none;
}
.elevation { touch-action: pan-y; }
.elevation svg { display: block; width: 100%; height: auto; overflow: visible; cursor: crosshair; touch-action: pan-y; }
/* The grade as solid bands (docs/design/screens/tour.md, "Profile"): a stretch is filled from the line to the base in its band's
   colour --grade-N, with no fade. */
.ele-grade-0 { fill: var(--grade-0); }
.ele-grade-1 { fill: var(--grade-1); }
.ele-grade-2 { fill: var(--grade-2); }
.ele-grade-3 { fill: var(--grade-3); }
.ele-grade-4 { fill: var(--grade-4); }
.ele-plot { fill: var(--ele-plot); }
.ele-line { fill: none; stroke: var(--link); stroke-width: 1.5; stroke-linejoin: round; }
.ele-climb-band { fill: none; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.ele-grid { stroke: var(--muted); stroke-width: 1; opacity: 0.35; }
.ele-axis { fill: var(--muted); font-size: 10px; font-family: var(--nt-font-body); }
.ele-cursor { stroke: var(--text); stroke-width: 1; opacity: 0.8; }
.ele-dot { fill: var(--nt-white); stroke: var(--link); stroke-width: 2; }
/* The readout: the point's figures in the one order of stats.js, a gap between them and no separator. The strip is 16 px and keeps
   its room while hidden, so the figures are 12 px here, not the data line's 16. */
.ele-tooltip {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: var(--nt-space-3);
  height: 16px;
  line-height: 16px;
  padding: 0 var(--nt-space-3) 0 var(--nt-space-10);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  pointer-events: none;
}
.ele-tooltip .fig { font-size: 0.75rem; line-height: 16px; }
/* 0.8 em of 12 px is 9.6 px; the strip is 16 px high, so the unit may take 11 px. */
.ele-tooltip .fig .unit { font-size: 0.92em; }
/* hidden keeps its strip, so a scrub does not move the plot */
.ele-tooltip.hidden { display: flex !important; visibility: hidden; }

.muted { color: var(--muted); }
.hidden { display: none !important; }
.empty { color: var(--muted); padding: var(--nt-space-8); text-align: center; }

/* -- toast -- */
.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border);
  padding: var(--nt-space-2) var(--nt-space-4); border-radius: var(--r-m); box-shadow: var(--shadow);
  z-index: 2000; max-width: 80vw;
}
.toast.error { border-color: var(--nt-error); color: var(--danger); }
.toast.success { border-color: var(--nt-success); color: var(--success-text); }

/* -- map popups and tooltips (docs/design/components/map-content.md, "Map menu and popups"): Leaflet's white boxes in the app's surface -- */
.leaflet-popup-content-wrapper { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-m); box-shadow: var(--shadow); }
.leaflet-popup-tip { background: var(--panel); box-shadow: none; }
.leaflet-popup-content { margin: var(--nt-space-3) var(--nt-space-4); font-size: 0.82rem; line-height: 1.4; }
.leaflet-popup-content p { margin: 0 0 var(--nt-space-2); }
.leaflet-popup-content a { color: var(--link); }
.leaflet-popup:has(.leaflet-popup-close-button) .leaflet-popup-content { margin-right: var(--nt-space-10); }
.leaflet-container a.leaflet-popup-close-button { top: 0; right: 0; width: var(--tap); height: var(--tap); font: 22px/var(--tap) var(--nt-font-body); color: var(--muted); }
.leaflet-tooltip { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-s); box-shadow: var(--shadow); font-family: var(--nt-font-body); }
.leaflet-tooltip::before { display: none; }
/* The map menu: rows of the list-row shape (icon, label, optional second line), 48 px high, no browser button look. */
.map-menu-popup .leaflet-popup-content-wrapper { overflow: hidden; }
.map-menu-popup .leaflet-popup-content { margin: 0; }
.map-menu { display: flex; flex-direction: column; min-width: 208px; padding: var(--nt-space-1) 0; }
.map-menu-row { display: flex; align-items: center; gap: var(--nt-space-3); width: 100%; min-height: var(--tap); margin: 0; padding: var(--nt-space-2) var(--nt-space-4); background: transparent; border: 0; border-radius: 0; color: var(--text); font: inherit; font-size: 0.95rem; font-weight: var(--nt-weight-body-strong); text-align: left; cursor: pointer; }
/* the menu clips its rows, so the focus ring sits inside the row */
.map-menu-row:focus-visible { outline-offset: -2px; }
.map-menu-ico { flex: none; display: grid; place-items: center; width: 22px; height: 22px; color: var(--muted); }
.map-menu-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.map-menu-text { display: grid; min-width: 0; }
.map-menu-text small { color: var(--muted); font-size: 0.75rem; font-weight: var(--nt-weight-body); }
.map-menu-row.danger, .map-menu-row.danger .map-menu-ico { color: var(--danger); }
.map-menu-rule { margin: var(--nt-space-1) 0; border: 0; border-top: 1px solid var(--border); }

@media (max-width: 700px) {
  input:not([type="checkbox"]), select, textarea { min-height: 44px; }
  .checkline { min-height: 44px; }
  .split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(12rem, 42%) minmax(18rem, 1fr);
  }
  .split > .panel { border-right: 0; border-bottom: 1px solid var(--border); }
  .modal .mini-map { height: 240px; }
  .col-climb-fields {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  }
  .col-climb-fields select { grid-column: 2 / 3; }
  .col-climb-fields .col-climb-jump { grid-column: 3; justify-self: end; }
}

/* -- collections: editor sections, segmented choice, rhythm list -- */
.autosave-status { color: var(--muted); font-size: 0.75rem; min-width: 5.5rem; text-align: right; }
.coll-page { width: min(760px, 100%); }
.coll-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--nt-space-2) var(--nt-space-4); align-items: end; }
.coll-grid label { margin: var(--nt-space-1) 0 var(--nt-space-1); }
.coll-switch { display: flex; align-items: center; gap: var(--nt-space-2); margin: var(--nt-space-2) 0; }
.coll-switch .route-climbs-switch { font-size: 0.85rem; color: var(--text); }
.coll-change { display: flex; align-items: center; gap: var(--nt-space-2); margin: var(--nt-space-1) 0; }
.coll-change input { width: 6rem; }
/* A sentence with its number in it: "KW [14] bis KW [43]", "Strecken der letzten [40] Touren meiden". */
.coll-range { display: flex; align-items: center; flex-wrap: wrap; gap: var(--nt-space-2) var(--nt-space-2); margin: var(--nt-space-2) 0; }
.coll-page .coll-range input, .coll-page .field .coll-range input { flex: none; width: 4.5rem; }
.coll-switch .route-climbs-switch { margin: 0; }
/* A choice of a few: the track is full width. */
.coll-page .segmented { display: flex; width: 100%; }
.coll-map { height: 260px; margin-top: var(--nt-space-2); border: 1px solid var(--border); border-radius: var(--r-s); }
.coll-actions { display: flex; align-items: center; gap: var(--nt-space-3); flex-wrap: wrap; margin-top: var(--nt-space-2); }
.scan-state { display: flex; align-items: center; gap: var(--nt-space-2) var(--nt-space-3); flex-wrap: wrap; margin-top: var(--nt-space-2); }
.scan-state p { margin: 0; flex: 1 1 14rem; }
.scan-state p:empty { display: none; }
.scan-details { flex: 1 1 100%; }
.scan-details summary { display: flex; align-items: center; min-height: 48px; cursor: pointer; color: var(--muted); }
.scan-details-text { margin: 0; max-height: 12rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8rem; }
.coll-danger { border-top-color: var(--danger); }
.coll-table .num { text-align: right; }
.page a:not(.muted) { color: var(--link); }
.page a.row-btn, .page a.round-btn { color: var(--text); }
.page a.back-btn { color: var(--text); }
.coll-page .field, .modal .field { display: block; }
.coll-page .field > span, .modal .field > span { display: block; margin: var(--nt-space-2) 0 var(--nt-space-1); color: var(--muted); font-size: 0.8rem; }
.coll-grid .field > span { margin-top: var(--nt-space-1); }

/* Collection overview: totals, one map with every stage, the stage table. */
.page.stages-page:not(.full) { width: 100%; max-width: 64rem; }
.stage-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: var(--nt-space-2); margin-bottom: var(--nt-space-3); }
.stage-stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-s); padding: var(--nt-space-2) var(--nt-space-3); display: flex; flex-direction: column; gap: 0.1rem; }
.stage-stat-label { color: var(--muted); font-size: 0.75rem; }
.stage-stat strong { font-size: 1.05rem; }
.stage-map { height: 360px; margin-bottom: var(--nt-space-3); border: 1px solid var(--border); border-radius: var(--r-s); }
.stage-swatch { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; margin-right: var(--nt-space-2); }
.stage-table { width: 100%; }
.stage-table th, .stage-table td { padding-inline: var(--nt-space-2); }
@media (max-width: 700px) { .stage-map { height: 280px; } .stage-table { font-size: 0.85rem; } }

/* -- collection page: cards, field feedback -- */
.coll-page.wide { width: min(1100px, 100%); }
.coll-subtitle { margin: var(--nt-space-1) 0 var(--nt-space-2); }
.coll-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: var(--nt-space-3); }
.coll-card { display: block; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-m); padding: var(--nt-space-4) var(--nt-space-4); text-decoration: none; color: var(--text) !important; }
.coll-card h2 { margin: 0 0 var(--nt-space-1); font-size: 1.05rem; }
.coll-card p { margin: var(--nt-space-1) 0 0; font-size: 0.85rem; }
.coll-card-stats { color: var(--text); font-weight: var(--nt-weight-body-strong); margin-top: var(--nt-space-2) !important; }
.coll-card-warn { color: var(--warn); }
.coll-lede { margin: var(--nt-space-1) 0 var(--nt-space-4); }
.coll-list-page { width: min(900px, 100%); }
.field-error { display: block; min-height: 0; color: var(--danger); font-size: 0.78rem; }
.field-error:empty { display: none; }
.field-hint { display: block; color: var(--muted); font-size: 0.75rem; margin-top: var(--nt-space-1); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
.notice { border: 1px solid var(--border); border-radius: var(--r-s); padding: var(--nt-space-2) var(--nt-space-3); margin: var(--nt-space-2) 0; font-size: 0.85rem; background: var(--panel); }
.notice.warn { border-color: var(--warn); color: var(--warn); }
.autosave-status.saved { color: var(--success-text); }
.autosave-status.failed { color: var(--danger); }
.start-info { color: var(--muted); font-size: 0.8rem; }
.stage-editor-slot:empty { display: none; }
@media (max-width: 700px) { .coll-map { height: 220px; } }

.settings-page .field { display: block; }
.settings-page .field > span { display: block; margin: var(--nt-space-2) 0 var(--nt-space-1); color: var(--muted); font-size: 0.8rem; }
.dev-section > summary { cursor: pointer; font-weight: var(--nt-weight-body-strong); min-height: 48px; display: flex; align-items: center; }
.dev-section > summary small { display: block; color: var(--muted); font-weight: var(--nt-weight-body); font-size: 0.8rem; }
.gen-scope { margin: 0 0 var(--nt-space-3); line-height: 1.45; }
.coll-grid { align-items: start; }
.stage-table td:nth-child(2) { white-space: normal; min-width: 8rem; }
@media (max-width: 700px) {
  .stage-totals { grid-template-columns: repeat(2, 1fr); }
  .stage-table th, .stage-table td { padding-inline: var(--nt-space-1); font-size: 0.8rem; }
  .stage-table td:nth-child(2) { min-width: 6.5rem; }
  .stage-table td:last-child button { min-width: 40px; padding-inline: var(--nt-space-1); }
}

.panel-toggle { all: unset; display: flex; align-items: center; justify-content: space-between; width: 100%; cursor: default; }
.panel-toggle-chevron { display: none; }
@media (max-width: 700px) {
  .panel-toggle { cursor: pointer; min-height: 44px; }
  .panel-toggle-chevron { display: inline-block; width: 0.55rem; height: 0.55rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 120ms; }
  .panel.collapsed .panel-toggle-chevron { transform: rotate(-45deg); }
  .panel.collapsed > :not(h2) { display: none; }
  .panel.collapsed h2 { margin-bottom: 0; }
  .split:has(> .panel.collapsed) { grid-template-rows: auto 1fr; }
  .panel-toggle:focus-visible { outline: 2px solid var(--nt-focus-ring); outline-offset: 2px; }
}
.coll-page .stage-table { width: 100%; }

/* -- route points on the map (route.js): a 44 px target around a dot with a white ring -- */
.re-via { background: transparent; border: 0; display: grid; place-items: center; }
.re-via span { display: grid; place-items: center; width: 22px; height: 22px; margin: 0; border-radius: 50%; background: var(--c-routen); border: 3px solid var(--nt-white); box-shadow: 0 1px 4px color-mix(in srgb, var(--nt-tiefschwarz) 65%, transparent); color: var(--nt-white); font: 600 10px/1 var(--nt-font-body); letter-spacing: -0.02em; transition: width 0.1s, height 0.1s, font-size 0.1s; }
.re-via.re-start span { background: var(--c-start); }
.re-via.re-end span { background: var(--c-end); }
.re-via.re-climb span { background: var(--c-climb); width: 24px; height: 24px; font-size: 11px; letter-spacing: normal; transition: none; }
/* A, B and the numbered vias rest as a 22 px dot and grow to 26 px while hovered, pressed or carried; the lifted one sits on top. */
.re-via:not(.re-climb):is(:hover, :active, .leaflet-drag-target) span { width: 26px; height: 26px; font-size: 11px; }
@media (hover: hover) { .re-via:not(.re-climb):hover { z-index: 2000 !important; } }
/* The stop a click on the line would set: exactly that disc, ring and shadow included, only fainter, and never the pointer's target. */
.re-via.re-ghost { pointer-events: none; opacity: 0.6; }
.stage-gaps { margin: 0 0 var(--nt-space-2); padding: var(--nt-space-2) var(--nt-space-3) var(--nt-space-2) var(--nt-space-6); border: 1px solid var(--warn); border-radius: var(--r-s); color: var(--warn); font-size: 0.85rem; }
.gen-field select { text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 700px) { .gen-controls .gen-field.full-row { flex-basis: 100%; } }

/* -- legacy lists on a desktop: controls at the touch size, filters that do not widen the table -- */
@media (min-width: 701px) {
  :is(#view, #view-wide) select, :is(#view, #view-wide) input:not([type="checkbox"]):not([type="radio"]) { min-height: 48px; }
  :is(#view, #view-wide) .checkline { min-height: 48px; display: flex; align-items: center; gap: var(--nt-space-2); }
  table.cardable .filter-row input, table.cardable .filter-row select { width: 100%; min-width: var(--tap); max-width: 9rem; }
  table.cardable td { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  table.cardable td.title-cell { max-width: 24rem; }
}

/* -- one object chosen on the map (map-focus.js): the rest fades, the object and its badges on top; a tour's preview has no rest to fade (region.js) -- */
.nt-focused:not(.nt-previewing) :is(.leaflet-overlay-pane, .leaflet-col-pane, .leaflet-marker-pane, .leaflet-climbflag-pane) {
  opacity: 0.35; filter: grayscale(0.85); transition: opacity 120ms ease;
}
.leaflet-focus-pane svg { pointer-events: none; }
.focus-badge { background: transparent; border: 0; display: grid; place-items: center; pointer-events: none; }
.focus-badge span {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--nt-white);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--nt-tiefschwarz) 65%, transparent); color: var(--nt-white); font: 600 11px/1 var(--nt-font-body);
}
.focus-start span { background: var(--c-start); }
.focus-end span { background: var(--c-end); }
/* A climb's top is the chequered flag of every end marker, round like the badges. */
.focus-end span:empty {
  background-color: var(--flag-light);
  background-image: linear-gradient(45deg, var(--flag-dark) 25%, transparent 25%, transparent 75%, var(--flag-dark) 75%), linear-gradient(45deg, var(--flag-dark) 25%, transparent 25%, transparent 75%, var(--flag-dark) 75%);
  background-position: 0 0, 5px 5px; background-size: 10px 10px;
}
/* The flags every drawn climb carries (climbFlags): smaller than the focus badges. */
.climb-flag-tappable { pointer-events: auto; cursor: pointer; }
.climb-flag-tappable::after { content: ""; position: absolute; inset: -4px; }
.focus-mini span { width: 14px; height: 14px; border-width: 2px; box-shadow: 0 1px 3px color-mix(in srgb, var(--nt-tiefschwarz) 60%, transparent); }
.focus-foot span { background: var(--c-climb); width: 10px; height: 10px; border-width: 2px; }

/* -- the brand (docs/design/foundations/brand.md): the wordmark follows the theme, the name stays readable as text -- */
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wordmark { display: inline-flex; align-items: center; min-width: 0; }
.wm { display: block; height: 1.3rem; width: auto; max-width: 100%; }
.wm-on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wm-on-light { display: none; }
  :root:not([data-theme="light"]) .wm-on-dark { display: block; }
}
:root[data-theme="dark"] .wm-on-light { display: none; }
:root[data-theme="dark"] .wm-on-dark { display: block; }
.brand-login .wm { height: 1.9rem; margin-inline: auto; }
/* The small wordmark of every header: 0.8 rem high is 93 px wide, over the brand's 80 px floor; the row around it is the clear zone (brand.md). */
.wm-sm { height: 0.8rem; }

/* A raised surface is a --panel-2 card with controls in it. In dark the card and a neutral control are both Graphit, so inside it a
   tonal button, a chip and a disabled fill step one tier up. One rule for every such surface; a new one is added to the selector. */
.raised, .tool-card { --btn-neutral: var(--btn-neutral-raised); --nt-disabled-bg: var(--nt-disabled-bg-raised); }
