/* Chỉ số phục vụ – mọi quy tắc nằm trong .cspv để không đụng giao diện theme */
.cspv {
  --cspv-bg: #f4f6f8;
  --cspv-panel: #ffffff;
  --cspv-fg: #16202b;
  --cspv-muted: #5b6875;
  --cspv-line: #dde3e9;
  --cspv-accent: #1d5c8c;
  --cspv-accent-soft: #e3eef7;
  --cspv-good: #1f7a4d;
  --cspv-warn: #a8660b;
  --cspv-bad: #b3332b;
  --cspv-track: #e8edf2;
  --cspv-radius: 10px;
  background: var(--cspv-bg);
  color: var(--cspv-fg);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  padding: 16px;
  border-radius: 12px;
  display: grid;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  text-align: left;
}
.cspv *, .cspv *::before, .cspv *::after { box-sizing: border-box; }
.cspv [hidden] { display: none !important; }
.cspv h2, .cspv h3, .cspv p { margin: 0; padding: 0; border: 0; text-transform: none; letter-spacing: normal; }
.cspv .cspv-num { font-variant-numeric: tabular-nums; }
.cspv .cspv-title { font-size: 22px; font-weight: 700; line-height: 1.25; color: var(--cspv-fg); }
.cspv h3 { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--cspv-fg); }
.cspv .cspv-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--cspv-muted); font-weight: 600; }
.cspv .cspv-muted { color: var(--cspv-muted); }

.cspv .cspv-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-bottom: 12px; border-bottom: 1px solid var(--cspv-line); }
.cspv .cspv-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--cspv-muted); margin-right: auto; min-width: 0; }
.cspv .cspv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cspv-muted); flex: none; }
.cspv .cspv-dot.ok { background: var(--cspv-good); }
.cspv .cspv-dot.loading { background: var(--cspv-warn); animation: cspv-pulse 1s infinite alternate; }
.cspv .cspv-dot.error { background: var(--cspv-bad); }
@keyframes cspv-pulse { from { opacity: 1 } to { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .cspv .cspv-dot.loading { animation: none; } }
.cspv .cspv-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cspv select, .cspv input[type="search"], .cspv button {
  font: inherit; font-size: 13px; line-height: 1.2; color: var(--cspv-fg); background: var(--cspv-panel);
  border: 1px solid var(--cspv-line); border-radius: 8px; padding: 6px 10px; min-height: 34px; width: auto; max-width: 100%;
  margin: 0; box-shadow: none; text-transform: none; letter-spacing: normal;
}
.cspv select { padding-right: 28px; }
.cspv button { cursor: pointer; font-weight: 600; }
.cspv button.cspv-primary { background: var(--cspv-accent); border-color: var(--cspv-accent); color: #fff; }
.cspv select:focus-visible, .cspv input:focus-visible, .cspv button:focus-visible, .cspv tr:focus-visible { outline: 2px solid var(--cspv-accent); outline-offset: 2px; }
.cspv .cspv-ctl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--cspv-muted); margin: 0; font-weight: 400; }

.cspv .cspv-head { display: grid; gap: 6px; }
.cspv .cspv-lead { font-size: 15px; max-width: 75ch; }
.cspv .cspv-lead b { font-weight: 600; }
.cspv .cspv-alert { border: 1px solid var(--cspv-bad); color: var(--cspv-bad); background: var(--cspv-panel); border-radius: var(--cspv-radius); padding: 12px 14px; }

