/* ==========================================================================
   天赢德州 4.0 · 独立管理控制台 Design System
   Tailwind CSS Showcase (Linear / Vercel / Stripe / Catalyst) × Deep Navy Pro
   Zero external CDN · Flagship Light & Obsidian Dark Modes
   ========================================================================== */

:root {
  color-scheme: light;
  /* Core Surfaces */
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f1f5f9;
  --surface-glass: rgba(255, 255, 255, 0.84);
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-subtle: #f1f5f9;

  /* Sidebar (Deep Navy Signature) */
  --nav-bg: #0b1120;
  --nav-bg-elev: #111a2e;
  --nav-border: rgba(148, 163, 184, 0.12);
  --nav-text: #cbd5e1;
  --nav-muted: #64748b;
  --nav-hover: rgba(148, 163, 184, 0.10);
  --nav-active-bg: linear-gradient(90deg, rgba(99, 102, 241, 0.22) 0%, rgba(56, 189, 248, 0.10) 100%);
  --nav-active-border: rgba(129, 140, 248, 0.34);
  --nav-active-text: #ffffff;
  --nav-accent: #6366f1;

  /* Typography */
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --subtle: #94a3b8;

  /* Brand & Semantic Palette */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef2ff;
  --primary-border: #c7d2fe;

  --emerald: #059669;
  --emerald-bright: #10b981;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;

  --sky: #0284c7;
  --sky-bright: #0ea5e9;
  --sky-soft: #f0f9ff;
  --sky-border: #bae6fd;

  --amber: #d97706;
  --amber-bright: #f59e0b;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --rose: #e11d48;
  --rose-bright: #f43f5e;
  --rose-soft: #fff1f2;
  --rose-border: #fecdd3;

  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --violet-border: #ddd6fe;

  /* Shadows & Radii */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.025);
  --shadow-card-hover: 0 4px 12px rgba(15, 23, 42, 0.06), 0 12px 28px rgba(15, 23, 42, 0.05);
  --shadow-pop: 0 16px 40px rgba(15, 23, 42, 0.14), 0 2px 8px rgba(15, 23, 42, 0.06);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;

  /* Charts (Evil Charts Light Tokens) */
  --chart-grid: rgba(148, 163, 184, 0.22);
  --chart-dot-grid: rgba(100, 116, 139, 0.22);
  --chart-axis: #64748b;
  --chart-crosshair: rgba(99, 102, 241, 0.45);
  --chart-crosshair-color: #6366f1;
  --chart-glow-opacity: 0.22;
  --chart-glow-secondary: 0.14;
  --chart-bar-track: rgba(148, 163, 184, 0.10);
  --chart-tooltip-bg: rgba(15, 23, 42, 0.84);
  --chart-tooltip-border: rgba(148, 163, 184, 0.24);
  --chart-tooltip-text: #f8fafc;
  --chart-empty-bg: rgba(248, 250, 252, 0.78);
  --chart-empty-pill-bg: rgba(255, 255, 255, 0.90);
  --chart-empty-pill-border: rgba(148, 163, 184, 0.30);

  /* Font Stacks */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

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

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090c12;
  --bg-subtle: #0d121c;
  --surface: #111622;
  --surface-2: #161d2d;
  --surface-hover: #1c2538;
  --surface-glass: rgba(17, 22, 34, 0.82);
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --border-subtle: rgba(148, 163, 184, 0.07);

  --nav-bg: #060910;
  --nav-bg-elev: #0d1322;
  --nav-border: rgba(148, 163, 184, 0.10);
  --nav-text: #cbd5e1;
  --nav-muted: #64748b;
  --nav-hover: rgba(148, 163, 184, 0.09);
  --nav-active-bg: linear-gradient(90deg, rgba(99, 102, 241, 0.25) 0%, rgba(16, 185, 129, 0.10) 100%);
  --nav-active-border: rgba(129, 140, 248, 0.36);

  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --subtle: #64748b;

  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-soft: rgba(99, 102, 241, 0.15);
  --primary-border: rgba(129, 140, 248, 0.30);

  --emerald: #34d399;
  --emerald-bright: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --emerald-border: rgba(52, 211, 153, 0.28);

  --sky: #38bdf8;
  --sky-bright: #0ea5e9;
  --sky-soft: rgba(14, 165, 233, 0.14);
  --sky-border: rgba(56, 189, 248, 0.28);

  --amber: #fbbf24;
  --amber-bright: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --amber-border: rgba(251, 191, 36, 0.28);

  --rose: #fb7185;
  --rose-bright: #f43f5e;
  --rose-soft: rgba(244, 63, 94, 0.14);
  --rose-border: rgba(251, 113, 133, 0.30);

  --violet: #a78bfa;
  --violet-soft: rgba(139, 92, 246, 0.15);
  --violet-border: rgba(167, 139, 250, 0.30);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-card-hover: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(129, 140, 248, 0.18);
  --shadow-pop: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(148, 163, 184, 0.14);

  /* Charts (Evil Charts Obsidian Dark Tokens) */
  --chart-grid: rgba(148, 163, 184, 0.11);
  --chart-dot-grid: rgba(148, 163, 184, 0.16);
  --chart-axis: #94a3b8;
  --chart-crosshair: rgba(129, 140, 248, 0.58);
  --chart-crosshair-color: #818cf8;
  --chart-glow-opacity: 0.62;
  --chart-glow-secondary: 0.42;
  --chart-bar-track: rgba(148, 163, 184, 0.07);
  --chart-tooltip-bg: rgba(9, 13, 24, 0.84);
  --chart-tooltip-border: rgba(148, 163, 184, 0.22);
  --chart-empty-bg: rgba(15, 23, 42, 0.36);
  --chart-empty-pill-bg: rgba(17, 24, 39, 0.84);
  --chart-empty-pill-border: rgba(148, 163, 184, 0.22);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--font-mono); font-size: 12.5px; }
