/* Institutional Analytics — tokens tomados de DESIGN.md */
:root {
  --canvas: #f8f9fa;
  --card: #ffffff;
  --ink: #111c2d;
  --ink-strong: #1d2939;
  --ink-2: #475467;
  --ink-3: #667085;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --track: #eef0f4;
  --navy: #1e3a8a;
  --slate: #475467;
  --steel: #64748b;
  --sand: #98a2b3;
  --accent: #0e7490;
  --pos: #027a48;
  --neg: #b42318;
  --warn-bg: #fffaeb;
  --warn-ink: #b54708;
  --pos-bg: #ecfdf3;
  --r-sm: 2px;
  --r: 4px;
  --r-lg: 8px;
  --gutter: 1.25rem;
  --margin: 2rem;
  --topbar-h: 64px;
  --subnav-h: 52px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + var(--subnav-h) + 16px); }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.875rem;
  line-height: 1.375rem;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: "tnum" 1, "cv05" 1;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: var(--r); }
.icon { width: 1.125rem; height: 1.125rem; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 0.95rem; height: 0.95rem; }
.num-prop { font-feature-settings: "tnum" 0, "cv05" 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { max-width: 1440px; margin: 0 auto; padding: 0 var(--margin); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar .container { display: flex; align-items: center; gap: 1.5rem; height: var(--topbar-h); }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; flex: none; }
.brand-mark { width: 40px; height: 40px; border-radius: var(--r-lg); background: var(--ink-strong); color: #fff; display: grid; place-items: center; }
.brand-mark .icon { width: 22px; height: 22px; }
.brand-title { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25rem; color: var(--ink); }
.brand-sub { font-size: 0.6875rem; color: var(--ink-3); line-height: 0.9rem; margin-top: 2px; }
.nav { display: flex; align-items: stretch; gap: 0.25rem; margin-left: auto; height: 100%; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: flex; align-items: center; padding: 0 0.65rem; white-space: nowrap;
  font-size: 0.8125rem; font-weight: 500; color: var(--ink-3); text-decoration: none;
  border-bottom: 2px solid transparent; margin-top: 2px;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink-strong); }
.icon-btn { width: 36px; height: 36px; border: 0; background: none; border-radius: 999px; color: var(--ink-3); display: grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--track); color: var(--ink); }

