/*
 * Registro Regional PCD – Huancavelica
 * Tipografía: Atkinson Hyperlegible (diseñada para personas con baja visión).
 * Colores de grado = colores del carné CONADIS: celeste (leve/moderado) y amarillo (severo).
 */
:root {
  --papel: #f5f7f6;
  --superficie: #ffffff;
  --tinta: #1d2b30;
  --tinta-suave: #4f6168;
  --linea: #d5dedd;
  --puna: #1f5c70;          /* color institucional del sistema */
  --puna-oscuro: #15424f;
  --celeste: #8ec3e0;       /* carné celeste */
  --celeste-tinte: #e3f1f9;
  --amarillo: #f2c230;      /* carné amarillo */
  --amarillo-tinte: #fdf3d2;
  --alerta: #a8322f;
  --ok: #2f6f45;

  --bs-body-font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  --bs-body-color: var(--tinta);
  --bs-body-bg: var(--papel);
  --bs-primary: var(--puna);
  --bs-primary-rgb: 31, 92, 112;
  --bs-link-color: var(--puna);
  --bs-link-color-rgb: 31, 92, 112;
  --bs-link-hover-color: var(--puna-oscuro);
  --bs-border-color: var(--linea);
  --bs-border-radius: .4rem;
  --bs-focus-ring-color: rgba(242, 194, 48, .7);
}

body { font-size: 1.0625rem; line-height: 1.55; }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.01em; color: var(--tinta); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }

/* Foco visible y grueso: muchos usuarios navegan con teclado */
:focus-visible { outline: 3px solid var(--amarillo) !important; outline-offset: 2px; box-shadow: none !important; }

.btn { font-weight: 700; padding: .55rem 1rem; }
.btn-primary { --bs-btn-bg: var(--puna); --bs-btn-border-color: var(--puna); --bs-btn-hover-bg: var(--puna-oscuro);
  --bs-btn-hover-border-color: var(--puna-oscuro); --bs-btn-active-bg: var(--puna-oscuro); }
.btn-outline-primary { --bs-btn-color: var(--puna); --bs-btn-border-color: var(--puna); --bs-btn-hover-bg: var(--puna);
  --bs-btn-hover-border-color: var(--puna); }
