/*
 * Tein Warranty — desain "Bersih": datar, garis tipis, tanpa bayangan, aksen hijau Tein.
 * Warna diatur lewat variabel di :root, ubah di sini untuk mengganti tema.
 */
:root {
    --bg: #F4F5F7;
    --surface: #FFFFFF;
    --surface-2: #FAFBFC;
    --surface-3: #F7F8FA;
    --border: #E3E6EA;
    --border-row: #EEF0F2;
    --border-input: #CBD2D9;
    --border-btn: #DDE1E6;
    --text: #1F2933;
    --text-2: #3E4C59;
    --muted: #52606D;
    --muted-2: #616E7C;
    --faint: #9AA5B1;
    --accent: #007A36;          /* hijau Tein gelap: tombol (kontras teks putih cukup) */
    --accent-hover: #00682E;
    --accent-bright: #009944;   /* hijau logo Tein: garis aktif, fokus */
    --accent-soft: #E9F5EE;
    --accent-line: #CFE6D7;
    --accent-ink: #0B5D2A;
    --danger: #C81E1E;
    --danger-hover: #A61B1B;
    --danger-ink: #B91C1C;
    --danger-soft: #FDECEC;
    --warn-soft: #FFF4E5;
    --warn-ink: #8A4B00;
    --ok-soft: #E6F4EA;
    --ok-ink: #0B6B32;
    --info-soft: #E8F0FE;
    --info-ink: #1E4FA8;
    --radius: 10px;
    --radius-sm: 6px;
    --ring: 3px solid rgba(0, 153, 68, .2);
}

/* ---------- Dasar ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* Halaman selalu selebar layar penuh dan scrollbar (jika ada) menimpa tepi kanannya, jadi isi tidak
   bergeser saat pindah antara halaman pendek & panjang, tanpa menyisakan ruang kosong. */
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; scroll-padding-top: 80px; /* agar fokus/scroll tidak tertutup header sticky */ }
/* SweetAlert: kunci scroll lewat <html> agar body tetap selebar layar, tanpa padding pengganti scrollbar. */
html.swal2-shown:not(.swal2-no-backdrop, .swal2-toast-shown) { overflow-y: hidden; }
body.swal2-shown { overflow: visible !important; padding-right: 0 !important; }
body {
    width: 100vw;
    margin: 0;
    font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}
h1, h2, h3, p, dl, dd, figure { margin: 0; }
img, video { max-width: 100%; }
a { color: var(--accent-ink); }
a:hover { color: #064020; }
button, input, select, textarea { font: inherit; color: inherit; }
[x-cloak], [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.icon { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Kerangka halaman ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-main { flex: 1 1 auto; padding-bottom: 40px; /* ruang agar tombol bantuan tidak menutupi isi paling bawah */ }
.container { width: 100%; max-width: 1232px; margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: 1120px; }
.container.tight { max-width: 760px; }
.page { padding-top: 28px; padding-bottom: 48px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.page-count { margin-left: 10px; font-size: 14px; font-weight: 400; color: var(--muted-2); letter-spacing: 0; }
.page-sub { margin-top: 4px; font-size: 14px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .9em; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--text); }

/* ---------- Header & navigasi ---------- */
/* Header selalu terlihat di atas layar saat halaman digulir. */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.site-header .container { display: flex; align-items: center; gap: 32px; min-height: 64px; }
.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 36px; width: auto; display: block; }
.nav { display: flex; align-self: stretch; gap: 28px; flex: 1 1 auto; }
.nav a {
    display: flex; align-items: center; padding-top: 2px;
    border-bottom: 2px solid transparent;
    color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent-bright); }
.header-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.header-link { color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none; }
.header-link:hover { color: var(--text); }
.menu-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
    font-size: 14px; font-weight: 500; color: var(--text-2); cursor: pointer;
}
.menu-btn:hover { background: var(--surface-3); }
.nav-toggle { display: none; }
.dropdown-wrap { position: relative; }
.dropdown {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; z-index: 200;
}
.dropdown-label { padding: 6px 10px; font-size: 12px; color: var(--muted-2); }
.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px;
    border: 0; border-radius: var(--radius-sm); background: none; text-align: left;
    font-size: 14px; color: var(--text); text-decoration: none; cursor: pointer;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); color: var(--text); }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown form { margin: 0; }

@media (max-width: 900px) {
    .site-header .container { gap: 16px; }
    .nav-toggle { display: inline-flex; }
    /* Menu melayang di bawah header (menimpa isi), jadi halaman tidak terdorong ke bawah saat menu dibuka. */
    .nav {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; gap: 0; padding: 4px 24px 12px; max-height: calc(100vh - 64px); overflow-y: auto;
        background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
    }
    .nav.open { display: flex; }
    .nav a { padding: 10px 12px; border-bottom: 0; border-left: 3px solid transparent; }
    .nav a.active { border-left-color: var(--accent-bright); background: var(--accent-soft); }
    .header-right .menu-label { display: none; }
}

