/* ═══════════════════════════════════════════════════════════════════
   J.A.R.V.I.S. — Global Design System
   Just A Rather Very Intelligent System
   © 2026 Lenoci Giovanni & Simeone Lorenzo — All Rights Reserved
   ═══════════════════════════════════════════════════════════════════ */

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

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

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition-theme), color var(--transition-theme);
  overflow-x: hidden;
}

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

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

input, textarea, select {
  font-family: inherit;
  outline: none;
  border: none;
}

ul, ol {
  list-style: none;
}

/* ─── CSS Custom Properties / Design Tokens ─── */
:root {
  /* Typography */
  --font-display: 'Orbitron', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-theme: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Z-Index Scale */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-sidebar: 25;
  --z-overlay: 30;
  --z-modal: 40;
  --z-toast: 50;
  --z-max: 100;

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 64px;
  --max-content-width: 1400px;
}

/* ═══════════════════════════════════════════
   DARK THEME — Iron Man HUD
   ═══════════════════════════════════════════ */
[data-theme="dark"] {
  --bg-primary: #060a13;
  --bg-secondary: #0d1321;
  --bg-tertiary: #141c2f;
  --bg-elevated: #1a2540;
  --bg-card: rgba(13, 19, 33, 0.85);
  --bg-card-hover: rgba(20, 28, 47, 0.95);
  --bg-input: rgba(13, 19, 33, 0.7);
  --bg-input-focus: rgba(20, 28, 47, 0.9);
  --bg-overlay: rgba(0, 0, 0, 0.75);
  --bg-sidebar: rgba(10, 15, 26, 0.95);
  --bg-header: rgba(6, 10, 19, 0.9);

  --text-primary: #e8edf5;
  --text-secondary: #8899b4;
  --text-tertiary: #556a8a;
  --text-inverse: #060a13;
  --text-accent: #00d4ff;
  --text-link: #00d4ff;

  --accent-primary: #00d4ff;
  --accent-primary-hover: #33ddff;
  --accent-primary-rgb: 0, 212, 255;
  --accent-secondary: #ff6b00;
  --accent-secondary-hover: #ff8533;
  --accent-secondary-rgb: 255, 107, 0;
  --accent-tertiary: #a855f7;
  --accent-success: #22c55e;
  --accent-success-rgb: 34, 197, 94;
  --accent-warning: #f59e0b;
  --accent-warning-rgb: 245, 158, 11;
  --accent-danger: #ef4444;
  --accent-danger-rgb: 239, 68, 68;
  --accent-info: #3b82f6;

  --border-primary: rgba(0, 212, 255, 0.12);
  --border-secondary: rgba(255, 255, 255, 0.05);
  --border-active: rgba(0, 212, 255, 0.35);
  --border-input: rgba(0, 212, 255, 0.1);
  --border-input-focus: rgba(0, 212, 255, 0.4);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);

  --glow-primary: 0 0 15px rgba(0, 212, 255, 0.25), 0 0 30px rgba(0, 212, 255, 0.1);
  --glow-secondary: 0 0 15px rgba(255, 107, 0, 0.25), 0 0 30px rgba(255, 107, 0, 0.1);
  --glow-intense: 0 0 30px rgba(0, 212, 255, 0.4), 0 0 60px rgba(0, 212, 255, 0.15);
  --glow-danger: 0 0 15px rgba(239, 68, 68, 0.3);

  --glass-bg: rgba(13, 19, 33, 0.65);
  --glass-border: rgba(0, 212, 255, 0.08);
  --glass-blur: 20px;

  --gradient-primary: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
  --gradient-secondary: linear-gradient(135deg, #ff6b00 0%, #cc5500 100%);
  --gradient-card: linear-gradient(145deg, rgba(13, 19, 33, 0.9) 0%, rgba(20, 28, 47, 0.7) 100%);
  --gradient-hero: linear-gradient(180deg, rgba(0, 212, 255, 0.05) 0%, transparent 50%);
  --gradient-sidebar: linear-gradient(180deg, rgba(0, 212, 255, 0.03) 0%, transparent 100%);

  --scrollbar-track: #0d1321;
  --scrollbar-track: #0d1321;
  --scrollbar-thumb: #1a2540;
  --scrollbar-thumb-hover: #253a5e;

  --particle-color: rgba(0, 212, 255, 0.4);

  /* HUD Specific Tokens (Dark Mode) */
  --hud-bg: #050b18;
  --hud-grid: rgba(0, 212, 255, 0.07);
  --hud-panel-bg: rgba(6, 14, 28, 0.82);
  --hud-panel-border: rgba(0, 212, 255, 0.24);
  --hud-cyan: #00d4ff;
  --hud-blue: #0088ff;
  --hud-gold: #f59e0b;
  --hud-text: #e0f2fe;
  --hud-text-dim: #7dd3fc;
  --hud-glow: 0 0 20px rgba(0, 212, 255, 0.4);
}

