/* Design system for the provisioning panel.
   Tokens transcribed from the Minton admin template
   (HTML/Vertical/blue/src/scss/_variables.scss). Minton's own stack -
   Bootstrap 4.3 + jQuery 3.4 - is deliberately NOT vendored: the panel builds
   its interactions on htmx plus native <details>/<dialog>, so it carries no
   framework and no external request. See vh-panel-operability-design.md D3. */

/* CONTRAST IS A CONSTRAINT HERE, NOT A POLISH ITEM. `base.html:8` already
   declares `color-scheme: light dark`, so this panel renders dark TODAY, and
   today's badges are opaque and legible (`.badge-drift` #fecaca on #7f1d1d =
   6.93:1 in both modes). A palette that only darkens the surfaces turns those
   into 1.2:1. Every pair below was measured; the floor is 4.5:1.

   Three Minton values do NOT survive that floor and are deliberately not used
   as text colours:
     $primary #3bafda on white ............ 2.52:1  (and white ON it: 2.52:1)
     $gray-600 #98a6ad on white ........... 2.50:1
     $menu-item-color-dark #9097a7 on #38414a  3.54:1
   Each gets a darker/lighter sibling below. #3bafda is kept for borders,
   indicator bars and dark-mode text (4.56:1 on the dark card), where it passes.
*/
:root {
  color-scheme: light dark;

  --primary:        #3bafda;   /* fills, borders, indicators - NOT text on white */
  --primary-text:   #1f7d9e;   /* 4.68:1 on white - links, active nav, solid-fill bg */
  --success: #1abc9c;
  --warning: #f7b84b;
  --danger:  #f1556c;
  --error-text: #b91c1c;   /* 5.98:1 on the light body */

  --body-bg:     #f5f6f8;
  --card-bg:     #ffffff;
  --text:        #6c757d;
  --text-strong: #343a40;
  --border:      #dee2e6;
  --muted:       #667179;      /* 5.00:1 - Minton's #98a6ad is 2.50:1 */

  --sidebar-bg:    #ffffff;
  --sidebar-text:  #6e768e;    /* 4.52:1 on white */
  --sidebar-width: 240px;
  --topbar-bg:     #ffffff;
  --topbar-height: 70px;

  --radius: 0.25rem;
  --shadow: 0 0 35px 0 rgba(154, 161, 171, 0.15);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-size: 0.9rem;
  --cell-pad: 0.85rem;

  /* Badge colours are TOKENS so dark mode can override them. Opaque fills, not
     alpha - an alpha fill composites over whatever card colour is behind it,
     which is exactly how the first draft of this plan lost 5 stops of contrast.
     Light: ok 6.53 / held 5.80 / drift 6.93 / archived 8.33. */
  --badge-ok-bg:    #d3f5ed;  --badge-ok-fg:    #0b5f4f;
  --badge-held-bg:  #fdecc8;  --badge-held-fg:  #7a5410;
  --badge-drift-bg: #fecaca;  --badge-drift-fg: #7f1d1d;
  --badge-arch-bg:  #e5e7eb;  --badge-arch-fg:  #374151;
}

