/* ============================================================================
   B7 Tracker — base.css
   Owner: shell agent. This file owns (a) the design-token layer and (b) the
   app layout (positioning of #b7-top / #map / #elev / #panel / #field /
   #toasts) plus the shared UI primitives.

   RULES FOR OTHER MODULES
   -----------------------
   * CONSUME the tokens below. Never redefine them in core.css / map.css /
     elev.css / panel.css / field.css.
   * Style ONLY the inside of your own mount point. Do not restyle #map,
     #elev, #panel, #field, #b7-top or #toasts themselves (their box, size and
     position are layout and belong here).
   * Reuse the primitives (.btn .chip .card .sec .kv .bar .dot .skel .sr-only
     .inp) instead of reinventing them — they already handle tap targets,
     focus rings and reduced motion.

   Load order: vendor/leaflet.css, base.css, core.css, map.css, elev.css,
   panel.css, field.css.
   ========================================================================= */


/* ============================================================================
   1. TOKENS
   Dark is the only theme. Palette is tuned for a phone held outdoors at 3am:
   near-black ground, high-contrast text, one warm trail-running orange.
   All body-text pairs below clear WCAG AA (>= 4.5:1) on --bg and --surface.
   ========================================================================= */
:root {
  color-scheme: dark;

  /* --- backgrounds & surfaces --------------------------------------------
     --bg        page ground (deepest)
     --bg-2      inset areas: map backdrop, elevation strip, bottom sheet
     --bg-3      wells: inputs, progress rails, table stripes
     --surface   cards sitting on --bg
     --surface-2 raised / hovered card, active list row
     --line      hairline dividers
     --line-strong  borders of interactive things, stronger separators     */
  --bg:           #0a0c0f;
  --bg-2:         #10131a;
  --bg-3:         #171b24;
  --surface:      #14181f;
  --surface-2:    #1c222c;
  --line:         #262d38;
  --line-strong:  #3a4453;

  /* --- text ---------------------------------------------------------------
     --fg    primary text            (18.0:1 on --bg)
     --fg-2  secondary text          (11.2:1 on --bg)
     --fg-3  labels, units, captions ( 5.4:1 on --bg — still AA for body)  */
  --fg:    #f2f5f8;
  --fg-2:  #b3bdcb;
  --fg-3:  #7d8798;

  /* --- accent (warm trail-running orange) ---------------------------------
     --accent      the brand orange; AA as text on --bg (7.5:1)
     --accent-2    lighter orange for text on accent fills / emphasis
     --accent-dim  translucent wash: active chip fills, rings, hover tints
     --on-accent   text/icon colour to put ON a solid --accent fill (7.3:1) */
  --accent:      #ff7a1f;
  --accent-2:    #ffb469;
  --accent-dim:  rgba(255, 122, 31, .16);
  --on-accent:   #1a0d02;

  /* --- status -------------------------------------------------------------
     Use for text, dots and bars. All AA as text on --bg.                  */
  --ok:    #45d67a;   /* passed, running, fresh fix          */
  --warn:  #f5b93c;   /* stale data, close to a cutoff       */
  --bad:   #ff5d52;   /* lost signal, upstream down, DNF     */
  --info:  #5cb4ff;   /* neutral highlight, other racers     */

  /* --- map line colours ---------------------------------------------------
     --track  the full course polyline (cool, reads over dark topo tiles)
     --trail  the racer's travelled GPS trail (warm, ties to the racer)    */
  --track: #5aa9e6;
  --trail: #ff9d4d;

  /* --- radii ------------------------------------------------------------ */
  --r-1:    6px;    /* chips, tiny wells        */
  --r-2:    10px;   /* buttons, cards           */
  --r-3:    16px;   /* sheets, big containers   */
  --r-full: 999px;  /* pills, dots              */

  /* --- spacing ---------------------------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;

  /* --- type ---------------------------------------------------------------
     System stacks only (zero dependencies, full Czech diacritic coverage).
     --fs-3 is the body size. Sizes are deliberately generous: legibility
     beats density on this project.                                        */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
  --fs-1: 0.75rem;      /* 12px — micro labels, units, chips     */
  --fs-2: 0.875rem;     /* 14px — dense text, secondary rows     */
  --fs-3: 1rem;         /* 16px — body                           */
  --fs-4: 1.1875rem;    /* 19px — sub-headings                   */
  --fs-5: 1.5rem;       /* 24px — stat values                    */
  --fs-6: clamp(2rem, 1.4rem + 2.6vw, 2.75rem);  /* hero number  */

  /* --- other ------------------------------------------------------------ */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .28);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .45), 0 16px 40px rgba(0, 0, 0, .58);
  --dur: 180ms;   /* forced to 0ms under prefers-reduced-motion */

  /* --- internal layout vars (shell-owned; modules may read, not set) -----
     --b7-top-min is the header's minimum content height (static).
     --b7-top-h is overwritten with the header's *measured* height by the
     boot script in index.html and is what #toasts offsets itself by. The
     two must stay separate: feeding the measured height back into
     min-height would grow the header by one safe-area inset per frame.   */
  --b7-top-min: 56px;
  --b7-top-h: 56px;
  --b7-panel-w: 400px;
  --b7-map-h: 48dvh;
  --b7-elev-h: 108px;
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0ms; }
}


