/* =====================================================================
   ZERO — monochrome surface layer
   Loaded after style.css. Black/white minimal with sparse red accent
   and green for live indicators.
   ===================================================================== */

@font-face {
  font-family: "Chakra Petch";
  src: url("/static/fonts/chakra-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/static/fonts/chakra-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/static/fonts/chakra-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Chakra Petch";
  src: url("/static/fonts/chakra-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Chakra Petch", "Inter", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Code", Consolas, monospace;

  --bg: #0a0a0a;
  --bg-elevated: rgba(14, 14, 14, 0.94);
  --surface: rgba(18, 18, 18, 0.80);
  --surface-hover: rgba(26, 26, 26, 0.90);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.16);

  --text: #e8e8e8;
  --text-secondary: #999;
  --text-muted: #555;

  --accent: #fff;
  --accent-2: #22c55e;
  --accent-3: #dc2626;
  --accent-muted: rgba(255, 255, 255, 0.06);
  --accent-hover: rgba(255, 255, 255, 0.10);
  --accent-rgb: 255, 255, 255;
  --good: #22c55e;
  --bad: #dc2626;
  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 12px 32px -16px rgba(0, 0, 0, 0.9);
  --shadow-lg: 0 24px 64px -24px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 8px 28px -12px rgba(0, 0, 0, 0.9);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 160ms var(--ease);
  --transition-slow: 280ms var(--ease);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}

::selection { background: rgba(255, 255, 255, 0.25); color: #fff; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

/* ---------------- ambient background ---------------- */

.bg-aura {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #0a0a0a;
}
/* subtle monochrome noise-like texture only */
.bg-aura span { display: none; }
.bg-aura::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 10%, transparent 75%);
}

/* ---------------- shell / sidebar ---------------- */

.shell { position: relative; z-index: 1; }
.main { min-width: 0; }

.sidebar {
  background: rgba(12, 12, 12, 0.96);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 16px 0 40px -28px rgba(0, 0, 0, 0.9);
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.06) 40%, transparent 90%);
  pointer-events: none;
}

.brand {
  padding: 22px 18px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.8);
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.12) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: sheen 8s var(--ease) infinite;
}
@keyframes sheen {
  0%, 62% { transform: translateX(-120%); }
  82%, 100% { transform: translateX(120%); }
}
.brand-mark img { border-radius: 7px; }

.brand-text {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.1;
}
.brand-text span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.38em;
  margin-top: 5px;
  color: var(--text-muted);
}

.nav { padding: 14px 12px; gap: 3px; }

.nav-sep {
  padding: 18px 12px 7px;
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--text-muted);
}

.nav-item {
  position: relative;
  padding: 10px 12px;
  border-radius: 8px;
  border-left: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  letter-spacing: 0.01em;
  overflow: hidden;
  transition: color var(--transition), background var(--transition);
}
.nav-item::before {
  content: "";
  position: absolute;
  left: 0; top: 22%; bottom: 22%;
  width: 2px;
  border-radius: 2px;
  background: #fff;
  opacity: 0;
  transform: scaleY(0.3);
  transition: all var(--transition);
}
.nav-item svg { width: 16px; height: 16px; opacity: 0.55; transition: all var(--transition); flex-shrink: 0; }
.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.nav-item:hover svg { opacity: 0.85; }
.nav-item.active {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
.nav-item.active::before { opacity: 1; transform: scaleY(1); }
.nav-item.active svg { opacity: 1; color: #fff; }

.nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  background: #fff;
  color: #0a0a0a;
  font-size: 10px;
  font-weight: 700;
}

.nav-tag {
  margin-left: auto;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--good);
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.22);
}

.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); gap: 6px; }

.lic-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lic-chip.dim { color: var(--text-muted); border-style: dashed; }

/* ---------------- topbar ---------------- */

.topbar {
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  min-height: 64px;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.topbar-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}
.topbar-clock {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.topbar-right { margin-left: auto; gap: 10px; }
.topbar-meta + .topbar-right { margin-left: 0; }
.online-txt { color: var(--good); letter-spacing: 0.16em; font-size: 10px; font-weight: 600; }
.pulse-dot {
  width: 8px; height: 8px;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08), 0 0 10px rgba(34, 197, 94, 0.6);
  animation: alive 2.4s ease-in-out infinite;
}
@keyframes alive {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08), 0 0 10px rgba(34, 197, 94, 0.6); }
  50% { opacity: 0.45; box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.03), 0 0 4px rgba(34, 197, 94, 0.3); }
}

