/* ═══════════════════════════════════════════════════════════════════
   SPOT ON CONTROL CENTER v2 — DESIGN SYSTEM
   Premium dark-mode-first design system
   Version: 2.0 | Maintained by: Blake Lappan
   ═══════════════════════════════════════════════════════════════════ */

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

/* ─── CSS Custom Properties ─────────────────────────────────────── */
:root {
  /* Colors — Dark Mode (default) */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1a1f2e;
  --bg-card: #1e2538;
  --bg-elevated: #242b3d;
  --bg-hover: #2a3348;
  --bg-active: #323c52;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  --accent-blue: #3b82f6;
  --accent-blue-light: #60a5fa;
  --accent-blue-dark: #2563eb;
  --accent-green: #10b981;
  --accent-green-light: #34d399;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fbbf24;
  --accent-red: #ef4444;
  --accent-red-light: #f87171;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;

  --border-color: #1e293b;
  --border-light: #334155;
  --border-focus: #3b82f6;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
  --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.15);
  --shadow-glow-amber: 0 0 20px rgba(245, 158, 11, 0.15);
  --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Glassmorphism */
  --glass-bg: rgba(30, 37, 56, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(20px);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 64px;

  /* Z-index scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-tooltip: 600;
}

/* ─── Light Mode ────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;

  --border-color: #e2e8f0;
  --border-light: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.1);

  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.06);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

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

a {
  color: var(--accent-blue-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-blue);
}

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

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

/* ─── Selection ─────────────────────────────────────────────────── */
::selection {
  background-color: rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
}

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

/* ─── Typography Scale ──────────────────────────────────────────── */
.text-xs   { font-size: 0.75rem;  line-height: 1rem;    }
.text-sm   { font-size: 0.8125rem; line-height: 1.25rem; }
.text-base { font-size: 0.9375rem; line-height: 1.5rem;  }
.text-lg   { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl   { font-size: 1.25rem;  line-height: 1.75rem; }
.text-2xl  { font-size: 1.5rem;   line-height: 2rem;    }
.text-3xl  { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl  { font-size: 2.25rem;  line-height: 2.5rem;  }

.font-light    { font-weight: 300; }
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.font-display { font-family: var(--font-display); }
.font-mono    { font-family: var(--font-mono); }

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }
.text-uppercase { text-transform: uppercase; letter-spacing: 0.05em; }
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.75; }

/* ─── Color Utilities ───────────────────────────────────────────── */
.text-success { color: var(--accent-green); }
.text-warning { color: var(--accent-amber); }
.text-danger  { color: var(--accent-red); }
.text-info    { color: var(--accent-blue-light); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-accent  { color: var(--accent-blue); }
.text-purple  { color: var(--accent-purple); }
.text-cyan    { color: var(--accent-cyan); }

.bg-success { background-color: var(--accent-green); }
.bg-warning { background-color: var(--accent-amber); }
.bg-danger  { background-color: var(--accent-red); }

/* ═══════════════════════════════════════════════════════════════════
   COMPONENTS
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Card ──────────────────────────────────────────────────────── */
.card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-lg);
}

.card--interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.card--flat {
  background: var(--bg-card);
  backdrop-filter: none;
}

.card--flush {
  padding: 0;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-4);
}

.card__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card__subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

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

.card__body {
  padding: var(--space-6);
}

.card__footer {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-color);
  margin-top: var(--space-4);
}

/* ─── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.5625rem 1.125rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Button variants */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-blue-dark) 100%);
  color: #ffffff;
  border-color: var(--accent-blue);
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-blue-light) 0%, var(--accent-blue) 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-red) 0%, #dc2626 100%);
  color: #ffffff;
  border-color: var(--accent-red);
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-red-light) 0%, var(--accent-red) 100%);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
  color: #ffffff;
  border-color: var(--accent-green);
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}

.btn-success:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-green-light) 0%, var(--accent-green) 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

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

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.1);
}

/* Button sizes */
.btn-xs {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-xl {
  padding: 0.875rem 2rem;
  font-size: 1.125rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  padding: 0.5625rem;
  width: 38px;
  height: 38px;
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
  padding: 0.375rem;
}

.btn-icon.btn-lg {
  width: 44px;
  height: 44px;
  padding: 0.625rem;
}

/* Button loading state */
.btn.is-loading {
  color: transparent;
  pointer-events: none;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ─── Badges ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  white-space: nowrap;
  line-height: 1.5;
}

.badge--success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green-light);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge--warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber-light);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge--danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red-light);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge--info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue-light);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge--neutral {
  background: rgba(100, 116, 139, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(100, 116, 139, 0.25);
}

.badge--purple {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.badge--cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.25);
}

