/* ═══════════════════════════════════════════════════════════════
   NEBULA UI DESIGN SYSTEM v1.0
   中后台框架 · 深浅双主题 · Phosphor Icons · AI 微交互
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size:14px; -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale; }
body { font-family: var(--font); background:var(--bg-root); color:var(--text-primary); min-height:100vh; line-height:1.6; }

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }
::-webkit-scrollbar-thumb:hover { background:var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   THEME TOKENS — Dark (default)
   ═══════════════════════════════════════════════════════ */
:root {
  /* Surface */
  --bg-root:        #09090B;
  --bg-elevated:    #111113;
  --bg-card:        #18181B;
  --bg-hover:       #202024;
  --bg-subtle:      #0E0E10;
  --bg-input:       #131316;

  /* Text */
  --text-primary:   #FAFAFA;
  --text-secondary: #A1A1AA;
  --text-muted:     #71717A;
  --text-placeholder:#52525B;

  /* Accent — Nebula Indigo */
  --accent:          #6366F1;
  --accent-light:    #818CF8;
  --accent-dark:     #4F46E5;
  --accent-glow:     rgba(99,102,241,0.25);
  --accent-subtle:   rgba(99,102,241,0.08);

  /* Semantic */
  --success:         #10B981;
  --success-subtle:  rgba(16,185,129,0.08);
  --warning:         #F59E0B;
  --warning-subtle:  rgba(245,158,11,0.08);
  --danger:          #EF4444;
  --danger-subtle:   rgba(239,68,68,0.08);
  --info:            #0EA5E9;
  --info-subtle:     rgba(14,165,233,0.08);
  --purple:          #A855F7;
  --purple-subtle:   rgba(168,85,247,0.08);
  --pink:            #EC4899;
  --pink-subtle:     rgba(236,72,153,0.08);

  /* Border */
  --border:          #27272A;
  --border-light:    #1F1F23;
  --border-focus:    #6366F1;

  /* Radius */
  --radius-xs:       4px;
  --radius-sm:       6px;
  --radius:          8px;
  --radius-lg:        12px;
  --radius-xl:        16px;
  --radius-full:      9999px;

  /* Shadow */
  --shadow-sm:       0 1px 2px rgba(0,0,0,0.3);
  --shadow:          0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:       0 4px 6px rgba(0,0,0,0.4), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:       0 10px 15px rgba(0,0,0,0.5), 0 4px 6px rgba(0,0,0,0.3);
  --shadow-xl:       0 20px 25px rgba(0,0,0,0.6), 0 8px 10px rgba(0,0,0,0.3);
  --shadow-glow:     0 0 20px var(--accent-glow);
  --shadow-card:     0 1px 3px rgba(0,0,0,0.3);

  /* Typography */
  --font:            -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono:       'SF Mono', 'Cascadia Code', 'Consolas', monospace;

  /* Transition */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition:      0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --sidebar-width:   240px;
  --sidebar-collapsed: 64px;
  --header-height:    56px;

  /* AI micro-interaction durations */
  --duration-pulse:  2s;
  --duration-bounce: 0.6s;
  --duration-shimmer:1.8s;
}

/* ═══════════════════════════════════════════════════════
   THEME: Light
   ═══════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg-root:        #FAFAFA;
  --bg-elevated:    #F4F4F5;
  --bg-card:        #FFFFFF;
  --bg-hover:       #F4F4F5;
  --bg-subtle:      #F9FAFB;
  --bg-input:       #F4F4F5;

  --text-primary:   #09090B;
  --text-secondary: #52525B;
  --text-muted:     #A1A1AA;
  --text-placeholder:#D4D4D8;

  --accent:         #4F46E5;
  --accent-light:   #6366F1;
  --accent-dark:    #4338CA;
  --accent-glow:    rgba(79,70,229,0.15);
  --accent-subtle:  rgba(79,70,229,0.06);

  --border:         #E4E4E7;
  --border-light:   #F4F4F5;
  --border-focus:   #4F46E5;

  --shadow-sm:      0 1px 2px rgba(0,0,0,0.05);
  --shadow:         0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg:      0 10px 15px rgba(0,0,0,0.05), 0 4px 6px rgba(0,0,0,0.03);
  --shadow-xl:      0 20px 25px rgba(0,0,0,0.06), 0 8px 10px rgba(0,0,0,0.03);
  --shadow-glow:    0 0 20px var(--accent-glow);
  --shadow-card:    0 1px 3px rgba(0,0,0,0.04);
}

/* ═══════════════════════════════════════════════════════
   LAYOUT SYSTEM
   ═══════════════════════════════════════════════════════ */
