/* Panel Marvix · estilos */
:root {
  --navy: #13233A;
  --acento: #E2892B;
  --acento-osc: #B96A17;
  --fondo: #F5F2EC;
  --superficie: #FFFFFF;
  --superficie-2: #FAF8F4;
  --tinta: #1B2A3F;
  --suave: #5B6878;
  --linea: #E3DED4;
  --ok: #2E7D4F;
  --ok-fondo: #E4F2E9;
  --mal: #B3261E;
  --mal-fondo: #FBE9E7;
  --alerta: #B86E00;
  --alerta-fondo: #FFF1DA;
  --info: #2F6DB5;
  --info-fondo: #E6EFFA;
  --gris-fondo: #EEEBE5;
  --sombra: 0 1px 2px rgba(19, 35, 58, .06), 0 4px 16px rgba(19, 35, 58, .05);
  --radio: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0F1622; --superficie: #172131; --superficie-2: #1C2738; --tinta: #E8ECF2; --suave: #9AA7B8;
    --linea: #2A3749; --ok: #5CC28A; --ok-fondo: #173326; --mal: #F2847B; --mal-fondo: #3A1C1A;
    --alerta: #F0B35A; --alerta-fondo: #3A2C14; --info: #7EB0EE; --info-fondo: #182B45; --gris-fondo: #222E40;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1rem; margin-bottom: .75rem; }
small { color: var(--suave); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }

/* Barra superior */
.barra {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem; background: var(--navy); color: #fff;
}
.marca { display: flex; align-items: center; gap: .55rem; color: #fff; font-weight: 700; white-space: nowrap; }
.marca:hover { text-decoration: none; }
.logo {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--acento); color: var(--navy); font-weight: 800;
}
.menu { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; flex: 1; }
.menu::-webkit-scrollbar { display: none; }
.menu a { color: #C9D3E0; padding: .45rem .75rem; border-radius: 8px; white-space: nowrap; }
.menu a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.menu a.activo { color: #fff; background: rgba(255,255,255,.14); }
.acciones-barra { display: flex; align-items: center; gap: .6rem; }
.acciones-barra .boton-texto { color: #C9D3E0; }
.campana { position: relative; color: #C9D3E0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; }
.campana:hover { background: rgba(255,255,255,.08); }
.campana.con-avisos { color: #fff; }
.globo {
  position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--acento); color: var(--navy); font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
}

.contenido { max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.pie { text-align: center; color: var(--suave); font-size: .8rem; padding: 1rem; }

.titulo-pagina { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.sub { margin: .3rem 0 0; color: var(--suave); }
.miga { margin: 0 0 .2rem; font-size: .85rem; color: var(--suave); }

/* Tarjetas */
.tarjeta {
  background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio);
  padding: 1.1rem 1.2rem; box-shadow: var(--sombra); margin-bottom: 1rem; min-width: 0;
}
.tarjeta.sin-relleno { padding: 0; }
.cabeza-tarjeta { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.vacio { color: var(--suave); margin: .25rem 0; }
.nota { color: var(--suave); font-size: .88rem; margin: .6rem 0 0; }
.mas { margin: .5rem 0 0; font-size: .9rem; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { background: var(--superficie); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1rem 1.1rem; box-shadow: var(--sombra); }
.kpi h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--suave); margin: 0; font-weight: 600; }
.kpi .cifra { font-size: 1.9rem; font-weight: 750; margin: .35rem 0 .2rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .nota { margin-top: .35rem; }
.kpi.destacado { background: var(--navy); border-color: var(--navy); color: #fff; }
.kpi.destacado h2, .kpi.destacado .nota { color: #C9D3E0; }
.avance { height: 8px; border-radius: 4px; background: var(--gris-fondo); overflow: hidden; }
.kpi.destacado .avance { background: rgba(255,255,255,.15); }
.avance span { display: block; height: 100%; background: var(--acento); border-radius: 4px; }
.avance.grande span { background: var(--ok); }

.dos-columnas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dos-columnas > .tarjeta { margin-bottom: 1rem; }
.graficos { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; }
.lienzo { position: relative; height: 240px; }
.lienzo.alto { height: 300px; }

/* Listas de recomendaciones y alarmas */
.lista-rec, .lista-alarmas { list-style: none; margin: 0; padding: 0; }
.lista-rec li, .lista-alarmas li { display: flex; gap: .65rem; padding: .55rem 0; border-top: 1px solid var(--linea); }
.lista-rec li:first-child, .lista-alarmas li:first-child { border-top: 0; padding-top: 0; }
.punto { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: .45rem; background: var(--info); }
.nivel-alta .punto { background: var(--mal); }
.nivel-media .punto { background: var(--acento); }
.lista-alarmas li.vista { opacity: .6; }
.lista-alarmas small { margin-left: .25rem; }

/* Chips */
.chip {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 650;
  background: var(--gris-fondo); color: var(--tinta); white-space: nowrap; vertical-align: middle;
}
.e-preparando { background: var(--alerta-fondo); color: var(--alerta); }
.e-postulada, .e-en_curso { background: var(--info-fondo); color: var(--info); }
.e-en_evaluacion { background: #EFE7FA; color: #6B45A8; }
.e-ganada { background: var(--ok-fondo); color: var(--ok); }
.e-perdida { background: var(--mal-fondo); color: var(--mal); }
.e-desierta, .e-cancelada, .e-descartada { background: var(--gris-fondo); color: var(--suave); }
.c-ca { background: transparent; border: 1px solid var(--linea); color: var(--suave); }
.c-lic { background: transparent; border: 1px solid var(--linea); color: var(--suave); }
.c-priv { background: transparent; border: 1px solid var(--acento); color: var(--acento-osc); }
@media (prefers-color-scheme: dark) { .e-en_evaluacion { background: #2B2140; color: #C3A6F0; } .c-priv { color: var(--acento); } }

/* Barra de probabilidad */
.prob { display: inline-flex; align-items: center; gap: .45rem; }
.prob-barra { display: inline-block; width: 70px; height: 7px; background: var(--gris-fondo); border-radius: 4px; overflow: hidden; }
.prob-barra span { display: block; height: 100%; border-radius: 4px; }
.prob-alta .prob-barra span { background: var(--ok); }
.prob-media .prob-barra span { background: var(--acento); }
.prob-baja .prob-barra span { background: var(--mal); }
.prob-num { font-variant-numeric: tabular-nums; font-size: .88rem; min-width: 2.6em; }
.cifra.grande { font-size: 2.6rem; font-weight: 750; margin: 0 0 .4rem; letter-spacing: -.02em; }
.prob-barra { flex: none; }
.prob-grande .prob { display: flex; }
.prob-grande .prob-barra { flex: 1 1 auto; max-width: 320px; height: 10px; }
.razones { margin: .8rem 0 0; padding-left: 1.1rem; color: var(--suave); }
.razones li { margin: .2rem 0; }

/* Tablas */
.tabla-envoltura { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); font-weight: 650;
  padding: .65rem .75rem; border-bottom: 1px solid var(--linea); white-space: nowrap; background: var(--superficie-2); }
.tabla td { padding: .65rem .75rem; border-bottom: 1px solid var(--linea); vertical-align: top; }
.tabla tbody tr:hover { background: var(--superficie-2); }
.tabla tr.marcada td { background: color-mix(in srgb, var(--acento) 7%, transparent); }
.tabla tfoot td { font-weight: 700; border-bottom: 0; }
.tabla.compacta td, .tabla.compacta th { padding: .4rem .6rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bajo { display: block; margin-top: .2rem; }
.palabras { font-size: .78rem; }
.urgente { color: var(--mal); font-weight: 650; }
.acciones { white-space: nowrap; }
.acciones > * { margin: 0 .25rem .25rem 0; }
.tramos { margin: .3rem 0 0; padding-left: 1rem; font-size: .82rem; color: var(--suave); }
details summary { cursor: pointer; font-size: .8rem; color: var(--info); }

/* Botones */
.boton, .boton-texto, .estrella { font: inherit; cursor: pointer; }
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1rem; border-radius: 9px;
  border: 1px solid var(--acento); background: var(--acento); color: #fff; font-weight: 650; white-space: nowrap;
}
.boton:hover { background: var(--acento-osc); border-color: var(--acento-osc); text-decoration: none; }
.boton.secundario { background: var(--superficie); color: var(--tinta); border-color: var(--linea); }
.boton.secundario:hover { border-color: var(--suave); background: var(--superficie-2); }
.boton.exito { background: var(--ok); border-color: var(--ok); }
.boton.peligro { background: var(--mal); border-color: var(--mal); }
.boton.pequeno { padding: .32rem .65rem; font-size: .85rem; }
.boton.activo { background: var(--navy); border-color: var(--navy); cursor: default; }
.boton-texto { background: none; border: 0; padding: .3rem .2rem; color: var(--info); }
.boton-texto:hover { text-decoration: underline; }
.boton-texto.peligro { color: var(--mal); }
.estrella { background: none; border: 0; font-size: 1.25rem; line-height: 1; color: var(--acento); padding: 0 .2rem; }
.en-linea { display: inline; margin: 0; }
.botones, .botonera { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.botonera { margin-top: .25rem; }
.peligro-zona { text-align: right; }

/* Formularios */
.formulario label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 600; color: var(--tinta); }
.formulario label small { font-weight: 400; }
input, select, textarea {
  font: inherit; color: var(--tinta); background: var(--superficie); border: 1px solid var(--linea); border-radius: 8px;
  padding: .55rem .7rem; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--acento) 55%, transparent); outline-offset: 1px; border-color: var(--acento); }
input[type=radio], input[type=checkbox] { width: auto; accent-color: var(--acento); }
.rejilla { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.1rem; }
.rejilla .completo, .rejilla h2 { grid-column: 1 / -1; }
.rejilla h2 { margin-bottom: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: .88rem; font-weight: 600; margin-bottom: .4rem; padding: 0; }
.opcion { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: .4rem !important; font-weight: 500 !important;
  margin-right: 1rem; padding: .45rem .7rem; border: 1px solid var(--linea); border-radius: 8px; cursor: pointer; }
.opcion:has(input:checked) { border-color: var(--acento); background: color-mix(in srgb, var(--acento) 8%, transparent); }
.casillas { display: flex; flex-wrap: wrap; gap: .4rem; }
.casillas .opcion { margin-right: 0; }
.formulario.en-fila { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-top: .8rem; }
.formulario.en-fila label { flex: 1 1 180px; }
.resultado-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; }
.formulario textarea { margin-bottom: .6rem; }
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filtros input[type=search] { flex: 1 1 240px; width: auto; }
.filtros select { width: auto; flex: 0 1 auto; }
.config .tarjeta { margin-bottom: 1rem; }
.config > .botones { margin-bottom: 1.5rem; }
[hidden] { display: none !important; }

.datos { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1rem; margin: 0; }
.datos dt { color: var(--suave); font-size: .88rem; }
.datos dd { margin: 0; }
.notas { margin-top: .9rem; padding: .7rem .9rem; background: var(--superficie-2); border-radius: 8px; font-size: .92rem; }
.historial { list-style: none; margin: 0; padding: 0; }
.historial li { padding: .45rem 0 .45rem .9rem; border-left: 2px solid var(--linea); position: relative; font-size: .92rem; }
.historial li::before { content: ""; position: absolute; left: -5px; top: .8rem; width: 8px; height: 8px; border-radius: 50%; background: var(--linea); }
.historial li.t-estado::before { background: var(--acento); }
.historial li.t-radar::before { background: var(--info); }
.historial time { color: var(--suave); font-size: .8rem; margin-right: .35rem; }
.tres-datos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.tres-datos > div { background: var(--superficie-2); border-radius: 8px; padding: .7rem .9rem; }
.etiqueta { display: block; font-size: .78rem; color: var(--suave); margin-bottom: .2rem; }

.aviso { padding: .7rem 1rem; border-radius: 9px; margin: 0 0 1rem; background: var(--info-fondo); color: var(--info); }
.aviso.ok { background: var(--ok-fondo); color: var(--ok); }
.aviso.error { background: var(--mal-fondo); color: var(--mal); }
.estado-sync { font-size: .82rem; padding: .3rem .7rem; border-radius: 999px; }
.estado-sync.ok { background: var(--ok-fondo); color: var(--ok); }
.estado-sync.mal { background: var(--mal-fondo); color: var(--mal); }
pre.codigo, pre.token { background: var(--navy); color: #F5F2EC; padding: .8rem 1rem; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

/* Acceso e instalación */
body.acceso { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--navy); }
.caja-acceso { width: 100%; max-width: 380px; background: var(--superficie); border-radius: 16px; padding: 1.8rem; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.caja-acceso.ancha { max-width: 620px; }
.caja-acceso .formulario { display: grid; gap: .9rem; }
.caja-acceso h1 { font-size: 1.3rem; margin: .6rem 0 1rem; }
.marca-acceso { display: flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.05rem; }
.requisitos { list-style: none; padding: 0; margin: 0 0 1rem; }
.requisitos li { padding: .2rem 0; }
.requisitos .si { color: var(--ok); }
.requisitos .no { color: var(--mal); }
.pasos li { margin: .4rem 0; }

/* Pantallas medianas y móviles */
@media (max-width: 1050px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .graficos { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .graficos .ancho { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .barra { flex-wrap: wrap; padding: .55rem 1rem; gap: .5rem; }
  .menu { order: 3; flex-basis: 100%; margin: 0 -.25rem; }
  .acciones-barra { margin-left: auto; }
  .contenido { padding: 1rem 1rem 2.5rem; }
  h1 { font-size: 1.35rem; }
  .kpis { gap: .7rem; }
  .kpi { padding: .85rem; }
  .kpi .cifra { font-size: 1.45rem; }
  .dos-columnas, .graficos, .rejilla, .resultado-forms, .tres-datos { grid-template-columns: minmax(0, 1fr); }
  .lienzo { height: 220px; }
  .filtros select, .filtros input[type=search] { flex: 1 1 100%; width: 100%; }
  .datos { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .datos dd { margin-bottom: .45rem; }
}
