/* Absensi — tema gelap + emas, mobile-first, tanpa font/CDN eksternal */
:root {
  --bg: #f7f4ed;
  --bg-soft: #efe9dd;
  --card: #ffffff;
  --card-2: #fbf8f2;
  --line: rgba(150, 120, 45, 0.22);
  --line-strong: rgba(150, 120, 45, 0.45);
  --gold: #a8801a;
  --gold-soft: #d9b356;
  --gold-dim: rgba(168, 128, 26, 0.10);
  --text: #201d17;
  --muted: #6f6759;
  --ok: #1d7f47;
  --warn: #9c6608;
  --bad: #b03a30;
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(900px 420px at 50% -140px, rgba(212, 175, 55, 0.22), transparent 70%),
    linear-gradient(180deg, #fdfbf6 0%, #f2ede2 55%, #ece6d9 100%);
  background-repeat: no-repeat;
}

.wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

/* ---------------------------------------------------------------- header --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 16px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, rgba(212,175,55,.18), rgba(212,175,55,.02));
  color: var(--gold);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .5px;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title {
  font-size: 15px; font-weight: 650; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: .4px;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--gold-dim);
  color: var(--gold-soft);
  white-space: nowrap;
}

.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }

.btn-link {
  appearance: none; background: none; border: 0; padding: 2px 0;
  color: var(--muted); font-size: 11px; font-family: inherit;
  letter-spacing: .5px; text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.btn-link:active { color: var(--gold); }

.note-field { margin-top: 14px; margin-bottom: 10px; }
.note-required { color: var(--warn); letter-spacing: .3px; text-transform: none; }
.owner-hint { margin: 10px 0 0; line-height: 1.55; }

.clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.clock-small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ card --- */
.card {
  background: linear-gradient(180deg, var(--card), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 18px 40px -28px #000;
}

.card-tight { padding: 14px 16px; }

.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}

.section-title {
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--gold); font-weight: 650; margin: 0;
}

.section-note { font-size: 11px; color: var(--muted); }

/* ------------------------------------------------------------------- hero --- */
.hero { text-align: center; padding: 16px 18px 20px; }

.hero-greet { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.hero-name { font-size: 21px; font-weight: 650; letter-spacing: .2px; }

.dist-label {
  font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--muted); margin-top: 14px;
}

.dist-value {
  font-size: 44px; font-weight: 300; letter-spacing: -1.5px;
  color: var(--gold); line-height: 1.05; font-variant-numeric: tabular-nums;
}
.dist-unit { font-size: 17px; font-weight: 500; color: var(--gold-soft); margin-left: 3px; }

.dist-sub {
  font-size: 12px; color: var(--muted); margin-top: 6px;
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot-ok { background: var(--ok); box-shadow: 0 0 8px rgba(95,191,127,.7); }
.dot-warn { background: var(--warn); box-shadow: 0 0 8px rgba(224,163,60,.7); }
.dot-bad { background: var(--bad); box-shadow: 0 0 8px rgba(226,104,95,.7); }
.dot-gold { background: var(--gold); box-shadow: 0 0 8px rgba(212,175,55,.7); }

/* ---------------------------------------------------------------- selfie --- */
/* Selfie tampil sebagai modal hanya saat tombol MASUK/PULANG ditekan */
.selfie { display: none; }
.selfie.open {
  display: flex; position: fixed; inset: 0; z-index: 90;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(32, 26, 12, .55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  text-align: left;
}
.selfie-card {
  width: 100%; max-width: 430px; padding: 16px;
  border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--card);
  box-shadow: 0 26px 60px rgba(90, 72, 30, .32);
}
.selfie-close {
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; padding: 0 2px;
  color: var(--muted);
}
.selfie-close:hover { color: var(--text); }
.selfie-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.selfie-title {
  font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--gold); font-weight: 650;
}
.selfie-status { font-size: 10.5px; color: var(--muted); }
.selfie-status.ok { color: var(--ok); font-weight: 600; }

.selfie-idle {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 9px;
}
.selfie-idle .section-note { margin: 0; }
.selfie-idle .btn { flex: 0 0 auto; }

.selfie-live { margin-top: 10px; }
.selfie-live video {
  width: 100%; max-height: 260px; object-fit: cover; display: block;
  border-radius: 12px; background: #111;
  transform: scaleX(-1);            /* preview seperti cermin */
}
.selfie-live .row { margin-top: 8px; }