.nb-layout {
  display: flex; min-height: 100vh;
}
.nb-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top:0; left:0; bottom:0; z-index: 100;
  transition: width var(--transition), min-width var(--transition);
}
.nb-main {
  flex: 1; margin-left: var(--sidebar-width);
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}

/* Sidebar collapsed */
.nb-layout.collapsed .nb-sidebar { width: var(--sidebar-collapsed); min-width: var(--sidebar-collapsed); }
.nb-layout.collapsed .nb-main { margin-left: var(--sidebar-collapsed); }
.nb-layout.collapsed .nb-nav-label,
.nb-layout.collapsed .nb-sidebar-brand span,
.nb-layout.collapsed .nb-sidebar-footer span { display: none; }
.nb-layout.collapsed .nb-nav-item { justify-content: center; padding: 10px; }
.nb-layout.collapsed .nb-sidebar-brand { justify-content: center; padding: 16px 12px; }

/* ── Sidebar Brand ─────────────────────────────────── */
.nb-sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; height: var(--header-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nb-brand-logo {
  width: 32px; height: 32px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px; font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.nb-brand-name {
  font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}

/* ── Sidebar Navigation ─────────────────────────────── */
.nb-sidebar-nav {
  flex: 1; overflow-y: auto;
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.nb-nav-section {
  margin-top: 16px; margin-bottom: 4px;
}
.nb-nav-section:first-child { margin-top: 0; }
.nb-nav-section-title {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 0 10px; margin-bottom: 6px;
}
.nb-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; color: var(--text-secondary);
  cursor: pointer; transition: all var(--transition-fast);
  text-decoration: none; white-space: nowrap;
  position: relative;
}
.nb-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nb-nav-item.active {
  background: var(--accent-subtle); color: var(--accent);
  font-weight: 600;
}
.nb-nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nb-nav-item i { font-size: 18px; flex-shrink: 0; width: 20px; text-align: center; }
.nb-nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: var(--accent); color: #fff;
  padding: 1px 7px; border-radius: var(--radius-full); min-width: 18px; text-align: center;
}

/* ── Sidebar Footer ─────────────────────────────────── */
.nb-sidebar-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.nb-user-avatar {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.nb-user-info { flex: 1; min-width: 0; }
.nb-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.nb-user-role { font-size: 11px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════ */
.nb-header {
  height: var(--header-height);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky; top: 0; z-index: 50;
}
.nb-header-left { display: flex; align-items: center; gap: 12px; }
.nb-header-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.nb-header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ── Theme Toggle ──────────────────────────────────── */
.nb-theme-toggle {
  display: flex; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-full); padding: 3px;
  cursor: pointer; transition: all var(--transition-fast);
}
.nb-theme-toggle:hover { border-color: var(--accent); }
.nb-theme-toggle-btn {
  width: 30px; height: 28px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; border: none; background: transparent;
  color: var(--text-muted); cursor: pointer;
  transition: all var(--transition-fast);
}
.nb-theme-toggle-btn.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 6px var(--accent-glow);
}

/* ── Sidebar Toggle ────────────────────────────────── */
.nb-sidebar-toggle {
  width: 34px; height: 34px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all var(--transition-fast);
}
.nb-sidebar-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── Header Actions ────────────────────────────────── */
.nb-header-btn {
  width: 34px; height: 34px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all var(--transition-fast);
  position: relative;
}
.nb-header-btn:hover { border-color: var(--accent); color: var(--accent); }
.nb-header-btn .nb-dot {
  position: absolute; top: 3px; right: 3px;
  width: 8px; height: 8px; border-radius: var(--radius-full);
  background: var(--danger);
  animation: nbPulse var(--duration-pulse) ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════
   PAGE CONTENT
   ═══════════════════════════════════════════════════════ */
.nb-content {
  flex: 1; padding: 24px;
  overflow-y: auto;
}
.nb-page { display: none; }
.nb-page.active { display: block; animation: nbFadeIn 0.3s ease-out; }

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

/* ── Page Header ──────────────────────────────────── */
.nb-page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.nb-page-header-left h1 {
  font-size: 22px; font-weight: 700; color: var(--text-primary);
  margin-bottom: 4px;
}
.nb-page-header-left p {
  font-size: 13px; color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Cards
   ═══════════════════════════════════════════════════════ */
.nb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-fast);
}
.nb-card:hover { box-shadow: var(--shadow-md); }
.nb-card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--text-primary);
}
.nb-card-body { padding: 16px 18px; }
.nb-card-footer {
  padding: 12px 18px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}

