/* =========================================================================
   DATA KK — DESA ARGOMULYO · Modern UI
   Kec. Banjit, Kab. Way Kanan, Lampung — 34766
   ========================================================================= */
:root {
  /* Palet resmi: slate-teal yang tenang dipadu aksen hangat — kontras jelas, tidak dominan hijau */
  --bg: #F6F7F5;
  --bg-soft: #F1EDE3;
  --panel: #ffffff;
  --border: #E1DED4;
  --dark: #122E2C;
  --dark2: #1B4C48;
  --mid: #24746D;
  --mid2: #3E9C93;
  --accent: #E8703F;
  --accent2: #EFA23C;
  --text: #1E2624;
  --muted: #6B716E;
  --danger: #D6524A;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 2px 8px rgba(20,24,22,0.06);
  --shadow-md: 0 10px 30px rgba(16,24,22,0.12);
  --shadow-lg: 0 22px 60px rgba(10,16,15,0.22);
  --ease: cubic-bezier(.22,1,.36,1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 100% -10%, rgba(36,116,109,0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(232,112,63,0.08), transparent 55%),
    var(--bg);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #C7D3BE; border-radius: 20px; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ============================== ICON SYSTEM ============================== */
/* Ikon garis (stroke) modern & konsisten — menggantikan emoji agar tampilan resmi/profesional */
.icon, svg.icon, [data-feather] {
  width: 18px; height: 18px; flex-shrink: 0;
  stroke: currentColor; stroke-width: 2; fill: none;
  vertical-align: middle;
}
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 26px; height: 26px; }
.icon-xl { width: 30px; height: 30px; }

/* ============================== SPLASH SCREEN ============================== */
#splash {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 700px at 50% -10%, var(--mid) 0%, var(--dark) 60%);
  overflow: hidden;
  transition: opacity .6s var(--ease), visibility .6s var(--ease);
}
#splash.fade-out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-inner { text-align: center; color: #EFF6EE; position: relative; z-index: 2; padding: 20px; }
.splash-logo-ring {
  width: 116px; height: 116px; margin: 0 auto 22px; border-radius: 50%;
  background: linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.03));
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.18);
  animation: splashPulse 2.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(231,168,46,0.35);
}
.splash-logo-ring img { width: 74px; height: 74px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0,0,0,0.35)); }
@keyframes splashPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231,168,46,0.22); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(231,168,46,0); transform: scale(1.015); }
}
.splash-eyebrow { font-size: 12px; letter-spacing: 3px; color: #B9D6BE; font-weight: 700; text-transform: uppercase; opacity: 0; animation: riseIn .7s var(--ease) .15s forwards; }
.splash-title { font-family: 'Fraunces', Georgia, serif; font-size: 27px; font-weight: 700; margin-top: 8px; opacity: 0; animation: riseIn .7s var(--ease) .3s forwards; }
.splash-sub { font-size: 12.5px; color: #A9C4AE; margin-top: 6px; opacity: 0; animation: riseIn .7s var(--ease) .45s forwards; }
.splash-loader { margin: 26px auto 0; width: 160px; height: 4px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; opacity: 0; animation: riseIn .6s var(--ease) .6s forwards; }
.splash-loader::after {
  content: ""; display: block; height: 100%; width: 40%; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--mid2));
  animation: loaderSlide 1.1s ease-in-out infinite;
}
@keyframes loaderSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.splash-decor { position: absolute; inset: 0; z-index: 1; opacity: .5; }
.splash-decor span {
  position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(62,156,147,0.35), transparent 70%);
  animation: floaty 9s ease-in-out infinite;
}
.splash-decor span:nth-child(1) { width: 260px; height: 260px; top: -60px; left: -60px; animation-delay: 0s; }
.splash-decor span:nth-child(2) { width: 200px; height: 200px; bottom: -50px; right: -40px; animation-delay: 1.5s; background: radial-gradient(circle, rgba(231,168,46,0.30), transparent 70%); }
.splash-decor span:nth-child(3) { width: 140px; height: 140px; bottom: 20%; left: 8%; animation-delay: 3s; }
@keyframes floaty { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-10px) scale(1.02); } }

