/* ═══════════════════════════════════════════════════════════════════
   KSP-EIS — DESIGN SYSTEM (vanilla port)
   Dark default; light via html[data-theme="light"]
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --accent: #6366f1;
  --accent-2: #4338ca;
  --accent-fg: #ffffff;
  --status-ok: #3fb37f;
  --status-warn: #e8c95a;
  --status-bad: #e8785f;
  --status-crit: #e14c4c;
  --status-info: #4c8de1;
  --neutral-950: #05070d;

  --bg: #0b1120;
  --panel: #111827;
  --panel-2: #1a2233;
  --line: #2c3549;
  --line-2: #232c40;
  --txt: #e5e9f2;
  --mut: #9aa5bc;
  --dim: #66718c;
  --shadow-panel: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-modal: 0 18px 60px rgba(0,0,0,0.55);
}
html[data-theme="light"] {
  --bg: #f1f3f8;
  --panel: #ffffff;
  --panel-2: #f4f6fb;
  --line: #d4dae6;
  --line-2: #e2e7f0;
  --txt: #17203a;
  --mut: #4d5872;
  --dim: #8b94ab;
  --shadow-panel: 0 1px 3px rgba(20,30,60,0.08);
  --shadow-modal: 0 18px 60px rgba(20,30,60,0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* Skala tipografi */
