/* =========================================================
   Absensi Lapangan — gaya dasar
   ========================================================= */
:root {
  --primary: #8c1d40;
  --primary-dark: #6e1632;
  --primary-soft: #f8d7e1;
  --primary-text: #8c1d40;    /* warna utama untuk teks/ikon di atas latar (mode gelap: versi terang) */
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --link: #8c1d40;
  --surface-2: #f9fafb;        /* latar halus: hover tombol, kutipan, footer popup */
  --surface-3: #f3f4f6;        /* chip, hitungan tab, bar progres */
  --border-strong: #d1d5db;
  --primary-faint: #fdf2f5;
  --success-text: #166534;
  --warning-text: #92400e;
  --danger-text: #991b1b;
  --danger-soft-2: #fecaca;
  --danger-faint: #fff5f5;
  --danger-border: #fca5a5;
  --info-text: #1e40af;
  --indigo-soft: #eef2ff;
  --indigo-text: #3730a3;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------------------------------------------------------
   Mode gelap: aktif bila <html data-tema-aktif="gelap">.
   Diatur tema.js — ikuti HP/laptop, atau dipilih sendiri (Profil / tombol di topbar).
   --------------------------------------------------------- */
:root[data-tema-aktif="gelap"] {
  color-scheme: dark;
  --primary: #b8365f;
  --primary-dark: #a3294f;
  --primary-soft: #4a1426;
  --primary-faint: #2a1119;
  --primary-text: #f28ba8;
  --link: #f28ba8;
  --bg: #0f1418;
  --surface: #182027;
  --surface-2: #1d262e;
  --surface-3: #263039;
  --text: #e5e7eb;
  --muted: #9aa4b2;
  --border: #2d3843;
  --border-strong: #4b5563;
  --success: #22c55e; --success-soft: #123d24; --success-text: #86efac;
  --warning: #f59e0b; --warning-soft: #3d2606; --warning-text: #fcd34d;
  --danger: #ef4444; --danger-soft: #4a1518; --danger-soft-2: #6b1d1d; --danger-faint: #2a1517; --danger-border: #b91c1c; --danger-text: #fca5a5;
  --info: #60a5fa; --info-soft: #172554; --info-text: #93c5fd;
  --indigo-soft: #1e1b4b; --indigo-text: #a5b4fc;
  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .4);
}
/* Peta: ubin OpenStreetMap dibuat gelap (penanda & lingkaran radius tetap berwarna asli) */
:root[data-tema-aktif="gelap"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9); }
:root[data-tema-aktif="gelap"] .leaflet-container { background: #1b2228; }
:root[data-tema-aktif="gelap"] .leaflet-bar a,
:root[data-tema-aktif="gelap"] .leaflet-control-attribution { background: var(--surface); color: var(--muted); border-color: var(--border); }
:root[data-tema-aktif="gelap"] .leaflet-control-attribution a { color: var(--link); }
:root[data-tema-aktif="gelap"] .leaflet-popup-content-wrapper,
:root[data-tema-aktif="gelap"] .leaflet-popup-tip { background: var(--surface); color: var(--text); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
body.auth-loading .app { visibility: hidden; }
a { color: var(--link); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, opacity .15s;
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { padding: .9rem 1.4rem; font-size: 1.05rem; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }

/* ---------- Form ---------- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .35rem; font-size: .9rem; }
.input, select, textarea {
  width: 100%; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; background: var(--surface); color: var(--text);
}
.input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.field-error { color: var(--danger); font-size: .8rem; margin-top: .25rem; }
.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .9rem; }
.alert-danger { background: var(--danger-soft); color: var(--danger-text); }
.alert-info { background: var(--info-soft); color: var(--info-text); }
.alert-warning { background: var(--warning-soft); color: var(--warning-text); }

/* ---------- Kartu & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.card + .card { margin-top: 1rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.card-header h2 { margin: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stack > * + * { margin-top: 1rem; }
.grid > .card + .card { margin-top: 0; }   /* jarak antar kartu di grid cukup dari gap (tidak dobel / tidak turun sebelah) */

.stat { display: flex; align-items: center; gap: 1rem; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.tone-primary { background: var(--primary-soft); color: var(--primary-text); }
.tone-success { background: var(--success-soft); color: var(--success); }
.tone-warning { background: var(--warning-soft); color: var(--warning); }
.tone-danger  { background: var(--danger-soft);  color: var(--danger); }
.tone-info    { background: var(--info-soft);    color: var(--info); }

/* ---------- Badge ---------- */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-soft); color: var(--success-text); }
.badge-warning { background: var(--warning-soft); color: var(--warning-text); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger-text); }
.badge-info    { background: var(--info-soft);    color: var(--info-text); }
.badge-muted   { background: var(--surface-3); color: var(--muted); }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: none; }

