:root {
  --tema-utama: #059669;
  --tema-aksen: #0d9488;
  --tema-font: "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif;
  --s-hadir: #10b981;
  --s-telat: #f59e0b;
  --s-izin: #3b82f6;
  --s-sakit: #8b5cf6;
  --s-cuti: #06b6d4;
  --s-alpa: #ef4444;
  color-scheme: light;
}
html[data-mode="gelap"], html.dark {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
html, body { margin: 0; }
body {
  font-family: var(--tema-font, "Plus Jakarta Sans"), system-ui, sans-serif;
  font-feature-settings: "tnum" 1;
}
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.lompat {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: #059669; color: #fff; padding: 10px 14px;
  border-radius: 10px; font-weight: 700; text-decoration: none;
}
.lompat:focus { top: 12px; }

/* Navigasi aktif (desktop & mobile) */
.nav { color: #64748b; }
.dark .nav { color: #94a3b8; }
.nav:hover { background: rgba(148, 163, 184, 0.1); color: #0f172a; }
.dark .nav:hover { color: #f8fafc; }
.nav.aktif { background: #ecfdf5; color: #047857; }
.dark .nav.aktif { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.nav-bawah { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
.nav-bawah .nav.aktif { background: rgba(5, 150, 105, 0.1); color: #047857; }
.dark .nav-bawah .nav.aktif { background: rgba(16, 185, 129, 0.18); color: #34d399; }

/* Halaman transisi clean */
.hal:not([hidden]) { animation: halNaik .18s ease; }
@keyframes halNaik { from { opacity: 0; } }

/* Custom non-native dropdowns & pickers */
.dd.buka .dd-chev { transform: rotate(180deg); }
.dd-btn:focus-visible, .dp-day:focus-visible, .tp-cell:focus-visible {
  outline: 2px solid #059669;
  outline-offset: 1px;
}
.dd-opt {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px;
  border-radius: 10px; padding: 8px 11px; font-size: 13px; font-weight: 600;
  text-align: left; color: #334155; transition: background-color .14s, color .14s;
}
.dark .dd-opt { color: #e2e8f0; }
.dd-opt:hover { background: #f1f5f9; color: #0f172a; }
.dark .dd-opt:hover { background: #1e293b; color: #ffffff; }
.dd-opt.aktif { background: #ecfdf5; color: #047857; font-weight: 700; }
.dark .dd-opt.aktif { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.dd-opt.aktif::after { content: "✓"; font-size: 11px; font-weight: 800; flex-shrink: 0; }

.dp-day {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px;
  font-size: 12px; font-weight: 600; color: #334155; transition: background-color .14s, color .14s;
}
.dark .dp-day { color: #cbd5e1; }
.dp-day:hover { background: #ecfdf5; color: #047857; }
.dark .dp-day:hover { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.dp-day.luar { opacity: .35; }
.dp-day.kini { box-shadow: inset 0 0 0 1.5px #059669; }
.dp-day.aktif, .dp-day.aktif:hover { background: #059669; color: #ffffff; font-weight: 800; }

.tp-cell {
  display: flex; width: 100%; align-items: center; justify-content: center;
  border-radius: 8px; padding: 5px 6px; font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: #334155; transition: background-color .12s, color .12s;
}
.dark .tp-cell { color: #cbd5e1; }
.tp-cell:hover { background: #f1f5f9; color: #0f172a; }
.dark .tp-cell:hover { background: #1e293b; color: #ffffff; }
.tp-cell.aktif, .tp-cell.aktif:hover { background: #059669; color: #ffffff; font-weight: 700; }

/* Tombol Absen & Progress Ring */
.cincin circle { fill: none; stroke-width: 6; }
.cincin-bg { stroke: #e2e8f0; }
.dark .cincin-bg { stroke: #1e293b; }
.cincin-isi {
  stroke: #059669;
  stroke-linecap: round;
  stroke-dasharray: 641;
  stroke-dashoffset: 641;
  transition: stroke-dashoffset .8s cubic-bezier(.22, 1, .36, 1);
}
.dark .cincin-isi { stroke: #10b981; }
.tombol-absen { background: #059669; color: #ffffff; }
.tombol-absen:hover { background: #047857; }
.tombol-absen.pulang { background: #0f172a; color: #ffffff; box-shadow: 0 14px 28px -12px rgba(15, 23, 42, 0.35); }
.tombol-absen.pulang:hover { background: #1e293b; }
.dark .tombol-absen.pulang { background: #f8fafc; color: #0f172a; box-shadow: 0 14px 28px -12px rgba(248, 250, 252, 0.18); }
.dark .tombol-absen.pulang:hover { background: #e2e8f0; }
.tombol-absen.selesai {
  background: linear-gradient(135deg, #059669, #0d9488);
  color: #ffffff;
  box-shadow: 0 12px 24px -10px rgba(5, 150, 105, 0.35);
}

/* Status Pill & Clean Soft Avatar */
.avatar {
  width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center;
  font-weight: 700; font-size: 12.5px; letter-spacing: -.01em; flex: none; position: relative; overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.dark .avatar { border-color: rgba(255, 255, 255, 0.08); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.status {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 8px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.st-hadir, .st-disetujui { color: #047857; background: #ecfdf5; }
.st-telat, .st-menunggu { color: #b45309; background: #fffbeb; }
.st-izin { color: #1d4ed8; background: #eff6ff; }
.st-sakit { color: #6d28d9; background: #f5f3ff; }
.st-cuti { color: #0e7490; background: #ecfeff; }
.st-alpa, .st-ditolak { color: #b91c1c; background: #fef2f2; }
.st-belum, .st-libur { color: #64748b; background: #f1f5f9; }
.dark .st-hadir, .dark .st-disetujui { color: #34d399; background: rgba(16, 185, 129, 0.14); }
.dark .st-telat, .dark .st-menunggu { color: #fbbf24; background: rgba(245, 158, 11, 0.15); }
.dark .st-izin { color: #93c5fd; background: rgba(59, 130, 246, 0.15); }
.dark .st-sakit { color: #c4b5fd; background: rgba(139, 92, 246, 0.16); }
.dark .st-cuti { color: #67e8f9; background: rgba(6, 182, 212, 0.15); }
.dark .st-alpa, .dark .st-ditolak { color: #f87171; background: rgba(239, 68, 68, 0.16); }
.dark .st-belum, .dark .st-libur { color: #94a3b8; background: #1e293b; }

/* Donut Chart */
.donat .seg-d { fill: none; stroke-width: 11; transition: stroke-dasharray .75s cubic-bezier(.22, 1, .36, 1), stroke-dashoffset .75s cubic-bezier(.22, 1, .36, 1); }
.donat .dasar { fill: none; stroke: #f1f5f9; stroke-width: 11; }
.dark .donat .dasar { stroke: #1e293b; }
.donat text { stroke: none; fill: #0f172a; font-family: inherit; text-anchor: middle; font-variant-numeric: tabular-nums; }
.dark .donat text { fill: #f8fafc; }
.donat .angka { font-size: 23px; font-weight: 800; letter-spacing: -.03em; }
.donat .ket { font-size: 9.5px; fill: #64748b; font-weight: 600; }
.dark .donat .ket { fill: #94a3b8; }

.legenda li {
  display: grid; grid-template-columns: 8px 1fr auto; align-items: center;
  gap: 4px 10px; font-size: 12.5px; font-weight: 600; color: #334155;
}
.dark .legenda li { color: #cbd5e1; }
.legenda .titik { width: 8px; height: 8px; border-radius: 3px; }
.legenda .batang { grid-column: 2 / 4; height: 4px; border-radius: 99px; background: #f1f5f9; overflow: hidden; }
.dark .legenda .batang { background: #1e293b; }
.legenda .batang i { display: block; height: 100%; border-radius: inherit; }

/* Kalender Tiles */
.kal .hd { font-size: 11px; font-weight: 700; color: #64748b; text-align: center; padding-bottom: 4px; }
.dark .kal .hd { color: #94a3b8; }
.hari {
  height: 54px; border-radius: 11px; border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
  background: #f8fafc; color: #0f172a; transition: opacity .15s, transform .12s;
}
@media (max-width: 639px) {
  .hari { height: auto; aspect-ratio: 1; }
}
@media (min-width: 1280px) {
  .hari { height: 58px; }
}
.dark .hari { background: #1e293b; color: #f8fafc; }
.hari:not(.kosong):active { transform: scale(.95); }
.hari small { font-size: 9.5px; font-weight: 600; opacity: .9; }
.hari.kosong { background: transparent; pointer-events: none; }
.hari.hadir { background: #10b981; color: #fff; }
.hari.telat { background: #f59e0b; color: #1c1917; }
.hari.izin { background: #3b82f6; color: #fff; }
.hari.sakit { background: #8b5cf6; color: #fff; }
.hari.cuti { background: #06b6d4; color: #fff; }
.hari.alpa { background: #ef4444; color: #fff; }
.hari.libur { background: transparent; border: 1px solid #e2e8f0; color: #94a3b8; }
.dark .hari.libur { border-color: #334155; color: #64748b; }
.hari.nanti { background: transparent; border: 1px dashed #e2e8f0; color: #94a3b8; }
.dark .hari.nanti { border-color: #334155; color: #64748b; }
.hari.kini { box-shadow: inset 0 0 0 2px #0f172a; }
.dark .hari.kini { box-shadow: inset 0 0 0 2px #f8fafc; }
.hari.dipilih { outline: 2.5px solid #059669; outline-offset: 2px; }
.dark .hari.dipilih { outline-color: #34d399; }

/* Sticky table column consistency */
.tabel tbody tr:hover td { background: #f8fafc; }
.dark .tabel tbody tr:hover td { background: #1e293b; }

/* Segmented Tabs Izin */
.seg { color: #64748b; }
.dark .seg { color: #94a3b8; }
.seg[aria-selected="true"] { background: #059669; color: #ffffff; }

/* Saklar & Input Form */
.saklar input {
  appearance: none; width: 42px; height: 24px; border-radius: 99px;
  background: #cbd5e1; position: relative; flex: none; cursor: pointer; transition: background-color .2s; margin: 0;
}
.dark .saklar input { background: #334155; }
.saklar input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,.22); transition: transform .22s ease;
}
.saklar input:checked { background: #059669; }
.saklar input:checked::after { transform: translateX(18px); }
input[aria-invalid="true"], textarea[aria-invalid="true"], .dd-btn[aria-invalid="true"] { border-color: #dc2626 !important; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

.hari-kerja { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.hari-kerja label { position: relative; }
.hari-kerja input { position: absolute; opacity: 0; inset: 0; }
.hari-kerja span {
  display: grid; place-items: center; height: 38px; border-radius: 10px;
  border: 1px solid #e2e8f0; font-weight: 700; font-size: 11.5px; cursor: pointer; color: #475569;
  transition: background-color .14s, color .14s, border-color .14s;
}
.dark .hari-kerja span { border-color: #334155; color: #cbd5e1; }
.hari-kerja input:checked + span { background: #059669; color: #fff; border-color: #059669; }

/* PIN Dialog */
dialog::backdrop { background: rgba(2, 6, 23, 0.56); backdrop-filter: blur(4px); }
.pin-titik i {
  width: 14px; height: 14px; border-radius: 99px; border: 2px solid #cbd5e1;
  transition: background-color .15s, border-color .15s, transform .15s;
}
.dark .pin-titik i { border-color: #475569; }
.pin-titik i.isi { background: #059669; border-color: #059669; transform: scale(1.15); }
.pin-titik.salah { animation: goyang .35s; }
@keyframes goyang { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

.selfie {
  position: relative; aspect-ratio: 3 / 4; max-height: 48vh; border-radius: 18px;
  overflow: hidden; background: #0f172a; display: grid; place-items: center; color: #cbd5e1; text-align: center;
}
.selfie video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.selfie .bingkai { position: absolute; inset: 14% 18% 24%; border: 2px dashed rgba(255,255,255,.5); border-radius: 50% / 45%; pointer-events: none; }

.foto-kecil { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; margin-top: 10px; border: 1px solid #e2e8f0; }
.dark .foto-kecil { border-color: #334155; }

/* Hasil absen */
.hasil .centang {
  width: 72px; height: 72px; border-radius: 99px; display: grid; place-items: center;
  background: #059669; color: #fff;
}
.hasil .centang.telat { background: #d97706; }
.hasil .centang svg { width: 34px; height: 34px; stroke-width: 2.5; }

/* Toast & Pop-up animasi */
.toast { transform: translate(-50%, 120px); opacity: 0; pointer-events: none; transition: transform .3s ease, opacity .2s ease; }
.toast.tampil { transform: translate(-50%, 0); opacity: 1; }
.proto-card { animation: halNaik .2s ease; }

@media (max-width: 560px) {
  .hari small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
