/* SAMAZAC Digital — sistema de diseño base.
   Paleta del escudo: azul San Marcos, azul acero, plata, cal (fondo), oro antorcha y café águila (solo archivo).
   Tipografías: Source Serif 4 (títulos y documentos) y Public Sans (aplicación, cifras tabulares). */

@font-face {
  font-family: 'Public Sans';
  src: url('../fuentes/public-sans.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fuentes/source-serif-4.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fuentes/source-serif-4-italica.woff2') format('woff2');
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  /* Marca */
  --azul-950: #071F2C;
  --azul-900: #0B3145;
  --azul-800: #12405A;
  --azul-700: #176183;
  --azul-600: #1E719A;
  --azul-500: #3A8BB3;
  --azul-200: #BFD6E4;
  --azul-100: #E2EDF4;
  --azul-50: #F0F6FA;
  --plata: #C9D5E2;
  --plata-claro: #E7EDF3;
  --cal: #F3F6F9;
  --blanco: #FFFFFF;
  --oro: #D9A12B;
  --oro-hover: #C88F1C;
  --oro-texto: #8A5E0A;
  --oro-claro: #FBF1DC;
  --cafe: #6E3B2B;
  --cafe-claro: #F4EAE5;

  /* Texto y líneas */
  --tinta: #0E2533;
  --tinta-2: #3E5566;
  --tinta-3: #5D7283;
  --linea: #D9E2EA;
  --linea-fuerte: #B9C7D4;

  /* Semáforo académico */
  --verde: #2E7D4F;  --verde-fondo: #E3F1E8;  --verde-texto: #1F5C3A;
  --ambar: #C98A0B;  --ambar-fondo: #FBF0D9;  --ambar-texto: #7A5206;
  --rojo: #B23A3A;   --rojo-fondo: #F8E3E1;   --rojo-texto: #8E2B2B;
  --gris: #4A4F57;   --gris-fondo: #E6E8EB;   --gris-texto: #3A3F47;

  /* Tipografía */
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Forma */
  --radio: 10px;
  --radio-g: 16px;
  --sombra: 0 1px 2px rgba(11, 49, 69, .06), 0 2px 8px rgba(11, 49, 69, .05);
  --sombra-alta: 0 10px 30px rgba(7, 31, 44, .18), 0 2px 6px rgba(7, 31, 44, .08);
  --enfoque: 0 0 0 3px rgba(30, 113, 154, .35);

  /* Medidas del marco */
  --barra-alto: 56px;
  --nav-alto: 64px;
  --lateral-ancho: 268px;
  --contenido-max: 1180px;
  --seg-arriba: env(safe-area-inset-top, 0px);
  --seg-abajo: env(safe-area-inset-bottom, 0px);
  --seg-izq: env(safe-area-inset-left, 0px);
  --seg-der: env(safe-area-inset-right, 0px);
}

