:root {
  --bg: #071013;
  --bg2: #0b1619;
  --panel: #0f1d21;
  --panel2: #13252a;
  --line: #1d3439;
  --fg: #e3f1ef;
  --muted: #86a3a0;
  --teal: #5eead4;
  --teal2: #2dd4bf;
  --teal-dim: #1f5f58;
  --cyan: #67e8f9;
  --amber: #f6c453;
  --red: #f87171;
  --green: #4ade80;
  --radius: 14px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--fg);
  background: radial-gradient(1200px 600px at 80% -10%, #0f2a2c 0%, transparent 60%), radial-gradient(900px 500px at -10% 10%, #0c2023 0%, transparent 55%), var(--bg);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.45;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: .01em; }
h1 { font-size: 18px; }
h2 { font-size: 16px; }
h3 { font-size: 14.5px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
b { font-weight: 600; }

/* top bar */
.topbar {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between;
  padding: 16px clamp(14px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 19, .82);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(145deg, #12363a, #0b1c1f); border: 1px solid var(--line); display: grid; place-items: center; }
.brand-mark svg { width: 24px; height: 24px; fill: none; stroke: var(--teal); stroke-width: 2.2; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
  color: var(--fg); background: var(--panel2); border: 1px solid var(--line);
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--teal-dim); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: linear-gradient(135deg, var(--teal2), #14b8a6); color: #04201d; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; }
.chip {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip.ok { color: var(--teal); border-color: var(--teal-dim); }

.banner { margin: 12px clamp(14px, 3vw, 32px) 0; padding: 10px 14px; border-radius: 10px; background: rgba(246, 196, 83, .1); border: 1px solid rgba(246, 196, 83, .35); color: #f8dc93; font-size: 13px; }
.banner-bad { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .4); color: #fecaca; }

.wrap { padding: 18px clamp(14px, 3vw, 32px) 28px; display: flex; flex-direction: column; gap: 18px; max-width: 1500px; margin: 0 auto; }
#dash { display: flex; flex-direction: column; gap: 18px; }
#dash[hidden] { display: none; }
.lede { color: var(--muted); font-size: 14px; max-width: 900px; }
.lede b { color: var(--fg); }

/* grids */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.kpis .kpi-gauge { grid-column: span 2; }
@media (max-width: 640px) { .kpis .kpi-gauge { grid-column: auto; } }
@media (min-width: 1280px) { .kpis { grid-template-columns: minmax(0, 1.75fr) repeat(5, minmax(0, 1fr)); } .kpis .kpi-gauge { grid-column: auto; } }
.cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.two-one { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .two-one, .two { grid-template-columns: minmax(0, 1fr); } }

.panel {
  background: linear-gradient(180deg, var(--panel2) 0%, var(--panel) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; min-width: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.25);
}
.panel-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.sec-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; margin-bottom: 10px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
select, input[type="search"] {
  font: inherit; font-size: 13px; color: var(--fg);
  background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; min-width: 0;
}
input[type="search"] { width: 210px; }
select:focus, input:focus, .btn:focus-visible { outline: 2px solid var(--teal-dim); outline-offset: 1px; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.kpi-gauge { flex-direction: row; align-items: center; gap: 18px; }
.label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.big { font-size: clamp(18px, 1.55vw, 24px); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.accent-teal { color: var(--teal); }
.accent-amber { color: var(--amber); }
.accent-red { color: var(--red); }

.gauge-wrap { position: relative; width: 120px; height: 120px; flex: none; }
.gauge-wrap canvas { width: 120px !important; height: 120px !important; }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.gauge-center b { font-size: 20px; font-variant-numeric: tabular-nums; }
.gauge-center span { font-size: 11px; color: var(--muted); }

/* card per KKP */
.kkp { display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.kkp::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(94,234,212,.10), transparent 70%); pointer-events: none; }
.kkp-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.kkp-name { font-size: 15px; font-weight: 650; }
.kkp-body { display: flex; gap: 14px; align-items: center; }
.kkp .gauge-wrap, .kkp .gauge-wrap canvas { width: 96px !important; height: 96px !important; }
.kkp .gauge-center b { font-size: 16px; }
.kkp-dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; font-size: 12.5px; }
.kkp-dl dt { color: var(--muted); font-size: 11.5px; }
.kkp-dl dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.pill-ok { color: var(--green); background: rgba(74, 222, 128, .12); }
.pill-warn { color: var(--amber); background: rgba(246, 196, 83, .14); }
.pill-bad { color: var(--red); background: rgba(248, 113, 113, .14); }
.pill-muted { color: var(--muted); background: rgba(134, 163, 160, .14); }

/* charts */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 300px; }
.donut-wrap { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.chart-box.donut { width: 210px; height: 210px; }
.legend { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 6px; font-size: 12.5px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.legend span:last-child { font-variant-numeric: tabular-nums; color: var(--muted); }

/* bars */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; gap: 6px; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.bar-top span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 12px; border-radius: 999px; background: #0a1a1d; border: 1px solid var(--line); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal-dim), var(--teal)); width: 0; transition: width .6s ease; }
.bar-fill.warn { background: linear-gradient(90deg, #8a6a1f, var(--amber)); }
.bar-fill.bad { background: linear-gradient(90deg, #7f2a2a, var(--red)); }

/* tables */
.table-wrap { overflow: auto; max-height: 460px; border-radius: 10px; border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: #0c1a1d; padding: 10px 12px; white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tr:hover td { background: rgba(94, 234, 212, .04); }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.tbl tr.ganti td { background: rgba(74, 222, 128, .05); }
.c-red { color: var(--red); font-weight: 650; }
.c-pakai { color: #fca5a5; }
.c-ganti { color: #86efac; }
.empty-row { padding: 12px 4px 0; }
.btn-more { margin-top: 10px; }

.notes summary { cursor: pointer; font-weight: 600; }
.notes ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.65; }

/* empty state */
.empty { display: grid; place-items: center; min-height: 60vh; }
.empty[hidden] { display: none; }
.empty-card { text-align: center; max-width: 520px; padding: 34px 28px; border: 1px dashed var(--teal-dim); border-radius: 18px; background: rgba(15, 29, 33, .7); display: grid; gap: 12px; justify-items: center; }
.empty-card svg { width: 46px; height: 46px; fill: none; stroke: var(--teal); stroke-width: 1.6; }
.empty-card p { color: var(--muted); }
.empty-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.drop-overlay { position: fixed; inset: 0; z-index: 20; background: rgba(4, 12, 14, .82); display: grid; place-items: center; }
.drop-overlay[hidden] { display: none; }
.drop-overlay div { padding: 40px 60px; border: 2px dashed var(--teal); border-radius: 20px; font-size: 18px; color: var(--teal); }

.foot { text-align: center; padding: 6px 16px 24px; }

@media print {
  .topbar .actions, .controls, .btn-more, .drop-overlay { display: none !important; }
  body { background: #fff; color: #000; }
}
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }
@media (max-width: 640px) { .topbar { position: static; } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis .kpi-gauge { grid-column: span 2; } }