/* ═══════════════════════════════════════════
   LIGHT THEME — Stark Industries
   ═══════════════════════════════════════════ */
[data-theme="light"] {
  --bg-primary: #f2f5fb;
  --bg-secondary: #e5ebf5;
  --bg-tertiary: #d6e0ee;
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: #ffffff;
  --bg-input-focus: #ffffff;
  --bg-overlay: rgba(15, 23, 42, 0.4);
  --bg-sidebar: rgba(255, 255, 255, 0.95);
  --bg-header: rgba(245, 248, 253, 0.94);

  --text-primary: #091224;
  --text-secondary: #334762;
  --text-tertiary: #6b7f99;
  --text-inverse: #f8fafc;
  --text-accent: #0077cc;
  --text-link: #0077cc;

  --accent-primary: #0077cc;
  --accent-primary-hover: #0060a8;
  --accent-primary-rgb: 0, 119, 204;
  --accent-secondary: #d97706;
  --accent-secondary-hover: #b45309;
  --accent-secondary-rgb: 217, 119, 6;
  --accent-tertiary: #7c3aed;
  --accent-success: #16a34a;
  --accent-success-rgb: 22, 163, 74;
  --accent-warning: #d97706;
  --accent-warning-rgb: 217, 119, 6;
  --accent-danger: #dc2626;
  --accent-danger-rgb: 220, 38, 38;
  --accent-info: #0284c7;

  --border-primary: rgba(0, 119, 204, 0.22);
  --border-secondary: rgba(15, 23, 42, 0.09);
  --border-active: rgba(0, 119, 204, 0.5);
  --border-input: rgba(15, 23, 42, 0.15);
  --border-input-focus: rgba(0, 119, 204, 0.6);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.1);
  --shadow-xl: 0 16px 48px rgba(15, 23, 42, 0.12);

  --glow-primary: 0 2px 14px rgba(0, 119, 204, 0.22);
  --glow-secondary: 0 2px 14px rgba(217, 119, 6, 0.2);
  --glow-intense: 0 4px 24px rgba(0, 119, 204, 0.28);
  --glow-danger: 0 2px 12px rgba(220, 38, 38, 0.15);

  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 119, 204, 0.18);
  --glass-blur: 20px;

  --gradient-primary: linear-gradient(135deg, #0077cc 0%, #0099ee 100%);
  --gradient-secondary: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.96) 0%, rgba(242, 246, 253, 0.9) 100%);
  --gradient-hero: linear-gradient(180deg, rgba(0, 119, 204, 0.06) 0%, transparent 50%);
  --gradient-sidebar: linear-gradient(180deg, rgba(0, 119, 204, 0.03) 0%, transparent 100%);

  --scrollbar-track: #e5ebf5;
  --scrollbar-thumb: #b8c5d8;
  --scrollbar-thumb-hover: #889bb4;

  --particle-color: rgba(0, 119, 204, 0.35);

  /* HUD Specific Tokens (Light Mode) */
  --hud-bg: #edf2f9;
  --hud-grid: rgba(0, 102, 204, 0.07);
  --hud-panel-bg: rgba(255, 255, 255, 0.88);
  --hud-panel-border: rgba(0, 119, 204, 0.26);
  --hud-cyan: #0077cc;
  --hud-blue: #0284c7;
  --hud-gold: #d97706;
  --hud-text: #091224;
  --hud-text-dim: #334762;
  --hud-glow: 0 0 16px rgba(0, 119, 204, 0.25);
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

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

