/* ==========================================================================
   RHD LICENSING SUITE - PRODUCTION DESIGN SYSTEM & STYLESHEET (2026)
   Aesthetic Architecture: Linear + Raycast + Vercel + SentinelOne Dark UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* ==========================================================================
     1. COLOR TOKENS & OBSIDIAN DEPTH LADDER
     ========================================================================== */
  --raw-obsidian-950: 5, 7, 11;       /* #05070b - Deepest void canvas */
  --raw-obsidian-900: 8, 10, 16;      /* #080a10 - Application root */
  --raw-obsidian-850: 12, 16, 23;     /* #0c1017 - Card surfaces / sidebar */
  --raw-obsidian-800: 18, 23, 33;     /* #121721 - Elevated panels / tables */
  --raw-obsidian-750: 24, 31, 44;     /* #181f2c - Dropdowns / modals / hover */
  --raw-obsidian-700: 32, 41, 58;     /* #20293a - Active states */

  /* Neutral Text Greys */
  --text-main:      #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted:     #94a3b8;
  --text-subtle:    #64748b;
  --text-disabled:  #475569;

  /* Semantic Layers */
  --bg-void:       rgb(var(--raw-obsidian-950));
  --bg-base:       rgb(var(--raw-obsidian-900));
  --bg-surface:    rgb(var(--raw-obsidian-850));
  --bg-elevated:   rgb(var(--raw-obsidian-800));
  --bg-overlay:    rgb(var(--raw-obsidian-750));
  --bg-hover:      rgb(var(--raw-obsidian-700));

  /* Hairline Borders & Specular Inner Highlights */
  --border-hairline:    rgba(255, 255, 255, 0.05);
  --border-subtle:      rgba(255, 255, 255, 0.08);
  --border-color:       rgba(255, 255, 255, 0.12);
  --border-strong:      rgba(255, 255, 255, 0.20);
  --border-interactive: rgba(255, 255, 255, 0.35);
  --inner-highlight:    inset 0 1px 0 0 rgba(255, 255, 255, 0.08);
  --inner-highlight-md: inset 0 1px 0 0 rgba(255, 255, 255, 0.14);

  /* Cyber Accents */
  --primary:         #8b5cf6;
  --primary-hover:   #7c3aed;
  --primary-glow:    rgba(139, 92, 246, 0.35);
  --accent-cyan:     #06b6d4;
  --accent-cyan-glow:rgba(6, 182, 212, 0.35);
  --accent-emerald:  #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.35);
  --accent-orange:   #f59e0b;
  --accent-orange-glow: rgba(245, 158, 11, 0.35);
  --danger:          #ef4444;
  --danger-hover:    #dc2626;
  --danger-glow:     rgba(239, 68, 68, 0.35);

  /* Geometry & Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* App Sizing */
  --sidebar-width: 260px;
  --appbar-height: 64px;

  /* Easing & Physics */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s var(--ease-smooth);
  --transition-normal: 0.25s var(--ease-spring);
  --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
  --elevated-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   LIGHT MODE DESIGN SYSTEM TOKENS (SYSTEM / TOGGLED)
   ========================================================================== */
