/*
  3DT GUI - the one common stylesheet for every page shown in the GUI's
  content frame. Two page types share it:
    - map page      (.map-page): full-bleed Leaflet map + right-hand panel
                    (CIRCUITS > TRACK LIBRARY, CIRCUITS > WHITELINE EDITOR)
    - content page  (CONFIG > ONBOARD): panel without a map
  A page keeps only what is truly its own (map markers, special widgets).

  Colours: never written here as values. Layer 1 is the official palette
  (colors.css); layer 2 below gives each colour its ROLE. To restyle, change a
  colour in colors.css, or point a role at another palette colour here.
*/
@import "colors.css";

/* ---- Layer 2: roles ---- */
:root {
    --ui-page-bg:        var(--3dt-dark-grey);    /* every page = the selected subnav item (styles.css) */
    --ui-panel-bg:       var(--3dt-dark-grey);    /* right-hand panel, map page shell */
    --ui-section-bg:     var(--3dt-dark-grey);    /* cards (grouped by their border) */
    --ui-highlight-bg:   var(--3dt-black);        /* hover / active tab, toggle hover */
    --ui-line:           var(--3dt-medium-grey);  /* borders: tabs, map controls, collapse button */
    --ui-soft-line:      color-mix(in srgb, var(--3dt-medium-grey) 40%, transparent); /* discreet border: cards, fields and values (owner, 2026-09-30) */
    --ui-divider:        var(--3dt-medium-grey);  /* separators */
    --ui-scroll:         var(--3dt-medium-grey);  /* scrollbar thumb */
    --ui-text:           var(--3dt-white);        /* content: values, fields, choices, headings */
    --ui-label:          var(--3dt-light-grey);   /* labels and information (e.g. "DB file: ...", status lines) */
    --ui-muted:          var(--3dt-medium-grey);  /* read-only / disabled values (on black fields) */
    --ui-input-bg:       var(--3dt-black);
    --ui-accent:         var(--3dt-orange);       /* active tab (as the nav's active item) */
    --ui-select:         var(--3dt-blue);         /* selected option (checkboxes, radios) */
    --ui-btn-text:       var(--3dt-white);
    --ui-btn-primary:    var(--3dt-dark-green);   /* add / load / update / export */
    --ui-btn-danger:     var(--3dt-red);          /* remove / reject */
    --ui-btn-neutral:    var(--3dt-black);        /* secondary actions */
    --ui-btn-gap:        10px;                    /* between buttons side by side (ADD CIRCUIT | ADD LAYOUT | REMOVE) */
    --ui-ok:             var(--3dt-green);
    --ui-fail:           var(--3dt-red);
    --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---- Base ---- */
html, body {
    height: 100%;
    margin: 0;
    background-color: var(--ui-page-bg);
    color: var(--ui-text);
    font-family: var(--ui-font);
    font-size: 13px;
}
body:has(> .map-page) { overflow: hidden; } /* map pages fill the frame exactly; content pages scroll */
input, select, button, textarea { accent-color: var(--ui-select); }
:focus, :focus-visible { outline: none; }  /* no focus ring on fields/buttons (owner, 2026-09-30) */

/* Plain form fields anywhere (login, content pages); field rows refine the layout. */
input[type="text"], input[type="password"], input[type="number"], select, textarea {
    background-color: var(--ui-input-bg);
    color: var(--ui-text);
    border: 1px solid var(--ui-soft-line);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
}
/* Chrome autofill paints fields light blue: keep them black with white text. */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--ui-input-bg) inset;
    -webkit-text-fill-color: var(--ui-text);
    caret-color: var(--ui-text);
}

/* ---- Map page shell: map + right-hand panel ---- */
.map-page {
    position: relative; /* anchors .rhs-toggle */
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: var(--ui-panel-bg);
    /* Twice the left navbar's 250px - one value for the panel width and the
       toggle's distance from the right edge, so the button always sits on
       the map/panel boundary. */
    --rhs-width: 500px;
}
.map-canvas { flex: 1; min-width: 0; height: 100%; }

