/* ============================================
   CeraVis MLCC Design System - Base
   Modern · Light-first · Minimal · Subtle depth
   Dual Theme (Light default / Dark optional)
   ============================================ */

:root {
  /* ===== LIGHT THEME (default) =====
     风格：现代简约 · 浅色为主 · 突出质感
     留白多 · 阴影柔和 · 圆角适中 · 字体轻盈 */

  /* Background layers */
  --bg-base: #F7F8FA;
  --bg-elevated: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-surface-hi: #F8FAFC;
  --bg-overlay: rgba(255, 255, 255, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.7);

  /* Borders & Lines (更柔和) */
  --border-subtle: rgba(15, 23, 42, 0.05);
  --border-default: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.16);
  --border-glow: rgba(37, 99, 235, 0.30);

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #64748B;
  --text-disabled: #94A3B8;
  --text-inverse: #FFFFFF;

  /* Brand & Accent (稍降饱和度，更现代) */
  --brand-primary: #2563EB;
  --brand-primary-hi: #3B82F6;
  --brand-primary-lo: #1D4ED8;
  --brand-cyan: #0891B2;
  --brand-purple: #7C3AED;
  --brand-pink: #DB2777;
  --brand-emerald: #059669;
  --brand-amber: #D97706;
  --brand-rose: #DC2626;

  /* Brand text on tinted backgrounds */
  --brand-purple-text: #6D28D9;
  --brand-cyan-text: #0E7490;
  --brand-pink-text: #BE185D;
  --brand-emerald-text: #047857;
  --brand-amber-text: #B45309;
  --brand-blue-text: #1D4ED8;
  --brand-rose-text: #B91C1C;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, #2563EB 0%, #0891B2 100%);
  --grad-purple: linear-gradient(135deg, #7C3AED 0%, #DB2777 100%);
  --grad-emerald: linear-gradient(135deg, #059669 0%, #0891B2 100%);
  --grad-amber: linear-gradient(135deg, #D97706 0%, #DC2626 100%);
  --grad-hero: radial-gradient(ellipse 800px 600px at 20% 0%, rgba(37, 99, 235, 0.06) 0%, transparent 60%),
               radial-gradient(ellipse 600px 600px at 90% 100%, rgba(124, 58, 237, 0.05) 0%, transparent 50%);

  /* Status */
  --status-success: #059669;
  --status-success-bg: rgba(5, 150, 105, 0.08);
  --status-warning: #D97706;
  --status-warning-bg: rgba(217, 119, 6, 0.08);
  --status-danger: #DC2626;
  --status-danger-bg: rgba(220, 38, 38, 0.08);
  --status-info: #2563EB;
  --status-info-bg: rgba(37, 99, 235, 0.08);

  /* Shadow (更柔和、多层次) */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.10);
  --shadow-glow: 0 4px 16px rgba(37, 99, 235, 0.12);

  /* Topbar */
  --topbar-bg: rgba(255, 255, 255, 0.85);
  --topbar-border: 1px solid var(--border-subtle);

  /* Selection */
  --selection-bg: rgba(37, 99, 235, 0.2);
  --selection-color: var(--text-primary);

  /* Pattern overlays */
  --pattern-color: rgba(15, 23, 42, 0.05);

  /* Misc */
  --backdrop-blur: blur(20px);
  --code-bg: #F1F5F9;
  --kbd-bg: #F1F5F9;
  --kbd-border: 1px solid var(--border-default);

  /* Typography (更轻盈) */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, monospace;

  /* Radius (柔和) */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 20px;
  --r-full: 9999px;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 60px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 120ms;
  --dur-mid: 220ms;
  --dur-slow: 360ms;
}

/* ============================================
   DARK THEME (optional)
   ============================================ */
[data-theme="dark"] {
  --bg-base: #0A0E1A;
  --bg-elevated: #0F141F;
  --bg-surface: #131A28;
  --bg-surface-hi: #1A2233;
  --bg-overlay: rgba(15, 20, 31, 0.85);
  --bg-glass: rgba(15, 20, 31, 0.7);

  --border-subtle: rgba(148, 163, 184, 0.06);
  --border-default: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --border-glow: rgba(96, 165, 250, 0.40);

  --text-primary: #E4E7EB;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;
  --text-disabled: #475569;
  --text-inverse: #0F172A;

  --brand-primary: #3B82F6;
  --brand-primary-hi: #60A5FA;
  --brand-primary-lo: #1D4ED8;
  --brand-cyan: #06B6D4;
  --brand-purple: #8B5CF6;
  --brand-pink: #EC4899;
  --brand-emerald: #10B981;
  --brand-amber: #F59E0B;
  --brand-rose: #EF4444;

  --brand-purple-text: #C4B5FD;
  --brand-cyan-text: #67E8F9;
  --brand-pink-text: #F9A8D4;
  --brand-emerald-text: #6EE7B7;
  --brand-amber-text: #FCD34D;
  --brand-blue-text: #93C5FD;
  --brand-rose-text: #FCA5A5;

  --grad-brand: linear-gradient(135deg, #3B82F6 0%, #06B6D4 100%);
  --grad-purple: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  --grad-emerald: linear-gradient(135deg, #10B981 0%, #06B6D4 100%);
  --grad-amber: linear-gradient(135deg, #F59E0B 0%, #EF4444 100%);
  --grad-hero: radial-gradient(ellipse at top, rgba(59, 130, 246, 0.10) 0%, transparent 60%),
               radial-gradient(ellipse at bottom right, rgba(139, 92, 246, 0.08) 0%, transparent 50%);

  --status-success: #10B981;
  --status-success-bg: rgba(16, 185, 129, 0.12);
  --status-warning: #F59E0B;
  --status-warning-bg: rgba(245, 158, 11, 0.12);
  --status-danger: #EF4444;
  --status-danger-bg: rgba(239, 68, 68, 0.12);
  --status-info: #3B82F6;
  --status-info-bg: rgba(59, 130, 246, 0.12);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5), 0 4px 8px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 4px 16px rgba(59, 130, 246, 0.2);

  --topbar-bg: rgba(15, 20, 31, 0.85);
  --topbar-border: 1px solid var(--border-subtle);

  --selection-bg: rgba(59, 130, 246, 0.4);
  --selection-color: var(--text-primary);

  --pattern-color: rgba(148, 163, 184, 0.06);

  --backdrop-blur: blur(20px);
  --code-bg: #0F141F;
  --kbd-bg: #1A2233;
  --kbd-border: 1px solid var(--border-default);
}

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s var(--ease-out), color 0.3s var(--ease-out);
}

body {
  background-image: var(--grad-hero);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--brand-primary); }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input, textarea, select {
  font: inherit;
  color: inherit;
}

ul, ol { list-style: none; }

img, svg { display: block; max-width: 100%; }

::selection {
  background: var(--selection-bg);
  color: var(--selection-color);
}

/* Scrollbar (更纤细) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ===== Typography ===== */
.t-display {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text-primary);
}
.t-h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; color: var(--text-primary); }
.t-h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
.t-h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.t-body { font-size: 14px; }
.t-sm { font-size: 12px; }
.t-xs { font-size: 11px; }
.t-mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.t-muted { color: var(--text-secondary); }
.t-dim { color: var(--text-tertiary); }
.t-upper { text-transform: uppercase; letter-spacing: 0.08em; }
.t-num { font-variant-numeric: tabular-nums; }
.t-medium { font-weight: 500; }

