/* ==========================================================================
   HomeBiz Zim - dashboard.css
   KPIs, chart, low stock, top products, payment mix, activity
   Load order: 3 of 7
   ========================================================================== */

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  position: relative;
  overflow: hidden;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi::after {
  content: "";
  position: absolute;
  top: -58px;
  right: -46px;
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background: var(--kpi-tint, var(--brand-soft));
  opacity: 0.85;
}
.kpi.green { --kpi-tint: var(--green-soft); --kpi-color: var(--green); }
.kpi.red { --kpi-tint: var(--red-soft); --kpi-color: var(--red); }
.kpi.blue { --kpi-tint: var(--blue-soft); --kpi-color: var(--blue); }
.kpi.violet { --kpi-tint: var(--violet-soft); --kpi-color: var(--violet); }
.kpi-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi-ico {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: var(--kpi-tint);
  color: var(--kpi-color);
}
.kpi-ico .icon { width: 16px; height: 16px; }
.kpi-value {
  position: relative;
  z-index: 1;
  margin-top: 5px;
  font-size: clamp(22px, 2.2vw, 27px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.kpi-value.negative { color: var(--red); }
.kpi-sub { position: relative; z-index: 1; margin-top: 3px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }

/* ---------- Chart ---------- */
.chart-card { display: flex; flex-direction: column; }
.chart {
  display: flex;
  align-items: stretch;
  gap: 5px;
  height: 190px;
  padding: 18px 16px 10px;
}
.chart-col { position: relative; display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 6px; }
.chart-track { position: relative; display: flex; flex: 1; min-height: 0; align-items: flex-end; justify-content: center; }
.chart-bar {
  width: 100%;
  max-width: 26px;
  min-height: 3px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  animation: grow 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  transition: filter 0.15s, box-shadow 0.15s;
}
.chart-col.is-today .chart-bar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-soft); }
.chart-bar.is-empty { background: var(--surface-3); }
.chart-col:hover .chart-bar { filter: brightness(1.12); }
.chart-tip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--h, 0) * 1% + 7px);
  z-index: 2;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--text);
  color: var(--surface);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 2px);
  transition: opacity 0.14s, transform 0.14s;
}
.chart-col:hover .chart-tip, .chart-col:focus-within .chart-tip { opacity: 1; transform: translate(-50%, 0); }
.chart-x {
  min-height: 13px;
  color: var(--muted);
  font-size: 9.5px;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
}
.chart-empty { padding: 0 18px 16px; color: var(--muted); font-size: 11.5px; }

/* ---------- Mini lists ---------- */
.mini-list { display: flex; flex-direction: column; gap: 1px; padding: 8px 9px 11px; }
.mini-row { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 10px; }
.mini-row:hover { background: var(--surface-2); }
.mini-main { flex: 1; min-width: 0; }
.mini-main strong { display: block; overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.mini-main small { display: block; overflow: hidden; color: var(--muted); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}
.badge i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-low { background: var(--amber-soft); color: var(--amber); }
.badge-out { background: var(--red-soft); color: var(--red); }

/* ---------- Top products ---------- */
.rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.rank {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}
.rank-1 { background: var(--amber-soft); color: var(--amber); }
.rank-2 { background: var(--blue-soft); color: var(--blue); }
.rank-3 { background: var(--brand-soft); color: var(--brand-text); }
.rank-info { flex: 1; min-width: 0; }
.rank-info strong { display: block; overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.rank-info small { display: block; color: var(--muted); font-size: 10.5px; }
.rank-bar { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.rank-bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.rank-val { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Payment split ---------- */
.split-row { padding: 8px 0; }
.split-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.split-top .icon { width: 15px; height: 15px; color: var(--muted); }
.split-top strong { margin-left: auto; color: var(--text); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.split-bar { height: 6px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.split-bar span { display: block; height: 100%; border-radius: 99px; transition: width 0.5s ease; }

/* ---------- Activity ---------- */
.activity-list { display: flex; flex-direction: column; padding: 7px 9px 11px; }
.card > .activity-list { padding: 7px 9px 11px; }
.activity-row { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 11px; }
.activity-row:hover { background: var(--surface-2); }
.activity-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; }
.activity-ico .icon { width: 16px; height: 16px; }
.activity-ico.sale { background: var(--green-soft); color: var(--green); }
.activity-ico.expense { background: var(--red-soft); color: var(--red); }
.activity-main { flex: 1; min-width: 0; }
.activity-main strong { display: block; overflow: hidden; font-size: 12.5px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.activity-main small { display: block; overflow: hidden; color: var(--muted); font-size: 10.8px; text-overflow: ellipsis; white-space: nowrap; }
.activity-amt { flex: none; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-amt.plus { color: var(--green); }
.activity-amt.minus { color: var(--red); }