/* Collapse button: floats over the map on the map/panel boundary, stays
   clickable while the panel is collapsed. Above Leaflet's controls (1000). */
.rhs-toggle {
    position: absolute;
    top: 50%;
    right: var(--rhs-width);
    transform: translateY(-50%);
    z-index: 1001;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ui-panel-bg);
    border: 1px solid var(--ui-line);
    border-radius: 4px;
    cursor: pointer;
    transition: right 0.2s;
}
.rhs-toggle::after { /* CSS triangle, mirrored when collapsed */
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 6px solid var(--ui-text);
}
.rhs-toggle:hover { background-color: var(--ui-highlight-bg); }
.rhs-toggle.collapsed { right: 0; transform: translateY(-50%) scaleX(-1); }

.rhs-bar {
    width: var(--rhs-width);
    flex-shrink: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--ui-panel-bg);
    box-sizing: border-box;
    padding: 20px 20px 0 20px;
    transition: width 0.2s, padding 0.2s;
}
.rhs-bar.collapsed { width: 0; padding: 0; overflow: hidden; }

/* Only the content scrolls; picker/tabs above and the footer below stay put. */
.rhs-form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.rhs-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;        /* the panel scrolls up / down only, never sideways (BW 2026-11-03: a wide select showed a horizontal bar in Safari) */
    padding-bottom: 20px;
    margin-right: -13px;       /* the box ends 7 px from the window edge ... */
    padding-right: 7px;        /* ... the content keeps its old right edge (20 px) ... */
    scrollbar-gutter: stable;  /* ... and the 6 px scrollbar sits centred in the gap (7 + 6 + 7), shown or not */
}
/* Chrome / Safari: the styled 6 px scrollbar (a classic one, so the gutter is the same with and without overflow; the standard scrollbar-width would make it an overlay on macOS).
   Firefox: scrollbar-width thin (its width may differ by a pixel or two). */
@supports selector(::-webkit-scrollbar) {
    .rhs-scroll::-webkit-scrollbar { width: 6px; }
    .rhs-scroll::-webkit-scrollbar-track { background: var(--ui-panel-bg); }
    .rhs-scroll::-webkit-scrollbar-thumb { background-color: var(--ui-scroll); border-radius: 3px; }
}
@supports not selector(::-webkit-scrollbar) {
    .rhs-scroll { scrollbar-width: thin; scrollbar-color: var(--ui-scroll) var(--ui-panel-bg); }
}

.rhs-footer {
    flex-shrink: 0;
    background-color: var(--ui-panel-bg);
    padding-top: 16px;
    padding-bottom: 20px;
    margin-top: 8px;
    border-top: 1px solid var(--ui-divider);
    display: flex;
    align-items: center;
    gap: var(--ui-btn-gap);
    flex-wrap: wrap;
}

/* ---- Content page shell: the same 500 px panel, docked left, no map (CONFIG > ONBOARD) ---- */
.panel-page {
    display: flex;
    flex-direction: column;
    width: 500px;
    flex-shrink: 0;
    height: 100vh;
    box-sizing: border-box;
    background-color: var(--ui-panel-bg);
    padding: 20px 20px 0 20px;
}
body:has(> .panel-page) { overflow: hidden; } /* only the panel's .rhs-scroll scrolls */

/* ---- Panel content ---- */
.rhs-picker { display: flex; align-items: center; gap: var(--ui-btn-gap); margin-bottom: 16px; flex-wrap: wrap; }
.rhs-select {
    flex: 1;
    min-width: 140px;
    background-color: var(--ui-input-bg);
    color: var(--ui-text);
    border: 1px solid var(--ui-soft-line);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    height: 30px;
    box-sizing: border-box;
}
.rhs-picker-meta { color: var(--ui-label); font-size: 11px; width: 100%; }

/* Tabs: same selection logic as the lefthand navbar (solid background swap,
   accent colour for the active label). */
