/* ==========================================================================
   r00tc console — stylesheet
   --------------------------------------------------------------------------
   Design system, in order:

     1.  Tokens            — colour, type, geometry, elevation, motion
     2.  Reset & base      — typography, selection, focus, reduced motion
     3.  Backdrop          — grid, vignette, CRT scanlines
     4.  Layout            — .container / .main-wrapper
     5.  Header            — brand, LED, live stats, action bar
     6.  Buttons           — .btn-retro + variants, icon buttons
     7.  Panels            — corner-ticked frames with gradient headers
     8.  HUD               — the metric row
     9.  Tables            — fleet + shared row treatment
    10.  Pills & badges    — status, permissions, node, build
    11.  Empty state
    12.  Monitor viewport
    13.  Modals
    14.  Scrollbars
    15.  Spec grid
    16.  File manager
    17.  Footer
    18.  Icons & inputs
    19.  Context menu
    20.  Toasts
    21.  Confirm dialog
    22.  Process manager
    23.  Browser picker
    24.  Grabber
    25.  Responsive

   Colour policy: the console is strictly monochrome — black, white and grey,
   exactly as it has always been. The four intent tokens (ok / warn / info /
   danger) exist so a component can name what it means while still rendering in
   the console greys.
   ========================================================================== */
/* Fonts are bundled locally (public/css/fonts/) — the Google Fonts @import was
   dropped so the console renders identically on networks that block CDNs or
   have no internet at all. Same families/weights as before. */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-400i.ttf') format('truetype');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-400.ttf') format('truetype');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-500.ttf') format('truetype');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-600.ttf') format('truetype');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/ibm-plex-mono-700.ttf') format('truetype');
}
@font-face {
  font-family: 'Share Tech Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/share-tech-mono-400.ttf') format('truetype');
}

/* ==========================================================================
   1. TOKENS
   ========================================================================== */
:root {
  color-scheme: dark;

  /* --- surfaces (stepped luminance) --- */
  --bg-deep: #050505;
  --bg-sunken: #080808;
  --bg-panel: #0b0b0b;
  --bg-card: #101010;
  --bg-header: #161616;
  --bg-raised: #1a1a1a;
  --bg-input: #0a0a0a;

  /* --- gradient stops: every surface gradient is tokenised so the console's
         theme picker can recolour the whole UI from one hue --- */
  --head-top: #1a1a1a;
  --head-bot: #131313;
  --btn-top: #161616;
  --btn-bot: #0d0d0d;
  --btn-top-hover: #212121;
  --btn-bot-hover: #171717;
  --card-bot: #0c0c0c;
  --th-top: #1a1a1a;
  --th-bot: #141414;
  --pop-top: #171717;
  --pop-bot: #101010;

  /* --- hairlines --- */
  --line: #2a2a2a;
  --line-soft: #1c1c1c;
  --line-strong: #3a3a3a;
  --line-hi: rgba(255, 255, 255, 0.05);

  /* --- borders: refined, layered edges for depth --- */
  --border: var(--line-strong);
  --border-soft: var(--line-soft);
  --border-strong: var(--line);
  --border-hi: var(--line-hi);
  --ring-ready: 0 0 0 1px rgba(255, 255, 255, 0.10);
  --ring-focus: 0 0 0 2px rgba(255, 255, 255, 0.16), 0 0 0 1px var(--info);

  /* --- type --- */
  --text-primary: #f2f2f2;
  --text-secondary: #a3a3a3;
  --text-muted: #8a8a8a;
  --text-dim: #666666;

  /* --- the console palette is monochrome. These four tokens exist so the
         components can name their *intent* (ready / live / warn / danger) while
         still rendering in the console's own greys. --- */
  --term-green: #ffffff;
  --term-green-dim: rgba(255, 255, 255, 0.12);
  --term-green-glow: 0 0 12px rgba(255, 255, 255, 0.22);
  --term-amber: #9d9d9d;
  --term-amber-dim: rgba(255, 255, 255, 0.07);
  --term-cyan: #d6d6d6;
  --term-cyan-dim: rgba(255, 255, 255, 0.1);
  --term-cyan-glow: 0 0 12px rgba(255, 255, 255, 0.18);
  --term-red: #ffffff;
  --term-red-dim: rgba(255, 255, 255, 0.14);

  --ok: var(--term-green);
  --ok-dim: var(--term-green-dim);
  --ok-glow: var(--term-green-glow);
  --warn: var(--term-amber);
  --warn-dim: var(--term-amber-dim);
  --warn-glow: 0 0 12px rgba(255, 255, 255, 0.14);
  --info: var(--term-cyan);
  --info-dim: var(--term-cyan-dim);
  --info-glow: var(--term-cyan-glow);
  --danger: var(--term-red);
  --danger-dim: var(--term-red-dim);
  --danger-glow: 0 0 12px rgba(255, 255, 255, 0.26);
  --accent: #ffffff;

  --border-dim: var(--line);
  --border-glow: var(--accent);

  /* --- geometry --- */
  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 10px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* The footer band's floor height: the slide-out drawer stops this far above
     the viewport bottom so its card can never sit inside the footer. */
  --footer-h: 84px;

  /* --- elevation --- */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --sh-2: 0 6px 20px rgba(0, 0, 0, 0.55);
  --sh-3: 0 18px 48px rgba(0, 0, 0, 0.7);
  --sh-4: 0 30px 90px rgba(0, 0, 0, 0.85);
  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.045);

  /* --- motion --- */
  --t-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --t-med: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --font-display: 'Share Tech Mono', 'IBM Plex Mono', ui-monospace, monospace;
}

/* Polished focus ring — clearer, softer, on-brand interactive states. */
*:focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-mono);
  direction: ltr;
  min-height: 100vh;
  line-height: 1.55;
  font-size: 13px;
  /* Medium weight reads noticeably crisper on the dark retro surfaces than
     the thin 400 default — small mono text was washing out. */
  font-weight: 500;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Numeric readouts must never jitter as they tick. */
.hud-value,
.stat-val,
.proc-num,
.proc-num-dim,
.proc-mem,
.cpu-low,
.cpu-warn,
.cpu-high,
.grabber-cat .n {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

::selection {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

/* One visible focus treatment for the whole console. */
:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1, h2, h3, h4 {
  font-size: inherit;
  font-weight: inherit;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   3. BACKDROP — fine grid, top glow, vignette, CRT scanlines
   ========================================================================== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    radial-gradient(ellipse 80% 55% at 50% -10%, rgba(255, 255, 255, 0.07), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 120%, rgba(0, 0, 0, 0.6), transparent 70%);
  background-size: 32px 32px, 32px 32px, 100% 100%, 100% 100%;
}

/* Scanlines sit above the content but below the popovers. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.24) 50%);
  background-size: 100% 4px;
  opacity: 0.5;
}

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 var(--sp-5);
}

.main-wrapper {
  position: relative;
  z-index: 1;
  padding: var(--sp-5) 0 64px;
}

/* Console only: the workspace fills the viewport between the sticky header and
   the page bottom, so the Clients panel and its corner ticks reach the corners. */
/* Console fills the whole viewport: header at the top, the Clients panel takes
   everything below with NO gaps (no top or bottom margins). */
body.console-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.console-body .main-wrapper {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* The console footer now carries the fleet counter readout. */

/* The console is a single slim column: the workspace sits centred and the left
   navigation is a slide-out drawer (see §27), not an inline grid column. */
.app-shell {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.side-nav {
  position: fixed;
  top: 76px;
  left: 10px;
  /* A floating card that ends *above* the footer band: the drawer's bottom
     edge clears the footer's top hairline with an air gap, so the two never
     overlap or read as one colliding strip. */
  bottom: calc(var(--footer-h) + 14px);
  z-index: 1200;
  width: 272px;
  max-width: 84vw;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: 18px 16px 18px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-sunken) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md, 10px);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
  transform: translateX(calc(-100% - 14px));
  transition: transform 0.34s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.app-shell.nav-open .side-nav { transform: translateX(0); }

/* A hairline down the right edge separates navigation from the workspace. */
.side-nav::after { display: none; }

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* The workspace breadcrumb: the console's pages, named. */
.view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  min-height: 26px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.crumbs span { color: var(--text-dim); }
.crumbs i { color: var(--line-strong); font-style: normal; }
.crumbs b { color: #fff; }

.view-bar-actions {
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* A faint rule between the menu and the fleet counters. */
.nav-group + .nav-group {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-soft);
}

/* The tail group is pinned to the drawer's bottom edge — Sign out lives
   there, last, separated from the console rows above it. */
.nav-group-tail { margin-top: auto; }
.nav-signout { color: var(--text-secondary); }
.nav-signout:hover,
.nav-signout:hover .ic { color: var(--danger, #ff5c6c); }

.nav-group-title {
  padding: 0 0 var(--sp-2) 10px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* A nav row: icon, label, optional counter. The active row gets a left rail. */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: left;
  color: var(--text-secondary);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.nav-item .ic { color: var(--text-dim); transition: color var(--t-fast); }

.nav-item:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line);
  color: #fff;
}

.nav-item:hover .ic { color: #fff; }

.nav-item.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border-color: var(--line-strong);
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-item.is-active .ic { color: #fff; }

.nav-count {
  margin-left: auto;
  min-width: 26px;
  padding: 1px 8px;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}

/* Compact telemetry rows — deliberately not cards. They double as filters. */
.nav-stat {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 12px;
  font: inherit;
  font-size: 11px;
  color: var(--text-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.nav-stat:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: var(--line);
  color: var(--text-primary);
}

.nav-stat.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border-color: var(--line-strong);
  box-shadow: inset 2px 0 0 var(--accent);
}

.nav-stat.is-active b { color: #fff; }

.nav-stat b {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.nav-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--text-dim);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
}

.nav-dot-ok { background: var(--ok); box-shadow: 0 0 7px var(--ok); animation: pulseLed 2.2s ease-in-out infinite; }
.nav-dot-info { background: var(--info); box-shadow: 0 0 7px var(--info); }

/* ==========================================================================
   5. HEADER
   ========================================================================== */
.console-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--head-top) 0%, var(--head-bot) 100%);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 var(--line-hi) inset, 0 8px 28px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

/* A hairline of light along the bottom edge. */
.console-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.35), transparent);
  opacity: 0.7;
}

/* The brand owns the first column, so it can never be squeezed or clipped. */
.header-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-5);
  padding: 12px var(--sp-5);
}

