/* PRECIA · estilos. Marca: azul noche #0A1438, azul #1A92B4 (texto #0E6F8A), turquesa #18D6D4, verde #9BE339; títulos Montserrat 800, texto Inter.
   La marca blanca cambia --pri, --sec, --menu y --acento desde la configuración de cada empresa. Vista para computador, tablet y celular. */
:root {
  --pri: #0A1438; --sec: #1A92B4; --sec-texto: #0E6F8A; --menu: #0A1438; --acento: #18D6D4; --verde: #9BE339;
  --fondo: #f3f6fa; --tarjeta: #ffffff; --texto: #0f172a; --suave: #64748b; --borde: #e2e8f0; --peligro: #dc2626; --aviso: #d97706; --ok: #16a34a;
  --radio: 14px; --sombra: 0 6px 24px rgba(10, 20, 56, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Inter, 'Segoe UI', system-ui, sans-serif; background: var(--fondo); color: var(--texto); font-size: 15px; line-height: 1.5; overflow-x: hidden; }
h1, h2, h3, .titulo { font-family: Montserrat, 'Segoe UI', sans-serif; font-weight: 800; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--sec-texto); }
button, input, select, textarea { font: inherit; }
.oculto { display: none !important; }

/* ---------- botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer; font-weight: 600;
  background: var(--sec); color: #fff; min-height: 42px; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sec { background: #e6f4f8; color: var(--sec-texto); }
.btn.claro { background: #fff; color: var(--texto); border: 1px solid var(--borde); }
.btn.peligro { background: var(--peligro); }
.btn.verde { background: var(--verde); color: var(--pri); }
.btn.mini { min-height: 32px; padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.campo label { font-size: .82rem; font-weight: 600; color: var(--suave); }
.campo input, .campo select, .campo textarea, input.tb, select.tb { border: 1px solid var(--borde); border-radius: 10px; padding: 10px 12px; background: #fff; color: var(--texto); width: 100%; min-height: 42px; }
.campo textarea { min-height: 90px; resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--acento); border-color: transparent; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- ingreso ---------- */
.ingreso { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--acento) 35%, transparent), transparent 45%), radial-gradient(circle at 90% 95%, color-mix(in srgb, var(--verde) 25%, transparent), transparent 45%), var(--pri); }
.caja-ingreso { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); overflow: hidden; }
.caja-ingreso .cabeza { padding: 26px 24px 8px; text-align: center; }
.caja-ingreso .cabeza img { max-width: 220px; max-height: 80px; object-fit: contain; }
.caja-ingreso .cuerpo { padding: 12px 24px 24px; }
.caja-ingreso .pie { padding: 12px; text-align: center; font-size: .78rem; color: var(--suave); border-top: 1px solid var(--borde); }
.marca-texto { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 1.9rem; color: var(--pri); letter-spacing: -.02em; }
.subtitulo { color: var(--suave); font-size: .9rem; }
.franja { height: 6px; background: linear-gradient(90deg, var(--pri), var(--sec) 40%, var(--acento) 70%, var(--verde)); }