/* Card variants */
.nb-card-flat { box-shadow: none; border-color: var(--border-light); }
.nb-card-accent { border-top: 3px solid var(--accent); }
.nb-card-success { border-top: 3px solid var(--success); }
.nb-card-warning { border-top: 3px solid var(--warning); }
.nb-card-danger { border-top: 3px solid var(--danger); }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Stats Cards
   ═══════════════════════════════════════════════════════ */
.nb-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.nb-stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: all var(--transition-fast);
  cursor: default;
}
.nb-stat-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.nb-stat-card:active { transform: translateY(0); }
.nb-stat-icon {
  width: 42px; height: 42px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.nb-stat-icon.accent  { background: var(--accent-subtle); color: var(--accent); }
.nb-stat-icon.success { background: var(--success-subtle); color: var(--success); }
.nb-stat-icon.warning { background: var(--warning-subtle); color: var(--warning); }
.nb-stat-icon.danger  { background: var(--danger-subtle); color: var(--danger); }
.nb-stat-icon.info    { background: var(--info-subtle); color: var(--info); }
.nb-stat-icon.purple  { background: var(--purple-subtle); color: var(--purple); }
.nb-stat-body { flex: 1; min-width: 0; }
.nb-stat-label {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
  margin-bottom: 4px;
}
.nb-stat-value {
  font-size: 28px; font-weight: 800; color: var(--text-primary);
  line-height: 1.1; font-variant-numeric: tabular-nums;
}
.nb-stat-change {
  font-size: 11px; font-weight: 600; margin-top: 4px;
  display: inline-flex; align-items: center; gap: 3px;
}
.nb-stat-change.up   { color: var(--success); }
.nb-stat-change.down { color: var(--danger); }

/* ── Stat Sparkline ────────────────────────────────── */
.nb-stat-sparkline { margin-top: 8px; height: 32px; }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Buttons
   ═══════════════════════════════════════════════════════ */
.nb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-primary);
  transition: all var(--transition-fast);
  text-decoration: none; white-space: nowrap;
  font-family: var(--font);
}
.nb-btn:hover { border-color: var(--accent); color: var(--accent); }
.nb-btn:active { transform: scale(0.97); }
.nb-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.nb-btn i { font-size: 16px; }

