/* Trafficnetwork node web UI. Plain CSS, no build step. Colors are tokens; dark mode follows the system. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, 0.9);
  --ink: #17202e;
  --muted: #4d5a6d;
  --line: #d3d9e2;
  --accent: #0b5cd5;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --ok: #0a6b4b;
  --warn-bg: #fff4d6;
  --warn-ink: #5c3b00;
  --focus: #ff9d00;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.18);
  --shadow-lift: 0 2px 10px rgba(16, 24, 40, 0.28);
  --radius: 10px;
  --header-h: 52px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141b;
    --surface: #1a202b;
    --glass: rgba(26, 32, 43, 0.9);
    --ink: #e8ecf3;
    --muted: #a9b4c5;
    --line: #313a4a;
    --accent: #7db0ff;
    --accent-ink: #0b1220;
    --danger: #ff8a80;
    --ok: #5fd3a3;
    --warn-bg: #3a2e0d;
    --warn-ink: #ffe3a3;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    --shadow-lift: 0 2px 10px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
/* The map page is one screen: the map fills what header and banner leave, nothing scrolls (dvh: the visible height on a phone,
   without the browser's own bars). */
body.page-map { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 2000;
  background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: var(--radius); box-shadow: var(--shadow);
}
.skip-link:focus { top: 8px; }

button, .button {
  font: inherit; min-height: 44px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.button:hover { filter: brightness(1.08); }
/* "small" buttons stay 44 px tall where a thumb has to hit them (WCAG 2.5.8 asks for 24, Apple's guidance for 44). */
button.small { min-height: 44px; padding: 4px 12px; font-size: 0.9rem; }

/* ---------- header / footer ---------- */
/* body is a full-height column: header, banner and footer keep their natural height, the content gives way.
   Their height is reserved before the script fills them in, so nothing below them moves when it does. */
.site-header, .safety-banner, .site-footer { flex: 0 0 auto; }
#site-header { min-height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--line); }
#site-footer { min-height: 64px; }

.site-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 6px 12px; min-height: var(--header-h);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); font-size: 1.1rem; display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { display: block; height: 26px; width: auto; border-radius: 5px; }
.brand-accent { color: var(--accent); }
.site-nav { display: flex; gap: 4px; flex: 1 1 auto; }
.site-nav a { padding: 10px 10px; border-radius: var(--radius); text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; min-height: 44px; }
.site-nav a[aria-current="page"] { background: var(--bg); font-weight: 600; box-shadow: inset 0 -3px 0 var(--accent); }
.header-tools { display: flex; align-items: center; gap: 8px; }
@media (max-width: 640px) {
  /* row 1: name + language switch, row 2: navigation */
  .brand { order: 1; flex: 1 1 auto; }
  .header-tools { order: 2; }
  .site-nav { order: 3; flex: 1 1 100%; }
  .site-header, #site-header { gap: 0 8px; padding: 2px 12px; min-height: 96px; }
  .site-nav a { padding: 8px 10px; }
}

.safety-banner {
  background: var(--warn-bg); color: var(--warn-ink);
  padding: 6px 12px; font-size: 0.9rem; text-align: center; border-bottom: 1px solid var(--line);
}
#safety-banner { min-height: 2.3rem; }
@media (max-width: 640px) {
  #safety-banner { font-size: 0.8rem; line-height: 1.3; min-height: 3rem; padding: 4px 12px; }
}

.site-footer {
  display: grid; grid-template-columns: 1fr; justify-items: center; gap: 2px 18px; align-items: center;
  padding: 10px 12px; font-size: 0.9rem; color: var(--muted);
  background: var(--surface); border-top: 1px solid var(--line);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 0 18px; justify-content: center; }
.footer-links a, .footer-links span { display: inline-flex; align-items: center; min-height: 32px; }

/* "N online" at the bottom right (add-on O-B): a <details>, so the extra lines open on tap, click or Enter. It always
   keeps its place in the footer, so neither the first answer nor a changing number moves anything. */