.num, .kpi-value, td.num, th.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Subtle custom scrollbars */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.28); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.45); }

/* ==========================================================================
   Login View (Tailwind Showcase Architectural Grid + Glass Card)
   ========================================================================== */
.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
  overflow: hidden;
  background: #070b14;
  color: #f8fafc;
}

.login-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse 75% 65% at 50% 42%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 42%, #000 35%, transparent 100%);
  pointer-events: none;
}

.login-aurora {
  position: absolute;
  width: 680px;
  height: 440px;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 30% 45%, rgba(99, 102, 241, 0.28), transparent 58%),
    radial-gradient(circle at 72% 40%, rgba(16, 185, 129, 0.20), transparent 55%),
    radial-gradient(circle at 52% 72%, rgba(56, 189, 248, 0.16), transparent 60%);
  filter: blur(42px);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 432px;
  background: rgba(15, 22, 37, 0.82);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 20px;
  padding: 34px 32px 28px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.login-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(129, 140, 248, 0.85), rgba(52, 211, 153, 0.7), transparent);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.brand-emblem {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 55%, #10b981 100%);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.42), inset 0 1px 1px rgba(255, 255, 255, 0.32);
  color: #ffffff;
}

.brand-emblem-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 0 18px rgba(99, 102, 241, 0.34), inset 0 1px 1px rgba(255, 255, 255, 0.28);
}

.login-brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #ffffff;
  line-height: 1.25;
}

.login-brand p {
  font-size: 12.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.login-card .field label {
  color: #cbd5e1;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 6px;
}

.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrap .input-ico {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: #64748b;
  pointer-events: none;
}

.login-card .field input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 38px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(9, 13, 24, 0.72);
  color: #f8fafc;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

.login-card .field input::placeholder { color: #64748b; }
.login-card .field input:focus {
  border-color: #818cf8;
  background: rgba(9, 13, 24, 0.95);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
  outline: none;
}

.login-card .field input.totp-input {
  padding-left: 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.44em;
  font-variant-numeric: tabular-nums;
}

.login-err {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.14);
  border: 1px solid rgba(251, 113, 133, 0.35);
  color: #fda4af;
  font-size: 13px;
  font-weight: 500;
}

.login-submit {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14.5px;
  color: #ffffff;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 55%, #0ea5e9 100%);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.14s, filter 0.14s, box-shadow 0.14s;
}

.login-submit:hover {
  filter: brightness(1.07);
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.login-submit:active { transform: translateY(1px); }

.login-trust {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.login-trust-item {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.35;
}

.login-trust-item strong {
  display: block;
  color: #e2e8f0;
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 2px;
}

/* ==========================================================================
   App Shell (Sidebar + Sticky Glass Topbar + Porcelain Workspace)
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.56);
  backdrop-filter: blur(3px);
  z-index: 65;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
  color: var(--nav-text);
  z-index: 70;
  overflow: hidden;
}

.sidebar::before {
  content: "";
  position: absolute;
  top: -70px;
  left: -40px;
  width: 240px;
  height: 180px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.20), transparent 70%);
  pointer-events: none;
}

.sidebar-brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 15px;
  border-bottom: 1px solid var(--nav-border);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  color: #fff;
  cursor: pointer;
}

.sidebar-brand-title {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.25;
}

.sidebar-brand-sub {
  display: block;
  font-size: 11px;
  color: #8b9bb8;
  letter-spacing: 0.03em;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 14px;
}

.nav-group { margin-bottom: 14px; }
.nav-group:last-child { margin-bottom: 0; }

.nav-group-label {
  padding: 4px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.nav-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8.5px 11px;
  margin-bottom: 2px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: #b7c5dd;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #7c90b2;
  transition: color 0.14s;
}

.nav-item:hover {
  background: var(--nav-hover);
  color: #ffffff;
}

.nav-item:hover svg { color: #cbd5e1; }

.nav-item.active {
  background: var(--nav-active-bg);
  border-color: var(--nav-active-border);
  color: var(--nav-active-text);
  font-weight: 600;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #818cf8 0%, #38bdf8 100%);
}

.nav-item.active svg { color: #a5b4fc; }

.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(244, 63, 94, 0.22);
  color: #fda4af;
  border: 1px solid rgba(251, 113, 133, 0.30);
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--nav-border);
  background: rgba(2, 6, 23, 0.32);
}

.admin-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #e0e7ff;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.38), rgba(14, 165, 233, 0.30));
  border: 1px solid rgba(129, 140, 248, 0.32);
  flex-shrink: 0;
}

.admin-meta { min-width: 0; flex: 1; }
.admin-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-role {
  font-size: 11px;
  color: #8b9bb8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-security-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.09);
  font-size: 11px;
  color: #64748b;
}

.sidebar-security-note svg { width: 13px; height: 13px; color: #10b981; flex-shrink: 0; }

/* Workspace & Topbar */
.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 80% 340px at 50% -140px, rgba(99, 102, 241, 0.05), transparent 72%),
    var(--bg);
}

[data-theme="dark"] .workspace {
  background:
    radial-gradient(ellipse 75% 360px at 50% -120px, rgba(99, 102, 241, 0.09), transparent 70%),
    var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--topbar-h);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}

.cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}

.cmd-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface);
}

.cmd-trigger svg { width: 15px; height: 15px; }

.kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
}

/* Topbar Status Pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.status-pill.tone-ok {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
  color: var(--emerald);
}

.status-pill.tone-warn {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}

.status-pill.tone-danger {
  background: var(--rose-soft);
  border-color: var(--rose-border);
  color: var(--rose);
}

.status-pill.tone-info {
  background: var(--sky-soft);
  border-color: var(--sky-border);
  color: var(--sky);
}

.pulse-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pulse-dot.live::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: pulseRing 2s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

@keyframes pulseRing {
  0% { transform: scale(0.8); opacity: 0.55; }
  75% { transform: scale(2.1); opacity: 0; }
  100% { transform: scale(2.1); opacity: 0; }
}

.auto-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.auto-toggle input { accent-color: var(--primary); margin: 0; cursor: pointer; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.spinning svg { animation: spin360 0.7s linear infinite; }
@keyframes spin360 { to { transform: rotate(360deg); } }

.mobile-only { display: none; }

/* Main Content Container */
.page-content {
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px 28px 44px;
}

/* ==========================================================================
   Page Header, Cards, Grids & Surfaces
   ========================================================================== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-subtitle {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Grids */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-asym { grid-template-columns: minmax(0, 1.38fr) minmax(0, 1fr); }
.grid-asym-rev { grid-template-columns: minmax(0, 1fr) minmax(0, 1.38fr); }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }

/* Card */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  min-width: 0;
  transition: border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.card:hover {
  border-color: var(--border-strong);
}

[data-theme="dark"] .card {
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

[data-theme="dark"] .card:hover {
  box-shadow: var(--shadow-card-hover), inset 0 1px 0 rgba(255, 255, 255, 0.075);
}

.card-pad { padding: 18px 20px; }

.card-danger {
  border-color: var(--rose-border);
  background: linear-gradient(180deg, var(--rose-soft) 0%, var(--surface) 45%);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  flex-wrap: wrap;
}

.card-head-border {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.card-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.card-body { padding: 0 20px 18px; }
.card-body-pad { padding: 16px 20px 18px; }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 20px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12.5px;
  color: var(--muted);
}

/* KPI Metric Cards */
.kpi-card {
  position: relative;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  min-width: 0;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.2s;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
}

[data-theme="dark"] .kpi-card {
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

[data-theme="dark"] .kpi-card:hover {
  box-shadow: var(--shadow-card-hover), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.kpi-card.kpi-alert {
  border-color: var(--rose-border);
  background: linear-gradient(160deg, var(--rose-soft) 0%, var(--surface) 58%);
}

.kpi-main-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.kpi-main-row .kpi-value {
  margin-top: 0;
  min-width: 0;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi-label-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.metric-icon svg { width: 18px; height: 18px; }
.metric-icon.indigo { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }
.metric-icon.emerald { background: var(--emerald-soft); color: var(--emerald); border-color: var(--emerald-border); }
.metric-icon.sky { background: var(--sky-soft); color: var(--sky); border-color: var(--sky-border); }
.metric-icon.amber { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-border); }
.metric-icon.rose { background: var(--rose-soft); color: var(--rose); border-color: var(--rose-border); }
.metric-icon.violet { background: var(--violet-soft); color: var(--violet); border-color: var(--violet-border); }

.kpi-label {
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
}

.kpi-value {
  margin-top: 12px;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
}

.kpi-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 5px;
  letter-spacing: 0;
}

.kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons, Badges, Segmented Controls & Banners
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, color 0.14s, box-shadow 0.14s;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #ffffff; }

.btn-emerald {
  background: var(--emerald-bright);
  border-color: var(--emerald-bright);
  color: #ffffff;
}
.btn-emerald:hover { filter: brightness(1.06); }

.btn-danger {
  background: var(--rose-bright);
  border-color: var(--rose-bright);
  color: #ffffff;
}
.btn-danger:hover { filter: brightness(1.06); }

.btn-danger-soft {
  background: var(--rose-soft);
  border-color: var(--rose-border);
  color: var(--rose);
}
.btn-danger-soft:hover { background: var(--rose-bright); border-color: var(--rose-bright); color: #ffffff; }

.btn-warn-soft {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}
.btn-warn-soft:hover { filter: brightness(0.97); }

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-hover); border-color: transparent; }

.btn-link {
  border: none;
  background: transparent;
  padding: 2px 4px;
  height: auto;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
}
.btn-link:hover { text-decoration: underline; background: transparent; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 6px; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.4;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}

.badge-ok { background: var(--emerald-soft); border-color: var(--emerald-border); color: var(--emerald); }
.badge-warn { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.badge-danger { background: var(--rose-soft); border-color: var(--rose-border); color: var(--rose); }
.badge-info { background: var(--sky-soft); border-color: var(--sky-border); color: var(--sky); }
.badge-indigo { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.badge-violet { background: var(--violet-soft); border-color: var(--violet-border); color: var(--violet); }

/* Segmented Control (Stripe / Catalyst style) */
.seg-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}

.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Sub Tabs (Finance / Tables / Risk) */
.sub-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  overflow-x: auto;
}

.sub-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.14s;
}

