/* Snipel Fleet dashboard — cockpit theme, ported from the cpp gst_camera_viewer web
   UI (same palette / chips / glow-dots / mono IDs), mobile-first responsive. */
:root {
  color-scheme: dark;
  --bg: #080b14; --panel: #141c30; --panel2: #1a2238; --line: #3a4568;
  --inset: #0e1526; --inset2: #0a0e18;
  --fg: #e9eefc; --muted: #8ea3ca; --accent: #7cc4ff;
  --green: #5eead4; --yellow: #fbbf24; --red: #fb7185; --gray: #566089;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--fg);
  /* soft corner glows — fade over the FULL radius (transparent 100%) so there is
     no visible falloff edge banding across the empty page (see git history). */
  background:
    radial-gradient(120% 90% at 6% -20%, rgba(124,196,255,.14), transparent 100%),
    radial-gradient(120% 90% at 94% -16%, rgba(180,120,255,.12), transparent 100%),
    linear-gradient(#080b14, #0a0e1a);
  background-attachment: fixed;
  font: 13px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
/* holographic blueprint-grid canvas (drawn by fx.js) sits behind all content */
#bgGrid { position: fixed; inset: 0; z-index: 0; pointer-events: none; display: block; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 10px 16px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, rgba(30,42,78,.22), rgba(20,28,48,.16));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(3px) saturate(1.3); -webkit-backdrop-filter: blur(3px) saturate(1.3);
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: .5px; white-space: nowrap;
  background: linear-gradient(90deg, #a9d4ff, #c9a9ff 55%, #ffc0e6);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .sub { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 6px;
  text-transform: uppercase; letter-spacing: .12em; }
.summary { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------- section tabs */
.tabs {
  display: flex; align-items: center; gap: 4px; padding: 6px 16px 0;
  /* not sticky: the topbar already is, and two sticky bars at top:0 overlap */
  position: relative; z-index: 4; overflow-x: auto; scrollbar-width: none;
  background: linear-gradient(180deg, rgba(20,28,48,.30), rgba(14,20,36,.18));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent; border: 1px solid transparent; border-bottom: none;
  color: var(--muted); padding: 8px 16px; font-size: 13px; font-weight: 600;
  border-radius: 10px 10px 0 0; cursor: pointer; white-space: nowrap; --gc: 124,196,255;
}
.tab:hover { color: var(--fg); }
.tab.active {
  color: var(--fg); background: linear-gradient(180deg, rgba(124,196,255,.14), rgba(124,196,255,.03));
  border-color: var(--line); box-shadow: 0 -1px 12px rgba(124,196,255,.12) inset;
}
.tab-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; padding-bottom: 6px; }
.tab-tools input[type=search] { max-width: 240px; }
.tabpane > .panel { min-height: 40vh; }
@media (max-width: 720px) {
  .tabs { padding: 6px 10px 0; flex-wrap: wrap; }
  .tab { padding: 8px 12px; }
  .tab-tools { margin-left: 0; flex-basis: 100%; flex-wrap: wrap; padding: 6px 0; }
  .tab-tools input[type=search] { flex: 1; max-width: none; }
}
.summary .pill, .pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--inset); border: 1px solid var(--line); border-radius: 13px;
  padding: 3px 11px; font-size: 11.5px; color: var(--muted); white-space: nowrap;
}
.summary .pill b { font-size: 12.5px; color: var(--fg); font-weight: 700; }
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.controls input[type=search] {
  background: var(--inset); border: 1px solid var(--line); color: var(--fg);
  border-radius: 7px; padding: 6px 10px; width: 240px; max-width: 46vw;
}
.controls input[type=search]:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(124,196,255,.18); }
.chk { color: var(--muted); font-size: 12px; user-select: none; display: inline-flex;
  gap: 5px; align-items: center; white-space: nowrap; }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.clock-ms { opacity: .5; font-size: 10px; font-variant-numeric: tabular-nums; }
.clock.stale { opacity: .4; }

main { padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px;
  max-width: 1500px; margin: 0 auto; position: relative; z-index: 1; }
/* minmax(0,1fr) above + min-width:0 here keep a wide child (e.g. a data table)
   from blowing the grid column out past the viewport — it scrolls instead. */
.panel { background: rgba(20,28,52,.20); min-width: 0;
  backdrop-filter: blur(3px) saturate(1.2); -webkit-backdrop-filter: blur(3px) saturate(1.2);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.28); }
