/* ====================================================================
 * OPUS NOVA — tokens compartidos del hub OPUS (:4700)
 * Extraído del design-system de OPUS ai (modulo-0/packages/design-system)
 * Fuente de verdad de la paleta: src/tokens/colors.css (dark-first).
 * ==================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Brand (azul OPUS) */
  --brand:        #0c6fd6;
  --brand-hover:  #2e8bf0;
  --brand-soft:   rgba(12, 111, 214, 0.14);
  --brand-text:   #59a6f5;

  /* Accent (heritage amber) + semánticos */
  --accent:  #f59e0b;
  --green:   #10b981;
  --red:     #ef4444;
  --amber:   #f59e0b;

  /* Superficies (neutrals dark del DS) */
  --bg:      #050810;   /* neutral-0  — página */
  --bg2:     #0a0e18;   /* neutral-5  — barras */
  --card:    #0e1420;   /* neutral-10 — surface */
  --raised:  #141b2b;   /* neutral-15 — inputs/kv */
  --overlay: #1a2236;   /* neutral-20 */

  /* Bordes y texto */
  --line:        rgba(255, 255, 255, 0.10);
  --line-subtle: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text:        #f5f6fb;
  --dim:         #b6bbd0;
  --mute:        #8f96b0;

  /* Tipografía */
  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Radios y sombras */
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-8:  0 4px 8px rgba(0, 0, 0, 0.4), 0 0 2px rgba(0, 0, 0, 0.3);
  --shadow-16: 0 8px 16px rgba(0, 0, 0, 0.45), 0 0 2px rgba(0, 0, 0, 0.3);
  --shadow-28: 0 14px 28px rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 0, 0, 0.35);
  --glow-brand: 0 0 0 1px rgba(12, 111, 214, 0.25), 0 8px 24px rgba(12, 111, 214, 0.18);
}

/* ── Tokens semánticos (comunes a los dos temas; los valores cambian en cada tema) ── */
:root {
  color-scheme: dark;
  --on-brand: #ffffff;
  --on-green: #04140e;
  --header-bg: rgba(10, 14, 24, 0.85);
  --scrim: rgba(5, 8, 16, 0.84);
  --tint: rgba(255, 255, 255, 0.05);
  --tint-2: rgba(255, 255, 255, 0.03);
  --ink-rgb: 255, 255, 255;
  /* Estados */
  --ok-bg: rgba(16, 185, 129, 0.14);   --ok-line: rgba(16, 185, 129, 0.35);   --ok-text: #4ade9c;
  --warn-bg: rgba(245, 158, 11, 0.10); --warn-line: rgba(245, 158, 11, 0.40); --warn-text: #f5c86b; --warn-strong: #ffdf9e;
  --bad-bg: rgba(239, 68, 68, 0.12);   --bad-line: rgba(239, 68, 68, 0.38);   --bad-text: #ff8a8a;
  --info-bg: rgba(59, 130, 246, 0.15); --info-line: rgba(59, 130, 246, 0.35); --info-text: #93c5fd;
  --gold-bg: rgba(201, 162, 39, 0.16); --gold-line: rgba(201, 162, 39, 0.40); --gold-text: #e8c547;
  --focus-ring: 0 0 0 3px rgba(89, 166, 245, 0.35);
}

/* ── Tema claro: [data-theme="light"] lo fija el script de cabecera (localStorage eco_theme o el sistema) ── */
:root[data-theme="light"] {
  color-scheme: light;
  --brand:        #0c6fd6;
  --brand-hover:  #0a5cb5;
  --brand-soft:   rgba(12, 111, 214, 0.09);
  --brand-text:   #0a5bb5;
  --accent:  #f59e0b;
  --green:   #047857;
  --red:     #dc2626;
  --amber:   #b45309;

  --bg:      #f3f5fa;
  --bg2:     #ffffff;
  --card:    #ffffff;
  --raised:  #eef1f7;
  --overlay: #ffffff;

  --line:        rgba(15, 23, 42, 0.14);
  --line-subtle: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.26);
  --text:        #0e1420;
  --dim:         #39425a;
  --mute:        #586279;

  --shadow-8:  0 2px 8px rgba(15, 23, 42, 0.08), 0 0 1px rgba(15, 23, 42, 0.12);
  --shadow-16: 0 8px 18px rgba(15, 23, 42, 0.12), 0 0 1px rgba(15, 23, 42, 0.14);
  --shadow-28: 0 14px 30px rgba(15, 23, 42, 0.14), 0 0 1px rgba(15, 23, 42, 0.14);
  --glow-brand: 0 0 0 1px rgba(12, 111, 214, 0.30), 0 8px 22px rgba(12, 111, 214, 0.12);

  --on-green: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.88);
  --scrim: rgba(243, 245, 250, 0.88);
  --tint: rgba(15, 23, 42, 0.05);
  --tint-2: rgba(15, 23, 42, 0.03);
  --ink-rgb: 15, 23, 42;
  --ok-bg: rgba(4, 120, 87, 0.10);   --ok-line: rgba(4, 120, 87, 0.40);   --ok-text: #047857;
  --warn-bg: rgba(180, 83, 9, 0.09); --warn-line: rgba(180, 83, 9, 0.40); --warn-text: #8a4308; --warn-strong: #6b3306;
  --bad-bg: rgba(220, 38, 38, 0.08); --bad-line: rgba(220, 38, 38, 0.40); --bad-text: #b91c1c;
  --info-bg: rgba(12, 111, 214, 0.09); --info-line: rgba(12, 111, 214, 0.35); --info-text: #0a5bb5;
  --gold-bg: rgba(180, 130, 10, 0.12); --gold-line: rgba(180, 130, 10, 0.45); --gold-text: #7a5a06;
  --focus-ring: 0 0 0 3px rgba(12, 111, 214, 0.28);
}

/* ── Marca OPUS (cuadro con la O) y botón de tema, compartidos por login y hub ── */
.theme-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; flex: none; cursor: pointer;
  border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--raised); color: var(--text); }
.theme-btn:hover { border-color: var(--line-strong); }
.theme-btn:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn .moon { display: none; }
:root[data-theme="light"] .theme-btn .moon { display: block; }
:root[data-theme="light"] .theme-btn .sun { display: none; }
