.chart-card { min-height: 310px; }
.chart-card .card__title { font-size: 16px; }
.chart-wrap { height: 248px; }
.chart-svg { width: 100%; height: 100%; overflow: visible; }
.chart-grid-line { stroke: rgba(255,255,255,.09); stroke-width: 1; }
.chart-axis-label { fill: var(--muted); font-size: 11px; }
.chart-label { fill: var(--muted); font-size: 14px; font-weight: 800; }
.chart-legend { display: flex; gap: 18px; align-items: center; color: var(--muted); font-size: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.legend-green { background: var(--green); }
.legend-red { background: var(--red); }
.legend-yellow { background: var(--yellow); }
.legend-blue { background: var(--blue); }
.legend-purple { background: var(--purple); }

.summary-panel .quick-list__value { text-align: right; }
.summary-panel strong.highlight { color: var(--yellow); font-size: 20px; }
.side-actions { display: grid; gap: 10px; }
.side-actions .btn { justify-content: flex-start; }
.legend-strip { display: flex; gap: 12px; flex-wrap: wrap; padding: 14px 16px; }
.legend-strip .status-pill { min-width: 120px; }

.dashboard-layout--clean .table-grid { display: none; }
.period-banner {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.period-banner__eyebrow {
  display: block;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.period-banner h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 36px);
  letter-spacing: -.04em;
}
.period-banner p {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 760px;
  line-height: 1.45;
}
.period-banner__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dashboard-block-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.dashboard-block-grid--wide { align-items: stretch; }
.dashboard-treasury-card {
  border-color: rgba(245,185,66,.26);
  background: linear-gradient(180deg, rgba(35,42,46,.96), rgba(15,28,43,.98));
}
.treasury-total {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(245,185,66,.22);
  border-radius: 16px;
  background: rgba(245,185,66,.09);
  margin-bottom: 4px;
}
.treasury-total span { color: var(--soft); font-weight: 800; }
.treasury-total strong { color: var(--yellow); font-size: clamp(26px, 3vw, 36px); letter-spacing: -.04em; }
.treasury-total small { color: var(--muted); }
.status-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.status-summary-item {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.status-summary-item strong { font-size: 22px; }
.control-links { display: grid; gap: 10px; }
.control-link {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px;
  color: var(--text);
  background: rgba(255,255,255,.035);
}
.control-link:hover { border-color: rgba(245,185,66,.38); background: rgba(245,185,66,.08); }
.control-link strong { color: var(--yellow); }
.control-link span { color: var(--muted); line-height: 1.35; }
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-warning { color: var(--yellow) !important; }
.text-blue { color: var(--blue) !important; }
.text-purple { color: var(--purple) !important; }
.quick-list__value.highlight { color: var(--yellow); }

/* V7 · carga inicial Firebase */
.import-empty-card {
  border-color: rgba(245, 197, 66, 0.42);
  background: linear-gradient(135deg, rgba(245, 197, 66, 0.10), rgba(15, 31, 50, 0.96));
}
.side-actions--row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.side-actions--row .btn {
  width: auto;
}

/* V12 — etiquetas de importes y gráficas circulares por categoría */
.chart-value {
  font-size: 13px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(9, 17, 29, .95);
  stroke-width: 4px;
  stroke-linejoin: round;
}
.dashboard-block-grid--categories {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.category-breakdown-card { min-height: 300px; }
.donut-chart {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
.donut-svg { width: 180px; height: 180px; overflow: visible; }
.donut-pct {
  fill: var(--text);
  font-size: 10px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(9, 17, 29, .95);
  stroke-width: 4px;
}
.donut-total-label { fill: var(--muted); font-size: 11px; font-weight: 800; }
.donut-total-value { fill: var(--text); font-size: 16px; font-weight: 900; }
.donut-legend { display: grid; gap: 8px; min-width: 0; }
.donut-legend h3 { margin: 0 0 4px; font-size: 14px; color: var(--text); }
.donut-legend__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  color: var(--soft);
}
.donut-legend__item span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.donut-legend__item i { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.donut-legend__item strong { color: var(--text); white-space: nowrap; }
.donut-legend__item small { color: var(--muted); font-weight: 900; }
.donut-empty {
  min-height: 190px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: rgba(255,255,255,.025);
}
@media (max-width: 1100px) {
  .dashboard-block-grid--categories { grid-template-columns: 1fr; }
  .donut-chart { grid-template-columns: 1fr; justify-items: center; }
  .donut-legend { width: 100%; }
}

/* V13 — donuts del mismo tamaño visual que el resto de gráficas */
.chart-grid--categories {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.category-breakdown-card {
  min-height: 322px;
}

.category-breakdown-card .card__body {
  padding-top: 12px;
}
.donut-chart--compact {
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 236px;
}
.donut-chart--compact .donut-svg {
  width: 172px;
  height: 172px;
}
.donut-chart--compact .donut-legend {
  gap: 8px;
}
.donut-chart--compact .donut-legend__item {
  padding: 6px 0;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  font-size: 14px;
}
.donut-chart--compact .donut-total-label { font-size: 11px; }
.donut-chart--compact .donut-total-value { font-size: 18px; }
.donut-chart--compact .donut-pct { font-size: 11px; }
.category-ranking {
  display: grid;
  gap: 12px;
  min-height: 236px;
  align-content: start;
}
.category-ranking__item {
  display: grid;
  gap: 5px;
}
.category-ranking__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}
.category-ranking__top span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--soft);
}
.category-ranking__top i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.category-ranking__top strong {
  white-space: nowrap;
  color: var(--text);
}
.category-ranking__track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.075);
  overflow: hidden;
}
.category-ranking__bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--category-color, var(--yellow));
  opacity: .92;
}
.category-ranking__bar--expense { filter: saturate(1.2); }
.category-ranking__item small {
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}
@media (max-width: 1350px) {
  .chart-grid--categories { grid-template-columns: 1fr; }
  .donut-chart--compact { grid-template-columns: 176px minmax(0, 1fr); }
}