.rhs-tabs { display: flex; border-bottom: 1px solid var(--ui-line); margin-bottom: 16px; }
.rhs-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--ui-text);
    padding: 10px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
}
.rhs-tab:hover { background-color: var(--ui-highlight-bg); color: var(--ui-text); }
.rhs-tab.active { background-color: var(--ui-highlight-bg); color: var(--ui-accent); font-weight: bold; }
/* Many tabs (ONBOARD's chapters): auto-sized, wrapping onto more rows. */
.rhs-tabs.wrap { flex-wrap: wrap; }
.rhs-tabs.wrap .rhs-tab { flex: 1 0 auto; padding: 10px 8px; }

.rhs-section-header {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: bold;
    color: var(--ui-text);
    margin: 20px 0 10px 0;
    padding-top: 16px;
    border-top: 1px solid var(--ui-divider);
}
.rhs-card {
    border: 1px solid var(--ui-soft-line);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    background-color: var(--ui-section-bg);
}

/* Label beside value: the value column is always 65 % of the row; a long
   label wraps instead of squeezing its value. */
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.field-row label { color: var(--ui-label); font-size: 12px; }
.field-row > label { flex: 1 1 auto; min-width: 0; margin: 0; }
.field-row > input,
.field-row > select,
.field-row-pair input[type="text"], .field-row-pair input[type="password"],
.ui-textarea {
    box-sizing: border-box; /* keeps border+padding inside the 65 % */
    background-color: var(--ui-input-bg);
    color: var(--ui-text);
    border: 1px solid var(--ui-soft-line);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
}
.ui-textarea { font-family: inherit; }
/* One control height (31 px = the button height): every text/number/password input in a field row. Every dropdown (select) is 30 px (BW 2026-11-03).
   Compact exceptions (DATABASE / FEEDS title select, TRACK LIBRARY (SQLITE) turn rows) say height: auto in their page; TRACK LIBRARY (BRN) turn / pit cards use the standard heights (BW 2026-11-03). */
.field-row input[type="text"], .field-row input[type="number"], .field-row input[type="password"],
.field-row-pair input[type="text"], .field-row-pair input[type="password"], .field-row-pair input[type="number"] { box-sizing: border-box; height: 31px; }
select { box-sizing: border-box; height: 30px; }
.field-row > input,
.field-row > select { flex: 0 0 65%; max-width: 65%; }
.field-row:has(> .val) { min-height: 31px; }   /* a read-only text row (Source, Last seen, Used by) is as tall as the input rows above it; the textarea row keeps its own height */
.field-row input:disabled,
.field-row input:read-only { color: var(--ui-muted); }
select:disabled, .field-row input:disabled { cursor: not-allowed; }
select:disabled { color: var(--ui-muted); opacity: 0.7; }   /* disabled select: muted text, dimmed arrow */
/* From / To of a fitting (guiDialog select with typed / resolve, and the FITTING card): the dropdown, the typed time and the resolved-time line stacked in the 65 % column */
.field-row-col { display: flex; flex-direction: column; gap: 6px; flex: 0 0 65%; max-width: 65%; min-width: 0; }
.field-row-col > select, .field-row-col > input { width: 100%; max-width: none; box-sizing: border-box; }
.field-row-col > .btn { align-self: flex-start; }
.field-row:has(> .field-row-col > .field-row-pair) > .ui-info { align-self: flex-start; margin-top: 9px; }   /* the (i) level with the password input, not with the whole column */
.field-row-col > .field-row-pair { max-width: none; flex: none; width: 100%; }   /* a password field with its eye inside a column (guiDialog reveal / generate) */
.field-row-col > .ui-status { margin: 0; }
.field-row:has(> .field-row-col) { align-items: flex-start; }
.field-row:has(> .field-row-col) > label { padding-top: 7px; }
.field-row-col [hidden] { display: none; }
.field-row-pair { display: flex; align-items: center; gap: 8px; flex: 0 0 65%; min-width: 0; max-width: 65%; }
.field-row-pair input[type="text"], .field-row-pair input[type="password"] { flex: 1; width: 0; min-width: 0; }
.field-row-pair .btn { flex: none; }
.field-row-pair [hidden] { display: none; }   /* a hidden choice inside a row pair (the .ui-radio display would win otherwise) */
.field-row-pair.pair-20-80 > :first-child { flex: 0 0 20%; min-width: 56px; }   /* Turn dropdown 20 % / Name input 80 % (TRACK LIBRARY (BRN) turn card); min-width keeps 'T99' and the arrow readable on a phone */
.field-row-pair.pair-20-80 > .t-numin.t-hand { color: var(--ui-accent); font-weight: bold; }   /* a turn number set by hand (T10 and a dot), BW Q2.105; empty = Auto shows the grey placeholder */
.field-row .ui-radio { display: flex; align-items: center; gap: 4px; color: var(--ui-text); font-size: 12px; } /* a choice is content, not a label */

