/* ==========================================================================
   Owllander RemotePC — "Night Watch" design system
   Deep-indigo observatory palette; owl-eye amber signature.
   Vanilla CSS, no framework. Low-specificity selectors throughout.
   ========================================================================== */

:root {
  /* near-black canvas */
  --bg:          #0a0a0e;
  --bg-2:        #0d0d13;
  --surface:     #131319;
  --surface-2:   #17171f;
  --surface-3:   #1e1e29;
  --border:      #2a2a36;
  --border-soft: #1e1e27;
  --hairline:    #232330;

  /* text */
  --text:    #ECECF3;
  --text-2:  #c7c7d4;
  --muted:   #8b8b9e;
  --faint:   #5a5a6c;

  /* violet — brand / active / live. Kept under the --amber* names so every
     existing reference re-skins to purple with no churn. */
  --amber:        #8b5cf6;
  --amber-bright: #a78bfa;
  --amber-deep:   #7c3aed;
  --amber-wash:   rgba(139, 92, 246, 0.14);
  --amber-line:   rgba(139, 92, 246, 0.36);
  --amber-glow:   rgba(139, 92, 246, 0.50);

  /* secondary accent — links */
  --sky:      #8b9dff;
  --sky-wash: rgba(139, 157, 255, 0.12);

  /* states */
  --danger:      #FF5F6B;
  --danger-wash: rgba(255, 95, 107, 0.14);
  --danger-line: rgba(255, 95, 107, 0.36);
  --good:        #34D399;
  --good-wash:   rgba(52, 211, 153, 0.14);

  /* accent-bar palette for dashboard stat cards */
  --c-violet: #8b5cf6;
  --c-green:  #34d399;
  --c-blue:   #38bdf8;
  --c-amber:  #fbbf24;
  --c-red:    #fb7185;

  /* type */
  --font-display: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", "Consolas", monospace;

  /* geometry */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --rail: 232px;
  --rail-collapsed: 66px;
  --topbar-h: 60px;

  --shadow-1: 0 1px 2px rgba(0,0,0,.5);
  --shadow-2: 0 14px 40px rgba(0,0,0,.5);
  --shadow-pop: 0 22px 60px rgba(0,0,0,.65);

  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(1100px 700px at 85% -12%, #17122b 0%, rgba(0,0,0,0) 55%),
    radial-gradient(900px 600px at -8% 108%, #120f22 0%, rgba(0,0,0,0) 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
::selection { background: var(--amber-glow); color: #f5f3ff; }

/* thin owl-night scrollbars */
* { scrollbar-width: thin; scrollbar-color: #2a2a38 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #2a2a38; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #3a3a4c; }

/* focus — amber owl-ring */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ===== boot / loading ==================================================== */
.boot {
  position: fixed; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 20px;
  color: var(--muted);
}
.boot p { font-family: var(--font-mono); font-size: 13px; letter-spacing: .03em; }
.boot-eye {
  width: 64px; height: 64px; border-radius: 50%;
  border: 2px solid var(--amber-line);
  display: grid; place-content: center;
  box-shadow: 0 0 30px var(--amber-wash);
}
.boot-eye span {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 18px var(--amber-glow);
  animation: blink 2.4s var(--ease) infinite;
}
@keyframes blink {
  0%, 88%, 100% { transform: scaleY(1); opacity: 1; }
  92% { transform: scaleY(.1); opacity: .7; }
}

/* ==========================================================================
   LOGIN
   ========================================================================== */
.auth {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.auth-art {
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border-soft);
  background:
    radial-gradient(900px 600px at 70% 20%, #1e1e29 0%, rgba(0,0,0,0) 60%),
    linear-gradient(180deg, #0c0c12, #0a0a10);
}
/* starfield */
.auth-art::before, .auth-art::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(1.4px 1.4px at 20% 30%, #d8d5e6 50%, transparent),
    radial-gradient(1.2px 1.2px at 65% 18%, #b4adc7 50%, transparent),
    radial-gradient(1px 1px at 80% 55%, #928ba7 50%, transparent),
    radial-gradient(1.6px 1.6px at 35% 72%, #edeaf6 50%, transparent),
    radial-gradient(1px 1px at 50% 45%, #9c96b1 50%, transparent),
    radial-gradient(1.3px 1.3px at 12% 80%, #ccc8db 50%, transparent),
    radial-gradient(1px 1px at 88% 82%, #8f88a7 50%, transparent);
  opacity: .5;
}
.auth-art::after { opacity: .25; filter: blur(.4px); }
.auth-brandmark {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 26px;
  text-align: center; padding: 40px;
}
.eye {
  --size: 168px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  display: grid; place-content: center;
  border: 2px solid var(--amber-line);
  background: radial-gradient(circle at 50% 45%, rgba(243,169,60,.10), rgba(243,169,60,0) 62%);
  box-shadow: 0 0 70px var(--amber-wash), inset 0 0 40px rgba(243,169,60,.05);
}
.eye .iris {
  width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, var(--amber-bright), var(--amber) 55%, var(--amber-deep));
  box-shadow: 0 0 26px var(--amber-glow);
  position: relative;
}
.eye .iris::after {
  content: ""; position: absolute; top: 24%; left: 28%;
  width: 9px; height: 9px; border-radius: 50%;
  background: #ede9fe; opacity: .9; filter: blur(.3px);
}
.auth-brandmark h1 { font-size: 30px; letter-spacing: -.02em; }
.auth-brandmark h1 b { color: var(--amber); font-weight: 600; }
.auth-tag { color: var(--muted); max-width: 380px; font-size: 14.5px; }
.auth-meta {
  position: absolute; left: 36px; bottom: 30px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--faint);
  letter-spacing: .04em;
}

.auth-panel {
  display: grid; place-content: center;
  padding: 40px;
  background: linear-gradient(180deg, rgba(18,26,43,.55), rgba(10,14,24,.2));
}
.auth-card { width: min(380px, 92vw); }
.auth-card .kicker {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--amber); margin-bottom: 10px;
}
.auth-card h2 { font-size: 25px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); margin-bottom: 28px; font-size: 13.5px; }

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */
.field { margin-bottom: 16px; }
.field > label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-2); margin-bottom: 7px;
}
.input, select.input, textarea.input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--faint); }
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--amber-line);
  box-shadow: 0 0 0 3px var(--amber-wash);
  background: #0c0c12;
}
.input-wrap { position: relative; }
.input-wrap .ghost-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
}
.help { font-size: 12px; color: var(--faint); margin-top: 6px; }
.form-error {
  background: var(--danger-wash);
  border: 1px solid var(--danger-line);
  color: #ffd7da;
  border-radius: var(--r-sm);
  padding: 10px 13px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ===== buttons =========================================================== */
.btn {
  --bg: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 15px;
  font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: transform .08s var(--ease), border-color .15s, background .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--border); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--amber-bright), var(--amber));
  border-color: var(--amber-deep);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(139,92,246,.30);
}
.btn-primary:hover { background: linear-gradient(180deg, #b9a3fb, var(--amber-bright)); border-color: var(--amber); }
.btn-danger { color: #ffd9dc; border-color: var(--danger-line); background: var(--danger-wash); }
.btn-danger:hover { background: rgba(255,95,107,.2); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.ghost-btn {
  background: transparent; border: 0; color: var(--muted); cursor: pointer;
  padding: 6px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
}
.ghost-btn:hover { color: var(--text); background: var(--surface-2); }

.btn-row { display: flex; gap: 9px; flex-wrap: wrap; }

/* ==========================================================================
   APP SHELL
   ========================================================================== */
.shell {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  min-height: 100vh;
}
.shell.collapsed { grid-template-columns: var(--rail-collapsed) 1fr; }
/* The mobile nav backdrop must not take a grid cell on desktop. */
.scrim { display: none; }

/* ---- left rail ---- */
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0d0d13, #0a0a0e);
  border-right: 1px solid var(--border-soft);
  padding: 16px 12px;
  z-index: 30;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 18px;
}
.brand .mark {
  flex: none;
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-content: center;
  border: 1.5px solid var(--amber-line);
  background: radial-gradient(circle at 50% 45%, rgba(243,169,60,.16), rgba(243,169,60,0) 65%);
}
.brand .mark i {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--amber); box-shadow: 0 0 12px var(--amber-glow); display: block;
}
.brand .name { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.brand .name b { color: var(--amber); font-weight: 600; }
.brand .name small { display: block; font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); letter-spacing: .18em; font-weight: 500; }
.collapsed .brand .name, .collapsed .nav-label, .collapsed .rail-foot .who-text, .collapsed .rail-section { display: none; }
.collapsed .brand { justify-content: center; padding: 6px 0 18px; }

.rail-section {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--faint);
  padding: 14px 12px 6px;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--muted); font-weight: 500; font-size: 13.5px;
  text-decoration: none;
  transition: background .14s, color .14s;
}
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active {
  background: var(--amber-wash);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--amber-line);
}
.nav a.active svg { color: var(--amber); }
.collapsed .nav a { justify-content: center; padding: 11px 0; }

