/* GOcontroll Cloud dashboard — GENERATED by cloud-deployer. Static; the brand tokens
   come from /api/app-config (styling.brand / styling.brand_secondary) applied to
   --brand / --brand-2 at runtime. Tokens mirror GOcontroll-Architecture/styling.
   Theme-aware (light default + prefers-color-scheme dark). Do not hand-edit. */

:root {
  --brand: #e94e25;
  --brand-light: #fdf2ef;
  --brand-dim: rgba(233, 78, 37, .12);
  /* The SECOND accent (configurator.md §3.2): --brand is identity/chrome, --brand-2 is
     what the VIEWER PICKED — selected rows/tabs/ticks and the whole time control. Same
     literal default, so an unbranded deployment looks exactly as it always did; app.js
     overrides it with styling.brand_secondary, or with styling.brand when that is empty.
     Its tints are mixed from the live value per rule (with the static --brand-* as the
     fallback declaration), because a selection background must follow the chosen colour —
     an orange tint under a blue border is the bug this split is meant to end. */
  --brand-2: #e94e25;
  /* Derived from the two accents by app.js (readableAccents): an accent is used as given for
     fills, borders and rules, but TEXT and LINES drawn IN it use its -ink twin (darkened, or
     in the dark theme lightened, until it reads against the page), and text drawn ON it uses
     --on-brand(-2) (white while white reads, else the ink black). A light accent — a yellow —
     otherwise gives white-on-yellow buttons and invisible chart lines. The GOcontroll orange
     passes as it is, so these defaults are what an unbranded deployment keeps. */
  --brand-ink: #e94e25;
  --brand-2-ink: #e94e25;
  --on-brand: #fff;
  --on-brand-2: #fff;
  --black: #1a1a1a;
  --bg: #f5f5f5;
  --panel: #fff;
  --white: #fff;
  --muted: #6b7280;
  --border: #e2e2e2;
  --border2: #d0d0d0;
  --danger: #dc2626;
  --warn: #d97706;
  --info: #2563eb;
  --ok: #16a34a;
  --radius: 6px;
  /* ONE font for everything readable — device ids, labels, values, headings, table
     cells, axis ticks (deployment.md §3, `pages`). --mono is reserved for literal
     machine text a reader transcribes or copies; in this UI that is only the
     one-time code. Columns of numbers line up with `font-variant-numeric:
     tabular-nums`, never by switching face. */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', ui-monospace, monospace;
  --topbar-h: 52px;
  --tabbar-h: 40px;
  --sidebar-w: 288px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-light: rgba(233, 78, 37, .16);
    --black: #ececec;
    --bg: #131313;
    --panel: #1c1c1c;
    --white: #1c1c1c;
    --muted: #9aa0aa;
    --border: #2c2c2c;
    --border2: #3a3a3a;
  }
}

* { box-sizing: border-box; }
/* The `hidden` attribute must beat author `display` rules (e.g. .empty-state uses
   flex, which would otherwise override the UA [hidden]{display:none}). */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--black);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.spacer { flex: 1 1 auto; }

/* Nothing before the design (deployment.md §3, 0.51.0): until app.js has the branding and knows
   what to show, the chrome is not painted — only the page background. The tokens above are
   GOcontroll's, and a client's viewer must not see them flash before the login screen. */
body.booting .topbar, body.booting .tab-bar, body.booting .shell { visibility: hidden; }

/* ---- top bar ---- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 3px solid var(--brand);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo { height: 26px; width: auto; }
/* Logo → divider → app title, per the styling guide's header order. */
.topbar-div { width: 1px; height: 20px; background: var(--border); flex: 0 0 1px; }
.app-title { font-size: 15px; font-weight: 600; letter-spacing: .01em; }

/* Connection indicator — the guide's status-dot pattern (8×8 circle), not a "●" glyph
   in monospace. Mono is for the one-time code only (see the token block); this is a label. */
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.conn::before {
  content: "";
  width: 8px; height: 8px; flex: 0 0 8px;
  border-radius: 50%;
  background: var(--border2);
}
.conn.ok::before { background: var(--ok); }
.conn.err::before { background: var(--danger); }

/* ---- workspace tabs (Devices | Users) ----
   The underline bar mirrored from GOcontroll-Application-Context-Manager: a tab swaps the
   whole workspace (sidebar + content). Deliberately a different visual language from the
   per-device dashboard tabs below (.tabs/.tab, filled pills) — two nav levels that must
   not read as one. Which tabs exist is decided by the role in app.js.
   It is only hidden pre-boot and behind the login gate (which hides .shell anyway), so
   .shell's height may bank on it being there. */
.tab-bar {
  height: var(--tabbar-h);
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.tab-item {
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .1s;
}
.tab-item:hover { color: var(--black); background: var(--bg); }
/* selection state ⇒ the SECONDARY accent (configurator.md §3.2) */
.tab-item.active { color: var(--brand-2-ink); border-bottom-color: var(--brand-2); background: var(--bg); font-weight: 700; }

/* ---- shell layout ---- */
/* The content column may shrink below its content (minmax 0): the sidebar's width is the
   viewer's (0.51.0), and the dashboard takes what is left. */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - var(--tabbar-h));
}
/* General is the one workspace without a sidebar — the roster is the content there. The
   column has to collapse, or the content lands in the (now empty) sidebar track. */