@media (prefers-color-scheme: dark) {
  :root {
    --body-bg:     #2b3035;
    --card-bg:     #343a40;
    --text:        #aab8c5;
    --text-strong: #f1f5f7;
    --border:      #464f5b;
    --sidebar-bg:  #38414a;   /* Minton's $bg-leftbar-dark */
    --topbar-bg:   #38414a;
    --shadow:      0 0 35px 0 rgba(0, 0, 0, 0.25);

    /* On dark, #3bafda measures 4.56:1 on the card - so the base primary IS the
       text colour here, and the darkened light-mode sibling would be too dim. */
    --primary-text: #3bafda;

    /* Minton defines a separate dark menu colour rather than darkening the light
       one (_variables.scss:24 vs :30). Its #9097a7 is 3.54:1 on #38414a, so this
       uses a lighter step from the same family. */
    --sidebar-text: #a8afbd;   /* 4.71:1 on #38414a */
    --muted:        #98a6ad;   /* 4.60:1 on #343a40 */

    /* The old inline stylesheet never set an explicit body background, so this
       literal was untested against a real dark surface; --body-bg #2b3035
       pins it at 2.06:1. Lifted here instead. */
    --error-text: #f78ea0;    /* 5.92:1 on #2b3035 */

    /* Dark badges: the saturated hue becomes the FOREGROUND on a dim opaque
       fill. Measured on --card-bg #343a40:
       ok 6.73 / held 7.26 / drift 6.16 / archived 5.81. */
    --badge-ok-bg:    #163b35;  --badge-ok-fg:    #5fd3bb;
    --badge-held-bg:  #40341a;  --badge-held-fg:  #f0c164;
    --badge-drift-bg: #4a1f26;  --badge-drift-fg: #f78ea0;
    --badge-arch-bg:  #3f464e;  --badge-arch-fg:  #c2cbd3;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: 1.5;
  color: var(--text);
  background: var(--body-bg);
}

/* Shell: a fixed sidebar with the content column beside it. Grid rather than
   float/absolute, so the content column owns its own scroll — do NOT give
   `.content` a scroll container of its own. */
.app {
  display: grid;
  /* `minmax(0, 1fr)`, not `1fr`: a grid track's default `min-width: auto` is
     its content's max-content size, so ONE wide table stretched the whole
     content column past the viewport instead of scrolling inside its own
     `.table-scroll`. The drawer hid this — it was `position: fixed`, outside
     the grid — so it only surfaced when the per-VH tabs moved into the page. */
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

/* ------------------------------------------------------------------ sidebar
   The owner's report: "hard to understand which row is clickable and which is
   not, and you cannot tell which item belongs to which category." Both halves
   had one cause - five headers styled almost exactly like the links beneath
   them (same 1.25rem indent, and --muted #667179 vs --sidebar-text #6e768e is a
   1.1:1 difference), three of which only ever repeated their single child's
   name. Answered structurally, never by colour alone:

   1. TOKENS SWAP ROLES. The old rules coloured LINKS with --sidebar-text
      (4.52:1) and HEADERS with --muted (5.00:1) - the label was literally the
      darker of the two, which is the mechanical reason nothing read as a
      target. Links now take --text-strong (11.51:1 light / 9.46:1 dark), so the
      targets are the most prominent text in the column, which is what a nav is
      for. --muted stays on the header, but the header now sits on the recessed
      band, where it measures 4.62:1 light / 5.32:1 dark. That incidentally
      retires a live AA failure: --muted on the DARK SIDEBAR #38414a is 4.15:1,
      under this file's own 4.5 floor - the audit at the top of this file
      measured it against --card-bg #343a40 (4.60) and never against the surface
      it was actually painted on.
      (--sidebar-text was the obvious header colour and does NOT work: on the
      band it is 4.18:1 in light. Measured, rejected.)
   2. ICON GUTTER. Every destination carries a 16px inline SVG; a header carries
      none. Presence of a glyph is a SHAPE difference, so it works at a glance,
      in greyscale, for colour-blind operators and under forced-colors.
   3. SURFACE. A header is a full-bleed RECESSED BAND. --body-bg is, in both
      themes, the surface one step behind the sidebar (light #f5f6f8 on #ffffff,
      dark #2b3035 on #38414a), so the band reads as backdrop rather than
      content without inventing a colour. Its hairlines carry the light theme,
      where that difference is only ~1.08:1; its fill carries the dark one. A
      band never fills, never takes the pointer cursor, and cannot be selected.
   4. GEOMETRY. Members are indented past the header and hang off a 3px rail - a
      real border-left on every row, so the rows of a group fuse into ONE
      unbroken bracket and the header sits outside it. Nothing else has a rail.
   5. HIT AREA. A row is a 44px target (WCAG 2.5.5) filling the column width,
      and it FILLS on hover and on keyboard focus. The old design changed only
      the text colour, which is why no row ever looked like a target.

   Contrast, measured on both sidebars and again on each tinted row (light/dark):
     label + hint --text-strong   rest 11.51/9.46  hover 10.20/7.20  cur 9.12/6.02
     header       --muted on band      4.62/5.32
     icon         --sidebar-text  rest  4.52/4.71  (3:1 floor for graphics)
     rail (cur)   --primary-text vs sidebar  4.68/4.12
     focus ring   --text-strong on the filled row  10.20/7.20
   Two deliberate swaps against the old rule: the current row's TEXT is
   --text-strong, not --primary-text (3.93:1 light / 2.88:1 dark once the row is
   tinted), and the rail is --primary-text, not --primary (#3bafda is 2.52:1 on
   white - under the 3:1 a non-text indicator needs).

   Placement: keep this block where the old .sidebar rules were, AFTER the :root
   dark block - tests/panel/test_panel_assets.py::_dark_block brace-counts from
   the FIRST dark media query in the file, and it must land on the :root one.
   (That is also why no comment here spells that at-rule out in full: the
   literal string is what such a scanner searches for, and a mention inside a
   comment is indistinguishable from the real thing. My own preview renderer
   tripped on exactly that.) */
.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 0 0 1.25rem;

  /* Row fills. Not a new colour: --primary at low alpha, which is ONE value
     that composites correctly over #ffffff AND over #38414a. Alpha rather than
     two opaque literals on purpose - if these dark overrides were ever deleted
     the rows would merely read weaker, whereas a deleted opaque pair goes
     unreadable (white on #3bafda is 2.52:1). Raising them costs label contrast;
     see the table above before touching. */
  --nav-fill-hover:      rgba(59, 175, 218, 0.14);
  --nav-fill-current:    rgba(59, 175, 218, 0.26);
  --nav-fill-cur-hover:  rgba(59, 175, 218, 0.34);
}
@media (prefers-color-scheme: dark) {
  /* The dark sidebar is #38414a, not white: the same alphas read as a whisper. */
  .sidebar {
    --nav-fill-hover:      rgba(59, 175, 218, 0.18);
    --nav-fill-current:    rgba(59, 175, 218, 0.30);
    --nav-fill-cur-hover:  rgba(59, 175, 218, 0.38);
  }
}

.sidebar .brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  font-weight: 600;
  color: var(--text-strong);
  /* The wordmark is the one inert row left in the column. This is the same rule
     the topbar draws, so the two line up across the shell and the brand reads
     as chrome rather than as a section label. It does not depend on what comes
     after it - the first band's border-top would drift the day a group is
     reordered. It stays unlinked on purpose: pointing it at /panel/attention
     would put one destination on screen twice. */
  border-bottom: 1px solid var(--border);
}

