/* ============================================================
   ControlHub — refined dark admin theme
   Pure CSS, no external deps.
   ============================================================ */

:root {
  /* Neutral ink/slate ramp */
  --ink-950: #070b14;
  --ink-900: #0b1220;
  --ink-850: #0f172a;
  --ink-800: #131c2e;
  --ink-750: #182236;
  --ink-700: #1e293b;
  --ink-600: #273449;
  --ink-500: #334155;
  --line: #1f2b3e;
  --line-soft: #17212f;

  /* Text */
  --text: #e6edf6;
  --text-strong: #f6f9fc;
  --muted: #93a2b8;
  --muted-2: #6b7c94;

  /* Accent (blue-teal) */
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --accent-ink: #05221e;
  --accent-glow: rgba(45, 212, 191, 0.16);

  /* Status */
  --ok: #34d399;
  --ok-bg: rgba(52, 211, 153, 0.12);
  --ok-line: rgba(52, 211, 153, 0.35);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-line: rgba(248, 113, 113, 0.35);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --warn-line: rgba(251, 191, 36, 0.35);
  --neutral: #94a3b8;
  --neutral-bg: rgba(148, 163, 184, 0.12);

  /* Shape / spacing scale */
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
  --shadow-pop: 0 24px 60px -20px rgba(0, 0, 0, 0.75);

  --sidebar-w: 248px;
  --topbar-h: 60px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Menlo, Consolas,
    "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 78% -8%, rgba(56, 189, 248, 0.07), transparent 60%),
    radial-gradient(900px 500px at 2% 6%, rgba(45, 212, 191, 0.06), transparent 55%),
    var(--ink-950);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; color: var(--text-strong); font-weight: 650; letter-spacing: -0.01em; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: var(--accent-glow); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--ink-600) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--ink-600); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-500); background-clip: content-box; }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  --_bg: var(--ink-700);
  --_bg-hover: var(--ink-600);
  --_fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--_bg);
  color: var(--_fg);
  font: inherit;
  font-weight: 550;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.06s ease, opacity 0.14s ease;
  user-select: none;
}
.btn:hover { background: var(--_bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary {
  --_bg: linear-gradient(180deg, #34e0cd, #21bfa9);
  --_bg-hover: linear-gradient(180deg, #40e6d4, #27c9b2);
  --_fg: var(--accent-ink);
  border-color: transparent;
  font-weight: 650;
  box-shadow: 0 6px 18px -8px var(--accent-glow);
}
.btn-ghost { --_bg: transparent; --_bg-hover: var(--ink-750); border-color: transparent; }
.btn-danger { --_fg: var(--danger); border-color: var(--danger-line); --_bg: var(--danger-bg); --_bg-hover: rgba(248,113,113,0.2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-block { width: 100%; }

/* ============================================================
   Forms
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-4); }
.field:last-child { margin-bottom: 0; }
.label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted-2); }

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  background: var(--ink-900);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s;
}
.input::placeholder { color: var(--muted-2); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--ink-850);
}
.textarea { resize: vertical; min-height: 120px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.input-group { display: flex; gap: var(--s-2); }
.input-group .input { flex: 1; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative; width: 40px; height: 22px; border-radius: 20px;
  background: var(--ink-600); border: 1px solid var(--line); transition: background 0.16s ease;
  flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #cbd5e1; transition: transform 0.16s ease, background 0.16s;
}
.switch input:checked + .track { background: linear-gradient(180deg, #34e0cd, #21bfa9); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); background: #05221e; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-glow); }
.switch .switch-label { font-size: 13.5px; color: var(--text); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 520px) { .form-row { grid-template-columns: 1fr; } }

/* ============================================================
   Status pills / badges
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 20px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
  border: 1px solid var(--line); background: var(--neutral-bg); color: var(--neutral);
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(255,255,255,0.04); }
.pill.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.pill.ok .dot { animation: pulse 2.4s ease-in-out infinite; }
.pill.danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.pill.accent { color: var(--accent); background: var(--accent-glow); border-color: var(--accent-line, rgba(45,212,191,0.35)); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

.tag { font-family: var(--mono); font-size: 11.5px; padding: 2px 7px; border-radius: 5px; background: var(--ink-750); border: 1px solid var(--line); color: var(--muted); }

/* ============================================================
   Login
   ============================================================ */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: var(--s-6);
}
.login-card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 34px 30px 28px;
  box-shadow: var(--shadow-pop);
  animation: rise 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(0.99); } to { opacity: 1; transform: none; } }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand .mark { width: 42px; height: 42px; }
.login-brand .word { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); }
.login-brand .word b { color: var(--accent); font-weight: 700; }
.login-sub { color: var(--muted); font-size: 13px; margin: 4px 0 24px; }
.login-error {
  display: none; margin-bottom: var(--s-4); padding: 10px 12px;
  background: var(--danger-bg); border: 1px solid var(--danger-line); border-radius: var(--r-sm);
  color: #fecaca; font-size: 13px;
}
.login-error.show { display: block; animation: shake 0.35s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-5px)} 40%,80%{transform:translateX(5px)} }
.login-foot { margin-top: 22px; text-align: center; color: var(--muted-2); font-size: 12px; }
.login-demo { margin-top: 14px; text-align: center; font-size: 12px; color: var(--muted-2); }

