:root {
  --tinta: #12263f;
  --tinta-2: #3d5068;
  --celda: #1f4e8c;
  --celda-clara: #dbe6f5;
  --sol: #e0a100;
  --papel: #f4f6f9;
  --hoja: #ffffff;
  --linea: #cfd8e3;
  --ok: #1d7a4f;
  --alerta: #a35a00;
  --error: #b3261e;
  --radio: 6px;
  --fuente: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: var(--fuente); color: var(--tinta); background: var(--papel); line-height: 1.5; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.02rem; }
p { margin: 0 0 .8rem; max-width: 70ch; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sol); outline-offset: 2px; }
.oculto { display: none !important; }
.muted { color: var(--tinta-2); font-size: .9rem; }
.num { font-variant-numeric: tabular-nums; }

/* ---- acceso ---- */
.acceso { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.acceso-marca { background: var(--tinta); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.acceso-marca h1 { font-size: 2.3rem; max-width: 16ch; }
.acceso-marca p { color: #b9c7da; max-width: 42ch; }
.acceso-marca .aviso-sitio { margin-top: 1rem; padding: .6rem .8rem; border-left: 4px solid var(--sol); background: rgba(255,255,255,.08); color: #fff; }
.acceso-marca svg { width: 100%; max-width: 360px; margin-top: 1.5rem; }
.acceso-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.acceso-form form { width: 100%; max-width: 380px; }
@media (max-width: 800px) { .acceso { grid-template-columns: 1fr; } .acceso-marca { padding: 1.5rem; } .acceso-marca h1 { font-size: 1.6rem; } .acceso-marca svg { display: none; } }

/* ---- estructura ---- */
.barra { background: var(--tinta); color: #fff; display: flex; align-items: center; gap: 1rem; padding: .6rem 1.2rem; }
.barra .marca { font-weight: 700; letter-spacing: .01em; }
.barra .marca span { color: var(--sol); }
.barra .espacio { flex: 1; }
.barra .usuario { font-size: .9rem; color: #c8d4e4; }
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 1.2rem; max-width: 1280px; margin: 0 auto; padding: 1.2rem; }
.riel { position: sticky; top: 1rem; align-self: start; display: flex; flex-direction: column; gap: .25rem; }
.riel button { text-align: left; background: transparent; border: 0; border-left: 4px solid transparent; padding: .6rem .8rem; border-radius: 0 var(--radio) var(--radio) 0; cursor: pointer; color: var(--tinta-2); }
.riel button:hover { background: var(--celda-clara); }
.riel button[aria-current="true"] { border-left-color: var(--sol); background: var(--hoja); color: var(--tinta); font-weight: 600; box-shadow: 0 1px 0 var(--linea); }
.resumen-vivo { margin-top: 1rem; padding: .8rem; background: var(--hoja); border: 1px solid var(--linea); border-radius: var(--radio); font-size: .88rem; }
.resumen-vivo dt { color: var(--tinta-2); } .resumen-vivo dd { margin: 0 0 .4rem; font-weight: 600; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; padding: .8rem; }
  .riel { position: static; flex-direction: row; overflow-x: auto; }
  .riel button { border-left: 0; border-bottom: 4px solid transparent; border-radius: var(--radio) var(--radio) 0 0; white-space: nowrap; }
  .riel button[aria-current="true"] { border-bottom-color: var(--sol); }
  .resumen-vivo { display: none; }
}

.hoja { background: var(--hoja); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.2rem; margin-bottom: 1rem; }
.hoja > h2 { padding-bottom: .5rem; border-bottom: 2px solid var(--celda-clara); }

/* ---- formularios ---- */
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem 1.1rem; }
.campo { display: flex; flex-direction: column; gap: .25rem; }
.campo label, .campo .etq { font-size: .88rem; font-weight: 600; }
.campo small { color: var(--tinta-2); }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%; padding: .5rem .6rem; border: 1px solid #98a8bb; border-radius: var(--radio); background: #fff; min-height: 2.4rem; }
input:disabled, select:disabled { background: #eef1f5; color: #7a889a; }
.opciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.opcion { position: relative; }
.opcion input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.opcion span { display: block; padding: .5rem .9rem; border: 1px solid #98a8bb; border-radius: var(--radio); background: #fff; }
.opcion input:checked + span { background: var(--celda); border-color: var(--celda); color: #fff; font-weight: 600; }
.opcion input:focus-visible + span { outline: 3px solid var(--sol); outline-offset: 2px; }
.chk { display: flex; align-items: center; gap: .5rem; }
.chk input { width: 1.1rem; height: 1.1rem; }

.btn { display: inline-block; padding: .55rem 1.1rem; border-radius: var(--radio); border: 1px solid var(--celda); background: var(--celda); color: #fff; cursor: pointer; font-weight: 600; }
.btn:hover { background: #17407a; }
.btn.sec { background: #fff; color: var(--celda); }
.btn.sec:hover { background: var(--celda-clara); }
.btn.peligro { background: #fff; color: var(--error); border-color: var(--error); }
.btn.peligro:hover { background: #fbe9e7; }
.btn.chico { padding: .3rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: wait; }
.acciones { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; align-items: center; }

.aviso { padding: .7rem .9rem; border-radius: var(--radio); border: 1px solid; margin-bottom: .8rem; font-size: .93rem; }
.aviso.error { background: #fdecea; border-color: #e5a29c; color: #7a1a14; }
.aviso.alerta { background: #fff4de; border-color: #e6c27a; color: #5f3b00; }
.aviso.ok { background: #e3f4ea; border-color: #9ed1b5; color: #14532f; }
.aviso.info { background: var(--celda-clara); border-color: #a9bedd; color: var(--tinta); }

/* ---- tablas ---- */
.tabla-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .4rem .5rem; border-bottom: 1px solid var(--linea); text-align: left; vertical-align: middle; }
th { font-size: .82rem; color: var(--tinta-2); font-weight: 600; background: #f0f3f7; }
td.der, th.der { text-align: right; }
table input { min-height: 2rem; padding: .25rem .4rem; }
table input[type=number] { width: 5.6rem; }
table input.ancho { width: 100%; min-width: 11rem; }

/* ---- resultados ---- */
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--linea); border-radius: var(--radio); background: var(--hoja); margin-bottom: 1rem; }
.cifra { padding: .9rem 1rem; border-right: 1px solid var(--linea); }
.cifra:last-child { border-right: 0; }
.cifra b { display: block; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cifra.principal b { color: var(--celda); }
.cifra span { font-size: .82rem; color: var(--tinta-2); }
.dos { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
dl.datos { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; font-size: .93rem; }
dl.datos dt { color: var(--tinta-2); } dl.datos dd { margin: 0; font-variant-numeric: tabular-nums; }
.esquema { width: 100%; max-height: 420px; background: #f8fafc; border: 1px solid var(--linea); border-radius: var(--radio); }
.esquema .mod { stroke: #0b1f3a; stroke-width: .8; }
.esquema .s0 { fill: #1f4e8c; } .esquema .s1 { fill: #2f7fb3; } .esquema .s2 { fill: #3c9a8a; }
.esquema .s3 { fill: #6a6fb0; } .esquema .s4 { fill: #8a5a9e; } .esquema .s5 { fill: #4a6a86; }
.esquema text { font-size: 11px; fill: var(--tinta-2); font-family: var(--fuente); }
.leyenda { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .5rem; font-size: .85rem; }
.leyenda i { display: inline-block; width: .8rem; height: .8rem; margin-right: .3rem; vertical-align: -1px; border-radius: 2px; }
.etiqueta { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--celda-clara); }
.etiqueta.si { background: #dcefe4; color: var(--ok); } .etiqueta.no { background: #eceff3; color: #5d6b7c; }
ul.limpia { margin: 0; padding-left: 1.1rem; } ul.limpia li { margin-bottom: .35rem; }
.norma { padding: .6rem 0; border-bottom: 1px solid var(--linea); }
.norma:last-child { border-bottom: 0; }
.norma b { display: block; }
details summary { cursor: pointer; font-weight: 600; }

.tarjeta-proy { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; padding: .8rem 0; border-bottom: 1px solid var(--linea); align-items: center; }
.tarjeta-proy:last-child { border-bottom: 0; }
.tarjeta-proy h3 { margin: 0; }
.vacio { padding: 1.5rem; text-align: center; color: var(--tinta-2); border: 1px dashed #98a8bb; border-radius: var(--radio); }

@media print {
  body { background: #fff; }
  .barra, .riel, .acciones, .btn, .resumen-vivo { display: none !important; }
  .layout { display: block; padding: 0; }
  .hoja { break-inside: avoid; border-color: #999; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .riel button, .opcion span { transition: background-color .15s, color .15s; }
}
