/* ID KaMu — sistem tampilan
   Arah: "Monochrome + Pop" — charcoal + putih hangat + satu aksen merah api.
   Semua warna lewat token; komponen tidak boleh memakai hex langsung. */

/* ───────────── Token ───────────── */
:root {
  color-scheme: light;
  --brand: #E11D48;          /* latar tombol utama (teks putih 4,7:1) */
  --brand-hover: #BE123C;
  --brand-text: #BE123C;     /* teks/link merah kecil */
  --brand-soft: #FFF1F2;
  --on-brand: #FFFFFF;
  --logo-red: #FA003F;       /* hanya untuk logo */

  --bg: #FAF8F8;
  --surface: #FFFFFF;
  --surface-2: #F4F0F0;
  --border: rgb(28 21 23 / .09);   /* garis dekoratif */
  --border-strong: #8C7E81;        /* tepi kolom isian, ≥3:1 (WCAG 1.4.11) */
  --text: #1C1517;
  --text-2: #6B5F62;

  --success: #047857;  --success-bg: #ECFDF5;
  --warning: #B45309;  --warning-bg: #FFFBEB;
  --danger:  #B91C1C;  --danger-bg:  #FEF2F2;
  --neutral: #475569;  --neutral-bg: #F1F5F9;

  --rt1-bg: #DBEAFE; --rt1: #1E40AF;
  --rt2-bg: #D1FAE5; --rt2: #065F46;
  --rt3-bg: #FEF3C7; --rt3: #92400E;

  /* Overlay scan: sama di terang/gelap, teks putih ≥5:1 */
  --scan-ok: #047857; --scan-warn: #B45309; --scan-err: #B91C1C;
  --on-scan: #FFFFFF; --scan-ink: #1C1517;

  --shadow: 0 1px 2px rgb(28 21 23 / .06), 0 4px 16px rgb(28 21 23 / .06);
  --focus: 0 0 0 3px rgb(225 29 72 / .35);

  /* Skala huruf: satu momen display per layar */
  --text-display: clamp(2.25rem, 10vw, 3rem);
  --text-stat: clamp(1.75rem, 7vw, 2.25rem);
  --text-h1: clamp(1.625rem, 6vw, 2rem);
  --text-h2: 1.25rem; --text-h3: 1.0625rem;
  --text-sm: .875rem; --text-xs: .8125rem; --text-label: .75rem;

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 8px; --r: 14px; --r-lg: 20px; --r-full: 999px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --tap: 48px;
  --nav-h: 64px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-micro: 150ms; --t-small: 250ms; --t-medium: 400ms;
}

/* Gelap: dipakai saat dipilih manual, atau mengikuti HP jika belum dipilih. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand-text: #FB7185; --brand-soft: #3B1219;
  --bg: #141011; --surface: #1E191A; --surface-2: #262022; --border: rgb(255 255 255 / .08); --border-strong: #807275;
  --text: #F7F3F3; --text-2: #A89DA0;
  --success: #34D399; --success-bg: #0B3B2C;
  --warning: #FBBF24; --warning-bg: #3D2405;
  --danger:  #F87171; --danger-bg:  #3F1212;
  --neutral: #A1A1AA; --neutral-bg: #27272A;
  --rt1-bg: #1E3A8A; --rt1: #BFDBFE;
  --rt2-bg: #064E3B; --rt2: #A7F3D0;
  --rt3-bg: #78350F; --rt3: #FDE68A;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
  --focus: 0 0 0 3px rgb(251 113 133 / .45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand-text: #FB7185; --brand-soft: #3B1219;
    --bg: #141011; --surface: #1E191A; --surface-2: #262022; --border: rgb(255 255 255 / .08); --border-strong: #807275;
    --text: #F7F3F3; --text-2: #A89DA0;
    --success: #34D399; --success-bg: #0B3B2C;
    --warning: #FBBF24; --warning-bg: #3D2405;
    --danger:  #F87171; --danger-bg:  #3F1212;
    --neutral: #A1A1AA; --neutral-bg: #27272A;
    --rt1-bg: #1E3A8A; --rt1: #BFDBFE;
    --rt2-bg: #064E3B; --rt2: #A7F3D0;
    --rt3-bg: #78350F; --rt3: #FDE68A;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 4px 16px rgb(0 0 0 / .3);
    --focus: 0 0 0 3px rgb(251 113 133 / .45);
  }
}

/* ───────────── Dasar ───────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: var(--text-h1); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: var(--text-h2); font-weight: 800; }
h3 { font-size: var(--text-h3); font-weight: 800; }
p { margin: 0; }
a { color: var(--brand-text); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 480px; margin: 0 auto; padding: var(--s-4); }
.stack { display: grid; gap: var(--s-3); }
.stack-lg { display: grid; gap: var(--s-5); }
.row-flex { display: flex; align-items: center; gap: var(--s-2); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.label-caps { font-size: var(--text-label); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ───────────── Header ───────────── */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-3);
  max-width: 480px; margin: 0 auto;
  padding: calc(var(--s-3) + env(safe-area-inset-top)) var(--s-4) var(--s-3);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.app-header .logo { width: 40px; height: 40px; }