/* Badge with dot indicator */
.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge--lg {
  padding: 0.3125rem 0.875rem;
  font-size: 0.75rem;
}

/* ─── Form Controls ─────────────────────────────────────────────── */
.input,
.select,
.textarea {
  width: 100%;
  padding: 0.5625rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  outline: none;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-light);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: var(--bg-tertiary);
}

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

.input--error,
.textarea--error {
  border-color: var(--accent-red);
}

.input--error:focus,
.textarea--error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

.textarea {
  resize: vertical;
  min-height: 5rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-group__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.input-group__label--required::after {
  content: ' *';
  color: var(--accent-red);
}

.input-group__hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.input-group__error {
  font-size: 0.75rem;
  color: var(--accent-red);
}

.input-wrapper {
  position: relative;
}

.input-wrapper .input {
  padding-left: 2.5rem;
}

.input-wrapper__icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input-wrapper__action {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color var(--transition-fast);
}

.input-wrapper__action:hover {
  color: var(--text-primary);
}

/* Checkbox / Radio */
.checkbox,
.radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox input,
.radio input {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-light);
  background: var(--bg-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  position: relative;
}

.radio input {
  border-radius: 50%;
}

.checkbox input:checked,
.radio input:checked {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.checkbox input:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.radio input:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.toggle input {
  appearance: none;
  width: 40px;
  height: 22px;
  background: var(--border-light);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}

.toggle input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle input:checked {
  background: var(--accent-blue);
}

.toggle input:checked::after {
  transform: translateX(18px);
}

/* ─── Modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-slow);
}

.modal-overlay.is-active .modal {
  transform: scale(1) translateY(0);
}

.modal--lg { max-width: 720px; }
.modal--xl { max-width: 960px; }
.modal--full { max-width: 90vw; max-height: 90vh; }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
}

.modal__title {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
}

.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.modal__close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal__body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-color);
}

/* ─── Toast ─────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-height) + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
  max-width: 420px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideDown var(--transition-slow) forwards, fadeIn var(--transition-base) forwards;
  transition: transform var(--transition-base), opacity var(--transition-base);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.toast.is-dismissing {
  opacity: 0;
  transform: translateX(100%);
}

.toast__icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  margin-top: 1px;
}

.toast--success .toast__icon { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.toast--error .toast__icon   { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }
.toast--warning .toast__icon { background: rgba(245, 158, 11, 0.2); color: var(--accent-amber); }
.toast--info .toast__icon    { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue); }

.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-amber); }
.toast--info    { border-left: 3px solid var(--accent-blue); }

.toast__content {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.toast__message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.toast__close {
  flex-shrink: 0;
  color: var(--text-muted);
  padding: 0.125rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
  cursor: pointer;
}

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

/* Toast progress bar */
.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

.toast__progress-bar {
  height: 100%;
  border-radius: inherit;
  animation: shrink linear forwards;
}

.toast--success .toast__progress-bar { background: var(--accent-green); }
.toast--error .toast__progress-bar   { background: var(--accent-red); }
.toast--warning .toast__progress-bar { background: var(--accent-amber); }
.toast--info .toast__progress-bar    { background: var(--accent-blue); }

@keyframes shrink {
  from { width: 100%; }
  to { width: 0%; }
}

/* ─── Dropdown ──────────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.dropdown.is-open .dropdown__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  width: 100%;
  text-align: left;
}

.dropdown__item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown__item--danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
}

.dropdown__divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-2) 0;
}

.dropdown__label {
  padding: 0.375rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Table ─────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background: var(--bg-tertiary);
  position: sticky;
  top: 0;
  z-index: var(--z-base);
}

.table th {
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
}

.table td {
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

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

.table tbody tr:last-child td {
  border-bottom: none;
}

.table--striped tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.table--compact th,
.table--compact td {
  padding: 0.5rem 0.75rem;
}

.table .td-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.table .td-actions {
  text-align: right;
  white-space: nowrap;
}

.table .sortable {
  cursor: pointer;
  user-select: none;
}

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

.table .sortable::after {
  content: '↕';
  margin-left: 0.25rem;
  opacity: 0.3;
}

.table .sortable.sort-asc::after {
  content: '↑';
  opacity: 1;
}

.table .sortable.sort-desc::after {
  content: '↓';
  opacity: 1;
}

/* ─── Avatar ────────────────────────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--bg-card);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--sm { width: 28px; height: 28px; font-size: 0.6875rem; }
.avatar--lg { width: 44px; height: 44px; font-size: 1rem; }
.avatar--xl { width: 56px; height: 56px; font-size: 1.25rem; }

.avatar--green { background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%); }
.avatar--amber { background: linear-gradient(135deg, var(--accent-amber) 0%, #d97706 100%); }
.avatar--red   { background: linear-gradient(135deg, var(--accent-red) 0%, #dc2626 100%); }
.avatar--cyan  { background: linear-gradient(135deg, var(--accent-cyan) 0%, #0891b2 100%); }

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  margin-left: -8px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* Status indicator on avatar */
.avatar-status {
  position: relative;
}

.avatar-status::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 2px solid var(--bg-card);
}

.avatar-status--away::after { background: var(--accent-amber); }
.avatar-status--offline::after { background: var(--text-muted); }
.avatar-status--busy::after { background: var(--accent-red); }

/* ─── Stat Card ─────────────────────────────────────────────────── */
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  font-size: 1.125rem;
}

