/* Absensi v2 worker app */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --teal: #0f766e; --teal-d: #115e59; --bg: #f1f5f4; --card: #fff;
  --ink: #1f2937; --mut: #6b7280; --line: #e5e7eb;
  --ok: #16a34a; --warn: #d97706; --err: #dc2626;
}
body { font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; }
.wrap { max-width: 480px; margin: 0 auto; padding: 12px 14px 40px; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { width: 42px; height: 42px; border-radius: 12px; background: var(--teal); color: #fff; font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.app-name { font-weight: 700; font-size: 17px; }
.clock-line { font-size: 13px; color: var(--mut); font-variant-numeric: tabular-nums; }
.clock-line #clock { font-weight: 600; color: var(--teal-d); }
.lang-btn { border: 1.5px solid var(--teal); background: #fff; color: var(--teal); font-weight: 700; padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; }

.view-title { font-size: 17px; margin-bottom: 14px; }

/* logged-in user bar */
.me-bar { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.me-ava { width: 40px; height: 40px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.me-info { flex: 1; min-width: 0; }
.me-info b { display: block; font-size: 14.5px; }
.me-info small { color: var(--mut); font-size: 12px; }
.icon-btn { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 11px; font-size: 15px; cursor: pointer; color: var(--err); }

/* tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.tab-btn { padding: 10px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--mut); cursor: pointer; }
.tab-btn.sel { border-color: var(--teal); background: #ecfdf5; color: var(--teal-d); }

.pending-bar[hidden] { display: none; }
.pending-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.pending-bar button { background: #d97706; color: #fff; border: 0; border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }

.card { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.field { display: block; margin-bottom: 14px; }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--mut); margin-bottom: 6px; }
.req { color: var(--err); font-style: normal; }

/* type-ahead search */
.search-wrap { position: relative; }
.search-input, .pin-input { width: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 15px; background: #fff; color: var(--ink); }
.search-input:focus, .pin-input:focus { outline: none; border-color: var(--teal); }
.pin-input { letter-spacing: 6px; font-size: 18px; }
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.12); z-index: 20; max-height: 260px; overflow-y: auto; }
.search-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid #f3f4f6; }
.search-item:last-child { border-bottom: 0; }
.search-item:hover { background: #f0fdfa; }
.search-item b { display: block; font-size: 14px; }
.search-item small { color: var(--mut); font-size: 12px; }

.picked-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; background: #ecfdf5; border: 1.5px solid var(--teal); color: var(--teal-d); border-radius: 10px; padding: 9px 12px; font-weight: 600; font-size: 14px; }
.picked-chip.other { background: #eef2ff; border-color: #6366f1; color: #3730a3; }
.chip-x { border: 0; background: none; font-size: 14px; cursor: pointer; color: inherit; }

/* for-other */
.for-other-bar { margin-bottom: 12px; }
.for-other-btn { width: 100%; padding: 10px; border: 1.5px dashed #6366f1; background: #eef2ff; color: #3730a3; border-radius: 10px; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.for-other-btn.on { border-style: solid; }
.other-picker { margin-bottom: 14px; }
.other-picker[hidden] { display: none; }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.type-btn .t-ico { font-size: 22px; }
.type-btn.sel { border-color: var(--teal); background: #ecfdf5; color: var(--teal-d); box-shadow: 0 0 0 2px rgba(15,118,110,.15); }

.profile-chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.p-chip { background: #f0fdfa; border: 1px solid #ccfbf1; color: var(--teal-d); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; }

.selfie-row { display: flex; align-items: center; gap: 12px; }
.photo-btn { flex: 1; padding: 13px; border: 1.5px dashed var(--teal); background: #f0fdfa; color: var(--teal-d); border-radius: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
#photoPreview { width: 64px; height: 64px; object-fit: cover; border-radius: 12px; border: 2px solid var(--teal); }

.loc-row { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; flex-wrap: wrap; }
.loc-line { font-size: 13px; color: var(--mut); flex: 1; min-width: 160px; }
.loc-line.ok { color: var(--ok); }
.loc-line.fail { color: var(--warn); }
.gps-btn { border: 1.5px solid var(--teal); background: #f0fdfa; color: var(--teal-d); border-radius: 10px; padding: 9px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.gps-btn[hidden] { display: none; }
.gps-btn:active { background: #ccfbf1; }

.submit-btn { width: 100%; padding: 16px; background: var(--teal); color: #fff; border: 0; border-radius: 14px; font-size: 17px; font-weight: 700; cursor: pointer; }
.submit-btn:active { background: var(--teal-d); }
.submit-btn:disabled { opacity: .6; }

.toast { margin-top: 12px; padding: 12px; border-radius: 10px; font-size: 14px; background: #eef2ff; }
.toast.ok { background: #dcfce7; color: #166534; }
.toast.warn { background: #fef3c7; color: #92400e; }
.toast.err { background: #fee2e2; color: #991b1b; }

/* history */
.hist-head { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.hist-head input { padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 14px; flex: 1; }
.mini-btn { padding: 9px 12px; border: 1.5px solid var(--teal); background: #fff; color: var(--teal); border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer; }
.scroll-x { overflow-x: auto; }
.hist-table { width: 100%; border-collapse: collapse; }
.hist-table th, .hist-table td { border: 1px solid #e5e7eb; padding: 7px 8px; font-size: 12.5px; white-space: nowrap; }
.hist-table th { background: #e6f2f0; font-size: 11.5px; }
.hist-table .h-date { font-weight: 700; }
.hist-table .h-empty { color: #c2c9c7; text-align: center; }
.hist-table small { color: var(--mut); }
.hist-table a { text-decoration: none; }
.hist-empty { color: var(--mut); font-size: 13.5px; text-align: center; padding: 14px 0; }

.foot { text-align: center; margin-top: 14px; font-size: 12.5px; color: var(--mut); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--err); }

/* inline SVG icons */
.ico { vertical-align: -0.18em; flex-shrink: 0; }
.logo .ico { stroke-width: 2.8; }
.photo-btn, .gps-btn, .for-other-btn, .p-chip, .pending-bar span { display: inline-flex; align-items: center; gap: 6px; }
.pending-bar span { gap: 5px; }
.type-btn .t-ico { display: flex; align-items: center; justify-content: center; color: var(--mut); }
.type-btn.sel .t-ico { color: var(--teal); }

/* notification bell + panel */
.icon-btn.notif { position: relative; color: var(--teal-d); }
.notif-dot { position: absolute; top: -5px; right: -5px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 5px; }
.notif-dot[hidden] { display: none; }
.notif-panel[hidden] { display: none; }
.notif-panel { background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.notif-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14.5px; }
.notif-body { max-height: 260px; overflow-y: auto; }
.notif-item { display: flex; gap: 8px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; margin-bottom: 6px; font-size: 12.5px; line-height: 1.4; background: #f9fafb; }
.notif-item.late { background: #fee2e2; color: #991b1b; }
.notif-item.early { background: #ffedd5; color: #9a3412; }
.notif-item.unseen { box-shadow: inset 3px 0 0 currentColor; }
.notif-item .ni-ico { flex-shrink: 0; margin-top: 1px; }

/* ===== on-time celebration ===== */
.ok-burst[hidden] { display: none; }
/* no backdrop-filter: it composites unreliably on older Android WebViews */
.ok-burst { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 78, 71, .55); animation: okFade .25s ease both; }
.ok-card { background: #fff; border-radius: 22px; padding: 30px 34px 26px; text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,.22); animation: okPop .45s cubic-bezier(.2,.9,.3,1.3) both; max-width: 86vw; }
.ok-ring { position: relative; width: 120px; height: 120px; margin: 0 auto 14px; }
.ok-svg { width: 120px; height: 120px; }
.ok-circle { fill: none; stroke: #d1fae5; stroke-width: 8; }
.ok-svg .ok-tick { fill: none; stroke: #16a34a; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; animation: okDraw .5s .18s ease-out forwards; }
.ok-title { font-size: 22px; font-weight: 800; color: #15803d; letter-spacing: .3px; }
.ok-sub { font-size: 13.5px; color: var(--mut); margin-top: 6px; line-height: 1.45; }
/* confetti */
.conf { position: absolute; top: 50%; left: 50%; width: 9px; height: 9px; border-radius: 2px; opacity: 0; }
.conf.c1 { background: #16a34a; animation: confF .9s .25s ease-out forwards; --tx: -70px; --ty: -62px; }
.conf.c2 { background: #0f766e; animation: confF .9s .3s ease-out forwards;  --tx: 68px;  --ty: -58px; }
.conf.c3 { background: #f59e0b; animation: confF .9s .22s ease-out forwards; --tx: -82px; --ty: 26px; }
.conf.c4 { background: #6366f1; animation: confF .9s .34s ease-out forwards; --tx: 80px;  --ty: 34px; }
.conf.c5 { background: #ef4444; animation: confF .9s .28s ease-out forwards; --tx: -18px; --ty: -88px; }
.conf.c6 { background: #14b8a6; animation: confF .9s .36s ease-out forwards; --tx: 24px;  --ty: 84px; }
@keyframes okFade { from { opacity: 0 } to { opacity: 1 } }
@keyframes okPop { 0% { transform: scale(.7); opacity: 0 } 100% { transform: scale(1); opacity: 1 } }
@keyframes okDraw { to { stroke-dashoffset: 0 } }
@keyframes confF {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.4) rotate(0deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1) rotate(220deg); }
}
@media (prefers-reduced-motion: reduce) {
  .ok-card, .ok-burst { animation: none; }
  .ok-svg .ok-tick { animation: none; stroke-dashoffset: 0; }
  .conf { display: none; }
}

.ph-modal[hidden] { display: none; }
.ph-modal { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 50; cursor: pointer; }
.ph-modal img { max-width: 90vw; max-height: 85vh; border-radius: 12px; }