.hidden { display: none; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------- status dots */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--gray); border: 1px solid transparent; vertical-align: middle; }
.dot.green { background: var(--green); box-shadow: 0 0 7px var(--green); }
.dot.yellow { background: var(--yellow); box-shadow: 0 0 7px var(--yellow); }
.dot.red { background: var(--red); box-shadow: 0 0 7px var(--red); }
.dot.unknown { background: var(--gray); box-shadow: none; }
.dot.lg { width: 13px; height: 13px; }

/* ------------------------------------------------------------- fleet table */
.fleet-table { width: 100%; border-collapse: collapse;
  /* Safari/WebKit: rows swapped by the auto-refresh inside a backdrop-filtered
     panel can keep a STALE paint (text invisible until hover/scroll repaints;
     the free-space bar survives because its absolute span composites on its
     own layer). Promoting the table to its own compositing layer avoids it. */
  transform: translateZ(0); -webkit-transform: translateZ(0); }
.fleet-table tbody { will-change: transform; }
.fleet-table th { text-align: left; color: var(--muted); font-weight: 700; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .5px; padding: 7px 8px;
  border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.fleet-table th[data-sort]:hover { color: var(--fg); }
.fleet-table td { padding: 8px; border-bottom: 1px solid rgba(58,69,104,.4);
  white-space: nowrap; vertical-align: middle; }
.fleet-table tbody tr { cursor: pointer; transition: background .12s; }
.fleet-table tbody tr:hover { background: var(--panel2); }
.fleet-table tbody tr.selected { background: #22315a; box-shadow: inset 3px 0 0 var(--accent); }
.offline { opacity: .5; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.hwid-copy { cursor: copy; border-bottom: 1px dotted var(--muted); }
.hwid-copy:hover { color: var(--accent); border-bottom-color: var(--accent); }
.hwid-copy.copied { color: var(--accent); border-bottom-color: transparent; }
.tempcell { font-variant-numeric: tabular-nums; }
.hot { color: var(--red); font-weight: 700; }
.warm { color: var(--yellow); }

/* free-space bar */
.bar { position: relative; width: 92px; height: 10px; background: var(--inset2);
  border: 1px solid var(--line); border-radius: 5px; overflow: hidden;
  display: inline-block; vertical-align: middle; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.bar.low > span { background: var(--red); }
.bar-label { font-size: 10.5px; color: var(--muted); margin-left: 6px; }

/* pill badges / tags */
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 11px;
  font-size: 11px; font-weight: 700; border: 1px solid var(--line); background: var(--inset);
  color: var(--muted); }
.badge.on { color: var(--green); border-color: rgba(94,234,212,.4); }
.badge.off { color: var(--red); border-color: rgba(251,113,133,.4); }
.badge.attn { color: var(--yellow); border-color: rgba(251,191,36,.4); }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 7px; background: #22315a; color: var(--accent);
  margin-left: 4px; }

/* --------------------------------------------------------------- detail */
.detail, #map-panel { scroll-margin-top: 70px; }
.detail h2 { margin: 0 0 2px; font-size: 18px; }
.detail .hwid { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  word-break: break-all; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 12px; }
.kv .k { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.card { background: rgba(26,34,56,.20);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; }
.card h4 { margin: 0 0 7px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); display: flex; align-items: center; gap: 7px; }
.card .big { font-size: 14px; font-weight: 600; }
.card .reason { color: var(--muted); font-size: 12px; margin-top: 4px; }
.card.red { border-color: rgba(251,113,133,.5); box-shadow: 0 0 0 1px rgba(251,113,133,.12) inset; }
.card.yellow { border-color: rgba(251,191,36,.5); box-shadow: 0 0 0 1px rgba(251,191,36,.1) inset; }
.card.green { border-color: rgba(94,234,212,.4); }

.section { margin: 16px 0; }
.section h3, #map-panel h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); margin: 0 0 8px; }
.grid2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; }

/* data tables (recordings / config) — scroll horizontally rather than overflow */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; min-width: 460px; }
table.data th, table.data td { text-align: left; padding: 6px 8px;
  border-bottom: 1px solid rgba(58,69,104,.4); font-size: 12px; white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 700; text-transform: uppercase;
  font-size: 10.5px; letter-spacing: .4px; }
.drive-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.drive-row .mount { width: 210px; max-width: 100%; }