:root[data-theme="light"] {
  --raw-obsidian-950: 241, 245, 249;   /* #f1f5f9 - Crisp light gray canvas */
  --raw-obsidian-900: 248, 250, 252;   /* #f8fafc - App workspace base */
  --raw-obsidian-850: 255, 255, 255;   /* #ffffff - Card surfaces / sidebar */
  --raw-obsidian-800: 255, 255, 255;   /* #ffffff - Elevated panels */
  --raw-obsidian-750: 241, 245, 249;   /* #f1f5f9 - Dropdowns / modals / hover */
  --raw-obsidian-700: 226, 232, 240;   /* #e2e8f0 - Active states */

  /* Neutral Text Greys */
  --text-main:      #0f172a;           /* Deep slate 900 */
  --text-secondary: #334155;           /* Slate 700 */
  --text-muted:     #64748b;           /* Slate 500 */
  --text-subtle:    #94a3b8;           /* Slate 400 */
  --text-disabled:  #cbd5e1;           /* Slate 300 */

  /* Semantic Layers */
  --bg-void:       #f1f5f9;
  --bg-base:       #f8fafc;
  --bg-surface:    #ffffff;
  --bg-elevated:   #ffffff;
  --bg-overlay:    #ffffff;
  --bg-hover:      #f1f5f9;

  /* Borders & Specular Highlights */
  --border-hairline:    rgba(15, 23, 42, 0.05);
  --border-subtle:      rgba(15, 23, 42, 0.08);
  --border-color:       rgba(15, 23, 42, 0.12);
  --border-strong:      rgba(15, 23, 42, 0.20);
  --border-interactive: rgba(15, 23, 42, 0.35);
  --inner-highlight:    inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
  --inner-highlight-md: inset 0 1px 0 0 rgba(255, 255, 255, 1);
  --card-shadow:        0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  --elevated-shadow:    0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

@media (prefers-color-scheme: light) {
  :root[data-theme-mode="system"] {
    --raw-obsidian-950: 241, 245, 249;
    --raw-obsidian-900: 248, 250, 252;
    --raw-obsidian-850: 255, 255, 255;
    --raw-obsidian-800: 255, 255, 255;
    --raw-obsidian-750: 241, 245, 249;
    --raw-obsidian-700: 226, 232, 240;

    --text-main:      #0f172a;
    --text-secondary: #334155;
    --text-muted:     #64748b;
    --text-subtle:    #94a3b8;
    --text-disabled:  #cbd5e1;

    --bg-void:       #f1f5f9;
    --bg-base:       #f8fafc;
    --bg-surface:    #ffffff;
    --bg-elevated:   #ffffff;
    --bg-overlay:    #ffffff;
    --bg-hover:      #f1f5f9;

    --border-hairline:    rgba(15, 23, 42, 0.05);
    --border-subtle:      rgba(15, 23, 42, 0.08);
    --border-color:       rgba(15, 23, 42, 0.12);
    --border-strong:      rgba(15, 23, 42, 0.20);
    --border-interactive: rgba(15, 23, 42, 0.35);
    --inner-highlight:    inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
    --inner-highlight-md: inset 0 1px 0 0 rgba(255, 255, 255, 1);
    --card-shadow:        0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
    --elevated-shadow:    0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  }
}


/* ==========================================================================
   2. GLOBAL RESET & CORE FOUNDATION
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
}

::selection {
  background: var(--primary);
  color: #ffffff;
}

html, body {
  background-color: var(--bg-base);
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

[data-theme="light"] body {
  background-image: radial-gradient(rgba(15, 23, 42, 0.04) 1px, transparent 1px);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* ==========================================================================
   3. APP WORKSPACE LAYOUT
   ========================================================================== */
.app-layout {
  display: flex;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: var(--bg-base);
}

/* Off-canvas Backdrop for Mobile */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s var(--ease-smooth), visibility 0.25s var(--ease-smooth);
  z-index: 998;
}
.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 999;
  position: relative;
  box-shadow: var(--inner-highlight);
}

.sidebar-header {
  height: var(--appbar-height);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-hairline);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(6, 182, 212, 0.15));
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0 16px -2px var(--primary-glow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.logo:hover .logo-icon {
  transform: scale(1.05) rotate(-3deg);
  box-shadow: 0 0 24px var(--primary-glow);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff 40%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-sub {
  font-size: 0.65rem;
  color: var(--text-subtle);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.mobile-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* Sidebar User Status Card */
.sidebar-profile {
  padding: 1rem 1.25rem;
  margin: 0.85rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--inner-highlight);
}

.profile-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.profile-name {
  font-weight: 700;
  font-size: 0.86rem;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding: 0.85rem 0.75rem 0.35rem 0.75rem;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.nav-item i {
  font-size: 0.95rem;
  width: 18px;
  text-align: center;
  color: var(--text-subtle);
  transition: color var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-main);
  background: var(--bg-hover);
  border-color: var(--border-hairline);
  transform: translateX(2px);
}
.nav-item:hover i {
  color: var(--primary);
}

.nav-item.active {
  background: var(--bg-elevated);
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 20px -4px var(--primary-glow);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -0.85rem;
  top: 20%;
  bottom: 20%;
  width: 3.5px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px var(--primary-glow);
}
.nav-item.active i {
  color: var(--primary);
}

.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-hairline);
}

.logout-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--danger);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.logout-link:hover {
  background: rgba(239, 68, 68, 0.12);
  transform: translateX(2px);
}

