/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  color-scheme: light;

  /* Marca (comparte lenguaje visual con la extensión) */
  --acento: #5b4bdb;
  --acento-fuerte: #4a3cc4;
  --acento-suave: #eeebff;

  /* Superficies y texto (paleta validada con la skill dataviz) */
  --superficie: #fcfcfb;
  --plano-pagina: #f9f9f7;
  --panel: #ffffff;
  --borde: #e1e0d9;
  --texto-primario: #0b0b0b;
  --texto-secundario: #52514e;
  --texto-tenue: #898781;

  /* Categóricos (identidad de estado de proceso, orden fijo) */
  --cat-1: #2a78d6;
  --cat-2: #eb6834;
  --cat-3: #1baf7a;
  --cat-4: #eda100;
  --cat-5: #e87ba4;

  /* Estado (semántica de desenlace — reservados, nunca reutilizados) */
  --estado-good: #0ca30c;
  --estado-warning: #fab219;
  --estado-critical: #d03b3b;
  --exito-texto: #006300;

  --radio: 12px;
  --radio-chico: 8px;
  --sombra: 0 1px 2px rgba(11, 11, 11, 0.06), 0 12px 32px rgba(11, 11, 11, 0.06);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --superficie: #1a1a19;
    --plano-pagina: #0d0d0d;
    --panel: #201f1e;
    --borde: #2c2c2a;
    --texto-primario: #ffffff;
    --texto-secundario: #c3c2b7;
    --texto-tenue: #898781;

    --cat-1: #3987e5;
    --cat-2: #d95926;
    --cat-3: #199e70;
    --cat-4: #c98500;
    --cat-5: #d55181;

    --estado-good: #0ca30c;
    --estado-warning: #fab219;
    --estado-critical: #d03b3b;
    --exito-texto: #0ca30c;

    --acento-suave: #2a2550;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --superficie: #1a1a19;
  --plano-pagina: #0d0d0d;
  --panel: #201f1e;
  --borde: #2c2c2a;
  --texto-primario: #ffffff;
  --texto-secundario: #c3c2b7;
  --texto-tenue: #898781;

  --cat-1: #3987e5;
  --cat-2: #d95926;
  --cat-3: #199e70;
  --cat-4: #c98500;
  --cat-5: #d55181;

  --estado-good: #0ca30c;
  --estado-warning: #fab219;
  --estado-critical: #d03b3b;
  --exito-texto: #0ca30c;

  --acento-suave: #2a2550;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--texto-primario);
  background: var(--plano-pagina);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; }
::selection { background: var(--acento); color: #fff; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilidades
   ============================================================= */
.contenedor { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--acento); color: #fff;
  border-radius: var(--radio-chico); font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.tabular { font-variant-numeric: tabular-nums; }

/* =============================================================
   4. Tipografía
   ============================================================= */
.eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--acento); }
.texto-tenue { color: var(--texto-tenue); }
.texto-secundario { color: var(--texto-secundario); }

/* =============================================================
   5. Componentes
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.5rem; border-radius: 999px; font-weight: 700; font-size: .95rem;
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), background .15s;
}
.btn-primario { background: var(--acento); color: #fff; box-shadow: var(--sombra); }
.btn-primario:hover { background: var(--acento-fuerte); transform: translateY(-1px); }
.btn-secundario { background: var(--panel); color: var(--texto-primario); border: 1px solid var(--borde); }
.btn-secundario:hover { border-color: var(--acento); color: var(--acento); }
.btn-chico { padding: .5rem 1rem; font-size: .85rem; border-radius: var(--radio-chico); }

.tarjeta {
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.5rem; box-shadow: var(--sombra);
}

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .3rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--acento-suave); color: var(--acento);
}

/* Navegación */
.cabecera {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--plano-pagina) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--borde);
}
.cabecera-fila { display: flex; align-items: center; justify-content: space-between; padding: .9rem 0; gap: 1rem; }
.marca { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.05rem; }
.marca .marca-icono { width: 28px; height: 28px; }
.nav-principal { display: none; gap: 1.75rem; }
.nav-principal a { font-size: .9rem; font-weight: 600; color: var(--texto-secundario); }
.nav-principal a:hover { color: var(--texto-primario); }
.cabecera-acciones { display: flex; align-items: center; gap: .6rem; }
.boton-tema {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--borde);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}