/* ============================================================================
   2. RESET / DOCUMENT
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-3);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, canvas { max-width: 100%; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; }
a { color: var(--accent-2); text-decoration-color: rgba(255, 180, 105, .45); text-underline-offset: 2px; }
b, strong { font-weight: 700; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }

::selection { background: var(--accent-dim); color: var(--fg); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* Thin dark scrollbars — a bright default scrollbar ruins the night theme. */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--r-full);
}


/* ============================================================================
   3. APP LAYOUT — MOBILE FIRST (single column, the page scrolls)
      DOM order in index.html: #b7-top, #map, #elev, #panel, #field, #toasts.
      #field and #toasts are fixed and therefore out of flow.
   ========================================================================= */

/* --- header strip: sticky at the very top, content built by core.js -------
   Laid out as a horizontal flex row with a gap, so core.js can just append
   its title / status / buttons as siblings. The safe-area top inset is part
   of the header's own padding, so it paints under the status bar. */
#b7-top {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: calc(var(--b7-top-min) + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding:
    calc(var(--s-2) + env(safe-area-inset-top, 0px))
    calc(var(--s-4) + env(safe-area-inset-right, 0px))
    var(--s-2)
    calc(var(--s-4) + env(safe-area-inset-left, 0px));
  background: rgba(10, 12, 15, .88);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px)) {
  #b7-top {
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    backdrop-filter: blur(14px) saturate(1.3);
  }
}
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  #b7-top { background: var(--bg); }
}

/* --- map: ~48% of the viewport on a phone ------------------------------
   `isolation: isolate` traps Leaflet's internal z-index ladder (its panes
   and controls go up to 1000) inside the map so it can never paint over the
   header, the toasts or the field sheet.                                  */
#map {
  position: relative;
  z-index: 0;
  isolation: isolate;
  height: var(--b7-map-h);
  min-height: 240px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

/* --- elevation strip: compact, full-bleed --------------------------------
   Clipped on purpose so nothing inside it can push the page layout around;
   elev.js should draw its scrub readout inside the band. */
#elev {
  position: relative;
  z-index: 10;
  height: var(--b7-elev-h);
  min-height: 84px;
  overflow: hidden;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

/* --- panel: flows below and scrolls with the page ----------------------
   Padded here (including safe-area insets) so panel.js can just stack
   .card / .sec blocks. Direct children are laid out in a gapped column. */
#panel {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding:
    var(--s-4)
    calc(var(--s-4) + env(safe-area-inset-right, 0px))
    calc(var(--s-6) + env(safe-area-inset-bottom, 0px))
    calc(var(--s-4) + env(safe-area-inset-left, 0px));
}

/* --- field browser: bottom sheet over everything -------------------------
   CONTRACT: field.js toggles the class `open` on #field. Nothing else.
   The scrim and the background scroll-lock are driven from that class.
   #field is a flex column: give your inner list `flex: 1; min-height: 0;
   overflow-y: auto;` and it will scroll inside the sheet.                 */
