:root {
  --blue: #00559f;
  --blue-dark: #003f77;
  --blue-soft: #e6f0fa;
  --yellow: #f2c500;
  --bg: #eef3f9;
  --card: #ffffff;
  --text: #12202e;
  --muted: #66798d;
  --line: #dde6f0;
  --danger: #c0272d;
  --ok: #177a4b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 42, 67, 0.04), 0 8px 24px rgba(16, 42, 67, 0.06);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
p { margin: 0; }
.muted { color: var(--muted); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 50, 95, 0.25);
}

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

.mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--yellow);
  color: #0b2a4a;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 12px; opacity: 0.78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.link {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 13px;
  padding: 7px 11px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}
.link:hover { background: rgba(255, 255, 255, 0.2); }

/* ---------- layout ---------- */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}

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

label {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #2a3f55;
}

.step {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.opt, .counter { font-size: 12px; color: var(--muted); font-weight: 500; }

input[type="text"], input[type="tel"], input:not([type]), textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  background: #fbfdff;
  border-radius: 12px;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 85, 159, 0.12);
  background: #fff;
}
textarea { resize: vertical; min-height: 76px; }

.hint { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---------- pilihan layanan ---------- */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  position: relative;
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 14px 14px 13px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.choice-ico { font-size: 20px; line-height: 1.2; margin-bottom: 4px; }
.choice-title { font-size: 15px; font-weight: 650; }
.choice-sub { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.choice[aria-checked="true"] {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(0, 85, 159, 0.1);
}
.choice[aria-checked="true"]::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none;
  border: 1.5px solid var(--line);
  background: #fbfdff;
  color: #34495e;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip[aria-checked="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 3px 10px rgba(0, 85, 159, 0.22);
}

/* ---------- foto ---------- */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shot-add, .shot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px dashed #b9cade;
  background: #f7fafd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--blue);
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}
.shot-add .cam { font-size: 22px; }
.shot-add:hover { background: var(--blue-soft); border-color: var(--blue); }
.shot { border: 1px solid var(--line); padding: 0; background: #000; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.shot .badge {
  position: absolute;
  left: 5px;
  bottom: 5px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
}

/* ---------- button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 13px;
  padding: 14px 18px;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s, filter 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, #0a63b4 0%, var(--blue) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 85, 159, 0.28);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--blue); border: 1.5px solid var(--line); margin-top: 8px; }

.submitbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.submitbar .btn { max-width: 528px; margin: 0 auto; }

/* ---------- overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(9, 26, 43, 0.55);
  backdrop-filter: blur(3px);
}
.overlay[hidden] { display: none; }

.busy-box, .done-card {
  background: #fff;
  border-radius: 20px;
  padding: 26px 22px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.busy-box p { margin-top: 14px; color: var(--muted); font-size: 14px; }

.spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto;
  border-radius: 999px;
  border: 3px solid var(--blue-soft);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tick {
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e6f6ed;
  color: var(--ok);
  font-size: 30px;
  font-weight: 700;
}
.done-card h2 { font-size: 20px; margin-bottom: 6px; }
.ticket {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0.02em;
  color: var(--blue);
  margin: 6px 0;
  font-variant-numeric: tabular-nums;
}
.done-card .muted { font-size: 13px; margin-bottom: 16px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100% - 32px);
  background: #1e2d3d;
  color: #fff;
  font-size: 13.5px;
  line-height: 1.45;
  padding: 11px 16px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.toast[hidden] { display: none; }
.toast.err { background: #8f1f24; }

/* ---------- login ---------- */
body.auth { display: grid; place-items: center; min-height: 100dvh; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, #dbe9f8 0%, var(--bg) 55%); }
.auth-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 22px;
  padding: 28px 24px;
  box-shadow: 0 24px 60px rgba(16, 42, 67, 0.14);
  text-align: center;
}
.logo-big {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: var(--yellow);
  font-size: 30px;
  box-shadow: 0 10px 20px rgba(0, 85, 159, 0.28);
}
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .muted { font-size: 14px; margin-bottom: 20px; }
.auth-card form { text-align: left; }
.auth-card label { display: block; margin: 14px 0 6px; }
.auth-card .btn { margin-top: 20px; }
.auth-card .foot { margin-top: 18px; font-size: 12px; color: var(--muted); }
.error {
  margin-top: 12px;
  background: #fdecec;
  color: var(--danger);
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid #f6cdcd;
}
.error[hidden] { display: none; }

