/* ═══════════════════════════════════════════════════════
   Portal Nagari Pesisir Selatan — Mobile-First Stylesheet
   ═══════════════════════════════════════════════════════ */

/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:        #1d4ed8;
  --blue-mid:    #0ea5e9;
  --teal:        #0d9488;
  --green:       #059669;
  --grad:        linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 40%, #0d9488 70%, #059669 100%);
  --grad-light:  linear-gradient(135deg, #eff6ff 0%, #ecfdf5 100%);
  --white:       #ffffff;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-300:    #d1d5db;
  --gray-500:    #6b7280;
  --gray-700:    #374151;
  --gray-900:    #111827;
  --radius-sm:   0.75rem;
  --radius:      1rem;
  --radius-lg:   1.5rem;
  --shadow:      0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,0.14);
  --tap-size:    48px;  /* minimum touch target */
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Safe area untuk iPhone notch/Dynamic Island */
  padding-top: env(safe-area-inset-top);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100vh;
  min-height: 100dvh; /* dynamic viewport height */
  line-height: 1.5;
  /* Hapus highlight biru saat tap di Android/iOS */
  -webkit-tap-highlight-color: transparent;
  /* Cegah select teks saat tap cepat */
  -webkit-touch-callout: none;
  /* Performa scroll */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

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

/* Semua elemen interaktif: hapus delay 300ms & highlight */
a, button, [role="button"], .kec-card, .nagari-card, .landing-card {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* ─── Page Transition (fade-in saat halaman load) ───────── */
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.page-content {
  animation: pageFadeIn 0.22s ease-out both;
}

/* ─── Skeleton Loading ──────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: var(--radius);
}
.skeleton-card {
  height: 90px;
  border-radius: var(--radius);
}

/* ─── Gradient Background ───────────────────────────────── */
.page-gradient {
  background: var(--grad);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── Top Navigation Bar ────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  top: env(safe-area-inset-top, 0);
  z-index: 50;
  background: var(--grad);
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  height: 56px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  /* Smooth blur jika scroll (iOS) */
  -webkit-backdrop-filter: blur(0);
}

.topbar-back {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Min touch target 48x48 */
  min-width: var(--tap-size);
  min-height: var(--tap-size);
  margin: -8px;
  padding: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  color: white;
  transition: background 0.12s;
}
.topbar-back:active { background: rgba(255,255,255,0.25); }
.topbar-back svg { width: 1.1rem; height: 1.1rem; }

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ─── Breadcrumb ────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.70);
  padding: 0.45rem 1rem 0;
  flex-wrap: wrap;
  -webkit-overflow-scrolling: touch;
}
.breadcrumb a { color: rgba(255,255,255,0.80); min-height: 28px; display: inline-flex; align-items: center; }
.breadcrumb a:active { color: white; }
.breadcrumb .sep  { font-size: 0.6rem; opacity: 0.6; }
.breadcrumb .cur  { color: white; font-weight: 600; }

.page-subtitle {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.80);
  padding: 0.2rem 1rem 0.75rem;
}

/* ─── Section Header (gradient bg untuk inner pages) ────── */
.section-header { background: var(--grad); }

/* ─── Landing Page ──────────────────────────────────────── */
.landing-header {
  padding: 3rem 1.5rem 4.25rem;
  /* Hitung safe area top */
  padding-top: calc(env(safe-area-inset-top, 0px) + 3.5rem);
  text-align: center;
  color: white;
}

.landing-logo-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin: 0 auto 0.75rem;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.25));
  display: block;
}

.landing-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.2rem;
  text-shadow: 0 1px 6px rgba(0,0,0,0.2);
}

.landing-sub {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.80);
}

.landing-cards {
  padding: 1rem 1.25rem;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.landing-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-lg);
  /* Jangan gunakan transform default agar active terasa */
  transition: box-shadow 0.15s;
  cursor: pointer;
  /* Pastikan touch target cukup besar */
  min-height: var(--tap-size);
}
.landing-card:active {
  transform: scale(0.975);
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  background: #f8faff;
}