/* ==========================================================================
   4. MAIN WORKSPACE & TOP APPBAR
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
  position: relative;
}

.main-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 420px;
  background: radial-gradient(ellipse 70% 50% at 50% 0%, var(--primary-glow), transparent 70%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  transition: opacity 0.3s ease;
}

.topbar {
  height: var(--appbar-height);
  min-height: var(--appbar-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(12, 16, 23, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  box-shadow: var(--inner-highlight);
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 0.75rem;
}

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 440px;
}
.topbar-search i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 0.85rem;
  pointer-events: none;
}
.topbar-search input {
  width: 100%;
  height: 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 1rem 0 2.5rem;
  color: var(--text-main);
  font-size: 0.84rem;
  outline: none;
  transition: all var(--transition-fast);
}
.topbar-search input:focus {
  border-color: var(--primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 1px var(--primary), 0 0 16px -2px var(--primary-glow);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.system-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
}
.system-status-indicator.paused {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.25);
  color: #f87171;
}

.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.main-footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-subtle);
  background: var(--bg-surface);
}

/* ==========================================================================
   5. PAGE HEADERS & METRICS CARDS (LINEAR / RAYCAST STYLE)
   ========================================================================== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Tactical KPI Grid (4-Column) */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.kpi-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.35rem 0.75rem 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border-hairline), 0 4px 16px -2px rgba(0, 0, 0, 0.35), var(--inner-highlight);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--kpi-glow, var(--primary)), transparent);
  opacity: 0.85;
}

.kpi-card.primary { --kpi-glow: var(--primary); }
.kpi-card.emerald { --kpi-glow: var(--accent-emerald); }
.kpi-card.cyan    { --kpi-glow: var(--accent-cyan); }
.kpi-card.orange  { --kpi-glow: var(--accent-orange); }

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 14px 32px -6px rgba(0, 0, 0, 0.5), 0 0 24px -4px var(--primary-glow);
}

.kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.kpi-label-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.kpi-icon.primary { background: rgba(139, 92, 246, 0.12); color: var(--primary); border: 1px solid rgba(139, 92, 246, 0.25); }
.kpi-icon.emerald { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.25); }
.kpi-icon.cyan    { background: rgba(6, 182, 212, 0.12);  color: var(--accent-cyan);    border: 1px solid rgba(6, 182, 212, 0.25); }
.kpi-icon.orange  { background: rgba(245, 158, 11, 0.12); color: var(--accent-orange);  border: 1px solid rgba(245, 158, 11, 0.25); }

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}
.trend-up { background: rgba(16, 185, 129, 0.14); color: #34d399; }
.trend-down { background: rgba(239, 68, 68, 0.14); color: #f87171; }

.kpi-sparkline-wrap {
  margin: 0.5rem -1.25rem -0.5rem -1.25rem;
  height: 32px;
  overflow: hidden;
}
.kpi-sparkline {
  width: 100%;
  height: 100%;
  display: block;
}

/* Telemetry Metric Cards (Used across Subadmins, Logs, Credits, API Docs) */
.metric-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem 1.15rem 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border-hairline), 0 4px 16px -2px rgba(0, 0, 0, 0.35), var(--inner-highlight);
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--metric-glow, var(--primary)), transparent);
  opacity: 0.85;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 14px 32px -6px rgba(0, 0, 0, 0.5), 0 0 24px -4px var(--primary-glow);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.metric-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: transform var(--transition-fast);
}
.metric-card:hover .metric-icon-box {
  transform: scale(1.08);
}

.metric-icon-box.cyan    { background: rgba(6, 182, 212, 0.12); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.25); box-shadow: 0 0 14px -3px rgba(6, 182, 212, 0.2); }
.metric-icon-box.emerald { background: rgba(16, 185, 129, 0.12); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.25); box-shadow: 0 0 14px -3px rgba(16, 185, 129, 0.2); }
.metric-icon-box.purple  { background: rgba(139, 92, 246, 0.12); color: var(--primary); border: 1px solid rgba(139, 92, 246, 0.25); box-shadow: 0 0 14px -3px rgba(139, 92, 246, 0.2); }
.metric-icon-box.orange  { background: rgba(245, 158, 11, 0.12); color: var(--accent-orange); border: 1px solid rgba(245, 158, 11, 0.25); box-shadow: 0 0 14px -3px rgba(245, 158, 11, 0.2); }
.metric-icon-box.rose    { background: rgba(244, 63, 94, 0.12); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.25); box-shadow: 0 0 14px -3px rgba(244, 63, 94, 0.2); }

.metric-value-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-hairline);
}
.metric-trend.up {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}
.metric-trend.down {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.25);
}

.metric-footer-text {
  font-size: 0.72rem;
  color: var(--text-subtle);
  margin-top: 0.65rem;
  display: block;
}

/* ==========================================================================
   6. COMMAND CENTER (8:4 SPLIT & TELEMETRY STREAM)
   ========================================================================== */
.command-body-split {
  display: grid;
  grid-template-columns: 8fr 4fr;
  gap: 1.25rem;
  align-items: flex-start;
}

.command-main-col,
.command-side-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Live Telemetry Radar Widget */
.live-telemetry-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--inner-highlight);
}