.stat-card__icon--blue   { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue-light); }
.stat-card__icon--green  { background: rgba(16, 185, 129, 0.15); color: var(--accent-green-light); }
.stat-card__icon--amber  { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber-light); }
.stat-card__icon--red    { background: rgba(239, 68, 68, 0.15); color: var(--accent-red-light); }
.stat-card__icon--purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.stat-card__icon--cyan   { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }

.stat-card__value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.stat-card__value .font-mono {
  font-family: var(--font-mono);
}

.stat-card__label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.stat-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
}

.stat-card__trend--up {
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
}

.stat-card__trend--down {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

/* Decorative glow */
.stat-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
  pointer-events: none;
}

/* ─── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sticky);
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
}

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

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar__logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-cyan) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar__brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity var(--transition-base);
}

.sidebar.is-collapsed .sidebar__brand-text {
  opacity: 0;
  width: 0;
}

.sidebar__brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar__brand-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.2;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
}

.sidebar__section {
  margin-bottom: var(--space-3);
}

.sidebar__section-label {
  padding: var(--space-2) var(--space-3);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-base);
}

.sidebar.is-collapsed .sidebar__section-label {
  opacity: 0;
}

/* ── PRIMARY TABS (big nav buttons at top) ─────────────────────── */
.sidebar__primary-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-color);
}

.sidebar__tab {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.625rem var(--space-3);
  font-size: 0.9375rem;
  font-weight: 550;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.sidebar__tab:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar__tab.is-active {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue-light);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.sidebar__tab.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent-blue);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.sidebar__tab-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.125rem;
}

.sidebar__tab-text {
  transition: opacity var(--transition-base);
}

.sidebar.is-collapsed .sidebar__tab-text {
  opacity: 0;
}

/* ── SUB-NAVIGATION (pages within active section) ──────────────── */
.sidebar__sub-nav {
  padding-top: var(--space-1);
  animation: slideDown 0.2s ease;
}

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

.sidebar__sub-nav .sidebar__link {
  padding-left: calc(var(--space-3) + 8px);
  font-size: 0.8125rem;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.5rem var(--space-3);
  font-size: 0.875rem;
  font-weight: 450;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 1px;
}

.sidebar__link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar__link.is-active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue-light);
}

.sidebar__link.is-active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent-blue);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.sidebar__link-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.sidebar__link-text {
  transition: opacity var(--transition-base);
}

.sidebar.is-collapsed .sidebar__link-text {
  opacity: 0;
}