.online-badge { position: relative; justify-self: end; font-size: 0.85rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.online-badge[hidden] { display: none; }
.online-badge[data-state="pending"], .online-badge[data-state="unavailable"] { visibility: hidden; }
.online-summary {
  display: inline-flex; align-items: center; gap: 6px; min-width: 8.5rem; min-height: 32px; padding: 2px 6px; justify-content: flex-end;
  cursor: pointer; list-style: none; border-radius: var(--radius); text-decoration: underline dotted; text-underline-offset: 3px;
}
.online-summary::-webkit-details-marker { display: none; }
.online-summary .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.online-detail {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 3000; width: min(21rem, 88vw); padding: 8px 12px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-align: left;
}
.online-detail p { margin: 4px 0; max-width: none; }
@media (min-width: 760px) {
  .site-footer { grid-template-columns: 1fr auto 1fr; }
  .footer-links { grid-column: 2; }
  .online-badge { grid-column: 3; grid-row: 1; }
}

/* ---------- content pages ---------- */
.page { width: 100%; max-width: 860px; margin: 0 auto; padding: 16px; flex: 1 0 auto; }
.page h1 { margin: 8px 0 4px; font-size: 1.7rem; }
.page h2 { margin: 28px 0 8px; font-size: 1.25rem; }
.page p, .page li { max-width: 68ch; }
.lead { color: var(--muted); font-size: 1.05rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 12px 0; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 8px; font-size: 1.15rem; }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card.highlight { border: 2px solid var(--accent); }
.card p:last-child { margin-bottom: 0; }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
pre.code {
  position: relative; margin: 8px 0; padding: 12px 44px 12px 12px; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  font: 0.85rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre;
}
pre.code button { position: absolute; top: 6px; right: 6px; min-height: 32px; padding: 2px 8px; font-size: 0.8rem; }
.join-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: start; }
@media (max-width: 640px) { .join-grid { grid-template-columns: minmax(0, 1fr); } }
.join-qr-box { background: #ffffff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; max-width: 260px; }
.join-qr { display: block; width: 100%; height: auto; }
pre.join-code { white-space: pre-wrap; word-break: break-all; padding-right: 12px; padding-bottom: 44px; }
pre.join-code button { top: auto; bottom: 6px; }
dl.facts.join-facts dt, dl.facts.join-facts dd { min-width: 0; overflow-wrap: anywhere; margin-inline-start: 0; }
@media (max-width: 640px) { dl.facts.join-facts { grid-template-columns: minmax(0, 1fr); } }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 8px 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.pill { display: inline-block; padding: 1px 10px; border-radius: 99px; border: 1px solid var(--line); font-size: 0.85rem; }
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.off { color: var(--muted); }
.repo-cta { display: inline-flex; align-items: center; gap: 8px; margin: 10px 0; font-weight: 600; }

/* ---------- map page ---------- */
/* Phone portrait (the default here): the map fills the whole area below the header and the sheet slides over its lower part.
   Wide screens and a phone on its side (see the media query below) use a side panel instead. The same <aside> is both. */
.map-layout { flex: 1 1 auto; position: relative; min-height: 0; }
#map-panel { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: var(--bg); contain: layout paint; }
#map:focus-visible { outline-offset: -3px; }
.map-overlay {
  position: absolute; z-index: 800; pointer-events: none; left: 8px; right: 68px; top: 8px;
  display: flex; gap: 8px; justify-content: flex-start; align-items: flex-start; flex-wrap: wrap;
}
.map-overlay > * { pointer-events: auto; }
.chip {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 99px;
  padding: 4px 12px; font-size: 0.85rem; box-shadow: var(--shadow);
}
/* Place search: a rounded bar on the map like a navigation app's, results under it. */
.place-search {
  position: relative; z-index: 2; flex: 1 1 100%; max-width: 440px; display: flex; align-items: center;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lift);
}
.place-search[hidden] { display: none; }
.place-search input[type="search"] {
  flex: 1 1 auto; min-width: 0; height: 44px; margin: 0; padding: 0 4px 0 16px; border: 0; border-radius: 24px;
  background: transparent; color: var(--ink); font: inherit; font-size: 1rem;
}
.place-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.place-search input[type="search"]:focus-visible { outline-offset: -2px; }
.place-search button.icon {
  flex: 0 0 auto; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: transparent; color: var(--ink); box-shadow: none;
}
.place-search button.icon[hidden] { display: none; }
.place-search button.icon:hover { background: var(--bg); }
.place-search .icon-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.place-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: min(60vh, 22rem); overflow: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lift); padding: 4px 0;
}
.place-panel[hidden] { display: none; }
.place-panel .hint { margin: 8px 16px; }
.place-panel .hint.bad { color: var(--danger); }
.place-results { list-style: none; margin: 0; padding: 0; }
button.place-result {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-height: 48px; padding: 8px 16px;
  border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); text-align: left; box-shadow: none;
}
button.place-result:hover, button.place-result:focus-visible { background: var(--bg); }
.place-result .place-name { font-weight: 600; }
.place-result .place-rest { color: var(--muted); font-size: 0.85rem; }
/* the place that was chosen: a pin (teardrop) with its name */
.place-icon { background: none; border: 0; }
.place-pin { display: block; width: 26px; height: 26px; margin: 4px 0 0 1px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #d93025; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5); position: relative; }
.place-pin::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.place-label { font-weight: 700; }
.chip.ok { color: var(--ok); }
.chip.bad { color: var(--danger); }

/* Floating round controls at the right edge, in reach of the thumb (Apple Maps style: light blur behind them). */
.map-controls {
  position: absolute; z-index: 850; top: 10px; right: calc(10px + env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.map-controls .leaflet-control { float: none; margin: 0; clear: none; }
button.round {
  width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink);
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow-lift);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  button.round, .map-controls .leaflet-bar { -webkit-backdrop-filter: blur(10px) saturate(1.4); backdrop-filter: blur(10px) saturate(1.4); }
}
button.round svg .icon-fill { fill: currentColor; }
button.round svg .icon-line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#locate[data-state="centered"] { color: var(--accent); border-color: var(--accent); }
#locate[data-state="following"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.map-controls .leaflet-bar { border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-lift); background: var(--glass); }
.map-controls .leaflet-bar a, .map-controls .leaflet-touch .leaflet-bar a {
  width: 44px; height: 44px; line-height: 44px; font-size: 22px; background: transparent; color: var(--ink); border-bottom: 1px solid var(--line);
}
.map-controls .leaflet-bar a:last-child { border-bottom: 0; }
.map-controls .leaflet-bar a:hover { background: var(--bg); }

/* The map's own corner controls (attribution, legend) stay above the sheet. */
.map-layout .leaflet-bottom { bottom: var(--sheet-offset, 0px); }
.leaflet-control-attribution { background: var(--glass); color: var(--ink); }
.leaflet-control-attribution a { color: var(--accent); }

/* The sheet. */
.side-panel.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1000;
  height: var(--sheet-h, 128px); max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border-radius: 18px 18px 0 0; box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.28);
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  transition: height 0.22s ease;
}
.side-panel.sheet.dragging { transition: none; }
.sheet-top { flex: 0 0 auto; touch-action: none; }
.sheet-handle {
  display: block; width: 100%; min-height: 44px; padding: 0; border: 0; border-radius: 18px 18px 0 0; background: transparent;
  touch-action: none; cursor: grab;
}
.sheet-handle:hover:not(:disabled) { border-color: transparent; }
.sheet-handle .grip { display: block; width: 44px; height: 5px; margin: 0 auto; border-radius: 3px; background: var(--muted); }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 0 14px 10px; }
.report-button { flex: 1 1 auto; min-height: 48px; font-size: 1.05rem; border-radius: 99px; }
.sheet-summary { flex: 0 1 40%; margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 1.25; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 4px 14px 14px; }
.sheet-body h2 { font-size: 1rem; margin: 12px 0 6px; }
.sheet-body h2:first-child { margin-top: 0; }
.sheet-detail .back-button { margin-bottom: 8px; }
.connect-link { margin: 12px 0 0; }
.connect-link a { display: inline-flex; align-items: center; min-height: 44px; }
/* The footer moves into the sheet on a phone (map-page.js): it keeps its content, it just has no strip of its own there. */
.sheet-body .site-footer { margin: 12px -14px -14px; border-top: 1px solid var(--line); }