/* Every group, first included, so the first band's border-top never doubles up
   against the brand's border-bottom. */
.sidebar .nav-group { margin-top: 0.5rem; }

/* THE HEADER. A band, not a row: recessed surface, two hairlines, full bleed,
   no glyph, no fill, no hover, no pointer. */
.sidebar .nav-section {
  margin: 0;
  padding: 0.4rem 1.25rem 0.3rem;
  background: var(--body-bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: default;
  user-select: none;
}

/* THE MEMBERS. Indented past the band and hung off the rail. Do NOT add margin,
   gap, or a taller nested element between these rows: the rail only reads as
   one bracket because they are flush, and a gap silently shatters it into
   dashes with no error and no failing test. */
.sidebar .nav-items {
  list-style: none;
  margin: 0;
  padding: 0 0.6rem 0 1.4rem;
}
/* Styled by descendant selector, never by a class on the <a>: three tests
   assert the literal `<a href="/panel/..." aria-current="page"`, so nothing may
   sit between those two attributes. */
.sidebar .nav-items a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;            /* 44px - a real hit area, not a text baseline */
  padding: 0.5rem 0.85rem 0.5rem 0.8rem;
  border-left: 3px solid var(--border);            /* the rail - a real border, */
  border-radius: 0 var(--radius) var(--radius) 0;  /* so forced-colors keeps it */
  color: var(--text-strong);
  font-weight: 500;
  text-decoration: none;
  transition: background-color 120ms ease;
}

/* Geometry lives in the markup, paint lives here: one rule governs all seven
   glyphs and each inline <svg> stays ~130 bytes. `color` is what the inline
   currentColor strokes resolve against, so the glyph sits one step behind the
   label at rest and comes up with the row. */
.sidebar .nav-icon {
  flex: 0 0 1rem;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--sidebar-text);
}

.sidebar .nav-text { min-width: 0; }
/* Labels WRAP rather than truncate: a clipped label with no tooltip is content
   loss at 200% text zoom, and a two-line row is merely ugly. */
.sidebar .nav-label { line-height: 1.3; }
/* Used on exactly one row ("Channels"), the only label here that names nothing
   you could guess. It is --text-strong like the label, differentiated by size
   and weight rather than colour: no muted token in the palette survives a
   tinted row in BOTH themes (best case --muted, 4.19:1 light / 2.90:1 dark on
   the current row), and inventing one would be the literal the badge test
   exists to forbid. */