.text-heading    { font-size: 18px; font-weight: 700; }
.text-subheading { font-size: 15px; font-weight: 700; }
.text-body-strong{ font-size: 13px; font-weight: 600; }
.text-body       { font-size: 13px; }
.text-caption    { font-size: 11.5px; }
.text-label      { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.text-mut { color: var(--mut); }
.text-dim { color: var(--dim); }
.text-txt { color: var(--txt); }
.text-ok   { color: var(--status-ok); }
.text-warn { color: var(--status-warn); }
.text-bad  { color: var(--status-bad); }
.text-crit { color: var(--status-crit); }
.text-info { color: var(--status-info); }

/* ═══ APP LAYOUT ═══ */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.main-col { display: flex; min-width: 0; flex: 1; flex-direction: column; overflow: hidden; padding: 0 20px; }
.page-scroll { min-height: 0; flex: 1; overflow-y: auto; padding-bottom: 16px; }
.page-view { display: none; }
.page-view.active { display: block; }

/* ═══ SIDEBAR ═══ */
.sidebar {
  display: flex; height: 100vh; width: 250px; flex-shrink: 0; flex-direction: column;
  border-right: 1px solid var(--line-2); background: var(--panel);
  transition: width 0.25s ease;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 16px 14px 12px; position: relative; }
.logo-text { min-width: 0; flex: 1; }
.sidebar-toggle {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--mut);
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-toggle:hover { border-color: var(--accent); color: var(--txt); }
.sidebar-toggle svg.lucide { width: 15px; height: 15px; }

/* ── Mode sidebar tersembunyi (hanya ikon) ── */
.app-shell.sidebar-collapsed .sidebar { width: 64px; }
.app-shell.sidebar-collapsed .sidebar-logo { flex-direction: column; gap: 8px; padding: 14px 10px 10px; }
.app-shell.sidebar-collapsed .logo-text,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-count,
.app-shell.sidebar-collapsed .sidebar-footer > div:last-child { display: none; }
.app-shell.sidebar-collapsed .nav-group-label {
  font-size: 0; padding: 6px 0; margin: 4px 8px 2px;
  border-top: 1px solid var(--line-2);
}
.app-shell.sidebar-collapsed .nav-item { justify-content: center; padding: 9px 0; }
.app-shell.sidebar-collapsed .nav-item .nav-icon { width: auto; }
.app-shell.sidebar-collapsed .sidebar-nav { padding: 4px 8px 10px; }
.app-shell.sidebar-collapsed .sidebar-footer { justify-content: center; padding: 12px 8px; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.logo-title { font-size: 14px; font-weight: 800; letter-spacing: 0.02em; }
.logo-sub { font-size: 10.5px; color: var(--dim); margin-top: 1px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.nav-group-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); padding: 12px 8px 5px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: none; background: transparent; border-radius: 8px;
  padding: 7px 10px; margin-bottom: 2px; font-size: 12.5px; font-weight: 600; color: var(--mut);
}
.nav-item:hover { background: var(--panel-2); color: var(--txt); }
.nav-item.active { background: var(--accent); color: var(--accent-fg); }
.nav-item .nav-icon { width: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.nav-item svg.lucide, .nav-item .lucide-i { width: 16px; height: 16px; flex-shrink: 0; }
.shrink-0 { flex-shrink: 0; }
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 6px;
  background: rgba(0,0,0,0.25); color: inherit;
}
.nav-item.active .nav-count { background: rgba(255,255,255,0.2); }
.sidebar-footer { border-top: 1px solid var(--line-2); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 999px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.user-name { font-size: 12px; font-weight: 700; }
.user-role { font-size: 10.5px; color: var(--dim); }

/* ═══ TOPBAR ═══ */
.topbar {
  margin: 12px 0 10px; flex-shrink: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 10px; background: var(--panel); padding: 10px 14px;
  box-shadow: var(--shadow-panel);
}
.topbar h1 { font-size: 14.5px; font-weight: 700; }
.topbar .subtitle { font-size: 11.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 520px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.clock { font-size: 11.5px; color: var(--mut); }
.clock b { color: var(--txt); }
.icon-btn {
  width: 32px; height: 32px; border-radius: 7px; position: relative;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--txt); font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg.lucide { width: 16px; height: 16px; }
.icon-btn:hover { border-color: var(--accent); }
.notif-dot {
  position: absolute; top: -4px; right: -4px; width: 10px; height: 10px;
  border-radius: 999px; background: var(--status-crit); display: none;
}
.notif-wrap { position: relative; }
.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  max-height: 384px; width: 320px; overflow-y: auto;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel);
  box-shadow: var(--shadow-modal);
}
.notif-dropdown.hidden { display: none; }
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line-2);
  font-size: 12px; font-weight: 700;
}
.notif-header button { border: none; background: none; color: var(--accent); font-size: 11px; font-weight: 600; }
.notif-item { padding: 9px 12px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.notif-item:last-child { border-bottom: none; }
.notif-item.read { opacity: 0.6; }
.notif-item .msg { font-size: 12px; color: var(--txt); }
.notif-item .time { font-size: 10.5px; color: var(--dim); margin-top: 2px; }
.notif-empty { padding: 18px; text-align: center; font-size: 12px; color: var(--dim); }

/* ═══ BADGES & PILLS ═══ */
.badge {
  display: inline-block; border-radius: 999px; padding: 2px 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
}
.badge.band-ok   { background: color-mix(in srgb, var(--status-ok) 16%, transparent);   color: var(--status-ok);   border: 1px solid color-mix(in srgb, var(--status-ok) 40%, transparent); }
.badge.band-warn { background: color-mix(in srgb, var(--status-warn) 16%, transparent); color: var(--status-warn); border: 1px solid color-mix(in srgb, var(--status-warn) 40%, transparent); }
.badge.band-bad  { background: color-mix(in srgb, var(--status-bad) 16%, transparent);  color: var(--status-bad);  border: 1px solid color-mix(in srgb, var(--status-bad) 40%, transparent); }
.badge.band-crit { background: color-mix(in srgb, var(--status-crit) 16%, transparent); color: var(--status-crit); border: 1px solid color-mix(in srgb, var(--status-crit) 40%, transparent); animation: pulse 2s infinite; }
.badge.band-info { background: color-mix(in srgb, var(--status-info) 16%, transparent); color: var(--status-info); border: 1px solid color-mix(in srgb, var(--status-info) 40%, transparent); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.pct-pill {
  display: inline-block; min-width: 52px; border-radius: 999px; padding: 2px 8px;
  text-align: center; font-size: 11px; font-weight: 800;
}

/* ═══ CARDS / PANELS ═══ */
.card {
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel);
  padding: 16px; box-shadow: var(--shadow-panel);
}
.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 12px; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--mut);
}
.card-title .actions { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; }
.sub-panel { border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 12px 14px; }

