:root {
  --acento: #f5a524; --acento-fuerte: #d98a00;
  --fondo: #f5f6f8; --panel: #ffffff; --texto: #1b1f27; --suave: #5d6573; --borde: #dfe3ea;
  --ok: #1f9d55; --mal: #d64545; --aviso-fondo: #fff6e5;
  --radio: 14px; --sombra: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  color-scheme: light;
}
:root[data-tema="oscuro"] {
  --fondo: #121419; --panel: #1b1e25; --texto: #e9ebef; --suave: #9aa3b2; --borde: #2c313b;
  --aviso-fondo: #2e2614; --sombra: none; color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--fondo); color: var(--texto); line-height: 1.45; }
a { color: inherit; }
.cabecera { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
            padding: .9rem 1.25rem; border-bottom: 1px solid var(--borde); background: var(--panel); }
.marca { font-weight: 800; font-size: 1.25rem; text-decoration: none; letter-spacing: -.01em; }
.marca span { color: var(--acento); }
.boton-tema { border: 1px solid var(--borde); background: transparent; color: var(--texto);
              border-radius: 999px; padding: .35rem .75rem; cursor: pointer; font-size: .9rem; }
main { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
h1 { font-size: 1.6rem; margin: .5rem 0 .25rem; letter-spacing: -.02em; }
.sub { color: var(--suave); margin: 0 0 1.25rem; }

/* Portada */
.rejilla { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tarjeta { display: block; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
           padding: 1.1rem 1.2rem; text-decoration: none; box-shadow: var(--sombra); transition: transform .12s, border-color .12s; }
a.tarjeta:hover, a.tarjeta:focus-visible { transform: translateY(-2px); border-color: var(--acento); outline: none; }
.tarjeta h2 { margin: .4rem 0 .3rem; font-size: 1.1rem; }
.tarjeta p { margin: 0; color: var(--suave); font-size: .92rem; }
.tarjeta .icono { font-size: 1.6rem; }
.tarjeta.pronto { opacity: .55; }
.etiqueta { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
            padding: .15rem .5rem; border-radius: 999px; background: var(--borde); color: var(--suave); }

/* Calculadora */
.calc { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .calc { grid-template-columns: 400px minmax(0, 1fr); align-items: start; }
  .resultado { position: sticky; top: 1rem; } }
.panel { background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.1rem 1.2rem; box-shadow: var(--sombra); }
fieldset { border: 0; padding: 0; margin: 0 0 1.1rem; }
legend { font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); margin-bottom: .5rem; }
label { display: block; font-size: .9rem; margin: .55rem 0 .25rem; }
input, select { width: 100%; font: inherit; color: var(--texto); background: var(--fondo); border: 1px solid var(--borde);
                border-radius: 10px; padding: .55rem .7rem; }
input:focus, select:focus { outline: 2px solid var(--acento); outline-offset: 1px; border-color: transparent; }
.fila { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.segmentos { display: flex; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; }
.segmentos label { flex: 1; margin: 0; text-align: center; cursor: pointer; }
.segmentos input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmentos span { display: block; padding: .5rem .4rem; font-size: .9rem; }
.segmentos input:checked + span { background: var(--acento); color: #1b1f27; font-weight: 700; }
.segmentos input:focus-visible + span { outline: 2px solid var(--acento-fuerte); outline-offset: -2px; }
.ayuda { font-size: .8rem; color: var(--suave); margin-top: .25rem; }
[hidden] { display: none !important; }

.destacado { display: flex; flex-wrap: wrap; gap: 1rem; align-items: baseline; }
.grande { font-size: 3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.grande small { font-size: 1.2rem; font-weight: 600; color: var(--suave); }
.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: 1rem 0; }
.dato { background: var(--fondo); border-radius: 10px; padding: .55rem .7rem; }
.dato b { display: block; font-size: 1.1rem; }
.dato span { font-size: .78rem; color: var(--suave); }
.criterio { font-weight: 600; }
.avisos p { background: var(--aviso-fondo); border-left: 4px solid var(--acento); padding: .55rem .75rem; border-radius: 8px; margin: .5rem 0; font-size: .9rem; }
.error { color: var(--mal); font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { padding: .45rem .5rem; text-align: right; border-bottom: 1px solid var(--borde); }
th:first-child, td:first-child { text-align: left; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); font-weight: 600; }
tr.elegida td { background: color-mix(in srgb, var(--acento) 18%, transparent); font-weight: 700; }
.si { color: var(--ok); } .no { color: var(--mal); }
.tabla-scroll { overflow-x: auto; }
.refs { font-size: .8rem; color: var(--suave); margin-top: 1rem; }
footer { text-align: center; font-size: .8rem; color: var(--suave); padding: 2rem 1rem; }

/* Resumen fijo abajo en móvil, para ver el resultado mientras se rellenan datos. */
.barra-movil { position: fixed; left: 0; right: 0; bottom: 0; padding: .7rem 1rem; background: var(--acento); color: #1b1f27;
               font-size: .95rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; box-shadow: 0 -4px 16px rgba(0,0,0,.15); }
.barra-movil a { margin-left: auto; font-weight: 700; }
#salida { scroll-margin-top: 1rem; }
@media (min-width: 900px) { .barra-movil { display: none; } }
@media (max-width: 899px) { body { padding-bottom: 3.5rem; } }
