:root {
    --ink: #17283d;
    --ink-soft: #4a5b70;
    --paper: #f3f6f9;
    --card: #ffffff;
    --line: #d9e1ea;
    --brand: #0c6b78;
    --brand-dark: #08525c;
    --danger: #a8281d;
    --danger-bg: #fdecea;
    --ok: #1d6b3a;
    --ok-bg: #e7f5ec;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
}

h1, h2 { line-height: 1.3; margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; margin-top: 1.5rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); }
code { background: #e8eef4; padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }

.muted { color: var(--ink-soft); }
.hint { display: block; margin-top: .25rem; color: var(--ink-soft); font-size: .8rem; }

/* Bilah atas */
.topbar { background: var(--ink); color: #fff; }
.topbar-inner {
    max-width: 1040px; margin: 0 auto; padding: .75rem 1.25rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 600; }
.brand-logo { height: 32px; width: auto; border-radius: 4px; background: #fff; padding: 2px; }
.topbar-user { display: flex; align-items: center; gap: .75rem; }
.topbar-user form { margin: 0; }
.user-name { font-size: .9rem; color: #cfd9e5; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 2rem 1.25rem; flex: 1; }

/* Ringkasan */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.25rem; }
.stat-value { font-size: 1.9rem; font-weight: 600; color: var(--brand); line-height: 1.2; }
.stat-label { color: var(--ink-soft); font-size: .9rem; }

.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 1.5rem; }
.empty h2 { margin-top: 0; }

/* Halaman masuk */
.plain-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card {
    width: 100%; max-width: 400px; background: var(--card);
    border: 1px solid var(--line); border-radius: 12px; padding: 2rem 1.75rem;
}
.auth-card-wide { max-width: 520px; }
.auth-logo { display: block; max-height: 56px; width: auto; margin-bottom: .75rem; }
.auth-org { font-weight: 500; color: var(--ink-soft); margin-bottom: .25rem; }

/* Formulir */
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: .3rem; font-weight: 500; font-size: .9rem; }
.field input {
    width: 100%; padding: .65rem .8rem; font: inherit; color: var(--ink);
    background: #fff; border: 1px solid #b9c5d2; border-radius: 8px;
}
.field input:focus { outline: 3px solid rgba(12, 107, 120, .3); border-color: var(--brand); }

.btn {
    display: inline-block; padding: .6rem 1.1rem; font: inherit; font-weight: 500;
    border: 1px solid transparent; border-radius: 8px; cursor: pointer; text-decoration: none; text-align: center;
}
.btn:focus-visible { outline: 3px solid rgba(12, 107, 120, .4); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-block { width: 100%; }
.btn-quiet { background: transparent; color: #fff; border-color: #5b6f86; padding: .35rem .8rem; font-size: .85rem; }
.btn-quiet:hover { background: #24384f; }

.alert { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f0c3be; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe0cb; }

.footer { text-align: center; padding: 1.25rem 1rem; color: var(--ink-soft); font-size: .8rem; }

@media (max-width: 480px) {
    .auth-card { padding: 1.5rem 1.25rem; }
    .user-name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ===== Tahap 4: peserta, pendaftaran, tabel ===== */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.narrow { max-width: 460px; }
.card-form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; }
.auth-alt { margin: 1rem 0 0; text-align: center; font-size: .9rem; }
.field.check { display: flex; gap: .6rem; align-items: flex-start; }
.field.check input { width: auto; margin-top: .3rem; flex: none; }
.field.check label { margin: 0; font-weight: 400; font-size: .85rem; color: var(--ink-soft); }

.secret { display: inline-block; margin-top: .4rem; padding: .35rem .7rem; font-size: 1.05rem; letter-spacing: .05em; background: #fff; border: 1px dashed #7a8b9e; border-radius: 6px; color: var(--ink); user-select: all; }
.alert-flash { margin-bottom: 1rem; }

.topnav { display: flex; gap: .25rem; margin-left: 1.5rem; flex: 1; }
.topnav a { color: #cfd9e5; text-decoration: none; padding: .35rem .75rem; border-radius: 6px; font-size: .9rem; }
.topnav a:hover, .topnav a.is-active { background: #24384f; color: #fff; }
.link-quiet { color: #cfd9e5; font-size: .85rem; }

.link-box { display: inline-block; padding: .4rem .7rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; word-break: break-all; user-select: all; }

.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.tab { padding: .4rem .8rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); text-decoration: none; font-size: .85rem; }
.tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab-n { opacity: .7; margin-left: .2rem; }

.search { display: flex; gap: .5rem; margin-bottom: 1rem; max-width: 480px; }
.search input { flex: 1; padding: .6rem .8rem; font: inherit; border: 1px solid #b9c5d2; border-radius: 8px; }
.bulkbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.bulkbar select { padding: .55rem .7rem; font: inherit; border: 1px solid #b9c5d2; border-radius: 8px; background: #fff; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: .65rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: #eef3f7; font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.col-check { width: 2rem; }
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-right: .25rem; }
.btn-small { padding: .3rem .65rem; font-size: .78rem; background: #fff; color: var(--ink); border-color: #b9c5d2; }
.btn-small:hover { background: #eef3f7; }
.btn-small.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-small.btn-primary:hover { background: var(--brand-dark); }

.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 500; }
.badge-pending { background: #fff3d1; color: #7a5200; }
.badge-active { background: var(--ok-bg); color: var(--ok); }
.badge-rejected { background: var(--danger-bg); color: var(--danger); }
.badge-suspended { background: #e8e8f0; color: #3d3d66; }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--brand); }

/* ===== Tahap 4b: biro, asesor, klien ===== */
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem; }
.panel h2 { margin-top: 0; }
.panel h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.panel-wide { grid-column: 1 / -1; }
.panel-gap { margin-top: 1.5rem; }
.logo-preview { display: block; max-height: 80px; max-width: 100%; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.row-form { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.row-form .field { margin-bottom: 0; flex: 1 1 200px; }
.rename-form input { padding: .4rem .6rem; font: inherit; border: 1px solid #b9c5d2; border-radius: 6px; min-width: 220px; }
.field input[type="file"] { padding: .45rem; }
.search select { padding: .55rem .7rem; font: inherit; border: 1px solid #b9c5d2; border-radius: 8px; background: #fff; max-width: 200px; }
.search { flex-wrap: wrap; max-width: 760px; }
.bulkbar select { max-width: 220px; }

/* ===== Tahap 5-9: katalog, program, pengerjaan tes, laporan ===== */
.topnav { overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.num { width: 5.5rem; padding: .35rem .5rem; font: inherit; border: 1px solid #b9c5d2; border-radius: 6px; }
.small { font-size: .8rem; }
.big { font-size: 1.4rem; }
.grow { flex: 1 1 auto; }
.check-line { display: block; margin: .35rem 0; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .75rem 1rem; align-items: end; }
.grid-form .field { margin-bottom: 0; }
.grid-form select, .row-form select, .field select { width: 100%; padding: .6rem .7rem; font: inherit; border: 1px solid #b9c5d2; border-radius: 8px; background: #fff; }
.grid-form input[type="datetime-local"] { width: 100%; padding: .6rem .7rem; font: inherit; border: 1px solid #b9c5d2; border-radius: 8px; }
.item-row { display: flex; flex-wrap: wrap; gap: .6rem .9rem; align-items: center; }
.item-row label { font-size: .85rem; display: inline-flex; align-items: center; gap: .3rem; }
.rules { color: var(--ink-soft); font-size: .9rem; padding-left: 1.1rem; }
[hidden] { display: none !important; }

/* halaman tes */
.page-test { background: var(--paper); }
.test-top { position: sticky; top: 0; z-index: 5; background: var(--ink); color: #fff; padding: .6rem 1rem .3rem; }
.test-title { font-weight: 600; font-size: .95rem; }
.test-meta { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .25rem 0; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.3rem; font-weight: 600; letter-spacing: .03em; }
.timer.is-low { color: #ffb4a8; }
.save-status { font-size: .78rem; color: #cfd9e5; }
.test-progress { width: 100%; height: 6px; display: block; accent-color: #3fc1b0; }
.test-body { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.test-help { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem; font-size: .88rem; }
.test-help summary { cursor: pointer; font-weight: 500; }
.qnav { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: 1rem; }
.qdot { width: 2.1rem; height: 2.1rem; border-radius: 6px; border: 1px solid #b9c5d2; background: #fff; font: inherit; font-size: .8rem; cursor: pointer; color: var(--ink); }
.qdot.is-done { background: var(--ok-bg); border-color: #8fc7a4; color: var(--ok); }
.qdot.is-current { outline: 2px solid var(--brand); outline-offset: 1px; }
.q { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem 1rem; margin: 0 0 1rem; }
.q legend { font-weight: 600; padding: 0 .4rem; font-size: .9rem; }
.q-head, .q-row { display: grid; grid-template-columns: 1fr 3.2rem 3.2rem; gap: .4rem; align-items: center; }
.q-head { color: var(--ink-soft); font-size: .75rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); }
.mlh { text-align: center; font-weight: 600; }
.q-row { padding: .45rem 0; border-bottom: 1px solid #eef3f7; }
.q-row:last-child { border-bottom: 0; }
.q-text { font-size: 1rem; }
.pick { display: flex; justify-content: center; cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick span { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 2px solid #b9c5d2; font-weight: 600; font-size: .85rem; color: var(--ink-soft); background: #fff; }
.pick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.pick-l input:checked + span { background: #7a4a00; border-color: #7a4a00; }
.pick input:focus-visible + span { outline: 3px solid rgba(12,107,120,.45); outline-offset: 2px; }
.test-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.test-actions .btn:disabled { opacity: .4; cursor: not-allowed; }

/* laporan */
.report { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; max-width: 900px; margin: 0 auto; }
.report-head { display: flex; align-items: center; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .75rem; margin-bottom: 1rem; }
.report-head > div { flex: 1; }
.report-head h1 { margin: 0; }
.report-logo { max-height: 56px; width: auto; }
.info-table { width: 100%; border-collapse: collapse; font-size: .88rem; margin-bottom: 1rem; }
.info-table th { text-align: left; color: var(--ink-soft); font-weight: 500; padding: .25rem .6rem .25rem 0; white-space: nowrap; width: 1%; }
.info-table td { padding: .25rem 1rem .25rem 0; }
.disclaimer { background: #fff6e0; border: 1px solid #f0d9a0; color: #7a5200; padding: .6rem .8rem; border-radius: 8px; font-size: .82rem; }
.report-section { margin-top: 1.5rem; page-break-inside: avoid; }
.report-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; align-items: center; }
.disc-graph { width: 100%; height: auto; max-width: 520px; }
.score-table { font-size: .82rem; }
.texts dt { font-weight: 600; margin-top: .6rem; }
.texts dd { margin: .1rem 0 0; color: var(--ink-soft); }
.report-foot { margin-top: 2rem; text-align: center; color: var(--ink-soft); font-size: .8rem; border-top: 1px solid var(--line); padding-top: .75rem; }

@media (max-width: 640px) {
    .report-grid { grid-template-columns: 1fr; }
    .report { padding: 1rem; }
}
@media print {
    body { background: #fff; }
    .topbar, .footer, .no-print, .alert-flash { display: none !important; }
    .container { max-width: none; padding: 0; }
    .report { border: 0; padding: 0; }
}
.head-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

/* ===== CBI: soal Benar/Salah dan laporan ===== */
.q-stem { font-size: 1.05rem; margin: .4rem 0 .8rem; line-height: 1.5; }
.tf-options { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.tf-pick { cursor: pointer; }
.tf-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tf-pick span { display: block; text-align: center; padding: .7rem .5rem; border: 2px solid #b9c5d2; border-radius: 10px; background: #fff; font-weight: 600; color: var(--ink-soft); }
.tf-pick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.tf-pick input:focus-visible + span { outline: 3px solid rgba(12,107,120,.45); outline-offset: 2px; }

.cbi-graph, .cbi-bar { width: 100%; height: auto; max-width: 640px; display: block; }
.cbi-cat { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid transparent; }
.cbi-low, .cbi-gi-low { background: #dff1e5; color: #1d6b3a; border-color: #bfe0cb; }
.cbi-concern, .cbi-gi-concern { background: #fdf1c9; color: #7a5200; border-color: #f0d9a0; }
.cbi-serious, .cbi-gi-serious { background: #f8d9d5; color: #a8281d; border-color: #f0c3be; }
.alert-warn { background: #fff6e0; color: #7a5200; border: 1px solid #f0d9a0; }

/* ===== LBA II: situasi pilihan ganda terkunci dan laporan ===== */
.sc-options { display: grid; gap: .55rem; }
.sc-pick { cursor: pointer; display: block; }
.sc-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sc-box { display: block; padding: .7rem .85rem; border: 2px solid #b9c5d2; border-radius: 10px; background: #fff; color: var(--ink); line-height: 1.5; }
.sc-letter { color: var(--brand); margin-right: .15rem; }
.sc-pick:hover .sc-box { border-color: var(--brand); }
.sc-pick input:checked + .sc-box { background: #e3f1f3; border-color: var(--brand); }
.sc-pick input:focus-visible + .sc-box { outline: 3px solid rgba(12,107,120,.45); outline-offset: 2px; }
.q-sc.is-locked .sc-pick { cursor: default; }
.q-sc.is-locked .sc-pick:hover .sc-box { border-color: #b9c5d2; }
.q-sc.is-locked .sc-pick input:checked:hover + .sc-box { border-color: var(--brand); }
.q-sc.is-locked .sc-pick input:not(:checked) + .sc-box { opacity: .6; }
.sc-lock-note { margin: .5rem 0 0; }

.lba-graph, .lba-bars { width: 100%; height: auto; max-width: 560px; display: block; }
.lba-lvl { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid transparent; }
.lba-lvl-low { background: #fdf1c9; color: #7a5200; border-color: #f0d9a0; }
.lba-lvl-medium { background: #e3f1f3; color: #08525c; border-color: #b8dadf; }
.lba-lvl-high { background: #dff1e5; color: #1d6b3a; border-color: #bfe0cb; }
.lba-order { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; margin: .5rem 0 1rem; padding: 0; list-style: none; }
.lba-order li { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; background: #fff; }
.lba-order .lba-rank { display: block; font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.lba-order .lba-name { display: block; font-weight: 600; }
.lba-order .lba-sc { display: block; font-size: .85rem; color: var(--ink-soft); }
.lba-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
.lba-metric { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; background: #fff; }
.lba-metric .lba-big { font-size: 1.8rem; font-weight: 600; color: var(--brand); line-height: 1.2; }
@media (max-width: 640px) { .lba-order { grid-template-columns: 1fr 1fr; } .lba-metrics { grid-template-columns: 1fr; } }

/* ===== Tes IQ: soal pilihan ganda ===== */
.q-img { display: block; width: 100%; max-width: 720px; height: auto; margin: .2rem 0 1rem; border: 1px solid #d7dee6; border-radius: 8px; background: #fff; }
.mcq-options { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.mcq-options.mcq-letters { grid-template-columns: repeat(5, 1fr); max-width: 720px; }
.mcq-pick { cursor: pointer; }
.mcq-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mcq-pick span { display: block; padding: .65rem .8rem; border: 2px solid #b9c5d2; border-radius: 10px; background: #fff; color: var(--ink-soft); }
.mcq-letters .mcq-pick span { text-align: center; font-weight: 600; padding: .65rem .2rem; }
.mcq-pick input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.mcq-pick input:focus-visible + span { outline: 3px solid rgba(12,107,120,.45); outline-offset: 2px; }

/* ===== Tes IQ: laporan ===== */
.iq-summary { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.iq-big { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 7.5rem; padding: .8rem 1.2rem; border: 2px solid var(--brand); border-radius: 12px; }
.iq-big strong { font-size: 2.4rem; line-height: 1.1; color: var(--brand); }
.iq-bar { width: 100%; height: auto; max-width: 640px; display: block; }
.iq-bar-wrap { margin: .5rem 0 1rem; }
.score-table tr.is-current td { font-weight: 700; background: #eef5f9; }

/* ===== Pendaftaran lengkap & detail peserta ===== */
[hidden] { display: none !important; }
.auth-card-xwide { max-width: 680px; }
.form-section {
    margin: 1.5rem 0 .9rem; padding-bottom: .4rem; border-bottom: 2px solid var(--line);
    font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--brand);
}
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.field textarea {
    width: 100%; padding: .65rem .8rem; font: inherit; color: var(--ink); background: #fff;
    border: 1px solid #b9c5d2; border-radius: 8px; resize: vertical; min-height: 4.5rem;
}
.field textarea:focus, .field select:focus { outline: 3px solid rgba(12, 107, 120, .3); border-color: var(--brand); }
.note {
    margin: 0 0 1rem; padding: .6rem .8rem; background: #eef6f8; border-left: 4px solid var(--brand);
    border-radius: 8px; font-size: .85rem; color: var(--ink-soft);
}
.detail-list { display: grid; grid-template-columns: 200px 1fr; gap: .55rem 1rem; margin: 0; }
.detail-list dt { font-weight: 500; color: var(--ink-soft); }
.detail-list dd { margin: 0; word-break: break-word; white-space: pre-line; }
@media (max-width: 560px) {
    .field-row { grid-template-columns: 1fr; }
    .detail-list { grid-template-columns: 1fr; gap: .1rem; }
    .detail-list dd { margin-bottom: .6rem; }
}