/* V15 — mejora de legibilidad en dashboard al 100% */
@media (min-width: 1200px) {
  .dashboard-layout--clean .chart-grid:first-of-type {
    gap: 16px;
  }
}


/* V16 — mejora real de legibilidad a zoom 100% */
.dashboard-layout--clean .chart-grid:first-of-type .card__title { font-size: 17px; }
.dashboard-layout--clean .chart-grid:first-of-type .card__body { padding-top: 10px; }

/* V18 — banner superior compacto */
.dashboard-layout--clean .period-banner {
  padding: 14px 18px;
  min-height: 108px;
}
.dashboard-layout--clean .period-banner h1 {
  font-size: clamp(25px, 2.45vw, 32px);
}
.dashboard-layout--clean .period-banner p {
  max-width: 680px;
  margin-top: 4px;
}
.dashboard-layout--clean .period-banner__eyebrow {
  margin-bottom: 5px;
}


.quick-list__item--treasury-total {
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid rgba(245,185,66,.28);
  border-radius: 14px;
  background: rgba(245,185,66,.08);
  align-items: center;
}
.quick-list__item--treasury-total:last-child { border-bottom: 1px solid rgba(245,185,66,.28); }
.treasury-reserve__value {
  color: var(--yellow);
  font-size: clamp(20px, 1.85vw, 26px);
  white-space: nowrap;
}
.quick-list__item--treasury-total .quick-list__label {
  display: grid;
  gap: 3px;
  line-height: 1.15;
}
.quick-list__item--treasury-total .quick-list__label strong {
  font-size: 15px;
}
.quick-list__item--treasury-total .quick-list__label small {
  line-height: 1.15;
}
.side-column .quick-list__item--treasury-total .quick-list__label small {
  font-size: 12px;
}

/* V33 — revisión de cierre fiscal canónico */
.fiscal-close-review { display: grid; gap: 14px; }
.fiscal-close-review__head,
.fiscal-close-review__row {
  display: grid;
  grid-template-columns: minmax(180px, 1.45fr) repeat(4, minmax(110px, .8fr));
  gap: 10px;
  align-items: center;
}
.fiscal-close-review__head {
  padding: 0 10px 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.fiscal-close-review__row {
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.025);
}
.fiscal-close-review__row span { color: var(--soft); }
@media (max-width: 900px) {
  .fiscal-close-review__head { display: none; }
  .fiscal-close-review__row { grid-template-columns: 1fr 1fr; }
  .fiscal-close-review__row strong { grid-column: 1 / -1; }
}


/* V42 — drill-down de categorías del dashboard */
.donut-legend__item--interactive {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
  padding-left: 7px;
  padding-right: 7px;
  transition: background .15s ease, transform .15s ease;
  grid-template-columns: minmax(0, 1fr) auto auto 16px;
}
.donut-legend__item--interactive:hover,
.donut-legend__item--interactive:focus-visible {
  background: rgba(255,255,255,.055);
  outline: 1px solid rgba(245,185,66,.24);
}
.donut-legend__item--interactive:active { transform: translateY(1px); }
.donut-legend__chevron { color: var(--yellow); font-size: 20px; line-height: 1; text-align: right; }
.category-ranking__item--interactive {
  width: 100%;
  border: 0;
  padding: 7px;
  margin: -7px;
  border-radius: 11px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.category-ranking__item--interactive:hover,
.category-ranking__item--interactive:focus-visible { background: rgba(255,255,255,.05); outline: 1px solid rgba(245,185,66,.22); }
.category-detail__summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.category-detail__summary > div {
  display: grid;
  gap: 6px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.035);
}
.category-detail__summary span { color: var(--muted); font-size: 12px; font-weight: 700; }
.category-detail__summary strong { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.category-detail__summary i { width: 10px; height: 10px; border-radius: 3px; background: var(--category-color, var(--yellow)); flex: 0 0 auto; }
.category-detail__help { margin: 0 0 14px; color: var(--muted); line-height: 1.45; }
.category-detail__table-wrap { max-height: min(58vh, 560px); overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.category-detail__table { min-width: 850px; }
.category-detail__table td:nth-child(2) { min-width: 240px; }
.category-detail__table td:nth-child(2) small { display: block; margin-top: 4px; color: var(--muted); font-weight: 500; }
.category-detail__table tfoot td { position: sticky; bottom: 0; background: #122136; border-top: 1px solid var(--line-strong); }
.category-detail__amount { text-align: right; white-space: nowrap; font-weight: 900; }
.category-detail__files { white-space: nowrap; }
.category-detail__attachment { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.055); text-decoration: none; }
.category-detail__attachment:hover { background: rgba(245,185,66,.12); }
.category-detail__attachment--missing { opacity: .7; }
@media (max-width: 850px) {
  .category-detail__summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