.sub-tab:hover { color: var(--text); }
.sub-tab.active { color: var(--primary); }
.sub-tab.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
}

/* Graceful Callout Banner */
.callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 16px;
  font-size: 13px;
}

.callout-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.callout-warn {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--text);
}
.callout-warn .callout-icon { color: var(--amber); }

.callout-info {
  background: var(--sky-soft);
  border-color: var(--sky-border);
  color: var(--text);
}
.callout-info .callout-icon { color: var(--sky); }

.callout-ok {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
  color: var(--text);
}
.callout-ok .callout-icon { color: var(--emerald); }

.callout-danger {
  background: var(--rose-soft);
  border-color: var(--rose-border);
  color: var(--text);
}
.callout-danger .callout-icon { color: var(--rose); }

.callout-title { font-weight: 650; margin-bottom: 2px; }
.callout-desc { font-size: 12.5px; color: var(--muted); }

/* ==========================================================================
   Charts & Gauges (Evil Charts Flagship Glass, Patterns, Glow & Motion)
   ========================================================================== */
.chart-stage {
  position: relative;
  width: 100%;
  min-height: 180px;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ec-legend-interactive {
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.ec-legend-interactive:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

/* Evil Charts Glassmorphic Floating Tooltip */
.chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 20;
  min-width: 174px;
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--chart-tooltip-bg);
  border: 1px solid var(--chart-tooltip-border);
  backdrop-filter: blur(16px) saturate(165%);
  -webkit-backdrop-filter: blur(16px) saturate(165%);
  color: var(--chart-tooltip-text);
  font-size: 12px;
  box-shadow:
    0 18px 40px rgba(2, 6, 23, 0.36),
    0 3px 10px rgba(2, 6, 23, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: opacity 0.14s ease, transform 90ms cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
  will-change: transform, opacity;
}

.chart-tooltip.visible { opacity: 1; }

.chart-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.chart-tooltip-title {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  font-family: var(--font-mono);
}

.chart-tooltip-idx {
  font-size: 10px;
  color: #94a3b8;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.chart-tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 4px;
}

.chart-tooltip-row:first-of-type { margin-top: 0; }

.chart-tooltip-divider {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.chart-tooltip-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
  white-space: nowrap;
}

.chart-tooltip-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chart-tooltip-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
}

/* Relative Delta Badges inside Glass Tooltip */
.ec-delta {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.ec-delta-up {
  background: rgba(16, 185, 129, 0.20);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.30);
}

.ec-delta-down {
  background: rgba(244, 63, 94, 0.22);
  color: #fda4af;
  border: 1px solid rgba(251, 113, 133, 0.32);
}

.ec-delta-flat {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.24);
}

/* Area Chart Glow, Magnetic Crosshair & Multi-Series Focus */
.ec-dot-grid {
  pointer-events: none;
}

