/* Panel EMELIFT AIOS. Lenguaje visual de AI Partner (páginas de ATG): fondo lavanda muy
   claro, tarjetas blancas con sombra suave, eyebrow con punto, acentos azul y violeta.
   Solo tema claro. */
:root {
  --ink: #10131f;
  --bg: #f6f7fd;
  --paper: #ffffff;
  --slate: #4f5570;
  --soft: #626884;
  --line: #e4e8f6;
  --tint: #eef0fd;
  --blue: #2c4bff;
  --blue-2: #9fb0ff;
  --violet: #7a3fd6;
  --magenta: #e97bd6;
  --ok: #0b6e4b; --ok-bg: #e6f5ee; --ok-dot: #19a974;
  --warn: #8a5200; --warn-bg: #fff4e2; --warn-dot: #e0a23a;
  --bad: #c0142f; --bad-bg: #fde8ec; --bad-dot: #e5484d;
  --info: #2c4bff; --info-bg: #eef0fd;
  --shadow: 0 6px 24px rgba(44, 75, 255, .06);
  --sans: "Arimo", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
button, select, input { font: inherit; color: inherit; }
a { color: var(--blue); }
.oculto { display: none !important; }

/* Barra superior */
.barra { position: sticky; top: 0; z-index: 20; background: rgba(246, 247, 253, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.barra .in { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.marca img { height: 34px; width: auto; }
.marca .titulo { display: flex; flex-direction: column; line-height: 1.15; }
.marca .titulo b { font-size: 15px; }
.marca .titulo span { font-size: 12px; color: var(--slate); }
.controles { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--slate); }
.seg button[aria-pressed="true"] { background: linear-gradient(135deg, var(--blue), var(--violet)); color: #fff; }
.seg button:focus-visible, .tabs button:focus-visible, .btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.usuario { font-size: 13px; color: var(--slate); display: flex; align-items: center; gap: 8px; }
.btn { border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 7px 14px; font-weight: 600; cursor: pointer; font-size: 13px; }
.btn.primario { border: 0; color: #fff; background: linear-gradient(135deg, var(--blue), var(--violet)); padding: 12px 22px; font-size: 15px; border-radius: 12px; box-shadow: 0 8px 24px rgba(44, 75, 255, .25); }

/* Contenido */
main { max-width: 1280px; margin: 0 auto; padding: 26px 24px 72px; display: flex; flex-direction: column; gap: 26px; }
.eyebrow { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
h1 { font-size: clamp(24px, 3.2vw, 32px); line-height: 1.15; margin: 6px 0 0; text-wrap: balance; }
h2 { font-size: 18px; margin: 0; text-wrap: balance; }
h3 { font-size: 14px; margin: 0; }
p { margin: 0; }
.muted { color: var(--slate); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

.encabezado { display: flex; flex-direction: column; gap: 4px; }
.encabezado .sub { color: var(--slate); font-size: 14px; }

/* Estado general */
.estado { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 14px; align-items: stretch; }
.estado .resumen { border-radius: 16px; padding: 18px 20px; color: #fff; display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.estado .resumen b { font-size: 22px; line-height: 1.2; }
.estado .resumen span { font-size: 13px; opacity: .92; }
.estado .resumen.ok { background: linear-gradient(135deg, #0f8a5f, #19a974); }
.estado .resumen.aviso { background: linear-gradient(135deg, #b26a00, #e0a23a); }
.estado .resumen.falla { background: linear-gradient(135deg, #b0122b, #e5484d); }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.chips { align-items: start; }
.chip { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); min-width: 0; }
.chip.aviso { border-color: #f3d9a8; } .chip.falla { border-color: #f6c3cc; }
.chip summary { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; list-style: none; }
.chip summary::-webkit-details-marker { display: none; }
.chip summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
.chip-mas { margin: 8px 0 2px 19px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--slate); }
.chip-mas ul { margin: 0; padding-left: 16px; }
.chip-mas b { display: inline; font-size: 12.5px; color: var(--ink); }
.chip-mas .accion { color: var(--ink); }
button.enlace { border: 0; background: none; padding: 0; color: var(--blue); font-weight: 700; cursor: pointer; text-align: left; font-size: 12.5px; }
.punto { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; }
.punto.ok { background: var(--ok-dot); } .punto.aviso { background: var(--warn-dot); } .punto.falla { background: var(--bad-dot); } .punto.info { background: var(--blue-2); }
.chip b { font-size: 13px; display: block; }
.chip span { font-size: 12px; color: var(--slate); }

.revisar { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; }
.revisar-item { background: var(--warn-bg); border: 1px solid #f3d9a8; border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow); }
.revisar-item.falla { background: var(--bad-bg); border-color: #f6c3cc; }
.revisar-item .cab { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.revisar-item .punto { margin-top: 0; align-self: center; }
.revisar-item ul { margin: 0; padding-left: 18px; }

/* Pestañas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--slate); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; }
.tabs button[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.vista { display: flex; flex-direction: column; gap: 24px; }

/* Tarjetas */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card .cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--blue); font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 15px; color: var(--slate); font-weight: 600; }
.kpi .l { font-size: 13px; font-weight: 700; }
.kpi .d { font-size: 12px; color: var(--slate); }
.delta-sube { color: var(--ok); font-weight: 700; }
.delta-baja { color: var(--bad); font-weight: 700; }

.leyenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--slate); }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.c-emelift { background: var(--blue); } .c-aip { background: var(--blue-2); } .c-linea { background: var(--violet); } .c-falla { background: var(--bad-dot); } .c-ok { background: var(--ok-dot); } .c-aviso { background: var(--warn-dot); }

/* Gráficas */
svg.graf { width: 100%; height: auto; display: block; overflow: visible; }
svg text { font-family: var(--sans); fill: var(--slate); font-size: 11px; }
svg .eje { stroke: var(--line); stroke-width: 1; }
svg .rejilla { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.nw { white-space: nowrap; }
.graf-caja { width: 100%; min-width: 0; }
.vacio { color: var(--soft); font-size: 13px; padding: 18px 0; text-align: center; }

/* Tablas */
.tabla { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); font-weight: 700; background: var(--tint); white-space: nowrap; }
th:first-child { border-top-left-radius: 10px; } th:last-child { border-top-right-radius: 10px; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td .quien b { display: block; }
td .quien span { font-size: 12px; color: var(--slate); }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.p-ok { color: var(--ok); background: var(--ok-bg); } .p-aviso { color: var(--warn); background: var(--warn-bg); }
.p-falla { color: var(--bad); background: var(--bad-bg); } .p-info { color: var(--info); background: var(--info-bg); }
.p-gris { color: var(--slate); background: #f0f1f6; }
.etq { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 6px; background: var(--tint); color: var(--ink); margin: 1px 3px 1px 0; white-space: nowrap; }

.aviso-caja { border-radius: 14px; padding: 14px 16px; font-size: 13.5px; border: 1px solid; }
.aviso-caja.aviso { background: var(--warn-bg); border-color: #f3d9a8; }
.aviso-caja.info { background: var(--tint); border-color: #d9defb; }
.aviso-caja.falla { background: var(--bad-bg); border-color: #f6c3cc; }

.lista-senales { display: flex; flex-direction: column; gap: 8px; }
.senal { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.senal div { min-width: 0; }
.senal b { display: block; font-size: 13.5px; }
.senal span { font-size: 12px; color: var(--slate); }

/* Filas que abren el detalle */
tr.clic { cursor: pointer; }
tr.clic:hover td, tr.clic:focus-visible td { background: #f7f8ff; }
tr.clic:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
tr.elegida td { background: var(--tint); }

/* Ficha de una persona */
.ficha { border-color: #cfd6fb; scroll-margin-top: 80px; }
.ficha .cab > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.ficha-acciones { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ficha h3 { margin-bottom: 8px; }
.herrs { margin-top: 10px; }
.mejora { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.mejora .cab { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.mejora b { font-size: 13.5px; }
details.mas summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--blue); }
details.mas[open] summary { margin-bottom: 8px; }

/* Uso por semana */
table.semanas td.celda-sem { padding: 6px 8px; }
.nivel { display: inline-block; min-width: 38px; text-align: center; padding: 4px 8px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.nivel.n0 { color: var(--soft); }
.nivel.n1 { background: #eef0fd; color: var(--ink); }
.nivel.n2 { background: #cdd5ff; color: var(--ink); }
.nivel.n3 { background: #7f93ff; color: #fff; }
.nivel.n4 { background: var(--blue); color: #fff; }

/* Equipo: etapas */
.etapas { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.col-etapa { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); min-width: 0; }
.col-etapa .cab { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.tarjeta-p { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.tarjeta-p:hover { border-color: var(--blue-2); }
.tarjeta-p:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.tarjeta-p b { font-size: 13px; }
.tarjeta-p span { font-size: 11.5px; color: var(--slate); }
td.siguiente { min-width: 240px; }
td .paso + .nw { display: inline-block; }
.paso { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; margin-right: 6px; }
.paso.si { background: var(--ok-bg); color: var(--ok); }
.paso.no { background: #f0f1f6; color: var(--soft); }

/* Secciones y costos */
h2.seccion { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); margin: 8px 0 -8px; }
.card .kpis .kpi { box-shadow: none; background: var(--bg); }
.kpis.compactos { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpis-grandes .kpi .v { font-size: 32px; }
svg.barra-total { width: 100%; height: 24px; display: block; border-radius: 8px; overflow: hidden; }
svg.muestra { display: inline-block; margin-right: 7px; vertical-align: -1px; }
.grid.arriba { align-items: start; }
.pila { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
td .explica { max-width: 560px; margin-top: 2px; }
tfoot td { border-top: 2px solid var(--line); border-bottom: 0; }
code { font-size: 12px; background: var(--tint); padding: 1px 5px; border-radius: 5px; }

/* Accesos rápidos */
.g4 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.accesos ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.accesos li { display: flex; flex-direction: column; font-size: 13.5px; }
.accesos a { font-weight: 700; text-decoration: none; }
.accesos a:hover { text-decoration: underline; }

.fuente { display: flex; flex-direction: column; gap: 8px; }
.fuente .linea { display: flex; justify-content: space-between; gap: 8px; align-items: center; }

.pie { font-size: 12px; color: var(--soft); text-align: center; }

/* Tooltip */
#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 8px; max-width: 260px; box-shadow: 0 6px 18px rgba(0,0,0,.18); white-space: pre-line; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .caja { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 16px 48px rgba(44, 75, 255, .10); padding: 36px 32px; max-width: 440px; width: 100%; display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.login img { height: 44px; }
.login h1 { font-size: 26px; }
.login .grad { background: linear-gradient(90deg, var(--blue), var(--violet) 60%, var(--magenta)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login .error { color: var(--bad); font-size: 13px; }
.cargando { padding: 60px 0; text-align: center; color: var(--slate); }

@media (max-width: 1100px) and (min-width: 761px) {
  .etapas { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .estado { grid-template-columns: 1fr; }
  .g2, .g-21 { grid-template-columns: 1fr; }
  .etapas { grid-template-columns: 1fr; }
  .barra .in { padding: 10px 16px; }
  main { padding: 18px 16px 48px; }
  .tabla { margin: 0 -16px; padding: 0 16px; }
  .card { padding: 18px 16px; }
  .g2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .vista { animation: entra .25s ease-out; }
  @keyframes entra { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