/* ---------- Reinicio ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--tinta);
  background: var(--cal);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}
img, svg { display: block; max-width: 100%; }
svg.i { display: inline-block; flex: none; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--azul-700); text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
table { border-collapse: collapse; }
:focus-visible { outline: none; box-shadow: var(--enfoque); border-radius: 6px; }
::selection { background: var(--azul-200); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Utilidades ---------- */
.serif { font-family: var(--serif); }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--tinta-3); }
.suave { color: var(--tinta-2); }
.peq { font-size: 14px; }
.mini { font-size: 12.5px; }
.fuerte { font-weight: 650; }
.oro-texto { color: var(--oro-texto); }
.al-der { text-align: right; }
.al-centro { text-align: center; }
.pila { display: flex; flex-direction: column; gap: 16px; }
.pila-chica { display: flex; flex-direction: column; gap: 8px; }
.pila-grande { display: flex; flex-direction: column; gap: 28px; }
.fila { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fila-nw { display: flex; align-items: center; gap: 10px; min-width: 0; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.crece { flex: 1 1 auto; min-width: 0; }
.rejilla { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.rejilla-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rejilla-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rejilla-4 { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rejilla-datos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
@media (max-width: 899px) {
  .rejilla-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rejilla-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 599px) {
  .rejilla-2, .rejilla-3 { grid-template-columns: minmax(0, 1fr); }
  .solo-escritorio { display: none !important; }
}
@media (min-width: 600px) { .solo-movil { display: none !important; } }
.truncar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.separador { height: 1px; background: var(--linea); border: 0; margin: 4px 0; }

/* ---------- Tipografía de pantalla ---------- */
.titulo-1 { font-family: var(--serif); font-weight: 650; font-size: clamp(26px, 4.6vw, 34px); letter-spacing: -.01em; color: var(--azul-900); }
.titulo-2 { font-family: var(--serif); font-weight: 650; font-size: 22px; color: var(--azul-900); }
.titulo-3 { font-family: var(--sans); font-weight: 650; font-size: 17px; color: var(--tinta); }
.entradilla { font-size: 17px; color: var(--tinta-2); max-width: 62ch; }
.etiqueta { font-size: 13px; font-weight: 600; color: var(--tinta-3); letter-spacing: .01em; }
.cifra { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.01em; }

/* ---------- Marco de la app (con sesión) ---------- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}
.barra {
  position: sticky;
  top: 0;
  z-index: 30;
  height: calc(var(--barra-alto) + var(--seg-arriba));
  padding: var(--seg-arriba) calc(12px + var(--seg-der)) 0 calc(12px + var(--seg-izq));
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--azul-900);
  color: #fff;
}
.barra-marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.barra-marca img { width: 30px; height: auto; }
.barra-marca-texto { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.barra-marca-texto b { font-family: var(--serif); font-weight: 650; font-size: 17px; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 430px) { .barra-btn.solo-amplio { display: none; } .chip-perfil-texto span { display: none; } }
.barra-marca-texto span { font-size: 11.5px; color: var(--plata); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-espacio { flex: 1 1 auto; }
.barra-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 10px;
  border: 0; border-radius: 999px;
  background: transparent; color: #fff;
}
.barra-btn:hover { background: rgba(255, 255, 255, .08); }
.barra-btn .globo {
  position: absolute; top: 3px; right: 3px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--oro); color: var(--azul-950);
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--azul-900);
}
.chip-perfil {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 6px 0 4px;
  border: 1px solid rgba(201, 213, 226, .35); border-radius: 999px;
  background: rgba(255, 255, 255, .06); color: #fff;
  max-width: 46vw;
}
.chip-perfil:hover { background: rgba(255, 255, 255, .12); }
.chip-perfil .avatar { width: 28px; height: 28px; font-size: 12px; }
.chip-perfil-texto { display: flex; flex-direction: column; line-height: 1.1; text-align: left; min-width: 0; }
.chip-perfil-texto b { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-perfil-texto span { font-size: 11px; color: var(--plata); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.contenido {
  min-width: 0;
  padding: 20px calc(16px + var(--seg-der)) calc(var(--nav-alto) + var(--seg-abajo) + 28px) calc(16px + var(--seg-izq));
}
.contenido > * { max-width: var(--contenido-max); margin-left: auto; margin-right: auto; }

/* Navegación inferior (celular) */
.nav-inferior {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  height: calc(var(--nav-alto) + var(--seg-abajo));
  padding: 0 var(--seg-der) var(--seg-abajo) var(--seg-izq);
  background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--linea);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
}
.nav-item {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none;
  color: var(--tinta-3);
  font-size: 11.5px; font-weight: 600;
  text-decoration: none;
  padding: 6px 2px 4px;
}
.nav-item .i { width: 24px; height: 24px; }
.nav-item[aria-current='page'] { color: var(--azul-700); }
.nav-item[aria-current='page']::before {
  content: '';
  position: absolute; top: 0; left: 50%;
  width: 32px; height: 3px; margin-left: -16px;
  border-radius: 0 0 3px 3px;
  background: var(--oro);
}
.nav-item .globo {
  position: absolute; top: 5px; left: calc(50% + 6px);
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--rojo); color: #fff;
  font-size: 10.5px; font-weight: 800; line-height: 17px; text-align: center;
}
.nav-texto { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Barra lateral (computadora) */
.lateral { display: none; }
@media (min-width: 1024px) {
  .app {
    grid-template-columns: var(--lateral-ancho) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: 'lateral barra' 'lateral contenido';
  }
  .lateral {
    grid-area: lateral;
    position: sticky; top: 0;
    height: 100vh; height: 100dvh;
    display: flex; flex-direction: column;
    background: var(--azul-900);
    color: var(--plata);
    overflow-y: auto;
    padding: 18px 14px 14px;
  }
  .barra { grid-area: barra; background: var(--blanco); color: var(--tinta); border-bottom: 1px solid var(--linea); }
  .barra .barra-marca { display: none; }
  .barra-btn { color: var(--tinta-2); }
  .barra-btn:hover { background: var(--cal); }
  .barra-btn .globo { box-shadow: 0 0 0 2px var(--blanco); }
  .chip-perfil { border-color: var(--linea); background: var(--blanco); color: var(--tinta); max-width: 340px; }
  .chip-perfil:hover { background: var(--cal); }
  .chip-perfil-texto span { color: var(--tinta-3); }
  .contenido { grid-area: contenido; padding: 28px 36px 56px; }
  .nav-inferior { display: none; }
}
.lateral-marca { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; text-decoration: none; color: #fff; }
.lateral-marca img { width: 44px; height: auto; }
.lateral-marca b { display: block; font-family: var(--serif); font-size: 20px; font-weight: 650; letter-spacing: .01em; }
.lateral-marca span { display: block; font-size: 12px; color: var(--plata); line-height: 1.3; }
.lateral-rol {
  margin: 0 4px 14px; padding: 10px 12px;
  border-radius: var(--radio);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(201, 213, 226, .18);
}
.lateral-rol .etiqueta { color: var(--plata); font-weight: 500; font-size: 12px; }
.lateral-rol b { display: block; color: #fff; font-size: 14.5px; font-weight: 650; }
.lateral-grupo { margin: 14px 10px 6px; font-size: 12px; font-weight: 600; color: #8FA9BC; letter-spacing: .02em; }
.lateral-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 0 12px; margin: 1px 0;
  border-radius: 10px;
  color: #D3DEE8; text-decoration: none; font-size: 15px; font-weight: 500;
}
.lateral-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.lateral-item[aria-current='page'] { background: rgba(255, 255, 255, .11); color: #fff; font-weight: 650; }
.lateral-item[aria-current='page']::before {
  content: ''; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--oro);
}
.lateral-item .globo {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px;
  border-radius: 999px; background: var(--oro); color: var(--azul-950);
  font-size: 12px; font-weight: 800; line-height: 22px; text-align: center;
}
.lateral-pie { margin-top: auto; padding: 14px 8px 4px; font-size: 12px; color: #8FA9BC; line-height: 1.4; }
.lateral-pie a { color: var(--plata); }

/* ---------- Encabezado de pantalla ---------- */
.pantalla { display: flex; flex-direction: column; gap: 22px; }
.pantalla-cabeza { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.pantalla-cabeza-texto { min-width: 0; flex: 1 1 320px; }
.pantalla-cabeza .migas {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 0 0 6px -6px; padding: 4px 8px 4px 2px;
  border: 0; border-radius: 8px; background: none;
  color: var(--azul-700); font-size: 15px; font-weight: 600; text-decoration: none;
}
.pantalla-cabeza .migas:hover { background: var(--azul-100); }
.pantalla-sobre { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 600; color: var(--oro-texto); }
.pantalla-titulo { font-family: var(--serif); font-weight: 650; font-size: clamp(26px, 5vw, 32px); line-height: 1.15; letter-spacing: -.01em; color: var(--azul-900); }
.pantalla-subtitulo { margin-top: 6px; color: var(--tinta-2); font-size: 16px; max-width: 70ch; }
.pantalla-acciones { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Tarjetas ---------- */
.tarjeta {
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: var(--radio-g);
  padding: 18px;
  min-width: 0;
}
.tarjeta-cabeza { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tarjeta-titulo { font-size: 17px; font-weight: 650; color: var(--tinta); display: flex; align-items: center; gap: 8px; }
.tarjeta-titulo .i { color: var(--azul-700); }
.tarjeta-sub { font-size: 14px; color: var(--tinta-3); margin-top: 2px; }
.tarjeta-pie { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--linea); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.tarjeta-plana { background: var(--plata-claro); border-color: transparent; }
.tarjeta-azul { background: var(--azul-900); border-color: var(--azul-900); color: #fff; }
.tarjeta-azul .tarjeta-titulo, .tarjeta-azul .tarjeta-titulo .i { color: #fff; }
.tarjeta-azul .tarjeta-sub, .tarjeta-azul .muted { color: var(--plata); }
.tarjeta-oro { background: var(--oro-claro); border-color: #EFD9A8; }
.tarjeta-cafe { background: var(--cafe-claro); border-color: #E3CFC6; }
.tarjeta-arco { border-radius: 120px 120px var(--radio-g) var(--radio-g); padding-top: 34px; }
.tarjeta-boton { display: block; width: 100%; text-align: left; text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s, background .15s; }
.tarjeta-boton:hover { border-color: var(--azul-200); background: var(--azul-50); }
.tarjeta-acento { box-shadow: inset 0 3px 0 var(--oro); }
.tarjeta-sin-borde { border: 0; }

/* Datos / indicadores */
.dato {
  position: relative;
  background: var(--blanco);
  border: 1px solid var(--linea);
  border-radius: 14px;
  padding: 14px 16px 13px;
  min-width: 0;
}
.dato-etiqueta { font-size: 13.5px; color: var(--tinta-3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dato-valor { margin-top: 6px; font-size: 28px; line-height: 1.05; font-weight: 750; color: var(--azul-900); letter-spacing: -.02em; }
.dato-valor small { font-size: 15px; font-weight: 600; color: var(--tinta-3); letter-spacing: 0; }
.dato-detalle { margin-top: 6px; font-size: 13.5px; color: var(--tinta-2); }
.dato-alerta { border-color: #EDC3BF; background: #FFF9F8; }
.dato-alerta .dato-valor { color: var(--rojo); }
.dato-oro { border-color: #EFD9A8; background: var(--oro-claro); }
.dato-oro .dato-valor { color: var(--oro-texto); }
.dato-boton { cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit; transition: border-color .15s, background .15s; }
.dato-boton:hover { border-color: var(--azul-200); background: var(--azul-50); }
.dato-boton.dato-alerta:hover { background: #FDF0EE; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 15.5px; font-weight: 650; line-height: 1.1;
  text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn[disabled], .btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primario { background: var(--azul-700); color: #fff; }
.btn-primario:hover { background: var(--azul-600); }
.btn-secundario { background: var(--blanco); color: var(--azul-800); border-color: var(--linea-fuerte); }
.btn-secundario:hover { background: var(--azul-50); border-color: var(--azul-200); }
.btn-fantasma { background: transparent; color: var(--azul-700); }
.btn-fantasma:hover { background: var(--azul-100); }
.btn-oro { background: var(--oro); color: var(--azul-950); }
.btn-oro:hover { background: var(--oro-hover); }
.btn-peligro { background: var(--rojo); color: #fff; }
.btn-peligro:hover { background: #9B2F2F; }
.btn-claro { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn-claro:hover { background: rgba(255, 255, 255, .18); }
.btn-chico { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-bloque { width: 100%; }
.btn-solo-icono { padding: 0; width: 44px; }
.btn-chico.btn-solo-icono { width: 36px; }
.enlace { border: 0; background: none; padding: 0; color: var(--azul-700); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.enlace-flecha { display: inline-flex; align-items: center; gap: 4px; color: var(--azul-700); font-weight: 650; text-decoration: none; font-size: 15px; border: 0; background: none; padding: 0; cursor: pointer; }
.enlace-flecha:hover { text-decoration: underline; }

/* ---------- Chips y semáforo ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px;
  border-radius: 999px;
  font-size: 13px; font-weight: 650; white-space: nowrap;
  background: var(--plata-claro); color: var(--tinta-2);
}
.chip .i { width: 15px; height: 15px; }
.chip-azul { background: var(--azul-100); color: var(--azul-800); }
.chip-verde { background: var(--verde-fondo); color: var(--verde-texto); }
.chip-ambar { background: var(--ambar-fondo); color: var(--ambar-texto); }
.chip-rojo { background: var(--rojo-fondo); color: var(--rojo-texto); }
.chip-gris { background: var(--gris-fondo); color: var(--gris-texto); }
.chip-oro { background: var(--oro-claro); color: var(--oro-texto); }
.chip-cafe { background: var(--cafe-claro); color: var(--cafe); }
.chip-borde { background: transparent; border: 1px solid var(--linea-fuerte); }
.semaforo {
  display: inline-flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 11px 0 9px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 700; white-space: nowrap;
}
.semaforo::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.semaforo-regular { background: var(--verde-fondo); color: var(--verde-texto); }
.semaforo-irregular { background: var(--ambar-fondo); color: var(--ambar-texto); }
.semaforo-riesgo { background: var(--rojo-fondo); color: var(--rojo-texto); }
.semaforo-baja { background: var(--gris-fondo); color: var(--gris-texto); }
.punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.punto-verde { background: var(--verde); } .punto-ambar { background: var(--ambar); } .punto-rojo { background: var(--rojo); } .punto-gris { background: #9AA3AD; } .punto-azul { background: var(--azul-600); } .punto-oro { background: var(--oro); }

/* ---------- Listas ---------- */
.lista { list-style: none; background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio-g); overflow: hidden; }
.lista > li + li { border-top: 1px solid var(--linea); }
.lista-sin-marco { border: 0; border-radius: 0; background: transparent; }
.lista-fila {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 60px; padding: 11px 14px;
  border: 0; background: none; text-align: left; color: inherit; text-decoration: none;
}
button.lista-fila, a.lista-fila { cursor: pointer; transition: background .12s; }
button.lista-fila:hover, a.lista-fila:hover { background: var(--azul-50); }
.lista-icono {
  flex: none; width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--azul-100); color: var(--azul-700);
}
.lista-texto { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lista-titulo { font-weight: 650; font-size: 15.5px; color: var(--tinta); }
.lista-detalle { font-size: 14px; color: var(--tinta-3); }
.lista-derecha { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; font-size: 14px; color: var(--tinta-2); }
.lista-flecha { flex: none; color: var(--tinta-3); }
.lista-fila.es-nuevo { background: linear-gradient(90deg, var(--oro-claro), transparent 70%); }

/* ---------- Tablas ---------- */
.tabla-env { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--linea); border-radius: var(--radio-g); background: var(--blanco); }
.tabla { width: 100%; font-size: 14.5px; }
.tabla th {
  position: sticky; top: 0;
  padding: 10px 12px;
  background: var(--plata-claro); color: var(--tinta-2);
  font-size: 13px; font-weight: 650; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--linea);
}
.tabla td { padding: 10px 12px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla tbody tr:nth-child(even) td { background: #FAFCFD; }
.tabla tr.clicable { cursor: pointer; }
.tabla tr.clicable:hover td { background: var(--azul-50); }
.tabla .num, .tabla td.num, .tabla th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla .centro { text-align: center; }
.tabla tfoot td { font-weight: 700; background: var(--plata-claro); border-top: 1px solid var(--linea-fuerte); }
.tabla-compacta td, .tabla-compacta th { padding: 7px 10px; }
.tabla-vacia { padding: 28px 16px; text-align: center; color: var(--tinta-3); }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo-etiqueta { font-size: 14.5px; font-weight: 650; color: var(--tinta); }
.campo-control {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  font-size: 16px;
  border: 1px solid var(--linea-fuerte);
  border-radius: 12px;
  background: var(--blanco);
  color: var(--tinta);
  transition: border-color .15s, box-shadow .15s;
}
.campo-control::placeholder { color: #8A9AA8; }
.campo-control:focus { outline: none; border-color: var(--azul-600); box-shadow: var(--enfoque); }
textarea.campo-control { min-height: 96px; resize: vertical; line-height: 1.45; }
select.campo-control { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235D7283' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.campo-ayuda { font-size: 13.5px; color: var(--tinta-3); }
.campo-error { font-size: 13.5px; color: var(--rojo); font-weight: 600; }
.campo.con-error .campo-control { border-color: var(--rojo); }
.campo-fila { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.casilla { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; cursor: pointer; }
.casilla input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--azul-700); flex: none; }
.buscador { position: relative; flex: 1 1 260px; min-width: 0; }
.buscador .i { position: absolute; left: 12px; top: 50%; margin-top: -10px; color: var(--tinta-3); pointer-events: none; }
.buscador input { padding-left: 40px; }
.interruptor { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 15px; }
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.interruptor-pista { position: relative; width: 46px; height: 28px; border-radius: 999px; background: var(--linea-fuerte); transition: background .15s; flex: none; }
.interruptor-pista::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.interruptor input:checked + .interruptor-pista { background: var(--azul-700); }
.interruptor input:checked + .interruptor-pista::after { transform: translateX(18px); }
.interruptor input:focus-visible + .interruptor-pista { box-shadow: var(--enfoque); }

/* ---------- Pestañas y segmentado ---------- */
.pestanas {
  display: flex; gap: 4px;
  overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--linea);
  margin-bottom: 2px;
}
.pestanas::-webkit-scrollbar { display: none; }
.pestana {
  flex: none;
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 14px;
  border: 0; background: none;
  color: var(--tinta-3); font-size: 15px; font-weight: 650;
  white-space: nowrap;
}
.pestana:hover { color: var(--azul-800); }
.pestana[aria-selected='true'] { color: var(--azul-800); }
.pestana[aria-selected='true']::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--azul-700); }
.pestana .contador { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--plata-claro); color: var(--tinta-2); font-size: 12px; line-height: 20px; text-align: center; }
.segmentado { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--plata-claro); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg-op { flex: none; min-height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--tinta-2); font-size: 14.5px; font-weight: 650; white-space: nowrap; }
.seg-op[aria-pressed='true'] { background: var(--blanco); color: var(--azul-800); box-shadow: 0 1px 3px rgba(11, 49, 69, .12); }

/* ---------- Avisos, notas y vacíos ---------- */
.nota {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px;
  border-radius: 14px;
  background: var(--azul-50); border: 1px solid var(--azul-100);
  color: var(--tinta); font-size: 15px;
}
.nota > .i { color: var(--azul-700); margin-top: 1px; }
.nota-titulo { font-weight: 700; }
.nota-aviso { background: var(--ambar-fondo); border-color: #F0DDB1; }
.nota-aviso > .i { color: var(--ambar); }
.nota-peligro { background: var(--rojo-fondo); border-color: #EDC3BF; }
.nota-peligro > .i { color: var(--rojo); }
.nota-exito { background: var(--verde-fondo); border-color: #C3DFCC; }
.nota-exito > .i { color: var(--verde); }
.nota-oro { background: var(--oro-claro); border-color: #EFD9A8; }
.nota-oro > .i { color: var(--oro-texto); }
.vacio { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px; }
.vacio-icono { width: 64px; height: 64px; border-radius: 50% 50% 14px 14px; display: flex; align-items: center; justify-content: center; background: var(--azul-100); color: var(--azul-700); margin-bottom: 4px; }
.vacio-titulo { font-family: var(--serif); font-size: 20px; font-weight: 650; color: var(--azul-900); }
.vacio-texto { color: var(--tinta-2); max-width: 46ch; }
.vacio .btn { margin-top: 8px; }

/* ---------- Avatares ---------- */
.avatar {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14.5px; letter-spacing: .02em;
  background: var(--av-fondo, var(--azul-100)); color: var(--av-texto, var(--azul-800));
  -webkit-user-select: none; user-select: none;
}
.avatar-chico { width: 32px; height: 32px; font-size: 12.5px; }
.avatar-grande { width: 64px; height: 64px; font-size: 22px; }
.avatar-arco { border-radius: 999px 999px 10px 10px; }

/* ---------- Progreso ---------- */
.progreso { height: 10px; border-radius: 999px; background: var(--plata-claro); overflow: hidden; }
.progreso-barra { height: 100%; border-radius: 999px; background: var(--azul-700); transition: width .5s ease; }
.progreso-oro .progreso-barra { background: var(--oro); }
.progreso-verde .progreso-barra { background: var(--verde); }
.progreso-ambar .progreso-barra { background: var(--ambar); }
.progreso-rojo .progreso-barra { background: var(--rojo); }
.progreso-delgado { height: 6px; }
.anillo { position: relative; flex: none; }
.anillo svg { transform: rotate(-90deg); }
.anillo-texto { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.05; }
.anillo-texto b { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--azul-900); }
.anillo-texto span { font-size: 12px; color: var(--tinta-3); font-weight: 600; }

/* ---------- Pasos (estado de trámites) ---------- */
.pasos { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.paso { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--tinta-3); padding-top: 2px; }
.paso::before { content: ''; position: absolute; top: 13px; left: calc(-50% + 16px); right: calc(50% + 16px); height: 3px; border-radius: 3px; background: var(--linea); }
.paso:first-child::before { display: none; }
.paso-marca { position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--blanco); border: 2px solid var(--linea-fuerte); color: var(--tinta-3); font-size: 12px; font-weight: 800; }
.paso.hecho { color: var(--verde-texto); }
.paso.hecho::before { background: var(--verde); }
.paso.hecho .paso-marca { background: var(--verde); border-color: var(--verde); color: #fff; }
.paso.actual { color: var(--azul-800); }
.paso.actual::before { background: var(--verde); }
.paso.actual .paso-marca { border-color: var(--azul-700); color: var(--azul-700); box-shadow: 0 0 0 4px var(--azul-100); }

/* ---------- Hoja / diálogo ---------- */
.hoja {
  width: min(100%, var(--hoja-ancho, 620px));
  max-width: 100%;
  max-height: min(92vh, 92dvh);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  background: var(--blanco);
  color: var(--tinta);
  box-shadow: var(--sombra-alta);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.hoja:not([open]) { display: none; }
.hoja::backdrop { background: rgba(7, 31, 44, .5); }
.hoja[open] { animation: hoja-sube .22s cubic-bezier(.2, .8, .2, 1); }
.hoja.saliendo { animation: hoja-baja .16s ease-in forwards; }
@keyframes hoja-sube { from { transform: translateY(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes hoja-baja { to { transform: translateY(24px); opacity: 0; } }
@media (min-width: 720px) {
  .hoja { margin: auto; border-radius: 20px; max-height: min(88vh, 88dvh); }
  .hoja-ancha { --hoja-ancho: 860px; }
}
.hoja-asa { width: 40px; height: 5px; border-radius: 999px; background: var(--linea-fuerte); margin: 8px auto 0; flex: none; }
@media (min-width: 720px) { .hoja-asa { display: none; } }
.hoja-cabeza { display: flex; align-items: center; gap: 12px; padding: 12px 14px 10px 20px; flex: none; }
.hoja-titulo { flex: 1 1 auto; font-family: var(--serif); font-size: 21px; font-weight: 650; color: var(--azul-900); }
.hoja-cerrar { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--plata-claro); color: var(--tinta-2); display: flex; align-items: center; justify-content: center; }
.hoja-cerrar:hover { background: var(--plata); }
.hoja-cuerpo { padding: 4px 20px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; }
.hoja-pie { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 20px calc(14px + var(--seg-abajo)); border-top: 1px solid var(--linea); background: var(--blanco); flex: none; }
.hoja-pie .btn { flex: 1 1 180px; }
html.hoja-abierta { overflow: hidden; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed; z-index: 90;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-alto) + var(--seg-abajo) + 14px);
  width: min(560px, calc(100% - 24px));
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
@media (min-width: 1024px) { .toasts { bottom: 24px; } }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--azul-950); color: #fff;
  box-shadow: var(--sombra-alta);
  font-size: 15px; font-weight: 550;
  animation: toast-entra .2s ease-out;
}
.toast-icono { color: var(--plata); }
.toast-exito .toast-icono { color: #7FD3A0; }
.toast-aviso .toast-icono { color: var(--oro); }
.toast-error .toast-icono { color: #F2A29B; }
.toast-texto { flex: 1 1 auto; }
.toast-accion { flex: none; border: 0; background: none; color: var(--oro); font-weight: 750; padding: 4px 6px; }
.toast.saliendo { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
@keyframes toast-entra { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Banda de conexión (modo sin conexión) ---------- */
.banda-conexion {
  position: sticky; top: calc(var(--barra-alto) + var(--seg-arriba)); z-index: 25;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px calc(16px + var(--seg-der)) 9px calc(16px + var(--seg-izq));
  background: #4A3A0E; color: #FFF3D6;
  font-size: 14.5px; font-weight: 600;
}
.banda-conexion .i { color: var(--oro); }
.banda-conexion.sincronizando { background: var(--azul-800); color: #fff; }
.banda-conexion.sincronizando .i { color: var(--plata); animation: girar 1s linear infinite; }
.banda-conexion .btn { margin-left: auto; }
.banda-conexion > span { flex: 1 1 200px; min-width: 0; }
@media (max-width: 600px) { .banda-conexion { font-size: 13.5px; padding-top: 7px; padding-bottom: 7px; gap: 8px; flex-wrap: nowrap; } .banda-conexion .btn { min-height: 34px; padding: 0 10px; font-size: 13px; } .banda-conexion .btn .i { display: none; } }
@media (min-width: 1024px) { .banda-conexion { top: var(--barra-alto); grid-column: 2; } }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Bloques de sección ---------- */
.seccion { display: flex; flex-direction: column; gap: 12px; }
.seccion-cabeza { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.seccion-titulo { font-family: var(--serif); font-size: 21px; font-weight: 650; color: var(--azul-900); }
.seccion-sub { font-size: 14.5px; color: var(--tinta-3); }

/* ---------- Gráficas SVG ---------- */
.grafica { width: 100%; overflow: visible; }
.grafica text { font-family: var(--sans); font-size: 12px; fill: var(--tinta-3); font-variant-numeric: tabular-nums; }
.grafica .eje { stroke: var(--linea); stroke-width: 1; }
.grafica .rejilla-linea { stroke: #E9EEF3; stroke-width: 1; }
.grafica .valor { fill: var(--tinta); font-weight: 650; }
.grafica-leyenda { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--tinta-2); }
.grafica-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.grafica-leyenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.grafica-tip { position: fixed; z-index: 95; pointer-events: none; padding: 7px 10px; border-radius: 8px; background: var(--azul-950); color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--sombra-alta); max-width: 240px; }

.grafica-fig { margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.grafica-lienzo { width: 100%; min-width: 0; }
.grafica-marca { outline: none; }
.grafica-marca:focus-visible path, .grafica-marca:hover path { filter: brightness(1.08); }
.grafica-datos > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--azul-700); list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.grafica-datos > summary::-webkit-details-marker { display: none; }
.grafica-datos > summary::before { content: '+'; display: inline-block; width: 14px; font-weight: 800; }
.grafica-datos[open] > summary::before { content: '–'; }
.grafica-datos .tabla-env { margin-top: 8px; }
.tendencia { display: inline-block; vertical-align: middle; }

/* ---------- Mapa ---------- */
.mapa { position: relative; z-index: 0; isolation: isolate; border-radius: var(--radio-g); overflow: hidden; border: 1px solid var(--linea); background: #EEF3F7; }
.mapa-lienzo { width: 100%; }
.mapa-esquema { width: 100%; height: 100%; display: block; }
.mapa-pin { background: none; border: 0; }
.mapa-pin svg { filter: drop-shadow(0 2px 3px rgba(7, 31, 44, .35)); }
.mapa-pin-etiqueta { position: absolute; left: 28px; top: 6px; white-space: nowrap; padding: 2px 7px; border-radius: 999px; background: #fff; color: var(--tinta); font: 600 12px/1.4 var(--sans); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.leaflet-container { font-family: var(--sans); }
.leaflet-popup-content { font-size: 14px; line-height: 1.4; }

/* ---------- Escáner ---------- */
.escaner-marco { position: relative; border-radius: 16px; overflow: hidden; background: #071F2C; aspect-ratio: 4 / 3; }
.escaner-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.escaner-mira { position: absolute; inset: 18% 22%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 18px; box-shadow: 0 0 0 999px rgba(7, 31, 44, .35); }
.escaner-estado { font-size: 14px; color: var(--tinta-3); text-align: center; }

/* ---------- QR ---------- */
.qr { background: #fff; padding: 8px; border-radius: 10px; display: inline-block; line-height: 0; }
.qr svg { width: 100%; height: auto; }

/* ---------- Pantalla de carga ---------- */
.splash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--azul-900); color: #fff; z-index: 100; }
.splash img { width: 112px; height: auto; }
.splash-nombre { font-family: var(--serif); font-size: 26px; font-weight: 650; }
.splash-nota { color: var(--plata); font-size: 14px; }
.cargando { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 16px; color: var(--tinta-3); }
.cargando::before { content: ''; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--plata); border-top-color: var(--azul-700); animation: girar .8s linear infinite; }

/* ---------- Menú de perfil (hoja) ---------- */
.perfiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.perfil-op {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px; min-height: 64px;
  border: 1px solid var(--linea); border-radius: 14px;
  background: var(--blanco); text-align: left; color: inherit;
}
.perfil-op:hover { border-color: var(--azul-200); background: var(--azul-50); }
a.perfil-op { text-decoration: none; color: inherit; }
.perfil-op[aria-current='true'] { border-color: var(--azul-700); box-shadow: inset 0 0 0 1px var(--azul-700); background: var(--azul-50); }
.perfil-op-icono { flex: none; width: 42px; height: 42px; border-radius: 999px 999px 10px 10px; display: flex; align-items: center; justify-content: center; background: var(--azul-900); color: var(--oro); }
.perfil-op-texto { display: flex; flex-direction: column; min-width: 0; }
.perfil-op-texto b { font-size: 15px; }
.perfil-op-texto span { font-size: 13px; color: var(--tinta-3); }
.recorrido { border: 1px solid var(--linea); border-radius: 14px; padding: 14px; background: var(--blanco); }
.recorrido + .recorrido { margin-top: 10px; }
.recorrido-num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--oro-claro); color: var(--oro-texto); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; }
.recorrido-pasos { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14.5px; color: var(--tinta-2); }

/* ---------- Detalles plegables ---------- */
details.plegable { border: 1px solid var(--linea); border-radius: 14px; background: var(--blanco); }
details.plegable > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; font-weight: 650; }
details.plegable > summary::-webkit-details-marker { display: none; }
details.plegable > summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--tinta-3); border-bottom: 2px solid var(--tinta-3); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s; flex: none; }
details.plegable[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
details.plegable > .plegable-cuerpo { padding: 0 15px 15px; }

/* ---------- Clave-valor ---------- */
.kv { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 8px 18px; font-size: 15px; }
.kv dt { color: var(--tinta-3); font-weight: 600; }
.kv dd { margin: 0; color: var(--tinta); min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; } .kv dd { margin-bottom: 8px; } }

/* ---------- Impresión ---------- */
@media print {
  .barra, .lateral, .nav-inferior, .banda-conexion, .toasts, .pantalla-acciones { display: none !important; }
  .app { display: block; }
  .contenido { padding: 0; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