.landing-card-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
  width: 3.75rem;
  height: 3.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--grad-light);
}

.landing-card-body { flex: 1; min-width: 0; }
.landing-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.18rem;
}
.landing-card-desc {
  font-size: 0.74rem;
  color: var(--gray-500);
  line-height: 1.45;
}

.landing-card-arrow { color: var(--blue-mid); flex-shrink: 0; }
.landing-card-arrow svg { width: 1.15rem; height: 1.15rem; }

/* ─── Kecamatan Grid ────────────────────────────────────── */
.kec-grid-wrap { padding: 0.875rem; }

.kec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
}

.kec-card {
  background: white;
  border-radius: var(--radius);
  /* Min tap target terpenuhi via padding */
  min-height: var(--tap-size);
  padding: 0.85rem 0.4rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  /* Hardware-accelerated untuk performa */
  will-change: transform;
  transition: border-color 0.12s;
}
.kec-card:active {
  transform: scale(0.94);
  background: #f0f9ff;
  border-color: var(--blue-mid);
}

.kec-emoji { font-size: 2rem; line-height: 1; }
.kec-name  { font-size: 0.62rem; font-weight: 700; color: var(--gray-700); line-height: 1.3; }
.kec-count { font-size: 0.57rem; color: var(--gray-500); }

/* ─── Kecamatan Banner (nagari & layanan pages) ─────────── */
.kec-banner {
  background: var(--grad);
  padding: 0.875rem 1rem 1rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.kec-banner-emoji  { font-size: 2.25rem; flex-shrink: 0; }
.kec-banner-nama   { font-size: 0.95rem; font-weight: 700; }
.kec-banner-count  { font-size: 0.72rem; color: rgba(255,255,255,0.80); }

/* ─── Nagari Grid ───────────────────────────────────────── */
.nagari-grid-wrap { padding: 0.875rem; }

.nagari-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nagari-card {
  background: white;
  border-radius: var(--radius);
  min-height: var(--tap-size);
  padding: 0.85rem 0.4rem 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.2rem;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  will-change: transform;
  transition: border-color 0.12s;
}
.nagari-card:active {
  transform: scale(0.94);
  background: #f0fdf9;
  border-color: var(--teal);
}

.nagari-emoji { font-size: 1.75rem; line-height: 1; }
.nagari-name  { font-size: 0.6rem; font-weight: 600; color: var(--gray-700); line-height: 1.3; }

/* ─── Layanan Form ──────────────────────────────────────── */
.layanan-form-wrap {
  padding: 1rem 1rem;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
}

.layanan-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  display: block;
}
.select2-wrap { margin-bottom: 1.1rem; }

/* ─── Select2 Mobile Overrides ──────────────────────────── */
.select2-container--default .select2-selection--single {
  height: 52px !important;
  border: 2px solid var(--gray-200) !important;
  border-radius: var(--radius-sm) !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 0.875rem !important;
  font-size: 1rem !important;  /* >= 16px: cegah auto-zoom iOS */
  color: var(--gray-900) !important;
  background: white !important;
}
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open  .select2-selection--single {
  border-color: var(--blue-mid) !important;
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15) !important;
  outline: none !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1 !important;
  padding: 0 !important;
  font-size: 1rem !important;
  color: var(--gray-900) !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--gray-500) !important;
  font-size: 0.9rem !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 50px !important;
  right: 10px !important;
}
.select2-container--default .select2-results__option {
  padding: 0.75rem 1rem !important; /* touch-friendly list item */
  font-size: 0.9rem !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--blue-mid) !important;
}
.select2-dropdown {
  border: 2px solid var(--blue-mid) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow-lg) !important;
}
.select2-search--dropdown .select2-search__field {
  border: 2px solid var(--gray-200) !important;
  border-radius: 0.5rem !important;
  padding: 0.65rem 0.875rem !important;
  font-size: 1rem !important;  /* >= 16px */
  margin: 4px !important;
  width: calc(100% - 8px) !important;
}
.select2-search--dropdown .select2-search__field:focus {
  border-color: var(--blue-mid) !important;
  outline: none !important;
}

