/* Cascarón de la plataforma: una sola hoja de estilos para todas las pantallas.
   Ninguna pantalla trae estilos propios ni en línea (la política de seguridad
   del sitio los bloquea). Un módulo usa estas piezas tal cual. */

@font-face {
  font-family: "Barlow";
  src: url("/core/fuentes/barlow-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("/core/fuentes/barlow-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Barlow";
  src: url("/core/fuentes/barlow-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Semi Condensed";
  src: url("/core/fuentes/barlow-semi-condensed-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --cianotipo: #12406b;
  --cianotipo-profundo: #0c2e4e;
  --papel: #f6f7f5;
  --hoja: #ffffff;
  --tinta: #17232e;
  --tinta-suave: #51606d;
  --linea: #d5dad6;
  --senal: #f2b233;
  --rojo: #b3362b;
  --rojo-fondo: #fbeceb;
  --verde: #2c7453;
  --verde-fondo: #e8f3ed;
  --plano-linea: rgba(255, 255, 255, 0.07);
  --plano-texto: #e7eef5;
  --plano-texto-suave: #a9bfd3;

  --texto: "Barlow", "Segoe UI", system-ui, sans-serif;
  --titulo: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;

  --lateral: 17rem;
  --radio: 4px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--texto);
  font-size: 1rem;
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

/* Texto que solo oye el lector de pantalla. */
.solo-lector {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

a {
  color: var(--cianotipo);
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: 3px solid var(--senal);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  font-family: var(--titulo);
  font-weight: 600;
  color: var(--cianotipo-profundo);
  line-height: 1.15;
  margin: 0;
}
h1 {
  font-size: 2rem;
  letter-spacing: -0.005em;
}
h2 {
  font-size: 1.375rem;
  margin-top: 2.5rem;
}
h3 {
  font-size: 1.125rem;
  margin-top: 1.5rem;
}
p {
  margin: 0.75rem 0 0;
  max-width: 68ch;
}
.nota {
  color: var(--tinta-suave);
  font-size: 0.9375rem;
}

/* --- Marco: plano a la izquierda, papel a la derecha -------------------------- */

.marco {
  min-height: 100vh;
}

.lateral {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--lateral);
  display: flex;
  flex-direction: column;
  color: var(--plano-texto);
  background-color: var(--cianotipo);
  /* Retícula de plano: una línea fina cada 24 px en los dos sentidos. */
  background-image:
    linear-gradient(var(--plano-linea) 1px, transparent 1px),
    linear-gradient(90deg, var(--plano-linea) 1px, transparent 1px);
  background-size: 24px 24px;
  overflow-y: auto;
  z-index: 20;
}

.lateral__nombre {
  display: block;
  padding: 1.5rem 1.25rem 1.25rem;
  font-family: var(--titulo);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.1;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

.lateral__nav {
  flex: 1;
  padding: 0.75rem 0;
}

.lateral__grupo {
  margin: 1rem 1.25rem 0.25rem;
  font-size: 0.8125rem;
  color: var(--plano-texto-suave);
}

.lateral ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.modulo__enlace,
.seccion__enlace {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--plano-texto);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.modulo__enlace {
  padding: 0.5rem 1.25rem 0.5rem calc(1.25rem - 3px);
  font-weight: 500;
}
.seccion__enlace {
  padding: 0.3125rem 1.25rem 0.3125rem calc(3.125rem - 3px);
  font-size: 0.9375rem;
  color: var(--plano-texto-suave);
}
.modulo__enlace:hover,
.seccion__enlace:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.modulo--activo > .modulo__enlace {
  color: #fff;
  background: var(--cianotipo-profundo);
  border-left-color: var(--senal);
}
.seccion--activa > .seccion__enlace {
  color: #fff;
  font-weight: 500;
}
.modulo--activo > ul {
  background: rgba(12, 46, 78, 0.55);
  padding: 0.25rem 0 0.5rem;
}

.modulo__icono {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.modulo__nombre {
  flex: 1;
  min-width: 0;
}

/* La señal de obra: cuánto trabajo espera en cada módulo. */
.pendientes {
  flex: none;
  min-width: 1.5rem;
  padding: 0 0.4375rem;
  border-radius: 999px;
  background: var(--senal);
  color: var(--cianotipo-profundo);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5rem;
  text-align: center;
}
.pendientes--roto {
  background: transparent;
  color: var(--senal);
  box-shadow: inset 0 0 0 1.5px var(--senal);
}

.lateral__pie {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--cianotipo);
}
.lateral__persona {
  font-weight: 500;
  color: #fff;
  overflow-wrap: anywhere;
}
.lateral__rol {
  font-size: 0.875rem;
  color: var(--plano-texto-suave);
}
.lateral__salir {
  margin-top: 0.75rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--plano-texto);
  font: inherit;
  font-size: 0.9375rem;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.lateral__salir:hover {
  color: #fff;
}

.area {
  margin-left: var(--lateral);
  min-width: 0;
}

.barra {
  display: none;
}

.contenido {
  max-width: 72rem;
  padding: 1.75rem 2.5rem 4rem;
}

.ruta {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--tinta-suave);
}
.ruta li + li::before {
  content: "›";
  margin-right: 0.375rem;
}
.ruta a {
  color: inherit;
}

/* --- Piezas del contenido -------------------------------------------------------- */

.aviso {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--cianotipo);
  background: var(--hoja);
  max-width: 68ch;
}
.aviso--error {
  border-left-color: var(--rojo);
  background: var(--rojo-fondo);
}
.aviso--bien {
  border-left-color: var(--verde);
  background: var(--verde-fondo);
}

.vacio {
  margin-top: 1.5rem;
  padding: 2rem 1.5rem;
  border: 1px dashed var(--linea);
  border-radius: var(--radio);
  color: var(--tinta-suave);
  max-width: 68ch;
}

.tabla-envoltura {
  margin-top: 1rem;
  overflow-x: auto;
  background: var(--hoja);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
th,
td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--linea);
}
th {
  font-weight: 600;
  color: var(--tinta-suave);
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.numero {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.estado {
  display: inline-block;
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  background: var(--papel);
  color: var(--tinta-suave);
  box-shadow: inset 0 0 0 1px var(--linea);
}
.estado--bien {
  background: var(--verde-fondo);
  color: var(--verde);
  box-shadow: none;
}
.estado--mal {
  background: var(--rojo-fondo);
  color: var(--rojo);
  box-shadow: none;
}
.estado--espera {
  background: #fdf3da;
  color: #7a5200;
  box-shadow: none;
}

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.4375rem 1rem;
  border: 1px solid var(--cianotipo-profundo);
  border-radius: var(--radio);
  background: var(--cianotipo-profundo);
  color: #fff;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.boton:hover {
  background: var(--cianotipo);
}
.boton--secundario {
  background: var(--hoja);
  color: var(--cianotipo-profundo);
}
.boton--secundario:hover {
  background: var(--papel);
}
.boton--menor {
  min-height: 2rem;
  padding: 0.1875rem 0.625rem;
  font-size: 0.875rem;
}
.boton[disabled] {
  opacity: 0.55;
  cursor: progress;
}

.formulario {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--hoja);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
  max-width: 44rem;
}
.campo {
  display: block;
  margin-bottom: 1rem;
}
.campo__nombre {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
}
.campo__ayuda {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--tinta-suave);
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.4375rem 0.625rem;
  border: 1px solid #9aa6ae;
  border-radius: var(--radio);
  background: var(--hoja);
  color: var(--tinta);
  font: inherit;
}
textarea {
  min-height: 5rem;
  resize: vertical;
}
.campo--corto input {
  max-width: 8rem;
}
.opciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.opciones legend {
  padding: 0;
  margin-bottom: 0.25rem;
  font-weight: 500;
}
.opcion {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2rem;
}
.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.fila-acciones {
  margin-top: 1rem;
}