.app-header .title { flex: 1; min-width: 0; }
.app-header .title b { display: block; font-weight: 800; letter-spacing: -0.01em; }
.app-header .title span { display: block; font-size: .8125rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .chip { flex: none; }
.app-header .title span span { display: inline; } /* mis. "ID KaMu · Petugas" tetap satu baris */
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}

/* ───────────── Tombol ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-5);
  border: 1.5px solid transparent; border-radius: var(--r);
  font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer; user-select: none;
  transition: background-color var(--t-micro) var(--ease), border-color var(--t-micro) var(--ease), transform var(--t-micro) var(--ease);
}
.btn:active { transform: scale(.98); }
.btn:has(input:focus-visible) { box-shadow: var(--focus); } /* label-tombol yang membungkus input file */
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-success { background: var(--success-bg); color: var(--success); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.0625rem; }
.btn-sm { min-height: 40px; padding: 0 var(--s-3); font-size: .875rem; border-radius: var(--r-sm); }
.btn-icon { width: var(--tap); padding: 0; border-radius: var(--r-full); }
@media (hover: hover) {
  .btn-primary:hover { background: var(--brand-hover); }
  .btn-secondary:hover, .btn-ghost:hover { background: var(--surface-2); }
}
.btn[aria-busy="true"] { color: transparent; position: relative; pointer-events: none; }
.btn[aria-busy="true"]::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid currentColor; border-color: var(--on-brand) var(--on-brand) transparent transparent;
  animation: spin .7s linear infinite;
}
.btn-secondary[aria-busy="true"]::after, .btn-ghost[aria-busy="true"]::after { border-color: var(--text) var(--text) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── Form ───────────── */
.field { display: grid; gap: var(--s-1); }
.label { font-weight: 600; font-size: .9375rem; }
.label .opt { font-weight: 400; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: var(--tap); padding: var(--s-3) var(--s-4);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--r);
  font-size: 1rem; /* ≥16px: iOS tidak zoom saat fokus */
  transition: border-color var(--t-micro) var(--ease);
}
.textarea { min-height: 96px; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--focus); outline: none; }
.input::placeholder { color: var(--text-2); opacity: .8; }
.help { font-size: .8125rem; color: var(--text-2); }
.error-text { display: none; font-size: .875rem; font-weight: 600; color: var(--danger); }
.field.invalid .input, .field.invalid .select, .field.invalid .textarea, .field.invalid .radio-cards label { border-color: var(--danger); }
.field.invalid .error-text { display: block; }
.date-3 { display: grid; grid-template-columns: 1fr 1.4fr 1.2fr; gap: var(--s-2); }
.date-3 .select { padding-left: var(--s-3); padding-right: 26px; background-position: calc(100% - 15px) 50%, calc(100% - 9px) 50%; }

