/* Monitor de discrepancias A3 ↔ ePack · hoja de estilos única (CSP style-src 'self').
   Dirección «Triage ágil»: lista + panel de detalle, tokens claros y oscuros propios. */

/* ---------- Symbol glyphs ----------
   Noto Sans (Linux) has no precomposed ≠ and Liberation Sans (what "Arial" resolves to through
   fontconfig) draws ↔ → small and low. These faces cover only those code points, use fonts that are
   already installed (local(), never a download) and try DejaVu Sans before the Arial/Liberation
   alias; Segoe UI and Helvetica Neue win on Windows and macOS. */
@font-face { font-family: "UI Symbols"; font-weight: 100 549; src: local("Segoe UI"), local("SegoeUI"), local("Helvetica Neue"), local("HelveticaNeue"), local("DejaVu Sans"), local("DejaVuSans"), local("Arial"), local("ArialMT"), local("Liberation Sans"), local("LiberationSans"); unicode-range: U+2190-21FF, U+2212, U+2260; }
@font-face { font-family: "UI Symbols"; font-weight: 550 900; src: local("Segoe UI Semibold"), local("SegoeUI-Semibold"), local("Segoe UI Bold"), local("SegoeUI-Bold"), local("Helvetica Neue Bold"), local("HelveticaNeue-Bold"), local("DejaVu Sans Bold"), local("DejaVuSans-Bold"), local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold"); unicode-range: U+2190-21FF, U+2212, U+2260; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --font: "UI Symbols", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "UI Symbols", ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Consolas, "Noto Sans Mono", "DejaVu Sans Mono", "Liberation Mono", Menlo, monospace;

  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --sunken: #eef0ec;
  --hover: #f3f5f1;
  --row-hover: #f3f4f2;
  --line: #e3e6e1;
  --line-strong: #cfd5ce;

  --ink: #16221c;
  --ink-2: #3b4842;
  --muted: #5b6962;

  --brand: #1b5e45;
  --brand-strong: #134634;
  --brand-soft: #e7f1ec;
  --brand-line: #a9cbbb;
  --on-brand: #ffffff;
  --focus: #2563eb;

  /* Sign of Δ and negative balances: one cool/warm pair, always with a glyph or an icon + text. */
  --pos: #1d5fae;
  --neg: #a63d24;
  --neg-soft: #fbece6;
  --neg-line: #efc3b4;
  /* System errors only (no snapshot, login): never used for data. */
  --danger: #b3261e;
  --danger-soft: #fdeceb;
  --danger-line: #efbcb7;
  --warn-ink: #7a4a00;
  --warn-soft: #fdf0d3;
  --warn-line: #eccb85;
  --warn-icon: #b26f00;
  --ok-ink: #17643f;
  --ok-soft: #e2f2e8;
  --ok-line: #a9d5bb;

  /* Row-local bars and the read-window timeline: A3 neutral slate, ePack brand green. */
  --src-a3: #64748b;
  --src-epack: #1b5e45;
  --mark-bg: #ffe39a;
  --mark-ink: #16221c;
  --caveat-bg: #fbf5e6;
  --caveat-line: #ecdcb4;

  --shadow-sm: 0 1px 2px rgb(22 34 28 / .06);
  --shadow-md: 0 1px 2px rgb(22 34 28 / .05), 0 6px 16px -6px rgb(22 34 28 / .12);
  --shadow-pop: 0 2px 6px rgb(22 34 28 / .08), 0 28px 56px -16px rgb(22 34 28 / .32);
  --shadow-bar: 0 -8px 18px -14px rgb(22 34 28 / .45);
  --backdrop: rgb(12 22 17 / .44);

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --t-fast: 120ms;
  --t-med: 180ms;
  --gutter: 16px;
  --pane-w: clamp(360px, 30vw, 460px);
  --control-h: 34px;
  --chip-h: 30px;
  --sticky-top: 0px;

  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0c1110;
    --surface: #131a17;
    --surface-2: #17201c;
    --sunken: #0f1513;
    --hover: #1a2420;
    --row-hover: #1a1e1d;
    --line: #24302b;
    --line-strong: #34423c;
    --ink: #e6ece8;
    --ink-2: #c3cdc8;
    --muted: #97a69e;
    --brand: #6fc59d;
    --brand-strong: #8fd6b4;
    --brand-soft: #16302a;
    --brand-line: #2f6b54;
    --on-brand: #07130d;
    --focus: #7aa7ff;
    --pos: #8ab8ff;
    --neg: #ef9a78;
    --neg-soft: #34190f;
    --neg-line: #6e3a28;
    --danger: #ff8a80;
    --danger-soft: #3a1916;
    --danger-line: #6e2f29;
    --warn-ink: #f2c46b;
    --warn-soft: #332610;
    --warn-line: #6b5120;
    --warn-icon: #f2c46b;
    --ok-ink: #7fd3a5;
    --ok-soft: #12291e;
    --ok-line: #2b5a41;
    --src-a3: #a3b1c2;
    --src-epack: #3fa877;
    --mark-bg: #5c4612;
    --mark-ink: #fff4d6;
    --caveat-bg: #1d1a10;
    --caveat-line: #3d3418;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 1px 2px rgb(0 0 0 / .35), 0 8px 20px -8px rgb(0 0 0 / .6);
    --shadow-pop: 0 2px 8px rgb(0 0 0 / .5), 0 28px 60px -16px rgb(0 0 0 / .75);
    --shadow-bar: 0 -10px 20px -14px rgb(0 0 0 / .9);
    --backdrop: rgb(2 6 4 / .66);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg); }
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--brand); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--focus) 28%, transparent); }
mark { background: var(--mark-bg); color: var(--mark-ink); border-radius: 3px; padding: 0 1px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
kbd { font-family: var(--mono); font-size: 11px; line-height: 1; min-width: 18px; padding: 3px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.clipboard-proxy { position: fixed; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-xs { width: 13px; height: 13px; stroke-width: 2; vertical-align: -2px; }
.noscript { margin: 16px; padding: 12px 16px; border: 1px solid var(--danger-line); background: var(--danger-soft); color: var(--danger); border-radius: var(--r-md); }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 50; padding: 8px 12px; border-radius: var(--r-md); background: var(--brand); color: var(--on-brand); font-weight: 600; text-decoration: none; transition: top var(--t-fast); }
.skip-link:focus { top: 10px; }

/* ---------- Buttons, chips, tags, badges ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-h); padding: 0 12px; border: 1px solid transparent; border-radius: var(--r-md); background: transparent; font-size: 13px; font-weight: 600; letter-spacing: .005em; white-space: nowrap; transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast); }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--hover); border-color: color-mix(in srgb, var(--line-strong) 60%, var(--ink) 40%); }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.btn-icon { width: var(--control-h); padding: 0; color: var(--ink-2); }
.btn-icon:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.btn-small { height: 28px; padding: 0 9px; font-size: 12px; gap: 5px; }
.btn:disabled { opacity: .45; box-shadow: none; }
.btn[aria-disabled="true"] { opacity: .6; cursor: progress; }
.btn-link { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 4px 6px; border-radius: var(--r-sm); color: var(--brand); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.btn-link:hover { background: var(--brand-soft); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--sunken); color: var(--ink-2); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.count:empty { display: none; }
.count-on-primary { background: color-mix(in srgb, var(--on-brand) 18%, transparent); color: var(--on-brand); }
.count-strong { background: var(--brand); color: var(--on-brand); }
.label-short { display: none; }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: var(--chip-h); padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; flex: none; transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.chip .icon { width: 14px; height: 14px; color: var(--muted); }
.chip .chip-icon-neg { color: var(--neg); }
.chip:hover { background: var(--hover); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); box-shadow: inset 0 0 0 1px var(--brand); }
.chip[aria-pressed="true"] .icon { color: currentColor; }
.chip-count { font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .chip-count { color: currentColor; opacity: .8; }
.chip-count:empty { display: none; }
.chip.is-empty:not([aria-pressed="true"]) { color: var(--muted); }
.chip-wh-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); flex: none; }

.badge, .pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--sunken); color: var(--ink-2); font-size: 11px; font-weight: 650; line-height: 1; white-space: nowrap; }
.badge .icon, .pill .icon { width: 12px; height: 12px; stroke-width: 2; }
[data-tone="warn"].badge { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
[data-tone="ok"].badge { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.pill-neg { background: var(--neg-soft); border-color: var(--neg-line); color: var(--neg); }
.pill-neutral { background: var(--sunken); border-color: var(--line); color: var(--ink-2); }
.pill-lg { height: 26px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.pill-lg .icon { width: 14px; height: 14px; }

/* The Δ label itself, rendered as the unit badge: amber pending, green verified. */
.dbadge { display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 7px; border: 1px solid; border-radius: 999px; font-size: 10.5px; font-weight: 650; line-height: 1; letter-spacing: .005em; white-space: nowrap; }
.dbadge .icon { width: 12px; height: 12px; stroke-width: 2.1; }
.dbadge[data-tone="warn"] { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.dbadge[data-tone="ok"] { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.dbadge-lg { height: 26px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.dbadge-lg .icon { width: 14px; height: 14px; }
.neg-icon { width: 13px; height: 13px; stroke-width: 2.1; vertical-align: -2px; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 6px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark rect { fill: var(--brand); }
.brand-mark path { stroke: var(--on-brand); stroke-width: 2.6; stroke-linecap: round; fill: none; }
.brand-mark circle { fill: var(--mark-bg); }
.brand-text { min-width: 0; }
.brand-text h1 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.logout { display: contents; }
.freshness { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.freshness-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 18%, transparent); }
.freshness[data-tone="old"] { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-ink); }
.freshness[data-tone="old"] .freshness-dot { background: var(--warn-icon); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn-icon) 22%, transparent); }
.freshness[data-tone="error"] { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.freshness[data-tone="error"] .freshness-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.freshness[data-busy="true"] .freshness-dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.is-loading .btn-refresh .icon, .is-loading .btn-refresh-bar .icon { animation: spin .9s linear infinite; }

.load-alert { display: none; }

/* ---------- Overview: KPI presets + provenance ---------- */
.overview { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 10px var(--gutter); }
.kpi-block { min-width: 0; flex: 1 1 auto; container: kpis / inline-size; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); line-height: 1.3; }
.eyebrow-note { text-transform: none; letter-spacing: 0; font-weight: 500; }
.kpis { display: flex; gap: 2px; margin: 5px 0 0 -10px; }
.kpi { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 1px; flex: 1 1 auto; max-width: 270px; padding: 4px 10px 5px; border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink); text-align: left; transition: background-color var(--t-fast), box-shadow var(--t-fast); }
.kpi + .kpi::before { content: ""; position: absolute; left: -2px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.kpi:hover { background: var(--hover); }
.kpi:hover::before, .kpi:hover + .kpi::before, .kpi[aria-pressed="true"]::before, .kpi[aria-pressed="true"] + .kpi::before { opacity: 0; }
.kpi[aria-pressed="true"] { background: var(--brand-soft); box-shadow: inset 0 -2px 0 var(--brand); }
.kpi:focus-visible { outline-offset: 0; }
.kpi-label { display: flex; align-items: flex-start; gap: 5px; font-size: 12px; font-weight: 500; line-height: 1.25; color: var(--muted); }
.kpi[aria-pressed="true"] .kpi-label { color: var(--brand-strong); }
.kpi-icon { width: 13px; height: 13px; margin-top: 1px; stroke-width: 2; }
.kpi[data-tone="warn"] .kpi-icon { color: var(--warn-icon); }
.kpi[data-tone="ok"] .kpi-icon { color: var(--ok-ink); }
.kpi[data-tone="neg"] .kpi-icon { color: var(--neg); }
.kpi-figure { display: flex; align-items: baseline; flex-wrap: nowrap; gap: 0 6px; }
.kpi-value { font-size: 21px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; color: var(--ink); }
.kpi-share { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.kpi[aria-pressed="true"] .kpi-share { color: var(--brand-strong); }
/* Keep the strip height stable while the snapshot loads (no layout shift under the sticky bars). */
.kpi-share:empty::before { content: "\00a0"; }

.provenance { flex: 0 0 auto; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 2px; padding-left: 20px; border-left: 1px solid var(--line); font-size: 12px; line-height: 1.4; }
.provenance > div { display: contents; }
.provenance dt { color: var(--muted); white-space: nowrap; }
.provenance dd { color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 0; }
.coverage-line { display: flex; align-items: center; gap: 6px; }
.provenance .badge { height: 18px; font-size: 10.5px; }
.madrid { color: var(--muted); }
.stamp-note { color: var(--warn-ink); font-weight: 600; }
.nowrap { white-space: nowrap; }
.fresh-flag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border: 1px solid var(--warn-line); border-radius: 999px; background: var(--warn-soft); color: var(--warn-ink); font-weight: 650; white-space: nowrap; vertical-align: 1px; }
.fresh-flag .icon { width: 12px; height: 12px; stroke-width: 2; }
@media (min-width: 1200px) and (max-width: 1499px) { .cov-unit, .provenance .madrid { display: none; } }
@media (min-width: 1200px) and (max-width: 1399px) { #coverage-detail { display: none; } }
/* Six one-line figures need ~1000 px; below that the share keeps "31 %" and drops " de las filas". */
@container kpis (max-width: 1000px) { .kpi-rest:not(.kpi-rest-word) { display: none; } }

/* ---------- Caveat line + «Avisos y alcance» popover ---------- */
.caveat { position: relative; display: flex; align-items: center; gap: 10px; margin: 0 var(--gutter) 10px; padding: 4px 6px 4px 12px; min-height: 36px; border: 1px solid var(--caveat-line); border-radius: var(--r-md); background: var(--caveat-bg); color: var(--ink-2); font-size: 13px; }
.caveat-icon { color: var(--warn-icon); }
.caveat-text { flex: 1 1 auto; min-width: 0; line-height: 1.35; }
.caveat-text strong { color: var(--ink); font-weight: 650; }
.unit-warning { color: var(--warn-ink); font-weight: 600; }
.caveat-more { flex: none; }
.caveat-more > summary { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.caveat-more > summary::-webkit-details-marker { display: none; }
.caveat-more > summary:hover, .caveat-more[open] > summary { background: color-mix(in srgb, var(--warn-line) 30%, transparent); }
.caveat-more[open] > summary .chev { transform: rotate(180deg); }
.chev { transition: transform var(--t-fast); }
.count-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-ink); font-size: 11px; font-weight: 700; }
.count-badge:empty { display: none; }
.caveat-panel { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; width: min(1080px, 100%); max-height: var(--panel-max, min(78vh, 700px)); overflow: auto; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: 16px 28px; padding: 16px 18px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop); font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.cp-windows { grid-column: 1; grid-row: 1; }
.cp-scope { grid-column: 1; grid-row: 2; }
.cp-warnings { grid-column: 2; grid-row: 1 / span 2; }
.cp-legend { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--line); }
.caveat-panel h3 { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.cp-text { line-height: 1.5; }
.cp-text + .cp-text { margin-top: 6px; }
.cp-muted, .cp-note { color: var(--muted); font-size: 12px; line-height: 1.45; }
.cp-note { margin-top: 8px; }
.warning-list li { position: relative; padding-left: 14px; margin: 0 0 6px; line-height: 1.45; }
.warning-list li::before { content: ""; position: absolute; left: 2px; top: .6em; width: 5px; height: 5px; border-radius: 50%; background: var(--warn-icon); }
.cp-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; font-size: 12.5px; }
.cp-facts > div { display: contents; }
.cp-facts dt { color: var(--muted); white-space: nowrap; }
.cp-facts dd { color: var(--ink); font-variant-numeric: tabular-nums; }

.timeline { display: grid; gap: 7px; margin: 2px 0 12px; }
.tl-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 74px; align-items: center; gap: 10px; font-size: 12px; }
.tl-name { color: var(--ink-2); font-weight: 600; }
.tl-track { position: relative; height: 10px; border-radius: 3px; background: var(--sunken); }
.tl-bar { position: absolute; top: 0; bottom: 0; left: var(--l, 0%); width: var(--w, 0%); min-width: 3px; border-radius: 3px; }
.tl-bar[data-src="a3"] { background: var(--src-a3); }
.tl-bar[data-src="epack"] { background: var(--src-epack); }
.tl-gen { position: absolute; top: -4px; bottom: -4px; left: var(--g, 100%); width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.tl-dur { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-axis { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 84px 0 50px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-gen-key { display: inline-block; width: 2px; height: 11px; margin: 0 4px 0 1px; border-radius: 1px; background: var(--ink); vertical-align: -1px; }

.legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; }
.legend li { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12.5px; line-height: 1.4; }
.legend-key { display: inline-flex; align-items: center; gap: 8px; min-height: 20px; font-size: 12px; font-weight: 650; color: var(--ink); }
.legend-key .delta { font-size: 13px; }
.legend-neg { color: var(--neg); }
.legend-neg .icon { width: 14px; height: 14px; }

/* ---------- Workspace ---------- */
.workspace { padding: 0 var(--gutter) 12px; }
.records { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: clip; container-type: inline-size; container-name: records; }
.records:focus { outline: none; }

/* Sticky only once the snapshot is rendered: the bar's layer is then created at its final position
   (Chromium skipped its first raster when the content above grew on load). */
.viewbar { position: relative; top: 0; z-index: 4; padding: 10px 12px 0; background: var(--surface); }
[data-state="ready"] .viewbar { position: sticky; }
.viewbar-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.views { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 3px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.views::-webkit-scrollbar { display: none; }
.view { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; flex: none; transition: background-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast); }
.view:hover { color: var(--ink); }
.view[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand), 0 1px 2px rgb(0 0 0 / .08), 0 0 0 1px var(--line); }
.view[aria-pressed="true"] .count { background: var(--brand-soft); color: var(--brand-strong); }
.vl-short { display: none; }
@container records (max-width: 860px) {
  .view[data-tab="review"] .vl-long { display: none; }
  .view[data-tab="review"] .vl-short { display: inline; }
}
.kbd-hint { margin-left: auto; display: flex; align-items: center; gap: 4px; padding-left: 12px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.kbd-hint kbd { min-width: 17px; padding: 2px 4px; font-size: 10.5px; }
@container records (max-width: 950px) { .kbd-hint { display: none; } }
.view-summary { display: none; }

/* One line on desktop: search, then every chip in a single horizontal scroller. */
.toolbar { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.toolbar-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.search { position: relative; display: flex; align-items: center; flex: 0 0 clamp(244px, 18vw, 264px); min-width: 0; }
.search > .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: var(--chip-h); padding: 0 32px 0 32px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); font-size: 13px; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:hover { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--ink) 40%); }
.search input:focus-visible { outline: 2px solid transparent; outline-offset: 1px; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
/* Chromium reserves the clear button's room even while the field is empty, which clipped the placeholder. */
.search input:placeholder-shown::-webkit-search-cancel-button { display: none; }
.search-key { position: absolute; right: 7px; pointer-events: none; }
.search input:focus ~ .search-key, .search input:not(:placeholder-shown) ~ .search-key { display: none; }
.chip-line { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.chip-viewport { position: relative; display: flex; flex: 1 1 auto; min-width: 0; }
.chipbar { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; padding: 3px 3px; margin: -3px 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-padding-inline: 24px; }
.chipbar::-webkit-scrollbar { display: none; }
.chipbar.has-overflow:not(.at-end) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
.chipbar.has-overflow.scrolled:not(.at-end) { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 56px), transparent); mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 56px), transparent); }
.chipbar.has-overflow.scrolled.at-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 32px); mask-image: linear-gradient(to right, transparent, #000 32px); }
.chip-group { display: flex; align-items: center; gap: 6px; flex: none; }
.wh-chips { display: flex; align-items: center; gap: 6px; flex: none; }
.chip-divider { flex: none; width: 1px; height: 18px; background: var(--line-strong); margin: 0 3px; }
.chip-divider:has(+ .wh-chips:empty) { display: none; }
.btn-reset { flex: none; }
/* Mouse affordance for the one-line chip scroller (keyboard focus scrolls it by itself). */
.chip-scroll { position: absolute; top: 50%; z-index: 1; display: none; align-items: center; justify-content: center; width: 26px; height: 26px; margin-top: -13px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-sm); }
.chip-scroll:hover { background: var(--hover); color: var(--ink); }
.chip-scroll .icon { width: 14px; height: 14px; }
.chip-scroll[data-dir="prev"] { left: 0; }
.chip-scroll[data-dir="next"] { right: 0; }
.chip-viewport.can-next .chip-scroll[data-dir="next"], .chip-viewport.can-prev .chip-scroll[data-dir="prev"] { display: inline-flex; }