/* ─── Tombol ────────────────────────────────────────────── */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.95rem 1.5rem;
  min-height: var(--tap-size);
  border: none;
  border-radius: var(--radius);
  background: var(--grad);
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(14,165,233,0.30);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.15s;
  text-decoration: none;
}
.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(14,165,233,0.20);
}
.btn-disabled {
  opacity: 0.42 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
  pointer-events: none;
}

/* ─── Welcome / Info Page ───────────────────────────────── */
.welcome-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--grad);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.25rem;
  padding-top: calc(env(safe-area-inset-top, 0px) + 1.25rem);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 2rem);
}

.welcome-back {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  min-height: var(--tap-size);
  touch-action: manipulation;
}
.welcome-back:active { color: white; }
.welcome-back svg { width: 1rem; height: 1rem; }

.welcome-logo-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin: 0 auto 0.75rem;
  filter: drop-shadow(0 3px 10px rgba(0,0,0,0.25));
  display: block;
}

.welcome-title {
  color: white;
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.3rem;
  text-shadow: 0 1px 6px rgba(0,0,0,0.15);
}
.welcome-subtitle {
  color: rgba(255,255,255,0.80);
  font-size: 0.8rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.welcome-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 1.25rem;
}

.welcome-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eff6ff;
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.8rem;
  letter-spacing: 0.03em;
}

.welcome-card-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.6rem;
}
.welcome-card-body {
  font-size: 0.8rem;
  color: var(--gray-500);
  line-height: 1.65;
}
.welcome-card-body strong { color: var(--gray-700); }

.welcome-divider {
  height: 1px;
  background: var(--gray-100);
  margin: 0.9rem 0;
}

.welcome-steps { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 0.5rem; }
.welcome-step  { display: flex; align-items: flex-start; gap: 0.7rem; }

.step-num {
  width: 1.55rem;
  height: 1.55rem;
  min-width: 1.55rem;
  border-radius: 50%;
  background: var(--grad);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-text {
  font-size: 0.78rem;
  color: var(--gray-700);
  line-height: 1.5;
  padding-top: 0.15rem;
}

.welcome-btn-wrap { width: 100%; max-width: 440px; }

/* ─── Info Card (layanan page) ──────────────────────────── */
.info-card {
  background: #eff6ff;
  border-left: 4px solid #0ea5e9;
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin-bottom: 1.1rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
}
.info-card-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1.4; }
.info-card-text { font-size: 0.77rem; color: #1e40af; line-height: 1.55; }
.info-card-text strong { color: #1e3a8a; }

/* ─── Toast ─────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1.25rem);
  left: 50%;
  transform: translateX(-50%) translateY(5rem);
  background: rgba(17,24,39,0.93);
  color: white;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.22s, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Welcome Page — Full Screen Layout ────────────────────
   Seluruh halaman = 1 viewport, info card scrollable di dalam
   ─────────────────────────────────────────────────────────── */
.welcome-fullscreen {
  height: 100dvh;
  overflow: hidden;
  background: var(--grad);
  display: flex;
  flex-direction: column;
}

/* Bagian atas: tombol balik + logo + judul (tidak scroll) */
.welcome-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 0.9rem) 1.25rem 0;
}

.welcome-top .welcome-back {
  align-self: flex-start;
  margin-bottom: 0.75rem;
}

.welcome-top .welcome-logo-img {
  width: 56px;
  height: 56px;
  margin-bottom: 0.5rem;
}

.welcome-top .welcome-title    { font-size: 1.15rem; margin-bottom: 0.15rem; }
.welcome-top .welcome-subtitle { font-size: 0.74rem; margin-bottom: 0; }