/* ---------- admin ---------- */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 26px; letter-spacing: -0.03em; color: var(--blue); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 8px; }
.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.item-top { display: flex; gap: 12px; padding: 12px; }
.thumb {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  background: #dde7f1;
}
.item-body { min-width: 0; flex: 1; }
.item-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.item-title b { font-size: 15px; font-variant-numeric: tabular-nums; }
.item-title time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.item-sub { font-size: 13px; color: #34495e; margin-top: 3px; }
.item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  margin-top: 6px;
}
.pill.ok { background: #e6f6ed; color: var(--ok); }
.pill.bad { background: #fdecec; color: var(--danger); }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 40px 10px; }

@media (min-width: 640px) {
  .page { padding: 24px 16px; }
  .topbar { padding-left: max(16px, calc((100vw - 560px) / 2)); padding-right: max(16px, calc((100vw - 560px) / 2)); }
}

/* ---------- auth tambahan ---------- */
.auth-card.wide { max-width: 430px; }
.auth-card select {
  width: 100%;
  border: 1.5px solid var(--line);
  background: #fbfdff;
  border-radius: 12px;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2366798d' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.auth-card select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,85,159,.12); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-weight: 500; font-size: 13.5px; color: #34495e; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }
.switch { margin-top: 16px; font-size: 13.5px; color: var(--muted); }
.switch a, .foot a { color: var(--blue); font-weight: 600; text-decoration: none; }
.switch a:hover, .foot a:hover { text-decoration: underline; }

.pending-ico { font-size: 40px; margin-bottom: 8px; }
.pending-note { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 10px 0 16px; }
.dotline { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.dotline span { width: 7px; height: 7px; border-radius: 999px; background: var(--blue); opacity: .25; animation: blink 1.2s infinite; }
.dotline span:nth-child(2) { animation-delay: .2s; }
.dotline span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

/* ---------- admin petugas ---------- */
.section-title { font-size: 14px; font-weight: 650; color: #34495e; margin: 18px 2px 10px; }
.avatar {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 999px;
  display: grid; place-items: center; background: var(--blue-soft); color: var(--blue);
  font-weight: 750; font-size: 17px;
}
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mini {
  appearance: none; border: 1px solid var(--line); background: #fbfdff; color: var(--blue);
  font: inherit; font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px; cursor: pointer;
}
.mini:hover { background: var(--blue-soft); border-color: #b9d2ea; }
.mini.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.mini.primary:hover { filter: brightness(1.05); background: var(--blue); }
.mini:disabled { opacity: .55; cursor: not-allowed; }
.thumb-empty { display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 750; font-size: 24px; }
body.auth { align-items: safe center; }

/* ---------- menu petugas ---------- */
.greet { font-size: 14px; color: var(--muted); margin: 2px 2px 10px; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.menu-card {
  appearance: none; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 18px; padding: 18px 14px 16px; text-align: left; font: inherit;
  color: var(--text); cursor: pointer; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px; transition: transform .1s, border-color .15s, box-shadow .15s;
}
.menu-card:hover { border-color: #b9d2ea; box-shadow: 0 10px 26px rgba(16,42,67,.1); }
.menu-card:active { transform: translateY(1px); }
.menu-card strong { font-size: 17px; letter-spacing: -.01em; }
.menu-card span:last-child { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.menu-ico { font-size: 26px; margin-bottom: 6px; }
.menu-card.paska .menu-ico { filter: hue-rotate(0deg); }
.note-card { font-size: 13px; color: #34495e; }
.note-card strong { display: block; margin-bottom: 6px; font-size: 13px; }
.note-card ul { margin: 0; padding-left: 18px; line-height: 1.6; color: var(--muted); }

.back {
  appearance: none; border: 0; background: transparent; color: var(--blue);
  font: inherit; font-size: 14px; font-weight: 600; padding: 4px 2px 10px; cursor: pointer;
}
.progress-row { display: flex; align-items: center; gap: 14px; }
.progress-row .spinner { margin: 0; flex: 0 0 auto; }
.progress-row strong { font-size: 15px; }
.hasil-card { margin-bottom: 10px; }
.hasil-teks { white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; color: #24384c; word-break: break-word; }
.hasil-teks strong { color: #0f2438; }
.hasil-teks code { background: #eef3f9; padding: 1px 5px; border-radius: 6px; font-size: 12.5px; }
.hasil-img { width: 100%; border-radius: 12px; margin-top: 10px; border: 1px solid var(--line); display: block; }
.history-item {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; font: inherit; cursor: pointer;
}
.history-item:hover { border-color: #b9d2ea; }
.history-id { flex: 1; font-size: 13px; color: #34495e; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.warn-text { color: #9a6700; }