/* Pie de página */
.pie {
  border-top: 1px solid var(--borde); margin-top: 4rem; padding: 2.5rem 0;
  color: var(--texto-tenue); font-size: .85rem;
}
.pie-filas { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; }
.pie-enlaces { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.pie-enlaces a:hover { color: var(--texto-primario); }

/* Ad slots — placeholders vacíos, el propietario pega su código de AdSense */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 90px; border: 1px dashed var(--borde); border-radius: var(--radio-chico);
  color: var(--texto-tenue); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase;
  margin-block: 2rem;
}

/* FAQ */
.faq-item { border-bottom: 1px solid var(--borde); padding: 1rem 0; }
.faq-item summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--acento); font-size: 1.2rem; flex-shrink: 0; }
.faq-item[open] summary::after { content: "–"; }
.faq-item p { margin-top: .75rem; color: var(--texto-secundario); }

/* =============================================================
   6. Secciones — landing
   ============================================================= */
.hero { padding: 4rem 0 2rem; text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); max-width: 18ch; margin-inline: auto; }
.hero .subtitulo { margin: 1.25rem auto 0; max-width: 52ch; font-size: 1.15rem; color: var(--texto-secundario); }
.hero-cta { display: flex; justify-content: center; gap: .75rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-nota { margin-top: .85rem; font-size: .8rem; color: var(--texto-tenue); }

/* Demo visual del autorrelleno: mock estático animado con CSS, sin vídeo/GIF */
.demo-mock {
  margin: 3rem auto 0; max-width: 560px; text-align: left;
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  box-shadow: var(--sombra); overflow: hidden;
}
.demo-mock-barra { display: flex; gap: 6px; padding: .75rem 1rem; border-bottom: 1px solid var(--borde); }
.demo-mock-barra span { width: 10px; height: 10px; border-radius: 50%; background: var(--borde); }
.demo-mock-cuerpo { padding: 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
.demo-campo { display: flex; flex-direction: column; gap: 4px; }
.demo-campo label { font-size: .72rem; font-weight: 700; color: var(--texto-tenue); }
.demo-campo .caja {
  height: 34px; border-radius: 6px; border: 1px solid var(--borde); background: var(--superficie);
  display: flex; align-items: center; padding: 0 .6rem; font-size: .85rem; color: var(--texto-tenue);
  position: relative; overflow: hidden;
}
.demo-campo .caja .texto-escrito { color: var(--texto-primario); opacity: 0; animation: aparecer .4s var(--ease-out) forwards; }
.demo-campo.n1 .caja .texto-escrito { animation-delay: .3s; }
.demo-campo.n2 .caja .texto-escrito { animation-delay: .7s; }
.demo-campo.n3 .caja .texto-escrito { animation-delay: 1.1s; }
.demo-campo .caja.rellenada { border-color: var(--estado-good); }
@keyframes aparecer { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .demo-campo .caja .texto-escrito { animation: none !important; opacity: 1 !important; }
}

/* Beneficios */
.beneficios { display: grid; gap: 1.25rem; margin-top: 2.5rem; grid-template-columns: 1fr; }
.beneficio-icono { font-size: 1.6rem; margin-bottom: .6rem; }
.beneficio h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.beneficio p { color: var(--texto-secundario); font-size: .92rem; }

/* Portales */
.portales-lista { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1.5rem; }
.portal-chip {
  padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--borde);
  background: var(--panel); font-weight: 600; font-size: .9rem;
}

.seccion { padding: 3.5rem 0; }
.seccion-cabecera { text-align: center; max-width: 46ch; margin: 0 auto 1rem; }
.seccion-cabecera h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-top: .5rem; }

.faq-lista { max-width: 680px; margin: 2rem auto 0; }

