/* ============================================================
   Sistem Absensi Kantor Desa Teluk Dalam
   Tema: dark indigo + aksen blurple (Inter), rapi & ringan.
   ============================================================ */

:root {
  --bg: #161826;
  --bg-2: #12141f;
  --surface: #232532;
  --surface-2: #282b3a;
  --text: #e9e9ed;
  --accent: #9184d9;
  --accent-2: #a7a1db;
  --divider: rgba(233, 233, 237, 0.14);

  --n-100: #f3f5fe;
  --n-200: #e4e7f5;
  --n-300: #cfd3e5;
  --n-400: #b2b6ca;
  --n-500: #9397ab;
  --n-600: #75798c;
  --n-700: #595d6c;
  --n-800: #3f424d;
  --n-900: #292b31;

  --a-100: #f5f4ff;
  --a-200: #e7e5fe;
  --a-300: #d2cefd;
  --a-400: #b5abfc;
  --a-500: #968ae0;
  --a-600: #796cbf;
  --a-700: #5d5294;
  --a-800: #423a6a;
  --a-900: #2b2741;

  --hijau: #7fce9b;
  --hijau-t: #a8e0bd;
  --kuning: #e6b566;
  --kuning-t: #f0cf95;
  --merah: #d68a8a;
  --merah-t: #e6b3b3;
  --biru: #8fb8e0;
  --biru-t: #bcd6f0;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 0 0 1px var(--n-800);
  --shadow-md: 0 0 0 1px var(--n-700), 0 6px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 0 0 1px var(--n-700), 0 16px 40px rgba(0, 0, 0, 0.55);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 244px;
}

* , *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 6px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 600;
}
h1 { font-size: 22px; }
h3 { font-size: 17px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-dim { color: var(--n-500); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.wrap { flex-wrap: wrap; }
.gap-1 { gap: 8px; }
.items-center { align-items: center; }
.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
  width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column;
  padding: 18px 12px;
  background: var(--bg);
  border-right: 1px solid var(--divider);
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 11px;
  padding: 0 8px 20px; margin-bottom: 4px;
}
.brand-logo {
  width: 42px; height: 42px; flex: none; border-radius: 11px;
  background: var(--a-800); color: var(--a-100);
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  box-shadow: 0 0 24px -6px var(--accent);
  overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.sidebar .brand h2 { font-size: 14px; margin: 0; line-height: 1.25; }
.sidebar .brand span { font-size: 11px; color: var(--n-500); }

.nav-label {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--n-600); padding: 12px 12px 6px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; color: var(--n-400);
  transition: background .15s ease, color .15s ease;
}
.sidebar nav a svg { flex: none; opacity: .85; }
.sidebar nav a:hover { background: rgba(233,233,237,0.06); color: var(--n-200); }
.sidebar nav a.active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--a-200);
  box-shadow: inset 2px 0 0 var(--accent);
}
.sidebar nav a.active svg { opacity: 1; }
.sidebar-foot { margin-top: auto; padding-top: 14px; }

.main { flex: 1; min-width: 0; padding: 20px 24px 40px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
  padding-bottom: 16px; border-bottom: 1px solid var(--divider);
}
.topbar h1 { margin: 0; }
.topbar .user-box { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--n-400); }
.topbar-jam { text-align: right; line-height: 1.15; }
.topbar-jam .jam { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.topbar-jam .wib { font-size: 10.5px; color: var(--n-500); }

.menu-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--n-800);
  color: var(--n-300); cursor: pointer; font-size: 13.5px; font-weight: 500;
}
.menu-toggle:hover { background: var(--surface-2); color: var(--text); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 40;
}

/* ---------- Kartu ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.glass { background: var(--surface); }
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-header h3 { margin: 0; }
.card-kicker {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--n-400);
}

/* ---------- Kartu statistik ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 14px;
}
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-card .value {
  font-size: 32px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-card .sub { font-size: 12px; color: var(--n-500); }
.i-hijau { color: var(--hijau); }
.i-kuning { color: var(--kuning); }
.i-merah { color: var(--merah); }
.i-biru { color: var(--biru); }
.i-accent { color: var(--accent); }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--a-600); color: #fff; }
.btn-primary:hover { background: var(--a-500); }
.btn-ghost { background: transparent; border-color: var(--n-700); color: var(--n-300); }
.btn-ghost:hover { background: rgba(233,233,237,0.07); color: var(--text); }
.btn-success { background: #2f7d54; color: #eafaf0; }
.btn-success:hover { background: #38946389; }
.btn-danger { background: #8f4247; color: #fdeaea; }
.btn-danger:hover { background: #a34c52; }
.btn-warning { background: #8a6a2f; color: #fdf3e2; }
.btn-warning:hover { background: #9e7a36; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Form ---------- */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-size: 12.5px; font-weight: 500; color: var(--n-400);
}
.form-control {
  width: 100%; padding: 10px 12px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--n-800); border-radius: 8px;
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.form-control::placeholder { color: var(--n-600); }
.form-control:disabled { opacity: .6; }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239397ab' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}
textarea.form-control { min-height: 92px; resize: vertical; }
input[type="date"].form-control, input[type="time"].form-control { color-scheme: dark; }
input[type="file"].form-control { padding: 8px 12px; }
.switch-row { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--n-300); }
.switch-row input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left; padding: 10px 12px;
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--n-500); font-weight: 600;
  border-bottom: 1px solid var(--divider); white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--n-900); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: rgba(233,233,237,0.03); }
