/* Dashboard — grids de gráficos e cards de bancos */

.dashboard-health {
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(0, 2fr);
  gap: 16px;
  margin-bottom: 16px;
  min-width: 0;
}

.dashboard-health__summary,
.dashboard-health__details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  min-width: 0;
}

.dashboard-health__summary {
  --health-color: var(--text-dim);
  --health-score: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  text-align: center;
}

.dashboard-health__summary .card-title {
  align-self: stretch;
  text-align: left;
}

.dashboard-health__summary[data-health-state="excellent"] {
  --health-color: var(--color-teal);
}

.dashboard-health__summary[data-health-state="good"] {
  --health-color: var(--color-blue);
}

.dashboard-health__summary[data-health-state="attention"] {
  --health-color: var(--color-amber-visual);
}

.dashboard-health__summary[data-health-state="critical"] {
  --health-color: var(--color-red);
}

.dashboard-health__gauge {
  position: relative;
  width: 168px;
  height: 84px;
  margin: 22px auto 10px;
  overflow: hidden;
}

.dashboard-health__gauge-fill {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: conic-gradient(
    from 270deg,
    var(--health-color) 0 calc(var(--health-score) * 1.8deg),
    var(--surface-3) calc(var(--health-score) * 1.8deg) 180deg,
    transparent 180deg 360deg
  );
}

.dashboard-health__gauge-fill::after {
  content: '';
  position: absolute;
  inset: 22px 22px auto;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: var(--surface);
}

.dashboard-health__score {
  position: absolute;
  inset: auto 0 0;
  color: var(--health-color);
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.dashboard-health__label {
  color: var(--health-color);
  font-size: 18px;
  font-weight: 750;
}

.dashboard-health__diagnosis {
  max-width: 300px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.dashboard-health__details {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(280px, 1.1fr);
  gap: 18px;
  padding: 20px;
}

.dashboard-health__hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.dashboard-health__metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--color-blue) 22%, var(--border));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-blue) 7%, var(--surface));
}

.dashboard-health__metric span,
.dashboard-health__metric small {
  color: var(--text-muted);
}

.dashboard-health__metric span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.dashboard-health__metric strong {
  margin: 6px 0 4px;
  color: var(--color-blue);
  font-family: var(--font-mono);
  font-size: clamp(14px, 1vw, 18px);
  white-space: nowrap;
  overflow-wrap: normal;
}

.dashboard-health__metric strong.text-red {
  color: var(--color-red);
}

.dashboard-health__metric small {
  font-size: 12px;
  white-space: nowrap;
}

.dashboard-health__components {
  display: grid;
  align-content: center;
  gap: 11px;
  min-width: 0;
}

.dashboard-health__component-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.dashboard-health__component-heading strong {
  color: var(--text);
  font-weight: 650;
}

.dashboard-health__component-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.dashboard-health__component-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--color-blue);
}

.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  min-width: 0;
}

.dash-grid > * {
  min-width: 0;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-width: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.chart-card .chart-area {
  position: relative;
  height: 280px;
  min-width: 0;
  overflow: hidden;
}

.chart-area canvas {
  width: 100% !important;
  max-width: 100% !important;
}

/* Lista de bancos (vw_saldo_bancos) */
.bank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-width: 0;
  transition: transform var(--transition), border-color var(--transition);
}

.bank-item:hover {
  transform: translateX(2px);
  border-color: var(--border-strong);
}

.bank-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-blue-dim);
  color: var(--color-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.bank-info {
  flex: 1;
  min-width: 0;
}

.bank-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bank-type {
  font-size: 12px;
  color: var(--text-muted);
}

.bank-balance {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.bank-balance.negativo {
  color: var(--color-red);
}

@media (max-width: 1100px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-health__details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .dashboard-health {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .dashboard-health__hero-metrics {
    grid-template-columns: 1fr;
  }
}