.shell.full { grid-template-columns: minmax(0, 1fr); }
/* Connect Claude (auth.mcp) */
.connect-wrap { max-width: 720px; padding: 20px 24px; }
.cn-title { margin: 0 0 14px; font-size: 18px; }
.cn-row { display: flex; gap: 8px; align-items: center; }
.cn-url { flex: 1 1 auto; font-family: var(--mono, ui-monospace, monospace); }
.cn-steps { margin: 16px 0 8px; padding-left: 20px; line-height: 1.7; }
.cn-sub { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cn-table td:last-child { text-align: right; }
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
/* the device sidebar's edge (configurator.md §6.1, 0.51.0): drag, arrow keys, double-click to fit */
.side-resize {
  position: absolute; top: 0; right: -4px; width: 8px; height: 100%;
  cursor: col-resize; z-index: 5; touch-action: none; outline: none;
}
.side-resize::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 2px;
  background: transparent; transition: background .12s;
}
.side-resize:hover::after, .side-resize:focus-visible::after { background: var(--border2); }
body.side-resizing .side-resize::after { background: var(--brand-2); }
body.side-resizing { cursor: col-resize; user-select: none; }
.side-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 16px 8px;
}
.side-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.side-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-sort { display: flex; align-items: center; gap: 0; margin: -2px 12px 10px 16px; }
.side-sort[hidden] { display: none; }
.side-sort-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 8px; }
.side-sort-b { height: 26px; padding: 0 10px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; margin-left: -1px; }
.side-sort-b:first-of-type { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.side-sort-b { flex: 1 1 auto; min-width: 0; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-sort-b:last-of-type { border-radius: 0 var(--radius) var(--radius) 0; }
.side-sort-b.sel { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-brand-2); position: relative; }
.search {
  margin: 0 12px 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--black);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}
.search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dim); }
.device-list { overflow-y: auto; padding: 0 8px 12px; }

.device {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  margin: 1px 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.device:hover { background: var(--bg); }
.device.sel {
  background: var(--brand-light);
  background: color-mix(in srgb, var(--brand-2) 12%, transparent);
  border-color: var(--brand-2);
}
.device .dev-id { font-weight: 600; font-size: 13px; word-break: break-all; }
.device .dev-fields { margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.device .dev-f { font-size: 11.5px; color: var(--muted); }
.device .dev-f b { color: var(--black); font-weight: 600; }
/* a state field in its colour (configurator.md §5.1, since 0.46.0) */
.device .dev-f b.st-ok { color: var(--ok); }
.device .dev-f b.st-warn { color: var(--warn); }
.device .dev-f b.st-danger { color: var(--danger); }
.device .dev-f b.st-info { color: var(--info); }

/* ---- content ---- */
.content { overflow-y: auto; min-height: 0; padding: 12px; }
.empty-state {
  display: flex; align-items: center; justify-content: center;
  height: 60vh; color: var(--muted); font-size: 14px;
}
/* ---- General workspace — the fleet (configurator.md §6.2) ----
   Full width: it has no sidebar, because the roster IS the content here. */
.general-wrap { max-width: 1400px; }

.fleet-map-wrap { position: relative; margin-bottom: 10px; }
.fleet-map {
  height: 320px; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg);
}
.fleet-map-empty { display: flex; align-items: center; justify-content: center; height: 100%; }

/* The marker is the project favicon; the dot at its corner is the online reading — the
   same green/red the row's last-seen cell carries. */
.fleet-pin { background: none; border: 0; }
.fleet-pin img {
  width: 22px; height: 22px; display: block; border-radius: 4px;
  background: #fff; padding: 2px; box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.fleet-dot {
  position: absolute; right: -2px; bottom: -2px;
  width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff;
}
.fleet-dot.on  { background: var(--ok); }
.fleet-dot.off { background: var(--danger); }

/* The hover tile: what the row says, plus the way into that device's dashboards. */
.fleet-tile {
  /* above every Leaflet pane AND its controls (which reach z-index 1000) */
  position: absolute; z-index: 1200; transform: translate(-50%, -100%);
  min-width: 180px; max-width: 260px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border2); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.ft-id { font-size: 13px; font-weight: 700; color: var(--black); word-break: break-all; }
.ft-seen { font-size: 11.5px; font-weight: 600; margin-top: 1px; }
.ft-seen.on  { color: var(--ok); }
.ft-seen.off { color: var(--danger); }
.ft-f { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ft-f b { color: var(--black); font-weight: 600; margin-left: 2px; }
.ft-dash {
  display: block; width: 100%; text-align: left; margin-top: 6px;
  padding: 6px 9px; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--brand-2-ink); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.ft-dash:hover { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 10%, transparent); }
.ft-none { margin-top: 6px; }

.fleet-table { width: 100%; border-collapse: collapse; }
.fleet-table th {
  text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); white-space: nowrap;
  padding: 4px 10px 6px; border-bottom: 1px solid var(--border2);
}
.fleet-table td {
  padding: 6px 10px; font-size: 13px; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.fleet-row { cursor: pointer; }
.fleet-row:hover td { background: color-mix(in srgb, var(--brand-2) 8%, transparent); }
.fleet-id { font-weight: 600; word-break: break-all; }
/* The colour IS the status — no separate status column (configurator.md §6.2). */
.fleet-seen.on  { color: var(--ok); font-weight: 600; }
.fleet-seen.off { color: var(--danger); font-weight: 600; }
/* health first, the fleet's figures, a column's rise (configurator.md §6.2, since 0.33.0) */
.fleet-health { white-space: nowrap; }
/* the health column: the status dot alone, as narrow as its header (since 0.37.0) */
.fleet-table th.fleet-health, .fleet-table td.fleet-health { width: 1%; padding-left: 12px; padding-right: 12px; }
.fleet-table td.fleet-health { text-align: center; }
.fleet-table td.fleet-health .health-dot { margin: 0; vertical-align: 0; cursor: help; }
.fleet-rise { margin-left: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
/* the table left, the map right on a third, following the page down (configurator.md §6.2) */
.general-wrap { max-width: 1800px; }
.fleet-body { display: block; }
.fleet-body.with-map { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.fleet-body.with-map .fleet-map-wrap { order: 2; position: sticky; top: 8px; margin-bottom: 0; }
.fleet-body.with-map .fleet-map { height: min(72vh, 680px); }
@media (max-width: 900px) { .fleet-body.with-map { grid-template-columns: 1fr; } .fleet-body.with-map .fleet-map-wrap { order: -1; position: static; } }
/* the events of the last days: one dot per event type the device had, side by side (since 0.36.0) */
.fleet-ev { white-space: nowrap; }
.fleet-ev .ev-dots { gap: 4px; }
.fleet-ev .ev-dot { width: 9px; height: 9px; cursor: help; }
/* a sortable header: the sorted one in the selection accent, a caret for its direction (since 0.36.0) */
.fleet-table th.fleet-sort { cursor: pointer; user-select: none; }
/* removing devices (device_removal): the bar above the table, the tick per row */
.fleet-pick { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-bottom: 8px; }
.fleet-pick-n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: auto; }
.fleet-table th.fleet-tick, .fleet-table td.fleet-tick { width: 1%; padding-right: 0; }
.dev-tick { display: inline-block; width: 13px; height: 13px; vertical-align: -1px; border: 1.5px solid var(--border2);
  border-radius: 3px; background: var(--panel); }
.dev-tick.on { border-color: var(--danger); background: var(--danger); box-shadow: inset 0 0 0 2px var(--panel); }
.fleet-table tr.picked td { background: rgba(220, 38, 38, .06); }
.fleet-table th.fleet-sort:hover { color: var(--black); }
.fleet-table th.fleet-sort.sorted { color: var(--brand-2-ink); }
.fleet-table th.fleet-sort.sorted::after { content: ""; display: inline-block; margin-left: 6px; vertical-align: 2px;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 5px solid currentColor; }
.fleet-table th.fleet-sort.sorted.desc::after { border-bottom: 0; border-top: 5px solid currentColor; }
.fleet-row:hover td { background: color-mix(in srgb, var(--brand-2) 12%, transparent); }
.fleet-pin.lit { z-index: 1000 !important; }
.fleet-pin.lit img { transform: scale(1.45); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-2) 55%, transparent); transition: transform .12s; }
/* figures, an equal cell each across the width — the General tab's fleet figures (since 0.36.0)
   and the stats widget (since 0.38.0) look alike */