.total-row td { background: var(--surface-2); font-weight: 600; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; flex: none;
  background: var(--a-800); color: var(--a-100);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.badge-plain::before { display: none; }
.badge-success { background: rgba(127,206,155,0.14); color: var(--hijau-t); }
.badge-warning { background: rgba(230,181,102,0.14); color: var(--kuning-t); }
.badge-danger  { background: rgba(214,138,138,0.14); color: var(--merah-t); }
.badge-info    { background: var(--a-900); color: var(--a-200); }
.badge-biru    { background: rgba(143,184,224,0.14); color: var(--biru-t); }
.badge-muted   { background: rgba(147,151,171,0.14); color: var(--n-300); }

/* ---------- Donat & grafik ---------- */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { flex: none; position: relative; }
.donut-center {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
}
.donut-center .big { font-size: 26px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.donut-center .kecil { font-size: 10.5px; color: var(--n-500); }
.legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 150px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-val { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; }
.bar-area { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar {
  width: 100%; border-radius: 5px 5px 0 0;
  background: var(--a-600); min-height: 3px;
  transition: height .3s ease;
}
.bar-label { font-size: 10.5px; color: var(--n-500); }
.bar-val { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Kalender ---------- */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { text-align: center; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--n-500); padding: 4px 0; font-weight: 600; }
.cal-cell {
  min-height: 62px; border-radius: 8px; padding: 6px 7px;
  background: var(--bg-2); border: 1px solid var(--n-900);
  display: flex; flex-direction: column; gap: 3px; overflow: hidden;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell .tgl { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal-cell.kerja { background: rgba(127,206,155,0.10); border-color: rgba(127,206,155,0.28); }
.cal-cell.merah { background: rgba(214,138,138,0.10); border-color: rgba(214,138,138,0.28); }
.cal-cell.merah .tgl { color: var(--merah-t); }
.cal-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-cell.today .tgl { color: var(--a-200); }
.cal-badge {
  font-size: 10px; font-weight: 600; align-self: flex-start;
  background: rgba(127,206,155,0.20); color: var(--hijau-t);
  padding: 1px 6px; border-radius: 20px;
}
.cal-libur { font-size: 9px; line-height: 1.15; color: var(--merah-t); margin-top: auto; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12px; color: var(--n-500); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .lg { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.lg-kerja { background: rgba(127,206,155,0.45); }
.lg-merah { background: rgba(214,138,138,0.45); }
.lg-today { border: 2px solid var(--accent); }
.lg-hadir { background: rgba(127,206,155,0.28); border-radius: 20px; }

/* ---------- Halaman auth / publik ---------- */
.center-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 30px 26px; box-shadow: var(--shadow-md);
}
.logo-title { text-align: center; margin-bottom: 22px; }
.logo-title .mark {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 15px;
  background: var(--a-800); color: var(--a-100);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  box-shadow: 0 0 30px -8px var(--accent); overflow: hidden;
}
.logo-title .mark img { width: 100%; height: 100%; object-fit: cover; }
.logo-title h1 { font-size: 20px; margin-bottom: 4px; }
.logo-title p { color: var(--n-500); font-size: 13px; margin: 0; }

/* ---------- Alur absensi pegawai ---------- */
.step-panel { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.co-info { margin-bottom: 6px; }
.steps { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; }
.step-dot { width: 34px; height: 4px; border-radius: 4px; background: var(--n-800); transition: background .25s ease; }
.step-dot.active { background: var(--accent); }

.pegawai-list { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; }
.pegawai-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px;
  background: var(--bg-2); border: 1px solid var(--n-900);
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.pegawai-item:hover { border-color: var(--accent); background: var(--surface-2); }
.pegawai-item .info { min-width: 0; flex: 1; }
.pegawai-item .nm { font-size: 14px; font-weight: 500; }
.pegawai-item .jb { font-size: 11.5px; color: var(--n-500); }
.pegawai-item .status-tag { margin-left: auto; flex: none; }
.pegawai-item.status-selesai { opacity: .55; }
.pegawai-item.status-selesai:hover { border-color: var(--n-900); background: var(--bg-2); }

.pin-display { display: flex; justify-content: center; gap: 13px; margin: 20px 0; }
.pin-dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--n-700); transition: background .15s ease, border-color .15s ease; }
.pin-dot.filled { background: var(--accent); border-color: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
  padding: 15px 0; text-align: center; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--n-800);
  font-size: 19px; font-weight: 500; cursor: pointer; user-select: none;
  transition: background .12s ease;
}
.key:hover { background: var(--surface-2); }
.key:active { background: var(--a-800); }
.key.wide { font-size: 13.5px; color: var(--n-400); }

.camera-wrap {
  width: 100%; aspect-ratio: 1/1; border-radius: var(--radius-lg);
  overflow: hidden; background: var(--bg-2); border: 1px solid var(--n-800);
}
.camera-wrap video, .camera-wrap img { width: 100%; height: 100%; object-fit: cover; }

.countdown-box {
  text-align: center; font-size: 38px; font-weight: 700; letter-spacing: 2px;
  padding: 18px 10px; margin: 16px 0; border-radius: var(--radius);
  background: var(--a-900); border: 1px solid var(--a-700);
  color: var(--a-200); font-variant-numeric: tabular-nums;
}
.countdown-box.siap {
  font-size: 19px; letter-spacing: 0;
  background: rgba(127,206,155,0.14); border-color: rgba(127,206,155,0.35); color: var(--hijau-t);
}

/* ---------- Modal konfirmasi ---------- */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10, 11, 18, 0.72);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.confirm-overlay.show { display: flex; }
.confirm-box {
  width: 100%; max-width: 380px; background: var(--surface);
  border-radius: var(--radius-lg); padding: 24px 22px;
  box-shadow: var(--shadow-lg); text-align: center;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.confirm-box .c-accent, .confirm-box .accent-bar {
  width: 46px; height: 4px; border-radius: 4px;
  background: var(--accent); margin: 0 auto 16px;
}
.confirm-box.danger .c-accent, .confirm-box.danger .accent-bar { background: var(--merah); }
.confirm-box .c-title, .confirm-box h4 {
  font-size: 17px; font-weight: 600; margin-bottom: 8px; line-height: 1.25;
}
.confirm-box .c-msg, .confirm-box p {
  font-size: 14px; color: var(--n-400); margin: 0 0 20px; line-height: 1.5;
}
.confirm-box .c-actions, .confirm-actions { display: flex; gap: 10px; }
.confirm-box .c-actions .btn, .confirm-actions .btn { flex: 1; }

/* ---------- Loading & toast ---------- */
.loading-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(10, 11, 18, 0.72);
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 16px;
}
.loading-overlay.show { display: flex; }
.spinner {
  width: 46px; height: 46px; border-radius: 50%;
  border: 4px solid var(--n-800); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay .l-text, .loading-text { font-size: 14px; font-weight: 500; color: var(--text); }

.toast-container {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 4000; display: flex; flex-direction: column; gap: 9px;
  width: calc(100% - 32px); max-width: 420px;
}
.toast {
  padding: 12px 16px; border-radius: 9px; font-size: 13.5px;
  background: var(--surface); box-shadow: var(--shadow-md);
  animation: slideDown .22s ease;
}
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.success { border-left: 3px solid var(--hijau); }
.toast.error { border-left: 3px solid var(--merah); }
.toast.warning { border-left: 3px solid var(--kuning); }

/* ---------- Peta ---------- */
.map-section { margin-top: 14px; border: 1px solid var(--n-800); border-radius: var(--radius); overflow: hidden; background: var(--bg-2); }
.map-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; background: transparent; border: none; cursor: pointer;
  color: var(--text); font-size: 14px; font-weight: 500; text-align: left;
}
.map-toggle:hover { background: rgba(233,233,237,0.05); }
.map-toggle .chevron { transition: transform .25s ease; font-size: 12px; color: var(--n-500); }
.map-section.open .map-toggle .chevron { transform: rotate(180deg); }
.map-body { display: none; padding: 14px; }
.map-section.open .map-body { display: block; }
.map-search-row { display: flex; gap: 8px; margin-bottom: 10px; position: relative; }
.map-search-row .form-control { margin: 0; }
.map-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 500;
  background: var(--surface); border: 1px solid var(--n-700);
  border-radius: 9px; overflow: hidden; max-height: 240px; overflow-y: auto; display: none;
  box-shadow: var(--shadow-md);
}
.map-results.show { display: block; }
.map-results button {
  display: block; width: 100%; text-align: left; padding: 10px 13px;
  background: none; border: none; border-bottom: 1px solid var(--n-900);
  color: var(--text); cursor: pointer; font-size: 13px; line-height: 1.4;
}
.map-results button:last-child { border-bottom: none; }
.map-results button:hover { background: var(--surface-2); }
#peta { height: 340px; width: 100%; border-radius: var(--radius); z-index: 1; }
/* Peta Leaflet memakai z-index internal s/d 700. Batasi agar tidak menutupi
   loading, dialog konfirmasi, dan toast milik sistem. */
/* isolation: isolate mengurung seluruh z-index internal Leaflet di dalam kotak
   peta, sehingga tidak pernah menembus loading/dialog/toast. Struktur internal
   Leaflet TIDAK diubah agar klik, geser, dan zoom tetap berfungsi normal. */
#peta, #peta-detail { position: relative; z-index: 1; isolation: isolate; }
.map-hint { font-size: 12.5px; color: var(--n-500); margin-top: 9px; line-height: 1.5; }
.map-loading-mini { font-size: 13px; color: var(--n-500); padding: 40px 0; text-align: center; }
.leaflet-container { background: #0d0f18; font-family: inherit; }
.leaflet-control-layers {
  background: var(--surface) !important; color: var(--text) !important;
  border: 1px solid var(--n-700) !important; border-radius: 8px !important;
}
.leaflet-control-layers label { color: var(--text) !important; font-size: 13px; }
.leaflet-control-layers-selector { accent-color: var(--accent); }

/* ---------- Logo di pengaturan ---------- */
.logo-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.logo-preview {
  width: 96px; height: 96px; flex: none; border-radius: var(--radius);
  background: var(--bg-2); border: 1px dashed var(--n-700);
  display: grid; place-items: center; overflow: hidden; padding: 6px;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-kosong { font-size: 11px; color: var(--n-600); text-align: center; padding: 0 6px; }

/* ---------- Detail absensi ---------- */
.info-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--n-900); font-size: 13.5px;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--n-500); flex: none; }
.info-val { text-align: right; word-break: break-word; }
.detail-foto { width: 100%; max-height: 250px; object-fit: cover; border-radius: var(--radius); margin-bottom: 12px; }
.detail-foto-kosong {
  width: 100%; height: 120px; display: grid; place-items: center;
  border-radius: var(--radius); margin-bottom: 12px;
  background: var(--bg-2); color: var(--n-600); font-size: 13px;
  border: 1px dashed var(--n-800);
}
.thumb { width: 40px; height: 40px; border-radius: 7px; object-fit: cover; cursor: pointer; }
.img-viewer {
  position: fixed; inset: 0; z-index: 3500; background: rgba(10,11,18,.9);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.img-viewer.show { display: flex; }
.img-viewer img { max-width: 100%; max-height: 100%; border-radius: var(--radius); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 34px 16px; color: var(--n-500); }
.empty-state svg { color: var(--n-700); margin-bottom: 10px; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* ---------- Tanda tangan laporan ---------- */
.ttd-block { display: flex; justify-content: flex-end; margin-top: 28px; }
.ttd-kol { text-align: center; line-height: 1.9; font-size: 13.5px; }
.ttd-space { height: 62px; }

/* ---------- Responsif ---------- */
@media (min-width: 861px) {
  html.sidebar-collapsed .sidebar { width: 0; padding-left: 0; padding-right: 0; opacity: 0; border-right-color: transparent; overflow: hidden; }
}
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100%; width: 260px;
    z-index: 50; transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .main { padding: 16px 15px 34px; }
  .topbar h1 { font-size: 18px; }
  .card { padding: 14px; margin-bottom: 12px; }
  .data-table { font-size: 12.5px; }
  .data-table th, .data-table td { padding: 9px 8px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 13px; }
  .stat-card .value { font-size: 25px; }
  .auth-card { padding: 24px 18px; }
  .cal-cell { min-height: 50px; padding: 4px; }
  .cal-cell .tgl { font-size: 11.5px; }
  .cal-badge { font-size: 8.5px; padding: 1px 4px; }
  .cal-libur { display: none; }
  .countdown-box { font-size: 31px; }
  .topbar-jam .jam { font-size: 16px; }
}

/* ---------- Cetak (PDF) ---------- */
@media print {
  @page { size: A4; margin: 15mm; }
  .no-print, .sidebar, .sidebar-overlay, .topbar, .menu-toggle { display: none !important; }
  html, body { background: #fff !important; color: #000 !important; }
  .layout { display: block; }
  .main { padding: 0 !important; }
  .card, .glass { background: #fff !important; box-shadow: none !important; margin: 0 0 10px; }
  .report-print, .report-print h3 { color: #000 !important; }
  .report-print .report-sub, .report-print .report-note { color: #333 !important; }
  .report-table { width: 100%; border-collapse: collapse; }
  .report-table th, .report-table td {
    border: 1px solid #333 !important; color: #000 !important;
    padding: 7px 8px !important; font-size: 12px;
  }
  .report-table thead th {
    background: #423a6a !important; color: #fff !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .report-table .total-row td {
    background: #e7e5fe !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .report-table strong { color: #000 !important; }
  .ttd-block { display: flex; justify-content: flex-end; margin-top: 34px; }
}

/* ===== Info jam kerja di halaman absensi pegawai ===== */
.jam-info {
  background: var(--bg-2); border: 1px solid var(--n-800);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px;
}
.jam-info-baris {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13.5px; padding: 4px 0; color: var(--n-400);
}
.jam-info-baris strong { color: var(--text); font-variant-numeric: tabular-nums; font-size: 15px; }
.jam-info-ket {
  margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--n-900);
  font-size: 12.5px; color: var(--n-500); text-align: center; line-height: 1.5;
}
.jam-info-ket strong { color: var(--a-300); }

/* ===== Topbar: subjudul, pencarian, aksi ===== */
.topbar-sub { font-size: 12.5px; color: var(--n-500); margin-top: 2px; }
.topbar-cari {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--n-800);
  border-radius: 8px; padding: 7px 12px; color: var(--n-500);
}
.topbar-cari input {
  background: none; border: none; outline: none; color: var(--text);
  font-size: 13.5px; width: 170px;
}
.topbar-cari input::placeholder { color: var(--n-600); }
.topbar-cari:focus-within { border-color: var(--accent); }
.user-nama { display: inline-flex; align-items: center; gap: 6px; }

/* ===== Kartu statistik: ikon & tren ===== */
.stat-ikon { display: inline-flex; }
.value-sub { font-size: 15px; color: var(--n-500); font-weight: 400; }
.tren-naik { color: var(--hijau); font-weight: 600; }
.tren-turun { color: var(--merah); font-weight: 600; }

/* ===== Tata letak dashboard ===== */
.dash-grid-2 { display: grid; grid-template-columns: 400px 1fr; gap: 14px; }
.dash-grid-tren { display: grid; grid-template-columns: 1fr 380px; gap: 14px; }

/* ===== Legenda kecil pada judul kartu ===== */
.mini-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--n-500); }
.mini-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ml-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ===== Batang nol (garis tipis) ===== */
.bar-nol { min-height: 2px !important; height: 2px !important; opacity: .45; }

/* ===== Grafik garis (tren mingguan) ===== */
.line-chart { position: relative; height: 150px; margin-top: 6px; }
.line-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.line-dot {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--accent);
  transform: translate(-50%, -50%); cursor: default;
}
.line-labels { display: flex; margin-top: 10px; }
.line-labels .line-label { flex: 1; text-align: left; }
.line-labels .line-label:last-child { text-align: right; }
.ll-hari { font-size: 12px; color: var(--n-400); }
.ll-persen { font-size: 12px; color: var(--n-600); font-variant-numeric: tabular-nums; }
.line-label.kini .ll-hari { color: var(--text); font-weight: 500; }
.tren-rata { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--hijau); }
.tren-rata strong { color: var(--hijau); }

/* ===== Daftar "Perlu Perhatian" ===== */
.hitung-badge {
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 7px;
  background: var(--surface-2); color: var(--n-300);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.perhatian-list { display: flex; flex-direction: column; gap: 4px; }
.perhatian-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 4px; border-radius: 8px; transition: background .15s ease;
}
.perhatian-item:hover { background: rgba(233,233,237,0.04); }
.pi-ikon {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--a-900); color: var(--a-300);
  display: grid; place-items: center;
}
.pi-info { flex: 1; min-width: 0; }
.pi-nama { font-size: 13.5px; font-weight: 500; }
.pi-jab { font-size: 11.5px; color: var(--n-500); }

