@charset "UTF-8";

/* ==========================================================================
   GSM DESIGN SYSTEM - ASIGSMAVIP
   Diseño profesional Telecom, SaaS & GSM Services
   Colores: Deep Navy, Electric Cyan, Neon Emerald, Tech Gradients
   Efectos: Advanced Glassmorphism, Micro-interacciones Spring, Glows Shaders
   ========================================================================== */

:root {
  /* === Color Primitives (ASIGSMAVIP Luxury Obsidian, Graphite, Silver & Flame) === */
  --color-bg: #070707;
  --color-bg-elevated: #262c35;
  --color-bg-surface: #20242B;
  --color-bg-hover: #282e37;
  --color-bg-active: #161a20;
  --color-bg-gradient: radial-gradient(circle at 50% 0%, #201309 0%, #070707 70%);

  /* Typography / Foregrounds */
  --color-fg: #f0f0f0;
  --color-fg-primary: #ffffff;
  --color-fg-secondary: #C5CBD3;
  --color-fg-tertiary: #8e95a2;
  --color-fg-muted: #6b7280;
  --color-fg-ivory: #FFF4DE;

  /* Primary Accent: Electric Flame Orange */
  --color-primary: #ff7a00;
  --color-primary-hover: #ff9124;
  --color-primary-dark: #df4e05;
  --color-primary-soft: rgba(255, 122, 0, 0.15);
  --color-primary-glow: 0 0 24px rgba(255, 122, 0, 0.4);

  --color-accent: #ff7a00;
  --color-accent-hover: #ff9a24;
  --color-accent-soft: rgba(255, 122, 0, 0.15);
  --color-accent-glow: 0 0 20px rgba(255, 122, 0, 0.35);

  /* Secondary: Gold Amber */
  --color-secondary: #ffb02e;
  --color-secondary-hover: #ffbe4d;
  --color-secondary-soft: rgba(255, 176, 46, 0.15);
  --color-secondary-glow: 0 0 20px rgba(255, 176, 46, 0.3);

  /* Functional Status Colors */
  --color-success: #10b981;
  --color-success-hover: #34d399;
  --color-success-soft: rgba(16, 185, 129, 0.15);

  --color-warning: #f59e0b;
  --color-warning-hover: #fbbf24;
  --color-warning-soft: rgba(245, 158, 11, 0.15);

  --color-error: #f43f5e;
  --color-error-hover: #fb7185;
  --color-error-soft: rgba(244, 63, 94, 0.15);

  --color-info: #0ea5e9;
  --color-info-hover: #38bdf8;
  --color-info-soft: rgba(14, 165, 233, 0.15);

  /* Borders & Dividers */
  --color-border: rgba(197, 203, 211, 0.18);
  --color-border-light: rgba(197, 203, 211, 0.28);
  --color-border-dark: rgba(197, 203, 211, 0.10);
  --color-border-focus: #ff7a00;

  /* === Glassmorphism & Materials === */
  --glass-bg: rgba(32, 36, 43, 0.88);
  --glass-bg-light: rgba(38, 44, 53, 0.75);
  --glass-bg-heavy: rgba(22, 26, 32, 0.94);
  --glass-border: rgba(197, 203, 211, 0.18);
  --glass-border-light: rgba(197, 203, 211, 0.28);
  --glass-border-glow: rgba(255, 122, 0, 0.35);
  --glass-blur: 24px;
  --glass-saturate: 180%;
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);

  /* Cards */
  --card-bg: #20242B;
  --card-border: rgba(197, 203, 211, 0.18);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.2);
  --card-shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.65), 0 0 24px rgba(255, 122, 0, 0.25);
  --card-radius: 16px;
  --card-radius-sm: 12px;
  --card-radius-lg: 24px;

  /* === Typography === */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --text-base: 15px;
  --text-sm: 13.5px;
  --text-xs: 11.5px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 26px;
  --text-3xl: 34px;
  --text-4xl: 44px;
  --leading-tight: 1.15;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;

  /* === Springs & Motion (Apple-grade) === */
  --spring-default: cubic-bezier(0.16, 1, 0.3, 1);
  --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-duration-fast: 0.16s;
  --spring-duration-normal: 0.28s;
  --spring-duration-slow: 0.45s;
  --spring-bounce-duration: 0.5s;
  --press-scale: 0.97;
  --press-duration: 0.1s;

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

  /* === Z-Index === */
  --z-dropdown: 100;
  --z-header: 150;
  --z-modal: 200;
  --z-popover: 300;
  --z-toast: 400;
  --z-tooltip: 500;
  --z-command-palette: 600;

  /* === Breakpoints === */
  --bp-xs: 360px;
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
  --bp-2xl: 1536px;
}

