:root {
  --bg: #f4f6f8; --card: #fff; --ink: #1d2733; --muted: #5d6b7a; --line: #d9e0e7; --brand: #0f5d73; --brand-ink: #fff;
  --ok: #1d7a46; --ok-bg: #e3f4ea; --warn: #8a5a00; --warn-bg: #fff3d6; --bad: #a3262a; --bad-bg: #fde6e6; --focus: #1a73e8;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
nav.side { background: #0b3f4f; color: #e6f1f4; padding: 16px 12px; }
nav.side .brand { font-weight: 700; margin-bottom: 4px; }
nav.side .who { font-size: 12px; opacity: .8; margin-bottom: 16px; }
nav.side a { display: block; color: #e6f1f4; text-decoration: none; padding: 7px 10px; border-radius: 6px; }
nav.side a.on, nav.side a:hover { background: rgba(255,255,255,.12); }
main { padding: 22px 28px; max-width: 1200px; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 17px; margin: 0 0 10px; } h3 { font-size: 15px; margin: 14px 0 6px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
table { border-collapse: collapse; width: 100%; } th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; margin-bottom: 10px; }
label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #b9c4cf; border-radius: 6px; background: #fff; color: var(--ink); }
textarea { min-height: 90px; resize: vertical; }
button, .btn { font: inherit; background: var(--brand); color: var(--brand-ink); border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary { background: #e6edf2; color: var(--ink); } button.danger { background: var(--bad); } button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #e6edf2; }
.chip.green { background: var(--ok-bg); color: var(--ok); } .chip.amber { background: var(--warn-bg); color: var(--warn); } .chip.red { background: var(--bad-bg); color: var(--bad); }
.muted { color: var(--muted); } .small { font-size: 13px; } .mt { margin-top: 12px; } .err { color: var(--bad); margin: 6px 0; }
.problems li { color: var(--bad); }
.toast { position: fixed; bottom: 18px; right: 18px; background: #12313c; color: #fff; padding: 10px 14px; border-radius: 8px; }
.code { font: 600 20px/1 ui-monospace, Consolas, monospace; letter-spacing: .12em; }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 6px 12px; }
.login { max-width: 380px; margin: 10vh auto; }
.banner { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 6px; margin-bottom: 14px; }
details > summary { cursor: pointer; color: var(--brand); margin: 6px 0; }

/* exam player */
.exam { max-width: 900px; margin: 0 auto; padding: 16px 18px 80px; }
.examhead { position: sticky; top: 0; background: var(--bg); padding: 10px 0; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); z-index: 2; }
.timer { font: 700 22px/1 ui-monospace, Consolas, monospace; } .timer.low { color: var(--bad); }
.q { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 14px 0; }
.q .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.q .stem { font-weight: 600; margin-bottom: 10px; white-space: pre-wrap; }
.opt { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; padding: 6px 4px; font-size: 15px; color: var(--ink); cursor: pointer; }
.opt input { margin-top: 3px; }
.q textarea { width: 100%; }
.order li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.saved { font-size: 12px; color: var(--ok); } .saving { font-size: 12px; color: var(--muted); }
.cover td:first-child { color: var(--muted); width: 220px; }
.editorwrap { position: fixed; inset: 0; background: #fff; z-index: 10; display: flex; flex-direction: column; }
.editorbar { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.editorbar #edMsg { flex: 1; color: var(--muted); }
.editorhost { flex: 1; min-height: 0; }
.checks li.pass::marker { content: '✔  '; color: var(--ok); } .checks li.fail::marker { content: '✘  '; color: var(--bad); }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr; } nav.side { position: static; } main { padding: 14px 16px; } .kv { grid-template-columns: 1fr; } }
.screenpause { position: fixed; inset: 0; background: rgba(15, 23, 42, .92); color: #fff; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px; }
.screenpause .card { max-width: 520px; color: var(--ink); }
.screenvideo { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* B1/B2 simulations (public/sim.js) */
.simwrap { position: fixed; inset: 0; background: var(--bg); z-index: 10; display: flex; flex-direction: column; }
.simdesk { flex: 1; min-height: 0; display: grid; grid-template-columns: 280px 1fr; }
.simtask { background: var(--card); border-right: 1px solid var(--line); padding: 12px 16px; overflow: auto; }
.simtask ol { padding-left: 20px; } .simtask li { margin-bottom: 8px; }
.simscreen { position: relative; display: flex; flex-direction: column; min-height: 0; background: #dfe7ee; padding: 12px; }
.simwin { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.simtitle { padding: 6px 12px; background: #0b3f4f; color: #fff; font-weight: 600; }
.simcontent { flex: 1; min-height: 0; overflow: auto; padding: 12px; }
.simtaskbar { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.simtaskbar button { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.simtaskbar button.on { background: var(--brand); color: var(--brand-ink); }
.simcount { margin-left: auto; color: var(--muted); }
.simsplit { display: grid; grid-template-columns: 220px 1fr; gap: 12px; min-height: 100%; }
.simnav { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 8px; }
.simtree { text-align: left; background: none; color: var(--ink); border: 0; padding: 4px 6px; border-radius: 4px; font-weight: 400; }
.simtree.on { background: var(--ok-bg); font-weight: 600; }
.simtree[data-depth="1"] { padding-left: 20px; } .simtree[data-depth="2"] { padding-left: 34px; } .simtree[data-depth="3"] { padding-left: 48px; }
.simtree[data-depth="4"] { padding-left: 62px; } .simtree[data-depth="5"] { padding-left: 76px; }
.simbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.simtable td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.linkish { background: none; border: 0; color: var(--brand); padding: 0; text-decoration: underline; font-weight: 400; text-align: left; }
.simmail { display: grid; grid-template-columns: 260px 1fr; gap: 12px; min-height: 100%; }
.simlist { list-style: none; margin: 0; padding: 0; border-right: 1px solid var(--line); }
.simlist li { border-bottom: 1px solid var(--line); padding: 4px 0; }
.simmsg { display: flex; flex-direction: column; align-items: flex-start; width: 100%; background: none; color: var(--ink); border: 0; padding: 6px; font-weight: 400; text-align: left; gap: 2px; }
.simmsg.unread b { color: var(--brand); } .simmsg.unread span:first-of-type { font-weight: 600; } .simmsg.on { background: var(--ok-bg); }
.simbody { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 6px; margin: 8px 0; }
.simcompose > label { display: block; margin-bottom: 6px; } .simcompose > label input, .simcompose textarea { width: 100%; }
.simcompose fieldset label.check { display: flex; gap: 6px; align-items: center; margin: 2px 0; }
.simcompose fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 6px 0; }
.simbrowser { display: flex; flex-direction: column; gap: 8px; min-height: 100%; }
.simaddress { display: flex; gap: 6px; align-items: center; } .simaddress input { flex: 1; }
.simaddress .secure { color: var(--ok); } .simaddress .insecure { color: var(--bad); font-weight: 600; white-space: nowrap; }
.simpage { position: relative; flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.simsearch { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; } .simsearch h2 { width: 100%; } .simsearch input { flex: 1; min-width: 200px; }
.simresult { margin-bottom: 12px; } .simurl { color: var(--ok); }
.simpopup { position: absolute; top: 40px; right: 30px; max-width: 280px; background: #fff7c2; border: 2px solid #d4a500; border-radius: 8px; padding: 12px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.simx { position: absolute; top: 4px; right: 4px; background: none; color: var(--ink); border: 0; padding: 2px 6px; }
.simsec .simwarn { color: var(--bad); font-weight: 600; } .simsec .simok, .simok { color: var(--ok); }
.simwarn { color: var(--bad); }
#simAsk:empty { display: none; }
.simask { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
@media (max-width: 900px) { .simdesk { grid-template-columns: 1fr; } .simtask { max-height: 30vh; } .simsplit, .simmail { grid-template-columns: 1fr; } }
/* Pre-assessment forms and the learner page (public/learner.js, exam waiting room) */
.paform { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 8px 0; background: var(--card); }
.paform summary { cursor: pointer; }
.paform form label { display: block; margin-top: 8px; } .paform form input:not([type=checkbox]), .paform form textarea { width: 100%; }
.paform form label.check { display: flex; gap: 6px; align-items: center; }
.big { font-size: 1.2em; }
.nowrap { white-space: nowrap; }