.burger {
  border-radius: 8px;
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}

/* ---------------- views ---------------- */

.view { padding: 28px 30px 44px; }
.view.active { animation: viewEnter 0.4s var(--ease) both; }
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.view-kicker {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.view-kicker::before {
  content: "";
  width: 18px; height: 1px;
  background: rgba(255, 255, 255, 0.20);
}
.view-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.1;
}
.view-sub {
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.view-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1px solid rgba(34, 197, 94, 0.22);
  background: rgba(34, 197, 94, 0.06);
  color: var(--good);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.live-pill i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
  animation: alive 2s ease-in-out infinite;
}

/* ---------------- stat cards ---------------- */

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  position: relative;
  background: rgba(16, 16, 16, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px 18px;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  opacity: 0.5;
}
.stat-card::after { display: none; }
.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-md);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.stat-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.20em;
  color: var(--text-muted);
}
.stat-ico {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.stat-ico svg { width: 15px; height: 15px; }
.stat-num {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  margin-bottom: 8px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.stat-num.mono-sm {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.02em;
  padding-top: 10px;
  padding-bottom: 6px;
  color: var(--text-secondary);
}
.stat-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ---------------- cards ---------------- */

.card {
  position: relative;
  background: rgba(14, 14, 14, 0.80);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  overflow: hidden;
}
.card::before { display: none; }
.card-head {
  padding: 16px 20px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}
.card-head .counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ---------------- tables ---------------- */

.ztable { font-size: 12.5px; }
.ztable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(12, 12, 12, 0.96);
  padding: 12px 16px;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.ztable td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}
.ztable tbody tr { transition: background var(--transition); }
.ztable tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.ztable tbody tr:last-child td { border-bottom: 0; }
.ztable .empty { color: var(--text-muted); padding: 44px 16px; }

.flg { width: 20px; height: 14px; border-radius: 3px; object-fit: cover; vertical-align: middle; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10); }