.ec-line-glow {
  opacity: var(--chart-glow-secondary);
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.ec-line-glow.is-primary {
  opacity: var(--chart-glow-opacity);
}

.ec-series-area,
.ec-series-line,
.ec-pulse-group {
  transition: opacity 0.2s ease;
}

.ec-area-svg.is-series-focus .ec-series-area:not(.is-focus),
.ec-area-svg.is-series-focus .ec-series-line:not(.is-focus),
.ec-area-svg.is-series-focus .ec-pulse-group:not(.is-focus) {
  opacity: 0.22;
}

.ec-pulse-enter {
  animation: ecPulseEnter 0.42s cubic-bezier(0.22, 1, 0.36, 1) 0.56s both;
}

@keyframes ecPulseEnter {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ch-crosshair {
  pointer-events: none;
  transition: transform 85ms cubic-bezier(0.22, 1, 0.36, 1), opacity 130ms ease;
}

.ch-hdot-group {
  pointer-events: none;
  transition: transform 85ms cubic-bezier(0.22, 1, 0.36, 1), opacity 130ms ease;
}

/* Grouped Bar Chart Spring Rise & Spotlight */
.gbar-col {
  transition: opacity 170ms ease, filter 170ms ease;
}

.ec-bar-shape,
.ec-bar-sheen {
  pointer-events: none;
  transition: filter 170ms ease;
}

.ec-bar-grow {
  transform-origin: 0 0;
  animation: ecBarRise 0.58s cubic-bezier(0.34, 1.28, 0.64, 1) var(--ec-delay, 0ms) both;
}

@keyframes ecBarRise {
  0% { transform: scaleY(0); opacity: 0.35; }
  100% { transform: scaleY(1); opacity: 1; }
}

.ec-gbar-svg.is-hovering .gbar-col:not(.is-active) {
  opacity: 0.38;
}

.ec-gbar-svg.is-hovering .gbar-col.is-active .ec-bar-a {
  filter: brightness(1.09) drop-shadow(0 0 8px rgba(16, 185, 129, 0.36));
}

.ec-gbar-svg.is-hovering .gbar-col.is-active .ec-bar-b {
  filter: brightness(1.09) drop-shadow(0 0 8px rgba(244, 63, 94, 0.36));
}

[data-theme="dark"] .ec-gbar-svg.is-hovering .gbar-col.is-active .ec-bar-a {
  filter: brightness(1.14) drop-shadow(0 0 11px rgba(16, 185, 129, 0.52));
}

[data-theme="dark"] .ec-gbar-svg.is-hovering .gbar-col.is-active .ec-bar-b {
  filter: brightness(1.14) drop-shadow(0 0 11px rgba(244, 63, 94, 0.52));
}

/* KPI Mini Sparkline */
.ec-sparkline {
  flex-shrink: 0;
  display: inline-flex;
  align-items: flex-end;
  justify-content: flex-end;
  line-height: 0;
}

.ec-sparkline svg {
  display: block;
  overflow: visible;
}

.ec-spark-glow {
  opacity: var(--chart-glow-opacity);
}

.ec-spark-draw {
  stroke-dasharray: var(--ec-spark-len, 150px);
  stroke-dashoffset: var(--ec-spark-len, 150px);
  animation: ecSparkDraw 0.78s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes ecSparkDraw {
  from { stroke-dashoffset: var(--ec-spark-len, 150px); }
  to { stroke-dashoffset: 0; }
}

.ec-spark-fade {
  animation: ecSparkFade 0.7s ease-out 0.14s both;
}

@keyframes ecSparkFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Graceful Dotted Empty Chart Frame */
.ec-empty-frame {
  position: relative;
  width: 100%;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  background: var(--chart-empty-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ec-empty-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ec-empty-pill {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--chart-empty-pill-bg);
  border: 1px solid var(--chart-empty-pill-border);
  backdrop-filter: blur(12px) saturate(145%);
  -webkit-backdrop-filter: blur(12px) saturate(145%);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
}

.ec-empty-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.55);
  animation: ecDotBreath 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

.ec-empty-sub {
  font-size: 11.5px;
  color: var(--muted);
}

/* Live chart stats strip */
.chart-stat-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.chart-stat-pill {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.chart-stat-pill span { font-size: 12px; color: var(--muted); }
.chart-stat-pill strong { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 4 Compact Radial Gauges inside Server Stress Card */
.gauge-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.gauge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px 9px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  text-align: center;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.gauge-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.gauge-ring { width: 78px; height: 78px; display: block; overflow: visible; }

.ec-gauge-arc {
  filter: drop-shadow(0 0 4px var(--ec-glow, rgba(16, 185, 129, 0.32)));
  transition: stroke-dashoffset 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .ec-gauge-arc {
  filter: drop-shadow(0 0 8px var(--ec-glow, rgba(16, 185, 129, 0.50)));
}

.ec-gauge-anim {
  animation: ecGaugeSweep 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ecGaugeSweep {
  from { stroke-dashoffset: var(--ec-circ); }
  to { stroke-dashoffset: var(--ec-offset); }
}

.gauge-label {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
}

.ec-gauge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: ecDotBreath 2.4s ease-in-out infinite;
}

@keyframes ecDotBreath {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.84); }
}

.gauge-sub { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 1px; }

/* Horizontal Bars (Evil Charts Hatched Sheen & Hover Spotlight) */
.hbar-list { display: grid; gap: 6px; }
.hbar-row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) 86px;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 9px;
  font-size: 12.5px;
  cursor: pointer;
  transition: opacity 0.16s ease, background 0.16s ease;
}

.hbar-list:hover .hbar-row:not(:hover) {
  opacity: 0.48;
}

.hbar-row:hover {
  background: var(--surface-2);
}

.hbar-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
  font-weight: 550;
}
.hbar-name small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}
.hbar-track {
  height: 11px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}
