/* ==========================================================
   Tes Online — gaya native ala Apple (iOS/macOS HIG)
   Tema: light | medium | dark  via [data-theme]
   ========================================================== */

:root,
[data-theme="light"] {
  --bg: #f2f2f7;
  --bg-elevated: #ffffff;
  --card: rgba(255, 255, 255, 0.78);
  --card-solid: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --text: #000000;
  --text-2: rgba(60, 60, 67, 0.62);
  --text-3: rgba(60, 60, 67, 0.32);
  --separator: rgba(60, 60, 67, 0.18);
  --accent: #007aff;
  --accent-text: #ffffff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --green: #34c759;
  --red: #ff3b30;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --bar: rgba(249, 249, 249, 0.78);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --seg-active: #ffffff;
  --hero-a: #e8f1ff;
  --hero-b: #f6ecff;
  color-scheme: light;
}

[data-theme="medium"] {
  --bg: #3a3a3f;
  --bg-elevated: #48484e;
  --card: rgba(80, 80, 86, 0.72);
  --card-solid: #4c4c52;
  --fill: rgba(235, 235, 245, 0.1);
  --fill-strong: rgba(235, 235, 245, 0.18);
  --text: #f5f5f7;
  --text-2: rgba(235, 235, 245, 0.68);
  --text-3: rgba(235, 235, 245, 0.36);
  --separator: rgba(235, 235, 245, 0.16);
  --accent: #3d9bff;
  --accent-text: #ffffff;
  --accent-soft: rgba(61, 155, 255, 0.2);
  --green: #3ad45f;
  --red: #ff5a50;
  --orange: #ffa31a;
  --yellow: #ffd426;
  --bar: rgba(58, 58, 63, 0.78);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.18), 0 8px 24px rgba(0, 0, 0, 0.18);
  --seg-active: #6a6a71;
  --hero-a: #44485a;
  --hero-b: #4d4459;
  color-scheme: dark;
}

[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --card: rgba(28, 28, 30, 0.78);
  --card-solid: #1c1c1e;
  --fill: rgba(120, 120, 128, 0.24);
  --fill-strong: rgba(120, 120, 128, 0.36);
  --text: #ffffff;
  --text-2: rgba(235, 235, 245, 0.6);
  --text-3: rgba(235, 235, 245, 0.3);
  --separator: rgba(84, 84, 88, 0.6);
  --accent: #0a84ff;
  --accent-text: #ffffff;
  --accent-soft: rgba(10, 132, 255, 0.22);
  --green: #30d158;
  --red: #ff453a;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --bar: rgba(22, 22, 24, 0.78);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --seg-active: #636366;
  --hero-a: #0b1a33;
  --hero-b: #1e1029;
  color-scheme: dark;
}

/* Fallback bila JS mati: ikut preferensi sistem */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #000; --bg-elevated: #1c1c1e; --card: rgba(28,28,30,.78); --card-solid: #1c1c1e;
    --fill: rgba(120,120,128,.24); --fill-strong: rgba(120,120,128,.36);
    --text: #fff; --text-2: rgba(235,235,245,.6); --text-3: rgba(235,235,245,.3);
    --separator: rgba(84,84,88,.6); --accent: #0a84ff; --accent-soft: rgba(10,132,255,.22);
    --bar: rgba(22,22,24,.78); --seg-active: #636366; --hero-a: #0b1a33; --hero-b: #1e1029;
    color-scheme: dark;
  }
}

