/* ============================================================
 * Dashboard engine — KPI cards, HTML/CSS charts, feeds.
 * ============================================================ */

.dash-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e6ee); border-radius: 10px;
}
.dash-filter { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.dash-filter label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted, #6b7280); font-weight: 700;
}
.dash-filter select, .dash-filter input {
  padding: 7px 9px; border: 1px solid var(--border, #d5d9e0);
  border-radius: 6px; font: inherit; background: #fff;
}
.dash-live { display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted, #6b7280); margin-left: auto; }
.dash-updated { font-size: 12px; color: var(--muted, #6b7280); margin-right: 4px; }
.dash-loading, .dash-empty {
  padding: 24px; text-align: center; color: var(--muted, #9ca3af);
  font-size: 13px;
}
.dash-empty { padding: 16px; }

/* --- KPI row ---------------------------------------------------------- */
.dash-kpis {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.dash-kpi {
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e6ee);
  border-radius: 12px; padding: 14px 16px;
}
.dash-kpi-value { font-size: 26px; font-weight: 800; line-height: 1.1; }
.dash-kpi-label { font-size: 12px; font-weight: 600; color: var(--text, #334155); margin-top: 4px; }
.dash-kpi-sub { font-size: 11px; color: var(--muted, #9ca3af); margin-top: 2px; }

/* --- Card grid -------------------------------------------------------- */
.dash-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.dash-card {
  background: var(--surface, #fff); border: 1px solid var(--border, #e2e6ee);
  border-radius: 12px; padding: 14px; display: flex; flex-direction: column;
}
.dash-card-wide { grid-column: span 2; }
@media (max-width: 700px) { .dash-card-wide { grid-column: span 1; } }
.dash-card-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: #475569; margin-bottom: 12px;
}
.dash-card-body { flex: 1; min-height: 60px; }

/* --- Vertical bars ---------------------------------------------------- */
.dash-vbars {
  display: flex; align-items: flex-end; gap: 8px; height: 150px;
  padding-top: 16px; overflow-x: auto;
}
.dash-vbar {
  flex: 1; min-width: 26px; display: flex; flex-direction: column;
  align-items: center; height: 100%; justify-content: flex-end; gap: 4px;
}
.dash-vbar-fill { width: 70%; min-height: 2px; border-radius: 4px 4px 0 0;
  transition: height .3s ease; }
.dash-vbar-val { font-size: 10px; font-weight: 700; color: #475569; }
.dash-vbar-lbl { font-size: 10px; color: var(--muted, #9ca3af); white-space: nowrap; }

/* --- Horizontal bars -------------------------------------------------- */
.dash-hbars { display: flex; flex-direction: column; gap: 8px; }
.dash-hbar { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 8px; }
.dash-hbar-lbl {
  font-size: 12px; color: #334155; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-hbar-track { background: #eef2f7; border-radius: 999px; height: 12px; overflow: hidden; }
.dash-hbar-fill { height: 100%; border-radius: 999px; min-width: 2px; transition: width .3s ease; }
.dash-hbar-val { font-size: 12px; font-weight: 700; color: #475569; text-align: right; }

/* --- Donut ------------------------------------------------------------ */
.dash-donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dash-donut {
  width: 120px; height: 120px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
}
.dash-donut-hole {
  width: 74px; height: 74px; border-radius: 50%;
  background: var(--surface, #fff); display: grid; place-items: center;
}
.dash-donut-hole span { font-size: 18px; font-weight: 800; color: #334155; }
.dash-legend { display: flex; flex-direction: column; gap: 5px; min-width: 120px; flex: 1; }
.dash-legend-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; font-size: 12px; }
.dash-legend-dot { width: 12px; height: 12px; border-radius: 3px; }
.dash-legend-lbl { color: #475569; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-legend-val { font-weight: 700; color: #334155; }

/* --- Tables ----------------------------------------------------------- */
.dash-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dash-table th, .dash-table td {
  text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border-soft, #eef0f3);
}
.dash-table th { color: var(--muted, #6b7280); font-weight: 700; font-size: 11px; text-transform: uppercase; }
.dash-table td.num, .dash-table th.num { text-align: right; }
.dash-table td:first-child { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Activity feed + mini lists --------------------------------------- */
.dash-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.dash-feed li { display: grid; grid-template-columns: 22px 1fr auto; align-items: baseline; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--border-soft, #f1f3f6); }
.dash-feed-icon { font-size: 13px; }
.dash-feed-text { font-size: 12.5px; color: #334155; }
.dash-feed-actor { color: var(--muted, #9ca3af); font-size: 11px; }
.dash-feed-time { font-size: 11px; color: var(--muted, #9ca3af); white-space: nowrap; }

.dash-mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dash-mini-list li { display: flex; flex-direction: column; }
.dash-mini-main { font-size: 12.5px; font-weight: 600; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-mini-sub { font-size: 11px; color: var(--muted, #9ca3af); }