/* Kartu radio besar (pilihan RT) */
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-2); }
.radio-cards input { position: absolute; opacity: 0; pointer-events: none; }
.radio-cards label {
  display: grid; place-items: center; min-height: 56px; padding: var(--s-2);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--r);
  font-weight: 600; cursor: pointer;
  transition: border-color var(--t-micro) var(--ease), background-color var(--t-micro) var(--ease);
}
.radio-cards input:checked + label { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-text); }
.radio-cards input:focus-visible + label { box-shadow: var(--focus); }

/* Checkbox besar */
.check { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3); background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--r); cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.field.invalid .check { border-color: var(--danger); }

/* Saklar */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: var(--tap); cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 52px; height: 30px; flex: none; margin: 0; border-radius: var(--r-full); background: var(--border-strong); position: relative; cursor: pointer; transition: background-color var(--t-small) var(--ease); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--on-brand); box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform var(--t-small) var(--ease); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(22px); }

/* ───────────── Kartu, badge, chip ───────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--s-4); box-shadow: var(--shadow); }
.card-flat { box-shadow: none; }

.badge { display: inline-flex; align-items: center; gap: var(--s-1); padding: 2px 10px; border-radius: var(--r-full); font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.badge-rt1 { background: var(--rt1-bg); color: var(--rt1); }
.badge-rt2 { background: var(--rt2-bg); color: var(--rt2); }
.badge-rt3 { background: var(--rt3-bg); color: var(--rt3); }
.badge-brand { background: var(--brand-soft); color: var(--brand-text); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral); }
.badge-count { min-width: 22px; justify-content: center; padding: 0 6px; background: var(--brand); color: var(--on-brand); }

.chip { display: inline-flex; align-items: center; gap: var(--s-2); padding: 6px 12px; border-radius: var(--r-full); font-size: var(--text-xs); font-weight: 600; background: var(--success-bg); color: var(--success); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip[data-state="queue"] { background: var(--warning-bg); color: var(--warning); }
.chip[data-state="offline"] { background: var(--neutral-bg); color: var(--neutral); }
.chip[data-state="sending"]::before { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ───────────── Tab segmen ───────────── */
.tabs { display: flex; gap: var(--s-1); padding: var(--s-1); background: var(--surface-2); border-radius: var(--r); }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: calc(var(--r) - 4px); background: transparent; font-weight: 600; font-size: .9375rem; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.filters { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; min-height: 40px; padding: 0 var(--s-4); border: 1.5px solid var(--border); border-radius: var(--r-full); background: var(--surface); font-weight: 600; font-size: .875rem; cursor: pointer; }
.filters button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

/* ───────────── Daftar anggota ───────────── */
.list { display: grid; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.list-item { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-3) var(--s-4); min-height: 64px; }
.list-item + .list-item { border-top: 1px solid var(--border); }
.list-item.tap { cursor: pointer; transition: background-color var(--t-micro) var(--ease); }
.list-item.tap:active { background: var(--surface-2); }
.list-item .main { flex: 1 1 150px; min-width: 0; }
.list-item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .meta { display: flex; align-items: center; gap: var(--s-2); margin-top: 2px; font-size: .8125rem; color: var(--text-2); white-space: nowrap; }
.list-item .actions { display: flex; gap: var(--s-2); flex: none; margin-left: auto; } /* turun ke baris baru bila sempit */
.avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.avatar-lg { width: 112px; height: 112px; }

