:root {
  --navy: #0b3a5b;
  --navy-2: #12507a;
  --teal: #0f8b8d;
  --bg: #f3f6f9;
  --card: #ffffff;
  --text: #1c2730;
  --muted: #5b6670;
  --line: #dbe3ea;
  --hijau: #1e7d34;
  --hijau-bg: #e5f4e9;
  --kuning: #8a6100;
  --kuning-bg: #fff4d6;
  --merah: #b3261e;
  --merah-bg: #fde8e6;
  --biru: #1452a3;
  --biru-bg: #e3edfb;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--navy-2); }
header.top {
  background: linear-gradient(120deg, var(--navy), var(--navy-2));
  color: #fff; padding: 14px 16px;
}
header.top .wrap { display: flex; align-items: center; gap: 12px; }
header.top .logo {
  width: 38px; height: 38px; border-radius: 9px; background: rgba(255,255,255,.15);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
header.top h1 { font-size: 16px; margin: 0; font-weight: 700; }
header.top p { margin: 0; font-size: 12.5px; opacity: .8; }
header.top nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
header.top nav a { color: #fff; text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 8px; opacity: .9; }
header.top nav a:hover, header.top nav a.on { background: rgba(255,255,255,.14); opacity: 1; }
.wrap { max-width: 920px; margin: 0 auto; }
.wrap.wide { max-width: 1240px; }
main { padding: 20px 16px 48px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h2 { font-size: 17px; margin: 0 0 4px; color: var(--navy); }
.card h3 { font-size: 14px; margin: 18px 0 10px; color: var(--navy); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.lead { color: var(--muted); margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } header.top nav { display: none; } }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
label .req { color: var(--merah); }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #c4cfd9; border-radius: 9px; font: inherit; background: #fff; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(18,80,122,.25); border-color: var(--navy-2); }
textarea { min-height: 80px; resize: vertical; }
input[type=file] { padding: 8px; background: #f8fafc; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 9px; border: 1px solid transparent; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; background: var(--navy); color: #fff;
}
.btn:hover { background: var(--navy-2); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.sec { background: #fff; color: var(--navy); border-color: #b9c7d3; }
.btn.sec:hover { background: #f1f5f8; }
.btn.hijau { background: var(--hijau); }
.btn.merah { background: var(--merah); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; font-size: 14px; }
.alert.err { background: var(--merah-bg); color: var(--merah); }
.alert.ok { background: var(--hijau-bg); color: var(--hijau); }
.alert.info { background: var(--biru-bg); color: var(--biru); }
.alert.warn { background: var(--kuning-bg); color: var(--kuning); }
.hidden { display: none !important; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.b-DIAJUKAN { background: var(--kuning-bg); color: var(--kuning); }
.b-DISETUJUI { background: var(--hijau-bg); color: var(--hijau); }
.b-DITOLAK { background: var(--merah-bg); color: var(--merah); }
.b-SELESAI { background: var(--biru-bg); color: var(--biru); }
.b-KEDALUWARSA { background: var(--merah-bg); color: var(--merah); }
dl.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { dl.kv { grid-template-columns: 1fr; } dl.kv dd { margin-bottom: 6px; } }
.big-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; font-weight: 700; color: var(--navy); background: #eef3f7; padding: 8px 12px; border-radius: 8px; display: inline-block; letter-spacing: .5px; }
.copy-row { display: flex; gap: 8px; margin-top: 6px; }
.copy-row input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* Langkah alur */
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; counter-reset: s; margin: 8px 0 4px; }
.steps div { background: #f5f8fb; border: 1px solid var(--line); border-radius: 10px; padding: 12px 10px; font-size: 13px; position: relative; }
.steps div::before { counter-increment: s; content: counter(s); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.steps b { display: block; color: var(--navy); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.menu { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.menu a { display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: .15s; }
.menu a:hover { border-color: var(--navy-2); box-shadow: 0 4px 16px rgba(11,58,91,.08); transform: translateY(-1px); }
.menu a .ic { font-size: 26px; }
.menu a b { display: block; color: var(--navy); font-size: 16px; margin: 6px 0 2px; }
.menu a span { font-size: 13.5px; color: var(--muted); }
@media (max-width: 760px) { .menu { grid-template-columns: 1fr; } }

/* Timeline status */
.timeline { list-style: none; padding: 0; margin: 12px 0 0; }
.timeline li { position: relative; padding: 0 0 16px 30px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li .dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #b9c7d3; background: #fff; }
.timeline li.done .dot { background: var(--hijau); border-color: var(--hijau); }
.timeline li.now .dot { background: var(--kuning); border-color: var(--kuning); }
.timeline li.fail .dot { background: var(--merah); border-color: var(--merah); }
.timeline li b { display: block; }
.timeline li span { font-size: 13px; color: var(--muted); }

/* Gate */
.gate-banner { border-radius: 16px; padding: 28px 20px; text-align: center; color: #fff; margin-bottom: 16px; }
.gate-banner .ic { font-size: 54px; line-height: 1; }
.gate-banner h2 { margin: 10px 0 4px; font-size: 22px; color: #fff; }
.gate-banner p { margin: 0; opacity: .9; }
.g-hijau { background: var(--hijau); }
.g-kuning { background: #b07c00; }
.g-merah { background: var(--merah); }
.g-biru { background: var(--biru); }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stats button { all: unset; cursor: pointer; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stats button.on { border-color: var(--navy-2); box-shadow: inset 0 0 0 1px var(--navy-2); }
.stats .n { font-size: 24px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.stats .l { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 200px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f5f8fb; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fbfd; }
td .sub { color: var(--muted); font-size: 12.5px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.drawer-bg { position: fixed; inset: 0; background: rgba(10,25,40,.45); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100%); background: var(--bg); z-index: 21; overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,.15); }
.drawer .head { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 14px 18px; display: flex; align-items: center; gap: 10px; z-index: 1; }
.drawer .head h2 { margin: 0; font-size: 16px; color: var(--navy); }
.drawer .head .x { margin-left: auto; }
.drawer .body { padding: 16px; }
.login-box { max-width: 380px; margin: 60px auto; }
.muted { color: var(--muted); }
footer.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 20px 16px 30px; }

/* Hasil scan gate */
.scan-hasil { border-radius: 18px; padding: 26px 18px; text-align: center; color: #fff; margin-bottom: 16px; }
.scan-hasil .ic { font-size: 64px; line-height: 1; }
.scan-hasil h2 { color: #fff; font-size: 26px; margin: 10px 0 6px; letter-spacing: .3px; }
.scan-hasil p { margin: 0; font-size: 16px; opacity: .95; }
.scan-hasil .alat { font-size: 18px; font-weight: 700; margin-top: 8px; }
.s-TERCATAT { background: var(--hijau); }
.s-DUPLIKAT { background: #5b6670; }
.s-DITOLAK { background: var(--merah); }
.foto-alat { width: 100%; max-height: 260px; object-fit: contain; background: #eef2f6; border-radius: 12px; border: 1px solid var(--line); display: block; }
