/* =========================================================
   Presensi Biller - gaya bersama (login, chip) + aplikasi petugas
   Palet: biru PLN #0A5C9E, navy #062E4F, kuning #FFC72C
   ========================================================= */
:root {
  --blue: #0A5C9E;
  --navy: #062E4F;
  --sky: #E7F1FA;
  --yellow: #FFC72C;
  --ink: #14202B;
  --muted: #5F6E7D;
  --line: #E1E8F0;
  --bg: #EEF2F7;
  --ok: #15805A;
  --ok-bg: #DDF3EA;
  --warn: #9A5B00;
  --warn-bg: #FFF0CF;
  --bad: #C23B3B;
  --bad-bg: #FCE4E4;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  -webkit-tap-highlight-color: transparent
}

body {
  font-family: var(--font);
  color: var(--ink)
}

/* ---------- Komponen bersama ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap
}

.chip-ok {
  background: var(--ok-bg);
  color: var(--ok)
}

.chip-warn {
  background: var(--warn-bg);
  color: var(--warn)
}

.chip-muted {
  background: #E9EEF4;
  color: var(--muted)
}

.btn-pln {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 600;
  font-size: 16px
}

.btn-pln:hover,
.btn-pln:focus {
  background: #084D85;
  color: #fff
}

.btn-pln:disabled {
  opacity: .6
}

.btn-soft {
  background: var(--sky);
  color: var(--blue);
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 600
}

.btn-soft:hover,
.btn-soft:active {
  background: #D5E7F6;
  color: var(--navy)
}

.btn-danger-soft {
  background: var(--bad-bg);
  color: var(--bad);
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 600
}

.btn-danger-soft:hover {
  background: #F8D3D3;
  color: var(--bad)
}

.btn-ghost {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: 0;
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 600
}

.form-control {
  border-radius: 14px;
  border-color: #D3DCE7
}

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 .2rem rgba(10, 92, 158, .18)
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px
}

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: linear-gradient(165deg, var(--blue) 0%, var(--navy) 70%);
  display: flex
}

.login-wrap {
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: calc(28px + var(--safe-t)) 20px calc(24px + var(--safe-b))
}

.login-brand {
  text-align: center;
  color: #fff;
  margin-bottom: 26px
}

.login-logo {
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25)
}

.login-brand h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 14px 0 2px
}

.login-brand p {
  margin: 0;
  opacity: .8
}

.login-card {
  background: #fff;
  border-radius: 24px;
  padding: 24px 20px 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28)
}

.login-card h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 16px
}

.login-foot {
  text-align: center;
  color: rgba(255, 255, 255, .7);
  font-size: 13px;
  margin: 18px 0 0
}

.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  width: 44px;
  height: 44px;
  color: var(--muted);
  font-size: 20px
}

/* ---------- Aplikasi petugas ---------- */
body.petugas {
  background: #D9E3EE;
  touch-action: manipulation;
  overscroll-behavior-y: contain
}

.petugas .app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(84px + var(--safe-b));
  overflow-x: hidden
}

@media(min-width:520px) {
  .petugas .app {
    box-shadow: 0 0 0 1px rgba(6, 46, 79, .06), 0 24px 70px rgba(6, 46, 79, .22)
  }
}

.hero {
  background: linear-gradient(160deg, var(--blue), var(--navy));
  color: #fff;
  padding: calc(18px + var(--safe-t)) 20px 96px;
  border-radius: 0 0 32px 32px;
  position: relative;
  overflow: hidden
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 17px;
  flex: none;
  overflow: hidden
}

.avatar.xl {
  width: 84px;
  height: 84px;
  font-size: 30px;
  margin: 0 auto 12px
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover
}

/* ---------- Avatar dengan tombol ganti foto ---------- */
.avatar-edit {
  position: relative;
  width: fit-content
}

.avatar-edit .avatar.xl {
  margin: 0
}

.avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  border: 3px solid #fff;
  cursor: pointer
}

.avatar-badge:hover {
  background: #084D85
}

.hello {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2
}

.role {
  font-size: 13px;
  opacity: .8
}

.hero-clock {
  margin-top: 22px;
  position: relative;
  z-index: 1
}

.clock {
  font-size: 46px;
  font-weight: 300;
  letter-spacing: 1px;
  line-height: 1;
  font-variant-numeric: tabular-nums
}