/* ───────────── Statistik ───────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-2); }
.stat { padding: var(--s-3) var(--s-2); text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
.stat .n { display: block; font-size: var(--text-stat); font-weight: 800; font-variant-numeric: tabular-nums; line-height: .95; letter-spacing: -0.03em; }
.stat .l { display: block; margin-top: 4px; font-size: var(--text-label); font-weight: 600; color: var(--text-2); }
.stat-total { background: var(--text); border-color: var(--text); color: var(--bg); }
.stat-total .l { color: inherit; opacity: .75; }

/* ───────────── Navigasi bawah & FAB ───────────── */
.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--s-5)); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.bottom-nav .inner { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; max-width: 480px; height: var(--nav-h); }
.nav-item { display: grid; place-items: center; align-content: center; gap: 2px; border: 0; background: none; color: var(--text-2); font-size: var(--text-label); font-weight: 600; text-decoration: none; cursor: pointer; position: relative; }
.nav-item .icon { width: 24px; height: 24px; padding: 0; }
.nav-item[aria-current="page"] { color: var(--brand-text); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; top: 6px; width: 56px; height: 32px; border-radius: var(--r-full); background: var(--brand-soft); z-index: -1; }
.nav-item .badge-count { position: absolute; top: 6px; left: calc(50% + 6px); font-size: .6875rem; min-width: 18px; height: 18px; padding: 0 4px; }

/* Menu 5 item dengan tombol Scan menonjol di tengah (panel admin) */
.bottom-nav .inner.inner-5 { grid-template-columns: repeat(5, 1fr); }
.nav-scan { color: var(--text); }
.nav-scan .nav-scan-btn {
  display: grid; place-items: center; width: 56px; height: 56px; margin-top: -26px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 18px rgb(225 29 72 / .4); border: 4px solid var(--bg);
  transition: transform var(--t-micro) var(--ease);
}
.nav-scan .nav-scan-btn .icon { width: 26px; height: 26px; }
.nav-scan:active .nav-scan-btn { transform: scale(.94); }

/* Pintasan & kartu tombol */
.shortcut-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
.shortcut {
  display: flex; align-items: center; gap: var(--s-3); min-height: 56px; padding: var(--s-3) var(--s-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); color: var(--text);
  font-weight: 600; text-decoration: none; font-size: var(--text-sm);
}
.shortcut .icon { color: var(--brand-text); }
@media (hover: hover) { .shortcut:hover { background: var(--surface-2); } }
button.card { width: 100%; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.br-alert { border-color: var(--warning); background: var(--warning-bg); }
.login-mark { display: grid; place-items: center; width: 88px; height: 88px; border-radius: 28px; background: var(--brand); color: var(--on-brand); }
.login-mark .icon { width: 44px; height: 44px; }

/* Wizard pendaftaran (/sensus) */
fieldset.wz-step { border: 0; margin: 0; min-width: 0; }
fieldset.wz-step.card { padding: var(--s-4); }
fieldset.wz-step:not(.card) { padding: 0; }
.wz-progress { height: 6px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.wz-progress span { display: block; height: 100%; width: 20%; background: var(--brand); border-radius: inherit; transition: width var(--t-medium) var(--ease); }
.wz-nav {
  position: sticky; bottom: 0; z-index: 5; display: grid; grid-template-columns: 1fr 2fr; gap: var(--s-2);
  padding: var(--s-3) 0 calc(var(--s-3) + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 35%);
}
.wz-nav.single { grid-template-columns: 1fr; }
.wz-photo { width: 180px; height: 180px; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); width: 100%; }
.photo-actions .btn { padding: 0 var(--s-3); }
.choice-cards { display: grid; gap: var(--s-3); }
.choice-cards input { position: absolute; opacity: 0; pointer-events: none; }
.choice-cards label {
  display: grid; gap: var(--s-1); min-height: 84px; padding: var(--s-4); cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--r-lg);
  transition: border-color var(--t-micro) var(--ease), background-color var(--t-micro) var(--ease);
}
.choice-cards label b { font-size: 1.0625rem; font-weight: 800; letter-spacing: -0.01em; }
.choice-cards label span { color: var(--text-2); font-size: var(--text-sm); }
.choice-cards input:checked + label { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.choice-cards input:checked + label b { color: var(--brand-text); }
.choice-cards input:focus-visible + label { box-shadow: var(--focus); }
.field.invalid .choice-cards label { border-color: var(--danger); }
.sum-edit { border: 0; background: none; padding: 0; color: var(--brand-text); font-weight: 600; font-size: var(--text-sm); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* Halaman depan (/) */
.hero { display: grid; justify-items: center; gap: var(--s-3); padding: var(--s-6) 0 var(--s-2); text-align: center; }
.hero .hero-logo { width: 132px; height: 132px; }
.hero h1 { font-size: var(--text-display); line-height: .95; letter-spacing: -0.03em; }
.entry-group { display: grid; gap: var(--s-3); }
.entry-group > .label-caps { padding-left: var(--s-1); }
.entry {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s-4);
  min-height: 76px; padding: var(--s-4); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: transform var(--t-micro) var(--ease), background-color var(--t-micro) var(--ease);
}
.entry:active { transform: scale(.985); }
@media (hover: hover) { .entry:hover { background: var(--surface-2); } }
.entry .entry-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r); background: var(--brand-soft); color: var(--brand-text); }
.entry.primary .entry-icon { background: var(--brand); color: var(--on-brand); }
.entry .entry-icon .icon { width: 26px; height: 26px; }
.entry b { display: block; font-size: 1.0625rem; font-weight: 800; letter-spacing: -0.01em; }
.entry span.sub { display: block; color: var(--text-2); font-size: var(--text-sm); }
.entry .chev { color: var(--text-2); }