/* Light Mode Overrides (if explicit data-theme="light") */
[data-theme="light"] {
  --color-bg: #f8fafc;
  --color-bg-elevated: #ffffff;
  --color-bg-surface: #f1f5f9;
  --color-bg-hover: #e2e8f0;
  --color-bg-active: #cbd5e1;
  --color-bg-gradient: radial-gradient(circle at 50% 0%, #e2e8f0 0%, #f8fafc 70%);

  --color-fg: #0f172a;
  --color-fg-primary: #020617;
  --color-fg-secondary: #475569;
  --color-fg-tertiary: #64748b;
  --color-fg-muted: #94a3b8;

  --color-border: #e2e8f0;
  --color-border-light: #cbd5e1;
  --color-border-dark: #94a3b8;

  --glass-bg: rgba(255, 255, 255, 0.82);
  --glass-bg-light: rgba(255, 255, 255, 0.65);
  --glass-bg-heavy: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);

  --card-bg: rgba(255, 255, 255, 0.9);
  --card-border: rgba(0, 0, 0, 0.07);
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 16px 36px rgba(0, 0, 0, 0.1), 0 0 20px rgba(6, 214, 160, 0.12);
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  :root {
    --spring-duration-fast: 0.01s;
    --spring-duration-normal: 0.01s;
    --spring-duration-slow: 0.01s;
    --spring-bounce-duration: 0.01s;
    --press-duration: 0.01s;
  }
  *, *::before, *::after {
    animation-duration: 0.01s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01s !important;
  }
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  background-image: var(--color-bg-gradient);
  background-attachment: fixed;
  color: var(--color-fg);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-normal);
  min-height: 100vh;
  margin: 0;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--color-primary);
  color: #070b14;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: rgba(7, 11, 20, 0.6);
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-light);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* ==========================================================================
   GLASS & CARD CONTAINERS
   ========================================================================== */

.glass, .glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.glass-heavy {
  background: var(--glass-bg-heavy);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid var(--glass-border-light);
}

.card, .card-gsm {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  transition: transform var(--spring-duration-normal) var(--spring-default),
              box-shadow var(--spring-duration-normal) var(--spring-default),
              border-color var(--spring-duration-normal) var(--spring-default);
}

.card:hover, .card-gsm:hover {
  transform: translateY(-2px);
  border-color: rgba(6, 214, 160, 0.25);
  box-shadow: var(--card-shadow-hover);
}

.card:active, .card-gsm:active {
  transform: scale(var(--press-scale));
  transition-duration: var(--press-duration);
}

.card-interactive {
  cursor: pointer;
}

/* Header & Navigation Glass */
.navbar-gsm {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(7, 11, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn, .btn-gsm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 18px;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 120ms cubic-bezier(0.16, 1, 0.3, 1), background-color 150ms ease-out, border-color 150ms ease-out, box-shadow 150ms ease-out;
  user-select: none;
}

.btn:active, .btn-gsm:active, .btn-primary:active, .btn-secondary:active, .btn-accent:active, .btn-ghost:active, .btn-whatsapp:active, .btn-nav-cta:active, button:active {
  transform: scale(0.97) !important;
  transition: transform 80ms cubic-bezier(0.16, 1, 0.3, 1) !important;
}

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

/* Primary Button: Electric Cyan Gradient */
.btn-primary, .btn-gsm-primary {
  background: linear-gradient(135deg, #06d6a0 0%, #00b4d8 100%);
  color: #05141f;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(6, 214, 160, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover, .btn-gsm-primary:hover {
  background: linear-gradient(135deg, #10f0b8 0%, #00c6eb 100%);
  box-shadow: 0 6px 24px rgba(6, 214, 160, 0.5);
  color: #020a10;
  transform: translateY(-1px);
}

/* Secondary Button: Glass Elevated with Cyan Border */
.btn-secondary, .btn-gsm-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-fg);
  border: 1px solid var(--color-border-light);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover, .btn-gsm-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(6, 214, 160, 0.15);
}

/* Accent Indigo Button */
.btn-accent, .btn-gsm-accent {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-accent:hover, .btn-gsm-accent:hover {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--color-fg-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-fg);
}

/* WhatsApp Emerald Button */
.btn-whatsapp {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.35);
  border: none;
}

