:root {
  --ink: #1b2733; --muted: #5d6b7a; --line: #d9dfe6; --bg: #f4f6f8; --card: #fff;
  --brand: #14508c; --brand-dark: #0d3a68; --ok: #1f7a4d; --ok-bg: #e5f4ec;
  --warn: #b4541a; --warn-bg: #fdf0e3; --bad: #a3262b; --bad-bg: #fbe9ea; --info-bg: #e8f0f9;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.45rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }

.topbar { background: var(--brand-dark); color: #fff; }
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; padding-top: .6rem; padding-bottom: .6rem; }
.brand { font-weight: 700; color: #fff; text-decoration: none; margin-right: auto; }
.topbar nav { display: flex; flex-wrap: wrap; gap: .15rem; order: 3; width: 100%; }
.topbar nav a { color: #d5e2f0; text-decoration: none; padding: .3rem .65rem; border-radius: 6px; font-size: .92rem; }
.topbar nav a.on, .topbar nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.topbar .tools { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.topbar .tools a { color: #d5e2f0; }
.topbar .tools a.on { color: #fff; font-weight: 700; text-decoration: none; }
.linkbtn { background: none; border: 0; color: #d5e2f0; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
@media (min-width: 900px) { .topbar nav { order: 0; width: auto; margin-right: auto; } .brand { margin-right: 1rem; } }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 1.25rem; padding-bottom: 3rem; }
.head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem; margin-bottom: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.side { grid-template-columns: 2fr 1fr; } }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .85rem; }

.btn { display: inline-block; border: 1px solid var(--brand); background: var(--brand); color: #fff; border-radius: 8px;
  padding: .5rem .95rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.3; }
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.ghost:hover { background: var(--info-bg); }
.btn.danger { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: .25rem .6rem; font-size: .85rem; font-weight: 500; }
.btn.big { padding: .8rem 1.2rem; font-size: 1.05rem; width: 100%; text-align: center; }

label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid #b9c3ce; border-radius: 7px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.field { margin-bottom: .8rem; }
.fields { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .fields { grid-template-columns: 1fr 1fr; } .fields.three { grid-template-columns: repeat(3, 1fr); } }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 400; font-size: .95rem; margin: .2rem 0; }
.hint { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
details > summary { cursor: pointer; font-weight: 600; color: var(--brand); }
details[open] > summary { margin-bottom: .75rem; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: .45rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .55rem .6rem; border-bottom: 1px solid #edf0f3; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #e9edf1; color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--brand); }

.flash { border-radius: 8px; padding: .6rem .9rem; margin-bottom: .6rem; background: var(--ok-bg); color: #14563a; border: 1px solid #bfe3cf; }
.flash.error { background: var(--bad-bg); color: #7c1c21; border-color: #f0c5c7; }
.note { background: var(--info-bg); border-radius: 8px; padding: .6rem .9rem; margin-bottom: 1rem; }
.note.warn { background: var(--warn-bg); }

.login { max-width: 380px; margin: 8vh auto 0; }

/* Review screen */
.sheet-img { width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; }
.qlist { display: grid; gap: .3rem; }
@media (min-width: 640px) { .qlist { grid-template-columns: 1fr 1fr; gap: .3rem 1.25rem; } }
.q { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; border-radius: 8px; border: 1px solid transparent; }
.q.attention { background: var(--warn-bg); border-color: #efc79e; }
.q .n { width: 1.8rem; font-weight: 700; text-align: right; }
.q .why { font-size: .75rem; color: var(--warn); margin-left: auto; text-align: right; }
.q .why.plain { color: var(--muted); }
.bubble { position: relative; }
.bubble input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.bubble span { display: grid; place-items: center; width: 2.35rem; height: 2.35rem; border-radius: 50%; border: 2px solid #8794a2; font-weight: 700; color: var(--muted); background: #fff; }
.bubble input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.bubble input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.submitbar { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: .75rem 16px; margin: 1rem -16px 0; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.submitbar .grow { flex: 1 1 12rem; }

/* Question bank */
.question { border-top: 1px solid #edf0f3; padding: .7rem 0; scroll-margin-top: 1rem; }
.question:first-of-type { border-top: 0; }
.question .stem { white-space: pre-line; margin: .15rem 0 .4rem; }
.question ol { margin: 0 0 .4rem; padding-left: 1.4rem; list-style: lower-alpha; }
.question li.key { font-weight: 700; color: var(--ok); }
.question textarea { min-height: 5rem; }

/* Result */
.verdict { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.verdict .score { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.verdict .tag { font-size: 1.5rem; font-weight: 800; padding: .3rem 1rem; border-radius: 10px; }
.verdict .tag.pass { background: var(--ok-bg); color: var(--ok); }
.verdict .tag.fail { background: var(--bad-bg); color: var(--bad); }
.bar { height: .6rem; background: #e9edf1; border-radius: 99px; overflow: hidden; min-width: 90px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.bar i.strong { background: var(--ok); } .bar i.weak { background: var(--warn); }
.keygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); gap: .35rem; }
.keygrid div { border: 1px solid var(--line); border-radius: 6px; padding: .2rem .45rem; font-size: .85rem; }
.keygrid .right { background: var(--ok-bg); } .keygrid .wrong { background: var(--bad-bg); }
@media print { .topbar, .actions, .noprint { display: none !important; } body { background: #fff; } .card { border: 0; padding: 0; } }