/* Card title; .card-head puts buttons on the title's right (e.g. Undo / Redo). */
.rhs-card > h3 { margin: 0 0 10px 0; font-size: 12px; text-transform: uppercase; color: var(--ui-text); }
.rhs-card > h3.card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.card-head-btns { display: flex; gap: var(--ui-btn-gap); }
/* Icon button = plain clickable icon (BW 2026-10-30 refresh, 2026-11-04 undo / redo): no box, border or fill; text colour, accent on hover / keyboard focus; aria-label required */
.ui-icon-btn { width: 22px; height: 22px; padding: 0; border: 0; background: none; color: var(--ui-text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; }
.ui-icon-btn:hover:not(:disabled), .ui-icon-btn:focus-visible { color: var(--ui-accent); }
.ui-icon-btn:focus-visible { outline: 1px solid var(--ui-accent); outline-offset: 1px; }
.ui-icon-btn:disabled { opacity: 0.35; cursor: default; }
.ui-icon-btn svg { width: 16px; height: 16px; }

/* Buttons are as wide as their name (owner, 2026-10-12): left-aligned on a page or the panel itself,
   right-aligned inside a section (card, dialog); buttons next to each other share one .ui-btn-row. */
.rhs-card > .btn { display: block; width: fit-content; margin: 0 0 6px auto; }
/* Inside a tab, buttons sit on the right like in a card (BW 2026-11-03): a lone button and a row of them (.rhs-picker). */
.rhs-tab-panel > .btn { display: block; width: fit-content; margin: 0 0 6px auto; }
.rhs-tab-panel > .rhs-picker { justify-content: flex-end; }
.rhs-card > .ui-btn-row { display: flex; justify-content: flex-end; gap: var(--ui-btn-gap); margin: 0 0 6px; }

/* Status / result text under a control. */
.ui-status { font-size: 11px; color: var(--ui-label); margin: 0 0 8px; white-space: pre-line; }
.ui-status:empty { display: none; }
.ui-status.ui-summary { color: var(--ui-muted); }   /* summary line of a card (what the item is, its length, where it lies): quieter than the labels (BW 2026-11-04) */

/* Slim progress bar. */
.ui-progress {
    display: block; width: 100%; height: 6px; margin: 0 0 6px;
    -webkit-appearance: none; appearance: none;
    border: none; border-radius: 3px; background: var(--ui-line); overflow: hidden;
}
.ui-progress::-webkit-progress-bar { background: var(--ui-line); border-radius: 3px; }
.ui-progress::-webkit-progress-value { background: var(--ui-ok); border-radius: 3px; }
.ui-progress::-moz-progress-bar { background: var(--ui-ok); border-radius: 3px; }

/* ---- Buttons: one shape for the whole GUI, only the colour changes ---- */
.btn {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--ui-btn-text);
}
.btn-green   { background-color: var(--ui-btn-primary); }
.btn-red     { background-color: var(--ui-btn-danger); }
.btn-neutral { background-color: var(--ui-btn-neutral); }
/* Hover = white outline, so no shades outside the official colours are needed. */
.btn:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--ui-text); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Deploy dialog (TRACK LIBRARY: circuits.sqlite, ONBOARD: config.yaml) ---- */
.deploy-modal-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.6); /* black 60 % */
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.deploy-modal-backdrop.open { display: block; }
/* The dialog sits at the centre of the whole browser viewport, not of the content frame: popup.js sets --cx / --cy (the viewport centre in this frame's coordinates, kept inside the frame);
   without popup.js it falls back to the frame's centre. */
