
  :root {
    /* Follows data-theme, never the OS: dark is this dashboard's default and is
       set explicitly on <html>, so leaving this as `light dark` painted native
       scrollbars, <select>/<input> internals and the token field's autofill
       highlight in LIGHT for anyone whose OS was in light mode -- on a dark
       page. The [data-theme="dark"] block below flips it back. */
    color-scheme: light;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Neutrals from the RhinoPackages design language (its tailwind.config.ts
       and the `gray-*` utilities its components actually use), which is
       Tailwind's gray scale on white surfaces. Every value below is a real
       scale value -- keep it that way; picking an arbitrary nearby hex is what
       makes a neutral palette look muddy.
       bg=gray-50, surface=white, surface-elevated/hover=gray-100,
       border=gray-200 (border-gray-200), border-subtle=gray-100,
       text=gray-900/600/500 (text-gray-900, text-gray-600, text-gray-500). */
    --bg: #f9fafb;
    --surface: #ffffff;
    --surface-elevated: #f3f4f6;
    --surface-hover: #f3f4f6;
    --border: #e5e7eb;
    --border-subtle: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --accent: #1a7f37;
    --accent-rgb: 26, 127, 55;
    --accent-light: #dafbe1;
    --accent-hover: #1f883d;
    --primary: #0969da;
    --primary-light: #ddf4ff;
    --primary-hover: #0860ca;
    --warn: #9a6700;
    --warn-light: #fff8c5;
    --bad: #d1242f;
    --bad-light: #ffebe9;
    --info: #0969da;
    --info-light: #ddf4ff;

    /* Residual-curve series (the Solve card's chart): blue, teal and purple for
       Ux Uy Uz, vermillion for p, green for k, amber for epsilon, then pink and
       grey for anything else. An Okabe-Ito set, which stays apart under the
       common colour-vision deficiencies; each is >= 3:1 on --surface, as a
       1.5px line needs. Not the state scale: a "done" green line would read as
       a verdict. */
    --rs-1: #0072b2; --rs-2: #0e8f9e; --rs-3: #7b4fc9; --rs-4: #d55e00;
    --rs-5: #00875f; --rs-6: #a86f00; --rs-7: #b5487f; --rs-8: #6b7280;

    /* BRAND -- identity and interaction, never state. RhinoPackages' accent is
       the pink of its logo ramp; these are its `brand-*` scale verbatim.
       Deliberately NOT wired to --accent/--primary/--warn/--bad above: those
       four ARE the campaign's state scale (done / leased / pending /
       quarantined) and they read green-blue-amber-red in the stat cards, the
       progress bar and every badge. Recolouring a "done" case to brand pink
       would make the dashboard prettier and unreadable at a glance. */
    /* brand-700, not the brand-600 the source uses for text: measured against
       THIS page's grounds, brand-600 is 4.40:1 on the gray-50 canvas and 3.91:1
       on its own brand-100 chip -- both under AA. brand-700 clears every pairing
       here (6.04 on white, 5.78 on the canvas, 5.14 on the chip) and is still a
       pinned value from the same scale. */
    --brand: #be185d;                         /* brand-700 */
    --brand-hover: #9d174d;                   /* brand-800 */
    --brand-light: #fce7f3;                   /* brand-100, bg-brand-50/100 */
    --brand-rgb: 190, 24, 93;
    --shadow-sm: 0 1px 0 rgba(31, 35, 40, 0.04);
    --shadow: 0 3px 6px rgba(140, 149, 159, 0.15);
    --shadow-md: 0 8px 24px rgba(140, 149, 159, 0.2);
    --ring: rgba(236, 72, 153, 0.4);          /* ring-brand-500 */
    --btn-bg: #f9fafb;
    --btn-border: #d1d5db;                    /* ring-gray-300 */
    /* Skeleton placeholders: a gray-200 bar with a gray-50 sweep. Its own pair
       rather than --border/--surface-hover, because a skeleton sits on BOTH
       grounds -- white panels and the gray-100 stat cards and table heads --
       and gray-100 bars vanish on the second. */
    --skel: #e5e7eb;                          /* gray-200 */
    --skel-shine: #f9fafb;                    /* gray-50 */
  }

  /* The RhinoPackages dark scale, pinned verbatim from its tailwind.config.ts
     -- zinc 700 #484f58, 800 #30363d, 900 #161b22, 950 #0d1117. That config
     overrides Tailwind's own zinc with these four, so they are the design
     language rather than a nearby approximation, and they are a full step
     harder than the GitHub "Dark Dimmed" this replaced.
     Mapping: bg=zinc-950, surface=zinc-900 (dark:bg-zinc-900),
     surface-elevated=zinc-950 (a RECESSED well -- inputs, table headers --
     despite the name, so it goes DARKER than the surface, not lighter),
     surface-hover=zinc-800 (hover:bg-zinc-800), border=zinc-700
     (dark:border-zinc-700), border-subtle=zinc-800 (dark:border-zinc-800),
     text=zinc-100/400/500 (dark:text-zinc-100, -400, -500). */
  [data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1117;
    --surface: #161b22;
    --surface-elevated: #0d1117;
    --surface-hover: #30363d;
    --border: #484f58;
    --border-subtle: #30363d;
    --text-primary: #f4f4f5;                  /* zinc-100 */
    /* Each shifted one step brighter than the source's zinc-400/500 pairing:
       zinc-500 on zinc-900 measures 3.58:1, under AA, and muted text here is
       timestamps and counts rather than decoration. zinc-300/400 keeps three
       distinct levels (15.7 / 11.7 / 6.8) and clears AA at every one. */
    --text-secondary: #d4d4d8;                /* zinc-300 */
    --text-muted: #a1a1aa;                    /* zinc-400 */
    --accent: #57ab5a;
    --accent-rgb: 87, 171, 90;
    --accent-light: rgba(70, 149, 74, 0.15);
    --accent-hover: #6bc46e;
    --primary: #539bf5;
    --primary-light: rgba(65, 132, 228, 0.1);
    --primary-hover: #6cb6ff;
    --warn: #c69026;
    --warn-light: rgba(174, 124, 20, 0.15);
    --bad: #e5534b;
    --bad-light: rgba(229, 83, 75, 0.1);
    --info: #539bf5;
    --info-light: rgba(65, 132, 228, 0.15);
    /* The same eight series, lightened for the dark ground (>= 4.5:1). */
    --rs-1: #5aa9e6; --rs-2: #3dc6d6; --rs-3: #a58df0; --rs-4: #ff8a3d;
    --rs-5: #3ecf9a; --rs-6: #e6b422; --rs-7: #f08fc0; --rs-8: #a1a1aa;

    /* Brand lightens in the dark, exactly as the source does: its components
       pair `text-brand-600` with `dark:text-brand-400`, because brand-600 on a
       near-black surface is too dim to read as an accent. */
    --brand: #f472b6;                         /* brand-400, dark:text-brand-400 */
    --brand-hover: #f9a8d4;                   /* brand-300 */
    --brand-light: rgba(131, 24, 67, 0.45);   /* brand-900, dark:bg-brand-900 */
    --brand-rgb: 244, 114, 182;
    --shadow-sm: 0 0 transparent;
    --shadow: 0 3px 6px #010409;
    --shadow-md: 0 8px 24px #010409;
    --ring: rgba(244, 114, 182, 0.4);         /* ring-brand-400 */
    --btn-bg: #30363d;                        /* zinc-800 */
    /* zinc-500, not the zinc-700 used for dividers: a button or input edge is
       what IDENTIFIES the control, so 1.4.11 wants 3:1 against the surface
       behind it. zinc-700 gives 2.09; zinc-500 gives 3.58. Dividers stay at
       zinc-700 below -- they carry no identification duty. */
    --btn-border: #71717a;                    /* zinc-500 */
    /* zinc-800 reads on both the zinc-900 panels and the zinc-950 wells; the
       sweep is one step lighter, zinc-700, so it is visible without glaring. */
    --skel: #30363d;                          /* zinc-800 */
    --skel-shine: #484f58;                    /* zinc-700 */
  }


  /* dark:bg-brand-600 is what the source fills its primary actions with -- one
     step DARKER than the brand-400 it uses for brand TEXT, so white label text
     keeps its contrast. */
  [data-theme="dark"] button.primary {
    background: #db2777;                      /* brand-600 */
    border-color: #9d174d;                    /* brand-800 */
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  }
  [data-theme="dark"] button.primary:hover {
    background: #be185d;                      /* brand-700 */
    border-color: #9d174d;
  }


  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* Header */
  header {
    /* canvas.inset, not canvas.overlay: GitHub's global nav sits DARKER than the
       page ground it floats over, not lighter. Using --surface made the bar the
       brightest band on the screen, which is backwards. */
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
  }
  .header-inner {
    max-width: 1560px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  .brand-group {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
  }
  .brand-group:hover .brand-title {
    color: var(--primary);
  }
  .brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    /* Flat, and the same mark as the favicon in <head>: one green tile, the wind in
       white, in both themes -- no gradient, no shadow. */
    background: #2da44e;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
  }
  .brand-logo svg { width: 18px; height: 18px; }
  .brand-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .brand-badge {
    font-size: 10.5px;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-weight: 500;
  }
  .header-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
  }
  .conn-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    font-weight: 500;
  }
  /* As wide as the widest word of a load, whichever it is showing: a reload
     goes "connecting…", "refreshing…", "connected", and each narrower word
     slid the pill and the buttons beside it sideways. The second grid row is
     that word, invisible and zero-high; an answer longer than it ("auth
     required", a 401) still widens the pill. */
  #connText { display: inline-grid; }
  #connText::after { content: "connecting…"; height: 0; overflow: hidden; visibility: hidden; }
  #connDot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.2s ease;
  }
  #connDot.ok {
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.25);
  }
  #connDot.bad {
    background: var(--bad);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.25);
  }
  #connDot.working {
    background: var(--warn);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25);
    animation: pulse 1.2s infinite ease-in-out;
  }
  @keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
  }
  .header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Phones: the sticky header was four lines (logo and a wrapped title, a
     version badge, the connection pill, the icons) and ate a fifth of the
     screen. One row now: the title short, the version badge gone (Settings
     still names the build), the pill down to its dot, the icons tight. */
  @media (max-width: 640px) {
    .hide-sm, .brand-badge, .brand-logo, #connText { display: none !important; }
    .header-inner { padding: 6px 12px; gap: 8px; flex-wrap: nowrap; }
    .brand-title { font-size: 15px; white-space: nowrap; }
    .header-meta { gap: 6px; }
    .conn-pill { padding: 6px; }
    .header-actions { gap: 2px; }
  }

  /* Main Container */
  main {
    max-width: 1560px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 60px;
    flex: 1;
  }

  /* Panels / Cards */
  .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
  }
  .panel:hover {
    box-shadow: var(--shadow);
  }
  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .panel-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .panel h2 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .panel-subtitle {
    color: var(--text-muted);
    font-size: 12.5px;
  }

  /* Alerts / Notices */
  .err {
    background: var(--bad-light);
    color: var(--bad);
    border: 1px solid var(--bad);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 10px;
  }
  .notice-banner {
    background: var(--info-light);
    color: var(--info);
    border: 1px solid var(--info);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 13px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  .warn-banner {
    background: var(--warn-light);
    color: var(--warn);
    border: 1px solid var(--warn);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12.5px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  /* Form Elements */
  .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
  .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 220px;
  }
  label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .label-hint {
    font-size: 11px;
    font-weight: normal;
    color: var(--text-muted);
  }
  input[type=text], input[type=password], select {
    font-family: inherit;
    font-size: 13.5px;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
  }
  input[type=text]:focus, input[type=password]:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
  }
  select { cursor: pointer; }

  /* `hidden` means hidden: a rule that sets display (a button's inline-flex, a
     badge's) otherwise wins over the attribute, and Roll back showed with nothing
     to roll back to. */
  [hidden] { display: none !important; }

  /* Buttons */
  button {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 8px;
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
  }
  button:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
  }
  button:active { transform: translateY(1px); }
  /* aria-disabled: a button whose request is in flight (setPending). It looks
     disabled and ignores a press, but keeps its focus -- see setPending. */
  button:disabled, button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
  }
  /* Brand, not --accent: --accent is the state scale's "done" green, and a
     primary button wearing it reads as a status chip. */
  button.primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(var(--brand-rgb), 0.25);
  }
  button.primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
  }
  button.subtle {
    border-color: transparent;
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
  }
  button.subtle:hover {
    background: var(--surface-elevated);
    color: var(--text-primary);
  }
  button.icon-btn {
    padding: 8px;
    border-radius: 8px;
  }
  /* accent.fg, not success.fg: in GitHub every link is blue and green is spent
     only on the primary button and success state. Having links green is what
     made this read as a green-themed app rather than a GitHub-themed one. */
  .broker-static {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-elevated);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-secondary);
  }
  .broker-static #brokerDisplay {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .broker-static .link { margin-left: auto; flex: none; }

  a.link {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    transition: color 0.15s ease;
  }
  a.link:hover { text-decoration: underline; color: var(--primary-hover); }

  /* -- Settings drawer -------------------------------------------------------
     Everything an operator sets ONCE -- the connection, the machine
     credentials, the preferences -- plus the first-run wizard. It used to be a
     panel at the top of the page, which meant the first thing anyone saw was a
     form they had already filled in, and the database host was printed in
     plain sight on a page that needs no credential to load. */
  .drawer-scrim {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0; pointer-events: none;
    transition: opacity 0.18s ease;
  }
  .drawer-scrim.open { opacity: 1; pointer-events: auto; }
  .drawer {
    position: fixed; z-index: 61; top: 0; right: 0; bottom: 0;
    width: min(580px, 100%);
    display: flex; flex-direction: column;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateX(101%);
    transition: transform 0.2s ease;
    /* The phone's own insets: otherwise the close button sits under a notch
       and the last field under the home indicator. */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .drawer.open { transform: translateX(0); }
  /* Drag the left edge to resize (the width is remembered per drawer). The
     handle is wider than it looks so it is easy to catch, and it is a real
     focusable separator so the arrow keys resize it too. */
  .drawer-resize {
    position: absolute; left: -4px; top: 0; bottom: 0; width: 9px; z-index: 2;
    cursor: ew-resize; touch-action: none; background: transparent;
  }
  .drawer-resize::after {
    content: ""; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px;
    background: transparent; transition: background 0.12s ease;
  }
  .drawer-resize:hover::after, .drawer-resize:focus-visible::after, .drawer-resize.dragging::after {
    background: var(--brand);
  }
  .drawer-resize:focus-visible { outline: none; }
  @media (max-width: 640px) { .drawer-resize { display: none; } }
  .notify-events { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; }
  .notify-events label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; cursor: pointer; }
  /* Push kinds carry a line each on what they mean, so they stack. */
  .push-events { flex-direction: column; flex-wrap: nowrap; gap: 5px; }
  .push-events label { align-items: baseline; }
  .push-events label.off { opacity: 0.5; cursor: default; }
  .push-events .label-hint { font-weight: 400; }
  .storage-total { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
  .storage-sub { color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
  .storage-meter { height: 8px; border-radius: 4px; background: var(--surface-hover);
                   overflow: hidden; margin: 12px 0 4px; }
  .storage-meter > span { display: block; height: 100%; background: var(--brand); }
  .storage-meter.warn > span { background: #d97706; }
  .storage-meter.full > span { background: #dc2626; }
  /* Worker drawer: the cases one machine took (GET /v1/workers/{id}/cases). */
  #workerBody table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 12px; }
  #workerBody th, #workerBody td { text-align: left; padding: 5px 8px 5px 0; vertical-align: top;
                                   border-bottom: 1px solid var(--border-subtle); }
  #workerBody .w-err { max-width: 340px; overflow-wrap: anywhere; color: var(--text-secondary); }
  .w-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
  .w-filters button[aria-pressed="true"] { background: var(--primary-light); border-color: var(--primary); }
  .w-pager { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--text-secondary); font-size: 12.5px; }
  .storage-bar { height: 4px; border-radius: 2px; background: var(--brand); opacity: 0.55; min-width: 1px; }
  #storageBody table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 18px; }
  #storageBody th, #storageBody td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--border);
                                     vertical-align: top; }
  #storageBody td.num, #storageBody th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  #storageBody .note { color: var(--text-muted); font-size: 11.5px; margin-top: 2px; }
  @media (prefers-reduced-motion: reduce) {
    .drawer, .drawer-scrim { transition: none; }
  }
  .drawer-head {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
  }
  .drawer-head h2 {
    margin: 0; font-size: 13px; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-secondary);
  }
  .drawer-tabs {
    display: flex; gap: 2px; padding: 10px 14px 0;
    border-bottom: 1px solid var(--border); flex-wrap: wrap;
  }
  .drawer-tab {
    appearance: none; border: 0; background: none; cursor: pointer;
    font: inherit; font-size: 12.5px; font-weight: 600;
    color: var(--text-muted);
    padding: 8px 12px; border-radius: 6px 6px 0 0;
    border-bottom: 2px solid transparent;
  }
  .drawer-tab:hover { color: var(--text-primary); background: var(--surface-hover); }
  .drawer-tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
  .drawer-body { overflow-y: auto; flex: 1; padding: 18px 20px 28px; }
  /* The panels moved in here keep their ids and their scripts; what they lose
     is the card chrome, which would be a box inside a box. */
  .drawer-body .panel { background: none; border: 0; box-shadow: none; padding: 0; margin: 0; }
  .drawer-body .panel:hover { box-shadow: none; }
  /* A title and its subtitle sit side by side on the wide page; at drawer width
     that leaves the heading wrapping in a narrow column with the sentence beside
     it. The header itself stays flex, so "signed in as ..." keeps its
     margin-left:auto. */
  .drawer-body .panel-title-group { flex-direction: column; align-items: flex-start; gap: 3px; }
  .drawer-section + .drawer-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border-subtle); }

  /* -- The first-run wizard ---------------------------------------------------
     docs/operations.md's "First run", answered from live state rather than
     from checkboxes an operator ticks. A finished step collapses to one line
     and only the first unfinished one expands, so this shows the single thing
     left to do rather than five forms at once. */
  .wiz-step { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
  .wiz-step:last-child { border-bottom: 0; }
  .wiz-mark {
    flex: none; width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; line-height: 1;
    border: 1.5px solid var(--border);
    color: var(--text-muted); background: var(--surface-elevated);
  }
  .wiz-step.done .wiz-mark { background: var(--accent); border-color: var(--accent); color: #ffffff; }
  .wiz-step.current .wiz-mark { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
  .wiz-main { flex: 1; min-width: 0; }
  .wiz-title { font-weight: 600; font-size: 13.5px; color: var(--text-primary); }
  .wiz-step.pending .wiz-title { color: var(--text-muted); }
  .wiz-note { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
  .wiz-db { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); word-break: break-all; }
  .wiz-act { margin-top: 10px; }
  .wiz-all-done {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; border-radius: 8px; margin-bottom: 4px;
    background: var(--accent-light); color: var(--accent);
    font-weight: 600; font-size: 13px;
  }
  /* The gear wears a dot while a step is outstanding. Without it a drawer is
     undiscoverable on exactly the run where it matters most. */
  .gear-wrap { position: relative; display: inline-flex; }
  .gear-dot {
    position: absolute; top: 3px; right: 3px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--warn); border: 2px solid var(--surface);
  }

  .connected-bar {
    display: flex; align-items: center; gap: 10px; margin-top: 4px;
    padding: 10px 14px; border-radius: 6px;
    background: var(--surface-elevated); border: 1px solid var(--border);
  }
  .connected-bar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
  .connected-bar .lbl { color: var(--text-primary); font-weight: 600; font-size: 0.85rem; }
  .conn-db {
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .num.alert { color: var(--bad); }

  .fleet-queue {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .fleet-card {
    flex: 1 1 190px; min-width: 175px;
    border: 1px solid var(--border); border-radius: 6px;
    padding: 9px 12px; background: var(--surface-elevated);
  }
  .fleet-card .fc-name {
    font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em;
    text-transform: uppercase; color: var(--text-muted);
    display: flex; align-items: center; justify-content: space-between;
  }
  .fleet-card .fc-nums { display: flex; gap: 16px; margin-top: 5px; align-items: baseline; }
  .fleet-card .fc-n { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .fleet-card .fc-lbl { font-size: 11px; color: var(--text-muted); margin-left: 4px; }
  .fleet-card .fc-age { font-size: 10.5px; font-family: var(--font-mono); }
  .fleet-card.stale { border-style: dashed; }
  /* Why a worker will not take a case, under its status badge: the node's own words. */
  .worker-unfit { font-size: 11px; line-height: 1.4; color: var(--bad); max-width: 44ch; margin-top: 4px; white-space: normal; }
  .fleet-card.stale .fc-n, .fleet-card.stale .fc-name { color: var(--text-muted); }

  .geo-wrap { min-height: 40px; }
  /* The three views across the panel's whole width, the caption that names them
     directly under them, and the legend under that. Beside the views the legend took
     a third of the width and held each drawing to 300 px. */
  .geo-fig { display: flex; flex-direction: column; gap: 12px; }
  .geo-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
  /* Three across, sharing the width; two and then one as the panel narrows, so a
     phone shows each at its full width. */
  .geo-views { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
  .geo-caption { font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }
  /* Each drawing fills its column. They are square (S = ISO = EW = EH), and the zoom
     maps the pointer through the drawn size, so scaling them changes nothing else. */
  .geo-fig svg.geo-zoom { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1;
                          background: var(--surface-elevated); border: 1px solid var(--border); border-radius: 6px; }
  .geo-views > .skel-block { width: 100% !important; height: auto !important; aspect-ratio: 1 / 1; }
  /* One view: its drawing, and the zoom buttons over its top-right corner. */
  .geo-view { position: relative; min-width: 0; line-height: 0; }
  .geo-ctl { position: absolute; top: 6px; right: 6px; display: flex; flex-direction: column; gap: 4px; }
  .geo-btn { width: 26px; height: 26px; padding: 0; display: grid; place-items: center; cursor: pointer;
             border: 1px solid var(--border); border-radius: 5px; background: var(--surface);
             color: var(--text-secondary); opacity: 0.92; }
  .geo-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-hover); opacity: 1; }
  .geo-btn:disabled { opacity: 0.35; cursor: default; }
  .geo-fig svg.geo-zoom { cursor: grab; touch-action: none; user-select: none; }
  .geo-fig svg.geo-zoom.dragging { cursor: grabbing; }
  /* Lines keep their width while the drawing is magnified; otherwise a footprint
     outline at 8x is a thick band hiding the building it outlines. */
  .geo-fig svg.geo-zoom * { vector-effect: non-scaling-stroke; }
  /* Under the views, in two columns where two fit; an entry is never split between them. */
  .geo-legend { font-size: 12px; color: var(--text-secondary); line-height: 1.9; columns: 340px 2; column-gap: 32px; }
  .geo-legend > * { break-inside: avoid; }
  .geo-swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; vertical-align: -1px; margin-right: 6px; }
  .geo-note { font-size: 11.5px; color: var(--text-muted); margin-top: 8px; max-width: 46ch; }

  /* -- Wind at pedestrian height (the .wfld viewer) ------------------------- */
  .wf-wrap { min-height: 40px; outline: none; }
  .wf-wrap.wf-drop { box-shadow: 0 0 0 2px var(--ring); border-radius: 6px; }
  .wf-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 10px; }
  .wf-dir { display: flex; align-items: center; gap: 6px; }
  .wf-dir button { min-width: 30px; justify-content: center; }
  .wf-dir input[type=range] { width: 180px; }
  .wf-dirlabel { font-variant-numeric: tabular-nums; font-size: 12.5px; min-width: 15ch; color: var(--text-primary); }
  .wf-seg { display: inline-flex; border: 1px solid var(--btn-border); border-radius: 6px; overflow: hidden; }
  .wf-seg button { border: 0; border-radius: 0; background: var(--btn-bg); font-size: 12px; padding: 4px 10px; }
  .wf-seg button[aria-pressed="true"] { background: var(--primary-light); color: var(--primary); font-weight: 600; }
  .wf-seg button:disabled { opacity: 0.45; cursor: not-allowed; }
  .wf-fig { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
  .wf-plot { position: relative; width: min(100%, 560px); aspect-ratio: 1 / 1; }
  .wf-plot canvas { width: 100%; height: 100%; display: block; border: 1px solid var(--border);
                    border-radius: 6px; background: var(--surface-elevated); cursor: crosshair; }
  .wf-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
            box-shadow: var(--shadow); border-radius: 6px; padding: 6px 8px; font-size: 11.5px; line-height: 1.5;
            color: var(--text-primary); white-space: nowrap; font-variant-numeric: tabular-nums; display: none; z-index: 2; }
  .wf-tip .k { color: var(--text-muted); }
  .wf-side { font-size: 12px; color: var(--text-secondary); line-height: 1.6; max-width: 40ch; }
  .wf-legend { margin: 2px 0 12px; }
  .wf-legend .wf-ramp { height: 10px; width: 220px; border-radius: 2px; border: 1px solid var(--border); }
  .wf-legend .wf-ticks { display: flex; justify-content: space-between; width: 222px; font-size: 10.5px;
                         color: var(--text-muted); font-variant-numeric: tabular-nums; margin-top: 2px; }
  .wf-legend .wf-ltitle { font-size: 11.5px; color: var(--text-primary); font-weight: 600; margin-bottom: 4px; }
  .wf-note { font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }
  .wf-empty { font-size: 12px; color: var(--text-secondary); line-height: 1.6; max-width: 70ch; }
  .wf-empty .mono, #tab-prefs .mono { font-family: var(--font-mono); font-size: 11.5px; word-break: break-all; }

  /* KPI Stats Grid */
  .stats-grid {
    display: grid;
    /* SEVEN across, because seven is what this row renders: total, done,
       leased, pending, quarantined, remaining, and the SLURM queue. The rule
       below used to say eight, which left a permanently empty column and made
       every card narrower than it needed to be.
       The minimum is 150px so the set still fits on one line down to a ~1175px
       viewport; below that it wraps, which is the right tradeoff -- the one
       thing this row is for is reading the campaign's state as a single set. */
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
    gap: 12px;
    margin-bottom: 20px;
  }
  /* 7 x 150 + 6 x 12 gaps = 1192, plus main's 40px of side padding = 1232. The
     breakpoint sits just above that, so every common laptop width (1280, 1366,
     1440, 1512, 1920) gets the full row by default rather than by luck. */
  @media (min-width: 1240px) {
    .stats-grid { grid-template-columns: repeat(7, 1fr); }
  }
  .stat-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    background: var(--surface-elevated);
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  /* The state's colour lives in a 6px dot beside its label -- the size GitHub
     uses for a language dot -- instead of a 3px bar across the whole tile. Same
     information, a fraction of the ink. */
  .stat-card .label::after {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border);
    flex: none;
  }
  .stat-card.total .label::after       { background: var(--text-muted); }
  .stat-card.done .label::after        { background: var(--accent); }
  .stat-card.leased .label::after      { background: var(--primary); }
  .stat-card.pending .label::after     { background: var(--warn); }
  .stat-card.quarantined .label::after { background: var(--bad); }
  .stat-card.queued .label::after        { background: var(--primary); }
  /* A stale snapshot is drawn as provisional, not as a number to act on. */
  .stat-card.queued.nonzero-stale { border-style: dashed; }

  .stat-card .label {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .stat-card .value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    margin-top: 4px;
  }
  .stat-card .value { color: var(--text-primary); }
  .stat-card.quarantined.nonzero .value { color: var(--bad); }
  .stat-card .subtext {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
  }

  /* Progress Bar */
  .campaign-progress {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
  }
  .progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12.5px;
    font-weight: 600;
  }
  .progress-bar-wrap {
    height: 12px;
    background: var(--border-subtle);
    border-radius: 999px;
    overflow: hidden;
    display: flex;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  }
  .progress-segment {
    height: 100%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  /* The first answer after a skeleton: drawn at its widths, not grown to them
     (renderStatus says why). */
  .progress-bar-wrap.no-anim .progress-segment { transition: none; }
  .progress-bar-wrap.thin { height: 6px; box-shadow: none; }
  /* The unit under way. Not a fabricated fill: a translucent band the width of
     that one unit, with the barber-pole motion every progress indicator since
     the 1990s has used for "working, duration unknown". */
  .progress-segment.active {
    opacity: 0.45;
    background-image: repeating-linear-gradient(
      -45deg, rgba(255, 255, 255, 0.55) 0 5px, rgba(255, 255, 255, 0) 5px 10px);
    background-size: 14.15px 100%;
    animation: progress-stripes 900ms linear infinite;
  }
  @keyframes progress-stripes { from { background-position: 0 0; } to { background-position: 14.15px 0; } }
  /* Motion is decoration here -- the width already carries the meaning -- so it
     goes away for anyone who asked for less of it, and the band stays visible. */
  @media (prefers-reduced-motion: reduce) {
    .progress-segment.active { animation: none; }
  }
  .progress-caption {
    display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
    margin-top: 4px; font-size: 10.5px; color: var(--text-muted);
  }
  .progress-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .progress-pct { flex: none; font-variant-numeric: tabular-nums; }
  .progress-segment.done { background: var(--accent); }
  .progress-segment.leased { background: var(--primary); }
  .progress-segment.pending { background: var(--warn); }
  .progress-segment.quarantined { background: var(--bad); }
  .progress-legend {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    font-size: 11.5px;
    color: var(--text-secondary);
    flex-wrap: wrap;
  }
  .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }

  /* Tables */
  .table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
  }
  table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13px;
    text-align: left;
  }
  thead {
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border);
  }
  th {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
  }
  td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
  }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: var(--surface-hover); }
  td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

  #workersTable.no-cluster th:nth-child(3),
  #workersTable.no-cluster td:nth-child(3) { display: none; }

  /* Phones: a table squeezed to the viewport wraps every cell -- a worker id
     broke over three lines and each row ran ~350px tall. Keep cells on one
     line and let .table-wrap scroll sideways; long ids truncate instead. */
  @media (max-width: 640px) {
    .table-wrap td { white-space: nowrap; padding: 8px 10px; }
    .table-wrap th { padding: 8px 10px; }
    .table-wrap code.inline { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
    .table-wrap .chip { max-width: 160px; }
    .table-wrap .worker-unfit { white-space: normal; min-width: 180px; }
    .progress-header { flex-wrap: wrap; gap: 2px 12px; }
    .progress-header > span { white-space: nowrap; }
    .progress-legend { flex-wrap: wrap; gap: 4px 12px; }
    .stat-card { padding: 12px; }
    .stat-card .label, .stat-card .subtext { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .stat-card .label { font-size: 10.5px; letter-spacing: 0.03em; }
  }

  /* Badges */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: lowercase;
  }
  .badge.done { background: var(--accent-light); color: var(--accent); }
  .badge.leased { background: var(--primary-light); color: var(--primary); }
  .badge.pending { background: var(--warn-light); color: var(--warn); }
  .badge.quarantined { background: var(--bad-light); color: var(--bad); }
  /* A worker's build chip and its "→ target · stuck" badge share a cell, and the
     badge wraps under the chip; with no gap the two touched. */
  code.inline + .badge { margin-top: 4px; }

  .chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 500;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
  }
  .chip.mono { font-family: var(--font-mono); font-size: 11px; }
  .chip-btn { cursor: pointer; color: var(--text-muted); font-weight: 500; }
  .chip-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
  /* One line wherever there is room for it; a phone may wrap. */
  #etaText { white-space: nowrap; }
  @media (max-width: 640px) { #etaText { white-space: normal; } }

  /* Code & Mono */
  code, pre {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
  }
  code.inline {
    padding: 2px 6px;
    color: var(--text-primary);
  }
  code.inline.case-id {
    display: inline-block;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
  /* Middle truncation: the head takes the ellipsis, the tail never shrinks,
     so the "…" lands between them and the distinguishing suffix stays visible. */
  code.case-id .mt { display: flex; min-width: 0; }
  code.case-id .mt-h { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  code.case-id .mt-t { flex: none; white-space: nowrap; }
  pre {
    padding: 12px 14px;
    overflow-x: auto;
    max-height: 380px;
    margin: 8px 0 0;
    line-height: 1.45;
    color: var(--text-primary);
  }

  /* Case Browser Specifics */
  tr.caseRow {
    cursor: pointer;
    transition: background 0.15s ease;
  }
  tr.caseRow:hover td { background: var(--surface-elevated); }
  tr.caseRow.open td {
    background: var(--surface-elevated);
    border-bottom-color: transparent;
  }
  tr.caseDetailRow td {
    padding: 0;
    background: var(--surface-elevated);
    border-bottom: 2px solid var(--border);
  }
  tr.caseDetailRow.closed { display: none; }

  .caseDetail {
    padding: 16px 20px;
    background: var(--surface-elevated);
  }
  /* Four cards: parameters, compute, storage, mesh & solve. Explicit column
     counts rather than auto-fit: auto-fit at 280 px put three on a row and the
     fourth alone under them, which reads as an afterthought. 4 on a wide
     screen, 2 on a laptop half-screen or a tablet, 1 on a phone. minmax(0,..)
     so a long build string cannot push a column wider than its share. */
  .detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 14px;
    /* Each card its own height: a solving case's Mesh & Solve card is the
       tallest by far, and stretching the other three to it drew three tall
       empty boxes beside it. */
    align-items: start;
  }
  /* Wide screen: Parameters, Compute and Storage share the first row at one
     height, and Mesh & Solve -- by far the tallest -- runs full width under
     them, its reports in two balanced columns. Beside the other three
     it left a tall empty gap under them however they were stretched. */
  @media (min-width: 1340px) {
    .detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
    .detail-grid > .detail-card:nth-child(4) { grid-column: 1 / -1; }
    /* Its reports flow down two balanced columns, newspaper style, so the
       long Solve report does not leave the Mesh half empty. */
    .ms-card { column-count: 2; column-gap: 32px; column-rule: 1px solid var(--border-subtle); }
    .ms-card > h3 { column-span: all; }
    .ms-card .kv-list, .ms-card table, .ms-card .rs-wrap, .ms-card .ms-head { break-inside: avoid; }
  }
  @media (max-width: 1339px) { .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 759px) {
    .detail-grid { grid-template-columns: minmax(0, 1fr); }
    /* On a phone the case table is wider than the screen and scrolls sideways
       in its wrapper, and the expanded row is as wide as the TABLE -- so "one
       column" was an 836 px card on a 375 px screen. The cards are pinned to
       the visible part of the wrapper instead (sticky), one screen wide; 88 px
       is main's, the panel's and the wrapper's gutters, 40 the panel's own.
       The geometry below keeps the table's width, as it always had. */
    .caseDetail .detail-grid, .caseDetail .pct-card {
      position: sticky; left: 20px; width: calc(100vw - 128px);
    }
  }

  /* -- Mesh & Solve card ------------------------------------------------------ */
  .ms-sec + .ms-sec { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-subtle); }
  .ms-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
  .ms-title { font-weight: 700; font-size: 12px; color: var(--text-primary); }
  .ms-at { margin-left: auto; font-size: 10.5px; color: var(--text-muted); white-space: nowrap;
           overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .ms-note { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
  /* Words and numbers here, not hashes: break between words ("49 k cells /
     rank"), and inside one only when it alone is wider than the card (a
     build string). The kv-list default breaks anywhere, for SHA-256s. */
  .ms-sec .kv-list dd { word-break: normal; overflow-wrap: anywhere; }
  .ms-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 8px; table-layout: auto; }
  /* Scoped under .caseDetail: `tr.caseDetailRow td` (the expanded row's own
     cell -- no padding, the well colour, a 2px rule) matches every td nested
     in the panel too, and outranks a bare `.ms-table td`. */
  .caseDetail .ms-table thead { background: none; }
  .caseDetail .ms-table th { padding: 3px 4px; font-size: 10px; letter-spacing: 0.04em; text-align: left;
                             border-bottom: 1px solid var(--border); }
  .caseDetail .ms-table td { padding: 3px 4px; background: none; border-bottom: 1px solid var(--border-subtle);
                             color: var(--text-primary); font-family: var(--font-mono); font-size: 11px;
                             white-space: nowrap; }
  .caseDetail .ms-table th.num, .caseDetail .ms-table td.num { text-align: right; }
  .caseDetail .ms-table tr:hover td { background: none; }
  .caseDetail .ms-table tr:last-child td, .caseDetail .ms-table tr.has-sub td { border-bottom: 0; }
  .caseDetail .ms-table td.ms-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .caseDetail .ms-table td.ms-sub { white-space: normal; font-family: var(--font-sans); font-size: 11px;
                                    color: var(--bad); padding-top: 0; }
  .caseDetail .ms-table td.ms-over { color: var(--bad); font-weight: 700; }
  /* A verdict: one line, never broken inside a word (the dd it sits in breaks
     anywhere, for hashes), and cut short rather than wrapped when a node sends
     a status nobody expected. */
  .vbadge { display: inline-block; vertical-align: middle; padding: 1px 6px; border-radius: 5px; font-size: 10.5px;
            font-weight: 600; font-family: var(--font-mono); line-height: 1.5; white-space: nowrap;
            word-break: normal; max-width: 14em; overflow: hidden; text-overflow: ellipsis; }
  .vbadge.ok   { background: var(--accent-light); color: var(--accent); }
  .vbadge.bad  { background: var(--bad-light); color: var(--bad); }
  .vbadge.warn { background: var(--warn-light); color: var(--warn); }
  .vbadge.info { background: var(--primary-light); color: var(--primary); }
  .vbadge.muted { background: var(--surface-elevated); color: var(--text-muted); border: 1px solid var(--border); }
  .ms-dirbar { height: 5px; border-radius: 3px; background: var(--surface-hover); overflow: hidden; margin: 2px 0 0; }
  .ms-dirbar > span { display: block; height: 100%; background: var(--accent); }
  .ms-finished { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, auto) 1fr; gap: 2px 8px;
                 font-size: 11px; margin-top: 6px; align-items: center; }
  .ms-finished .mono { font-family: var(--font-mono); color: var(--text-primary); overflow: hidden;
                       text-overflow: ellipsis; white-space: nowrap; }
  .ms-finished .it { color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .ms-sublabel { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
                 color: var(--text-muted); margin-top: 10px; }

  /* -- Residual curves (the Solve card) ------------------------------------------
     One log-scale line chart per wind direction, drawn by residualSvg(). The
     controls are re-skinned because the page's bare `button` and `select` are
     sized for forms, not for a legend. */
  .rs-head { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin-top: 4px; }
  .rs-head .mono { font-size: 11px; color: var(--text-primary); }
  .rs-at { margin-left: auto; font-size: 10.5px; color: var(--text-muted); white-space: nowrap;
           font-variant-numeric: tabular-nums; }
  select.rs-dir { width: auto; max-width: 100%; padding: 2px 6px; font-size: 11px; border-radius: 6px;
                  font-family: var(--font-mono); }
  .rs-svg { display: block; width: 100%; height: auto; margin-top: 4px; overflow: visible; touch-action: pan-y; }
  .rs-svg text { font: 9.5px var(--font-mono); fill: var(--text-muted); }
  .rs-svg .rs-grid { stroke: var(--border-subtle); stroke-width: 1; }
  .rs-svg .rs-frame { stroke: var(--border); stroke-width: 1; fill: none; }
  .rs-svg .rs-line { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round;
                     vector-effect: non-scaling-stroke; }
  .rs-svg .rs-cross { stroke: var(--text-secondary); stroke-width: 1; stroke-dasharray: 2 2; pointer-events: none; }
  .rs-svg .rs-tol { stroke: var(--text-secondary); stroke-width: 1; stroke-dasharray: 6 3; opacity: 0.85; }
  .rs-svg text.rs-tol-label { fill: var(--text-secondary); }
  .rs-svg .rs-hit { fill: transparent; }
  .rs-keys { display: flex; flex-wrap: wrap; gap: 3px 5px; margin-top: 6px; }
  button.rs-key { padding: 1px 6px; gap: 4px; border-radius: 6px; font-size: 10.5px; font-weight: 500;
                  font-family: var(--font-mono); line-height: 1.6; background: transparent; }
  button.rs-key i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
  button.rs-key .v { color: var(--text-muted); font-variant-numeric: tabular-nums; }
  /* Not by opacity alone: a switched-off series is struck through as well. */
  button.rs-key[aria-pressed="false"] { opacity: 0.5; text-decoration: line-through; }
  .rs-note { margin-top: 4px; font-size: 11px; }
  /* How the direction on show ended, under its name: the badge, then why. */
  .rs-verdict { margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--text-secondary); }
  .rs-verdict .vbadge { margin-right: 4px; }
  .rs-tally { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

  /* -- Histograms (the dataset drawer and "Where this case sits") -------------
     One renderer, histSvg(). Bars are the reference distribution; an outline is
     the whole campaign drawn behind an LCZ's bars; the marker is this case. */
  .hist { display: block; overflow: visible; flex: none; }
  /* The bars carry the distribution's shape, which no text beside them does:
     0.72 is the least opacity that keeps them 3:1 on --surface in both themes
     (3.2:1 light, 3.8:1 dark), the rule the page holds control edges to. */
  .hist .hb { fill: var(--primary); opacity: 0.72; }
  .hist .hb.on { opacity: 1; }
  .hist .ho { fill: none; stroke: var(--text-muted); stroke-width: 1; opacity: 0.7; }
  .hist .hbase { stroke: var(--border); stroke-width: 1; }
  .hist .hmed { stroke: var(--text-secondary); stroke-width: 1; stroke-dasharray: 2 2; }
  .hist .hhalo { stroke: var(--surface); stroke-width: 5; }
  .hist .hmark { stroke: var(--brand); stroke-width: 2; }
  .hist .hcap { fill: var(--brand); }
  .hist .hempty { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }

  /* -- Where this case sits -------------------------------------------------- */
  .pct-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
  .pct-head h3 { margin: 0; }
  .seg { display: inline-flex; border: 1px solid var(--btn-border); border-radius: 7px; overflow: hidden; }
  .seg button { border: 0; border-radius: 0; padding: 3px 10px; font-size: 11.5px; font-weight: 500;
                background: transparent; color: var(--text-secondary); }
  .seg button + button { border-left: 1px solid var(--btn-border); }
  /* Not by colour alone (1.2:1 between the two states): an underline in
     --brand, as .drawer-tab[aria-selected] has, and a heavier weight. */
  .seg button[aria-pressed="true"] { background: var(--brand-light); color: var(--brand); font-weight: 700;
                                     box-shadow: inset 0 -2px 0 var(--brand); }
  .seg button:disabled { opacity: 0.45; }
  .pct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px 18px; }
  /* A narrow card scrolls its per-mesh table rather than spilling it. */
  .ms-scroll { overflow-x: auto; }
  .pct-group { grid-column: 1 / -1; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
               letter-spacing: 0.05em; color: var(--text-muted); margin-top: 6px;
               padding-bottom: 3px; border-bottom: 1px solid var(--border-subtle); }
  .pct-group:first-child { margin-top: 0; }
  .pct-tile { min-width: 0; }
  .pct-label { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden;
               text-overflow: ellipsis; }
  .pct-row { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
  .pct-val { font-size: 12.5px; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums;
             line-height: 1.3; }
  .pct-rank { font-size: 11px; color: var(--text-muted); line-height: 1.3; }
  .pct-foot { font-size: 11px; color: var(--text-muted); margin-top: 10px; }

  /* -- Dataset drawer --------------------------------------------------------- */
  .drawer-toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 20px;
                    border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); }
  .drawer-toolbar select { width: auto; padding: 5px 10px; font-size: 12.5px; }
  .ds-total { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
  .ds-sub { color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
  .ds-note { color: var(--text-muted); font-size: 11.5px; margin-top: 6px; line-height: 1.45; }
  .ds-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 22px; }
  .ds-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
          color: var(--text-muted); margin: 0 0 6px; }
  .ds-bars { display: grid; grid-template-columns: minmax(0, max-content) minmax(40px, 1fr) auto;
             gap: 3px 8px; align-items: center; font-size: 12px; }
  .ds-bars .k { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
  .ds-bars .k.bucket { color: var(--text-muted); font-style: italic; }
  .ds-bars .t { height: 8px; border-radius: 3px; background: var(--surface-hover); overflow: hidden; }
  .ds-bars .t > span { display: block; height: 100%; background: var(--primary); opacity: 0.75; min-width: 1px; }
  .ds-bars .t > span.done { background: var(--accent); opacity: 1; }
  .ds-bars .t > span.leased { background: var(--primary); opacity: 1; }
  .ds-bars .t > span.pending { background: var(--warn); opacity: 1; }
  .ds-bars .t > span.quarantined { background: var(--bad); opacity: 1; }
  .ds-bars .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); }
  .ds-more { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
  .ds-more summary { cursor: pointer; }
  .ds-group { font-size: 12px; font-weight: 700; color: var(--text-primary); margin: 18px 0 2px;
              padding-bottom: 4px; border-bottom: 1px solid var(--border); }
  .ds-metric { display: flex; align-items: center; gap: 12px; padding: 8px 0;
               border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
  .ds-metric .main { flex: 1 1 200px; min-width: 0; }
  .ds-metric .lbl { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
  .ds-metric .unit { font-weight: 400; color: var(--text-muted); }
  .ds-metric .st { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; font-variant-numeric: tabular-nums; }
  .ds-metric .st b { color: var(--text-primary); font-weight: 600; }
  .ds-metric .fig { flex: none; }
  .ds-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted);
             font-variant-numeric: tabular-nums; margin-top: 1px; }
  .ds-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); margin-top: 8px; }
  .ds-legend i { display: inline-block; width: 12px; height: 8px; vertical-align: -0px; margin-right: 5px; border-radius: 2px; }
  .ds-msg { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
  .ds-msg .why { color: var(--text-muted); font-size: 11.5px; margin-top: 6px; font-family: var(--font-mono);
                 word-break: break-word; }
  #datasetBody > * { transition: opacity 0.12s ease; }
  #datasetBody.is-stale > * { opacity: 0.5; transition-delay: 0.2s; }
  .detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
  }
  .detail-card h3 {
    margin: 0 0 10px;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
  }
  .kv-list {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 6px 12px;
    font-size: 12.5px;
    margin: 0;
  }
  .kv-list dt { color: var(--text-muted); font-weight: 500; }
  .kv-list dd { margin: 0; word-break: break-all; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
  .kv-list dd.mono { font-family: var(--font-mono); font-size: 11.5px; }
  /* A dd is a flex ROW, so two block children sit beside each other -- which put
     the progress caption next to the bar in a 1fr column and let word-break
     split it mid-word ("last lin / e 9h ago"). A row with more than one line
     stacks instead, and min-width:0 lets its children ellipsize rather than
     pushing the grid column wider than the card. */
  .kv-list dd.stack { flex-direction: column; align-items: stretch; gap: 0; min-width: 0; }
  .kv-list dd.stack > * { min-width: 0; max-width: 100%; }

  .copy-btn {
    background: transparent;
    border: none;
    padding: 2px 4px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
  }
  .copy-btn:hover { background: var(--surface-elevated); color: var(--text-primary); }
  .copy-btn svg { width: 13px; height: 13px; }
  /* A link just made: monospace, selected whole on focus, never wrapped. */
  input.share-url { font-family: var(--font-mono); font-size: 12px; }

  /* Pager */
  .pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--text-muted);
  }
  .pager-controls {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Empty state */
  .empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-muted);
    font-size: 13.5px;
  }
  .empty-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    opacity: 0.4;
    color: var(--text-muted);
  }

  /* Refresh Countdown Ring */
  /* The countdown lives inside the Refresh button at a fixed width, so the
     number ticking (or "off") never moves anything around it. */
  .refresh-count {
    display: inline-block;
    min-width: 3ch;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
  }
  .spin { animation: spin 0.8s linear infinite; }
  @keyframes spin { 100% { transform: rotate(360deg); } }

  /* -- Skeletons --------------------------------------------------------------
     Grey shapes of the content that is coming, shown while a region has
     nothing to draw and a request is on its way. `.skel` only PAINTS -- colour
     and sweep -- so it can also be put on an element that already has a shape
     (the campaign bar, a chip) without flattening its radius or height; the
     shape classes below size the free-standing ones.

     The sweep is painted against the viewport (background-attachment: fixed),
     so every bar on the page shows a slice of ONE band passing over it, the
     way Facebook's and LinkedIn's placeholders do, instead of each bar
     flashing at its own speed. --skel-phase starts a bar part-way through the
     cycle; skelPhase() in the script sets it from the page clock, which keeps
     a skeleton inserted later (or rebuilt mid-load) in step with the rest.
     Inside a transformed ancestor (the drawers slide in with one) a fixed
     background falls back to scroll, per the transforms spec: each bar then
     sweeps on its own, which still reads as loading.

     A soft sweep, deliberately not stripes: the barber-pole band on a leased
     case's bar means "a worker is on this now", and a placeholder must not be
     mistaken for work in progress. */
  .skel {
    background-color: var(--skel);
    background-image: linear-gradient(100deg, transparent 40%, var(--skel-shine) 50%, transparent 60%);
    background-size: 200% 100%;
    background-repeat: no-repeat;
    background-attachment: fixed;
    animation: skel-sweep 1.5s ease-in-out infinite;
    animation-delay: var(--skel-phase, 0s);
  }
  @keyframes skel-sweep { from { background-position: 130% 0; } to { background-position: -30% 0; } }
  /* A line of text: 0.75em of ink in a 1.5em box, the page's own line-height,
     so a column of these is as tall as the lines that replace it. */
  .skel-text { display: block; height: 0.75em; margin: 0.375em 0; max-width: 100%; border-radius: 4px; }
  .skel-block { display: block; max-width: 100%; border-radius: 6px; }
  .skel-pill { display: block; max-width: 100%; border-radius: 999px; }
  .skel-circle { display: inline-block; flex: none; border-radius: 50%; }
  .skel-w-30 { width: 30%; }
  .skel-w-45 { width: 45%; }
  .skel-w-60 { width: 60%; }
  .skel-w-75 { width: 75%; }
  .skel-w-90 { width: 90%; }
  /* An existing element worn as its own placeholder: it keeps its box, its
     text goes. For a chip whose words are wrong until data arrives ("0
     active" before anyone has asked how many are). */
  .skel-mask { color: transparent !important; border-color: transparent !important; user-select: none; }
  .skel-mask * { visibility: hidden; }
  /* The generic row hover is --surface-hover, which in the dark theme IS the
     bar colour: a hovered skeleton row would go blank under the cursor. */
  tr.skel-row:hover td { background: none; }
  /* Motion is decoration: the grey shape already says "coming". */
  @media (prefers-reduced-motion: reduce) {
    .skel { animation: none; background-image: none; }
  }
  /* Forced colours (Windows High Contrast) repaint a background as Canvas and
     drop a gradient, so every bar was Canvas on Canvas -- gone -- and they force
     `color` too, which put the masked words ("0 known", the badge's
     "version • database • auth") back on screen. A skeleton is a shape, not
     a colour scheme: it keeps a system colour that reads as one. */
  @media (forced-colors: active) {
    .skel { forced-color-adjust: none; background-color: GrayText; background-image: none; }
    .skel-mask { forced-color-adjust: none; color: transparent !important; }
  }

  /* Rows that answer the PREVIOUS question while the next one is on its way (a
     filter, a sort, another page). Dimmed, not replaced: they are still true of
     what they say, and blanking a table for a round trip makes the pager jump
     under the cursor. The delay is on the way IN only, so a fast broker never
     dims at all and the answer lands at full strength at once. */
  #casesBody, #storageBody > *, .geo-wrap .geo-fig { transition: opacity 0.12s ease; }
  #casesTableWrap.is-stale #casesBody,
  #storageBody.is-stale > *,
  .geo-wrap.geo-stale .geo-fig { opacity: 0.5; transition-delay: 0.2s; }

  /* Text for assistive tech only: the words a skeleton stands in for. */
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }

  /* Toast */
  #toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-primary);
    color: var(--bg);
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    pointer-events: none;
  }
  #toast.show { opacity: 1; transform: translateY(0); }

  /* Footer */
  footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 20px;
    margin-top: auto;
  }