.nb-btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.nb-btn-primary:hover { filter: brightness(1.1); color: #fff !important; }
.nb-btn-primary:active { filter: brightness(1); }

.nb-btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.nb-btn-success:hover { filter: brightness(1.1); color: #fff !important; }
.nb-btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.nb-btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.nb-btn-danger:hover { filter: brightness(1.1); color: #fff !important; }

.nb-btn-ghost {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary);
}
.nb-btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

.nb-btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.nb-btn-xs { padding: 3px 8px; font-size: 11px; border-radius: var(--radius-xs); }
.nb-btn-lg { padding: 10px 22px; font-size: 14px; border-radius: var(--radius); }

.nb-btn-group { display: inline-flex; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.nb-btn-group .nb-btn { border: none; border-radius: 0; border-right: 1px solid var(--border); }
.nb-btn-group .nb-btn:last-child { border-right: none; }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Badges & Tags
   ═══════════════════════════════════════════════════════ */
.nb-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-full);
}
.nb-badge-accent  { background: var(--accent-subtle); color: var(--accent); }
.nb-badge-success { background: var(--success-subtle); color: var(--success); }
.nb-badge-warning { background: var(--warning-subtle); color: var(--warning); }
.nb-badge-danger  { background: var(--danger-subtle); color: var(--danger); }
.nb-badge-info    { background: var(--info-subtle); color: var(--info); }
.nb-badge-neutral { background: var(--bg-hover); color: var(--text-muted); }

.nb-tag {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 10px; font-weight: 500; padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Tables
   ═══════════════════════════════════════════════════════ */
.nb-table-wrap { overflow-x: auto; }
.nb-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.nb-table th {
  padding: 10px 14px; text-align: left; font-weight: 600;
  color: var(--text-muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.nb-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.nb-table tr:hover td { background: var(--bg-hover); }
.nb-table tr:last-child td { border-bottom: none; }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Forms
   ═══════════════════════════════════════════════════════ */
.nb-form-group { margin-bottom: 16px; }
.nb-form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.nb-form-input {
  width: 100%; padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-input);
  color: var(--text-primary); font-size: 13px;
  font-family: var(--font); transition: all var(--transition-fast);
  outline: none;
}
.nb-form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.nb-form-input::placeholder { color: var(--text-placeholder); }
.nb-form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.nb-form-select { cursor: pointer; appearance: none; }
.nb-form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.nb-form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

/* ── Toggle Switch ─────────────────────────────────── */
.nb-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 13px;
}
.nb-toggle-track {
  width: 38px; height: 22px; border-radius: var(--radius-full);
  background: var(--border); position: relative;
  transition: background var(--transition-fast);
}
.nb-toggle.on .nb-toggle-track { background: var(--accent); }
.nb-toggle-thumb {
  width: 18px; height: 18px; border-radius: var(--radius-full);
  background: #fff; position: absolute; top: 2px; left: 2px;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.nb-toggle.on .nb-toggle-thumb { transform: translateX(16px); }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Progress
   ═══════════════════════════════════════════════════════ */
.nb-progress {
  height: 6px; border-radius: var(--radius-full);
  background: var(--bg-hover); overflow: hidden;
}
.nb-progress-bar {
  height: 100%; border-radius: var(--radius-full);
  background: var(--accent); transition: width 0.6s ease;
}
.nb-progress-bar.success { background: var(--success); }
.nb-progress-bar.warning { background: var(--warning); }
.nb-progress-bar.danger  { background: var(--danger); }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Empty State & Placeholder
   ═══════════════════════════════════════════════════════ */
.nb-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 60px 20px; text-align: center;
}
.nb-empty-icon { font-size: 42px; color: var(--text-muted); opacity: 0.25; }
.nb-empty-title { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.nb-empty-desc  { font-size: 13px; color: var(--text-muted); max-width: 360px; }

.nb-placeholder {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 40px; text-align: center; color: var(--text-muted);
  font-size: 13px; background: var(--bg-card);
}
.nb-placeholder i { font-size: 36px; display: block; margin-bottom: 10px; opacity: 0.3; }
.nb-placeholder-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Dividers
   ═══════════════════════════════════════════════════════ */
.nb-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 20px 0;
}
.nb-divider-sm { margin: 12px 0; }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Avatars
   ═══════════════════════════════════════════════════════ */
.nb-avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.nb-avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.nb-avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.nb-avatar-accent  { background: var(--accent); }
.nb-avatar-success { background: var(--success); }
.nb-avatar-warning { background: var(--warning); }
.nb-avatar-danger  { background: var(--danger); }
.nb-avatar-info    { background: var(--info); }
.nb-avatar-purple  { background: var(--purple); }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Tooltips
   ═══════════════════════════════════════════════════════ */
.nb-tooltip {
  position: relative;
}
.nb-tooltip::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--text-primary); color: var(--bg-root);
  font-size: 11px; font-weight: 500; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition-fast);
}
.nb-tooltip:hover::after { opacity: 1; }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Grid & Layout Helpers
   ═══════════════════════════════════════════════════════ */