/* ============================================================
   App shell
   ============================================================ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  grid-row: 1 / -1;
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  z-index: 30;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px;
  height: var(--topbar-h); padding: 0 var(--s-5);
  border-bottom: 1px solid var(--line-soft);
}
.sidebar-brand .mark { width: 30px; height: 30px; flex: none; }
.sidebar-brand .word { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.sidebar-brand .word b { color: var(--accent); }

.nav { padding: var(--s-4) var(--s-3); display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted-2); font-weight: 700; padding: var(--s-4) 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--muted); font-weight: 550; font-size: 13.5px;
  cursor: pointer; border: none; background: none; width: 100%; text-align: left;
  transition: background 0.13s ease, color 0.13s ease;
  position: relative;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-item:hover { background: var(--ink-800); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item .count { margin-left: auto; font-size: 11px; background: var(--ink-700); color: var(--muted); padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.nav-item.active .count { background: rgba(45,212,191,0.2); color: var(--accent); }

.sidebar-foot { padding: var(--s-3); border-top: 1px solid var(--line-soft); }
.sys-mini { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--ink-850); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.sys-mini .row { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.sys-mini .bar { height: 5px; border-radius: 10px; background: var(--ink-700); overflow: hidden; }
.sys-mini .bar > span { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.5s ease; }

/* Topbar */
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-6); border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.72); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .host {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  padding: 6px 12px; background: var(--ink-850); border: 1px solid var(--line-soft); border-radius: 20px;
}
.topbar .host b { color: var(--text); font-weight: 600; font-family: var(--mono); font-size: 12.5px; }
.topbar .host .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.topbar .grow { flex: 1; }
.menu-toggle { display: none; }

.user-menu { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px;
  border-radius: 22px; border: 1px solid var(--line-soft); background: var(--ink-850);
  cursor: pointer; color: var(--text); font: inherit;
}
.user-btn:hover { background: var(--ink-800); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px; color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.user-btn .uname { font-size: 13px; font-weight: 600; }
.user-btn .chev { width: 14px; height: 14px; color: var(--muted); }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
  background: var(--ink-800); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-pop); padding: 6px; z-index: 40;
  display: none;
}
.dropdown.open { display: block; animation: rise 0.14s ease; }
.dropdown .dd-head { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.dropdown .dd-head .n { font-weight: 650; font-size: 13px; }
.dropdown .dd-head .e { font-size: 11.5px; color: var(--muted-2); }
.dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 6px; background: none; border: none; color: var(--text);
  font: inherit; font-size: 13px; cursor: pointer;
}
.dd-item:hover { background: var(--ink-700); }
.dd-item.danger { color: var(--danger); }
.dd-item svg { width: 15px; height: 15px; }

/* Main / content */
.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: var(--s-6); max-width: 1360px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; gap: var(--s-4); margin-bottom: var(--s-6); flex-wrap: wrap; }
.page-head .titles { min-width: 0; }
.page-head h1 { font-size: 22px; }
.page-head .subtitle { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ============================================================
   Cards / layout
   ============================================================ */
.card {
  background: linear-gradient(180deg, var(--ink-850), var(--ink-900));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: var(--s-5); }
.card-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line-soft); }
.card-head h3 { font-size: 14.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: var(--s-2); }
.card-body { padding: var(--s-5); }