.form-label { font-weight: 700; margin-bottom: .3rem; }
.form-control, .form-select { padding: .55rem .75rem; border-color: #b9c7c6; }
.form-text { color: var(--tinta-suave); }
.table { --bs-table-bg: transparent; }
.table thead th { font-size: .9rem; color: var(--tinta-suave); border-bottom-width: 2px; white-space: nowrap; }
.text-suave { color: var(--tinta-suave) !important; }

/* ---------- Armazón del sistema interno ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.app-nav { background: var(--puna-oscuro); color: #fff; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.app-nav .marca { display: flex; gap: .65rem; align-items: center; color: #fff; text-decoration: none; margin-bottom: 1.5rem; }
.app-nav .marca strong { display: block; line-height: 1.15; }
.app-nav .marca small { color: #b8d4dc; font-size: .8rem; }
.sello { width: 2.4rem; height: 2.4rem; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--celeste) 0 66%, var(--amarillo) 66% 100%); color: var(--puna-oscuro); font-weight: 700; }
.app-nav .nav-link { color: #dbe9ed; border-radius: .35rem; padding: .55rem .7rem; display: flex; gap: .6rem; align-items: center; }
.app-nav .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav .nav-link.active { background: #fff; color: var(--puna-oscuro); font-weight: 700; }
.app-nav .grupo { color: #9fc0ca; font-size: .8rem; margin: 1.2rem .7rem .3rem; }
.app-nav .usuario { border-top: 1px solid rgba(255,255,255,.15); margin-top: 1.5rem; padding-top: 1rem; font-size: .9rem; color: #dbe9ed; }
.app-main { padding: 1.75rem 2rem 3rem; min-width: 0; }
.cabecera { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.cabecera p { margin: .25rem 0 0; color: var(--tinta-suave); }

.app-barra { display: none; }
@media (max-width: 991.98px) {
  .app { grid-template-columns: 1fr; }
  .app-nav { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 1050; transform: translateX(-100%); transition: transform .2s; }
  .app-nav.abierto { transform: none; }
  .app-barra { display: flex; align-items: center; justify-content: space-between; background: var(--puna-oscuro);
    color: #fff; padding: .6rem 1rem; position: sticky; top: 0; z-index: 1040; }
  .app-barra button { color: #fff; border: 0; background: none; font-size: 1.6rem; line-height: 1; }
  .app-main { padding: 1.25rem 1rem 3rem; }
}
@media (prefers-reduced-motion: reduce) { .app-nav { transition: none; } }

/* Bloques de contenido */
.panel { background: var(--superficie); border: 1px solid var(--linea); border-radius: .5rem; padding: 1.25rem; }
.panel + .panel { margin-top: 1rem; }
.panel-titulo { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .75rem; }
.panel-titulo h2 { margin: 0; }

/* Cifras del tablero: una sola fila, sin tarjetas repetidas */
.cifras { display: flex; flex-wrap: wrap; border: 1px solid var(--linea); border-radius: .5rem; background: var(--superficie); }
.cifra { flex: 1 1 160px; padding: 1rem 1.25rem; border-right: 1px solid var(--linea); }
.cifra:last-child { border-right: 0; }
.cifra .n { font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cifra .t { color: var(--tinta-suave); font-size: .95rem; }
.cifra.principal { background: var(--puna); color: #fff; border-radius: .5rem 0 0 .5rem; }
.cifra.principal .t { color: #cfe3ea; }
@media (max-width: 575.98px) { .cifra { border-right: 0; border-bottom: 1px solid var(--linea); } .cifra.principal { border-radius: .5rem .5rem 0 0; } }

/* Barras horizontales simples */
.barras { list-style: none; padding: 0; margin: 0; }
.barras li { display: grid; grid-template-columns: minmax(8rem, 40%) 1fr 3.5rem; gap: .6rem; align-items: center; padding: .3rem 0; }
.barras .riel { background: #e9efee; border-radius: 99px; height: .7rem; overflow: hidden; }
.barras .relleno { display: block; height: 100%; background: var(--puna); border-radius: 99px; }
.barras .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* Etiquetas de grado = colores del carné */
.grado { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.grado-LEVE, .grado-MODERADO { background: var(--celeste-tinte); color: #174a63; border: 1px solid var(--celeste); }
.grado-SEVERO { background: var(--amarillo-tinte); color: #6b4f00; border: 1px solid var(--amarillo); }
.estado { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.estado-PENDIENTE { color: #8a5a00; }
.estado-VERIFICADO { color: var(--ok); }
.estado-OBSERVADO { color: var(--alerta); }

/* Formulario por secciones (es un proceso, por eso van numeradas) */
.seccion { background: var(--superficie); border: 1px solid var(--linea); border-radius: .5rem; padding: 1.25rem 1.25rem .5rem; margin-bottom: 1rem; }
.seccion > legend { float: none; width: auto; font-size: 1.1rem; font-weight: 700; display: flex; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.seccion > legend .paso { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--puna); color: #fff; display: grid; place-items: center; font-size: .95rem; }
.opciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.opcion { position: relative; }
.opcion input { position: absolute; opacity: 0; }
.opcion label { display: block; padding: .5rem .85rem; border: 1px solid #b9c7c6; border-radius: .4rem; cursor: pointer; background: #fff; }
.opcion input:checked + label { background: var(--puna); border-color: var(--puna); color: #fff; }
.opcion input:focus-visible + label { outline: 3px solid var(--amarillo); outline-offset: 2px; }
.opcion.severo input:checked + label { background: var(--amarillo); border-color: #c99a00; color: var(--tinta); }
.opcion.celeste input:checked + label { background: var(--celeste); border-color: #5f9fc2; color: var(--tinta); }
.aviso-dni { font-size: .95rem; margin-top: .35rem; }

/* Mapas */
.mapa { height: 420px; border-radius: .5rem; border: 1px solid var(--linea); z-index: 0; }
.mapa-grande { height: calc(100vh - 230px); min-height: 460px; }
.leyenda { background: #fff; padding: .5rem .7rem; border-radius: .4rem; border: 1px solid var(--linea); font-size: .85rem; line-height: 1.6; }
.leyenda i { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }
.punto-ubicacion { font-size: .9rem; color: var(--tinta-suave); }

.vivo { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--tinta-suave); }
.vivo::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--ok); }
@media (prefers-reduced-motion: no-preference) {
  .vivo.cargando::before { animation: latido 1s ease-in-out infinite; }
  @keyframes latido { 50% { opacity: .25; } }
}

dl.ficha { display: grid; grid-template-columns: minmax(9rem, 30%) 1fr; gap: .45rem 1rem; margin: 0; }
dl.ficha dt { color: var(--tinta-suave); font-weight: 400; }
dl.ficha dd { margin: 0; font-weight: 700; }

.filtros { background: var(--superficie); border: 1px solid var(--linea); border-radius: .5rem; padding: 1rem; margin-bottom: 1rem; }
.filtros .form-label { font-size: .9rem; }

/* ---------- Portal público ---------- */
.publico-cab { background: var(--puna-oscuro); color: #fff; }
.publico-cab .contenedor { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; }
.publico-cab a { color: #fff; }
.contenedor { max-width: 1180px; margin: 0 auto; }
.portada { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 2rem; padding: 2.5rem 1rem 2rem; align-items: start; }
.portada h1 { font-size: 2.3rem; line-height: 1.15; max-width: 16ch; }
.portada .total { font-size: 4.5rem; font-weight: 700; color: var(--puna); line-height: 1; font-variant-numeric: tabular-nums; }
.portada .mapa { height: 520px; }
@media (max-width: 991.98px) { .portada { grid-template-columns: 1fr; } .portada .mapa { height: 400px; } .portada h1 { font-size: 1.9rem; } }
.bloque-publico { padding: 1rem 1rem 2rem; }
.nota-privacidad { border-left: 4px solid var(--amarillo); background: #fff; padding: .75rem 1rem; font-size: .95rem; }
.pie { border-top: 1px solid var(--linea); padding: 1.5rem 1rem; color: var(--tinta-suave); font-size: .95rem; }

/* ---------- Acceso ---------- */
.acceso { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(320px, 440px); }
.acceso-lado { background: var(--puna-oscuro); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.acceso-lado h1 { color: #fff; font-size: 2.2rem; max-width: 15ch; }
.acceso-lado p { color: #cfe3ea; max-width: 46ch; }
.acceso-form { padding: 3rem 2rem; display: flex; flex-direction: column; justify-content: center; background: var(--superficie); }
@media (max-width: 767.98px) { .acceso { grid-template-columns: 1fr; } .acceso-lado { padding: 2rem 1.25rem; } .acceso-form { padding: 2rem 1.25rem; } }

.pagination { --bs-pagination-color: var(--puna); --bs-pagination-active-bg: var(--puna); --bs-pagination-active-border-color: var(--puna); }