.nb-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.nb-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.nb-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.nb-flex { display: flex; }
.nb-flex-col { flex-direction: column; }
.nb-gap-sm { gap: 8px; }
.nb-gap { gap: 16px; }
.nb-gap-lg { gap: 24px; }
.nb-flex-1 { flex: 1; }
.nb-items-center { align-items: center; }
.nb-justify-between { justify-content: space-between; }
.nb-text-sm { font-size: 12px; }
.nb-text-xs { font-size: 11px; }
.nb-text-muted { color: var(--text-muted); }
.nb-text-accent { color: var(--accent); }
.nb-text-success { color: var(--success); }
.nb-text-danger { color: var(--danger); }
.nb-font-bold { font-weight: 700; }
.nb-mb { margin-bottom: 16px; }
.nb-mb-lg { margin-bottom: 24px; }
.nb-mb-sm { margin-bottom: 8px; }

/* ═══════════════════════════════════════════════════════
   AI MICRO-INTERACTIONS
   ═══════════════════════════════════════════════════════ */

/* ── Pulse Indicator ────────────────────────────────── */
@keyframes nbPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}
.nb-pulse {
  animation: nbPulse var(--duration-pulse) ease-in-out infinite;
}
.nb-pulse-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: var(--radius-full);
  flex-shrink: 0;
}
.nb-pulse-dot.live {
  background: var(--success);
  animation: nbPulse var(--duration-pulse) ease-in-out infinite;
  box-shadow: 0 0 6px rgba(16,185,129,0.5);
}
.nb-pulse-dot.idle {
  background: var(--text-muted);
}
.nb-pulse-ring {
  position: relative;
}
.nb-pulse-ring::after {
  content: ''; position: absolute; inset: -4px; border-radius: var(--radius-full);
  border: 2px solid var(--accent);
  animation: nbPulseRing 1.5s ease-out infinite;
}
@keyframes nbPulseRing {
  0%   { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* ── Score Bounce ──────────────────────────────────── */
@keyframes nbBounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.1); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}
.nb-bounce {
  animation: nbBounceIn var(--duration-bounce) cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.nb-bounce-once {
  animation: nbBounceIn var(--duration-bounce) cubic-bezier(0.68, -0.55, 0.265, 1.55) 1;
}

/* ── Shimmer Loading ───────────────────────────────── */
@keyframes nbShimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.nb-shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    var(--bg-hover) 40%,
    var(--bg-card) 80%
  );
  background-size: 200% 100%;
  animation: nbShimmer var(--duration-shimmer) ease-in-out infinite;
}
.nb-skeleton {
  border-radius: var(--radius); overflow: hidden;
}
.nb-skeleton-line {
  height: 14px; border-radius: var(--radius-xs);
  margin-bottom: 8px;
}
.nb-skeleton-line:last-child { margin-bottom: 0; width: 60%; }
.nb-skeleton-line.w-sm { width: 30%; }
.nb-skeleton-line.w-lg { width: 80%; }
.nb-skeleton-avatar {
  width: 40px; height: 40px; border-radius: var(--radius-full);
}
.nb-skeleton-card {
  padding: 18px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ── Glow on Hover ─────────────────────────────────── */
@keyframes nbGlow {
  0%, 100% { box-shadow: 0 0 5px var(--accent-glow); }
  50%      { box-shadow: 0 0 20px var(--accent-glow); }
}
.nb-glow-hover { transition: box-shadow var(--transition-fast); }
.nb-glow-hover:hover {
  box-shadow: 0 0 20px var(--accent-glow);
  border-color: var(--accent);
}

/* ── Float Animation ───────────────────────────────── */
@keyframes nbFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.nb-float {
  animation: nbFloat 3s ease-in-out infinite;
}

/* ── Number Counter (used with JS) ─────────────────── */
.nb-counter {
  display: inline-block; font-variant-numeric: tabular-nums;
  transition: all var(--transition);
}

/* ── AI Thinking Dots ──────────────────────────────── */
@keyframes nbThinking {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40%           { transform: scale(1); opacity: 1; }
}
.nb-thinking { display: inline-flex; gap: 3px; align-items: center; }
.nb-thinking-dot {
  width: 5px; height: 5px; border-radius: var(--radius-full);
  background: var(--accent);
  animation: nbThinking 1.2s ease-in-out infinite;
}
.nb-thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.nb-thinking-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Scan Line ─────────────────────────────────────── */
@keyframes nbScanLine {
  0%   { background-position: -200% 0; }
  100% { background-position: 300% 0; }
}
.nb-scan-line {
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent-glow) 45%,
    rgba(99,102,241,0.15) 50%,
    var(--accent-glow) 55%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: nbScanLine 2.5s ease-in-out infinite;
}

