:root {
  --navy: #142033;
  --deep: #0d1624;
  --slate: #334155;
  --bg: #f5f7fa;
  --white: #ffffff;
  --border: #d8dee8;
  --muted: #667085;
  --success: #3e7c59;
  --warning: #b7791f;
  --danger: #b42318;
  --shadow: 0 12px 35px rgba(13, 22, 36, 0.09);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: #172033; background: var(--bg); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a.button { transition: opacity .16s ease, transform .16s ease, background .16s ease; }
button:hover, a.button:hover { opacity: .94; }
button:active, a.button:active { transform: translateY(1px); }
.topbar { height: 76px; padding: 0 max(24px, calc((100vw - 1320px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--deep); color: white; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 48px; height: 48px; object-fit: contain; }
.brand span { display: grid; gap: 2px; }
.brand strong { letter-spacing: .04em; }
.brand small { color: #aab6c7; font-size: 12px; }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topnav a { color: #c7d0dc; }
.topnav a.active, .topnav a:hover { color: white; }
.user-chip { padding: 8px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; color: #e7edf5; }
.link-button { border: 0; background: none; color: #c7d0dc; cursor: pointer; }
.page-shell { width: min(1320px, calc(100% - 40px)); margin: 36px auto 60px; }
.footer { min-height: 62px; padding: 18px max(24px, calc((100vw - 1320px) / 2)); background: #eef1f5; border-top: 1px solid var(--border); display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.035em; margin-bottom: 12px; }
h2 { font-size: 24px; letter-spacing: -.02em; }
h3 { font-size: 18px; }
p { line-height: 1.65; }
.muted, .fine-print { color: var(--muted); }
.fine-print { font-size: 13px; }
.lede { color: #536174; font-size: 17px; max-width: 700px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 14px; }
.button-primary { background: var(--accent); color: white; }
.button-secondary { background: white; color: var(--navy); border-color: var(--border); }
.button-danger { background: var(--danger); color: white; }
.button-small { min-height: 34px; padding: 0 10px; font-size: 12px; }
.button-large { min-height: 50px; padding: 0 22px; }
.button:disabled { opacity: .4; cursor: not-allowed; }
.panel { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 24px; box-shadow: 0 3px 14px rgba(13,22,36,.03); }
.panel-strong { border-top: 3px solid var(--accent); }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading p { color: var(--muted); max-width: 780px; margin-bottom: 0; }
.panel-heading, .section-heading, .live-card-top, .result-main, .metric-line { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); gap: 24px; }
.key-form { margin-top: 24px; }
.key-form label, .form-grid label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; color: #374151; }
.input-action { display: flex; gap: 10px; margin-top: 8px; }
input, textarea, select { width: 100%; border: 1px solid #cfd6df; border-radius: 7px; background: white; color: #172033; padding: 11px 12px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 84%); }
textarea { min-height: 110px; resize: vertical; }
.secure-badge, .status-pill { display: inline-flex; align-items: center; border-radius: 999px; font-size: 10px; font-weight: 900; letter-spacing: .08em; white-space: nowrap; }
.secure-badge { padding: 7px 10px; background: #e9eff7; color: #31557f; }
.status-pill { padding: 6px 9px; background: #edf0f4; color: #526172; }
.status-pill.success { background: #e7f2eb; color: #2e6949; }
.status-pill.warning { background: #fff3db; color: #8f6014; }
.status-pill.danger { background: #fcebea; color: #9d2118; }
.status-pill.neutral { background: #edf0f4; color: #526172; }
.notice { margin-top: 18px; padding: 14px 16px; border-radius: 7px; }
.danger-soft { background: #fff0ef; border: 1px solid #f1c4c0; color: #882119; }
.result-summary { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.clean-list { padding-left: 20px; color: #526172; }
.clean-list li { margin: 11px 0; line-height: 1.5; }
.section-block { margin-top: 34px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.module-card { background: white; border: 1px solid var(--border); border-radius: 9px; padding: 20px; display: grid; gap: 8px; }
.module-card:hover { border-color: var(--accent); }
.module-index { color: var(--muted); font-size: 12px; }
.document-page { max-width: 900px; margin: 0 auto; background: white; border: 1px solid var(--border); border-radius: 10px; padding: 40px; }
.document-body, .prewrap { white-space: pre-wrap; line-height: 1.75; }
.center-card { max-width: 620px; margin: 80px auto; text-align: center; background: white; border: 1px solid var(--border); border-radius: 12px; padding: 42px; box-shadow: var(--shadow); }
.center-card.wide { max-width: 760px; }
.submission-mark { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: #e7f2eb; color: var(--success); font-size: 28px; font-weight: 900; }
.login-wrap { min-height: calc(100vh - 230px); display: grid; place-items: center; }
.login-card { width: min(620px, 100%); text-align: center; background: white; border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 12px; padding: 42px; box-shadow: var(--shadow); }
.login-logo { width: 126px; height: 126px; object-fit: contain; margin-bottom: 20px; }
.flash { width: min(1320px, calc(100% - 40px)); margin: 16px auto -18px; padding: 12px 16px; border-radius: 7px; font-size: 14px; }
.flash-success { background: #e7f2eb; color: #2e6949; border: 1px solid #c7dfd0; }
.flash-error { background: #fff0ef; color: #8f221a; border: 1px solid #f1c4c0; }
.flash-warning { background: #fff4de; color: #875b16; border: 1px solid #efd9ad; }
.system-control { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 24px; padding: 24px; border: 1px solid #b9d4c4; border-left: 5px solid var(--success); border-radius: 10px; background: #f8fcf9; }
.system-control.halted { border-color: #efc2bf; border-left-color: var(--danger); background: #fff8f7; }
.halt-form { display: flex; gap: 10px; min-width: 430px; }
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 20px 0 24px; }
.stats-grid.compact { grid-template-columns: repeat(4, 1fr); }
.stat-card { background: white; border: 1px solid var(--border); border-radius: 9px; padding: 18px; display: grid; gap: 9px; }
.stat-card span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat-card strong { font-size: 28px; }
.stat-card strong.small { font-size: 15px; }
.admin-layout { display: grid; grid-template-columns: 235px minmax(0,1fr); gap: 22px; }
.admin-nav { padding: 12px; height: fit-content; display: grid; gap: 4px; }
.admin-nav a { padding: 11px 12px; border-radius: 6px; font-size: 13px; color: #475569; }
.admin-nav a:hover { background: #f3f6f9; color: var(--navy); }
.admin-content { min-width: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
td { padding: 13px 12px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.empty { padding: 34px; color: var(--muted); text-align: center; }
.text-link { color: var(--accent); font-weight: 700; }
.live-grid, .results-list, .stack, .settings-stack { display: grid; gap: 16px; }
.live-card { background: white; border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: 9px; padding: 20px; }
.live-card.flagged { border-left-color: var(--danger); background: #fffafa; }
.live-meta { display: flex; gap: 28px; margin-top: 18px; color: var(--muted); font-size: 13px; }
.live-meta strong { color: #263142; }
.result-card { background: white; border: 1px solid var(--border); border-radius: 10px; padding: 22px; }
.score-block { min-width: 150px; text-align: right; display: grid; justify-items: end; gap: 6px; }
.score-block > span:first-child { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.score-block strong { font-size: 28px; }
.trainer-note { margin: 16px 0; padding: 14px 16px; background: #f7f8fa; border: 1px solid #e6e9ee; border-radius: 7px; }
.trainer-note p { margin: 6px 0 0; color: var(--muted); }
.result-actions { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; }
.release-form { flex: 1; display: flex; gap: 10px; align-items: flex-end; justify-content: flex-end; }
.release-form textarea { max-width: 620px; min-height: 72px; }
.form-panel { margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.checkbox-row { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 8px !important; }
.checkbox-row input { width: auto; }
.inline-form { display: flex; gap: 7px; align-items: center; }
.inline-form select { min-width: 110px; padding: 7px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 20px 0; }
.timeline { display: grid; gap: 10px; }
.timeline-item { display: flex; justify-content: space-between; gap: 20px; padding: 12px; background: #f7f8fa; border-radius: 6px; font-size: 12px; }
.toggle-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.toggle-card { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 7px; font-size: 13px; }
.toggle-card input { width: auto; }
.sticky-save { position: sticky; bottom: 18px; display: flex; justify-content: flex-end; padding: 14px; background: rgba(245,247,250,.92); backdrop-filter: blur(8px); border-radius: 10px; }
.metric-line { padding-top: 14px; border-top: 1px solid var(--border); }

.exam-page { background: var(--deep); color: #172033; overflow: hidden; }
.exam-header { height: 82px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--deep); color: white; border-bottom: 1px solid rgba(255,255,255,.08); }
.exam-brand { display: flex; align-items: center; gap: 12px; }
.exam-brand img { width: 48px; height: 48px; object-fit: contain; }
.exam-brand span { display: grid; gap: 3px; }
.exam-brand small { color: #a9b5c5; }
.exam-identity { display: flex; align-items: center; gap: 18px; color: #d4dce6; font-size: 13px; }
.exam-identity > strong { font-size: 20px; color: white; font-variant-numeric: tabular-nums; }
.exam-stage { min-height: calc(100vh - 82px); display: grid; place-items: center; padding: 40px 20px; background: linear-gradient(180deg, #101b2b, #0d1624); }
.question-sheet { position: relative; z-index: 2; width: min(920px, 100%); background: white; border: 1px solid #cfd6df; border-top: 4px solid var(--accent); border-radius: 8px; padding: 38px 42px; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.question-number { color: var(--accent); font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: .1em; }
.question-sheet h1 { font-size: 26px; line-height: 1.45; letter-spacing: -.015em; margin-bottom: 28px; }
.answers { display: grid; gap: 11px; }
.answer-option { display: grid; grid-template-columns: auto auto 1fr; gap: 13px; align-items: center; min-height: 58px; padding: 12px 16px; border: 1px solid #d9dee6; border-radius: 7px; cursor: pointer; background: #fff; }
.answer-option:hover { border-color: #9eb5cf; background: #fafbfd; }
.answer-option:has(input:checked) { border-color: var(--accent); background: #f3f7fb; box-shadow: inset 3px 0 0 var(--accent); }
.answer-option input { width: auto; accent-color: var(--accent); }
.answer-letter { width: 30px; height: 30px; border-radius: 5px; display: grid; place-items: center; background: #edf1f5; color: #46576b; font-weight: 800; font-size: 12px; }
.exam-actions { margin-top: 30px; padding-top: 22px; border-top: 1px solid #e5e8ed; display: flex; justify-content: space-between; }
.exam-actions-right { margin-left: auto; }
.lock-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(7,12,20,.92); }
.lock-overlay.hidden { display: none; }
.lock-card { width: min(570px, 100%); padding: 38px; text-align: center; background: white; border-radius: 10px; border-top: 4px solid var(--accent); box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.lock-card img { width: 100px; height: 100px; object-fit: contain; margin-bottom: 14px; }
.watermark { pointer-events: none; user-select: none; position: fixed; inset: -20%; z-index: 3; color: rgba(21,32,51,.055); font-size: 13px; font-weight: 800; letter-spacing: .08em; line-height: 90px; transform: rotate(-24deg); overflow: hidden; word-spacing: 28px; }

@media (max-width: 900px) {
  .topbar { height: auto; min-height: 76px; padding: 14px 20px; align-items: flex-start; }
  .topnav { flex-wrap: wrap; justify-content: flex-end; }
  .dashboard-grid, .admin-layout, .two-column { grid-template-columns: 1fr; }
  .stats-grid, .stats-grid.compact { grid-template-columns: repeat(2,1fr); }
  .form-grid, .toggle-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .system-control, .result-actions { align-items: stretch; flex-direction: column; }
  .halt-form, .release-form { min-width: 0; flex-direction: column; align-items: stretch; }
  .exam-header { height: auto; padding: 14px 18px; }
  .exam-identity > span:first-child { display: none; }
  .question-sheet { padding: 26px 20px; }
}
.review-dialog { border: 0; padding: 0; border-radius: 12px; width: min(620px, calc(100% - 32px)); box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.review-dialog::backdrop { background: rgba(7,12,20,.72); }
.dialog-card { padding: 30px; display: grid; gap: 18px; }
.dialog-card label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; }
.dialog-score { display: flex; justify-content: space-between; padding: 14px 16px; background: #f7f8fa; border-radius: 7px; }
.dialog-score strong { font-size: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
