@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800&display=swap');

:root {
  --navy: #10395c;
  --navy-oscuro: #0b2b46;
  --teal: #14b8a6;
  --gris-fondo: #eef2f5;
  --borde: #dfe6ec;
  --tinta: #1d2b36;
  --tinta-suave: #5b6b78;
  /* Paleta categorica (validada) para municipios, orden fijo */
  --serie-1: #2a78d6;
  --serie-2: #4a3aa7;
  --serie-3: #e87ba4;
  --serie-4: #eda100;
  --serie-5: #1baf7a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  background: var(--gris-fondo);
  color: var(--tinta);
  font-size: 14px;
}
h1, h2, h3 {
  font-family: "Poppins", "Inter", "Segoe UI", system-ui, sans-serif;
  font-weight: 700; letter-spacing: -.01em;
}

/* ---------- Barra superior ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; z-index: 20;
}
.topbar .marca { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.topbar .marca .camion { font-size: 24px; }
.topbar .usuario { margin-left: auto; display: flex; align-items: center; gap: 14px; font-weight: 600; }
.topbar .campana { cursor: pointer; opacity: .85; }
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--teal); display: grid; place-items: center; font-weight: 700;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; top: 56px; left: 0; bottom: 0; width: 250px;
  background: #fff; border-right: 1px solid var(--borde);
  overflow-y: auto; padding: 14px 0; z-index: 10;
  display: flex; flex-direction: column;
}
.sidebar .buscar { margin: 0 16px 14px; }

/* Marca Novasoftware */
.marca-nova {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 16px 14px; margin-bottom: 6px;
  border-bottom: 1px solid var(--borde);
}
.marca-nova .nova-txt { font-size: 18px; letter-spacing: -.2px; }
.marca-nova img#logo-operacion-sidebar { max-height: 36px; max-width: 168px; object-fit: contain; }
.marca-nova .nova-txt b { color: #12233b; font-weight: 800; }
.marca-nova .nova-txt span { color: #2f6bff; font-weight: 600; }
.logo-nova { display: block; height: 26px; width: auto; object-fit: contain; }
.logo-nova--sidebar { height: 24px; }
.pie-nova {
  margin-top: auto; padding: 14px 16px 4px; font-size: 10.5px; line-height: 1.5;
  color: var(--tinta-suave); border-top: 1px solid var(--borde); text-align: center;
}
.marca-nova--portal {
  border: none; justify-content: center; padding: 0; margin-bottom: 26px;
  background: #fff; border-radius: 12px; padding: 12px 22px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.marca-nova--portal .nova-txt { font-size: 24px; }
.marca-nova--portal .logo-nova { height: 34px; }
.pie-nova--portal {
  margin-top: 40px; border: none; color: #8fa6ba; font-size: 12px;
}
.sidebar .buscar input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--borde);
  border-radius: 6px; font-size: 13px;
}
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; cursor: pointer; color: var(--tinta);
  border-left: 3px solid transparent; user-select: none;
}
.menu-item:hover { background: #f4f8fb; }
.menu-item.activo { background: #eef6fb; border-left-color: var(--teal); font-weight: 600; }
.menu-item .icono {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font-size: 15px; color: #fff; flex-shrink: 0;
}

/* ---------- Contenido ---------- */
.contenido { margin: 56px 0 0 250px; padding: 22px 26px; }
.encabezado { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.encabezado h1 { font-size: 22px; color: var(--navy); }
.migas { color: var(--tinta-suave); font-size: 13px; }
.migas b { color: var(--navy); }

.vista { display: none; }
.vista.activa { display: block; }

/* ---------- Panel de reporte (estilo informe embebido) ---------- */
.reporte { display: flex; background: #fff; border: 1px solid var(--borde); border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(16,57,92,.06); }
.panel-filtros {
  width: 230px; flex-shrink: 0; background: var(--navy); color: #fff; padding: 22px 18px;
  display: flex; flex-direction: column; gap: 18px;
}
.panel-filtros h2 { font-size: 22px; font-weight: 700; }
.panel-filtros .logo { font-size: 30px; text-align: center; }
.panel-filtros label { font-size: 12px; opacity: .85; display: block; margin-bottom: 6px; }
.panel-filtros select {
  width: 100%; padding: 7px 10px; border-radius: 6px; border: none; font-size: 13px;
}
.panel-filtros .checks { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.panel-filtros .checks label { display: flex; align-items: center; gap: 8px; margin: 0; opacity: 1; cursor: pointer; }

.cuerpo-reporte { flex: 1; padding: 20px 24px; min-width: 0; }
.cuerpo-reporte h2 { color: var(--navy); font-size: 26px; margin-bottom: 14px; }

.fila-graficas { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tarjeta-grafica {
  border: 2px solid #d3e9f7; border-radius: 10px; padding: 14px;
}
.tarjeta-grafica h3 { font-size: 14px; text-align: center; color: var(--tinta); margin-bottom: 8px; font-weight: 600; }
.tarjeta-grafica .lienzo { position: relative; height: 260px; }

.fila-totales { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; }
.tarjeta-total {
  border: 2px solid #d3e9f7; border-radius: 10px; padding: 16px; text-align: center;
}
.tarjeta-total .titulo { font-size: 16px; color: var(--tinta); }
.tarjeta-total .valor { font-size: 32px; font-weight: 700; color: var(--tinta); font-variant-numeric: tabular-nums; }

.pestanas { display: flex; gap: 4px; margin-top: 18px; border-top: 1px solid var(--borde); padding-top: 10px; }
.pestana {
  padding: 8px 18px; cursor: pointer; font-size: 13px; border-radius: 6px 6px 0 0;
  color: var(--tinta-suave); border: 1px solid transparent;
}
.pestana.activa { color: var(--navy); font-weight: 600; border-color: var(--borde); background: #f6fafc; }

/* ---------- Tablero de Córdoba ---------- */
.pagina-tablero { margin-top: 16px; }
.aviso-tablero {
  margin: 14px 0; padding: 10px 14px; border-radius: 8px;
  background: #fff8e1; border: 1px solid #ffe082; color: #8d6e00; font-size: 13px;
}
.filtros-tablero {
  display: flex; gap: 18px; flex-wrap: wrap; margin: 14px 0 4px;
  padding: 10px 14px; background: #f6fafc; border: 1px solid var(--borde); border-radius: 8px;
}
.filtros-tablero label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px; color: var(--tinta-suave); font-weight: 600;
}
.filtros-tablero select {
  min-width: 180px; padding: 6px 8px; border: 1px solid var(--borde);
  border-radius: 6px; font-size: 13px; color: var(--tinta); background: #fff;
}
.kpis-tablero { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpis-tablero.kpis-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-tablero {
  background: #fff; border: 1px solid var(--borde); border-radius: 10px; padding: 14px 16px;
}
.kpi-tablero .rot { font-size: 12px; color: var(--tinta-suave); }
.kpi-tablero .num {
  font-size: 24px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums;
}

/* ---------- Portada de reportes consolidados ---------- */
.rejilla-modulos {
  display: grid; gap: 18px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.modulo {
  background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 2px 8px rgba(16, 57, 92, .06);
  transition: transform .12s ease, box-shadow .12s ease;
}
.modulo:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16, 57, 92, .14); }
.modulo .cabeza {
  background: var(--navy); padding: 20px; text-align: center;
}
.modulo .cabeza .ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 62px; height: 62px; border-radius: 50%; background: #fff;
  font-size: 30px; line-height: 1;
}
.modulo .cuerpo {
  padding: 16px 18px 18px; text-align: center;
  display: flex; flex-direction: column; flex: 1; gap: 10px;
}
.modulo .cuerpo h3 { color: var(--navy); font-size: 15px; margin: 0; }
.modulo .cuerpo p {
  color: var(--tinta-suave); font-size: 12.5px; line-height: 1.5;
  margin: 0; flex: 1; text-align: left;
}
.modulo .cuerpo .ver { align-self: center; }

.detalle-modulo { margin-top: 4px; }
.volver-portada {
  background: none; border: 1px solid var(--borde); border-radius: 6px;
  color: var(--navy); cursor: pointer; font-size: 13px; padding: 7px 13px;
  margin-bottom: 14px;
}
.volver-portada:hover { background: var(--gris-fondo); }
.fila-tarjetas { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.dato-clave {
  border: 1px solid var(--borde); border-radius: 8px; padding: 12px 18px;
  min-width: 140px;
}
.dato-clave .rot { font-size: 12px; color: var(--tinta-suave); }
.dato-clave .num { font-size: 22px; font-weight: 700; color: var(--navy); }

/* ---------- Vistas de modulo ---------- */
.tarjeta {
  background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(16,57,92,.06);
}
.tarjeta h3 { color: var(--navy); margin-bottom: 12px; font-size: 15px; }
.fila-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.campo label { display: block; font-size: 12px; color: var(--tinta-suave); margin-bottom: 4px; }
.campo input, .campo select {
  padding: 8px 12px; border: 1px solid var(--borde); border-radius: 6px; font-size: 14px;
}
button.primario {
  background: var(--teal); color: #fff; border: none; padding: 9px 20px;
  border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 14px;
}
button.primario:hover { filter: brightness(.94); }

table.datos { width: 100%; border-collapse: collapse; font-size: 13px; }
table.datos th {
  text-align: left; padding: 8px 10px; background: #f2f7fa; color: var(--navy);
  border-bottom: 2px solid var(--borde); white-space: nowrap;
}
table.datos td { padding: 7px 10px; border-bottom: 1px solid #eef2f5; }
table.datos td.num, table.datos th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.datos tfoot td { font-weight: 700; background: #eef4f9; border-top: 2px solid var(--borde); }

/* Matriz Balance Subsidio/Contribucion (estilo SIGAB) */
table.balance-sigab th {
  background: var(--navy); color: #fff; border: 1px solid #0b2b46;
  text-align: center; white-space: nowrap;
}
table.balance-sigab td {
  border: 1px solid var(--borde); padding: 6px 10px;
}
table.balance-sigab tbody tr:nth-child(odd) { background: #f5f9fc; }
table.balance-sigab [data-total] { background: #eef4f9; font-weight: 700; }
table.balance-sigab tfoot td { border: 1px solid #0b2b46; }
.insignia { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.insignia.pagada { background: #e1f5e6; color: #1b5e20; }
.insignia.parcial { background: #fff3d6; color: #8a5a00; }
.insignia.pendiente { background: #fde3e3; color: #b71c1c; }
.mensaje { padding: 12px 14px; border-radius: 8px; margin-top: 10px; font-size: 13px; }
.mensaje.ok { background: #e1f5e6; color: #1b5e20; }
.mensaje.error { background: #fde3e3; color: #b71c1c; }
.par-columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dato-linea { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--borde); }
.dato-linea .etiqueta { color: var(--tinta-suave); }

/* ---------- Portal de seleccion de operacion / login ---------- */
.portal {
  position: fixed; inset: 0; z-index: 100; overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(20, 184, 166, .28), transparent 42%),
    radial-gradient(circle at 88% 12%, rgba(47, 107, 255, .24), transparent 40%),
    radial-gradient(circle at 50% 95%, rgba(20, 184, 166, .16), transparent 50%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-oscuro) 100%);
  background-size: 200% 200%, 200% 200%, 200% 200%, 100% 100%;
  animation: portalGradiente 22s ease-in-out infinite;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 30px;
}
.portal::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 26px 26px;
}
@keyframes portalGradiente {
  0%, 100% { background-position: 0% 0%, 100% 0%, 50% 100%, 0 0; }
  50% { background-position: 30% 25%, 70% 30%, 60% 65%, 0 0; }
}
.portal h1 { color: #fff; font-size: 30px; letter-spacing: 1px; }
.portal p { color: #b8cbdb; margin-top: -18px; }
.portal > * { position: relative; z-index: 1; }
.auth-card {
  background: #fff; border-radius: 16px; padding: 34px 32px 28px;
  width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.auth-card h1 { color: var(--navy); font-size: 21px; letter-spacing: 0; }
.auth-card p { color: var(--tinta-suave); font-size: 13px; margin-top: 8px; }
.form-auth {
  display: flex; flex-direction: column; gap: 12px;
  width: 100%; max-width: 320px; margin: 24px auto 0;
}
.form-auth.oculto { display: none; }
.form-auth input {
  width: 100%; padding: 11px 14px; border-radius: 8px;
  border: 1px solid var(--borde); font-size: 15px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-auth input:focus {
  outline: none; border-color: #2f6bff; box-shadow: 0 0 0 3px rgba(47, 107, 255, .15);
}
.form-auth .boton-auth {
  width: 100%; padding: 11px 14px; border-radius: 8px; border: none;
  background: #2f6bff; color: #fff; font-size: 15px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: filter .12s, transform .08s;
}
.form-auth .boton-auth:hover { filter: brightness(.94); }
.form-auth .boton-auth:active { transform: translateY(1px); }
.form-auth .boton-auth:disabled { opacity: .6; cursor: not-allowed; }
.form-auth .mensaje-auth { font-size: 13px; min-height: 18px; text-align: center; }
.form-auth .mensaje-auth.error { color: #c62828; }
.form-auth .enlace-auth {
  font-size: 13px; color: #2f6bff; text-align: center; text-decoration: none; font-weight: 500;
}
.form-auth .enlace-auth:hover { text-decoration: underline; }
.form-auth .info-auth { margin: 0 0 4px; font-size: 13.5px; color: var(--tinta-suave); text-align: left; }
.portal .operaciones { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.tarjeta-operacion {
  width: 190px; padding: 28px 18px; background: #fff; border-radius: 14px;
  text-align: center; cursor: pointer; user-select: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  transition: transform .15s ease;
}
.tarjeta-operacion:hover { transform: translateY(-6px); }
.tarjeta-operacion .logo-op {
  width: 74px; height: 74px; margin: 0 auto 12px; border-radius: 50%;
  display: grid; place-items: center; font-size: 34px; color: #fff;
}
.tarjeta-operacion .logo-op--img {
  width: 100%; height: 62px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
}
.tarjeta-operacion .logo-op--img img {
  max-width: 100%; max-height: 100%; object-fit: contain;
}
.tarjeta-operacion .nombre { font-weight: 700; color: var(--navy); font-size: 16px; }
.tarjeta-operacion .region { font-size: 12px; color: var(--tinta-suave); margin-top: 3px; }
.topbar .operacion-actual {
  background: var(--teal); padding: 4px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ---------- Hoja de vida (secciones y campos de lectura) ---------- */
details.seccion {
  background: #fff; border: 1px solid var(--borde); border-radius: 8px;
  margin-bottom: 10px; overflow: hidden;
}
details.seccion > summary {
  list-style: none; cursor: pointer; padding: 11px 16px;
  background: #f2f7fa; color: var(--navy); font-weight: 600; font-size: 14px;
  display: flex; justify-content: space-between; align-items: center;
}
details.seccion > summary::after { content: "▾"; color: var(--tinta-suave); }
details.seccion[open] > summary::after { content: "▴"; }
details.seccion .interior { padding: 14px 16px; }

.grilla-campos {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 14px;
}
.campo-lectura label {
  display: block; font-size: 12px; color: var(--tinta); font-weight: 600;
  margin-bottom: 3px;
}
.campo-lectura .valor {
  background: #f1f3f5; border: 1px solid var(--borde); border-radius: 4px;
  padding: 7px 10px; font-size: 13px; color: var(--tinta-suave); min-height: 32px;
}

.tira-pestanas { display: flex; gap: 3px; margin: 14px 0 0; flex-wrap: wrap; }
.tira-pestanas .ficha {
  padding: 9px 16px; font-size: 13px; cursor: pointer; user-select: none;
  background: #dfe9f0; color: var(--navy); border-radius: 6px 6px 0 0;
  border: 1px solid var(--borde); border-bottom: none;
}
.tira-pestanas .ficha.activa { background: #fff; font-weight: 700; }
.panel-ficha {
  background: #fff; border: 1px solid var(--borde); border-radius: 0 8px 8px 8px;
  padding: 16px;
}
.cambio-anterior { color: #b71c1c; font-weight: 600; }
.cambio-actual { color: #1b5e20; font-weight: 600; }

@media (max-width: 1100px) {
  .fila-graficas, .fila-totales, .par-columnas { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .contenido { margin-left: 0; }
}

/* ---------------- Vinculación ---------------- */
.ayuda { color: var(--tinta-suave); font-size: 13px; line-height: 1.6; margin: 4px 0 12px; }
.ayuda code {
  display: inline-block; margin-top: 4px; padding: 6px 8px; border-radius: 6px;
  background: #f2f5f8; border: 1px solid var(--borde);
  font-family: "Consolas", "Courier New", monospace; font-size: 12px; color: var(--tinta);
}
.vinc-estado p { margin: 0 0 8px; }
.campo input[type="file"] {
  padding: 6px 8px; border: 1px dashed var(--borde); border-radius: 8px;
  background: #fafbfc; cursor: pointer;
}
button.secundario {
  padding: 10px 18px; cursor: pointer; border-radius: 8px;
  background: #fff; color: var(--tinta); border: 1px solid var(--borde);
}
button.secundario:hover { background: #f2f5f8; }

/* Boton de accion destructiva (borrar tarifas). Va en rojo a proposito:
   tiene que verse distinto del primario antes de hacer clic, no despues. */
button.peligro {
  background: #c62828; color: #fff; border: none; padding: 9px 20px;
  border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 14px;
}
button.peligro:hover { filter: brightness(.92); }
button.peligro:disabled { background: #d9a0a0; cursor: default; }

/* Consulta de usuarios Quindío: encabezado con botón "Editar datos" a la derecha */
.cq-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
/* Campos en solo lectura (estilo Santander): grises pero legibles */
#usuarios-quindio input:disabled, #usuarios-quindio select:disabled {
  background: #f4f6f8; color: var(--tinta); opacity: 1; cursor: default;
  -webkit-text-fill-color: var(--tinta);
}

/* Barra de progreso de los cargues masivos (vinculacion). El porcentaje es
   real: viene de /vinculacion/progreso, que cuenta filas escritas. */
.progreso { margin-top: 12px; }
.progreso-barra {
  height: 10px; background: #eef2f5; border-radius: 999px; overflow: hidden;
}
.progreso-barra span {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: #1baf7a; transition: width .25s ease;
}
.progreso-barra.indeterminada span { width: 35%; animation: progreso-vaiven 1.1s ease-in-out infinite; }
@keyframes progreso-vaiven {
  0% { margin-left: 0; } 50% { margin-left: 65%; } 100% { margin-left: 0; }
}
.progreso-texto { font-size: 12px; color: var(--tinta-suave); margin-top: 6px; }

/* Fila de una tabla que señala un dato equivocado -- p.ej. un cargue cuyo
   "municipio" quedo siendo el nombre de una hoja de Excel. Se ve ANTES de que
   alguien tenga que saberse de memoria cuales son los municipios validos. */
table.datos tr.fila-alerta > td { background: #fdecea; color: #8a1c12; }
table.datos tr.fila-alerta > td:first-child { box-shadow: inset 3px 0 0 #c0392b; }