/* ============================== PUBLIC DASHBOARD (LOGIN SCREEN) ============================== */
#loginScreen {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column;
  overflow-y: auto;
  background:
    radial-gradient(1000px 600px at 15% -10%, rgba(28,90,84,0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 110%, rgba(231,168,46,0.16), transparent 55%),
    var(--dark);
  animation: fadeIn .5s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Top bar: brand on left, proportional "Masuk Petugas" button on right */
.pd-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-wrap: wrap;
}
.pd-brand { display: flex; align-items: center; gap: 12px; }
.pd-brand-logo { width: 42px; height: 42px; border-radius: 11px; background: rgba(255,255,255,0.09); padding: 5px; flex-shrink: 0; }
.pd-brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.pd-brand-eyebrow { font-size: 10.5px; letter-spacing: 1.2px; color: #9FC2A6; font-weight: 700; text-transform: uppercase; }
.pd-brand-title { font-family: 'Fraunces', Georgia, serif; font-size: 16.5px; font-weight: 700; color: #EFF6EE; line-height: 1.2; margin-top: 2px; }

.pd-login-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 20px; border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(135deg, var(--mid2), var(--mid)); color: #fff;
  font-size: 13.5px; font-weight: 700; white-space: nowrap;
  box-shadow: 0 10px 22px rgba(28,90,84,0.32); transition: transform .18s var(--ease), box-shadow .18s;
  flex-shrink: 0;
}
.pd-login-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(28,90,84,0.4); }
.pd-login-btn:active { transform: translateY(0) scale(.98); }
.pd-login-btn .icon { width: 15px; height: 15px; }
/* Label pendek disembunyikan secara default; muncul di layar sempit lewat media query, jadi tombol tidak pernah jadi ikon polos */
.pd-login-label-short { display: none; }

.pd-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 32px 20px 40px;
}