.hbar-fill {
  position: relative;
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4f46e5 0%, #38bdf8 100%);
  transform-origin: left center;
  transition: width 0.38s cubic-bezier(0.22, 1, 0.36, 1), filter 0.18s ease;
  overflow: hidden;
}

.hbar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.22) 0px,
    rgba(255, 255, 255, 0.22) 2px,
    transparent 2px,
    transparent 7px
  );
  pointer-events: none;
}

.hbar-row:hover .hbar-fill {
  filter: brightness(1.08);
}

.ec-hbar-anim {
  animation: ecHbarGrow 0.62s cubic-bezier(0.22, 1, 0.36, 1) var(--ec-delay, 0ms) both;
}

@keyframes ecHbarGrow {
  from { transform: scaleX(0); opacity: 0.4; }
  to { transform: scaleX(1); opacity: 1; }
}

.hbar-val {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.hbar-unit {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* Donut Layout (Bidirectional Glow & Live Center) */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.donut-svg-box { flex: 0 0 160px; }

.ec-donut-svg {
  display: block;
  overflow: visible;
}

.donut-seg {
  cursor: pointer;
  transition: stroke-width 170ms cubic-bezier(0.22, 1, 0.36, 1), opacity 170ms ease, filter 170ms ease;
}

.ec-donut-svg.is-hovering .donut-seg:not(.is-active) {
  opacity: 0.35;
}

.ec-donut-svg .donut-seg.is-active {
  filter: drop-shadow(0 0 8px var(--ec-seg-glow, rgba(99, 102, 241, 0.5)));
}

.ec-donut-center-title,
.ec-donut-center-val,
.ec-donut-center-sub {
  transition: fill 160ms ease;
  pointer-events: none;
}

.donut-legend {
  flex: 1;
  min-width: 170px;
  display: grid;
  gap: 4px;
}

.donut-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  margin: 0 -9px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 12.5px;
  cursor: pointer;
  transition: opacity 160ms ease, background 160ms ease, border-color 160ms ease;
}

.donut-legend.is-hovering .donut-legend-row:not(.is-active) {
  opacity: 0.45;
}

.donut-legend-row.is-active,
.donut-legend-row:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.donut-legend-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  min-width: 0;
}
.donut-legend-right {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.donut-legend-pct {
  color: var(--muted);
  font-weight: 500;
}

/* Dual-color Progress Bar (ui2 Funds Overview) */
.funds-total {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 10px;
}
.dual-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-subtle);
  display: flex;
  overflow: hidden;
  gap: 2px;
}
.dual-bar-a { background: linear-gradient(90deg, #4f46e5, #6366f1); border-radius: 999px 0 0 999px; }
.dual-bar-b { background: linear-gradient(90deg, #10b981, #34d399); }
.dual-bar-c { background: linear-gradient(90deg, #f59e0b, #fbbf24); border-radius: 0 999px 999px 0; }

.funds-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.funds-bucket span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
}
.funds-bucket strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Module Health Matrix */
.health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}
.health-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}
.health-item-name { color: var(--text-2); font-weight: 550; }

/* ==========================================================================
   Tables & Toolbars
   ========================================================================== */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 20px 14px;
}

.input, .select, .textarea {
  height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.14s, box-shadow 0.14s, background 0.14s;
}
.textarea { height: auto; padding: 9px 11px; min-height: 76px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--surface-2);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text);
}

thead th:first-child, tbody td:first-child { padding-left: 20px; }
thead th:last-child, tbody td:last-child { padding-right: 20px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-hover); }
tbody tr.clickable { cursor: pointer; }
tbody tr.row-large td { background: var(--amber-soft); }
tbody tr.row-flash td { animation: rowPulse 2s ease; }
@keyframes rowPulse {
  0% { background: rgba(16, 185, 129, 0.24); }
  100% { background: transparent; }
}

th.right, td.right { text-align: right; }

.cell-sub {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty-state svg {
  width: 34px;
  height: 34px;
  margin: 0 auto 8px;
  display: block;
  opacity: 0.45;
}

/* Risk Score Bar */
.risk-score-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 82px;
}
.risk-score-bar {
  width: 48px;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.risk-score-fill { display: block; height: 100%; border-radius: 999px; }

/* ==========================================================================
   Form Fields & Setting Cards
   ========================================================================== */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}