.sidebar .nav-hint {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.25;
}

.sidebar .nav-items a:hover {
  background: var(--nav-fill-hover);
}
.sidebar .nav-items a:hover .nav-icon { color: inherit; }
/* Keyboard parity: the same fill plus a ring, because the fill alone would be
   indistinguishable from hover. --text-strong, not --primary: the ring must
   clear 3:1 against the FILLED row it sits on, and it is the one token that
   flips with the theme, so it can never be the weak link (10.20:1 light /
   7.20:1 dark). Inset, so the 240px column cannot clip it. */
.sidebar .nav-items a:focus-visible {
  background: var(--nav-fill-hover);
  outline: 2px solid var(--text-strong);
  outline-offset: -2px;
}

/* CURRENT. Three simultaneous cues, because hover and current share a hue and
   the fills are only ~1.12:1 apart: the rail turns from grey to teal (hover
   deliberately leaves the rail alone, so a teal rail means exactly one thing),
   the label goes semibold, and the fill steps up. */
.sidebar .nav-items a[aria-current="page"] {
  background: var(--nav-fill-current);
  border-left-color: var(--primary-text);
  font-weight: 600;
}
.sidebar .nav-items a[aria-current="page"] .nav-icon { color: inherit; }
/* Equal specificity to the :hover rule above, so this MUST come after it -
   without it the page you are on is the one row that does not answer the
   pointer. */
.sidebar .nav-items a[aria-current="page"]:hover,
.sidebar .nav-items a[aria-current="page"]:focus-visible {
  background: var(--nav-fill-cur-hover);
}

@media (prefers-reduced-motion: reduce) {
  .sidebar .nav-items a { transition: none; }
}

@media (forced-colors: active) {
  /* Author backgrounds are dropped, taking both tints with them; borders are
     forced to CanvasText, so the rail and the band survive as structure but the
     current row loses its only remaining mark. An outline reads as "this row",
     where an underline would read as "this word". */
  .sidebar .nav-items a[aria-current="page"] {
    outline: 2px solid CanvasText;
    outline-offset: -2px;
  }
}

.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
}
.topbar .spacer { flex: 1; }