.sidebar__link-badge {
  margin-left: auto;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar.is-collapsed .sidebar__link-badge {
  display: none;
}

/* Sidebar footer */
.sidebar__footer {
  padding: var(--space-3);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar__user:hover {
  background: var(--bg-hover);
}

.sidebar__user-info {
  overflow: hidden;
  transition: opacity var(--transition-base);
}

.sidebar.is-collapsed .sidebar__user-info {
  opacity: 0;
  width: 0;
}

.sidebar__user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ─── Top Bar ───────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  z-index: var(--z-sticky);
  transition: left var(--transition-slow);
}

.sidebar.is-collapsed ~ .topbar {
  left: var(--sidebar-collapsed);
}

.topbar__hamburger {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.topbar__hamburger:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.topbar__breadcrumb-item {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

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

.topbar__breadcrumb-item.is-current {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar__breadcrumb-sep {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.topbar__spacer {
  flex: 1;
}

/* Top bar search */
.topbar__search {
  position: relative;
  width: 320px;
  max-width: 100%;
}

.topbar__search .input {
  padding-left: 2.5rem;
  padding-right: 4rem;
  background: var(--bg-tertiary);
  border-color: transparent;
  height: 38px;
  font-size: 0.8125rem;
}

.topbar__search .input:focus {
  background: var(--bg-secondary);
  border-color: var(--border-focus);
}

.topbar__search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.topbar__search-kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
}

.topbar__search-kbd kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem 0.375rem;
  font-family: var(--font-sans);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  line-height: 1;
}

/* Top bar actions */
.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar__action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.topbar__action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topbar__action-btn .notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 2px solid var(--bg-card);
  animation: pulse 2s infinite;
}

.topbar__divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 var(--space-2);
}

/* ─── Breadcrumb ────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
}

.breadcrumb__item {
  color: var(--text-muted);
}

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

.breadcrumb__item.is-current {
  color: var(--text-primary);
  font-weight: 500;
  pointer-events: none;
}

.breadcrumb__sep {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ─── Search Box ────────────────────────────────────────────────── */
.search-box {
  position: relative;
}

.search-box__input {
  width: 100%;
  padding: 0.5625rem 2.25rem 0.5625rem 2.5rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.search-box__input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-box__icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box__clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.search-box__input:not(:placeholder-shown) + .search-box__icon + .search-box__clear,
.search-box__input.has-value ~ .search-box__clear {
  opacity: 1;
}

.search-box__clear:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ─── Loading / Skeleton ────────────────────────────────────────── */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-light);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-spinner--sm { width: 16px; height: 16px; border-width: 2px; }
.loading-spinner--lg { width: 36px; height: 36px; border-width: 3px; }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-8);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--bg-hover) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton--text {
  height: 0.875rem;
  width: 100%;
  margin-bottom: var(--space-2);
}

.skeleton--text:last-child {
  width: 60%;
}

.skeleton--title {
  height: 1.25rem;
  width: 40%;
  margin-bottom: var(--space-3);
}

.skeleton--avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.skeleton--card {
  height: 120px;
  border-radius: var(--radius-lg);
}

.skeleton--btn {
  height: 38px;
  width: 100px;
  border-radius: var(--radius-md);
}

/* ─── Progress Bar ──────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-blue-light) 100%);
  border-radius: inherit;
  transition: width var(--transition-slow);
  position: relative;
}

.progress-bar__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s ease infinite;
  background-size: 200% 100%;
}

.progress-bar--success .progress-bar__fill { background: linear-gradient(90deg, var(--accent-green) 0%, var(--accent-green-light) 100%); }
.progress-bar--warning .progress-bar__fill { background: linear-gradient(90deg, var(--accent-amber) 0%, var(--accent-amber-light) 100%); }
.progress-bar--danger .progress-bar__fill  { background: linear-gradient(90deg, var(--accent-red) 0%, var(--accent-red-light) 100%); }

.progress-bar--lg { height: 10px; }
.progress-bar--sm { height: 3px; }

/* ─── Tab Group ─────────────────────────────────────────────────── */
.tab-group {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.tab-group__item {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  position: relative;
  transition: color var(--transition-fast);
  cursor: pointer;
}

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

.tab-group__item.is-active {
  color: var(--accent-blue-light);
}

.tab-group__item.is-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-blue);
  border-radius: var(--radius-full) var(--radius-full) 0 0;
}

