:root {
  --primario: #1f5fc4;
  --primario-hover: #194fa6;
  --primario-oscuro: #0f2c5c;
  --primario-claro: #e8f0fb;
  --fondo: #f4f7fb;
  --superficie: #ffffff;
  --suave: #f8fafd;
  --borde: #d9e1ec;
  --texto: #0f1b2d;
  --texto-2: #45556c;
  --tenue: #5c6b81;
  --exito: #1b7f46;
  --exito-bg: #e3f4ea;
  --advertencia: #a15c00;
  --advertencia-bg: #fdf1dc;
  --peligro: #c0392b;
  --peligro-bg: #fbe6e4;
  --info-bg: #e6f0fb;
  --radio: 8px;
  --sombra: 0 1px 2px rgba(15, 27, 45, 0.06);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  color: var(--texto);
  background: var(--fondo);
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100dvh;
}
h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
h2 {
  font-size: 1.125rem;
  margin: 0 0 0.75rem;
}
h3 {
  font-size: 1rem;
  margin: 0.5rem 0;
}
a {
  color: var(--primario);
}
ul,
ol {
  padding-left: 1.25rem;
}
small,
.nota {
  color: var(--tenue);
  font-size: 0.875rem;
}
img,
video {
  max-width: 100%;
}

button,
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--primario);
  border-radius: var(--radio);
  background: var(--primario);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
button:hover,
.boton:hover {
  background: var(--primario-hover);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.secundario {
  background: var(--superficie);
  color: var(--texto);
  border-color: #8593a8;
}
.secundario:hover {
  background: var(--suave);
}
.peligro {
  background: var(--peligro);
  border-color: var(--peligro);
  color: #fff;
}
.enlace {
  background: none;
  border: 0;
  color: var(--primario);
  padding: 0.25rem;
  min-height: auto;
  font-weight: 600;
}
.enlace:hover {
  background: none;
  text-decoration: underline;
}
.enlace.peligro {
  color: var(--peligro);
  background: none;
}
:focus-visible {
  outline: 2px solid var(--primario);
  outline-offset: 2px;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.875rem;
  font-weight: 600;
}
input,
select,
textarea {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #8593a8;
  border-radius: var(--radio);
  font: inherit;
  font-weight: 400;
  background: var(--superficie);
  color: var(--texto);
}
input[type='checkbox'],
input[type='radio'] {
  width: auto;
  min-height: auto;
  accent-color: var(--primario);
}
.en-linea {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}
.con-boton {
  display: flex;
  gap: 0.5rem;
}
.dos {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}
fieldset.opciones {
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  display: grid;
  gap: 0.5rem;
}
fieldset.opciones label {
  display: block;
  font-weight: 400;
}

.fila {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.entre {
  justify-content: space-between;
}
.pila {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.centrado {
  text-align: center;
}
.tarjeta {
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--sombra);
}
.recuadro {
  background: var(--suave);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 1rem;
}
.rejilla {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  margin: 1rem 0;
}
.vacio {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--texto-2);
  background: var(--superficie);
  border: 1px dashed var(--borde);
  border-radius: 12px;
}
.multilinea {
  white-space: pre-wrap;
}
.texto-peligro {
  color: var(--peligro);
  font-weight: 600;
}
.cabecera {
  margin-bottom: 1rem;
}

.aviso {
  padding: 0.75rem 1rem;
  border-radius: var(--radio);
  background: var(--info-bg);
  border: 1px solid #b9cfeb;
  margin: 0.5rem 0;
}
.aviso.error {
  background: var(--peligro-bg);
  border-color: #efb8b2;
}
.aviso.exito {
  background: var(--exito-bg);
  border-color: #b5dcc4;
}
.aviso.advertencia {
  background: var(--advertencia-bg);
  border-color: #efd29d;
}
#avisos {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: grid;
  gap: 0.5rem;
  max-width: 22rem;
}
#avisos .aviso {
  box-shadow: 0 8px 24px rgba(15, 27, 45, 0.15);
  margin: 0;
}

.chip {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f1f4f8;
  color: #5a6880;
  white-space: nowrap;
  text-decoration: none;
}
.chip.abierta,
.chip.administrador,
.chip.tu {
  background: #e6f0fb;
  color: #1d5faf;
}
.chip.en_proceso,
.chip.media,
.chip.fecha_limite_proxima,
.chip.suspendida {
  background: #fdf1dc;
  color: #8a4b00;
}
.chip.cerrada,
.chip.activa,
.chip.activo {
  background: #e3f4ea;
  color: #17693b;
}
.chip.alta {
  background: #fde9d7;
  color: #a34700;
}
.chip.critica,
.chip.urgente,
.chip.fecha_limite_vencida,
.chip.revocado {
  background: #fbe6e4;
  color: #a12a1f;
}