.telemetry-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.telemetry-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.telemetry-status-text {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #10b981;
}

.live-radar-ping {
  position: relative;
  display: inline-flex;
  width: 8px;
  height: 8px;
}
.ping-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #10b981;
  opacity: 0.75;
  animation: radarRipple 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.ping-dot {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
}
@keyframes radarRipple {
  0% { transform: scale(1); opacity: 0.8; }
  75%, 100% { transform: scale(2.8); opacity: 0; }
}

.telemetry-grid {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0.5rem 0;
}
.telemetry-metric {
  text-align: center;
}
.telemetry-num {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.telemetry-num small {
  font-size: 0.75rem;
  color: var(--text-subtle);
}
.telemetry-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
  display: block;
}
.telemetry-divider {
  width: 1px;
  height: 32px;
  background: var(--border-color);
}

/* Datadog Segmented SLA Bar */
.system-health-strip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.85rem 1.15rem;
  box-shadow: var(--inner-highlight);
}
.health-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.segmented-health-bar {
  display: flex;
  gap: 3px;
  height: 18px;
  width: 100%;
}
.bar-seg {
  flex: 1;
  border-radius: 2px;
  background-color: #10b981;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  cursor: pointer;
}
.bar-seg:hover {
  transform: scaleY(1.2);
  opacity: 0.8;
}
.health-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-subtle);
  margin-top: 0.4rem;
}

/* Activity Stream & Spine */
.activity-timeline {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 0.5rem 0.5rem;
}
.activity-timeline::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 1.25rem;
  width: 2px;
  background: var(--border-color);
}
.timeline-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 0;
}
.timeline-icon-wrap {
  position: relative;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.timeline-item.entry-emerald .timeline-icon-wrap {
  border-color: #10b981;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
}
.timeline-item.entry-primary .timeline-icon-wrap {
  border-color: #8b5cf6;
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.15);
}
.timeline-item.entry-rose .timeline-icon-wrap {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}
.timeline-content {
  flex: 1;
  min-width: 0;
}
.timeline-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.timeline-actor {
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
}
.timeline-time {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.timeline-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  line-height: 1.4;
}

/* ==========================================================================
   7. INVENTORY DATA TABLES & SEGMENTED CONTROLS
   ========================================================================== */
.card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--border-hairline), 0 4px 20px -2px rgba(0, 0, 0, 0.4), var(--inner-highlight);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

[data-theme="light"] .card:hover {
  border-color: rgba(15, 23, 42, 0.2);
}

.card-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(var(--raw-obsidian-800), 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  letter-spacing: -0.01em;
}

.card-body {
  padding: 1.35rem 1.5rem;
}

/* Segmented Status Pill Toolbar */
.inventory-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.status-pill-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  max-width: 100%;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.status-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}
.status-pill.active {
  background: var(--bg-elevated);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), var(--inner-highlight);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.dot-all { background: #9ca3af; }
.dot-active { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.6); }
.dot-unused { background: #3b82f6; }
.dot-expired { background: #6b7280; }
.dot-banned { background: #ef4444; }

.status-count {
  font-size: 0.72rem;
  padding: 1px 6px;
  background: var(--bg-base);
  border-radius: var(--radius-full);
  color: var(--text-subtle);
  border: 1px solid var(--border-hairline);
}
.status-pill.active .status-count {
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.35);
}

/* Omni-Search Box */
.search-box-wrapper {
  position: relative;
  min-width: 260px;
  flex: 1;
  max-width: 420px;
}
.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 0.85rem;
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 38px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 4.5rem 0 2.4rem;
  color: var(--text-main);
  font-size: 0.84rem;
  outline: none;
  transition: all var(--transition-fast);
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), 0 0 16px -2px var(--primary-glow);
  background: var(--bg-elevated);
}
.search-kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  pointer-events: none;
}
.search-clear-btn {
  position: absolute;
  right: 2.2rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 4px;
}
.search-clear-btn:hover { color: var(--text-main); }

/* Table Component */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) var(--bg-surface);
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.data-table th {
  background: var(--bg-elevated);
  color: var(--text-subtle);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1.15rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: all var(--transition-fast);
}

.data-table td {
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--text-main);
  vertical-align: middle;
  transition: background var(--transition-fast), box-shadow var(--transition-fast);
}

.data-table tbody tr:hover td {
  background: var(--bg-hover);
}

.data-table tbody tr:hover td:first-child {
  box-shadow: inset 3px 0 0 0 var(--primary);
}

/* Key Pill & Hardware Badges */
.key-code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-main);
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: all;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.key-code:hover {
  background: var(--bg-elevated);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 16px var(--primary-glow);
  transform: translateY(-1px);
}