.deploy-modal {
    position: absolute;
    left: var(--cx, 50%);
    top: var(--cy, 50%);
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    background-color: var(--ui-section-bg);
    border: 1px solid var(--ui-line);
    border-radius: 6px;
    padding: 20px;
    width: 360px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    color: var(--ui-text);
    font-family: var(--ui-font);
}
.deploy-modal h3 { margin: 0 0 12px 0; font-size: 14px; text-transform: uppercase; }
.deploy-modal.dev-warn { border: 3px solid var(--3dt-red); }   /* _DEV write warning (popup.js guiDeviceWrite) */
.deploy-modal.dev-warn h3 { color: var(--3dt-red); font-size: 22px; }
.deploy-modal.dev-warn .deploy-modal-text { font-size: 16px; font-weight: bold; }
.deploy-modal-hint { margin-bottom: 10px; color: var(--ui-label); }
.deploy-modal-text { margin: 0 0 12px 0; color: var(--ui-text); line-height: 1.45; }   /* a confirmation's question */
.deploy-modal-err { min-height: 16px; margin: 8px 0 0 0; color: var(--ui-fail); font-size: 12px; }
.deploy-modal label { display: block; margin: 0 0 4px 0; font-size: 12px; color: var(--ui-label); }
.deploy-modal input[type="password"] { width: 100%; height: 31px; box-sizing: border-box; background-color: var(--ui-input-bg); color: var(--ui-text); border: 1px solid var(--ui-soft-line); border-radius: 4px; padding: 0 8px; font-size: 13px; font-family: inherit; }
.deploy-modal textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 70px;
    background-color: var(--ui-input-bg);
    color: var(--ui-text);
    border: 1px solid var(--ui-soft-line);
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
}
.deploy-reboot-label { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--ui-label); cursor: pointer; }
.deploy-modal-actions { display: flex; justify-content: flex-end; gap: var(--ui-btn-gap); margin-top: 12px; }
.deploy-status { margin-top: 10px; font-size: 12px; color: var(--ui-label); }
.deploy-results { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.deploy-result-row { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; }
.deploy-result-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; }
.deploy-result-dot.success { background-color: var(--ui-ok); }
.deploy-result-dot.failure { background-color: var(--ui-fail); }

/* ---- Maps: every map style (Leaflet controls, footer, labels, markers, line labels) is in trackmap/map.css, loaded by the map pages (BW 2026-10-30) ---- */

