/* ===========================================================
   reports.css — dashboard view (KPIs, charts, panels)
   =========================================================== */

.view-heading { font-size: 16px; font-weight: 600; margin: 0; }

.dashboard { display: flex; flex-direction: column; gap: 18px; }

/* ===== KPI cards ===== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.kpi-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--line-strong);
}
.kpi-card.kpi-accent::before { background: var(--accent); }
.kpi-card.kpi-info::before   { background: var(--info); }
.kpi-card.kpi-warn::before   { background: var(--warn); }
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-top: 4px;
}
.kpi-sub { font-size: 11px; color: var(--fg-subtle); margin-top: 2px; }

/* ===== Dashboard grid of panels ===== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  align-items: start;
}
.dash-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: min(520px, 70vh);
}
.dash-panel.span-2 { grid-column: span 2; }
.dash-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.dash-panel-head h3 { font-size: 13px; font-weight: 600; }
.dash-panel-sub { font-size: 11px; color: var(--fg-subtle); }
.dash-panel-body {
  padding: 14px 16px;
  min-height: 60px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.chart-empty {
  color: var(--fg-subtle);
  font-size: 12px;
  text-align: center;
  padding: 24px 8px;
}

/* ===== Funnel ===== */
.funnel { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.funnel-row { display: grid; grid-template-columns: 10px 130px 1fr 28px; align-items: center; gap: 8px; }
.funnel-dot { width: 8px; height: 8px; border-radius: 50%; }
.funnel-name {
  font-size: 12px; color: var(--fg);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.funnel-track { background: var(--hover); border-radius: 999px; height: 16px; overflow: hidden; }
.funnel-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.funnel-val { font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Horizontal bars ===== */
.hbars { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: 110px 1fr 26px; align-items: center; gap: 8px; }
.hbar-label {
  font-size: 12px; color: var(--fg-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hbar-track { background: var(--hover); border-radius: 999px; height: 14px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.hbar-val { font-size: 12px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Area chart ===== */
.chart-svg { width: 100%; height: 120px; display: block; }

/* ===== Mini bars ===== */
.minibars {
  display: flex; align-items: flex-end; gap: 3px;
  height: var(--mb-h, 90px);
}
.minibar { flex: 1; display: flex; align-items: flex-end; height: 100%; min-width: 3px; }
.minibar-fill { width: 100%; border-radius: 3px 3px 0 0; min-height: 2px; transition: height 0.3s ease; }

/* ===== Lists (upcoming / generic) ===== */
.dash-list { list-style: none; display: flex; flex-direction: column; }
.dash-list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.dash-list-item:last-child { border-bottom: 0; }
.dli-main { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dli-meta { font-size: 11px; color: var(--fg-muted); white-space: nowrap; }

/* ===== Activity feed ===== */
.activity-feed { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.activity-item {
  display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 12px;
}
.activity-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-left: 3px;
}
.activity-text { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-time { font-size: 11px; color: var(--fg-subtle); white-space: nowrap; }

/* ===== Footer / misc ===== */
.dash-foot { font-size: 11px; color: var(--fg-subtle); text-align: right; }
.link-btn {
  background: none; border: 0; color: var(--accent-hover);
  cursor: pointer; font-size: 11px; padding: 0; text-decoration: underline;
}
.dash-loading { display: flex; flex-direction: column; gap: 12px; padding: 20px; }

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-panel.span-2 { grid-column: span 2; }
}
@media (max-width: 720px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-panel.span-2 { grid-column: span 1; }
  .funnel-row { grid-template-columns: 10px 90px 1fr 24px; }
  .hbar-row { grid-template-columns: 80px 1fr 24px; }
}