.fleet-summary { margin-bottom: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.fig { display: flex; flex-direction: column; gap: 3px; padding: 12px 18px 13px; border-left: 1px solid var(--border); min-width: 0; }
.fig:first-child { border-left: 0; }
.fig[title]:not([title=""]) { cursor: help; }
.fig-k { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig-v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.fig-s { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fig-dot { display: inline-flex; align-items: center; white-space: nowrap; }
.fig-dot .health-dot { margin-right: 5px; vertical-align: 0; }
/* the stats widget: one row filling its card, sideways scrolling when the figures do not fit */
.widget.w-stats { padding: 0; }
.w-stats .figs { flex: 1; min-height: 0; grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(max-content, 1fr); overflow-x: auto; overflow-y: hidden; }
/* every label at the top, centred, every value centred under it — the same height in every cell,
   whether or not a figure has a sub line */
.w-stats .fig { justify-content: flex-start; align-items: center; text-align: center; padding: 10px 10px 6px; }
.w-stats .fig-v { font-size: 20px; }
.w-stats .fig-s { font-size: 11px; white-space: nowrap; justify-content: center; }

/* per-device dashboard tabs — the second nav level, inside the Devices workspace. Which
   of these exist depends on the selected device (dashboard_access; see app.js). */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.tab {
  height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  transition: color .12s, border-color .12s, background .12s;
}
.tab:hover { border-color: var(--border2); color: var(--black); }
.tab.sel {
  background: var(--brand-2); border-color: var(--brand-2); color: var(--on-brand-2);
  box-shadow: 0 1px 4px var(--brand-dim);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--brand-2) 20%, transparent);
}

.dash-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; --ctl-h: 30px; }
.dash-toolbar .btn { height: var(--ctl-h); padding: 0 14px; }
/* interactive time bar — viewer picks live / historical window (see app.js) */
.time-sel { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.time-sel > select.time-input, .time-sel > input.time-input { height: var(--ctl-h, 30px); padding: 0 8px; }
.time-input {
  font: inherit; font-size: 12.5px; color: var(--black);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 8px; outline: none;
}
.time-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dim); }
.time-dt { font-variant-numeric: tabular-nums; }
.time-lbl { white-space: nowrap; }
/* the page's device, named at the time bar's end (since 0.41.0): the label small, the id large */
.dev-ctx { margin-left: auto; display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.dev-ctx-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dev-ctx-id { font-size: 17px; font-weight: 700; color: var(--black); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.time-reset {
  padding: 4px 9px; border: 1px solid var(--border); border-radius: 100px;
  background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-size: 11.5px;
}
.time-reset:hover { border-color: var(--brand); color: var(--brand-ink); }

/* graphical time control: scale presets (hour/day/week/month) + dual-handle range slider */
.time-scales { display: inline-flex; gap: 0; }
.time-scale {
  height: var(--ctl-h, 30px); padding: 0 12px; border: 1px solid var(--border); border-radius: 0; margin-left: -1px;
  background: var(--panel); color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600;
  transition: color .12s, border-color .12s, background .12s;
}
.time-scale:hover { border-color: var(--border2); color: var(--black); }
/* the whole time control is "what the viewer picked" ⇒ secondary throughout */
.time-scale.sel { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-brand-2); position: relative; }
.time-scale:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.time-scale:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.time-range-lbl { font-variant-numeric: tabular-nums; color: var(--black); white-space: nowrap; }
/* The guide's button base. inline-flex + gap carries an icon next to the label; the
   explicit centring keeps full-width buttons (the login card's) centred, which a flex
   container would otherwise left-align. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--black); cursor: pointer; font: inherit; font-size: 13px;
  transition: color .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand-ink); }

/* ---- widget grid (12-col, mirrors the configurator layout) ----
   One layout row is 40px + a 6px gap = 46px: the configurator's DASH_ROW_PX, so a widget is
   as tall here as the operator drew it (tests/widgets.test.js pins the two together). */
.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 40px;
  gap: 6px;
}
.widget {
  grid-column: span 4;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.w-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* A full draw under way (drawGrid): the previous page dims at once; a heavy widget waits in its
   place until its data is in. A state, not a message — no words. */
.grid.loading { opacity: .45; pointer-events: none; transition: opacity .12s ease; }
.w-body.w-wait { border-radius: calc(var(--radius) - 2px); margin: 2px 0;
  background: linear-gradient(90deg, transparent 0%, var(--border) 50%, transparent 100%) 0 0 / 200% 100%;
  animation: wWait 1.2s linear infinite; opacity: .6; }
@keyframes wWait { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .w-body.w-wait { animation: none; } }
.dash-w-empty { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; justify-content: center; flex: 1; text-align: center; }

/* gauge */
.gauge-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; }
.gauge-svg { width: 100%; max-width: 190px; height: auto; }
/* A stat value is still UI text; tabular-nums keeps the digits from jittering as it
   updates, which is the only thing the monospace face was buying here. */