/* ═══ STAT TILES ═══ */
.stat-grid { display: grid; gap: 10px; margin-bottom: 10px; }
.stat-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.stat-tile {
  display: flex; align-items: center; gap: 10px;
  border-radius: 10px; border: 1px solid var(--line-2); border-top-width: 2px;
  background: var(--panel); padding: 9px 12px; box-shadow: var(--shadow-panel);
  min-width: 0;
}
.stat-tile.accent-ok   { border-top-color: var(--status-ok); }
.stat-tile.accent-warn { border-top-color: var(--status-warn); }
.stat-tile.accent-bad  { border-top-color: var(--status-bad); }
.stat-tile.accent-crit { border-top-color: var(--status-crit); }
.stat-tile.accent-info { border-top-color: var(--status-info); }
.stat-icon {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.band-ok   { color: var(--status-ok);   background: color-mix(in srgb, var(--status-ok) 16%, transparent); }
.stat-icon.band-warn { color: var(--status-warn); background: color-mix(in srgb, var(--status-warn) 16%, transparent); }
.stat-icon.band-bad  { color: var(--status-bad);  background: color-mix(in srgb, var(--status-bad) 16%, transparent); }
.stat-icon.band-crit { color: var(--status-crit); background: color-mix(in srgb, var(--status-crit) 16%, transparent); }
.stat-icon.band-info { color: var(--status-info); background: color-mix(in srgb, var(--status-info) 16%, transparent); }
.stat-body { min-width: 0; }
.stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 16px; font-weight: 800; line-height: 1.2; }
.stat-sub { font-size: 10.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 8px; padding: 6px 13px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.btn-accent { background: var(--accent); color: var(--accent-fg); }
.btn-accent:hover { filter: brightness(1.1); }
.btn-outline { background: var(--panel-2); color: var(--txt); border-color: var(--line); }
.btn-outline:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--mut); border-color: var(--line-2); }
.btn-ghost:hover { color: var(--txt); border-color: var(--accent); }
.btn-xs { padding: 3px 9px; font-size: 11px; border-radius: 6px; }
.btn-ok-outline   { background: transparent; color: var(--status-ok);  border-color: var(--line-2); }
.btn-ok-outline:hover { border-color: var(--status-ok); }
.btn-bad-outline  { background: transparent; color: var(--status-bad); border-color: var(--line-2); }
.btn-bad-outline:hover { border-color: var(--status-bad); }
.seg-toggle { display: inline-flex; gap: 4px; }
.seg-btn {
  border-radius: 7px; border: 1px solid var(--line-2); background: transparent;
  color: var(--mut); font-size: 11.5px; font-weight: 600; padding: 4px 11px;
}
.seg-btn.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* ═══ FORMS ═══ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--mut); }
.form-field .req { color: var(--status-crit); }
.form-input, .form-select, .form-textarea {
  width: 100%; border-radius: 7px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--txt); font-size: 12.5px; padding: 7px 10px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent); }
.form-textarea { resize: vertical; }
.inline-form {
  margin-bottom: 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); padding: 16px;
}
.inline-form h4 { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.check-list {
  max-height: 128px; overflow-y: auto; border: 1px solid var(--line-2);
  border-radius: 7px; background: var(--panel-2); padding: 6px 10px;
}
.check-list label { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 12px; color: var(--txt); cursor: pointer; }

/* ═══ TABLES ═══ */
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--dim); padding: 8px 10px; border-bottom: 1px solid var(--line-2);
}
.data-table th.num, .data-table td.num { text-align: right; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); color: var(--txt); }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover { background: var(--panel-2); }