.grid { display: grid; gap: var(--s-4); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* Stat cards */
.stat {
  padding: var(--s-5); position: relative; overflow: hidden;
}
.stat .stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.stat .ico {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent-glow); color: var(--accent);
}
.stat .ico svg { width: 20px; height: 20px; }
.stat .ico.blue { background: rgba(56,189,248,0.14); color: var(--accent-2); }
.stat .ico.amber { background: var(--warn-bg); color: var(--warn); }
.stat .ico.green { background: var(--ok-bg); color: var(--ok); }
.stat .stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); line-height: 1.05; }
.stat .stat-value small { font-size: 15px; color: var(--muted); font-weight: 600; }
.stat .stat-sub { font-size: 12px; color: var(--muted-2); margin-top: 6px; }
.stat .meter { height: 6px; border-radius: 10px; background: var(--ink-700); overflow: hidden; margin-top: 14px; }
.stat .meter > span { display: block; height: 100%; border-radius: 10px; transition: width 0.6s cubic-bezier(0.2,0.7,0.2,1); background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.stat .meter > span.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stat .meter > span.danger { background: linear-gradient(90deg, #ef4444, #f87171); }

/* ============================================================
   Charts
   ============================================================ */
.chart-card .card-head .legend { margin-left: auto; display: flex; gap: var(--s-4); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-item .swatch { width: 10px; height: 10px; border-radius: 3px; }
.chart-canvas-wrap { position: relative; width: 100%; }
.chart-canvas-wrap canvas { display: block; width: 100%; height: auto; }
.chart-now { position: absolute; top: 14px; right: 16px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.chart-now small { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted-2); font-weight: 700; padding: 11px var(--s-4); border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; background: var(--ink-850);
}
table.tbl tbody td { padding: 13px var(--s-4); border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tbody tr { transition: background 0.1s ease; }
table.tbl tbody tr:hover { background: var(--ink-800); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { font-family: var(--mono); font-size: 12.5px; color: var(--muted); text-align: right; white-space: nowrap; }
table.tbl .actions-cell { text-align: right; white-space: nowrap; }
table.tbl .actions-cell .btn { margin-left: 6px; }
.cell-primary { font-weight: 600; color: var(--text-strong); }
.cell-sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.row-name { display: flex; align-items: center; gap: 10px; }
.file-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--ink-750); color: var(--muted); }
.file-ico svg { width: 17px; height: 17px; }
.file-ico.dir { color: var(--accent-2); background: rgba(56,189,248,0.1); }
.name-link { background: none; border: none; font: inherit; color: inherit; cursor: pointer; text-align: left; padding: 0; display: flex; align-items: center; gap: 10px; }
.name-link:hover .cell-primary { color: var(--accent); }

/* ============================================================
   Empty / skeleton / spinner
   ============================================================ */
.empty { text-align: center; padding: 54px var(--s-4); color: var(--muted); }
.empty .empty-ico { width: 54px; height: 54px; margin: 0 auto var(--s-4); border-radius: 14px; display: grid; place-items: center; background: var(--ink-800); border: 1px solid var(--line-soft); color: var(--muted-2); }
.empty .empty-ico svg { width: 26px; height: 26px; }
.empty h3 { font-size: 15px; margin-bottom: 6px; }
.empty p { font-size: 13px; color: var(--muted-2); max-width: 340px; margin: 0 auto var(--s-4); }

.skeleton { position: relative; overflow: hidden; background: var(--ink-800); border-radius: 6px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent); animation: sweep 1.3s infinite; }
@keyframes sweep { 100% { transform: translateX(100%); } }
.sk-row { height: 46px; margin-bottom: 1px; }
.sk-line { height: 12px; border-radius: 5px; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); border-top-color: currentColor; animation: spin 0.7s linear infinite; display: inline-block; }
.spinner.lg { width: 30px; height: 30px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 60px; color: var(--muted); }

/* ============================================================
   Toasts
   ============================================================ */
.toast-root {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px;
  background: var(--ink-800); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  animation: toast-in 0.28s cubic-bezier(0.2,0.7,0.2,1);
}
.toast.leaving { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast .t-ico { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.toast .t-body { flex: 1; min-width: 0; }
.toast .t-title { font-weight: 650; font-size: 13.5px; }
.toast .t-msg { font-size: 12.5px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.toast .t-close { background: none; border: none; color: var(--muted-2); cursor: pointer; padding: 2px; border-radius: 5px; flex: none; }
.toast .t-close:hover { color: var(--text); background: var(--ink-700); }
.toast.success { border-left-color: var(--ok); } .toast.success .t-ico { color: var(--ok); }
.toast.error { border-left-color: var(--danger); } .toast.error .t-ico { color: var(--danger); }
.toast.warning { border-left-color: var(--warn); } .toast.warning .t-ico { color: var(--warn); }
.toast.info { border-left-color: var(--accent-2); } .toast.info .t-ico { color: var(--accent-2); }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 8, 15, 0.66); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: var(--s-6);
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--ink-800), var(--ink-850));
  border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  animation: modal-in 0.24s cubic-bezier(0.2,0.7,0.2,1);
}
.modal.wide { width: min(860px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-5) var(--s-5) var(--s-4); border-bottom: 1px solid var(--line-soft); }
.modal-head .m-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-glow); color: var(--accent); }
.modal-head .m-ico svg { width: 19px; height: 19px; }
.modal-head .m-ico.danger { background: var(--danger-bg); color: var(--danger); }
.modal-head .titles { flex: 1; min-width: 0; }
.modal-head h2 { font-size: 16.5px; }
.modal-head .m-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.modal-close { background: none; border: none; color: var(--muted-2); cursor: pointer; padding: 4px; border-radius: 6px; flex: none; }
.modal-close:hover { color: var(--text); background: var(--ink-700); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: var(--s-5); overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line-soft); }
.modal-foot .grow { flex: 1; }

