/* ============================================================
   QRUCIBLE — Unified Design System
   Patentify color scheme + Qrucible structural layout
   Dark engineering UI with rich accent palette
   ============================================================ */

/* ── CSS Custom Properties (Dark Theme Default) ── */
:root {
  /* Backgrounds */
  --bg-primary: #0A0A0A;
  --bg-secondary: #111111;
  --bg-tertiary: #1A1A1A;
  --bg-elevated: #222222;
  --bg-overlay: rgba(10, 10, 10, 0.92);

  /* Text */
  --text-primary: rgba(255,255,255,0.92);
  --text-secondary: rgba(255,255,255,0.6);
  --text-tertiary: rgba(255,255,255,0.3);
  --text-disabled: rgba(255,255,255,0.2);

  /* Accents — Patentify Rich Color Palette */
  --accent-cyan: #06B6D4;
  --accent-cyan-dim: rgba(6, 182, 212, 0.15);
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-purple: #8B5CF6;
  --accent-purple-dim: rgba(139, 92, 246, 0.15);
  --accent-purple-glow: rgba(139, 92, 246, 0.35);
  --accent-green: #22C55E;
  --accent-green-dim: rgba(34, 197, 94, 0.15);
  --accent-green-glow: rgba(34, 197, 94, 0.35);
  --accent-orange: #D4A017;
  --accent-orange-dim: rgba(212, 160, 23, 0.15);
  --accent-orange-glow: rgba(212, 160, 23, 0.35);
  --accent-red: #EF4444;
  --accent-red-dim: rgba(239, 68, 68, 0.15);
  --accent-red-glow: rgba(239, 68, 68, 0.35);
  --accent-blue: #2563EB;
  --accent-blue-dim: rgba(37, 99, 235, 0.15);
  --accent-blue-glow: rgba(37, 99, 235, 0.35);
  --accent-teal: #2E8B7A;
  --accent-teal-dim: rgba(46, 139, 122, 0.15);
  --accent-teal-glow: rgba(46, 139, 122, 0.35);
  --accent-rose: #F43F5E;
  --accent-rose-dim: rgba(244, 63, 94, 0.15);
  --accent-rose-glow: rgba(244, 63, 94, 0.35);

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
  --font-display: 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Type Scale */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

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

  /* Borders */
  --border-subtle: 1px solid rgba(255,255,255,0.06);
  --border-default: 1px solid rgba(255,255,255,0.1);
  --border-strong: 1px solid rgba(255,255,255,0.18);
  --border-accent: 1px solid var(--accent-teal);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.7);
  --shadow-cyan: 0 0 20px rgba(6, 182, 212, 0.2);
  --shadow-purple: 0 0 20px rgba(139, 92, 246, 0.2);
  --shadow-green: 0 0 20px rgba(34, 197, 94, 0.2);
  --shadow-orange: 0 0 20px rgba(212, 160, 23, 0.2);
  --shadow-teal: 0 0 20px rgba(46, 139, 122, 0.2);
  --shadow-blue: 0 0 20px rgba(37, 99, 235, 0.2);

  /* Gradients */
  --gradient-cyan: linear-gradient(135deg, #06B6D4, #0891B2);
  --gradient-purple: linear-gradient(135deg, #8B5CF6, #7C3AED);
  --gradient-green: linear-gradient(135deg, #22C55E, #16A34A);
  --gradient-orange: linear-gradient(135deg, #D4A017, #B8860B);
  --gradient-teal: linear-gradient(135deg, #2E8B7A, #236B5F);
  --gradient-blue: linear-gradient(135deg, #2563EB, #1D4ED8);
  --gradient-rose: linear-gradient(135deg, #F43F5E, #E11D48);
  --gradient-bg: linear-gradient(180deg, #0A0A0A 0%, #080808 100%);
  --gradient-panel: linear-gradient(180deg, rgba(17,17,17,0.98) 0%, rgba(10,10,10,0.98) 100%);
  --gradient-card: linear-gradient(135deg, rgba(26,26,26,0.8), rgba(17,17,17,0.8));
  --gradient-glow-cyan: radial-gradient(ellipse at center, rgba(6,182,212,0.08) 0%, transparent 70%);
  --gradient-glow-teal: radial-gradient(ellipse at center, rgba(46,139,122,0.08) 0%, transparent 70%);

  /* Transitions */
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --topbar-height: 56px;
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --guide-width: 320px;
  --statusbar-height: 28px;
  --demo-bar-height: 0px;
  --context-banner-height: 48px;

  /* ── Patentify Compatibility Aliases ── */
  --bg: var(--bg-primary);
  --bg-surface: var(--bg-secondary);
  --bg-card: var(--bg-tertiary);
  --bg-hover: var(--bg-elevated);
  --border: var(--border-default);
  --text: var(--text-primary);
  --text-muted: var(--text-tertiary);
  --text-faint: var(--text-disabled);
  --accent: var(--accent-teal);
  --teal: #2E8B7A;
  --blue: var(--accent-blue);
  --amber: var(--accent-orange);
  --green: var(--accent-green);
  --red: var(--accent-red);
  --violet: var(--accent-purple);
  --success: var(--accent-green);
  --warning: var(--accent-orange);
  --danger: var(--accent-red);
  --info: var(--accent-blue);
}

/* ── Light Theme ── */
[data-theme="light"] {
  --bg-primary: #F5F5F5;
  --bg-secondary: #EBEBEB;
  --bg-tertiary: #E0E0E0;
  --bg-elevated: #F5F5F5;
  --bg-overlay: rgba(245, 245, 245, 0.92);

  --text-primary: rgba(0,0,0,0.87);
  --text-secondary: rgba(0,0,0,0.6);
  --text-tertiary: rgba(0,0,0,0.35);
  --text-disabled: rgba(0,0,0,0.2);

  --accent-cyan: #0891B2;
  --accent-purple: #7C3AED;
  --accent-green: #16A34A;
  --accent-orange: #B8860B;
  --accent-red: #DC2626;
  --accent-blue: #1D4ED8;
  --accent-teal: #236B5F;
  --accent-rose: #E11D48;

  --accent-cyan-dim: rgba(8, 145, 178, 0.1);
  --accent-purple-dim: rgba(124, 58, 237, 0.1);
  --accent-green-dim: rgba(22, 163, 74, 0.1);
  --accent-orange-dim: rgba(184, 134, 11, 0.1);
  --accent-red-dim: rgba(220, 38, 38, 0.1);
  --accent-blue-dim: rgba(29, 78, 216, 0.1);
  --accent-teal-dim: rgba(35, 107, 95, 0.1);
  --accent-rose-dim: rgba(225, 29, 72, 0.1);

  --accent-cyan-glow: rgba(8, 145, 178, 0.25);
  --accent-purple-glow: rgba(124, 58, 237, 0.25);
  --accent-green-glow: rgba(22, 163, 74, 0.25);
  --accent-orange-glow: rgba(184, 134, 11, 0.25);
  --accent-red-glow: rgba(220, 38, 38, 0.25);
  --accent-blue-glow: rgba(29, 78, 216, 0.25);
  --accent-teal-glow: rgba(35, 107, 95, 0.25);
  --accent-rose-glow: rgba(225, 29, 72, 0.25);

  --border-subtle: 1px solid rgba(0,0,0,0.06);
  --border-default: 1px solid rgba(0,0,0,0.1);
  --border-strong: 1px solid rgba(0,0,0,0.16);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.18);
  --shadow-cyan: 0 0 20px rgba(8,145,178,0.15);
  --shadow-purple: 0 0 20px rgba(124,58,237,0.15);
  --shadow-green: 0 0 20px rgba(22,163,74,0.15);
  --shadow-orange: 0 0 20px rgba(184,134,11,0.15);
  --shadow-teal: 0 0 20px rgba(35,107,95,0.15);
  --shadow-blue: 0 0 20px rgba(29,78,216,0.15);

  --gradient-bg: linear-gradient(180deg, #F5F5F5 0%, #EBEBEB 100%);
  --gradient-panel: linear-gradient(180deg, rgba(235,235,235,0.98) 0%, rgba(245,245,245,0.98) 100%);
  --gradient-card: linear-gradient(135deg, rgba(224,224,224,0.9), rgba(235,235,235,0.9));
  --gradient-cyan: linear-gradient(135deg, #0891B2, #06748E);
  --gradient-purple: linear-gradient(135deg, #7C3AED, #6D28D9);
  --gradient-green: linear-gradient(135deg, #16A34A, #15803D);
  --gradient-orange: linear-gradient(135deg, #B8860B, #996F0A);
  --gradient-teal: linear-gradient(135deg, #236B5F, #1A5248);
  --gradient-blue: linear-gradient(135deg, #1D4ED8, #1E40AF);
  --gradient-glow-cyan: radial-gradient(ellipse at center, rgba(8,145,178,0.06) 0%, transparent 70%);
  --gradient-glow-teal: radial-gradient(ellipse at center, rgba(35,107,95,0.06) 0%, transparent 70%);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* ── Noise/Grain Texture Overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

[data-theme="light"] body::before {
  opacity: 0.15;
}

/* ── App Shell Layout ── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   DEMO TOGGLE BAR
   ============================================================ */
.demo-bar {
  display: none;
  height: 0;
}

.demo-bar.hidden {
  display: none;
}

.demo-bar-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.demo-bar-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  transition: all var(--transition-base);
}

.demo-bar-indicator.off {
  background: rgba(255,255,255,0.4);
  box-shadow: none;
}

.demo-toggle {
  position: relative;
  width: 44px;
  height: 22px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-full);
  border: 1px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all var(--transition-base);
  outline: none;
}

.demo-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.demo-toggle:checked {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.4);
}

.demo-toggle:checked::after {
  transform: translateX(22px);
}

.demo-bar-status {
  font-size: 10px;
  opacity: 0.8;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-3);
  z-index: 100;
  flex-shrink: 0;
}

.topbar.glass {
  background: rgba(17, 17, 17, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .topbar.glass {
  background: rgba(235, 235, 235, 0.7);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-logo-img {
  height: 24px;
  width: auto;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.topbar-logo:hover .topbar-logo-img {
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.5));
}

.topbar-logo svg { width: 28px; height: 28px; }

.topbar-logo-text {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.topbar-logo-text span {
  background: var(--gradient-teal);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.12);
}

[data-theme="light"] .topbar-divider {
  background: rgba(0,0,0,0.12);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.breadcrumb-item { color: var(--text-tertiary); white-space: nowrap; }
.breadcrumb-item.active { color: var(--text-primary); }
.breadcrumb-sep { color: var(--text-disabled); font-size: 10px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.segment-badge {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--accent-teal-dim);
  border: 1px solid var(--accent-teal);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--accent-teal);
  font-weight: 500;
}

.segment-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-teal);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.demo-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  transition: all var(--transition-base);
}

.demo-status-dot.inactive {
  background: var(--text-disabled);
  box-shadow: none;
}

.icon-btn.demo-active {
  color: var(--accent-green);
  background: rgba(76, 175, 80, 0.12);
  border-color: rgba(76, 175, 80, 0.3);
  position: relative;
}

.icon-btn.demo-active::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse-dot 2s infinite;
}

.icon-btn.demo-active:hover {
  background: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.5);
}

/* ============================================================
   VIEW TOGGLE (RAG / IP)
   ============================================================ */
.view-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.view-toggle-segment {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
}

.view-toggle-segment:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.view-toggle-segment.active {
  background: var(--accent-teal);
  color: #fff;
  box-shadow: 0 1px 3px rgba(6, 182, 212, 0.3);
}

.view-toggle-segment.active:hover {
  background: var(--accent-teal);
  color: #fff;
}

.view-toggle-segment svg {
  flex-shrink: 0;
}

[data-theme="light"] .view-toggle {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .view-toggle-segment:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .view-toggle-segment.active {
  background: var(--accent-teal);
  color: #fff;
}

/* Hidden utility */
.hidden { display: none !important; }

/* Responsive: compact toggle on small screens */
@media (max-width: 768px) {
  .view-toggle-segment {
    padding: 4px 8px;
    font-size: 10px;
  }
  .view-toggle-segment svg {
    display: none;
  }
}

.icon-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 14px;
}

.icon-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.15);
}

[data-theme="light"] .icon-btn:hover {
  border-color: rgba(0,0,0,0.15);
}

.user-menu-btn {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 4px 10px 4px 4px;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.user-menu-btn:hover { border-color: rgba(255,255,255,0.15); color: var(--text-primary); }
[data-theme="light"] .user-menu-btn:hover { border-color: rgba(0,0,0,0.15); }

.user-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--gradient-purple);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white;
}

/* ============================================================
   MIDDLE ROW (Sidebar + Main + Guide)
   ============================================================ */
.content-row {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: var(--border-default);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-slow), min-width var(--transition-slow);
  z-index: 50;
  flex-shrink: 0;
}

.sidebar.glass {
  background: rgba(17, 17, 17, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .sidebar.glass {
  background: rgba(235, 235, 235, 0.6);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-disabled);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-section-label { opacity: 0; }

.sidebar-toggle {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--text-tertiary);
  cursor: pointer; border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-2) 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-group { padding: var(--space-2) 0; }

.nav-group-label {
  padding: var(--space-2) var(--space-4) var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-disabled);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-group-label { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 7px var(--space-3);
  margin: 1px 8px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--radius-md);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

[data-theme="light"] .nav-item:hover {
  background: rgba(0,0,0,0.04);
}

.nav-item.active {
  color: var(--accent-teal);
  background: var(--accent-teal-dim);
  box-shadow: inset 3px 0 0 var(--accent-teal);
}

.nav-item-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

.nav-item-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }

.nav-badge {
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  border-radius: var(--radius-full);
  background: var(--accent-teal-dim);
  color: var(--accent-teal);
  flex-shrink: 0;
}

.sidebar.collapsed .nav-item-text,
.sidebar.collapsed .nav-badge { opacity: 0; width: 0; overflow: hidden; }

.sidebar.collapsed .nav-item { justify-content: center; padding: 7px; margin: 1px 6px; }
.sidebar.collapsed .nav-item.active { border-radius: var(--radius-md); box-shadow: none; }

/* Sidebar tooltip on collapse */
.sidebar.collapsed .nav-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  border: var(--border-default);
  box-shadow: var(--shadow-md);
  z-index: 200;
}

.sidebar-footer {
  padding: var(--space-3);
  border-top: var(--border-subtle);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-primary);
  position: relative;
}

.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
.main-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

.page-container {
  padding: var(--space-6);
  max-width: 1400px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

/* ============================================================
   GUIDE PANEL
   ============================================================ */
.guide-panel {
  width: var(--guide-width);
  min-width: var(--guide-width);
  background: var(--bg-secondary);
  border-left: var(--border-default);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-slow), min-width var(--transition-slow), opacity var(--transition-slow);
  flex-shrink: 0;
}

.guide-panel.collapsed {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
}

.guide-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
  border-radius: var(--radius-lg) 0 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.guide-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  display: flex; align-items: center; gap: var(--space-2);
}

.guide-title::before {
  content: '?';
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent-purple-dim);
  border: 1px solid var(--accent-purple);
  color: var(--accent-purple);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.guide-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.guide-body::-webkit-scrollbar { width: 3px; }
.guide-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.guide-section { margin-bottom: var(--space-5); }

.guide-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-disabled);
  margin-bottom: var(--space-2);
}

