@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;650;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
  color-scheme: light;
  --ink: #132821;
  --muted: #4e635c;
  --line: #dce7e0;
  --paper: #f3f7f4;
  --white: #fff;
  --dark: #123f35;
  --accent: #1d6b57;
  --soft: #e4f2eb;
  --serif: 'Instrument Serif', Georgia, serif;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 16px;
  background: var(--paper);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid #176c5a;
  outline-offset: 3px;
}
a { color: var(--accent); text-underline-offset: .18em; }
p { line-height: 1.56; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell, .top-inner { width: min(100% - 64px, 1240px); margin-inline: auto; }
.top { height: 69px; background: #f7faf8; border-bottom: 1px solid var(--line); }
.top-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.06rem; text-decoration: none; letter-spacing: -.025em; }
.top nav { display: flex; gap: 25px; }
.top nav a { text-decoration: none; font-size: .89rem; color: var(--muted); font-weight: 650; }
.top nav a:hover { color: var(--accent); text-decoration: underline; }
.hero { padding: 45px 0 30px; }
.hero h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(3.15rem, 6.15vw, 6rem); line-height: .96; letter-spacing: -.035em; }
.hero em { color: #23755e; font-weight: 400; }
.hero p { max-width: 640px; font-size: 1.06rem; color: var(--muted); margin: 17px 0 0; }

.views { display: flex; gap: 7px; margin-bottom: 14px; overflow-x: auto; padding: 4px 3px 6px; }
.views button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 0 auto;
  min-height: 46px;
  background: #fafcfb;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 11px;
  color: #36514a;
  font-size: .9rem;
  font-weight: 650;
  white-space: nowrap;
}
.views button:hover, .groups button:hover { background: var(--soft); }
.views button[aria-pressed="true"] { background: var(--dark); color: #f4fff9; border-color: var(--dark); }
.views button svg { width: 18px; height: 18px; }
.status { padding: 24px; color: var(--muted); border: 1px solid var(--line); background: white; border-radius: 10px; }
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 4px 14px #153a2c05;
}
.card-head, .details-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; padding: 23px 27px 15px; }
.card h2 { margin: 0; font-size: clamp(1.21rem, 2.1vw, 1.68rem); letter-spacing: -.035em; line-height: 1.15; }
.card-actions { display: flex; align-items: end; gap: 8px; }
.card-actions:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
.card-actions .secondary { min-height: 38px; }
.card-head p, .details-head p { color: var(--muted); margin: 7px 0 0; font-size: .95rem; }
.field { display: grid; gap: 4px; color: var(--muted); min-width: 170px; font-size: .84rem; }
select {
  appearance: none;
  background: #fafcfb url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23354f47' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 650;
  min-height: 38px;
  padding: 5px 30px 5px 11px;
}
.groups { display: flex; gap: 7px; flex-wrap: wrap; padding-inline: 27px; margin-bottom: 14px; }
.groups:empty { display: none; }
.groups button { border: 1px solid var(--line); border-radius: 7px; background: transparent; padding: 6px 11px; color: var(--muted); font-size: .87rem; font-weight: 650; }
.groups [aria-pressed="true"] { background: var(--soft); color: #165543; border-color: #cce5d8; }
.timeline {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f6faf7;
  padding: 10px 13px;
  margin: 0 27px;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.play, .step { display: grid; place-items: center; flex: 0 0 auto; width: 39px; height: 39px; border-radius: 8px; border: 1px solid var(--line); }
.play { color: white; background: #16624e; border-color: #16624e; }
.play:not(:disabled):hover { background: #123f35; }
.step { color: var(--dark); background: #fff; width: 35px; }
.step:not(:disabled):hover { background: var(--soft); }
:is(.step, .play):disabled { opacity: .4; }
.slider { flex: 1 1 100px; min-width: 42px; }
#period { appearance: none; width: 100%; height: 7px; border-radius: 99px; margin: 2px 0 0; background: linear-gradient(90deg, #398c74 var(--progress), #d8e6dd var(--progress)); cursor: pointer; }
#period::-webkit-slider-thumb { appearance: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid #fff; background: #22745c; box-shadow: 0 0 0 1px #297961; }
#period::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; background: #22745c; box-shadow: 0 0 0 1px #297961; }
.slider-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .77rem; margin-top: 3px; }
.date-select select { min-width: 118px; }
.visual {
  margin: 15px 27px 24px;
  border: 1px solid #e8f0eb;
  border-radius: 12px;
  overflow: hidden;
  background-color: #fbfdfb;
  background-image: radial-gradient(#cbdcd340 .8px, transparent .8px);
  background-size: 15px 15px;
}
.visual-heading, .legend { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 15px; color: var(--muted); font-size: .85rem; }
.visual-heading { border-bottom: 1px solid #edf3ee; background: #fbfdfbe8; }
.visual-heading p { margin: 0; }
#diagram-unit { text-align: right; font-weight: 700; }
.mobile-hint { display: none; }
.canvas { overflow-x: auto; }
.diagram { width: 100%; min-width: 680px; display: block; overflow: visible; }
.diagram text { font-family: 'DM Sans', system-ui, sans-serif; }
.column-label { fill: #547069; font-size: 10px; font-weight: 700; letter-spacing: .13em; }
.core rect { fill: #12493d; filter: drop-shadow(0 6px 10px #153a2c33); }
.core-label { fill: #fff; font-size: 17px; font-weight: 700; letter-spacing: -.04em; }
.core-caption { fill: #c6e3d8; font-size: 10px; }
.node { cursor: pointer; }
.node rect { fill: #fff; stroke: #d8e5dc; stroke-width: 1.1; }
.node.selected rect, .node:hover rect { stroke: #66a793; stroke-width: 1.65; fill: #f7fcf9; }
.node-label { fill: #203b34; font-size: 13px; font-weight: 650; }
.node-value { fill: #344f47; font-size: 14px; font-weight: 700; }
.flow-band, .flow-line, .flow-particles, .flow-hit { fill: none; }
.flow-band { transition: stroke-width .38s ease-out; }
.flow-line { stroke-width: 1.2; opacity: .5; }
.flow-particles { stroke-width: 2.8; stroke-dasharray: 2 24; stroke-linecap: round; animation: current 1.18s linear infinite; opacity: .9; }
.flow-arrow { fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stock :is(.flow-particles, .flow-arrow) { display: none; }
.flow-hit { stroke: transparent; stroke-width: 19; cursor: pointer; }
.connection.selected .flow-line { stroke-width: 2; opacity: 1; }
.off { visibility: hidden; pointer-events: none; }
@keyframes current { to { stroke-dashoffset: -26; } }
.legend { border-top: 1px solid #edf3ee; background: #fbfdfbe8; }
.legend > span:first-child { display: flex; align-items: center; gap: 7px; }
.legend i { display: inline-block; width: 20px; height: 5px; border-radius: 4px; background: #4da58a; flex: 0 0 auto; }
.legend a { text-decoration: none; }
.legend a:hover { text-decoration: underline; }
.legend:has(.map-key) i { display: none; }
.legend:has(.map-key) #legend-text { display: flex; flex-wrap: wrap; gap: 9px 17px; }
.visual:has(.tariff-canvas) .mobile-hint { display: none; }
.tariff-canvas {
  --tariff-paid-color: #21795f;
  --tariff-state-color: #4b67ac;
}
.tariff-grid { padding: 0 16px; background: #fff; }
.tariff-columns, .tariff-row {
  display: grid;
  grid-template-columns: minmax(125px, .8fr) minmax(168px, 1fr) minmax(235px, 1.8fr);
  gap: 16px;
  align-items: center;
  padding: 10px 14px;
}
.tariff-columns { color: var(--muted); border-bottom: 1px solid #e3ede7; font-size: .83rem; font-weight: 650; }
.tariff-row { min-height: 71px; border-bottom: 1px solid #e3ede7; }
.tariff-total { background: #f0f7f3; }
.tariff-service { font-weight: 700; }
.tariff-row button {
  min-width: 0;
  min-height: 40px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.tariff-row button:hover, .tariff-row button[aria-pressed="true"] {
  background: #f4f8f6;
  border-color: #adcdc0;
}
.tariff-total .tariff-bill strong { font-size: clamp(1.2rem, 2.5vw, 1.65rem); }
.tariff-split { display: block; height: 10px; overflow: hidden; border-radius: 5px; background: var(--tariff-state-color); }
.tariff-split > span {
  display: block;
  width: var(--tariff-paid, 0%);
  height: 100%;
  background: var(--tariff-paid-color);
  transition: width .55s cubic-bezier(.25, .1, .25, 1);
}
.tariff-values { display: flex; justify-content: space-between; gap: 10px; margin-top: 5px; font-size: .84rem; color: #185a47; }
.tariff-values strong { color: #354e91; }
.tariff-missing .tariff-split { background: #e4e9e6; }
.tariff-missing .tariff-split > span { visibility: hidden; }
.tariff-missing .tariff-values { color: var(--muted); }
.tariff-mobile-label { display: none; }
.tariff-context { margin: 0; padding: 12px 14px; color: var(--muted); font-size: .85rem; }
.map-key.tariff-key-state::before { background: #4b67ac; }
@media (max-width: 740px) {
  .tariff-grid { padding-inline: 6px; }
  .tariff-columns { display: none; }
  .tariff-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 5px; padding-inline: 8px; }
  .tariff-coverage { grid-column: 1 / -1; }
  .tariff-row .tariff-bill { text-align: right; }
  .tariff-mobile-label { display: block; color: var(--muted); font-size: .75rem; margin-bottom: 3px; }
  .tariff-context { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .tariff-split > span { transition: none; }
}
.map-key { display: inline-flex; align-items: center; gap: 6px; }
.map-key::before { content: ''; width: 18px; height: 4px; border-radius: 99px; background: #38846b; }
.map-key-usd::before { background: #4e74b5; }
.map-key-stock::before { height: 0; background: none; border-top: 2px dashed #747c81; border-radius: 0; }

body:has(.views [data-view="mapa"][aria-pressed="true"]) .hero { padding-block: 25px 20px; }
body:has(.views [data-view="mapa"][aria-pressed="true"]) .hero h1 { font-size: clamp(2.9rem, 5.2vw, 4.65rem); }
body:has(.views [data-view="mapa"][aria-pressed="true"]) .hero p { max-width: 950px; margin-top: 9px; }
.overview-diagram { min-width: 0; }
.map-zone-label { fill: #4b6960; font-size: 12px; letter-spacing: .10em; font-weight: 700; }
.map-node rect { fill: #fff; stroke: #cddfd5; stroke-width: 1.1px; }
.map-cambio rect, .map-bcra rect, .map-estado rect, .map-hogares rect, .map-recaudacion rect { fill: #164b3f; stroke: #164b3f; }
.map-node-title { fill: #233b33; font-size: 16px; font-weight: 700; letter-spacing: -.035em; }
.map-node-note { fill: #4e675d; font-size: 11.5px; }
.map-stock { fill: #405a50; font-size: 11.8px; font-weight: 700; }
:is(.map-cambio, .map-bcra, .map-estado, .map-hogares, .map-recaudacion) .map-node-title { fill: #fff; }
:is(.map-cambio, .map-bcra, .map-estado, .map-hogares, .map-recaudacion) .map-node-note { fill: #c5e3d7; }
:is(.map-bcra, .map-recaudacion) .map-stock { fill: #f3fffa; }
.map-edge { --path-color: #35856b; cursor: pointer; }
.map-edge.map-usd { --path-color: #4b71b7; }
.map-edge.map-balance, .map-edge.map-structural { --path-color: #778389; }
.map-edge .flow-band { stroke: var(--path-color); opacity: .35; stroke-linecap: round; stroke-linejoin: round; transition: none; }
.map-edge .flow-line, .map-edge .flow-particles { stroke: var(--path-color); }
.map-edge .flow-line { stroke-width: 1.45; opacity: .78; }
.map-edge .flow-particles { stroke-width: 2.4; stroke-dasharray: 2 24; }
.map-edge.map-negative .flow-particles { animation-direction: reverse; }
.map-edge-label { fill: #27433a; font-size: 11px; font-weight: 650; }
.map-edge-divider { fill: var(--path-color); }
.map-edge-label .map-edge-value {
  fill: #155f4b;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.7px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.map-usd .map-edge-label .map-edge-value { fill: #355891; }
.map-balance .map-edge-label .map-edge-value { fill: #415459; }
.map-edge:hover .map-edge-name, .map-edge.selected .map-edge-name, .map-edge:focus-visible .map-edge-name { text-decoration: underline; }
.map-edge:focus-visible { outline: none; }
.map-edge:focus-visible .flow-line { stroke-width: 2.5; opacity: 1; }
.map-edge.map-balance .flow-line, .map-edge.map-structural .flow-line { stroke-dasharray: 4 4; }
.map-edge.map-structural, .map-edge.map-structural .flow-hit { cursor: default; }
.map-edge.map-zero .flow-line { opacity: .28; stroke-dasharray: 2 5; }
:is(.map-balance, .map-structural, .map-zero) .flow-particles { display: none; }
#explorer:fullscreen { overflow: auto; border-radius: 0; }
#explorer:fullscreen .visual { max-width: 1500px; margin-inline: auto; }

.circuit-diagram { min-width: 755px; }
.circuit-diagram .map-edge-label { font-size: 12px; }
.circuit-diagram .map-edge-value { font-size: 11px; }
.circuit-diagram .circuit-main-edge .map-edge-name { font-size: 14px; font-weight: 750; }
.circuit-diagram .map-node-note { font-size: 10.5px; }
.circuit-household-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 14px 24px 3px;
}
.circuit-household-note p { flex: 1 1 360px; margin: 0; font-size: .88rem; color: var(--muted); }
.circuit-household-note .secondary { white-space: normal; text-align: left; }
body:has([data-view="circuito"][aria-pressed="true"]) .hero { padding-block: 25px 20px; }
body:has([data-view="circuito"][aria-pressed="true"]) .hero h1 { font-size: clamp(2.9rem, 5.2vw, 4.65rem); }
body:has([data-view="circuito"][aria-pressed="true"]) .hero p { max-width: 950px; margin-top: 9px; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); gap: 11px; margin-block: 13px; }
.metric {
  text-align: left;
  min-height: 105px;
  padding: 13px 16px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  align-content: center;
  gap: 6px;
}
.metric:hover { border-color: #7bb6a1; }
.metric span { color: var(--muted); font-size: .87rem; }
.metric strong { font-size: clamp(1.25rem, 2vw, 1.75rem); letter-spacing: -.045em; }
.metric small { color: var(--muted); }
.metric .positive { color: #156349; }
.details { overflow: hidden; }
.details-head { padding-bottom: 21px; border-bottom: 1px solid var(--line); }
.secondary { background: white; color: var(--accent); border: 1px solid #c5ded3; border-radius: 8px; padding: 8px 12px; white-space: nowrap; font-weight: 700; font-size: .87rem; }
.secondary:hover { background: var(--soft); }
.detail-grid { display: grid; grid-template-columns: minmax(260px, 36%) 1fr; }
.series-list { max-height: 330px; overflow: auto; border-right: 1px solid var(--line); }
.series-list button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  color: var(--ink); text-align: left; padding: 10px 15px 10px 25px; border: 0; border-bottom: 1px solid #eef3ef;
  background: transparent; font-size: .88rem;
}
.series-list button strong { white-space: nowrap; font-size: .85rem; }
.series-list button small { color: var(--muted); display: block; margin-top: 2px; }
.series-list button:hover, .series-list button[aria-pressed="true"] { background: var(--soft); }
.history { padding: 19px 25px; overflow-wrap: anywhere; }
.kind, .change { font-size: .86rem; color: var(--muted); margin: 1px 0 4px; }
.history h3 { margin: 4px 0 8px; font-size: 1.19rem; line-height: 1.2; }
.reading { font-size: 1.68rem; letter-spacing: -.04em; }
.chart { margin-top: 10px; background: #f7faf8; padding: 2px 9px 7px; border-radius: 8px; }
.chart svg { width: 100%; max-height: 140px; display: block; }
.chart-axis { fill: none; stroke: #c8dad0; stroke-width: 1; }
.chart-line { fill: none; stroke: #258367; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.chart-mark { stroke: #639b87; stroke-dasharray: 3 3; }
.chart-dot { fill: #205f4d; }
.chart-labels { display: flex; justify-content: space-between; padding-inline: 7px; color: var(--muted); font-size: .8rem; }
.attribution { font-size: .86rem; color: var(--muted); margin-bottom: 0; }
.related { display: block; border: 0; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; padding: 0; margin-top: 11px; font-size: .87rem; }
.sources { margin-top: 15px; padding: 24px 27px; }
.sources p { color: var(--muted); max-width: 83ch; }
.sources details { margin-block: 14px; }
.sources summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.sources li { margin-bottom: 10px; }
.sources small { color: var(--muted); }
.footer { margin-top: 16px; padding-block: 19px 25px; color: var(--ink); font-size: .9rem; display: flex; justify-content: space-between; gap: 10px; }
.footer span { color: var(--muted); }

@media (max-width: 800px) {
  .shell, .top-inner { width: min(100% - 32px, 1240px); }
  .hero { padding-top: 33px; }
  .views button { flex: 0 0 auto; }
  .card-head, .details-head { padding-inline: 16px; }
  .groups { padding-inline: 16px; }
  .timeline, .visual { margin-inline: 16px; }
  .diagram { min-width: 735px; }
  .overview-diagram { min-width: 960px; }
  .mobile-hint { display: block; font-size: .81rem; color: var(--muted); margin: 5px 15px 2px; }
}

@media (max-width: 540px) {
  .top { height: 58px; }
  .top nav { gap: 12px; }
  .top nav a { font-size: .81rem; }
  .brand { gap: 6px; font-size: .93rem; }
  .brand img { width: 26px; height: 26px; }
  .hero p { font-size: 1rem; }
  .card-head { flex-direction: column; gap: 12px; }
  .card-actions { flex-wrap: wrap; }
  .card-actions .secondary { font-size: .78rem; }
  .timeline { margin-inline: 11px; gap: 6px; padding-inline: 8px; }
  .step { width: 27px; }
  .play { width: 34px; }
  .date-select select { min-width: auto; max-width: 107px; padding-left: 7px; padding-right: 23px; background-position: right 7px center; }
  .slider-labels { font-size: .65rem; }
  .visual { margin-inline: 11px; }
  .visual-heading, .legend { align-items: start; flex-direction: column; padding-inline: 11px; }
  #diagram-unit { text-align: left; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 100px; padding-inline: 10px; }
  .details-head { flex-wrap: wrap; gap: 12px; }
  .detail-grid { grid-template-columns: 1fr; }
  .series-list { max-height: 188px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sources, .history { padding-inline: 15px; }
}

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