/* Area tengah: card yang bisa di-scroll */
.welcome-scroll-area {
  flex: 1;
  min-height: 0;          /* kunci agar flex child bisa scroll */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 1.25rem 0.5rem;
  /* Scrollbar tipis */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.welcome-scroll-area::-webkit-scrollbar { width: 4px; }
.welcome-scroll-area::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
}

/* Card di dalam area scroll */
.welcome-scroll-area .welcome-card {
  margin-bottom: 0;
  max-width: 100%;
}

/* Bagian bawah: tombol lanjutkan (tidak scroll) */
.welcome-bottom {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.9rem);
  background: var(--grad); /* lindungi agar teks di atas tidak bocor */
}

/* ─── Layanan Page — Full Screen (no scroll) ────────────────
   Topbar + banner + form semua muat dalam 1 viewport penuh
   ─────────────────────────────────────────────────────────── */
body[data-page="layanan"] {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body[data-page="layanan"] .topbar   { flex-shrink: 0; }
body[data-page="layanan"] .kec-banner { flex-shrink: 0; }

/* Breadcrumb sedikit lebih kompak */
body[data-page="layanan"] .kec-banner { padding: 0.7rem 1rem 0.8rem; }

.layanan-fullscreen-form {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem 1rem;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
  gap: 0.75rem;
}

.layanan-fullscreen-form .info-card   { margin-bottom: 0; }
.layanan-fullscreen-form .select2-wrap { margin-bottom: 0; }

/* ─── Footer ────────────────────────────────────────────── */
.page-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  font-size: 0.68rem;
  color: var(--gray-500);
}

.landing-footer {
  padding: 0.75rem 1.5rem;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  text-align: center;
  color: rgba(255,255,255,0.60);
  font-size: 0.68rem;
}

/* ─── Swipe Back Indicator ──────────────────────────────── */
.swipe-hint {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%) translateX(-100%);
  background: rgba(255,255,255,0.92);
  border-radius: 0 12px 12px 0;
  padding: 0.6rem 0.75rem;
  font-size: 1.2rem;
  box-shadow: 2px 0 16px rgba(0,0,0,0.12);
  z-index: 100;
  pointer-events: none;
  transition: transform 0.15s ease;
}
.swipe-hint.visible { transform: translateY(-50%) translateX(0); }

/* ─── Responsive ─────────────────────────────────────────── */
@media (min-width: 480px) {
  .kec-grid    { grid-template-columns: repeat(4, 1fr); }
  .nagari-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 640px) {
  .landing-title { font-size: 1.55rem; }
  .landing-cards { max-width: 520px; margin: 0 auto; }
  .kec-grid      { grid-template-columns: repeat(5, 1fr); }
  .nagari-grid   { grid-template-columns: repeat(5, 1fr); }
  .kec-grid-wrap, .nagari-grid-wrap, .layanan-form-wrap {
    max-width: 680px; margin: 0 auto;
  }
}

@media (min-width: 1024px) {
  .kec-grid    { grid-template-columns: repeat(5, 1fr); gap: 1rem; }
  .nagari-grid { grid-template-columns: repeat(6, 1fr); gap: 1rem; }
  .kec-grid-wrap, .nagari-grid-wrap { max-width: 860px; }
  .layanan-form-wrap { max-width: 520px; }
  /* Di desktop, aktifkan hover */
  .kec-card:hover    { box-shadow: var(--shadow-lg); border-color: var(--blue-mid); transform: translateY(-2px); }
  .nagari-card:hover { box-shadow: var(--shadow-lg); border-color: var(--teal);     transform: translateY(-2px); }
  .landing-card:hover { box-shadow: 0 12px 36px rgba(0,0,0,0.18); transform: translateY(-2px); }
}

/* ─── Login Button (top-right landing) ──────────────────── */
.landing-header { position: relative; }

.btn-login-top {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 0.7rem);
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.18);
  border: 1.5px solid rgba(255,255,255,0.40);
  color: white;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.btn-login-top:active { background: rgba(255,255,255,0.30); }