/* ---------- estructura ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: linear-gradient(to right, var(--menu) 250px, var(--fondo) 250px); }
.menu { background: var(--menu); color: #dbe7f3; padding: 16px 12px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.menu .logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; }
.menu .logo img { max-width: 150px; max-height: 44px; object-fit: contain; }
.menu .logo b { font-family: Montserrat, sans-serif; font-size: 1.35rem; }
.menu a { display: flex; align-items: center; gap: 10px; color: #dbe7f3; text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 500; }
.menu a:hover { background: rgba(255, 255, 255, .07); }
.menu a.activo { background: color-mix(in srgb, var(--acento) 22%, transparent); color: #fff; box-shadow: inset 3px 0 0 var(--acento); }
.menu .sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 12px 4px; }
.menu .pie-menu { margin-top: auto; font-size: .75rem; opacity: .7; padding: 12px; }
.principal { min-width: 0; display: flex; flex-direction: column; }
.barra { display: flex; align-items: center; gap: 12px; padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--borde); position: sticky; top: 0; z-index: 20; }
.barra .titulo-pagina { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra .usuario { font-size: .85rem; color: var(--suave); text-align: right; }
.hamburguesa { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--pri); }
.contenido { padding: 22px; max-width: 1400px; width: 100%; }
.etiqueta-pruebas { background: #fef3c7; color: #92400e; font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 999px; letter-spacing: .05em; }

/* ---------- tarjetas ---------- */
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px; margin-bottom: 16px; min-width: 0; }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); border-top: 4px solid var(--acento); }
.kpi .v { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 1.6rem; color: var(--pri); }
.kpi .t { color: var(--suave); font-size: .82rem; }
.modulo { background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.modulo .ico { font-size: 1.6rem; }
.modulo p { margin: 0; color: var(--suave); font-size: .88rem; flex: 1; }

/* ---------- pestañas ---------- */
.pestanas { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--borde); margin-bottom: 16px; scrollbar-width: thin; }
.pestanas button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--suave); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.pestanas button.activa { color: var(--pri); border-bottom-color: var(--acento); }

