/* ===================================================================
   TOKENS Y BASE: la identidad visual (colores, espacios, sombras, tipografía) en tema oscuro, claro y automático,
   el reseteo, el foco visible y las preferencias de movimiento. Un color nuevo es un token de AQUÍ, nunca un hex en una plantilla
   (lo vigila `check_all`, «estilos»). Se carga PRIMERO.
   =================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===================================================================
   TOKENS. Un único sitio donde vive la identidad visual del portal.
   Las pantallas NUNCA declaran un color a mano: usan estos tokens o
   las clases de componente de más abajo. Si un color hace falta y no
   está aquí, el sitio de añadirlo es este, no la plantilla.
   =================================================================== */
:root {
  color-scheme: dark;
  /* Superficies, en escala de elevación (a más alto, más cerca) */
  --bg: #0d0e11;
  --surface: #16181d;
  --surface-2: #1c1f26;
  --surface-3: #232730;
  --border: #2a2e37;
  --border-strong: #3a3f4b;
  --hover: #ffffff09;

  /* Marca. `--accent` es el rojo vivo (bandas, iconos, foco); `--accent-btn`
     es el MISMO rojo oscurecido hasta que el texto blanco encima llega a 4,5:1
     (AA): con el vivo, el botón principal se quedaba en 4,17. */
  --accent: #e63946;
  --accent-btn: #c9303c;
  --accent-hover: #f2505d;
  --accent-soft: #e6394622;
  --accent2: #f4a261;
  --accent-text: #ff6b76;   /* el rojo de marca como TEXTO sobre fondo oscuro (el vivo se queda en 4,3:1) */

  /* Texto, en tres niveles de énfasis */
  --text: #e9ebee;
  --text-2: #a9aeb9;
  --muted: #8f95a3;

  /* Estados: cada uno con su fondo tenue y su color de texto legible
     sobre ese fondo (contraste comprobado sobre --surface, AA en los dos
     temas). `--on-ok` es el texto de un botón verde: blanco sobre el verde
     se quedaba en 3,3:1. */
  --ok: #2a9d8f;      --ok-bg: #15311f;   --ok-fg: #5fc48a;  --on-ok: #06130d;
  --warn: #e9c46a;    --warn-bg: #2e2609; --warn-fg: #e9c46a;
  --danger: #d64545;  --danger-bg: #331717; --danger-fg: #ef8080;  --danger-btn: #c23b3b;
  --info: #4ea8de;    --info-bg: #14283c;  --info-fg: #7ecff5;
  --pink-bg: #3a1030; --pink-fg: #f4a6d7;

  /* Formas y profundidad */
  --r-sm: 5px; --r: 8px; --r-lg: 12px; --r-pill: 999px;
  --sh-1: 0 1px 2px #00000055;
  --sh-2: 0 4px 14px #00000066;
  --sh-3: 0 14px 40px #000000aa;
  --ring: 0 0 0 3px #e6394655;
  --scrim: #000000b0;
  --overlay: #000a; --overlay-strong: #000c; --overlay-soft: #00000040;   /* velos y sombras que no cambian con el tema */
  --on-accent: #fff;        /* texto sobre el rojo de marca y sobre los botones de color */
  --on-warn: #1a1508;       /* texto sobre el ámbar */
  --warn-btn: #b5451b;      /* botón de aviso («cuidado, pero se puede») */

  /* Medidas de la navegación y objetivo táctil mínimo */
  --nav-w: 232px; --rail-w: 68px; --tap: 44px;
}