.hwid-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Badges (Status, Duration, Roles) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-active { background: rgba(16, 185, 129, 0.12); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-unused { background: rgba(59, 130, 246, 0.12);  color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-expired { background: rgba(107, 114, 128, 0.12); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.3); }
.badge-banned { background: rgba(239, 68, 68, 0.12);  color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-paused { background: rgba(245, 158, 11, 0.12);  color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-main-admin { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; border: 1px solid rgba(139, 92, 246, 0.35); }
.badge-sub-admin  { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Live Status Pulsing Dots */
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  background-color: currentColor;
}

.badge-dot.pulse-emerald {
  background-color: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: pulseDot 2s infinite ease-in-out;
}

.badge-dot.pulse-primary {
  background-color: var(--primary);
  box-shadow: 0 0 6px var(--primary);
  animation: pulseDot 2s infinite ease-in-out;
}

.badge-dot.pulse-orange {
  background-color: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.6;
  }
}

/* API Docs Language Tabs & Snippet Terminal Containers */
.lang-tab {
  transition: all var(--transition-fast);
}
.lang-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 14px -2px var(--primary-glow);
}

.code-snippet-box pre {
  background: #090d16 !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-md) !important;
  padding: 1.25rem 1.5rem !important;
  color: #e2e8f0 !important;
  font-family: var(--font-mono) !important;
  font-size: 0.84rem !important;
  line-height: 1.6 !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] .code-snippet-box pre {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

/* ==========================================================================
   8. BUTTONS & FORM INPUTS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  line-height: 1.25;
}
.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 10px var(--primary-glow);
}
.btn-primary:hover {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 6px 22px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15), var(--inner-highlight);
}
.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text-main);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), var(--inner-highlight);
}

.btn-success {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 10px rgba(16, 185, 129, 0.3);
}
.btn-success:hover {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 6px 20px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #000000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 2px 10px rgba(245, 158, 11, 0.3);
}
.btn-warning:hover {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 20px rgba(245, 158, 11, 0.45);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 10px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 20px rgba(239, 68, 68, 0.45);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.76rem;
  border-radius: 6px;
}

.btn-xs {
  padding: 0.22rem 0.55rem;
  font-size: 0.7rem;
  border-radius: 4px;
  line-height: 1.2;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-block { width: 100%; }

/* Form Controls */
.form-group {
  margin-bottom: 1.15rem;
}
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.45rem;
}
.form-control {
  width: 100%;
  height: 40px;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 0.85rem;
  color: var(--text-main);
  font-size: 0.86rem;
  outline: none;
  transition: all var(--transition-fast);
}
.form-control:focus {
  border-color: var(--primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 1px var(--primary), 0 0 16px -2px var(--primary-glow);
}

/* Preset Duration Chips */
.duration-chip-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.duration-chip {
  padding: 0.45rem 0.85rem;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.duration-chip:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}
.duration-chip.active {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 0 12px -2px var(--primary-glow);
}

/* ==========================================================================
   9. MODAL DIALOGS, DRAWERS & 4-UNIT COUNTDOWN CLOCK
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}
.modal-backdrop.is-active,
.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.85), var(--inner-highlight);
  transform: scale(0.96) translateY(10px);
  transition: transform var(--transition-normal);
}
.modal-backdrop.is-active .modal-dialog,
.modal-backdrop.show .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(18, 23, 33, 0.5);
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.4rem;
  transition: color var(--transition-fast);
}
.modal-close:hover { color: #ffffff; }

.modal-body {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  background: rgba(18, 23, 33, 0.3);
}

/* 4-Unit Countdown Clock */
.countdown-box {
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--inner-highlight);
}
.countdown-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.countdown-units {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.countdown-unit {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--inner-highlight);
}
.countdown-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.45rem;
  font-weight: 800;
  color: #34d399;
  line-height: 1.1;
  text-shadow: 0 0 12px rgba(52, 211, 153, 0.25);
}
.countdown-label {
  font-size: 0.64rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 0.25rem;
}

/* Modal HWID & Metadata Box */
.hwid-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.hwid-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: #93c5fd;
  word-break: break-all;
}

