/* Mobile-first, no external fonts: system font stack only. */
:root {
  --bg: #f3f5f8; --card: #fff; --text: #17202a; --muted: #5d6b7a; --line: #d9dee5;
  --primary: #0b3d63; --primary-2: #145a8d;
  --green: #1e7b34; --green-bg: #e3f4e7; --yellow: #8a6100; --yellow-bg: #fff4d1;
  --red: #b3261e; --red-bg: #fde7e5; --radius: 12px; --tap: 48px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg); color: var(--text); }
[hidden] { display: none !important; }
h1 { font-size: 1.35rem; margin: 0 0 .5rem; } h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
a { color: var(--primary-2); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mono, .mrz { font-family: ui-monospace, "DejaVu Sans Mono", "Liberation Mono", Menlo, Consolas, monospace; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  justify-content: space-between; padding: .5rem .75rem; background: var(--primary); color: #fff; }
.brand { color: #fff; font-weight: 700; text-decoration: none; min-height: var(--tap); display: flex; align-items: center; }
.nav { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.nav a, .linkbtn { color: #fff; text-decoration: none; padding: .6rem .6rem; border-radius: 8px; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover, .linkbtn:hover { background: rgba(255,255,255,.15); }
.linkbtn { background: none; border: 0; font: inherit; cursor: pointer; }
.inline { display: inline; }

.container { max-width: 760px; margin: 0 auto; padding: .75rem; }
.card { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.card.narrow { max-width: 420px; margin: 2rem auto; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 600; font-size: .92rem; }
input, select { font: inherit; min-height: var(--tap); padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); width: 100%; }
input:focus, select:focus { outline: 3px solid rgba(20,90,141,.3); border-color: var(--primary-2); }
.input-small { min-height: 36px; width: 9rem; display: inline-block; padding: .3rem .5rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--tap); padding: .55rem 1rem;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:disabled { opacity: .6; }
.btn-big { min-height: 60px; font-size: 1.1rem; width: 100%; }
.btn-small { min-height: 36px; padding: .3rem .7rem; font-size: .85rem; }
.actions-col { display: flex; flex-direction: column; gap: .65rem; margin: 1rem 0 .5rem; }
.actions-row { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: 1rem; }
.actions-row .btn { flex: 1 1 10rem; }
.hint { font-size: .85rem; color: var(--muted); }

.banner { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: .75rem; font-weight: 600; }
.banner-green { background: var(--green-bg); color: var(--green); border: 1px solid #b6dfc0; }
.banner-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid #f1d98a; }
.banner-red { background: var(--red-bg); color: var(--red); border: 1px solid #f3b9b4; }
#offline-banner { margin: .5rem .75rem 0; }
.badges { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-red { background: var(--red-bg); color: var(--red); }

.result-head { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .75rem; }
.thumb { width: 110px; height: auto; max-height: 160px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #eee; }
.fields { display: grid; grid-template-columns: 1fr; gap: .65rem; }
@media (min-width: 560px) { .fields { grid-template-columns: 1fr 1fr; } }
.fields label.failed input, .fields label.failed select { border: 2px solid var(--yellow); background: var(--yellow-bg); }
.fields label.failed::after { content: "Periksa kolom ini"; font-size: .75rem; color: var(--yellow); font-weight: 600; }
.fields label.changed input, .fields label.changed select { border-color: var(--primary-2); }
.mrz-box { margin-top: 1rem; }
.mrz-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.mrz { background: #10161d; color: #e6edf3; padding: .6rem .7rem; border-radius: 8px; overflow-x: auto; font-size: clamp(8px, 2.45vw, 14px); line-height: 1.5; margin: 0; white-space: pre; user-select: all; }
progress { width: 100%; height: 14px; }
.tips ul { padding-left: 1.2rem; margin: .5rem 0 0; } .tips summary { font-weight: 600; cursor: pointer; min-height: 32px; }

/* history */
.search { display: grid; grid-template-columns: 1fr; gap: .5rem; margin-bottom: .5rem; }
@media (min-width: 560px) { .search { grid-template-columns: 1fr 1fr; } }
.list { list-style: none; padding: 0; margin: 0; }
.list-item { display: flex; gap: .65rem; align-items: center; padding: .7rem .25rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; min-height: var(--tap); }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot-success { background: var(--green); } .dot-partial { background: #e0a800; } .dot-failure { background: var(--red); }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: center; margin-top: .75rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .45rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }

/* live camera */
.live { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.live-stage { position: relative; flex: 1; overflow: hidden; }
.live-stage video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.live-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.guide { position: relative; width: 92%; aspect-ratio: 5.2 / 1; border: 3px solid #fff; border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); display: flex; align-items: flex-end; justify-content: center; }
.guide.ok { border-color: #3ddc71; }
.guide span { position: absolute; top: -2.2rem; color: #fff; font-weight: 600; text-align: center; font-size: .95rem; text-shadow: 0 1px 2px #000; }
.live-hint { position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); background: rgba(0,0,0,.65); color: #fff;
  padding: .5rem .9rem; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.live-hint.ok { background: rgba(30,123,52,.9); }
.live-controls { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem calc(1rem + env(safe-area-inset-bottom)); background: #000; color: #fff; }
.live-controls .btn { min-width: 6rem; }
.shutter { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: #e9e9e9; cursor: pointer; }
.shutter:active { background: #bbb; }
.toggle { flex-direction: row; align-items: center; color: #fff; font-weight: 600; gap: .4rem; }
.toggle input { width: 22px; min-height: 22px; height: 22px; }
