/* Super User Dashboard (Fase 12) */
:root { --chart-bar: #2a63b8; --chart-hover: #163e72; --heat: 42, 99, 184; }
@media (prefers-color-scheme: dark) { :root { --chart-bar: #86a8ee; --chart-hover: #c3d4f7; --heat: 134, 168, 238; } }

.adm-head { display: flex; gap: var(--sp-4); align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.adm-controls { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.btn-sm { padding: 8px 14px; font-size: var(--fs-sm); min-height: 38px; }
.seg { display: inline-flex; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 3px; background: rgba(255,255,255,.08); }
.seg button { border: 0; background: transparent; color: var(--header-fg); font: inherit; font-size: var(--fs-sm); font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; min-height: 32px; }
.seg button[aria-pressed="true"] { background: var(--header-fg); color: var(--header-bg); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.adm-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: var(--sp-3) 0 var(--sp-5); scrollbar-width: none; }
.adm-tabs a { padding: 10px 14px; white-space: nowrap; color: var(--muted); font-weight: 600; font-size: var(--fs-sm); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.adm-tabs a:hover { color: var(--fg); }
.adm-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.kpis:has(> .kpi:nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .kpis, .kpis:has(> .kpi:nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi-label { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-sub { font-size: var(--fs-xs); color: var(--muted); }
.delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); } .delta.flat { color: var(--muted); }

.adm-alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--radius); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; color: var(--fg); border: 1px solid var(--line); background: var(--surface); margin: 0; }
.alert-warn { background: var(--warn-soft); border-color: transparent; }
.alert-bad { background: var(--bad-soft); border-color: transparent; }
.alert-info { background: var(--info-soft); border-color: transparent; }
.alert-ok { background: var(--ok-soft); border-color: transparent; }

.adm-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 860px) { .adm-grid2 { grid-template-columns: 1fr; } }
.adm-grid2 > .panel, .adm-tab > .panel { min-width: 0; }

/* grafik batang */
.chart-fig { margin: 0; }
.chart { min-height: 180px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--chart-bar); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit.on { fill: var(--fg); fill-opacity: .06; }
.chart-table { margin-top: 6px; }
.chart-table summary { cursor: pointer; font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }
.chart-table .table-wrap { max-height: 260px; overflow: auto; margin-top: 6px; }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--fg); color: var(--surface); padding: 6px 10px; border-radius: 6px; font-size: var(--fs-xs); line-height: 1.4; box-shadow: var(--shadow); max-width: 240px; }

/* batang horizontal (corong, paket, topik) */
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hbars li { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; grid-template-areas: "label val" "track track"; gap: 4px 10px; align-items: baseline; }
.hb-label { grid-area: label; font-size: var(--fs-sm); font-weight: 600; overflow-wrap: anywhere; }
.hb-val { grid-area: val; font-size: var(--fs-xs); color: var(--fg); text-align: right; font-variant-numeric: tabular-nums; }
.hb-track { grid-area: track; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.hb-fill { display: block; height: 100%; background: var(--chart-bar); border-radius: 999px; }
.hb-fill.low { background: var(--warn); }

/* tabel */
.adm-table { min-width: 0; font-size: var(--fs-sm); }
.adm-table th, .adm-table td { padding: 9px 12px; }
.adm-table td.num, .adm-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.adm-table td { white-space: nowrap; }
.adm-table td .chip { white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.cohort td.heat { background: rgba(var(--heat), calc(var(--h) * .55)); }
.ok-t { color: var(--ok); font-weight: 700; } .bad-t { color: var(--bad); font-weight: 700; }

.trx-filter { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--sp-3); }
.trx-filter .field { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.trx-filter .input { min-width: 150px; }

.kv2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 20px; margin: 0 0 var(--sp-4); }
.kv2 dt { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kv2 dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.adm-h3 { font-size: var(--fs-md); margin: var(--sp-4) 0 var(--sp-2); }

.health { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); max-height: 460px; overflow: auto; }
.health li { padding: 6px 10px; border-radius: 6px; overflow-wrap: anywhere; }
.health li.warn { background: var(--warn-soft); font-weight: 600; }
.health li.note { color: var(--muted); }
.err-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: var(--fs-sm); }
.err-list li { display: flex; gap: 8px; overflow-wrap: anywhere; }
.err-list b { color: var(--bad); font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .kpi-value { font-size: 1.2rem; }
  .hbars li { grid-template-columns: 1fr; grid-template-areas: "label" "track" "val"; }
  .hb-val { text-align: left; }
}

/* Fase 14.4: tab Live GA */
.ga-head { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; justify-content: space-between; }
.ga-head > div:first-child { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ga-dot { width: 10px; height: 10px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22,163,74,.6); animation: gaPulse 1.6s infinite; }
.ga-dot.off { background: var(--muted); animation: none; }
@keyframes gaPulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.55); } 70% { box-shadow: 0 0 0 10px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
@media (prefers-reduced-motion: reduce) { .ga-dot { animation: none; } }
.ga-sub { font-size: var(--fs-lg, 1.15rem); margin: var(--sp-3) 0 0; }
.kpi.ga-big .kpi-value { color: #16a34a; }

/* Affiliate (Fase 15) */
.tab-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 800; }
.f-cards { display: flex; flex-direction: column; gap: 10px; }
.f-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 10px 18px; align-items: center; background: var(--surface); }
.f-card.urgent { border-left: 4px solid var(--warn); }
.f-card h3 { margin: 0; font-size: var(--fs-md); }
.f-card .muted { font-size: var(--fs-xs); }
.f-acct { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-sm); }
.f-acct .mono { font-size: var(--fs-md); font-weight: 700; letter-spacing: .03em; }
.f-amt b { font-size: var(--fs-lg); color: var(--ok); font-variant-numeric: tabular-nums; }
.f-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.f-copy { border: 0; background: var(--surface-2); color: var(--primary); font: inherit; font-size: var(--fs-xs); font-weight: 700; padding: 3px 8px; border-radius: 6px; cursor: pointer; margin-left: 6px; }
@media (max-width: 760px) { .f-card { grid-template-columns: 1fr; } .f-actions { justify-content: flex-start; } }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-link { border: 0; background: none; color: var(--primary); font: inherit; font-size: var(--fs-xs); font-weight: 700; cursor: pointer; padding: 2px 4px; text-decoration: underline; }
.adm-table td.wrap { white-space: normal; min-width: 180px; }
.adm-dialog { border: 0; border-radius: var(--radius-lg); padding: var(--sp-5); width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.adm-dialog::backdrop { background: rgba(10, 20, 40, .55); }
.adm-dialog h2 { margin: 0; font-size: var(--fs-lg); }
.adm-dialog .field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); font-weight: 600; }