.marca {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primario-oscuro);
  text-decoration: none;
}
.marca small {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: inherit;
  opacity: 0.75;
}
.marca.oscura {
  color: #fff;
}

.barra-publica,
.pie {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
}
.barra-publica {
  background: var(--superficie);
  border-bottom: 1px solid var(--borde);
  position: sticky;
  top: 0;
  z-index: 10;
}
.barra-publica nav,
.pie nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.barra-publica nav a,
.pie nav a {
  text-decoration: none;
}
.pie {
  background: var(--primario-oscuro);
  color: #c5d3ea;
}
.pie a {
  color: #c5d3ea;
}
.publico main > section {
  padding: 3.5rem clamp(1rem, 6vw, 6rem);
}
.publico section.clara {
  background: var(--superficie);
}
.publico section.oscura {
  background: var(--primario-oscuro);
  color: #fff;
}
.oscura .tarjeta {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: #c5d3ea;
}
.oscura h3 {
  color: #fff;
}
.oscura small {
  color: #7fb0f5;
}
.hero {
  background: var(--superficie);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  max-width: 40rem;
}
.antetitulo {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primario);
}
.oscura .antetitulo {
  color: #7fb0f5;
}
.pasos-publicos {
  counter-reset: paso;
}
.pasos-publicos h3::before {
  counter-increment: paso;
  content: counter(paso) '. ';
  color: #7fb0f5;
}
#preguntas details {
  margin: 0.75rem 0;
}
#preguntas summary {
  font-weight: 600;
  cursor: pointer;
}
.llamado {
  text-align: center;
  background: var(--primario-claro);
}
.llamado .fila {
  justify-content: center;
}
.legal {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3rem 1rem;
}
.legal h2 {
  margin-top: 2rem;
}

body.acceso {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
}
.acceso aside {
  background: var(--primario-oscuro);
  color: #c5d3ea;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.acceso .lema {
  color: #fff;
  font-size: 1.375rem;
  font-weight: 600;
}
.lista-check li::marker {
  content: '✓  ';
  color: #7fb0f5;
}
.acceso main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.acceso .tarjeta {
  width: min(100%, 28rem);
}

body.app {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}
#barra {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--superficie);
  border-bottom: 1px solid var(--borde);
  position: sticky;
  top: 0;
  z-index: 30;
}
#barra .marca {
  margin-right: auto;
}
#barra select {
  width: auto;
  max-width: 20rem;
}
.contador {
  background: var(--peligro);
  color: #fff;
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.75rem;
}
.menu-usuario {
  position: relative;
}
.menu-usuario summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem;
  list-style: none;
}
.menu-usuario > div {
  position: absolute;
  right: 0;
  top: 100%;
  display: grid;
  gap: 0.5rem;
  min-width: 15rem;
  padding: 1rem;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: 0 8px 24px rgba(15, 27, 45, 0.12);
  z-index: 50;
  justify-items: start;
}
#lateral {
  background: var(--primario-oscuro);
  padding: 1rem 0.75rem;
}
#lateral p {
  color: #8fa6cc;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  margin: 1rem 0.5rem 0.25rem;
}
#lateral a {
  display: block;
  color: #c5d3ea;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radio);
}
#lateral a:hover,
#lateral a[aria-current] {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
#lateral a[aria-current] {
  box-shadow: inset 3px 0 #7fb0f5;
  font-weight: 600;
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primario);
  color: #fff;
}
#principal {
  padding: 1.5rem clamp(1rem, 3vw, 2rem);
  min-width: 0;
}
.solo-movil {
  display: none;
}
.estrecha {
  max-width: 32rem;
  margin: 3rem auto;
}

.kpis {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  margin: 1rem 0;
}
.kpi {
  display: grid;
  gap: 0.25rem;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-top: 3px solid var(--primario);
  border-radius: 12px;
  padding: 1rem;
  color: var(--texto);
  text-decoration: none;
}
a.kpi[href]:hover {
  border-color: var(--primario);
}
.kpi span {
  font-size: 0.8rem;
  color: var(--texto-2);
}
.kpi strong {
  font-size: 1.75rem;
}
.kpi.peligro strong {
  color: var(--peligro);
}
.kpi.peligro {
  border-top-color: var(--peligro);
}
.barras {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
.barras li {
  display: grid;
  grid-template-columns: 1fr auto;
  font-size: 0.875rem;
}
.barras i {
  grid-column: 1 / -1;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--primario);
  min-width: 2px;
}
.barras i.abierta {
  background: #1d5faf;
}
.barras i.en_proceso,
.barras i.media {
  background: #8a5a00;
}
.barras i.cerrada {
  background: #17693b;
}
.barras i.critica,
.barras i.urgente {
  background: #b42318;
}
.barras i.alta {
  background: #a34700;
}
.barras i.baja {
  background: #44546a;
}
.lista {
  list-style: none;
  padding: 0;
  margin: 0;
}
.lista li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--borde);
}
.lista li:last-child {
  border-bottom: 0;
}
.lista a,
.lista button {
  display: grid;
  text-align: left;
  text-decoration: none;
  color: var(--texto);
  font-weight: 400;
}
.lista .no-leida strong::before {
  content: '● ';
  color: var(--primario);
}
.borde-peligro {
  border-left: 4px solid var(--peligro);
}
.borde-advertencia {
  border-left: 4px solid var(--advertencia);
}