/* Wide screens and a phone held sideways: map left, panel right. */
@media (min-width: 900px), (orientation: landscape) and (max-height: 500px) {
  .map-layout { display: flex; flex-direction: row; }
  #map-panel { position: relative; inset: auto; flex: 1 1 auto; min-height: 260px; }
  .side-panel.sheet {
    position: relative; left: auto; right: auto; bottom: auto; width: 340px; flex: 0 0 340px; height: auto; max-height: none;
    border-radius: 0; box-shadow: none; border-left: 1px solid var(--line); padding: 0; transition: none; z-index: auto;
  }
  .sheet-top { touch-action: auto; }
  .sheet-handle { display: none; }
  .sheet-head { padding-top: 12px; flex-wrap: wrap; }
  .sheet-summary { flex: 1 1 100%; }
  .map-layout .leaflet-bottom { bottom: 0; }
  .sheet-body .site-footer { margin: 0; }
}

.filters { display: flex; flex-wrap: wrap; gap: 0 14px; margin: 0; padding: 0; border: 0; }
.filters label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.filters input[type="checkbox"], .layer-toggle input[type="checkbox"] { width: 20px; height: 20px; }
.filters legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.filters .filter-note { flex-basis: 100%; margin: 0; }
.layer-toggle { display: flex; align-items: center; gap: 10px; margin-top: 4px; min-height: 44px; }
.hint { color: var(--muted); font-size: 0.9rem; }
ul.report-list { list-style: none; margin: 0; padding: 0; }
ul.report-list li { border-top: 1px solid var(--line); padding: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; justify-content: space-between; }
ul.report-list li > div { flex: 1 1 11rem; }
ul.report-list li button { flex: 0 0 auto; white-space: nowrap; }
ul.report-list li:first-child { border-top: 0; }
ul.report-list .meta { color: var(--muted); font-size: 0.85rem; }