/* ---------- Dasar ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable", "Segoe UI",
    system-ui, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Noto Sans Arabic", "Noto Sans JP", "Noto Sans SC",
    "Hiragino Sans", "PingFang SC", "Microsoft YaHei", "Yu Gothic", sans-serif;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .25s ease, color .25s ease;
}
body.has-tabbar { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .4em; }
h1 { font-size: 34px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0 0 .8em; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; background: var(--fill); padding: .1em .35em; border-radius: 6px; }
.ico { width: 22px; height: 22px; flex: none; }
.inline { display: inline; margin: 0; }
.muted { color: var(--text-2); }
.footnote { font-size: 13px; color: var(--text-2); }
.caption { font-size: 12px; color: var(--text-2); }
.center { text-align: center; }
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.hidden { display: none !important; }
[dir="rtl"], .rtl { direction: rtl; unicode-bidi: isolate; }

.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 20px 16px 32px; }
.container.narrow { max-width: 560px; }
.container.wide { max-width: 1180px; }

/* ---------- Navbar (blur/vibrancy) ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--separator);
  padding-top: env(safe-area-inset-top);
}
.navbar-inner { max-width: 1180px; margin: 0 auto; height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #0a84ff, #5e5ce6); color: #fff; display: grid; place-items: center; }
.brand-mark .ico { width: 18px; height: 18px; stroke-width: 3; }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a:not(.btn) { color: var(--text-2); padding: 6px 12px; border-radius: 999px; font-size: 15px; }
.nav-links a:not(.btn):hover { color: var(--text); background: var(--fill); text-decoration: none; }
.nav-links a.active { color: var(--accent); font-weight: 600; }
body.has-tabbar .nav-links a:not(.btn) { display: none; }
@media (min-width: 768px) { body.has-tabbar .nav-links a:not(.btn) { display: inline-block; } }

/* ---------- Tab bar bawah (mobile) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--separator);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 500; color: var(--text-2); padding: 4px 0; min-width: 0; }
.tabbar a:hover { text-decoration: none; }
.tabbar a.active { color: var(--accent); }
.tabbar .ico { width: 25px; height: 25px; }
@media (min-width: 768px) { .tabbar { display: none; } body.has-tabbar { padding-bottom: 0; } }

/* ---------- Admin subnav ---------- */
.admin-subnav { max-width: 1180px; margin: 0 auto; padding: 12px 16px 0; }

/* ---------- Kartu & grouped list ---------- */
.card {
  background: var(--card);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
  border: .5px solid var(--separator);
}
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.section-header { font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: var(--text-2); margin: 24px 16px 6px; font-weight: 500; }
.section-footer { font-size: 13px; color: var(--text-2); margin: 6px 16px 0; }

.group {
  background: var(--card-solid);
  border-radius: 12px;
  overflow: hidden;
  list-style: none;
  margin: 0; padding: 0;
  border: .5px solid var(--separator);
}
.group > li, .group > .row, .group > a.row { position: relative; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px;
  padding: 10px 16px;
  color: var(--text);
  background: transparent;
}
.group > * + * .row, .group > .row + .row, .group > li + li > .row { box-shadow: inset 0 .5px 0 var(--separator); }
.group > li + li > .row, .group > .row + .row { margin-left: 0; }
a.row:hover, button.row:hover { background: var(--fill); text-decoration: none; }
.row .row-main { flex: 1; min-width: 0; }
.row .row-title { font-size: 17px; overflow-wrap: anywhere; }
.row .row-sub { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.row .row-value { color: var(--text-2); font-size: 15px; text-align: right; flex: none; max-width: 55%; overflow-wrap: anywhere; }
.row .chev { color: var(--text-3); width: 16px; height: 16px; flex: none; }
.row.inset-icon { padding-left: 12px; }

/* Ikon aplikasi berwarna (gaya Settings) */
.app-icon { width: 30px; height: 30px; border-radius: 7px; display: inline-grid; place-items: center; color: #fff; flex: none; }
.app-icon .ico { width: 19px; height: 19px; }
.app-icon .glyph { font-size: 17px; font-weight: 700; line-height: 1; }
.app-icon.lg { width: 56px; height: 56px; border-radius: 13px; }
.app-icon.lg .ico { width: 32px; height: 32px; }
.app-icon.lg .glyph { font-size: 30px; }

/* ---------- Tombol pill ---------- */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px;
  padding: 12px 22px;
  font: inherit; font-size: 17px; font-weight: 600;
  cursor: pointer; text-decoration: none !important;
  transition: transform .08s ease, opacity .15s ease, background-color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); opacity: .85; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }
.btn-gray { background: var(--fill); color: var(--text); }
.btn-danger { background: rgba(255, 59, 48, .14); color: var(--red); }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-plain { background: transparent; color: var(--accent); padding-left: 10px; padding-right: 10px; }
.btn-sm { padding: 6px 14px; font-size: 15px; }
.btn-xs { padding: 4px 10px; font-size: 13px; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Segmented control ---------- */
.segmented {
  display: inline-flex; position: relative;
  background: var(--fill);
  border-radius: 9px; padding: 2px; gap: 2px;
  max-width: 100%;
}
.segmented .seg {
  -webkit-appearance: none; appearance: none;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: 7px; cursor: pointer;
  white-space: nowrap; text-align: center; flex: 1;
}
.segmented .seg:hover { text-decoration: none; }
.segmented .seg.active, .segmented .seg[aria-checked="true"] {
  background: var(--seg-active);
  box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04);
  font-weight: 600;
}
.segmented-scroll { display: flex; overflow-x: auto; scrollbar-width: none; }
.segmented-scroll::-webkit-scrollbar { display: none; }
.segmented.full { display: flex; width: 100%; }

/* ---------- Form ---------- */
.form-group { background: var(--card-solid); border-radius: 12px; overflow: hidden; border: .5px solid var(--separator); }
.field { display: block; padding: 10px 16px; position: relative; }
.field + .field { box-shadow: inset 0 .5px 0 var(--separator); }
.field > label, .field > .label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 2px; }
.field input, .field select, .field textarea {
  width: 100%; border: 0; outline: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 17px; padding: 4px 0;
}
.field textarea { resize: vertical; min-height: 70px; }
.field select { -webkit-appearance: none; appearance: none; cursor: pointer; }
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); }
.field.has-error { background: rgba(255, 59, 48, .07); }
.field-error { color: var(--red); font-size: 13px; margin: 4px 0 0; }
.field-row { display: grid; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } .field-row .field + .field { box-shadow: inset .5px 0 0 var(--separator); } }
.field-row + .field, .field + .field-row { box-shadow: inset 0 .5px 0 var(--separator); }
.field-row .field + .field { box-shadow: inset 0 .5px 0 var(--separator); }
@media (min-width: 560px) { .field-row .field + .field { box-shadow: inset .5px 0 0 var(--separator); } }
.field input[type="date"] { min-height: 30px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

.input-plain {
  width: 100%; border: .5px solid var(--separator); background: var(--card-solid); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 16px; outline: 0;
}
.input-plain:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input-plain { resize: vertical; min-height: 90px; }

/* Switch iOS */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--fill-strong); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 3px 8px rgba(0,0,0,.15); transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Alert ---------- */
.alert { border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; font-size: 15px; border: .5px solid var(--separator); background: var(--card-solid); }
.alert-success { color: var(--green); background: rgba(52, 199, 89, .12); }
.alert-error { color: var(--red); background: rgba(255, 59, 48, .12); }
.alert-info { color: var(--accent); background: var(--accent-soft); }
.alert-warning { color: var(--orange); background: rgba(255, 149, 0, .13); }

/* ---------- Landing / hero ---------- */
.hero {
  border-radius: 24px; padding: 40px 22px; text-align: center;
  background: radial-gradient(120% 120% at 0% 0%, var(--hero-a), transparent 60%), radial-gradient(120% 120% at 100% 100%, var(--hero-b), transparent 60%), var(--card-solid);
  border: .5px solid var(--separator);
}
.hero h1 { font-size: clamp(30px, 7vw, 52px); }
.hero p.lead { font-size: clamp(17px, 2.4vw, 21px); color: var(--text-2); max-width: 620px; margin: 0 auto 22px; }
.hero .btn-row { justify-content: center; }
.eyebrow { display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 14px; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid-3 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }

.tile {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border-radius: 16px; padding: 16px;
  border: .5px solid var(--separator); box-shadow: var(--shadow); color: var(--text);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  transition: transform .15s ease;
}
a.tile:hover { text-decoration: none; transform: translateY(-2px); }
.tile .tile-body { flex: 1; min-width: 0; }
.tile .tile-title { font-weight: 600; font-size: 17px; }
.tile .tile-desc { font-size: 14px; color: var(--text-2); margin: 2px 0 8px; }
.tile .meta { display: flex; flex-wrap: wrap; gap: 6px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.badge-blue { background: var(--accent-soft); color: var(--accent); }
.badge-green { background: rgba(52, 199, 89, .15); color: var(--green); }
.badge-red { background: rgba(255, 59, 48, .14); color: var(--red); }
.badge-orange { background: rgba(255, 149, 0, .15); color: var(--orange); }

.stat { padding: 16px; border-radius: 16px; background: var(--card-solid); border: .5px solid var(--separator); }
.stat .stat-num { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.stat .stat-label { font-size: 13px; color: var(--text-2); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.large-title { font-size: 34px; font-weight: 700; margin: 4px 0 4px; }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 480px; margin: 12px auto 0; }
.auth-head { text-align: center; margin: 12px 0 18px; }
.auth-head .app-icon { margin-bottom: 12px; }

/* ---------- Tes: pengerjaan ---------- */
.test-bar {
  position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 40;
  margin: -20px -16px 16px; padding: 10px 16px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--separator);
}
.test-bar-inner { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--fill); }
.timer.warn { color: var(--orange); background: rgba(255,149,0,.15); }
.timer.danger { color: var(--red); background: rgba(255,59,48,.15); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.progress { height: 4px; background: var(--fill); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s ease; }

.question-card .q-num { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.question-card .q-text { font-size: 20px; font-weight: 600; line-height: 1.4; margin: 6px 0 16px; overflow-wrap: anywhere; }
.options { list-style: none; margin: 0; padding: 0; border-radius: 12px; overflow: hidden; background: var(--card-solid); border: .5px solid var(--separator); }
.options li + li { box-shadow: inset 0 .5px 0 var(--separator); }
.option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; min-height: 52px; }
.option:hover { background: var(--fill); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .opt-letter { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); font-size: 14px; font-weight: 600; flex: none; color: var(--text-2); }
.option .opt-text { flex: 1; font-size: 17px; overflow-wrap: anywhere; }
.option .opt-check { width: 22px; height: 22px; color: var(--accent); opacity: 0; transition: opacity .15s; flex: none; }
.option input:checked ~ .opt-letter { background: var(--accent); color: #fff; }
.option input:checked ~ .opt-check { opacity: 1; }
.option input:checked ~ .opt-text { font-weight: 600; }
.option input:focus-visible ~ .opt-letter { box-shadow: 0 0 0 3px var(--accent-soft); }
.lang-text { font-size: 1.15em; }
.q-text .lang-text, .opt-text .lang-text { font-family: inherit; }

.q-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.q-nav .btn { flex: 1; max-width: 220px; }

.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; }
.q-grid button { aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--fill); color: var(--text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.q-grid button.answered { background: var(--accent-soft); color: var(--accent); }
.q-grid button.current { outline: 2px solid var(--accent); outline-offset: 1px; }

.js .question-card { display: none; }
.js .question-card.current { display: block; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Sheet / dialog */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; display: none; align-items: flex-end; justify-content: center; }
.sheet-backdrop.open { display: flex; }
.sheet { width: 100%; max-width: 520px; background: var(--bg-elevated); border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 85vh; overflow: auto; animation: up .25s ease; }
@media (min-width: 600px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 16px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: -6px auto 12px; }

/* ---------- Hasil ---------- */
.score-ring { --p: 0; width: 160px; height: 160px; border-radius: 50%; margin: 6px auto 12px; display: grid; place-items: center;
  background: conic-gradient(var(--ring, var(--accent)) calc(var(--p) * 1%), var(--fill) 0); }
.score-ring > div { width: 132px; height: 132px; border-radius: 50%; background: var(--card-solid); display: grid; place-items: center; text-align: center; }
.score-ring .big { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.score-ring .small { font-size: 12px; color: var(--text-2); }
.bar { height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.dim { padding: 14px 16px; }
.dim + .dim { box-shadow: inset 0 .5px 0 var(--separator); }
.dim-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 6px; }
.dim-name { font-weight: 600; }
.dim-pct { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 15px; }
.dim p { font-size: 15px; color: var(--text-2); margin: 8px 0 0; }
.review-item { padding: 14px 16px; }
.review-item + .review-item { box-shadow: inset 0 .5px 0 var(--separator); }
.review-item .ri-q { font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }
.review-item .ri-a { font-size: 15px; display: flex; gap: 6px; align-items: flex-start; overflow-wrap: anywhere; }
.review-item .ri-a .ico { width: 18px; height: 18px; margin-top: 2px; }
.ok { color: var(--green); }
.bad { color: var(--red); }
.disclaimer { font-size: 14px; border-radius: 12px; padding: 12px 14px; background: rgba(255,149,0,.12); color: var(--text); border: .5px solid rgba(255,149,0,.35); display: flex; gap: 10px; }
.disclaimer .ico { color: var(--orange); }

/* ---------- Tabel (admin) ---------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: 12px; border: .5px solid var(--separator); background: var(--card-solid); }
table.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: .5px solid var(--separator); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); font-weight: 600; background: var(--fill); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { white-space: nowrap; text-align: right; }
.table .clip { max-width: 420px; overflow-wrap: anywhere; }

/* Kartu daftar untuk mobile sebagai pengganti tabel */
@media (max-width: 640px) {
  table.table.stack thead { display: none; }
  table.table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 10px 14px; border-bottom: .5px solid var(--separator); }
  .table.stack tr:last-child { border-bottom: 0; }
  .table.stack td { padding: 3px 0; border: 0; }
  .table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--text-2); font-size: 13px; }
  .table.stack td.actions { text-align: left; padding-top: 8px; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 12px 0; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.toolbar .input-plain, .toolbar select.input-plain { width: auto; flex: 1; min-width: 140px; }

.pagination { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 999px; background: var(--fill); color: var(--text); font-size: 14px; }
.pagination .current { background: var(--accent); color: #fff; }

.option-editor { display: grid; gap: 8px; }
.option-editor .opt-row { display: grid; grid-template-columns: auto 1fr 84px auto; gap: 8px; align-items: center; }
@media (max-width: 520px) { .option-editor .opt-row { grid-template-columns: auto 1fr 64px auto; } }
.opt-row .input-plain { padding: 8px 10px; }

.footer { text-align: center; padding: 24px 16px 32px; }
.theme-picker { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty .ico { width: 44px; height: 44px; color: var(--text-3); margin-bottom: 8px; }

@media (max-width: 480px) {
  h1, .large-title { font-size: 30px; }
  .card { padding: 16px; border-radius: 16px; }
  .question-card .q-text { font-size: 18px; }
  .btn { padding: 11px 18px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ==================== v2 ==================== */
/* Avatar */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; flex: none; background: var(--fill); color: #fff; font-weight: 700; letter-spacing: 0; vertical-align: middle; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-md { width: 52px; height: 52px; font-size: 19px; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }
.avatar-xl { width: 104px; height: 104px; font-size: 38px; box-shadow: var(--shadow); }
.nav-avatar { display: inline-flex; margin-left: 4px; padding: 0 !important; background: none !important; }
.nav-avatar:hover { opacity: .85; }
body.has-tabbar .nav-links .nav-avatar { display: inline-flex !important; }
@media (max-width: 767px) { body.has-tabbar .nav-logout { display: none; } }
.hello { display: flex; align-items: center; gap: 14px; }
.hello a:hover { text-decoration: none; }
.file-input { font-size: 14px; color: var(--text-2); max-width: 100%; }
.file-input::file-selector-button { border: 0; border-radius: 999px; padding: 6px 12px; margin-right: 8px; background: var(--accent-soft); color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

/* Baris grup yang memuat tombol */
.row-wrap { flex-wrap: wrap; }
.row-link { color: var(--text); min-width: 160px; }
.row-link:hover { text-decoration: none; }
.row-link:hover .row-title { color: var(--accent); }
.row-actions { flex-wrap: nowrap; gap: 6px; }
.row-value-inline { font-size: 14px; color: var(--text-2); font-weight: 500; }
.toggle-field { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; }
.page-head > a.footnote { align-self: center; }

/* Teks soal multi-baris (bacaan) */
.qline { display: block; }
.qline.qgap { height: .6em; }
.qline.qlabel { font-size: 13px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.q-text .qline[dir="rtl"], .q-text .qline:lang(ar) { font-size: 1.15em; line-height: 1.9; }
.question-card .q-text { font-weight: 500; }
.question-card .q-text .qline:last-child { font-weight: 600; }
.ri-q .qline { font-weight: 600; }
.review-wrap > summary { list-style: none; cursor: pointer; }
.review-wrap > summary::-webkit-details-marker { display: none; }
.review-wrap[open] > summary .chev { transform: rotate(90deg); }

/* Kartu kesimpulan di dasbor */
.summary-card { display: block; color: var(--text); }
.summary-card:hover { text-decoration: none; transform: translateY(-1px); }
.summary-card .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.summary-hero .avatar { margin: 0 auto; }

/* Kraepelin */
.kr-example { display: flex; justify-content: center; gap: 6px; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kr-example span, .kr-example em { width: 40px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--fill); font-style: normal; }
.kr-example .hl { background: var(--accent); color: #fff; }
.kr-example em { background: rgba(52,199,89,.18); color: var(--green); }
.kr-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; position: relative; }
.kr-head .right { text-align: right; }
.kr-colnum { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kr-flash { position: absolute; left: 50%; top: 0; transform: translateX(-50%); font-weight: 700; color: var(--orange); opacity: 0; pointer-events: none; }
.kr-flash.show { animation: krflash .9s ease; }
@keyframes krflash { 0% { opacity: 0; } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.kr-strip { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 14px auto 10px; min-height: 300px; justify-content: center; font-variant-numeric: tabular-nums; }
.kr-d { width: 72px; height: 42px; display: grid; place-items: center; font-size: 28px; font-weight: 600; color: var(--text-3); border-radius: 12px; }
.kr-d.hl { color: var(--text); background: var(--card-solid); border: 2px solid var(--accent); font-size: 36px; font-weight: 700; height: 52px; box-shadow: var(--shadow); }
.kr-a { height: 18px; font-size: 13px; font-weight: 700; color: var(--text-3); margin-left: 110px; line-height: 18px; }
.kr-a.done { color: var(--green); }
.kr-a.cur { color: var(--accent); font-size: 16px; animation: pulse 1s infinite; }
.kr-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 340px; margin: 0 auto 10px; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.kr-pad button { -webkit-appearance: none; appearance: none; border: 0; height: 64px; border-radius: 16px; background: var(--card-solid); color: var(--text); font: inherit; font-size: 28px; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; border: .5px solid var(--separator); }
.kr-pad button.press, .kr-pad button:active { background: var(--accent); color: #fff; transform: scale(.96); }
@media (max-height: 700px) { .kr-strip { min-height: 230px; } .kr-d { height: 34px; font-size: 22px; } .kr-d.hl { height: 44px; font-size: 30px; } .kr-pad button { height: 54px; } }
.kr-page .footer { display: none; }
.kr-chart { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding-top: 6px; }
.kr-chart span { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85; }

/* Cetak dari halaman aplikasi (fallback; laporan resmi ada di report.php) */
@media print {
  :root, [data-theme] { --bg: #fff; --card: #fff; --card-solid: #fff; --text: #000; --text-2: #444; --separator: #ccc; --fill: #eee; color-scheme: light; }
  body { background: #fff !important; padding: 0 !important; }
  .navbar, .tabbar, .footer, .admin-subnav, .no-print, .btn, .theme-picker { display: none !important; }
  .card, .tile, .group, .stat { box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* perbaikan v2: chevron global, statistik ringkas di HP, Kraepelin muat satu layar */
.chev { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 104px), 1fr)); }
@media (max-width: 480px) { .stat { padding: 12px; } .stat .stat-num { font-size: 22px; } .stat .stat-num[style] { font-size: 15px !important; padding: 4px 0 !important; } }
.kr-strip { min-height: 0; margin: 8px auto 6px; }
.kr-page main.container { padding-top: 12px; padding-bottom: 8px; }
@media (max-height: 900px) {
  .kr-d { height: 32px; font-size: 22px; }
  .kr-d.hl { height: 44px; font-size: 30px; }
  .kr-a { height: 14px; line-height: 14px; }
  .kr-pad { gap: 8px; }
  .kr-pad button { height: 52px; font-size: 24px; }
}

/* v3: catatan netral (tes agama) & grup kategori */
.note-box { display: flex; gap: 10px; font-size: 14px; border-radius: 12px; padding: 12px 14px; background: var(--accent-soft); color: var(--text); border: .5px solid var(--separator); }
.note-box .ico { color: var(--accent); }
.group-count { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-3); }