#field {
  position: fixed;
  z-index: 50;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: min(88dvh, 820px);
  padding:
    0
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  background: var(--bg-2);
  border-top: 1px solid var(--line-strong);
  border-radius: var(--r-3) var(--r-3) 0 0;
  box-shadow: var(--shadow-2);
  overscroll-behavior: contain;
  visibility: hidden;
  transform: translateY(100%);
  transition:
    transform var(--dur) cubic-bezier(.22, .7, .3, 1),
    visibility var(--dur) linear;
}
#field.open {
  visibility: visible;
  transform: translateY(0);
}

/* Scrim behind the open sheet. Rendered from <body> so it needs no markup of
   its own. Two identical rules on purpose: a selector list containing an
   unsupported :has() would be dropped whole, taking the fallback with it. */
body.field-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(4, 6, 9, .64);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: b7-fade var(--dur) ease-out both;
}
body:has(#field.open)::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(4, 6, 9, .64);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: b7-fade var(--dur) ease-out both;
}
/* Lock the page behind the sheet (again, kept in separate rules). */
html.field-open, body.field-open { overflow: hidden; }
html:has(#field.open) { overflow: hidden; }
body:has(#field.open) { overflow: hidden; }

/* --- toasts: fixed, centred, clear of the header -------------------------
   --b7-top-h is the measured header height and already includes the
   safe-area top inset, so it must not be added a second time here. */
#toasts {
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  top: calc(var(--b7-top-h) + var(--s-2));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding-right: calc(var(--s-4) + env(safe-area-inset-right, 0px));
  padding-left: calc(var(--s-4) + env(safe-area-inset-left, 0px));
  pointer-events: none;
}
/* Container ignores pointers so the map stays draggable; individual toasts
   opt back in. */
#toasts > * {
  pointer-events: auto;
  width: 100%;
  max-width: 560px;
}


/* ============================================================================
   4. APP LAYOUT — >= 900px (two columns, exactly 100dvh, no page scroll)
      +--------------------------------+
      |            #b7-top             |
      +---------------------+  #panel  |
      |        #map         |  (own    |
      +---------------------+  scroll) |
      |        #elev        |          |
      +---------------------+----------+
   ========================================================================= */
@media (min-width: 900px) {
  html, body { height: 100dvh; overflow: hidden; }

  body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--b7-panel-w);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "top  top"
      "map  panel"
      "elev panel";
  }

  #b7-top {
    grid-area: top;
    position: static;
    padding-inline: var(--s-5);
  }

  #map {
    grid-area: map;
    height: auto;
    min-height: 0;
    border-right: 1px solid var(--line);
  }

  #elev {
    grid-area: elev;
    height: 140px;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  #panel {
    grid-area: panel;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--s-4);
    padding-bottom: var(--s-6);
    background: var(--bg);
  }

  /* The field browser becomes a centred dialog instead of a bottom sheet. */
  #field {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: min(760px, 92vw);
    max-height: min(80dvh, 760px);
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-3);
    transform: translate(-50%, -46%) scale(.985);
    opacity: 0;
    transition:
      transform var(--dur) cubic-bezier(.22, .7, .3, 1),
      opacity var(--dur) ease,
      visibility var(--dur) linear;
  }
  #field.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }

  /* Toasts stay over the map column only. */
  #toasts { right: var(--b7-panel-w); }
}

@media (min-width: 1400px) {
  :root { --b7-panel-w: 440px; }
}


/* ============================================================================
   5. SHARED PRIMITIVES
   Every module should build from these. Each is documented with the exact
   markup it expects.
   ========================================================================= */