.clock-date {
  opacity: .85;
  margin-top: 6px;
  font-size: 14px
}

.content {
  padding: 0 16px 16px
}

.pull-up {
  margin-top: -64px;
  position: relative
}

.dial-card {
  margin-top: -70px;
  background: #fff;
  border-radius: 26px;
  padding: 26px 16px 18px;
  box-shadow: 0 12px 34px rgba(6, 46, 79, .14);
  text-align: center;
  position: relative
}

/* Tombol presensi bulat: elemen utama layar */
.dial {
  --c: var(--yellow);
  --fg: var(--navy);
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 0;
  background: var(--c);
  color: var(--fg);
  position: relative;
  display: grid;
  place-items: center;
  margin: 4px auto 12px;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--c) 55%, transparent), inset 0 -7px 0 rgba(0, 0, 0, .09);
  transition: transform .15s
}

.dial:active:not([disabled]) {
  transform: scale(.95)
}

.dial i {
  display: block;
  font-size: 40px;
  line-height: 1;
  margin-bottom: 4px
}

.dial span {
  display: block;
  font-weight: 700;
  font-size: 16px
}

.dial.pulang {
  --c: var(--blue);
  --fg: #fff
}

.dial.done {
  --c: var(--ok);
  --fg: #fff
}

.dial.aktif::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid var(--c);
  animation: ring 2.4s ease-out infinite
}

@keyframes ring {
  0% {
    transform: scale(.94);
    opacity: .7
  }

  100% {
    transform: scale(1.2);
    opacity: 0
  }
}

@media (prefers-reduced-motion:reduce) {
  .dial.aktif::before {
    animation: none;
    opacity: .35
  }
}

.dial-hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0 8px 16px
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left
}

.time-box {
  background: var(--sky);
  border-radius: 18px;
  padding: 12px 14px
}

.tb-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 2px
}

.tb-time {
  font-size: 28px;
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px
}

.loc-link {
  display: inline-block;
  margin-top: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none
}

.block {
  background: #fff;
  border-radius: 22px;
  padding: 18px 16px;
  margin-top: 14px
}

.block-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px
}

.stat {
  background: var(--bg);
  border-radius: 16px;
  padding: 12px 6px;
  text-align: center
}

.stat b {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.1
}

.stat span {
  font-size: 12.5px;
  color: var(--muted)
}

.stats.on-dark .stat {
  background: rgba(255, 255, 255, .12)
}

.stats.on-dark .stat b {
  color: #fff
}

.stats.on-dark .stat span {
  color: rgba(255, 255, 255, .8)
}

.page-head {
  background: linear-gradient(160deg, var(--blue), var(--navy));
  color: #fff;
  padding: calc(20px + var(--safe-t)) 20px 84px;
  border-radius: 0 0 32px 32px
}

.page-head h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 14px
}

.profile-head {
  text-align: center;
  padding-bottom: 88px
}

.profile-head h1 {
  font-size: 21px
}

.profile-head .sub {
  opacity: .8;
  font-size: 14px
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .12);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 12px
}

.month-nav span {
  font-weight: 600
}

.month-nav a {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #fff;
  border-radius: 12px;
  text-decoration: none;
  font-size: 18px
}

.month-nav a:active {
  background: rgba(255, 255, 255, .18)
}

.month-nav a.off {
  opacity: .3;
  pointer-events: none
}

.log {
  background: #fff;
  border-radius: 20px;
  margin-bottom: 10px;
  overflow: hidden
}

.log-head {
  width: 100%;
  border: 0;
  background: none;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  text-align: left
}

.log-date {
  width: 52px;
  height: 56px;
  border-radius: 14px;
  background: var(--sky);
  color: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none
}

.log-date b {
  font-size: 21px;
  line-height: 1
}

.log-date span {
  font-size: 12px;
  color: var(--muted)
}

.log-body {
  flex: 1;
  min-width: 0
}

.log-times {
  display: flex;
  gap: 16px;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums
}

.log-times i {
  color: var(--blue);
  font-size: 14px
}

.log-caret {
  color: var(--muted);
  transition: transform .2s
}

.log-head[aria-expanded="true"] .log-caret {
  transform: rotate(180deg)
}