.content { padding: 1.5rem; min-width: 0; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.card-body { padding: 1.25rem; }

.table { width: 100%; border-collapse: collapse; }
.table th,
.table td {
  padding: var(--cell-pad);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.table th {
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
}
.table tbody tr:hover { background: rgba(59, 175, 218, 0.04); }

/* Surgical fleet refresh (Task 5, rule 2): a row the poller just swapped in
   carries `data-row-changed="true"` (`_fleet_body.html::fleet_row`, oob path
   only), so a change happening while an operator is looking is not silent.
   A CSS animation fires the moment a matching element enters the render tree
   - exactly what an OOB `outerHTML` swap does (a fresh node), so no JS is
   needed to trigger or reset this. */
@keyframes fleet-row-changed {
  from { background: rgba(59, 175, 218, 0.35); }
  to   { background: transparent; }
}
tr[data-row-changed="true"] { animation: fleet-row-changed 1.6s ease-out; }
@media (prefers-reduced-motion: reduce) {
  tr[data-row-changed="true"] { animation: none; }
}

/* `[hidden] { display: none }` comes from the UA stylesheet, and ANY author
   `display` declaration beats a UA one regardless of specificity. `.badge`
   below sets `display: inline-block`, so the log viewer's "Paused" badge —
   the one thing in this panel that relies on the attribute (`panel.js` flips
   `badge.hidden`) — was permanently visible, reporting "0 new line(s)" at a
   reader who had not scrolled anywhere. `!important` is the fix that actually
   holds: without it this only wins on source order, which the next rule added
   below `.badge` would quietly take back. */
[hidden] { display: none !important; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 600;
}
.badge-ok       { background: var(--badge-ok-bg);    color: var(--badge-ok-fg); }
.badge-held     { background: var(--badge-held-bg);  color: var(--badge-held-fg); }
.badge-drift    { background: var(--badge-drift-bg); color: var(--badge-drift-fg); }
.badge-archived { background: var(--badge-arch-bg);  color: var(--badge-arch-fg); }

.status-dot {
  display: inline-block;
  width: 0.55rem; height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.4rem;
}
.status-dot-ok   { background: var(--success); }
.status-dot-warn { background: var(--warning); }
.status-dot-bad  { background: var(--danger); }
.status-dot-idle { background: var(--muted); }

.btn {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
}
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 0.15rem rgba(59, 175, 218, 0.4); }
/* Solid fills carrying white text use --primary-text (4.68:1). White on Minton's
   own #3bafda is 2.52:1 - the template's weak spot, not something to inherit. */
.btn-primary { background: var(--primary-text); border-color: var(--primary-text); color: #fff; }
.btn-danger  { background: #c8354a; border-color: #c8354a; color: #fff; }
.btn-ghost   { background: transparent; }
.btn-sm      { padding: 0.28rem 0.6rem; font-size: 0.8rem; }
.btn[aria-pressed="true"],
.btn[aria-selected="true"] {
  background: var(--primary-text); border-color: var(--primary-text); color: #fff;
}

.muted { color: var(--muted); }
.mono  { font-family: var(--mono); }
/* Matches td.id .label / .confirm h2's own use of --text-strong: the topbar
   heading (_topbar.html) is the section title, so it gets the same emphasis
   token rather than the plain, lighter --text a bare <strong> inherits. */
.text-strong { color: var(--text-strong); }

/* ---- VH database browser. A 27-table list needs to be scannable, so the
   tables are a wrapping strip grouped by schema rather than a column of
   buttons. */
.db-tables { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0.8rem 0; }
.db-schema {
  width: 100%; margin-top: 0.5rem; font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.db-table {
  display: inline-flex; align-items: baseline; gap: 0.35rem;
  padding: 0.2rem 0.5rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--text); text-decoration: none;
}
.db-table:hover { background: rgba(128, 128, 128, 0.12); }
.db-table.is-active { background: var(--primary-text); color: #fff; border-color: var(--primary-text); }
.db-rows { font-size: 0.7rem; opacity: 0.7; }
.db-preview { margin-top: 1.2rem; }
.db-pager { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; flex-wrap: wrap; }
/* A cell holding a long value truncates instead of setting its column's width;
   the full text stays on `title`. Without this, ONE long path decides how wide
   that column is and pushes every other column off-screen — the complaint this
   whole tab is being rebuilt for. Deliberately tight: a database browser shows
   arbitrary columns, so the win is fitting MORE of them on screen, not showing
   any single one in full. */
.db-value { display: inline-block; max-width: 14rem; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* A cell the server withheld: a shape summary, not a value. Italic + muted so
   a whole column of them reads as "not shown" at a glance rather than as data
   that happens to look alike. */
.db-masked { color: var(--muted); font-style: italic; }

/* ---- SQL console + per-row editing (the Database tab's write half). */
.db-console { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 0.8rem; }
.db-console > summary {
  cursor: pointer; font-weight: 600; color: var(--text-strong); margin-bottom: 0.6rem;
}
.db-console textarea {
  width: 100%; font-family: var(--mono); font-size: 0.82rem; padding: 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--body-bg); color: var(--text-strong); resize: vertical;
}
.db-console-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; }
/* The row editor is a <dialog>, not a popover in the cell: `.table-scroll`
   would clip a popover and leave its buttons unreachable. */
.db-editor-form { display: flex; flex-direction: column; gap: 0.5rem; }
.db-editor-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; }
/* Plain block with an inline checkbox. The surrounding label rule is a flex
   COLUMN; inheriting it stacked the checkbox above its text, and wrapping the
   text in a flex-item <span> made it shrink instead. A bare text node after
   the input avoids both. Caught in a browser — the suite cannot see layout. */
.db-editor-form .db-null { display: block; font-size: 0.8rem; }
.db-editor-form .db-null input { margin: 0 0.4rem 0 0; vertical-align: middle; }
.db-editor-form input[type="text"], .db-editor-form select { font: inherit; padding: 0.3rem; }
.db-editor-delete {
  margin-top: 0.9rem; padding-top: 0.7rem; border-top: 1px solid var(--border);
}
td.row-actions { width: 2.4rem; }

/* ---- VH page. Replaces the fixed right-side drawer, whose 46rem cap was the
   reason every wide tab needed horizontal scrolling. Nothing here constrains
   width: the page is the content column, so a tab's own table gets the whole
   window and shrinks with it. */
.vh-page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--border);
}
.vh-page-header .mono { font-size: 1.05rem; }
.vh-page-header .label { margin-left: 0.6rem; color: var(--muted); }
.vh-tabs {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  padding: 0.7rem 0; border-bottom: 1px solid var(--border); margin-bottom: 1rem;
}
/* Links, not buttons: each tab is a URL. Styled as a tab strip anyway, so the
   navigation reads as staying on the same VH rather than leaving it. */