/* ---------------------------------------------------------------------------
   .btn — the standard tappable control. Always >= 44px tall.
     <button class="btn">Mapa</button>
     <button class="btn on">Mapa</button>          selected / active state
     <button class="btn sm">Vše</button>           36px, for dense toolbars
     <button class="btn block">Zobrazit pole</button>   full width
     <button class="btn icon" aria-label="Zavřít">✕</button>   square 44px
   Works on <button>, <a> and <label>.
--------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  min-width: 44px;
  padding: 0 var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  background: var(--surface);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-2);
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--dur) ease,
    border-color var(--dur) ease,
    color var(--dur) ease,
    transform var(--dur) ease;
}
@media (hover: hover) {
  .btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--fg); }
  .btn.on:hover { background: var(--accent-2); border-color: var(--accent-2); }
}
.btn:active { transform: translateY(1px); }
.btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .45;
  pointer-events: none;
}
.btn.sm { min-height: 36px; min-width: 36px; padding: 0 var(--s-3); font-size: var(--fs-1); }
.btn.block { display: flex; width: 100%; }
.btn.icon { padding: 0; width: 44px; flex: none; }
.btn.icon.sm { width: 36px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--fg-2); }

/* ---------------------------------------------------------------------------
   .chip — a small pill for metadata. Not a tap target by default; when it is
   rendered as <button> or <a> it grows to 44px automatically.
     <span class="chip">M40</span>
     <span class="chip ok"><i class="dot ok"></i> V cíli</span>
     <button class="chip on">Jen sledovaní</button>
--------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  min-height: 26px;
  padding: 2px var(--s-2);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--bg-3);
  color: var(--fg-2);
  font-size: var(--fs-1);
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.chip.on   { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-2); }
.chip.ok   { color: var(--ok);   border-color: rgba(69, 214, 122, .35); }
.chip.warn { color: var(--warn); border-color: rgba(245, 185, 60, .35); }
.chip.bad  { color: var(--bad);  border-color: rgba(255, 93, 82, .38); }
.chip.info { color: var(--info); border-color: rgba(92, 180, 255, .35); }
button.chip, a.chip, label.chip {
  min-height: 44px;
  padding-inline: var(--s-3);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--dur) ease, border-color var(--dur) ease, color var(--dur) ease;
}
@media (hover: hover) {
  button.chip:hover, a.chip:hover, label.chip:hover { background: var(--surface-2); color: var(--fg); }
  button.chip.on:hover, a.chip.on:hover { background: var(--accent-dim); color: var(--accent-2); }
}

/* ---------------------------------------------------------------------------
   .card — the standard content container on --bg.
     <section class="card"> … </section>
     <section class="card flat">   no shadow, sunken look
     <section class="card tight">  12px padding
     <section class="card bare">   no padding, clips children (for lists)
--------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  padding: var(--s-4);
  box-shadow: var(--shadow-1);
}
.card.flat  { background: var(--bg-2); box-shadow: none; }
.card.tight { padding: var(--s-3); }
.card.bare  { padding: 0; overflow: hidden; }

/* ---------------------------------------------------------------------------
   .sec — a section header. Renders an uppercase label followed by a hairline.
     <h2 class="sec">Mezičasy</h2>
     <h2 class="sec">Mezičasy <span class="n">7 / 18</span></h2>
   The trailing rule is an ::after, so it always lands after your content.
--------------------------------------------------------------------------- */
.sec {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0 0 var(--s-2);
  font-family: var(--font-sans);
  font-size: var(--fs-1);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.sec::after {
  content: "";
  order: 1;
  flex: 1 1 auto;
  height: 1px;
  min-width: var(--s-4);
  background: linear-gradient(90deg, var(--line), transparent);
}
.sec .n {
  letter-spacing: .04em;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
/* A control inside a .sec is pushed past the rule, to the far right. */
.sec .btn, .sec .chip { order: 2; letter-spacing: 0; text-transform: none; }

/* ---------------------------------------------------------------------------
   .kv — one label/value stat cell.
     <div class="kv">
       <span class="k">Uběhnuto</span>
       <span class="v">42,1</span>
       <span class="u">km</span>
       <span class="s">z 99,4 km</span>     optional sub-note
     </div>
   Modifiers: .kv.row (label left / value right), .kv.big (hero number),
   .kv.accent / .kv.ok / .kv.warn / .kv.bad (colours the value).
   Bare children without .k/.v classes still render sanely: the first child
   is treated as the label.
--------------------------------------------------------------------------- */
.kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.kv > * { min-width: 0; }
/* positional fallback — explicit classes below override it */
.kv > :first-child {
  font-size: var(--fs-1);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.kv .k {
  font-family: var(--font-sans);
  font-size: var(--fs-1);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.kv .v {
  font-family: var(--font-mono);
  font-size: var(--fs-5);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.01em;
  text-transform: none;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.kv .u {
  font-family: var(--font-sans);
  font-size: var(--fs-2);
  font-weight: 600;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg-3);
}
.kv .s {
  font-family: var(--font-sans);
  font-size: var(--fs-1);
  font-weight: 400;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: 0;
  color: var(--fg-3);
}
.kv.row {
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}
.kv.row .v { font-size: var(--fs-3); }
.kv.big .v    { font-size: var(--fs-6); }
.kv.accent .v { color: var(--accent-2); }
.kv.ok .v     { color: var(--ok); }
.kv.warn .v   { color: var(--warn); }
.kv.bad .v    { color: var(--bad); }

/* ---------------------------------------------------------------------------
   .bar — a progress bar. The single child element is the fill; set its width
   inline (or from JS).
     <div class="bar"><i style="width:42.3%"></i></div>
     <div class="bar lg ok"><i style="width:100%"></i></div>
   Modifiers: .lg (12px tall), .ok / .warn / .bad / .info recolour the fill.
--------------------------------------------------------------------------- */
.bar {
  position: relative;
  height: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: var(--bg-3);
  overflow: hidden;
}
.bar > * {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--dur) ease;
}
.bar.lg { height: 12px; }
.bar.ok   > * { background: var(--ok); }
.bar.warn > * { background: var(--warn); }
.bar.bad  > * { background: var(--bad); }
.bar.info > * { background: var(--info); }

/* ---------------------------------------------------------------------------
   .dot — a status dot.
     <i class="dot ok"></i>            static
     <i class="dot ok live"></i>       with the "live" pulse
   Colours: (default = --fg-3), .ok .warn .bad .info .accent
--------------------------------------------------------------------------- */
.dot {
  display: inline-block;
  position: relative;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: var(--r-full);
  background: var(--fg-3);
  vertical-align: baseline;
}
.dot.ok     { background: var(--ok); }
.dot.warn   { background: var(--warn); }
.dot.bad    { background: var(--bad); }
.dot.info   { background: var(--info); }
.dot.accent { background: var(--accent); }
.dot.live::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: b7-pulse 2s cubic-bezier(.2, .6, .3, 1) infinite;
}

/* ---------------------------------------------------------------------------
   .skel — loading skeleton. Put it on an empty element sized by .line/.block
   or by your own CSS.
     <div class="skel line"></div>
     <div class="skel block"></div>
--------------------------------------------------------------------------- */
.skel {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-1);
  background: var(--bg-3);
  color: transparent !important;
}
.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  animation: b7-shimmer 1.4s ease-in-out infinite;
}
.skel.line  { height: 1em; margin: .25em 0; }
.skel.block { height: 64px; }