.fab {
  position: fixed; z-index: 25; right: max(var(--s-4), calc(50% - 240px + var(--s-4)));
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--s-4));
  min-height: 56px; padding: 0 var(--s-5); border-radius: var(--r-full); box-shadow: 0 6px 20px rgb(225 29 72 / .35);
}

/* ───────────── Toast & dialog ───────────── */
.toast-wrap { position: fixed; left: 0; right: 0; z-index: 60; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--s-4)); display: grid; justify-items: center; padding: 0 var(--s-4); pointer-events: none; }
.toast { max-width: 448px; padding: var(--s-3) var(--s-4); border-radius: var(--r); background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow); animation: toast-in var(--t-small) var(--ease); }
.toast[data-type="error"] { background: var(--scan-err); color: var(--on-scan); }
.toast.out { animation: toast-out var(--t-micro) var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

dialog.sheet {
  width: 100%; max-width: 480px; margin: auto auto 0; padding: var(--s-5) var(--s-4) calc(var(--s-5) + env(safe-area-inset-bottom));
  border: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--surface); color: var(--text);
}
dialog.sheet[open] { animation: sheet-in var(--t-medium) var(--ease); }
dialog.sheet::backdrop { background: rgb(0 0 0 / .45); }
@keyframes sheet-in { from { transform: translateY(100%); } }

/* ───────────── Overlay hasil scan ───────────── */
.scan-result {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-content: center; justify-items: center; gap: var(--s-3);
  padding: var(--s-5); text-align: center; color: var(--on-scan);
  background: var(--scan-ok);
  animation: result-in var(--t-small) var(--ease);
}
.scan-result[data-kind="warn"] { background: var(--scan-warn); }
.scan-result[data-kind="error"] { background: var(--scan-err); }
.scan-result .verdict { display: flex; align-items: center; gap: var(--s-3); font-size: var(--text-display); font-weight: 800; line-height: .95; letter-spacing: -0.03em; }
.scan-result .verdict .icon { width: 1em; height: 1em; stroke-width: 2.75; animation: pop var(--t-small) var(--ease-spring) both; }
.scan-result .photo { width: 168px; height: 168px; border-radius: var(--r-lg); object-fit: cover; border: 4px solid var(--on-scan); background: var(--on-scan); animation: photo-in var(--t-medium) var(--ease) 60ms both; }
.scan-result .who { font-size: var(--text-h1); font-weight: 800; letter-spacing: -0.025em; }
.scan-result .sub { font-size: 1rem; opacity: .9; }
.scan-result .badge { background: var(--on-scan); color: var(--scan-ink); }
@keyframes result-in { from { opacity: 0; transform: scale(.96); } }
@keyframes pop { from { opacity: 0; transform: scale(.4); } }
@keyframes photo-in { from { opacity: 0; transform: scale(.9); } }

