:root {
  --bg: #fff6fa;
  --surface: #ffffff;
  --surface-2: #fdeaf3;
  --ink: #2b1330;
  --muted: #86677a;
  --line: #f2dbe7;
  --brand: #d6247f;
  --brand-deep: #a8135f;
  --brand-soft: #fde3ef;
  --on-brand: #ffffff;
  --ok: #177a45;
  --ok-soft: #dcf5e6;
  --warn: #a15c07;
  --warn-soft: #fdeccb;
  --bad: #b4232a;
  --bad-soft: #fde1e1;
  --shadow: 0 1px 2px rgba(80, 20, 55, .06), 0 8px 24px rgba(80, 20, 55, .07);
  --shadow-lift: 0 10px 30px rgba(214, 36, 127, .32);
  --radius: 20px;
  --display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #170c1b;
    --surface: #231229;
    --surface-2: #2e1936;
    --ink: #f8e9f1;
    --muted: #b99cad;
    --line: #3a2443;
    --brand: #ff5aa5;
    --brand-deep: #ff8cc1;
    --brand-soft: #3d1830;
    --on-brand: #2a0a1b;
    --ok: #5fdc93;
    --ok-soft: #12301f;
    --warn: #fbbf4a;
    --warn-soft: #3a2a0b;
    --bad: #ff8a8f;
    --bad-soft: #3b1518;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
    --shadow-lift: 0 10px 30px rgba(255, 90, 165, .26);
  }
}
:root[data-theme="dark"] {
  --bg: #170c1b;
  --surface: #231229;
  --surface-2: #2e1936;
  --ink: #f8e9f1;
  --muted: #b99cad;
  --line: #3a2443;
  --brand: #ff5aa5;
  --brand-deep: #ff8cc1;
  --brand-soft: #3d1830;
  --on-brand: #2a0a1b;
  --ok: #5fdc93;
  --ok-soft: #12301f;
  --warn: #fbbf4a;
  --warn-soft: #3a2a0b;
  --bad: #ff8a8f;
  --bad-soft: #3b1518;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  --shadow-lift: 0 10px 30px rgba(255, 90, 165, .26);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
svg { display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- kerangka ---------- */
.shell { max-width: 480px; margin: 0 auto; min-height: 100vh; padding: calc(var(--safe-top) + 4px) 16px calc(92px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 2px; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 70%, transparent); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.topbar-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-title h1 { font-size: 24px; line-height: 1.1; }
.branch-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--brand-deep); background: var(--brand-soft); padding: 3px 9px; border-radius: 99px; align-self: flex-start; max-width: 100%; }
.branch-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); color: var(--brand-deep); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); display: grid; place-items: center; overflow: hidden; flex: none; font-weight: 800; font-family: var(--display); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-head h3 { font-size: 17px; }
.section-head span { font-size: 12px; color: var(--muted); }
.eyebrow { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; font-weight: 700; color: var(--muted); }