/* hazard markers (divIcon) */
.hz-icon { display: grid; place-items: center; }
.hz-icon .pin {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; line-height: 1;
}
.hz-icon.type-traffic .pin { background: #c2410c; }
.hz-icon.type-ice .pin { background: #0369a1; }
.hz-icon.type-accident .pin { background: #b91c1c; }
.hz-icon.type-construction .pin { background: #a16207; }
.hz-icon.type-breakdown .pin { background: #6d28d9; }
.hz-icon.type-obstacle .pin { background: #374151; }
.hz-icon.camera .pin { background: #111827; }
.hz-icon.picker .pin { background: var(--accent); width: 34px; height: 34px; }

/* The visitor's position: an arrow in the direction of travel (a plain dot while the direction is unknown), outlined in white with
   a dark halo so it reads on every map colour, inside a light circle of the position's accuracy. */
.me-icon { background: none; border: 0; }
.me-arrow { display: block; width: 44px; height: 44px; transition: transform 0.3s linear; filter: drop-shadow(0 0 1px rgba(4, 18, 56, 0.95)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55)); }
.me-arrow .me-head { fill: #1d4ed8; stroke: #fff; stroke-width: 3; stroke-linejoin: round; }
.me-arrow .me-dot { fill: #1d4ed8; stroke: #fff; stroke-width: 4; }
.me-arrow:not(.no-heading) .me-dot { display: none; }
.me-arrow.no-heading .me-head { display: none; }
path.me-accuracy { fill: #3b82f6; fill-opacity: 0.16; stroke: #1d4ed8; stroke-opacity: 0.55; stroke-width: 1.5px; }

.leaflet-popup-content { margin: 12px 14px; font: 15px/1.45 system-ui, sans-serif; min-width: 210px; }
.leaflet-popup-content h3 { margin: 0 0 4px; font-size: 1.05rem; }
.leaflet-popup-content .row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.leaflet-popup-content .status { margin-top: 6px; font-size: 0.9rem; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-container a.leaflet-popup-close-button { width: 44px; height: 44px; font-size: 24px; line-height: 44px; color: var(--muted); }
.legend { background: var(--glass); color: var(--ink); padding: 6px 10px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 0.8rem; line-height: 1.5; }
.legend i { display: inline-block; width: 22px; height: 6px; margin-right: 6px; vertical-align: middle; border-radius: 3px; }
.legend i.none { height: 0; border-top: 2px dashed var(--muted); border-radius: 0; }
path.interval-preview { stroke: #6b7280; }
path.defect-preview { stroke: #c62828; }
.interval-point-label { font-weight: 700; padding: 0 5px; }

/* ---------- speed-limit detail, forms, chips ---------- */
.limit-detail h3 { margin: 0 0 4px; font-size: 1.1rem; }
.limit-detail h4 { margin: 12px 0 4px; font-size: 0.95rem; }
.limit-detail p { margin: 4px 0; }
.limit-title:focus-visible { outline-offset: 4px; }
.limit-origin { color: var(--ink); }
.limit-warning, .limit-safety { background: var(--warn-bg); color: var(--warn-ink); padding: 6px 10px; border-radius: var(--radius); }
.proposals { list-style: none; margin: 4px 0; padding: 0; }
.proposals li { border-top: 1px solid var(--line); padding: 6px 0; }
.vote-row { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 4px 0; }
.vote-status { font-size: 0.9rem; color: var(--muted); }
.limit-actions { justify-content: flex-start; margin-top: 8px; }
.limit-form { display: grid; gap: 10px; }
.limit-form fieldset, .duration { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 8px 10px 10px; min-width: 0; }
.limit-form legend, .duration legend { font-weight: 600; padding: 0 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
button.chip-button { min-width: 48px; min-height: 44px; padding: 4px 12px; border-radius: 99px; font-variant-numeric: tabular-nums; }
button.chip-button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.field { display: grid; gap: 4px; }
.field-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
input[type="text"], select {
  font: inherit; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); max-width: 100%;
}
input[type="text"][aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.inline-choice { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.inline-choice label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.points-choice { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; margin: 8px 0; }
.point-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; min-height: 44px; }
.point-label { flex: 1 1 12rem; }
.defect-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 10px; }
.defect-list li { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }

/* ---------- context signs (docs/context-signs.md) ---------- */
.signs-box { margin: 8px 0 12px; display: grid; gap: 6px; }
.sign-pictogram { flex: none; display: block; }
.ctx-marker { background: transparent; border: 0; }
.ctx-marker svg { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45)); }
.ctx-arrow { display: block; font-size: 15px; line-height: 16px; text-align: center; color: #111; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.ctx-arrow-icon { background: transparent; border: 0; }
.ctx-head { display: flex; gap: 10px; align-items: center; }
.ctx-popup { display: grid; gap: 8px; }
.ctx-popup p { margin: 0; }
.ctx-status { font-weight: 600; }
.sign-list { max-height: 36vh; overflow-y: auto; display: grid; gap: 4px; margin-top: 8px; padding-right: 2px; }
.sign-choice { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.sign-choice.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); font-weight: 600; }
.sign-choice input { flex: none; }
.day-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.day-box { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.toggle-line { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.when-box { margin: 4px 0 8px 24px; display: grid; gap: 6px; }
.preview-box .choice-grid { grid-template-columns: 1fr; }

/* ---------- report dialog ---------- */
dialog {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  padding: 0; width: min(94vw, 460px); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); max-height: 92dvh; overflow: auto;
}
dialog::backdrop { background: rgba(10, 14, 22, 0.55); }
dialog form { padding: 16px 18px; display: grid; gap: 12px; }
dialog h2 { margin: 0; font-size: 1.2rem; }
dialog fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 8px 12px 10px; min-width: 0; }
dialog legend { font-weight: 600; padding: 0 6px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; }
.choice-grid label { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.choice-grid input:checked + span { font-weight: 700; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.result { padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--line); }
.result.ok { border-color: var(--ok); color: var(--ok); }
.result.bad { border-color: var(--danger); color: var(--danger); }
.duration-box:empty { display: none; }
.duration .choice-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.duration-custom { margin-top: 8px; }

/* On a phone the dialogs are bottom sheets too: anchored to the bottom edge, full width, rounded at the top. */
@media (max-width: 640px) {
  dialog#report-dialog, dialog#camera-notice, dialog#sign-dialog {
    position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

/* speed-camera notice (informs, does not ask for consent) and camera areas */
dialog .notice-box { padding: 16px 18px; display: grid; gap: 12px; }
dialog .notice-box p { margin: 0; }
path.cam-zone:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* legal pages: both languages are in the HTML, the one that is not the page's language is hidden */
:root[lang="de"] .lang-block[lang="en"], :root[lang="en"] .lang-block[lang="de"] { display: none; }
.legal .card { margin: 14px 0; }
.legal .draft-note { border: 1px solid var(--warn, var(--line)); background: var(--warn-bg, transparent); padding: 10px 12px; border-radius: var(--radius); }
.legal-table { width: 100%; border-collapse: collapse; margin: 8px 0; table-layout: fixed; }
.legal-table th, .legal-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-table th, .legal-table td { overflow-wrap: anywhere; }
.legal-table code { overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.legal { overflow-wrap: anywhere; }