.guide-tip {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

.guide-tip-icon { flex-shrink: 0; margin-top: 1px; }

/* ============================================================
   STATUS BAR
   ============================================================ */
.statusbar {
  height: var(--statusbar-height);
  min-height: var(--statusbar-height);
  background: var(--bg-secondary);
  border-top: var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-5);
  flex-shrink: 0;
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

.status-dot.connected { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.status-dot.disconnected { background: var(--accent-red); }
.status-dot.warning { background: var(--accent-orange); }

.status-spacer { flex: 1; }

.status-version {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-disabled);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-secondary);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover { border-color: rgba(255,255,255,0.15); }
[data-theme="light"] .card:hover { border-color: rgba(0,0,0,0.15); }

.card-header {
  padding: var(--space-4);
  border-bottom: var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body { padding: var(--space-4); }

.card-accent-cyan { border-color: rgba(6, 182, 212, 0.3); }
.card-accent-purple { border-color: rgba(139, 92, 246, 0.3); }
.card-accent-green { border-color: rgba(34, 197, 94, 0.3); }
.card-accent-orange { border-color: rgba(212, 160, 23, 0.3); }
.card-accent-teal { border-color: rgba(46, 139, 122, 0.3); }
.card-accent-blue { border-color: rgba(37, 99, 235, 0.3); }
.card-accent-rose { border-color: rgba(244, 63, 94, 0.3); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-cyan { background: var(--accent-cyan-dim); color: var(--accent-cyan); border: 1px solid rgba(6,182,212,0.3); }
.badge-purple { background: var(--accent-purple-dim); color: var(--accent-purple); border: 1px solid rgba(139,92,246,0.3); }
.badge-green { background: var(--accent-green-dim); color: var(--accent-green); border: 1px solid rgba(34,197,94,0.3); }
.badge-orange { background: var(--accent-orange-dim); color: var(--accent-orange); border: 1px solid rgba(212,160,23,0.3); }
.badge-red { background: var(--accent-red-dim); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.3); }
.badge-blue { background: var(--accent-blue-dim); color: var(--accent-blue); border: 1px solid rgba(37,99,235,0.3); }
.badge-teal { background: var(--accent-teal-dim); color: var(--accent-teal); border: 1px solid rgba(46,139,122,0.3); }
.badge-rose { background: var(--accent-rose-dim); color: var(--accent-rose); border: 1px solid rgba(244,63,94,0.3); }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-secondary); border: var(--border-subtle); }
.badge-amber { background: var(--accent-orange-dim); color: var(--accent-orange); border: 1px solid rgba(212,160,23,0.3); }
.badge-violet { background: var(--accent-purple-dim); color: var(--accent-purple); border: 1px solid rgba(139,92,246,0.3); }
.badge-muted { background: var(--bg-tertiary); color: var(--text-tertiary); border: var(--border-subtle); }
.badge-running { background: var(--accent-blue-dim); color: var(--accent-blue); border: 1px solid rgba(37,99,235,0.3); }