.field-hint {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
}

.switch-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   Visual Poker Table Observer (Green Felt Top-Down Graphic)
   ========================================================================== */
.poker-shield-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 11px;
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  color: var(--emerald);
  font-size: 12.5px;
  font-weight: 650;
  margin-bottom: 16px;
}

.poker-arena {
  position: relative;
  width: 100%;
  height: 390px;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 45%, #162235 0%, #090e19 100%);
  border: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
  margin-bottom: 14px;
}

.poker-felt-outer {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  height: 60%;
  border-radius: 999px;
  background: linear-gradient(180deg, #3c2718 0%, #24160c 100%);
  padding: 12px;
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.55),
    inset 0 2px 3px rgba(255, 224, 178, 0.20);
}

.poker-felt-inner {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: radial-gradient(ellipse at 50% 42%, #136e4b 0%, #0b4a33 58%, #073323 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
}

.poker-pot-pill {
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.56);
  border: 1px solid rgba(251, 191, 36, 0.40);
  color: #fde68a;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.poker-board-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pcard {
  width: 34px;
  height: 48px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.05;
  color: #0f172a;
}

.pcard.red { color: #dc2626; }
.pcard.empty {
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

.pcard.back {
  width: 22px;
  height: 30px;
  font-size: 10px;
  background: linear-gradient(135deg, #1e293b 0%, #312e81 100%);
  border: 1px solid rgba(165, 180, 252, 0.45);
  color: #a5b4fc;
}

.poker-seat-pod {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 118px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.90);
  border: 1px solid rgba(148, 163, 184, 0.26);
  color: #f8fafc;
  font-size: 11px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.poker-seat-pod.empty {
  background: rgba(15, 23, 42, 0.48);
  border-style: dashed;
  color: #64748b;
}

.poker-seat-pod.folded { opacity: 0.56; }
.poker-seat-pod.allin { border-color: #fbbf24; box-shadow: 0 0 14px rgba(251, 191, 36, 0.35); }

.seat-nick {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-stack {
  color: #34d399;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.seat-cards-row {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 3px;
}

.dealer-chip {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fbbf24;
  color: #0f172a;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #0f172a;
}

/* ==========================================================================
   Fair Verify Visual Card
   ========================================================================== */
.verify-checks-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.verify-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
}

.verify-check-item.ok { border-color: var(--emerald-border); background: var(--emerald-soft); }
.verify-check-item.fail { border-color: var(--rose-border); background: var(--rose-soft); }

.verify-check-ico {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 700;
}

.verify-check-item.ok .verify-check-ico { background: var(--emerald-bright); color: #fff; }
.verify-check-item.fail .verify-check-ico { background: var(--rose-bright); color: #fff; }

/* ==========================================================================
   Modals, Slide-Over Drawer, Command Palette (⌘K) & Toasts
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.modal-box {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow-pop);
  animation: modalIn 0.16s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-box.modal-lg { max-width: 780px; }
.modal-box.modal-xl { max-width: 920px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.modal-sub { margin-top: 3px; font-size: 12.5px; color: var(--muted); }

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

/* Slide-over User Detail Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(2, 6, 23, 0.50);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: min(540px, 100vw);
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(2, 6, 23, 0.28);
  padding: 22px 24px 32px;
  animation: drawerIn 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes drawerIn {
  from { transform: translateX(36px); opacity: 0.5; }
  to { transform: translateX(0); opacity: 1; }
}

/* Command Palette (⌘K) */
.cmd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 115;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 24px;
}

.cmd-dialog {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: modalIn 0.14s ease;
}

.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.cmd-input-row svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.cmd-input-row input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
}

.cmd-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
}

.cmd-group-label {
  padding: 6px 10px 4px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cmd-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
}

.cmd-item:hover, .cmd-item.selected {
  background: var(--primary-soft);
  color: var(--primary);
}

.cmd-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmd-item-left svg { width: 16px; height: 16px; opacity: 0.8; }
.cmd-item-hint { font-size: 11.5px; color: var(--muted); }

/* Key-Value Diff Table (Audit Before/After & Structured Detail) */
.kv-list {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.kv-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
}
.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--muted); font-weight: 550; }
.kv-val { color: var(--text); word-break: break-all; }

.diff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.diff-col {
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}

.diff-col-head {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 650;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.diff-row-changed { background: var(--amber-soft); }

/* Provisioning Box (TOTP otpauth://) */
.otp-box {
  padding: 14px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--primary-border);
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

/* Permission Matrix Chips */
.perm-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.perm-chip {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
}

/* ==========================================================================
   Room Management Stats, Preset Chips & Live Lobby Card Preview
   ========================================================================== */
.room-stats-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.room-stat-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.room-stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
}

.room-stat-val {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin-top: 2px;
}

.room-stat-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}