/* ---------- salam ---------- */
.greet { display: flex; align-items: center; gap: 12px; }
.greet-text { flex: 1; min-width: 0; }
.greet-text h2 { font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; }
.greet-text p { font-size: 13px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 99px; white-space: nowrap; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-wait { background: var(--warn-soft); color: var(--warn); }
.chip-wait i { animation: pulse 1.2s ease-in-out infinite; }
.chip-off { background: var(--bad-soft); color: var(--bad); }

/* ---------- kartu absen ---------- */
.punch { text-align: center; padding: 18px 16px 16px; position: relative; overflow: hidden; }
.punch::before { content: ""; position: absolute; inset: -40% -20% auto -20%; height: 70%; background: radial-gradient(closest-side, var(--brand-soft), transparent); opacity: .9; pointer-events: none; }
.punch > * { position: relative; }
.punch-top { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.shift-badge { font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: var(--surface-2); color: var(--ink); }
.dial { position: relative; width: 236px; height: 236px; margin: 14px auto 6px; }
.dial svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.ring-arc { fill: none; stroke: var(--brand); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .8s ease, stroke .3s; }
.ring-arc.done { stroke: var(--ok); }
.ring-arc.late { stroke: var(--warn); }
.dial-btn { position: absolute; inset: 22px; border-radius: 50%; background: linear-gradient(155deg, var(--brand), var(--brand-deep)); color: var(--on-brand); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: var(--shadow-lift); transition: transform .15s, filter .2s, box-shadow .2s; }
.dial-btn:active:not(:disabled) { transform: scale(.96); }
.dial-btn:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: default; }
.dial-btn.out { background: linear-gradient(155deg, #3b2a6e, #22143f); color: #fff; box-shadow: 0 10px 30px rgba(59, 42, 110, .35); }
.dial-btn.done { background: linear-gradient(155deg, #1f9a5a, #146f3f); color: #fff; box-shadow: 0 10px 30px rgba(23, 122, 69, .3); }
.dial-btn.busy { filter: saturate(.6); }
.dial-clock { font-family: var(--display); font-weight: 800; font-size: 40px; line-height: 1; letter-spacing: -.02em; display: inline-flex; }
.dial-clock b { display: inline-block; min-width: .6em; text-align: center; font-weight: 800; }
.dial-clock .colon { min-width: .3em; opacity: .85; }
.dial-clock small { font-size: 15px; font-weight: 700; align-self: flex-end; margin: 0 0 5px 3px; opacity: .8; }
.dial-label { font-size: 13px; font-weight: 700; margin-top: 4px; }
.dial-sub { font-size: 11px; opacity: .85; }
.dial-btn svg { width: 26px; height: 26px; margin-bottom: 2px; }
.countdown { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.countdown i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.countdown.ok { background: var(--ok-soft); color: var(--ok); }
.countdown.warn { background: var(--warn-soft); color: var(--warn); }
.log-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.log { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 14px; padding: 10px 12px; text-align: left; }
.log-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); color: var(--ok); flex: none; }
.log-ico.out { color: #5b44a8; }
.log small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.log strong { font-family: var(--display); font-size: 20px; }
.geo { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: 14px; font-size: 13px; text-align: left; }
.geo-in { background: var(--ok-soft); color: var(--ok); }
.geo-out { background: var(--warn-soft); color: var(--warn); }
.geo-wait { background: var(--surface-2); color: var(--muted); }
.geo strong { display: flex; align-items: center; gap: 6px; }
.geo span.sub { font-size: 12px; opacity: .9; text-align: right; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; text-align: left; margin-top: 12px; background: var(--warn-soft); color: var(--ink); }
.notice.bad { background: var(--bad-soft); }
.notice .n-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--warn); flex: none; }
.notice.bad .n-ico { color: var(--bad); }
.notice strong { display: block; font-size: 14px; }
.notice p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.notice .n-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.msg-ok, .msg-err { font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: 12px; margin-top: 10px; text-align: left; }
.msg-ok { background: var(--ok-soft); color: var(--ok); }
.msg-err { background: var(--bad-soft); color: var(--bad); }

/* ---------- menu cepat ---------- */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border-radius: 18px; padding: 14px; text-align: left; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; transition: transform .12s; }
.tile:active { transform: scale(.97); }
.tile-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-deep); }
.tile:nth-child(2) .tile-ico { background: var(--warn-soft); color: var(--warn); }
.tile:nth-child(3) .tile-ico { background: var(--ok-soft); color: var(--ok); }
.tile:nth-child(4) .tile-ico { background: var(--surface-2); color: #5b44a8; }
.tile strong { font-size: 14px; }
.tile small { font-size: 12px; color: var(--muted); }

/* ---------- statistik ---------- */
.stat-big { display: flex; align-items: baseline; gap: 6px; }
.stat-big strong { font-family: var(--display); font-size: 36px; line-height: 1; }
.stat-big span { color: var(--muted); font-size: 14px; font-weight: 600; }
.bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 12px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-deep)); transition: width .8s ease; }
.stat-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-pair div { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.stat-pair small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.stat-pair strong { font-family: var(--display); font-size: 18px; }
.danger { color: var(--bad); }
.okc { color: var(--ok); }

/* ---------- daftar jadwal & riwayat ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.day { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--surface-2); }
.day.today { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.day-date { text-align: center; line-height: 1.1; }
.day-date strong { display: block; font-family: var(--display); font-size: 24px; }
.day-date small { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.shift-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.shift-row + .shift-row { margin-top: 4px; }
.shift-code { min-width: 30px; text-align: center; font-weight: 800; font-size: 12px; color: #fff; padding: 2px 7px; border-radius: 8px; }
.shift-time { font-weight: 700; }
.shift-branch { font-weight: 600; font-size: 12px; }
.hist-times { font-family: var(--display); font-weight: 800; font-size: 17px; }
.pill { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 99px; white-space: nowrap; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-info { background: var(--brand-soft); color: var(--brand-deep); }
.today-tag { font-size: 11px; font-weight: 800; color: var(--brand-deep); }

/* ---------- form ---------- */
label.f { display: block; font-size: 13px; font-weight: 700; margin: 12px 0 5px; }
.input { width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); min-height: 46px; }
.input:focus { border-color: var(--brand); outline: none; }
textarea.input { resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; min-height: 48px; border-radius: 14px; font-weight: 700; transition: transform .12s, filter .2s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: linear-gradient(155deg, var(--brand), var(--brand-deep)); color: var(--on-brand); box-shadow: 0 6px 16px rgba(214, 36, 127, .25); }
.btn-ghost { background: var(--surface-2); color: var(--ink); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; margin-top: 14px; }
.row { display: flex; gap: 10px; margin-top: 14px; }
.row .btn { flex: 1; }
.info-list { display: flex; flex-direction: column; }
.info-list div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.info-list div:last-child { border-bottom: 0; }
.info-list span { color: var(--muted); }
.info-list strong { font-family: var(--display); font-size: 16px; text-align: right; }