.confidence-high { background: var(--accent-green-dim); color: var(--accent-green); border: 1px solid rgba(34,197,94,0.4); font-family: var(--font-mono); }
.confidence-medium { background: var(--accent-orange-dim); color: var(--accent-orange); border: 1px solid rgba(212,160,23,0.4); font-family: var(--font-mono); }
.confidence-low { background: var(--accent-red-dim); color: var(--accent-red); border: 1px solid rgba(239,68,68,0.4); font-family: var(--font-mono); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-green);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: var(--border-default);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: rgba(255,255,255,0.2);
}

[data-theme="light"] .btn-secondary:hover {
  border-color: rgba(0,0,0,0.2);
}

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

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-danger {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border: 1px solid rgba(239,68,68,0.3);
}

.btn-danger:hover {
  background: var(--accent-red);
  color: white;
}

.btn-cyan {
  background: var(--accent-cyan-dim);
  color: var(--accent-cyan);
  border: 1px solid rgba(6,182,212,0.3);
}

.btn-cyan:hover {
  background: var(--accent-cyan);
  color: white;
}

.btn-teal {
  background: var(--gradient-teal);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-teal:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow-md);
}

.btn-sm {
  padding: 4px var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 10px var(--space-5);
  font-size: var(--text-base);
}

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-primary);
  border: var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px var(--space-3);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(46, 139, 122, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-disabled);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(255,255,255,0.3)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