/* ===== Layout Shell ===== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

.sidebar {
  grid-area: sidebar;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 10;
}

.topbar {
  grid-area: topbar;
  background: var(--topbar-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-bottom: var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 var(--s-6);
  gap: var(--s-4);
  position: sticky;
  top: 0;
  z-index: 9;
}

.main {
  grid-area: main;
  padding: var(--s-6) var(--s-8);
  overflow-x: hidden;
}

@media (max-width: 1024px) {
  .app {
    grid-template-columns: var(--sidebar-w-collapsed) 1fr;
  }
}

/* ===== Sidebar ===== */
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-3);
}
.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--grad-brand);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.brand-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 1px;
}

.nav-section {
  padding: var(--s-2) var(--s-3);
}
.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: var(--s-3) var(--s-3) var(--s-2);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  cursor: pointer;
  user-select: none;
  transition: color var(--dur-fast);
}
.nav-label:hover { color: var(--text-secondary); }
.nav-label .icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform var(--dur-mid) var(--ease-out);
}
.nav-label.collapsed .icon {
  transform: rotate(-90deg);
}
.nav-label.collapsed + .nav-group {
  display: none;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 7px var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  margin-bottom: 1px;
  position: relative;
}
.nav-item:hover {
  background: var(--bg-surface-hi);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--status-info-bg);
  color: var(--brand-primary);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--brand-primary);
  border-radius: 0 var(--r-full) var(--r-full) 0;
}
.nav-item .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .icon { opacity: 1; }
.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--r-full);
  background: var(--status-info-bg);
  color: var(--brand-primary);
}
.nav-item .badge.dot {
  padding: 0;
  width: 6px;
  height: 6px;
  background: var(--brand-cyan);
  box-shadow: 0 0 8px var(--brand-cyan);
}
.nav-item .badge.new {
  background: var(--grad-emerald);
  color: white;
}

