/* UVA Core · estilos del enmaquetado (sin cambios de diseño) */
:root{color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}html{scroll-padding-top:env(safe-area-inset-top,0px)}body{margin:0;padding:0;font:14px -apple-system,BlinkMacSystemFont,sans-serif;background:#fff;color:#000}img{max-width:100%}[hidden]:not([hidden=until-found i]){display:none!important}
/* Layout: menú lateral grafito fijo + área de trabajo en gris medio; encabezados de tabla en grafito.
   Color solo con significado y con la misma paleta de MediCore y UVA Command:
   azul = Vigente · amarillo = Vencida · rojo = Cancelada · verde = Promotoría · morado = Broker · naranja = requiere atención.
   Tema único por decisión: ni fondo negro de lectura ni blanco brillante. */
:root {
  color-scheme: light;
  --bg: #DCDEE1; --surface: #EEEFF1; --surface-2: #E5E7EA; --surface-3: #D7DADE;
  --border: #C9CDD2; --border-strong: #A3A9B0; --control: #80868E;
  --text: #1D2023; --text-2: #4D535A; --sombra: rgba(20, 22, 25, .45);
  --side: #1B1D20; --side-2: #26292D; --side-3: #30343A; --side-line: #34383D; --side-text: #C9CDD2; --side-muted: #9AA0A8; --side-on: #FFFFFF;
  --th-bg: #2A2E33; --th-bg-2: #353A40; --th-text: #E3E6E9;
  --vig: #249CEB; --vig-soft: #D3E2EA; --vig-ink: #165E8D;
  --ven: #D8A33C; --ven-soft: #EDE2CC; --ven-ink: #755820;
  --can: #D2504A; --can-soft: #EAD3CF; --can-ink: #933834;
  --pro: #35B979; --pro-soft: #D4E5D8; --pro-ink: #1E6945;
  --bro: #8878D9; --bro-soft: #DFDAE6; --bro-ink: #5B5091;
  --urg: #F2762E; --urg-soft: #F0DACB; --urg-ink: #8F461B;
  --cat: #6B7178; --cat-track: #D3D6DA;
  --font-ui: Calibri, 'Carlito', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', Consolas, ui-monospace, Menlo, monospace;
  --radio: 6px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); }