/* ---------- Bantuan: tombol melayang di kanan bawah layar ---------- */
/* Jarak kanan diukur dari tepi layar (100vw - 100% = lebar scrollbar), jadi tombol tidak ikut bergeser saat scrollbar muncul/hilang. */
.help-fab {
    position: fixed; right: calc(36px - (100vw - 100%)); bottom: 20px; z-index: 90;
    display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 72px);
    padding: 10px 20px 10px 16px; border-radius: 999px;
    background: var(--accent); color: #FFFFFF; text-decoration: none;
}
.help-fab:hover { background: var(--accent-hover); color: #FFFFFF; }
.help-fab:focus-visible { outline: var(--ring); outline-offset: 2px; }
.help-fab-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.help-fab-text strong { font-size: 13.5px; font-weight: 700; }
.help-fab-text span { font-size: 12px; font-weight: 500; }
@media (max-width: 640px) {
    .help-fab { right: 16px; bottom: 16px; max-width: calc(100vw - 32px); }
}

/* ---------- Kartu & bagian ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-body { padding: 24px 28px; }
.section { padding: 24px 28px; border-bottom: 1px solid var(--border); }
.section:last-child { border-bottom: 0; }
.section-title { margin-bottom: 16px; font-size: 15px; font-weight: 600; }
.section-title .muted { font-weight: 400; }
.card-foot {
    display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px;
    padding: 16px 28px; border-top: 1px solid var(--border); background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}
.card-foot .note { margin-right: auto; font-size: 13px; color: var(--muted-2); }
.card-foot .push { margin-right: auto; display: flex; flex-direction: column; gap: 4px; }
.card > .summary:first-child { border-radius: var(--radius) var(--radius) 0 0; }

/* ---------- Grid form ---------- */
.grid { display: grid; gap: 18px 24px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.sm { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* ---------- Isian ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.label .muted { font-weight: 400; }
.input, .select, .textarea {
    width: 100%; height: 42px; padding: 0 12px;
    border: 1px solid var(--border-input); border-radius: var(--radius-sm);
    background: var(--surface); font-size: 15px; color: var(--text);
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.select {
    appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2352606D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: var(--ring); border-color: var(--accent-bright); }
.input[readonly] { background: var(--surface-3); color: var(--muted); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid, .upload.is-invalid { border-color: var(--danger); }
.field-error { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--danger-ink); }
.field-error .icon { margin-top: 2px; }
.hint { font-size: 12.5px; color: var(--muted-2); }
.check { display: flex; align-items: center; gap: 10px; padding: 3px 0; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.check-group { display: flex; flex-direction: column; gap: 2px; }
.fieldset { margin: 0; padding: 0; border: 0; }
.fieldset legend { padding: 0; margin-bottom: 6px; }
.link-btn {
    display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 0;
    border: 0; background: none; font-size: 12.5px; font-weight: 500; color: var(--accent-ink);
    text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.link-btn:hover { color: #064020; }

/* Upload foto/video */
.upload {
    position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; min-height: 74px;
    border: 1px dashed #B8C2CC; border-radius: 8px; background: var(--surface-2); cursor: pointer;
}
.upload:hover { border-color: var(--accent-bright); background: #F6FBF8; }
.upload:focus-within { outline: var(--ring); border-color: var(--accent-bright); }
.upload input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-icon { width: 40px; height: 40px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; flex: none; }
.upload-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.upload-title { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-meta { font-size: 12.5px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--accent-line); overflow: hidden; }
.upload-progress::before { content: ''; display: block; width: calc(var(--p, 0) * 100%); height: 100%; background: var(--accent); transition: width .2s; }
.upload-preview, .upload-thumb { width: 48px; height: 48px; margin-left: auto; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); flex: none; }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: 14.5px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-lg { height: 44px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #FFFFFF; }
.btn-secondary { background: var(--surface); border-color: var(--border-input); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); color: #FFFFFF; }
.btn:focus-visible, .icon-btn:focus-visible, .menu-btn:focus-visible { outline: var(--ring); outline-offset: 1px; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.icon-btn {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; flex: none;
    border: 1px solid var(--border-btn); border-radius: var(--radius-sm); background: var(--surface);
    color: var(--text-2); text-decoration: none; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.ok { color: var(--ok-ink); }
.icon-btn.no { color: var(--danger-hover); }
.icon-btn.del { color: #7B8794; }
.icon-btn.del:hover { color: var(--danger-hover); }
.actions { display: flex; justify-content: flex-end; gap: 6px; }

/* ---------- Status ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge-waiting { background: var(--warn-soft); color: var(--warn-ink); }
.badge-approved, .badge-done { background: var(--ok-soft); color: var(--ok-ink); }
.badge-process, .badge-processing { background: var(--info-soft); color: var(--info-ink); }
.badge-rejected { background: var(--danger-soft); color: var(--danger-hover); }

/* ---------- Toolbar daftar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.search { position: relative; flex: 1 1 320px; max-width: 440px; }
.search .icon { position: absolute; left: 12px; top: 12px; color: var(--muted-2); pointer-events: none; }
.search .input { height: 40px; padding-left: 36px; font-size: 14px; }
.toolbar .select { width: auto; min-width: 170px; height: 40px; font-size: 14px; }
.toolbar .btn { height: 40px; }

/* ---------- Tabel ---------- */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 300px); min-height: 200px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
    position: sticky; top: 0; z-index: 2; background: var(--surface-3);
    padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
    font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.table th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--text); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border-row); vertical-align: middle; background: var(--surface); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.table .strong { font-weight: 600; }
.table .nowrap { white-space: nowrap; }
.table .w-sm { min-width: 120px; }
.table .w-md { min-width: 150px; }
.table .sub { display: block; font-size: 13px; color: var(--muted-2); }
.table .num { text-align: right; }
.table .col-actions { position: sticky; right: 0; z-index: 1; border-left: 1px solid var(--border-row); text-align: right; }
.table th.col-actions { z-index: 3; text-align: right; }
.table .empty { padding: 40px 14px; text-align: center; color: var(--muted-2); }
.thumbs { display: flex; flex-wrap: nowrap; gap: 6px; width: max-content; }
.thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); background: #E4E7EB; cursor: zoom-in; display: block; }
.thumb-empty { width: 36px; height: 36px; border-radius: 4px; background: #E4E7EB; color: var(--faint); display: flex; align-items: center; justify-content: center; }
.checklist { display: grid; grid-template-columns: auto auto; gap: 1px 10px; font-size: 13px; white-space: nowrap; }
.checklist .yes { color: var(--ok-ink); }
.checklist .off { color: #B8C2CC; }
.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip.sm { max-width: 130px; }
.clip.md { max-width: 220px; }

/* ---------- Pagination ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--muted); }
.pager b { color: var(--text); }
.pager .select { width: auto; height: 34px; padding: 0 30px 0 10px; font-size: 14px; background-position: right 8px center; }
.pages { display: flex; flex-wrap: wrap; gap: 6px; }
.pages a, .pages span {
    min-width: 36px; height: 36px; padding: 0 8px; display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-btn); border-radius: var(--radius-sm); background: var(--surface);
    color: var(--text); text-decoration: none;
}
.pages a:hover { background: var(--surface-3); }
.pages .current { background: var(--accent); border-color: var(--accent); color: #FFFFFF; font-weight: 600; }
.pages .disabled { color: var(--faint); }
.pages .gap { border: 0; background: none; min-width: 20px; color: var(--faint); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(31, 41, 51, .55); }
.modal-box { position: relative; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.modal-box.wide { max-width: 960px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 600; }
.modal-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 22px; font-size: 14.5px; color: var(--text-2); }
.modal-body img { display: block; max-width: 100%; margin: 0 auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted); cursor: pointer; }
.modal-close:hover { background: var(--surface-3); color: var(--text); }

/* ---------- Pesan ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; font-size: 14px; }
.alert .icon { margin-top: 2px; }
.alert-error { background: var(--danger-soft); border: 1px solid #F5C2C2; color: var(--danger-hover); }
.alert-info { background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-ink); }

/* ---------- Detail data ---------- */
.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 24px; }
.dl dt { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }
.dl dd { margin-top: 4px; font-size: 15px; color: var(--text); word-break: break-word; }
.photos { display: flex; flex-wrap: wrap; gap: 16px; }
.photo { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted-2); }
.photo img { width: 180px; height: 130px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: #E4E7EB; cursor: zoom-in; }
.photo a { display: block; }
.photo video { width: 240px; height: 130px; border-radius: 8px; background: #1F2933; }
.photo-empty { width: 180px; height: 130px; border-radius: 8px; background: #E4E7EB; color: var(--faint); display: flex; align-items: center; justify-content: center; }
.thumbs a { display: block; }
.summary { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 16px 28px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 14px; }
.summary div { display: flex; flex-direction: column; }
.summary span { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2); }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { display: block; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.stat:hover { border-color: var(--accent-bright); color: var(--text); }
.stat-label { font-size: 13.5px; color: var(--muted); }
.stat-value { margin-top: 4px; font-size: 28px; font-weight: 700; }

/* Syarat & ketentuan */
.terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 28px; }
.terms h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 15px; font-weight: 600; }
.terms h3 .icon { color: var(--accent-bright); }
.terms ol { margin: 0; padding-left: 20px; font-size: 14.5px; line-height: 1.65; color: var(--text-2); }
.terms li + li { margin-top: 6px; }

/* ---------- Scanner label box (form garansi) ---------- */
.scan-box {
    display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; padding: 16px;
    border: 1px dashed var(--accent-line); border-radius: 8px; background: var(--accent-soft);
}
.scan-box .hint { color: var(--accent-ink); }
.readings { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.readings:empty { display: none; }
.reading {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px;
    padding: 10px 12px; border-bottom: 1px solid var(--border-row);
}
.reading:last-child { border-bottom: 0; }
.reading-name { font-size: 12.5px; color: var(--muted-2); }
.reading-name b { font-weight: 600; color: var(--text-2); }
.reading-value { font-size: 15px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.reading-value:empty { display: none; }
.reading .badge { grid-column: 2; grid-row: 1 / span 2; }
.badge-idle { background: var(--surface-3); color: var(--muted-2); }

/* Jendela kamera: kotak di tengah pada desktop, layar penuh pada HP. */
html.scanner-open { overflow: hidden; }
.scanner {
    position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(31, 41, 51, .7);
}
.scanner-box {
    display: flex; flex-direction: column; width: 100%; max-width: 520px; max-height: 100%;
    overflow: hidden; background: var(--surface); border-radius: var(--radius); outline: none;
}
.scanner-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.scanner-head h2 { font-size: 16px; font-weight: 600; }
.scanner-view { position: relative; flex: none; aspect-ratio: 4 / 3; background: #111; overflow: hidden; }
.scanner-view video { display: block; width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 14% 8%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 12px; pointer-events: none; }
.scanner-msg { padding: 10px 16px; font-size: 14px; color: var(--text-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.scanner-list { flex: 0 1 auto; overflow-y: auto; margin: 12px 16px; }
.scanner-foot { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.scanner-foot .btn { height: 46px; padding: 0 14px; }
.scanner-foot .btn-primary { flex: 1 1 auto; }
.scanner-foot label.btn:focus-within { outline: var(--ring); outline-offset: 1px; }
.scanner-foot [aria-pressed="true"] { background: var(--warn-soft); border-color: #F0C989; color: var(--warn-ink); }
@media (max-width: 640px) {
    .scanner { padding: 0; align-items: stretch; }
    .scanner-box { max-width: none; height: 100%; border-radius: 0; }
    .scanner-view { flex: 1 1 auto; min-height: 220px; aspect-ratio: auto; }
    .scanner-list { flex: none; margin: 10px 16px; }
    .scanner-list .reading { padding: 7px 12px; }
    .scanner-foot { flex-wrap: wrap; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .scanner-foot .btn-secondary { flex: 1 1 0; }
    .scanner-foot .btn-primary { flex-basis: 100%; }
}

/* ---------- Halaman login / error ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 24px 16px; }
.auth .brand img { height: 46px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-body { display: flex; flex-direction: column; gap: 16px; }
.error-code { font-size: 44px; font-weight: 700; color: var(--accent); line-height: 1; }
.error-page { max-width: 480px; margin: 0 auto; padding: 64px 24px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.auth .error-page { padding: 8px 0; }

/* ---------- Loading ---------- */
#loadingOverlay { display: none; position: fixed; inset: 0; z-index: 3000; background: rgba(244, 245, 247, .7); }
.spinner { position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 3px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- SweetAlert2: samakan dengan tema, tanpa bayangan ---------- */
.swal2-popup { border: 1px solid var(--border) !important; border-radius: var(--radius) !important; font-family: inherit !important; }
.swal2-popup.swal2-toast { box-shadow: none !important; }
.swal2-title { font-size: 20px !important; color: var(--text) !important; }
.swal2-styled { box-shadow: none !important; border-radius: var(--radius-sm) !important; }
.swal2-styled.swal2-confirm { background: var(--accent) !important; }

/* ---------- Utilitas ---------- */
.muted { color: var(--muted-2); }
.text-danger { color: var(--danger-ink); }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }

@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .nav { padding-left: 16px; padding-right: 16px; }
    .page { padding-top: 20px; padding-bottom: 32px; }
    .page-title { font-size: 21px; }
    .section, .card-body { padding: 20px 16px; }
    .card-foot { padding: 14px 16px; }
    .card-foot .btn { flex: 1 1 auto; }
    .summary { padding: 14px 16px; }
    .search { max-width: none; }
    .toolbar .select { flex: 1 1 auto; }
}
