/* SIGCS · hoja de estilos unica.
   Organizada por secciones: variables, base, cabecera, componentes, pantallas. */

/* Paleta tomada del logo de Century Security: azul marino y rojo.
   Un solo color para todos los botones (rojo) y el azul marino para enlaces y texto. */
:root {
  --tinta: #16202b;
  --tinta-suave: #5b6b7c;
  --tinta-tenue: #6b7b8c;
  --linea: #dde4ea;
  --fondo: #f5f7f9;
  --papel: #ffffff;
  --marca: #1f3a5f;          /* azul marino del logo */
  --marca-oscura: #16293f;
  --marca-clara: #e9eff5;
  --rojo: #c00000;           /* rojo del logo: el color de todos los botones */
  --rojo-oscuro: #9c0000;
  --alerta: #b4232a;
  --alerta-fondo: #fdecec;
  --ok: #1f7a4d;
  --ok-fondo: #e4f4ec;
  --aviso: #92650d;
  --aviso-fondo: #fdf3e3;
  --radio: 8px;
  --sombra: 0 1px 2px rgba(22, 32, 43, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--tinta);
  background: var(--fondo);
}

a { color: var(--marca); }
h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 30px 0 10px; }
h3 { font-size: 15px; }

/* ------------------------------------------------------------ cabecera */