body { margin: 0; color: var(--text); font-family: var(--font-ui); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.muted { color: var(--text-2); }
b, strong { font-weight: 700; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--side) 0 252px, var(--bg) 252px); }
.side { background: var(--side); color: var(--side-text); position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 12px 18px max(12px, env(safe-area-inset-left, 0px)); }
.side-marca { display: flex; align-items: center; gap: 12px; padding: 0 6px 18px; border-bottom: 1px solid var(--side-line); }
.logo { width: 46px; height: auto; display: block; flex: none; }
.side-marca b { display: block; font-size: 19px; color: var(--side-on); letter-spacing: .01em; }
.side-marca span { font-size: 12.5px; color: var(--side-muted); }
.nav { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; flex: 1; }
.nav-grupo { display: flex; flex-direction: column; gap: 1px; }
.nav-grupo > span { font-size: 12px; font-weight: 700; color: var(--side-muted); padding: 0 10px 6px; letter-spacing: .02em; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 5px; color: var(--side-text); text-decoration: none; font-size: 14.5px; }
.nav a svg { width: 17px; height: 17px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.nav a:hover { background: var(--side-2); color: var(--side-on); }
.nav a.activo { background: var(--side-3); color: var(--side-on); font-weight: 700; }
.nav a.activo::before { content: ''; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 3px; background: var(--side-on); border-radius: 0; }
.nav a.activo svg { opacity: 1; }
.nav a .nom { flex: 1; min-width: 0; }
.nav a .fase { font-size: 11px; color: var(--side-muted); border: 1px solid var(--side-line); border-radius: 3px; padding: 0 5px; white-space: nowrap; }
.nav a:focus-visible { outline-color: var(--side-on); }
.side-pie { border-top: 1px solid var(--side-line); padding: 14px 10px 0; display: grid; gap: 8px; font-size: 13px; }
.side-pie small { display: block; font-size: 11.5px; color: var(--side-muted); }
.side-pie span { color: var(--side-on); }
.area { min-width: 0; display: flex; flex-direction: column; }
.barra { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: calc(env(safe-area-inset-top, 0px) + 12px) max(24px, env(safe-area-inset-right, 0px)) 12px 24px; }
.migas { font-size: 13.5px; color: var(--text-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.migas b { color: var(--text); }
.barra .der { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.etq { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.etq.demo { color: var(--text-2); border-style: dashed; }
.btn-menu { display: none; }
main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start;
  padding: 22px max(24px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 48px) 24px; }
main:focus { outline: none; }
main > *, .tarjeta > *, .sheet-cuerpo > * { min-width: 0; }

/* ---------- Títulos y tarjetas ---------- */
.encabezado { display: grid; gap: 4px; }
.encabezado h1 { font-size: 27px; font-weight: 700; line-height: 1.15; margin: 0; letter-spacing: -.005em; text-wrap: balance; }
.encabezado p { margin: 0; color: var(--text-2); max-width: 80ch; font-size: 15px; line-height: 1.5; }
.tarjeta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.tarjeta h2 { font-size: 17px; font-weight: 700; margin: 0; line-height: 1.25; }
.tarjeta-cab { display: flex; align-items: center; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; }
.tarjeta-cab .muted { font-size: 13.5px; }
.nota { font-size: 13.5px; line-height: 1.5; color: var(--text-2); margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid2-ancho { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* ---------- Cifras principales ---------- */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); padding: 14px 16px; display: grid; gap: 6px; align-content: start; min-width: 0; }
.kpi > small { font-size: 14px; color: var(--text-2); }
button.kpi { font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.kpi:hover { border-color: var(--border-strong); }
button.kpi[aria-pressed=true] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.kpi .valor { font-size: 32px; font-weight: 700; line-height: 1.05; letter-spacing: -.01em; }
.kpi .valor button.cifra { border-bottom-color: transparent; }
.kpi .valor button.cifra:hover { border-bottom-color: var(--text); }
.reparto { display: flex; height: 8px; gap: 2px; margin-top: 4px; }
.reparto i { display: block; height: 100%; }
.reparto i:first-child { border-radius: 0; }
.reparto i:last-child { border-radius: 0 4px 4px 0; }
.lineas { display: grid; gap: 3px; font-size: 13.5px; }
.lineas div { display: flex; justify-content: space-between; gap: 10px; }
.lineas em { font-style: normal; color: var(--text-2); }
.estado { border-top: 4px solid var(--c, var(--border-strong)); }
.estado.Vigente { --c: var(--vig); } .estado.Vencida { --c: var(--ven); } .estado.Cancelada { --c: var(--can); }
.estado > small { color: var(--ck, var(--text-2)); font-weight: 700; }
.estado.Vigente { --ck: var(--vig-ink); } .estado.Vencida { --ck: var(--ven-ink); } .estado.Cancelada { --ck: var(--can-ink); }

/* ---------- Pestañas ---------- */
.pestanas { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.pestanas button { border: 0; background: none; padding: 9px 14px 8px; border-bottom: 3px solid transparent; cursor: pointer; color: var(--text-2); white-space: nowrap; font-size: 14.5px; }
.pestanas button:hover { color: var(--text); }
.pestanas button[aria-selected=true] { color: var(--text); font-weight: 700; border-bottom-color: var(--text); }
.pestanas .cuenta { display: inline-block; margin-left: 6px; font-size: 12px; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--text); font-variant-numeric: tabular-nums; }
.pestanas .cuenta.atn { background: var(--urg-soft); color: var(--urg-ink); }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); }
.tabla-wrap.alta { max-height: min(68vh, 760px); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14.5px; }
th { text-align: left; font-weight: 700; font-size: 13.5px; color: var(--th-text); background: var(--th-bg); padding: 9px 14px; white-space: nowrap; vertical-align: bottom; border-bottom: 1px solid var(--th-bg); }
thead tr.grupos th { background: var(--th-bg-2); text-align: center; border-bottom: 1px solid #4A5057; }
td { padding: 8px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); vertical-align: middle; }
tbody tr:nth-child(even) td { background: #EAEBEE; }
tbody tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; }
.alta thead th { position: sticky; top: 0; z-index: 2; }
.fija th:first-child, .fija td:first-child { position: sticky; left: 0; z-index: 1; box-shadow: inset -1px 0 0 var(--border-strong); }
.fija th:first-child { box-shadow: inset -1px 0 0 #4A5057; }
.fija thead tr.grupos th:first-child { position: static; box-shadow: none; }
.alta .fija thead th:first-child { z-index: 3; }
/* Tabla alta con encabezado por bloques: los dos renglones del encabezado quedan fijos, uno debajo del otro */
.alta thead tr.grupos th { height: 32px; padding-top: 0; padding-bottom: 0; text-align: left; }
.alta thead tr.grupos th > span { position: sticky; left: 150px; display: inline-block; }
.alta thead tr.grupos th:first-child > span { left: 14px; }
.alta thead tr.grupos + tr th { top: 32px; }
.alta .fija thead tr.grupos th:first-child { position: sticky; top: 0; left: auto; z-index: 2; box-shadow: none; }
.btn.btn-mini { padding: 0 10px; font-size: 13.5px; line-height: 19px; }
tr.fila-click { cursor: pointer; }
tr.fila-click:hover td { background: var(--surface-3); }
tfoot td { font-weight: 700; background: var(--surface-2) !important; border-top: 2px solid var(--text); border-bottom: 0; }
th button.orden { all: unset; cursor: pointer; display: inline-flex; gap: 5px; align-items: center; color: var(--th-text); }
th button.orden:hover { color: #FFFFFF; }
th button.orden:focus-visible { outline: 2px solid #FFFFFF; outline-offset: 2px; }
th .flecha { font-size: 10px; }
button.cifra { all: unset; cursor: pointer; border-bottom: 1px dotted var(--control); font-variant-numeric: tabular-nums lining-nums; }
button.cifra:hover { border-bottom: 1px solid var(--text); }
button.cifra:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.cero { color: var(--text-2); }

/* ---------- Marcas de color con significado ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 10px 1px 8px; border-radius: 999px; font-size: 13.5px; line-height: 20px; font-weight: 700; white-space: nowrap; }
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chip.Vigente { background: var(--vig-soft); color: var(--vig-ink); } .chip.Vigente::before { background: var(--vig); }
.chip.Vencida { background: var(--ven-soft); color: var(--ven-ink); } .chip.Vencida::before { background: var(--ven); }
.chip.Cancelada { background: var(--can-soft); color: var(--can-ink); } .chip.Cancelada::before { background: var(--can); }
.ud { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.ud::before { content: ''; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.ud.Promotoría::before { background: var(--pro); } .ud.Broker::before { background: var(--bro); }
.tag-ud { display: inline-flex; padding: 1px 9px; border-radius: 3px; font-size: 13.5px; font-weight: 700; line-height: 20px; }
.tag-ud.Promotoría { background: var(--pro-soft); color: var(--pro-ink); } .tag-ud.Broker { background: var(--bro-soft); color: var(--bro-ink); }
.sit { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sit svg { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sit.atn { color: var(--urg-ink); font-weight: 700; }
.sit.atn svg { stroke: var(--urg); }
.mov { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 0 7px; border-radius: 3px; border: 1px solid var(--border-strong); color: var(--text); white-space: nowrap; }

/* ---------- Barras de participación ---------- */
.part { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; width: 100%; }
.barra-p { width: 110px; height: 8px; background: var(--cat-track); border-radius: 0 4px 4px 0; overflow: hidden; flex: none; }
.barra-p > span { display: block; height: 100%; background: var(--cat); border-radius: 0 4px 4px 0; }
.barra-p.pro > span { background: var(--pro); } .barra-p.bro > span { background: var(--bro); }
.part em { font-style: normal; min-width: 58px; text-align: right; }

/* ---------- Controles ---------- */
.btn { padding: 6px 13px; border: 1px solid var(--control); background: var(--surface); border-radius: 4px; cursor: pointer; white-space: nowrap; line-height: 20px; font-size: 14.5px; }
.btn:hover { background: var(--surface-3); }
.btn[disabled] { cursor: default; opacity: .5; }
.btn-prim { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn-prim:hover { background: #3A3F45; }
.btn .n { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--text); color: var(--surface); font-size: 12px; text-align: center; }
select, input[type=text], input[type=search] { border: 1px solid var(--control); background: var(--surface); border-radius: 4px; padding: 6px 9px; min-height: 34px; max-width: 100%; font-size: 14.5px; }
.campo { display: grid; gap: 4px; min-width: 0; }
.campo > span { font-size: 13px; color: var(--text-2); }
.filtros { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 12px; align-items: end; }
.filtros .campo select, .filtros .campo input { width: 100%; }
.filtros .ancho { grid-column: span 2; }
.herr { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.herr .sep { flex: 1; }
.herr .buscar { flex: 1 1 320px; }
.herr .buscar input { width: 100%; }
td .herr { flex-wrap: nowrap; }
.segmentado { display: inline-flex; border: 1px solid var(--control); border-radius: 4px; overflow: hidden; flex-wrap: wrap; justify-self: start; }
.segmentado button { border: 0; background: var(--surface); padding: 6px 14px; cursor: pointer; border-right: 1px solid var(--border); display: inline-flex; gap: 8px; align-items: center; }
.segmentado button:last-child { border-right: 0; }
.segmentado button i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.segmentado button[aria-pressed=true] { background: var(--text); color: var(--surface); }
.segmentado button b { font-variant-numeric: tabular-nums; }
.activos { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 13.5px; }
.activos .f { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 999px; padding: 1px 4px 1px 10px; }
.activos .f button { border: 0; background: none; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 5px; color: var(--text-2); border-radius: 50%; }
.activos .f button:hover { color: var(--text); background: var(--surface-3); }
.totales { display: flex; gap: 30px; flex-wrap: wrap; padding: 10px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; }
.totales div { display: grid; }
.totales small { font-size: 13px; color: var(--text-2); }
.totales b { font-size: 19px; font-variant-numeric: tabular-nums lining-nums; }
.pag { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.panel-col { border: 1px solid var(--border); border-radius: 4px; padding: 12px 14px; background: var(--surface-2); display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.panel-col fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; }
.panel-col legend { font-size: 13px; font-weight: 700; color: var(--text); padding: 0 0 4px; }
.panel-col label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.leyenda span { display: inline-flex; gap: 6px; align-items: center; }
.leyenda i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.ecuacion { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 15px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); }
.ecuacion .op { color: var(--text-2); font-size: 18px; }
.ecuacion b { font-variant-numeric: tabular-nums; }

/* ---------- Gráfica mensual ---------- */
.graf { display: grid; grid-template-columns: 36px minmax(0, 1fr); grid-template-rows: 200px auto; column-gap: 8px; position: relative; }
.graf-eje { position: relative; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.graf-eje span { position: absolute; right: 0; transform: translateY(50%); }
.graf-area { position: relative; border-bottom: 1px solid var(--text-2); }
.graf-area .rejilla { position: absolute; left: 0; right: 0; height: 1px; background: var(--border); }
.graf-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.graf-mes { display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.graf-mes:hover { background: rgba(29, 32, 35, .06); }
.graf-mes .b { width: min(16px, 30%); border-radius: 4px 4px 0 0; }
.graf-mes .b.ven { background: var(--ven); } .graf-mes .b.can { background: var(--can); }
.graf-x { grid-column: 2; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); font-size: 12.5px; color: var(--text-2); text-align: center; padding-top: 6px; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--side); color: #F1F2F3; font-size: 13.5px; line-height: 1.5; padding: 8px 11px; border-radius: 4px; white-space: nowrap; }

/* ---------- Panel lateral: ficha y detalle ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: flex-end; }
.sheet-fondo { position: absolute; inset: 0; background: var(--sombra); }
.sheet { position: relative; width: min(1160px, 100%); height: 100%; background: var(--bg); overflow: auto; overscroll-behavior: contain; }
.sheet-cab { position: sticky; top: 0; z-index: 6; background: var(--side); color: var(--side-on); padding: calc(env(safe-area-inset-top, 0px) + 12px) max(16px, env(safe-area-inset-right, 0px)) 12px 22px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sheet-cab h2 { font-size: 21px; font-weight: 700; margin: 0; line-height: 1.2; }
.sheet-cab .sub { color: var(--side-text); font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.sheet-cab .acciones { margin-left: auto; display: flex; gap: 8px; }
.sheet-cab .btn { background: var(--side-2); color: var(--side-on); border-color: #5B6168; }
.sheet-cab .btn:hover { background: var(--side-3); }
.sheet-cab :focus-visible { outline-color: var(--side-on); }
.sheet-cuerpo { padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 36px) 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.resumen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio); }
.resumen > div { padding: 10px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-width: 0; display: grid; gap: 2px; }
.resumen small { font-size: 12.5px; color: var(--text-2); }
.resumen span { font-weight: 700; overflow-wrap: anywhere; }
.campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 24px; margin: 0; }
.campos div { display: grid; gap: 2px; min-width: 0; }
.campos dt { font-size: 13px; color: var(--text-2); }
.campos dd { margin: 0; overflow-wrap: anywhere; }
.aviso { border: 1px solid var(--border-strong); border-left: 4px solid var(--text); background: var(--surface); padding: 10px 14px; font-size: 14px; }
.aviso.atn { border-left-color: var(--urg); }
.aviso.ok { border-left-color: var(--pro); }
.decision { border: 1px solid var(--border-strong); border-left: 4px solid var(--urg); background: var(--surface-2); padding: 12px 14px; display: grid; gap: 12px; margin-top: 12px; }
.decision:focus { outline: none; }
.decision h3 { margin: 0; font-size: 16px; }
.decision .herr { align-items: center; }
tr.sel td { background: var(--surface-3); }
.mayus { text-transform: uppercase; }
/* Reglas de clasificación por Número de Serie */
.reglas { display: grid; gap: 10px; }
.reglas > div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 4px 14px; align-items: baseline; }
.reglas p { margin: 0; font-size: 14.5px; line-height: 1.5; }
.resumen button.cifra.mono { font-size: 14px; }
/* ---------- Gráficas de Aseguradoras ---------- */
.periodo { align-items: end; gap: 12px 16px; }
.periodo .campo select { min-width: 150px; }
.periodo .segmentado { flex-wrap: nowrap; }
.hb { display: grid; --hb-etq: 132px; }
.hb-fila { display: grid; grid-template-columns: 136px minmax(0, 1fr); align-items: center; column-gap: 12px; min-height: 28px; border-radius: 3px; }
.hb-fila:hover { background: var(--surface-2); }
.hb-nom { all: unset; cursor: pointer; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; padding: 2px 0; }
.hb-nom:hover { text-decoration: underline; text-underline-offset: 3px; }
.hb-nom:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.hb-pista { display: flex; align-items: center; height: 28px; border-left: 1px solid var(--text-2); min-width: 0; }
.hb-barra { display: flex; gap: 2px; height: 14px; min-width: 3px; }
.hb-seg { border: 0; padding: 0; margin: 0; cursor: pointer; min-width: 2px; height: 100%; }
.hb-seg.pro, .gm-seg.pro { background: var(--pro); }
.hb-seg.bro, .gm-seg.bro { background: var(--bro); }
.hb-seg:last-child { border-radius: 0 4px 4px 0; }
.hb-seg:hover, .gm-seg:hover { filter: brightness(1.12); }
.hb-seg:focus-visible, .gm-seg:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.hb-val { display: inline-flex; gap: 8px; align-items: baseline; padding-left: 8px; font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hb-val em { font-style: normal; color: var(--text-2); }
.gm { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: 230px auto; column-gap: 8px; }
.gm-eje { position: relative; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.gm-eje span { position: absolute; right: 0; transform: translateY(50%); white-space: nowrap; }
.gm-area { position: relative; border-bottom: 1px solid var(--text-2); }
.gm-area .rejilla { position: absolute; left: 0; right: 0; height: 1px; background: var(--border); }
.gm-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.gm-col { display: flex; justify-content: center; border-radius: 3px 3px 0 0; }
.gm-col:hover { background: rgba(29, 32, 35, .06); }
.gm-pila { width: min(24px, 60%); height: 100%; display: flex; flex-direction: column-reverse; gap: 2px; }
.gm-seg { border: 0; padding: 0; margin: 0; width: 100%; flex: none; min-height: 2px; cursor: pointer; }
.gm-seg:last-child { border-radius: 4px 4px 0 0; }
.gm-x { grid-column: 2; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); font-size: 12.5px; color: var(--text-2); text-align: center; padding-top: 6px; }
.ver-tabla summary { cursor: pointer; font-size: 14px; width: max-content; padding: 2px 0; }
.ver-tabla summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.ver-tabla[open] summary { margin-bottom: 10px; }
.tipg { position: fixed; z-index: 60; pointer-events: none; background: var(--side); color: #F1F2F3; font-size: 13.5px; line-height: 1.45; padding: 9px 12px; border-radius: 5px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); display: grid; gap: 3px; min-width: 210px; max-width: 340px; }
.tipg b { font-weight: 700; margin-bottom: 2px; }
.tipg .r { display: grid; grid-template-columns: 12px auto minmax(0, 1fr); align-items: center; gap: 8px; }
.tipg .r .k { width: 12px; height: 3px; border-radius: 2px; }
.tipg .r .k.pro { background: var(--pro); } .tipg .r .k.bro { background: var(--bro); }
.tipg .r strong { font-variant-numeric: tabular-nums; }
.tipg .r span { color: #B9BEC4; }
.tipg .r.tot { border-top: 1px solid #3A3F45; padding-top: 4px; margin-top: 2px; }
.mayus::placeholder { text-transform: none; }
td .txt { display: block; white-space: normal; min-width: 240px; max-width: 340px; line-height: 1.35; }
.importes { width: 100%; max-width: 480px; }
.importes td { padding: 6px 0; border-bottom: 1px solid var(--border); background: transparent !important; }
.importes tr.total td { font-weight: 700; border-top: 2px solid var(--text); border-bottom: 0; }
.pdf-vista { border: 1px dashed var(--border-strong); background: var(--surface); border-radius: 4px; min-height: 300px; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--text-2); }

/* ---------- Carga ---------- */
.zona { border: 1px dashed var(--border-strong); border-radius: 4px; background: var(--surface-2); padding: 20px; display: grid; gap: 8px; justify-items: start; }
.zona.sobre { border-color: var(--text); background: var(--surface-3); }
.zona { position: relative; cursor: pointer; }
.zona input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.zona:focus-within { outline: 2px solid var(--text); outline-offset: 2px; }
.zona .btn { pointer-events: none; }
.proxima { border: 1px dashed var(--border-strong); background: var(--surface); border-radius: var(--radio); padding: 24px; display: grid; gap: 8px; }

/* ---------- Business Performance ----------
   El año elegido lleva el color de la sección: grafito en Global, verde en Promotoría y morado en Broker.
   El año anterior va en gris. La baja y lo que queda bajo la meta llevan el naranja de "requiere atención". */
:root { --glo: #3A4047; --glo-2: #A5AAB1; --pro-2: #A6DDC1; --bro-2: #C8C1EE; --ant: #B2B6BC; }
.grid-kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi > .nota { margin-top: -2px; }
.kpi-delta { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: 14px; }
.kpi-delta > span:last-child { color: var(--text-2); }
.delta { position: relative; display: inline-flex; align-items: baseline; gap: 4px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums lining-nums; }
.delta i { font-style: normal; font-size: .7em; }
.delta.baja { color: var(--urg-ink); }
.delta.baja i { color: var(--urg); }
.delta.igual { font-weight: 400; color: var(--text-2); }
td .delta, .lineas .delta, .hp-val .delta { font-weight: 400; }
td .delta.baja, .lineas .delta.baja, .hp-val .delta.baja { font-weight: 700; }
.lineas .delta { font-size: 13px; margin-left: 4px; }
.meta { position: relative; height: 8px; background: var(--cat-track); border-radius: 0 4px 4px 0; margin: 4px 0 20px; }
.meta > i { display: block; height: 100%; background: var(--cat); border-radius: 0 4px 4px 0; }
.meta.atn { background: var(--urg-soft); }
.meta.atn > i { background: var(--urg); }
.meta > b { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); }
.meta > span { position: absolute; top: 13px; transform: translateX(-50%); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.gp-par { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; height: 100%; }
.gp-b { display: block; border: 0; padding: 0; margin: 0; width: min(16px, 34%); min-height: 2px; border-radius: 4px 4px 0 0; cursor: pointer; flex: none; }
span.gp-b.vacio { min-height: 0; height: 0; cursor: default; }
.gp-b.glo, .hp-b.glo, .gl-p.glo, .ha-seg.glo, .leyenda i.glo { background: var(--glo); }
.gp-b.pro, .hp-b.pro, .gl-p.pro, .ha-seg.pro, .leyenda i.pro { background: var(--pro); }
.gp-b.bro, .hp-b.bro, .gl-p.bro, .ha-seg.bro, .leyenda i.bro { background: var(--bro); }
.gp-b.ant, .hp-b.ant, .gl-p.ant, .leyenda i.ant { background: var(--ant); }
.ha-seg.glo.resto, .leyenda i.glo.resto { background: var(--glo-2); }
.ha-seg.pro.resto, .leyenda i.pro.resto { background: var(--pro-2); }
.ha-seg.bro.resto, .leyenda i.bro.resto { background: var(--bro-2); }
.gp-b:hover, button.hp-b:hover, button.ha-seg:hover { filter: brightness(1.12); }
span.hp-b { cursor: default; }
.gp-b:focus-visible, .hp-b:focus-visible, .gl-p:focus-visible, .ha-seg:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.gm.chico { grid-template-rows: 170px auto; }
/* En una gráfica angosta con muchos meses, la etiqueta se reduce a la inicial del mes */
.gm { container-type: inline-size; }
@container (max-width: 345px) { .gm.denso .gm-x .cola { display: none; } }
.leyenda i.linea { height: 3px; width: 16px; border-radius: 2px; }
.leyenda b { color: var(--text); font-variant-numeric: tabular-nums; }
.gl-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.gl-svg polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.gl-svg .glo { stroke: var(--glo); } .gl-svg .pro { stroke: var(--pro); } .gl-svg .bro { stroke: var(--bro); } .gl-svg .ant { stroke: var(--ant); }
.gl-col { position: relative; cursor: pointer; }
.gl-col:hover::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; margin-left: -.5px; background: var(--border-strong); }
.gl-p { position: absolute; left: 50%; width: 12px; height: 12px; margin: 0 0 -6px -6px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; cursor: pointer; }
.gl-ref { position: absolute; left: 0; right: 0; height: 1px; background: var(--text-2); }
.leyenda i.ref { background: var(--text-2); height: 1px; width: 16px; border-radius: 0; }
.col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; min-width: 0; }
.grid2.dos { gap: 16px 28px; }
@media (min-width: 1181px) { .grid2.dos { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.hp { display: grid; gap: 6px; --hp-etq: 140px; }
.hp-fila { display: grid; grid-template-columns: 136px minmax(0, 1fr); align-items: center; column-gap: 12px; border-radius: 3px; }
.hp.ancho .hp-fila { grid-template-columns: 230px minmax(0, 1fr); }
.hp.ancho .hp-nom { white-space: normal; line-height: 1.25; }
.hp.anios { --hp-etq: 170px; }
.hp.anios .hp-fila { grid-template-columns: 44px minmax(0, 1fr); }
.hp-fila:hover { background: var(--surface-2); }
.hp-nom { font-size: 14px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; padding: 2px 0; }
.hp-nom .ud { justify-content: flex-end; }
.hp-pista { display: grid; gap: 2px; padding: 3px 0; border-left: 1px solid var(--text-2); min-width: 0; }
.hp-l { display: flex; align-items: center; height: 14px; min-width: 0; }
.hp-l.alto { height: 20px; }
.hp-b { display: block; border: 0; padding: 0; margin: 0; height: 10px; min-width: 2px; border-radius: 0 4px 4px 0; cursor: pointer; flex: none; }
.ha-barra { display: flex; gap: 2px; height: 14px; min-width: 3px; flex: none; }
.ha-seg { display: block; border: 0; padding: 0; margin: 0; height: 100%; min-width: 2px; }
button.ha-seg { cursor: pointer; }
.ha-seg:last-child { border-radius: 0 4px 4px 0; }
.hp-val { display: inline-flex; gap: 8px; align-items: baseline; padding-left: 8px; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hp-val em { font-style: normal; color: var(--text-2); }
.hp-val .delta { font-size: 12.5px; }
.minis { gap: 20px 28px; }
.mini { display: grid; gap: 8px; min-width: 0; }
.mini-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.mini-cab h3, h3.sub { font-size: 15.5px; font-weight: 700; margin: 0; }
.mini-cab span { font-size: 14px; }
.sangria { padding-left: 16px; color: var(--text-2); }
.tipg .r .k.glo { background: #F1F2F3; }
.tipg .r .k.ant { background: #7F858D; }
.tipg .r .k.glo2 { background: var(--glo-2); } .tipg .r .k.pro2 { background: var(--pro-2); } .tipg .r .k.bro2 { background: var(--bro-2); }

@media (max-width: 1640px) { .grid2-ancho { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1280px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .resumen { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1180px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .filtros .campo > span[aria-hidden="true"] { display: none; }
  .reglas > div { grid-template-columns: minmax(0, 1fr); }
  .hb { --hb-etq: 108px; }
  .hb-fila { grid-template-columns: 96px minmax(0, 1fr); column-gap: 8px; }
  .hb-nom { font-size: 13.5px; }
  .gm { grid-template-columns: 48px minmax(0, 1fr); grid-template-rows: 200px auto; }
  .periodo .campo { flex: 1 1 140px; }
  .periodo .campo select { min-width: 0; width: 100%; }
  .periodo .campo.medida { flex-basis: 100%; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: calc(env(safe-area-inset-top, 0px) + 12px) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
  .side-marca { border-bottom: 0; padding-bottom: 0; }
  .side .nav, .side .side-pie { display: none; }
  .side.abierto .nav, .side.abierto .side-pie { display: flex; }
  .side.abierto .side-pie { display: grid; }
  .btn-menu { display: inline-flex; margin-left: auto; background: var(--side-2); color: var(--side-on); border-color: #5B6168; }
  .btn-menu:hover { background: var(--side-3); }
  .btn-menu:focus-visible { outline-color: var(--side-on); }
  .nav a.activo::before { left: 0; }
  .barra { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .filtros .ancho { grid-column: auto; }
  .herr .sep { display: none; }
  .tabla-wrap.alta { max-height: none; }
  .pag { justify-content: flex-start; }
  .app { background: var(--bg); }
  .grid4 { grid-template-columns: minmax(0, 1fr); }
  .kpi .valor { font-size: 28px; }
}
@media (max-width: 1180px) { .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .grid-kpi { grid-template-columns: minmax(0, 1fr); }
  .hp { --hp-etq: 122px; }
  .hp.anios { --hp-etq: 128px; }
  .hp-fila { grid-template-columns: 96px minmax(0, 1fr); column-gap: 8px; }
  .hp.ancho .hp-fila { grid-template-columns: 112px minmax(0, 1fr); }
  .hp-val { font-size: 12.5px; gap: 6px; }
  .gp-b { width: min(12px, 40%); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