/* ═══════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════ */
.heading-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  line-height: 1.2;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2, .h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-primary);
}

h3, .h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-primary);
}

h4, .h4 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.text-accent { color: var(--accent-primary); }
.text-secondary { color: var(--text-secondary); }
.text-mono { font-family: var(--font-mono); }
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::before {
  opacity: 1;
}

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

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

.btn-primary:hover {
  box-shadow: var(--glow-intense);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-primary);
  border: 1.5px solid var(--border-active);
}

.btn-secondary:hover {
  background: rgba(var(--accent-primary-rgb), 0.08);
  box-shadow: var(--glow-primary);
  transform: translateY(-2px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--accent-danger), #c53030);
  color: #fff;
  box-shadow: var(--glow-danger);
}

.btn-danger:hover {
  box-shadow: 0 0 25px rgba(var(--accent-danger-rgb), 0.4);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 20px;
}

.btn-ghost:hover {
  color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.06);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.btn-icon:hover {
  color: var(--accent-primary);
  background: rgba(var(--accent-primary-rgb), 0.08);
}

.btn-sm {
  padding: 8px 18px;
  font-size: var(--text-xs);
  letter-spacing: 1px;
}

.btn-lg {
  padding: 16px 36px;
  font-size: var(--text-base);
  letter-spacing: 2px;
}

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

.btn .btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ═══════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════ */
.input-group {
  position: relative;
  margin-bottom: var(--space-lg);
}

.input-group label {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.input-field {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}

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

.input-field:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-input-focus);
  box-shadow: var(--glow-primary);
}

.input-field.error {
  border-color: var(--accent-danger);
  box-shadow: var(--glow-danger);
}

.input-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.input-group .input-icon {
  top: calc(50% + 12px);
}

.input-error-text {
  font-size: var(--text-xs);
  color: var(--accent-danger);
  margin-top: var(--space-xs);
  display: none;
}

.input-field.error + .input-error-text,
.input-group.has-error .input-error-text {
  display: block;
}

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  backdrop-filter: blur(var(--glass-blur));
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

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

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-primary);
  box-shadow: var(--glow-primary);
  transform: translateY(-2px);
}

.card-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}

.card-flat {
  border: none;
  box-shadow: none;
}

.card-flat:hover {
  transform: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════
   TOGGLE SWITCH
   ═══════════════════════════════════════════ */
.toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-secondary);
  transition: all var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 2px;
  bottom: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--transition-base);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(24px);
  background: #fff;
}