[data-theme="light"] .form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='rgba(0,0,0,0.3)' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.form-textarea { resize: vertical; min-height: 80px; }

[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
  background: white;
  color: var(--text-primary);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: var(--border-default);
}

.table-wrap::-webkit-scrollbar { height: 4px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th {
  background: var(--bg-tertiary);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: var(--border-default);
  white-space: nowrap;
}

td {
  padding: var(--space-3);
  border-bottom: var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
[data-theme="light"] tr:hover td { background: rgba(0,0,0,0.02); }

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  animation: dropdown-open 0.12s ease;
  padding: var(--space-1) 0;
}

@keyframes dropdown-open {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
}

[data-theme="light"] .dropdown-item:hover {
  background: rgba(0,0,0,0.06);
}

.dropdown-item.danger { color: var(--accent-red); }
.dropdown-item.danger:hover { background: var(--accent-red-dim); }

.dropdown-sep {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: var(--space-1) 0;
}

[data-theme="light"] .dropdown-sep { background: rgba(0,0,0,0.06); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-secondary);
  border: var(--border-default);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  animation: modal-up 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@keyframes modal-up {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body { padding: var(--space-5); }
.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: var(--border-default);
  gap: 0;
  overflow-x: auto;
}

.tabs::-webkit-scrollbar { height: 0; }

.tab {
  padding: 8px var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-sans);
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
  color: var(--accent-teal);
  border-bottom-color: var(--accent-teal);
}

/* ============================================================
   PROGRESS
   ============================================================ */
.progress-bar {
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.progress-fill-green { background: var(--gradient-green); }
.progress-fill-cyan { background: var(--gradient-cyan); }
.progress-fill-purple { background: var(--gradient-purple); }
.progress-fill-orange { background: var(--gradient-orange); }
.progress-fill-teal { background: var(--gradient-teal); }
.progress-fill-blue { background: var(--gradient-blue); }
.progress-fill-red { background: var(--accent-red); }

/* ============================================================
   TOOLTIPS
   ============================================================ */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  white-space: nowrap;
  border: var(--border-default);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  pointer-events: none;
}

/* ============================================================
   SKELETON LOADER
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-tertiary) 25%,
    var(--bg-elevated) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   SCROLLBAR GLOBAL
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-muted { color: var(--text-tertiary); }
.text-disabled { color: var(--text-disabled); }
.text-primary { color: var(--text-primary); }
.text-accent { color: var(--accent-teal); }
.font-mono { font-family: var(--font-mono); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.rounded { border-radius: var(--radius-md); }
.rounded-full { border-radius: var(--radius-full); }
.border { border: var(--border-default); }
.w-full { width: 100%; }
.min-w-0 { min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ============================================================
   CONTEXT BANNER
   ============================================================ */
.context-banner {
  height: var(--context-banner-height);
  min-height: var(--context-banner-height);
  background: linear-gradient(90deg, rgba(46,139,122,0.12) 0%, rgba(6,182,212,0.08) 100%);
  border-bottom: 1px solid rgba(46,139,122,0.2);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-4);
  flex-shrink: 0;
}

.context-banner.hidden {
  display: none;
}

.context-banner-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-md);
  background: var(--accent-teal-dim);
  border: 1px solid rgba(46,139,122,0.3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--accent-teal);
}

.context-banner-text {
  flex: 1; min-width: 0;
}

.context-banner-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-banner-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-banner-actions {
  display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0;
}

/* ============================================================
   PANEL RESIZER
   ============================================================ */
.panel-resizer {
  width: 4px;
  background: transparent;
  cursor: col-resize;
  flex-shrink: 0;
  transition: background var(--transition-fast);
  position: relative;
  z-index: 10;
}

.panel-resizer:hover {
  background: var(--accent-teal);
}

.panel-resizer::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -4px; right: -4px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  gap: var(--space-3);
}

.empty-state-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-disabled);
  margin-bottom: var(--space-2);
}

.empty-state-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-state-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 280px;
}

/* ============================================================
   NOTIFICATION / TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: calc(var(--statusbar-height) + var(--space-4));
  right: var(--space-4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  color: var(--text-primary);
  pointer-events: all;
  animation: toast-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 280px;
  max-width: 360px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.warning { border-left: 3px solid var(--accent-orange); }
.toast.info { border-left: 3px solid var(--accent-blue); }

/* ============================================================
   IP WORKSPACE
   ============================================================ */

/* ── Node Canvas ─────────────────────────────────────── */
.node-canvas {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--bg-primary);
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  cursor: default;
}

[data-theme="light"] .node-canvas {
  background-image:
    radial-gradient(circle, rgba(0,0,0,0.06) 1px, transparent 1px);
}

.canvas-viewport {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform-origin: 0 0;
  will-change: transform;
}