/* ═══ DASHBOARD ═══ */
.dash-layout { display: grid; grid-template-columns: 7fr 3fr; gap: 10px; height: calc(100vh - 158px); min-height: 420px; }
.map-wrap {
  position: relative; overflow: hidden; border-radius: 10px;
  border: 1px solid var(--line-2); isolation: isolate;
}
#leaflet-map { position: absolute; inset: 0; z-index: 0; background: var(--panel-2); }
.tiles-dark { filter: invert(1) hue-rotate(180deg) brightness(0.8) contrast(0.9) saturate(0.5); }
.leaflet-control-attribution { font-size: 9px !important; background: color-mix(in srgb, var(--panel) 80%, transparent) !important; color: var(--dim) !important; }
.leaflet-control-attribution a { color: var(--mut) !important; }
.map-overlay-tl { position: absolute; top: 12px; left: 12px; z-index: 500; display: flex; gap: 6px; }
.map-chip {
  border-radius: 7px; border: 1px solid var(--line-2); font-size: 11.5px; font-weight: 600;
  padding: 5px 11px; color: var(--txt);
  background: color-mix(in srgb, var(--panel) 95%, transparent); backdrop-filter: blur(4px);
}
.map-chip:hover { border-color: var(--accent); }
.map-chip.danger-active { background: var(--status-crit); color: #fff; border-color: var(--status-crit); }
.map-legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 500;
  border-radius: 9px; border: 1px solid var(--line-2); padding: 9px 12px;
  background: color-mix(in srgb, var(--panel) 95%, transparent); backdrop-filter: blur(4px);
  font-size: 11px; color: var(--mut);
}
.map-legend .legend-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); margin-bottom: 5px; }
.legend-row { display: flex; align-items: center; gap: 7px; padding: 1.5px 0; }
.legend-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }
.dash-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.dash-side .card.grow { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; }
.dash-side .scroll-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.prog-row { padding: 5px 0; }
.prog-row .head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 4px; }
.prog-track { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.prog-fill { height: 100%; border-radius: 999px; }
.prog-detail { font-size: 10px; color: var(--dim); margin-top: 3px; }
.issue-row {
  display: block; width: 100%; text-align: left; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel-2); padding: 8px 10px;
}
.issue-row:hover { border-color: var(--accent); }
.issue-row .top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 3px; }
.issue-row .title { font-size: 12.5px; font-weight: 600; color: var(--txt); }
.issue-row .loc { font-size: 11px; color: var(--dim); margin-top: 3px; }

/* ═══ PROGRAMS ═══ */
.program-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.program-card { display: flex; flex-direction: column; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 14px; }
.program-card h4 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.program-card .tagline { font-size: 11.5px; color: var(--mut); flex: 1; margin-bottom: 12px; }
.program-card .stats { display: flex; gap: 24px; margin-bottom: 12px; }
.program-card .num { font-size: 20px; font-weight: 800; }
.program-card .num-label { font-size: 10.5px; color: var(--dim); }

/* ═══ ISSUES / KANBAN ═══ */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kanban-col { border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 10px; }
.kanban-col .col-head { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; font-weight: 700; color: var(--mut); padding: 2px 4px 8px; }
.kanban-card {
  cursor: pointer; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel); padding: 9px 11px; margin-bottom: 8px;
}
.kanban-card:hover { border-color: var(--accent); }
.kanban-card .title { font-size: 12.5px; font-weight: 600; }
.kanban-card .inst { font-size: 11px; color: var(--dim); margin: 3px 0 6px; }
.kanban-card .foot { display: flex; justify-content: space-between; align-items: center; }
.kanban-card .score { font-size: 11.5px; font-weight: 700; color: var(--mut); }

/* ═══ LIST ROWS (survey/eskalasi/rce) ═══ */
.list-row { border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 12px 14px; margin-bottom: 9px; }
.list-row .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.list-row .body-text { font-size: 12.5px; color: var(--mut); line-height: 1.55; }
.list-row .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; color: var(--dim); margin-top: 8px; }
.link-inst { border: none; background: none; padding: 0; font-size: 13px; font-weight: 700; color: var(--txt); }
.link-inst:hover { color: var(--accent); }
.chip-level {
  display: inline-block; border-radius: 6px; border: 1px solid var(--line);
  font-size: 11px; font-weight: 800; padding: 2px 8px; color: var(--txt);
}
.source-ref { font-size: 10.5px; color: var(--dim); }

/* ═══ INTEGRATION ═══ */
.integration-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.source-card { border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 13px 15px; }
.source-card .name { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.source-card .row { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--mut); padding: 3px 0; }

/* ═══ BVE (drill-down anggaran) ═══ */
.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.crumb {
  border-radius: 7px; border: 1px solid var(--line-2); background: transparent;
  font-size: 11.5px; font-weight: 600; padding: 4px 11px; color: var(--mut);
}
.crumb:hover { border-color: var(--accent); color: var(--txt); }
.crumb.current { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); cursor: default; }
.crumb-sep { color: var(--dim); font-size: 12px; }
.tree-node {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2);
  padding: 8px 12px; margin-bottom: 6px;
}
.tree-node.problem {
  border-color: var(--status-crit);
  background: color-mix(in srgb, var(--status-crit) 8%, var(--panel-2));
}
.tree-node .left { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.tree-node .label { font-size: 12.5px; font-weight: 600; }
.level-pill {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  border-radius: 999px; border: 1px solid var(--line); color: var(--dim); padding: 1px 7px;
}
.tree-node .right { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--mut); white-space: nowrap; }