.tab-group--pills {
  border-bottom: none;
  gap: var(--space-1);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.tab-group--pills .tab-group__item {
  border-radius: var(--radius-sm);
  padding: 0.4375rem 0.875rem;
  font-size: 0.8125rem;
}

.tab-group--pills .tab-group__item.is-active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.tab-group--pills .tab-group__item.is-active::after {
  display: none;
}

/* ─── Chip ──────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.chip--interactive {
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip--interactive:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.chip--active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-blue-light);
  border-color: rgba(59, 130, 246, 0.3);
}

.chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 0.625rem;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.chip__remove:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ─── Tooltip ───────────────────────────────────────────────────── */
.tooltip {
  position: relative;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 0.375rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  pointer-events: none;
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
}

.tooltip:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tooltip--right::before {
  bottom: auto;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}

.tooltip--right:hover::before {
  transform: translateY(-50%) translateX(0);
}

/* ─── Empty State ───────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state__message {
  font-size: 0.875rem;
  max-width: 360px;
  line-height: 1.6;
  margin-bottom: var(--space-6);
}

/* ─── Divider ───────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-4) 0;
}

.divider--vertical {
  width: 1px;
  height: auto;
  margin: 0 var(--space-4);
  align-self: stretch;
}

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: var(--space-6);
  transition: margin-left var(--transition-slow);
  min-height: calc(100vh - var(--topbar-height));
}

.sidebar.is-collapsed ~ .app-main,
.sidebar.is-collapsed ~ .topbar ~ .app-main {
  margin-left: var(--sidebar-collapsed);
}

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

.page-header__left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.page-header__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header__subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ═══════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Flexbox ───────────────────────────────────────────────────── */
.flex          { display: flex; }
.inline-flex   { display: inline-flex; }
.flex-col      { flex-direction: column; }
.flex-row      { flex-direction: row; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.items-start   { align-items: flex-start; }
.items-center  { align-items: center; }
.items-end     { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around  { justify-content: space-around; }

.self-start  { align-self: flex-start; }
.self-center { align-self: center; }
.self-end    { align-self: flex-end; }

.gap-0  { gap: 0; }
.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); }
.gap-8  { gap: var(--space-8); }

/* ─── Grid ──────────────────────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ─── Spacing ───────────────────────────────────────────────────── */
.p-0  { padding: 0; }
.p-1  { padding: var(--space-1); }
.p-2  { padding: var(--space-2); }
.p-3  { padding: var(--space-3); }
.p-4  { padding: var(--space-4); }
.p-5  { padding: var(--space-5); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }

.px-1 { padding-left: var(--space-1); padding-right: var(--space-1); }
.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-5 { padding-left: var(--space-5); padding-right: var(--space-5); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }
.px-8 { padding-left: var(--space-8); padding-right: var(--space-8); }

.py-1 { padding-top: var(--space-1); padding-bottom: var(--space-1); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-5 { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }

.pt-1 { padding-top: var(--space-1); } .pt-2 { padding-top: var(--space-2); }
.pt-3 { padding-top: var(--space-3); } .pt-4 { padding-top: var(--space-4); }
.pt-6 { padding-top: var(--space-6); } .pt-8 { padding-top: var(--space-8); }

.pb-1 { padding-bottom: var(--space-1); } .pb-2 { padding-bottom: var(--space-2); }
.pb-3 { padding-bottom: var(--space-3); } .pb-4 { padding-bottom: var(--space-4); }
.pb-6 { padding-bottom: var(--space-6); } .pb-8 { padding-bottom: var(--space-8); }

.m-0  { margin: 0; }
.m-1  { margin: var(--space-1); }
.m-2  { margin: var(--space-2); }
.m-3  { margin: var(--space-3); }
.m-4  { margin: var(--space-4); }
.m-6  { margin: var(--space-6); }
.m-8  { margin: var(--space-8); }

.mx-auto { margin-left: auto; margin-right: auto; }

.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); }
.mt-6 { margin-top: var(--space-6); } .mt-8 { margin-top: var(--space-8); }

.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); }
.mb-6 { margin-bottom: var(--space-6); } .mb-8 { margin-bottom: var(--space-8); }

.ml-1 { margin-left: var(--space-1); } .ml-2 { margin-left: var(--space-2); }
.ml-3 { margin-left: var(--space-3); } .ml-4 { margin-left: var(--space-4); }
.ml-auto { margin-left: auto; }

.mr-1 { margin-right: var(--space-1); } .mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); } .mr-4 { margin-right: var(--space-4); }
.mr-auto { margin-right: auto; }