/* The console header adds a hamburger as the first cell (see §27). */
.header-content.has-nav-toggle {
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: var(--sp-4);
}

.system-title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
  padding-left: 14px;
  border-left: 2px solid var(--line-strong);
  text-decoration: none;
  color: inherit;
}

/* The brand mark: the plate keeps the header's first column optically anchored. */
.brand-mark {
  display: inline-flex;
  flex: none;
  line-height: 0;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.14));
  transition: filter var(--t-med), transform var(--t-med);
}

.system-title:hover .brand-mark {
  filter: drop-shadow(0 0 16px rgba(255, 255, 255, 0.3));
  transform: translateY(-1px);
}

.r00tc-mark { display: block; }

.sys-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #000;
  border: 1px solid var(--ok);
  color: var(--ok);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  letter-spacing: 1.5px;
  box-shadow: var(--ok-glow);
  text-transform: uppercase;
}

.sys-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--ok);
  animation: pulseLed 1.6s ease-in-out infinite;
}

@keyframes pulseLed {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.28; transform: scale(0.8); }
}

.brand-title {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 0.6vw + 0.85rem, 1.35rem);
  letter-spacing: 2.2px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.14);
  white-space: nowrap;
}

.brand-title span {
  color: var(--info);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
}

.header-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--sp-3);
  font-size: 11px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  letter-spacing: 0.6px;
  padding-right: var(--sp-3);
  border-right: 1px solid var(--line-soft);
}

.stat-item:last-of-type { border-right: none; }

.stat-val {
  color: var(--ok);
  font-weight: 700;
  font-family: var(--font-mono);
}

.stat-val.amber { color: var(--warn); }
.stat-val.cyan { color: var(--info); }

/* The UTC readout is the first thing to go when space runs out. */
.stat-clock .stat-val {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}


/* ==========================================================================
   6. BUTTONS
   ========================================================================== */
.btn-retro {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 14px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, var(--btn-top) 0%, var(--btn-bot) 100%);
  color: var(--text-primary);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--inset-hi), var(--sh-1);
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.btn-retro:hover {
  background: linear-gradient(180deg, var(--btn-top-hover) 0%, var(--btn-bot-hover) 100%);
  border-color: #3a3a3a;
  color: #fff;
  box-shadow: var(--inset-hi), var(--sh-2), var(--info-glow);
}

.btn-retro:active {
  transform: translateY(1px);
  box-shadow: var(--inset-hi);
}

.btn-retro:disabled,
.btn-retro[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-retro-primary {
  border-color: rgba(255, 255, 255, 0.6);
  color: var(--ok);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 100%);
}

.btn-retro-primary:hover {
  background: var(--ok);
  border-color: var(--ok);
  color: #000000;
  box-shadow: var(--ok-glow);
}

.btn-retro-cyan {
  border-color: rgba(255, 255, 255, 0.6);
  color: var(--info);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 100%);
}

.btn-retro-cyan:hover {
  background: var(--info);
  border-color: var(--info);
  color: #000000;
  box-shadow: var(--info-glow);
}

.btn-retro-amber {
  border-color: rgba(255, 255, 255, 0.6);
  color: var(--warn);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0.04) 100%);
}

.btn-retro-amber:hover {
  background: var(--warn);
  border-color: var(--warn);
  color: #000000;
  box-shadow: var(--warn-glow);
}

.btn-retro-danger {
  border-color: rgba(255, 255, 255, 0.5);
  color: #ffffff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 100%);
}

.btn-retro-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #000000;
  box-shadow: var(--danger-glow);
}

/* Square icon button used by the fleet rows' options trigger. */
.btn-action-menu {
  padding: 0;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: var(--r-sm);
}

.btn-action-menu .ic { width: 16px; height: 16px; }

.btn-action-menu:hover {
  border-color: var(--info);
  color: var(--info);
}


/* ==========================================================================
   7. PANELS — corner-ticked frames with gradient headers
   ========================================================================== */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-sunken) 100%);
  border: 1px solid var(--border);
  margin-bottom: var(--sp-5);
  box-shadow: var(--sh-3), 0 0 0 1px var(--border-hi);
}

/* Four L-shaped corner ticks — the retro frame signature. */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  pointer-events: none;
  border: 0 solid var(--info);
  opacity: 0.75;
}

.panel::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}

.panel::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--bg-header) 0%, var(--head-bot) 100%);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: 0 1px 0 var(--line-hi) inset;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--info);
  text-transform: uppercase;
}

.panel-title::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--info);
  box-shadow: var(--info-glow);
}

.panel-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--ok);
  background: var(--ok-dim);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 2px 10px;
}

.panel-body { padding: 18px; }

/* Panel toolbar: a search field on the left, a count readout on the right. */
.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 10px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), transparent);
  border-bottom: 1px solid var(--line);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
  padding: 0 11px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--inset-hi);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

.search-field .ic { color: var(--text-dim); width: 15px; height: 15px; }

.search-field input {
  flex: 1;
  min-width: 0;
  padding: 8px 0;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-primary);
  background: none;
  border: none;
  outline: none;
}

.search-field input::placeholder { color: var(--text-dim); }

.search-field:hover { border-color: #4a4a4a; }

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: var(--inset-hi), 0 0 0 3px rgba(255, 255, 255, 0.09);
}

.search-field:focus-within .ic { color: #fff; }

.toolbar-meta {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.toolbar-meta span { color: var(--text-secondary); }

/* Right-side cluster in the fleet toolbar: actions first, the "X of Y shown"
   readout always last so it reads as the row's footnote. */
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.toolbar-actions .btn-retro { padding: 6px 12px; font-size: 10px; }
.toolbar-actions .toolbar-meta { padding-left: 6px; border-left: 1px solid var(--line-soft); }

/* Info banner */
.info-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: var(--sp-5);
  font-size: 11px;
  color: var(--text-secondary);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
}

.info-banner code {
  color: var(--warn);
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 2px 8px;
}

/* ==========================================================================
   8. HUD — metric row
   ========================================================================== */
.hud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.hud-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px 15px 22px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, 0.045), transparent 60%),
    linear-gradient(180deg, var(--bg-card) 0%, var(--card-bot) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--sh-2);
  transition: transform var(--t-med), border-color var(--t-med), box-shadow var(--t-med);
}

/* Accent rail — cyan by default, overridden per state. */
.hud-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--info);
  box-shadow: var(--info-glow);
}

/* Faint corner wash, adds depth without noise. */
.hud-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.05), transparent 70%);
  pointer-events: none;
}

.hud-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--sh-3);
}

.hud-card.green::before { background: var(--ok); box-shadow: var(--ok-glow); }
.hud-card.amber::before { background: var(--warn); box-shadow: var(--warn-glow); }
.hud-card.red::before { background: var(--danger); box-shadow: var(--danger-glow); }

.hud-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.hud-value {
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.05;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 24px rgba(255, 255, 255, 0.14);
}

.hud-sub {
  margin-top: 5px;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}


/* ==========================================================================
   9. TABLES
   ========================================================================== */
.fleet-table-wrapper {
  overflow: auto;
  max-height: min(68vh, 780px);
  border: 1px solid var(--line);
  background: var(--bg-sunken);
  box-shadow: var(--inset-hi);
}

.fleet-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  text-align: left;
}

.fleet-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  background: linear-gradient(180deg, var(--th-top) 0%, var(--th-bot) 100%);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.fleet-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.fleet-table tbody tr {
  transition: background var(--t-fast), box-shadow var(--t-fast);
}

/* Alternating rows keep long fleets readable. */
.fleet-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.012);
}

/* Hover paints an accent rail down the left edge of the row. */
.fleet-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.055);
}

.fleet-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--info);
}

.fleet-table tbody tr:last-child td { border-bottom: none; }

/* A node that has just appeared gets one green sweep. */
.fleet-table tbody tr.row-new td {
  animation: rowSweep 1.4s ease-out;
}

@keyframes rowSweep {
  0% { background: rgba(255, 255, 255, 0.22); }
  100% { background: transparent; }
}

/* ==========================================================================
   10. PILLS & BADGES
   ========================================================================== */
.node-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: #050505;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 3px 9px;
}

.spec-pill {
  display: block;
  font-size: 11px;
  color: var(--text-primary);
  margin-bottom: 3px;
  line-height: 1.35;
}

.spec-pill span {
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.loc-pill {
  color: var(--info);
  font-weight: 600;
}

.perm-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  padding: 2px 8px;
  margin-right: 4px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #000;
  color: var(--text-dim);
}

.perm-pill.active {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--ok);
  background: var(--ok-dim);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.status-pill.ready {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--ok);
  background: var(--ok-dim);
}

.status-pill.ready::before { animation: pulseLed 2.4s ease-in-out infinite; }

.status-pill.waiting {
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--warn);
  background: var(--warn-dim);
}

.status-pill.active {
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--info);
  background: var(--info-dim);
}

.status-pill.active::before { opacity: 1; transform: none; }

.status-pill.danger {
  border-color: rgba(255, 92, 108, 0.55);
  color: #ff5c6c;
  background: rgba(255, 92, 108, 0.10);
}

.status-pill.danger::before { opacity: 1; transform: none; box-shadow: none; }

/* Row-actions overflow menu (3-dot) */
.lic-actions { position: relative; display: inline-flex; justify-content: flex-end; }
.lic-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 60;
  min-width: 130px; display: none; flex-direction: column;
  background: #0a0a0a; border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.lic-menu.open { display: flex; }