/* ═══════════════════════════════════════════
   BADGE
   ═══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: var(--radius-full);
}

.badge-primary {
  background: rgba(var(--accent-primary-rgb), 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.2);
}

.badge-success {
  background: rgba(var(--accent-success-rgb), 0.12);
  color: var(--accent-success);
  border: 1px solid rgba(var(--accent-success-rgb), 0.2);
}

.badge-warning {
  background: rgba(var(--accent-warning-rgb), 0.12);
  color: var(--accent-warning);
  border: 1px solid rgba(var(--accent-warning-rgb), 0.2);
}

.badge-danger {
  background: rgba(var(--accent-danger-rgb), 0.12);
  color: var(--accent-danger);
  border: 1px solid rgba(var(--accent-danger-rgb), 0.2);
}

.badge-owner {
  background: linear-gradient(135deg, rgba(var(--accent-secondary-rgb), 0.15), rgba(var(--accent-primary-rgb), 0.15));
  color: var(--accent-secondary);
  border: 1px solid rgba(var(--accent-secondary-rgb), 0.3);
}

/* ═══════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.4s var(--transition-bounce) forwards;
  pointer-events: auto;
  max-width: 420px;
  font-size: var(--text-sm);
}

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

.toast-icon {
  font-size: var(--text-xl);
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--accent-success); }
.toast-error .toast-icon { color: var(--accent-danger); }
.toast-warning .toast-icon { color: var(--accent-warning); }
.toast-info .toast-icon { color: var(--accent-info); }

.toast-close {
  margin-left: auto;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition-fast);
}

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

.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  max-width: 500px;
  width: 90%;
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-xl);
  transform: scale(0.9) translateY(20px);
  transition: all var(--transition-base);
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 1px;
}

.modal-body {
  color: var(--text-secondary);
  line-height: 1.7;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

/* ─── JARVIS Custom Modal Dialogs ─── */
.jarvis-modal-overlay {
  backdrop-filter: blur(12px);
}

.jarvis-modal {
  text-align: center;
  padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
  max-width: 440px;
}

.jarvis-modal-icon {
  margin: 0 auto var(--space-lg);
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(var(--accent-primary-rgb), 0.08);
  animation: modalIconPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.jarvis-modal-icon svg {
  width: 32px;
  height: 32px;
}

.jarvis-modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.jarvis-modal-message {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}

.jarvis-modal-body {
  margin-bottom: var(--space-lg);
  text-align: left;
}

.jarvis-modal-footer {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-lg);
}

.jarvis-modal-btn {
  min-width: 120px;
  font-size: var(--text-sm) !important;
}

.jarvis-modal-detail {
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
}

.jarvis-modal-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: var(--font-body);
  transition: all var(--transition-fast);
  margin-top: var(--space-sm);
}

.jarvis-modal-input:focus {
  border-color: var(--border-input-focus);
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.12);
}

.jarvis-modal-input.error {
  border-color: var(--accent-danger);
  box-shadow: 0 0 0 3px rgba(var(--accent-danger-rgb), 0.15);
}

.jarvis-modal-input-error {
  color: var(--accent-danger);
  font-size: var(--text-xs);
  margin-top: var(--space-xs);
  text-align: left;
}

.jarvis-modal-prompt-msg {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-bottom: var(--space-sm);
  text-align: left;
}

@keyframes modalIconPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

/* ═══════════════════════════════════════════
   LOADING / SPINNER
   ═══════════════════════════════════════════ */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: var(--z-max);
  transition: opacity 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.arc-reactor {
  width: 100px;
  height: 100px;
  position: relative;
}

.arc-reactor .core {
  width: 30px;
  height: 30px;
  background: var(--accent-primary);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 30px var(--accent-primary), 0 0 60px rgba(var(--accent-primary-rgb), 0.4);
  animation: pulse 2s ease-in-out infinite;
}

.arc-reactor .ring {
  position: absolute;
  border: 2px solid rgba(var(--accent-primary-rgb), 0.3);
  border-radius: 50%;
  border-top-color: var(--accent-primary);
}

.arc-reactor .ring-1 {
  inset: 10px;
  animation: spin 2s linear infinite;
}

.arc-reactor .ring-2 {
  inset: 0;
  animation: spin 3s linear infinite reverse;
}

.arc-reactor .ring-3 {
  inset: -10px;
  border-width: 1px;
  animation: spin 4s linear infinite;
  opacity: 0.5;
}

.loading-text {
  margin-top: var(--space-xl);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-primary);
  animation: flicker 3s ease-in-out infinite;
}

/* ═══════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-primary);
  transition: all var(--transition-base);
}

.avatar:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--glow-primary);
}

.avatar-lg {
  width: 64px;
  height: 64px;
}

.avatar-xl {
  width: 96px;
  height: 96px;
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--accent-primary-rgb), 0.15);
  color: var(--accent-primary);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
}

/* ═══════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════ */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-primary), transparent);
  margin: var(--space-xl) 0;
  border: none;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg, transparent, var(--border-primary), transparent);
}

