:root {
  --bg: #f4f2ed; --surface: #ffffff; --surface-2: #faf8f4; --line: #e4dfd5;
  --ink: #1c2321; --ink-2: #5b6461; --ink-3: #8b928f;
  --brand: #0f3d3e; --brand-2: #17595a; --brand-soft: #e3efee;
  --accent: #c8862b; --accent-soft: #fbf0df;
  --ok: #2f7d4f; --ok-soft: #e4f3e9; --warn: #a86512; --warn-soft: #fdf0dc;
  --bad: #b23b3b; --bad-soft: #fbe7e7;
  --radius: 12px; --shadow: 0 1px 2px rgba(20, 30, 28, .06), 0 4px 16px rgba(20, 30, 28, .05);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--brand-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40vh 0; text-align: center; color: var(--ink-3); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--brand) 240px, transparent 240px); }
.side { background: var(--brand); color: #e7f0ef; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand small { color: #9fc2c0; font-size: 12px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: #d3e3e2; text-decoration: none; margin-bottom: 2px; }
.nav a:hover { background: rgba(255, 255, 255, .06); }
.nav a.on { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #7fa7a5; padding: 14px 10px 6px; }
.nav .badge { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; font-weight: 700; }
.side-user { margin-top: 18px; border-top: 1px solid rgba(255, 255, 255, .1); padding: 14px 10px 0; font-size: 13px; color: #b9d0ce; }
.side-user b { color: #fff; display: block; }
.main { min-width: 0; }
.topbar { display: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 24px 24px 90px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: -.2px; }
.page-head .sub { color: var(--ink-2); font-size: 13px; }
.page-head .grow { flex: 1; }
.bottomnav { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .side { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar b { flex: 1; font-size: 16px; }
  .topbar button { background: transparent; border: 0; color: #fff; padding: 6px; }
  .page { padding: 16px 16px 96px; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { flex: 1; text-align: center; padding: 8px 2px 7px; font-size: 11px; color: var(--ink-3); text-decoration: none; position: relative; }
  .bottomnav a svg { display: block; margin: 0 auto 2px; }
  .bottomnav a.on { color: var(--brand); font-weight: 600; }
  .bottomnav .dot { position: absolute; top: 5px; left: 55%; background: var(--accent); color: #fff; font-size: 10px; border-radius: 99px; padding: 0 5px; }
}

/* ---------- komponen ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.grid > .card + .card { margin-top: 0; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3); margin: 18px 0 8px; }
.card h3:first-child { margin-top: 0; }
.modal h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-3); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .g2 { grid-template-columns: 1fr; } }
.stat { padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 750; letter-spacing: -.5px; }
.stat .l { color: var(--ink-2); font-size: 13px; }
.stat.warn { background: var(--warn-soft); border-color: #f0d7ae; }
.stat.link { cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 8px 14px; cursor: pointer; text-decoration: none; font-weight: 550; font-size: 14px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { background: var(--brand-2); }
.btn.acc { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); border-color: #ecc4c4; }
.btn.ok { color: var(--ok); border-color: #bfe0cb; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

label.f { display: block; }
label.f > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; font-weight: 550; }
label.f > span i { color: var(--bad); font-style: normal; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; padding: 9px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: auto; }
textarea { min-height: 70px; resize: vertical; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters > * { flex: 1 1 150px; width: auto; }
.filters input[type=search] { flex: 2 1 220px; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--surface-2); }
.tw { overflow-x: auto; margin: -6px -18px; padding: 0 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

.pill { display: inline-block; font-size: 12px; border-radius: 99px; padding: 1px 9px; background: var(--brand-soft); color: var(--brand); font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.grey { background: #eeece8; color: var(--ink-2); }

.kv { display: grid; grid-template-columns: 190px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 12px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; font-weight: 550; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }

.person { display: flex; gap: 14px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 750; font-size: 18px; flex: none; }
.person h1 { margin: 0; font-size: 20px; }

.mlist { display: none; }
.mitem { display: flex; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.mitem:last-child { border-bottom: 0; }
.mitem .avatar { width: 40px; height: 40px; font-size: 14px; }
.mitem .grow { flex: 1; min-width: 0; }
.mitem .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .dlist { display: none; } .mlist { display: block; } }

.empty { text-align: center; color: var(--ink-3); padding: 30px 10px; }
.notice { border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px; background: var(--accent-soft); color: #7a4f12; border: 1px solid #f0d7ae; }
.notice.info { background: var(--brand-soft); color: var(--brand); border-color: #c8dfdd; }
.notice.bad { background: var(--bad-soft); color: var(--bad); border-color: #ecc4c4; }

/* ---------- modal & toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 25, 24, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px 12px; overflow: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 820px; }
.modal-h { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-h b { flex: 1; font-size: 16px; }
.modal-h button { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-3); }
.modal-b { padding: 18px; }
.modal-f { padding: 12px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 80; font-size: 14px; max-width: 90vw; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.toast.bad { background: var(--bad); }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand) 0%, #0b2b2c 100%); }
.auth .card { width: 100%; max-width: 380px; padding: 26px; }
.auth h1 { font-size: 20px; margin: 10px 0 2px; }
.auth .sub { color: var(--ink-2); font-size: 14px; margin-bottom: 18px; }
.auth .brand-mark { width: 44px; height: 44px; font-size: 18px; }
.pin-input { letter-spacing: 8px; font-size: 20px; text-align: center; }

.bar { height: 8px; background: #eeece8; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand-2); }
.rowbar { display: grid; grid-template-columns: 52px 1fr 30px; gap: 10px; align-items: center; font-size: 13px; padding: 3px 0; }

.jam-grid { display: grid; grid-template-columns: 70px 1fr 1fr 70px; gap: 6px 8px; align-items: center; font-size: 14px; }
.jam-grid .h { font-size: 12px; color: var(--ink-3); }
.diff { width: 100%; font-size: 14px; border-collapse: collapse; }
.diff td { padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.diff .old { color: var(--bad); text-decoration: line-through; }
.diff .new { color: var(--ok); font-weight: 600; }
.doc-thumb { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand-2); border: 2px solid var(--surface); }
.timeline li:last-child { border-left-color: transparent; }
.map-sel { width: 100%; }

/* ---------- absensi ---------- */
.absen-wrap { max-width: 520px; margin: 0 auto; }
.absen-clock { text-align: center; }
.clock { font-size: 44px; font-weight: 750; letter-spacing: 1px; font-variant-numeric: tabular-nums; color: var(--brand); line-height: 1.15; margin: 4px 0; }
.absen-status { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.absen-status > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.absen-status b { display: block; font-size: 20px; }
.lok { border-radius: 10px; padding: 10px 12px; }
.lok.ok { background: var(--ok-soft); color: var(--ok); }
.lok.bad { background: var(--bad-soft); color: var(--bad); }
.cam-box { position: relative; background: #111; border-radius: 12px; overflow: hidden; aspect-ratio: 3 / 4; max-height: 60vh; margin: 0 auto; display: grid; place-items: center; }
.cam-box video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-box canvas { width: 100%; height: 100%; object-fit: contain; background: #111; }
.cam-msg { position: absolute; inset: auto 12px 12px; color: #fff; font-size: 13px; text-align: center; background: rgba(0,0,0,.5); padding: 8px; border-radius: 8px; }
.absen-btn { padding: 15px; font-size: 17px; margin-top: 14px; border-radius: 12px; }
.drawer a { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.drawer a.on { color: var(--brand); font-weight: 650; }
@media (min-width: 861px) { #menuBtn { display: none; } }
[hidden] { display: none !important; }
.lok.warn { background: var(--warn-soft); color: var(--warn); }
.luar-note { margin-top: 4px; max-width: 280px; }

.auth .card.auth-wide { max-width: 480px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #eeece8; border-radius: 11px; padding: 4px; margin: 16px 0; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 9px; font-weight: 600; color: var(--ink-2); cursor: pointer; display: flex; gap: 6px; align-items: center; justify-content: center; }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.auth .absen-wrap .card { box-shadow: none; padding: 14px 0 0; border: 0; }
.auth .absen-wrap .card + .card { border-top: 1px solid var(--line); margin-top: 14px; }
.absen-hello { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 4px; }
.absen-hello .avatar { width: 40px; height: 40px; font-size: 14px; }
@media (max-width: 520px) { .auth { padding: 0; place-items: stretch; } .auth .card.auth-wide { max-width: none; border-radius: 0; min-height: 100vh; } }

/* ---------- cuti ---------- */
.cuti-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cuti-item:last-child { border-bottom: 0; }
.cuti-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cuti-tgl { font-weight: 650; margin: 4px 0 2px; }
.saldo-card .saldo-n { font-size: 32px; font-weight: 750; color: var(--brand); }
.saldo-card .saldo-n span { font-size: 15px; color: var(--ink-3); font-weight: 500; }
details summary { cursor: pointer; }
.bo-row { display: grid; grid-template-columns: 90px auto 90px 1fr auto; gap: 6px; align-items: center; margin-bottom: 6px; }
@media (max-width: 520px) { .bo-row { grid-template-columns: 1fr auto 1fr; } .bo-row .bo-n { grid-column: 1 / -1; } }
