/* ==========================================================================
   Licors Moyà · Cartas digitales v2 · Tokens + componentes Dashboard 2.0
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f5f2ef;
  --surface: #ffffff;
  --surface-2: #faf7f5;
  --surface-3: #f1ece8;
  --line: #e6dfda;
  --line-strong: #d3c9c2;
  --text: #1e1a1b;
  --text-2: #4f4749;
  --muted: #776f71;
  --brand: #761a23;
  --brand-600: #5c121a;
  --brand-ink: #ffffff;
  --brand-weak: rgba(118, 26, 35, .08);
  --brand-weak-2: rgba(118, 26, 35, .16);
  --gold: #8a5d0c;
  --gold-weak: rgba(176, 122, 18, .12);
  --focus: #2a78d6;

  /* Series (validadas: scripts/validate_palette — light, surface #fff) */
  --series-1: #9b2c3a;
  --series-2: #2a78d6;
  --series-3: #b07a12;
  --series-neutral: #b9b2ad;
  --grid: #ece6e1;
  --axis: #c9c0b9;

  /* Estados (siempre con icono + texto) */
  --good: #0c7a2e;   --good-bg: #e6f4ea;
  --warn: #8a5a00;   --warn-bg: #fdf2d8;
  --serious: #a3461f;--serious-bg: #fbe7dd;
  --crit: #b42828;   --crit-bg: #fbe3e3;
  --info: #1d5fa8;   --info-bg: #e5effa;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(30, 26, 27, .05), 0 6px 18px rgba(30, 26, 27, .05);
  --shadow-lg: 0 24px 60px rgba(30, 26, 27, .22);
  --font: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: Georgia, 'Times New Roman', serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121011; --surface: #1c1a1b; --surface-2: #221f20; --surface-3: #2a2627;
    --line: #353031; --line-strong: #4a4344; --text: #f2eeec; --text-2: #d2cbc9; --muted: #a59c9d;
    --brand: #d0566a; --brand-600: #e07385; --brand-ink: #1c1a1b;
    --brand-weak: rgba(208, 86, 106, .12); --brand-weak-2: rgba(208, 86, 106, .22);
    --gold: #d9a645; --gold-weak: rgba(180, 126, 34, .18); --focus: #6aa8f0;
    --series-1: #d0566a; --series-2: #3987e5; --series-3: #b47e22; --series-neutral: #6b6365;
    --grid: #2b2728; --axis: #3d3738;
    --good: #4cc26f; --good-bg: rgba(12, 163, 12, .14);
    --warn: #f3c050; --warn-bg: rgba(250, 178, 25, .14);
    --serious: #f09a72; --serious-bg: rgba(236, 131, 90, .16);
    --crit: #f07a7a; --crit-bg: rgba(208, 59, 59, .18);
    --info: #7db3f2; --info-bg: rgba(57, 135, 229, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121011; --surface: #1c1a1b; --surface-2: #221f20; --surface-3: #2a2627;
  --line: #353031; --line-strong: #4a4344; --text: #f2eeec; --text-2: #d2cbc9; --muted: #a59c9d;
  --brand: #d0566a; --brand-600: #e07385; --brand-ink: #1c1a1b;
  --brand-weak: rgba(208, 86, 106, .12); --brand-weak-2: rgba(208, 86, 106, .22);
  --gold: #d9a645; --gold-weak: rgba(180, 126, 34, .18); --focus: #6aa8f0;
  --series-1: #d0566a; --series-2: #3987e5; --series-3: #b47e22; --series-neutral: #6b6365;
  --grid: #2b2728; --axis: #3d3738;
  --good: #4cc26f; --good-bg: rgba(12, 163, 12, .14);
  --warn: #f3c050; --warn-bg: rgba(250, 178, 25, .14);
  --serious: #f09a72; --serious-bg: rgba(236, 131, 90, .16);
  --crit: #f07a7a; --crit-bg: rgba(208, 59, 59, .18);
  --info: #7db3f2; --info-bg: rgba(57, 135, 229, .16);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .25);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
}