.cta-final { text-align: center; padding: 3rem 2rem; border-radius: var(--radio); background: var(--acento-suave); }
.cta-final h2 { font-size: clamp(1.4rem, 3vw, 2rem); }

/* =============================================================
   7. Panel (dashboard de candidaturas)
   ============================================================= */
.panel-cabecera { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.panel-cabecera h1 { font-size: 1.6rem; }

.fuente-datos {
  display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--texto-secundario);
  padding: .5rem .9rem; border: 1px solid var(--borde); border-radius: 999px; background: var(--panel);
}
.fuente-datos .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--texto-tenue); }
.fuente-datos.conectado .punto { background: var(--estado-good); }

.stat-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-tile { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.1rem 1.25rem; }
.stat-tile .label { font-size: .78rem; color: var(--texto-secundario); font-weight: 600; }
.stat-tile .valor { font-size: 1.9rem; font-weight: 700; margin-top: .25rem; }
.stat-tile .delta { font-size: .78rem; margin-top: .2rem; font-weight: 700; }
.stat-tile .delta.pos { color: var(--exito-texto); }
.stat-tile .delta.neu { color: var(--texto-tenue); }

.panel-toolbar {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.25rem;
  padding: .75rem; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio-chico);
}
.panel-toolbar input[type="search"], .panel-toolbar select {
  padding: .5rem .7rem; border: 1px solid var(--borde); border-radius: 6px; background: var(--superficie);
  color: var(--texto-primario); font-size: .85rem;
}
.vista-toggle { display: inline-flex; border: 1px solid var(--borde); border-radius: 999px; overflow: hidden; margin-left: auto; }
.vista-toggle button { padding: .45rem 1rem; font-size: .82rem; font-weight: 700; }
.vista-toggle button[aria-pressed="true"] { background: var(--acento); color: #fff; }

/* Tabla */
.tabla-envoltorio { overflow-x: auto; border: 1px solid var(--borde); border-radius: var(--radio); background: var(--panel); }
table.tabla-candidaturas { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 720px; }
table.tabla-candidaturas th { text-align: left; padding: .75rem 1rem; color: var(--texto-tenue); font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--borde); }
table.tabla-candidaturas td { padding: .75rem 1rem; border-bottom: 1px solid var(--borde); }
table.tabla-candidaturas tr:last-child td { border-bottom: none; }
table.tabla-candidaturas tr:hover td { background: var(--superficie); }

/* Los pills de estado nunca colorean el texto (regla dataviz: la identidad
   la lleva la marca de color, no el texto) — el texto queda en tinta
   neutra, y un punto de color hace de identificador. */
.estado-pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .65rem .25rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--color-estado-fondo); color: var(--texto-primario);
}
.estado-pill::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--color-estado-solido);
}

/* Mapeo de cada estado de candidatura a su rol de color (ver manifest.js).
   Los estados de proceso usan la paleta categórica (identidad); los tres
   desenlaces usan la paleta de estado (semántica good/warning/critical). */