/* ═══ IIE / EWS (dua kolom master–detail) ═══ */
.split-2col { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; align-items: start; }
.rank-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  width: 100%; text-align: left; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel-2); padding: 8px 11px; margin-bottom: 6px;
}
.rank-row:hover { border-color: var(--accent); }
.rank-row.selected { border-color: var(--accent); background: var(--panel); }
.rank-row .primary { min-width: 0; flex: 1; }
.rank-row .sup { font-size: 10.5px; color: var(--dim); }
.rank-row .name { font-size: 12.5px; font-weight: 600; color: var(--txt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-row .side { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.rank-row .score { width: 28px; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--txt); }
.dim-bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; }
.dim-bar-row .dim-label { width: 92px; font-size: 11px; color: var(--mut); flex-shrink: 0; }
.dim-track { flex: 1; height: 7px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.dim-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.dim-val { width: 28px; text-align: right; font-size: 11.5px; font-weight: 700; color: var(--txt); }
.detail-h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); margin: 14px 0 8px; }
.media-card { border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 9px 11px; margin-bottom: 7px; }
.media-card .head { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 10.5px; color: var(--dim); margin-bottom: 4px; }
.trend-chart-wrap { height: 150px; position: relative; }
.filter-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-chip {
  border-radius: 999px; border: 1px solid var(--line-2); background: transparent;
  font-size: 10.5px; font-weight: 600; padding: 2.5px 10px; color: var(--mut);
}
.filter-chip.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* ═══ REGISTRY ═══ */
.registry-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 12px; align-items: start; }
.registry-editor {
  width: 100%; min-height: 420px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--txt); font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px; line-height: 1.5; padding: 12px;
}
.registry-error {
  border-radius: 8px; border: 1px solid var(--status-crit); background: var(--panel-2);
  color: var(--status-crit); font-size: 11.5px; padding: 9px 12px; margin-top: 8px;
  white-space: pre-wrap;
}

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: flex-start; justify-content: center; overflow-y: auto;
  background: color-mix(in srgb, var(--neutral-950) 78%, transparent);
  padding: 40px 16px;
}
.modal-overlay.open { display: flex; }
.modal-box {
  width: 100%; max-width: 760px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); padding: 22px 24px; box-shadow: var(--shadow-modal);
}
.modal-close-row { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.modal-close-btn { border: none; background: none; color: var(--dim); font-size: 12px; font-weight: 600; }
.modal-close-btn:hover { color: var(--txt); }
.stage-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stage-chip {
  border-radius: 8px; border: 1px solid var(--line-2); color: var(--mut);
  font-size: 11px; font-weight: 600; padding: 5px 10px;
}
.stage-chip.current { border-color: var(--accent); color: var(--accent); }
.stage-sep { color: var(--dim); font-size: 12px; }
.kpi-grid-modal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi-cell { border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); padding: 9px 12px; }
.kpi-cell .k-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); }
.kpi-cell .k-value { font-size: 14.5px; font-weight: 800; margin-top: 2px; }
.dl-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 12px; }
.dl-2col dt { color: var(--dim); }
.dl-2col dd { color: var(--txt); font-weight: 600; }
.sat-grids { display: flex; gap: 14px; margin: 8px 0; }
.sat-grid-wrap { text-align: center; }
.sat-grid { display: grid; grid-template-columns: repeat(8, 14px); grid-auto-rows: 14px; gap: 1px; border-radius: 6px; overflow: hidden; }
.sat-caption { font-size: 10px; color: var(--dim); margin-top: 4px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ═══ TOAST ═══ */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel);
  color: var(--txt); font-size: 13px; padding: 12px 16px; box-shadow: var(--shadow-modal);
  opacity: 0; transform: translateY(8px); transition: all 0.25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ═══ UTILITIES ═══ */
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.wrap { flex-wrap: wrap; }
.empty-note { font-size: 12px; color: var(--dim); padding: 8px 0; }

/* Scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* Responsif dasar */
@media (max-width: 1100px) {
  .dash-layout { grid-template-columns: 1fr; height: auto; }
  .map-wrap { height: 420px; }
  .split-2col { grid-template-columns: 1fr; }
  .stat-grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .program-grid, .kanban, .integration-grid { grid-template-columns: 1fr; }
  .registry-layout { grid-template-columns: 1fr; }
}