.btn-login-top svg { width: 0.9rem; height: 0.9rem; }

/* ─── User Badge (top-right, saat sudah login) ───────────── */
.user-badge {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 0.6rem);
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255,255,255,0.95);
  border-radius: 999px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  overflow: hidden;
  max-width: 160px;
}
.user-badge.hidden { display: none; }

.user-badge-info {
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.75rem 0.35rem 0.65rem;
  min-width: 0;
}
.user-badge-nagari {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.user-badge-kec {
  font-size: 0.6rem;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.btn-logout {
  background: none;
  border: none;
  border-left: 1px solid var(--gray-200);
  color: var(--gray-500);
  padding: 0 0.55rem;
  height: 100%;
  min-height: 36px;
  cursor: pointer;
  font-size: 0.75rem;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
}
.btn-logout:active { background: var(--gray-100); color: var(--gray-900); }

/* ─── Landing: Layanan Mandiri card saat sudah login ─────── */
.layanan-card-logged .landing-card-icon { background: linear-gradient(135deg,#eff6ff,#ecfdf5); }
.logged-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.3rem;
}

/* ─── Modal Overlay ──────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.50);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ─── Bottom Sheet ───────────────────────────────────────── */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 1.5rem 1.5rem 0 0;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bottom-sheet.open { transform: translateY(0); }

.bs-handle-wrap {
  padding: 0.6rem 0 0;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  cursor: grab;
}
.bs-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
}

.bs-header {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bs-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gray-900);
}
.bs-close {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: var(--gray-100);
  color: var(--gray-500);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.bs-close:active { background: var(--gray-200); }

.bs-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.25rem;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* ─── Native Select (dalam modal) ───────────────────────── */
.bs-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
}
.bs-select {
  width: 100%;
  height: 50px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 0 0.875rem;
  font-size: 1rem; /* >= 16px: cegah auto-zoom iOS */
  font-family: inherit;
  color: var(--gray-900);
  background: white;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 1.1rem;
  cursor: pointer;
  touch-action: manipulation;
}
.bs-select:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}
.bs-select:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Dark Mode Sederhana (opsional) ─────────────────────── */
@media (prefers-color-scheme: dark) {
  /* Dibiarkan default agar konsisten dengan branding */
}

/* ═══════════════════════════════════════════════════════
   Landing Page — Full Viewport (no scroll, mobile-fit)
   ═══════════════════════════════════════════════════════ */

.landing-page {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header lebih kompak */
.landing-page .landing-header {
  flex-shrink: 0;
  padding-top: calc(env(safe-area-inset-top, 0px) + 2rem);
  padding-bottom: 0.25rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.landing-page .landing-logo-img {
  width: 60px;
  height: 60px;
  margin-bottom: 0.2rem;
}

.landing-page .landing-title {
  font-size: 1.05rem;
  margin-bottom: 0.05rem;
}

.landing-page .landing-sub {
  font-size: 0.65rem;
}

/* Area cards: mengisi sisa ruang, tidak scroll */
.landing-page .landing-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.2rem 1rem;
  padding-bottom: 0.2rem;
  gap: 0.6rem;
  overflow: hidden;
  min-height: 0;
}

/* Card lebih kompak */
.landing-page .landing-card {
  padding: 0.65rem 0.9rem;
}

.landing-page .landing-card-icon {
  width: 2.85rem;
  height: 2.85rem;
  font-size: 1.85rem;
  border-radius: var(--radius-sm);
}

.landing-page .landing-card-title {
  font-size: 0.9rem;
}

.landing-page .landing-card-desc {
  font-size: 0.7rem;
}

/* Footer sangat tipis */
.landing-page .landing-footer {
  flex-shrink: 0;
  padding: 0.3rem 1rem calc(env(safe-area-inset-bottom, 0px) + 0.3rem);
  font-size: 0.6rem;
}