.filtros {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  align-items: end;
  margin: 1rem 0;
  padding: 1rem;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 12px;
}
.filtros .ancho {
  grid-column: span 2;
}
.paginacion {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}
.paginacion select {
  width: auto;
}
.tabla {
  width: 100%;
  border-collapse: collapse;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: 12px;
  overflow: hidden;
}
.tabla th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--tenue);
  background: var(--suave);
}
.tabla tbody tr:hover {
  background: var(--suave);
}
.tabla th,
.tabla td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--borde);
  vertical-align: middle;
}

dialog {
  width: min(40rem, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  border: 0;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 16px 48px rgba(15, 27, 45, 0.25);
}
dialog::backdrop {
  background: rgba(15, 27, 45, 0.45);
}
dialog form {
  display: grid;
  gap: 1rem;
}
dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.codigo {
  font:
    700 2rem/1 ui-monospace,
    monospace;
  letter-spacing: 0.2em;
  text-align: center;
  background: var(--suave);
  padding: 1rem;
  border-radius: var(--radio);
  user-select: all;
}
.medio {
  display: grid;
  place-items: center;
  background: #eef2f7;
  border-radius: var(--radio);
  min-height: 12rem;
}
.medio img,
.medio video {
  max-height: 65dvh;
}

.detalle {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
  margin-top: 1rem;
}
.cabecera-incidencia {
  margin: 0.75rem 0 1rem;
}
.datos {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  margin: 0;
}
.datos dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--tenue);
  font-weight: 600;
}
.datos dd {
  margin: 0;
  word-break: break-word;
}
.linea-tiempo {
  list-style: none;
  padding-left: 1rem;
  border-left: 2px solid var(--borde);
  display: grid;
  gap: 1rem;
}
.linea-tiempo small {
  display: block;
}
.pasos {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  counter-reset: paso;
}
.pasos li {
  counter-increment: paso;
  color: var(--texto-2);
}
.pasos li::before {
  content: counter(paso);
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  border: 2px solid #8593a8;
  font-size: 0.75rem;
  font-weight: 700;
}
.pasos li.hecho::before {
  content: '✓';
  border-color: var(--exito);
  color: var(--exito);
  background: var(--exito-bg);
}
.pasos li.actual {
  font-weight: 700;
  color: var(--texto);
}
.pasos li.actual::before {
  background: var(--primario);
  border-color: var(--primario);
  color: #fff;
}
.evidencias {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
}
.miniatura {
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  background: #eef2f7;
  color: var(--texto-2);
  border: 1px solid var(--borde);
}
.miniatura:hover {
  background: #e2e8f0;
}
.miniatura img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.archivos li.error small {
  color: var(--peligro);
}
.pestanas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 0.25rem;
  margin-bottom: 1.25rem;
}
.pestanas > * {
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 6px;
  min-height: auto;
  background: none;
  text-decoration: none;
  color: var(--texto-2);
  font-weight: 600;
}
.pestanas > :hover,
.pestanas > [aria-current] {
  background: var(--primario-claro);
  color: var(--primario);
}
.arbol {
  display: grid;
  gap: 1rem;
}
.arbol summary {
  font-weight: 700;
  cursor: pointer;
}
.arbol li {
  margin: 0.35rem 0;
}

@media (max-width: 900px) {
  body.app,
  body.acceso {
    display: block;
  }
  .acceso aside {
    display: none;
  }
  .barra-publica,
  #barra {
    position: static;
  }
  .barra-publica nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    white-space: nowrap;
  }
  .solo-movil {
    display: inline-flex;
  }
  #lateral {
    display: none;
  }
  body.menu-abierto #lateral {
    display: block;
  }
  .detalle {
    grid-template-columns: 1fr;
  }
  .filtros .ancho {
    grid-column: 1 / -1;
  }
  .tabla thead {
    display: none;
  }
  .tabla,
  .tabla tbody,
  .tabla tr,
  .tabla td {
    display: block;
    width: 100%;
  }
  .tabla tr {
    border-bottom: 1px solid var(--borde);
    padding: 0.5rem 0;
  }
  .tabla td {
    border: 0;
    padding: 0.25rem 0.75rem;
  }
  .tabla td[data-t]::before {
    content: attr(data-t) ': ';
    color: var(--tenue);
    font-size: 0.8rem;
  }
}
