:root {
  --verde: #0b5d3b;
  --verde-claro: #e6f2ec;
  --rojo: #b3261e;
  --rojo-claro: #fbeaea;
  --texto: #1b1f1d;
  --sutil: #5d6661;
  --borde: #d8dedb;
  --fondo: #f6f8f7;
  --blanco: #ffffff;
  --radio: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texto); background: var(--fondo);
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--verde); }
h1 { font-size: 1.4rem; margin: .6rem 0; }
h2 { font-size: 1.15rem; margin: 1rem 0 .4rem; }
h1 small, h2 small { font-size: .8rem; font-weight: normal; color: var(--sutil); }
main { max-width: 760px; margin: 0 auto; padding: .75rem 1rem 6rem; }

.aviso-pruebas { background: #f2b705; color: #000; text-align: center; font-weight: bold; font-size: .8rem; padding: 2px; }
.cabecera {
  background: var(--verde); color: #fff; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: .4rem 1rem; padding: .6rem 1rem;
  padding-top: max(.6rem, env(safe-area-inset-top));
}
.cabecera a, .cabecera .enlace { color: #fff; text-decoration: none; }
.marca { font-weight: bold; font-size: 1.1rem; }
.marca span { font-weight: normal; opacity: .8; font-size: .9rem; }
.cabecera nav { display: flex; flex-wrap: wrap; gap: .2rem .9rem; align-items: center; font-size: .95rem; }
.en-linea { display: inline; margin: 0; }
.enlace { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

.sutil { color: var(--sutil); font-size: .9rem; }
.pos { color: var(--verde); }
.neg { color: var(--rojo); }
.flash { padding: .6rem .8rem; border-radius: var(--radio); background: var(--verde-claro); }
.flash.error { background: var(--rojo-claro); color: var(--rojo); }
.flash.info { background: #eef1f6; color: #263445; }
.error { color: var(--rojo); }

label { display: block; margin: .5rem 0; font-size: .95rem; }
input, select, button { font: inherit; }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=date], input:not([type]), select {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .6rem;
  border: 1px solid var(--borde); border-radius: 8px; background: var(--blanco);
}
label.check { display: flex; align-items: center; gap: .5rem; }
label.check input { width: auto; margin: 0; }
button {
  padding: .55rem 1rem; border: 1px solid var(--borde); border-radius: 8px; background: var(--blanco);
  cursor: pointer; min-height: 44px;
}
button.primario { background: var(--verde); border-color: var(--verde); color: #fff; }
button:disabled { opacity: .5; cursor: default; }
button.pequeno { min-height: 32px; padding: .2rem .6rem; font-size: .85rem; }
fieldset { border: 1px solid var(--borde); border-radius: 8px; }

.tarjeta { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: .8rem 1rem; margin: .8rem 0; }
.tarjeta.estrecha { max-width: 420px; }
.inactivo { opacity: .6; }
.tarjetas { list-style: none; padding: 0; display: grid; gap: .6rem; }
.tarjetas a { display: block; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: .8rem 1rem; text-decoration: none; color: var(--texto); }
.tarjetas span { display: block; color: var(--sutil); font-size: .9rem; }

.herramientas { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); padding: .8rem 1rem; margin: .6rem 0 1rem; }
.voz { width: 100%; font-size: 1.15rem; min-height: 56px; background: var(--verde); color: #fff; border: 0; }
.voz.escuchando { background: var(--rojo); animation: latido 1s infinite; }
@keyframes latido { 50% { opacity: .75; } }
.ayuda { margin: .4rem 0 .2rem; }
.resultados { display: grid; gap: .35rem; }
.candidato { text-align: left; width: 100%; }

.selector-periodo, .filtros { display: flex; flex-wrap: wrap; gap: .2rem 1rem; align-items: flex-end; }
.selector-periodo label, .filtros label { flex: 1 1 180px; }
.orden { font-size: .9rem; color: var(--sutil); }
.orden a.activo { font-weight: bold; text-decoration: none; color: var(--texto); }

.lista { list-style: none; padding: 0; margin: 0; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); }
.fila { display: flex; align-items: center; gap: .6rem; padding: .35rem .6rem .35rem .8rem; border-top: 1px solid var(--borde); min-height: 52px; }
.fila:first-child { border-top: 0; }
.fila .nombre { flex: 1; text-decoration: none; color: var(--texto); }
.total { font-weight: bold; min-width: 2.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.btn-puntuar { min-width: 48px; font-size: 1.2rem; font-weight: bold; }
.lista-simple { padding-left: 1.2rem; }
.lista-simple li { margin: .3rem 0; }
.gran-total { font-size: 1.2rem; }

.tabla { width: 100%; border-collapse: collapse; background: var(--blanco); font-size: .92rem; }
.tabla th, .tabla td { border-bottom: 1px solid var(--borde); padding: .4rem .45rem; text-align: left; vertical-align: top; }
.tabla tr.anulado td { text-decoration: line-through; color: var(--sutil); }
.tabla tr.anulado td:last-child { text-decoration: none; }
.tabla tr.anulacion td { color: var(--sutil); font-style: italic; }
.fila-campos { display: flex; gap: 1rem; }
.fila-campos label { flex: 1; }
.barra-fija { position: sticky; bottom: 0; background: var(--fondo); padding: .6rem 0; display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.barra-fija label { flex: 1 1 220px; margin: 0; }
details summary { cursor: pointer; color: var(--verde); }

/* Hoja para puntuar */
.hoja { border: 0; border-radius: 16px 16px 0 0; padding: 0; width: 100%; max-width: 560px; margin: auto auto 0; }
.hoja::backdrop { background: rgba(0, 0, 0, .45); }
.hoja-cuerpo { padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
.hoja h2 { margin: 0 0 .2rem; font-size: 1.25rem; }
.oido { font-style: italic; color: var(--sutil); margin: 0 0 .5rem; }
#hoja-candidatos { display: grid; gap: .4rem; }
.rapidos { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: .8rem 0 .3rem; }
.rapidos button { font-size: 1.25rem; font-weight: bold; min-height: 56px; }
.rapidos .pos { color: var(--verde); border-color: var(--verde); }
.rapidos .neg { color: var(--rojo); border-color: var(--rojo); }
.resumen { font-weight: bold; min-height: 1.4em; }
.acciones { display: flex; gap: .6rem; justify-content: flex-end; margin-top: .6rem; }
.acciones button { flex: 1; }

.aviso {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(1rem + env(safe-area-inset-bottom));
  background: #1f2a24; color: #fff; padding: .5rem .6rem .5rem 1rem; border-radius: 12px;
  display: flex; gap: .8rem; align-items: center; justify-content: space-between; width: calc(100% - 2rem); max-width: 520px; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.aviso[hidden] { display: none; }
.aviso button { background: transparent; color: #9fe3bf; border-color: #4b6b5a; }
.resumen-sinc li { margin: .25rem 0; }

@media (min-width: 700px) {
  .tarjetas { grid-template-columns: 1fr 1fr; }
  .hoja { border-radius: 16px; margin: auto; }
}
code { background: #e9eeeb; padding: .1rem .3rem; border-radius: 4px; font-size: .88em; word-break: break-all; }
textarea.codigo { width: 100%; font: 13px/1.4 ui-monospace, Menlo, Consolas, monospace; padding: .6rem; border: 1px solid var(--borde); border-radius: 8px; }
.orden-escrita { display: flex; gap: .5rem; align-items: flex-end; }
.orden-escrita label { flex: 1; margin: .4rem 0 0; }
.varias-fila { border: 1px solid var(--borde); border-radius: 10px; padding: .5rem .6rem; margin: .4rem 0; display: grid; grid-template-columns: 1fr 5.5rem auto; gap: .5rem; align-items: end; }
.varias-fila label { margin: 0; }
.varias-fila .aviso-fila { grid-column: 1 / -1; color: var(--rojo); font-size: .88rem; margin: 0; }
.varias-fila .quitar { min-height: 40px; padding: .3rem .6rem; }
.voz.grabando { background: var(--rojo); animation: latido 1s infinite; }
.pie { text-align: center; color: var(--sutil); font-size: .8rem; padding: 0 1rem 2rem; }