.cfg-form { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.cfg-form input { background: var(--inset); border: 1px solid var(--line); color: var(--fg);
  border-radius: 7px; padding: 6px 9px; }
button { background: linear-gradient(180deg, #8fceff, var(--accent)); color: #06121f; border: 0;
  border-radius: 7px; padding: 7px 13px; font-weight: 700; cursor: pointer; }
button:hover { filter: brightness(1.06); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { color: var(--fg); border-color: var(--accent); filter: none; }
button.sm { padding: 2px 9px; font-size: 11px; }
a.dl { color: var(--accent); text-decoration: none; }
a.dl:hover { text-decoration: underline; }

/* Debug camera frames */
.frames-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.frame-card { width: 220px; max-width: 100%; }
.frame-thumb { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border: 1px solid var(--line); border-radius: 8px; background: var(--inset2); cursor: zoom-in; }
.frame-thumb:hover { border-color: var(--accent); }
.frame-meta { display: flex; gap: 6px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.frame-age { color: var(--muted); font-size: 11px; margin-left: auto; }
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.lightbox.hidden { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0,0,0,.7); }

svg text { fill: var(--muted); font-size: 10px; }
.chart-wrap { background: var(--inset2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
pre.cfg { background: var(--inset2); border: 1px solid var(--line); border-radius: 8px; padding: 10px;
  max-height: 240px; overflow: auto; font-size: 11.5px; color: #c9d5e3;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
#map { width: 100%; height: auto; max-width: 100%; aspect-ratio: 900/360;
  background: var(--inset2); border: 1px solid var(--line); border-radius: 10px; }
.close-x { cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }
.close-x:hover { color: var(--red); }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0,1fr); } }

/* org group headers in the fleet table (shown when >1 org fleet is visible) */
.fleet-table tr.org-header td {
  padding: 10px 10px 4px; border: 0; background: transparent;
  color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
}

/* update badges: pending = the frame needs power + internet; ok = current */
.badge.updpend { background: rgba(251,191,36,.14); color: var(--yellow);
  border: 1px solid rgba(251,191,36,.5); box-shadow: 0 0 8px rgba(251,191,36,.18);
  white-space: nowrap; }
.badge.updok { color: var(--green); border: 1px solid rgba(94,234,212,.25);
  background: rgba(94,234,212,.06); }
.badge.updfail { background: rgba(251,113,133,.12); color: var(--red);
  border: 1px solid rgba(251,113,133,.5); box-shadow: 0 0 8px rgba(251,113,133,.18);
  white-space: nowrap; }

/* Phones: stack the header, and turn the wide fleet table into per-device cards. */
@media (max-width: 720px) {
  main { padding: 12px; gap: 12px; }
  .topbar { gap: 8px 12px; padding: 9px 12px; }
  .summary { order: 3; flex-basis: 100%; }
  .controls { order: 2; flex-basis: 100%; }
  .controls input[type=search] { flex: 1; max-width: none; width: auto; }
  .clock { margin-left: auto; }

  /* Compact two-line device cards (~56px each => 10+ devices per screen).
     Line 1: status · host (fills) · update badge · seen.
     Line 2: C/F/D/R subsystem dots · temp · free bar.
     HWID / AP / build are detail-view data; hidden here. Column order is the
     <thead> order: 1 status, 2 host, 3 upd, 4 hwid, 5 cam, 6 fc, 7 det,
     8 rec, 9 temp, 10 free, 11 AP, 12 build, 13 seen. */
  .fleet-table thead { display: none; }
  .fleet-table, .fleet-table tbody { display: block; width: 100%; }
  .fleet-table tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 2px 9px;
    border: 1px solid var(--line); border-radius: 10px; background: var(--panel2);
    margin-bottom: 5px; padding: 5px 9px;
  }
  .fleet-table tbody tr.selected { box-shadow: inset 0 0 0 1px var(--accent); }
  .fleet-table td { display: flex; align-items: center; gap: 4px; padding: 0;
    border: 0; white-space: nowrap; }
  .fleet-table td::before { display: none; }
  .fleet-table td:nth-child(1) { order: 0; }
  .fleet-table td:nth-child(2) { order: 1; flex: 1 1 auto; min-width: 96px;
    display: block; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
  .fleet-table td:nth-child(3) { order: 2; }
  .fleet-table td:nth-child(13) { order: 3; color: var(--muted); font-size: 11px; }
  .fleet-table td:nth-child(5), .fleet-table td:nth-child(6),
  .fleet-table td:nth-child(7), .fleet-table td:nth-child(8) { order: 4; }
  .fleet-table td:nth-child(9) { order: 5; font-size: 11.5px; }
  .fleet-table td:nth-child(10) { order: 6; }
  .fleet-table td:nth-child(4), .fleet-table td:nth-child(11),
  .fleet-table td:nth-child(12) { display: none; }
  /* tiny context letters for the subsystem dots */
  .fleet-table td:nth-child(5)::after, .fleet-table td:nth-child(6)::after,
  .fleet-table td:nth-child(7)::after, .fleet-table td:nth-child(8)::after {
    color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .3px; }
  .fleet-table tr.org-header { background: transparent; border: 0; padding: 2px 2px 0; margin-bottom: 2px; }
  .fleet-table tr.org-header td { display: block; width: 100%; padding: 4px 2px 0; }
  .fleet-table td:nth-child(5)::after { content: "CAM"; }
  .fleet-table td:nth-child(6)::after { content: "FC"; }
  .fleet-table td:nth-child(7)::after { content: "DET"; }
  .fleet-table td:nth-child(8)::after { content: "REC"; }
  .bar { width: 72px; }
  .detail-head { gap: 10px; }
}

/* ================ holographic buttons (ported from cpp web UI) ================ */
@property --ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
button { position: relative; overflow: hidden; isolation: isolate; --gc: 94,234,212;
  transition: transform .1s cubic-bezier(.2,.7,.3,1), box-shadow .16s ease, filter .16s ease; }
button.ghost { --gc: 124,196,255; }
/* neon twin-arc border traced on hover */
button::after { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.7px;
  z-index: 1; opacity: 0; transition: opacity .16s ease; pointer-events: none;
  background: conic-gradient(from var(--ang), rgba(var(--gc),1) 0 3%, transparent 15% 47%,
    rgba(var(--gc),1) 50% 53%, transparent 65% 97%, rgba(var(--gc),1) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude; }
button:hover:not(:disabled) { box-shadow: 0 0 16px rgba(var(--gc),.3); }
button:hover:not(:disabled)::after { opacity: 1; animation: btnTrace 1.8s linear infinite; }
@keyframes btnTrace { to { --ang: 360deg; } }
button:active:not(:disabled) { transform: scale(.965); }
button.press { animation: btnPress .24s ease-out; }
@keyframes btnPress {
  0% { filter: brightness(1.5); box-shadow: 0 0 0 2px rgba(var(--gc),.9), 0 0 24px rgba(var(--gc),.6); }
  100% { filter: brightness(1); box-shadow: 0 0 0 0 rgba(var(--gc),0); } }
.btn-ripple { position: absolute; z-index: 2; border-radius: 50%; transform: translate(-50%,-50%) scale(0);
  pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(circle, rgba(var(--gc),.7), rgba(var(--gc),.16) 45%, transparent 70%);
  animation: btnRip .55s cubic-bezier(.2,.7,.3,1) forwards; }
.btn-ring { position: absolute; z-index: 2; border-radius: 50%; transform: translate(-50%,-50%) scale(0);
  pointer-events: none; mix-blend-mode: screen; border: 2px solid rgba(var(--gc),.8);
  animation: btnRip .5s ease-out forwards; }
@keyframes btnRip { to { transform: translate(-50%,-50%) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  button:hover::after { animation: none; } .btn-ripple, .btn-ring { display: none; } button.press { animation: none; }
}

/* -------------------------------------------------------------- accounts */
.ghost-btn {
  background: rgba(124,196,255,.08); border: 1px solid var(--line); color: var(--fg);
  border-radius: 8px; padding: 5px 11px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.ghost-btn:hover { border-color: var(--accent); box-shadow: 0 0 12px rgba(124,196,255,.2); }
.userchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg); }
.role-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.role-tag.admin { color: #7cc4ff; border-color: rgba(124,196,255,.45); }
.role-tag.danger { color: var(--red); border-color: rgba(251,113,133,.5); }

/* full-screen overlay for login + admin modal */
.overlay { position: fixed; inset: 0; z-index: 1100; display: flex; align-items: center;
  justify-content: center; padding: 20px; background: rgba(6,9,16,.82);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.overlay.hidden { display: none; }

.login-card { width: min(340px, 92vw); display: flex; flex-direction: column; gap: 12px;
  background: rgba(20,28,52,.72); border: 1px solid var(--line); border-radius: 14px;
  padding: 26px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.brand-lg { font-size: 22px; margin-bottom: 6px; }
.login-card input { background: var(--inset); border: 1px solid var(--line); color: var(--fg);
  border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124,196,255,.18); }
.login-card button { background: linear-gradient(180deg, #2f6ea8, #24547f); border: 1px solid rgba(124,196,255,.5);
  color: #eaf4ff; border-radius: 8px; padding: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.login-card button:hover { box-shadow: 0 0 16px rgba(124,196,255,.35); }
.login-card button:disabled { opacity: .6; cursor: default; }
.login-error { color: var(--red); font-size: 12px; min-height: 14px; }

/* admin modal */
.modal-card { width: min(700px, 95vw); max-height: 88vh; overflow: auto;
  background: rgba(16,22,40,.9); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.admin-sub { margin: 14px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.admin-create { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin-create input, .admin-create select {
  background: var(--inset); border: 1px solid var(--line); color: var(--fg); border-radius: 7px; padding: 7px 9px; font-size: 13px; }
.admin-create input:focus, .admin-create select:focus { outline: none; border-color: var(--accent); }

.admin-user { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; background: rgba(20,28,52,.35); }
.admin-user.off { opacity: .55; }
.admin-user-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.admin-user-title { display: inline-flex; align-items: center; gap: 8px; }
.admin-user-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.mini-btn { background: rgba(124,196,255,.07); border: 1px solid var(--line); color: var(--fg);
  border-radius: 6px; padding: 3px 9px; font-size: 11.5px; cursor: pointer; }
.mini-btn:hover { border-color: var(--accent); }
.mini-btn.danger { color: var(--red); border-color: rgba(251,113,133,.4); }
.mini-btn.danger:hover { border-color: var(--red); }

.admin-grants { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 9px; }
.grant-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11px;
  border: 1px solid var(--line); border-radius: 20px; padding: 2px 5px 2px 9px; background: rgba(124,196,255,.06); }
.grant-chip.claim { border-style: dashed; }
.grant-chip .src { color: var(--muted); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; }
.grant-x { cursor: pointer; color: var(--muted); border-radius: 50%; width: 15px; height: 15px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
.grant-x:hover { color: var(--red); background: rgba(251,113,133,.15); }
.grant-input { background: var(--inset); border: 1px solid var(--line); color: var(--fg);
  border-radius: 7px; padding: 4px 9px; font-size: 11.5px; width: 190px; max-width: 60vw; }
.grant-input:focus { outline: none; border-color: var(--accent); }

/* license credits + delegated-permission chrome */
.balancechip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px;
  color: var(--muted); border: 1px solid rgba(94,234,212,.35); border-radius: 20px;
  padding: 2px 10px; background: rgba(94,234,212,.07); white-space: nowrap; }
.balancechip .credits { color: var(--green); font-weight: 800; font-variant-numeric: tabular-nums; }
.credit-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--green);
  border: 1px solid rgba(94,234,212,.35); border-radius: 12px; padding: 1px 7px; }
.admin-perms { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 9px; }
.perm-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--fg);
  user-select: none; cursor: pointer; }
.perm-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent);
  border: 1px solid rgba(124,196,255,.35); border-radius: 12px; padding: 1px 7px; }
.admin-lic { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 9px; }
.credit-input { background: var(--inset); border: 1px solid var(--line); color: var(--fg);
  border-radius: 7px; padding: 4px 8px; font-size: 11.5px; width: 64px; }
.credit-input:focus { outline: none; border-color: var(--accent); }
.admin-activations { margin-top: 6px; }
.section .activations { margin-top: 10px; }

/* password change chrome */
.userchip.clickable { cursor: pointer; }
.userchip.clickable:hover { color: var(--accent); }
.chip-key { font-size: 11px; opacity: .55; margin-left: 2px; }
.login-card input[readonly] { opacity: .75; cursor: default; }
.admin-reset { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 9px; }
.admin-reset .pw-username { width: 120px; background: var(--inset); border: 1px solid var(--line);
  color: var(--muted); border-radius: 7px; padding: 4px 9px; font-size: 11.5px; }
.admin-reset input[type=password] { background: var(--inset); border: 1px solid var(--line);
  color: var(--fg); border-radius: 7px; padding: 4px 9px; font-size: 11.5px; width: 180px; max-width: 60vw; }
.admin-reset input:focus { outline: none; border-color: var(--accent); }

.toast { position: fixed; top: 14px; left: 50%; transform: translate(-50%, -20px);
  background: var(--panel); border: 1px solid rgba(94,234,212,.4); color: var(--green);
  padding: 8px 16px; border-radius: 20px; font-size: 13px; z-index: 1200; opacity: 0;
  transition: opacity .3s, transform .3s; box-shadow: 0 4px 20px rgba(0,0,0,.45); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Admin-only device recovery block (key-reset / forget). */
.danger-zone { border: 1px solid rgba(251,113,133,.28); border-radius: 12px;
  padding: 12px 16px; background: rgba(251,113,133,.05); }
.danger-zone h3 { color: var(--red); }
.btn-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
button.danger { background: linear-gradient(180deg, #f2909d, var(--red)); color: #2a0710;
  --gc: 251,113,133; }