.rail-spacer { flex: 1; }
.rail-foot { border-top: 1px solid var(--border-soft); padding-top: 12px; }
.who {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px; border-radius: var(--r-sm);
  background: transparent; border: 0; cursor: pointer; color: var(--text); text-align: left;
}
.who:hover { background: var(--surface-2); }
.who .avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-content: center; font-weight: 700; font-size: 12px;
  background: var(--amber-wash); color: var(--amber); border: 1px solid var(--amber-line);
}
.who .who-text { line-height: 1.25; overflow: hidden; }
.who .who-text b { font-size: 13px; display: block; }
.who .who-text span { font-size: 11px; color: var(--faint); }
.collapsed .who { justify-content: center; }

/* ---- topbar ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  background: rgba(10,14,24,.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.crumbs .sep { color: var(--faint); }
.crumbs b { font-family: var(--font-display); font-weight: 600; }
.crumbs a { color: var(--muted); }
.topbar-spacer { flex: 1; }
.fleet-pulse {
  display: flex; align-items: center; gap: 16px;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.fleet-pulse .pp { display: inline-flex; align-items: center; gap: 6px; }
.fleet-pulse b { color: var(--text); }
.clock { font-family: var(--font-mono); font-size: 12px; color: var(--faint); letter-spacing: .02em; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-content: center;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: #3a3a4c; }
.icon-btn svg { width: 17px; height: 17px; }

/* ---- content ---- */
.content { padding: 24px 26px 60px; }
.page-head {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .titles h1 { font-size: 24px; }
.page-head .titles p { color: var(--muted); margin: 5px 0 0; font-size: 13.5px; }
.page-head .actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* ==========================================================================
   STAT READOUT (observatory)
   ========================================================================== */
.readout {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin-bottom: 26px;
}
.stat {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  padding: 16px 17px;
  overflow: hidden;
}
.stat .lbl {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 7px;
}
.stat .val {
  font-family: var(--font-display); font-weight: 700;
  font-size: 30px; line-height: 1.1; margin-top: 9px;
  letter-spacing: -.02em;
}
.stat .val small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat .spark { margin-top: 10px; height: 30px; }
/* signature: a colored accent bar across the top of each stat card */
.stat::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--c-violet);
}
.stat:nth-child(1)::after { background: var(--c-violet); }
.stat:nth-child(2)::after { background: var(--c-green); }
.stat:nth-child(3)::after { background: var(--c-blue); }
.stat:nth-child(4)::after { background: var(--c-amber); }
.stat:nth-child(5)::after { background: var(--c-red); }
.stat.accent .val { color: var(--amber); }
.stat .corner {
  position: absolute; top: 14px; right: 15px; color: var(--faint);
}
.stat .corner svg { width: 18px; height: 18px; }