.pd-foot { text-align: center; font-size: 11px; color: #7C9A81; margin-top: 22px; line-height: 1.6; }
.pd-foot b { color: #B9D6BE; }

/* Public dashboard card shown before login */
.public-dash-card {
  width: 100%; max-width: 720px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg); padding: 30px 30px 26px; color: #EFF6EE;
  backdrop-filter: blur(6px);
  animation: cardIn .55s var(--ease);
}
.pd-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800;
  letter-spacing: .5px; color: #F2C14E; background: rgba(242,193,78,0.14);
  border: 1px solid rgba(242,193,78,0.3); padding: 4px 10px; border-radius: 20px; margin-bottom: 12px;
}
.pd-title { font-family: 'Fraunces', Georgia, serif; font-size: 21px; font-weight: 700; }
.pd-sub { font-size: 12.5px; color: #B9D6BE; margin-top: 8px; line-height: 1.6; max-width: 480px; }
.pd-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 18px; }
.pd-stat {
  display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-md); padding: 12px 13px;
  transition: background .2s;
}
.pd-stat.skeleton { opacity: .55; }
.pd-stat-icon { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,0.09); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #EFF6EE; }
.pd-stat-icon .icon { width: 17px; height: 17px; }
.pd-stat-value { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.pd-stat-label { font-size: 10.5px; color: #9FC2A6; font-weight: 600; margin-top: 2px; }
.pd-bar-title { font-size: 11.5px; font-weight: 700; letter-spacing: .5px; color: #9FC2A6; text-transform: uppercase; margin-top: 20px; margin-bottom: 8px; }
.pd-bar-wrap { max-height: 190px; overflow-y: auto; padding-right: 4px; }
.pd-bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; font-size: 12px; }
.pd-bar-label { width: 118px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #DCE7DE; }
.pd-bar-track { flex: 1; background: rgba(255,255,255,0.08); border-radius: 8px; height: 9px; overflow: hidden; }
.pd-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--mid2)); border-radius: 8px; width: 0; transition: width 1s var(--ease); }
.pd-bar-value { width: 24px; text-align: right; font-weight: 700; color: #EFF6EE; }
.pd-updated { font-size: 11px; color: #7C9A81; margin-top: 16px; display: flex; align-items: center; gap: 6px; }

#loginModal { z-index: 600; }
.login-card {
  width: 100%; max-width: 400px; background: rgba(255,255,255,0.98) !important;
  border-radius: var(--radius-lg); padding: 34px 30px 28px;
  box-shadow: var(--shadow-lg);
  animation: cardIn .35s var(--ease) both;
  position: relative;
}
.login-modal-close {
  position: absolute; top: 14px; right: 14px; width: 30px; height: 30px;
  border-radius: 50%; background: var(--bg-soft); border: none; cursor: pointer;
  font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.login-modal-close:hover { background: var(--border); color: var(--dark); }
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.login-logo { width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 18px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; padding: 8px; box-shadow: inset 0 0 0 1px var(--border); }
.login-logo img { width: 100%; height: 100%; object-fit: contain; }
.login-eyebrow { text-align: center; font-size: 11px; letter-spacing: 2px; font-weight: 800; color: var(--mid); text-transform: uppercase; }
.login-title { text-align: center; font-family: 'Fraunces', Georgia, serif; font-size: 22px; font-weight: 700; margin-top: 4px; color: var(--dark); }
.login-sub { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; margin-bottom: 22px; line-height: 1.5; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--dark2); margin-bottom: 6px; }
.field-input-wrap { position: relative; }
.field-input-wrap .fi-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); opacity: .55; display: flex; }
.field-input-wrap .fi-icon .icon { width: 16px; height: 16px; }
.field input {
  width: 100%; padding: 12px 14px 12px 38px; border-radius: 12px; border: 1.5px solid var(--border);
  font-size: 14px; background: #FAFCF8; transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input:focus { outline: none; border-color: var(--mid2); box-shadow: 0 0 0 4px rgba(28,90,84,0.12); background: #fff; }
.field .toggle-pass { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; opacity: .6; padding: 4px; display: flex; color: var(--muted); }
.login-btn {
  width: 100%; padding: 13px; border: none; border-radius: 12px; margin-top: 6px;
  background: linear-gradient(135deg, var(--mid2), var(--mid)); color: #fff; font-weight: 700; font-size: 14.5px;
  cursor: pointer; box-shadow: 0 10px 24px rgba(28,90,84,0.30); transition: transform .18s var(--ease), box-shadow .18s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(28,90,84,0.38); }
.login-btn:active { transform: translateY(0px) scale(.99); }
.login-error {
  background: #FDEDEC; border: 1px solid #F3C4BE; color: var(--danger); font-size: 12.5px;
  padding: 9px 12px; border-radius: 10px; margin-bottom: 14px; display: none; align-items: center; gap: 6px;
  animation: shake .4s;
}
.login-error.show { display: flex; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.login-foot { text-align: center; font-size: 11px; color: var(--muted); margin-top: 20px; line-height: 1.6; }
.login-foot b { color: var(--dark2); }

/* ============================== APP SHELL ============================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(185deg, var(--dark2), var(--dark) 60%);
  color: #EFEFE6; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  z-index: 40; transition: transform .35s var(--ease);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 12px; flex-shrink: 0; }
.brand-logo { width: 42px; height: 42px; border-radius: 11px; background: rgba(255,255,255,0.09); padding: 5px; flex-shrink: 0; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-eyebrow { font-size: 10px; letter-spacing: 1.4px; color: #9FC2A6; font-weight: 700; }
.brand-title { font-family: 'Fraunces', Georgia, serif; font-size: 17px; font-weight: 700; line-height: 1.15; margin-top: 2px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; flex-shrink: 0; }
.side-nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: transparent; color: #DCE7DE; border: none; cursor: pointer; font-size: 13.5px; font-weight: 600;
  text-align: left; transition: background .18s, color .18s, transform .12s;
}
.side-nav-btn:hover { background: rgba(255,255,255,0.07); transform: translateX(2px); }
.side-nav-btn.active { background: linear-gradient(135deg, var(--mid2), var(--mid)); color: #fff; box-shadow: 0 8px 18px rgba(28,90,84,0.35); }
.side-nav-btn .icon { width: 17px; height: 17px; }

.side-label { font-size: 10.5px; letter-spacing: 1.4px; color: #86A18C; font-weight: 700; padding: 12px 8px 6px; text-transform: uppercase; flex-shrink: 0; }
/* Tinggi TETAP (bukan flex:1) supaya daftar dusun selalu punya ruang tampil
   yang cukup lega, tidak peduli seberapa pendek jendela/layar perangkat.
   Jika seluruh isi sidebar jadi lebih tinggi dari layar, sidebar itu sendiri
   yang di-scroll (lihat overflow-y di .sidebar), bukan daftar dusun yang
   dikorbankan sampai nyaris hilang. */
.dusun-list { flex: none; height: 260px; overflow-y: auto; padding-right: 2px; }
.dusun-item {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 8px;
  padding: 10px 10px; margin-bottom: 3px; border-radius: var(--radius-sm); background: transparent;
  color: #EFEFE6; font-size: 13.5px; font-weight: 500; border: none; cursor: pointer; transition: background .16s, transform .12s;
}
.dusun-item:hover { background: rgba(255,255,255,0.07); transform: translateX(2px); }
.dusun-item.active { background: rgba(62,156,147,0.22); font-weight: 700; box-shadow: inset 0 0 0 1px rgba(62,156,147,0.4); }
.dusun-num {
  font-size: 10.5px; width: 22px; height: 22px; border-radius: 6px; background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 700;
}
.dusun-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dusun-count { font-size: 10.5px; opacity: 0.75; background: rgba(255,255,255,0.08); padding: 1px 7px; border-radius: 20px; }

.sidebar-foot { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 10px; margin-top: 6px; display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 7px 8px; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--accent2), var(--accent)); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: #422f04; flex-shrink: 0; }
.user-name { font-size: 12.5px; font-weight: 700; }
.user-role { font-size: 10.5px; color: #9FC2A6; }
.btn-ghost-dark { background: rgba(255,255,255,0.08); color: #EFEFE6; padding: 9px 12px; font-size: 12.5px; border: none; border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background .16s; }
.btn-ghost-dark:hover { background: rgba(255,255,255,0.16); }
.credit-tag { font-size: 10px; color: #6F8A75; text-align: center; padding-top: 4px; line-height: 1.5; }

/* Mobile sidebar toggle */
.mobile-topbar { display: none; }
.sidebar-scrim { display: none; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  padding: 20px 28px 0; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding-bottom: 12px;
}
.rw-tag { font-size: 11.5px; color: var(--mid); font-weight: 700; letter-spacing: .5px; }
.dusun-title { font-family: 'Fraunces', Georgia, serif; font-size: 25px; font-weight: 700; }
.tabs { display: flex; gap: 8px; background: #fff; padding: 5px; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.tab { padding: 8px 15px; font-size: 12.8px; background: transparent; color: var(--dark2); border: none; border-radius: 9px; cursor: pointer; font-weight: 700; transition: background .16s, color .16s; }
.tab:hover { background: var(--bg-soft); }
.tab.active { background: var(--dark); color: #fff; box-shadow: var(--shadow-sm); }

.content { flex: 1; overflow-y: auto; padding: 10px 28px 34px; }
.view { animation: viewIn .4s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.view.hidden { display: none; }

/* ============================== DASHBOARD ============================== */
.dash-hero {
  background: linear-gradient(120deg, var(--dark2), var(--dark) 70%);
  border-radius: var(--radius-lg); color: #EFF6EE; padding: 24px 26px; margin-bottom: 20px;
  position: relative; overflow: hidden; box-shadow: var(--shadow-md);
}
.dash-hero::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(420px 220px at 92% -10%, rgba(231,168,46,0.28), transparent 60%),
              radial-gradient(360px 220px at 100% 120%, rgba(62,156,147,0.30), transparent 60%);
}
.dash-hero-inner { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.dash-hero-eyebrow { font-size: 11px; letter-spacing: 2px; color: #B9D6BE; font-weight: 800; text-transform: uppercase; }
.dash-hero-title { font-family: 'Fraunces', Georgia, serif; font-size: 25px; font-weight: 700; margin-top: 4px; }
.dash-hero-sub { font-size: 12.5px; color: #C4DBC8; margin-top: 5px; max-width: 460px; line-height: 1.5; }
.dash-hero-time { font-size: 12px; color: #9FC2A6; text-align: right; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px;
  display: flex; align-items: center; gap: 13px; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease); position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--bar-color, var(--mid)); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--bg-soft); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; color: var(--bar-color, var(--mid));
}
.stat-icon .icon { width: 21px; height: 21px; }
.stat-value { font-size: 23px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }

.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } .stat-grid { grid-template-columns: repeat(2,1fr); } }

.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-weight: 800; font-size: 14.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mid2); }

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.legend-row:last-child { border-bottom: none; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 7px; }

/* ============================== MISC PAGE PARTS ============================== */
.notice { background: #FBF0DC; border: 1px solid #E7CE9B; border-radius: var(--radius-sm); padding: 11px 15px; font-size: 13px; margin-bottom: 16px; display:flex; align-items:center; gap:8px; }
.notice a { color: #8A6516; font-weight: 700; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 820px) { .upload-grid { grid-template-columns: 1fr; } }

.dropzone {
  border: 2px dashed #B7C7AC; border-radius: var(--radius-md); padding: 34px 20px; text-align: center;
  cursor: pointer; background: linear-gradient(180deg, #F7FAF4, #F1F6ED); display: block;
  transition: border-color .2s, background .2s, transform .15s;
}
.dropzone:hover { border-color: var(--mid2); background: #F2F9F0; }
.dropzone.dragover { border-color: var(--mid2); background: #E9F6EC; transform: scale(1.01); }
.dz-icon { color: var(--mid); margin-bottom: 8px; display: inline-flex; }
.dz-icon .icon { width: 30px; height: 30px; stroke-width: 1.6; }
@keyframes floatIcon { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.dz-title { font-weight: 700; font-size: 15px; }
.dz-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

.camera-box {
  border-radius: var(--radius-md); background: linear-gradient(150deg, var(--dark2), var(--dark));
  color: #EFF6EE; padding: 26px 20px; text-align: center; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; cursor: pointer; position: relative; overflow: hidden;
  transition: transform .15s var(--ease);
}
.camera-box:hover { transform: translateY(-2px); }
.camera-box::after { content:""; position:absolute; inset:0; background: radial-gradient(280px 160px at 90% -10%, rgba(231,168,46,0.25), transparent 60%); }
.camera-icon-wrap { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center; z-index:1; border: 1px solid rgba(255,255,255,0.18); }
.camera-icon-wrap .icon { width: 25px; height: 25px; stroke-width: 1.6; }
.camera-box .dz-title, .camera-box .dz-sub { position: relative; z-index: 1; }
.camera-box .dz-title { color: #fff; }
.camera-box .dz-sub { color: #B9D6BE; }

.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 10px; }
.section-title { font-weight: 800; font-size: 15px; }
.section-sub { font-size: 12px; color: var(--muted); }

.queue-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 12px; margin-top: 10px;}
.queue-item {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; position: relative;
  box-shadow: var(--shadow-sm); animation: popIn .3s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
.queue-item .rm { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,0.55); border: none; border-radius: 7px; color: #fff; width: 22px; height: 22px; cursor: pointer; z-index: 3; }
.queue-thumb { height: 96px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.queue-thumb img { width: 100%; height: 100%; object-fit: cover; }
.queue-body { padding: 8px 10px 9px; }
.queue-name { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.badge { margin-top: 5px; font-size: 10.5px; font-weight: 700; border-radius: 20px; padding: 3px 9px; display: inline-flex; align-items: center; gap: 4px; }
.badge.wait { color: #8A9B84; background: #EEF1E7; }
.badge.busy { color: #8A6516; background: #FBF0DC; }
.badge.ok { color: #2E7D46; background: #E4F3E7; }
.badge.err { color: #B23B3B; background: #FBE4E4; }

/* Scanning laser sweep animation for a queue item actively scanning */
.queue-item.scanning .queue-thumb::before {
  content: ""; position: absolute; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent2), var(--mid2), transparent);
  box-shadow: 0 0 12px 2px rgba(231,168,46,0.7);
  animation: scanSweep 1.6s ease-in-out infinite;
  z-index: 2;
}
.queue-item.scanning .queue-thumb::after {
  content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(28,90,84,0.06) 0 2px, transparent 2px 4px);
  z-index: 1;
}
@keyframes scanSweep { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }

/* Bulk scanning banner shown when many files are being processed */
#scanBanner {
  display: flex; align-items: center; gap: 16px; background: linear-gradient(120deg, var(--dark2), var(--dark));
  color: #EFF6EE; border-radius: var(--radius-md); padding: 16px 20px; margin-bottom: 14px;
  box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
#scanBanner .scan-radar { width: 50px; height: 50px; border-radius: 50%; position: relative; flex-shrink: 0; background: radial-gradient(circle, rgba(62,156,147,0.25), transparent 70%); }
#scanBanner .scan-radar::before, #scanBanner .scan-radar::after {
  content:""; position:absolute; inset:0; border-radius: 50%; border: 2px solid rgba(62,156,147,0.5);
  animation: radarPing 1.8s ease-out infinite;
}
#scanBanner .scan-radar::after { animation-delay: .9s; }
@keyframes radarPing { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.3); opacity: 0; } }
#scanBanner .scan-radar .core { position: absolute; inset: 16px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 14px 4px rgba(242,193,78,0.6); }
#scanBanner .scan-text-title { font-weight: 800; font-size: 14px; }
#scanBanner .scan-text-sub { font-size: 12px; color: #B9D6BE; margin-top: 2px; }
#scanBanner .scan-progress { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
#scanBanner .scan-progress b { font-size: 20px; }
#scanBanner .scan-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--accent2), var(--mid2)); transition: width .3s var(--ease); }

.preview-wrap-card { border-left: 4px solid var(--mid2); }

/* Section cards for queue / preview so action buttons sit inside a clear boundary
   instead of floating loosely on the page background */
.section-card { margin-top: 16px; }
.section-card .row-between { margin-bottom: 4px; }
#queueWrap.section-card .queue-grid { margin-top: 12px; }

/* ============================== SEARCH VIEW ============================== */
.search-controls { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.search-input-wrap { flex: 1 1 260px; }
.search-input-wrap input { padding: 11px 14px 11px 38px; }
.search-select { flex: 0 1 220px; margin-bottom: 0; cursor: pointer; }
#searchTableWrap { margin-top: 16px; }
.search-hit { background: rgba(242,193,78,0.35); border-radius: 3px; padding: 0 1px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); margin-top: 18px; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { border-bottom: 1px solid #EAEFE3; padding: 10px 13px; text-align: left; white-space: nowrap; }
th { background: var(--bg-soft); font-weight: 700; color: var(--dark2); position: sticky; top: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #F7FAF4; }
td input { width: 110px; border: 1px solid var(--mid2); border-radius: 6px; padding: 4px 6px; font-size: 12px; }
.editable { cursor: pointer; }
.del-btn { border: none; background: none; cursor: pointer; color: var(--danger); font-size: 14px; border-radius: 6px; padding: 4px 6px; transition: background .15s; }
.del-btn:hover { background: #FBE4E4; }

.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-icon { margin-bottom: 10px; opacity: .5; display: inline-flex; }
.empty-icon .icon { width: 36px; height: 36px; stroke-width: 1.4; }
.empty-title { font-weight: 800; font-size: 15px; color: var(--dark2); }
.empty-sub { font-size: 12.5px; margin-top: 5px; }

.btn {
  cursor: pointer; border: none; border-radius: var(--radius-sm); font-weight: 700; padding: 10px 18px; font-size: 13px;
  display: inline-flex; align-items: center; gap: 7px; transition: transform .15s var(--ease), box-shadow .15s var(--ease), opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-dark { background: var(--dark); color: #EFEFE6; box-shadow: var(--shadow-sm); }
.btn-dark:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-green { background: linear-gradient(135deg, var(--mid2), var(--mid)); color: #fff; box-shadow: 0 8px 20px rgba(28,90,84,0.30); }
.btn-green:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(28,90,84,0.38); }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--mid2); }
.btn-icon { border: none; background: none; cursor: pointer; border-radius: 8px; padding: 4px 8px; transition: background .15s; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.btn-icon:hover { background: var(--bg-soft); }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-label { width: 150px; font-size: 12.5px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bar-track { flex: 1; background: var(--bg-soft); border-radius: 8px; height: 15px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--mid2), var(--mid)); border-radius: 8px; width: 0; transition: width 1s var(--ease); }
.bar-value { width: 32px; font-size: 12px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(15,25,17,0.55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; animation: fadeIn .2s; }
.modal { background: #fff; border-radius: var(--radius-lg); padding: 26px; width: 440px; max-width: 100%; box-shadow: var(--shadow-lg); animation: cardIn .3s var(--ease); max-height: 90vh; overflow-y: auto; }
.modal-sub { font-size: 12px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.lbl { font-size: 12px; font-weight: 700; display: block; margin-bottom: 5px; }
.input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 4px; transition: border-color .15s; }
.input:focus { outline: none; border-color: var(--mid2); }
.conn-result { font-size: 12.5px; margin-top: 10px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(0);
  background: var(--dark); color: #EFEFE6; padding: 12px 22px; border-radius: var(--radius-sm);
  font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 300; max-width: 480px;
  animation: toastIn .35s var(--ease); display: flex; align-items: center; gap: 8px;
}
.toast.err { background: #7A2E2E; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* Camera capture modal */
#cameraModal .modal { width: 480px; padding: 0; overflow: hidden; }
.cam-video-wrap { position: relative; background: #000; aspect-ratio: 3/4; max-height: 70vh; }
.cam-video-wrap video, .cam-video-wrap canvas { width: 100%; height: 100%; object-fit: cover; }
.cam-frame-guide { position: absolute; inset: 22px; border: 2.5px dashed rgba(255,255,255,0.55); border-radius: 14px; pointer-events: none; }
.cam-controls { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 16px; background: #101a12; }
.cam-shoot { width: 58px; height: 58px; border-radius: 50%; background: #fff; border: 4px solid rgba(255,255,255,0.35); cursor: pointer; }
.cam-shoot:active { transform: scale(.92); }
.cam-close { background: rgba(255,255,255,0.12); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* ============================== RESPONSIVE ============================== */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 45; background: var(--dark2); color: #fff; padding: 12px 16px;
    box-shadow: var(--shadow-md);
  }
  .mobile-topbar .mt-left { display: flex; align-items: center; gap: 10px; }
  .mobile-topbar .mt-logo { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,0.1); padding: 4px; }
  .mobile-topbar .mt-title { font-family: 'Fraunces', Georgia, serif; font-size: 15px; font-weight: 700; }
  .mobile-topbar .mt-burger { background: rgba(255,255,255,0.1); border: none; color: #fff; width: 36px; height: 36px; border-radius: 9px; font-size: 16px; cursor: pointer; }

  .app-shell { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; transform: translateX(-104%);
    box-shadow: var(--shadow-lg); width: 82vw; max-width: 300px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 39;
    opacity: 0; pointer-events: none; transition: opacity .25s;
  }
  .sidebar-scrim.show { opacity: 1; pointer-events: all; }

  /* Sidebar sekarang men-scroll sebagai satu kesatuan di mobile (bukan hanya
     daftar dusun), supaya daftar dusun tidak terdesak sampai nyaris hilang
     tingginya. Beri juga tinggi minimum + target sentuh yang lebih besar
     agar mudah dipilih dengan jari. */
  .dusun-list { height: 300px; }
  .dusun-item { padding: 12px 12px; margin-bottom: 4px; font-size: 14px; }
  .dusun-num { width: 24px; height: 24px; font-size: 11px; }
  .dusun-count { font-size: 11px; padding: 2px 8px; }
  .side-label { padding-top: 16px; font-size: 11.5px; }

  .topbar { padding: 16px 16px 0; }
  .content { padding: 10px 16px 90px; }
  .dusun-title { font-size: 20px; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { white-space: nowrap; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 13px 14px; }
  .stat-value { font-size: 19px; }
  .dash-hero { padding: 20px; }
  .dash-hero-title { font-size: 20px; }
  .upload-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 22px 24px; }
  .pd-topbar { padding: 12px 14px; }
  .pd-brand-title { font-size: 14px; }
  .pd-login-btn { padding: 0 16px; font-size: 12.5px; }
  .pd-wrap { padding: 20px 14px 30px; }
  .public-dash-card { padding: 18px 18px 16px; }
  .pd-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .search-controls { flex-direction: column; }
  .search-select { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .queue-grid { grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); }
  table { font-size: 11.5px; }
  .pd-brand-eyebrow { display: none; }
  .pd-brand-title { font-size: 13px; }
  .pd-login-btn { padding: 0 13px; gap: 6px; }
  .pd-login-label-full { display: none; }
  .pd-login-label-short { display: inline; }
}

/* Utility spin for loading icons */
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== TOMBOL INSTAL PWA ============================== */
.btn-install-app {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 11px 14px; margin-bottom: 8px;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 800; font-size: 13px; color: #17261C;
  background: linear-gradient(120deg, var(--accent2), var(--accent));
  box-shadow: 0 6px 18px rgba(255,122,69,0.35);
  animation: installPulse 2.4s ease-in-out infinite;
  transition: transform .15s var(--ease);
}
.btn-install-app:hover { transform: translateY(-1px); }
@keyframes installPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(255,122,69,0.28); }
  50% { box-shadow: 0 6px 20px rgba(255,176,32,0.38); }
}
.mt-right { display: flex; align-items: center; gap: 8px; }
.mt-install {
  width: 38px; height: 38px; padding: 0; margin: 0; border-radius: 50%;
  font-size: 17px; flex: none;
}

/* ============================== MODAL NOTIFIKASI FOTO BURAM ============================== */
.blur-modal { text-align: center; max-width: 420px; }
.blur-modal-icon { margin-bottom: 6px; color: var(--danger); display: flex; justify-content: center; }
.blur-modal-icon .icon { width: 40px; height: 40px; stroke-width: 1.4; }
.blur-modal-title { font-weight: 800; font-size: 17px; color: var(--dark2); margin-bottom: 8px; }
.blur-modal-sub { font-size: 13px; color: var(--muted); text-align: left; line-height: 1.6; }
.blur-file-list { margin: 8px 0; padding-left: 18px; font-weight: 700; color: var(--danger); }
.blur-file-list li { margin-bottom: 3px; word-break: break-all; }
