*{box-sizing:border-box}
body{
  font-family:"IBM Plex Sans","SF Pro Text",-apple-system,BlinkMacSystemFont,sans-serif;
  background:var(--bg);
  color:var(--text);
  margin:0;
  padding:0;
  line-height:1.5;
}
.page-content{max-width:1080px}
.sa-hero{margin-bottom:1.75rem}
.sa-hero h1{
  font-family:"IBM Plex Mono","SF Mono",ui-monospace,Menlo,monospace;
  font-size:clamp(1.6rem,3vw,2.1rem);
  font-weight:600;
  letter-spacing:-.03em;
  margin:0 0 .35rem;
}
.sa-sub{
  color:var(--muted);
  font-size:.88rem;
  display:flex;
  flex-wrap:wrap;
  gap:.5rem .85rem;
  align-items:center;
}
.sa-sub .dot{opacity:.45}
.sa-live-pill{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  font-size:.75rem;
  font-weight:600;
  color:#16a34a;
}
.sa-live-pill i{
  width:7px;height:7px;border-radius:50%;background:#22c55e;
  display:inline-block;animation:saPulse 1.5s infinite;
}
@keyframes saPulse{0%,100%{opacity:1}50%{opacity:.25}}

.sa-tabs{
  display:flex;
  gap:.25rem;
  border-bottom:1px solid var(--border);
  margin-bottom:1.5rem;
  overflow-x:auto;
}
.sa-tab{
  appearance:none;
  background:none;
  border:0;
  border-bottom:2px solid transparent;
  color:var(--muted);
  font:inherit;
  font-size:.9rem;
  font-weight:500;
  padding:.7rem 1rem;
  cursor:pointer;
  text-decoration:none;
  white-space:nowrap;
  margin-bottom:-1px;
}
.sa-tab:hover{color:var(--text)}
.sa-tab.active{
  color:var(--text);
  border-bottom-color:var(--text);
  font-weight:650;
}

.sa-toolbar{
  display:flex;
  align-items:center;
  gap:.4rem;
  flex-wrap:wrap;
  margin-bottom:1.25rem;
}
.btn-s{
  background:transparent;
  color:var(--muted);
  border:1px solid var(--border);
  cursor:pointer;
  padding:.35rem .7rem;
  font-size:.78rem;
  border-radius:999px;
  font-family:inherit;
}
.btn-s:hover{color:var(--text);border-color:var(--border-hover)}
.btn-s.active{
  background:var(--text);
  color:var(--bg);
  border-color:var(--text);
}
.empty{text-align:center;padding:2.5rem;color:var(--muted)}

/* CIVCI-style KPI grid */
.kpi-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:1px;
  background:var(--border);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  margin-bottom:1.25rem;
}
@media(max-width:900px){.kpi-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:480px){.kpi-grid{grid-template-columns:1fr}}
.kpi{
  background:var(--surface);
  padding:1.15rem 1.2rem 1.25rem;
  min-height:110px;
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
  gap:.15rem;
}
.kpi-val{
  font-family:"IBM Plex Mono","SF Mono",ui-monospace,Menlo,monospace;
  font-size:clamp(1.55rem,2.6vw,2rem);
  font-weight:650;
  letter-spacing:-.03em;
  line-height:1.1;
  font-variant-numeric:tabular-nums;
}
.kpi-lbl{
  font-size:.78rem;
  font-weight:600;
  color:var(--text);
}
.kpi-hint{
  font-size:.72rem;
  color:var(--muted);
}
.kpi-delta{font-size:.72rem;font-weight:650}
.kpi-delta.up{color:#16a34a}
.kpi-delta.down{color:#dc2626}

.sa-block{
  border:1px solid var(--border);
  border-radius:14px;
  background:var(--surface);
  padding:1.15rem 1.25rem 1.25rem;
  margin-bottom:1rem;
}
.sa-block-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:1rem;
  margin-bottom:.85rem;
  flex-wrap:wrap;
}
.sa-block-title{
  font-size:.95rem;
  font-weight:650;
  margin:0;
}
.sa-block-meta{font-size:.75rem;color:var(--muted)}

.sa-split{
  display:grid;
  grid-template-columns:1.2fr .8fr;
  gap:1rem;
  margin-bottom:1rem;
}
@media(max-width:860px){.sa-split{grid-template-columns:1fr}}

.chart-canvas{
  width:100%;
  height:220px;
  display:block;
  border-radius:8px;
}
.chart-canvas.sm{height:170px}

.rank-list{display:flex;flex-direction:column;gap:.55rem}
.rank-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:.5rem .75rem;
  align-items:center;
  font-size:.82rem;
}
.rank-main{display:flex;align-items:center;gap:.5rem;min-width:0}
.rank-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:500;
}
.rank-bar{
  grid-column:1 / -1;
  height:6px;
  background:var(--bg);
  border-radius:99px;
  overflow:hidden;
}
.rank-fill{
  height:100%;
  background:var(--text);
  opacity:.75;
  border-radius:99px;
}
.rank-val{
  font-family:"IBM Plex Mono",ui-monospace,Menlo,monospace;
  font-size:.78rem;
  font-variant-numeric:tabular-nums;
  color:var(--muted);
  white-space:nowrap;
}
.rank-flag{font-size:1rem;line-height:1}