.ui-info { display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px; margin: 0 0 0 5px; padding: 0; vertical-align: -1px; border: 1px solid var(--ui-label); border-radius: 50%; background: none; color: var(--ui-label); font: italic 700 9px/1 var(--ui-font, inherit); cursor: help; }   /* the (i) after a label; trackmap.js infoIcon() shows the text in .ui-info-tip */
:is(.rhs-card, .rhs-venue, .rhs-tab-panel).has-info .field-row { position: relative; padding-right: 18px; }   /* a card with (i) icons: one column at the right edge; rows without an icon keep the padding so all values line up */
:is(.rhs-card, .rhs-venue, .rhs-tab-panel).has-info .field-row .ui-info { position: absolute; right: 0; top: 50%; margin: -6px 0 0 0; }
.rhs-pick { display: flex; align-items: center; flex-basis: 100%; }   /* a dropdown with its (i) at the right edge */
.rhs-pick .rhs-select { flex: 1 1 auto; min-width: 0; }
/* a picker as wide as a field's control (BW 2026-11-04, TRACK LIBRARY): the same 65 % column and the same (i) column at the right edge as a field row */
.rhs-pick.pick-field { position: relative; padding-right: 18px; box-sizing: border-box; }
.rhs-pick.pick-field .rhs-select { flex: 0 0 65%; max-width: 65%; }
.rhs-pick.pick-field .ui-info { position: absolute; right: 0; top: 50%; margin: -6px 0 0 0; }
/* a TURNS / PIT card of this layout's own element (BW 2026-11-04): the corporate orange at 10 % over the card background (90 % transparent) */
.rhs-card.card-own { background-color: color-mix(in srgb, var(--3dt-orange) 10%, var(--ui-section-bg)); }
.ui-info:hover, .ui-info:focus-visible, .ui-info.open { color: var(--ui-text); border-color: var(--ui-text); outline: none; }
.ui-info-tip { position: fixed; z-index: 3000; max-width: 260px; padding: 7px 9px; border: 1px solid var(--ui-line); border-radius: 4px; background-color: var(--ui-highlight-bg); color: var(--ui-text); font-size: 11px; line-height: 1.4; pointer-events: none; }
/* ---- Shared components approved by BW 2026-10-28 (kb/conventions/gui-components.md) ---- */
/* Icon-only button: square at the one button height, any colour variant (btn btn-neutral btn-icon). */
.btn-icon { width: 31px; height: 31px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon svg { width: 14px; height: 14px; fill: currentColor; }

/* Checkbox: palette box, orange when checked (class ui-check on the input). The Leaflet layers control's overlay checkbox (DARK) takes the same look (BW 2026-10-28); base-layer radios stay native. */
.ui-check,
.leaflet-control-layers-overlays input.leaflet-control-layers-selector { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 16px; height: 16px; margin: 0; cursor: pointer;
            background-color: var(--ui-input-bg); border: 1px solid var(--ui-line); border-radius: 3px; }
.ui-check:hover,
.leaflet-control-layers-overlays input.leaflet-control-layers-selector:hover { border-color: var(--ui-text); }
.ui-check:checked,
.leaflet-control-layers-overlays input.leaflet-control-layers-selector:checked { background-color: var(--ui-accent); border-color: var(--ui-accent); }
.ui-check:checked::after,
.leaflet-control-layers-overlays input.leaflet-control-layers-selector:checked::after { content: ''; position: absolute; left: 4px; top: 0; width: 4px; height: 8px; border: solid var(--ui-text); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ui-check:disabled,
.leaflet-control-layers-overlays input.leaflet-control-layers-selector:disabled { opacity: 0.4; cursor: not-allowed; }

/* Range slider: grey track, orange left of the thumb (the page sets --p = 0..1), white thumb (class ui-range on the input). */
.ui-range { color: var(--ui-text); --p: 0; -webkit-appearance: none; appearance: none; height: 16px; margin: 0; background: transparent; cursor: pointer; }
.field-row-pair .ui-range { flex: 1; width: 0; min-width: 0; }   /* in a form row the slider fills the 65 % column up to its value (TRACKMAP geometry, every page) */
.field-row-pair .ui-range + span, .field-row-pair .row-value { flex: none; min-width: 78px; text-align: right; color: var(--ui-text); font-size: 12px; font-variant-numeric: tabular-nums; }   /* the value right of a slider */
.ui-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--ui-accent) calc(7px + (100% - 14px) * var(--p)), var(--ui-muted) 0); }
.ui-range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border: none; border-radius: 50%; background: var(--ui-text); transition: transform 0.1s; }
.ui-range:hover::-webkit-slider-thumb { transform: scale(1.15); }
.leaflet-control-layers-overlays input.leaflet-control-layers-selector { vertical-align: middle; margin-right: 6px; }
.ui-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--ui-muted); }
.ui-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ui-accent); }
.ui-range::-moz-range-thumb { width: 14px; height: 14px; border: none; border-radius: 50%; background: var(--ui-text); }