/* ─── Display ───────────────────────────────────────────────────── */
.hidden  { display: none; }
.block   { display: block; }
.inline  { display: inline; }
.inline-block { display: inline-block; }

/* ─── Width / Height ────────────────────────────────────────────── */
.w-full    { width: 100%; }
.h-full    { height: 100%; }
.min-h-screen { min-height: 100vh; }

.max-w-xs  { max-width: 20rem; }
.max-w-sm  { max-width: 24rem; }
.max-w-md  { max-width: 28rem; }
.max-w-lg  { max-width: 32rem; }
.max-w-xl  { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-7xl { max-width: 80rem; }
.max-w-full { max-width: 100%; }

/* ─── Position ──────────────────────────────────────────────────── */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

/* ─── Overflow ──────────────────────────────────────────────────── */
.overflow-auto   { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

/* ─── Border ────────────────────────────────────────────────────── */
.border     { border: 1px solid var(--border-color); }
.border-b   { border-bottom: 1px solid var(--border-color); }
.border-t   { border-top: 1px solid var(--border-color); }
.rounded    { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ─── Shadow ────────────────────────────────────────────────────── */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-glow { box-shadow: var(--shadow-glow); }

/* ─── Cursor ────────────────────────────────────────────────────── */
.cursor-pointer  { cursor: pointer; }
.cursor-default  { cursor: default; }
.pointer-events-none { pointer-events: none; }

/* ─── Opacity ───────────────────────────────────────────────────── */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-75  { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* ─── Truncation ────────────────────────────────────────────────── */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── SR Only ───────────────────────────────────────────────────── */
.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;
}

/* ═══════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */

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

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

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

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

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

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

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.animate-fadeIn    { animation: fadeIn var(--transition-base) forwards; }
.animate-slideUp   { animation: slideUp var(--transition-slow) forwards; }
.animate-slideDown { animation: slideDown var(--transition-slow) forwards; }
.animate-scaleIn   { animation: scaleIn var(--transition-slow) forwards; }
.animate-pulse     { animation: pulse 2s infinite; }
.animate-spin      { animation: spin 1s linear infinite; }
.animate-bounce    { animation: bounce 1s ease infinite; }

/* Staggered animation delays for child elements */
.stagger > :nth-child(1)  { animation-delay: 0ms; }
.stagger > :nth-child(2)  { animation-delay: 50ms; }
.stagger > :nth-child(3)  { animation-delay: 100ms; }
.stagger > :nth-child(4)  { animation-delay: 150ms; }
.stagger > :nth-child(5)  { animation-delay: 200ms; }
.stagger > :nth-child(6)  { animation-delay: 250ms; }
.stagger > :nth-child(7)  { animation-delay: 300ms; }
.stagger > :nth-child(8)  { animation-delay: 350ms; }
.stagger > :nth-child(9)  { animation-delay: 400ms; }
.stagger > :nth-child(10) { animation-delay: 450ms; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

/* Large desktop */
@media (min-width: 1280px) {
  .xl\:grid-5 { grid-template-columns: repeat(5, 1fr); }
  .xl\:grid-6 { grid-template-columns: repeat(6, 1fr); }
}

/* Tablet and below */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

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

  .topbar {
    left: 0;
  }

  .app-main {
    margin-left: 0;
  }

  .topbar__hamburger {
    display: flex;
  }

  .topbar__search {
    display: none;
  }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  .lg\:hidden { display: none; }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --space-6: 1rem;
  }

  .app-main {
    padding: var(--space-4);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header__actions {
    width: 100%;
  }

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

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

  .modal {
    max-width: 100%;
    border-radius: var(--radius-lg);
    margin: var(--space-2);
  }

  .md\:hidden { display: none; }
}

/* Small mobile */
@media (max-width: 640px) {
  .page-header__title {
    font-size: 1.25rem;
  }

  .topbar {
    padding: 0 var(--space-3);
  }

  .topbar__actions {
    gap: var(--space-1);
  }

  .sm\:hidden { display: none; }
}

/* ─── Sidebar overlay for mobile ────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sticky) - 1);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.sidebar-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* ─── Print ─────────────────────────────────────────────────────── */
@media print {
  .sidebar,
  .topbar,
  .toast-container,
  .sidebar-overlay {
    display: none !important;
  }

  .app-main {
    margin: 0 !important;
    padding: 0 !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}