/* a tiny inline bar meter */
.meter { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--amber), var(--amber-bright)); }
.meter.hot > i { background: linear-gradient(90deg, #ff8a3c, var(--danger)); }

/* ==========================================================================
   COMPUTER WINDOW CARDS  (signature: lit windows in the night)
   ========================================================================== */
.window-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.win {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  overflow: hidden;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
  transition: transform .14s var(--ease), border-color .16s, box-shadow .2s;
}
.win:hover { transform: translateY(-3px); border-color: var(--border); box-shadow: var(--shadow-2); text-decoration: none; }
/* the lit-window glow strip — only for awake machines */
.win.awake { box-shadow: 0 -1px 0 var(--amber-line) inset, 0 18px 40px rgba(0,0,0,.35); }
.win.awake::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  opacity: .9;
}
.win .glass {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    repeating-linear-gradient(45deg, #0d0d13 0 12px, #0a0a0e 12px 24px);
  overflow: hidden;
}
.win .glass img { width: 100%; height: 100%; object-fit: cover; display: block; }
.win.asleep .glass { filter: grayscale(.7) brightness(.55); }
.win .glass .noscreen {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px;
  color: var(--faint); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em;
}
.win .glass .noscreen svg { width: 26px; height: 26px; opacity: .6; }
/* preview refresh shimmer */
.win .glass.refreshing::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(243,169,60,.16) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: shimmer .9s var(--ease);
}
@keyframes shimmer { to { transform: translateX(100%); } }
.win .glass .stamp {
  position: absolute; left: 9px; bottom: 9px;
  font-family: var(--font-mono); font-size: 10.5px; color: #d8d5e6;
  background: rgba(6,9,16,.6); border: 1px solid rgba(255,255,255,.06);
  padding: 2px 7px; border-radius: 20px; backdrop-filter: blur(4px);
}
.win .glass .live-chip {
  position: absolute; right: 9px; top: 9px;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em;
  color: #16121f; background: var(--amber); padding: 3px 8px; border-radius: 20px; font-weight: 600;
}
.win .body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 10px; }
.win .row1 { display: flex; align-items: center; gap: 10px; }
.win .row1 .nm { font-family: var(--font-display); font-weight: 600; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win .row1 .who-mini { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.win .mini-metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.win .mm { background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 7px 8px; }
.win .mm .k { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .1em; color: var(--faint); text-transform: uppercase; }
.win .mm .v { font-family: var(--font-mono); font-size: 14px; font-weight: 600; margin-top: 2px; }

/* ===== status dot (awake amber / asleep slate) ===== */
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; position: relative; }
.dot.awake { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); }
.dot.awake::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--amber-line); animation: ping 2.2s var(--ease) infinite;
}
.dot.asleep { background: transparent; border: 1.6px solid var(--faint); }
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 80%,100% { transform: scale(1.5); opacity: 0; } }

