/* ═══════════════════════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette — flat, light, professional */
  --white:      #ffffff;
  --bg:         #f4f5f7;
  --bg-card:    #ffffff;
  --bg-hover:   #f8f9fb;

  --border:     #e2e5ea;
  --border-md:  #d0d4dc;

  --text:       #1a1d23;
  --text-2:     #5a6070;
  --text-3:     #9aa0ae;

  --blue:       #3b6ef8;
  --blue-light: #eef2ff;
  --blue-mid:   #dde4fd;

  --green:      #19a96b;
  --green-light:#e6f7f0;
  --green-mid:  #c7edd9;

  --red:        #e03b5a;
  --red-light:  #fdedf0;
  --red-mid:    #f9c8d0;

  --orange:     #e07a1a;
  --orange-light:#fff3e6;

  --yellow:     #c9920a;
  --yellow-light:#fef9e6;

  --gray-light: #f1f2f4;

  /* Type */
  --font:       'Inter', system-ui, sans-serif;
  --mono:       'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --sidebar-w:  230px;
  --r:          8px;
  --r-sm:       5px;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════
   LAYOUT — SIDEBAR + MAIN
═══════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 32px 36px 64px;
  max-width: calc(1280px + var(--sidebar-w));
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — BRAND
═══════════════════════════════════════════════════════════ */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 32px; height: 32px;
  background: var(--blue);
  color: #fff;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 14px; font-weight: 700;
  color: var(--text);
  letter-spacing: -.2px;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — NAV
═══════════════════════════════════════════════════════════ */
.nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
  transition: background .12s, color .12s;
}

.nav-item:hover { background: var(--bg); color: var(--text); }

.nav-item.active {
  background: var(--blue-light);
  color: var(--blue);
}

.nav-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — FOOTER LEGEND
═══════════════════════════════════════════════════════════ */
.sidebar-footer {
  padding: 16px 14px 20px;
  border-top: 1px solid var(--border);
}

.legend-block { display: flex; flex-direction: column; gap: 5px; }

.legend-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-2);
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.green  { background: var(--green); }
.dot.yellow { background: #d4a017; }
.dot.blue   { background: var(--blue); }
.dot.red    { background: var(--red); }
.dot.gray   { background: var(--text-3); }

/* ═══════════════════════════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════════════════════════ */
.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--text);
}

.page-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
}

/* ═══════════════════════════════════════════════════════════
   PANEL / SECTION
═══════════════════════════════════════════════════════════ */
.panel { display: block; }
.panel.hidden { display: none; }

.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 16px;
  overflow: hidden;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.step-num {
  width: 22px; height: 22px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   UPLOAD
═══════════════════════════════════════════════════════════ */
.upload-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  padding: 20px;
  align-items: center;
}

.upload-box {
  position: relative;
  border: 2px dashed var(--border-md);
  border-radius: var(--r);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 160px;
  justify-content: center;
  transition: border-color .15s, background .15s;
  background: var(--bg);
}

.upload-box input[type=file] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}

.upload-box:hover,
.upload-box.drag {
  border-color: var(--blue);
  background: var(--blue-light);
}

.upload-box.has-file {
  border-color: var(--green);
  border-style: solid;
  background: var(--green-light);
}

.upload-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 4px;
}

.upload-badge.kpp    { background: var(--blue-mid); color: var(--blue); }
.upload-badge.tenant { background: var(--green-mid); color: var(--green); }

.upload-icon { color: var(--text-3); }

.upload-box.has-file .upload-icon { color: var(--green); }

.upload-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.upload-hint {
  font-size: 11px;
  color: var(--text-3);
}

.file-name {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--green);
  background: var(--green-mid);
  padding: 3px 10px;
  border-radius: 20px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  color: var(--text-3);
}

.format-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-2);
  background: var(--blue-light);
  border-top: 1px solid var(--border);
}

.format-hint svg { flex-shrink: 0; margin-top: 1px; color: var(--blue); }
.format-hint strong { color: var(--blue); }

/* ═══════════════════════════════════════════════════════════
   RUN ROW
═══════════════════════════════════════════════════════════ */
.run-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 20px;
}

.select-group { display: flex; flex-direction: column; gap: 5px; }

.select-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.sel {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-md);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239aa0ae' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  min-width: 180px;
}

.sel:focus { outline: none; border-color: var(--blue); }

.btn-run {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--blue);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .14s;
  white-space: nowrap;
}

.btn-run:disabled { opacity: .35; cursor: not-allowed; }
.btn-run:not(:disabled):hover { opacity: .87; }
.btn-run.green { background: var(--green); }

/* ═══════════════════════════════════════════════════════════
   PROGRESS
═══════════════════════════════════════════════════════════ */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 16px;
}

.progress-bar-wrap.hidden { display: none; }

.progress-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
  width: 35%;
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

.progress-text {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   ALERT
═══════════════════════════════════════════════════════════ */
.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 20px 16px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
}

.alert.hidden { display: none; }
.alert.ok { background: var(--green-light); color: var(--green); }
.alert.er { background: var(--red-light); color: var(--red); }

