:root {
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --surface-2: #F5F7F9;
  --surface-3: #EBEEF1;
  --primary: #0E6E8C;
  --primary-soft: rgba(14, 110, 140, 0.1);
  --primary-hover: #0B5A72;
  --success: #157A3E;
  --success-soft: rgba(21, 122, 62, 0.1);
  --warning: #92620A;
  --warning-soft: rgba(217, 143, 15, 0.12);
  --danger: #B3261E;
  --danger-soft: rgba(179, 38, 30, 0.09);
  --neutral: #5B6774;
  --neutral-soft: rgba(91, 103, 116, 0.1);
  --text: #1C2226;
  --text-secondary: #5B6774;
  --text-tertiary: #8A94A0;
  --border: #E1E5E9;
  --border-strong: #CBD2D9;
  --radius-lg: 10px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --shadow-out: 0 1px 2px rgba(20, 30, 40, 0.05), 0 1px 3px rgba(20, 30, 40, 0.06);
  --shadow-out-hover: 0 2px 4px rgba(20, 30, 40, 0.06), 0 4px 10px rgba(20, 30, 40, 0.08);
  /* Kartu bergaya "menonjol ke dalam": kombinasi inset gelap tipis di atas + inset
     highlight terang di bawah, dibungkus outline shadow lembut supaya kartu tetap
     terbaca terpisah dari background (bukan efek neumorphism norak, tetap rapi/resmi). */
  --shadow-inset: inset 0 1px 3px rgba(20, 30, 40, 0.10), inset 0 -1px 0 rgba(255, 255, 255, 0.6), 0 1px 2px rgba(20, 30, 40, 0.04);
  --shadow-inset-soft: inset 0 1px 2px rgba(20, 30, 40, 0.06), inset 0 -1px 0 rgba(255, 255, 255, 0.5);
  --shadow-pressed: inset 0 1px 3px rgba(20, 30, 40, 0.14), inset 0 -1px 0 rgba(255, 255, 255, 0.4);
  --shadow-modal: 0 12px 24px rgba(20, 30, 40, 0.12), 0 4px 8px rgba(20, 30, 40, 0.08);
  --shadow-glow-primary: none;
  --transition: 0.15s ease;
  --sidebar-w: 248px;
}

/* ===== Tema Gelap ===== */
[data-theme="dark"] {
  --bg: #14181C;
  --surface: #1C2126;
  --surface-2: #22282E;
  --surface-3: #2A3138;
  --primary: #2DA8CE;
  --primary-soft: rgba(45, 168, 206, 0.16);
  --primary-hover: #56BEDD;
  --success: #3FBE72;
  --success-soft: rgba(63, 190, 114, 0.14);
  --warning: #E0A429;
  --warning-soft: rgba(224, 164, 41, 0.16);
  --danger: #E5574E;
  --danger-soft: rgba(229, 87, 78, 0.14);
  --neutral: #98A3AE;
  --neutral-soft: rgba(152, 163, 174, 0.14);
  --text: #EDF0F2;
  --text-secondary: #A6B0BA;
  --text-tertiary: #7A8590;
  --border: #323A42;
  --border-strong: #414B54;
  --shadow-out: 0 1px 2px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-out-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-inset: inset 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 -1px 0 rgba(255, 255, 255, 0.04), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-inset-soft: inset 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
  --shadow-pressed: inset 0 1px 3px rgba(0, 0, 0, 0.45), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
  --shadow-modal: 0 16px 32px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .brand-icon-accent {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb { border-color: var(--bg); }

* { box-sizing: border-box; }

html, body { overflow-x: hidden; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  transition: background var(--transition), color var(--transition);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }

::selection { background: var(--primary-soft); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

.public-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.public-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.public-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  color: var(--text);
}

.public-brand .brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--shadow-inset-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.public-container {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 50px 20px;
  display: flex;
  flex-direction: column;
}

.public-hero {
  text-align: center;
  margin-bottom: 36px;
}

.public-hero h1 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.public-hero p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 15px;
}

.public-search-card {
  margin-bottom: 30px;
  padding: 24px;
}

.public-search-card #input-cari-public {
  width: 100%;
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 15.5px;
  margin-bottom: 14px;
}

.public-search-card #btn-cari-public {
  width: 100%;
  border-radius: 12px;
  padding: 14px;
  font-size: 15.5px;
}

.public-search-card .filter-row {
  flex-direction: column;
  align-items: stretch;
  border-bottom: none;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  margin-bottom: 0;
  padding-top: 20px;
  padding-bottom: 0;
  gap: 16px;
}