.cspv .cspv-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cspv .cspv-tile { background: var(--cspv-panel); border: 1px solid var(--cspv-line); border-radius: var(--cspv-radius); padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.cspv .cspv-big { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.cspv .cspv-big small { font-size: 15px; font-weight: 500; color: var(--cspv-muted); }
.cspv .cspv-sub { font-size: 12.5px; color: var(--cspv-muted); }
.cspv .chg-up { color: var(--cspv-good); font-weight: 600; }
.cspv .chg-down { color: var(--cspv-bad); font-weight: 600; }
.cspv .chg-flat { color: var(--cspv-muted); font-weight: 600; }

.cspv .cspv-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.cspv .cspv-card { background: var(--cspv-panel); border: 1px solid var(--cspv-line); border-radius: var(--cspv-radius); padding: 16px 18px; display: grid; gap: 12px; align-content: start; min-width: 0; position: relative; }
.cspv .cspv-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cspv .cspv-note { font-size: 12px; color: var(--cspv-muted); }

.cspv .cspv-groups { display: grid; gap: 14px; }
.cspv .cspv-grp { display: grid; gap: 5px; }
.cspv .cspv-grp-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.cspv .cspv-grp-name { font-weight: 500; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cspv .cspv-bar { height: 10px; background: var(--cspv-track); border-radius: 5px; overflow: hidden; }
.cspv .cspv-bar > i { display: block; height: 100%; background: var(--cspv-accent); border-radius: 5px; }
.cspv .cspv-bar > i.low { background: var(--cspv-warn); }
.cspv .cspv-pill { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #fbefdc; color: var(--cspv-warn); }
.cspv .cspv-lost { font-size: 12px; color: var(--cspv-muted); }

.cspv .cspv-chart { width: 100%; min-height: 220px; }
.cspv .cspv-chart svg { display: block; width: 100%; height: auto; overflow: visible; max-width: none; }
.cspv .cspv-chart text { fill: var(--cspv-muted); font-size: 11px; font-family: inherit; }
.cspv .cspv-chart .val { fill: var(--cspv-fg); font-weight: 600; }
.cspv .cspv-tip {
  position: absolute; pointer-events: none; background: var(--cspv-panel); border: 1px solid var(--cspv-line);
  box-shadow: 0 6px 20px rgb(0 0 0 / .14); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; z-index: 3;
}

.cspv .cspv-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cspv .cspv-stat { display: grid; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--cspv-bg); }
.cspv .cspv-stat b { font-size: 20px; }
.cspv .cspv-stat span { font-size: 12px; color: var(--cspv-muted); }
.cspv .cspv-split { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--cspv-track); }
.cspv .cspv-split i { display: block; height: 100%; }

.cspv .cspv-table-wrap { overflow: auto; max-height: 560px; border: 1px solid var(--cspv-line); border-radius: 8px; margin: 0; }
.cspv table.cspv-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0; border: 0; background: transparent; table-layout: auto; }
.cspv .cspv-table th, .cspv .cspv-table td { padding: 8px 10px; text-align: left; border: 0; border-bottom: 1px solid var(--cspv-line); white-space: nowrap; background: transparent; vertical-align: middle; }
.cspv .cspv-table th { position: sticky; top: 0; background: var(--cspv-panel); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--cspv-muted); font-weight: 600; z-index: 1; }
.cspv .cspv-table .cspv-r { text-align: right; }
.cspv .cspv-table tbody tr { cursor: pointer; }
.cspv .cspv-table tbody tr:hover td { background: var(--cspv-accent-soft); }
.cspv .cspv-table tr.me td { background: var(--cspv-accent-soft); font-weight: 600; }
.cspv .cspv-table tr.me td:first-child { box-shadow: inset 3px 0 0 var(--cspv-accent); }
.cspv .cspv-mini { display: inline-block; width: 90px; height: 6px; background: var(--cspv-track); border-radius: 3px; vertical-align: middle; overflow: hidden; }
.cspv .cspv-mini i { display: block; height: 100%; background: var(--cspv-accent); }
.cspv .cspv-empty { padding: 18px; text-align: center; color: var(--cspv-muted); }

@media (max-width: 900px) {
  .cspv .cspv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cspv .cspv-grid2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 460px) {
  .cspv { padding: 12px; }
  .cspv .cspv-big { font-size: 24px; }
  .cspv .cspv-stats { grid-template-columns: minmax(0, 1fr); }
}