.gauge-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: -6px; }
.gauge-range { margin-top: 2px; }
.gauge-sec { margin-top: 4px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* gauge style "dial" — a 270° instrument dial drawn whole in one SVG (configurator.md §6.1) */
/* The dial fills its cell and scales inside it: pinned to the wrap, so a short cell shrinks the
   drawing instead of letting it spill over the widget title. */
.gauge-wrap.dial { position: relative; min-height: 0; }
.dial-svg { width: 100%; height: 100%; min-height: 0; }
.gauge-wrap.dial .dial-svg { position: absolute; inset: 0; }
.dial-tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.dial-val { font-size: 34px; font-weight: 700; fill: var(--black); font-variant-numeric: tabular-nums; }
.dial-unit { font-size: 12px; fill: var(--muted); }
/* the vertical bar gauge (since 0.46.0) */
.bar-svg { width: 100%; height: 100%; min-height: 0; }
.bar-val { font-size: 20px; font-weight: 700; fill: var(--black); font-variant-numeric: tabular-nums; }
.bar-unit { font-size: 11px; font-weight: 400; fill: var(--muted); }
.bar-mark { stroke: var(--muted); stroke-width: 1; }
.dial-sec { font-size: 12px; font-weight: 700; fill: var(--black); font-variant-numeric: tabular-nums; }

/* tyres — the vehicle from above, a reading beside every tyre */
.tyres-wrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.tyres-svg { width: 100%; height: 100%; }
.tyres-wrap.off .tyres-svg { opacity: .3; }
.tyres-off { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.ty-side { font-size: 11px; font-weight: 700; fill: var(--muted); }
.ty-val { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ty-unit { font-size: 10px; fill: var(--muted); }

/* wear — per zone: label, the bar of what remains, initial · degraded · remaining */
.wear-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 5px; min-height: 0; }
.wear-label { font-size: 13px; font-weight: 700; margin-bottom: 5px; }
.wear-bar { height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; margin-bottom: 6px; }
.wear-bar i { display: block; height: 100%; background: var(--ok); }
.wear-bar i.low { background: var(--danger); }
.wear-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wear-num { display: flex; flex-direction: column; }
.wear-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.wear-v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.wear-num.low .wear-v { color: var(--danger); }

/* properties — label · value per device property, editable in place (configurator.md §14.10) */
.prop-list { display: flex; flex-direction: column; gap: 2px; overflow: auto; min-height: 0; }
.prop-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.prop-row:last-child { border-bottom: 0; }
.prop-k { font-size: 12.5px; color: var(--muted); }
.prop-v { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.prop-edit { display: inline-flex; align-items: center; gap: 6px; }
.prop-input { width: 150px; flex: 0 0 auto; }
.prop-u { font-size: 12px; color: var(--muted); }
/* a gauge as its plain readings (configurator.md §6.1, style "plain", since 0.37.0) */
.gauge-plain { justify-content: center; flex: 1; }
.gauge-plain .prop-v { font-size: 16px; }
.prop-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.prop-msg { font-size: 12.5px; color: var(--danger); }

/* timeseries axis chart */
.spark-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.spark-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 4px; }
.spark-legend span { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.spark-legend i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
/* X = active time window, Y = configured band. Gutters via a 2×2 grid. */
.ts-chart {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 54px 1fr;
  grid-template-rows: 1fr 15px;
  column-gap: 4px;
}
.ts-yaxis { grid-column: 1; grid-row: 1; position: relative; }
.ts-plot  { grid-column: 2; grid-row: 1; position: relative; min-height: 0;
  border-left: 1px solid var(--border2); border-bottom: 1px solid var(--border2); }
.ts-corner { grid-column: 1; grid-row: 2; }
/* a second unit reads against an axis of its own on the right (since 0.36.0) */
.ts-chart.two-axes { grid-template-columns: 54px 1fr 54px; }
.ts-yaxis.right { grid-column: 3; grid-row: 1; }
.ts-yaxis.right .ts-ylab { right: auto; left: 5px; }
/* a boolean reads against an On/Off axis of its own, right of the second unit's (since 0.46.0) */
.ts-chart.three-axes { grid-template-columns: 54px 1fr 54px 30px; }
.ts-plot .ts-mark { fill: var(--muted); opacity: .1; }
.ts-xaxis { grid-column: 2; grid-row: 2; position: relative; }
.ts-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ts-grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ts-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ts-ylab { position: absolute; right: 5px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ts-xlab { position: absolute; top: 2px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ts-nodata { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

/* interactive cursor: a crosshair that follows the pointer along the time axis, with a dot on
   each series and a tooltip; it drives the synced map marker below (see app.js broadcastCursor). */
.ts-plot { cursor: crosshair; }
.ts-cursor { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.ts-cursor-line { position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -0.5px; background: var(--muted); opacity: .65; }
.ts-cursor-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--panel); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.ts-cursor-tip {
  position: absolute; top: 4px; transform: translateX(8px);
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 8px; font-size: 11px; line-height: 1.5; color: var(--black);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .16); white-space: nowrap;
}
.ts-cursor-tip.flip { transform: translateX(calc(-100% - 8px)); }
.ts-cursor-time { display: block; font-variant-numeric: tabular-nums; font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.ts-cursor-row { display: flex; align-items: center; gap: 5px; }
.ts-cursor-row i { width: 9px; height: 3px; border-radius: 2px; display: inline-block; flex: none; }
.ts-cursor-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
/* the synced map marker — the chart-hovered position; a soft pulse so it reads as the live cursor */
path.map-cursor { animation: mapCursorPulse 1.4s ease-in-out infinite; }
@keyframes mapCursorPulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
/* drag-to-zoom: the brushed span highlighted while selecting a new time window. This IS a
   time selection, so it follows the SECONDARY accent like the rest of the time control;
   color-mix follows the live --brand-2 where supported, else the static --brand-dim fallback. */
.ts-brush {
  position: absolute; top: 0; bottom: 0; z-index: 3; pointer-events: none;
  background: var(--brand-dim);
  background: color-mix(in srgb, var(--brand-2) 16%, transparent);
  border-left: 1px solid var(--brand-2); border-right: 1px solid var(--brand-2);
}

/* table */
.dash-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dash-table th { text-align: left; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; font-size: 10.5px; padding: 4px 8px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel); }
.dash-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.dash-table td.muted { color: var(--muted); }
.table-scroll { overflow: auto; flex: 1; min-height: 0; }
/* trips: a row opens its trip (sets the time window); the chosen one carries the selection accent */
.trip-row { cursor: pointer; }
.trip-row:hover td { background: color-mix(in srgb, var(--brand-2) 8%, transparent); }
.trip-row.sel td { background: color-mix(in srgb, var(--brand-2) 16%, transparent); font-weight: 600; }
.trip-row.doubt td { color: var(--muted); }
.trips-table th, .trips-table td { white-space: nowrap; padding: 4px 5px; }
.trips-table td.trip-dots { width: 1%; padding-right: 0; }

/* ---- sessions: loading and unloading (configurator.md §6.1) ---- */
.sess-kind { white-space: nowrap; }
.sess-mark { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: 0; border: 2px solid var(--ok); background: var(--ok); }
.sess-mark.unload { border-color: var(--black); background: var(--black); }
.sess-mark.off { background: transparent; }
.sess-off { color: var(--muted); font-style: italic; }
.sess-change { font-weight: 600; text-align: right; }

/* ---- event dots: one per severity (sidebar row, trip row) ---- */
.ev-dots { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.ev-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.ev-dot.danger { background: var(--danger); }
.ev-dot.warn { background: var(--warn); }
.ev-dot.info { background: var(--info); }

/* ---- health (configurator.md §14.11): the status dot and the widget with its reasons ---- */
.health-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: 1px; background: var(--border); }
.health-dot.green { background: var(--ok); }
.health-dot.orange { background: var(--warn); }
.health-dot.red { background: var(--danger); }
.health-dot.unknown { background: var(--muted); }
/* a General row's alerts as the sidebar's dot (since 0.46.0): nothing to say, no dot — its room kept */
.health-dot.alert-dot.none { visibility: hidden; }
.alert-dot { cursor: help; }
/* a state in its colour, a value outside its band, activity Yes/No (configurator.md §6.2, since 0.46.0) */
.st-ok { color: var(--ok); font-weight: 600; }
.st-warn { color: var(--warn); font-weight: 600; }
.st-danger { color: var(--danger); font-weight: 600; }
.st-info { color: var(--info); font-weight: 600; }
.health { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto; }
.health-head { display: flex; align-items: center; gap: 8px; }
.health-pill { padding: 2px 12px; border-radius: 100px; font-weight: 700; font-size: 13px; color: #fff; background: var(--muted); }
.health-pill.green { background: var(--ok); }
.health-pill.orange { background: var(--warn); }
.health-pill.red { background: var(--danger); }
.health-day { font-size: 11px; color: var(--muted); }
.health-list { display: flex; flex-direction: column; gap: 3px; }
.health-r { font-size: 12px; display: flex; flex-direction: column; padding-left: 8px; border-left: 3px solid var(--border); }
.health-r b { font-weight: 700; }
.health-r span { color: var(--muted); font-size: 11.5px; }
.health-r.red { border-left-color: var(--danger); }
.health-r.orange { border-left-color: var(--warn); }
.health-r.unknown { border-left-color: var(--muted); }
.health-r.note { border-left-color: var(--info); }
.health-r.none { color: var(--muted); border-left-color: var(--ok); }

/* ---- settings (configurator.md §14.11): thresholds in force, default, fleet, this device ---- */
.settings-table td { vertical-align: middle; }
.setting-val { font-weight: 700; white-space: nowrap; }
.setting-src { margin-left: 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.setting-src.fleet { color: var(--info); }
.setting-src.device { color: var(--brand-ink, var(--brand)); }
.setting-input { width: 84px; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; font: inherit; font-size: 12px; background: var(--panel); color: inherit; }
.settings-msg { font-size: 12px; color: var(--danger); }
.settings-foot { font-size: 11px; color: var(--muted); margin-top: 4px; }
.export-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.export-msg { font-size: 12px; color: var(--danger); }

/* ---- download: a period's raw data as one ZIP (configurator.md §6.1) ---- */
.download { display: flex; flex-direction: column; gap: 8px; }
.download-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.download-info { font-size: 12.5px; color: var(--muted); }
.download-go { margin-left: 8px; }

/* ---- the data-quality tab (configurator.md §6.3) ---- */
.quality-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.quality-title { font-size: 16px; margin: 0; }
.quality-card { display: block; }
.quality-row { cursor: pointer; }
.quality-row:hover td { background: color-mix(in srgb, var(--brand-2) 8%, transparent); }
.quality-score { font-weight: 700; }
.quality-score.ok { color: var(--ok); }
.quality-score.warn { color: var(--warn); }
.quality-score.bad { color: var(--danger); }

/* ---- the pinned moment, named in the time bar ---- */
.moment-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 2px 2px 10px; border-radius: 100px; font-size: 12px; font-weight: 600;
  color: var(--info); background: color-mix(in srgb, var(--info) 12%, transparent); white-space: nowrap; }
.moment-x { border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; padding: 0 6px; line-height: 1.4; }

/* text */
.text-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; display: flex; align-items: center; justify-content: center; flex: 1; word-break: break-all; text-align: center; }

/* state (numeric code → text) */
.state-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; flex: 1; text-align: center; min-width: 0; }
.state-pill { padding: 4px 12px; border-radius: 100px; font-weight: 700; font-size: 13px; max-width: 100%; word-break: break-word; }
.state-pill.c-neutral { background: rgba(107, 114, 128, .14); color: var(--muted); }
.state-pill.c-ok      { background: rgba(22, 163, 74, .12);   color: var(--ok); }
.state-pill.c-warn    { background: rgba(217, 119, 6, .14);   color: var(--warn); }
.state-pill.c-danger  { background: rgba(220, 38, 38, .12);   color: var(--danger); }
.state-pill.c-info    { background: rgba(37, 99, 235, .12);   color: var(--info); }
.state-raw { font-variant-numeric: tabular-nums; }

/* boolean */
.bool-wrap { display: flex; align-items: center; justify-content: center; flex: 1; }
.bool-pill { padding: 4px 12px; border-radius: 100px; font-weight: 700; font-size: 13px; }
.bool-pill.on { background: rgba(22, 163, 74, .12); color: var(--ok); }
.bool-pill.off { background: rgba(107, 114, 128, .14); color: var(--muted); }

/* map */
.map-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.map-canvas { flex: 1; min-height: 80px; border-radius: 4px; overflow: hidden; background: var(--bg); }
.map-foot { margin-top: 3px; }

.small { font-size: 11.5px; }
.muted { color: var(--muted); }
.err { color: var(--danger); }
.ok { color: var(--ok); }

/* ---- responsive: collapse the grid + sidebar on narrow screens ---- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .sidebar { border-right: none; border-bottom: 1px solid var(--border); max-height: 40vh; }
  .side-resize { display: none; }
  .grid { grid-template-columns: repeat(4, 1fr); }
  .widget { grid-column: span 4 !important; }
}

/* ============================================================
   Auth — login screen + header user chip + user management.
   Rendered by app.js only when auth is enabled (see /api/me).
   ============================================================ */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }

.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { color: var(--on-brand); filter: brightness(1.06); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn:disabled { opacity: .55; cursor: default; }

/* login card — a sign-in PAGE, not a modal over the shell: the overlay carries the
   page background and the card the brand lockup. Mirrors the confirmation-card
   pattern in GOcontroll-Architecture/styling (12px radius, 40px logo, 3px brand rule). */
.overlay.login-ov { background: var(--bg); align-items: center; padding: 24px 16px; }
.login-card {
  position: relative; width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px 32px 24px; box-shadow: 0 8px 32px rgba(0,0,0,.10); overflow: hidden;
}
/* the same 3px brand accent the top bar carries, here as the card's crown */
.login-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--brand); }
.login-brand { margin-bottom: 22px; }
.login-logo { height: 40px; width: auto; display: block; }
.login-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand-ink); }
/* the title carries the gap the (removed) strapline used to hold — copy rule, deployment.md §3 */
.login-title { font-size: 20px; font-weight: 700; letter-spacing: .01em; margin-top: 2px; margin-bottom: 22px; }
.login-step { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.login-step > * { flex: 0 0 auto; }
.login-label { font-size: 12px; font-weight: 500; color: var(--black); }
.login-input { flex: 1 1 auto; min-width: 0; padding: 9px 11px; font: inherit; font-size: 13.5px; color: var(--black); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); outline: none; transition: border-color .15s, box-shadow .15s; }
.login-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-dim); }
.login-input.sm { padding: 6px 9px; font-size: 12.5px; }
/* The ONE place --mono is right: a code transcribed digit by digit from an email.
   Fixed advance keeps the six characters an even row and separates 0/O and 1/l.
   It matches the code panel in the mail (functions/api/[[route]].js, CODE_HTML). */