.sidebar-foot {
  margin-top: auto;
  padding: var(--s-4);
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ===== Topbar ===== */
.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 8px 12px 8px 36px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--dur-fast) var(--ease-out);
}
.topbar-search input::placeholder { color: var(--text-tertiary); }
.topbar-search input:focus {
  border-color: var(--brand-primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--status-info-bg);
}
.topbar-search .icon-search {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.topbar-search kbd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  background: var(--kbd-bg);
  border: var(--kbd-border);
  border-radius: var(--r-xs);
  color: var(--text-tertiary);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  position: relative;
  transition: all var(--dur-fast) var(--ease-out);
}
.icon-btn:hover {
  background: var(--bg-surface-hi);
  color: var(--text-primary);
}
.icon-btn .dot-notif {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--brand-rose);
  border-radius: 50%;
  border: 2px solid var(--bg-elevated);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px 12px 4px 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.user-chip:hover {
  background: var(--bg-surface-hi);
  border-color: var(--border-strong);
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--grad-purple);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; }
.user-role { font-size: 10px; color: var(--text-tertiary); }

/* ===== Theme Toggle Button ===== */
.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: all var(--dur-fast) var(--ease-out);
}
.theme-toggle:hover {
  background: var(--bg-surface-hi);
  color: var(--brand-primary);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  transition: all var(--dur-mid) var(--ease-out);
}
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ===== Page Header ===== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--s-6);
  gap: var(--s-4);
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  color: var(--text-primary);
}
.page-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
}
.page-actions {
  display: flex;
  gap: var(--s-2);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary {
  background: var(--brand-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--brand-primary-lo);
  box-shadow: var(--shadow-md);
}
.btn-ghost {
  background: var(--bg-surface);
  border-color: var(--border-default);
  color: var(--text-primary);
}
.btn-ghost:hover {
  background: var(--bg-surface-hi);
  border-color: var(--border-strong);
}
.btn-outline {
  background: transparent;
  border-color: var(--border-default);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 20px; font-size: 14px; }
.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
  justify-content: center;
}

/* ===== Cards (更现代简约) ===== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: all var(--dur-mid) var(--ease-out);
}
.card-hi {
  background: var(--bg-surface-hi);
  border-color: var(--border-default);
}
.card:hover {
  box-shadow: var(--shadow-sm);
}
.card-glow::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--brand-primary) 50%, transparent 100%);
  opacity: 0.5;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-4);
}
.card-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-primary);
}
.card-title .accent {
  width: 3px;
  height: 14px;
  background: var(--brand-primary);
  border-radius: var(--r-full);
}
.card-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* ===== Grids ===== */
.grid { display: grid; gap: var(--s-4); }
.g-1 { grid-template-columns: 1fr; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }
.g-6 { grid-template-columns: repeat(6, 1fr); }
.g-12 { grid-template-columns: repeat(12, 1fr); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
.g-3-1 { grid-template-columns: 3fr 1fr; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }

@media (max-width: 1280px) {
  .g-4, .g-5, .g-6 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: repeat(2, 1fr); }
  .g-2-1, .g-1-2, .g-3-1 { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4, .span-6, .span-8 { grid-column: span 2; }
}
@media (max-width: 768px) {
  .g-2, .g-3, .g-4, .g-5, .g-6 { grid-template-columns: 1fr; }
  .span-2, .span-3, .span-4, .span-6, .span-8 { grid-column: span 1; }
  .main { padding: var(--s-4); }
}

/* ===== Stat Cards ===== */
.stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: all var(--dur-mid) var(--ease-out);
}
.stat:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-default);
}
.stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-bottom: var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-bottom: var(--s-2);
  color: var(--text-primary);
}
.stat-value .unit {
  font-size: 14px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-left: 4px;
}
.stat-delta {
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
}
.stat-delta.up { color: var(--status-success); }
.stat-delta.down { color: var(--status-danger); }
.stat-foot {
  margin-top: var(--s-2);
  font-size: 11px;
  color: var(--text-tertiary);
}
.stat-spark {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100px;
  height: 36px;
  opacity: 0.6;
}