.btn-whatsapp:hover {
  background: linear-gradient(135deg, #2cf578 0%, #16a090 100%);
  box-shadow: 0 6px 26px rgba(37, 211, 102, 0.5);
  transform: translateY(-1px);
}

/* Button Sizes */
.btn-sm {
  padding: 6px 12px;
  font-size: var(--text-xs);
  border-radius: 8px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--text-lg);
  border-radius: 14px;
}

/* ==========================================================================
   INPUTS & FORMS
   ========================================================================== */

.input, .input-gsm, .form-control {
  width: 100%;
  padding: 11px 16px;
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--color-fg);
  background: rgba(14, 22, 40, 0.7);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  transition: all var(--spring-duration-fast) var(--spring-default);
}

.input:focus, .input-gsm:focus, .form-control:focus {
  outline: none;
  background: rgba(19, 29, 51, 0.9);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(6, 214, 160, 0.22), 0 0 16px rgba(6, 214, 160, 0.15);
}

.input::placeholder, .form-control::placeholder {
  color: var(--color-fg-tertiary);
}

.input-error, .is-invalid {
  border-color: var(--color-error) !important;
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2) !important;
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-fg-secondary);
  margin-bottom: var(--space-2);
}

/* ==========================================================================
   BADGES & STATUS DOTS
   ========================================================================== */