/* ── IP Node ──────────────────────────────────────────── */
.ip-node {
  position: absolute;
  width: 240px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  cursor: move;
  user-select: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ip-node:hover {
  border-color: rgba(255,255,255,0.15);
  box-shadow: var(--shadow-lg);
}

.ip-node.selected {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 1px var(--accent-teal), var(--shadow-lg);
}

.ip-node-header {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  cursor: move;
}

.ip-node-icon {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}

.ip-node-title {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ip-node-body {
  padding: var(--space-2) var(--space-3);
}

/* ── Edge ─────────────────────────────────────────────── */
.edge-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}

.edge-path {
  fill: none;
  stroke: rgba(255,255,255,0.12);
  stroke-width: 1.5;
  stroke-dasharray: 6 3;
}

.edge-path.active {
  stroke: var(--accent-teal);
  stroke-dasharray: none;
}

/* ── Port ─────────────────────────────────────────────── */
.port {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid rgba(255,255,255,0.2);
  cursor: crosshair;
  transition: all var(--transition-fast);
  position: absolute;
}

.port:hover, .port.connecting { border-color: var(--accent-teal); background: var(--accent-teal); }

/* ── Canvas Toolbar ───────────────────────────────────── */
.canvas-toolbar {
  position: absolute;
  top: var(--space-3);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.canvas-toolbar-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.canvas-toolbar-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.canvas-toolbar-btn.active { background: var(--accent-teal-dim); color: var(--accent-teal); }

.canvas-toolbar-sep {
  width: 1px; height: 16px;
  background: rgba(255,255,255,0.1);
}

/* ── Mini-Map ─────────────────────────────────────────── */
.mini-map {
  position: absolute;
  bottom: var(--space-4);
  right: var(--space-4);
  width: 160px; height: 100px;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.mini-map-viewport {
  position: absolute;
  border: 1px solid var(--accent-teal);
  background: rgba(46, 139, 122, 0.1);
  cursor: move;
}

/* ── Metadata panel (right-side inspector) ────────────── */
.meta-panel {
  width: 300px;
  min-width: 300px;
  background: var(--bg-secondary);
  border-left: var(--border-default);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-slow), min-width var(--transition-slow);
  flex-shrink: 0;
}

.meta-panel.collapsed {
  width: 0;
  min-width: 0;
}

/* ── Timeline Panel ──────────────────────────────────── */
.timeline-panel {
  background: var(--bg-secondary);
  border-top: var(--border-default);
  transition: height var(--transition-slow);
  flex-shrink: 0;
  overflow: hidden;
}

.timeline-panel.collapsed { height: 0; }

.timeline-header {
  padding: var(--space-2) var(--space-4);
  border-bottom: var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timeline-track {
  display: flex;
  align-items: center;
  gap: 0;
  height: 36px;
  border-bottom: var(--border-subtle);
}

.timeline-track-label {
  width: 100px;
  min-width: 100px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  border-right: var(--border-subtle);
  height: 100%;
  display: flex;
  align-items: center;
}

.timeline-blocks {
  flex: 1;
  position: relative;
  height: 100%;
  overflow: hidden;
}

.timeline-block {
  position: absolute;
  height: 20px;
  top: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ── Side-by-Side Diff ───────────────────────────────── */
.diff-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.diff-pane {
  background: var(--bg-secondary);
  overflow: auto;
}

.diff-pane-header {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-tertiary);
  border-bottom: var(--border-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
}

.diff-line {
  display: flex;
  gap: var(--space-3);
  padding: 2px var(--space-3);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

.diff-line.added { background: rgba(34,197,94,0.08); }
.diff-line.removed { background: rgba(239,68,68,0.08); }
.diff-line-num { color: var(--text-disabled); min-width: 28px; text-align: right; }
.diff-line-content { flex: 1; color: var(--text-secondary); }
.diff-line.added .diff-line-content { color: var(--accent-green); }
.diff-line.removed .diff-line-content { color: var(--accent-red); }

/* ── Canvas Overlay Panels ───────────────────────────── */
.canvas-overlay-panel {
  position: absolute;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
}

/* ── Relationship Graph ──────────────────────────────── */
.rel-graph-node {
  position: absolute;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.rel-graph-node:hover { border-color: var(--accent-teal); color: var(--accent-teal); }
.rel-graph-node.highlighted { border-color: var(--accent-cyan); color: var(--accent-cyan); background: var(--accent-cyan-dim); }

/* ============================================================
   RAG PIPELINE (Search / Retrieval)
   ============================================================ */

/* ── Search Input Row ─────────────────────────────────── */
.search-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border-bottom: var(--border-subtle);
  flex-shrink: 0;
}

.search-input-wrap {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 36px 8px var(--space-3);
  background: var(--bg-primary);
  border: var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(46, 139, 122, 0.15);
}

.search-input::placeholder { color: var(--text-disabled); }

.search-icon {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-disabled);
  pointer-events: none;
}

/* ── Filter Bar ───────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-bottom: var(--border-subtle);
  overflow-x: auto;
  flex-shrink: 0;
}

.filter-bar::-webkit-scrollbar { height: 0; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-chip:hover { border-color: rgba(255,255,255,0.15); color: var(--text-primary); }
[data-theme="light"] .filter-chip:hover { border-color: rgba(0,0,0,0.15); }
.filter-chip.active { background: var(--accent-teal-dim); border-color: var(--accent-teal); color: var(--accent-teal); }

/* ── Source Card ──────────────────────────────────────── */
.source-card {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: border-color var(--transition-fast);
  cursor: pointer;
}

.source-card:hover { border-color: rgba(255,255,255,0.1); }
[data-theme="light"] .source-card:hover { border-color: rgba(0,0,0,0.1); }

.source-card-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.source-card-body { flex: 1; min-width: 0; }

.source-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-card-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 2px;
}

.source-card-snippet {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Chunk Viewer ─────────────────────────────────────── */
.chunk-viewer {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-secondary);
}

.chunk-highlight {
  background: rgba(212, 160, 23, 0.2);
  border-radius: 2px;
  color: var(--accent-orange);
  font-weight: 500;
}

/* ── Answer Panel ─────────────────────────────────────── */
.answer-card {
  background: linear-gradient(135deg, rgba(46, 139, 122, 0.08), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(46, 139, 122, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.answer-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.answer-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent-teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.answer-body {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text-primary);
}

.answer-citations {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-3);
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.citation-chip:hover { border-color: var(--accent-teal); color: var(--accent-teal); }

/* ── Evidence Trail ───────────────────────────────────── */
.evidence-trail {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.evidence-item {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.evidence-item:hover { background: var(--bg-tertiary); }

.evidence-bar {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.evidence-content { flex: 1; min-width: 0; }

.evidence-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.evidence-snippet {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Score Bars ───────────────────────────────────────── */
.score-bar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.score-bar-track {
  flex: 1;
  height: 3px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
}

.score-label {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  min-width: 28px;
  text-align: right;
}

/* ============================================================
   SEARCH BAR (Standalone)
   ============================================================ */
.qr-search-bar {
  display: flex;
  align-items: stretch;
  background: var(--bg-secondary);
  border: var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.qr-search-bar:focus-within {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(46, 139, 122, 0.12);
}

.qr-search-icon {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3) 0 var(--space-4);
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.qr-search-input {
  flex: 1;
  background: none;
  border: none;
  padding: var(--space-3) 0;
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
}

.qr-search-input::placeholder { color: var(--text-disabled); }

.qr-search-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  border-left: var(--border-subtle);
  flex-shrink: 0;
}

.qr-search-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  background: var(--accent-teal);
  color: white;
  border: none;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  transition: filter var(--transition-fast);
  flex-shrink: 0;
}

.qr-search-submit:hover { filter: brightness(1.1); }

/* ============================================================
   MATRIX GRID
   ============================================================ */
.matrix-grid {
  display: grid;
  border: var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.matrix-cell {
  padding: var(--space-2) var(--space-3);
  border-right: var(--border-subtle);
  border-bottom: var(--border-subtle);
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.matrix-cell.header {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.matrix-cell.highlight { background: var(--accent-teal-dim); }

/* ============================================================
   NOTIFICATION DOT
   ============================================================ */
.notif-dot {
  position: relative;
}

.notif-dot::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 2px solid var(--bg-secondary);
}

/* ============================================================
   PILL NAV (used in some pages)
   ============================================================ */
.pill-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: var(--border-subtle);
  width: fit-content;
}

.pill-nav-item {
  padding: 5px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.pill-nav-item:hover { color: var(--text-primary); }
.pill-nav-item.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ============================================================
   SPLIT PANE LAYOUT
   ============================================================ */
.split-pane {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.split-left {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.split-right {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-left: var(--border-default);
}

/* ============================================================
   FEATURE SECTIONS (Landing / Onboarding)
   ============================================================ */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.feature-card {
  padding: var(--space-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: var(--border-subtle);
}

.feature-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-3);
  font-size: 18px;
}

.feature-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.feature-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ============================================================
   CHAT / CONVERSATION UI
   ============================================================ */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.chat-message {
  display: flex;
  gap: var(--space-2);
  max-width: 90%;
}

.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.assistant { align-self: flex-start; }

.chat-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.chat-bubble {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.chat-message.user .chat-bubble {
  background: var(--accent-teal-dim);
  border: 1px solid rgba(46,139,122,0.3);
  color: var(--text-primary);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-sm) var(--radius-md);
}

.chat-message.assistant .chat-bubble {
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) var(--radius-sm);
}

.chat-input-row {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: var(--border-subtle);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--bg-primary);
  border: var(--border-default);
  border-radius: var(--radius-md);
  padding: 8px var(--space-3);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  resize: none;
  height: 36px;
  transition: border-color var(--transition-fast);
}

.chat-input:focus { border-color: var(--accent-teal); }
.chat-input::placeholder { color: var(--text-disabled); }

/* ── Chat FAB ─────────────────────────────────────────── */
.chat-fab {
  position: fixed;
  bottom: calc(var(--statusbar-height) + var(--space-4));
  right: var(--space-4);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--gradient-teal);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg), var(--shadow-teal);
  transition: all var(--transition-fast);
  z-index: 400;
  color: white;
}

.chat-fab:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow-xl), var(--shadow-teal);
}

/* ── Chat Widget Panel ────────────────────────────────── */
.chat-widget-panel {
  position: fixed;
  bottom: calc(var(--statusbar-height) + var(--space-4) + 56px);
  right: var(--space-4);
  width: 340px;
  height: 480px;
  background: var(--bg-secondary);
  border: var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 400;
  animation: modal-up 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   LOADING STATES
   ============================================================ */
.loading-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--bg-tertiary);
  border-top-color: var(--accent-teal);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-dots {
  display: flex; gap: 4px; align-items: center;
}

.loading-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent-teal);
  animation: bounce-dot 1.2s infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce-dot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ============================================================
   DIVIDERS
   ============================================================ */
.divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: var(--space-3) 0;
}

.divider-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0;
  font-size: var(--text-xs);
  color: var(--text-disabled);
}

.divider-label::before, .divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.06);
}