/* ── Ripple Effect ─────────────────────────────────── */
.nb-ripple {
  position: relative; overflow: hidden;
}
.nb-ripple-effect {
  position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  transform: scale(0); animation: nbRipple 0.6s ease-out;
  pointer-events: none;
}
@keyframes nbRipple {
  to { transform: scale(4); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Chart (CSS bar chart)
   ═══════════════════════════════════════════════════════ */
.nb-bar-chart {
  display: flex; align-items: flex-end; gap: 12px;
  height: 160px; padding: 8px 0;
}
.nb-bar-col {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%; justify-content: flex-end;
}
.nb-bar-value {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.nb-bar {
  width: 100%; max-width: 48px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--accent); transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  min-height: 4px;
}
.nb-bar:hover { filter: brightness(1.2); }
.nb-bar.gradient {
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
}
.nb-bar-label {
  font-size: 10px; color: var(--text-muted); font-weight: 500;
}

/* Bar color variants */
.nb-bar.accent  { background: var(--accent); }
.nb-bar.success { background: var(--success); }
.nb-bar.warning { background: var(--warning); }
.nb-bar.purple  { background: var(--purple); }
.nb-bar.info    { background: var(--info); }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Activity Timeline
   ═══════════════════════════════════════════════════════ */
.nb-timeline { display: flex; flex-direction: column; }
.nb-timeline-item {
  display: flex; gap: 12px; padding: 10px 0; position: relative;
}
.nb-timeline-item:not(:last-child) { border-bottom: 1px solid var(--border-light); }
.nb-timeline-dot {
  width: 32px; height: 32px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.nb-timeline-dot.accent  { background: var(--accent-subtle); color: var(--accent); }
.nb-timeline-dot.success { background: var(--success-subtle); color: var(--success); }
.nb-timeline-dot.warning { background: var(--warning-subtle); color: var(--warning); }
.nb-timeline-dot.danger  { background: var(--danger-subtle); color: var(--danger); }
.nb-timeline-body { flex: 1; min-width: 0; }
.nb-timeline-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.nb-timeline-desc  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.nb-timeline-time  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Toast Notifications
   ═══════════════════════════════════════════════════════ */
.nb-toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.nb-toast {
  padding: 10px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; color: #fff;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex; align-items: center; gap: 8px;
  animation: nbToastIn 0.3s ease-out;
  max-width: 380px;
}
.nb-toast-success { background: var(--success); }
.nb-toast-error   { background: var(--danger); }
.nb-toast-warning { background: var(--warning); }
.nb-toast-info    { background: var(--accent); }
@keyframes nbToastIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════
   COMPONENTS: Modal
   ═══════════════════════════════════════════════════════ */
.nb-modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  animation: nbFadeIn 0.15s ease-out;
}
.nb-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 24px;
  width: 440px; max-width: 90vw; max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: nbModalIn 0.2s ease-out;
}
@keyframes nbModalIn {
  from { transform: translateY(16px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.nb-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.nb-modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.nb-modal-close {
  cursor: pointer; font-size: 20px; color: var(--text-muted);
  background: none; border: none; padding: 4px;
}
.nb-modal-close:hover { color: var(--text-primary); }
.nb-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .nb-grid-3, .nb-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .nb-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .nb-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .nb-layout.mobile-open .nb-sidebar {
    transform: translateX(0);
  }
  .nb-main { margin-left: 0 !important; }
  .nb-grid-2, .nb-grid-3, .nb-grid-4,
  .nb-stats-grid { grid-template-columns: 1fr; }
  .nb-content { padding: 16px; }
  .nb-header { padding: 0 16px; }
}

/* ═══════════════════════════════════════════════════════
   SUBTLE THEME TRANSITION
   ═══════════════════════════════════════════════════════ */
[data-theme-transitioning] *,
[data-theme-transitioning] *::before,
[data-theme-transitioning] *::after {
  transition: background-color 0.3s ease,
              border-color 0.3s ease,
              color 0.3s ease,
              box-shadow 0.3s ease !important;
}