/* Multi-Device Hardware Inspector in Detail Modal */
.modal-device-container {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.modal-device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-device-title {
  font-size: 0.72rem;
  color: var(--text-subtle);
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.modal-device-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.modal-device-search-wrap {
  position: relative;
  flex: 1;
}
.modal-device-search-wrap i {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.72rem;
  color: var(--text-subtle);
  pointer-events: none;
}
.modal-device-search-input {
  width: 100%;
  height: 30px;
  padding: 0 0.5rem 0 1.75rem;
  font-size: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition-fast);
}
.modal-device-search-input:focus {
  border-color: var(--primary);
}
.modal-device-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 4px;
}
.modal-device-list::-webkit-scrollbar {
  width: 5px;
}
.modal-device-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 3px;
}
.modal-device-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}
.modal-device-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}
.device-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all var(--transition-fast);
}
.device-item-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.035);
}
.device-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.device-item-index {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.15);
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}
.device-item-hwid {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: #93c5fd;
  word-break: break-all;
  flex: 1;
}
.device-item-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}
.device-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-subtle);
  padding-top: 3px;
  border-top: 1px dashed rgba(255, 255, 255, 0.06);
}
.device-item-ip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--text-muted);
}
.device-item-time {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.detail-key-banner {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.detail-key-text {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.detail-cell {
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
}
.detail-cell-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail-cell-val {
  font-size: 0.84rem;
  color: var(--text-main);
  margin-top: 0.2rem;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}
.toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  background: rgba(18, 23, 33, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  color: var(--text-main);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.84rem;
  animation: toastIn 0.25s var(--ease-spring);
}
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-success { border-left: 3px solid var(--accent-emerald); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--primary); }

/* Alerts */
.alert {
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  line-height: 1.4;
}
.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}
.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

/* ==========================================================================
   10. LUXURY AUTH & SELF-SERVICE PORTAL (SUPABASE / CLERK STYLE)
   ========================================================================== */
.auth-viewport {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1.5rem;
  background-color: #06080d;
  overflow: hidden;
}

/* Ambient Radial Spotlight & Grid Mesh */
.auth-viewport::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(ellipse 65% 55% at 50% 25%, rgba(139, 92, 246, 0.14) 0%, rgba(139, 92, 246, 0.03) 45%, transparent 75%),
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  pointer-events: none;
  z-index: 1;
  mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, black 40%, transparent 95%);
  -webkit-mask-image: radial-gradient(ellipse 70% 65% at 50% 45%, black 40%, transparent 95%);
}

.auth-viewport.portal-emerald::before {
  background-image: 
    radial-gradient(ellipse 65% 55% at 50% 25%, rgba(16, 185, 129, 0.13) 0%, rgba(16, 185, 129, 0.03) 45%, transparent 75%),
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
}

.auth-card-luxury {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  background: rgba(17, 21, 30, 0.82);
  backdrop-filter: blur(24px) saturate(190%);
  -webkit-backdrop-filter: blur(24px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.12),
    0 24px 64px -12px rgba(0, 0, 0, 0.85);
}

/* Hairline Top Highlight */
.auth-card-luxury::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.8), transparent);
  pointer-events: none;
}
.auth-card-luxury.card-emerald::after {
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.85), transparent);
}

/* Floating Halo Badge */
.auth-badge-halo {
  width: 58px;
  height: 58px;
  margin: 0 auto 1.25rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: 0 0 24px -2px rgba(139, 92, 246, 0.35);
}
.auth-badge-halo.halo-emerald {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(45, 212, 191, 0.08));
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 24px -2px rgba(16, 185, 129, 0.35);
}

.auth-badge-inner {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #11151e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #c4b5fd;
}
.auth-badge-halo.halo-emerald .auth-badge-inner {
  color: #6ee7b7;
}

.badge-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #11151e;
  box-shadow: 0 0 8px #10b981;
}

.auth-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 0.35rem;
}
.auth-card-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.45;
  margin-bottom: 1.5rem;
}

.luxury-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.luxury-input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-subtle);
  font-size: 0.88rem;
  pointer-events: none;
  transition: color var(--transition-fast);
}
.luxury-input {
  width: 100%;
  height: 44px;
  padding: 0 1rem 0 2.6rem;
  background: rgba(11, 14, 20, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.88rem;
  outline: none;
  transition: all var(--transition-fast);
}
.luxury-input:focus {
  border-color: var(--primary);
  background: rgba(16, 21, 30, 0.95);
  box-shadow: 0 0 0 1px var(--primary), 0 0 18px -2px var(--primary-glow);
}
.luxury-input-wrapper:focus-within .luxury-input-icon {
  color: #a78bfa;
}

.luxury-input.emerald-focus:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 1px var(--accent-emerald), 0 0 18px -2px var(--accent-emerald-glow);
}
.luxury-input-wrapper:focus-within .emerald-icon {
  color: #34d399;
}