.selfie-done { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.selfie-thumb {
  width: 84px; height: 84px; object-fit: cover; display: block;
  border-radius: 12px; border: 1px solid var(--line-strong); background: #111;
}
.selfie-done-side { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.selfie-ok { font-size: 11px; color: var(--ok); font-weight: 650; }

.selfie-err {
  margin-top: 9px; padding: 8px 10px; border-radius: 10px;
  font-size: 11.5px; line-height: 1.5;
  color: var(--bad);
  background: rgba(176, 58, 48, .07);
  border: 1px solid rgba(176, 58, 48, .25);
}

/* ---------------------------------------------------------------- tombol --- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.btn {
  appearance: none; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text);
  border-radius: 16px; padding: 13px 14px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: transform .06s ease, opacity .15s ease, border-color .15s ease;
  min-height: 46px;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .38; cursor: not-allowed; }

.btn-punch {
  min-height: 96px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  font-size: 19px; letter-spacing: 2px; font-weight: 700;
  border-radius: 20px;
}
.btn-in {
  color: #14110a;
  border: 1px solid rgba(232, 205, 119, .9);
  background: linear-gradient(160deg, #e8cd77 0%, #d4af37 55%, #b18f25 100%);
  box-shadow: 0 14px 30px -16px rgba(212, 175, 55, .75);
}
.btn-out {
  color: var(--gold-soft);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(212,175,55,.10), rgba(212,175,55,.02));
}
.btn-time { font-size: 11px; font-weight: 500; letter-spacing: .4px; opacity: .8; }

.btn-gold {
  background: linear-gradient(160deg, #e8cd77, #c9a533);
  color: #14110a; border-color: rgba(232,205,119,.9); font-weight: 700;
}
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px 12px; font-size: 13px; border-radius: 12px; }

/* ------------------------------------------------------------------ form --- */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 13px;
  color: var(--text);
  padding: 13px 14px;
  font-size: 16px;                 /* cegah zoom iOS */
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(212,175,55,.10);
}
textarea { resize: vertical; min-height: 74px; line-height: 1.4; }

::placeholder { color: var(--muted); }

.pin-input { letter-spacing: 8px; font-size: 22px; text-align: center; font-variant-numeric: tabular-nums; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }

/* --------------------------------------------------------------- message --- */
.msg {
  border-radius: 13px; padding: 11px 13px; font-size: 13px;
  margin-bottom: 12px; border: 1px solid transparent;
  display: flex; gap: 9px; align-items: flex-start;
}
.msg-error { background: rgba(226,104,95,.10); border-color: rgba(226,104,95,.35); color: #f0a49e; }
.msg-ok { background: rgba(95,191,127,.10); border-color: rgba(95,191,127,.32); color: #9ad9b1; }
.msg-info { background: rgba(212,175,55,.08); border-color: rgba(212,175,55,.28); color: var(--gold-soft); }
.msg-icon { flex: 0 0 auto; font-weight: 700; }
.hidden { display: none !important; }

/* ----------------------------------------------------------------- login --- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; padding: 26px 22px 22px; }
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 17px; display: grid; place-items: center;
  border: 1px solid var(--line-strong);
  background: linear-gradient(160deg, rgba(212,175,55,.2), rgba(212,175,55,.03));
  color: var(--gold); font-size: 22px; font-weight: 700;
}
.login-title { text-align: center; font-size: 19px; font-weight: 650; margin: 0 0 4px; }
.login-sub { text-align: center; font-size: 12px; color: var(--muted); margin: 0 0 22px; }
.login-foot { text-align: center; font-size: 11px; color: var(--muted); margin-top: 18px; line-height: 1.6; }
.login-foot .tautan-mode { display: inline-block; margin-top: 8px; padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--gold-ink, #8a6d1f);
  font-size: 11.5px; font-weight: 600; text-decoration: none; }
.login-foot .tautan-mode:hover { border-color: var(--gold, #c9a227); }
.login-logo img { width: 56px; height: 56px; border-radius: 14px; display: block; }
.login-card a.btn { display: block; text-align: center; text-decoration: none; }

/* --------------------------------------------------------------- history --- */
.hist { display: flex; flex-direction: column; gap: 9px; }

.hist-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.022);
  border: 1px solid rgba(255,255,255,.055);
}
.hist-row.is-today { border-color: var(--line-strong); background: rgba(212,175,55,.055); }

.hist-date { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.hist-day { font-size: 12.5px; font-weight: 600; }
.hist-today-tag { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); }

.hist-punches { display: flex; flex-direction: column; gap: 6px; }
.punch {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12.5px; flex-wrap: wrap;
}
.punch-kind {
  font-size: 9px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); width: 44px; flex: 0 0 auto;
}
.punch-time { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 14px; color: var(--text); }
.punch-meta { color: var(--muted); font-size: 11.5px; }
.punch-empty { color: var(--muted); font-size: 12.5px; }
.badge-out {
  font-size: 9.5px; letter-spacing: .4px; padding: 2px 6px; border-radius: 999px;
  background: rgba(226,104,95,.12); color: #eda49b; border: 1px solid rgba(226,104,95,.3);
}
.punch-note {
  font-size: 11.5px; color: var(--muted); font-style: italic;
  border-left: 2px solid var(--line-strong); padding-left: 8px; margin-top: 1px;
}

/* ------------------------------------------------------------- owner panel --- */
details.panel { padding: 0; overflow: hidden; }
details.panel > summary {
  list-style: none; cursor: pointer;
  padding: 15px 17px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 13px; font-weight: 600; color: var(--gold-soft);
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after {
  content: "+"; color: var(--gold); font-size: 17px; font-weight: 400; line-height: 1;
}
details.panel[open] > summary::after { content: "–"; }
details.panel[open] > summary { border-bottom: 1px solid var(--line); }
.panel-body { padding: 16px 17px 18px; }

.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 6px 0; }
.kv-k { color: var(--muted); }
.kv-v { font-variant-numeric: tabular-nums; text-align: right; }

.link-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.link-btn {
  flex: 1; min-width: 140px; text-align: center; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 12px; border-radius: 13px;
  border: 1px solid var(--line-strong); color: var(--gold-soft);
  font-size: 13px; font-weight: 600; background: rgba(212,175,55,.06);
}

.foot { text-align: center; font-size: 10.5px; color: var(--muted); margin-top: 22px; line-height: 1.7; }

/* ----------------------------------------------------------------- toast --- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px);
  max-width: 440px; width: calc(100% - 32px);
  padding: 13px 16px; border-radius: 14px;
  background: #fbf7ec; border: 1px solid var(--line-strong);
  color: var(--text); font-size: 13px;
  box-shadow: 0 24px 50px -20px #000;
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(226,104,95,.5); }
.toast.good { border-color: rgba(95,191,127,.45); }

.spin { display: inline-block; animation: none; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }
.busy { animation: pulse 1s ease-in-out infinite; }

@media (min-width: 420px) {
  .dist-value { font-size: 52px; }
  .btn-punch { min-height: 104px; font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
