.budget { padding-top: 14px; }
.budget-title { padding: 0 0 18px; }
.budget-title h1 { margin: 0 0 9px; font-size: clamp(32px,4vw,49px); letter-spacing: -.035em; }
.budget-title nav { display: flex; flex-wrap: wrap; gap: 5px 16px; font-size: 13px; }
.budget-section { padding: 16px 18px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; min-width: 0; }
.budget-section h2 { margin: 0 0 9px; font-size: clamp(18px,2vw,24px); }
.budget-section p, .budget-section ul { font-size: 13px; line-height: 1.6; margin: 6px 0 10px; }
.budget-controls { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px 10px; margin: 10px 0; }
.budget-controls[hidden], .budget-controls [hidden], .budget-chart-types[hidden], #budget-figure[hidden] { display: none; }
.budget-controls label { display: grid; min-width: 0; gap: 4px; font-size: 12px; font-weight: 650; }
.budget-controls select, .budget-chart-types button { width: 100%; min-width: 0; min-height: 39px; padding: 6px 9px; border: 1px solid #bdcbb8;
  border-radius: 6px; background: #f8faf7; color: var(--ink); font: 13px system-ui; cursor: pointer; }
.budget-chart-types { display: flex; gap: 6px; margin: 11px 0 6px; }
.budget-chart-types button { width: auto; min-width: 76px; }
.budget-chart-types button[aria-pressed=true] { background: var(--accent); color: #fff; border-color: var(--accent); }
.budget-chart-types button:disabled { cursor: default; opacity: .5; }
.budget-note { color: var(--muted); }
#budget-figure { margin: 5px 0 11px; }
#budget-figure canvas { display: block; width: 100%; height: clamp(185px, 32vh, 300px); }
#budget-figure figcaption { display: flex; gap: 5px 14px; flex-wrap: wrap; padding: 6px 0; color: var(--muted); font-size: 12px; }
.budget-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-inline-end: 6px; }
.budget-table { overflow: auto; max-height: 355px; margin: 8px 0 5px; border: 1px solid var(--line); border-radius: 7px; }
.budget-table table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.budget-table caption { padding: 8px; text-align: left; }
.budget-table th, .budget-table td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.budget-table th:first-child { text-align: left; }
.budget-table td { white-space: nowrap; }
.budget-table thead { position: sticky; top: 0; background: #edf3e7; }
.budget-table tbody tr:last-child > * { border-bottom: 0; }
#budget-sources { display: flex; flex-wrap: wrap; gap: 5px 16px; padding-top: 6px; font-size: 12px; }
.budget-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin: 12px 0 8px; }
.budget-metrics > div { padding: 9px 10px; background: #edf3e7; border-radius: 7px; }
.budget-metrics dt { color: var(--muted); font-size: 12px; }
.budget-metrics dd { margin: 2px 0 0; font-size: clamp(17px, 2.5vw, 23px); font-weight: 700; }
.budget-section details { border-top: 1px solid var(--line); padding: 7px 0 0; margin-top: 9px; }
.budget-section summary { cursor: pointer; font-weight: 650; font-size: 14px; }
.budget-related { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
@media (min-width: 1100px) {
  .explorer-links:has([href='/boe/presupuestos/']) { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 699px) {
  .budget-section { padding: 12px; }
  .budget-controls, .budget-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .budget-controls label:first-child { grid-column: 1 / -1; }
  .budget-related { grid-template-columns: minmax(0,1fr); gap: 0; }
}