[data-theme="light"] .divider { background: rgba(0,0,0,0.06); }
[data-theme="light"] .divider-label::before, [data-theme="light"] .divider-label::after { background: rgba(0,0,0,0.06); }

/* ============================================================
   ACCORDION
   ============================================================ */
.accordion-item {
  border-bottom: var(--border-subtle);
}

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

.accordion-trigger:hover { color: var(--text-primary); }

.accordion-trigger svg {
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.accordion-item.open .accordion-trigger { color: var(--text-primary); }
.accordion-item.open .accordion-trigger svg { transform: rotate(180deg); }

.accordion-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.accordion-item.open .accordion-content { max-height: 1000px; }

.accordion-body {
  padding: 0 var(--space-4) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ============================================================
   COPY BUTTON (inline code blocks)
   ============================================================ */
.copy-btn {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: 2px 8px;
  background: var(--bg-elevated);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0;
}

.copy-btn:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.15); }
pre:hover .copy-btn { opacity: 1; }

/* ============================================================
   CODE BLOCK
   ============================================================ */
pre {
  position: relative;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-tertiary);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
  border-radius: 0;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.page-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.page-btn.active { background: var(--accent-teal-dim); border-color: var(--accent-teal); color: var(--accent-teal); }
.page-btn:disabled { opacity: 0.3; pointer-events: none; }