.lic-menu button {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  background: none; border: none; color: #d6d6d6;
  cursor: pointer; text-align: left; white-space: nowrap;
}
.lic-menu button:hover { background: rgba(255,255,255,0.08); color: #fff; }
.lic-menu button.danger { color: #d6d6d6; }
.lic-menu button.danger:hover { background: rgba(255,255,255,0.08); color: #fff; }
.lic-menu .ic { width: 12px; height: 12px; }

/* Compact Fake-Error toggle chip (builder footer) */
.fe-tog { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; margin-right: 4px; }
.fe-tog input { display: none; }
/* Sized like .btn-retro so the toggle sits level with the BUILD button —
   same height, font, padding and chrome; the OFF/ON suffix replaces the
   check glyph a real button would not have. */
.fe-tog .fe-pill {
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  padding: 8px 14px; min-height: 34px;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  color: var(--text-dim);
  background: linear-gradient(180deg, var(--btn-top) 0%, var(--btn-bot) 100%);
  box-shadow: var(--inset-hi), var(--sh-1);
  transition: color .15s, border-color .15s, background .15s;
}
.fe-tog .fe-pill::after {
  content: "OFF"; font-size: 9px; letter-spacing: 1.2px;
  padding: 1px 6px; border-radius: 3px; opacity: .7;
  border: 1px solid currentColor;
}
.fe-tog input:checked + .fe-pill {
  color: #fff; border-color: rgba(255,255,255,0.7);
  background: linear-gradient(180deg, var(--btn-top-hover) 0%, var(--btn-bot-hover) 100%);
  box-shadow: var(--inset-hi), var(--sh-2), var(--info-glow);
}
.fe-tog input:checked + .fe-pill::after {
  content: "ON"; opacity: 1; color: var(--term-green);
}
.fe-tog:hover .fe-pill { border-color: rgba(255,255,255,0.45); }
.fe-tog input:disabled + .fe-pill { opacity: .45; cursor: not-allowed; }
/* Build running: the whole FAKE ERR pill freezes with the rest of the form */
.fe-tog.opt-locked { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ==========================================================================
   11. EMPTY STATE
   ========================================================================== */
.empty-fleet {
  padding: 64px 20px;
  text-align: center;
  color: var(--text-secondary);
  border: 1px dashed var(--line);
  background:
    radial-gradient(60% 100% at 50% 0%, rgba(255, 255, 255, 0.05), transparent 70%),
    var(--bg-sunken);
}

.empty-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--warn);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.25);
  margin-bottom: 8px;
}

.empty-sub {
  max-width: 560px;
  margin: 0 auto 20px;
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-dim);
}


/* ==========================================================================
   12. MONITOR VIEWPORT
   ========================================================================== */
.viewport-panel {
  display: none;
  position: relative;
  margin-bottom: var(--sp-5);
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 48px rgba(255, 255, 255, 0.14), var(--sh-3);
}

.viewport-panel.active { display: block; }

.viewport-panel.active::before {
  content: "LIVE";
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--danger);
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.75);
  border-radius: 999px;
  padding: 2px 10px;
  box-shadow: var(--danger-glow);
  pointer-events: none;
}

.viewport-canvas-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 560px;
  overflow: hidden;
  cursor: crosshair;
  background:
    radial-gradient(70% 70% at 50% 40%, #101010, #000 75%),
    #000;
}

#remote-canvas {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.95);
}

/* ==========================================================================
   13. MODALS
   ========================================================================== */
.retro-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background:
    radial-gradient(80% 80% at 50% 50%, rgba(5, 5, 5, 0.72), rgba(3, 3, 3, 0.92));
  backdrop-filter: blur(10px) saturate(0.9);
}

.retro-modal.active {
  display: flex;
  animation: modalFade var(--t-med) both;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.retro-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 880px;
  max-width: 100%;
  max-height: min(88vh, 1000px);
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-sunken) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--sh-4), 0 0 0 1px var(--border-hi);
  animation: modalRise var(--t-med) both;
}

.retro-modal.active .retro-dialog { animation: modalRise var(--t-med) both; }

@keyframes modalRise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Small prompts (redeem) sit over the blurred backdrop instead of an opaque
   panel — same transparency the stats/purchase overlays use. */
#retro-redeem-modal .retro-dialog,
#retro-proxy-modal .retro-dialog {
  background: rgba(10, 12, 16, 0.62);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}

/* Overlays that open on top of another view (redeem/purchases over BUY, proxy
   over the fleet) keep the backdrop fully transparent — no milky blur over
   whatever sits behind them. */
#retro-redeem-modal,
#retro-purchases-modal,
#retro-proxy-modal {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Free tier: everything inside a frozen modal reads as locked, not just dead —
   the control is still visible (it's a shop window) but unmistakably disabled. */
body.plan-free .retro-modal:not(#retro-buy-modal):not(#retro-purchases-modal):not(#retro-redeem-modal)
  :is(button, input, select, textarea, .cs-btn, .cs-item):not(.dlg-return):not(#btn-pass-change):not([id^="set-pass-"]) {
  cursor: not-allowed !important;
  opacity: 0.45;
}
body.plan-free .ctx-menu,
body.plan-free .host-view { pointer-events: none; }
body.plan-free .host-view #btn-host-close { pointer-events: auto; }

/* Corner ticks on every dialog, matching the panels. */
.retro-dialog::before,
.retro-dialog::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  border: 0 solid var(--info);
}

.retro-dialog::before {
  top: -1px;
  left: -1px;
  border-top-width: 2px;
  border-left-width: 2px;
}

.retro-dialog::after {
  bottom: -1px;
  right: -1px;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.dialog-header {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 12px 18px;
  background: linear-gradient(180deg, var(--bg-header) 0%, var(--head-bot) 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 var(--line-hi) inset;
}

.dialog-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  opacity: 0.6;
}

.dialog-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--info);
  text-transform: uppercase;
  min-width: 0;
}

.dialog-title .ic {
  width: 16px;
  height: 16px;
  color: var(--info);
}

.dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px;
}

.dialog-toolbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 10px 18px;
  background: #080808;
  border-bottom: 1px solid var(--line);
}

/* ==========================================================================
   14. SCROLLBARS
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: transparent; }

*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--info);
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner { background: transparent; }


/* ==========================================================================
   15. SPEC GRID (hardware telemetry inside the modal)
   ========================================================================== */
/* Hardware grade chip on each Clients row. */




/* ---- Info sheet ----------------------------------------------------------
   A dense, two-column spec sheet: small titled sections, one row per fact.
   It fits roughly three times the data the old card grid could, and reads like
   a datasheet instead of a dashboard. */
.info-sheet {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  grid-auto-rows: 1fr;
  gap: var(--sp-3);
}

.info-section {
  padding: 12px 14px 13px;
  background: linear-gradient(180deg, #0b0f16 0%, var(--bg-sunken) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--inset-hi);
}

.info-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  padding-bottom: 7px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--info);
  border-bottom: 1px solid var(--line-soft);
}

.info-section-title .perm-pill { margin-left: auto; font-size: 9px; padding: 1px 7px; }

.info-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
  line-height: 1.45;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.045);
}

.info-row:last-child { border-bottom: none; }

.info-key {
  color: var(--text-dim);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-val {
  color: var(--text-primary);
  font-weight: 600;
  word-break: break-word;
  min-width: 0;
}

.info-val.copyable {
  cursor: pointer;
  border-bottom: 1px dashed var(--line-strong);
  transition: color var(--t-fast), border-color var(--t-fast);
}

.info-val.copyable:hover { color: #fff; border-bottom-color: #fff; }
.info-val.copied { color: var(--ok); border-bottom-color: var(--ok); }

.info-note {
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--text-dim);
}

/* The real device location is the one section that carries an action. */
.info-section-accent {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, var(--bg-sunken) 100%);
}

.info-section-accent .info-val { font-family: var(--font-display); font-size: 13px; }

/* Identifiers are the sensitive half of the sheet — mark them. */
.info-section-secret { border-left: 2px solid var(--line-strong); }

.spec-card-sub {
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ==========================================================================
   Builder option grid
   --------------------------------------------------------------------------
   The builder's switches used to be three free-flowing flex rows whose labels
   carried their own nowrap text, so every box came out a different width and
   nothing lined up. They are one grid of equal cells now: check, icon, title
   and a short note on the same baseline, whatever the wording.
   ========================================================================== */
.opt-grid {
  display: grid;
  /* Two per row by default, three per row once the dialog owns the workspace —
     the six switches then land as an exact 3x2 block, so the grid reads as one
     unit instead of re-flowing with the panel width. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

body.tool-view .opt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.opt-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--border-dim);
  background: #0a0a0a;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}

.opt-card:hover { border-color: var(--line-strong); }
.opt-card.opt-locked { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.opt-card.opt-locked:hover { border-color: var(--line); }
/* Forced ON by another option (FAKE ERR -> PROTECT): the card keeps its full
   checked look — dimming read as "off" while the box was ticked — but clicks
   are dead and the note says who is holding it on. */
.opt-card.opt-forced { cursor: not-allowed; }
.opt-card.opt-forced .opt-check { pointer-events: none; }

/* The whole cell lights up with its switch, so the state reads at a glance.
   :has() keeps that honest without a line of JavaScript. */
.opt-card:has(.opt-check:checked) {
  border-color: var(--info);
  background: rgba(90, 160, 255, 0.07);
}

.opt-card .opt-check {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: #fff;
  cursor: pointer;
}

.opt-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.opt-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.opt-head .ic {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--info);
}

.opt-note {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

/* The Startup method picker hangs under the grid, full width, and only exists
   while Startup is on. */
.opt-sub {
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border-dim);
  background: #0a0a0a;
}

/* ==========================================================================
   16. FILE MANAGER
   ========================================================================== */
.path-input-group {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
  min-width: 240px;
}

.path-text {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ok);
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drives-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}

.drive-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  background: #000;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--info);
  cursor: pointer;
  transition: all var(--t-fast);
}

.drive-btn:hover,
.drive-btn.active {
  background: var(--info);
  border-color: var(--info);
  color: #000000;
  box-shadow: var(--info-glow);
}

/* ==========================================================================
   17. FOOTER
   ========================================================================== */
footer {
  position: relative;
  z-index: 1;
  /* No border-top on the console: the separator above the footer is the Clients
     panel's own bottom edge, which ends at the workspace inset rather than
     touching the viewport sides. */
  min-height: var(--footer-h);
  box-sizing: border-box;
  padding: var(--sp-5) 0;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.012));
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-inner .toolbar-meta { border-left: none; padding-left: 0; }

/* Outside the console there is no panel frame above the footer, so the other
   pages keep their own hairline separator. */
body:not(.console-body) footer { border-top: 1px solid var(--line-strong); }

/* The console footer is nearly empty (count + credit live inside the panel),
   so it stays slimmer than before but still present. */
body.console-body footer {
  min-height: calc(var(--footer-h) * 0.5);
  padding: calc(var(--sp-5) * 0.5) 0;
}

/* ==========================================================================
   18. ICONS & INPUTS
   ========================================================================== */