.public-filter-block {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.public-filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.public-filter-select {
  width: 100%;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
}

#shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-inset-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.brand-icon-accent {
  background: linear-gradient(155deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(14, 110, 140, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.public-brand .brand-icon-accent svg { width: 20px; height: 20px; }

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-text strong {
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.drawer-close { display: none; margin-left: auto; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition);
}

.nav-item:hover:not(.is-disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.is-active {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-inset-soft);
  position: relative;
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: var(--primary);
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
}

.nav-item.is-disabled {
  opacity: 0.42;
  cursor: default;
  pointer-events: none;
}

.nav-soon {
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-tertiary);
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-top: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-inset-soft);
}

.sidebar-foot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex: none;
}

.sidebar-foot-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-foot-text strong { font-size: 12.5px; }
.sidebar-foot-text span { font-size: 11px; color: var(--text-secondary); }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 39;
  animation: overlayIn 0.18s ease;
}

#main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 26px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.drawer-open { display: none; }

.topbar-title h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-secondary);
  box-shadow: var(--shadow-inset-soft);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), color var(--transition), box-shadow var(--transition);
}

.icon-btn:hover { color: var(--text); }
.icon-btn:active { transform: scale(0.94); }

.icon-btn.is-spinning { animation: spin 0.6s linear; }
.btn.is-spinning { opacity: 0.6; pointer-events: none; }

@keyframes spin { to { transform: rotate(360deg); } }

#content {
  padding: 22px 26px 60px;
  flex: 1;
}

.panel {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-inset);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.search-wrap {
  position: relative;
  flex: 1 1 240px;
  min-width: 180px;
}

#input-search { width: 100%; }

.hamburger, .hamburger::before, .hamburger::after {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.hamburger { position: relative; }
.hamburger::before, .hamburger::after { position: absolute; left: 0; }
.hamburger::before { top: -5px; }
.hamburger::after { top: 5px; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  transition: all var(--transition);
  white-space: nowrap;
}

.chip:hover { color: var(--text); border-color: var(--border-strong); }

.chip.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-hover);
}

.chip.chip-success.is-active { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.chip.chip-warning.is-active { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.chip.chip-danger.is-active  { background: var(--danger-soft);  border-color: var(--danger);  color: var(--danger); }
.chip.chip-neutral.is-active { background: var(--neutral-soft); border-color: var(--neutral); color: var(--neutral); }

.sort-select {
  min-width: 0;
  width: auto;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), color var(--transition), filter var(--transition);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-inset-soft);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding-left: 10px;
  padding-right: 10px;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(179, 38, 30, 0.25);
}

.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  min-height: 38px;
}

.btn-back { margin-bottom: 14px; }

input, select, textarea {
  font-family: inherit;
  font-size: 14.5px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow-inset-soft);
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 44px;
}

textarea { min-height: 70px; resize: vertical; }

input::placeholder, textarea::placeholder { color: var(--text-tertiary); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[readonly], .biaya-readonly {
  color: var(--text-secondary);
  cursor: default;
}

.card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 60%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-inset);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-pressed), 0 4px 10px rgba(20, 30, 40, 0.06);
  border-color: var(--border-strong);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

@media (min-width: 900px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

.stat-card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 65%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--neutral);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-inset);
  padding: 16px 18px;
  transition: box-shadow var(--transition);
  position: relative;
}

.stat-card:hover {
  box-shadow: var(--shadow-pressed), 0 4px 10px rgba(20, 30, 40, 0.06);
}

.stat-card.stat-card-success { border-left-color: var(--success); }
.stat-card.stat-card-warning { border-left-color: var(--warning); }
.stat-card.stat-card-accent { border-left-color: var(--primary); }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.warga-grid, .skeleton-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 700px) {
  .warga-grid, .skeleton-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1080px) {
  .warga-grid, .skeleton-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1440px) {
  .warga-grid, .skeleton-grid { grid-template-columns: repeat(4, 1fr); }
}