/* ═══════════════════════════════════════════════════════════
   STATS ROW
═══════════════════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1px;
  background: var(--border);
}

.stat-card {
  background: var(--bg-card);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-card.highlight-red { background: var(--red-light); }

.stat-val {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.stat-val.blue   { color: var(--blue); }
.stat-val.green  { color: var(--green); }
.stat-val.red    { color: var(--red); }
.stat-val.orange { color: var(--orange); }

.stat-key {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ═══════════════════════════════════════════════════════════
   TABLE
═══════════════════════════════════════════════════════════ */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg);
}

.table-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.count-badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--border);
  color: var(--text-2);
  font-weight: 500;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip-btn {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 20px;
  border: 1px solid var(--border-md);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  transition: all .12s;
}

.chip-btn:hover { background: var(--bg-hover); color: var(--text); }

.chip-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.chip-btn.chip-red.active  { background: var(--red); border-color: var(--red); }
.chip-btn.chip-red:hover   { color: var(--red); border-color: var(--red); }
.chip-btn.chip-green.active { background: var(--green); border-color: var(--green); }
.chip-btn.chip-green:hover  { color: var(--green); border-color: var(--green); }
.chip-btn.chip-yellow.active { background: var(--yellow); border-color: var(--yellow); }
.chip-btn.chip-yellow:hover  { color: var(--yellow); border-color: var(--yellow); }

.btn-dl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-md);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  transition: all .12s;
}

.btn-dl:hover { background: var(--bg-hover); color: var(--text); }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 9px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--bg-hover); }

/* Row states */
tbody tr.row-mangkir td { background: #fff0f2; }
tbody tr.row-resign  td { background: #fff0f2; }
tbody tr.row-beda    td { background: #fffaf0; }
tbody tr.row-only-a  td { background: #fff8f0; }
tbody tr.row-only-b  td { background: #fff8f0; }

/* Column widths */
.col-no     { width: 40px; }
.col-nik    { width: 120px; }
.col-tgl    { width: 90px; }
.col-val    { width: 130px; }
.col-arrow  { width: 20px; }
.col-status { width: 110px; }
.col-score  { width: 140px; }

/* Value display */
.nik-val {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
}

.row-num {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--mono);
}

.tgl-val {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}

.arrow-col {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}

.name-main { font-weight: 500; }
.name-sub  { font-size: 11px; color: var(--text-2); margin-top: 1px; }

/* Keterangan text */
.ket-text {
  font-size: 11px;
  color: var(--text-2);
}

/* kpp / tenant column headers */
.kpp-head    { color: var(--blue)  !important; }
.tenant-head { color: var(--green) !important; }

/* ─── VALUE CHIPS ───────────────────────────────────────── */
.val {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-sm);
}

.val-none    { color: var(--text-3); font-style: italic; font-size: 13px; }
.val-kpp     { background: var(--blue-light); color: var(--blue); }
.val-tenant  { background: var(--green-light); color: var(--green); }
.val-mangkir { background: var(--red-light); color: var(--red); font-weight: 700; }
.val-resign  { background: var(--red-light); color: var(--red); font-weight: 700; }
.val-alpha   { background: var(--gray-light); color: var(--text-3); font-style: italic; font-weight: 400; }

/* ─── STATUS BADGES ─────────────────────────────────────── */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.b-sama    { background: var(--green-light); color: var(--green); }
.b-beda    { background: var(--yellow-light); color: var(--yellow); }
.b-mangkir { background: var(--red-light); color: var(--red); }
.b-resign  { background: var(--red-light); color: var(--red); }
.b-only    { background: var(--orange-light); color: var(--orange); }

/* ─── NAME MATCH BAR ────────────────────────────────────── */
.match-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.match-track {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.match-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s;
}

.match-pct {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  min-width: 34px;
  text-align: right;
}

/* ─── INFO STRIP ────────────────────────────────────────── */
.info-strip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--blue-light);
  border-bottom: 1px solid var(--border);
}

.info-strip svg { flex-shrink: 0; margin-top: 2px; color: var(--blue); }

/* ─── FILE STATUS ───────────────────────────────────────── */
.file-status-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.file-status-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.file-status-sep {
  width: 1px;
  height: 36px;
  background: var(--border);
  margin: 0 24px;
}

.fsi-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-3);
}

.fsi-val {
  font-size: 13px;
  font-weight: 600;
}

.fsi-val.kpp    { color: var(--blue); }
.fsi-val.tenant { color: var(--green); }

/* ─── BUTTON IN SECTION BODY ─────────────────────────────── */
.section .btn-run {
  margin: 16px 20px 0;
}

/* ─── TABLE EMPTY ────────────────────────────────────────── */
.table-empty {
  padding: 32px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

.table-empty.hidden { display: none; }

/* ═══════════════════════════════════════════════════════════
   HIDDEN
═══════════════════════════════════════════════════════════ */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 4px; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 20px 16px 48px; }
  .upload-row { grid-template-columns: 1fr; }
  .upload-divider { display: none; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .run-row { flex-direction: column; align-items: stretch; }
  .sel { min-width: auto; width: 100%; }
}