.confirm-text { font-size: 14px; color: var(--text); line-height: 1.6; }
.confirm-text b { color: var(--text-strong); }
.confirm-text code { font-family: var(--mono); font-size: 12.5px; background: var(--ink-900); padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line-soft); color: var(--accent-2); }

/* ============================================================
   Files breadcrumb
   ============================================================ */
.breadcrumb { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-family: var(--mono); font-size: 13px; }
.breadcrumb button { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 6px; font: inherit; }
.breadcrumb button:hover { background: var(--ink-750); color: var(--text); }
.breadcrumb button:last-child { color: var(--accent); font-weight: 600; }
.breadcrumb .sep { color: var(--muted-2); }

/* Services cards */
.svc-card { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.svc-top { display: flex; align-items: center; gap: 13px; }
.svc-logo { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--ink-750); border: 1px solid var(--line-soft); }
.svc-logo svg { width: 24px; height: 24px; color: var(--accent); }
.svc-meta { flex: 1; min-width: 0; }
.svc-meta .svc-name { font-weight: 650; font-size: 15px; }
.svc-meta .svc-label { font-size: 12px; color: var(--muted-2); }
.svc-actions { display: flex; gap: var(--s-2); }
.svc-actions .btn { flex: 1; }

/* Log viewer */
.log-view {
  font-family: var(--mono); font-size: 12px; line-height: 1.65;
  background: var(--ink-950); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: var(--s-4); max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all;
  color: #b7c5d8;
}
.log-view .ln { display: block; }
.log-view .ln:hover { background: rgba(255,255,255,0.03); }

/* Misc utility */
.muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mb-4 { margin-bottom: var(--s-4); }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--line-soft); margin: var(--s-4) 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); font-family: var(--mono); font-size: 12.5px; }
.pw-strength { height: 4px; border-radius: 4px; background: var(--ink-700); overflow: hidden; margin-top: 6px; }
.pw-strength > span { display: block; height: 100%; width: 0; transition: width 0.3s, background 0.3s; border-radius: 4px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: 264px; height: 100vh;
    transform: translateX(-100%); transition: transform 0.24s cubic-bezier(0.2,0.7,0.2,1);
    box-shadow: var(--shadow-pop);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,0.5); animation: fade 0.18s; }
  .menu-toggle { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--ink-850); color: var(--text); cursor: pointer; }
  .menu-toggle svg { width: 19px; height: 19px; }
  .topbar .host .lbl { display: none; }
  .content { padding: var(--s-4); }
}
@media (max-width: 560px) {
  .user-btn .uname { display: none; }
  .page-head .actions { width: 100%; }
  .chart-now { font-size: 18px; }
}

/* ============================================================
   Identity & Access — additions
   ============================================================ */

/* Login: swappable slot for the 2FA second step */
.login-slot { display: block; }
.code-input {
  font-family: var(--mono); font-size: 20px; letter-spacing: 0.32em;
  text-align: center; font-weight: 600;
}
.code-input::placeholder { letter-spacing: 0.32em; }

/* Neutral pill (2FA off / disabled) */
.pill.neutral-pill { color: var(--neutral); background: var(--neutral-bg); border-color: var(--line); }