/* ---------- Spinner & state kosong ---------- */
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: .5rem; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 1rem; right: 1rem; left: 1rem; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; pointer-events: none; }
.toast { pointer-events: auto; max-width: 380px; width: 100%; background: #111827; color: #fff; padding: .8rem 1rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: .9rem; animation: toast-in .2s ease-out; border-left: 4px solid var(--info); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* =========================================================
   Layout aplikasi (sidebar + topbar)
   ========================================================= */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: #3d0c1d; color: #fbe4ec;
  display: flex; flex-direction: column; z-index: 50; transition: transform .2s;
}
.sidebar-brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.25rem; font-weight: 700; color: #fff; font-size: 1.05rem; }
.sidebar-brand .logo { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); display: grid; place-items: center; }
.sidebar-brand .logo svg { width: 20px; height: 20px; }
.sidebar-brand-logo { flex-direction: column; align-items: stretch; gap: .45rem; padding: 1rem 1rem .75rem; }
.sidebar-brand-logo .logo-perusahaan { display: block; width: 100%; height: auto; border-radius: 6px; }
.sidebar-brand-logo .nama-aplikasi { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #f9c9d7; text-align: center; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #f4a6bd; opacity: .8; padding: 1rem .6rem .35rem; }
.nav-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-radius: 9px; color: #fbe4ec; font-weight: 500; margin-bottom: 2px; }
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-link:hover { background: rgba(255,255,255,.07); }
.nav-link.active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: .75rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-footer .nav-link { width: 100%; background: none; border: none; font: inherit; cursor: pointer; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 1rem; padding: 0 1.5rem;
}
.topbar-title { font-weight: 700; font-size: 1.1rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user { display: flex; align-items: center; gap: .6rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.topbar-user .meta { line-height: 1.2; text-align: right; }
.topbar-user .meta .role { font-size: .75rem; color: var(--muted); }
.menu-toggle { display: none; background: none; border: none; padding: .4rem; cursor: pointer; color: var(--text); }
.menu-toggle svg { width: 24px; height: 24px; }
.content { padding: 1.5rem; flex: 1; width: 100%; max-width: 1200px; }
.page-head { margin-bottom: 1.25rem; }
.backdrop { display: none; }

/* Bottom nav (karyawan, layar kecil) */
.bottom-nav { display: none; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 1rem; }
  .topbar-user .meta { display: none; }
  .content { padding: 1rem; }

  body.role-karyawan .content { padding-bottom: calc(var(--bottomnav-h) + 1rem); }
  body.role-karyawan .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottomnav-h);
    background: var(--surface); border-top: 1px solid var(--border); z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .7rem; font-weight: 600; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--primary-text); }
  /* Tombol "Absen" di tengah menu bawah: bulat menonjol, gampang ditekan dengan jempol */
  .bottom-nav a.cta { color: var(--primary-text); }
  .bottom-nav a.cta svg { width: 26px; height: 26px; padding: 11px; box-sizing: content-box; border-radius: 50%;
    background: var(--primary); color: #fff; margin-top: -30px; border: 4px solid var(--surface);
    box-shadow: 0 6px 16px rgba(140, 29, 64, .35); }
}