/* ═══════════════════════════════════════════
   ANIMATIONS / KEYFRAMES
   ═══════════════════════════════════════════ */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.7; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

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

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

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

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

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

@keyframes slideInUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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

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

@keyframes toastSlideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: var(--glow-primary); }
  50% { box-shadow: var(--glow-intense); }
}

@keyframes typingDots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

@keyframes scanLine {
  0% { top: -5%; }
  100% { top: 105%; }
}

@keyframes borderGlow {
  0%, 100% { border-color: rgba(var(--accent-primary-rgb), 0.2); }
  50% { border-color: rgba(var(--accent-primary-rgb), 0.5); }
}

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

@keyframes hud-line {
  0% { width: 0; opacity: 0; }
  50% { opacity: 1; }
  100% { width: 100%; opacity: 0.6; }
}

/* ═══════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { align-items: center; justify-content: space-between; }
.flex-start { align-items: center; justify-content: flex-start; }
.flex-end { align-items: center; justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.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); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.m-auto { margin: auto; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 1.5px; }

.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.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;
}

.hidden { display: none !important; }
.invisible { visibility: hidden; }
.pointer { cursor: pointer; }
.no-select { user-select: none; }

.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.5s ease forwards; }
.animate-fade-in-down { animation: fadeInDown 0.5s ease forwards; }
.animate-scale-in { animation: scaleIn 0.4s ease forwards; }

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  html { font-size: 14px; }
  :root {
    --sidebar-width: 100%;
    --header-height: 56px;
  }
  .grid-4,
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; }

  /* Prevents iOS Safari from auto-zooming and displacing the layout on focus */
  input, textarea, select {
    font-size: 16px !important;
  }

  .hide-mobile { display: none !important; }
  .show-mobile { display: flex !important; }

  h1, .h1 { font-size: var(--text-3xl); }
  h2, .h2 { font-size: var(--text-xl); }

  .card { padding: var(--space-lg); }
  .btn-lg { padding: 14px 28px; }
}

@media (max-width: 480px) {
  html { font-size: 13px; }
  .toast-container {
    left: var(--space-md);
    right: var(--space-md);
  }
  .toast { max-width: 100%; }
  .modal { padding: var(--space-lg); width: 95%; }
}

/* ═══════════════════════════════════════════
   BACKGROUND PARTICLES (shared across pages)
   ═══════════════════════════════════════════ */
.particles-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--particle-color);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

/* ═══════════════════════════════════════════
   HUD DECORATIVE ELEMENTS
   ═══════════════════════════════════════════ */
.hud-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: rgba(var(--accent-primary-rgb), 0.3);
}

.hud-corner-tl {
  top: 0; left: 0;
  border-top: 2px solid;
  border-left: 2px solid;
  border-color: inherit;
}

.hud-corner-tr {
  top: 0; right: 0;
  border-top: 2px solid;
  border-right: 2px solid;
  border-color: inherit;
}

.hud-corner-bl {
  bottom: 0; left: 0;
  border-bottom: 2px solid;
  border-left: 2px solid;
  border-color: inherit;
}

.hud-corner-br {
  bottom: 0; right: 0;
  border-bottom: 2px solid;
  border-right: 2px solid;
  border-color: inherit;
}

.hud-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  opacity: 0.2;
  animation: hud-line 4s ease-in-out infinite;
}

/* ═══════════════════════════════════════════
   HIDE FIREBASE EMULATOR BANNER
   ═══════════════════════════════════════════ */
.firebase-emulator-warning,
div[class*="firebase-emulator-warning"],
div[class*="emulator-warning"],
div[id*="emulator-warning"],
body > div:has-text("Running in emulator mode") {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  overflow: hidden !important;
}