.lista-modulos {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  max-width: 44rem;
  background: var(--hoja);
  border: 1px solid var(--linea);
  border-radius: var(--radio);
}
.lista-modulos li + li {
  border-top: 1px solid var(--linea);
}
.lista-modulos a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  color: var(--cianotipo-profundo);
  font-weight: 500;
  text-decoration: none;
}
.lista-modulos a:hover {
  background: var(--papel);
}
.lista-modulos .modulo__nombre {
  flex: 1;
}

/* --- Entrada y fijar clave: una sola columna sobre el plano ------------------------- */

.puerta {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background-color: var(--cianotipo);
  background-image:
    linear-gradient(var(--plano-linea) 1px, transparent 1px),
    linear-gradient(90deg, var(--plano-linea) 1px, transparent 1px);
  background-size: 24px 24px;
}
.puerta__hoja {
  width: 100%;
  max-width: 26rem;
  padding: 2rem;
  background: var(--hoja);
  border-radius: var(--radio);
}
.puerta__hoja h1 {
  font-size: 1.75rem;
}
.puerta__hoja .campo:first-of-type {
  margin-top: 1.25rem;
}
.puerta__hoja .boton {
  width: 100%;
}

/* --- Celular: el plano se pliega en un cajón ------------------------------------------ */

@media (max-width: 56rem) {
  .barra {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--cianotipo);
    color: #fff;
  }
  .barra__menu {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radio);
    background: none;
    color: #fff;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
  }
  .barra__nombre {
    font-family: var(--titulo);
    font-weight: 600;
    font-size: 1.125rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .barra .pendientes {
    margin-left: auto;
  }

  .lateral {
    width: min(20rem, 86vw);
    transform: translateX(-100%);
    transition: transform 0.18s ease-out;
    visibility: hidden;
  }
  .marco--abierto .lateral {
    transform: none;
    visibility: visible;
    box-shadow: 0 0 0 100vmax rgba(12, 46, 78, 0.55);
  }
  .area {
    margin-left: 0;
  }
  .contenido {
    padding: 1.25rem 1rem 3rem;
  }
  h1 {
    font-size: 1.625rem;
  }
  .modulo__enlace,
  .seccion__enlace {
    min-height: 2.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lateral {
    transition: none;
  }
}
