/* Apple iOS / macOS Design System Tokens */
:root {
  /* iOS System Colors */
  --ios-blue: #007AFF;
  --ios-blue-rgb: 0, 122, 255;
  --ios-green: #34C759;
  --ios-green-rgb: 52, 199, 89;
  --ios-indigo: #5856D6;
  --ios-orange: #FF9500;
  --ios-pink: #FF2D55;
  --ios-purple: #AF52DE;
  --ios-red: #FF3B30;
  --ios-teal: #30B0C7;
  --ios-yellow: #FFCC00;
  --ios-mint: #00C7BE;
  --ios-cyan: #32ADE6;

  /* Active System Color Palette */
  --system-accent: #007AFF;
  --system-accent-rgb: 0, 122, 255;
  --table-header-bg: #A9D18E;
  --table-header-border: #70AD47;
  --table-header-color: #12380A;
  --table-header-bg-dark: #2E5324;
  --table-header-border-dark: #38662C;
  --table-header-color-dark: #E2F0D9;

  /* Neutrals - Light Mode (Default) */
  --system-bg: #F2F2F7;
  --system-bg-secondary: #FFFFFF;
  --system-bg-tertiary: #F8F8FA;
  --system-card-bg: rgba(255, 255, 255, 0.85);
  --system-glass-bg: rgba(255, 255, 255, 0.72);
  --system-glass-border: rgba(255, 255, 255, 0.6);
  --system-border: rgba(60, 60, 67, 0.12);
  --system-border-subtle: rgba(60, 60, 67, 0.06);

  /* Label Colors */
  --label-primary: #1C1C1E;
  --label-secondary: #636366;
  --label-tertiary: #8E8E93;
  --label-quaternary: #AEAEB2;

  /* Controls & Fills */
  --fill-primary: rgba(120, 120, 128, 0.2);
  --fill-secondary: rgba(120, 120, 128, 0.16);
  --fill-tertiary: rgba(118, 118, 128, 0.12);
  --fill-quaternary: rgba(116, 116, 128, 0.08);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.09), 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);

  /* Radii (Apple squircles) */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Inter, sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-base: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

/* Dark Mode Tokens */
[data-theme="dark"] {
  --system-bg: #000000;
  --system-bg-secondary: #1C1C1E;
  --system-bg-tertiary: #2C2C2E;
  --system-card-bg: rgba(28, 28, 30, 0.85);
  --system-glass-bg: rgba(28, 28, 30, 0.72);
  --system-glass-border: rgba(255, 255, 255, 0.12);
  --system-border: rgba(255, 255, 255, 0.15);
  --system-border-subtle: rgba(255, 255, 255, 0.08);

  --label-primary: #FFFFFF;
  --label-secondary: #EBEBF5;
  --label-tertiary: #8E8E93;
  --label-quaternary: #636366;

  --fill-primary: rgba(120, 120, 128, 0.36);
  --fill-secondary: rgba(120, 120, 128, 0.32);
  --fill-tertiary: rgba(118, 118, 128, 0.24);
  --fill-quaternary: rgba(118, 118, 128, 0.18);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

/* Global Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--system-bg);
  color: var(--label-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--fill-secondary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--label-tertiary);
}

/* ==========================================================================
   5 SYSTEM COLOR THEMES: Azul, Verde, Rojo, Morado, Naranja
   ========================================================================== */

/* Tema: Azul (Default iOS Blue) */
[data-theme-color="azul"] {
  --system-accent: #007AFF;
  --system-accent-rgb: 0, 122, 255;
  --ios-blue: #007AFF;
  --ios-blue-rgb: 0, 122, 255;
  --table-header-bg: #C3DCFE;
  --table-header-border: #007AFF;
  --table-header-color: #002B66;
  --table-header-bg-dark: #1A3E6D;
  --table-header-border-dark: #0A84FF;
  --table-header-color-dark: #E1EFFF;
}

/* Tema: Verde (Emerald Green) */
[data-theme-color="verde"] {
  --system-accent: #34C759;
  --system-accent-rgb: 52, 199, 89;
  --ios-blue: #34C759;
  --ios-blue-rgb: 52, 199, 89;
  --table-header-bg: #A9D18E;
  --table-header-border: #70AD47;
  --table-header-color: #12380A;
  --table-header-bg-dark: #2E5324;
  --table-header-border-dark: #38662C;
  --table-header-color-dark: #E2F0D9;
}

/* Tema: Rojo (Ruby / Crimson) */
[data-theme-color="rojo"] {
  --system-accent: #FF3B30;
  --system-accent-rgb: 255, 59, 48;
  --ios-blue: #FF3B30;
  --ios-blue-rgb: 255, 59, 48;
  --table-header-bg: #F8C6C4;
  --table-header-border: #FF3B30;
  --table-header-color: #5C0C07;
  --table-header-bg-dark: #631C18;
  --table-header-border-dark: #FF453A;
  --table-header-color-dark: #FFE5E3;
}

/* Tema: Morado (Royal Purple) */
[data-theme-color="morado"] {
  --system-accent: #AF52DE;
  --system-accent-rgb: 175, 82, 222;
  --ios-blue: #AF52DE;
  --ios-blue-rgb: 175, 82, 222;
  --table-header-bg: #E3C8F8;
  --table-header-border: #AF52DE;
  --table-header-color: #3B0E54;
  --table-header-bg-dark: #4C1D6B;
  --table-header-border-dark: #BF5AF2;
  --table-header-color-dark: #F6EAFF;
}

/* Tema: Naranja (Sunset Orange) */
[data-theme-color="naranja"] {
  --system-accent: #FF9500;
  --system-accent-rgb: 255, 149, 0;
  --ios-blue: #FF9500;
  --ios-blue-rgb: 255, 149, 0;
  --table-header-bg: #FEE0B2;
  --table-header-border: #FF9500;
  --table-header-color: #5C3200;
  --table-header-bg-dark: #663900;
  --table-header-border-dark: #FF9F0A;
  --table-header-color-dark: #FFF0DB;
}

/* Tema: Cian (Apple Cyan / Aqua) */
[data-theme-color="cian"] {
  --system-accent: #32ADE6;
  --system-accent-rgb: 50, 173, 230;
  --ios-blue: #32ADE6;
  --ios-blue-rgb: 50, 173, 230;
  --table-header-bg: #BAE8FA;
  --table-header-border: #32ADE6;
  --table-header-color: #064560;
  --table-header-bg-dark: #0D4760;
  --table-header-border-dark: #32ADE6;
  --table-header-color-dark: #E1F6FF;
}