.badge, .badge-gsm {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: 6px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-success {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-error {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.badge-info, .badge-cyan {
  background: rgba(6, 214, 160, 0.18);
  color: #10f0b8;
  border: 1px solid rgba(6, 214, 160, 0.35);
}

.badge-indigo {
  background: rgba(99, 102, 241, 0.18);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-fg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Pulsing Status Dot */
.status-dot, .status-dot-gsm {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.status-dot.running, .status-dot.online, .status-dot-online {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

.status-dot.running::after, .status-dot.online::after, .status-dot-online::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid #10b981;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.status-dot.idle, .status-dot.busy {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.status-dot.error, .status-dot.offline {
  background: #f43f5e;
  box-shadow: 0 0 8px #f43f5e;
}

/* ==========================================================================
   METRICS & KPI CARDS
   ========================================================================== */

.metric-gsm {
  display: flex;
  flex-direction: column;
  padding: var(--space-5);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  position: relative;
  overflow: hidden;
}

.metric-gsm::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

.metric-value {
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  margin: var(--space-1) 0;
}

.metric-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
}

.metric-trend.up { color: #10b981; }
.metric-trend.down { color: #f43f5e; }

/* ==========================================================================
   TABLES
   ========================================================================== */

.table, .table-gsm {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table th, .table-gsm th {
  padding: 12px 16px;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-fg-secondary);
  background: rgba(14, 21, 38, 0.95);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.table td, .table-gsm td {
  padding: 14px 16px;
  font-size: var(--text-sm);
  color: var(--color-fg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  transition: background var(--spring-duration-fast);
}

.table tr:hover td, .table-gsm tr:hover td {
  background: rgba(6, 214, 160, 0.04);
}

/* ==========================================================================
   SPRING KEYFRAMES & ANIMATIONS
   ========================================================================== */

@keyframes spring-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spring-exit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-12px) scale(0.98); }
}

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

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}

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

@keyframes glow-shift {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.animate-spring-enter {
  animation: spring-enter var(--spring-duration-normal) var(--spring-default) forwards;
}

.animate-fade-in {
  animation: fade-in var(--spring-duration-fast) var(--spring-default) forwards;
}

.animate-pulse-ring {
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.animate-float {
  animation: float-tech 4s ease-in-out infinite;
}

/* Stagger Delays */
.stagger-1 { animation-delay: 0.04s; }
.stagger-2 { animation-delay: 0.08s; }
.stagger-3 { animation-delay: 0.12s; }
.stagger-4 { animation-delay: 0.16s; }
.stagger-5 { animation-delay: 0.20s; }
.stagger-6 { animation-delay: 0.24s; }

/* ==========================================================================
   LAYOUT & CONTAINERS
   ========================================================================== */

.container, .container-gsm {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.grid-auto, .grid-gsm-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-5);
}

@media (max-width: 768px) {
  .grid-auto, .grid-gsm-auto {
    grid-template-columns: 1fr;
  }
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* ==========================================================================
   AUTH PAGES & CARDS
   ========================================================================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--color-bg);
  background-image: radial-gradient(circle at 50% 30%, #152445 0%, #070b14 65%);
}

.auth-wrap {
  width: 100%;
  max-width: 440px;
}

.auth-card {
  background: rgba(14, 22, 40, 0.88);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 30px rgba(6, 214, 160, 0.1);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-logo img {
  max-height: 52px;
  filter: drop-shadow(0 4px 12px rgba(6, 214, 160, 0.3));
}

.auth-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  text-align: center;
  color: #ffffff;
  margin: 0 0 var(--space-2) 0;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--color-fg-secondary);
  text-align: center;
  margin-bottom: var(--space-6);
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: var(--color-fg-tertiary);
  font-size: var(--text-xs);
  text-transform: uppercase;
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--color-border);
}

.auth-divider::before { margin-right: 12px; }
.auth-divider::after { margin-left: 12px; }

/* ==========================================================================
   COMMAND PALETTE & MODALS (Emil Kowalski Motion Principles)
   ========================================================================== */

/* Command palette: zero lag for high-frequency keyboard operations */
.command-palette {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%) scale(0.96);
  width: 640px;
  max-width: calc(100vw - 32px);
  z-index: var(--z-command-palette);
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease-out, transform 100ms cubic-bezier(0.16, 1, 0.3, 1);
}

.command-palette.open {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  pointer-events: auto;
}

.command-palette-backdrop, .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  z-index: calc(var(--z-command-palette) - 1);
  transition: opacity 120ms ease-out;
}

.command-palette-backdrop.open, .modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Modals: Spring entry from scale(0.95), specific transitions avoiding 'all' */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 620px;
  max-height: 85vh;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  background: var(--card-bg);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid var(--glass-border-light);
  border-radius: var(--card-radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65), 0 0 30px rgba(6, 214, 160, 0.15);
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), opacity 180ms ease-out;
  overflow: hidden;
  transform-origin: center center;
}

.modal.open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* ==========================================================================
   SONNER TOAST STACKING SYSTEM (Emil Kowalski Physics)
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999 !important;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  pointer-events: none;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 0;
}

.toast {
  display: block !important;
  pointer-events: auto;
  position: absolute;
  bottom: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  background: rgba(14, 22, 40, 0.94);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.3);
  transform-origin: bottom center;
  touch-action: pan-x;
  user-select: none;
  cursor: grab;
  will-change: transform, opacity;
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease-out;
}

.toast:active {
  cursor: grabbing;
}

/* Sonner Stacking Layers */
.toast[data-index="0"] {
  transform: translateY(0px) scale(1);
  z-index: 30;
  opacity: 1;
}

.toast[data-index="1"] {
  transform: translateY(-12px) scale(0.95);
  z-index: 20;
  opacity: 0.88;
}

.toast[data-index="2"] {
  transform: translateY(-24px) scale(0.90);
  z-index: 10;
  opacity: 0.65;
}

.toast[data-index="3"],
.toast[data-index="4"] {
  transform: translateY(-36px) scale(0.85);
  z-index: 5;
  opacity: 0;
  pointer-events: none;
}