/* ==========================================================================
   PANELS / CARDS / TABLES
   ========================================================================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}
.panel-head h3 { font-size: 15px; }
.panel-head .panel-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-body { padding: 16px; }
.panel-body.flush { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* toolbar (search + filter) */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.search {
  position: relative; flex: 1; min-width: 220px; max-width: 420px;
}
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.search input { padding-left: 36px; }
.seg {
  display: inline-flex; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; gap: 2px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
}
.seg button.on { background: var(--surface-3); color: var(--text); }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl thead th {
  text-align: left; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint); font-weight: 600;
  padding: 11px 14px; border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; background: var(--surface); white-space: nowrap; cursor: default;
}
.tbl thead th.sortable { cursor: pointer; }
.tbl thead th.sortable:hover { color: var(--text-2); }
.tbl tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: rgba(255,255,255,.018); }
.tbl .num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.tbl .name-cell { font-weight: 600; }
.tbl .actions-cell { text-align: right; white-space: nowrap; }

/* key-value list (specs) */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 9px 18px; align-items: baseline; }
.kv dt { font-size: 12px; color: var(--faint); font-family: var(--font-mono); letter-spacing: .03em; }
.kv dd { margin: 0; font-size: 13.5px; }
.kv dd.mono { font-family: var(--font-mono); }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; font-family: var(--font-mono);
  padding: 3px 9px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge.amber { color: var(--amber); border-color: var(--amber-line); background: var(--amber-wash); }