/* Role badges — color coded */
.role-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.01em;
  border: 1px solid var(--line); background: var(--neutral-bg); color: var(--neutral);
  white-space: nowrap;
}
.role-badge.role-owner { color: var(--accent); background: var(--accent-glow); border-color: rgba(45,212,191,0.35); }
.role-badge.role-admin { color: var(--accent-2); background: rgba(56,189,248,0.14); border-color: rgba(56,189,248,0.35); }
.role-badge.role-operator { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.role-badge.role-readonly { color: #cbd5e1; background: rgba(148,163,184,0.14); border-color: rgba(148,163,184,0.3); }
.role-badge.role-default { color: var(--neutral); background: var(--neutral-bg); border-color: var(--line); }

/* Inline role <select> inside table rows */
.select-inline { width: auto; min-width: 116px; height: 30px; padding: 4px 26px 4px 10px; font-size: 12.5px; }

/* Chips (scopes / permissions) */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: var(--ink-750); border: 1px solid var(--line-soft); color: var(--muted);
  white-space: nowrap;
}

/* Collapsible card (Roles & Permissions reference) */
.collapse-head { width: 100%; text-align: left; background: none; border: none; cursor: pointer; font: inherit; color: inherit; }
.collapse-head:hover { background: var(--ink-800); }
.collapse-chev { display: inline-grid; place-items: center; color: var(--muted-2); transition: transform 0.18s ease; }
.collapse-chev svg { width: 16px; height: 16px; }
.collapse-chev.open { transform: rotate(180deg); }
.collapse-card.open .collapse-head { border-bottom: 1px solid var(--line-soft); }
.role-ref { padding-bottom: 14px; border-bottom: 1px solid var(--line-soft); }
.role-ref:last-child { padding-bottom: 0; border-bottom: none; }
.role-ref-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

/* Token prefix */
.token-prefix { color: var(--text); }

/* Scope picker (create token) */
.scopes-wrap { display: flex; flex-direction: column; gap: 12px; max-height: 340px; overflow-y: auto; padding: 2px; }
.scope-group { border: 1px solid var(--line-soft); border-radius: var(--r-md); overflow: hidden; background: var(--ink-900); }
.scope-group-head {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: var(--ink-850); border-bottom: 1px solid var(--line-soft); cursor: pointer; user-select: none;
}
.scope-group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.check-item:last-child { border-bottom: none; }
.check-item:hover { background: var(--ink-850); }
.check-item input[type="checkbox"], .scope-group-head input[type="checkbox"] {
  width: 16px; height: 16px; margin-top: 2px; flex: none; accent-color: var(--accent); cursor: pointer;
}
.check-text { min-width: 0; }
.check-title { font-size: 12.5px; color: var(--text); }
.check-desc { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

/* One-time reveal box (token) */
.warn-banner {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; margin-bottom: var(--s-4);
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--r-md);
  color: #fde68a; font-size: 13px; line-height: 1.5;
}
.warn-banner svg { width: 18px; height: 18px; flex: none; color: var(--warn); margin-top: 1px; }
.reveal-box {
  background: var(--ink-950); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px; overflow-x: auto;
}
.reveal-code { font-family: var(--mono); font-size: 13.5px; color: var(--accent); word-break: break-all; white-space: pre-wrap; }

/* Audit filters */
.audit-filters { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.audit-filters .input { height: 36px; }
.audit-filters > .input { width: 130px; }
.filter-field { position: relative; display: flex; align-items: center; }
.filter-field .input { padding-left: 34px; }
.filter-field.grow-2 { flex: 1; min-width: 180px; }
.filter-field.grow-2 .input { width: 100%; }
.filter-ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); display: inline-grid; place-items: center; pointer-events: none; }
.filter-ico svg { width: 15px; height: 15px; }

/* Audit table */
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }
.audit-tbl .caret-cell { width: 34px; text-align: center; padding-left: 8px; padding-right: 0; }
.row-caret { display: inline-grid; place-items: center; color: var(--muted-2); transition: transform 0.16s ease; }
.row-caret svg { width: 15px; height: 15px; }
.row-caret.open { transform: rotate(90deg); color: var(--accent); }
.row-caret.hidden { visibility: hidden; }
.audit-row.clickable { cursor: pointer; }
.audit-row.expanded { background: var(--ink-800); }
.audit-row.expanded td { border-bottom-color: transparent; }
.action-tag {
  font-family: var(--mono); font-size: 11.5px; padding: 2px 8px; border-radius: 6px;
  background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.28); color: var(--accent-2);
  white-space: nowrap;
}
.detail-row td { background: var(--ink-900); padding: 0; }
.detail-inner { padding: var(--s-4) var(--s-5) var(--s-5); }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
@media (max-width: 620px) { .diff-grid { grid-template-columns: 1fr; } }
.diff-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); font-weight: 700; margin-bottom: 6px; }
.code-block {
  margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: #b7c5d8;
  background: var(--ink-950); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-word;
}

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.pager-btns { display: flex; gap: var(--s-2); }

/* Sessions */
.current-row { background: rgba(45,212,191,0.04); }
.pill.accent.this-device { margin-left: 8px; padding: 1px 8px; }

/* Two-factor setup */
.twofa-setup { display: flex; gap: var(--s-6); align-items: flex-start; }
@media (max-width: 620px) { .twofa-setup { flex-direction: column; align-items: stretch; } }
.qr-box { flex: none; background: #ffffff; border-radius: var(--r-md); padding: 12px; line-height: 0; box-shadow: var(--shadow-1); align-self: flex-start; }
.qr-img { display: block; width: 180px; height: 180px; image-rendering: pixelated; }
.twofa-side { flex: 1; min-width: 0; }
.backup-codes {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  background: var(--ink-950); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px;
}
@media (max-width: 460px) { .backup-codes { grid-template-columns: 1fr; } }
.backup-code {
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.06em; text-align: center;
  padding: 7px 6px; border-radius: 6px; background: var(--ink-850); border: 1px solid var(--line-soft); color: var(--text-strong);
}

/* ============================================================
   Multi-tenancy — Platform / Hosting Accounts
   ============================================================ */

/* Customer account badge in the top bar */
.acct-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  padding: 6px 12px; background: var(--accent-glow); border: 1px solid rgba(45, 212, 191, 0.35); border-radius: 20px;
  max-width: 240px;
}
.acct-badge .ico { width: 15px; height: 15px; color: var(--accent); flex: none; display: inline-grid; place-items: center; }
.acct-badge .ico svg { width: 15px; height: 15px; }
.acct-badge b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .acct-badge b { display: none; } .acct-badge { padding: 6px; } }

