/* Plataforma estadística INTRASTAT · paleta de intrastat.com */

@font-face { font-family: "Plat Serif"; font-weight: 200 900; font-display: swap; src: url("../fonts/source-serif-4-latin-opsz-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Plat Sans"; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plat Sans"; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plat Sans"; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Plat Mono"; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plat Mono"; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --ink: #10243f; --ink-2: #3a4d64; --ink-3: #5a6b7e;
  --rule: #dde4eb; --rule-2: #c8d3de;
  --paper: #ffffff; --canvas: #f3f6f9; --tint: #f7f9fb;
  --blue: #1f6fb2; --blue-deep: #144f86; --blue-wash: #e9f1f9;
  --band: #10243f; --band-2: #17365c;
  --e: #1f6fb2; --e-wash: #e3eef8; --i: #b1621a; --i-wash: #f7eadd;
  --up: #23794a; --down: #b3261e; --up-band: #8fdcac; --down-band: #ffa294;
  --warn: #8a5a00; --warn-wash: #fbf5e8;
  --serif: "Plat Serif", Georgia, serif;
  --sans: "Plat Sans", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "Plat Mono", ui-monospace, Menlo, Consolas, monospace;
  --side: 228px; --r: 10px; --r-s: 6px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 14.5px/1.5 var(--sans); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--blue); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-deep); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; padding: 8px 14px; background: var(--ink); color: #fff; }
.skip:focus { left: 8px; color: #fff; }
.code { font-family: var(--mono); font-size: .92em; letter-spacing: .01em; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.pos { color: var(--ink); } .neg { color: var(--i); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px 16px; background: var(--paper); border-right: 1px solid var(--rule); }
.brand { display: block; padding: 0 8px 4px; }
.brand img { display: block; height: 32px; width: auto; }
.brand-sub { margin: 2px 8px 14px; font-size: 12.5px; color: var(--ink-3); }
.menu-toggle { display: none; }
.nav-group { margin: 14px 8px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-s); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--canvas); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--blue-wash); color: var(--blue-deep); }
.nav svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; }
.side-foot { margin-top: auto; padding: 14px 8px 0; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--rule); }
.side-foot a { color: var(--ink-3); }
.side-foot p { margin: 0 0 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(6px); border-bottom: 1px solid var(--rule); }
.topbar-row { display: flex; align-items: center; gap: 12px; padding: 10px clamp(16px, 2.4vw, 32px) 0; }
.topbar-row .search-host { flex: 0 1 420px; }
.updated { margin-left: auto; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.filters-toggle { display: none; }
#filtros { padding: 8px clamp(16px, 2.4vw, 32px) 10px; }
#vista { padding: 22px clamp(16px, 2.4vw, 32px) 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1680px; width: 100%; }
.foot { padding: 0 clamp(16px, 2.4vw, 32px) 28px; font-size: 12.5px; color: var(--ink-3); max-width: 1680px; }

/* ---------- Filtros ---------- */
.frow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 14px; }
.fgroup, .fsel { display: flex; flex-direction: column; gap: 3px; }
.fbtn-k { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.fwrap { position: relative; }
.fbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-height: 40px; padding: 4px 12px; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper); cursor: pointer; text-align: left; }
.fbtn:hover { border-color: var(--blue); }
.fbtn-v { font-weight: 600; font-size: 13.5px; }
.fsel select, .fgroup input, .pop select { height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235a6b7e' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; max-width: 220px; }
.fgroup input { background-image: none; padding-right: 10px; width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper); padding: 2px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 4px; cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 13.5px; white-space: nowrap; }
.seg button:hover { background: var(--canvas); }
.seg button.is-on { background: var(--ink); color: #fff; }
.pop { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 300px; padding: 14px; background: var(--paper); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: 0 12px 32px rgba(16,36,63,.14); display: flex; flex-direction: column; gap: 12px; }
.pop-presets { display: flex; flex-direction: column; gap: 2px; }
.pop-presets button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: var(--r-s); cursor: pointer; }
.pop-presets button:hover { background: var(--canvas); }
.pop-presets button.is-on { background: var(--blue-wash); color: var(--blue-deep); font-weight: 600; }
.pop-range { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; padding-top: 10px; border-top: 1px solid var(--rule); font-size: 13px; }
.pop-msg { margin: 0; color: var(--down); font-size: 13px; }
.pop-msg:empty { display: none; }
.pop-foot { display: flex; justify-content: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--blue-wash); color: var(--blue-deep); font-size: 13px; }
.chip strong { font-weight: 600; }
.chip button { border: 0; background: none; cursor: pointer; width: 22px; height: 22px; border-radius: 50%; color: var(--blue-deep); font-size: 15px; line-height: 1; }
.chip button:hover { background: rgba(31,111,178,.15); }
.chip-clear { border: 0; background: none; color: var(--ink-3); cursor: pointer; text-decoration: underline; font-size: 13px; }