/* =========================================================
   Halaman login
   ========================================================= */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(160deg, #3d0c1d 0%, #8c1d40 55%, #c2416b 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-brand .logo { width: 56px; height: 56px; border-radius: 14px; background: var(--primary); color: #fff; display: inline-grid; place-items: center; margin-bottom: .75rem; }
.auth-brand .logo svg { width: 30px; height: 30px; }
.auth-brand .logo-perusahaan { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto 1rem; border-radius: 6px; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 2.75rem; }
.password-toggle { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--muted); padding: .3rem; }
.password-toggle svg { width: 20px; height: 20px; }

/* =========================================================
   Komponen dashboard karyawan
   ========================================================= */
.hero { background: linear-gradient(135deg, var(--primary) 0%, #c2416b 100%); color: #fff; border: none; }
:root[data-tema-aktif="gelap"] .hero { background: linear-gradient(135deg, #7a1838 0%, #a3294f 100%); }   /* burgundy lebih pekat di mode gelap */
.hero .clock { font-size: 2.4rem; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.hero .btn { background: #fff; color: var(--primary); border-color: #fff; }
.absen-status { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.absen-box { background: rgba(255,255,255,.15); border-radius: 10px; padding: .75rem; }
.absen-box .label { font-size: .8rem; opacity: .85; }
.absen-box .value { font-size: 1.2rem; font-weight: 700; }

/* Beranda karyawan: status hari ini jelas dalam sekali lihat (dipakai di lapangan, layar HP, sering di bawah matahari) */
.hero-atas { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.hero-info { opacity: .92; }
.status-chip { display: inline-flex; align-items: center; padding: .22rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; background: rgba(255,255,255,.22); color: #fff; }
.status-chip.belum { background: #fef3c7; color: #92400e; }
.status-chip.bekerja { background: #fff; color: #166534; }
.status-chip.bekerja::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: #16a34a; margin-right: .4rem; }
.status-chip.selesai { background: rgba(255,255,255,.25); color: #fff; }
.absen-box .ket { font-size: .74rem; opacity: .88; margin-top: .1rem; }
.hero-catatan { display: flex; gap: .5rem; align-items: flex-start; margin-top: .9rem; padding: .6rem .75rem; border-radius: 10px; background: rgba(0,0,0,.18); font-size: .84rem; line-height: 1.45; }
.hero-catatan svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.btn-absen-utama { margin-top: 1rem; font-size: 1.12rem; padding: 1rem 1.2rem; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.btn-absen-utama svg { width: 22px; height: 22px; }
.task-item { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--border); color: inherit; }
.task-item:last-child { border-bottom: none; }
.task-item .isi { min-width: 0; }
.task-item .judul { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-item .meta { font-size: .78rem; color: var(--muted); }
.task-item .meta.lewat { color: var(--danger); font-weight: 600; }
.ringkas-task { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.ringkas-task:empty { display: none; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.placeholder-card { text-align: center; padding: 3rem 1.5rem; }
.placeholder-card svg { width: 48px; height: 48px; color: var(--primary-text); opacity: .6; margin-bottom: .75rem; }

/* =========================================================
   Tahap 2: toolbar, modal, paginasi, peta, chip, switch
   ========================================================= */
.page-head.with-action { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.page-head.with-action h1 { margin: 0; }
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .input, .toolbar select { width: auto; flex: 1 1 160px; min-width: 0; }
.toolbar .search { flex: 3 1 220px; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-icon { padding: .4rem; width: 34px; height: 34px; }
.btn-icon svg { width: 17px; height: 17px; }
.actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: nowrap; }
.table td.actions-cell { width: 1%; white-space: nowrap; }
.table tr.inactive td { color: var(--muted); }
.table tr.inactive td:first-child { opacity: .7; }
.cell-user { display: flex; align-items: center; gap: .65rem; }
.cell-user .avatar { width: 32px; height: 32px; font-size: .75rem; }
.cell-user .sub { font-size: .8rem; color: var(--muted); }
.list-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.pager { display: flex; gap: .5rem; }
.chip { display: inline-block; padding: .1rem .5rem; border-radius: 6px; background: var(--surface-3); font-size: .78rem; margin: 1px 2px 1px 0; white-space: nowrap; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
/* HP: tulisan sedikit lebih besar & tombol lebih tinggi (min. 44 px) — enak dibaca & ditekan di lapangan */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .btn:not(.btn-sm):not(.btn-icon) { min-height: 44px; }
  .hero .clock { font-size: 2.8rem; }
}
.form-hint { font-size: .8rem; color: var(--muted); margin-top: .25rem; }
.check-list { border: 1px solid var(--border); border-radius: 10px; max-height: 180px; overflow-y: auto; padding: .35rem; }
.check-list label { display: flex; align-items: center; gap: .55rem; padding: .4rem .5rem; border-radius: 7px; font-weight: 400; margin: 0; cursor: pointer; }
.check-list label:hover { background: var(--surface-2); }
.check-list input { width: 17px; height: 17px; accent-color: var(--primary); }

/* Switch */
.switch { display: flex; align-items: center; gap: .75rem; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; width: 42px; height: 24px; background: var(--border-strong); border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }

/* Modal */
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .5); z-index: 900; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; overflow-y: auto; animation: fade-in .15s; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 520px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-lg { max-width: 780px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { margin: 0; }
.modal-close { background: none; border: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 .25rem; }
.modal-body { padding: 1.25rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
@keyframes fade-in { from { opacity: 0; } }
/* HP: modal layar penuh dengan tinggi TETAP - judul & tombol selalu terlihat, hanya isi yang di-scroll.
   (Dulu kotak putih dipaksa setinggi layar sementara isinya lebih tinggi, sehingga sisa form
   "tembus" ke halaman di belakang, mis. form Ubah Lokasi.) */
@media (max-width: 600px) {
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { border-radius: 0; height: 100%; display: flex; flex-direction: column; }
  .modal-header, .modal-footer { flex: none; }
  .modal-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .modal-footer { border-radius: 0; }
}

/* Peta */
.map { height: 360px; border-radius: 10px; border: 1px solid var(--border); z-index: 0; }
.map-sm { height: 280px; }
.map-tools { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.range-row { display: flex; align-items: center; gap: .75rem; }
.range-row input[type=range] { flex: 1; accent-color: var(--primary); }
.range-row .input { width: 90px; flex: none; }

/* Detail JSON audit */
.kv { font-size: .8rem; color: var(--muted); }
.kv b { color: var(--text); font-weight: 600; }

/* =========================================================
   Tahap 3: halaman absen & riwayat
   ========================================================= */
.absen-wrap { max-width: 640px; margin: 0 auto; }
.step-title { display: flex; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.step-num.done { background: var(--success); color: #fff; }
.gps-status { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .75rem; font-size: .9rem; }
.camera-box { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 60vh; background: #111827; border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
.camera-box video, .camera-box img { width: 100%; height: 100%; object-fit: cover; }
.camera-box video.mirror { transform: scaleX(-1); }
.camera-box .camera-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #e5e7eb; padding: 1.5rem; font-size: .9rem; }
.camera-actions { display: flex; gap: .5rem; margin-top: .75rem; }
.camera-actions .btn { flex: 1; }
.shutter { width: 64px; height: 64px; border-radius: 50%; border: 4px solid #fff; background: rgba(255,255,255,.25); position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.shutter:active { background: rgba(255,255,255,.6); }
.submit-bar { position: sticky; bottom: 0; padding: .75rem 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 900px) { body.role-karyawan .submit-bar { bottom: var(--bottomnav-h); } }
.hasil { text-align: center; }
.hasil .hasil-icon { width: 64px; height: 64px; border-radius: 50%; display: inline-grid; place-items: center; margin-bottom: .75rem; }
.hasil .hasil-icon svg { width: 32px; height: 32px; }
.hasil img { width: 100%; max-width: 320px; border-radius: 10px; margin: 1rem auto; display: block; }
.hari-card { display: grid; grid-template-columns: 70px 1fr; gap: .75rem; padding: .85rem 0; border-bottom: 1px solid var(--border); }
.hari-card:last-child { border-bottom: none; }
.hari-tgl { text-align: center; background: var(--surface-2); border-radius: 10px; padding: .4rem .25rem; align-self: start; }
.hari-tgl .d { font-size: 1.4rem; font-weight: 700; line-height: 1.1; }
.hari-tgl .m { font-size: .75rem; color: var(--muted); }
.absen-row { display: flex; align-items: center; gap: .65rem; padding: .25rem 0; }
.absen-row .thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; cursor: pointer; background: var(--border); flex-shrink: 0; border: none; padding: 0; }
.absen-row .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.absen-row .info { flex: 1; min-width: 0; }
.absen-row .jam { font-weight: 700; }
.absen-row .meta { font-size: .8rem; color: var(--muted); }
.foto-besar { width: 100%; border-radius: 10px; display: block; }

/* =========================================================
   Tahap 4: task & verifikasi
   ========================================================= */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab { padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; color: var(--muted); display: inline-flex; align-items: center; gap: .4rem; }
.tab .count { background: var(--surface-3); color: var(--text); border-radius: 999px; padding: 0 .45rem; font-size: .75rem; }
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab.active .count { background: rgba(255,255,255,.25); color: #fff; }
.text-danger { color: var(--danger); }
.radio-group { display: flex; gap: .5rem; flex-wrap: wrap; }
.radio-group label { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--border); border-radius: 9px; padding: .45rem .75rem; cursor: pointer; font-weight: 500; margin: 0; }
.radio-group input { accent-color: var(--primary); }
.radio-group label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
textarea.input { min-height: 80px; resize: vertical; }

.bukti-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.bukti-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.bukti-card .foto { position: relative; aspect-ratio: 4 / 3; background: #111827; cursor: zoom-in; border: none; padding: 0; display: block; width: 100%; overflow: hidden; }
.bukti-card .foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.bukti-card .body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: .5rem; }
.bukti-card .body h3 { margin: 0; }
.bukti-card .meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
.bukti-card .footer { display: flex; gap: .5rem; padding: 0 1rem 1rem; }
.bukti-card .footer .btn { flex: 1; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #15803d; }
.quote { background: var(--surface-2); border-left: 3px solid var(--border); padding: .5rem .75rem; border-radius: 6px; font-size: .88rem; }
.chips-pilih { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.chips-pilih button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: .3rem .7rem; font: inherit; font-size: .8rem; cursor: pointer; }
.chips-pilih button:hover { border-color: var(--primary); color: var(--primary-text); }

.task-card { display: block; color: inherit; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.task-card + .task-card { margin-top: .75rem; }
.task-card:hover { border-color: var(--primary); }
.task-card .top { display: flex; justify-content: space-between; gap: .75rem; align-items: flex-start; }
.task-card h3 { margin: 0 0 .25rem; }
.task-card .meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin-top: .4rem; }
.riwayat-bukti { display: flex; gap: .75rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.riwayat-bukti:last-child { border-bottom: none; }
.riwayat-bukti .thumb { width: 72px; height: 72px; flex-shrink: 0; border-radius: 8px; overflow: hidden; border: none; padding: 0; cursor: zoom-in; background: var(--border); }
.riwayat-bukti .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* =========================================================
   Tahap 5: review absensi
   ========================================================= */
.flag-list { margin: 0; padding: .5rem .75rem .5rem 1.6rem; background: var(--warning-soft); color: var(--warning-text); border-radius: 8px; font-size: .84rem; }
.flag-list li + li { margin-top: .2rem; }
.gps-ringkas { display: flex; flex-wrap: wrap; gap: .3rem; }
.gps-ringkas .chip { background: var(--indigo-soft); color: var(--indigo-text); }
.stat-link { color: inherit; }
.stat-link:hover .card { border-color: var(--primary); }

/* =========================================================
   Tahap 6: laporan
   ========================================================= */
.stat-mini { padding: .8rem 1rem; }
.stat-mini .stat-value { font-size: 1.35rem; }
.persen { display: flex; align-items: center; gap: .5rem; min-width: 110px; }
.persen .bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.persen .bar span { display: block; height: 100%; border-radius: 999px; }
.table tr.klik { cursor: pointer; }
.table tr.klik:hover td { background: var(--surface-2); }
.jam-btn { background: none; border: none; padding: 0; font: inherit; cursor: zoom-in; color: inherit; display: inline-flex; align-items: center; gap: .35rem; }
.jam-btn strong { text-decoration: underline dotted; text-underline-offset: 3px; }
.num { text-align: center !important; }

.kalender { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.kalender .kepala { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); padding: .2rem 0; }
.kalender .hari { min-height: 56px; border-radius: 8px; padding: .3rem .35rem; font-size: .75rem; border: 1px solid transparent; background: var(--surface); color: var(--text); text-align: left; font-family: inherit; cursor: default; }
.kalender .hari .tgl { font-weight: 700; font-size: .85rem; }
.kalender .hari .jam { color: var(--text); }
.kalender .hari.ada { cursor: pointer; }
.kalender .hari.ada:hover { border-color: var(--primary); }
.kalender .hari.pilih { outline: 2px solid var(--primary); }
.kalender .kosong { visibility: hidden; }
.st-hadir { background: var(--success-soft) !important; }
.st-terlambat { background: var(--warning-soft) !important; }
.st-perlu_review { background: var(--info-soft) !important; }
.st-ditolak { background: var(--danger-soft-2) !important; }
.st-tidak_hadir { background: var(--danger-soft) !important; }
.st-libur { background: var(--surface-3) !important; color: var(--muted); }
.st-belum_absen, .st-mendatang { background: var(--surface) !important; border-color: var(--border) !important; color: var(--muted); }
.st-belum_bergabung { background: var(--surface-2) !important; color: var(--border-strong); }
.legenda { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .78rem; color: var(--muted); margin-top: .75rem; }
.legenda span { display: inline-flex; align-items: center; gap: .35rem; }
.legenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--border); }
@media (max-width: 600px) { .kalender .hari { min-height: 44px; font-size: .68rem; } .kalender .hari .jam { display: none; } }

/* =========================================================
   Notifikasi & Pantau Langsung
   ========================================================= */
.topbar { position: sticky; }
.notif-btn { position: relative; background: none; border: none; padding: .45rem; border-radius: 10px; cursor: pointer; color: var(--text); display: inline-flex; }
.notif-btn:hover { background: var(--surface-3); }
.notif-btn svg { width: 22px; height: 22px; }
.notif-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.notif-panel { position: absolute; top: calc(var(--topbar-h) - 6px); right: 1rem; width: 380px; max-width: calc(100vw - 2rem); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.18); z-index: 60; overflow: hidden; }
.notif-head, .notif-foot { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .75rem 1rem; }
.notif-head { border-bottom: 1px solid var(--border); }
.notif-foot { border-top: 1px solid var(--border); flex-wrap: wrap; font-size: .85rem; background: var(--surface-2); }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item { display: flex; gap: .75rem; width: 100%; text-align: left; padding: .75rem 1rem; border: none; border-bottom: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.belum { background: var(--primary-faint); }
.notif-item.belum strong::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: .4rem; vertical-align: middle; }
.notif-item .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
.notif-item .stat-icon svg { width: 18px; height: 18px; }
.notif-item .isi { display: flex; flex-direction: column; min-width: 0; font-size: .88rem; }
.notif-item .pesan { color: var(--muted); }
.notif-item .waktu { color: var(--muted); font-size: .75rem; margin-top: .15rem; }
.link-btn { background: none; border: none; padding: 0; color: var(--primary-text); font: inherit; font-size: .85rem; cursor: pointer; font-weight: 600; }
.toast-notif { display: flex; gap: .6rem; align-items: flex-start; text-align: left; border-left-color: var(--primary); cursor: pointer; font: inherit; color: #fff; }
.toast-notif svg { flex-shrink: 0; margin-top: 2px; }
@media (max-width: 600px) { .notif-panel { right: .5rem; left: .5rem; width: auto; max-width: none; } }

.live { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; color: var(--muted); }
.live .titik { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(22,163,74,.6); animation: denyut 2s infinite; }
.live.mati .titik { background: #9ca3af; animation: none; }
@keyframes denyut { 70% { box-shadow: 0 0 0 8px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.pantau-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1rem; margin-top: 1rem; }
@media (max-width: 1000px) { .pantau-grid { grid-template-columns: 1fr; } }
.pantau-grid .map { height: 460px; }
.feed { max-height: 460px; overflow-y: auto; margin: 0 -1.25rem -1.25rem; }
.feed-item { display: flex; gap: .7rem; padding: .7rem 1.25rem; border-top: 1px solid var(--border); font-size: .88rem; }
.feed-item.baru { animation: sorot 3s ease-out; }
@keyframes sorot { from { background: var(--primary-soft); } to { background: transparent; } }
.feed-item .stat-icon { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; }
.feed-item .stat-icon svg { width: 16px; height: 16px; }
.feed-item .waktu { color: var(--muted); font-size: .75rem; }
.kontak { display: inline-flex; gap: .3rem; }
.peta-popup img { width: 160px; border-radius: 8px; display: block; margin-top: .4rem; cursor: zoom-in; }

/* =========================================================
   Monitor Tim & permintaan bantuan
   ========================================================= */
.btn-danger:hover { background: #b91c1c; }
.monitor-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1rem; margin-top: 1rem; align-items: start; }
.monitor-grid > .card + .card { margin-top: 0; }
@media (max-width: 1000px) { .monitor-grid { grid-template-columns: 1fr; } }
@media (min-width: 1001px) { .monitor-list { max-height: 560px; overflow-y: auto; } }
.banner-darurat { display: flex; align-items: center; gap: .6rem; color: var(--danger-text); border: 1px solid var(--danger-border); animation: kedip 1.6s ease-in-out infinite; }
.banner-darurat svg { flex-shrink: 0; }
@keyframes kedip { 50% { background: var(--danger-soft-2); } }
@media (prefers-reduced-motion: reduce) { .banner-darurat, .bantuan-card.baru { animation: none; } }
.tim-item { display: flex; align-items: flex-start; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.tim-item:last-child { border-bottom: none; }
.tim-item .isi { flex: 1; min-width: 0; }
.tim-item .baris { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .4rem; }
.bantuan-card { border: 1px solid var(--border); border-radius: 10px; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .4rem; background: var(--surface); }
.bantuan-card + .bantuan-card { margin-top: .6rem; }
.bantuan-card.darurat { border-color: var(--danger-border); background: var(--danger-faint); box-shadow: inset 4px 0 0 var(--danger); }
.bantuan-card.baru { animation: sorot 3s ease-out; }
.bantuan-card .atas { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.bantuan-card .meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.bantuan-card .aksi { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.bantuan-card .aksi .spacer { flex: 1; }
.table tr.lewat td { background: var(--danger-faint); }
.progres-bar { display: flex; gap: 2px; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-3); }
.progres-bar span { display: block; min-width: 4px; }
.progres-legenda { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .82rem; color: var(--muted); margin-top: .6rem; }
.progres-legenda span { display: inline-flex; align-items: center; gap: .35rem; }
.progres-legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.progres-legenda strong { color: var(--text); }

/* Karyawan: ajakan & daftar permintaan bantuan */
.bantuan-cta { display: flex; align-items: center; gap: .9rem; border-color: var(--danger-soft-2); background: var(--danger-faint); }
.bantuan-cta .isi { flex: 1; min-width: 0; }
@media (max-width: 480px) { .bantuan-cta { flex-wrap: wrap; } .bantuan-cta .btn { width: 100%; } }
.bantuan-item { padding: .75rem 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: .35rem; }
.bantuan-item:last-child { border-bottom: none; }
.bantuan-item.darurat { box-shadow: inset 3px 0 0 var(--danger); padding-left: .75rem; }
.bantuan-item .atas { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.bantuan-item .meta { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .2rem .8rem; }
.radio-group .pilih-darurat:has(input:checked) { border-color: var(--danger); background: var(--danger-soft); color: var(--danger-text); }

/* Penjaga lokasi: layar peringatan saat lokasi HP mati di jam kerja (penjaga-lokasi.js) —
   di atas popup (900), di bawah toast (1000) */
body.penjaga-lokasi-aktif { overflow: hidden; }
.penjaga-lokasi { position: fixed; inset: 0; z-index: 950; background: rgba(17, 24, 39, .72); display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fade-in .15s; }
.penjaga-kartu { background: var(--surface); border-radius: 16px; width: 100%; max-width: 420px; padding: 1.5rem; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.penjaga-ikon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto .75rem; display: flex; align-items: center; justify-content: center; background: var(--danger-soft); color: var(--danger); }
.penjaga-kartu h2 { margin: 0 0 .5rem; color: var(--danger); }
.penjaga-kartu p { margin: 0; }
.penjaga-langkah { text-align: left; margin: .9rem 0 1.1rem; padding-left: 1.25rem; line-height: 1.6; }

/* Form Buat Task: pilih banyak karyawan sekaligus (admin/task.js) */
.pilih-karyawan { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.pilih-alat { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .5rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.pilih-alat .input { flex: 1; min-width: 160px; }
.form-group .pilih-karyawan label { display: flex; align-items: center; gap: .55rem; margin: 0; font-weight: 500; cursor: pointer; }
.form-group .pilih-karyawan .pilih-semua { white-space: nowrap; font-size: .9rem; }
.pilih-daftar { max-height: 240px; overflow-y: auto; padding: .25rem 0; }
.pilih-item { padding: .5rem .75rem; }
.pilih-item:hover { background: var(--surface-3); }
.pilih-item:has(input:checked) { background: var(--primary-soft); }
.pilih-karyawan input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--primary); }

/* =========================================================
   Halaman unduh aplikasi (/unduh): satu tautan untuk Android & iPhone
   ========================================================= */
.unduh-card { max-width: 460px; }
.unduh-card .auth-brand { margin-bottom: 1rem; }
.unduh-card .auth-brand h1 { font-size: 1.35rem; margin: 0 0 .25rem; }
.unduh-opsi { border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-top: 1rem; }
.unduh-opsi h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.unduh-info { margin-top: .45rem; text-align: center; }
.langkah { margin: .85rem 0 0; padding-left: 1.2rem; line-height: 1.55; }
.langkah li + li { margin-top: .35rem; }
.unduh-lain { margin-top: .75rem; }
.unduh-lain summary { cursor: pointer; color: var(--link); font-weight: 600; }
.unduh-tukar { text-align: center; margin: 1rem 0 0; }
.unduh-bagikan { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); text-align: center; overflow-wrap: anywhere; }
.unduh-bagikan code { background: var(--surface-3); padding: .1rem .4rem; border-radius: 6px; }