/* Hover-expanded stack per Sonner */
.toast-container:hover .toast[data-index="1"] {
  transform: translateY(calc(-100% - 10px)) scale(1);
  opacity: 1;
}

.toast-container:hover .toast[data-index="2"] {
  transform: translateY(calc(-200% - 20px)) scale(1);
  opacity: 1;
}

/* ==========================================================================
   DASHBOARD TYPOGRAPHY & COMPACT GSM SIZING
   ========================================================================== */

.text-heading {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-fg);
  line-height: 1.3;
  margin: 0;
}

.text-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-fg);
  letter-spacing: -0.01em;
  margin: 0;
}

.text-caption {
  font-size: 0.8125rem;
  color: var(--color-fg-secondary);
  line-height: 1.35;
  margin: 0;
}

.text-metric {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-fg);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}

.text-metric-sm {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

/* Modal and Drawers Hide by Default */
.modal:not(.open) {
  display: none !important;
}

.command-palette:not(.open) {
  display: none !important;
}

.command-palette-backdrop:not(.open),
.modal-backdrop:not(.open) {
  display: none !important;
}

/* Compact Card Sizing */
.grid-auto, .grid-gsm-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}

#agents-grid article.card {
  border-radius: 14px;
}

#agents-grid article.card > div.p-5 {
  padding: 16px;
}

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

[x-cloak] {
  display: none !important;
}

/* ==========================================================================
   SVG & LAYOUT GUARDIANS (Prevents oversized icons & layout blowout)
   ========================================================================== */

svg {
  box-sizing: border-box;
}

.w-3, svg.w-3 { width: 12px !important; height: 12px !important; max-width: 12px !important; max-height: 12px !important; }
.w-4, svg.w-4 { width: 16px !important; height: 16px !important; max-width: 16px !important; max-height: 16px !important; }
.w-5, svg.w-5 { width: 20px !important; height: 20px !important; max-width: 20px !important; max-height: 20px !important; }
.w-6, svg.w-6 { width: 24px !important; height: 24px !important; max-width: 24px !important; max-height: 24px !important; }

.w-8 { width: 32px !important; height: 32px !important; min-width: 32px !important; min-height: 32px !important; }
.w-10 { width: 40px !important; height: 40px !important; min-width: 40px !important; min-height: 40px !important; }
.w-12 { width: 48px !important; height: 48px !important; min-width: 48px !important; min-height: 48px !important; }

.btn-sm svg {
  width: 15px !important;
  height: 15px !important;
  max-width: 15px !important;
  max-height: 15px !important;
  flex-shrink: 0;
}

/* Flexbox utilities */
.flex { display: flex !important; }
.flex-1 { flex: 1 1 0% !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }
.flex-wrap { flex-wrap: wrap !important; }
.items-center { align-items: center !important; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }

.gap-1 { gap: 4px !important; }
.gap-1\.5 { gap: 6px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }
.gap-5 { gap: 20px !important; }

/* Grid utilities */
.grid { display: grid !important; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
@media (min-width: 768px) {
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .md\:flex { display: flex !important; }
}

/* Spacing and border utilities */
.text-center { text-align: center !important; }
.rounded-xl { border-radius: 12px !important; }
.rounded-full { border-radius: 9999px !important; }
.min-w-0 { min-width: 0 !important; }
.overflow-hidden { overflow: hidden !important; }
.relative { position: relative !important; }
.absolute { position: absolute !important; }
.top-0 { top: 0 !important; }
.left-0 { left: 0 !important; }
.right-0 { right: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.mb-4 { margin-bottom: 16px !important; }
.mb-5 { margin-bottom: 20px !important; }
.mb-6 { margin-bottom: 24px !important; }
.mt-1 { margin-top: 4px !important; }
.mt-4 { margin-top: 16px !important; }
.p-3 { padding: 12px !important; }
.p-5 { padding: 18px !important; }
.py-6 { padding-top: 24px !important; padding-bottom: 24px !important; }
.h-16 { height: 64px !important; }
.border-b { border-bottom-width: 1px !important; }
.sticky { position: sticky !important; }
.z-50 { z-index: 50 !important; }