/* ---------- tablas (se deslizan dentro de su caja) ---------- */
.tabla-caja { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--borde); border-radius: 12px; background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th { background: #f1f5f9; text-align: left; padding: 9px 10px; font-weight: 700; color: #334155; position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 8px 10px; border-top: 1px solid var(--borde); vertical-align: top; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr:hover td { background: #f8fbff; }
table.t input.tb, table.t select.tb { min-height: 34px; padding: 6px 8px; border-radius: 8px; min-width: 70px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #e2e8f0; color: #334155; white-space: nowrap; }
.chip.BORRADOR { background: #f1f5f9; } .chip.PUBLICADA, .chip.VIGENTE, .chip.ACTIVA, .chip.ABIERTA, .chip.FIRMADA { background: #dcfce7; color: #166534; }
.chip.CERRADA, .chip.EN_APROBACION, .chip.EN_FIRMAS, .chip.PENDIENTE { background: #fef3c7; color: #92400e; }
.chip.EN_EVALUACION { background: #e0f2fe; color: #075985; } .chip.ADJUDICADA { background: var(--verde); color: var(--pri); }
.chip.DESIERTA, .chip.VENCIDO, .chip.REVOCADO, .chip.ERROR { background: #fee2e2; color: #991b1b; }
.chip.SELLADA { background: var(--pri); color: #fff; }
.atipico { background: #fee2e2 !important; color: #991b1b; font-weight: 700; }
.bajo { background: #fef3c7 !important; }
.critica { color: var(--peligro); font-weight: 700; }

/* ---------- avisos, modal, toast ---------- */
.aviso { padding: 12px 14px; border-radius: 12px; background: #e0f2fe; color: #075985; margin-bottom: 14px; font-size: .9rem; }
.aviso.ok { background: #dcfce7; color: #166534; } .aviso.mal { background: #fee2e2; color: #991b1b; } .aviso.alerta { background: #fef3c7; color: #92400e; }
.sello { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: var(--pri); color: #fff; }
.sello .ico { font-size: 2rem; }
.huella { font-family: ui-monospace, Consolas, monospace; font-size: .75rem; word-break: break-all; color: var(--suave); }
.fondo-modal { position: fixed; inset: 0; background: rgba(10, 20, 56, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 720px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); }
.modal.ancho { max-width: 1100px; }
.modal .mc { padding: 16px 20px; border-bottom: 1px solid var(--borde); display: flex; align-items: center; gap: 10px; }
.modal .mc h2 { margin: 0; flex: 1; font-size: 1.1rem; }
.modal .mb { padding: 18px 20px; overflow-y: auto; }
.modal .mp { padding: 12px 20px; border-top: 1px solid var(--borde); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.cerrar { background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--suave); line-height: 1; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 520px; }
#toast div { background: var(--pri); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--sombra); font-weight: 600; text-align: center; }
#toast div.mal { background: var(--peligro); } #toast div.ok { background: var(--ok); }
.cargando { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--acento), var(--verde)); z-index: 3000; animation: carga 1.2s infinite; }
@keyframes carga { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.vacio { text-align: center; color: var(--suave); padding: 30px 10px; }
.reloj { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 1.3rem; color: var(--pri); }

/* ---------- gráficas ---------- */
.grafica { width: 100%; overflow-x: auto; background: #fff; border: 1px solid var(--borde); border-radius: 12px; }
.grafica svg { display: block; }
.leyenda { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8rem; color: var(--suave); margin: 8px 0; }
.leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- portal público ---------- */
.portal-cabeza { background: var(--pri); color: #fff; padding: 22px 16px 40px; }
.portal-cabeza .dentro { max-width: 1200px; margin: 0 auto; }
.portal-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.portal-nav img { height: 44px; }
.portal-nav .esp { flex: 1; }
.portal-cabeza h1 { font-size: 2rem; color: #fff; max-width: 760px; }
.buscador { max-width: 1200px; margin: -26px auto 0; padding: 0 16px; }
.buscador .tarjeta { display: grid; grid-template-columns: 2fr repeat(4, 1fr) auto; gap: 10px; align-items: end; }
.lista-portal { max-width: 1200px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.lic { background: #fff; border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px; display: flex; flex-direction: column; gap: 8px; border-left: 5px solid var(--acento); }
.lic .meta { font-size: .82rem; color: var(--suave); display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* ---------- tablet ---------- */
@media (max-width: 1024px) {
  .app { grid-template-columns: 210px minmax(0, 1fr); }
  .buscador .tarjeta { grid-template-columns: 1fr 1fr 1fr; }
}
/* ---------- celular ---------- */
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .menu { position: fixed; left: 0; top: 0; bottom: 0; width: 82%; max-width: 300px; z-index: 900; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .menu.abierto { transform: none; }
  .hamburguesa { display: block; }
  .barra { padding: 10px 14px; }
  .barra .usuario { display: none; }
  .contenido { padding: 14px; }
  .tarjeta { padding: 14px; }
  .fondo-modal { align-items: flex-end; padding: 0; }
  .modal, .modal.ancho { max-width: 100%; border-radius: 18px 18px 0 0; max-height: 94vh; }
  .buscador .tarjeta { grid-template-columns: 1fr; }
  .portal-cabeza h1 { font-size: 1.5rem; }
  .rejilla { grid-template-columns: 1fr; }
  .kpi .v { font-size: 1.3rem; }
  .acciones .btn { flex: 1 1 auto; }
  .app { background: var(--fondo); }
  /* tablas de captura en celular: cada fila es una tarjeta */
  table.movil, table.movil tbody, table.movil tr, table.movil td { display: block; width: 100%; }
  table.movil tr:first-child { display: none; }
  table.movil tr { border-top: 1px solid var(--borde); padding: 8px 0; }
  table.movil td { border: 0; padding: 3px 12px; text-align: left !important; }
  table.movil td[data-l]::before { content: attr(data-l) ': '; font-weight: 600; color: var(--suave); }
  table.movil input.tb { width: 100% !important; }
}

/* botón flotante del Centro de solicitudes (como NEXSST) */
.btn-ayuda { position: fixed; right: 18px; bottom: 18px; width: 52px; height: 52px; border-radius: 50%; background: var(--acento); color: var(--pri); font: 800 1.5rem Montserrat, sans-serif; display: flex; align-items: center; justify-content: center; text-decoration: none; box-shadow: 0 8px 24px rgba(10,20,56,.3); z-index: 800; }
@media (max-width: 760px) { .btn-ayuda { right: 12px; bottom: 12px; width: 46px; height: 46px; } }