.search { position: relative; }
.search input { width: 100%; height: 34px; padding: 0 12px 0 34px; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%235a6b7e' stroke-width='1.6'%3E%3Ccircle cx='6' cy='6' r='4.8'/%3E%3Cpath d='M9.6 9.6l3.4 3.4'/%3E%3C/svg%3E") no-repeat 11px center; }
.fgroup .search input { width: 200px; }
.suggest { position: absolute; z-index: 45; top: calc(100% + 4px); left: 0; width: max(100%, 460px); max-height: 420px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: var(--paper); border: 1px solid var(--rule-2); border-radius: var(--r); box-shadow: 0 12px 32px rgba(16,36,63,.16); }
.suggest li { display: grid; grid-template-columns: 76px 74px 1fr; gap: 8px; align-items: baseline; padding: 7px 8px; border-radius: var(--r-s); cursor: pointer; font-size: 13.5px; }
.suggest li.is-active, .suggest li:hover { background: var(--blue-wash); }
.sg-kind { font-size: 11.5px; color: var(--ink-3); }

/* ---------- Bloques ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper); color: var(--ink); text-decoration: none; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--blue); color: var(--blue-deep); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: var(--blue-deep); color: #fff; }
.btn-ghost { border-color: transparent; color: var(--blue); }
.ico-dl { width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M7 1.5v8M3.5 6.2L7 9.7l3.5-3.5M2 12.5h10'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M7 1.5v8M3.5 6.2L7 9.7l3.5-3.5M2 12.5h10'/%3E%3C/svg%3E") center/contain no-repeat; }

.vhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.vhead h1, .fhead h1 { font: 600 clamp(26px, 2.5vw, 34px)/1.12 var(--serif); letter-spacing: -.01em; }
.vhead-sub { margin: 6px 0 0; color: var(--ink-2); max-width: 90ch; }
.vhead-extra { display: flex; gap: 8px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); }
.crumbs .sep { color: var(--rule-2); }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }

.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: 1 / -1; }

.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; padding: 14px 18px 0; }
.panel-head h2 { font-size: 15.5px; font-weight: 600; }
.panel-note { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); max-width: 80ch; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.panel-body { padding: 12px 18px 16px; }
.panel-flush .panel-body { padding: 12px 0 0; }
.panel-flush .table-note, .panel-flush .pager, .panel-flush .state, .panel-flush .mix, .panel-flush .skeleton { margin-left: 18px; margin-right: 18px; }
.sub-h { margin: 16px 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.more-links { display: flex; flex-wrap: wrap; gap: 18px; margin: -6px 0 0; font-size: 13.5px; }

/* ---------- KPI y variaciones ---------- */
.kpis { display: grid; gap: 10px 16px; }
.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { min-width: 0; }
.kpi-label { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.kpi-label[title] { text-decoration: underline dotted rgba(90,107,126,.5); text-underline-offset: 3px; cursor: help; }
.kpi-value { margin: 2px 0 0; font-size: 19px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.kpi-sub { margin: 3px 0 0; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.delta-arrow { font-size: 9px; }
.delta.is-up { color: var(--up); } .delta.is-down { color: var(--down); } .delta.is-flat { color: var(--ink-3); }
.delta.is-na { color: var(--ink-3); font-weight: 400; }
.flow-total { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.flow-value { font-size: 30px; font-weight: 600; letter-spacing: -.01em; }
.flow-panel { border-top: 3px solid var(--e); }
.flow-panel.flow-I { border-top-color: var(--i); }
.flow-panel .panel-head h2 { color: var(--e); }
.flow-panel.flow-I .panel-head h2 { color: var(--i); }

/* ---------- Cabecera de Panorama ---------- */
.hero { background: var(--band); color: #fff; border-radius: var(--r); padding: 24px 26px 18px; }
.hero .skeleton span { background: rgba(255,255,255,.12); }
.hero-top { display: grid; grid-template-columns: minmax(240px, .9fr) 2fr; gap: 24px; align-items: end; }
.hero-kicker { margin: 0 0 4px; color: #b9cde3; font-size: 14px; }
.hero h1 { font: 600 clamp(34px, 4.2vw, 56px)/1.02 var(--serif); letter-spacing: -.02em; }
.hero-note { margin: 8px 0 0; color: #9fb6cf; font-size: 13px; }
.hero-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.hero .kpi { border-left: 1px solid rgba(255,255,255,.18); padding-left: 14px; }
.hero .kpi-label { color: #b9cde3; font-size: 13px; }
.hero .kpi-value { font-size: clamp(22px, 2vw, 30px); color: #fff; }
.hero .kpi[data-flow="E"] .kpi-label::before, .hero .kpi[data-flow="I"] .kpi-label::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: #8fc1ec; }
.hero .kpi[data-flow="I"] .kpi-label::before { background: #f0b47c; }
.hero .delta.is-up { color: var(--up-band); } .hero .delta.is-down { color: var(--down-band); } .hero .delta.is-na, .hero .kpi-sub { color: #9fb6cf; }
.lanes-title { margin: 22px 0 6px; font-size: 13px; color: #9fb6cf; }
.lanes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; border-top: 1px solid rgba(255,255,255,.14); padding-top: 12px; }
.lane h2 { font-size: 13px; font-weight: 500; color: #dbe7f3; margin-bottom: 2px; }
.hero .tick { fill: #8ea6c1; }
.hero .chart svg line[stroke="#e3e9ef"] { stroke: rgba(255,255,255,.08); }
.hero .legend { color: #b9cde3; }
.hero .lane .legend { display: none; }
.lanes-legend { margin-top: 4px; }

/* ---------- Gráficos ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.tick { font: 400 11px var(--sans); fill: var(--ink-3); }
.tick-sub { font-weight: 600; }
.bar-pct { font: 600 11.5px var(--sans); fill: var(--ink-2); }
.hit { cursor: crosshair; } .hit-click { cursor: pointer; }
.chart-empty { margin: 16px 0; color: var(--ink-3); font-size: 13.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 6px; font-size: 12.5px; color: var(--ink-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw-line { width: 16px; height: 0; border-top: 2px solid; border-radius: 0; }
.sw-dash { border-top-style: dashed; }
.spark { display: block; }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.rank li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label val" "bar bar"; gap: 3px 10px; }
.rank-label { grid-area: label; display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 13.5px; }
.rank-label a, .rank-label > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-label .code { flex: none; }
.rank-bar { grid-area: bar; height: 6px; background: var(--canvas); border-radius: 3px; overflow: hidden; }
.rank-bar span { display: block; height: 100%; border-radius: 3px; }
.rank-val { grid-area: val; display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; white-space: nowrap; }
.rank-share, .rank-uv { color: var(--ink-3); font-size: 12.5px; }
.stack { display: flex; width: 100%; border-radius: 4px; overflow: hidden; background: var(--canvas); }
.stack span { display: block; height: 100%; border-right: 1px solid #fff; }
.mix { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.mix-row { display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 10px; margin-bottom: 8px; }
.mix-label { font-size: 13px; color: var(--ink-2); }
.mix-legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; font-size: 13px; }
.mix-legend li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; }
.mix-legend i, .cat i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.mix-legend b { font-weight: 500; color: var(--ink-3); }
.cat { display: inline-flex; align-items: center; gap: 8px; }

.movers-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.movers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.movers li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; }
.movers li a, .movers li > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-diff { font-weight: 600; } .is-up .mv-diff { color: var(--up); } .is-down .mv-diff { color: var(--down); }
.mv-contrib { color: var(--ink-3); font-size: 12px; min-width: 64px; text-align: right; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 7px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
table.data thead th { position: sticky; top: 0; background: var(--tint); font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
table.data .group-row th { text-align: center; font-size: 12px; color: var(--ink-2); border-bottom: 0; padding-bottom: 0; }
table.data .group-row .g-E { color: var(--e); box-shadow: inset 0 -2px 0 var(--e); }
table.data .group-row .g-I { color: var(--i); box-shadow: inset 0 -2px 0 var(--i); }
table.data .r { text-align: right; white-space: nowrap; }
table.data tbody tr:hover { background: var(--tint); }
table.data tbody th { font-weight: 500; }
table.data tfoot th, table.data tfoot td { font-weight: 600; background: var(--tint); border-top: 1px solid var(--rule-2); }
.sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; }
.sort:hover { color: var(--blue); }
.sort-ind { color: var(--blue); min-width: 8px; }
.c-code { width: 1%; white-space: nowrap; }
.c-name { min-width: 260px; }
.name-cell { display: flex; align-items: center; gap: 8px; }
.name-cell a { color: var(--ink); text-decoration: none; }
.name-cell a:hover { color: var(--blue); text-decoration: underline; }
.drill { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 4px; color: var(--blue) !important; text-decoration: none !important; border: 1px solid var(--rule); font-size: 13px; }
.drill:hover { background: var(--blue-wash); }
.c-spark { width: 92px; }
.share { display: inline-flex; align-items: center; gap: 6px; }
.share-bar { width: 44px; height: 6px; border-radius: 3px; background: var(--canvas); overflow: hidden; }
.share-bar span { display: block; height: 100%; }
.table-note { margin: 10px 0 14px; font-size: 12.5px; color: var(--ink-3); }
.tsearch { height: 32px; width: 230px; padding: 0 10px; border: 1px solid var(--rule-2); border-radius: var(--r-s); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0 0; font-size: 13px; color: var(--ink-3); }
.pager-ctl { display: flex; align-items: center; gap: 8px; }
.pager select { height: 30px; border: 1px solid var(--rule-2); border-radius: var(--r-s); padding: 0 6px; background: var(--paper); }
.tree .lvl0 th { font-weight: 600; }
.tree .lvl1 th { padding-left: 32px; }
.tree .lvl2 th { padding-left: 58px; font-weight: 400; color: var(--ink-2); }
.tree .lvl0 { background: var(--tint); }
.tree-tgl { width: 20px; height: 20px; margin-right: 8px; border: 1px solid var(--rule-2); border-radius: 4px; background: var(--paper); cursor: pointer; line-height: 1; font-size: 13px; }
table.pivot td.tot { font-weight: 600; background: var(--tint); }
.rel { font-size: 12.5px; font-weight: 600; } .rel.hi { color: var(--blue-deep); } .rel.lo { color: var(--i); }
.avg-line { margin: 0 0 8px; font-size: 13px; color: var(--ink-2); }

/* ---------- Evolución ---------- */
.years { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.ycard { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.ycard header { display: flex; align-items: baseline; gap: 10px; padding: 12px 18px; background: var(--band); color: #fff; }
.ycard h2 { font: 600 30px/1 var(--serif); }
.ycard-tag { font-size: 13px; color: #b9cde3; }
.ycard-body { display: grid; gap: 12px; padding: 14px 18px; }
.ycard-note { margin: 0; padding: 0 18px 14px; font-size: 12.5px; color: var(--ink-3); }

/* ---------- Fichas ---------- */
.fhead { display: flex; flex-direction: column; gap: 6px; }
.fhead-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.fcode { font: 500 15px var(--mono); padding: 3px 8px; border-radius: 4px; background: var(--ink); color: #fff; }
.fhead-desc { margin: 0; color: var(--ink-3); font-size: 13.5px; max-width: 110ch; }
.fhead-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* ---------- Datos ---------- */
.defs { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 8px 18px; margin: 0; font-size: 13.5px; }
.defs dt { font-weight: 600; } .defs dd { margin: 0; color: var(--ink-2); }
.stat { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px 18px; }

/* ---------- Estados ---------- */
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }
.skeleton span { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, #eef2f6 0%, #f7f9fb 50%, #eef2f6 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.state { padding: 18px 0; color: var(--ink-2); }
.state p { margin: 0 0 8px; }
.state-title { font-weight: 600; color: var(--ink); }
.state-error .state-title { color: var(--down); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; margin: 0; padding: 10px 16px; border-radius: var(--r-s); background: var(--ink); color: #fff; font-size: 13.5px; }

.tooltip { position: fixed; z-index: 70; pointer-events: none; max-width: 320px; padding: 8px 10px; border-radius: var(--r-s); background: var(--ink); color: #fff; font-size: 12.5px; box-shadow: 0 6px 18px rgba(16,36,63,.25); }
.tooltip strong { display: block; margin-bottom: 4px; font-weight: 600; }
.tip-row { display: grid; grid-template-columns: 9px 1fr auto; gap: 8px; align-items: center; }
.tip-row i { width: 9px; height: 9px; border-radius: 2px; }
.tip-row b { font-weight: 600; }

/* ---------- Adaptación ---------- */
@media (max-width: 1280px) {
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-top { grid-template-columns: 1fr; }
  .lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 50; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .brand img { height: 26px; }
  .brand-sub, .side-foot { display: none; }
  .menu-toggle { display: inline-flex; margin-left: auto; }
  .nav { display: none; flex-basis: 100%; }
  .side.is-open .nav { display: block; }
  .topbar { position: static; }
  .filters-toggle { display: inline-flex; }
  #filtros { display: none; }
  #filtros.is-open { display: block; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .updated { display: none; }
}
@media (max-width: 560px) {
  .lanes { grid-template-columns: 1fr; }
  .movers-cols { grid-template-columns: 1fr; }
  .fgroup .search input, .fgroup input { width: 100%; }
  .frow > * { flex: 1 1 100%; }
  .seg { overflow-x: auto; max-width: 100%; }
  .flow-value { font-size: 24px; }
  .tsearch { width: 100%; }
  .suggest { width: 100%; }
  .suggest li { grid-template-columns: 64px 1fr; }
  .suggest li .sg-t { grid-column: 1 / -1; }
}

/* El atributo hidden siempre gana a las reglas de display. */
[hidden] { display: none !important; }
.side .menu-toggle, .topbar .filters-toggle { display: none; }
@media (max-width: 980px) {
  .side .menu-toggle, .topbar .filters-toggle { display: inline-flex; }
}

/* Textos largos de la nomenclatura: dos líneas como máximo. */
.c-name { min-width: 220px; max-width: 360px; }
.name-cell a, .name-cell > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
table.data th, table.data td { padding: 7px 10px; }
.rank-label a, .rank-label > span:last-child { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.movers-cols { grid-template-columns: 1fr; gap: 6px; }
.share-bar { width: 28px; }
table.data { font-size: 13px; }
table.data th, table.data td { padding: 7px 8px; }
.c-name { max-width: 300px; }
.c-spark { width: 76px; }

/* ---------- Cuenta y acceso ---------- */
.acct-host { display: flex; align-items: center; gap: 8px; }
.acct-host:empty { display: none; }
.updated + .acct-host { margin-left: 4px; }
.acct { gap: 8px; padding-left: 4px; }
.acct-dot { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 600; }
.acceso-pill { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border-radius: 999px; background: var(--warn-wash); color: var(--warn); font-size: 12.5px; white-space: nowrap; }
.acceso-pill strong { font-family: var(--mono); font-weight: 600; }
@media (max-width: 760px) { .acct-name, .acceso-pill span:first-child { display: none; } }

html.gate-open, html.gate-open body { overflow: hidden; }
.gate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(16, 36, 63, .55); backdrop-filter: blur(3px); overflow-y: auto; }
.gate-card { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); width: min(920px, 100%); background: var(--paper); border-radius: 12px; box-shadow: 0 24px 64px -16px rgba(16, 36, 63, .45); overflow: hidden; }
.gate-intro { padding: 36px 32px; background: var(--band); color: #fff; }
.gate-kicker { margin: 0 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #8fc1ec; }
.gate-intro h2 { margin: 0 0 20px; font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.2; }
.gate-points { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.gate-points li { position: relative; padding-left: 24px; font-size: 15px; line-height: 1.45; color: #dbe6f2; }
.gate-points li::before { content: ""; position: absolute; left: 0; top: .35em; width: 12px; height: 12px; border-radius: 3px; background: linear-gradient(90deg, #8fc1ec 0 50%, #f0b47c 50% 100%); }
.gate-note { margin: 0; font-size: 13.5px; color: #a9bdd3; }
.gate-body { padding: 28px 32px 22px; }
.gate-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--canvas); border-radius: 8px; }
.gate-tabs button { height: 36px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font: 500 14px var(--sans); cursor: pointer; }
.gate-tabs button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 36, 63, .12); }
.gate-form { display: grid; gap: 12px; }
.gate-field label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.gate-field input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: var(--r-s); font: 15px var(--sans); color: var(--ink); background: #fff; }
.gate-field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 111, 178, .15); }
.gate-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.gate-check input { margin-top: 3px; }
.gate-hp { position: absolute; left: -9999px; }
.gate-submit { height: 42px; justify-content: center; font-size: 15px; }
.gate-error { margin: 0; padding: 10px 12px; border-radius: var(--r-s); background: #fdecea; color: var(--down); font-size: 14px; }
.gate-small { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); }
.gate-out { margin-top: 16px; text-align: center; }
.gate-turnstile:empty { display: none; }
@media (max-width: 760px) {
  .gate { place-items: start center; }
  .gate-card { grid-template-columns: minmax(0, 1fr); }
  .gate-intro { padding: 24px 20px; }
  .gate-intro h2 { font-size: 22px; margin-bottom: 12px; }
  .gate-points { display: none; }
  .gate-body { padding: 20px; }
}

/* Aviso de cookies de la plataforma (mismo consentimiento que el resto de intrastat.com) */
.cookie-mini { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 150; display: flex; gap: 16px; align-items: center; justify-content: space-between; max-width: 880px; margin: 0 auto; padding: 14px 18px; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 12px 32px -12px rgba(16, 36, 63, .3); font-size: 13.5px; color: var(--ink-2); }
.cookie-mini p { margin: 0; }
.cookie-mini div { display: flex; gap: 8px; flex: none; }
@media (max-width: 640px) { .cookie-mini { flex-direction: column; align-items: stretch; } .cookie-mini div { justify-content: flex-end; } }

/* ---------- Descargas de pago (compra.js) ---------- */
.buy-card { position: relative; display: grid; gap: 14px; width: min(860px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px 28px; background: var(--paper); border-radius: 12px; box-shadow: 0 24px 64px -16px rgba(16, 36, 63, .45); }
.buy-head h2 { margin: 0; padding-right: 36px; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.buy-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 14px; }
.buy-x { position: absolute; top: 14px; right: 16px; width: 32px; height: 32px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font-size: 24px; line-height: 1; cursor: pointer; }
.buy-x:hover { background: var(--canvas); }
.buy-scope { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; padding: 12px 14px; background: var(--canvas); border-radius: 8px; font-size: 13.5px; }
.buy-scope dt { color: var(--ink-3); }
.buy-scope dd { margin: 0; }
.buy-formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.buy-formats legend { margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.buy-radio { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 10px 12px; border: 1px solid var(--rule-2); border-radius: 8px; cursor: pointer; font-size: 14px; }
.buy-radio:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(31, 111, 178, .15); }
.buy-radio:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.buy-radio small { grid-column: 2; color: var(--ink-3); font-size: 12.5px; line-height: 1.35; }
.buy-preview summary { cursor: pointer; font-size: 14px; color: var(--blue); }
.buy-preview .table-wrap { max-height: 280px; margin-top: 8px; }
.buy-sample { font-size: 12.5px; }
.buy-price p { margin: 0; }
.buy-price p + p { margin-top: 2px; font-size: 13.5px; }
.buy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 720px) {
  .buy-card { padding: 20px 16px; }
  .buy-formats { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Dónde vender ---------- */
.dv-query { align-items: flex-end; gap: 14px 20px; }
.dv-query .fgroup-search { min-width: min(420px, 100%); }
.dv-qtyrow { display: flex; gap: 6px; align-items: center; }
.dv-qtyrow .dv-qty { width: 130px; height: 32px; padding: 0 10px; border: 1px solid var(--rule-2); border-radius: var(--r-s); font: 14px var(--sans); }
.dv-qtyrow select { height: 32px; padding: 0 8px; border: 1px solid var(--rule-2); border-radius: var(--r-s); background: var(--paper); font: 14px var(--sans); }
.dv-code { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border: 1px solid var(--rule-2); max-width: 100%; }
.dv-trend { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.dv-sub { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.note-box { margin: 0 0 16px; padding: 10px 14px; border-left: 3px solid var(--rule-2); background: var(--canvas); font-size: 13px; color: var(--ink-2); }
.note-box p { margin: 0; } .note-box p + p { margin-top: 4px; }
.nc-box { border-left-color: var(--warn, #b7791f); background: var(--paper-2, #f4f6f9); font-size: 14px; color: var(--ink); }
.nc-box ul { margin: 6px 0 8px; padding-left: 18px; }
.nc-box li { margin: 2px 0; }
.nc-box .code { font-variant-numeric: tabular-nums; font-weight: 600; }
.nc-box .nc-src { margin-top: 6px; font-size: 12px; color: var(--ink-3, #666); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: help; }
.pill-good { background: #e3f2e9; color: #1d7a4a; } .pill-warn { background: #fff3dc; color: #8a5a00; } .pill-bad { background: #fdecea; color: #b3261e; }
tr.is-weak td { color: var(--ink-3); }

/* ---------- Operadores de la cadena ---------- */
.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 12px 0; }
.op-card { position: relative; display: grid; gap: 8px; align-content: start; padding: 16px 18px; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; }
.op-card.is-featured { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset; }
.op-feat { position: absolute; top: 12px; right: 14px; font-size: 11.5px; font-weight: 600; color: var(--blue); text-transform: uppercase; letter-spacing: .04em; }
.op-card h3 { margin: 0; padding-right: 72px; font-size: 16px; }
.op-kinds { margin: 0; font-size: 13px; color: var(--blue-deep); font-weight: 500; }
.op-serv { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.op-dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin: 0; font-size: 13px; }
.op-dl dt { color: var(--ink-3); } .op-dl dd { margin: 0; }
.op-quote { margin: 4px 0 0; }
.op-rating { margin: 0; font-size: 13px; color: var(--ink-2, #444); }
.op-stars { color: #b7791f; letter-spacing: 1px; }
.op-rating .linkish { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; text-decoration: underline; cursor: pointer; }
.op-reviews { display: grid; gap: 8px; margin-top: 6px; padding: 8px 10px; background: var(--paper-2, #f4f6f9); border-radius: 8px; font-size: 13px; }
.op-reviews[hidden] { display: none; }
.op-review p { margin: 0 0 2px; }
.op-review-h { color: var(--ink-3, #666); }
.op-review-reply { padding-left: 10px; border-left: 2px solid var(--rule); color: var(--ink-2, #444); }
.op-badges, .op-contact { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; font-size: 13px; }