.log-detail {
  padding: 2px 14px 14px
}

.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}

.shots figure {
  margin: 0
}

.shots img,
.noimg {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  border-radius: 14px;
  background: #E9EEF4;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px
}

.shots figcaption {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  margin-top: 4px
}

.locs {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px
}

.locs a {
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 56px 16px;
  background: #fff;
  border-radius: 22px
}

.empty i {
  font-size: 44px;
  color: #B9C6D4
}

.app-ver {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  margin: 14px 0 0
}

/* Navigasi bawah gaya Material 3 */
.bnav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  padding: 8px 8px calc(8px + var(--safe-b));
  z-index: 50
}

.bnav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500
}

.bnav a i {
  width: 60px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-size: 21px;
  transition: background .2s
}

.bnav a.active {
  color: var(--navy);
  font-weight: 700
}

.bnav a.active i {
  background: var(--yellow)
}

/* Snackbar */
.snack {
  position: fixed;
  left: 50%;
  bottom: calc(92px + var(--safe-b));
  transform: translate(-50%, 16px);
  width: calc(100% - 32px);
  max-width: 448px;
  background: #1E2E3D;
  color: #fff;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 14.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 300
}

.snack.show {
  opacity: 1;
  transform: translate(-50%, 0)
}

.snack.danger {
  background: #8F2A2A
}

.snack.success {
  background: #116B4A
}

/* Kamera layar penuh */
.cam {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: none;
  flex-direction: column
}

.cam.show {
  display: flex
}

.cam-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  min-height: 0
}

.cam video,
.cam .shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover
}

.cam video {
  transform: scaleX(-1)
}

.cam .shot {
  object-fit: contain;
  background: #000
}

.guide {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 62%;
  aspect-ratio: 3/4;
  transform: translate(-50%, -50%);
  border: 3px dashed rgba(255, 255, 255, .75);
  border-radius: 50%/46%;
  pointer-events: none
}

.cam.review .guide {
  display: none
}

.cam-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: calc(14px + var(--safe-t)) 14px 34px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
  background: linear-gradient(rgba(0, 0, 0, .7), transparent)
}

.cam-title {
  font-weight: 700;
  font-size: 18px
}

.gps {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums
}

.gps-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  background: #999
}

.gps-dot.wait {
  background: var(--yellow);
  animation: blink 1s infinite
}

.gps-dot.ok {
  background: #3DDC97
}

.gps-dot.err {
  background: #FF6B6B
}

@keyframes blink {
  50% {
    opacity: .25
  }
}

.cam-x {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 18px;
  flex: none
}

.cam-msg {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  color: #fff;
  background: rgba(0, 0, 0, .6);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  text-align: center
}

.cam-msg:empty {
  display: none
}

.cam-bottom {
  background: #000;
  padding: 16px 24px calc(20px + var(--safe-b));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.cam-bottom[hidden] {
  display: none
}

.cam-bottom.review {
  justify-content: stretch
}

.shutter {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .35);
  display: grid;
  place-items: center
}

.shutter span {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid #000;
  display: block
}

.shutter:disabled {
  opacity: .35
}

.shutter:active:not(:disabled) {
  transform: scale(.93)
}

.cam-alt {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px
}

.cam-alt.ghost {
  background: none
}

/* Layar berhasil & zoom foto */
.done-layer {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(6, 46, 79, .6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 calc(0px + var(--safe-b))
}

.done-layer[hidden],
.zoom-layer[hidden] {
  display: none
}

.done-card {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 28px 28px 0 0;
  padding: 28px 22px calc(22px + var(--safe-b));
  text-align: center;
  animation: sheet .3s ease-out
}

@keyframes sheet {
  from {
    transform: translateY(40px);
    opacity: 0
  }
}

@media (prefers-reduced-motion:reduce) {
  .done-card {
    animation: none
  }
}

.done-check {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok);
  display: grid;
  place-items: center;
  font-size: 38px;
  margin: 0 auto 12px
}

.done-card.warn .done-check {
  background: var(--warn-bg);
  color: var(--warn)
}

.done-card h3 {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 4px
}

.done-card p {
  color: var(--muted);
  margin: 0 0 18px
}

.zoom-layer {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, .9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px
}

.zoom-layer img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px
}