.key-cell { font-family: var(--font-mono); font-size: 10.5px; color: #ccc; }

.exp-bad { color: var(--bad); font-weight: 600; }
.exp-live { color: var(--good); font-weight: 600; }
.faint { color: var(--text-muted); }

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  vertical-align: middle;
}
.role-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 4px 9px;
  border-radius: 99px;
  cursor: pointer;
  transition: all var(--transition);
}
.role-toggle:hover { color: var(--text); border-color: var(--border-hover); }
.role-toggle.admin { color: #fff; border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.08); }

/* ---------------- forms ---------------- */

.form-row label {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.form-row input,
.form-row textarea,
.zselect {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  padding: 11px 13px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.form-row input:hover,
.form-row textarea:hover,
.zselect:hover { border-color: rgba(255, 255, 255, 0.14); }
.form-row input:focus,
.form-row textarea:focus,
.zselect:focus {
  border-color: rgba(255, 255, 255, 0.30);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}
.form-row input::placeholder,
.form-row textarea::placeholder { color: var(--text-muted); }
.zselect {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}
.form-hint { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; line-height: 1.6; }

input[type="file"] {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 10px !important;
  cursor: pointer;
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  margin-right: 12px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #ccc;
  font-family: var(--font-sans);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}
input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.form-error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.22);
  color: #f87171;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  margin-bottom: 16px;
  animation: shake 0.35s var(--ease);
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.save-msg { font-size: 10.5px; letter-spacing: 0.1em; color: var(--good); }

/* duration widget */
.dur-combo input { border-radius: 8px; }
.mode-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.mode-toggle button {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.mode-toggle button.active {
  color: #0a0a0a;
  background: #fff;
}
.stepper {
  display: flex;
  align-items: stretch;
  gap: 6px;
  max-width: 220px;
}
.stepper button {
  width: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
}
.stepper button:hover { color: #fff; border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.06); }
.stepper input { flex: 1; text-align: center; }

/* ---------------- buttons ---------------- */

.btn-primary,
.btn-ghost,
.btn-danger,
.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn-primary {
  color: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: #fff;
  box-shadow: 0 4px 16px -6px rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px -6px rgba(255, 255, 255, 0.20);
  background: #f0f0f0;
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn-ghost {
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.btn-ghost:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.btn-danger {
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.08);
}
.btn-danger:hover {
  color: #fff;
  background: #dc2626;
  border-color: transparent;
  box-shadow: 0 6px 18px -8px rgba(220, 38, 38, 0.7);
  transform: translateY(-1px);
}

.btn-primary.sm, .btn-ghost.sm, .btn-danger.sm { padding: 8px 12px; font-size: 9.5px; border-radius: 6px; }

/* ---------------- modal ---------------- */

.modal-backdrop {
  background: rgba(0, 0, 0, 0.70);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal {
  background: rgba(14, 14, 14, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -48%) scale(0.97);
}
.modal.show { transform: translate(-50%, -50%) scale(1); }
.modal-head {
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  font-size: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); }
.modal-err {
  display: none;
  color: #f87171;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.20);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 11.5px;
  margin-bottom: 16px;
}
.modal-err.show { display: block; animation: shake 0.35s var(--ease); }

/* ---------------- toast ---------------- */

.toast-stack { gap: 8px; }
.toast {
  background: rgba(16, 16, 16, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 12px 16px 12px 14px;
  font-size: 11.5px;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  animation: toastIn 0.35s var(--ease) both;
}
.toast::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: #fff;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------------- profile / device cards ---------------- */

.profile-grid { gap: 14px; }
.profile-grid > .empty { grid-column: 1 / -1; padding: 48px 20px; text-align: center; }
.profile-card {
  background: rgba(255, 255, 255, 0.024);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.profile-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
}
.profile-name { font-family: var(--font-display); font-size: 15px; letter-spacing: 0.02em; }
.profile-user { font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.04em; }
.profile-url { background: rgba(0, 0, 0, 0.3); border-color: var(--border); font-size: 10px; }

.device-grid { gap: 14px; }
.device-card {
  position: relative;
  background: rgba(255, 255, 255, 0.024);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.device-card::after { display: none; }
.device-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, hsl(var(--dh, 210), 70%, 55%), hsl(var(--dh, 210), 70%, 38%));
  opacity: 0;
  transition: opacity var(--transition);
}
.device-card:hover {
  border-color: hsl(var(--dh, 210), 40%, 50%, 0.35);
  background: rgba(255, 255, 255, 0.045);
  transform: translateY(-2px);
  box-shadow: 0 14px 40px -18px hsla(var(--dh, 210), 60%, 20%, 0.55), var(--shadow-md);
}
.device-card:hover::before { opacity: 1; }
.device-head { font-size: 12.5px; gap: 9px; }
.device-dot {
  width: 7px; height: 7px;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08), 0 0 8px rgba(34, 197, 94, 0.6);
}
.device-dot.live { background: var(--good); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.08), 0 0 10px rgba(34, 197, 94, 0.7); animation: alive 2s ease-in-out infinite; }
.dev-live {
  color: var(--good);
  border-color: rgba(34, 197, 94, 0.24);
  background: rgba(34, 197, 94, 0.07);
  border-radius: 99px;
  letter-spacing: 0.14em;
}
.device-meta { font-size: 11px; color: var(--text-muted); }
.device-meta .dim { color: var(--text-secondary); }
.device-ip { font-size: 10.5px; color: var(--text-muted); }
.dev-avatar {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, hsl(var(--dh, 210), 55%, 42%), hsl(var(--dh, 210), 55%, 24%));
  border: 1px solid hsl(var(--dh, 210), 55%, 55%, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 4px 12px -6px hsla(var(--dh, 210), 60%, 20%, 0.6);
  flex-shrink: 0;
}
.dev-ident { min-width: 0; }
.dev-name { display: block; font-weight: 600; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-user { display: block; font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.dev-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.dev-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dev-chip.ip { font-family: var(--font-mono); color: var(--text-muted); }
.dev-chip.os {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.09);
  letter-spacing: 0.05em;
}
.dev-chip.geo { gap: 6px; }
.dev-chip.geo .flg { width: 13px; height: 10px; border-radius: 2px; object-fit: cover; }
.dev-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.dev-meta { display: inline-flex; align-items: center; gap: 5px; }
.dev-meta.live { color: var(--good); }
.dev-meta.live i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 6px var(--good);
  animation: alive 1.6s ease-in-out infinite;
}
.dev-meta.dim { color: var(--text-muted); opacity: 0.8; }
.dev-arr { display: inline-block; transition: transform var(--transition); }
.device-card:hover .dev-arr { transform: translateX(3px); }
.dev-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}
.dev-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 600;
  transition: gap var(--transition), color var(--transition);
}
.device-card:hover .dev-go { gap: 10px; color: #fff; }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 12px;
  width: 14px; height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-box input {
  width: 230px;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11.5px;
  padding: 9px 14px 9px 34px;
  outline: none;
  transition: all var(--transition);
}
.search-box input:focus {
  width: 280px;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

/* ---------------- live graph ---------------- */

.graph-card { padding: 0; }
.graph-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 4px;
}
.graph-head .card-head { border: 0; padding: 0; background: none; }
.graph-sub { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; letter-spacing: 0.01em; }
.graph-live {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.06);
  border: 1px solid rgba(34, 197, 94, 0.16);
}
.graph-live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
  align-self: center;
  animation: alive 2s ease-in-out infinite;
}
.graph-live b {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.graph-live-lbl { font-size: 8.5px; letter-spacing: 0.22em; color: var(--text-muted); }
.graph-canvas-wrap {
  position: relative;
  height: 220px;
  margin: 12px 12px 0;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.graph-canvas-wrap canvas { display: block; width: 100%; height: 100%; }
.graph-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity var(--transition);
}
.graph-empty.hide { opacity: 0; }
.graph-foot {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 16px 22px 20px;
  flex-wrap: wrap;
}
.graph-stat { display: flex; flex-direction: column; gap: 4px; }
.graph-stat span { font-size: 8.5px; letter-spacing: 0.18em; color: var(--text-muted); }
.graph-stat b { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.graph-legend {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.graph-legend i {
  width: 18px; height: 2px;
  border-radius: 2px;
  background: #fff;
}

/* ---------------- login ---------------- */

.login-page {
  position: relative;
  background: transparent;
  overflow: hidden;
}
.login-wrap { position: relative; z-index: 2; max-width: 440px; }
.login-rings {
  position: fixed;
  top: 50%; left: 50%;
  width: min(78vmin, 720px);
  height: min(78vmin, 720px);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1;
}
.login-rings i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: ringSpin 50s linear infinite;
}
.login-rings i:nth-child(2) {
  inset: 12%;
  border-color: rgba(255, 255, 255, 0.04);
  animation-duration: 35s;
  animation-direction: reverse;
}
.login-rings i:nth-child(3) {
  inset: 25%;
  border-color: rgba(255, 255, 255, 0.03);
  animation-duration: 25s;
}
.login-rings i::after {
  content: "";
  position: absolute;
  top: -3px; left: 50%;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.30);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.20);
}
@keyframes ringSpin { to { transform: rotate(360deg); } }