.login-code { font-family: var(--mono); font-size: 15px; letter-spacing: .22em; }
.login-btn { margin-top: 5px; padding: 9px 16px; font-weight: 600; white-space: nowrap; }
.login-msg { margin-top: 4px; min-height: 16px; }
.login-msg.err { color: var(--danger); }
.login-msg.ok { color: var(--ok); }

/* The wordmark's "controll" is anthracite (#1a1a1a) and there is only ONE logo.svg — on a
   dark panel it would vanish. Give it its own white plate rather than filtering the file,
   which would smear the brand orange. */
@media (prefers-color-scheme: dark) {
  .login-brand { display: inline-block; background: #fff; border-radius: 8px; padding: 9px 12px; }
}

/* header chip — who you are, then what you are, then the way out */
.user-area { display: inline-flex; align-items: center; gap: 10px; }
/* Its leading divider is a pseudo-element, not a sibling span: with auth off the whole
   chip is [hidden] and a sibling rule would leave the divider dangling on its own. */
.user-area::before { content: ""; width: 1px; height: 20px; background: var(--border); margin-right: 2px; }
/* An address is identity, not data: the UI font, like every other label. It was monospace,
   which read as a terminal readout. */
.user-email { font-size: 13px; color: var(--black); }
/* The guide's badge base: 2px 10px, 999px, .7rem, weight 600, letter-spacing .03em.
   Tinted rather than filled — `.badge.orange` is a solid brand fill, which next to the
   top bar's 3px brand rule is two loud oranges arguing. --brand-dim is defined for
   exactly this ("subtle brand overlays"). */
.role-badge {
  text-transform: uppercase;
  font-size: .7rem; font-weight: 600; letter-spacing: .03em;
  padding: 2px 10px; border-radius: 999px;
  background: var(--brand-dim); color: var(--brand-ink);
  border: 1px solid rgba(233, 78, 37, .25);
}
.role-badge.role-admin { background: rgba(37,99,235,.1); color: #1d4ed8; border-color: rgba(37,99,235,.25); }
.role-badge.role-user { background: rgba(107,114,128,.1); color: #4b5563; border-color: rgba(107,114,128,.25); }

/* The guide's header-utility button (.settings-btn / .logout): muted, not full-contrast —
   signing out is an escape hatch, not the page's main action. */
.btn.ghost { color: var(--muted); gap: 6px; }
.btn.ghost:hover { color: var(--brand-ink); border-color: var(--brand); }
.btn .ico { width: 14px; height: 14px; flex: 0 0 14px; display: block; }

/* ============================================================
   Users workspace — the roster sidebar + the grant matrix.
   Replaces the old modal "Manage" overlay: management is a workspace, not a dialog.
   ============================================================ */

/* --- sidebar: Administrators / Users --- */
.usr-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.usr-section { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.usr-section:last-child { border-bottom: none; }
.usr-section-head { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px 6px; }
.usr-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.usr-section-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* the add affordance sits in the section it adds to, so a new principal appears where it was made */
.usr-add-btn {
  margin-left: auto; width: 22px; height: 22px; line-height: 1; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); color: var(--muted); cursor: pointer; font: inherit; font-size: 14px;
}
.usr-add-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.usr-add-btn.open { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-light); }
.usr-add { display: flex; flex-direction: column; gap: 6px; padding: 6px 12px 10px; }
.usr-add-msg { min-height: 14px; }

.usr-list { padding: 0 8px; }
.usr-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 7px 11px; margin: 2px 0;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; cursor: pointer; font: inherit; color: inherit;
}
.usr-row:hover { background: var(--bg); }
.usr-row.sel {
  background: var(--brand-light);
  background: color-mix(in srgb, var(--brand-2) 12%, transparent);
  border-color: var(--brand-2);
}
.usr-row-email { font-size: 13px; font-weight: 600; word-break: break-all; min-width: 0; }
.usr-row-meta { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.usr-none { padding: 4px 14px 8px; }

/* --- content: the selected principal's grants --- */
.usr-page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.usr-page-title { font-size: 17px; font-weight: 700; word-break: break-all; }
.usr-page-sub { margin-bottom: 14px; }
.usr-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* The grant matrix: one compact row per device, one column per dashboard page, a tick per
   (device, dashboard) pair. Header ticks are bulk toggles over the TICKED devices. */
.gmx-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.gmx { width: 100%; border-collapse: collapse; font-size: 13px; --gmx-grouph: 28px; }
.gmx th, .gmx td { border-bottom: 1px solid var(--border); }
.gmx thead th {
  position: sticky; z-index: 1;
  background: var(--bg);
  padding: 8px 10px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); text-align: center; white-space: nowrap;
}
/* Two sticky header rows: the group caption pins to the very top, the page-name row pins
   right under it (offset by the caption's height) — so both survive a vertical scroll. */
.gmx thead tr.gmx-grouprow th { top: 0; z-index: 2; }
.gmx thead tr.gmx-colrow th { top: var(--gmx-grouph); }
/* the caption naming the right-hand block as the dashboard's pages — the axis label that
   was missing, so the columns no longer read as an unlabelled grid of ticks */
.gmx-pages-group {
  height: var(--gmx-grouph);
  padding-top: 5px; padding-bottom: 5px;
  font-size: 10.5px; color: var(--brand-ink);
  background: var(--brand-dim);
}
/* the DEVICE axis gets its own band + a firm divider, so "which device" reads as clearly
   separate from "which of its dashboard pages" */
.gmx-devcol { border-right: 2px solid var(--border2); }
.gmx thead th.gmx-devcol { text-align: left; vertical-align: bottom; }
.gmx-colhead { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gmx-colname { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.gmx tbody tr:last-child th, .gmx tbody tr:last-child td { border-bottom: none; }
.gmx tbody tr:hover { background: var(--bg); }
.gmx td { padding: 5px 10px; text-align: center; }
.gmx td.gmx-devcol { text-align: left; background: var(--bg); }
.gmx-dev { display: flex; align-items: center; gap: 8px; }
.gmx-dev-id { font-weight: 600; font-size: 12.5px; word-break: break-all; }
.gmx-dev-f { font-size: 11px; color: var(--muted); white-space: nowrap; }
/* a tick IS a selection — the one grant the actor picked ⇒ secondary */
.gmx input { accent-color: var(--brand-2); cursor: pointer; margin: 0; }
.gmx input:disabled { cursor: default; }
/* an unticked device greys its dashboard cells — a dashboard grant without its device is
   not a state the model has (see setGrants in the handler) */
.gmx tr.off td.gmx-cell { opacity: .3; }
/* the monthly report (since 0.40.0): a grant of its own beside the pages, set apart like the device axis */
.gmx thead th.gmx-report-group, .gmx td.gmx-report { border-left: 2px solid var(--border2); }
.gmx thead th.gmx-report-group { vertical-align: bottom; }
.gmx-none { padding: 14px; text-align: center; }

@media (max-width: 820px) {
  .user-email { display: none; }
  .gmx-colname { max-width: 80px; }
}

/* ---- a session's charts: a dialog over the dashboard (configurator.md §6.1, session_charts) ---- */
.overlay.sess-ov { z-index: 2000; align-items: center; padding: 24px 16px; }   /* above Leaflet's panes and controls */
.sess-dialog { width: min(1100px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 16px 48px rgba(0, 0, 0, .28); }
.sess-dialog-head { display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 16px; background: var(--panel);
  border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.sess-dialog-title { font-weight: 700; font-size: 15px; white-space: nowrap; display: inline-flex; align-items: center; }
.sess-dialog-sub { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 0; }
.sess-dialog-x { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; padding: 6px 8px; border-radius: var(--radius); cursor: pointer; }
.sess-dialog-x:hover { color: var(--black); background: var(--bg); }
.sess-dialog-body { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.sess-chart { height: 230px; flex: 0 0 auto; }
/* the removal warning (device_removal) */
.rm-dialog { width: min(560px, 100%); }
.rm-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.rm-warn { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid rgba(220, 38, 38, .35); border-left: 3px solid var(--danger);
  border-radius: var(--radius); background: rgba(220, 38, 38, .07); font-size: 13px; }
.rm-warn b { color: var(--danger); }
.rm-list { display: flex; flex-wrap: wrap; gap: 4px; max-height: 120px; overflow-y: auto; }
.rm-dev { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); font-size: 12px; font-weight: 600; }
.rm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rm-info { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rm-note { font-size: 12px; color: var(--muted); }
.rm-actions { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.rm-msg { font-size: 12.5px; color: var(--danger); }
.btn.rm-yes { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.rm-yes:hover { color: #fff; filter: brightness(1.06); }

/* ---- companies (configurator.md §7, since 0.43.0) ----
   A company is a label on a device: a small neutral tag, never a status colour — the status
   dot and the online colour keep their meaning. */
.co-tags { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: middle; }
.dev-id .co-tags { margin-left: 6px; }
.co-tag { font-size: 10.5px; font-weight: 600; line-height: 1.5; padding: 0 7px; border-radius: 999px;
  background: rgba(107, 114, 128, .12); color: var(--muted); border: 1px solid rgba(107, 114, 128, .22); white-space: nowrap; }
.device .dev-seen b.on  { color: var(--ok); }
.device .dev-seen b.off { color: var(--danger); }
.fleet-co { white-space: normal; }
.ft-co { margin: 2px 0 4px; }
.role-badge.role-company { background: rgba(107,114,128,.1); color: #4b5563; border-color: rgba(107,114,128,.25); }
.co-name { font-weight: 700; font-size: 14px; min-width: 220px; max-width: 360px; }
.co-tools { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; flex-wrap: wrap; }
.co-all { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; }
.co-search { max-width: 220px; }
.co-devs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; background: var(--panel); max-height: 60vh; overflow: auto; }
.co-dev { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.co-dev .gmx-dev-id { white-space: nowrap; }
.co-all input, .co-dev input { accent-color: var(--brand-2); cursor: pointer; margin: 0; }
.co-dev .co-tags { min-width: 0; }
.co-dev[hidden] { display: none; }
.co-filter { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 6px; }
.co-filter-lbl { margin-right: 2px; }
.co-chip { height: 24px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel);
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.co-chip.sel { background: var(--brand-2); border-color: var(--brand-2); color: var(--on-brand-2); }
.gmx tr[hidden] { display: none; }

/* commands: buttons that send a command to the device (since 0.47.0) */
.commands { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.cmd-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.cmd-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--border2); border-radius: 6px; background: var(--bg); }
.cmd-ask[hidden] { display: none; }
.cmd-q { font-size: 12.5px; font-weight: 600; margin-right: 4px; }
.btn.cmd-yes { border-color: var(--brand); color: var(--brand-ink); }
.cmd-msg { font-size: 12px; color: var(--danger); }
.cmd-msg:empty { display: none; }
.cmd-list { overflow: auto; min-height: 0; font-size: 11.5px; }
.cmd-row { display: grid; grid-template-columns: auto 1fr auto; column-gap: 8px; padding: 3px 0; border-top: 1px solid var(--border); }
.cmd-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.cmd-by { grid-column: 2 / 4; color: var(--muted); }
.cmd-st { font-weight: 600; color: var(--muted); }
.cmd-st.sent { color: var(--ok); }
.cmd-st.failed { color: var(--danger); }
.cmd-st.expired { color: var(--warn); }

/* alerts: why the device's dot is red (since 0.48.0) */
.alerts { display: flex; flex-direction: column; gap: 6px; overflow: auto; min-height: 0; }
.alert-row { display: flex; align-items: center; font-size: 13px; font-weight: 600; }
.alert-row .health-dot { flex: 0 0 auto; }
.alert-row.danger { color: var(--danger); }
.alert-row.warn { color: var(--warn); }
.alert-row.ok { color: var(--ok); }