.badge.good { color: var(--good); border-color: rgba(52,211,153,.32); background: var(--good-wash); }
.badge.danger { color: var(--danger); border-color: var(--danger-line); background: var(--danger-wash); }
.badge.sky { color: var(--sky); border-color: rgba(139,157,255,.3); background: var(--sky-wash); }
.badge.dim { color: var(--muted); }
.badge.good::before, .badge.danger::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}

/* empty states */
.empty {
  display: grid; place-items: center; justify-items: center; gap: 12px;
  padding: 60px 24px; text-align: center; color: var(--muted);
}
.empty .eye { --size: 76px; }
.empty .eye .iris { width: 24px; height: 24px; }
.empty h3 { font-size: 17px; color: var(--text); }
.empty p { max-width: 380px; font-size: 13.5px; }

/* ==========================================================================
   DETAIL PAGE / TABS
   ========================================================================== */
.detail-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border-soft); border-radius: var(--r);
  padding: 18px 20px; margin-bottom: 18px;
}
.detail-head .id-eye {
  width: 50px; height: 50px; border-radius: 13px; flex: none;
  display: grid; place-content: center;
  border: 1px solid var(--amber-line);
  background: radial-gradient(circle at 50% 45%, rgba(243,169,60,.16), rgba(243,169,60,0) 65%);
}
.detail-head .id-eye i { width: 16px; height: 16px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 14px var(--amber-glow); }
.detail-head.off .id-eye { border-color: var(--border); background: var(--surface-2); }
.detail-head.off .id-eye i { background: var(--faint); box-shadow: none; }
.detail-head .id-main h1 { font-size: 22px; }
.detail-head .id-main .meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.detail-head .id-main .meta span { display: inline-flex; align-items: center; gap: 6px; }
.detail-head .id-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--hairline);
  margin-bottom: 20px; overflow-x: auto;
}
.tabs a {
  padding: 11px 14px; color: var(--muted); font-weight: 600; font-size: 13.5px;
  border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.tabs a svg { width: 16px; height: 16px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ==========================================================================
   REMOTE DESKTOP STAGE
   ========================================================================== */
.stage-wrap {
  background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r);
  overflow: hidden;
}
.stage-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--hairline);
  background: var(--bg-2);
}
.stage-bar .conn { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; }
.stage-bar .grp { display: inline-flex; align-items: center; gap: 6px; }
.stage-bar .spacer { flex: 1; }
.toggle {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer;
  padding: 6px 9px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); user-select: none;
}
.toggle:hover { color: var(--text); }
.toggle.on { color: var(--amber); border-color: var(--amber-line); background: var(--amber-wash); }
.toggle input { display: none; }
.toggle .sw { width: 28px; height: 16px; border-radius: 20px; background: var(--surface-3); position: relative; transition: background .15s; }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.toggle.on .sw { background: var(--amber-wash); }
.toggle.on .sw::after { transform: translateX(12px); background: var(--amber); }

.stage {
  position: relative;
  background:
    radial-gradient(700px 400px at 50% 0%, #17171f, #08080c);
  min-height: 74vh;
  display: grid; place-items: center;
  padding: 3px;
}
.stage canvas, .stage img.frame {
  max-width: 100%; max-height: 90vh; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55); background: #000;
  image-rendering: auto;
}
.stage.blanked::after {
  content: "remote display blanked"; position: absolute; inset: 16px;
  display: grid; place-content: center; color: var(--faint);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
  background: #050508; border-radius: 8px; border: 1px dashed var(--border);
}
.stage-overlay {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px;
  text-align: center; color: var(--muted); background: rgba(7,11,20,.7); backdrop-filter: blur(3px);
}
.stage-overlay .spin {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--amber);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lat-pill {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 20px;
}