.login-box {
  position: relative;
  background: rgba(14, 14, 14, 0.90);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  padding: 42px 38px 34px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 32px 80px -40px rgba(0, 0, 0, 1);
  overflow: hidden;
  animation: fadeUp 0.5s var(--ease) both;
}
.login-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}
.login-box::after { display: none; }
.login-logo img {
  width: 62px; height: 62px;
  border-radius: 14px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.8);
}
.login-logo h1 {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.34em;
  font-weight: 600;
  margin-top: 16px;
}
.login-logo p {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  min-height: 16px;
  letter-spacing: 0.08em;
  margin-top: 8px;
}
.login-logo p::after {
  content: "";
  display: inline-block;
  width: 6px; height: 11px;
  margin-left: 2px;
  background: #fff;
  vertical-align: -1px;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.field input {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 13px 14px;
  outline: none;
  transition: all var(--transition);
}
.field input:focus {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}
.login-form .btn-primary { width: 100%; padding: 13px; margin-top: 4px; }
.login-foot {
  margin-top: 26px;
  text-align: center;
  font-size: 8.5px;
  letter-spacing: 0.36em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.step-note { font-size: 9px; letter-spacing: 0.3em; color: var(--text-secondary) !important; margin-top: 10px; }
.key-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  margin-bottom: 18px;
}
.key-label { font-size: 8.5px; letter-spacing: 0.22em; color: var(--text-muted); }
.key-value { font-family: var(--font-mono); font-size: 10px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-hint {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.bot-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
  flex-shrink: 0;
}
.unpair-box {
  margin-top: 20px;
  border: 1px solid rgba(220, 38, 38, 0.20);
  background: rgba(220, 38, 38, 0.05);
  border-radius: 10px;
  padding: 16px;
}
.unpair-title { font-size: 10px; letter-spacing: 0.18em; color: #f87171; text-transform: uppercase; margin-bottom: 8px; font-weight: 600; }
.unpair-text { font-size: 11px; line-height: 1.7; color: var(--text-muted); }
.unpair-text b { color: var(--text-secondary); }
.unpair-cmd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.unpair-cmd code { flex: 1; font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; }
.btn-copy {
  padding: 6px 10px;
  font-size: 8.5px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.btn-copy:hover { color: #fff; border-color: rgba(255, 255, 255, 0.22); }
.unpair-open { display: inline-block; font-size: 10px; letter-spacing: 0.12em; color: var(--text-secondary); text-transform: uppercase; }
.unpair-open:hover { color: #fff; }

.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; position: relative; z-index: 2; }
.error-box { text-align: center; }
.error-code { font-family: var(--font-display); font-size: 88px; font-weight: 700; color: #fff; }
.error-msg { font-size: 11px; letter-spacing: 0.24em; color: var(--text-muted); margin-top: 8px; text-transform: uppercase; }

/* ---------------- builder / announcer / bundle polish ---------------- */

.build-type-switch {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.type-btn {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 10px;
  cursor: pointer;
  transition: all var(--transition);
}
.type-btn.active {
  color: #0a0a0a;
  background: #fff;
}
.build-progress-track { background: rgba(255, 255, 255, 0.06); border-radius: 99px; overflow: hidden; }
.build-progress-bar { background: #fff; }

.an-fixed { background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin: 16px 20px; }
.an-fixed-row { font-size: 10.5px; }
.an-fixed-row b { color: var(--text-muted); font-weight: 600; letter-spacing: 0.1em; font-size: 9px; }
.dc-embed { background: #111; border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 8px; }
.dc-title { font-weight: 600; }
.dc-desc { font-size: 12.5px; line-height: 1.7; color: #d0d0d0; }
.dc-footer { font-size: 10px; color: var(--text-muted); border-top: 1px solid rgba(255, 255, 255, 0.05); padding-top: 10px; margin-top: 10px; }

.bundle-opt {
  background: rgba(255, 255, 255, 0.022);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all var(--transition);
}
.bundle-opt:hover { border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.03); }
.bundle-opt.active { border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.06); }
.bundle-opt input { accent-color: #fff; }
.bundle-download {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
}
.bundle-download:hover { border-color: rgba(255, 255, 255, 0.25); box-shadow: var(--shadow-md); }
.bundle-rebuild { border-radius: 8px; }

.rpt-modal { background: rgba(14, 14, 14, 0.98); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.rpt-badge { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); color: #ccc; border-radius: 99px; padding: 2px 8px; font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; }
.rpt-btn { border-radius: 6px; }

/* =====================================================================
   CLIENT CONSOLE — single window
   ===================================================================== */

body.client-page {
  overflow: hidden;
  background: var(--bg);
}

.cx-shell {
  position: relative;
  z-index: 2;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

/* ---- top bar ---- */

.cx-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(14, 14, 14, 0.90);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.cx-back {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 17px;
  text-decoration: none;
  transition: all var(--transition);
  flex-shrink: 0;
}
.cx-back:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(-2px);
}
.cx-id { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cx-id-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cx-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.06), 0 0 10px rgba(34, 197, 94, 0.6);
  flex-shrink: 0;
  transition: all var(--transition);
}
.cx-dot.off { background: var(--text-muted); box-shadow: none; }
.cx-id-top b {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cx-tag {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 99px;
  padding: 3px 8px;
  white-space: nowrap;
  transition: all var(--transition);
}
.cx-tag.live { color: var(--good); border-color: rgba(34, 197, 94, 0.24); background: rgba(34, 197, 94, 0.07); }
.cx-id-sub {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 54vw;
}
.cx-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.cx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 9px 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.cx-btn svg { width: 13px; height: 13px; }
.cx-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}
.cx-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.cx-btn-sm { padding: 6px 10px; font-size: 9px; border-radius: 6px; }
.cx-btn-primary {
  color: #0a0a0a;
  border-color: rgba(255, 255, 255, 0.85);
  background: #fff;
  box-shadow: 0 4px 16px -6px rgba(255, 255, 255, 0.15);
}
.cx-btn-primary:hover { background: #f0f0f0; box-shadow: 0 6px 20px -6px rgba(255, 255, 255, 0.20); }
.cx-btn-danger {
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.08);
}
.cx-btn-danger:hover { color: #fff; background: #dc2626; border-color: transparent; }
.cx-btn-accent { color: var(--good); border-color: rgba(34, 197, 94, 0.22); background: rgba(34, 197, 94, 0.06); }
.cx-btn-accent:hover { color: #fff; background: rgba(34, 197, 94, 0.14); border-color: rgba(34, 197, 94, 0.4); }
.cx-btn.on { color: #fff; background: rgba(255, 255, 255, 0.10); border-color: rgba(255, 255, 255, 0.22); }
.cx-btn-primary.armed {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 4px 14px -4px rgba(220, 38, 38, 0.6);
}
.cx-btn-primary.armed:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

/* ---- main split ---- */

.cx-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 400px);
  gap: 12px;
}

.cx-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(14, 14, 14, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}
.cx-panel::before { display: none; }

.cx-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  min-height: 46px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  flex-shrink: 0;
  z-index: 2;
}
.cx-head-left {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.cx-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.cx-head-right b { color: var(--text-secondary); font-weight: 500; }
.cx-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition);
}
.cx-screen.streaming .cx-live-dot { background: var(--red); box-shadow: 0 0 8px var(--red); animation: alive 1.1s ease-in-out infinite; }
.cx-screen.streaming .cx-head-left { color: #fca5a5; }

.cx-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 10px;
  border-radius: 10px;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}
.cx-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 50%, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 10%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
.cx-stage img,
.cx-stage canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.cx-stage:not(.has-frame) img,
.cx-stage:not(.has-frame) canvas { visibility: hidden; }
.cx-scan {
  position: absolute;
  left: 0; right: 0;
  top: -12%;
  height: 12%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.cx-screen.streaming .cx-scan { opacity: 1; animation: scanMove 4.5s linear infinite; }
@keyframes scanMove { to { top: 100%; } }

.cx-hint {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}
.cx-hint b { color: var(--text-secondary); font-weight: 600; }
.cx-hint .cx-hint-ico {
  width: 52px; height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}
.cx-hint svg { width: 22px; height: 22px; }

.cx-offline {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
}
.cx-offline.show { display: flex; }
.cx-offline span {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.24);
  background: rgba(220, 38, 38, 0.06);
  border-radius: 8px;
  padding: 14px 22px;
}

.cx-screen-foot {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 16px 13px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.cx-screen-foot b { color: var(--text-secondary); font-weight: 500; }
.cx-screen-foot .ok { color: var(--good); }
.cx-screen-foot .off { color: var(--text-muted); }
.cx-screen-foot .rec { color: var(--red); }

/* ---- chat ---- */

.cx-chat-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition);
}
.cx-chat.chat-on .cx-chat-dot { background: var(--good); box-shadow: 0 0 8px var(--good); }

.cx-chat-out {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.cx-chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.9;
  padding: 20px;
}
.cx-chat-empty b { display: block; color: var(--text-secondary); font-family: var(--font-display); font-size: 12px; letter-spacing: 0.16em; margin-bottom: 4px; }
.cx-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 88%;
  animation: msgIn 0.32s var(--ease) both;
}
.cx-msg.in { align-self: flex-start; }
.cx-msg.out { align-self: flex-end; align-items: flex-end; }
.cx-msg .who {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 3px;
}
.cx-msg .txt {
  font-size: 12px;
  line-height: 1.6;
  padding: 9px 12px;
  border-radius: 10px;
  word-break: break-word;
  white-space: pre-wrap;
}
.cx-msg.in .txt {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 3px;
  color: var(--text);
}
.cx-msg.out .txt {
  background: #fff;
  color: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.80);
  border-bottom-right-radius: 3px;
}
.cx-msg .time { font-family: var(--font-mono); font-size: 8px; color: var(--text-muted); padding: 0 3px; }
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.cx-chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px 4px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}
.cx-chat-input input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11.5px;
  padding: 10px 12px;
  outline: none;
  transition: all var(--transition);
}
.cx-chat-input input:focus {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}
.cx-chat-input input::placeholder { color: var(--text-muted); }
.cx-chat-input .cx-btn { padding: 0 14px; }
.cx-chat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px 11px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  flex-shrink: 0;
}
.cx-chat-foot .on { color: var(--good); }

/* ---- tool dock ---- */

.cx-tools {
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(14, 14, 14, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition);
}
.cx-tool-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 9px;
  flex-shrink: 0;
  overflow-x: auto;
}
.cx-tool-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.cx-tool-tab svg { width: 13px; height: 13px; opacity: 0.8; }
.cx-tool-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.cx-tool-tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}
.cx-tool-tab.active svg { color: #fff; opacity: 1; }
.cx-tools-spacer { flex: 1; }
.cx-tools-toggle {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  margin-left: 6px;
}
.cx-tools-toggle:hover { color: #fff; border-color: rgba(255, 255, 255, 0.22); }
.cx-tools-toggle svg { width: 12px; height: 12px; transition: transform var(--transition); }
.cx-tools.collapsed .cx-tools-toggle svg { transform: rotate(180deg); }

.cx-tool-panels {
  height: clamp(190px, 24vh, 260px);
  border-top: 1px solid var(--border);
  position: relative;
  min-height: 0;
  transition: height var(--transition-slow);
  overflow: hidden;
}
.cx-tools.collapsed .cx-tool-panels { height: 0; border-top: 0; }
.cx-tool-panel { display: none; height: 100%; min-height: 0; flex-direction: column; }
.cx-tool-panel.active { display: flex; }
.cx-tool-panel[data-tool="files"] { overflow: hidden; position: relative; }
.cx-tool-panel[data-tool="troll"] { overflow: hidden; }

.cx-troll-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
}
.cx-troll-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}
.cx-troll-row:last-child { border-bottom: 0; }
.cx-troll-cap {
  flex: 0 0 100%;
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1px;
}
.cx-troll-row .cx-btn { flex-shrink: 0; white-space: nowrap; }
.cx-troll-input {
  flex: 1 1 190px;
  min-width: 150px;
  max-width: none;
  padding: 6px 9px;
}
.cx-troll-dur {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  font-size: 9.5px;
  color: var(--text-muted);
}
.cx-troll-num {
  width: 66px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 10.5px;
  padding: 5px 7px;
  outline: none;
}
.cx-troll-num:focus { border-color: rgba(255, 255, 255, 0.22); }
.cx-troll-file {
  flex: 1 1 190px;
  min-width: 160px;
  max-width: 280px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 9.5px;
}
.cx-troll-file::file-selector-button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 9.5px;
  padding: 5px 8px;
  margin-right: 6px;
  cursor: pointer;
}
.cx-troll-note { font-size: 9.5px; color: var(--text-muted); }