.luxury-btn-submit {
  width: 100%;
  height: 46px;
  margin-top: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%), var(--primary);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 20px -2px var(--primary-glow);
  transition: all var(--transition-fast);
}
.luxury-btn-submit:hover {
  filter: brightness(1.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 28px var(--primary-glow);
  transform: translateY(-1px);
}
.luxury-btn-submit.btn-emerald {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 100%), var(--accent-emerald);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 20px -2px var(--accent-emerald-glow);
}
.luxury-btn-submit.btn-emerald:hover {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 28px var(--accent-emerald-glow);
}

.auth-footer-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
  margin: 1.5rem 0 1.25rem;
}
.auth-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-subtle);
}
.auth-footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--transition-fast);
}
.auth-footer-link:hover { color: #ffffff; }

/* Active License Feedback Card on Reset Portal */
.active-license-card {
  background: var(--bg-surface);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px -4px rgba(16, 185, 129, 0.15);
}
.active-license-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.active-license-code {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  padding: 0.4rem 0.6rem;
  background: var(--bg-base);
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  margin-bottom: 0.65rem;
}
.active-license-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   11. MOBILE RESPONSIVENESS & CARD DECK TRANSFORMATION (< 768px)
   ========================================================================== */
.mobile-inventory-cards {
  display: none;
}

@media (max-width: 1200px) {
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .command-body-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    transform: translate3d(-100%, 0, 0);
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  }
  .sidebar.open {
    transform: translate3d(0, 0, 0);
    box-shadow: 12px 0 36px rgba(0, 0, 0, 0.65);
  }
  .mobile-close-btn {
    display: block;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .kpi-strip {
    grid-template-columns: 1fr;
  }
  .content-body {
    padding: 1.25rem 1rem;
  }

  /* Table to Card Deck Transformation: Hide table only when card deck exists */
  .table-responsive.table-hide-mobile {
    display: none;
  }
  .table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-inventory-cards {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }
  .inventory-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--inner-highlight);
  }
  .card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
  }
  .card-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 0.4rem 0.6rem;
    border-radius: 5px;
    margin-bottom: 0.75rem;
  }
  .card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border-hairline);
    border-bottom: 1px solid var(--border-hairline);
    margin-bottom: 0.75rem;
  }
  .grid-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }
  .grid-label {
    font-size: 0.68rem;
    color: var(--text-subtle);
    text-transform: uppercase;
    font-weight: 700;
  }
  .grid-value {
    font-size: 0.82rem;
    color: var(--text-main);
  }
  .card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
  }
  .card-actions-row {
    display: flex;
    gap: 0.45rem;
    align-items: stretch;
  }
  .card-actions-row form {
    margin: 0;
    display: flex;
  }
  .card-actions-row .btn {
    justify-content: center;
    padding: 0.4rem 0.5rem;
    font-size: 0.74rem;
    white-space: nowrap;
  }
}

/* ==========================================================================
   11. THEME & ACCENT COLOR CUSTOMIZER (LIGHT / DARK / SYSTEM + NOW COLOR)
   ========================================================================== */
.theme-dropdown-container {
  position: relative;
  display: inline-flex;
}

.theme-menu-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.theme-current-color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
  display: inline-block;
  transition: all var(--transition-fast);
}

.theme-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 300px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: var(--elevated-shadow);
  z-index: 1050;
  display: none;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.2s var(--ease-spring), transform 0.2s var(--ease-spring);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.theme-dropdown-menu.active {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.theme-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
}

.theme-dropdown-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.theme-dropdown-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.theme-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.theme-close-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.theme-section {
  margin-bottom: 0.95rem;
}
.theme-section:last-child {
  margin-bottom: 0;
}

.theme-section-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

/* Mode Switcher Buttons: Light / Dark / System */
.theme-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  background: var(--bg-base);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.theme-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.55rem 0.25rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.theme-mode-btn i {
  font-size: 1rem;
}
.theme-mode-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}
.theme-mode-btn.active {
  background: var(--bg-surface);
  border-color: var(--border-color);
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Accent Color Swatches Grid ("and now color") */
.theme-color-palette {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.color-swatch-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--swatch-color);
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.color-swatch-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 0 12px var(--swatch-color);
}
.color-swatch-btn.active {
  border-color: #ffffff;
  box-shadow: 0 0 14px var(--swatch-color);
  transform: scale(1.1);
}
.color-swatch-btn.active::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: #ffffff;
  border-radius: 50%;
  opacity: 0.9;
}

.theme-reset-link {
  background: none;
  border: none;
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.theme-reset-link:hover {
  color: var(--primary);
}

/* Custom Color Input Row */
.custom-color-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
}