/* ───────────── Panel admin: kamera scan ───────────── */
.reader-wrap { position: relative; aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: #000; }
#reader { width: 100%; height: 100%; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
.reader-idle { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: var(--s-3); padding: var(--s-5); text-align: center; color: #fff; background: radial-gradient(circle at 50% 40%, #2A2325, #141011); }
.reader-idle p { color: rgb(255 255 255 / .75); font-size: var(--text-sm); }
.reader-tools { position: absolute; top: var(--s-3); right: var(--s-3); display: flex; gap: var(--s-2); z-index: 2; }
.reader-tools .btn { background: rgb(0 0 0 / .55); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.reader-tools .btn[aria-pressed="true"] { background: #FBBF24; color: #1C1517; }
.event-card { display: grid; gap: var(--s-3); }
.event-banner { gap: var(--s-1); }
.event-banner h2 { font-size: var(--text-h1); letter-spacing: -0.025em; }
.eb-warn { margin-top: var(--s-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--warning-bg); color: var(--warning); font-weight: 600; font-size: var(--text-sm); }
.event-card .actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
dialog.sheet.sheet-tall { max-height: 92dvh; overflow-y: auto; }
.detail-list { display: grid; grid-template-columns: auto 1fr; gap: var(--s-2) var(--s-4); margin: 0; }
.detail-list dt { color: var(--text-2); font-size: var(--text-sm); }
.detail-list dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.list-item.tap:focus-visible { box-shadow: inset var(--focus); }
.dp-stage { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-5) var(--s-4); border-radius: var(--r-lg); background: var(--surface-2); text-align: center; transition: background-color var(--t-small) var(--ease); }
.dp-stage .dp-name { font-size: var(--text-h1); font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.dp-stage .dp-sub { color: var(--text-2); font-weight: 600; }
.dp-stage.is-winner { background: var(--brand); color: var(--on-brand); }
.dp-stage.is-winner .dp-sub { color: var(--on-brand); opacity: .9; }
.dp-stage.is-winner .dp-name { animation: pop var(--t-medium) var(--ease-spring) both; }
.dp-winners { margin: 0; padding-left: 1.4em; display: grid; gap: var(--s-1); font-weight: 600; }
.dot-pending { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); flex: none; }
.app-header .btn-icon { flex: none; }

/* ───────────── KTA Digital (/kartu): satu momen "wow" ───────────── */
.kta-stage { perspective: 1100px; display: grid; justify-items: center; padding: var(--s-2) 0; }
.kta {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 30%;
  position: relative; width: min(100%, 340px); border-radius: 18px; overflow: hidden;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform var(--t-medium) var(--ease);
  box-shadow: 0 2px 6px rgb(28 21 23 / .12), 0 24px 48px -12px rgb(28 21 23 / .35);
  touch-action: pan-y;
  animation: kta-in 600ms var(--ease) both;
}
.kta.is-tilting { transition: transform 80ms linear; }
.kta canvas { display: block; width: 100%; height: auto; }
.kta-sheen {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(circle at var(--mx) var(--my), rgb(255 255 255 / .55), transparent 55%);
  opacity: .6; transition: opacity var(--t-medium) var(--ease);
}
@keyframes kta-in { from { opacity: 0; transform: translateY(24px) rotateX(12deg) scale(.96); } }
@media (prefers-reduced-motion: reduce) {
  .kta { transform: none !important; }
  .kta-sheen { display: none; }
}

/* ───────────── Skeleton, kosong ───────────── */
.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton-line { height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { display: grid; justify-items: center; gap: var(--s-3); padding: var(--s-7) var(--s-4); text-align: center; color: var(--text-2); align-content: center; }
.empty h1, .empty h2 { color: var(--text); }

/* ───────────── Gerak dikurangi ───────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