.active-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 12.5px; }
.view-note { flex: 1 1 100%; display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.view-note .icon { color: var(--muted); }
.active-label { color: var(--muted); font-weight: 600; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.active-chip, .qa-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 26px; max-width: 300px; padding: 0 8px 0 10px; border-radius: 999px; background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand-strong); font-size: 12px; font-weight: 600; white-space: nowrap; transition: background-color var(--t-fast); }
.active-chip span, .qa-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-chip:hover, .qa-chip:hover { background: color-mix(in srgb, var(--brand) 16%, var(--brand-soft)); }
.active-chip .icon, .qa-chip .icon { width: 12px; height: 12px; stroke-width: 2.2; opacity: .75; }
.active-chip:hover .icon, .qa-chip:hover .icon { opacity: 1; }

/* ---------- Records table ---------- */
.table-wrap { position: relative; min-height: 0; transition: opacity var(--t-med); scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.detail-body, .sheet-body { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.is-busy .table-wrap { opacity: .55; }
.records-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.col-wh { width: 144px; }
.col-num { width: 100px; }
.col-delta { width: 226px; }
/* A wide list (pane closed, large screens) shares the width instead of stretching «Artículo». */
@container records (min-width: 1100px) {
  .col-wh { width: 17%; }
  .col-num { width: 11%; }
  .col-delta { width: 19%; }
}
.records-table thead th { position: sticky; top: var(--sticky-top); z-index: 2; height: 40px; padding: 5px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; vertical-align: middle; white-space: nowrap; }
.records-table thead .th-num, .records-table thead .th-delta { text-align: right; }
.sort { display: inline-flex; align-items: center; gap: 4px; height: 22px; margin: 0 -6px; padding: 0 6px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; font-size: inherit; font-weight: inherit; }
.sort:hover { background: var(--hover); color: var(--ink); }
.sort .sort-icon { opacity: .55; }
th[aria-sort] .sort { color: var(--ink); }
th[aria-sort] .sort .sort-icon { opacity: 1; color: var(--brand); }
.sort-note { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.th-delta .sort { margin-right: -6px; }

.records-table tbody td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.records-table tbody tr { cursor: pointer; transition: background-color var(--t-fast); scroll-margin-top: 96px; scroll-margin-bottom: 12px; }
.records-table tbody tr:hover { background: var(--row-hover); }
.records-table tbody tr.is-selected { background: var(--brand-soft); }
.records-table tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.records-table tbody tr:has(.open:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.records-table tbody tr:has(.open:focus-visible) .open:focus-visible { outline-color: transparent; }
.records-table tbody tr:last-child td { border-bottom-color: transparent; }

/* Uniform two-line rows: code over description; value over unit; Δ over its badge. */
.art { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.open { display: inline-flex; align-items: center; max-width: 100%; min-height: 22px; margin: -2px -4px; padding: 1px 4px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink); font-family: var(--mono); font-size: 13px; font-weight: 700; letter-spacing: -.01em; line-height: 18px; text-align: left; overflow-wrap: anywhere; }
.open:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.open:focus-visible { outline-offset: 0; }
.art-desc { display: block; max-width: 100%; color: var(--ink-2); line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-wh .wh-name { display: block; color: var(--ink-2); line-height: 18px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-wh .wh-meta, .c-num .unit { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-num, .c-delta { text-align: right; font-variant-numeric: tabular-nums; }
.num { display: flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--ink); font-size: 13.5px; font-weight: 500; line-height: 18px; white-space: nowrap; }
.num.is-missing { color: var(--muted); font-style: italic; font-weight: 400; font-size: 12.5px; }
.is-negative .num { color: var(--neg); font-weight: 650; }
.dcell { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 0; }
.delta { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 14px; font-weight: 700; line-height: 18px; white-space: nowrap; color: var(--ink); }
.delta .icon { width: 11px; height: 11px; }
.delta .delta-flag { width: 13px; height: 13px; color: var(--muted); stroke-width: 2; }
.delta[data-tone="pos"] { color: var(--pos); }
.delta[data-tone="neg"] { color: var(--neg); }
.delta[data-tone="zero"] { color: var(--muted); font-weight: 600; }
.delta[data-tone="none"] { color: var(--muted); font-style: italic; font-weight: 500; font-size: 12.5px; }

/* ---------- List states ---------- */
.list-state { display: none; padding: 40px 24px 48px; }
[data-state="loading"] .list-state, [data-state="error"] .list-state { display: block; }
[data-state="loading"] .records-table, [data-state="empty"] .records-table, [data-state="error"] .records-table { display: none; }
.list-empty { padding: 36px 24px 44px; }
.state-card { max-width: 460px; margin: 0 auto; text-align: center; }
.state-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: var(--sunken); color: var(--muted); margin-bottom: 12px; }
.state-icon .icon { width: 22px; height: 22px; stroke-width: 1.6; }
[data-state="error"] .state-icon { background: var(--danger-soft); color: var(--danger); }
[data-state="loading"] .state-icon .icon { animation: pulse 1.2s ease-in-out infinite; }
.state-title { font-size: 15px; font-weight: 650; color: var(--ink); }
.state-text { margin-top: 6px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.state-actions:empty { display: none; }

/* ---------- Pager / list action bar ---------- */
.pager { border-top: 1px solid var(--line); background: var(--surface-2); padding: 7px 12px; font-size: 12.5px; }
.pager-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-height: 34px; }
.result-count { color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* Split view with a narrow list: keep the action bar on one line (the KPI strip shows the total). */
@media (min-width: 1200px) { @container records (max-width: 860px) { .rc-total { display: none; } } }
.pager-controls { display: inline-flex; align-items: center; gap: 2px; }
.pager-controls .btn-icon { width: 30px; height: 30px; }
.page-label { min-width: 92px; text-align: center; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.btn-density { height: 30px; padding: 0 9px; font-size: 12.5px; color: var(--ink-2); }
.btn-density[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-strong); box-shadow: inset 0 0 0 1px var(--brand); }
@container records (max-width: 900px) { .btn-density span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .btn-density { width: 30px; padding: 0; } }
.icon-density-compact { display: none; }
.density-compact .icon-density-compact { display: inline; }
.density-compact .icon-density-comfortable { display: none; }
.commandbar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.btn-refresh-bar { display: none; }
.pager-note { display: flex; align-items: center; gap: 6px; padding: 0 12px 7px; background: var(--surface-2); font-size: 11.5px; color: var(--muted); }

/* ---------- Detail (pane ≥1200 px, sheet below): head, scrolling body, foot ---------- */
.detail { padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); overflow: hidden; }
.detail::backdrop { background: var(--backdrop); }
.detail[open] { display: flex; flex-direction: column; }
.detail-inner { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: inherit; }
.detail-head { flex: none; padding: 12px 16px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.detail-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px -6px 4px 0; }
.detail-nav-buttons { display: flex; gap: 2px; }
.detail-nav .btn-icon { width: 30px; height: 30px; }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-code { font-family: var(--mono); font-size: 19px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; overflow-wrap: anywhere; color: var(--ink); }
.detail-code:focus { outline: none; }
.detail-code:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.detail-desc { margin-top: 4px; font-size: 14px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; }
/* The body scrolls between head and foot, so nothing ever sits behind the footer. */
.detail-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.detail-body > * { flex-shrink: 0; }
.only-phone { display: none; }
.detail-foot { flex: none; padding: 10px 16px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.detail-caveat { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.detail-caveat .icon { color: var(--warn-icon); }
.detail-foot-actions { display: flex; gap: 8px; margin-top: 10px; }
.detail-foot-actions .btn { flex: 1 1 auto; }
.detail-foot-actions .btn-step { display: none; }

.d-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; color: var(--ink-2); }
.d-meta .icon { color: var(--muted); }
.d-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.d-delta { position: relative; overflow: hidden; padding: 12px 14px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.d-delta::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line-strong); }
.d-delta[data-tone="pos"]::before { background: var(--pos); }
.d-delta[data-tone="neg"]::before { background: var(--neg); }
.d-delta-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.d-delta-value { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.d-delta-value .icon { width: 16px; height: 16px; }
.d-delta-value[data-tone="pos"] { color: var(--pos); }
.d-delta-value[data-tone="neg"] { color: var(--neg); }
.d-delta-value[data-tone="zero"] { color: var(--ink-2); }
.d-delta-value[data-tone="none"] { color: var(--muted); font-size: 18px; font-style: italic; font-weight: 500; }
.d-delta-read { margin-top: 6px; font-size: 13.5px; color: var(--ink); line-height: 1.45; }
.d-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.src { padding: 10px 12px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.src-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--ink); }
.src-head small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; flex: none; }
.swatch-a3 { background: var(--src-a3); }
.swatch-epack { background: var(--src-epack); }
.src-value { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; color: var(--ink); overflow-wrap: anywhere; }
.src-value .neg-icon { width: 16px; height: 16px; }
.src-value.is-missing { font-size: 15px; font-style: italic; font-weight: 500; color: var(--muted); }
.src.is-negative .src-value { color: var(--neg); }
.src-unit { margin-top: 3px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.src .pill { margin-top: 8px; }

.d-bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 92px; align-items: center; gap: 8px; font-size: 12px; }
.bar-label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 600; }
.bar-track { position: relative; height: 12px; border-radius: 3px; background: var(--sunken); }
.bar-zero { position: absolute; z-index: 1; top: -3px; bottom: -3px; left: var(--zero, 0%); width: 1px; background: var(--ink-2); }
.bar-fill { position: absolute; top: 0; bottom: 0; left: var(--from, 0%); width: var(--size, 0%); min-width: 2px; border-radius: 0 4px 4px 0; }
.bar-fill[data-src="a3"] { background: var(--src-a3); }
.bar-fill[data-src="epack"] { background: var(--src-epack); }
.bar-fill[data-dir="neg"] { border-radius: 4px 0 0 4px; background: var(--neg); }
.bar-fill[data-empty="true"] { display: none; }
.bar-val { min-width: 0; overflow-wrap: anywhere; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-val.is-negative { color: var(--neg); }
.bar-axis { position: relative; height: 14px; margin-left: 64px; margin-right: 100px; font-size: 10.5px; color: var(--muted); }
.bar-axis span { position: absolute; left: var(--zero, 0%); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.bars-cap { font-size: 11.5px; color: var(--muted); }

.d-section-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.d-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); border-top: 1px solid var(--line); font-size: 13px; }
.d-facts > div { display: contents; }
.d-facts dt, .d-facts dd { padding: 7px 0; border-bottom: 1px solid var(--line); }
.d-facts dt { color: var(--muted); padding-right: 16px; white-space: nowrap; }
.d-facts dd { color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.d-facts dd.is-flag { color: var(--neg); font-weight: 650; }
.d-notes li { position: relative; padding-left: 14px; margin: 5px 0; font-size: 13px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; }
.d-notes li::before { content: ""; position: absolute; left: 2px; top: .6em; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.d-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 280px; text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }
.d-empty .state-icon { margin: 0; }
.d-empty strong { color: var(--ink); font-size: 15px; }
.d-empty kbd { margin: 0 1px; }
.detail.is-placeholder .detail-head, .detail.is-placeholder .detail-foot { display: none; }

/* ---------- Sheets (filters, shortcuts) ---------- */
.sheet { padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); width: min(400px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.sheet-center { width: min(460px, calc(100vw - 24px)); }
.sheet::backdrop { background: var(--backdrop); }
.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 16px; font-weight: 700; }
.sheet-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.sheet-foot { display: flex; justify-content: space-between; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 650; color: var(--ink); }
.field-hint { font-weight: 500; color: var(--muted); }
.field select { height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font-size: 13.5px; }
.field select:focus-visible { outline: 2px solid transparent; outline-offset: 1px; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.field-help { font-size: 12px; color: var(--muted); line-height: 1.45; }
.sheet-status { margin-top: -4px; padding: 8px 10px; border: 1px solid var(--brand-line); border-radius: var(--r-md); background: var(--brand-soft); color: var(--ink); font-size: 12.5px; line-height: 1.4; }
/* Empty, it stays in the accessibility tree (a live region must exist before it speaks) but takes no room. */
.sheet-status:empty { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.checks { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 2px; }
.checks legend { padding: 0; margin-bottom: 6px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); flex: none; }
.check small { color: var(--muted); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13.5px; }
.keys > div { display: contents; }
.keys dt { white-space: nowrap; color: var(--muted); }
.keys dd { color: var(--ink); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 96px; z-index: 60; max-width: min(460px, calc(100vw - 32px)); padding: 9px 14px; border-radius: var(--r-md); background: var(--ink); color: var(--surface); font-size: 13px; font-weight: 600; line-height: 1.4; box-shadow: var(--shadow-pop); transform: translate(-50%, 8px); opacity: 0; pointer-events: none; transition: opacity var(--t-med), transform var(--t-med); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Density: compacto (one line per record) ---------- */
/* Measured: the one-line Δ cell needs up to ~315 px (badge ≈ 195–205 px + value ≤ 100 px). */
.density-compact .col-wh { width: 112px; }
.density-compact .col-delta { width: 318px; }
@container records (min-width: 1100px) { .density-compact .col-wh { width: 15%; } .density-compact .col-num { width: 10%; } .density-compact .col-delta { width: 23%; } }
.density-compact .records-table tbody td { padding-top: 6px; padding-bottom: 6px; }
.density-compact .art { flex-direction: row; align-items: center; gap: 10px; }
.density-compact .open { flex: 0 1 auto; min-width: 0; max-width: 100%; white-space: nowrap; overflow-wrap: normal; }
.density-compact .open .code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.density-compact .art-desc { flex: 1 1 0; min-width: 0; font-size: 12.5px; }
.density-compact .c-wh .wh-meta, .density-compact .c-num .unit { display: none; }
.density-compact .dcell { flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: 8px; }
.density-compact .delta { font-size: 13.5px; }
.density-compact .dcell .dbadge { padding: 0 6px; font-size: 10px; gap: 3px; }
/* A narrow list (split view below ~1440 px): the Δ badge wraps on two short lines («Δ numérica ·» /
   «unidad pendiente»; colour and text carry it, as on phones), so the description keeps ~20–35 visible
   characters instead of a few. */
@container records (max-width: 940px) {
  .density-compact .col-wh { width: 104px; }
  .density-compact .col-num { width: 92px; }
  .density-compact .col-delta { width: 236px; }
  .density-compact .records-table thead th, .density-compact .records-table tbody td { padding-left: 8px; padding-right: 8px; }
  .density-compact .dcell .dbadge { height: auto; min-height: 19px; max-width: 116px; padding: 2px 7px; white-space: normal; line-height: 1.15; text-align: left; border-radius: 7px; }
  .density-compact .dcell .dbadge .icon { display: none; }
  .density-compact .dcell { align-items: flex-start; }
}

/* ---------- Desktop ≥ 1200 px: split view ---------- */
@media (min-width: 1200px) {
  .workspace { display: grid; grid-template-columns: minmax(0, 1fr) var(--pane-w); gap: 12px; align-items: start; }
  .workspace.pane-closed { grid-template-columns: minmax(0, 1fr); }
  .detail:not([open]) { display: none; }
  .detail[open] { position: sticky; inset: auto; top: 12px; margin: 0; width: auto; max-width: none; height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); z-index: 1; box-shadow: var(--shadow-sm); }
  .sheet:not(.sheet-center) { margin: 12px 12px 12px auto; height: calc(100dvh - 24px); }
  .sheet:not(.sheet-center) .sheet-inner { height: 100%; }
  .sheet:not(.sheet-center) .sheet-body { flex: 1 1 auto; }
}
/* ≥ 1200 px and ≥ 780 px tall: app shell, only the list and the pane scroll */
@media (min-width: 1200px) and (min-height: 780px) {
  html, body { height: 100%; }
  body { overflow: hidden; }
  .shell { height: 100dvh; display: flex; flex-direction: column; }
  .main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .workspace { flex: 1 1 auto; min-height: 0; align-items: stretch; }
  .records { min-height: 0; }
  .table-wrap { flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .detail[open] { position: relative; top: 0; height: 100%; max-height: none; min-height: 0; }
  .records-table tbody tr { scroll-margin-top: 44px; scroll-margin-bottom: 4px; }
}
@media (min-width: 1200px) and (max-height: 779px) {
  .detail[open] { height: var(--pane-h, calc(100dvh - 24px)); }
}

/* ---------- 900–1199 px: full-width list, detail as side sheet ---------- */
@media (max-width: 1199px) {
  .detail { width: min(520px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; border-radius: var(--r-lg) 0 0 var(--r-lg); border-right: 0; }
  .detail[open] { animation: sheet-in-right var(--t-med) ease-out; }
  .sheet:not(.sheet-center) { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; border-radius: var(--r-lg) 0 0 var(--r-lg); }
  .sheet:not(.sheet-center) .sheet-inner { height: 100%; }
  .sheet:not(.sheet-center) .sheet-body { flex: 1 1 auto; }
  .sheet:not(.sheet-center)[open] { animation: sheet-in-right var(--t-med) ease-out; }
  .overview { flex-wrap: wrap; row-gap: 10px; }
  .legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-block { flex: 1 1 100%; }
  .provenance { flex: 1 1 100%; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--line); grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 12px; }
}
/* Page-scroll layouts (900–1199 px, or a desktop under 780 px tall): the view bar and the table head
   stay on top, and the list actions stick to the bottom of the viewport like the phone bar. */
@media (max-width: 1199px), (max-height: 779px) {
  :root { --sticky-top: 48px; }
  .viewbar { padding-bottom: 8px; }
  .toolbar { padding-top: 2px; }
}
@media (min-width: 900px) and (max-width: 1199px), (min-width: 1200px) and (max-height: 779px) {
  [data-state="ready"] .pager { position: sticky; bottom: 0; z-index: 3; padding-bottom: calc(7px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-bar); }
  .records-table tbody tr { scroll-margin-top: 96px; scroll-margin-bottom: calc(64px + env(safe-area-inset-bottom)); }
}
@keyframes sheet-in-right { from { transform: translateX(24px); opacity: .4; } }
@keyframes sheet-in-up { from { transform: translateY(32px); opacity: .5; } }

/* ---------- < 900 px: cards, bottom command bar ---------- */
@media (max-width: 899px) {
  :root { --control-h: 40px; --chip-h: 40px; --sticky-top: 0px; }
  .active-chip { height: 40px; padding: 0 12px 0 14px; font-size: 13px; }
  .btn-link { min-height: 40px; padding: 0 10px; }
  .pager-controls .btn-icon { width: 40px; height: 40px; }
  .btn-density { height: 40px; min-width: 40px; }
  .detail-nav .btn-icon { width: 40px; height: 40px; }
  .kbd-hint { display: none; }
  .btn-small { height: 40px; padding: 0 12px; }
  .caveat-more > summary { min-height: 40px; }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .toolbar { padding: 10px 12px; gap: 8px; }
  .viewbar { padding: 8px 12px 6px; box-shadow: 0 1px 0 var(--line); }
  .views { display: flex; align-self: stretch; width: 100%; }
  .view { flex: 1 0 auto; height: 34px; justify-content: center; }
  /* P13: count + pressed quick filters stay visible in the sticky view bar. */
  .kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 8px 0 0; }
  .kpi { max-width: none; min-width: 0; min-height: 56px; padding: 6px 10px 7px; background: var(--surface); border: 1px solid var(--line); }
  .kpi + .kpi::before { display: none; }
  .kpi-figure { flex-wrap: wrap; }
  .kpi .kpi-rest { display: inline; }
  .view-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 6px; }
  .view-count { flex: none; font-size: 12px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .quick-active { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
  .qa-chip { height: 28px; padding: 0 7px 0 9px; font-size: 12px; }
  .qa-chip::after { content: ""; position: absolute; inset: -6px -2px; }
  .commandbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px -12px rgb(0 0 0 / .25); }
  .commandbar .btn { height: 44px; padding: 0 8px; }
  .btn-refresh-bar { display: inline-flex; }
  .btn-refresh, .btn-help { display: none; }
  .brand-sub { display: none; }
  .brand-text h1 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
  .label-long { display: none; }
  .label-short { display: inline; }
  .toolbar-line { flex-direction: column; align-items: stretch; gap: 10px; }
  .search { flex: none; }
  .search input { height: 40px; font-size: 16px; }
  .search-key { display: none; }
  .chip-line { margin: 0 -12px; padding: 0 12px; gap: 4px; }
  .chipbar, .chipbar.has-overflow.scrolled.at-end { -webkit-mask-image: none; mask-image: none; }
  .chipbar.has-overflow:not(.at-end), .chipbar.has-overflow.scrolled:not(.at-end) { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .chipbar { margin: -3px -3px -3px -3px; }
  .chip-viewport.can-next .chip-scroll[data-dir], .chip-viewport.can-prev .chip-scroll[data-dir] { display: none; }
  .active-row { gap: 6px; }

  .records-table, .records-table tbody { display: block; }
  .records-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .records-table colgroup { display: none; }
  .records-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr); grid-template-areas: "art art delta" "a3 epack wh"; column-gap: 12px; row-gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); scroll-margin-top: 104px; scroll-margin-bottom: 84px; }
  .records-table tbody tr:last-child { border-bottom: 0; }
  .records-table tbody td { display: block; padding: 0; border: 0; min-width: 0; }
  .records-table tbody tr.is-selected td:first-child { box-shadow: none; }
  .records-table tbody tr.is-selected { box-shadow: inset 3px 0 0 var(--brand); }
  .c-art { grid-area: art; }
  .c-delta { grid-area: delta; }
  .c-num[data-label="A3"] { grid-area: a3; }
  .c-num[data-label="ePack"] { grid-area: epack; }
  .c-wh { grid-area: wh; text-align: right; }
  .records-table tbody .c-num, .records-table tbody .c-wh { padding-top: 9px; border-top: 1px solid var(--line); }
  .c-num::before, .c-wh::before { content: attr(data-label); display: block; margin-bottom: 1px; font-size: 11px; font-weight: 600; color: var(--muted); text-align: left; }
  .c-wh::before { text-align: right; }
  .c-num { text-align: left; }
  .num { justify-content: flex-start; font-size: 14px; }
  .open { font-size: 14px; min-height: 40px; margin: -9px -4px; }
  .art-desc { font-size: 13.5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
  .delta { font-size: 16px; line-height: 22px; }
  .dcell .dbadge { height: auto; min-height: 19px; max-width: 100%; padding: 3px 7px; white-space: normal; text-align: right; line-height: 1.25; border-radius: 7px; }
  .density-compact .col-delta { width: auto; }
  .density-compact .art { flex-direction: column; align-items: flex-start; gap: 2px; }
  .density-compact .open { max-width: 100%; }
  .density-compact .art-desc { -webkit-line-clamp: 1; }
  .density-compact .dcell { flex-direction: column; align-items: flex-end; gap: 3px; }
  .density-compact .records-table tbody tr { row-gap: 6px; padding-top: 9px; padding-bottom: 9px; }
  .density-compact .records-table tbody .c-num, .density-compact .records-table tbody .c-wh { padding-top: 6px; }

  .pager-main { justify-content: space-between; }
  .pager-note { padding-bottom: 10px; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* ---------- < 640 px: phone ---------- */
@media (max-width: 639px) {
  :root { --gutter: 12px; }
  .topbar { min-height: 52px; padding: 6px 12px; gap: 8px; }
  .brand { gap: 10px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-text h1 { font-size: 14px; }
  .tag-readonly, .freshness { display: none; }
  .only-phone { display: inline; }
  /* V1: a failed load is the first thing on the screen (the pill is hidden on phones). */
  [data-state="error"] .load-alert { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 12px; margin: 10px 12px 0; padding: 12px 14px; border: 1px solid var(--danger-line); border-radius: var(--r-lg); background: var(--danger-soft); }
  .load-alert .state-icon { width: 36px; height: 36px; margin: 0; background: var(--surface); color: var(--danger); }
  .load-alert .state-icon .icon { width: 18px; height: 18px; }
  .load-alert-text { flex: 1 1 0; min-width: 0; }
  .load-alert .state-title { font-size: 14.5px; }
  .load-alert .state-text { margin-top: 2px; font-size: 12.5px; }
  .load-alert .btn { flex: 1 1 100%; height: 44px; }
  [data-state="error"] #state-actions { display: none; }
  .btn-logout { width: 40px; padding: 0; }
  .btn-logout .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .overview { padding: 8px 12px 10px; gap: 8px; }
  .eyebrow { line-height: 1.4; }
  /* V8: compact tiles, figure first so every value sits on the same line; the share keeps its short form
     ("31 %", "todas", "ninguna") next to the value. */
  .kpis { margin-top: 6px; }
  .kpi { min-height: 0; justify-content: flex-start; gap: 2px; padding: 6px 9px 7px; }
  .kpi-figure { order: -1; flex-wrap: wrap; column-gap: 5px; }
  .kpi-value { font-size: 19px; line-height: 1.15; }
  .kpi-share { font-size: 11px; white-space: nowrap; }
  .kpi .kpi-rest { display: none; }
  .kpi-label { font-size: 11.5px; line-height: 1.2; }
  .dcell .dbadge .icon { display: none; }
  .provenance { grid-template-columns: auto minmax(0, 1fr); row-gap: 3px; }
  .provenance dd { white-space: normal; }
  .coverage-line { flex-wrap: wrap; }
  /* P1: the open disclosure takes its own full-width line and wraps inside the viewport. */
  .caveat { flex-wrap: wrap; align-items: flex-start; margin-bottom: 8px; padding: 8px 8px 4px 12px; font-size: 12.5px; }
  .caveat-icon { margin-top: 2px; }
  .caveat-text { flex: 1 1 calc(100% - 30px); }
  .caveat-more { flex: 1 1 100%; min-width: 0; padding-left: 18px; }
  .caveat-more > summary { height: 40px; padding: 0 8px; margin-left: -8px; }
  .caveat-panel { position: static; width: auto; max-width: 100%; max-height: none; margin: 4px 0 6px -18px; grid-template-columns: minmax(0, 1fr); gap: 14px; box-shadow: none; padding: 12px 14px; }
  .cp-windows, .cp-scope, .cp-warnings, .cp-legend { grid-column: 1; grid-row: auto; }
  .legend { grid-template-columns: minmax(0, 1fr); }
  .tl-row { grid-template-columns: 38px minmax(0, 1fr) 66px; gap: 8px; }
  .tl-axis { margin: 0 74px 0 46px; }
  @media (max-width: 399px) { .tl-zone { display: none; } }
  @media (max-width: 379px) { .cov-unit { display: none; } }
  .workspace { padding: 0 0 12px; }
  .records { border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .views { overflow: visible; }
  .view { flex: 1 1 0; min-width: 0; flex-direction: column; justify-content: center; gap: 1px; height: 46px; padding: 0 4px; font-size: 12.5px; }
  .view .count { height: 16px; min-width: 0; padding: 0 5px; font-size: 11px; background: transparent; }
  .vl-long { display: none; }
  .vl-short { display: inline; }
  .records-table tbody tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); column-gap: 10px; padding: 12px; }
  .c-num .unit, .c-wh .wh-meta { display: none; }
  .pager { padding: 8px 12px 10px; }
  .pager-note { align-items: flex-start; }

  .detail { width: 100vw; max-width: 100vw; height: auto; max-height: 92dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; border: 0; border-top: 1px solid var(--line); }
  .detail[open] { animation: sheet-in-up var(--t-med) ease-out; }
  .detail-inner { max-height: 92dvh; }
  .detail-head { position: relative; padding-top: 18px; }
  .detail-head::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line-strong); }
  #detail-prev, #detail-next { display: none; }
  .detail-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .detail-foot-actions .btn { height: 44px; }
  .detail-foot-actions .btn-step { display: inline-flex; flex: 0 0 auto; width: 48px; padding: 0; }
  .detail-foot-actions .btn-step span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .d-compare { gap: 6px; }
  .src-value { font-size: 20px; }
  .bar-row { grid-template-columns: 52px minmax(0, 1fr) 80px; }
  .bar-axis { margin-left: 60px; margin-right: 88px; }

  .sheet:not(.sheet-center), .sheet.sheet-center { width: 100vw; max-width: 100vw; height: auto; max-height: 90dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; border: 0; border-top: 1px solid var(--line); }
  .sheet[open] { animation: sheet-in-up var(--t-med) ease-out; }
  .sheet-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .sheet-foot .btn { height: 44px; flex: 1 1 auto; }
  .field select { height: 44px; font-size: 16px; }
  .check { min-height: 44px; }
}

@media (max-width: 380px) {
  .commandbar .btn { font-size: 12.5px; gap: 4px; }
}

/* ---------- Forced colours (Windows high contrast) ---------- */
@media (forced-colors: active) {
  .chip, .pill, .badge, .dbadge, .view, .active-chip, .qa-chip, .freshness, .kpi { border: 1px solid CanvasText; }
  .chip[aria-pressed="true"], .view[aria-pressed="true"], .kpi[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .records-table tbody tr.is-selected td:first-child { border-left: 4px solid Highlight; }
  .bar-fill, .tl-bar, .tl-gen, .bar-zero { forced-color-adjust: none; background: CanvasText; }
  .search input:focus-visible, .field select:focus-visible, .login-form input:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Login ---------- */
.login-page { min-height: 100vh; min-height: 100dvh; margin: 0; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.login-shell { width: min(420px, 100%); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.login-brand .brand-mark { width: 36px; height: 36px; }
.login-brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.login-brand span { display: block; font-size: 12.5px; color: var(--muted); }
.login-card { padding: 28px 28px 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md); }
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.login-card .login-lead { margin-top: 6px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--ink); }
.login-form input { height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 400; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.login-form input:hover { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--ink) 40%); }
.login-form input:focus-visible { outline: 2px solid transparent; outline-offset: 1px; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.login-form .btn-primary { height: 44px; margin-top: 4px; font-size: 14px; }
.login-error { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--danger-line); border-radius: var(--r-md); background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 600; line-height: 1.4; }
.login-error::before { content: "!"; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; background: var(--danger); color: var(--surface); font-size: 12px; font-weight: 800; }
.login-error:empty { display: none; }
.login-foot { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.5; }
.login-foot .icon { margin-top: 1px; color: var(--muted); }
.login-meta { margin-top: 14px; text-align: center; font-size: 12px; color: var(--muted); }