/* ============================================================
   HOTKEY DISPLAY
   ============================================================ */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1px 5px;
  background: var(--bg-tertiary);
  border: 1px solid rgba(255,255,255,0.12);
  border-bottom: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ============================================================
   WORKFLOW STEP INDICATOR
   ============================================================ */
.workflow-steps {
  display: flex;
  align-items: center;
  gap: 0;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-disabled);
  font-weight: 500;
}

.workflow-step.active { color: var(--accent-teal); }
.workflow-step.completed { color: var(--accent-green); }

.workflow-step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.workflow-step.completed .workflow-step-num {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: white;
}

.workflow-connector {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.08);
  min-width: var(--space-4);
}

.workflow-step.completed + .workflow-connector { background: var(--accent-green); }

/* ============================================================
   SHORTCUT BAR
   ============================================================ */
.shortcut-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-top: var(--border-subtle);
  background: var(--bg-secondary);
  font-size: var(--text-xs);
  color: var(--text-disabled);
  flex-shrink: 0;
  overflow-x: auto;
}

.shortcut-bar::-webkit-scrollbar { height: 0; }

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* ============================================================
   ANIMATED RING LOADING
   ============================================================ */
.ring-loader {
  display: inline-block;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent-teal);
  animation: spin 0.8s linear infinite;
}

/* ============================================================
   TAG INPUT
   ============================================================ */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px var(--space-2);
  background: var(--bg-primary);
  border: var(--border-default);
  border-radius: var(--radius-md);
  cursor: text;
  min-height: 36px;
  align-items: center;
  transition: border-color var(--transition-fast);
}

.tag-input-wrap:focus-within {
  border-color: var(--accent-teal);
  box-shadow: 0 0 0 3px rgba(46,139,122,0.15);
}

.tag-input-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-teal-dim);
  border: 1px solid rgba(46,139,122,0.3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--accent-teal);
}

.tag-input-remove {
  cursor: pointer;
  color: var(--accent-teal);
  opacity: 0.6;
  font-size: 12px;
  line-height: 1;
}

.tag-input-remove:hover { opacity: 1; }

.tag-input-field {
  border: none;
  background: none;
  outline: none;
  font-size: var(--text-xs);
  color: var(--text-primary);
  min-width: 80px;
  font-family: var(--font-sans);
}

.tag-input-field::placeholder { color: var(--text-disabled); }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  display: inline-block;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0; height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

input:checked + .toggle-track { background: var(--accent-teal); border-color: var(--accent-teal); }
input:checked + .toggle-track::after { transform: translateX(16px); }

/* ============================================================
   INLINE ALERT
   ============================================================ */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.6;
  border-left: 3px solid;
}

.alert-info { background: var(--accent-blue-dim); border-color: var(--accent-blue); color: var(--text-secondary); }
.alert-success { background: var(--accent-green-dim); border-color: var(--accent-green); color: var(--text-secondary); }
.alert-warning { background: var(--accent-orange-dim); border-color: var(--accent-orange); color: var(--text-secondary); }
.alert-danger { background: var(--accent-red-dim); border-color: var(--accent-red); color: var(--text-secondary); }

/* ============================================================
   VERTICAL STEPPER
   ============================================================ */
.stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stepper-step {
  display: flex;
  gap: var(--space-3);
  position: relative;
}

.stepper-step-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 20px;
}

.stepper-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-disabled);
  flex-shrink: 0;
  z-index: 1;
}

.stepper-step.active .stepper-dot { border-color: var(--accent-teal); color: var(--accent-teal); background: var(--accent-teal-dim); }
.stepper-step.completed .stepper-dot { background: var(--accent-green); border-color: var(--accent-green); color: white; }

.stepper-connector {
  flex: 1;
  width: 1px;
  background: rgba(255,255,255,0.08);
  margin: 2px 0;
  min-height: var(--space-4);
}

.stepper-step.completed .stepper-connector { background: var(--accent-green); }

.stepper-content {
  flex: 1;
  padding-bottom: var(--space-4);
}

.stepper-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
  line-height: 20px;
}

.stepper-step.active .stepper-title { color: var(--text-primary); }
.stepper-step.completed .stepper-title { color: var(--accent-green); }

.stepper-desc {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ============================================================
   PRINT / EXPORT UTILITIES
   ============================================================ */
@media print {
  .topbar, .sidebar, .guide-panel, .statusbar, .demo-bar {
    display: none !important;
  }
  .main-content { overflow: visible; }
  .app-shell { height: auto; }
}

/* ============================================================
   FOCUS VISIBLE ACCESSIBILITY
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent-teal);
  outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  :root { --guide-width: 280px; }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 200px;
    --guide-width: 260px;
  }
  .page-container { padding: var(--space-4); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  :root {
    --sidebar-width: 180px;
    --guide-width: 240px;
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ============================================================
   CHAT WIDGET ENHANCED LAYOUT
   ============================================================ */

.chat-widget-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.chat-widget-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-widget-messages::-webkit-scrollbar { width: 3px; }
.chat-widget-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.chat-widget-input-row {
  padding: var(--space-2) var(--space-3);
  border-top: var(--border-subtle);
  display: flex;
  gap: var(--space-2);
  align-items: center;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.chat-widget-input {
  flex: 1;
  background: var(--bg-primary);
  border: var(--border-default);
  border-radius: var(--radius-md);
  padding: 6px var(--space-3);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  resize: none;
  height: 32px;
  line-height: 1.4;
  transition: border-color var(--transition-fast);
}

.chat-widget-input:focus { border-color: var(--accent-teal); }
.chat-widget-input::placeholder { color: var(--text-disabled); }

.chat-widget-send {
  width: 28px; height: 28px;
  background: var(--accent-teal);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: filter var(--transition-fast);
  flex-shrink: 0;
}

.chat-widget-send:hover { filter: brightness(1.1); }

/* ── Typing Indicator ─────────────────────────────────── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-2);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  width: fit-content;
}

.typing-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: bounce-dot 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Suggested replies ────────────────────────────────── */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px var(--space-3);
  border-top: var(--border-subtle);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.suggestion-chip {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 500;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.suggestion-chip:hover { border-color: var(--accent-teal); color: var(--accent-teal); }

/* ============================================================
   METADATA PROPERTY LIST
   ============================================================ */
.prop-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.prop-row {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: var(--border-subtle);
  align-items: flex-start;
}

.prop-row:last-child { border-bottom: none; }

.prop-label {
  width: 100px;
  min-width: 100px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-disabled);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 2px;
}

.prop-value {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  word-break: break-word;
}

/* ============================================================
   DRAG AND DROP
   ============================================================ */
.drop-zone {
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
  cursor: pointer;
  text-align: center;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent-teal);
  background: var(--accent-teal-dim);
}

[data-theme="light"] .drop-zone {
  border-color: rgba(0,0,0,0.15);
}

.drop-zone-icon { color: var(--text-disabled); margin-bottom: var(--space-2); }
.drop-zone-text { font-size: var(--text-sm); color: var(--text-tertiary); }
.drop-zone-sub { font-size: var(--text-xs); color: var(--text-disabled); }

/* ============================================================
   CUSTOM SELECT DROPDOWN
   ============================================================ */
.select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 600;
  overflow: hidden;
  max-height: 240px;
  overflow-y: auto;
}