.ic {
  width: 14px;
  height: 14px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -2px;
}

.ui-input {
  font-family: inherit;
  font-size: 12px;
  padding: 8px 10px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--inset-hi);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.ui-input::placeholder { color: var(--text-dim); }

.ui-input:hover { border-color: #3a3a3a; }

.ui-input:focus {
  outline: none;
  background: var(--card-bot);
  border-color: var(--info);
  box-shadow: var(--inset-hi), 0 0 0 3px rgba(255, 255, 255, 0.16);
}

select.ui-input {
  cursor: pointer;
  appearance: none;
  padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 14px) calc(50% - 1px), calc(100% - 9px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Custom themed dropdowns — the OS select popup ignores our palette, so the
   real <select> hides and a styled list does the picking. */
.cs-select { position: relative; }
.cs-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; text-align: left; }
.cs-list { position: absolute; top: calc(100% + 2px); left: 0; right: 0; background: #0b0b0b; border: 1px solid rgba(255,255,255,0.16); border-radius: 4px; max-height: 240px; overflow-y: auto; z-index: 100000; display: none; }
.cs-list.open { display: block; }
.cs-item { padding: 8px 10px; font-size: 11px; color: #cfcfcf; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-item:hover { background: rgba(255,255,255,0.10); color: #fff; }
.cs-item.sel { background: rgba(255,255,255,0.05); color: #fff; }


/* ==========================================================================
   19. CONTEXT MENU
   ========================================================================== */
/* NOTE: the root menu must never carry a transform (including one left behind by
   a fill-forwards animation). A transformed element becomes the containing block
   for its `position: fixed` descendants — and the nested submenus ARE fixed and
   positioned in viewport coordinates, so a transform on the root would place
   every submenu relative to the menu box instead of the screen, which reads as
   "the submenu never opens". The entrance is therefore opacity-only. */
.ctx-menu {
  position: fixed;
  z-index: 99999;
  min-width: 214px;
  padding: 5px;
  background: linear-gradient(180deg, var(--pop-top) 0%, var(--pop-bot) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-4), 0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: ctxFade 0.12s ease-out;
}

/* A nested level is anchored to the viewport like its parent, so it needs the
   full elevation and its own stacking weight. */
.ctx-menu.ctx-sub {
  z-index: 100000;
  box-shadow: var(--sh-4), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

@keyframes ctxFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 11px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #e8e8e8;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}

.ctx-item:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.ctx-item.danger { color: #ffffff; }
.ctx-item.danger:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }

.ctx-item.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.ctx-item.is-disabled:hover {
  background: none;
  color: #e8e8e8;
}

.ctx-item .ctx-arrow {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.55;
}

/* ==========================================================================
   20. TOASTS
   ========================================================================== */
#toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  pointer-events: none;
}

.toast {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.3px;
  color: #f2f2f2;
  background: linear-gradient(180deg, var(--btn-top) 0%, var(--btn-bot) 100%);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--info);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  pointer-events: auto;
  word-break: break-word;
  opacity: 0;
  transform: translateX(24px);
  animation: toast-in 0.22s ease-out forwards;
}

.toast .ic { flex-shrink: 0; width: 15px; height: 15px; margin-top: 1px; color: var(--info); }

/* A thin progress line that drains over the toast's lifetime. */
.toast::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: currentColor;
  opacity: 0.35;
  transform-origin: left;
  animation: toastLife 4.5s linear forwards;
}

@keyframes toastLife {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.toast.ok { border-left-color: var(--ok); }
.toast.ok .ic { color: var(--ok); }
.toast.ok::after { background: var(--ok); }

.toast.error { border-left-color: var(--danger); }
.toast.error .ic { color: var(--danger); }
.toast.error::after { background: var(--danger); }

.toast.warn { border-left-color: var(--warn); }
.toast.warn .ic { color: var(--warn); }
.toast.warn::after { background: var(--warn); }

.toast.out { animation: toast-out 0.25s ease-in forwards; }

@keyframes toast-in { to { opacity: 1; transform: translateX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }

/* ==========================================================================
   21. CONFIRM DIALOG
   ========================================================================== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5);
  background: rgba(3, 3, 3, 0.72);
  backdrop-filter: blur(6px);
  animation: modalFade var(--t-fast) both;
}

.confirm-box {
  position: relative;
  width: 90%;
  max-width: 440px;
  padding: 20px;
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-sunken) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-4);
  animation: modalRise var(--t-fast) both;
}

.confirm-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--warn), transparent);
}

.confirm-box .msg {
  margin-bottom: 18px;
  font-size: 12px;
  line-height: 1.55;
  color: #f2f2f2;
  white-space: pre-wrap;
  word-break: break-word;
}

.confirm-box .btns {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

/* Optional headline — names the action above the question. */
.confirm-box .confirm-title {
  margin-bottom: 9px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* Optional second line — the consequence, in quieter type. */
.confirm-box .confirm-hint {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .4px;
  color: var(--text-dim);
}

/* Destructive variant — the accent bar and headline turn red. */
.confirm-box.confirm-danger::before {
  background: linear-gradient(90deg, var(--danger), transparent);
}

.confirm-box.confirm-danger .confirm-title { color: var(--danger); }


/* ==========================================================================
   22. PROCESS MANAGER — colourful System Informer style grid
   (the only place with a wide hue palette; scoped to #retro-proc-modal)
   ========================================================================== */
.proc-table-wrap {
  max-height: 62vh;
  overflow: auto;
  border-top: 1px solid var(--line);
}

#proc-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--th-top) 0%, var(--th-bot) 100%);
  user-select: none;
  cursor: pointer;
}

#proc-table thead th:hover { color: #fff; background: #18202c; }

#proc-table .sort-mark { margin-left: 3px; font-size: 9px; color: #00f0ff; }

#proc-items-tbody td {
  padding: 5px 10px;
  font-size: 11px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

#proc-items-tbody tr:hover { background: rgba(0, 240, 255, 0.06); }

.proc-name { color: #e8f6ff; font-weight: 700; }
.proc-system { color: #ffb300; }
.proc-num { color: #00f0ff; font-family: Consolas, monospace; }
.proc-num-dim { color: #5b6b76; font-family: Consolas, monospace; }
.proc-mem { color: #b48cff; font-family: Consolas, monospace; }
.proc-user { color: #7ee0a3; }
.proc-path { color: #6f7d88; font-family: Consolas, monospace; font-size: 10px; }

.cpu-low { color: #4cd07d; font-family: Consolas, monospace; }
.cpu-warn { color: #ffb300; font-family: Consolas, monospace; font-weight: 700; }
.cpu-high { color: #ff4655; font-family: Consolas, monospace; font-weight: 700; }
.cpu-none { color: #4a545c; }

/* System Informer diff highlights: new processes flash green,
   terminated ones flash red for one refresh cycle. */
#proc-items-tbody tr.proc-new td {
  background: rgba(0, 255, 102, 0.13);
  animation: proc-flash-green 1.6s ease-out forwards;
}

#proc-items-tbody tr.proc-dead td {
  background: rgba(255, 70, 85, 0.16);
  color: #ff8892;
  animation: proc-flash-red 1.6s ease-out forwards;
}

@keyframes proc-flash-green {
  0% { background: rgba(0, 255, 102, 0.35); }
  100% { background: rgba(0, 255, 102, 0.07); }
}

@keyframes proc-flash-red {
  0% { background: rgba(255, 70, 85, 0.40); }
  100% { background: rgba(255, 70, 85, 0.10); }
}

/* ==========================================================================
   23. BROWSER PICKER
   A native <select> cannot render an image inside an option, so the picker is
   a button + listbox carrying the vendor's real mark.
   ========================================================================== */
.browser-picker {
  position: relative;
  display: inline-block;
}

.browser-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 220px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff;
  text-align: left;
  background: linear-gradient(180deg, var(--btn-top) 0%, var(--btn-bot) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  box-shadow: var(--inset-hi);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.browser-picker-btn:hover {
  border-color: #3a3a3a;
  box-shadow: var(--inset-hi), var(--sh-2);
}

.browser-picker-btn[aria-expanded="true"],
.browser-picker-btn:focus-visible {
  border-color: var(--info);
  box-shadow: var(--inset-hi), 0 0 0 3px rgba(255, 255, 255, 0.16);
}

.browser-picker-btn .caret {
  margin-left: auto;
  font-size: 9px;
  opacity: 0.6;
  transition: transform var(--t-fast);
}

.browser-picker-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* The picker list is a plain popover (it has no fixed-position descendants), so
   a small slide is safe here — unlike the context menu, see §19. */
@keyframes ctxIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.browser-picker-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 250px;
  max-height: 330px;
  overflow-y: auto;
  padding: 5px;
  background: linear-gradient(180deg, var(--pop-top) 0%, var(--pop-bot) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-4);
  animation: ctxIn 0.12s ease-out both;
}

.browser-picker-list:not(.open) { display: none; }
.browser-picker-list.open { display: block; }

.browser-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}

.browser-picker-item:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.browser-picker-item.selected {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--info);
}

.browser-picker-item .count {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  background: #000;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 1px 8px;
}

.browser-picker-item.selected .count {
  color: var(--info);
  border-color: rgba(255, 255, 255, 0.45);
}

.browser-logo {
  display: block;
  flex: 0 0 auto;
}


/* ==========================================================================
   24. GRABBER
   ========================================================================== */
.grabber-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-2);
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255, 255, 255, 0.05), transparent 60%),
    var(--bg-sunken);
}

.grabber-cat {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  background: linear-gradient(180deg, var(--btn-bot) 0%, var(--bg-sunken) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.grabber-cat .ic { color: var(--text-dim); transition: color var(--t-fast); }

.grabber-cat:hover {
  border-color: var(--line-strong);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.grabber-cat:hover .ic { color: var(--info); }

.grabber-cat.on {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0%, rgba(255, 255, 255, 0.04) 100%);
  box-shadow: inset 3px 0 0 var(--ok), 0 0 0 rgba(255, 255, 255, 0);
}

/* While a sweep is running the category cards are read-only. */
.grab-locked .grabber-cat { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* Admin-gated categories stay visible but unpickable on a standard-user node —
   the operator sees the feature exists instead of hunting for a missing card. */
.grabber-cat.cat-locked { opacity: 0.45; cursor: not-allowed; }
.grabber-cat.cat-locked:hover {
  transform: none;
  border-color: var(--line);
  color: var(--text-dim);
}
.grabber-cat.cat-locked:hover .ic { color: var(--text-dim); }
.grabber-cat .adm {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #ffb347;
  border: 1px solid rgba(255, 179, 71, 0.4);
  border-radius: 3px;
  padding: 0 4px;
}

.grabber-cat.on .ic { color: var(--ok); }

.grabber-cat input {
  accent-color: var(--ok);
  pointer-events: none;
}

.grabber-cat .n {
  margin-left: auto;
  min-width: 26px;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  color: var(--text-dim);
  background: #000;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}

.grabber-cat.on .n {
  color: var(--ok);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.1);
}

/* The log reads as a timeline: a rail on the left, one colour per line kind. */
.grabber-log {
  /* Fixed height: a run must never grow the panel and push the controls around
     mid-sweep — new lines scroll inside instead. */
  height: 46vh;
  overflow: auto;
  padding: 12px 14px 14px 22px;
  font-family: Consolas, 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px) 14px 0 / 100% 100% no-repeat,
    var(--bg-sunken);
}

.grabber-log > div {
  position: relative;
  padding-left: 10px;
}

.grabber-log > div::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: -8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
}

.grabber-log .ok { color: var(--ok); }
.grabber-log .ok::before { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.grabber-log .no { color: var(--text-dim); }
.grabber-log .no::before { background: var(--text-dim); opacity: 0.5; }
.grabber-log .head {
  margin-top: 6px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.6px;
}
.grabber-log .head::before { background: var(--info); box-shadow: 0 0 8px var(--info); }
.grabber-log .warn { color: var(--warn); }
.grabber-log .warn::before { background: var(--warn); box-shadow: 0 0 6px var(--warn); }

/* Sweep outcome on the status line — green when the archive is ready. */
#grabber-status.grab-done { color: var(--ok); font-weight: 700; }
#grabber-status.grab-fail { color: var(--warn); }

/* Category lines carry their own hue so a sweep is scannable; .dim mutes the
   per-chunk row batches and .err flags a category that reported a failure. */
.grabber-log .catline { font-weight: 600; }
.grabber-log .catline.dim { font-weight: 400; opacity: 0.55; }
.grabber-log .catline.err { color: var(--warn) !important; }
.grabber-log .cat-passwords { color: #ff9f43; }
.grabber-log .cat-cookies { color: #54a0ff; }
.grabber-log .cat-autofill { color: #7bed9f; }
.grabber-log .cat-cards { color: #eccc68; }
.grabber-log .cat-history { color: #a29bfe; }
.grabber-log .cat-bookmarks { color: #fd79a8; }
.grabber-log .cat-downloads { color: #00cec9; }
.grabber-log .cat-tokens { color: #ffeaa7; }
.grabber-log .cat-wallets { color: #dfe6e9; }
.grabber-log .cat-wifi { color: #81ecec; }
.grabber-log .cat-sysinfo { color: #b2bec3; }
.grabber-log .cat-processes { color: #fab1a0; }
.grabber-log .cat-gaming { color: #9b59b6; }
.grabber-log .cat-vaults { color: #f39c12; }
.grabber-log .cat-secrets { color: #e74c3c; }
.grabber-log .cat-aitools { color: #1abc9c; }
.grabber-log .cat-vpns { color: #3498db; }
.grabber-log .cat-ftp { color: #95a5a6; }
.grabber-log .cat-mail { color: #f1c40f; }
.grabber-log .cat-env { color: #7f8c8d; }
.grabber-log .cat-apps { color: #bdc3c7; }
.grabber-log .cat-clipboard { color: #d4e6f1; }
.grabber-log .cat-shot { color: #5dade2; }

/* Anything marked hidden stays hidden, even when a rule sets a display value. */
[hidden] { display: none !important; }

/* The workspace column holds the Clients panel and, when a tool is open, the
   merged tool dialog. See §26. */
.workspace {
  position: relative;      /* anchors the leaving Clients panel (see §26) */
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
  flex: 1;
  min-height: 0;
  padding: 16px 20px 16px; /* breathing room on every side — the Clients panel
     floats with an air gap instead of touching the viewport edge */
}

/* Sits above the Clients panel while it slides away, and above the leaving
   dialog's own frame, so a crossfade never shows one bleed through the other. */
.tool-host { display: block; flex: 1; min-height: 0; position: relative; z-index: 2; }

/* The Clients panel stretches to fill the workspace so its corner ticks sit at
   the page corners and the empty state fills the tall column. */
#fleet-panel.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
  /* The panel's own bottom border is THE separator above the footer — it stops
     at the workspace inset instead of running into the viewport edge. */
}

#fleet-panel .panel-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#fleet-panel .fleet-table-wrapper { flex: 1; max-height: none; }

#fleet-panel .empty-fleet {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  /* Anchored to the top of the panel, not its centre — a centred element
     re-centres every time the panel's height settles during load, which is
     what made the empty state visibly jump upward after a refresh. */
  padding-top: clamp(90px, 18vh, 200px);
}

/* ==========================================================================
   26. TOOL VIEWS
   --------------------------------------------------------------------------
   Settings / Builder / Protector open *inside* the workspace instead of over
   it: the Clients panel slides out to the left, the tool slides in from the
   right, and the sidebar's Clients slot turns into the close button.
   ========================================================================== */
.tool-dialog {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: none;
  height: auto;
  box-shadow: var(--sh-3), 0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: toolIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

/* Merged views have room to breathe: the frame spans the workspace, the
   content sits in a comfortable centred column, and the two-up field grids
   inside get real room instead of being squeezed into 560 px. */
body.tool-view .tool-dialog .dialog-body {
  padding: 20px 24px;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
}

@keyframes toolIn {
  from { opacity: 0; transform: translateX(26px); }
  to { opacity: 1; transform: none; }
}

/* Leaving: the tool slides back out before the Clients panel returns, so the
   two never share the column (which used to squash both mid-transition). */
.tool-dialog.leaving { animation: toolOut 0.17s ease-in both; }

@keyframes toolOut {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateX(22px); }
}

/* The Clients panel leaving / returning. While it leaves it is taken out of the
   layout flow so the incoming tool gets the full column immediately — otherwise
   both flex:1 panels split the height and the workspace snaps twice. */
#fleet-panel.view-leaving {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  animation: viewOut 0.18s ease-in both;
}

#fleet-panel.view-entering {
  animation: viewIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes viewOut {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateX(-22px); }
}

@keyframes viewIn {
  from { opacity: 0; transform: translateX(-22px); }
  to { opacity: 1; transform: none; }
}

/* While a tool owns the workspace its sidebar item carries the active style —
   that is plain .nav-item.is-active, set by the view manager. Nothing extra is
   needed here, which is why there is no rule. */


/* ==========================================================================
   25. RESPONSIVE
   ========================================================================== */
/* The sidebar folds into a horizontal strip once it would crowd the table. */
@media (max-width: 1180px) {
  /* The sidebar is a slide-out drawer at every width now (see §27), so there is
     no horizontal "strip" fold any more — only the fleet table tightens up. */
  .fleet-table th,
  .fleet-table td { padding: 10px 10px; }
}

@media (max-width: 1080px) {
  .header-content { gap: var(--sp-3); }
  .header-stats { gap: var(--sp-2); }
  .stat-item { padding-right: var(--sp-2); }
}

@media (max-width: 900px) {
  .container { padding: 0 var(--sp-4); }
  .hud-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .viewport-canvas-container { min-height: 380px; }

  /* The builder's 3x2 switch grid needs width to stay readable: below this the
     notes wrap into three lines, so the merged view drops to two per row too. */
  .opt-grid,
  body.tool-view .opt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  body { font-size: 12px; }

  .container { padding: 0 var(--sp-3); }
  .main-wrapper { padding-top: var(--sp-4); }

  /* The header stacks instead of squeezing the brand. */
  .header-content {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-2);
    padding: 10px var(--sp-3);
  }

  .header-content.has-nav-toggle { grid-template-columns: minmax(0, 1fr); }

  .system-title {
    padding-left: 10px;
    border-left-width: 2px;
  }

  .brand-title { letter-spacing: 1.4px; }

  .header-stats {
    justify-content: flex-start;
    gap: var(--sp-2);
  }

  /* On phones the clock is the first thing to drop, then the membership chip. */
  .header-stats .stat-clock { display: none; }

  .btn-retro {
    font-size: 10px;
    padding: 7px 10px;
    letter-spacing: 0.6px;
  }

  .hud-value { font-size: 1.6rem; }

  .retro-modal { padding: 0; align-items: stretch; }
  .retro-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border: none;
  }
  .retro-dialog::before,
  .retro-dialog::after { display: none; }
  .dialog-body { padding: var(--sp-3); }

  .fleet-table th,
  .fleet-table td { padding: 9px 10px; }
  .fleet-table thead { display: none; }

  #toast-stack { left: 12px; right: 12px; max-width: none; }
  .toast { transform: translateY(-16px); }
  @keyframes toast-in { to { opacity: 1; transform: translateY(0); } }
  @keyframes toast-out { to { opacity: 0; transform: translateY(-16px); } }
}

@media (max-width: 560px) {
  .browser-picker,
  .browser-picker-btn { width: 100%; }
  .browser-picker-list { width: 100%; min-width: 0; }
  .hud-grid { grid-template-columns: 1fr; }
}

/* Print — keep it legible if an operator dumps a page to PDF. */
@media print {
  body::before,
  body::after { display: none; }
  .console-header,
  .retro-modal,
  #toast-stack { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ==========================================================================
   Identity cell -- deliberately narrow
   --------------------------------------------------------------------------
   The first column carries the flag, the node id, the host and the user. Long
   host/user names are clipped instead of stretching the row, so the tile stays
   slim no matter what the client reports.
   ========================================================================== */
.fleet-table th:first-child,
.fleet-table td:first-child { max-width: 190px; }

.fleet-identity {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

/* The flag is a small chip, not a poster — rounded with a hairline ring so it
   reads as a badge rather than a floating rectangle on the dark theme. */
.fleet-flag {
  flex: none;
  width: 20px;
  height: 15px;
  border-radius: 3px;
  object-fit: cover;
  vertical-align: middle;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 1px 3px rgba(0, 0, 0, 0.45);
}

/* Runtime chip: marks the build language (C++/RUST) beside the node id. */
.rt-badge {
  flex: none;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 3px;
  color: #0b0b0b;
  background: #6cb6ff;
  cursor: default;
}
.rt-badge.rt-rust { background: #f74c00; color: #fff; }
.rt-badge.rt-cpp { background: #6cb6ff; }
.rt-badge.rt-electron { background: #9f7bff; color: #fff; }
.rt-badge.rt-java { background: #e8a33d; color: #1a1205; }

/* ==========================================================================
   BUILD HISTORY — summary cards + artifact rows (merged view & overlay)
   ========================================================================== */
.bld-sum {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.bld-sum-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--border-dim);
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-sunken) 100%);
  box-shadow: inset 0 1px 0 var(--line-hi);
}

.bld-sum-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: var(--text-dim);
}

.bld-sum-num { color: #fff; font-size: 24px; font-weight: 700; line-height: 1.1; }
.bld-sum-val { font-size: 12px; font-weight: 700; padding-top: 7px; color: var(--text-secondary); }
.bld-sum-val.bld-cyan { color: var(--term-cyan); }
.bld-sum-val.bld-green { color: var(--ok); }

.bld-list {
  flex: 1 1 auto;
  min-height: min(56vh, 620px);
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid var(--border-dim);
  background: #000;
}

.bld-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-dim);
  transition: background var(--t-fast);
}
.bld-row:last-child { border-bottom: none; }
.bld-row:hover { background: rgba(255, 255, 255, 0.025); }

.bld-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.bld-id { color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; }

.bld-status {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}
.bld-status.is-current { color: var(--ok); }

.bld-row-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 7px;
  color: var(--text-secondary);
  font-size: 11px;
}
.bld-file { color: var(--term-cyan); font-weight: 700; }
.bld-clients { color: var(--text-dim); font-weight: 700; }
.bld-clients.has { color: var(--ok); }

.bld-sha {
  margin-top: 7px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.3px;
  word-break: break-all;
}

.bld-empty {
  padding: 26px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
  border: 1px dashed var(--border-dim);
}

@media (max-width: 640px) {
  .bld-sum { grid-template-columns: 1fr; }
  .bld-status { margin-left: 0; }
}

/* ---- grabber history --------------------------------------------------------
   The run list under Build History. Rows expand to a per-run digest: category
   counts, resolved Discord accounts with their badge/tier cards, and the
   export/delete actions. */
.grabs-list {
  flex: 0 0 auto;
  min-height: 0;
  max-height: 46vh;
}

.grabs-flag { color: var(--warn); font-size: 10px; font-weight: 700; }
.grabs-err  { color: var(--term-red); font-size: 10px; font-weight: 700; }

/* Settings sections — each feature sits in its own framed card */
.set-section {
  border: 1px solid var(--border-dim);
  background: #0a0a0a;
  padding: 12px;
  margin-bottom: 14px;
}

.grabs-sec-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  margin: 8px 0 6px;
}
.grabs-counts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 5px;
}
.grabs-count {
  border: 1px solid var(--border-dim);
  padding: 6px 8px;
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  /* One line per tile — two-word labels (Social Accounts, Password Vaults)
     were wrapping and stretching their whole row unevenly. */
  height: 32px;
  justify-content: space-between;
}
.grabs-count > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.grabs-count b { color: #fff; flex: 0 0 auto; }

/* Resolved Discord account cards. */
.grabs-accs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.grabs-acc {
  border: 1px solid var(--border-dim);
  background: rgba(255,255,255,0.02);
  padding: 10px;
}
.grabs-acc-head { display: flex; align-items: center; gap: 10px; }
.grabs-acc-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg-raised, #111);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
  flex: 0 0 auto; overflow: hidden;
}
.grabs-acc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.grabs-acc-name { color: #fff; font-size: 12px; font-weight: 700; }
.grabs-acc-sub { color: var(--text-dim); font-size: 10px; }
.grabs-acc-tier {
  margin-left: auto;
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  padding: 3px 8px; border: 1px solid var(--border-dim);
}
.grabs-acc-tier.t-unknown   { color: var(--text-dim); }
.grabs-acc-meta {
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-secondary);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
}
.grabs-acc-meta span:nth-child(odd) { color: var(--text-dim); }
.grabs-acc-badges { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.grabs-acc-badge {
  font-size: 9px; padding: 2px 7px;
  border: 1px solid var(--border-dim); color: var(--text-secondary);
}
.grabs-acc-badge.rare { color: #ffb300; border-color: #ffb30066; }
/* collapsible sections — grid-rows 0fr→1fr animates height smoothly, the
   opacity fade keeps the reveal from looking like a hard clip */
.collapse { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1), opacity .22s ease; }
.collapse > .collapse-in { overflow: hidden; min-height: 0; }
.collapse.open { grid-template-rows: 1fr; opacity: 1; }

/* settings checkboxes — one look everywhere */
.set-check {
  display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 12px; font-weight: 700; margin-bottom: 8px; cursor: pointer;
}
.set-check input[type="checkbox"] { accent-color: #fff; width: 16px; height: 16px; cursor: pointer; }

/* channel picker under "Notify me when client connect on:" — the boxes stay
   hidden until the member picks which channels they want */
.notify-pick { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; flex-wrap: wrap; }
.notify-pick-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 132px;
  padding: 10px 18px; font-size: 10px; font-weight: 800; letter-spacing: 1.4px;
  color: var(--text-secondary); background: #ffffff0a;
  border: 1px solid #ffffff1f; cursor: pointer; transition: all .18s ease;
}
.notify-pick-btn .ic { width: 13px; height: 13px; }
.notify-pick-btn:hover {
  color: #fff; background: #ffffff14; border-color: #ffffff44;
  transform: translateY(-1px);
}
.notify-pick-btn.active::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  margin-left: 2px; background: #fff;
  box-shadow: 0 0 8px #fff;
}
.notify-pick-btn.active {
  color: #fff; border-color: #fff; background: #ffffff14;
  box-shadow: 0 0 0 1px #ffffff44, 0 6px 18px -6px #ffffff33;
}
.notify-pick-hint { font-size: 10px; color: var(--text-dim); }
.notify-box {
  border: 1px solid #ffffff22; border-left: 3px solid #fff;
  padding: 12px 14px; margin-bottom: 10px; background: #ffffff08;
}
/* the boxes stay on the monochrome theme — the channel logos carry the id */
.notify-box-head {
  font-size: 10px; font-weight: 800; letter-spacing: 1.4px; color: #fff;
  margin-bottom: 8px;
}
.notify-box-head span { color: var(--text-dim); font-weight: 400; letter-spacing: 0; text-transform: none; }
.notify-box .ui-input { width: 100%; padding: 7px 10px; font-size: 11px; }
.notify-box-foot { display: flex; align-items: center; gap: 10px; margin-top: 7px; }
/* LOCAL's ON/OFF pair — the armed one carries the channel's lit state */
.notify-state-btn.armed {
  color: #fff; border-color: #fff; background: #ffffff14;
  box-shadow: 0 0 0 1px #ffffff44;
}

/* auto-grab rows — the number input and its caption */
.ag-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.ag-row .ui-input { width: 78px; padding: 7px 6px; font-size: 11px; text-align: center; }
.ag-row span { font-size: 10px; color: var(--text-dim); }

/* the whole fleet row is a selection target now */
#fleet-table-body tr { cursor: pointer; }
#fleet-table-body .btn-action-menu, #fleet-table-body .fleet-select { cursor: default; }
#fleet-table-body .fleet-select { cursor: pointer; }

/* RETURN TO CLIENTS — the arrow in the view bar while a tool view is open */
.view-back {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid #ffffff22; color: var(--text-secondary);
  font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  padding: 8px 16px; cursor: pointer; transition: all .15s ease;
}
.view-back .ic { width: 12px; height: 12px; }
.view-back:hover {
  color: #fff; border-color: #ffffff55; background: #ffffff10;
  transform: translateX(-2px);
}

/* the member's custom Discord emoji render as inline CDN images */
.grabs-emoji { width: 15px; height: 15px; vertical-align: -2px; }

/* auto vs manual runs — the badge sits next to the runtime pill */
.grabs-origin {
  display: inline-block; padding: 2px 8px; font-size: 9px; font-weight: 800;
  letter-spacing: 1.2px; border: 1px solid #00e5ff66; color: #00e5ff;
  text-transform: uppercase;
}
.grabs-origin-man { border-color: var(--text-dim); color: var(--text-dim); }

/* history filter bar (ALL / AUTO / MANUAL) */
.grabs-filter { display: inline-flex; border: 1px solid #ffffff22; }
.grabs-filter-btn {
  background: transparent; border: 0; color: var(--text-dim);
  /* Same metrics as the REFRESH / DISCORD WATCH .btn-retro buttons beside it —
     the trio used to sit shorter (no min-height) and break the bar's line. */
  font-size: 10px; font-weight: 800; letter-spacing: 1px;
  padding: 4px 12px; min-height: 34px; cursor: pointer;
}
.grabs-filter-btn + .grabs-filter-btn { border-left: 1px solid #ffffff22; }
.grabs-filter-btn.active { color: #fff; background: #ffffff14; }
.grabs-filter-btn:hover { color: #fff; }

/* Discord Watch window — per-device capture cards with full tokens */
.watch-rows { border-top: 1px solid #ffffff0f; margin-top: 6px; }
.watch-row { padding: 8px 10px 10px; border-bottom: 1px solid #ffffff0a; }
.watch-row:last-child { border-bottom: 0; }
.watch-row-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 10px; margin-bottom: 4px;
}
.watch-app { color: #00e5ff; font-weight: 800; letter-spacing: 0.5px; }
.watch-time { color: var(--text-dim); font-size: 9px; }
.watch-extra { color: var(--warn); font-size: 9px; font-weight: 700; }
.watch-copy {
  margin-left: auto; padding: 2px 10px !important; font-size: 9px !important;
}
.watch-secret {
  font-family: var(--font-mono, monospace); font-size: 10px; color: #e8e8e8;
  word-break: break-all; white-space: pre-wrap;
  background: #00000033; border: 1px solid #ffffff10;
  padding: 6px 8px; border-radius: 2px;
}

/* per-platform blocks inside a run's detail (Steam / Roblox / Epic / …) */
.grabs-plats { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.grabs-plat {
  border: 1px solid #ffffff1a; background: #ffffff08;
}
.grabs-plat-head {
  padding: 7px 10px; font-size: 10px; font-weight: 800; letter-spacing: 1px;
  color: #fff; border-bottom: 1px solid #ffffff1a;
}
.grabs-plat-head b { color: #00e5ff; }
.grabs-plat-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 10px; font-size: 11px; color: var(--text-secondary);
}
.grabs-plat-row b { color: var(--text-dim); font-weight: 400; font-family: Consolas, monospace; font-size: 10px; }
.grabs-plat-row + .grabs-plat-row { border-top: 1px solid #ffffff0d; }

/* A 64-bit id is long, so the badge tightens up inside the fleet row. */
.fleet-identity .node-badge {
  padding: 2px 6px;
  font-size: 11px;
  letter-spacing: 0.2px;
}

.fleet-identity-host,

.fleet-identity-host {
  font-weight: 700;
  color: #fff;
  margin-top: 3px;
}


/* ==========================================================================
   27. NAV DRAWER
   --------------------------------------------------------------------------
   The left menu is a slide-out drawer toggled by the header hamburger. Closed:
   parked off-screen. Open (`.app-shell.nav-open`): slides in over a dim,
   softly-blurred backdrop. Tap the backdrop, press Escape, or pick a nav row to
   fold it away again.
   ========================================================================== */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(2, 3, 5, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.app-shell.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }

/* The hamburger. Three bars that morph into an X while the drawer is open. */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  padding: 0;
  color: #fff;
  background: linear-gradient(180deg, var(--btn-top) 0%, var(--btn-bot) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.nav-toggle:hover { border-color: #fff; box-shadow: 0 0 16px rgba(255, 255, 255, 0.14); }
.nav-toggle:active { transform: scale(0.95); }
.nav-toggle:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }

.nav-toggle-bars { position: relative; width: 18px; height: 14px; display: inline-block; }

.nav-toggle-bars i {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.nav-toggle-bars i:nth-child(1) { top: 0; }
.nav-toggle-bars i:nth-child(2) { top: 6px; }
.nav-toggle-bars i:nth-child(3) { top: 12px; }

.nav-toggle.is-open .nav-toggle-bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-open .nav-toggle-bars i:nth-child(2) { opacity: 0; }
.nav-toggle.is-open .nav-toggle-bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (prefers-reduced-motion: reduce) {
  .side-nav,
  .nav-backdrop,
  .nav-toggle-bars i { transition: none; }
}

/* ==========================================================================
   28. FLEET ROWS — slim, essential columns only
   --------------------------------------------------------------------------
   Each client is a thin, full-width row: device name, IP, GPU, admin and the
   options button. Scoped to #fleet-table so other tables keep their look.
   ========================================================================== */
#fleet-table th { padding: 8px 12px; }
#fleet-table td { padding: 8px 12px; vertical-align: middle; }
#fleet-table td:first-child { max-width: none; }
#fleet-table .fleet-identity { gap: 7px; }
#fleet-table .fleet-identity-host { margin-top: 0; flex: 1 1 auto; min-width: 0; }
/* ==========================================================================
   29. CONSOLE TWEAKS — hidden bits + background pass-through
   ========================================================================== */
/* Hide the breadcrumb bar (FLEET / CLIENTS … and the "compile a client agent" hint). */
.view-bar { display: none; }
/* Hide the sidebar "Fleet / Admin / Prime" counters. */
.nav-group-fleet { display: none; }
/* When the operator sets a custom background, let it show THROUGH the panels
   (including the Clients panel and the HUD boxes) instead of being hidden
   behind opaque surfaces. */
html.has-bg .panel,
html.has-bg .hud-card,
html.has-bg .retro-dialog,
html.has-bg .console-header,
html.has-bg .dialog-header,
html.has-bg .tool-dialog,
body[style*="url("] .panel,
body[style*="url("] .hud-card,
body[style*="url("] .retro-dialog,
body[style*="url("] .console-header,
body[style*="url("] .dialog-header,
body[style*="url("] .tool-dialog {
  background: rgba(10, 10, 12, var(--panel-alpha, 0.16));
  -webkit-backdrop-filter: blur(var(--panel-blur, 2px));
  backdrop-filter: blur(var(--panel-blur, 2px));
}
/* The nav drawer is intentionally excluded from the pass-through list: it is a
   fixed overlay, so a translucent panel would let the page footer (and any
   other content beneath it) bleed through its surface. */
html.has-bg .side-nav,
body[style*="url("] .side-nav {
  /* Fully opaque — even 3% transparency let the footer's hairline (and the
     workspace bottom edge) bleed through right where Sign out sits. */
  background: linear-gradient(180deg, rgb(18, 18, 20) 0%, rgb(8, 8, 9) 100%);
}
html.has-bg .panel-body,
body[style*="url("] .panel-body { background: transparent; }
html.has-bg .empty-fleet,
body[style*="url("] .empty-fleet { background: transparent; }
html.has-bg .panel-header,
html.has-bg .panel-toolbar,
body[style*="url("] .panel-header,
body[style*="url("] .panel-toolbar { background: rgba(10, 10, 12, var(--panel-alpha, 0.16)); }
/* Keep the whole client table transparent (header + rows) so nothing "flips"
   to a solid colour the moment a client connects. */
html.has-bg .fleet-table-wrapper,
body[style*="url("] .fleet-table-wrapper { background: transparent; }
html.has-bg #fleet-table th,
body[style*="url("] #fleet-table th { background: transparent; }
html.has-bg #fleet-table td,
body[style*="url("] #fleet-table td { background: transparent; }
html.has-bg #fleet-table tbody tr:nth-child(even) td,
body[style*="url("] #fleet-table tbody tr:nth-child(even) td { background: transparent; }
html.has-bg #fleet-table tbody tr:hover td,
body[style*="url("] #fleet-table tbody tr:hover td { background: rgba(255, 255, 255, 0.05); }
html.has-bg #fleet-table tbody tr:hover td:first-child,
body[style*="url("] #fleet-table tbody tr:hover td:first-child { box-shadow: none; }

/* ==========================================================================
   30. MONITOR MODAL — full screen: left control rail + screen on the right
   ========================================================================== */
#retro-monitor-modal { padding: 0; align-items: stretch; justify-content: flex-start; }
#retro-monitor-modal .retro-dialog.mon-dialog {
  /* 100%/100vh: the html scrollbar-gutter reserves ~15px, so 100vw pushed the
     dialog's right edge (and the stream) off-screen — it looked "eaten". */
  width: 100%; max-width: 100%;
  height: 100vh; max-height: 100vh;
  margin: 0; border-radius: 0;
  display: flex; flex-direction: row;
}
#retro-monitor-modal .mon-rail {
  width: 244px; min-width: 244px; height: 100%;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 14px;
  background: linear-gradient(180deg, var(--bg-header, #161616), var(--bg-sunken, #080808));
  border-right: 1px solid var(--line-strong);
  overflow-y: auto;
}
#retro-monitor-modal .mon-title { font-size: 13px; letter-spacing: 2px; color: #fff; margin-bottom: 4px; }
#retro-monitor-modal .mon-stat { font-size: 11px; color: var(--text-secondary); }
#retro-monitor-modal .mon-stat b { color: #fff; }
#retro-monitor-modal .mon-select { width: 100%; }
#retro-monitor-modal .mon-range { width: 100%; accent-color: var(--term-green); }
#retro-monitor-modal .mon-btn { width: 100%; justify-content: center; }
#retro-monitor-modal .mon-close { margin-top: auto; }
#retro-monitor-modal .mon-screen {
  flex: 1; min-width: 0;
  height: 100%; max-height: 100vh; min-height: 0;
  padding: 0; background: #000; overflow: hidden;
  display: flex;
}
#retro-monitor-modal #monitor-canvas {
  width: 100%; height: 100%; display: block;
}

/* ==========================================================================
   31. SETTINGS SLIDERS (transparency / blur)
   ========================================================================== */
.set-slider { margin: 6px 0 14px; }
.set-slider label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px;
  color: var(--text-secondary); margin-bottom: 7px;
}
.set-slider label b { color: #fff; font-family: var(--font-display, monospace); }
.set-slider input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px; outline: none; cursor: pointer;
  background: linear-gradient(90deg, var(--line-strong), var(--line));
}
.set-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line-strong);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.35); cursor: pointer;
}
.set-slider input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  border: 2px solid var(--line-strong); cursor: pointer;
}

/* Compact the Clients panel header + filter bar so the client rows start higher
   and the fleet gets the vertical space. */
#fleet-panel .panel-header { padding: 6px 12px; min-height: 0; }
#fleet-panel .panel-toolbar { padding: 5px 12px; }
#fleet-panel .panel-header .panel-title { font-size: 11px; }

/* ==========================================================================
   32. RESIZABLE FLEET COLUMNS + full-text cells
   ========================================================================== */
#fleet-table { table-layout: fixed; }
#fleet-table thead th { position: relative; }
#fleet-table .col-resizer {
  position: absolute; top: 0; right: 0; width: 7px; height: 100%;
  cursor: col-resize; z-index: 5;
}
#fleet-table .col-resizer:hover { background: rgba(255, 255, 255, 0.18); }
#fleet-table .spec-pill strong {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#fleet-table .col-resizer::after {
  content: ""; position: absolute; top: 22%; right: 2px; width: 2px; height: 56%;
  background: var(--line-strong); opacity: 0; transition: opacity 0.15s;
}
#fleet-table th:hover .col-resizer::after { opacity: 0.85; }
body.col-resizing { cursor: col-resize; }
body.col-resizing * { user-select: none !important; }
#fleet-table td .spec-pill { min-width: 0; max-width: 100%; }
#fleet-table td .spec-pill strong {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ==========================================================================
   33. GRABBER — controls column on the left (picker, buttons, categories two
   per row, status), the sweep log console owns the whole right half
   ========================================================================== */

#retro-grabber-modal .grab-body { display: flex; flex-direction: row; min-height: 62vh; overflow: hidden; }
#retro-grabber-modal .grab-left {
  width: 44%; min-width: 300px; flex: none;
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line);
}

/* Picker on its own line, the action buttons under it. */
#retro-grabber-modal .grab-controls {
  flex: none;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
#retro-grabber-modal .grab-controls .browser-picker { width: 100%; }
#retro-grabber-modal .grab-controls .browser-picker-btn { width: 100%; position: relative; }
#retro-grabber-modal .grab-controls .browser-picker-btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* The list sits flush under the button — same width, no spill over the
 * action row. */
#retro-grabber-modal .grab-controls .browser-picker-list { width: 100%; min-width: 0; }
/* The chosen browser's name sits dead-centre in the picker; the caret is
 * pinned to the edge instead of pushing the label off-axis. */
#retro-grabber-modal .grab-controls .browser-picker-btn > #grabber-browser-current {
  flex: 1; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
#retro-grabber-modal .grab-controls .browser-picker-btn .caret { position: absolute; right: 11px; margin-left: 0; }
#retro-grabber-modal .grab-btns { display: flex; flex-wrap: nowrap; gap: 8px; }
/* One line: the four short labels split evenly; EXPORT ZIP gets a wider
 * share because its label is the longest — the icon never kisses the edge. */
#retro-grabber-modal .grab-btns .btn-retro { flex: 1 1 0; justify-content: center; min-width: 0; padding-left: 8px; padding-right: 8px; overflow: hidden; }
#retro-grabber-modal .grab-btns #btn-grabber-export { flex: 1.4 1 0; }
/* Too narrow for the full label? The icon stays whole and the text
 * ellipsizes — the two never draw on top of each other. */
#retro-grabber-modal .grab-btns .btn-retro .lbl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Two categories per row; the rows stretch so the six of them fill whatever
 * height the column has — no dead strip under the grid. */
#retro-grabber-modal .grabber-grid {
  flex: 1; min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(44px, 1fr);
  grid-auto-flow: row;
  align-content: stretch;
  overflow-y: auto; overflow-x: hidden; max-height: none;
}
#retro-grabber-modal .grabber-cat > span:not(.n) {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
#retro-grabber-modal .grabber-log { flex: 1; height: auto; align-self: stretch; overflow: auto; max-height: none; min-width: 0; }

/* The build-language pill in the modal title (C++ / RUST / ELECTRON). */
#retro-grabber-modal .grabber-rt {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--info);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.06);
  vertical-align: 1px;
}



/* ==========================================================================
   34. POLISH — the interaction states every control shares
   ========================================================================== */
/* Pressed: one pixel down, so a click feels like a click. */
.btn-retro:not(:disabled):active,
.btn-action-menu:not(:disabled):active,
.nav-item:not(:disabled):active,
.nav-stat:not(:disabled):active {
  transform: translateY(1px);
}

/* Disabled: inputs and pickers grey themselves out exactly like the buttons do. */
.ui-input:disabled,
.ui-input[disabled],
select:disabled,
textarea:disabled,
input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
label:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }

/* Forms: a dim placeholder, a white caret, and no white autofill box from Chrome. */
::placeholder { color: var(--text-dim); opacity: 0.85; }
input, select, textarea, .ui-input { caret-color: #fff; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
  transition: background-color 9999s ease-out 0s;
}

/* Numbers line up: counters, stats and licence keys share one advance width. */
.stat-val,
.nav-count,
#fleet-count-display,
#hud-admin-nodes,
#hud-prime-nodes {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* The fleet header stays put while the table scrolls. The existing gradient already paints
   it, so nothing changes visually; only a console with a custom background (where the header
   is transparent on purpose) needs a blurred fill to stay readable. */
.fleet-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}
html.has-bg .fleet-table thead th,
body[style*="url("] .fleet-table thead th {
  background: rgba(8, 8, 8, 0.82);
  backdrop-filter: blur(6px);
}

/* Hidden always wins over a component's own display rule. */

[id] { scroll-margin-top: 96px; }
kbd, code { font-family: var(--font-mono); }
/* ===========================================================================
   Fleet multi-select
   ---------------------------------------------------------------------------
   Rows carry a checkbox so several devices can be picked at once. The bar above
   the table appears only while something is selected, and a picked row gets a
   light inset border (monochrome, like every other state).
   =========================================================================== */
.fleet-bulk-bar { font-size: 11px; }
.fleet-table tr.row-selected > td { background: rgba(255, 255, 255, 0.055); }
.fleet-table tr.row-selected > td:first-child { box-shadow: inset 2px 0 0 #ffffff; }
.fleet-select { accent-color: #ffffff; }

/* ==========================================================================
   35. MOBILE CONSISTENCY (<=720px)
   ---------------------------------------------------------------------------
   The desktop layouts assume width: the fleet table squeezes seven columns
   into a phone, the grabber splits controls/log side by side, and the monitor
   rail eats 244px of a ~360px screen. These rules keep every panel usable:
   tables scroll with readable columns, split panes stack, rails collapse.
   ========================================================================== */
@media (max-width: 720px) {
  /* Fleet: each row becomes a card — the fixed 7-column grid cannot fit a
     phone, and an unlabeled squeezed table is what looked "broken". Cells
     stack vertically with their data-th label above the value. */
  #fleet-table,
  #fleet-table tbody,
  #fleet-table tr { display: block; width: 100%; }
  #fleet-table { min-width: 0; table-layout: auto; }
  /* Each device is its own card: surface + hairline + gap, so rows never
     bleed into each other. */
  #fleet-table tbody { padding: 10px 12px 4px; }
  #fleet-table tr {
    position: relative;
    padding: 8px 12px 8px 42px;
    margin-bottom: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.015) 100%);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--inset-hi);
  }
  #fleet-table tr:last-child { margin-bottom: 0; }
  #fleet-table td {
    display: block;
    width: 100%;
    padding: 6px 0;
    border-bottom: 1px solid var(--line-soft);
  }
  #fleet-table td::before {
    content: attr(data-th);
    display: block;
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 2px;
  }
  #fleet-table td[data-th=""]::before,
  #fleet-table td:not([data-th])::before { display: none; }
  /* Full-width helper rows (empty state, SHOW MORE) stay plain — no card chrome. */
  #fleet-table tr:has(> td[colspan]) {
    background: none;
    border: none;
    box-shadow: none;
    padding: 10px 0;
    margin-bottom: 4px;
  }
  /* Checkbox floats in the card's left gutter; actions ride the bottom rail. */
  #fleet-table td:first-child:not([colspan]),
  #fleet-table td:last-child:not([colspan]) {
    display: flex;
    align-items: center;
    border-bottom: none;
    padding-top: 4px;
    padding-bottom: 4px;
  }
  #fleet-table td:last-child:not([colspan]) { justify-content: flex-end; }
  #fleet-table td:first-child:not([colspan]) {
    position: absolute;
    top: 12px;
    left: 12px;
  }

  /* Monitor + Grabber modals are fixed-layout; nothing to reflow here. */

  /* Builder/protector option grids and wide inputs. */
  .path-input-group { min-width: 0; flex-wrap: wrap; }
  .search-field { min-width: 0; flex: 1 1 140px; }
}

/* ==========================================================================
   37. HOST VIEW — double-click fullscreen workspace
   Left rail = every right-click tool as an icon; viewer sits center; the X
   top-right returns to the clients list.
   ========================================================================== */
.host-view {
  position: fixed; inset: 0; z-index: 150; display: flex;
  background: var(--bg-base, #0a0a0a);
}
.host-view[hidden] { display: none; }
.host-rail {
  width: 56px; min-width: 56px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
  padding: 8px 6px;
  background: linear-gradient(180deg, var(--bg-header, #161616), var(--bg-sunken, #080808));
  border-right: 1px solid var(--line-strong);
  overflow-y: auto; scrollbar-width: none;
}
.host-rail::-webkit-scrollbar { display: none; }
.host-rail-btn {
  width: 40px; height: 40px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 4px;
  background: transparent; color: var(--text-secondary); cursor: pointer;
}
.host-rail-btn .ic { width: 18px; height: 18px; }
.host-rail-btn:hover { color: #fff; border-color: var(--line-strong); background: rgba(255,255,255,.06); }
.host-rail-btn.on { color: var(--term-green, #4ade80); border-color: var(--term-green, #4ade80); }
.host-rail-btn:disabled { opacity: .35; cursor: default; }

.host-stage {
  flex: 1; min-width: 0; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #000;
}
.host-stage-empty {
  color: var(--text-muted); font-size: 12px; letter-spacing: 2px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.host-close {
  position: absolute; top: 8px; right: 10px; z-index: 6;
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer;
}
.host-close .ic { width: 16px; height: 16px; }
.host-close:hover { background: #7f1d1d; border-color: #ef4444; }

/* The monitor dialog embedded in the host stage: its left rail collapses into
   a thin TOP icon bar — same buttons, one horizontal strip. */
#host-stage .mon-dialog {
  display: flex; flex-direction: column;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; border: none; border-radius: 0;
}
#host-stage .mon-rail {
  width: 100%; min-width: 0; height: 36px; min-height: 36px;
  flex-direction: row; align-items: center; gap: 6px;
  padding: 4px 10px; border-right: none;
  border-bottom: 1px solid var(--line-strong);
  overflow: visible;
}
#host-stage .mon-title { display: none; }
#host-stage .mon-stat { font-size: 9px; white-space: nowrap; margin: 0 !important; padding: 0 !important; border: none !important; }
#host-stage .mon-stat b { font-size: 9px; }
#host-stage .mon-select { width: 104px; height: 26px; font-size: 10px; padding: 0 6px; }
#host-stage .mon-range { width: 64px; height: 4px; margin: 0; }
#host-stage .mon-btn {
  width: auto; min-width: 28px; height: 28px;
  font-size: 9px; letter-spacing: .4px; padding: 0 8px; gap: 4px;
  justify-content: center;
}
#host-stage .mon-btn .ic { width: 12px; height: 12px; }
#host-stage .mon-btn.on { color: var(--term-green, #4ade80); border-color: var(--term-green, #4ade80); }
/* Visibility stays driven by the element's own inline display toggle —
   this rule only turns the vertical group into a row when it is shown. */
#host-stage #mon-nc-apps { flex-direction: row; flex-wrap: wrap; gap: 4px; margin: 0; display: flex; }
#host-stage #mon-nc-apps[style*="none"] { display: none; }
#host-stage .nc-app { min-width: 26px; font-size: 8px; padding: 0 6px; }
#host-stage .mon-close { margin: 0 0 0 auto; }
#host-stage .mon-screen { max-height: none; }