.custom-color-picker-wrapper {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}
.custom-color-picker-wrapper input[type="color"] {
  position: absolute;
  inset: -10px;
  width: 48px;
  height: 48px;
  opacity: 0;
  cursor: pointer;
}
.custom-color-preview-swatch {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--primary);
  border-radius: 50%;
}

.custom-color-hex-box {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 2px;
}
.custom-color-hash {
  color: var(--text-subtle);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}
.custom-color-hex-box input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
}

/* ==========================================================================
   12. FILTER MENU & ACTIVE FILTER CHIPS (HIGH PERFORMANCE INVENTORY UX)
   ========================================================================== */
.filter-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  padding: 0 0.85rem;
  height: 38px;
}
.filter-menu-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(139, 92, 246, 0.08);
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
}

.filter-arrow-icon {
  font-size: 0.68rem;
  transition: transform var(--transition-fast);
}
.filter-menu-btn.open .filter-arrow-icon {
  transform: rotate(180deg);
}

/* Collapsible Filter Panel Card */
.filter-panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  animation: filterSlideDown 0.22s var(--ease-spring);
}

@keyframes filterSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.filter-panel-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.15rem;
  padding: 1.35rem 1.4rem;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-select {
  height: 38px;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 0.85rem;
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.filter-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.4rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-base);
}

.filter-actions-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Active Filter Chips Strip */
.active-filters-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
  padding: 0.6rem 0.95rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.active-filters-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-main);
  transition: all var(--transition-fast);
}
.filter-chip strong {
  color: var(--text-muted);
  font-weight: 600;
}
.filter-chip-remove {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  font-size: 0.7rem;
  transition: all var(--transition-fast);
}
.filter-chip-remove:hover {
  background: var(--danger);
  color: #ffffff;
}

.filter-clear-all-link {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--danger);
  text-decoration: none;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: background var(--transition-fast);
}
.filter-clear-all-link:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   13. LIGHT MODE SELECTOR ADAPTATIONS
   ========================================================================== */
[data-theme="light"] .card,
[data-theme="light"] .kpi-card,
[data-theme="light"] .metric-card {
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.09);
}

[data-theme="light"] .kpi-value,
[data-theme="light"] .metric-value {
  color: #0f172a;
}

[data-theme="light"] .sidebar {
  background: #ffffff;
  border-right-color: rgba(15, 23, 42, 0.09);
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom-color: rgba(15, 23, 42, 0.09);
}

[data-theme="light"] .status-pill-group {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

[data-theme="light"] .status-pill {
  color: #64748b;
}

[data-theme="light"] .status-pill:hover {
  color: #0f172a;
  background: #e2e8f0;
}

[data-theme="light"] .status-pill.active {
  background: #ffffff;
  color: var(--primary);
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .status-count {
  background: #ffffff;
  color: #64748b;
  border-color: #cbd5e1;
}

[data-theme="light"] .key-code {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #0f172a;
}
[data-theme="light"] .key-code:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

[data-theme="light"] .data-table th {
  background: #f8fafc;
  color: #64748b;
  border-bottom-color: #e2e8f0;
}

[data-theme="light"] .data-table td {
  border-bottom-color: #f1f5f9;
  color: #334155;
}

[data-theme="light"] .data-table tr:hover td {
  background: #f8fafc;
}

[data-theme="light"] .btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}
[data-theme="light"] .btn-secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

[data-theme="light"] .modal-dialog {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .modal-header,
[data-theme="light"] .modal-footer {
  border-color: #e2e8f0;
}

[data-theme="light"] .modal-close {
  color: #64748b;
}
[data-theme="light"] .modal-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .detail-key-banner {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .countdown-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .countdown-unit {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

[data-theme="light"] .countdown-num {
  color: var(--primary);
}

[data-theme="light"] .hwid-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .hwid-val {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .modal-device-container {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .device-item-card {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .device-item-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

[data-theme="light"] .device-item-hwid {
  color: #2563eb;
}

[data-theme="light"] .modal-device-search-input {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme="light"] .device-item-bottom {
  border-top-color: #e2e8f0;
}

[data-theme="light"] .detail-cell {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .detail-cell-val {
  color: #0f172a;
}

[data-theme="light"] .auth-viewport {
  background-color: #f8fafc;
}

[data-theme="light"] .auth-viewport::before {
  background-image: 
    radial-gradient(ellipse 65% 55% at 50% 25%, rgba(139, 92, 246, 0.08) 0%, transparent 60%),
    linear-gradient(to right, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
}

[data-theme="light"] .auth-card-luxury {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

[data-theme="light"] .luxury-input {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

[data-theme="light"] .nav-item {
  color: #64748b;
}

[data-theme="light"] .nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .nav-item.active {
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary);
}