.select-option {
  padding: 7px var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.select-option:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
[data-theme="light"] .select-option:hover { background: rgba(0,0,0,0.06); }
.select-option.selected { color: var(--accent-teal); background: var(--accent-teal-dim); }

/* ============================================================
   MINI STAT CHIP
   ============================================================ */
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--bg-tertiary);
  border: var(--border-subtle);
  color: var(--text-tertiary);
}

.stat-chip.positive { background: var(--accent-green-dim); color: var(--accent-green); border-color: rgba(34,197,94,0.3); }
.stat-chip.negative { background: var(--accent-red-dim); color: var(--accent-red); border-color: rgba(239,68,68,0.3); }
.stat-chip.neutral { background: var(--bg-tertiary); color: var(--text-secondary); }

/* ============================================================
   RESIZABLE PANEL (JS-driven)
   ============================================================ */
.resize-handle {
  position: absolute;
  z-index: 20;
  transition: background var(--transition-fast);
}

.resize-handle-h {
  top: 0; bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
}

.resize-handle-v {
  left: 0; right: 0;
  height: 4px;
  cursor: row-resize;
  background: transparent;
}

.resize-handle-h:hover, .resize-handle-v:hover {
  background: var(--accent-teal);
}

/* ============================================================
   DATA INLINE CHART SPARKLINES
   ============================================================ */
.sparkline {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 24px;
}

.spark-bar {
  width: 4px;
  border-radius: 1px;
  background: var(--accent-teal);
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.spark-bar:hover { opacity: 1; }

/* ============================================================
   GLOBAL SEARCH OVERLAY
   ============================================================ */
.global-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 800;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  animation: fade-in 0.15s ease;
}

.global-search-panel {
  width: 100%;
  max-width: 640px;
  background: var(--bg-elevated);
  border: var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-up 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.global-search-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border-subtle);
}

.global-search-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.global-search-result:hover { background: rgba(255,255,255,0.04); }
[data-theme="light"] .global-search-result:hover { background: rgba(0,0,0,0.04); }

.global-search-result.active { background: var(--accent-teal-dim); }

/* ============================================================
   BREADCRUMB TRAIL
   ============================================================ */
.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-disabled);
  overflow: hidden;
  flex-shrink: 0;
}

.breadcrumb-trail-item { white-space: nowrap; }
.breadcrumb-trail-sep { color: var(--text-disabled); }
.breadcrumb-trail-item.current { color: var(--text-tertiary); }

/* ============================================================
   ── END QRUCIBLE DESIGN SYSTEM ──
   ============================================================ */

/* ── Dropdown Rounded ──────────────────────────────────────── */
.dropdown-menu {
  border-radius: var(--radius-lg);
}

/* ── Select Dropdown Rounded ───────────────────────────────── */
.select-dropdown {
  border-radius: var(--radius-lg);
}

/* ── Scrollable dropdown container rounded ─────────────────── */
.dropdown-menu,
.select-dropdown {
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.form-select {
  border-radius: var(--radius-lg);
}

/* ── Nav Item Fully Rounded ─────────────────────────────────── */
.nav-item {
  border-radius: var(--radius-lg);
}

/* ── Sidebar collapsed nav-item also rounded ───────────────── */
.sidebar.collapsed .nav-item {
  border-radius: var(--radius-lg);
}

/* ── Guide Panel: rounded top-left corner restored ─────────── */
.guide-panel {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.guide-header {
  border-radius: var(--radius-lg) 0 0 0;
}

/* ── LUCID Guide Pane Tab Bar Rounded ───────────────────────── */
.qr-guide-tab-bar {
  border-radius: var(--radius-lg) 0 0 0;
}

/* ── Sidebar Tabs (RAG | IP) ─────────────────────────────────── */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.06));
}

.sidebar-tab {
  flex: 1;
  padding: 6px 0;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1;
}

.sidebar-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.sidebar-tab.active {
  color: var(--accent-teal);
  background: var(--bg-tertiary);
  border-color: var(--accent-teal);
  box-shadow: 0 0 8px rgba(46, 139, 122, 0.15);
}

[data-theme="light"] .sidebar-tab.active {
  background: rgba(46, 139, 122, 0.08);
}

/* ── Sidebar Tab Panes ──────────────────────────────────────── */
.sidebar-tab-pane {
  display: none;
}

.sidebar-tab-pane.active {
  display: block;
}

/* ── Collapsed Sidebar Tab Behavior ─────────────────────────── */
.sidebar.collapsed .sidebar-tabs {
  padding: 4px 4px 8px;
  gap: 2px;
}

.sidebar.collapsed .sidebar-tab {
  font-size: 0;
  padding: 6px 4px;
  min-width: 0;
}

.sidebar.collapsed .sidebar-tab::after {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.sidebar.collapsed .sidebar-tab[data-tab="rag"]::after {
  content: 'R';
}

.sidebar.collapsed .sidebar-tab[data-tab="ip"]::after {
  content: 'IP';
}