/* Colour swatch picker: pick one of a few palette colours (ui-swatch + ui-swatch-none|red|green|blue). */
.ui-swatches { display: inline-flex; gap: 8px; }
.ui-swatch { width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 1px solid var(--ui-line); background-color: transparent; cursor: pointer; }
.ui-swatch.on { box-shadow: 0 0 0 2px var(--ui-text); }
.ui-swatch-none { background: linear-gradient(135deg, transparent 45%, var(--ui-label) 45%, var(--ui-label) 55%, transparent 55%); }
.ui-swatch-red { background-color: var(--3dt-red); }
.ui-swatch-green { background-color: var(--3dt-green); }
.ui-swatch-blue { background-color: var(--3dt-blue); }
/* a popup file field while a file is dragged over it (popup.js type 'file') */
.deploy-modal input.drop-over { border-color: var(--ui-accent); }
/* a read-only ID shown as plain text just left of its field (BW 2026-11-04, TRACK LIBRARY): right-justified, 5 px from the field - the gap between a field and its (i) */
.field-row .row-id { margin-left: auto; margin-right: -5px; color: var(--ui-label); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---- Waiting wheel (BW 2026-11-05): every component that waits for the database gets .ui-busy while it waits (popup.js guiBusy(host, promise), or toggle the class).
   A thin grey ring at the centre of the component only; the page stays usable. Shown after 300 ms so quick loads do not flicker. The host is positioned by this rule. */
.ui-busy { position: relative; }
.ui-busy::after {
    content: ""; position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; box-sizing: border-box; z-index: 5; pointer-events: none;
    border: 3px solid color-mix(in srgb, var(--ui-label) 25%, transparent); border-top-color: var(--ui-label); border-radius: 50%;
    opacity: 0; animation: ui-busy-spin 0.9s linear infinite, ui-busy-in 0.15s 0.3s forwards;
}
.ui-busy > * { opacity: 0.5; transition: opacity 0.15s 0.3s; }
@keyframes ui-busy-spin { to { transform: rotate(360deg); } }
@keyframes ui-busy-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ui-busy::after { animation: ui-busy-spin 4s linear infinite, ui-busy-in 0.15s 0.3s forwards; } }

/* TABLES-card rows (moved from database/index.php, shared with CONFIG > CUSTOMERS DEVICES / EVENTS): compact 24 px rows with a status dot (.db-live, green .on = active), small-caps group / column header (.db-grp, .db-tab.hd), right-aligned numbers (.v). */
/* table list: compact rows (gui-components.md), name | rows | size */
.db-tab { display: grid; grid-template-columns: 7px 1fr 86px 70px 13px; gap: 8px; align-items: center; height: 24px; padding: 0 6px; cursor: pointer; font-size: 12px; font-variant-numeric: tabular-nums; border-radius: 3px; }
.db-tab:hover, .db-tab.open { background-color: var(--ui-highlight-bg); }
.db-tab.open .n { color: var(--ui-accent); font-weight: 700; }
.db-tab .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-tab .ui-info { margin: 0; }   /* row (i): last column, flush with the card's right edge (gui-components: rows right, titles next to the text) */
.db-tab .v { text-align: right; }
/* live-write dot: the size of the nav footer's VPN dot; green + gentle pulse while rows arrive, dim when idle */
.db-live { width: 7px; height: 7px; border-radius: 50%; background-color: var(--ui-soft-line); }
.db-live.on { background-color: var(--3dt-green); animation: db-pulse 1.6s ease-out infinite; }
@keyframes db-pulse { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--3dt-green) 60%, transparent); } to { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .db-live.on { animation: none; } }
.db-grp { margin: 10px 0 4px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ui-label); }
.db-grp:first-child { margin-top: 0; }
.db-tab.hd { cursor: default; height: 22px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ui-label); }
.db-tab.hd:hover { background-color: transparent; }
.db-tab .nul { color: var(--ui-muted); }
.db-live.on.still { animation: none; }
/* card title with an (i): the title is a flex line so the (i) sits on the vertical centre of the title text, on every page (BW 2026-11-08: always align the tooltip with the card title) */
.rhs-card > h3:has(> .ui-info) { display: flex; align-items: center; }
.rhs-card > h3 > .ui-info { margin-top: 0; margin-bottom: 0; vertical-align: baseline; flex: none; }
/* sortable column header of a .db-tab list (CUSTOMERS DEVICES / EVENTS): official field names as written; click sorts, the sorted one is accent-coloured with the same arrows as the grids */
.db-tab.hd.sortable > span { cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 11px; user-select: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-tab.hd.sortable > span:hover { color: var(--ui-text); }
.db-tab.hd.sortable > span.sorted { color: var(--ui-accent); }
.db-tab.hd.sortable > span.v { text-align: right; }