/* Compact usage meter used in the accounts table */
.usage-cell { min-width: 118px; }
.usage-cell .u-label { font-size: 12px; color: var(--muted); white-space: nowrap; margin-bottom: 5px; }
.umeter { height: 6px; border-radius: 10px; background: var(--ink-700); overflow: hidden; }
.umeter > span {
  display: block; height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.umeter > span.warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.umeter > span.danger { background: linear-gradient(90deg, #ef4444, #f87171); }

/* ============================================================
   Web hosting — Sites table + Manage Site detail
   ============================================================ */

/* Cluster of type badge / SSL tags inside a table cell */
.site-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Reverse-proxy type pill (blue, matching the accent-2 family) */
.pill.type-proxy { color: var(--accent-2); background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.35); }

/* Manage Site: stacked collapsible section cards */
.detail-stack { display: flex; flex-direction: column; gap: var(--s-3); }
.detail-stack .collapse-card { margin-top: 0; }
.detail-stack .collapse-head { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.detail-stack .collapse-card:not(.open) .collapse-head { border-radius: var(--r-lg); }

/* Wrapping row of SSL action buttons */
.ssl-btns { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* Database engine badge (PostgreSQL — blue, matching the accent-2 family) */
.pill.engine-postgres { color: var(--accent-2); background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.35); }

/* Remote-access allowlist editor (per-database) */
.remote-list { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-2); }
.remote-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--ink-750);
}
.remote-row .mono { color: var(--text); }

/* ============================================================
   Backups — tabs, checklists, verify badge
   ============================================================ */

/* Tab bar (Jobs / History / Off-site targets) */
.tabs {
  display: flex; gap: 4px; margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  padding: 10px 14px; margin-bottom: -1px;
  background: none; border: none; border-bottom: 2px solid transparent;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  color: var(--muted); font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap;
  transition: color 0.13s ease, background 0.13s ease, border-color 0.13s ease;
}
.tab svg { width: 16px; height: 16px; flex: none; opacity: 0.85; }
.tab:hover { color: var(--text); background: var(--ink-800); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab.active svg { opacity: 1; }
.tab-panel { display: block; }

/* Scrollable checkbox list (sites / databases picker) */
.bk-checklist {
  max-height: 220px; overflow-y: auto;
  border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--ink-900);
}
.bk-checklist-empty { padding: 14px; color: var(--muted-2); font-size: 12.5px; }

/* Inline verify result badge in the history table */
.bk-verify-badge:not(:empty) { display: inline-block; margin-top: 6px; }

/* ============================================================
   Security — firewall, fail2ban, malware scan, SSH
   ============================================================ */

/* Master-control card (firewall on/off, top of a tab) */
.sec-control { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.sec-control .sec-control-main { display: flex; align-items: center; gap: var(--s-4); min-width: 0; }
.sec-control .sec-control-text { min-width: 0; }
.sec-control .sec-control-text .t { font-weight: 650; font-size: 14.5px; color: var(--text-strong); }
.sec-control .sec-control-text .s { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }
.sec-control .actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }

/* Preset buttons row */
.sec-presets { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* Firewall action pill (no dot) — reuses pill colour tokens */
.pill.plain { padding: 3px 10px; }

/* Malware-scan summary strip */
.sec-scan-summary { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.sec-scan-summary .s-stat { display: inline-flex; align-items: baseline; gap: 6px; }
.sec-scan-summary .s-stat .n { font-size: 18px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.01em; }
.sec-scan-summary .s-stat .l { font-size: 12.5px; color: var(--muted); }

/* Findings code snippet cell */
.sec-snippet {
  font-family: var(--mono); font-size: 12px; line-height: 1.5; color: #dbe4f0;
  background: var(--ink-950); border: 1px solid var(--line-soft); border-radius: 5px;
  padding: 3px 8px; display: inline-block; max-width: 380px;
  overflow-x: auto; white-space: pre; vertical-align: middle;
}

/* Fail2ban jail card */
.sec-jail { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.sec-jail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sec-jail-head .jail-name { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.sec-jail-head .jail-name svg { width: 18px; height: 18px; color: var(--accent); }
.sec-jail-stats { display: flex; gap: var(--s-6); margin-left: auto; }
.sec-jail-stat { text-align: right; }
.sec-jail-stat .n { font-size: 22px; font-weight: 700; color: var(--text-strong); line-height: 1.1; letter-spacing: -0.02em; }
.sec-jail-stat .n.danger { color: var(--danger); }
.sec-jail-stat .l { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }

/* Banned-IP rows (reuses the remote-list visual language) */
.sec-iplist { display: flex; flex-direction: column; gap: var(--s-2); }
.sec-iplist-empty { font-size: 12.5px; color: var(--muted-2); padding: 6px 2px; }

/* ============================================================
   Observability & Automation/DX (additive)
   ============================================================ */

/* Segmented range control (1h / 6h / 24h) */
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--ink-850); border: 1px solid var(--line-soft); border-radius: 8px; }
.seg button { border: none; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 6px; cursor: pointer; transition: background 0.13s ease, color 0.13s ease; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--ink-700); color: var(--accent); }

/* Notifications — top-bar bell + dropdown, and center list */
.notif-wrap { position: relative; }
.notif-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-soft); background: var(--ink-850); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: background 0.13s ease, color 0.13s ease; }
.notif-btn:hover { background: var(--ink-800); color: var(--text); }
.notif-btn svg { width: 18px; height: 18px; }
.notif-badge { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: none; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--ink-900); }
.notif-badge.show { display: flex; }
.notif-dd { width: 344px; max-width: calc(100vw - 32px); padding: 0; }
.notif-dd .notif-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.notif-dd .notif-head h4 { font-size: 13.5px; font-weight: 650; }
.notif-list { max-height: 380px; overflow: auto; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--ink-750); }
.notif-item.unread { background: rgba(45, 212, 191, 0.06); }
.notif-item .lvl-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--neutral); }
.notif-item .lvl-dot.info { background: var(--accent-2); }
.notif-item .lvl-dot.warning { background: var(--warn); }
.notif-item .lvl-dot.critical { background: var(--danger); }
.notif-item .n-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-item .n-msg { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.notif-item .n-time { font-size: 11px; color: var(--muted-2); margin-top: 3px; }
.notif-foot { padding: 8px; border-top: 1px solid var(--line-soft); }
.notif-empty { padding: 30px 14px; text-align: center; color: var(--muted-2); font-size: 12.5px; }

/* API Docs explorer */
.api-list { display: flex; flex-direction: column; }
.api-op { border-top: 1px solid var(--line-soft); }
.api-op:first-child { border-top: none; }
.api-op-head { display: flex; align-items: center; gap: var(--s-3); width: 100%; text-align: left; padding: 12px var(--s-5); background: none; border: none; color: var(--text); font: inherit; cursor: pointer; }
.api-op-head:hover { background: var(--ink-800); }
.api-op-head .api-path { font-size: 12.5px; color: var(--text); }
.api-op-head .api-summary { font-size: 12.5px; color: var(--muted); margin-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-op-head .api-chev { margin-left: auto; color: var(--muted-2); display: inline-flex; transition: transform 0.15s ease; }
.api-op-head .api-chev svg { width: 16px; height: 16px; }
.api-op-head.open .api-chev { transform: rotate(180deg); }
.method-badge { flex: none; font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 5px; text-transform: uppercase; letter-spacing: 0.03em; background: var(--ink-700); color: var(--muted); min-width: 52px; text-align: center; }
.method-badge.m-get { background: rgba(56, 189, 248, 0.14); color: var(--accent-2); }
.method-badge.m-post { background: rgba(52, 211, 153, 0.14); color: var(--ok); }
.method-badge.m-put, .method-badge.m-patch { background: rgba(251, 191, 36, 0.14); color: var(--warn); }
.method-badge.m-delete { background: rgba(248, 113, 113, 0.14); color: var(--danger); }
.api-op-body { padding: 4px var(--s-5) var(--s-5); background: var(--ink-900); }
.api-op-body .api-desc { font-size: 13px; color: var(--muted); margin: 8px 0 12px; }
.api-op-body .api-sub { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); font-weight: 700; margin: 14px 0 8px; }

/* Terminal */
.term-wrap { height: 460px; background: #070b14; border-radius: var(--r-md); padding: 8px; overflow: hidden; }
.term-wrap .xterm { height: 100%; padding: 4px; }
.term-fallback { display: flex; flex-direction: column; height: 100%; }
.term-fallback-out { flex: 1; margin: 0; overflow: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; color: #c9d5e5; white-space: pre-wrap; word-break: break-all; padding: 8px 10px; }
.term-fallback-form { border-top: 1px solid var(--line-soft); padding: 8px; }
.term-fallback-form .input { background: var(--ink-950); }

/* Code editor (overlay: highlighted <pre> behind a transparent <textarea>) */
.code-editor { position: relative; height: 440px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--ink-950); }
.code-editor .ce-pre, .code-editor .ce-ta {
  margin: 0; position: absolute; inset: 0; padding: 12px 14px; border: 0;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; tab-size: 2;
  white-space: pre; overflow: auto; box-sizing: border-box;
}
.code-editor .ce-pre { z-index: 1; color: #b7c5d8; pointer-events: none; }
.code-editor .ce-pre .ce-code { display: block; min-height: 100%; }
.code-editor .ce-ta { z-index: 2; background: transparent; color: transparent; caret-color: var(--accent); resize: none; outline: none; }
.code-editor .ce-ta::selection { background: rgba(45, 212, 191, 0.25); }
.ce-code .tok-str { color: #7ee787; }
.ce-code .tok-com { color: #6b7c94; font-style: italic; }
.ce-code .tok-kw { color: #58b6ff; }
.ce-code .tok-num { color: #f0a45d; }
.ce-code .tok-tag { color: #7ee787; }

/* File manager — selection column + chmod grid */
table.tbl th.sel-cell, table.tbl td.sel-cell { width: 34px; text-align: center; padding-left: 12px; padding-right: 0; }
table.tbl td.sel-cell input, table.tbl th.sel-cell input { cursor: pointer; }
.chmod-grid { display: grid; grid-template-columns: auto repeat(3, 1fr); gap: 8px 14px; align-items: center; margin-top: 4px; max-width: 280px; }
.chmod-grid .chmod-h { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.05em; }
.chmod-grid .chmod-row-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.chmod-grid .chmod-cell { display: grid; place-items: center; cursor: pointer; }

/* ============================================================
   DNS / Mail / Branding — additive
   ============================================================ */

/* Cloudflare "proxied" record pill (orange, distinct from the status colours) */
.pill.proxied { color: #f6821f; background: rgba(246, 130, 31, 0.12); border-color: rgba(246, 130, 31, 0.4); }

/* Branding — colour swatch inputs + live preview chip */
.color-swatch {
  width: 46px; height: 34px; padding: 2px; flex: none;
  background: var(--ink-900); border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer;
}
.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.color-swatch::-webkit-color-swatch { border: none; border-radius: 5px; }
.color-swatch::-moz-color-swatch { border: none; border-radius: 5px; }
.brand-preview {
  display: inline-flex; align-items: center; gap: 11px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
}
.brand-preview .mark { display: inline-grid; place-items: center; }
.brand-preview .word { font-weight: 700; letter-spacing: -0.02em; color: var(--text-strong); }
.brand-preview .word b { color: var(--accent); }

/* ============================================================
   Light theme — maps the dark tokens to light equivalents.
   Default stays dark; toggled via <html data-theme="light">.
   ============================================================ */
:root[data-theme="light"] {
  --ink-950: #eef2f7;
  --ink-900: #ffffff;
  --ink-850: #ffffff;
  --ink-800: #f1f5f9;
  --ink-750: #e9eef4;
  --ink-700: #e4e9f0;
  --ink-600: #cbd5e1;
  --ink-500: #94a3b8;
  --line: #d8e0ea;
  --line-soft: #e7ecf3;

  --text: #1e293b;
  --text-strong: #0b1220;
  --muted: #55657a;
  --muted-2: #7a8aa0;

  --accent-glow: rgba(45, 212, 191, 0.16);

  --ok-bg: rgba(16, 163, 127, 0.1);
  --ok-line: rgba(16, 163, 127, 0.3);
  --danger-bg: rgba(220, 38, 38, 0.1);
  --danger-line: rgba(220, 38, 38, 0.3);
  --warn-bg: rgba(217, 119, 6, 0.12);
  --warn-line: rgba(217, 119, 6, 0.32);
  --neutral-bg: rgba(100, 116, 139, 0.12);

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow-2: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
  --shadow-pop: 0 24px 60px -20px rgba(15, 23, 42, 0.22);
}
/* Slightly deepen status text colours for contrast on light surfaces */
:root[data-theme="light"] { --ok: #0f9d76; --danger: #dc2626; --warn: #b45309; --neutral: #64748b; }

/* Page background gradient tint for light mode */
:root[data-theme="light"] body {
  background:
    radial-gradient(1200px 600px at 78% -8%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(900px 500px at 2% 6%, rgba(45, 212, 191, 0.10), transparent 55%),
    var(--ink-950);
}
/* Components with hard-coded dark values need explicit light overrides */
:root[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.82); }
:root[data-theme="light"] .login-error { color: var(--danger); }
:root[data-theme="light"] .warn-banner { color: #92580a; }
:root[data-theme="light"] .log-view { color: #334155; }
:root[data-theme="light"] .code-block,
:root[data-theme="light"] .sec-snippet { color: #334155; }
:root[data-theme="light"] .pill .dot { box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03); }
:root[data-theme="light"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(15, 23, 42, 0.06), transparent); }
:root[data-theme="light"] * { scrollbar-color: #c2ccd8 transparent; }
/* Terminal + code editor stay dark surfaces for readability */
:root[data-theme="light"] .code-editor .ce-pre { color: #b7c5d8; }
