/* Palet Tailwind: slate (netral), indigo (utama), emerald / amber / rose (status). */
:root {
  --brand: #4f46e5;       /* indigo-600 */
  --brand-600: #6366f1;   /* indigo-500 */
  --brand-50: #eef2ff;    /* indigo-50 */
  --on-brand: #ffffff;
  --btn-from: #6366f1;    /* indigo-500 */
  --btn-to: #4338ca;      /* indigo-700 */

  --dark: #0f172a;        /* slate-900 */
  --dark-2: #312e81;      /* indigo-900 */
  --accent: #a5b4fc;      /* indigo-300 */
  --accent-ink: #1e1b4b;  /* indigo-950 */
  --amber: #f59e0b;       /* amber-500 */

  --success: #047857;     /* emerald-700 */
  --success-bg: #d1fae5;  /* emerald-100 */
  --warning: #b45309;     /* amber-700 */
  --warning-bg: #fef3c7;  /* amber-100 */
  --danger: #be123c;      /* rose-700 */
  --danger-bg: #ffe4e6;   /* rose-100 */

  --bg: #f1f5f9;          /* slate-100 */
  --surface: #ffffff;
  --surface-2: #f8fafc;   /* slate-50 */
  --text: #0f172a;        /* slate-900 */
  --text-muted: #64748b;  /* slate-500 */
  --border: #e2e8f0;      /* slate-200 */
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -12px rgba(15, 23, 42, 0.12);
  --shadow-lift: 0 14px 28px -12px rgba(79, 70, 229, 0.5);
  --bar: #1e293b;         /* slate-800 */
  --chip-on-bg: var(--dark);
  --chip-on-fg: #ffffff;
  --glow-1: rgba(99, 102, 241, 0.14);
  --glow-2: rgba(56, 189, 248, 0.10);

  --radius: 22px;
  --radius-sm: 14px;
  --nav-h: 64px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Poppins", var(--font);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #818cf8;       /* indigo-400 */
  --brand-600: #6366f1;
  --brand-50: #1e1b4b;    /* indigo-950 */
  --on-brand: #1e1b4b;
  --btn-from: #a5b4fc;    /* indigo-300 */
  --btn-to: #818cf8;      /* indigo-400 */
  --dark: #1e1b4b;        /* indigo-950 */
  --dark-2: #3730a3;      /* indigo-800 */
  --success: #34d399;     /* emerald-400 */
  --success-bg: #022c22;  /* emerald-950 */
  --warning: #fbbf24;     /* amber-400 */
  --warning-bg: #451a03;  /* amber-950 */
  --danger: #fb7185;      /* rose-400 */
  --danger-bg: #4c0519;   /* rose-950 */
  --bg: #020617;          /* slate-950 */
  --surface: #0f172a;     /* slate-900 */
  --surface-2: #1e293b;   /* slate-800 */
  --text: #e2e8f0;        /* slate-200 */
  --text-muted: #94a3b8;  /* slate-400 */
  --border: #334155;      /* slate-700 */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 14px 28px -14px rgba(129, 140, 248, 0.45);
  --bar: #475569;         /* slate-600 */
  --chip-on-bg: var(--accent);
  --chip-on-fg: var(--accent-ink);
  --glow-1: rgba(99, 102, 241, 0.10);
  --glow-2: rgba(56, 189, 248, 0.05);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 105% -8%, var(--glow-1), transparent 62%),
    radial-gradient(760px 460px at -12% 4%, var(--glow-2), transparent 62%),
    var(--bg);
  background-repeat: no-repeat;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, p, dl, dd, ol, ul { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

:focus-visible { outline: 3px solid var(--brand-600); outline-offset: 2px; border-radius: 8px; }

[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--dark); color: #fff; padding: 8px 14px; border-radius: 999px; z-index: 60; }
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--text-muted); font-size: 0.875rem; }
.label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  padding-top: env(safe-area-inset-top);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 70px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { border-radius: 14px; flex-shrink: 0; width: 44px; height: 44px; box-shadow: 0 8px 18px -8px rgba(15, 23, 42, 0.35); }
.brand-eyebrow { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-title { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.top-nav { display: none; gap: 2px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.top-nav a { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.875rem; padding: 8px 14px; border-radius: 999px; transition: background 0.2s, color 0.2s; }
.top-nav a:hover { color: var(--text); }
.top-nav a.is-active { color: var(--chip-on-fg); background: var(--chip-on-bg); }
.header-actions .header-cta { display: none; min-height: 42px; }

.theme-toggle {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; box-shadow: var(--shadow); transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--brand-600); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Layout blocks ---------- */
.block { padding-top: 28px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.block > *, .section-grid > *, .section-card > * { min-width: 0; }
.block-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 16px; padding: 8px 2px 2px; }
.block-head h2 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.block-head-action { align-items: flex-end; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; justify-self: start;
  padding: 8px 14px; border-radius: 999px; background: var(--brand-50); color: var(--brand);
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
}
.eyebrow svg { width: 16px; height: 16px; }
.eyebrow-sm { padding: 4px 11px; font-size: 0.6875rem; margin-bottom: 8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-head { display: grid; gap: 2px; margin-bottom: 14px; }
.card-head h3 { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }

/* ---------- Intro (hero teks) ---------- */
.intro { display: grid; gap: 16px; padding: 10px 2px 6px; align-content: center; }
.intro-title { font-family: var(--font-display); font-size: clamp(2rem, 8.2vw, 3.4rem); font-weight: 800; line-height: 1.08; letter-spacing: -0.03em; }
.highlight { color: var(--brand); position: relative; white-space: nowrap; }
.highlight::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -0.14em; height: 0.3em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath d='M3 10C55 3 140 2 197 8' fill='none' stroke='%23f59e0b' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}
.intro-sub { color: var(--text-muted); font-size: 1.0625rem; line-height: 1.65; max-width: 36em; }
.intro-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px; }
.intro-cta .btn { flex: 1 1 auto; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.intro > *, #ringkasan .hero { animation: rise 0.7s var(--ease) both; }
.intro > :nth-child(2) { animation-delay: 0.06s; }
.intro > :nth-child(3) { animation-delay: 0.12s; }
.intro > :nth-child(4) { animation-delay: 0.18s; }
#ringkasan .hero { animation-delay: 0.22s; }

/* ---------- Kartu gelap (progress & rekening) ---------- */
.hero, .rekening {
  position: relative; overflow: hidden; border: none; color: #ffffff;
  background: radial-gradient(120% 90% at 100% 0%, var(--dark-2) 0%, transparent 58%), var(--dark);
  box-shadow: 0 26px 50px -26px rgba(15, 23, 42, 0.7);
  padding: 22px; border-radius: 26px;
}
:root[data-theme="dark"] .hero, :root[data-theme="dark"] .rekening { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.hero > *, .rekening > * { position: relative; }
.hero-deco {
  position: absolute !important; width: 150px; height: 150px; right: -34px; top: -34px;
  stroke: var(--accent); stroke-width: 11; opacity: 0.95; pointer-events: none;
}
.pill-dark { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); font-size: 0.8125rem; font-weight: 700; color: #ffffff; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(165, 180, 252, 0.25); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(165, 180, 252, 0.06); } }

.hero-pct { font-family: var(--font-display); font-size: 3.5rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; margin-top: 18px; font-variant-numeric: tabular-nums; }
.hero-pct small { font-size: 0.5em; margin-left: 2px; color: var(--accent); }
.hero-caption { color: rgba(255, 255, 255, 0.66); font-size: 0.875rem; margin-top: 6px; }
.hero .progress { background: rgba(255, 255, 255, 0.12); border: none; margin: 18px 0; }
.hero .progress-fill { background: linear-gradient(90deg, #818cf8, var(--accent)); }
.hero-stats { display: grid; gap: 1px; background: rgba(255, 255, 255, 0.08); border-radius: var(--radius-sm); overflow: hidden; }
.hero-stats div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; background: rgba(255, 255, 255, 0.04); padding: 11px 14px; }
.hero-stats dt { font-size: 0.875rem; color: rgba(255, 255, 255, 0.66); font-weight: 600; }
.hero-stats dd { font-family: var(--font-display); font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-stats .text-danger { color: #fcd34d; }

/* ---------- Progress ---------- */
.progress { --value: 0%; position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress-lg { height: 12px; }
.progress-sm { height: 6px; border: none; background: var(--border); }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: var(--value); background: linear-gradient(90deg, var(--brand-600), var(--brand)); border-radius: inherit; transition: width 0.8s var(--ease); }
.tone-success .progress-fill { background: var(--success); }
.tone-warning .progress-fill { background: var(--warning); }
.tone-danger .progress-fill { background: var(--danger); }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.kpi { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: center; align-content: start; padding: 18px; }
.kpi-icon { grid-column: 2; grid-row: 1; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.kpi-icon svg { width: 17px; height: 17px; }
.kpi-success .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi-danger .kpi-icon { background: var(--danger-bg); color: var(--danger); }
.kpi-label { grid-column: 1; grid-row: 1; font-size: 0.875rem; font-weight: 600; color: var(--text-muted); line-height: 1.3; }
.kpi-value { grid-column: 1 / -1; font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 14px; }
.kpi-sub { grid-column: 1 / -1; font-size: 0.8125rem; color: var(--text-muted); margin-top: 6px; }

/* ---------- Status stacked bar ---------- */
.stacked-bar { display: flex; height: 40px; border-radius: 12px; overflow: hidden; gap: 3px; }
.stacked-bar span { display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 0.875rem; min-width: 28px; transition: width 0.8s var(--ease); }
.stacked-bar span:first-child { border-radius: 12px 4px 4px 12px; }
.stacked-bar span:last-child { border-radius: 4px 12px 12px 4px; }
.stacked-bar span:only-child { border-radius: 12px; }
.bg-success { background: #059669; }
.bg-warning { background: #d97706; }
.bg-danger { background: #e11d48; }
.legend { display: grid; gap: 8px; margin-top: 14px; }
.legend li { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "dot label value" "dot meta meta"; column-gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.legend .dot { grid-area: dot; }
.legend-label { grid-area: label; font-weight: 600; }
.legend-value { grid-area: value; font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend-meta { grid-area: meta; font-size: 0.8125rem; color: var(--text-muted); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- Section cards ---------- */
.section-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.section-card { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.section-meta { font-size: 0.875rem; font-weight: 600; color: var(--text-muted); margin-top: 10px; }
.tag { display: inline-flex; align-items: center; padding: 5px 13px; border-radius: 999px; background: var(--dark); color: var(--accent); font-weight: 700; font-size: 0.8125rem; }
.section-pct { font-family: var(--font-display); font-size: 2.25rem; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -0.02em; }
.section-pct small { font-size: 0.55em; }
.section-raised { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.section-raised b { font-family: var(--font-display); font-size: 1.375rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.section-status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.section-status div { display: grid; gap: 2px; justify-items: center; text-align: center; padding: 10px 4px; border-radius: var(--radius-sm); background: var(--surface-2); }
.section-status dt { font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.section-status dd { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.section-status .tone-success dd { color: var(--success); }
.section-status .tone-warning dd { color: var(--warning); }
.section-status .tone-danger dd { color: var(--danger); }
.section-status .tone-sisa dd { font-size: 0.875rem; line-height: 1.7; white-space: nowrap; }
.section-more { border-top: 1px dashed var(--border); padding-top: 4px; }
.section-more summary { cursor: pointer; font-weight: 700; font-size: 0.875rem; color: var(--brand); padding: 8px 0; list-style-position: inside; }
.section-more .table-scroll { margin-top: 4px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th, .data-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table thead th { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; white-space: nowrap; background: var(--surface-2); border-bottom: none; }
.data-table thead th:first-child { border-radius: 10px 0 0 10px; }
.data-table thead th:last-child { border-radius: 0 10px 10px 0; }
.data-table .num { text-align: right; }
.data-table tbody th { font-weight: 600; white-space: nowrap; }
.data-table tfoot th, .data-table tfoot td { font-weight: 800; border-bottom: none; }
.data-table.compact { font-size: 0.8125rem; }
.data-table.compact th, .data-table.compact td { padding: 9px 6px; }
.status-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.status-label .dot { width: 10px; height: 10px; }

/* ---------- Badges & chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.badge-lg { font-size: 0.875rem; padding: 6px 14px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

.toolbar { display: grid; gap: 12px; }
.search { display: flex; align-items: center; gap: 10px; padding: 0 18px; min-height: 52px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); transition: border-color 0.2s, box-shadow 0.2s; }
.search:focus-within { border-color: var(--brand-600); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-600) 18%, transparent); }
.search svg { color: var(--text-muted); }
.search input { flex: 1; border: none; outline: none; background: transparent; min-height: 50px; font-size: 16px; min-width: 0; }
.filter-row { display: grid; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 0.8125rem; font-weight: 700; cursor: pointer; transition: all 0.2s; }
.chip:hover { border-color: var(--brand-600); }
.chip.is-active { background: var(--chip-on-bg); border-color: var(--chip-on-bg); color: var(--chip-on-fg); }
.chip-success.is-active { background: var(--success); border-color: var(--success); color: #fff; }
.chip-warning.is-active { background: var(--warning); border-color: var(--warning); color: #fff; }
.chip-danger.is-active { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme="dark"] .chip-success.is-active,
:root[data-theme="dark"] .chip-warning.is-active,
:root[data-theme="dark"] .chip-danger.is-active { color: #0b1120; }
.result-count { font-weight: 600; }

/* ---------- Warga list ---------- */
.warga-list { display: grid; gap: 16px; }
.group-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 1rem; font-weight: 600; padding: 0 4px; }
.group-count { margin-left: auto; font-family: var(--font); font-size: 0.8125rem; color: var(--text-muted); font-weight: 600; }
.list-card { padding: 6px; }
.list-card li + li { border-top: 1px solid var(--border); }
.warga-item {
  width: 100%; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px;
  padding: 12px 10px; background: none; border: none; text-align: left; cursor: pointer; border-radius: 14px; transition: background 0.15s;
}
.warga-item:hover { background: var(--surface-2); }
.warga-item:active { background: var(--brand-50); }
.warga-no { width: 42px; height: 42px; border-radius: 13px; background: var(--dark); color: var(--accent); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.warga-main { display: grid; gap: 4px; min-width: 0; }
.warga-name { font-weight: 700; font-size: 0.9375rem; line-height: 1.3; overflow-wrap: anywhere; }
.warga-meta { font-size: 0.75rem; color: var(--text-muted); }
.warga-side { display: grid; justify-items: end; gap: 3px; text-align: right; }
.warga-amount { font-weight: 700; font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.warga-sisa { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; display: grid; gap: 10px; justify-items: center; padding: 32px 16px; }

/* ---------- Peta rumah ---------- */
.peta { display: grid; gap: 18px; }
.peta .card-head { margin-bottom: 0; }
.peta-legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.8125rem; font-weight: 600; }
.peta-legend li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); }
.peta-legend li.muted { background: none; padding: 5px 2px; }
.peta-legend .dot { width: 10px; height: 10px; }
.peta-section { display: grid; gap: 10px; }
.peta-title { font-family: var(--font-display); font-size: 0.9375rem; font-weight: 600; }
.peta-title span { font-family: var(--font); color: var(--text-muted); font-weight: 600; font-size: 0.8125rem; }
.peta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.rumah {
  --tone: var(--brand); --tone-bg: var(--brand-50);
  position: relative; display: grid; justify-items: center; align-content: center; gap: 0;
  min-height: 58px; padding: 6px 4px 11px; border-radius: 14px; overflow: hidden; cursor: pointer;
  background: var(--tone-bg); color: var(--tone);
  border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent);
  transition: transform 0.2s var(--ease), opacity 0.2s, box-shadow 0.2s;
}
.rumah:hover { transform: translateY(-2px); box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--tone) 40%, transparent); }
.rumah:active { transform: scale(0.97); }
.rumah.tone-success { --tone: var(--success); --tone-bg: var(--success-bg); }
.rumah.tone-warning { --tone: var(--warning); --tone-bg: var(--warning-bg); }
.rumah.tone-danger { --tone: var(--danger); --tone-bg: var(--danger-bg); }
.rumah.is-dim { opacity: 0.22; }
.rumah-no { font-family: var(--font-display); font-size: 1rem; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.rumah-pct { font-size: 0.6875rem; font-weight: 700; opacity: 0.85; font-variant-numeric: tabular-nums; }
.rumah-bar { position: absolute; left: 7px; right: 7px; bottom: 5px; height: 3px; border-radius: 99px; background: color-mix(in srgb, var(--tone) 18%, transparent); }
.rumah-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--value); border-radius: inherit; background: var(--tone); }

/* ---------- Bar chart ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 230px; overflow-x: auto; padding-bottom: 4px; }
.bar { flex: 1 1 0; min-width: 40px; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; gap: 6px; height: 100%; }
.bar-value { font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.bar-track { width: 100%; max-width: 40px; display: flex; align-items: flex-end; height: 100%; border-radius: 12px; background: var(--surface-2); }
.bar-fill { width: 100%; background: var(--bar); border-radius: 12px; min-height: 6px; transition: height 0.8s var(--ease); }
.bar:last-child .bar-fill { background: var(--brand-600); }
.bar:last-child .bar-value { color: var(--text); }
.bar-label { font-size: 0.6875rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }

/* ---------- Info ---------- */
.rekening { display: grid; gap: 4px; justify-items: start; align-content: start; }
.rekening-bank { font-weight: 800; font-size: 1rem; color: var(--accent); margin-top: 16px; }
.rekening-no { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: 0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.rekening-nama { color: rgba(255, 255, 255, 0.7); font-size: 0.9375rem; }
.rekening .btn { margin-top: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 0.9375rem; cursor: pointer; border: 1px solid transparent; transition: transform 0.2s var(--ease), box-shadow 0.2s, filter 0.2s, background 0.2s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(0.98); }
.btn-pill { border-radius: 999px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 1rem; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 0.8125rem; }
.btn-primary { background: linear-gradient(135deg, var(--btn-from), var(--btn-to)); color: var(--on-brand); box-shadow: var(--shadow-lift); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.btn-light:hover { border-color: var(--brand-600); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-outline { border-color: var(--border); color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.btn-outline:hover { border-color: var(--brand-600); color: var(--brand); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn svg { width: 18px; height: 18px; }
.btn-block { display: flex; width: 100%; margin-top: 16px; }
.chart-note { margin-top: 12px; font-size: 0.8125rem; }
.chart-note:empty { display: none; }

.data-check:empty { display: none; }
.data-check { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.check-title { font-size: 0.9375rem; font-weight: 800; margin-bottom: 8px; }
.check-list { display: grid; gap: 6px; }
.check-list li { display: grid; gap: 2px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--border); font-size: 0.875rem; }
.check-list li span { color: var(--text-muted); }
.check-list .check-error { border-left-color: var(--danger); }
.check-list .check-warn { border-left-color: var(--warning); }
.check-list .check-info { border-left-color: var(--success); }
.check-more { margin-top: 10px; }
.check-more summary { cursor: pointer; font-weight: 700; font-size: 0.875rem; padding: 6px 0; }

.data-source .card-head { margin-bottom: 6px; }

/* ---------- Statistik pengunjung (pengurus) ---------- */
.card-head-action { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-head-action .btn-row { margin-top: 0; }
.stats-login { display: flex; flex-wrap: wrap; gap: 8px; }
.stats-login input { flex: 1 1 220px; min-height: 46px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); font-size: 16px; color: var(--text); outline: none; }
.stats-login input:focus { border-color: var(--brand-600); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-600) 18%, transparent); }
.stats-error { margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--danger-bg); color: var(--danger); font-weight: 600; font-size: 0.875rem; }
.stats-kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stats-kpi > div { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.stats-kpi dt { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.stats-kpi dd { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stats-kpi .stats-kpi-sub { font-family: inherit; font-size: 0.75rem; font-weight: 500; color: var(--text-muted); margin-top: 2px; }
.stats-sub, .stats-list h4 { font-size: 0.8125rem; font-weight: 700; color: var(--text-muted); margin: 18px 0 10px; }
.stats-chart { height: 170px; }
.stats-chart .bar { min-width: 30px; }
.stats-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); column-gap: 16px; margin-bottom: 8px; }
.stats-list ul { display: grid; gap: 4px; }
.stats-list li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 12px; border-radius: 10px; background: var(--surface-2); font-size: 0.875rem; }
.stats-list li b { font-variant-numeric: tabular-nums; }
.visitor-stats .data-table td { vertical-align: top; }
.visitor-stats .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8125rem; white-space: nowrap; }
.visitor-stats .mono a { color: var(--brand); }
.visitor-stats .nowrap { white-space: nowrap; }
.stats-alert { margin: 6px 0 10px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warning-bg); color: var(--warning); font-weight: 600; font-size: 0.875rem; }
.stats-log-ringkas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; font-size: 0.8125rem; }

/* ---------- Footer ---------- */
.app-footer {
  margin-top: 36px; display: flex; align-items: center; gap: 14px; padding: 18px 20px;
  border-radius: 26px; background: var(--dark); color: #ffffff;
}
:root[data-theme="dark"] .app-footer { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.app-footer img { width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0; }
.footer-title { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.footer-sub { font-size: 0.8125rem; color: rgba(255, 255, 255, 0.66); }
.live-status { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--accent); font-weight: 600; }
.live-status:empty { display: none; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px;
  height: var(--nav-h); border-radius: 24px;
  background: color-mix(in srgb, var(--dark) 94%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.bottom-nav a { display: grid; place-items: center; align-content: center; gap: 2px; border-radius: 18px; text-decoration: none; color: rgba(255, 255, 255, 0.62); font-size: 0.6875rem; font-weight: 700; transition: color 0.2s, background 0.2s; }
.bottom-nav a svg { width: 21px; height: 21px; }
.bottom-nav a.is-active { color: var(--accent-ink); background: var(--accent); }

/* ---------- Detail sheet ---------- */
.sheet {
  border: none; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); margin: auto auto 0; width: 100%; max-width: 560px;
  max-height: 88vh; max-height: 88dvh; overflow-y: auto; border-radius: 28px 28px 0 0;
  background: var(--surface); color: var(--text); box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
}
.sheet[open] { animation: sheet-up 0.32s var(--ease); }
.sheet::backdrop { background: rgba(2, 6, 23, 0.6); backdrop-filter: blur(3px); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 44px; height: 5px; border-radius: 999px; background: var(--border); margin: 4px auto 12px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.detail-head h2 { font-family: var(--font-display); font-size: 1.3125rem; font-weight: 700; line-height: 1.3; margin-top: 4px; letter-spacing: -0.01em; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; flex-shrink: 0; }
.detail-status { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 10px; }
.detail-pct { font-family: var(--font-display); font-size: 1.875rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 16px; }
.detail-grid div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 11px 13px; }
.detail-grid dt { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; }
.detail-grid dd { font-weight: 700; font-variant-numeric: tabular-nums; }
.detail-note { margin-top: 10px; }
.detail-grid .detail-wide { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; }
.note { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warning-bg); color: var(--warning); font-size: 0.875rem; font-weight: 600; }
.detail-sub { font-family: var(--font-display); font-size: 1rem; font-weight: 600; margin: 20px 0 10px; }
.timeline { display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 20px 1fr auto; grid-template-areas: "dot title amount" "dot date amount"; column-gap: 12px; padding: 10px 0; position: relative; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 9px; top: 28px; bottom: -8px; width: 2px; background: var(--border); }
.timeline-dot { grid-area: dot; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); margin-top: 2px; z-index: 1; }
.is-paid .timeline-dot { background: var(--success); border-color: var(--success); box-shadow: inset 0 0 0 3px var(--surface); }
.timeline-title { grid-area: title; font-weight: 700; font-size: 0.9375rem; }
.timeline-date { grid-area: date; font-size: 0.8125rem; color: var(--text-muted); }
.timeline-amount { grid-area: amount; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.is-empty .timeline-title, .is-empty .timeline-amount { color: var(--text-muted); font-weight: 600; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); z-index: 70;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 0.875rem;
  box-shadow: 0 12px 30px -12px rgba(15, 23, 42, 0.6);
  transition: all 0.25s ease; max-width: calc(100% - 32px); text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Small phones ---------- */
@media (max-width: 380px) {
  .hero-pct { font-size: 3rem; }
  .kpi { padding: 14px; }
  .kpi-label { font-size: 0.8125rem; }
  .kpi-icon { width: 28px; height: 28px; border-radius: 9px; }
  .kpi-icon svg { width: 15px; height: 15px; }
  .kpi-value { font-size: 1.375rem; margin-top: 10px; }
  .section-status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warga-item { grid-template-columns: 38px 1fr; }
  .warga-no { width: 38px; height: 38px; }
  .warga-side { grid-column: 2; justify-items: start; text-align: left; grid-auto-flow: column; justify-content: start; align-items: center; gap: 8px; }
}

/* ---------- Tablet ---------- */
@media (min-width: 640px) {
  .container { padding: 0 24px; }
  .header-actions .header-cta { display: inline-flex; }
  .intro-cta .btn { flex: 0 0 auto; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .legend { grid-template-columns: repeat(3, 1fr); }
  .scroll-hint { display: none; }
  .filter-row { grid-template-columns: auto 1fr; align-items: center; }
  .detail-grid { grid-template-columns: repeat(4, 1fr); }
  .block-head h2 { font-size: 1.75rem; }
}

/* ---------- Desktop ---------- */
@media (min-width: 960px) {
  body { padding-bottom: 32px; }
  .bottom-nav { display: none; }
  .top-nav { display: flex; }
  .toast { bottom: 24px; }
  .block { padding-top: 48px; gap: 18px; }
  .card { padding: 22px; }
  .kpi { padding: 20px 22px; }
  .kpi-value { font-size: 1.875rem; }
  #ringkasan { padding-top: 40px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); column-gap: 40px; align-items: center; }
  #ringkasan .kpi-grid, #ringkasan .status-card { grid-column: 1 / -1; }
  .hero { padding: 30px; }
  .hero-pct { font-size: 4.75rem; margin-top: 24px; }
  .hero-deco { width: 190px; height: 190px; right: -40px; top: -40px; }
  .section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #info:has(#dataSource:not([hidden])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #info .block-head, #info .visitor-stats { grid-column: 1 / -1; }
  .rekening { padding: 30px; }
  .sheet { margin: auto; border-radius: 28px; max-height: 85vh; padding-top: 24px; }
  .sheet-handle { display: none; }
  .list-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; }
  .list-card li:nth-child(2) { border-top: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