.vh-tab {
  padding: 0.35rem 0.8rem; border-radius: var(--radius);
  color: var(--text); text-decoration: none; font-size: 0.85rem;
}
.vh-tab:hover { background: rgba(128, 128, 128, 0.12); }
.vh-tab.is-active {
  background: var(--primary-text); color: #fff; font-weight: 600;
}

/* ---- Dialog (Task 6). Styled for the ::backdrop that showModal() provides. */
.confirm { border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--card-bg); color: var(--text);
  max-width: 34rem; padding: 1.25rem; }
.confirm::backdrop { background: rgba(0, 0, 0, 0.45); }
.confirm h2 { margin: 0 0 0.5rem; font-size: 1.05rem; color: var(--text-strong); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
.confirm-form { display: flex; flex-direction: column; gap: 0.5rem; }

/* ---- Toasts, filter chips, and the a11y helper Task 7's radios need. */
.toast-region { position: fixed; bottom: 1rem; right: 1rem; z-index: 30;
  display: flex; flex-direction: column; gap: 0.5rem; }
.filter-group { display: inline-flex; gap: 0.3rem; }
.filter-group .btn { margin: 0; }
/* Fleet in-use/abandoned tabs (Task 5) — same filled-active treatment as
   `.hold-btn.is-active` and `.vh-tab.is-active` above, so a control that
   PARTITIONS the table reads distinctly from `.filter-group`'s buttons,
   which only narrow it. */
.tab-bar { display: inline-flex; gap: 0.3rem; margin-bottom: 0.6rem; }
.tab-bar .btn.is-active { background: var(--primary-text); color: #fff; border-color: var(--primary-text); }
.card-header .spacer { flex: 1; }
.fleet-search { width: min(24rem, 100%); }
.user-menu { position: relative; }
.user-menu > summary { cursor: pointer; list-style: none; }
.user-menu-body { position: absolute; right: 0; top: 100%; z-index: 25;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.5rem 0.9rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* =====================================================================
   Ported from the legacy inline stylesheet that used to live in
   base.html. Restyled to the tokens above wherever the mapping is
   obvious (an exact colour/font-family match, or a documented role such
   as "solid fill carrying white text"); left unchanged where it is not,
   per the plan's ambiguity rule - preserving behaviour beats tidiness.
   Every class name is kept exactly as the existing templates reference
   it. Two rules are deliberately NOT ported - see task-2-report.md. */

h1 { font-size: 1.4rem; margin: 0 0 1rem; }
/* --primary-text is documented above as "links, active nav, solid-fill bg". */
a { color: var(--primary-text); }

/* The fleet table (and the few narrower ones below) predate `.table` and
   are not wrapped in that class by the markup this task does not touch -
   these bare element selectors are what keeps them legible until later
   tasks adopt `.table` directly. */
table { border-collapse: collapse; width: 100%; margin-top: 1rem; }
th, td {
  border: 1px solid var(--border); padding: 0.4rem 0.6rem;
  text-align: left; font-size: 0.9rem; white-space: nowrap;
}
th { background: rgba(128, 128, 128, 0.14); }

/* Wrap only when needed, at sensible points - never shatter an id/token
   character-by-character the way `break-all` did (unreadable UUIDs). */
td.wrap { white-space: normal; overflow-wrap: anywhere; }
/* Identifiers (vh_id, db_name): monospace, single line - legible at the
   page's full width instead of stacking vertically in a cramped column. */
td.id { font-family: var(--mono); white-space: nowrap; vertical-align: top; }
td.id .drill { display: block; }
td.id .sub { display: block; font-size: 0.78rem; margin-top: 0.1rem; }
/* Human labels under an id: NOT monospace - a name and an email read worse
   in a font chosen for hex. Uses --text-strong (dark-mode aware), which
   also retires the old standalone dark-mode override for this rule. */
td.id .label { font-family: var(--font); color: var(--text-strong); font-weight: 600; }

/* Wide tables scroll horizontally instead of forcing the layout to crush
   cells. Wrap any many-column table in <div class="table-scroll">. */
.table-scroll { overflow-x: auto; margin-top: 1rem; }
.table-scroll > table { margin-top: 0; }

pre.logs {
  max-height: 26rem; overflow: auto; background: #0b0b0b; color: #d0d0d0;
  padding: 0.6rem 0.8rem; border-radius: 4px; font-size: 0.8rem; line-height: 1.35;
  white-space: pre-wrap; word-break: break-word;
}
/* Follow-mode pause badge (Task 1, panel.js): a clickable .badge variant, not
   a plain label — it needs the pointer + hover affordance a <button> gets for
   free, since clicking it jumps back to the live tail. */
.log-paused-badge {
  display: block; margin: 0.4rem 0; border: none; cursor: pointer;
  background: var(--badge-held-bg); color: var(--badge-held-fg);
}
.log-paused-badge:hover { filter: brightness(1.08); }

table.runtime-env-table { width: 100%; margin-top: 0.4rem; }
/* env NAME: never shatter (names like AZURE_STORAGE_CONNECTION_STRING stay
   on one line); env VALUE: long ones (e.g. the inline KNOWLEDGE_SYNC_PY boot
   script) collapse into a bounded, scrollable box instead of a page-long dump. */
table.runtime-env-table td.k { white-space: nowrap; vertical-align: top; font-family: var(--mono); }
table.runtime-env-table td.v { white-space: normal; max-width: 68rem; }
table.runtime-env-table td.v code { display: block; max-height: 9rem; overflow: auto;
  white-space: pre-wrap; word-break: break-word; font-size: 0.82rem;
  background: rgba(128, 128, 128, 0.1); padding: 0.3rem 0.45rem; border-radius: 3px; }

.db-load-columns { display: flex; flex-wrap: wrap; gap: 2rem; }
.db-load-columns h3 { font-size: 0.9rem; margin: 0.6rem 0 0.2rem; }
table.db-load-table { width: auto; min-width: 14rem; margin-top: 0.4rem; }

td.actions { white-space: nowrap; }

/* Registered builds (`_catalog_builds.html`). `fixed` is the whole fix for the
   page-too-wide complaint: with `auto`, the free-text commit title sized its own
   column and dragged the table past the viewport. Fixed makes the columns obey
   these widths and the title truncate instead. Percentages so a narrow window
   shrinks the table rather than overflowing it; the kebab is the one column
   whose content has a real minimum. */
.builds-table { table-layout: fixed; width: 100%; }
.builds-table col.c-build  { width: 38%; }
.builds-table col.c-source { width: 21%; }
.builds-table col.c-image  { width: 20%; }
.builds-table col.c-status { width: 21%; }
.builds-table col.c-menu   { width: 3rem; }
.builds-table td { vertical-align: top; }
/* The global `th, td` rule is `white-space: nowrap` - right for the fleet
   table's identifiers, fatal here. Under `table-layout: fixed` a cell that
   cannot fit does not shrink, it OVERFLOWS its neighbour, so at a narrow
   window the branch/author line ran straight over the digest column. Prose and
   badges opt back into wrapping; the identifiers below keep their single line,
   which is the part the global rule was actually protecting. */
.builds-table td { white-space: normal; }
.builds-table td.id .drill { white-space: nowrap; }
.builds-table td:not(.id) { word-break: break-word; }
/* `.drill`/`.sub` are stacked lines, but the rules that make them blocks are
   scoped to `td.id` (the fleet table's id column). Reused in the source and
   image columns they stayed INLINE, so a long branch + author ran straight out
   of its cell and over the next column - visible only in a browser, never in a
   template assertion. */
.builds-table .drill { display: block; }
.builds-table .sub   { display: block; font-size: 0.78rem; margin-top: 0.1rem; }
/* The truncation itself. `display: block` is required - a bare inline span has
   no box to overflow, so text-overflow would do nothing. */
.build-title {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font); color: var(--text);
}
.build-status .badge { margin-right: 0.15rem; }

/* Row actions behind a kebab. Same disclosure mechanics as the topbar user menu
   (`.user-menu`, whose positioning and panel chrome this reuses), so all that is
   added here is a clickable target the size of a table cell's worth of nothing
   and buttons stacked rather than inline. No JS to open it: <details> is the
   platform's own disclosure, so keyboard and screen-reader behaviour are free. */
.kebab > summary {
  display: inline-block; width: 1.5rem; text-align: center; line-height: 1.5;
  border-radius: var(--radius); color: var(--muted); user-select: none;
}
.kebab > summary::-webkit-details-marker { display: none; }
.kebab > summary:hover { background: rgba(128, 128, 128, 0.15); color: var(--text-strong); }
.kebab-body {
  display: flex; flex-direction: column; gap: 0.3rem;
  padding: 0.4rem; min-width: 10.5rem;
}
.kebab-body .hold-btn { text-align: left; font-size: 0.78rem; padding: 0.25rem 0.5rem; }
/* `--error-text`, not `--danger`: the raw #f1556c is a FILL colour and measures
   3.45:1 as text on the dark card, below the 4.5:1 this sheet holds itself to.
   `--error-text` is the red that already has a dark-mode value chosen for text. */
.hold-btn-danger { color: var(--error-text); border-color: var(--danger); }

.hold-group { display: inline-flex; }
.hold-btn {
  font: inherit; font-size: 0.72rem; margin: 0; padding: 0.1rem 0.45rem;
  border: 1px solid var(--border); background: rgba(128, 128, 128, 0.1); cursor: pointer;
}
.hold-btn + .hold-btn { border-left: none; }
/* Selected hold state: a solid fill carrying white text, same rule as
   .btn-primary above - --primary-text, not --primary. */
.hold-btn.is-active { background: var(--primary-text); color: #fff; border-color: var(--primary-text); }

/* Per-row re-pin control: four narrow text inputs + a button, kept compact
   so it fits inside the fleet table's actions column. */
.repin-form { display: flex; gap: 0.2rem; align-items: center; }
.repin-form input { width: 3.2rem; padding: 0.15rem 0.3rem; }

.banner {
  background: #fef3c7; color: #78350f; border: 1px solid #f59e0b;
  padding: 0.6rem 0.8rem; border-radius: 0.4rem; margin: 1rem 0;
}
.banner-error { background: #fee2e2; color: #7f1d1d; border-color: #ef4444; }

.rollout { margin: 1.2rem 0; padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: 0.4rem; }
.rollout h2 { font-size: 1rem; margin: 0 0 0.6rem; }
.rollout-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.rollout-controls button { margin-top: 0; }
.rollout-limit { font-size: 0.85rem; }
.rollout-limit input { width: 5rem; }
.rollout-section { margin: 0.2rem 0; }
.vh-list { margin: 0.2rem 0 0.5rem; padding-left: 1.2rem; font-size: 0.85rem; }
#rollout-result:not(:empty) { margin-top: 0.8rem; }

/* ---- Attention (panel operability PR3, Task 2): the landing screen's
   ranked problem cards. One card per `domain.attention.Concern`, already
   ordered by `rank()` — tier first, then most-recent-first. */
.concern-list { display: flex; flex-direction: column; gap: 0.75rem; }
.concern-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: var(--body-bg);
}
/* The left border is the scan-down cue - an operator triaging a long list
   reads the stripe, not the badge text. Four tiers, four distinct colours:
   tenant-facing was sharing --danger with operation-failed (review fix,
   MINOR 8) - the two most urgent tiers were indistinguishable at a glance,
   which is exactly backwards for a stripe that exists to be read without
   stopping to parse the badge. */
.concern-card.concern-tenant_facing    { border-left-color: var(--danger); }
.concern-card.concern-operation_failed { border-left-color: var(--primary); }
.concern-card.concern-drift            { border-left-color: var(--warning); }
.concern-card.concern-hygiene          { border-left-color: var(--muted); }
.concern-head { display: flex; align-items: center; gap: 0.6rem; }
.concern-kind { font-weight: 600; color: var(--text-strong); }
.concern-since { white-space: nowrap; font-size: 0.8rem; }
.concern-cause { margin: 0.45rem 0 0; }
.concern-vh-ids { margin: 0.3rem 0 0; font-size: 0.82rem; color: var(--muted); }
.concern-action { margin-top: 0.6rem; }
.attention-clear {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0 0 0.3rem;
}

form.login { max-width: 22rem; margin-top: 1rem; }
form.login label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; }
input, button { font: inherit; padding: 0.45rem 0.6rem; box-sizing: border-box; }
input { width: 100%; }
button { margin-top: 0.75rem; cursor: pointer; }
p.error { color: var(--error-text); font-size: 0.9rem; }
