/* ============================================================================
 * CRONO — Design Tokens (Light & Dark Mode + Escala estricta Z-Index)
 * ============================================================================ */

:root {
  /* Tipografía de sistema de alto rendimiento (cero CDNs) */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;

  /* Superficies — Modo Claro */
  --bg-app: #f4f6f9;
  --bg-surface: #ffffff;
  --bg-surface-2: #f8fafc;
  --bg-surface-hover: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-backdrop: rgba(15, 23, 42, 0.52);

  /* Bordes */
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Textos */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  /* Acentos y estados */
  --accent-50: #eff6ff;
  --accent-100: #dbeafe;
  --accent-500: #3b82f6;
  --accent-600: #2563eb;
  --accent-700: #1d4ed8;

  --success-bg: #dcfce7;
  --success-text: #166534;
  --success-solid: #16a34a;

  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --warning-solid: #d97706;

  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --danger-solid: #dc2626;

  /* Sombras */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.07);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.16);

  /* Radios y espaciado */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;

  --header-height: 56px;
  --sidebar-width: 248px;
  --sidebar-collapsed: 64px;

  /* Escala Z-Index (Sección 6.2 de DISENO_PROYECTO_CRONO.txt) */
  --z-content: 1;
  --z-chrome: 100;
  --z-timer-bar: 200;
  --z-dm-dock: 210;
  --z-project-chat: 220;
  --z-dropdown: 300;
  --z-modal: 400;
  --z-palette: 500;
  --z-lightbox: 600;
  --z-toast: 700;

  --transition-fast: 140ms ease;
  --transition-med: 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Modo Oscuro explícito */
html[data-theme="dark"] {
  --bg-app: #0b1120;
  --bg-surface: #111827;
  --bg-surface-2: #162033;
  --bg-surface-hover: #1e293b;
  --bg-elevated: #182235;
  --bg-backdrop: rgba(2, 6, 23, 0.72);

  --border-subtle: #1f2d42;
  --border-strong: #334155;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --accent-50: rgba(59, 130, 246, 0.14);
  --accent-100: rgba(59, 130, 246, 0.22);
  --accent-500: #60a5fa;
  --accent-600: #3b82f6;
  --accent-700: #2563eb;

  --success-bg: rgba(22, 163, 74, 0.18);
  --success-text: #86efac;
  --warning-bg: rgba(217, 119, 6, 0.20);
  --warning-text: #fcd34d;
  --danger-bg: rgba(220, 38, 38, 0.22);
  --danger-text: #fca5a5;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, 0.40);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.50);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.65);
}

/* Modo Sistema siguiendo preferencia del SO */
@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    --bg-app: #0b1120;
    --bg-surface: #111827;
    --bg-surface-2: #162033;
    --bg-surface-hover: #1e293b;
    --bg-elevated: #182235;
    --bg-backdrop: rgba(2, 6, 23, 0.72);
    --border-subtle: #1f2d42;
    --border-strong: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --accent-50: rgba(59, 130, 246, 0.14);
    --accent-100: rgba(59, 130, 246, 0.22);
    --accent-500: #60a5fa;
    --accent-600: #3b82f6;
    --accent-700: #2563eb;
    --success-bg: rgba(22, 163, 74, 0.18);
    --success-text: #86efac;
    --warning-bg: rgba(217, 119, 6, 0.20);
    --warning-text: #fcd34d;
    --danger-bg: rgba(220, 38, 38, 0.22);
    --danger-text: #fca5a5;
  }
}