/* ---------- navigasi bawah ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 8px 12px calc(8px + var(--safe-bottom)); background: linear-gradient(transparent, var(--bg) 35%); pointer-events: none; }
.nav-inner { max-width: 456px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 6px; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow), 0 0 0 1px var(--line); pointer-events: auto; }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px; border-radius: 16px; font-size: 11px; font-weight: 700; color: var(--muted); transition: background .2s, color .2s; }
.nav button.active { background: var(--brand-soft); color: var(--brand-deep); }

/* ---------- lembar (bottom sheet) ---------- */
.backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(30, 8, 30, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.backdrop.dark { background: rgba(10, 4, 12, .88); }
.sheet { width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + var(--safe-bottom)); animation: rise .25s ease; }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sheet-head h3 { font-size: 20px; display: flex; align-items: center; gap: 8px; }
.steps { margin: 10px 0 4px 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.selfie { display: block; width: auto; max-width: 100%; max-height: 52vh; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 20px; background: #000; margin: 8px auto 0; }
video.selfie { transform: scaleX(-1); }

/* ---------- masuk ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: 440px; margin: 0 auto; padding: calc(var(--safe-top) + 20px) 20px 28px; gap: 18px; position: relative; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.auth-logo { width: 84px; height: 84px; border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; overflow: hidden; }
.auth-logo img { width: 78%; height: 78%; object-fit: contain; }
.auth-brand h1 { font-size: 32px; line-height: 1.05; }
.auth-brand p { color: var(--muted); font-size: 14px; max-width: 28ch; }
.auth .card { padding: 20px 18px 22px; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 48px; }
.pass-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); }
.link { color: var(--brand-deep); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.auth-foot { text-align: center; font-size: 14px; color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 600; padding: 11px 18px; border-radius: 99px; max-width: 86vw; text-align: center; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
.shell.anim > * { animation: enter .35s ease both; }
.shell.anim > *:nth-child(2) { animation-delay: .04s; }
.shell.anim > *:nth-child(3) { animation-delay: .08s; }
.shell.anim > *:nth-child(4) { animation-delay: .12s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 560px) {
  body { background: radial-gradient(60% 40% at 50% 0, var(--brand-soft), var(--bg)); }
}