/* ==========================================================================
   Dashboard 2.0
   ========================================================================== */
.dv2 { color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }
.dv2 *:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.dv2 a { color: var(--brand); }
.dv2 h1, .dv2 h2, .dv2 h3 { color: var(--text); margin: 0; }
.dv2 .num { font-variant-numeric: tabular-nums; }

/* Sub-navegación de secciones */
.dv2-tabs {
  position: sticky; top: 64px; z-index: 20;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -24px 22px; padding: 10px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.dv2-tabs::-webkit-scrollbar { display: none; }
.dv2-tab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  padding: 8px 14px; border-radius: 999px; font-weight: 500; font-size: 13.5px; cursor: pointer;
}
.dv2-tab .n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dv2-tab:hover { background: var(--surface); border-color: var(--line); }
.dv2-tab[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }
.dv2-tab[aria-selected="true"] .n { color: inherit; opacity: .75; }
.dv2-tab .badge-dot { min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px; font-size: 11px; line-height: 20px; text-align: center; background: var(--crit-bg); color: var(--crit); font-weight: 700; }

/* Hero */
.dv2-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 6px 0 22px; flex-wrap: wrap; }
.dv2-eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin-bottom: 8px; }
.dv2-hero h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.08; letter-spacing: -.5px; }
.dv2-hero h1 em { font-style: italic; color: var(--brand); }
.dv2-hero p { color: var(--text-2); max-width: 720px; margin: 10px 0 0; font-size: 15px; }
.dv2-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Botones */
.dv2-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 500; line-height: 1.2; text-decoration: none !important;
}
.dv2-btn:hover { border-color: var(--brand); color: var(--brand); }
.dv2-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.dv2-btn.primary:hover { background: var(--brand-600); color: var(--brand-ink); }
.dv2-btn.ghost { border-color: transparent; background: transparent; }
.dv2-btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.dv2-btn[disabled] { opacity: .5; cursor: not-allowed; }

.dv2-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; }
.dv2-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }

/* Grids */
.dv2-grid { display: grid; gap: 16px; }
.dv2-g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dv2-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dv2-g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dv2-wide { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
.dv2-gap { margin-top: 16px; }
@media (max-width: 1280px) { .dv2-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .dv2-wide, .dv2-g3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .dv2-g4, .dv2-g2 { grid-template-columns: minmax(0, 1fr); } }

/* Panel */
.dv2-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.dv2-panel-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.dv2-panel-h h2 { font-size: 16px; font-weight: 600; }
.dv2-panel-h .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dv2-panel-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* KPI */
.dv2-kpi {
  position: relative; text-align: left; width: 100%; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; box-shadow: var(--shadow); color: var(--text);
  transition: transform .15s ease, border-color .15s ease;
}
.dv2-kpi:hover { transform: translateY(-2px); border-color: var(--brand-weak-2); }
.dv2-kpi .lbl { font-size: 12px; color: var(--text-2); font-weight: 500; padding-right: 22px; display: block; min-height: 2.6em; }
.dv2-kpi .val { font-size: 32px; font-weight: 600; letter-spacing: -.5px; line-height: 1.1; margin: 6px 0 4px; display: block; }
.dv2-kpi .val small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.dv2-kpi .val.pending { font-size: 20px; color: var(--gold); padding: 8px 0 4px; }
.dv2-kpi .foot { font-size: 12px; color: var(--muted); display: block; }
.dv2-kpi .info { position: absolute; top: 12px; right: 12px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); font: 600 11px/18px var(--font-display); font-style: italic; text-align: center; color: var(--muted); }
.dv2-kpi.accent { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-600) 100%); border-color: transparent; color: #fff; }
.dv2-kpi.accent .lbl, .dv2-kpi.accent .foot, .dv2-kpi.accent .val small { color: rgba(255, 255, 255, .82); }
.dv2-kpi.accent .info { border-color: rgba(255, 255, 255, .5); color: #fff; }
:root[data-theme="dark"] .dv2-kpi.accent { color: #1c1a1b; }
:root[data-theme="dark"] .dv2-kpi.accent .lbl, :root[data-theme="dark"] .dv2-kpi.accent .foot, :root[data-theme="dark"] .dv2-kpi.accent .val small { color: rgba(28, 26, 27, .78); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dv2-kpi.accent { color: #1c1a1b; }
  :root:not([data-theme="light"]) .dv2-kpi.accent .lbl, :root:not([data-theme="light"]) .dv2-kpi.accent .foot, :root:not([data-theme="light"]) .dv2-kpi.accent .val small { color: rgba(28, 26, 27, .78); }
}
.dv2-meter { display: block; height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.dv2-meter > span { display: block; height: 100%; border-radius: 3px; background: var(--series-1); }
.dv2-kpi.accent .dv2-meter { background: rgba(255, 255, 255, .25); }
.dv2-kpi.accent .dv2-meter > span { background: #fff; }

/* Tags */
.dv2-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.dv2-tag.good { background: var(--good-bg); color: var(--good); }
.dv2-tag.warn { background: var(--warn-bg); color: var(--warn); }
.dv2-tag.serious { background: var(--serious-bg); color: var(--serious); }
.dv2-tag.crit { background: var(--crit-bg); color: var(--crit); }
.dv2-tag.info { background: var(--info-bg); color: var(--info); }
.dv2-tag.brand { background: var(--brand-weak); color: var(--brand); }
.dv2-tag.gold { background: var(--gold-weak); color: var(--gold); }

/* Notas */
.dv2-note { border: 1px solid var(--line); border-left: 3px solid var(--gold); background: var(--gold-weak); color: var(--text-2); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.dv2-note.info { border-left-color: var(--series-2); background: var(--info-bg); }
.dv2-note strong { color: var(--text); }

/* Filtros */
.dv2-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.dv2-field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.dv2-field.grow { flex: 1 1 220px; }
.dv2-field label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.dv2 input[type="search"], .dv2 input[type="number"], .dv2 input[type="text"], .dv2 select {
  height: 36px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  border-radius: 9px; padding: 0 10px; font: inherit; font-size: 13px; width: 100%;
}
.dv2 input:focus, .dv2 select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-weak); }
.dv2-check { display: inline-flex; align-items: center; gap: 8px; height: 36px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.dv2-check input { accent-color: var(--brand); width: 16px; height: 16px; }

/* Tabla */
.dv2-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.dv2-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dv2-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dv2-table th[data-sort] { cursor: pointer; }
.dv2-table th[data-sort]:hover { color: var(--text); }
.dv2-table th .arr { opacity: .35; margin-left: 4px; }
.dv2-table th.sorted .arr { opacity: 1; color: var(--brand); }
.dv2-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text); background: var(--surface); }
.dv2-table tr:last-child td { border-bottom: 0; }
.dv2-table tbody tr:hover td { background: var(--surface-2); }
.dv2-table .r { text-align: right; font-variant-numeric: tabular-nums; }
.dv2-table .strong { font-weight: 600; }
.dv2-table .sub { display: block; font-size: 12px; color: var(--muted); }
.dv2-table .hot { color: var(--crit); font-weight: 600; }
.dv2-table .warm { color: var(--warn); font-weight: 600; }
.dv2-table .ok { color: var(--good); }
.dv2-table tr.clickable { cursor: pointer; }
.dv2-empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 12px; }
.dv2-pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.dv2-pager .ctrl { display: flex; gap: 6px; align-items: center; }

/* Barras horizontales HTML (ranking) */
.dv2-bars { display: flex; flex-direction: column; gap: 9px; }
.dv2-bar { display: grid; grid-template-columns: minmax(110px, 34%) 1fr 56px; gap: 10px; align-items: center; font-size: 13px; }
.dv2-bar .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.dv2-bar .track { display: block; height: 10px; background: var(--surface-3); border-radius: 0 5px 5px 0; overflow: hidden; }
.dv2-bar .fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.dv2-bar .fill.own { background: var(--series-1); }
.dv2-bar .fill.third { background: var(--series-2); }
.dv2-bar .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Gráficos */
.dv2-chart { position: relative; height: 280px; }
.dv2-chart.sm { height: 220px; }
.dv2-chart.lg { height: 340px; }
.dv2-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.dv2-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Donut */
.dv2-donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.dv2-donut { position: relative; width: 168px; height: 168px; flex: none; }
.dv2-donut .c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.dv2-donut .c b { font-size: 28px; font-weight: 600; }
.dv2-donut .c span { font-size: 11.5px; color: var(--muted); }

/* Hallazgos / avisos */
.dv2-findings { display: flex; flex-direction: column; gap: 10px; }
.dv2-finding { display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; width: 100%; color: var(--text); }
.dv2-finding:hover { border-color: var(--brand-weak-2); background: var(--surface-2); }
.dv2-finding .cnt { height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }
.dv2-finding .cnt.alta { background: var(--crit-bg); color: var(--crit); }
.dv2-finding .cnt.media { background: var(--warn-bg); color: var(--warn); }
.dv2-finding .cnt.baja { background: var(--info-bg); color: var(--info); }
.dv2-finding .cnt.zero { background: var(--good-bg); color: var(--good); }
.dv2-finding .t { font-weight: 600; font-size: 14px; }
.dv2-finding .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dv2-finding .go { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Calculadora */
.dv2-calc-lines { display: flex; flex-direction: column; gap: 10px; container-type: inline-size; min-width: 0; }
.dv2-calc-line { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, .8fr) repeat(4, minmax(0, 1fr)) minmax(0, 1.1fr) 36px; min-width: 0; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.dv2-calc-line .dv2-field { min-width: 0; }
.dv2-calc-line .res { font-size: 12px; color: var(--muted); grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; }
.dv2-calc-line .res b { color: var(--text); font-variant-numeric: tabular-nums; }
.dv2-calc-line [data-del] { width: 36px; padding: 0; justify-content: center; }
/* La línea se adapta al ancho de su panel (no al de la ventana): 3 campos por fila y, en muy estrecho, 2 */
@container (max-width: 860px) {
  .dv2-calc-line { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dv2-calc-line > .dv2-field { grid-column: span 2; }
  .dv2-calc-line > .dv2-field:first-child { grid-column: 1 / 6; grid-row: 1; }
  .dv2-calc-line > [data-del] { grid-column: 6; grid-row: 1; justify-self: end; }
}
@container (max-width: 440px) { .dv2-calc-line > .dv2-field { grid-column: span 3; } }
.dv2-total { background: linear-gradient(135deg, var(--brand), var(--brand-600)); color: #fff; border-radius: var(--radius); padding: 20px; }
.dv2-total .row-t { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, .18); font-size: 13.5px; }
.dv2-total .row-t:last-child { border: 0; }
.dv2-total .big { font-size: 34px; font-weight: 600; letter-spacing: -.5px; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.dv2-total .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; opacity: .8; }
:root[data-theme="dark"] .dv2-total { color: #1c1a1b; }
:root[data-theme="dark"] .dv2-total .row-t { border-color: rgba(28, 26, 27, .2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dv2-total { color: #1c1a1b; } }
.dv2-suggest { position: relative; }
.dv2-suggest ul { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; }
.dv2-suggest li { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.dv2-suggest li:hover, .dv2-suggest li.on { background: var(--brand-weak); }
.dv2-suggest li small { color: var(--muted); display: block; }

/* Diccionario / método */
.dv2-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-3); color: var(--text); padding: 2px 6px; border-radius: 6px; word-break: break-word; }
.dv2-recon { display: grid; grid-template-columns: 1fr auto; gap: 0; }
.dv2-recon > div { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.dv2-recon > div:nth-child(even) { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Drawer */
.dv2-overlay { position: fixed; inset: 0; background: rgba(15, 12, 13, .45); z-index: 1040; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.dv2-overlay.open { opacity: 1; pointer-events: auto; }
.dv2-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); z-index: 1050; background: var(--surface); color: var(--text); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateX(102%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; font-family: var(--font); }
.dv2-drawer.open { transform: none; }
.dv2-drawer header { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; }
.dv2-drawer header h3 { font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.15; margin-top: 4px; color: var(--text); }
.dv2-drawer .body { padding: 18px 24px 28px; overflow-y: auto; flex: 1; }
.dv2-drawer dl { margin: 0; }
.dv2-drawer dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-top: 16px; }
.dv2-drawer dd { margin: 4px 0 0; font-size: 14px; color: var(--text); }
.dv2-drawer dd.result { font-size: 30px; font-weight: 600; }
.dv2-drawer .formula { display: block; background: var(--surface-3); border-left: 3px solid var(--brand); padding: 10px 12px; border-radius: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; }
.dv2-drawer .ev { list-style: none; padding: 0; margin: 8px 0 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dv2-drawer .ev li { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.dv2-drawer .ev li:last-child { border: 0; }
.dv2-drawer .ev li small { display: block; color: var(--muted); }
.dv2-close { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); width: 36px; height: 36px; border-radius: 10px; font-size: 18px; line-height: 1; flex: none; cursor: pointer; }

/* Toast */
.dv2-toast { position: fixed; right: 20px; bottom: 20px; z-index: 1060; background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13px; opacity: 0; transform: translateY(10px); transition: all .2s ease; pointer-events: none; }
.dv2-toast.show { opacity: 1; transform: none; }

/* Carga */
.dv2-skel { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: dv2sk 1.2s ease-in-out infinite; border-radius: 10px; }
@keyframes dv2sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .dv2-skel { animation: none; } .dv2-kpi, .dv2-drawer { transition: none; } }

.dv2-section { display: none; }
.dv2-section.active { display: block; animation: dv2in .25s ease; }
@keyframes dv2in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.dv2-foot { margin: 34px 0 10px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }

@media print {
  .dv2-tabs, .dv2-hero-actions, nav.navbar, nav.sidebar, .dv2-btn, .dv2-filters { display: none !important; }
  .dv2-section { display: none !important; }
  .dv2-section.active { display: block !important; }
  main { padding-top: 0 !important; max-width: 100% !important; flex: 0 0 100% !important; }
}

/* ---------- Top por tipo de cliente ---------- */
.dv2-tt { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 10px; background: var(--surface); min-width: 0; }
.dv2-tt h3 { font-size: 14px; font-weight: 600; }
.dv2-tt .meta { font-size: 12px; color: var(--muted); margin: 2px 0 10px; }
.dv2-tt ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.dv2-tt li button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 18px minmax(0, 1fr); column-gap: 8px; width: 100%; padding: 6px 6px; border-radius: 8px; cursor: pointer; }
.dv2-tt li button:hover { background: var(--surface-2); }
.dv2-tt li button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.dv2-tt .rk { grid-row: span 2; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.dv2-tt .nm { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv2-tt .br { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 4px; }
.dv2-tt .track { height: 8px; background: var(--surface-3); border-radius: 0 4px 4px 0; overflow: hidden; }
.dv2-tt .fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.dv2-tt .v { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dv2-tt .v b { color: var(--text); }

/* ---------- Dónde está (detalle de referencia) ---------- */
.dv2-presence-types { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.dv2-drawer .dv2-table-wrap { max-height: 420px; overflow: auto; }
.dv2-drawer .dv2-table td, .dv2-drawer .dv2-table th { padding: 8px 10px; }
