/* SETPC — CRM y panel global. Mismos tokens que la caja (pos/css/app.css):
   neutro cálido, un acento verde reservado para la acción principal, números tabulares. */

@font-face { font-family: Plex; src: url(fonts/plex-sans-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Plex; src: url(fonts/plex-sans-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Plex; src: url(fonts/plex-sans-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --bg: #f3f1ec;
  --surface: #fdfcf9;
  --surface-sunk: #e9e6df;
  --line: #d6d1c6;
  --line-strong: #8e877a;
  --ink: #1c1b18;
  --ink-2: #57534b;
  --accent: #0d6a4d;
  --accent-press: #09523b;
  --accent-soft: #dcebe4;
  --on-accent: #fdfcf9;
  --danger: #a3241a;
  --danger-soft: #f6e1de;
  --warn: #7f4d00;
  --warn-soft: #f6ead3;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --t-xs: 0.8125rem; --t-sm: 0.875rem; --t-md: 1rem; --t-lg: 1.25rem; --t-xl: 1.5625rem; --t-2xl: 1.953rem; --t-3xl: 2.441rem;
  --r-sm: 6px; --r-md: 10px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font: 400 var(--t-md)/1.5 Plex, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
p, dl, dd { margin: 0; }
a { color: var(--accent-press); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.env-banner { margin: 0; padding: var(--s1) var(--s4); background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #e2c793; font-size: var(--t-sm); text-align: center; }
.support-banner { margin: 0; padding: var(--s2) var(--s4); background: var(--ink); color: var(--surface); display: flex; align-items: center; justify-content: center; gap: var(--s4); flex-wrap: wrap; font-size: var(--t-sm); border-bottom: 3px solid var(--accent); }
.support-banner .btn { min-height: 36px; }
.skip { position: absolute; left: var(--s4); top: -100px; padding: var(--s2) var(--s4); background: var(--ink); color: var(--surface); z-index: 10; }
.skip:focus { top: var(--s4); }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-sm); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }
.strong { font-weight: 600; }
.stack { display: grid; gap: var(--s4); }
.lead { color: var(--ink-2); max-width: 75ch; margin-bottom: var(--s5); }
.eyebrow { font-size: var(--t-sm); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }

/* ------------------------------------------------------------------ estructura */
.shell { min-height: 100vh; display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.shell--bare { grid-template-columns: minmax(0, 1fr); }

.side { background: var(--ink); color: var(--surface); padding: var(--s5) 0 var(--s4); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side__brand { padding: 0 var(--s5) var(--s5); display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.side__place { font-weight: 600; font-size: var(--t-lg); line-height: 1.2; }
.side__menu { display: flex; flex-direction: column; flex: 1; }
.side__menu > summary { display: none; }
.side__menu[open] { display: flex; flex-direction: column; flex: 1; }
.side nav ul { list-style: none; margin: 0; padding: 0; }
.side nav a {
  display: block; padding: 10px var(--s5); color: #d9d5cc; text-decoration: none; font-weight: 500;
  border-left: 3px solid transparent;
}
.side nav a:hover { background: #2b2a26; color: var(--surface); }
.side nav a[aria-current="page"] { color: var(--surface); background: #2b2a26; border-left-color: #6fcf97; }
.side__user { margin-top: auto; padding: var(--s4) var(--s5) 0; border-top: 1px solid #36342f; display: flex; justify-content: space-between; align-items: center; font-size: var(--t-sm); color: #b9b4a8; }
.link { background: none; border: 0; padding: var(--s2) 0; color: var(--surface); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.main { padding: var(--s6) var(--s6) var(--s7); max-width: 1240px; width: 100%; }
.main:focus { outline: none; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head h1 { font-size: var(--t-2xl); }
.section-title { font-size: var(--t-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: var(--s6) 0 var(--s3); }
.section-title--first { margin-top: 0; }
.page-head--section { margin: var(--s7) 0 var(--s3); }
.page-head--section .section-title { margin: 0; }
section > .section-title:first-child, .split > section > .section-title:first-child { margin-top: 0; }

.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: var(--s7); align-items: start; margin-top: var(--s6); }
.split--detail { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); }

/* ------------------------------------------------------------------ botones y campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 150ms var(--ease);
}
.btn:hover { background: var(--surface-sunk); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-press); border-color: var(--accent-press); color: var(--on-accent); }
.btn--danger { color: var(--danger); border-color: currentColor; }
.btn--danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn--block { width: 100%; }

.field { display: grid; gap: var(--s1); align-content: start; }
.field label, .fieldset legend { font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); }
.field--wide { grid-column: 1 / -1; }
.field--grow { flex: 1; min-width: 220px; }
.field__help { font-size: var(--t-sm); color: var(--ink-2); }
.field__error { font-size: var(--t-sm); color: var(--danger); font-weight: 500; }
.input {
  min-height: 44px; padding: 0 var(--s3); width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface);
}
select.input { padding-right: var(--s6); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled { background: var(--surface-sunk); color: var(--ink-2); }
.input--xs { width: 72px; }
.input--sm { width: 120px; }
.check { display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.form { display: grid; gap: var(--s4); }
.form--narrow { max-width: 620px; }
.form--compact { gap: var(--s3); margin-bottom: var(--s5); }
.form__actions { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s2); }
.fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s4); margin: 0; display: grid; gap: var(--s2); }
.fieldset legend { padding: 0 var(--s2); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s3); padding-bottom: var(--s5); margin-bottom: var(--s2); border-bottom: 1px solid var(--line); }
.inline-form { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.inline-form .input { flex: 1; min-width: 160px; width: auto; }
.inline-form .input--xs { flex: none; width: 72px; min-width: 0; }
.inline-form--new { margin-top: var(--s3); }

/* ------------------------------------------------------------------ datos */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--t-xs); font-weight: 500; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
.table tfoot td { border-bottom: 0; }
.table .r { text-align: right; }
.table--rows tbody tr:hover td { background: var(--surface); }
.actions { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; }
.row--muted td { color: var(--ink-2); }

.tag { display: inline-block; padding: 1px var(--s2); border-radius: var(--r-sm); font-size: var(--t-xs); font-weight: 500; background: var(--surface-sunk); color: var(--ink-2); white-space: nowrap; text-decoration: none; }
.tag--ok { background: var(--accent-soft); color: var(--accent-press); }
.tag--warn { background: var(--warn-soft); color: var(--warn); }
.tag--danger { background: var(--danger-soft); color: var(--danger); }
.side .tag { background: #36342f; color: #d9d5cc; }

.summary { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.summary > div { display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.summary > div:last-child { border-bottom: 0; }
.plain-list { margin: 0 0 var(--s2); padding-left: var(--s5); }
.code { font: var(--t-xs)/1.5 ui-monospace, monospace; background: var(--surface-sunk); padding: var(--s3); border-radius: var(--r-sm); overflow-x: auto; max-width: 60ch; white-space: pre-wrap; }

/* estadísticas: una fila, separadas por reglas, sin tarjetas */
.stats { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.stat { padding: var(--s4) var(--s4) var(--s4) 0; display: grid; gap: var(--s1); }
.stat + .stat { padding-left: var(--s5); border-left: 1px solid var(--line); }
.stat__label { font-size: var(--t-sm); color: var(--ink-2); }
.stat__value { font-size: var(--t-xl); font-weight: 600; }
.stat--hero .stat__value { font-size: var(--t-3xl); letter-spacing: -0.02em; line-height: 1.1; }

/* gráfico */
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart__grid { stroke: var(--line); stroke-width: 1; }
.chart__base { stroke: var(--line-strong); stroke-width: 1; }
.chart__axis { fill: var(--ink-2); font-size: 12px; font-family: Plex, sans-serif; }
.chart__bar { fill: var(--accent); opacity: .55; transition: opacity 150ms var(--ease); }
.chart__mark--today .chart__bar { opacity: 1; }
.chart__hit { fill: transparent; }
.chart__mark:hover .chart__bar { opacity: 1; }
.chart__mark:hover .chart__hit { fill: var(--surface-sunk); fill-opacity: .6; }
.chart__table summary { cursor: pointer; font-size: var(--t-sm); color: var(--ink-2); padding: var(--s2) 0; }

/* alertas */
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.alert { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--surface); border-left: 4px solid var(--line-strong); font-size: var(--t-sm); }
.alert a { white-space: nowrap; font-weight: 500; }
.alert--danger { border-left-color: var(--danger); }
.alert--warn { border-left-color: #c98a1c; }
.alert--info { border-left-color: var(--ink-2); }
.alert--ok { border-left-color: var(--accent); }
.backups { margin-bottom: var(--s6); }
.ok-note { padding: var(--s3) var(--s4); background: var(--accent-soft); color: var(--accent-press); border-radius: var(--r-sm); font-size: var(--t-sm); }

.notice { padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); margin-bottom: var(--s4); max-width: 75ch; }
.notice--danger { background: var(--danger-soft); color: var(--danger); }
.notice--ok { background: var(--accent-soft); color: var(--accent-press); }
.switch { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; padding: var(--s2) 0; }
.switch input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.fiscal-doc { display: grid; gap: var(--s1); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.fiscal-doc:last-child { border-bottom: 0; }
.fiscal-doc__head { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; }
.flash { padding: var(--s3) var(--s4); border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-press); font-weight: 500; margin-bottom: var(--s5); }
.empty { padding: var(--s7) 0; color: var(--ink-2); display: grid; gap: var(--s4); justify-items: start; }

.pager { display: flex; align-items: center; gap: var(--s4); margin-top: var(--s5); }
.tabs { display: flex; gap: var(--s1); flex-wrap: wrap; margin-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.tabs a { padding: var(--s2) var(--s3); text-decoration: none; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

.pairing { padding: var(--s5); margin-bottom: var(--s6); border: 2px solid var(--accent); border-radius: var(--r-md); background: var(--surface); display: grid; gap: var(--s3); }
.pairing h2 { font-size: var(--t-lg); }
.pairing__code { font-size: var(--t-3xl); font-weight: 600; letter-spacing: .12em; }
.stock-now { font-size: var(--t-2xl); font-weight: 600; margin-bottom: var(--s4); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.login__panel { width: min(100%, 400px); }
.login__panel h1 { font-size: var(--t-2xl); }

/* ------------------------------------------------------------------ pantallas angostas */
@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: var(--s3) 0; }
  .side__brand { padding: 0 var(--s4); }
  .side__menu > summary { display: block; position: absolute; right: var(--s4); top: var(--s3); padding: var(--s2) var(--s3); border: 1px solid #57534b; border-radius: var(--r-sm); cursor: pointer; list-style: none; }
  .side__menu > summary::-webkit-details-marker { display: none; }
  .side { position: relative; }
  .side nav { margin-top: var(--s3); }
  .side__user { padding: var(--s3) var(--s4) 0; }
  .main { padding: var(--s5) var(--s4) var(--s7); }
  .split, .split--detail { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .table--rows { display: block; overflow-x: auto; position: relative; }   /* contiene también el texto oculto de los encabezados */
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------ reportes y gráficos */
/* Paleta de datos (validada para daltonismo sobre la superficie del CRM). Orden fijo: el color sigue a la
   entidad, nunca a su posición. "prev" es el período anterior: gris, siempre detrás. */
:root {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --series-prev: #b9b4a8;
  --heat-0: #ece9e2; --heat-1: #cde2fb; --heat-2: #9ec5f4; --heat-3: #6da7ec; --heat-4: #3987e5; --heat-5: #256abf; --heat-6: #104281;
  --div-pos: #2a78d6; --div-neg: #e34948; --div-zero: #b9b4a8;
  --good-text: #006300;
}
.s1 { --c: var(--series-1); } .s2 { --c: var(--series-2); } .s3 { --c: var(--series-3); } .s4 { --c: var(--series-4); }
.s5 { --c: var(--series-5); } .s6 { --c: var(--series-6); } .s7 { --c: var(--series-7); } .s8 { --c: var(--series-8); }
.prev { --c: var(--series-prev); }
.div-pos { --c: var(--div-pos); } .div-neg { --c: var(--div-neg); } .div-zero { --c: var(--div-zero); }

.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart__bar { fill: var(--c, var(--series-1)); opacity: 1; transition: opacity 120ms var(--ease); }
.chart__bar--dim { opacity: .45; }
.chart__mark:hover .chart__bar, .chart--share rect:hover { opacity: .8; }
.chart__line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__line.prev { stroke-dasharray: 5 4; }
.chart__dot { fill: var(--surface); stroke: var(--c); stroke-width: 2; opacity: 0; transition: opacity 120ms var(--ease); }
.chart__cross { stroke: var(--line-strong); stroke-width: 1; opacity: 0; }
.chart__col:hover .chart__dot, .chart__col:hover .chart__cross, .chart__col.is-on .chart__dot, .chart__col.is-on .chart__cross { opacity: 1; }
.chart__label { fill: var(--ink); font-size: 13px; font-family: Plex, sans-serif; }
.chart__value { fill: var(--ink-2); font-size: 13px; font-family: Plex, sans-serif; font-variant-numeric: tabular-nums; }
.chart--ranking .chart__mark:hover .chart__hit { fill: var(--surface-sunk); fill-opacity: .7; }
.chart--share svg { height: 36px; border-radius: 6px; }
.chart--heat svg { max-width: 680px; }
.heat { fill: var(--heat-0); stroke: none; }
.heat--1 { fill: var(--heat-1); } .heat--2 { fill: var(--heat-2); } .heat--3 { fill: var(--heat-3); }
.heat--4 { fill: var(--heat-4); } .heat--5 { fill: var(--heat-5); } .heat--6 { fill: var(--heat-6); }
rect.heat:hover { stroke: var(--ink); stroke-width: 2; }
.heat-scale { display: flex; align-items: center; gap: 3px; margin-top: var(--s2); font-size: var(--t-xs); color: var(--ink-2); }
.heat-scale i { display: inline-block; width: 18px; height: 12px; border-radius: 3px; background: var(--heat-0); }
.heat-scale i.heat--1 { background: var(--heat-1); } .heat-scale i.heat--2 { background: var(--heat-2); } .heat-scale i.heat--3 { background: var(--heat-3); }
.heat-scale i.heat--4 { background: var(--heat-4); } .heat-scale i.heat--5 { background: var(--heat-5); } .heat-scale i.heat--6 { background: var(--heat-6); }
.heat-scale span { margin: 0 var(--s1); }

.legend { list-style: none; margin: 0 0 var(--s3); padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); font-size: var(--t-sm); color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: var(--s2); }
.legend--share { margin: var(--s3) 0 0; }
.legend--share strong { color: var(--ink); font-weight: 600; }
.legend__key { display: inline-block; flex: none; background: var(--c); }
.legend__key--rect { width: 12px; height: 12px; border-radius: 3px; }
.legend__key--line { width: 18px; height: 3px; border-radius: 2px; }
.legend__key--line.prev { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 9px); }

/* Tooltip de los gráficos (lo crea crm.js) */
.chart-tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 300px;
  padding: var(--s2) var(--s3); border-radius: var(--r-sm); background: var(--ink); color: var(--surface);
  font-size: var(--t-sm); line-height: 1.4; white-space: pre-line; box-shadow: 0 8px 24px -8px rgb(28 27 24 / .4);
}
.chart-tip strong { display: block; font-weight: 600; }

/* Página de reportes */
.page-head--report { align-items: flex-end; }
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); padding: var(--s4); margin-bottom: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.report-filters .field { min-width: 150px; }
.tabs--report { margin-bottom: var(--s5); overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
.tabs--report a { white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.kpi { display: grid; gap: var(--s1); align-content: start; padding: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.kpi__label { font-size: var(--t-sm); color: var(--ink-2); display: inline-flex; align-items: center; gap: var(--s2); }
.kpi__value { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.01em; }
.kpi__foot { font-size: var(--t-sm); }
.kpi__note { font-size: var(--t-xs); color: var(--ink-2); }
.delta { font-weight: 600; white-space: nowrap; }
.delta--good { color: var(--good-text); }
.delta--bad { color: var(--danger); }
.delta--flat { color: var(--ink-2); font-weight: 500; }
.insights { padding: var(--s4) var(--s5); margin-bottom: var(--s5); background: var(--accent-soft); border-radius: var(--r-md); }
.insights .section-title { margin: 0 0 var(--s2); color: var(--accent-press); }
.insights ul { margin: 0; padding-left: 1.2em; display: grid; gap: var(--s1); }
.report-card { padding: var(--s5); margin-bottom: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); min-width: 0; }
.report-card__title { font-size: var(--t-lg); margin-bottom: var(--s3); }
.report-card__sub { color: var(--ink-2); font-size: var(--t-sm); margin: 0 0 var(--s3); max-width: 75ch; }
.report-card .report-card__sub:last-child { margin: var(--s3) 0 0; }
.report-card__more { margin-top: var(--s3); font-size: var(--t-sm); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: var(--s4); margin-bottom: var(--s4); }
.report-grid > .report-card { margin-bottom: 0; }
.table-wrap { overflow-x: auto; }
.table--dense td, .table--dense th { padding: var(--s2) var(--s3); }
.row--total td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.tag--abc-a { background: #dbe8f9; color: #184f95; }
.tag--abc-b { background: #d6f1e6; color: #0b6b49; }
.tag--abc-c { background: #fbecc8; color: #7a5300; }
@media (max-width: 700px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .report-card { padding: var(--s4); }
  .report-filters .field { min-width: 0; flex: 1 1 140px; }
}
.chart--heat svg { max-width: 680px; }

/* Ranking horizontal (HTML): etiqueta · barra · valor alineado */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rank__row { display: grid; grid-template-columns: minmax(7rem, 15rem) minmax(0, 1fr) auto; align-items: center; gap: var(--s3);
  min-height: 30px; padding: 0 var(--s2); border-radius: var(--r-sm); font-size: var(--t-sm); }
.rank__row:hover { background: var(--surface-sunk); }
.rank__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; color: var(--ink); }
.rank .rank__track { width: 100%; height: 14px; display: block; }
.rank__value { color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; min-width: 6.5rem; }
.report-grid .rank__row { grid-template-columns: minmax(5.5rem, 10rem) minmax(0, 1fr) auto; }

@media (max-width: 700px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .kpi { padding: var(--s3); }
  .kpi__value { font-size: var(--t-lg); white-space: nowrap; }
  .rank__row, .report-grid .rank__row { grid-template-columns: minmax(0, 38%) minmax(0, 1fr) auto; gap: var(--s2); padding: 0; }
  .rank__value { min-width: 0; }
  /* Gráficos de ejes: ancho mínimo legible y desplazamiento lateral dentro de la tarjeta */
  .chart:not(.rank):not(.chart--share):not(.chart--compact) { overflow-x: auto; }
  .chart:not(.rank):not(.chart--share):not(.chart--compact) svg { min-width: 560px; }
}
