:root {
  --bg: #F2F4F7;
  --paper: #FFFFFF;
  --ink: #10151C;
  --ink-2: #3A434F;
  --muted: #4F5966;
  --line: #D5DBE3;
  --line-2: #E3E7EC;
  --accent: #C2410C;
  --accent-dark: #9A3412;
  --accent-soft: #FCE9DE;
  --blue: #1D4ED8;
  --blue-soft: #E6EDFB;
  --green: #17795A;
  --ok-bg: #E3F3EC; --ok: #14614A;
  --warn-bg: #FBF0DC; --warn: #7A4E00;
  --bad-bg: #FBE4E2; --bad: #9B1C14;
  --f-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--f-body); }
a { color: var(--blue); }
a:hover { color: #1E3A8A; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
img { max-width: 100%; }
.wrap { max-width: 480px; margin: 0 auto; padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 22px; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; line-height: 1.02; text-wrap: balance; }
h1 { font-size: 42px; font-weight: 800; }
h2 { font-size: 27px; font-weight: 700; }
h3 { font-size: 20px; font-weight: 700; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 14px; }
.tiny { font-size: 13px; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap-row { display: flex; flex-wrap: wrap; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); position: relative; flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; top: 5px; left: 5px; box-shadow: 12px 0 0 #fff, 0 12px 0 #fff, 12px 12px 0 #fff; }
.brand-mark::after { display: none; }
.brand-name { font-family: var(--f-display); font-size: 22px; font-weight: 700; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 18px; border-radius: 12px; font: 700 17px/1.1 var(--f-body); text-decoration: none; border: 0; cursor: pointer; text-align: center; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); }
.btn-secondary:hover { background: #E8EBF0; color: var(--ink); }
.btn-small { min-height: 44px; font-size: 15px; padding: 0 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.card.dark .muted, .card.dark .tiny { color: #DCE1E8; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--paper); border: 1px solid var(--line); }
.pill.blue { background: var(--blue-soft); color: #1E3A8A; border-color: transparent; }
.pill.orange { background: var(--accent-soft); color: var(--accent-dark); border-color: transparent; }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 15px; font-weight: 600; color: var(--ink); }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(16,21,28,.25); flex: none; }
.todo { background: #FFF4D6; color: #6B4E00; padding: 1px 6px; border-radius: 4px; font-size: 13px; font-weight: 600; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .legend { font-size: 15px; font-weight: 600; }
.input { height: 50px; padding: 0 14px; background: var(--paper); border: 1.5px solid #AEB7C2; border-radius: 10px; font: 500 17px var(--f-body); color: var(--ink); width: 100%; }
.input.sm { height: 42px; font-size: 15px; border-width: 1px; background: #F7F8FA; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.map { height: 280px; margin: 0 -20px; background: #E8EBEF; z-index: 0; }
.map.tall { height: 380px; }
@media (min-width: 520px) { .map { margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); } }

.tile { border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; background: var(--paper); border: 1px solid var(--line); min-width: 0; }
.tile.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.tile .v { font: 700 28px/1.05 var(--f-display); font-variant-numeric: tabular-nums; }
.tile.dark .eyebrow { color: #C9D0D9; }

.pass { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line-2); font-size: 15px; }
.pass b { font: 700 19px/1 var(--f-display); font-variant-numeric: tabular-nums; }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font: 700 14px var(--f-body); flex: none; }
.num.ink { background: var(--ink); font-size: 11px; }
.quote { padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: #7C2D12; font-size: 15px; font-style: italic; }

.seg { display: flex; padding: 3px; border-radius: 12px; background: #E3E7EC; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font: 600 15px var(--f-body); color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(16,21,28,.15); }

.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.check:has(input:checked) { border: 1.5px solid var(--accent); }
.check input[type=checkbox] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }

.tl { display: flex; flex-direction: column; }
.stop { display: flex; gap: 14px; }
.rail { display: flex; flex-direction: column; align-items: center; width: 28px; flex: none; }
.rail .line { flex: 1; width: 3px; background: #C9D0D9; min-height: 14px; }
.rail .line.dash { background: repeating-linear-gradient(var(--accent) 0 6px, transparent 6px 11px); min-height: 56px; }
.stop .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding-bottom: 16px; }

table.data { border-collapse: collapse; width: 100%; font-size: 14px; }
table.data th, table.data td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
table.data th { font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.scroll { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }

input[type=range] { width: 100%; accent-color: var(--accent); }

/* Leaflet markers */
.rt-km { background: #fff; border: 1.5px solid var(--blue); color: #1E3A8A; border-radius: 999px; font: 700 11px/18px var(--f-body); text-align: center; height: 20px !important; width: auto !important; min-width: 22px; padding: 0 5px; white-space: nowrap; }
.rt-st { display: grid; place-items: center; color: #fff; font: 700 11px var(--f-body); border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.rt-st.u { background: var(--blue); border-radius: 4px; }
.rt-st.s { background: var(--green); border-radius: 50%; }
.rt-spot { display: grid; place-items: center; background: var(--accent); color: #fff; border: 2.5px solid #fff; border-radius: 50%; font: 700 13px var(--f-body); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.rt-spot.ink { background: var(--ink); font-size: 11px; }
.rt-spot.ghost { background: #fff; color: var(--accent-dark); border-color: var(--accent); }
.rt-runner { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(194,65,12,.25); }
.leaflet-container { font-family: var(--f-body); }
.leaflet-popup-content { margin: 10px 12px; font-size: 14px; line-height: 1.4; }
.leaflet-popup-content b { font-size: 15px; }

/* Action-first layout: primary actions stay reachable; long lists collapse. */
.actionbar { position: sticky; bottom: 0; z-index: 1000; margin: 0 -20px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px)); background: rgba(242, 244, 247, .96); border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; backdrop-filter: blur(6px); }
.actionbar.one { grid-template-columns: 1fr; }
details.more > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 10px; border: 1px dashed #AEB7C2; font-weight: 600; font-size: 15px; color: var(--ink); background: var(--paper); }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: 10px; }
details.more > .stack, details.more > .tl { margin-top: 0; }
.mini { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.toggle { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--accent); background: var(--paper); color: var(--accent-dark); font: 700 14px var(--f-body); cursor: pointer; flex: none; }
.toggle[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Subpage tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.tab[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.linkrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.linkrow:hover { border-color: #AEB7C2; color: var(--ink); }
.linkrow span.small { color: var(--ink-2); }
