/* ============================================================
   SRM DASHBOARD - STYLE.CSS
   Kadin Indonesia Institute
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #1a56db;
  --primary-light:#3b82f6;
  --primary-pale: #eff6ff;
  --teal:         #0891b2;
  --teal-pale:    #ecfeff;
  --green:        #16a34a;
  --green-pale:   #f0fdf4;
  --orange:       #ea580c;
  --orange-pale:  #fff7ed;
  --red:          #dc2626;
  --yellow:       #ca8a04;
  --bg:           #f0f4f9;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text:         #1e293b;
  --text-2:       #475569;
  --text-3:       #94a3b8;
  --nav-h:        112px;
  --radius:       14px;
  --shadow:       0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
}

/* ─── TOP NAV ─────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  /* Single-row layout */
  display: flex;
  align-items: center;
  padding: 0 28px;
  min-height: 68px;
  gap: 16px;
}

/* Left: brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.12));
}

.brand-name { font-weight: 700; font-size: 14px; color: var(--text); line-height: 1.3; }
.brand-sub  { font-size: 11px; color: #000; }

.btn-kelola-data {
  margin-left: auto;
  padding: 8px 16px;
  border-radius: 8px;
  background: #1a56db;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-kelola-data:hover { background: #1e40af; }

/* Center: tabs */
.tab-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;              /* takes remaining space */
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 22px 16px;
  border: none;
  background: transparent;
  color: #000;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all .2s;
  white-space: nowrap;
  height: 68px;         /* same as topnav min-height for bottom border alignment */
  box-sizing: border-box;
}