/* ==========================================================================
   FILE MANAGER
   ========================================================================== */
.fm-path {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 12.5px; padding: 10px 14px;
  background: var(--bg-2); border-bottom: 1px solid var(--hairline);
}
.fm-path a { color: var(--sky); }
.fm-path .sep { color: var(--faint); }
.fm-drop {
  margin: 0; border: 1px dashed transparent; border-radius: 10px; transition: border-color .15s, background .15s;
}
.fm-drop.drag { border-color: var(--amber-line); background: var(--amber-wash); }
.fm-row-name { display: inline-flex; align-items: center; gap: 10px; }
.fm-row-name svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.fm-row-name.dir svg { color: var(--amber); }
.fm-row-name a { color: var(--text); font-weight: 600; }
.upload-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.upload-item { background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 9px 11px; }
.upload-item .top { display: flex; gap: 10px; font-size: 12.5px; }
.upload-item .top .pct { margin-left: auto; font-family: var(--font-mono); color: var(--muted); }
.upload-item .bar { height: 5px; border-radius: 4px; background: var(--surface-3); margin-top: 7px; overflow: hidden; }
.upload-item .bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--amber-bright)); border-radius: 4px; transition: width .2s; }

/* ==========================================================================
   MODAL
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5,7,12,.66); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .15s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(520px, 96vw);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  overflow: hidden; animation: pop .18s var(--ease);
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--hairline); }
.modal-head h3 { font-size: 16px; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--hairline); background: var(--bg-2); }
.modal.danger .modal-head { box-shadow: inset 3px 0 0 var(--danger); }
.token-reveal {
  font-family: var(--font-mono); font-size: 13px; background: var(--bg-2);
  border: 1px solid var(--amber-line); border-radius: var(--r-sm); padding: 13px;
  word-break: break-all; color: var(--amber-bright); display: flex; gap: 10px; align-items: center;
}
.token-reveal code { flex: 1; }

/* ==========================================================================
   TOASTS
   ========================================================================== */
.toaster { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-left-width: 3px; border-radius: var(--r-sm); padding: 12px 14px;
  box-shadow: var(--shadow-2); animation: toastin .22s var(--ease);
}
@keyframes toastin { from { transform: translateX(20px); opacity: 0; } }
.toast.ok { border-left-color: var(--good); }
.toast.err { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--amber); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: var(--good); } .toast.err svg { color: var(--danger); } .toast.info svg { color: var(--amber); }
.toast .t-msg { font-size: 13px; } .toast .t-msg b { display: block; margin-bottom: 2px; }

/* event log levels */
.lvl { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12px; }
.lvl::before { content: ""; width: 7px; height: 7px; border-radius: 2px; }
.lvl.Information::before, .lvl.info::before { background: var(--sky); }
.lvl.Warning::before, .lvl.warn::before { background: var(--amber); }
.lvl.Error::before, .lvl.err::before { background: var(--danger); }

/* spark canvas default */
canvas.spark { width: 100%; display: block; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
.rail-toggle { display: none; }

@media (max-width: 960px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: 252px;
    transform: translateX(-100%); transition: transform .22s var(--ease);
    box-shadow: var(--shadow-pop);
  }
  .shell.nav-open .rail { transform: translateX(0); }
  .shell.collapsed { grid-template-columns: 1fr; }
  .collapsed .brand .name, .collapsed .nav-label, .collapsed .who-text, .collapsed .rail-section { display: revert; }
  .rail-toggle { display: grid; }
  .scrim {
    position: fixed; inset: 0; background: rgba(5,7,12,.5); z-index: 25; display: none;
  }
  .shell.nav-open .scrim { display: block; }
  .content { padding: 18px 16px 50px; }
  .fleet-pulse { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .detail-head .id-actions { width: 100%; }
}

@media (max-width: 560px) {
  .readout { grid-template-columns: 1fr 1fr; }
  .page-head .actions { width: 100%; }
  .clock { display: none; }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .dot.awake::after, .boot-eye span { animation: none; }
}