/* ---------- Filter bar ---------- */
.filterbar { background: var(--card); border-bottom: 1px solid var(--line); }
.filterbar .container { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding-top: 0.875rem; padding-bottom: 0.875rem; }
.filter-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.select { position: relative; }
.select select {
  appearance: none; -webkit-appearance: none; height: 40px; min-width: 176px; padding: 0 2.25rem 0 0.85rem;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-lg); font-size: 0.8125rem; color: var(--ink);
}
.select select:hover { border-color: var(--sand); }
.select::after { content: ""; position: absolute; right: 0.9rem; top: 50%; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select.active select { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; height: 40px; padding: 0 1rem; border-radius: var(--r-lg); font-size: 0.8125rem; font-weight: 500; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); }
.btn:hover { background: var(--canvas); }
.btn.primary { background: var(--ink-strong); border-color: var(--ink-strong); color: #fff; }
.btn.primary:hover { background: #0b1626; }
.btn.small { height: 32px; padding: 0 0.7rem; font-size: 0.75rem; }
.btn[hidden] { display: none; }

/* ---------- Sub navigation ---------- */
.subnav {
  position: sticky; top: var(--topbar-h); z-index: 30;
  background: rgba(248, 249, 250, 0.94); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.subnav .container { display: flex; align-items: center; gap: 1rem; height: var(--subnav-h); }
.chips { display: flex; gap: 0.35rem; overflow-x: auto; scrollbar-width: thin; flex: 1; min-width: 0; padding: 4px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem; flex: none; height: 34px; padding: 0 0.75rem;
  border-radius: var(--r-lg); border: 1px solid transparent; background: none;
  font-size: 0.8125rem; font-weight: 500; color: var(--ink-2); text-decoration: none; white-space: nowrap;
}
.chip:hover { background: var(--track); color: var(--ink); }
.chip[aria-current="true"] { background: var(--ink-strong); color: #fff; }
.chip .tag { font-size: 0.6875rem; font-weight: 600; opacity: 0.75; }
.chip.women::after { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }
.chip[aria-current="true"].women::after { background: #7fd0e3; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--track); border-radius: var(--r-lg); flex: none; }
.seg button { border: 0; background: none; height: 28px; padding: 0 0.7rem; border-radius: 6px; font-size: 0.75rem; font-weight: 500; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.filter-summary { display: none; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--ink-2); background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 0.7rem; height: 28px; flex: none; }
.filter-summary.on { display: inline-flex; }
.filter-summary strong { font-weight: 600; color: var(--navy); }

/* ---------- Page header ---------- */
.page-head { padding: 2rem 0 1.25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.page-head .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; align-items: center; font-size: 0.75rem; color: var(--ink-2); margin-bottom: 0.65rem; }
.eyebrow .kicker { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.6875rem; color: var(--accent); }
.eyebrow .dot { color: var(--sand); }
h1.title { font-size: 2.25rem; line-height: 2.75rem; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.lede { max-width: 78ch; margin-top: 0.5rem; color: var(--ink-2); font-size: 0.9375rem; line-height: 1.5rem; }
.pill { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.75rem; border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--r); font-size: 0.75rem; color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--pos); }

/* ---------- Grid & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
.group-title { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 0.75rem; padding-top: 0.75rem; }
.group-title:first-child { padding-top: 0; }
.group-title h2 { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); white-space: nowrap; }
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.block { margin-bottom: 1.5rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.5rem; min-width: 0; display: flex; flex-direction: column; scroll-margin-top: calc(var(--topbar-h) + var(--subnav-h) + 16px); }
.card:target, .card.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.35); } 100% { box-shadow: 0 0 0 3px rgba(30, 58, 138, 0); } }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.card-head h3 { font-size: 1.0625rem; line-height: 1.5rem; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.qtag { display: inline-block; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.03em; color: var(--navy); background: #eef2ff; border-radius: var(--r); padding: 1px 6px; margin-right: 0.4rem; vertical-align: 2px; }
.badge { display: inline-block; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-2); background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r); padding: 2px 8px; white-space: nowrap; }
.badge.women { color: var(--accent); background: #ecfbff; border-color: #b9e6f0; }
.card-sub { margin-top: 0.25rem; color: var(--ink-2); font-size: 0.8125rem; line-height: 1.25rem; }
.card-tools { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.viz { margin-top: 1.25rem; flex: 1; }
.tblwrap { margin-top: 1.25rem; }
.viz + .tblwrap { border-top: 1px solid var(--line); padding-top: 0.5rem; margin-top: 1.25rem; }
.show-charts .tblwrap { display: none; }
.show-tables .viz { display: none; }
.show-tables .tblwrap { margin-top: 1rem; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--ink-3); }
.card-foot a, .linkbtn { color: var(--navy); text-decoration: none; font-weight: 500; background: none; border: 0; padding: 0; font-size: 0.75rem; }
.card-foot a:hover, .linkbtn:hover { text-decoration: underline; }
.note { font-size: 0.75rem; color: var(--ink-3); }
.empty { padding: 2.5rem 0; text-align: center; color: var(--ink-3); }

/* ---------- KPI ---------- */
.kpi { padding: 1.5rem; }
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-label { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.kpi-icon { width: 32px; height: 32px; border-radius: var(--r); background: var(--canvas); display: grid; place-items: center; color: var(--ink-3); }
.kpi-value { display: flex; align-items: baseline; gap: 0.35rem; margin-top: 0.85rem; font-size: 2.5rem; line-height: 2.75rem; font-weight: 700; letter-spacing: -0.025em; color: var(--ink-strong); font-feature-settings: "tnum" 0, "cv05" 1; }
.kpi-value small { font-size: 1rem; font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.kpi-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 600; white-space: nowrap; }
.delta.pos { color: var(--pos); } .delta.neg { color: var(--neg); } .delta.neutral { color: var(--ink-2); }

/* ---------- Horizontal bars ---------- */
.hb { display: flex; flex-direction: column; gap: 1rem; }
.hb.compact { gap: 0.35rem; }
.hb-row { border-radius: var(--r); outline-offset: 3px; }
.hb-row:hover .hb-fill, .hb-row:focus-visible .hb-fill { filter: brightness(1.18); }
.hb-top { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 0.35rem; font-size: 0.8125rem; }
.hb-label { color: var(--ink); font-weight: 500; }
.hb-val { font-weight: 600; color: var(--ink); white-space: nowrap; }
.hb-val em { font-style: normal; font-weight: 400; color: var(--ink-3); font-size: 0.75rem; margin-left: 0.35rem; }
.hb-track { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.hb-fill { height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--navy); transition: width 0.35s ease; }
.hb-sub { display: grid; grid-template-columns: 64px 1fr 96px; align-items: center; gap: 0.6rem; margin-top: 0.3rem; font-size: 0.75rem; color: var(--ink-2); }
.hb-sub .who { display: flex; align-items: center; gap: 0.35rem; }
.hb-sub .val { text-align: right; font-weight: 600; color: var(--ink); white-space: nowrap; }
.hb-sub .val em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.swatch { width: 8px; height: 8px; border-radius: 2px; background: var(--navy); flex: none; display: inline-block; }
.hb.compact .hb-row { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 84px; align-items: center; gap: 0.75rem; }
.hb.compact .hb-top { display: contents; margin: 0; }
.hb.compact .hb-label { grid-column: 1; font-size: 0.8125rem; font-weight: 400; }
.hb.compact .hb-track { grid-column: 2; grid-row: 1; }
.hb.compact .hb-val { grid-column: 3; grid-row: 1; text-align: right; }
.axis-note { margin-top: 0.75rem; font-size: 0.6875rem; color: var(--ink-3); text-align: right; }

.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: 0.75rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.legend-row { margin-bottom: 1rem; }

/* ---------- Columns ---------- */
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.5rem; align-items: end; height: 220px; padding-bottom: 0; border-bottom: 1px solid var(--line-strong); }
.col-item { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.col-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; width: 100%; }
.col-bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; flex: 0 1 30px; min-width: 10px; border-radius: var(--r); }
.col-bar .v { font-size: 0.6875rem; font-weight: 600; color: var(--ink); margin-bottom: 3px; white-space: nowrap; }
.col-bar .b { width: 100%; background: var(--navy); border-radius: 4px 4px 0 0; min-height: 2px; transition: height 0.35s ease; }
.col-bar:hover .b, .col-bar:focus-visible .b { filter: brightness(1.18); }
.col-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.5rem; margin-top: 0.5rem; }
.col-labels div { text-align: center; font-size: 0.75rem; line-height: 1rem; color: var(--ink-2); padding: 0 2px; overflow-wrap: anywhere; }

/* ---------- Donut ---------- */
.donut-wrap { display: flex; align-items: center; gap: 1.75rem; flex-wrap: wrap; justify-content: center; }
.donut { position: relative; width: 168px; height: 168px; flex: none; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.donut circle.seg-arc { fill: none; stroke-width: 15; cursor: default; transition: stroke-width 0.15s; }
.donut circle.seg-arc:hover, .donut circle.seg-arc:focus-visible { stroke-width: 18; outline: none; }
.donut circle.bg { fill: none; stroke: var(--track); stroke-width: 15; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 1.375rem; line-height: 1.6rem; font-weight: 600; color: var(--ink-strong); font-feature-settings: "tnum" 0; }
.donut-center span { font-size: 0.625rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.dl { display: flex; flex-direction: column; gap: 0.6rem; flex: 1; min-width: 190px; }
.dl-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: baseline; gap: 0.6rem; font-size: 0.8125rem; }
.dl-row i { width: 10px; height: 10px; border-radius: 3px; display: block; transform: translateY(1px); }
.dl-row .l { color: var(--ink-2); }
.dl-row .p { font-weight: 600; color: var(--ink); text-align: right; }
.dl-row .p em { font-style: normal; font-weight: 400; color: var(--ink-3); font-size: 0.75rem; margin-left: 0.4rem; }

/* ---------- Tables ---------- */
.tbl-scroll { overflow: auto; max-height: 420px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--card); text-align: left; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.tbl td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--canvas); }
.tbl .r { text-align: right; white-space: nowrap; }
.tbl td.k { color: var(--ink); }
.tbl td strong { color: var(--ink); font-weight: 600; }
.tbl a { color: var(--ink); text-decoration: none; font-weight: 500; }
.tbl a:hover { color: var(--navy); text-decoration: underline; }
.tbl tfoot td { font-weight: 600; color: var(--ink); border-top: 1px solid var(--line-strong); }
.card.table-card { padding: 0; }
.card.table-card .card-head, .card.table-card .card-sub { padding: 1.5rem 1.5rem 0; }
.card.table-card .card-sub { padding-top: 0.25rem; }
.card.table-card .tbl-scroll { margin-top: 1rem; max-height: 560px; border-top: 1px solid var(--line); }
.card.table-card .tbl th:first-child, .card.table-card .tbl td:first-child { padding-left: 1.5rem; }
.card.table-card .tbl th:last-child, .card.table-card .tbl td:last-child { padding-right: 1.5rem; }
.tbl-foot { display: flex; justify-content: space-between; padding: 0.85rem 1.5rem; border-top: 1px solid var(--line); background: var(--canvas); font-size: 0.75rem; color: var(--ink-3); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.bar-cell { display: inline-flex; align-items: center; gap: 0.5rem; }
.mini { display: inline-block; width: 56px; height: 6px; background: var(--track); border-radius: 999px; overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--navy); }

/* ---------- Findings ---------- */
.findings { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1.25rem; }
.finding { display: grid; grid-template-columns: 22px 1fr; gap: 0.75rem; font-size: 0.875rem; line-height: 1.375rem; color: var(--ink-2); }
.finding .icon { color: var(--accent); margin-top: 2px; }
.finding b { color: var(--ink-strong); font-weight: 600; }

/* ---------- Comments ---------- */
.field { display: flex; align-items: center; gap: 0.5rem; height: 40px; padding: 0 0.85rem; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--card); color: var(--ink-3); min-width: 260px; }
.field input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); }
.field:focus-within { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.pager { display: flex; align-items: center; gap: 0.5rem; }
.pager button { height: 32px; padding: 0 0.7rem; border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--r-lg); font-size: 0.75rem; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.cm-text { color: var(--ink); max-width: 70ch; }
.hl { background: #fef0c7; border-radius: 2px; }

/* ---------- Tooltip ---------- */
.tip { position: fixed; z-index: 100; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity 0.1s, transform 0.1s; max-width: 280px; background: var(--ink-strong); color: #fff; border-radius: var(--r-lg); padding: 0.55rem 0.75rem; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.25); font-size: 0.75rem; line-height: 1.1rem; }
.tip.on { opacity: 1; transform: none; }
.tip .tv { font-size: 0.9375rem; font-weight: 600; display: block; }
.tip .tl { color: #cfd6e3; display: block; }
.tip .ts { color: #98a2b3; display: block; margin-top: 2px; }

/* ---------- Dialog ---------- */
dialog { border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 0; max-width: 560px; width: calc(100% - 2rem); color: var(--ink); box-shadow: 0 24px 48px rgba(16, 24, 40, 0.22); }
dialog::backdrop { background: rgba(17, 28, 45, 0.45); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--line); }
dialog .dlg-head h2 { font-size: 1.0625rem; font-weight: 600; }
dialog .dlg-body { padding: 1.25rem 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; color: var(--ink-2); }
dialog ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; }

/* ---------- Footer ---------- */
.footer { margin-top: 3rem; border-top: 1px solid var(--line); background: var(--card); }
.footer .container { display: flex; gap: 1rem 2rem; justify-content: space-between; align-items: center; padding-top: 1.75rem; padding-bottom: 1.75rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--ink-3); }
.footer b { color: var(--ink-strong); font-size: 1rem; margin-right: 0.75rem; padding-right: 0.75rem; border-right: 1px solid var(--line-strong); }

/* ---------- Responsive ---------- */
@media (max-width: 1279px) { .brand-sub { display: none; } }
@media (max-width: 1023px) {
  :root { --margin: 1.5rem; --gutter: 1rem; }
  .grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .col-3 { grid-column: span 4; } .col-4, .col-5, .col-6, .col-7, .col-8, .col-12 { grid-column: span 8; }
  h1.title { font-size: 1.75rem; line-height: 2.25rem; }
  .brand-title { font-size: 1rem; }
  .topbar .container { gap: 1rem; }
}
@media (max-width: 767px) {
  :root { --margin: 1rem; --gutter: 0.75rem; --topbar-h: 56px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .col-3 { grid-column: span 2; } .col-4, .col-5, .col-6, .col-7, .col-8, .col-12 { grid-column: span 4; }
  .brand-title { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .kpi { padding: 1rem; } .kpi-value { font-size: 2rem; line-height: 2.25rem; }
  .card { padding: 1rem; }
  .select select { min-width: 0; width: 100%; } .select { flex: 1 1 140px; }
  .filter-label { width: 100%; }
  .field { min-width: 0; width: 100%; }
  .hb.compact .hb-row { grid-template-columns: 1fr 64px; }
  .hb.compact .hb-label { grid-column: 1; grid-row: 1; } .hb.compact .hb-val { grid-column: 2; grid-row: 1; }
  .hb.compact .hb-track { grid-column: 1 / -1; grid-row: 2; }
  .filter-summary { display: none !important; }
  .card.table-card .card-head, .card.table-card .card-sub { padding-left: 1rem; padding-right: 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print {
  .topbar, .subnav, .filterbar, .btn, .seg, .footer { display: none !important; }
  .card { break-inside: avoid; }
}

/* chips: etiqueta corta con elipsis */
.chip .lbl { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }

/* ajustes tras revisión visual */
.brand { min-width: 0; flex: 0 1 auto; }
.brand-sub { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-title { white-space: nowrap; }
.nav { min-width: 0; flex: 1; justify-content: flex-end; }
.nav a { flex: none; }
.dl { flex: 0 1 300px; }
@media (max-width: 1279px) { .brand-title { font-size: 1rem; } }

.viz { flex: 0 0 auto; }
.card-foot { margin-top: auto; }
.viz + .tblwrap, .card-head + .card-sub + .card-tools + .viz { margin-bottom: 1rem; }
.card > .note { margin-bottom: 0; }
.col-labels div { overflow-wrap: break-word; }
@media (max-width: 767px) {
  .subnav .container { overflow-x: auto; scrollbar-width: none; }
  .subnav .container::-webkit-scrollbar { display: none; }
  .chips { flex: none; overflow: visible; }
  .col-labels div { font-size: 0.6875rem; }
  .chip .lbl { max-width: 120px; }
}