.tab-btn:hover { color: var(--primary); background: var(--primary-pale); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Remove old topnav-inner (no longer needed) */
.topnav-inner { display: contents; }

/* ─── LOAD ERROR BANNER ────────────────────── */
.load-error-banner {
  max-width: 1280px;
  margin: 16px auto 0;
  padding: 12px 20px;
  border-radius: 8px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 14px;
  font-weight: 500;
}

/* ─── MAIN CONTENT ────────────────────────── */
.main-content { max-width: 1280px; margin: 0 auto; padding: 28px 28px 60px; }

.tab-panel { display: none; animation: fadeIn .25s ease; }
.tab-panel.active { display: block; }

@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ─── BREADCRUMB & PAGE TITLE ─────────────── */
.breadcrumb { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: #000; text-transform: uppercase; margin-bottom: 8px; }
.breadcrumb span { color: var(--primary); }

.page-title { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 8px; line-height: 1.2; }
.page-subtitle { font-size: 13.5px; color: #000; margin-bottom: 24px; max-width: 680px; }

/* ─── PAGE HERO ───────────────────────────── */
.page-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 40px;
  margin-bottom: 20px;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 55%;
  background-image: repeating-linear-gradient(135deg, rgba(26,86,219,.07) 0 2px, transparent 2px 16px);
  -webkit-mask-image: linear-gradient(to right, transparent, #000 45%);
  mask-image: linear-gradient(to right, transparent, #000 45%);
  pointer-events: none;
}

.page-hero-left { position: relative; z-index: 1; flex: 0 0 340px; }

.hero-badge {
  display: inline-block;
  background: var(--primary-pale);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.28;
  color: var(--text);
  margin-bottom: 14px;
}
.hero-title .accent { color: var(--primary); }

.hero-subtext { font-size: 13.5px; color: #000; max-width: 400px; margin-bottom: 18px; }

.hero-date { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #000; }
.hero-date svg { stroke: var(--text-3); flex-shrink: 0; }

.page-hero-stats {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  min-width: 0;
}

.hero-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}

.hero-stat-icon { width: 26px; height: 26px; color: var(--primary); margin-bottom: 14px; }
.hero-stat-icon svg { width: 100%; height: 100%; }

.hero-stat-num   { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 6px; }
.hero-stat-title { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.hero-stat-desc  { font-size: 11px; color: #000; line-height: 1.4; }

/* donut card (relocated into charts-row) */
.donut-wrap { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut-pct { font-size: 22px; font-weight: 800; color: var(--primary); }
.donut-sub { font-size: 11px; color: #000; }

.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #000; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.blue-dot  { background: var(--primary); }
.green-dot { background: var(--green); }

/* ─── CHART CARDS ─────────────────────────── */
.charts-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  flex: 1;
  min-width: 260px;
  overflow: hidden;
}

.chart-card-sm { flex: 0 0 280px; }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -20px -22px 16px;
  padding: 14px 22px;
  background: var(--primary);
  border-radius: var(--radius) var(--radius) 0 0;
}

.chart-title { font-size: 14.5px; font-weight: 700; color: #fff; }

.lihat-detail-btn {
  font-size: 11.5px;
  color: #fff;
  background: rgba(255,255,255,.2);
  border: none;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background .2s;
}
.lihat-detail-btn:hover { background: rgba(255,255,255,.32); }

.pie-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.pie-legend { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }

.pie-total { font-size: 11px; color: #000; text-align: center; }

/* ─── WKUK INFO LIST ──────────────────────── */
.wkuk-list { display: flex; flex-direction: column; }
.wkuk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.wkuk-row:last-child { border-bottom: none; }
.wkuk-row:hover { background: #f8fafc; }
.wkuk-name { font-size: 12.5px; color: var(--text); font-weight: 500; }
.wkuk-count { font-size: 12.5px; font-weight: 700; color: var(--primary); white-space: nowrap; }

/* ─── KADIN (WKUK & WKU) ──────────────────── */
.kadin-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.kadin-summary-item { font-size: 13px; color: #000; font-weight: 500; }
.kadin-summary-num { font-size: 15px; font-weight: 800; color: var(--primary); margin-right: 4px; }
.kadin-summary-sep { width: 1px; height: 14px; background: var(--border); }

.table-wrap.kadin-table-wrap { max-height: none; overflow: visible; }

.kadin-table { table-layout: fixed; }
.kadin-table .count-cell { justify-content: flex-end; }

.kadin-name-inner { display: flex; align-items: center; gap: 8px; }

.kadin-chevron {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  background: transparent;
  color: #000;
  cursor: pointer;
  border-radius: 5px;
  transition: transform .18s, background .15s, color .15s;
}
.kadin-chevron:hover { background: var(--primary-pale); color: var(--primary); }
.kadin-chevron.open { transform: rotate(90deg); }
.kadin-chevron-spacer { display: inline-block; width: 20px; flex-shrink: 0; }

.kadin-row-parent { cursor: pointer; }
.kadin-row-parent td { border-bottom: 1px solid var(--border); }
.kadin-parent-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.kadin-row-parent:hover .kadin-parent-name { color: var(--primary); }

.kadin-row-child { background: #fbfcfe; }
.kadin-row-child:hover { background: var(--primary-pale); }
.kadin-row-child td { border-bottom: 1px solid #f1f5f9; }
.kadin-row-child .kadin-name-cell { position: relative; }
.kadin-row-child .kadin-name-inner { padding-left: 38px; flex-wrap: wrap; row-gap: 4px; }
.kadin-row-child .kadin-name-cell::before {
  content: '';
  position: absolute;
  left: 28px; top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}
.kadin-row-child.last .kadin-name-cell::before { bottom: 50%; }
.kadin-row-child .kadin-name-cell::after {
  content: '';
  position: absolute;
  left: 28px; top: 50%;
  width: 10px; height: 1px;
  background: var(--border);
}
.kadin-wku-name { font-size: 12.5px; color: #000; }

.kadin-crossref-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--orange);
  background: var(--orange-pale);
  border-radius: 20px;
  padding: 2px 9px;
  white-space: nowrap;
}

.kadin-empty { text-align: center; color: #000; font-size: 13px; padding: 32px 0 !important; }

/* ─── PETA TEMA ───────────────────────────── */
.tema-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.tema-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left: 5px solid;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.tema-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

.tema-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.tema-count-row { display: flex; align-items: baseline; gap: 6px; }
.tema-count { font-size: 28px; font-weight: 800; }
.tema-count-label { font-size: 11.5px; color: #000; }
.tema-bar-wrap { margin-top: 10px; height: 6px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.tema-bar { height: 100%; border-radius: 3px; }

/* ─── SEKTOR ──────────────────────────────── */
.sektor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

.sektor-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left: 5px solid;
  height: 198px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.sektor-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }

.sektor-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.sektor-card-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sektor-card-count { font-size: 17px; font-weight: 800; flex-shrink: 0; }

.sektor-bar-wrap { height: 5px; background: #f1f5f9; border-radius: 3px; overflow: hidden; margin-bottom: 10px; flex-shrink: 0; }
.sektor-bar { height: 100%; border-radius: 3px; }

.sektor-sub-list { display: flex; flex-direction: column; gap: 5px; flex: 1; overflow: hidden; }

.sektor-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s;
}
.sektor-sub-row:last-child { border-bottom: none; padding-bottom: 0; }
.sektor-sub-row:hover { background: #f8fafc; }

.sektor-sub-name { color: #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sektor-sub-count { font-weight: 700; color: var(--text); flex-shrink: 0; }

.sektor-more {
  min-height: 14px;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ─── PEMERINTAH (Menko toolbar & list) ────── */
.menko-toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.instansi-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.instansi-toggle-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.instansi-toggle-btn:hover:not(.active) { background: var(--primary-pale); }
.instansi-toggle-btn.active { background: var(--primary); color: #fff; }
.instansi-toggle-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--primary-pale);
  color: var(--primary);
}
.instansi-toggle-btn.active .instansi-toggle-count { background: rgba(255,255,255,.3); color: #fff; }

.menko-filters-row { margin-bottom: 0; }

.menko-lainnya-note { font-size: 12px; color: #000; margin: -8px 0 14px; }

.menko-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.menko-row { border-bottom: 1px solid var(--border); }
.menko-row:last-child { border-bottom: none; }

/* "Lainnya" pseudo-group: Kementerian not in the official 7-Kemenko table -
   visually distinct, and its header isn't a clickable jump-to-Database row. */
.menko-row-unverified { border-top: 2px dashed #fcd34d; }
.menko-row-unverified .menko-row-header { cursor: default; background: #fffbeb; }
.menko-row-unverified .menko-row-header:hover { background: #fffbeb; }
.menko-row-unverified .menko-row-header:hover .menko-name { color: var(--text); }

.menko-row-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  transition: background .15s;
}
.menko-row-header:hover { background: #f8fafc; }

.menko-no { font-size: 12px; font-weight: 700; color: #000; width: 20px; flex-shrink: 0; }

.menko-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.menko-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menko-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.menko-row-header:hover .menko-name { color: var(--primary); }
.menko-desc { font-size: 12px; color: #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menko-total { flex-shrink: 0; text-align: right; display: flex; flex-direction: column; }
.menko-total-num { font-size: 18px; font-weight: 800; line-height: 1.2; }
.menko-total-label { font-size: 11.5px; color: #000; }

.menko-chevron {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  background: transparent;
  color: #000;
  border-radius: 6px;
  transition: transform .18s, background .15s;
}
.menko-chevron.open { transform: rotate(180deg); }

.menko-instansi-panel { padding: 4px 18px 18px 52px; }

.menko-instansi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.instansi-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.instansi-card:hover { border-color: var(--primary-light); box-shadow: 0 2px 8px rgba(0,0,0,.06); }

/* Only shown in the "Lainnya" tab, where cards mix several types (Pemda /
   Legislatif-Yudikatif / Non-Pemerintah / Belum Terklasifikasi). Reserve
   space in the name column so a long institution name never runs under it. */
.instansi-card.has-tag { padding-top: 24px; }
.instansi-card.has-tag .instansi-icon { align-self: start; }
.instansi-type-tag {
  position: absolute;
  top: 7px; left: 12px; right: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 6px;
  border-radius: 20px;
  background: var(--primary-pale);
  color: var(--primary);
  width: fit-content;
  max-width: calc(100% - 20px);
}
.instansi-type-tag-unclassified { background: #fffbeb; color: #b45309; }

.instansi-icon {
  grid-row: 1 / 3;
  width: 34px; height: 34px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.instansi-logo-img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.instansi-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.3; }
.instansi-count-row { display: flex; align-items: baseline; gap: 4px; }
.instansi-count { font-size: 15px; font-weight: 800; }
.instansi-count-label { font-size: 12.5px; color: #000; }

.menko-instansi-empty { font-size: 12.5px; color: #000; font-style: italic; padding: 6px 0; }

.menko-showall-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 14px;
  width: 100%;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--primary-pale);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.menko-showall-btn:hover { background: #dbeafe; }

.menko-empty { text-align: center; color: #000; font-size: 13px; padding: 32px 0; }

/* ─── DATABASE FILTERS ────────────────────── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.search-wrap { position: relative; flex: 0 0 240px; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--text-3); }
.search-input {
  width: 100%;
  padding: 8px 10px 8px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color .2s;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.12); }

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s;
  flex: 1;
  min-width: 150px;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

.reset-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #f8fafc;
  color: #000;
  cursor: pointer;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
}
.reset-btn:hover { background: #fee2e2; color: var(--red); border-color: #fca5a5; }

/* ─── DATA TABLE ──────────────────────────── */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: auto;
  max-height: 560px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  position: sticky; top: 0; z-index: 2;
  background: #f8fafc;
}

.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: #000;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

.data-table tbody tr { cursor: pointer; transition: background .15s; }
.data-table tbody tr:hover { background: var(--primary-pale); }

.td-rank { font-size: 13px; font-weight: 700; color: #000; }
.count-cell { display: flex; align-items: center; gap: 10px; }
.count-bar-wrap { flex: 1; height: 8px; background: #f1f5f9; border-radius: 4px; overflow: hidden; }
.count-bar { height: 100%; border-radius: 4px; background: var(--primary); }
.count-num { font-size: 13px; font-weight: 700; color: var(--text); min-width: 18px; text-align: right; }

.td-no { color: #000; font-weight: 600; text-align: center; }
.td-usulan { max-width: 320px; color: var(--text); }
.td-justifikasi { max-width: 300px; font-size: 12.5px; color: #000; }
.td-implikasi { max-width: 300px; font-size: 12.5px; color: #000; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-size: 12.5px;
  color: #000;
}

.pagination { display: flex; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: #000;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  padding: 0 8px;
}
.page-btn:hover { background: var(--primary-pale); color: var(--primary); border-color: var(--primary-light); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── MODAL ───────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--surface);
  border-radius: 18px;
  padding: 32px;
  max-width: 640px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,.2);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.95); } to { opacity:1; scale:1; } }

.modal-close {
  position: absolute;
  top: 16px; right: 18px;
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.modal-close:hover { background: #fee2e2; }

.modal-id { font-family: monospace; font-size: 13px; color: var(--primary); font-weight: 700; margin-bottom: 8px; }
.modal-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 18px; line-height: 1.4; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-field { display: flex; flex-direction: column; gap: 2px; }
.modal-label { font-size: 10.5px; font-weight: 600; color: #000; text-transform: uppercase; letter-spacing: .06em; }
.modal-value { font-size: 13px; color: var(--text); }
.modal-field.full { grid-column: 1 / -1; }
.modal-divider { grid-column: 1/-1; border: none; border-top: 1px solid var(--border); margin: 4px 0; }

.modal-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-bottom: 12px;
}
.modal-back-link:hover { text-decoration: underline; }
.modal-list { max-height: 50vh; overflow-y: auto; }

/* ─── ADMIN LOGIN GATE ────────────────────── */
.admin-login-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
/* An explicit `display` here would otherwise always win over the browser's
   default `[hidden] { display: none }` rule, since that default lives in the
   lowest-priority UA stylesheet layer -- so setting .hidden = true from JS
   would silently do nothing without this override. */
.admin-login-overlay[hidden] { display: none; }

.admin-login-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-login-box .page-title { font-size: 20px; margin-bottom: 0; color: #000; }
.admin-login-box .page-subtitle { font-size: 13px; margin-bottom: 0; color: #000; }

.admin-login-box input[type="password"] {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}
.admin-login-box input[type="password"]:focus { outline: 2px solid var(--primary-light); outline-offset: 1px; }

.admin-login-error {
  font-size: 13px;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
}

/* ─── ADMIN PAGE (Kelola Data) ───────────── */
.admin-wrap { max-width: 1400px; margin: 0 auto; padding: 32px 28px 60px; }
.admin-wrap .page-subtitle, .admin-wrap .page-title { color: #000; }

.admin-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: #000;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.admin-back-link:hover { color: var(--primary); }

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.admin-toolbar .btn-download {
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.admin-toolbar .btn-download:hover { border-color: var(--primary); color: var(--primary); }

.admin-toolbar input[type="file"] {
  font-family: inherit;
  font-size: 13px;
  color: #000;
  max-width: 260px;
}

.admin-toolbar .btn-upload {
  margin-left: auto;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.admin-toolbar .btn-upload:hover { background: #1e40af; }

.admin-toolbar .btn-reset-filter {
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: #000;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.admin-toolbar .btn-reset-filter:hover { border-color: var(--primary); color: var(--primary); }

.admin-msg {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
  white-space: pre-wrap;
  border: 1px solid transparent;
}
.admin-msg.ok  { background: var(--green-pale); color: #166534; border-color: #bbf7d0; }
.admin-msg.err { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

.admin-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table.admin-table {
  table-layout: auto;
  border-collapse: collapse;
  font-size: 13px;
}

table.admin-table thead th {
  position: sticky;
  top: 0;
  background: var(--primary-pale);
  color: var(--text);
  font-weight: 700;
  font-size: 12px;
  text-align: left;
  padding: 6px 6px 6px 10px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.th-inner { display: flex; align-items: center; justify-content: space-between; gap: 4px; }

.th-label { display: inline-flex; align-items: center; cursor: pointer; user-select: none; }
.th-label:hover { color: var(--primary); }
.sort-arrow { font-size: 10px; margin-left: 2px; color: var(--primary); }

.th-filter-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 9px;
  line-height: 1;
  color: #000;
  padding: 4px;
  border-radius: 4px;
}
.th-filter-btn:hover { color: var(--primary); background: rgba(26,86,219,.1); }
.th-filter-btn.active { color: var(--primary); background: rgba(26,86,219,.16); }

.th-filter-panel {
  position: absolute;
  z-index: 1000;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 8px;
  font-size: 12px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
.th-filter-search {
  width: 100%;
  padding: 5px 8px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
}
.th-filter-actions { display: flex; gap: 6px; margin-bottom: 6px; }
.th-filter-actions button {
  flex: 1;
  padding: 4px 6px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: #000;
  cursor: pointer;
  font-family: inherit;
}
.th-filter-actions button:hover { border-color: var(--primary); color: var(--primary); }
.th-filter-list {
  max-height: 180px;
  overflow-y: auto;
  margin-bottom: 6px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 4px 2px;
}
.th-filter-item { display: flex; align-items: center; gap: 6px; padding: 3px 2px; cursor: pointer; border-radius: 4px; }
.th-filter-item:hover { background: #f8fafc; }
.th-filter-item input { flex-shrink: 0; }
.th-filter-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 400; }
.th-filter-footer { display: flex; gap: 6px; }
.th-filter-footer button {
  flex: 1;
  padding: 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.th-filter-footer button[data-action="apply"] { background: var(--primary); color: #fff; }
.th-filter-footer button[data-action="apply"]:hover { background: #1e40af; }
.th-filter-footer button[data-action="clear"] { background: var(--surface); border: 1px solid var(--border); color: #000; }
.th-filter-footer button[data-action="clear"]:hover { border-color: var(--red); color: var(--red); }

table.admin-table td.admin-empty {
  text-align: center;
  color: #000;
  padding: 28px 10px;
  font-size: 13px;
}

table.admin-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: middle;
  color: var(--text);
  overflow-wrap: break-word;
}

table.admin-table tbody tr:hover { background: #fafbff; }

table.admin-table td[contenteditable="true"] {
  background: #fffbeb;
  border-radius: 4px;
  transition: background .15s;
}

/* Column sizing (table-layout: auto): narrow columns get a nowrap width
   hint so they hug their short content; long free-text columns get a
   min-width instead so wrapping happens across several words, not one
   word per line. The wrapper's overflow-x: auto lets the table go wider
   than the viewport and scroll horizontally rather than being squeezed. */
table.admin-table th:nth-child(1),  table.admin-table td:nth-child(1)  { width: 60px; min-width: 60px; white-space: nowrap; }                     /* no */
table.admin-table td:nth-child(1) { text-align: center; }
table.admin-table th:nth-child(4),  table.admin-table td:nth-child(4)  { min-width: 260px; }                                      /* usulan */
table.admin-table th:nth-child(5),  table.admin-table td:nth-child(5)  { min-width: 260px; }                                      /* justifikasi */
table.admin-table th:nth-child(6),  table.admin-table td:nth-child(6)  { min-width: 260px; }                                      /* implikasi */
table.admin-table th:nth-child(7),  table.admin-table td:nth-child(7)  { min-width: 200px; }                                      /* objek_kebijakan */
table.admin-table th:nth-child(8),  table.admin-table td:nth-child(8)  { width: 130px; min-width: 130px; }                        /* kemenko */
table.admin-table th:nth-child(9),  table.admin-table td:nth-child(9)  { width: 110px; min-width: 110px; }                        /* kl */
table.admin-table th:nth-child(11), table.admin-table td:nth-child(11) { width: 110px; min-width: 110px; }                        /* subsektor */
table.admin-table th:nth-child(12), table.admin-table td:nth-child(12) { width: 110px; min-width: 110px; }                        /* tema */
table.admin-table th:nth-child(13), table.admin-table td:nth-child(13) { width: 120px; min-width: 120px; }                        /* jenis_kebijakan */
table.admin-table th:nth-child(14), table.admin-table td:nth-child(14) { width: 90px; min-width: 90px; white-space: nowrap; }      /* Aksi */

/* wkuk, wku, sektor: header label stays on one line, but the data cell is
   capped to roughly two words wide and wraps to multiple lines instead of
   stretching the whole row (these values can otherwise be a long phrase). */
table.admin-table th:nth-child(2)  { width: 150px; white-space: nowrap; }   /* wkuk */
table.admin-table th:nth-child(3)  { width: 150px; white-space: nowrap; }   /* wku */
table.admin-table th:nth-child(10) { width: 150px; white-space: nowrap; }   /* sektor */
table.admin-table td:nth-child(2),
table.admin-table td:nth-child(3),
table.admin-table td:nth-child(10) {
  width: 150px;
  min-width: 150px;
  max-width: 150px;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

table.admin-table td[contenteditable="true"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: #fff;
}

/* Long free-text columns (usulan, justifikasi, implikasi, objek_kebijakan):
   readable line spacing + a capped, scrollable height so one long paragraph
   doesn't blow out the whole row's height and make the table hard to scan. */
table.admin-table td:nth-child(4),
table.admin-table td:nth-child(5),
table.admin-table td:nth-child(6),
table.admin-table td:nth-child(7) {
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 108px;
  overflow-y: auto;
}

.admin-row-actions { white-space: nowrap; }
.admin-row-actions button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
  transition: background .15s, color .15s, border-color .15s;
}
.admin-row-actions button[data-save] {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.admin-row-actions button[data-save]:hover { background: #15803d; }
.admin-row-actions button[data-reset] {
  background: var(--surface);
  color: #000;
}
.admin-row-actions button[data-reset]:hover { border-color: var(--red); color: var(--red); }

/* ─── RESPONSIVE ────────────────────────── */
@media (max-width: 1100px) {
  .tab-btn { padding: 22px 10px; font-size: 12px; gap: 5px; }
  .tab-btn svg { display: none; }
  .topnav { padding: 0 16px; }
}

@media (max-width: 900px) {
  .page-hero { flex-direction: column; align-items: stretch; padding: 28px 24px; }
  .page-hero::before { width: 100%; }
  .page-hero-left { flex: 1; }
  .page-hero-stats { grid-template-columns: repeat(2, 1fr); }
  .charts-row { flex-direction: column; }
  .chart-card-sm { flex: 1; }
  .main-content { padding: 16px 14px 40px; }
  .page-title { font-size: 20px; }
  /* Stack navbar on small screens */
  .topnav {
    flex-wrap: wrap;
    padding: 10px 14px 0;
    min-height: auto;
    gap: 0;
  }
  .brand { padding-bottom: 8px; flex: 1; }
  .tab-nav {
    width: 100%;
    border-top: 1px solid var(--border);
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0 2px;
  }
  .tab-btn { height: 44px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
}

@media (max-width: 600px) {
  .page-hero-stats { grid-template-columns: 1fr; }
  .hero-title { font-size: 24px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-wrap { flex: 1; width: 100%; }
  .modal-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 13px; }
  .brand-logo-img { height: 38px; }
}

/* ─── JENIS KEBIJAKAN — TREEMAP ────────── */

/* Header row: title left, total badge right */
.anatomi-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.anatomi-total-badge {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 20px;
  flex-shrink: 0;
}

.anatomi-total-badge-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary-pale);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.anatomi-total-badge-icon svg { width: 20px; height: 20px; }

.anatomi-total-badge-text { display: flex; flex-direction: column; gap: 1px; }
.anatomi-total-num  { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.anatomi-total-label{ font-size: 11.5px; color: var(--text-2); font-weight: 500; }

.anatomi-total-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}

.anatomi-total-event {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}

/* Card shell */
.atm-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 4px;
}

/* Card header */
.atm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.atm-head-title { font-size: 13.5px; font-weight: 700; color: var(--text); }

/* Toggle */
.atm-toggle {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.atm-tbtn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  cursor: pointer;
  transition: all .15s;
}
.atm-tbtn.active { background: var(--primary); color: #fff; }
.atm-tbtn:not(.active):hover { background: #e2e8f0; color: var(--text); }

/* ── Grid ── */
.atm-grid {
  display: grid;
  grid-template-columns: 36fr 40fr 24fr;
  grid-template-rows: minmax(220px, 1fr) minmax(160px, 1fr);
  grid-template-areas:
    "a o o"
    "a t n";
  gap: 4px;
  padding: 4px;
  background: #fff;
  box-sizing: border-box;
  width: 100%;
}

/* ── Base tile ── */
.atm-tile {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 22px 22px;
  border-radius: 10px;
  min-height: 0;
  box-sizing: border-box;
}

/* Color backgrounds */
.atm-tile--a {
  grid-area: a;
  background: linear-gradient(150deg, #162f78 0%, #1d4ed8 55%, #2563eb 100%);
}
.atm-tile--o {
  grid-area: o;
  background: linear-gradient(150deg, #054966 0%, #0891b2 55%, #06b6d4 100%);
}
.atm-tile--t {
  grid-area: t;
  background: linear-gradient(150deg, #053d30 0%, #047857 55%, #059669 100%);
}
.atm-tile--n {
  grid-area: n;
  background: linear-gradient(150deg, #6b2a05 0%, #b45309 55%, #d97706 100%);
  padding: 14px 14px 16px;
}

/* ── SVG texture overlay ── */
.atm-texture {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 68%;
  height: 88%;
  opacity: 0.10;
  pointer-events: none;
  user-select: none;
}
.atm-tile--n .atm-texture { width: 82%; height: 90%; }

/* ── Ordinal ghost number ── */
.atm-ordinal {
  position: absolute;
  bottom: 14px;
  right: 18px;
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  color: rgba(255,255,255,0.08);
  pointer-events: none;
  user-select: none;
  letter-spacing: -3px;
  z-index: 0;
}
.atm-tile--n .atm-ordinal { font-size: 42px; right: 14px; bottom: 10px; }

/* ── Icon circle ── */
.atm-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(4px);
}
.atm-icon svg { width: 22px; height: 22px; }
.atm-icon--sm { width: 38px; height: 38px; margin-bottom: 12px; }
.atm-icon--sm svg { width: 18px; height: 18px; }

/* ── Content body ── */
.atm-body {
  position: relative;
  z-index: 1;
}
.atm-body--sm {}

.atm-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.01em;
  margin-bottom: 7px;
}
.atm-body--sm .atm-name { font-size: 12.5px; margin-bottom: 5px; }

.atm-line {
  width: 28px;
  height: 2px;
  background: rgba(255,255,255,0.45);
  border-radius: 2px;
  margin-bottom: 12px;
}
.atm-body--sm .atm-line { margin-bottom: 8px; }

.atm-pct {
  font-size: 40px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  letter-spacing: -1.5px;
  margin-bottom: 6px;
}
.atm-pct--sm { font-size: 30px; }

.atm-cnt {
  font-size: 13.5px;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
}
.atm-body--sm .atm-cnt { font-size: 12px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .atm-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "a a"
      "o o"
      "t n";
    height: auto;
  }
  .atm-tile { min-height: 150px; }
  .atm-texture { width: 50%; height: 80%; }
}

@media (max-width: 560px) {
  .atm-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "a" "o" "t" "n";
    gap: 3px;
    padding: 3px;
  }
  .atm-tile { min-height: 140px; border-radius: 8px; }
  .atm-pct { font-size: 32px; }
  .atm-pct--sm { font-size: 26px; }
}

@media (max-width: 600px) {
  .anatomi-header-row { flex-direction: column; align-items: flex-start; }
  .anatomi-total-badge { width: 100%; box-sizing: border-box; }
}