.sesion { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sesion a { color: #fff; }
.etiqueta-rol { font-size: 11px; background: rgba(255, 255, 255, .18); padding: 2px 8px; border-radius: 20px; }
.enlace-boton {
  background: none; border: none; color: #fff; text-decoration: underline;
  cursor: pointer; font: inherit; padding: 0;
}

.contenido { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }

/* ------------------------------------------------------------ textos */
.ayuda { color: var(--tinta-suave); font-size: 13px; margin: 0 0 16px; }
.ruta { font-size: 12px; color: var(--tinta-suave); margin: 0 0 4px; }
.meta { font-size: 12px; color: var(--tinta-suave); }
.pista { font-size: 11px; color: var(--tinta-tenue); }
.vacio { color: var(--tinta-tenue); }
.nota { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio); padding: 12px 14px; margin: 0; }

.alerta { padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; font-size: 14px; border: 1px solid; }
.alerta.error { background: var(--alerta-fondo); border-color: #f3c4c4; color: var(--alerta); }
.alerta.exito { background: var(--ok-fondo); border-color: #bfe4d1; color: var(--ok); }
.alerta.info  { background: var(--marca-clara); border-color: #c6dbee; color: var(--marca-oscura); }

/* ------------------------------------------------------------ controles */
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--tinta-suave); }
input, select, textarea {
  font: inherit; color: var(--tinta); padding: 8px 10px; width: 100%;
  border: 1px solid var(--linea); border-radius: 6px; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marca-clara); border-color: var(--marca); }

button, .boton, .boton-claro, .boton-peligro {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 6px; padding: 9px 18px;
  border: 1px solid transparent; text-decoration: none; display: inline-block; text-align: center;
}
button, .boton { background: var(--rojo); color: #fff; }
button:hover, .boton:hover { background: var(--rojo-oscuro); }
button:disabled { background: var(--tinta-tenue); cursor: not-allowed; }
.boton-claro { background: #fff; color: var(--marca); border-color: #c6cfd8; font-weight: 500; }
.boton-claro:hover { background: var(--marca-clara); }
.boton-peligro { background: #fff; color: var(--alerta); border-color: #f3c4c4; }
.boton-peligro:hover { background: var(--alerta-fondo); }
.mini { padding: 4px 10px; font-size: 12px; background: #fff; color: var(--tinta); border: 1px solid var(--linea); }
.mini:hover { background: var(--marca-clara); }
.en-linea { display: inline; }

/* ------------------------------------------------------------ tarjetas de resumen */
.tarjetas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.tarjeta {
  background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 12px 18px; min-width: 120px; display: flex; flex-direction: column; box-shadow: var(--sombra);
}
.tarjeta .numero { font-size: 24px; font-weight: 600; color: var(--marca); line-height: 1.1; }
.tarjeta span:last-child { font-size: 12px; color: var(--tinta-suave); }

/* ------------------------------------------------------------ hoja (como el Excel) */
/* Menu superior: secciones a la izquierda, sesion a la derecha. */
.menu-superior {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 0 16px; background: var(--marca); color: #fff;
}
/* El menu parte de linea si hace falta; la sesion se queda a la derecha. */
.menu-superior nav { display: flex; flex-wrap: wrap; flex: 1 1 auto; min-width: 0; }
.menu-superior nav a {
  color: #fff; text-decoration: none; padding: 11px 14px; font-size: 13.5px; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.menu-superior nav a:hover { background: rgba(255, 255, 255, .12); }
.menu-superior nav a.activa { background: rgba(255, 255, 255, .14); border-bottom-color: var(--rojo); font-weight: 600; }
.menu-superior .sesion { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.menu-superior .sesion a { color: #fff; }

.hoja { max-width: 1240px; margin: 14px auto 40px; padding: 0 14px; }

/* Encabezado impreso: logo | titulo | version y fecha. */
.encabezado-excel {
  display: grid; grid-template-columns: 210px 1fr 190px;
  border: 1px solid #000; background: #fff;
}
.encabezado-excel > div { border-right: 1px solid #000; padding: 8px 10px; }
.encabezado-excel > div:last-child { border-right: none; }
.celda-logo { display: flex; align-items: center; justify-content: center; }
.celda-logo img { max-height: 58px; max-width: 100%; width: auto; }
.celda-titulo {
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-weight: 700; font-size: 15px; letter-spacing: .3px;
}
.celda-version { display: flex; flex-direction: column; justify-content: center; font-weight: 700; font-size: 13px; }
.celda-version div { padding: 2px 0; border-bottom: 1px solid #000; }
.celda-version div:last-child { border-bottom: none; }

/* Fila del boton INICIO y el nombre de la hoja. */
.barra-hoja {
  display: grid; grid-template-columns: 210px 1fr;
  border: 1px solid #000; border-top: none; background: #bfbfbf;
}
.boton-inicio {
  display: flex; align-items: center; justify-content: center;
  margin: 8px 20px; padding: 8px 0; border-radius: 6px;
  background: var(--rojo); color: #fff; font-weight: 700; letter-spacing: 1px;
  text-decoration: none; font-size: 15px; box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.boton-inicio:hover { background: var(--rojo-oscuro); }

/* Boton Volver del visor: mismo color que el resto. */
.boton-volver {
  background: var(--rojo); color: #fff; text-decoration: none; font-weight: 700;
  padding: 6px 18px; border-radius: 6px; font-size: 13px; white-space: nowrap;
}
.boton-volver:hover { background: var(--rojo-oscuro); }
.boton-inicio.invisible { visibility: hidden; }
.nombre-hoja {
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: .3px; padding: 10px;
}

.nota-hoja { margin: 6px 0; font-size: 12px; font-weight: 700; }

/* ------------------------------------------------------------ diagrama de inicio */
.diagrama { position: relative; padding: 26px 0 40px; }

/* ------------------------------------------------------------ portada
   Fondo de la marca: degradado oscuro con el trama de puntos de Century.
   Va en CSS y no como imagen: se ve nitido en cualquier pantalla y no hay
   un archivo mas que mantener al migrar el sistema a otro servidor. */
body.portada, body.pantalla-login { background: #170a0c; }
body.portada::before, body.portada::after,
body.pantalla-login::before, body.pantalla-login::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
}
body.portada::before, body.pantalla-login::before {
  background:
    linear-gradient(148deg, #2c1114 0%, #1c0c0e 38%, #4a0f14 62%, #8c1219 82%, #cf1a22 100%);
}
body.portada::after, body.pantalla-login::after {
  background-image: radial-gradient(circle, rgba(255, 130, 138, .30) 1.15px, transparent 1.35px);
  background-size: 13px 13px;
  -webkit-mask-image: linear-gradient(152deg, transparent 18%, #000 78%);
  mask-image: linear-gradient(152deg, transparent 18%, #000 78%);
}

/* Sobre el fondo oscuro, los botones necesitan un borde que los despegue. */
.hoja-portada .boton-rojo {
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .55);
}
.hoja-portada .boton-rojo:hover { border-color: #fff; }

/* El logo, sobre una placa blanca: su tipografia es azul oscuro y sobre el fondo
   oscuro no se leeria. La placa lo destaca y repite la banda blanca del encabezado. */
.marca-portada { display: flex; justify-content: center; margin: 22px 0 6px; }
.marca-portada img {
  width: min(300px, 56%); height: auto; display: block;
  background: #fff; padding: 14px 30px; border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
}
.fila-botones {
  position: relative; display: grid; gap: 16px;
  grid-template-columns: repeat(4, 1fr); margin-bottom: 14px;
}
.fila-botones.segunda { grid-template-columns: repeat(2, 1fr); max-width: 56%; margin: 0 auto 14px; }
.boton-rojo {
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--rojo); color: #fff; text-decoration: none; font-weight: 700;
  font-size: 15px; line-height: 1.25; padding: 20px 14px; min-height: 118px;
  border-radius: 10px; box-shadow: 0 3px 6px rgba(0, 0, 0, .35);
}
.boton-rojo:hover { background: var(--rojo-oscuro); }
.fila-botones.segunda .boton-rojo { min-height: 74px; }

/* ------------------------------------------------------------ retencion */
.tabla.tabla-retencion td { white-space: normal; }
.tabla-retencion .codigo { white-space: nowrap; }
.tabla-retencion .denominacion.nivel-1 { font-weight: 700; text-transform: uppercase; }
.tabla-retencion .denominacion.nivel-2 { padding-left: 22px; font-weight: 600; }
.tabla-retencion .denominacion.nivel-3 { padding-left: 42px; color: var(--tinta-suave); }
.tabla-retencion .procedimiento { min-width: 320px; font-size: 12.5px; color: var(--tinta-suave); }
.marca-si { font-weight: 700; color: var(--marca); }

.tabla td.descripcion-cambio { white-space: normal; min-width: 340px; }

.estado-vacio {
  background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 28px 30px; max-width: 760px; box-shadow: var(--sombra);
}
.estado-vacio h2 { margin-top: 0; }

/* ------------------------------------------------------------ cobertura */
.tarjeta .numero.ok { color: var(--ok); }
.tarjeta .numero.aviso { color: var(--aviso); }
.tarjeta .numero.alerta { color: var(--alerta); }

.barra-cobertura {
  display: flex; height: 14px; border-radius: 7px; overflow: hidden;
  background: var(--linea); margin: 4px 0 14px; box-shadow: var(--sombra);
}
.barra-cobertura .tramo { display: block; height: 100%; width: 0; }
.barra-cobertura .tramo[data-pct="0"] { width: 0%; }
.barra-cobertura .tramo[data-pct="1"] { width: 1%; }
.barra-cobertura .tramo[data-pct="2"] { width: 2%; }
.barra-cobertura .tramo[data-pct="3"] { width: 3%; }
.barra-cobertura .tramo[data-pct="4"] { width: 4%; }
.barra-cobertura .tramo[data-pct="5"] { width: 5%; }
.barra-cobertura .tramo[data-pct="6"] { width: 6%; }
.barra-cobertura .tramo[data-pct="7"] { width: 7%; }
.barra-cobertura .tramo[data-pct="8"] { width: 8%; }
.barra-cobertura .tramo[data-pct="9"] { width: 9%; }
.barra-cobertura .tramo[data-pct="10"] { width: 10%; }
.barra-cobertura .tramo[data-pct="11"] { width: 11%; }
.barra-cobertura .tramo[data-pct="12"] { width: 12%; }
.barra-cobertura .tramo[data-pct="13"] { width: 13%; }
.barra-cobertura .tramo[data-pct="14"] { width: 14%; }
.barra-cobertura .tramo[data-pct="15"] { width: 15%; }
.barra-cobertura .tramo[data-pct="16"] { width: 16%; }
.barra-cobertura .tramo[data-pct="17"] { width: 17%; }
.barra-cobertura .tramo[data-pct="18"] { width: 18%; }
.barra-cobertura .tramo[data-pct="19"] { width: 19%; }
.barra-cobertura .tramo[data-pct="20"] { width: 20%; }
.barra-cobertura .tramo[data-pct="21"] { width: 21%; }
.barra-cobertura .tramo[data-pct="22"] { width: 22%; }
.barra-cobertura .tramo[data-pct="23"] { width: 23%; }
.barra-cobertura .tramo[data-pct="24"] { width: 24%; }
.barra-cobertura .tramo[data-pct="25"] { width: 25%; }
.barra-cobertura .tramo[data-pct="26"] { width: 26%; }
.barra-cobertura .tramo[data-pct="27"] { width: 27%; }
.barra-cobertura .tramo[data-pct="28"] { width: 28%; }
.barra-cobertura .tramo[data-pct="29"] { width: 29%; }
.barra-cobertura .tramo[data-pct="30"] { width: 30%; }
.barra-cobertura .tramo[data-pct="31"] { width: 31%; }
.barra-cobertura .tramo[data-pct="32"] { width: 32%; }
.barra-cobertura .tramo[data-pct="33"] { width: 33%; }
.barra-cobertura .tramo[data-pct="34"] { width: 34%; }
.barra-cobertura .tramo[data-pct="35"] { width: 35%; }
.barra-cobertura .tramo[data-pct="36"] { width: 36%; }
.barra-cobertura .tramo[data-pct="37"] { width: 37%; }
.barra-cobertura .tramo[data-pct="38"] { width: 38%; }
.barra-cobertura .tramo[data-pct="39"] { width: 39%; }
.barra-cobertura .tramo[data-pct="40"] { width: 40%; }
.barra-cobertura .tramo[data-pct="41"] { width: 41%; }
.barra-cobertura .tramo[data-pct="42"] { width: 42%; }
.barra-cobertura .tramo[data-pct="43"] { width: 43%; }
.barra-cobertura .tramo[data-pct="44"] { width: 44%; }
.barra-cobertura .tramo[data-pct="45"] { width: 45%; }
.barra-cobertura .tramo[data-pct="46"] { width: 46%; }
.barra-cobertura .tramo[data-pct="47"] { width: 47%; }
.barra-cobertura .tramo[data-pct="48"] { width: 48%; }
.barra-cobertura .tramo[data-pct="49"] { width: 49%; }
.barra-cobertura .tramo[data-pct="50"] { width: 50%; }
.barra-cobertura .tramo[data-pct="51"] { width: 51%; }
.barra-cobertura .tramo[data-pct="52"] { width: 52%; }
.barra-cobertura .tramo[data-pct="53"] { width: 53%; }
.barra-cobertura .tramo[data-pct="54"] { width: 54%; }
.barra-cobertura .tramo[data-pct="55"] { width: 55%; }
.barra-cobertura .tramo[data-pct="56"] { width: 56%; }
.barra-cobertura .tramo[data-pct="57"] { width: 57%; }
.barra-cobertura .tramo[data-pct="58"] { width: 58%; }
.barra-cobertura .tramo[data-pct="59"] { width: 59%; }
.barra-cobertura .tramo[data-pct="60"] { width: 60%; }
.barra-cobertura .tramo[data-pct="61"] { width: 61%; }
.barra-cobertura .tramo[data-pct="62"] { width: 62%; }
.barra-cobertura .tramo[data-pct="63"] { width: 63%; }
.barra-cobertura .tramo[data-pct="64"] { width: 64%; }
.barra-cobertura .tramo[data-pct="65"] { width: 65%; }
.barra-cobertura .tramo[data-pct="66"] { width: 66%; }
.barra-cobertura .tramo[data-pct="67"] { width: 67%; }
.barra-cobertura .tramo[data-pct="68"] { width: 68%; }
.barra-cobertura .tramo[data-pct="69"] { width: 69%; }
.barra-cobertura .tramo[data-pct="70"] { width: 70%; }
.barra-cobertura .tramo[data-pct="71"] { width: 71%; }
.barra-cobertura .tramo[data-pct="72"] { width: 72%; }
.barra-cobertura .tramo[data-pct="73"] { width: 73%; }
.barra-cobertura .tramo[data-pct="74"] { width: 74%; }
.barra-cobertura .tramo[data-pct="75"] { width: 75%; }
.barra-cobertura .tramo[data-pct="76"] { width: 76%; }
.barra-cobertura .tramo[data-pct="77"] { width: 77%; }
.barra-cobertura .tramo[data-pct="78"] { width: 78%; }
.barra-cobertura .tramo[data-pct="79"] { width: 79%; }
.barra-cobertura .tramo[data-pct="80"] { width: 80%; }
.barra-cobertura .tramo[data-pct="81"] { width: 81%; }
.barra-cobertura .tramo[data-pct="82"] { width: 82%; }
.barra-cobertura .tramo[data-pct="83"] { width: 83%; }
.barra-cobertura .tramo[data-pct="84"] { width: 84%; }
.barra-cobertura .tramo[data-pct="85"] { width: 85%; }
.barra-cobertura .tramo[data-pct="86"] { width: 86%; }
.barra-cobertura .tramo[data-pct="87"] { width: 87%; }
.barra-cobertura .tramo[data-pct="88"] { width: 88%; }
.barra-cobertura .tramo[data-pct="89"] { width: 89%; }
.barra-cobertura .tramo[data-pct="90"] { width: 90%; }
.barra-cobertura .tramo[data-pct="91"] { width: 91%; }
.barra-cobertura .tramo[data-pct="92"] { width: 92%; }
.barra-cobertura .tramo[data-pct="93"] { width: 93%; }
.barra-cobertura .tramo[data-pct="94"] { width: 94%; }
.barra-cobertura .tramo[data-pct="95"] { width: 95%; }
.barra-cobertura .tramo[data-pct="96"] { width: 96%; }
.barra-cobertura .tramo[data-pct="97"] { width: 97%; }
.barra-cobertura .tramo[data-pct="98"] { width: 98%; }
.barra-cobertura .tramo[data-pct="99"] { width: 99%; }
.barra-cobertura .tramo[data-pct="100"] { width: 100%; }
.barra-cobertura .tramo.completo { background: var(--ok); }
.barra-cobertura .tramo.sin_pdf { background: #e0a326; }
.barra-cobertura .tramo.falta { background: var(--alerta); }

.leyenda {
  display: flex; flex-wrap: wrap; gap: 18px; font-size: 12px;
  color: var(--tinta-suave); margin-bottom: 20px;
}
.leyenda span { display: flex; align-items: center; gap: 6px; }
.punto-leyenda { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.punto-leyenda.completo { background: var(--ok); }
.punto-leyenda.sin_pdf { background: #e0a326; }
.punto-leyenda.falta { background: var(--alerta); }

.grupo-cobertura { margin-bottom: 28px; }
.grupo-cobertura h2 { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.estado-cobertura {
  font-size: 11px; padding: 3px 10px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .3px; white-space: nowrap;
}
.estado-cobertura.completo { background: var(--ok-fondo); color: var(--ok); }
.estado-cobertura.sin_pdf { background: var(--aviso-fondo); color: var(--aviso); }
.estado-cobertura.falta { background: var(--alerta-fondo); color: var(--alerta); }

.insignia.obligatorio { background: #f3e6f7; color: #7a2b8c; }
.codigo { font-family: Consolas, "Courier New", monospace; font-size: 13px; }

/* La fila entera se tiñe apenas, para leer el estado de un vistazo. */
tr.situacion-falta td { background: #fdf6f6; }
tr.situacion-sin_pdf td { background: #fdfaf3; }
.tabla tbody tr.situacion-falta:hover td,
.tabla tbody tr.situacion-sin_pdf:hover td { background: #f3f6f9; }

/* ------------------------------------------------------------ estructura */

/* Anchos fijos para que entren todas las columnas, como en la hoja impresa.
   El texto largo parte de linea en vez de invadir la columna vecina. */
.tabla.tabla-estructura, .tabla.tabla-listado { table-layout: fixed; width: 100%; }
.tabla.tabla-estructura th, .tabla.tabla-estructura td,
.tabla.tabla-listado th, .tabla.tabla-listado td {
  white-space: normal; vertical-align: top; overflow-wrap: break-word;
}

.tabla-estructura th:nth-child(1), .tabla-estructura td:nth-child(1) { width: 52px; }
.tabla-estructura th:nth-child(3), .tabla-estructura td:nth-child(3) { width: 108px; }
.tabla-estructura th:nth-child(4), .tabla-estructura td:nth-child(4) { width: 92px; }
.tabla-estructura th:nth-child(5), .tabla-estructura td:nth-child(5) { width: 190px; }
.tabla-estructura th:nth-child(6), .tabla-estructura td:nth-child(6) { width: 58px; }
.tabla-estructura th:nth-child(7), .tabla-estructura td:nth-child(7) { width: 190px; }

.tabla-listado th:nth-child(2), .tabla-listado td:nth-child(2) { width: 108px; }
.tabla-listado th:nth-child(3), .tabla-listado td:nth-child(3) { width: 92px; }
.tabla-listado th:nth-child(4), .tabla-listado td:nth-child(4) { width: 190px; }
.tabla-listado th:nth-child(5), .tabla-listado td:nth-child(5) { width: 58px; }
.tabla-listado th:nth-child(6), .tabla-listado td:nth-child(6) { width: 195px; }

/* Listado maestro de registros: siete columnas, todas visibles sin desbordar. */
.tabla.tabla-registros { table-layout: fixed; width: 100%; }
.tabla.tabla-registros th, .tabla.tabla-registros td {
  white-space: normal; vertical-align: top; overflow-wrap: break-word; font-size: 12.5px;
}
.tabla-registros th:nth-child(1), .tabla-registros td:nth-child(1) { width: 23%; }
.tabla-registros th:nth-child(2), .tabla-registros td:nth-child(2) { width: 19%; }
.tabla-registros th:nth-child(3), .tabla-registros td:nth-child(3) { width: 13%; }
.tabla-registros th:nth-child(4), .tabla-registros td:nth-child(4) { width: 17%; }
.tabla-registros th:nth-child(5), .tabla-registros td:nth-child(5) { width: 10%; }
.tabla-registros th:nth-child(6), .tabla-registros td:nth-child(6) { width: 9%; }
.tabla-registros th:nth-child(7), .tabla-registros td:nth-child(7) { width: 9%; }

.tabla-estructura .num-capitulo { font-weight: 700; text-align: center; }
.titulo-doc a { text-decoration: underline; }
.sin-documento { color: #6b6b6b; }

/* Boton "+" para subir el documento que le falta a un renglon. */
.subir-mini {
  display: inline-block; margin-left: 8px; width: 18px; height: 18px; line-height: 16px;
  text-align: center; border: 1px solid #b9c0c7; border-radius: 4px;
  color: #c00000; text-decoration: none; font-weight: 700; background: #fff;
}
.subir-mini:hover { background: #c00000; color: #fff; border-color: #c00000; }

.acciones-hoja { margin: 8px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Enlace discreto para corregir una fila de la hoja. */
.editar-mini {
  font-size: 11px; color: var(--tinta-suave); text-decoration: none; margin-left: 8px;
  border: 1px solid var(--linea); border-radius: 4px; padding: 1px 7px; white-space: nowrap;
}
.editar-mini:hover { background: var(--marca-clara); color: var(--marca); }

/* Un cambio registrado por el sistema, no heredado de la hoja. */
.cambio-nuevo td { background: #f4f9f4; }

.casilla-campo { flex-direction: row; align-items: center; gap: 8px; }
.casilla-campo input { width: auto; }

/* Banda gris de capitulo, como las filas de seccion del Excel. */
.tabla-estructura .fila-seccion td {
  background: #e9edf1; font-weight: 700; text-transform: uppercase;
  font-size: 13px; letter-spacing: .4px; border-top: 1px solid #ccd5dd;
}
.tabla-estructura .fila-seccion .num-capitulo { color: var(--tinta); }
.tabla-estructura tbody tr.fila-seccion:hover td { background: #e9edf1; }

.tabla-estructura .fila-pendiente .titulo-doc { color: var(--tinta-suave); }

/* Enlace discreto a la ficha, para no competir con el titulo. */
.titulo-doc a.sin-archivo { color: var(--tinta-suave); text-decoration: underline dotted; }


/* ------------------------------------------------------------ tablas (retícula, como la hoja) */
.tabla-scroll { overflow-x: auto; background: #fff; border: 1px solid #000; border-top: none; }
.tabla { border-collapse: collapse; width: 100%; font-size: 13px; }
.tabla th, .tabla td {
  padding: 5px 8px; text-align: left; border: 1px solid #b9c0c7; white-space: nowrap;
}
.tabla th {
  background: #d9d9d9; font-size: 12px; font-weight: 700; color: #000;
  text-align: center; border-color: #000;
}
.tabla tbody tr:hover td { background: #eef3f8; }
.tabla a { color: var(--marca); text-decoration: underline; }
.tabla a:visited { color: var(--marca); }
.tabla a:hover { color: var(--rojo); }
.tabla tr.inactiva td { opacity: .55; }
.centro { text-align: center; }
.acciones-fila { display: flex; gap: 6px; justify-content: center; }

.insignia { font-size: 11px; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .3px; }
.insignia.vigente { background: var(--ok-fondo); color: var(--ok); }
.insignia.borrador { background: var(--aviso-fondo); color: var(--aviso); }
.insignia.obsoleto { background: #f1f3f5; color: #6d7782; }
.insignia.restringido { background: var(--alerta-fondo); color: var(--alerta); }
.punto { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.accion { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: #f0f3f6; }
.accion.rechazado { background: var(--alerta-fondo); color: var(--alerta); }

.paginacion { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 16px 0; font-size: 14px; }
.paginacion .inactivo { color: var(--tinta-tenue); }

/* ------------------------------------------------------------ formularios */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filtros input { width: auto; }
.filtros select { width: auto; }

code {
  background: #eef2f6; padding: 1px 6px; border-radius: 4px;
  font-family: Consolas, "Courier New", monospace; font-size: 12px;
}

.formulario {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px;
  background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 20px; box-shadow: var(--sombra);
}
.formulario.estrecho { max-width: 460px; grid-template-columns: 1fr; }
.formulario .ancho { grid-column: 1 / -1; }
.acciones-form { grid-column: 1 / -1; display: flex; gap: 10px; }

.linea-peligro {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: var(--papel); border: 1px solid #f3c4c4; border-radius: var(--radio); padding: 14px 18px;
}
.linea-peligro .ayuda { margin: 0; }
.lista-roles { color: var(--tinta-suave); font-size: 14px; }

/* ------------------------------------------------------------ ficha */
.encabezado-doc {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  align-items: flex-start; margin-bottom: 18px;
}
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.ficha {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; margin: 0;
  background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio);
  overflow: hidden; box-shadow: var(--sombra);
}
.ficha > div { padding: 10px 14px; border-bottom: 1px solid var(--linea); border-right: 1px solid var(--linea); }
.ficha dt { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--tinta-suave); }
.ficha dd { margin: 3px 0 0; font-size: 14px; }

/* ------------------------------------------------------------ login y errores */
.pantalla-login {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.tarjeta-login {
  background: var(--papel); padding: 32px; border-radius: 10px; width: 340px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25); display: flex; flex-direction: column; gap: 14px;
}
.tarjeta-login .logo { display: block; width: 190px; margin: 0 auto 2px; }
.tarjeta-login h1 { text-align: center; margin: 0; color: var(--marca); letter-spacing: 1px; font-size: 22px; }
.tarjeta-login .sub { text-align: center; margin: -10px 0 6px; font-size: 12px; color: var(--tinta-suave); }

.pantalla-simple .contenido { max-width: 560px; }
.pagina-error { text-align: center; padding: 40px 0; }
.codigo-error { font-size: 56px; font-weight: 700; color: var(--marca); margin: 0; line-height: 1; }

/* ------------------------------------------------------------ visor */
.pantalla-visor { height: 100vh; display: flex; flex-direction: column; background: #2b3540; overflow: hidden; }
.barra-visor {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--marca); color: #fff; font-size: 14px;
}
.barra-visor .izquierda { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
/* El boton INICIO del visor es el mismo de las hojas, sin el margen de la banda gris. */
.barra-visor .meta { color: rgba(255, 255, 255, .8); }
.ficha-visor { color: #fff; text-decoration: underline; }
.marco-visor { position: relative; flex: 1; min-height: 0; }
.lienzo { width: 100%; height: 100%; border: 0; background: #3a4552; }
.lienzo.imagen { overflow: auto; display: flex; justify-content: center; padding: 20px; }
.lienzo.imagen img { max-width: 100%; height: auto; background: #fff; }
.lienzo.aviso {
  color: #dbe3ea; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; padding: 40px; gap: 4px;
}
.marca-agua {
  position: absolute; inset: 0; pointer-events: none; display: flex;
  align-items: center; justify-content: center; font-size: 30px;
  color: rgba(255, 255, 255, .16); transform: rotate(-24deg); letter-spacing: 2px;
  text-shadow: 0 0 8px rgba(0, 0, 0, .25); user-select: none;
}

/* Bloqueo de impresion: el navegador no imprime contenido. */
/* Nadie imprime el sistema salvo el administrador: la plantilla marca su cuerpo con
   .puede-imprimir. El visor de documentos no se imprime nunca, ni siquiera el admin. */
@media print {
  body { display: none !important; }
  body.puede-imprimir { display: block !important; }
  body.puede-imprimir.pantalla-visor { display: none !important; }
  body.puede-imprimir .menu-superior,
  body.puede-imprimir .acciones-hoja,
  body.puede-imprimir .buscador { display: none !important; }
  html { background: #fff; }
}

/* Aviso flotante del visor. */
.aviso-visor {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 9999;
  background: var(--rojo); color: #fff; padding: 10px 18px; border-radius: 6px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}

/* ------------------------------------------------------------ pantallas angostas */
/* ------------------------------------------------------------ pantallas estrechas
   El encabezado y la barra de hoja llevaban columnas fijas de 210 px fuera de
   cualquier contenedor con desplazamiento: en un telefono la pagina entera se
   desbordaba de lado y el nombre de la hoja quedaba cortado. */
@media (max-width: 720px) {
  .encabezado-excel { grid-template-columns: 1fr; }
  .encabezado-excel > div { border-right: none; border-bottom: 1px solid #000; }
  .encabezado-excel > div:last-child { border-bottom: none; }
  .celda-version { flex-direction: row; flex-wrap: wrap; gap: 0 14px; }
  .celda-version div { border-bottom: none; }

  .barra-hoja { grid-template-columns: 1fr; }
  .boton-inicio { margin: 8px 14px; }
  .nombre-hoja { padding-bottom: 8px; }

  .menu-superior { flex-wrap: wrap; }
  .menu-superior nav { order: 2; width: 100%; }
  .menu-superior .sesion { order: 1; width: 100%; justify-content: flex-end; padding: 6px 0; }

  .fila-botones, .fila-botones.segunda { grid-template-columns: 1fr; max-width: none; margin-left: 0; }
  .boton-rojo, .fila-botones.segunda .boton-rojo { min-height: 64px; font-size: 14px; }
  .marca-portada img { width: min(240px, 80%); }

  .encabezado-doc { flex-direction: column; }
  .tarjeta-login { width: min(340px, calc(100vw - 32px)); }
  .buscador input { max-width: none; }
}

/* ------------------------------------------------------------ buscador de la hoja */
.buscador {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 10px 0; padding: 8px 12px;
  background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio);
}
.buscador label { font-size: 12px; font-weight: 700; color: var(--tinta-suave); text-transform: uppercase; letter-spacing: .4px; }
.buscador input {
  flex: 1 1 260px; min-width: 200px; max-width: 460px;
  padding: 7px 10px; font: inherit; font-size: 14px;
  border: 1px solid var(--linea); border-radius: 5px; background: #fff;
}
.buscador input:focus { outline: 2px solid var(--marca); outline-offset: 1px; }
.buscador .conteo { font-size: 12px; color: var(--tinta-suave); white-space: nowrap; }
.limpiar-busqueda {
  font-size: 12px; padding: 5px 12px; cursor: pointer;
  background: #fff; color: var(--tinta); border: 1px solid var(--linea); border-radius: 5px;
}
.limpiar-busqueda:hover { background: var(--marca-clara); color: var(--marca); }

/* ------------------------------------------------------------ carga masiva */
.tabla.tabla-carga { table-layout: fixed; width: 100%; }
.tabla-carga th, .tabla-carga td { white-space: normal; word-break: break-word; }
.tabla-carga th:nth-child(1), .tabla-carga td:nth-child(1) { width: 38px; }
.tabla-carga th:nth-child(2), .tabla-carga td:nth-child(2) { width: 32%; }
.tabla-carga th:nth-child(3), .tabla-carga td:nth-child(3) { width: 34%; }
.tabla-carga th:nth-child(4), .tabla-carga td:nth-child(4) { width: 17%; }
.tabla-carga th:nth-child(5), .tabla-carga td:nth-child(5) { width: 96px; }
.tabla-carga .destino { width: 100%; padding: 5px 8px; font: inherit; font-size: 13px;
  border: 1px solid var(--linea); border-radius: 4px; box-sizing: border-box; }
.tabla-carga td { vertical-align: middle; }
.certeza { display: inline-block; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.certeza.alta { background: #e6f4ea; color: #1e7a37; }
.certeza.media { background: #fdf3e0; color: #95620d; }
.certeza.baja { background: #fdeaea; color: var(--rojo); }
.propuesta-segura td { background: #f6fbf7; }
.propuesta-sin td { background: #fdf7f7; }

/* ------------------------------------------------------------ buscador general */
.tabla-buscar .codigo { white-space: nowrap; font-family: Consolas, monospace; font-size: 12px; }
.tabla-buscar td { vertical-align: top; }
.filtros { flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filtros label.en-linea {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  font-size: 11.5px; color: var(--tinta-suave); text-transform: uppercase; letter-spacing: .3px;
}
.filtros label.en-linea input,
.filtros label.en-linea select { font-size: 13.5px; padding: 6px 9px; min-height: 0; }
.filtros label.en-linea input[type="search"] { width: 240px; }
.filtros .casilla-campo {
  flex-direction: row; align-items: center; gap: 7px; font-size: 13px;
  text-transform: none; letter-spacing: 0; color: var(--tinta); align-self: center;
}
.filtros .casilla-campo input { width: auto; }

/* Boton discreto para eliminar una fila, al lado de "editar". */
.eliminar-mini {
  font-size: 11px; color: var(--rojo); background: none; cursor: pointer; margin-left: 4px;
  border: 1px solid #e4b6b6; border-radius: 4px; padding: 1px 7px; white-space: nowrap;
}
.eliminar-mini:hover { background: #fdeaea; }