[data-estado-rol="cat-1"] { --color-estado-solido: var(--cat-1); --color-estado-fondo: color-mix(in srgb, var(--cat-1) 16%, var(--superficie)); }
[data-estado-rol="cat-2"] { --color-estado-solido: var(--cat-2); --color-estado-fondo: color-mix(in srgb, var(--cat-2) 16%, var(--superficie)); }
[data-estado-rol="cat-3"] { --color-estado-solido: var(--cat-3); --color-estado-fondo: color-mix(in srgb, var(--cat-3) 16%, var(--superficie)); }
[data-estado-rol="cat-4"] { --color-estado-solido: var(--cat-4); --color-estado-fondo: color-mix(in srgb, var(--cat-4) 18%, var(--superficie)); }
[data-estado-rol="cat-5"] { --color-estado-solido: var(--cat-5); --color-estado-fondo: color-mix(in srgb, var(--cat-5) 16%, var(--superficie)); }
[data-estado-rol="good"] { --color-estado-solido: var(--estado-good); --color-estado-fondo: color-mix(in srgb, var(--estado-good) 15%, var(--superficie)); }
[data-estado-rol="warning"] { --color-estado-solido: var(--estado-warning); --color-estado-fondo: color-mix(in srgb, var(--estado-warning) 20%, var(--superficie)); }
[data-estado-rol="critical"] { --color-estado-solido: var(--estado-critical); --color-estado-fondo: color-mix(in srgb, var(--estado-critical) 15%, var(--superficie)); }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 250px; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-columna { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); display: flex; flex-direction: column; min-height: 200px; }
.kanban-columna-cabecera { display: flex; align-items: center; gap: .5rem; padding: .8rem .9rem; border-bottom: 1px solid var(--borde); font-weight: 700; font-size: .85rem; }
.kanban-columna-cabecera .punto-estado { width: 10px; height: 10px; border-radius: 50%; background: var(--color-estado-solido); flex-shrink: 0; }
.kanban-columna-cabecera .contador { margin-left: auto; color: var(--texto-tenue); font-weight: 600; font-size: .78rem; }
.kanban-tarjetas { padding: .6rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; min-height: 60px; }
.kanban-tarjeta {
  background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-chico);
  padding: .65rem .75rem; font-size: .82rem; cursor: grab;
}
.kanban-tarjeta strong { display: block; font-size: .86rem; }
.kanban-tarjeta .empresa-muted { color: var(--texto-tenue); font-size: .76rem; }
.kanban-tarjeta.arrastrando { opacity: .4; }
.kanban-columna.zona-drop { outline: 2px dashed var(--acento); outline-offset: -4px; }
.kanban-vacio { padding: 1.5rem .75rem; text-align: center; color: var(--texto-tenue); font-size: .82rem; }

/* Gráfico de evolución semanal */
.grafico-envoltorio { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; margin-bottom: 1.5rem; }
.grafico-cabecera { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.grafico-cabecera h2 { font-size: 1rem; }
.grafico-barras { display: flex; align-items: flex-end; gap: 10px; height: 140px; }
.grafico-barra-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; height: 100%; justify-content: flex-end; }
.grafico-barra { width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; background: var(--cat-1); position: relative; }
.grafico-barra-valor { font-size: .7rem; color: var(--texto-secundario); font-weight: 700; }
.grafico-barra-eje { font-size: .68rem; color: var(--texto-tenue); }

/* Estado vacío / importación */
.estado-vacio {
  text-align: center; padding: 3rem 1.5rem; border: 1px dashed var(--borde); border-radius: var(--radio);
  background: var(--panel);
}
.estado-vacio h2 { font-size: 1.15rem; margin-bottom: .5rem; }
.estado-vacio p { color: var(--texto-secundario); max-width: 44ch; margin: 0 auto 1.25rem; }
.zona-importar {
  margin-top: 1.25rem; border: 2px dashed var(--borde); border-radius: var(--radio-chico);
  padding: 1.5rem; max-width: 420px; margin-inline: auto; transition: border-color .15s;
}
.zona-importar.arrastrando-sobre { border-color: var(--acento); background: var(--acento-suave); }
.acciones-vacio { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: .5rem; }

/* =============================================================
   8. Legales
   ============================================================= */
.contenido-legal { max-width: 720px; margin: 2rem auto 4rem; }
.contenido-legal h1 { margin-bottom: .5rem; }
.contenido-legal h2 { margin-top: 2rem; margin-bottom: .6rem; font-size: 1.15rem; }
.contenido-legal p, .contenido-legal li { color: var(--texto-secundario); margin-bottom: .75rem; }
.contenido-legal .fecha-actualizacion { color: var(--texto-tenue); font-size: .85rem; margin-bottom: 2rem; }

/* =============================================================
   9. Responsive
   ============================================================= */
@media (min-width: 720px) {
  .nav-principal { display: flex; }
  .beneficios { grid-template-columns: repeat(3, 1fr); }
  .stat-tiles { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 960px) {
  .hero { padding: 6rem 0 3rem; }
}

/* =============================================================
   10. Estado reducido de movimiento
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
