/* SGC EVEX · valores observados en https://www.sgcevex.es/metodologia. */
:root {
  --bg: oklch(0.985 0.003 250);
  --surface: #fff;
  --fg: oklch(0.24 0.012 255);
  --muted: oklch(0.3 0.008 255);
  --line: oklch(0.89 0.008 250);
  --navy: oklch(0.27 0.07 258);
  --on-navy: oklch(0.95 0.008 250);
  --accent: oklch(0.68 0.15 155);
  --on-accent: oklch(0.2 0.04 160);
  --font-body: 'IBM Plex Sans', system-ui, sans-serif;
  --font-display: Archivo, 'IBM Plex Sans', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1rem/1.5 var(--font-body); }
h1, h2, h3 { color: var(--navy); font-family: var(--font-display); line-height: 1.2; }
.masthead { padding: .7rem clamp(1rem, 4vw, 4rem); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--navy); font-weight: 700; }
.brand img { object-fit: contain; }
.brand small { display: block; color: var(--muted); font-weight: 400; }
main { padding: 2rem clamp(1rem, 4vw, 4rem); }

h1, h2, h3, p { margin-top: 0; }
.page-head, .dialog-head, .form-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.page-head h1, .dialog-head h2 { margin: 0; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { color: var(--fg); border: 1px solid var(--line); border-radius: .45rem; background: var(--surface); padding: .55rem .75rem; }
button { cursor: pointer; font-weight: 600; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.primario { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .7rem; overflow: hidden; }
.filtros { display: flex; gap: .85rem; padding: 1rem; flex-wrap: wrap; align-items: end; }
label { display: grid; gap: .35rem; font-weight: 600; }
.check { display: flex; align-items: center; min-height: 2.6rem; }
.recuento, .vacio { padding: 0 1rem; color: var(--muted); }
.tabla-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
td, th { padding: .7rem 1rem; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--navy); background: var(--bg); white-space: nowrap; }
td small { display: block; color: var(--muted); }
.texto-boton { background: none; border: 0; padding: 0; color: var(--navy); text-align: left; text-decoration: underline; text-underline-offset: .18em; }
dialog { width: min(42rem, 96vw); max-height: 94vh; margin: auto 0 auto auto; border: 1px solid var(--line); border-radius: .7rem 0 0 .7rem; padding: 1.3rem; color: var(--fg); }
dialog::backdrop { background: oklch(.2 .04 258 / .48); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; margin-top: 1rem; }
.ancho { grid-column: 1 / -1; }
.error { color: #a62625; }
#estado { margin: .7rem 0; }
#ficha-error:empty { display: none; }
[hidden] { display: none !important; }
@media (max-width: 540px) { .form-grid { grid-template-columns: 1fr; } }

.ficha-seccion { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1.2rem; }
.subir-form { display: flex; align-items: end; flex-wrap: wrap; gap: .7rem; margin: .75rem 0; }
.subir-form input { max-width: 100%; }
#archivos-lista { overflow-wrap: anywhere; }
#archivos-lista a { color: var(--navy); }

.masthead { display: flex; align-items: center; gap: 1rem 2rem; flex-wrap: wrap; }
.masthead nav { display: flex; flex-wrap: wrap; gap: .3rem; }
nav button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.tablero { display: grid; grid-template-columns: repeat(7, minmax(15.5rem, 1fr)); gap: .8rem; overflow-x: auto; padding: .2rem .25rem 1rem; }
.columna { border: 1px solid var(--line); background: oklch(.95 .012 250); padding: .8rem; border-radius: .65rem; min-height: 14rem; }
.columna h2 { font-size: 1rem; margin: 0; }
.columna > p { color: var(--muted); margin: .3rem 0 .8rem; }
.columna.destino { outline: 2px solid var(--accent); outline-offset: -2px; }
.tarjeta { border: 1px solid var(--line); border-radius: .5rem; padding: .8rem; background: var(--surface); margin-bottom: .5rem; cursor: grab; overflow-wrap: anywhere; }
.tarjeta p { margin: .3rem 0; }
.tarjeta select { width: 100%; }
.tarjeta.arrastrando { opacity: .45; }
#historial-lista { padding-left: 1.4rem; }
#historial-lista time { color: var(--muted); }

.page-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.boton { display: inline-block; border: 1px solid var(--line); border-radius: .45rem; background: var(--surface); padding: .55rem .75rem; text-decoration: none; color: var(--navy); font-weight: 600; }

.seg-grupo { padding: 1rem; margin-bottom: .8rem; }
.seg-grupo h2, .resumen-grupo h2 { font-size: 1.1rem; }
.seg-grupo ul { list-style: none; margin: 0; padding: 0; }
.seg-grupo li { display: flex; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding: .65rem 0; gap: .6rem 1rem; }
.seg-grupo li > div { flex: 1 1 12rem; }
.seg-vencido time { color: #a62625; font-weight: 700; }
.resumen-alerta { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: 1rem; }
.indicadores, .desgloses { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .8rem; }
.indicador, .resumen-grupo { padding: 1rem; }
.indicador dd { margin: .35rem 0 0; font: 700 1.55rem var(--font-display); color: var(--navy); }
.desgloses { grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.barra-fila { display: grid; grid-template-columns: 1fr auto; gap: .25rem .6rem; margin: .7rem 0; }
.barra-fila progress { grid-column: 1 / -1; grid-row: 2; width: 100%; accent-color: var(--accent); }

.masthead { position: sticky; top: 0; z-index: 1; box-shadow: 0 3px 18px oklch(.27 .07 258 / .07); }
.brand > span { font-family: var(--font-display); }
.brand small { font-family: var(--font-body); }
.buscador { margin-left: auto; font-size: .875rem; }
.buscador input { width: clamp(13rem, 20vw, 23rem); }
main { max-width: 105rem; margin-inline: auto; }
.page-head { background: var(--navy); padding: clamp(1rem, 3vw, 2rem); border-radius: .85rem; margin-bottom: .85rem; }
.page-head h1 { color: var(--on-navy); font-size: clamp(1.65rem, 3vw, 2.5rem); }
.panel { box-shadow: 0 4px 14px oklch(.27 .07 258 / .055); }
#estado:empty { display: none; }
#estado { overflow-wrap: anywhere; }
#archivar { color: var(--muted); }
button:hover:not(:disabled), .boton:hover { filter: brightness(.96); }
@media (max-width: 860px) {
  .masthead { position: static; gap: .65rem 1rem; }
  .buscador { margin-left: 0; flex: 1 0 100%; }
  .buscador input { width: 100%; }
}
@media (max-width: 675px) {
  .page-head { align-items: start; flex-direction: column; }
  .masthead nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .masthead nav button, .form-actions button, .page-actions button, .page-actions .boton { min-height: 44px; }
  .filtros { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .filtros select, dialog input, dialog select, dialog textarea { min-width: 0; width: 100%; }
  .form-actions { flex-wrap: wrap; }
}
@media (max-width: 540px) {
  main { padding-block: 1rem; }
  dialog { width: 100%; max-width: none; max-height: 100dvh; margin: auto 0 0; border-radius: .7rem .7rem 0 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

.pantalla-acceso { max-width: 38rem; padding-top: clamp(2rem, 11vh, 6rem); }
.acceso { padding: clamp(1.2rem, 4vw, 2rem); }
.acceso form { display: grid; gap: 1rem; }
.acceso button { justify-self: start; }
.aviso-ensayo { margin: 0; padding: .65rem 1rem; background: var(--surface); color: var(--text); text-align: center; }
#acceso-error { margin: .8rem 0 0; }
#acceso-error:empty { display: none; }