/* Tema claro (D-UX5 de docs/ux-2.0.md). Se elige en el menú de usuario; el
   «automático» sigue al sistema. Sin elección, el portal es oscuro como siempre. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef0f4; --surface: #ffffff; --surface-2: #f5f6f9; --surface-3: #e8eaf0;
  --border: #dcdfe6; --border-strong: #c3c8d3; --hover: #00000008;
  --accent: #c9303c; --accent-btn: #c9303c; --accent-hover: #b32733; --accent-soft: #c9303c18; --accent2: #a8530f; --accent-text: #c9303c;
  --text: #14161a; --text-2: #3d424c; --muted: #5b6270;
  --ok: #17794c; --ok-bg: #e3f4ea; --ok-fg: #17663a; --on-ok: #ffffff;
  --warn: #8a6700; --warn-bg: #fbf0d0; --warn-fg: #7a5a00;
  --danger: #c13030; --danger-bg: #fbe3e3; --danger-fg: #a52424; --danger-btn: #c13030;
  --info: #1f7bb3; --info-bg: #e0f0fb; --info-fg: #14587f;
  --pink-bg: #fbe3f1; --pink-fg: #8a1f5e;
  --sh-1: 0 1px 2px #1a1f2d22; --sh-2: 0 4px 14px #1a1f2d26; --sh-3: 0 14px 40px #1a1f2d38;
  --ring: 0 0 0 3px #c9303c55; --scrim: #0b0e1699;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --bg: #eef0f4; --surface: #ffffff; --surface-2: #f5f6f9; --surface-3: #e8eaf0;
    --border: #dcdfe6; --border-strong: #c3c8d3; --hover: #00000008;
    --accent: #c9303c; --accent-btn: #c9303c; --accent-hover: #b32733; --accent-soft: #c9303c18; --accent2: #a8530f; --accent-text: #c9303c;
    --text: #14161a; --text-2: #3d424c; --muted: #5b6270;
    --ok: #17794c; --ok-bg: #e3f4ea; --ok-fg: #17663a; --on-ok: #ffffff;
    --warn: #8a6700; --warn-bg: #fbf0d0; --warn-fg: #7a5a00;
    --danger: #c13030; --danger-bg: #fbe3e3; --danger-fg: #a52424; --danger-btn: #c13030;
    --info: #1f7bb3; --info-bg: #e0f0fb; --info-fg: #14587f;
    --pink-bg: #fbe3f1; --pink-fg: #8a1f5e;
    --sh-1: 0 1px 2px #1a1f2d22; --sh-2: 0 4px 14px #1a1f2d26; --sh-3: 0 14px 40px #1a1f2d38;
    --ring: 0 0 0 3px #c9303c55; --scrim: #0b0e1699;
  }
}
body {
  background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Foco visible y consistente en todo lo interactivo. Antes solo los
   campos del modal marcaban el foco, así que navegar con teclado por
   botones y enlaces no daba ninguna señal de dónde estabas. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: none; box-shadow: var(--ring); border-radius: var(--r-sm);
}

/* Títulos */
h1, h2 { font-size: 1.35rem; font-weight: 650; margin-bottom: 1rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; font-weight: 600; margin-bottom: .5rem; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Una escena que es oscura en cualquier tema (la Oficina dibujada): dentro, los tokens vuelven a su valor oscuro. */
.tema-oscuro {
  color-scheme: dark; color: var(--text);
  --bg: #0d0e11; --surface: #16181d; --surface-2: #1c1f26; --surface-3: #232730;
  --border: #2a2e37; --border-strong: #3a3f4b; --hover: #ffffff09;
  --accent: #e63946; --accent2: #f4a261; --accent-text: #ff6b76;
  --text: #e9ebee; --text-2: #a9aeb9; --muted: #8f95a3;
  --ok-bg: #15311f; --ok-fg: #5fc48a; --warn: #e9c46a; --warn-bg: #2e2609; --warn-fg: #e9c46a;
  --danger-bg: #331717; --danger-fg: #ef8080; --info-bg: #14283c; --info-fg: #7ecff5;
  --accent-btn: #c9303c; --accent-hover: #f2505d; --accent-soft: #e6394622;
  --ok: #2a9d8f; --on-ok: #06130d; --danger: #d64545; --danger-btn: #c23b3b; --info: #4ea8de; --pink-bg: #3a1030; --pink-fg: #f4a6d7;
  --sh-1: 0 1px 2px #00000055; --sh-2: 0 4px 14px #00000066; --sh-3: 0 14px 40px #000000aa; --ring: 0 0 0 3px #e6394655; --scrim: #000000b0;
}

/* ===== Adaptación a pantallas pequeñas y anchas de esta capa (de la más ancha a la más estrecha) ===== */

@media (max-width: 600px) {
/* ===== Móvil (≤ 600 px): sin barra lateral, barra inferior y objetivos táctiles de 44 px ===== */
  body { font-size: 15px; }
}