.chip-row{display:flex;flex-wrap:wrap;gap:.45rem}
.chip{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  border:1px solid var(--border);
  border-radius:999px;
  padding:.28rem .65rem;
  font-size:.76rem;
  background:var(--bg);
}
.chip strong{
  font-family:"IBM Plex Mono",ui-monospace,Menlo,monospace;
  font-weight:650;
  font-variant-numeric:tabular-nums;
}

/* Live feed — CIVCI style */
.live-feed{display:flex;flex-direction:column;gap:.15rem}
.live-item{
  display:grid;
  grid-template-columns:auto 1fr auto;
  gap:.65rem;
  align-items:baseline;
  padding:.55rem 0;
  border-bottom:1px solid var(--border);
  font-size:.86rem;
}
.live-item:last-child{border-bottom:0}
.live-flag{font-size:1.05rem;line-height:1}
.live-text{color:var(--text)}
.live-text em{font-style:normal;color:var(--muted)}
.live-text strong{
  font-family:"IBM Plex Mono",ui-monospace,Menlo,monospace;
  font-weight:650;
  font-variant-numeric:tabular-nums;
}
.live-ago{
  color:var(--muted);
  font-size:.74rem;
  white-space:nowrap;
  font-variant-numeric:tabular-nums;
}

.mini-stats{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:1px;
  background:var(--border);
  border:1px solid var(--border);
  border-radius:12px;
  overflow:hidden;
  margin-bottom:1rem;
}
@media(max-width:700px){.mini-stats{grid-template-columns:repeat(2,1fr)}}
.mini-stat{
  background:var(--surface);
  padding:.85rem 1rem;
}
.mini-stat .v{
  font-family:"IBM Plex Mono",ui-monospace,Menlo,monospace;
  font-size:1.2rem;
  font-weight:650;
  letter-spacing:-.02em;
  font-variant-numeric:tabular-nums;
}
.mini-stat .l{font-size:.72rem;color:var(--muted);margin-top:.1rem}

table{width:100%;border-collapse:collapse;font-size:.82rem}
th{
  text-align:left;
  font-size:.68rem;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:var(--muted);
  padding:.55rem .4rem;
  border-bottom:1px solid var(--border);
}
td{padding:.55rem .4rem;border-bottom:1px solid var(--border)}
tr:last-child td{border-bottom:none}

.badge{
  display:inline-block;
  padding:.1rem .45rem;
  border-radius:99px;
  font-size:.68rem;
  font-weight:650;
}
.badge--fulfilled,.badge--paid{background:rgba(34,197,94,.12);color:#16a34a}
.badge--unfulfilled,.badge--pending{background:rgba(245,158,11,.12);color:#d97706}
.badge--partial,.badge--partially_refunded{background:rgba(59,130,246,.12);color:#2563eb}
.badge--refunded{background:rgba(239,68,68,.12);color:#dc2626}

.sa-footnote{
  margin-top:.5rem;
  font-size:.72rem;
  color:var(--muted);
}