.cx-tool-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.012);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.cx-tool-bar .cx-label {
  font-size: 8.5px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-left: auto;
}
.cx-select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 10.5px;
  padding: 7px 10px;
  outline: none;
  max-width: 240px;
}
.cx-select:focus { border-color: rgba(255, 255, 255, 0.22); }

.cx-cam-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  overflow: hidden;
}
.cx-cam-stage img,
.cx-cam-stage canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.cx-cam-stage .cx-hint { font-size: 10px; }

.cx-mic-stage { gap: 12px; }
.cx-mic-icon {
  width: 64px; height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 22px;
}
.cx-mic-icon.pulsing { animation: micRing 1.4s ease-in-out infinite; }
@keyframes micRing {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.14); }
  50% { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0); }
}
.cx-mic-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 12px; }
.cx-mic-track {
  width: min(420px, 80%);
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.cx-mic-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: #fff;
  transition: width 90ms linear;
}

.cx-keylog-out {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 10px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.30);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* file manager inside dock */

.cx-tool-panel[data-tool="files"] .c-fm-toolbar {
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.012);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.cx-tool-panel[data-tool="files"] .c-fm-wrap {
  border: 0;
  background: transparent;
  flex: 1;
}
.cx-tool-panel[data-tool="files"] .c-fm-table { font-size: 11.5px; }
.cx-tool-panel[data-tool="files"] .c-fm-status {
  border: 0;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  padding: 5px 12px;
  font-size: 9.5px;
}
.cx-tool-panel[data-tool="files"] .c-fm-row:hover { background: rgba(255, 255, 255, 0.04); }
.cx-tool-panel[data-tool="files"] .c-fm-crumb { font-size: 10.5px; }
.cx-tool-panel[data-tool="files"] .c-fm-drop { border-radius: 0; }