@media (max-width: 1100px) {
  .dash-grid-2, .dash-grid-tren { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar-cari { display: none; }
  .user-nama { display: none; }
}
@media (max-width: 560px) {
  .line-labels .ll-hari { font-size: 10.5px; }
  .line-labels .ll-persen { font-size: 10.5px; }
  .bar-label { font-size: 9.5px; }
}

/* ===== Modal form (popup tengah layar) ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1800;
  background: rgba(10, 11, 18, 0.72);
  display: none; align-items: flex-start; justify-content: center;
  padding: 28px 18px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.show { display: flex; }
.modal-box {
  width: 100%; max-width: 640px; margin: auto;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modalPop .2s ease;
}
@keyframes modalPop {
  from { transform: translateY(10px) scale(.97); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--divider);
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .modal-sub { font-size: 12.5px; color: var(--n-500); margin-top: 4px; line-height: 1.45; }
.modal-tutup {
  flex: none; width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 1px solid var(--n-800); color: var(--n-400);
  display: grid; place-items: center; cursor: pointer;
}
.modal-tutup:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px 20px; }
.modal-body .form-group:last-of-type { margin-bottom: 0; }
.modal-kaki {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px 18px; border-top: 1px solid var(--divider);
}
body.modal-terbuka { overflow: hidden; }

@media (max-width: 560px) {
  .modal-overlay { padding: 14px 12px; }
  .modal-box { max-width: 100%; }
  .modal-head { padding: 15px 16px 12px; }
  .modal-body { padding: 15px 16px; }
  .modal-kaki { padding: 12px 16px 15px; }
  .modal-kaki .btn { flex: 1; }
}

/* ===== Poster QR Absensi ===== */
.qr-layout { display: grid; grid-template-columns: 1fr 380px; gap: 14px; align-items: start; }

.qr-poster {
  background: #ffffff; color: #111827;
  border-radius: var(--radius); padding: 30px 34px 26px;
  text-align: center; font-family: var(--font);
}
.qp-kop { display: flex; align-items: center; gap: 16px; text-align: left; }
.qp-logo { width: 68px; height: 68px; flex: none; object-fit: contain; }
.qp-logo-teks {
  border-radius: 14px; background: #423a6a; color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 20px;
}
.qp-kop-teks { flex: 1; min-width: 0; }
.qp-pemerintah { font-size: 12.5px; letter-spacing: .12em; color: #6b7280; font-weight: 600; }
.qp-kantor { font-size: 21px; font-weight: 700; line-height: 1.2; margin: 2px 0; color: #111827; }
.qp-alamat { font-size: 12.5px; color: #6b7280; }
.qp-garis { height: 3px; background: #423a6a; margin: 14px 0 20px; border-radius: 3px; }

.qp-judul { font-size: 26px; font-weight: 800; letter-spacing: .04em; color: #111827; }
.qp-subjudul { font-size: 13.5px; color: #4b5563; margin-top: 4px; }

.qp-qr-wrap { position: relative; display: inline-block; margin: 20px auto 6px; padding: 16px; }
.qp-qr-kotak {
  background: #fff; padding: 12px; border-radius: 10px;
  border: 1px solid #e5e7eb;
}
.qp-qr-kotak img, .qp-qr-kotak canvas { display: block; }
.qp-sudut { position: absolute; width: 30px; height: 30px; border: 4px solid #423a6a; }
.qp-sudut-kiri-atas   { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 8px 0 0 0; }
.qp-sudut-kanan-atas  { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 8px 0 0; }
.qp-sudut-kiri-bawah  { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 8px; }
.qp-sudut-kanan-bawah { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 8px 0; }

.qp-jam {
  display: flex; align-items: center; justify-content: center; gap: 26px;
  margin: 14px auto 20px; padding: 12px 22px;
  background: #f5f4ff; border: 1px solid #e0ddf7; border-radius: 12px;
  width: fit-content;
}
.qp-jam-item { text-align: center; }
.qp-jam-label { font-size: 10.5px; letter-spacing: .1em; color: #6b7280; font-weight: 600; }
.qp-jam-nilai { font-size: 22px; font-weight: 700; color: #423a6a; font-variant-numeric: tabular-nums; }
.qp-jam-pisah { width: 1px; height: 34px; background: #d8d5ee; }

.qp-langkah { text-align: left; margin-top: 4px; }
.qp-langkah-judul {
  font-size: 11px; letter-spacing: .12em; color: #6b7280;
  font-weight: 700; text-align: center; margin-bottom: 10px;
}
.qp-langkah-baris { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.qp-langkah-item {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12px; color: #374151; line-height: 1.4;
}
.qp-no {
  flex: none; width: 21px; height: 21px; border-radius: 50%;
  background: #423a6a; color: #fff; font-size: 11.5px; font-weight: 700;
  display: grid; place-items: center;
}
.qp-kaki {
  margin-top: 20px; padding-top: 14px; border-top: 1px dashed #d1d5db;
  font-size: 11.5px; color: #6b7280; line-height: 1.55;
}

.info-box {
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--a-900); border: 1px solid var(--a-800);
  font-size: 13px; line-height: 1.6; color: var(--n-300);
}
.info-box strong { color: var(--a-200); }

@media (max-width: 1100px) { .qr-layout { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .qr-poster { padding: 20px 16px; }
  .qp-judul { font-size: 20px; }
  .qp-kantor { font-size: 17px; }
  .qp-langkah-baris { grid-template-columns: 1fr 1fr; }
}

/* Cetak poster QR: satu halaman penuh, tanpa elemen panel */
@media print {
  .qr-layout { display: block; }
  .qr-poster {
    padding: 0; border-radius: 0;
    background: #fff !important; color: #000 !important;
  }
  .qp-kantor, .qp-judul { color: #000 !important; }
  .qp-garis, .qp-no, .qp-sudut { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qp-jam { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .qp-qr-wrap { margin-top: 26px; }
}

/* ===== Tabel laporan: lebar kolom & warna persentase ===== */
.report-table .kol-no  { width: 40px; }
.report-table .kol-num { width: 62px; }
.report-table .kol-nama { min-width: 170px; }
.report-table .kol-jab  { min-width: 150px; }
.persen-baik { color: var(--hijau); font-weight: 600; }
.persen-kurang { color: var(--merah); font-weight: 600; }

/* Cetak laporan: rapi, tidak terpotong, ada judul kolom di tiap halaman */
@media print {
  .report-table { table-layout: fixed; width: 100%; font-size: 10.5px; }
  .report-table thead { display: table-header-group; }
  .report-table tr { page-break-inside: avoid; }
  .report-table th, .report-table td {
    padding: 5px 4px !important; font-size: 10.5px !important;
    word-wrap: break-word; overflow-wrap: break-word;
  }
  .report-table .kol-no  { width: 4%; }
  .report-table .kol-nama { width: 20%; }
  .report-table .kol-jab  { width: 18%; }
  .report-table .kol-num  { width: 7.7%; }
  .report-table th br { display: none; }
  .persen-baik, .persen-kurang { color: #000 !important; }
  .table-wrap { overflow: visible !important; }
  .report-note { font-size: 10px !important; }
}

/* ===== Kamera: hitung mundur & tombol aksi foto ===== */
.camera-wrap { position: relative; }
.cam-hitung {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 84px; height: 84px; border-radius: 50%;
  background: rgba(10, 11, 18, 0.55);
  border: 3px solid rgba(255, 255, 255, 0.85);
  color: #fff; font-size: 38px; font-weight: 700;
  display: grid; place-items: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  pointer-events: none;
}
.cam-tombol { display: flex; gap: 10px; }
.cam-tombol .btn { flex: 1; }

/* ===== Kenyamanan sentuh di layar HP ===== */
.btn, .menu-toggle, .modal-tutup, .key, .pegawai-item, .map-toggle,
.sidebar nav a, .cal-cell, [data-buka-modal], [data-tutup-modal] {
  touch-action: manipulation;              /* hilangkan jeda ~300ms saat disentuh */
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 860px) {
  /* Ukuran sentuh minimum yang nyaman (rekomendasi 44px) */
  .btn { min-height: 42px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; padding: 8px 12px; }
  .menu-toggle { min-height: 40px; min-width: 40px; }
  .modal-tutup { width: 38px; height: 38px; }
  /* Tombol utama pada toolbar melebar penuh agar mudah ditekan */
  .card > .flex.between > .btn,
  .card > div > .btn.btn-primary { flex: 1 1 auto; justify-content: center; }
}

/* ===== Peringatan sesi akan berakhir ===== */
.sesi-peringatan {
  position: fixed; right: 18px; bottom: 18px; z-index: 3800;
  display: none; max-width: 320px;
}
.sesi-peringatan.show { display: block; }
.sesi-peringatan .sp-isi {
  background: var(--surface); border: 1px solid var(--kuning);
  border-left-width: 4px; border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 8px;
}
.sesi-peringatan strong { font-size: 14px; color: var(--kuning-t); }
.sesi-peringatan span { font-size: 13px; color: var(--n-400); line-height: 1.5; }
.sesi-peringatan b { color: var(--text); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .sesi-peringatan { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}
/* ============================================================
   KALENDER: pindah bulan tanpa muat ulang halaman
   ============================================================ */
.kal-info { font-size: 13px; margin: 2px 0 10px; }
.kal-info strong { color: var(--a-200); }

/* Sel kalender muncul lembut saat bulan berganti. Hanya opacity dan
   geseran kecil, sehingga tinggi kartu tidak berubah dan layar tidak
   ikut melompat. */
.kal-masuk .cal-cell { animation: kalMasuk .22s ease both; }
@keyframes kalMasuk {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.kal-sibuk { opacity: .55; transition: opacity .15s ease; }

/* Penanda tanggal merah hasil perkiraan (belum ada SKB resmi) */
.cal-libur.kira { opacity: .85; }
.cal-libur.kira::after {
  content: " (perkiraan)";
  font-style: italic; opacity: .75;
}

/* ============================================================
   DASHBOARD: animasi masuk untuk grafik tren & donat
   ============================================================ */
@keyframes dashNaik {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.dash-anim { animation: dashNaik .5s cubic-bezier(.22,.9,.3,1) both; }
.dash-anim.d1 { animation-delay: .05s; }
.dash-anim.d2 { animation-delay: .15s; }
.dash-anim.d3 { animation-delay: .25s; }

/* Donat: muncul sambil berputar sedikit */
@keyframes donatMasuk {
  from { opacity: 0; transform: rotate(-25deg) scale(.88); }
  to   { opacity: 1; transform: none; }
}
.donut-anim svg { animation: donatMasuk .7s cubic-bezier(.22,.9,.3,1) both; }
.donut-anim .donut-center { animation: dashNaik .5s ease .25s both; }
.donut-anim .legend-item { animation: dashNaik .4s ease both; }
.donut-anim .legend-item:nth-child(1) { animation-delay: .20s; }
.donut-anim .legend-item:nth-child(2) { animation-delay: .28s; }
.donut-anim .legend-item:nth-child(3) { animation-delay: .36s; }
.donut-anim .legend-item:nth-child(4) { animation-delay: .44s; }

/* Batang grafik tumbuh dari bawah, satu per satu */
@keyframes barTumbuh { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-anim .bar { transform-origin: bottom; animation: barTumbuh .55s cubic-bezier(.22,.9,.3,1) both; }
.bar-anim .bar-col:nth-child(1) .bar { animation-delay: .05s; }
.bar-anim .bar-col:nth-child(2) .bar { animation-delay: .11s; }
.bar-anim .bar-col:nth-child(3) .bar { animation-delay: .17s; }
.bar-anim .bar-col:nth-child(4) .bar { animation-delay: .23s; }
.bar-anim .bar-col:nth-child(5) .bar { animation-delay: .29s; }
.bar-anim .bar-col:nth-child(6) .bar { animation-delay: .35s; }
.bar-anim .bar-col:nth-child(7) .bar { animation-delay: .41s; }
.bar-anim .bar-col:nth-child(8) .bar { animation-delay: .47s; }

/* Grafik tren tersingkap dari kiri ke kanan (tanpa perlu tahu panjang garis) */
@keyframes trenSingkap { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.line-anim .line-svg { animation: trenSingkap .9s cubic-bezier(.3,.8,.4,1) both; }
.line-anim .line-dot { animation: dashNaik .35s ease both; }
.line-anim .line-dot:nth-of-type(1) { animation-delay: .25s; }
.line-anim .line-dot:nth-of-type(2) { animation-delay: .35s; }
.line-anim .line-dot:nth-of-type(3) { animation-delay: .45s; }
.line-anim .line-dot:nth-of-type(4) { animation-delay: .55s; }
.line-anim .line-dot:nth-of-type(5) { animation-delay: .65s; }
.line-anim .line-dot:nth-of-type(6) { animation-delay: .75s; }
.line-anim .line-dot:nth-of-type(7) { animation-delay: .85s; }

/* Hormati pengaturan HP yang meminta animasi dikurangi */
@media (prefers-reduced-motion: reduce) {
  .kal-masuk .cal-cell,
  .dash-anim,
  .donut-anim svg,
  .donut-anim .donut-center,
  .donut-anim .legend-item,
  .bar-anim .bar,
  .line-anim .line-svg,
  .line-anim .line-dot { animation: none !important; clip-path: none !important; }
}

/* ============================================================
   ISIAN JAM 24 JAM & PEMILIH BULAN INDONESIA
   Tampilannya sama persis di Android, iPhone, maupun komputer
   karena tidak lagi bergantung pada bahasa perangkat.
   ============================================================ */
.jam24, .bulan-id { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.jam24 .form-control, .bulan-id .form-control { min-width: 0; }
.jam24 .jam24-j, .jam24 .jam24-m {
  flex: 0 0 auto; width: 86px; text-align: center;
  font-variant-numeric: tabular-nums; letter-spacing: .5px;
}
.jam24-sep { font-weight: 700; font-size: 17px; color: var(--n-300); margin: 0 -2px; }
.jam24-wib { font-size: 12.5px; color: var(--n-400); letter-spacing: .4px; }
.bulan-id .bulanid-b { flex: 1 1 auto; min-width: 118px; }
.bulan-id .bulanid-t { flex: 0 0 auto; width: 104px; }

@media (max-width: 560px) {
  .jam24 .jam24-j, .jam24 .jam24-m { width: 74px; }
  .jam24-wib { font-size: 11.5px; }
  .bulan-id .bulanid-b { min-width: 0; }
  .bulan-id .bulanid-t { width: 92px; }
}
/* Layar sangat kecil: biarkan turun baris daripada terpotong */
@media (max-width: 360px) {
  .jam24 { flex-wrap: wrap; }
  .jam24-wib { flex-basis: 100%; }
}

/* ============================================================
   SIDEBAR: buka-tutup lebih halus
   ============================================================ */
/* Semua sifat yang berubah ikut dianimasikan, bukan hanya transform,
   supaya penyempitan di layar besar tidak terasa mematah. */
.sidebar {
  transition: transform .3s cubic-bezier(.4,0,.2,1),
              width .3s cubic-bezier(.4,0,.2,1),
              padding .3s cubic-bezier(.4,0,.2,1),
              opacity .24s ease,
              border-color .3s ease;
  will-change: transform, width;
}

/* Lapisan gelap kini memudar, bukan muncul mendadak.
   display:none diganti visibility agar bisa dianimasikan. */
.sidebar-overlay {
  display: block; visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity .28s ease, visibility .28s ease;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.sidebar-overlay.show { visibility: visible; opacity: 1; pointer-events: auto; }

/* Kunci gulir halaman selagi laci terbuka di layar kecil */
body.sidebar-terbuka { overflow: hidden; }

/* Menu di dalam laci muncul berurutan saat laci dibuka */
@media (max-width: 860px) {
  .sidebar.open nav a { animation: navMasuk .32s ease both; }
  .sidebar.open nav a:nth-child(1) { animation-delay: .04s; }
  .sidebar.open nav a:nth-child(2) { animation-delay: .07s; }
  .sidebar.open nav a:nth-child(3) { animation-delay: .10s; }
  .sidebar.open nav a:nth-child(4) { animation-delay: .13s; }
  .sidebar.open nav a:nth-child(5) { animation-delay: .16s; }
  .sidebar.open nav a:nth-child(6) { animation-delay: .19s; }
  .sidebar.open nav a:nth-child(7) { animation-delay: .22s; }
  .sidebar.open nav a:nth-child(8) { animation-delay: .25s; }
  .sidebar.open nav a:nth-child(9) { animation-delay: .28s; }
}
@keyframes navMasuk {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: none; }
}

/* Tombol menu berputar halus saat ditekan */
.menu-toggle { transition: transform .25s ease, background-color .2s ease; }
.menu-toggle:active { transform: scale(.92); }

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-overlay, .menu-toggle { transition: none !important; }
  .sidebar.open nav a { animation: none !important; }
}

/* ============================================================
   PENYESUAIAN LAYAR (dukungan semua perangkat)
   ============================================================ */
/* Tabel lebar tetap dapat digulir menyamping di HP */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Hindari peramban HP memperbesar font sendiri saat isian disentuh:
   ukuran 16px mencegah layar ikut membesar (zoom) di iPhone. */
@media (max-width: 860px) {
  .form-control, select.form-control, input.form-control, textarea.form-control { font-size: 16px; }
  .btn { min-height: 42px; }
  .card-header { flex-wrap: wrap; gap: 8px; }
}

/* Layar sangat kecil: tombol pada kepala kartu dibuat penuh dan rapi */
@media (max-width: 420px) {
  .card-header .flex { width: 100%; }
  .card-header .btn-sm { flex: 1 1 auto; justify-content: center; }
  .cal-legend { flex-wrap: wrap; gap: 8px 12px; }
}

/* Layar sangat lebar: batasi lebar isi agar tidak terlalu melebar */
@media (min-width: 1700px) {
  .main > .card, .main > .stat-grid, .main > .dash-grid-2, .main > .dash-grid-tren { max-width: 1560px; }
}

/* ============================================================
   PETA: penyesuaian layar & kelancaran
   ============================================================ */
/* Tinggi peta menyesuaikan layar. Di HP dibuat lebih pendek supaya
   ubin yang perlu diunduh lebih sedikit -> lebih ringan dan cepat. */
#peta { height: clamp(260px, 42vh, 420px); }

@media (max-width: 560px) {
  #peta { height: 280px; }
  /* Tombol pilihan Satelit / Peta Jalan dibuat lebih kecil agar tidak
     menutupi peta di layar sempit. */
  .leaflet-control-layers { font-size: 12.5px; }
  .leaflet-control-layers-expanded { padding: 7px 9px; }
  /* Tombol +/- diperbesar agar mudah disentuh jari */
  .leaflet-touch .leaflet-bar a { width: 34px; height: 34px; line-height: 34px; }
}

/* Perpindahan ubin dibuat melembut supaya tidak terasa berkedip */
.leaflet-tile { transition: opacity .22s ease; }
.leaflet-fade-anim .leaflet-tile { will-change: opacity; }

/* Penanda (pin) bergerak halus saat dipindahkan */
.leaflet-marker-icon { transition: transform .12s ease-out; }
.leaflet-dragging .leaflet-marker-icon { transition: none; }


@media (prefers-reduced-motion: reduce) {
  .leaflet-tile, .leaflet-marker-icon { transition: none !important; }
}