.card-warga {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-warga-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-3);
  box-shadow: var(--shadow-inset-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.card-warga-nama {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  overflow-wrap: anywhere;
  transition: color var(--transition);
}

.card-warga-nama:hover { color: var(--primary); }

.card-warga-alamat, .card-warga-catatan {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.card-warga-catatan {
  font-style: italic;
  color: var(--text-tertiary);
}

.card-warga-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 2px;
}

.card-warga-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.card-warga-actions .btn { flex: 1 1 auto; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.4;
  text-align: left;
}

.badge-success { background: var(--success-soft); color: var(--success); border-color: rgba(21,122,62,.2); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(146,98,10,.2); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: rgba(179,38,30,.2); }
.badge-neutral { background: var(--neutral-soft); color: var(--neutral); border-color: rgba(91,103,116,.18); }

.empty-state {
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 52px 24px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }

.empty-state p {
  margin: 0 0 18px;
  font-size: 14px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

.error-state { border-color: rgba(179, 38, 30, 0.25); }

.skeleton-card {
  height: 150px;
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface-3) 45%, var(--surface-2) 60%);
  background-size: 300% 100%;
  animation: shimmer 1.5s ease infinite;
  border: 1px solid var(--border);
}

@keyframes shimmer {
  0% { background-position: 120% 50%; }
  100% { background-position: -20% 50%; }
}

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 60%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-inset);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 18px;
}

.detail-avatar {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-inset-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.detail-info { flex: 1; min-width: 0; }

.detail-info h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.detail-meta {
  margin: 3px 0 0;
  font-size: 13.5px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.detail-catatan { font-style: italic; color: var(--text-tertiary); }

.rekap { margin-bottom: 18px; }

.rekap-card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 60%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-inset);
  border: 1px solid var(--border);
  padding: 20px;
}

.rekap-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.rekap-summary-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

@media (min-width: 560px) {
  .rekap-summary-row { grid-template-columns: repeat(4, 1fr); }
}

.rekap-summary-item {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-inset-soft);
  padding: 12px 14px;
}

.rekap-summary-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.rekap-summary-value {
  display: block;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: var(--shadow-inset-soft);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--primary);
  transition: width 0.5s ease;
}

.progress-label {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.rekap-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pemakaian-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 700px) {
  .pemakaian-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1080px) {
  .pemakaian-grid { grid-template-columns: repeat(3, 1fr); }
}

.card-pemakaian { padding: 18px 20px; }

.card-pemakaian-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-pemakaian-bulan {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text);
}

.card-pemakaian-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-bottom: 12px;
}

.field { display: flex; flex-direction: column; gap: 3px; }

.field-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field-value {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.card-pemakaian-dates {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  color: var(--text-secondary);
  padding-top: 10px;
  margin-top: 2px;
  border-top: 1px solid var(--border);
}

.card-pemakaian-catatan {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  overflow-wrap: anywhere;
}

.card-pemakaian-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.card-pemakaian-actions .btn { flex: 1 1 auto; }

#modal-overlay, #confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  animation: overlayIn 0.18s ease;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#modal-box, .confirm-box {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
  animation: modalIn 0.22s cubic-bezier(.4,0,.2,1);
}

.confirm-box { max-width: 380px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

#modal-box h3, .confirm-box h3 {
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--text);
}

.confirm-box p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

#modal-box label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

#modal-box input, #modal-box select, #modal-box textarea { width: 100%; }

#modal-box .modal-actions, .confirm-box .modal-actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.form-hint {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--text-tertiary);
}

.form-warning {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid rgba(179, 38, 30, 0.25);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 13px;
}

.gabung-tunggakan-box {
  margin-top: 16px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.gabung-tunggakan-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 4px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.gabung-tunggakan-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

#toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--neutral);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 13px 15px;
  font-size: 13.5px;
  color: var(--text);
  animation: toastIn 0.22s ease;
}

.toast.is-leaving { animation: toastOut 0.18s ease forwards; }

.toast-danger { border-left-color: var(--danger); }
.toast-success { border-left-color: var(--success); }
.toast-info { border-left-color: var(--primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(16px); }
}

@media (max-width: 899px) {
  .drawer-open { display: flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-modal);
  }
  .sidebar.is-open { transform: translateX(0); }
  .drawer-close { display: flex; }
  .topbar { padding: 14px 16px; }
  #content { padding: 16px 14px 48px; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-sub { font-size: 11.5px; }
}

@media (max-width: 699px) {
  .toolbar { flex-direction: column; }
  .toolbar .btn { width: 100%; }
  .search-wrap { flex: none; width: 100%; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .sort-select { width: 100%; }
  .card-warga-actions .btn,
  .card-pemakaian-actions .btn { min-width: 0; }
  #toast-stack { left: 12px; right: 12px; top: 12px; max-width: none; }
}

.export-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-field select,
.export-field input {
  min-width: 160px;
}

.export-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
}

.export-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.export-table th,
.export-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.export-table th {
  background: var(--surface-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.export-table tbody tr:last-child td { border-bottom: none; }

@media (max-width: 699px) {
  .export-field select,
  .export-field input { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}