.room-form-section {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.room-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.room-type-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.room-type-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  text-align: left;
  transition: all 0.14s ease;
}

.room-type-btn:hover {
  border-color: var(--primary-border);
  background: var(--surface);
}

.room-type-btn.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.14);
}

.room-type-btn.active.is-short {
  border-color: var(--violet);
  background: var(--violet-soft);
  color: var(--violet);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.14);
}

.room-type-btn strong { font-size: 13.5px; font-weight: 700; }
.room-type-btn span { font-size: 11.5px; color: var(--muted); }

.preset-chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.preset-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  font-size: 13px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  transition: all 0.14s ease;
}

.preset-chip small {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.preset-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.preset-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.30);
}

.preset-chip.active small { color: rgba(255, 255, 255, 0.85); }

.preset-chip.is-short.active {
  background: var(--violet);
  border-color: var(--violet);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.30);
}

.ante-style-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.ante-style-btn {
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.14s ease;
}

.ante-style-btn.active {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}

.room-preview-card {
  padding: 13px 16px;
  border-radius: 13px;
  background: linear-gradient(135deg, #0b1120 0%, #151e32 62%, #1d263b 100%);
  border: 1px solid rgba(251, 191, 36, 0.34);
  color: #f8fafc;
  margin-bottom: 14px;
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.24);
}

.room-preview-top {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 12px;
  margin-bottom: 7px;
}

.room-preview-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.room-preview-tag.short {
  background: rgba(244, 63, 94, 0.20);
  border-color: rgba(251, 113, 133, 0.48);
  color: #fda4af;
}

.room-preview-rid {
  padding: 1px 7px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.32);
  color: #e2e8f0;
}

.room-preview-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.room-preview-blinds {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 750;
  color: #fef3c7;
  letter-spacing: -0.02em;
}

.room-preview-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-size: 11.5px;
  color: #cbd5e1;
}

.room-preview-pill {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.38);
  color: #6ee7b7;
  font-size: 11px;
  font-weight: 600;
}

.room-preview-pill.warn {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(251, 191, 36, 0.40);
  color: #fde68a;
}

.room-form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.room-form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.room-form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.room-form-err {
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--rose-soft);
  border: 1px solid var(--rose-border);
  color: var(--rose);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 12px;
}

.btn-danger-outline {
  color: var(--rose);
  border-color: var(--rose-border);
  background: var(--rose-soft);
}
.btn-danger-outline:hover:not(:disabled) {
  background: var(--rose);
  border-color: var(--rose);
  color: #ffffff;
}

@media (max-width: 900px) {
  .room-stats-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-form-grid-3, .room-form-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .room-stats-bar, .room-form-grid-2, .room-form-grid-3, .room-form-grid-4, .room-type-switch {
    grid-template-columns: 1fr;
  }
}

/* Toast Stack */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 140;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border-radius: 11px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.20);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.34);
  font-size: 13px;
  font-weight: 550;
  animation: modalIn 0.16s ease;
}

.toast-item.tone-ok { border-left: 3px solid #10b981; }
.toast-item.tone-warn { border-left: 3px solid #f59e0b; }
.toast-item.tone-danger { border-left: 3px solid #f43f5e; }

/* ==========================================================================
   Responsive Breakpoints (<= 1180px, <= 900px, <= 640px)
   ========================================================================== */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-asym, .grid-asym-rev { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .mobile-only { display: inline-flex; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .topbar { padding: 8px 14px; }
  .page-content { padding: 16px 14px 36px; }
  .grid-2, .grid-3, .diff-grid, .verify-checks-grid { grid-template-columns: 1fr; }
  .gauge-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmd-trigger span.cmd-placeholder { display: none; }
  .poker-arena { height: 340px; }
  .poker-seat-pod { width: 96px; font-size: 10px; padding: 5px; }
}

@media (max-width: 560px) {
  .grid-4, .grid-6 { grid-template-columns: 1fr; }
  .funds-breakdown { grid-template-columns: 1fr; }
  .health-grid { grid-template-columns: 1fr; }
  .kv-row { grid-template-columns: 1fr; gap: 3px; }
  .login-card { padding: 26px 20px 22px; }
  .login-trust { grid-template-columns: 1fr; gap: 6px; }
  .kpi-main-row { flex-wrap: wrap; }
}

/* ==========================================================================
   Reduced Motion Accessibility (prefers-reduced-motion: reduce)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .ec-bar-grow,
  .ec-hbar-anim,
  .ec-gauge-anim,
  .ec-spark-draw,
  .ec-spark-fade,
  .ec-pulse-enter,
  .ec-gauge-dot,
  .ec-empty-dot,
  .pulse-dot.live::after {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .ec-spark-draw {
    stroke-dashoffset: 0 !important;
  }
  .ec-gauge-anim {
    stroke-dashoffset: var(--ec-offset) !important;
  }
}