/* ===== Badges & Tags ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-surface-hi);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.badge-info { background: var(--status-info-bg); color: var(--brand-primary); border-color: transparent; }
.badge-success { background: var(--status-success-bg); color: var(--status-success); border-color: transparent; }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning); border-color: transparent; }
.badge-danger { background: var(--status-danger-bg); color: var(--status-danger); border-color: transparent; }
.badge-purple { background: rgba(124, 58, 237, 0.10); color: var(--brand-purple-text); border-color: transparent; }
.badge-cyan { background: rgba(8, 145, 178, 0.10); color: var(--brand-cyan-text); border-color: transparent; }
.badge-outline { background: transparent; border-color: var(--border-default); }
.badge-pill { border-radius: var(--r-full); padding: 3px 10px; }

/* ===== Tags / Chips ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-surface-hi);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.tag-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ===== Tables ===== */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: var(--s-3) var(--s-4);
  background: var(--bg-surface-hi);
  border-bottom: 1px solid var(--border-subtle);
}
.tbl tbody td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.tbl tbody tr:hover {
  background: var(--bg-surface-hi);
}
.tbl tbody tr:last-child td {
  border-bottom: none;
}
.tbl .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ===== Progress / Bar ===== */
.bar {
  height: 6px;
  background: var(--bg-surface-hi);
  border-radius: var(--r-full);
  overflow: hidden;
  position: relative;
}
.bar-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--r-full);
  transition: width var(--dur-slow) var(--ease-out);
}
.bar-fill.cyan { background: var(--brand-cyan); }
.bar-fill.purple { background: var(--brand-purple); }
.bar-fill.emerald { background: var(--brand-emerald); }
.bar-fill.amber { background: var(--brand-amber); }
.bar-fill.gradient { background: var(--grad-brand); }

/* ===== Form ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.input, .textarea, .select {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--dur-fast) var(--ease-out);
  width: 100%;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px var(--status-info-bg);
}
.textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-sans);
}

/* ===== List items ===== */
.list {
  display: flex;
  flex-direction: column;
}
.list-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--bg-surface-hi);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--brand-primary);
}
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.list-item .li-sub {
  font-size: 11px;
  color: var(--text-tertiary);
}
.list-item .li-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ===== Loading / Skeleton ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.skel {
  background: linear-gradient(90deg, var(--bg-surface) 0%, var(--bg-surface-hi) 50%, var(--bg-surface) 100%);
  background-size: 200% 100%;
  animation: skel 1.6s linear infinite;
  border-radius: var(--r-sm);
}
@keyframes skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn var(--dur-mid) var(--ease-out); }

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(37, 99, 235, 0.3); }
  50% { box-shadow: 0 0 16px rgba(37, 99, 235, 0.6); }
}
.glow { animation: glow 2.4s ease-in-out infinite; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-4);
}
.tab {
  padding: var(--s-3) var(--s-4);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* ===== Utility ===== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.cursor-pointer { cursor: pointer; }

.mb-1 { margin-bottom: var(--s-1); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-6 { margin-bottom: var(--s-6); }
.mt-2 { margin-top: var(--s-2); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }

/* ===== Divider ===== */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: var(--s-4) 0;
}
.divider-v {
  width: 1px;
  background: var(--border-subtle);
  align-self: stretch;
  margin: 0 var(--s-3);
}