.cx-stage:fullscreen { border-radius: 0; margin: 0; background: #000; }
.cx-stage:fullscreen img,
.cx-stage:fullscreen canvas { object-fit: contain; }

.cx-toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.cx-toast {
  padding: 11px 15px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(16, 16, 16, 0.97);
  color: var(--text);
  font-size: 11px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.28s var(--ease);
}
.cx-toast.show { opacity: 1; transform: none; }

/* legacy client modal + context menu polish */
.c-modal { background: rgba(14, 14, 14, 0.98); border-color: rgba(255, 255, 255, 0.08); border-radius: 10px; }
.c-modal-head { font-family: var(--font-display); letter-spacing: 0.1em; font-size: 12px; }
.c-input { border-radius: 7px; background: rgba(255, 255, 255, 0.03); }
.c-ctx { background: rgba(14, 14, 14, 0.98); border-color: rgba(255, 255, 255, 0.08); border-radius: 8px; backdrop-filter: blur(14px); }
.c-ctx-item:hover { background: rgba(255, 255, 255, 0.06); }

/* ---------------- responsive ---------------- */

@media (max-width: 1280px) {
  .cx-grid { grid-template-columns: minmax(0, 1fr) 340px; }
}

@media (max-width: 1080px) {
  .cx-grid { grid-template-columns: minmax(0, 1fr) 310px; }
  .topbar-meta { display: none; }
  .topbar-meta + .topbar-right { margin-left: auto; }
}

@media (max-width: 900px) {
  body.client-page { overflow: auto; }
  .cx-shell { height: auto; min-height: 100vh; padding: 10px; }
  .cx-grid { grid-template-columns: 1fr; }
  .cx-screen { min-height: 360px; }
  .cx-chat { min-height: 380px; }
  .cx-id-sub { max-width: 42vw; }
  .cx-actions { flex-wrap: wrap; justify-content: flex-end; }
  .cx-tool-panels { height: 300px; }
}

@media (max-width: 768px) {
  .view { padding: 20px 16px 34px; }
  .topbar { padding: 12px 16px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .graph-head { flex-direction: column; }
  .graph-foot { gap: 18px; }
  .graph-legend { margin-left: 0; }
  .search-box input, .search-box input:focus { width: 100%; }
  .view-head { align-items: flex-start; }
  .cx-top { flex-wrap: wrap; }
  .cx-actions { width: 100%; margin-left: 0; justify-content: stretch; }
  .cx-actions .cx-btn { flex: 1; }
  .cx-tool-tabs { overflow-x: auto; padding-bottom: 8px; }
  .cx-tools-spacer { display: none; }
}

@media (max-width: 560px) {
  .cx-id { order: 3; width: 100%; }
  .cx-id-sub { max-width: 100%; }
  .cx-tool-panels { height: 320px; }
  .graph-live b { font-size: 20px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  .view-head-actions { width: 100%; }
  .view-head-actions .btn-ghost { flex: 1; }
  .graph-foot { gap: 14px 20px; }
  .topbar-clock { display: none; }
}