/* ---------------------------------------------------------------------------
   .inp — text / search input and <select>, dark-themed.
     <input class="inp" type="search" placeholder="Jméno nebo číslo">
--------------------------------------------------------------------------- */
.inp {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  background: var(--bg-3);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-3);
  line-height: 1.2;
  appearance: none;
  transition: border-color var(--dur) ease, background-color var(--dur) ease;
}
.inp::placeholder { color: var(--fg-3); opacity: 1; }
.inp:focus { border-color: var(--accent); background: var(--surface); }
.inp::-webkit-search-cancel-button { filter: invert(1) opacity(.55); }
select.inp { padding-right: var(--s-5); cursor: pointer; }

/* ---------------------------------------------------------------------------
   Small utilities.
     .sr-only  visually hidden, still read by screen readers
     .num      tabular monospace numerals (for tables and split times)
     .muted    secondary text colour
     .nowrap   no line breaks
--------------------------------------------------------------------------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.num    { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted  { color: var(--fg-3); }
.nowrap { white-space: nowrap; }


/* ============================================================================
   6. ANIMATIONS
   ========================================================================= */
@keyframes b7-pulse {
  0%   { transform: scale(1);   opacity: .5; }
  70%  { transform: scale(2.8); opacity: 0; }
  100% { transform: scale(2.8); opacity: 0; }
}
@keyframes b7-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes b7-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Reduced motion: no pulse, no shimmer, no transitions anywhere. --dur is
   already 0ms (see the token block); this kills keyframe animations too. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .dot.live::after,
  .skel::after { display: none; }
  .btn:active { transform: none; }
}
