:root {
  --ink: #16202c;
  --ink-soft: #5a6a7a;
  --line: #dfe5ec;
  --bg: #f4f6f9;
  --card: #ffffff;
  --accent: #1d6fe0;
  --accent-dark: #14529f;
  --good: #1a7f4b;
  --good-bg: #e8f6ee;
  --warn: #9a6400;
  --warn-bg: #fdf3df;
  --bad: #b4232b;
  --bad-bg: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 35, 55, .06), 0 6px 20px rgba(20, 35, 55, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.62 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--accent); }

/* ------------------------------------------------------------ chrome */
header.topbar {
  background: #0f1c2b;
  color: #fff;
  padding: 9px 22px;
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex-wrap: wrap;          /* wraps rather than spilling over a fixed height */
  min-height: 56px;
  z-index: 20;
  /* deliberately NOT sticky: on a lesson page the position rail below is what
     needs to stay on screen, and two stacked sticky bars with a wrapping nav
     leaves no room to read on a phone. */
}
header.topbar .brand {
  font-weight: 650;
  letter-spacing: .2px;
  font-size: 15px;
  white-space: nowrap;
}
header.topbar .brand span { color: #7fb2ff; font-weight: 500; }
header.topbar nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
header.topbar nav a {
  color: #c8d6e6;
  text-decoration: none;
  font-size: 14px;
  padding: 6px 11px;
  border-radius: 6px;
}
header.topbar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
header.topbar nav a.on { background: rgba(255,255,255,.16); color: #fff; }

main { max-width: 860px; margin: 0 auto; padding: 30px 22px 80px; }
main.wide { max-width: 1120px; }

h1 { font-size: 27px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.2px; }
h2 { font-size: 19px; margin: 32px 0 10px; letter-spacing: -.1px; }
h3 { font-size: 15px; margin: 22px 0 6px; text-transform: uppercase;
     letter-spacing: .06em; color: var(--ink-soft); }
p { margin: 0 0 14px; }
.lede { font-size: 17px; color: var(--ink-soft); margin-bottom: 26px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.flash {
  background: var(--warn-bg); border: 1px solid #f0dcae; color: var(--warn);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 14px;
}

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border: 0;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 560;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--accent-dark); }
.btn.ghost { background: #fff; color: var(--accent); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f2f7ff; }
.btn.wide { width: 100%; text-align: center; }

/* A button that reads as a link -- used where an inline onclick used to be. */
.linkbtn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
  cursor: pointer; text-decoration: underline;
}
.linkbtn:hover { color: var(--accent-dark); }

/* ------------------------------------------------------------ forms */
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; padding: 10px 12px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus { outline: 2px solid #b9d4ff; border-color: var(--accent); }

/* ------------------------------------------------------------ progress */
.bar { height: 8px; background: #e6ebf1; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar.good > i { background: var(--good); }

/* ------------------------------------------------------------ modules */
.mod {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 18px; margin-bottom: 10px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.mod:hover { border-color: #b9cfe8; }
.mod .num {
  flex: 0 0 34px; height: 34px; border-radius: 50%;
  background: #eef2f7; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 650;
}
.mod.done .num { background: var(--good-bg); color: var(--good); }
.mod.expired .num { background: var(--warn-bg); color: var(--warn); }
.mod .t { font-weight: 600; font-size: 15.5px; }
.mod .s { font-size: 13px; color: var(--ink-soft); }
.mod .meta { margin-left: auto; text-align: right; font-size: 12.5px; white-space: nowrap; }

.pill {
  display: inline-block; font-size: 11.5px; font-weight: 650; padding: 2px 9px;
  border-radius: 99px; letter-spacing: .02em;
}
.pill.done { background: var(--good-bg); color: var(--good); }
.pill.todo { background: #eef2f7; color: var(--ink-soft); }
.pill.expired { background: var(--warn-bg); color: var(--warn); }
.pill.retry { background: var(--bad-bg); color: var(--bad); }

/* ------------------------------------------------- sticky position rail */
.rail {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 9px 22px 8px;
}
.rail-inner { max-width: 860px; margin: 0 auto; }

.rail .top { display: flex; align-items: baseline; gap: 12px; }
.rail .modname {
  font-weight: 650; font-size: 14px; color: var(--ink);
  text-decoration: none; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.rail .modname:hover { color: var(--accent); }
.rail .mnum {
  display: inline-block; background: #eef2f7; color: var(--ink-soft);
  border-radius: 5px; padding: 1px 6px; font-size: 11.5px; margin-right: 6px;
  vertical-align: 1px;
}
.rail .pos {
  margin-left: auto; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap;
}

.rail .segs { display: flex; gap: 4px; margin-top: 7px; }
.rail .seg {
  flex: 1 1 0; height: 7px; border-radius: 99px; background: #e2e8f0;
  display: block; text-decoration: none; transition: background .15s;
}
.rail .seg:hover { background: #b9cfe8; }
.rail .seg.done { background: var(--good); }
.rail .seg.cur  { background: var(--accent); box-shadow: 0 0 0 2px #cfe0f8; }
/* where you are AND already finished: keep the "done" colour, keep the ring */
.rail .seg.cur.done { background: var(--good); box-shadow: 0 0 0 2px #c3e6d2; }
.rail .seg.recap { flex: 1.5 1 0; }

.rail .overall {
  display: flex; align-items: center; gap: 8px;
  margin-top: 7px; font-size: 11.5px; color: var(--ink-soft);
}
.rail .minibar {
  flex: 1 1 auto; height: 4px; background: #e9eef4; border-radius: 99px;
  overflow: hidden; min-width: 40px;
}
.rail .minibar > i { display: block; height: 100%; background: var(--accent); }
.rail .up { margin-left: auto; white-space: nowrap; }

/* ------------------------------------------------------------ bites */

/* Orientation line. The bite titles are hooks, not labels, so this carries
   the plain "where am I" information above them. */
.eyebrow {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  font-size: 12px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-soft); font-weight: 600; margin-bottom: 9px;
}
.eyebrow .topic { color: var(--accent); }
.eyebrow .sep { opacity: .45; }
.eyebrow .tag { text-transform: none; letter-spacing: 0; }

/* The stake used to be a boxed blue callout, which competed with the title
   for "main thing on the page". It's a standfirst: it leads INTO the body,
   it isn't a sibling of it. */
/* The stake. It gets an accent rule so it reads as its own element, but keeps
   normal weight and no fill -- it was the bold-plus-background that made the
   old version fight the title for "main thing on the page". */
.standfirst {
  font-size: 17.5px; line-height: 1.55; color: #45566c;
  margin: 0 0 22px; max-width: 62ch;
  border-left: 3px solid var(--accent);
  padding-left: 16px;
}

/* The lesson card opens with the title, so it needs a little more room at the
   top and no stacked margin under the heading. */
.card.lesson { padding-top: 26px; }
.card.lesson > h1 { margin-top: 0; margin-bottom: 10px; }
.card.lesson > .standfirst { margin-bottom: 22px; }

/* Recap scenario: an inner tinted box, so both kinds of bite have the same
   outer shape -- one white card, tinted callouts within it. */
.box.situation { background: #fffdf5; border: 1px solid #ecdfba; }
.box.situation h3 { color: var(--warn); }
.box.situation p:last-child { margin-bottom: 0; }

.spine {
  background: #0f1c2b; color: #fff; border-radius: var(--radius);
  padding: 15px 20px; margin: 0 0 20px;
}
.spine .k {
  display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: #7fb2ff; margin-bottom: 5px;
}
.spine b { font-size: 17px; font-weight: 600; line-height: 1.45; }

.card.scenario { background: #fffdf5; border-color: #ecdfba; }
.card.check { border-color: #cddcef; }
.card.check .qt { font-weight: 600; margin-bottom: 14px; }

.verdict {
  margin-top: 14px; padding: 13px 16px; border-radius: 8px; font-size: 14.5px;
}
.verdict.ok { background: var(--good-bg); border: 1px solid #c6e6d3; }
.verdict.no { background: var(--bad-bg); border: 1px solid #f3cccc; }
.verdict b { margin-right: 4px; }

.nextup {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  border-color: #b9cfe8; background: #f7fbff;
}
.nextup .t { font-weight: 600; font-size: 16px; margin-top: 2px; }
.nextup .btn { margin-left: auto; }
.nextup.caughtup { background: var(--good-bg); border-color: #c6e6d3; }

.done-hero { text-align: center; padding: 30px 26px 26px; }
.done-hero h1 { margin: 0 0 8px; }
.tickbig {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--good-bg); color: var(--good);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}

.modblock { margin-bottom: 10px; }
.modblock .mod { margin-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; }
.dots {
  display: flex; gap: 5px; padding: 9px 18px; background: #fff;
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap;
}
.dot {
  width: 22px; height: 6px; border-radius: 99px; background: #e2e8f0;
  display: block; text-decoration: none;
}
.dot:hover { background: #b9cfe8; }
.dot.on { background: var(--good); }
.dot.recap { width: 34px; }

.modstart { text-align: center; padding: 22px 24px 18px; }
.modstart .btn { font-size: 16px; padding: 13px 28px; }
.modstart p { margin: 12px 0 0; }

.bitelink {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 9px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow);
}
.bitelink:hover { border-color: #b9cfe8; }
.bitelink .tick {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: #eef2f7;
  color: var(--ink-soft); display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 650;
}
.bitelink.done .tick { background: var(--good-bg); color: var(--good); }
.bitelink .t { font-weight: 600; font-size: 15.5px; }
.bitelink .s { font-size: 13.5px; color: var(--ink-soft); margin-top: 2px; }

.tag.pay { background: #efe7fb; color: #5b3aa6; }
.tag.recapt { background: #fdf3df; color: var(--warn); }

.assembles { text-align: center; margin: -6px 0 18px; }

.afterbox { margin-top: 18px; text-align: center; }
.afterbox[hidden] { display: none; }
.modcomplete { margin-bottom: 12px; }

.opt .mark { flex: 0 0 auto; width: 18px; }
.opt.correct, .opt.wrong { cursor: default; }
.opt input[disabled] { pointer-events: none; }

.bitenav { margin-top: 26px; }
.bitenav .row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.bitenav .btn.ghost { padding: 8px 14px; font-size: 14px; }
.bitenav .saved {
  text-align: center; font-size: 12.5px; color: var(--ink-soft); margin: 13px 0 0;
}

/* "Stop for now" is a first-class action: the whole format is built on people
   doing one section and leaving, so it must not read as a faint escape hatch. */
.btn.stop {
  background: #fff; color: var(--ink);
  border: 1.5px solid #c3d0de;
  font-weight: 600; padding: 11px 24px;
  box-shadow: var(--shadow);
}
.btn.stop:hover {
  background: #f2f7ff; border-color: var(--accent); color: var(--accent);
}

.checkrow {
  display: flex; gap: 11px; align-items: flex-start; font-weight: 400;
  border: 1px solid var(--line); border-radius: 8px; padding: 13px 15px;
  margin-top: 18px; cursor: pointer; font-size: 14.5px;
}
.checkrow:hover { border-color: #b9cfe8; background: #fafcff; }
.checkrow input { margin-top: 4px; flex: 0 0 auto; }
.checkrow .muted { display: block; margin-top: 4px; }

.lowscore { color: var(--bad); }

/* ------------------------------------------------- admin: clients + login */
.signin { max-width: 420px; margin: 40px auto 0; }
.signin h1 { font-size: 23px; text-align: center; }
.signin .lede { text-align: center; font-size: 15px; }

.btn.tiny { padding: 5px 11px; font-size: 13px; }
.btn.danger { color: var(--bad); border-color: #f0cccc; }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
td.actions { white-space: nowrap; }
td.actions form { margin-left: 4px; }

.fieldrow { display: flex; gap: 14px; flex-wrap: wrap; }
.fieldrow > div { flex: 1 1 200px; }

details.addrow { margin-top: 6px; }
details.addrow summary {
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--accent);
  padding: 6px 0;
}
details.addrow[open] summary { margin-bottom: 8px; }

input[readonly] { background: #f6f8fb; font-family: ui-monospace, Consolas, monospace;
                  font-size: 13px; }

/* ------------------------------------------------------------ lesson */
.tagline {
  font-size: 15px; font-weight: 600; color: var(--accent);
  margin: 0 0 16px;
}
.lesson ul { margin: 0 0 16px; padding-left: 22px; }
.lesson li { margin-bottom: 7px; }

.box { border-radius: var(--radius); padding: 16px 20px; margin: 18px 0; }
.box h3 { margin-top: 0; }
.box.flags { background: var(--bad-bg); border: 1px solid #f3cccc; }
.box.flags h3 { color: var(--bad); }
.box.do { background: var(--good-bg); border: 1px solid #c6e6d3; }
.box.do h3 { color: var(--good); }
.box ul { margin: 0; padding-left: 20px; }
.box li { margin-bottom: 7px; }

/* "Watch for" is context, not the takeaway -- so it reads as part of the
   prose rather than a second coloured box fighting the green one. A page
   should have exactly one thing shouting at you. */
.watchfor { margin: 20px 0 4px; }
.watchfor h3 { margin: 0 0 8px; color: var(--bad); }
.watchfor ul { margin: 0; padding-left: 20px; }
.watchfor li { margin-bottom: 7px; }
.watchfor li::marker { color: var(--bad); }

/* ...and that one thing is the takeaway. */
.box.do.takeaway { margin-bottom: 2px; box-shadow: 0 1px 2px rgba(26, 127, 75, .08); }

.carrier-note {
  border-left: 3px solid var(--accent);
  background: #f3f8ff;
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  margin: 22px 0;
  font-size: 14px;
}
.carrier-note b { display: block; margin-bottom: 6px; }
.carrier-note ul { margin: 8px 0 0; padding-left: 18px; }
.carrier-note li { margin-bottom: 6px; }

/* ------------------------------------------------------------ quiz */
.q { border-top: 1px solid var(--line); padding: 20px 0 6px; }
.q:first-of-type { border-top: 0; padding-top: 4px; }
.q .qt { font-weight: 600; margin-bottom: 12px; }
.opt {
  display: flex; gap: 11px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 8px; cursor: pointer; background: #fff;
}
.opt:hover { border-color: #b9cfe8; background: #fafcff; }
.opt input { margin-top: 4px; flex: 0 0 auto; }
.opt.correct { background: var(--good-bg); border-color: #b7dfc7; }
.opt.wrong { background: var(--bad-bg); border-color: #f0c4c4; }
.why {
  font-size: 13.5px; color: var(--ink-soft); margin: 6px 0 0;
  padding-left: 2px;
}

.scorebox { text-align: center; padding: 26px 24px; }
.scorebox .n { font-size: 40px; font-weight: 700; letter-spacing: -1px; }
.scorebox.pass .n { color: var(--good); }
.scorebox.fail .n { color: var(--bad); }

/* ------------------------------------------------------------ tables */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tablewrap table { min-width: 560px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
     color: var(--ink-soft); font-weight: 650; }
tbody tr:hover { background: #fafcff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ evidence */
.kpis { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.kpi {
  flex: 1 1 160px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.kpi .v { font-size: 27px; font-weight: 700; letter-spacing: -.5px; }
.kpi .k { font-size: 12.5px; color: var(--ink-soft); }

.qrow { border-bottom: 1px solid var(--line); padding: 15px 0; }
.qrow:last-child { border-bottom: 0; }
.qrow .ref { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.qrow .qt { margin: 4px 0 8px; }
.qrow .note { font-size: 13.5px; color: var(--ink-soft); }
.tag {
  display: inline-block; font-size: 11px; font-weight: 650; padding: 2px 8px;
  border-radius: 5px; margin-right: 6px; white-space: nowrap;
}
.tag.kind-training { background: var(--good-bg); color: var(--good); }
.tag.kind-process { background: #eef1fb; color: #3c4ba0; }
.tag.kind-technical { background: var(--warn-bg); color: var(--warn); }
.tag.mod { background: #eef2f7; color: var(--ink-soft); font-weight: 550; }

/* ------------------------------------------------------------ certificate */
.cert {
  background: #fff; border: 2px solid #0f1c2b; border-radius: 4px;
  padding: 46px 52px; text-align: center; box-shadow: var(--shadow);
}
.cert .k { font-size: 12px; letter-spacing: .22em; text-transform: uppercase;
           color: var(--ink-soft); }
.cert .who { font-size: 33px; font-weight: 700; margin: 12px 0 4px; letter-spacing: -.5px; }
.cert .what { font-size: 17px; margin: 18px 0 6px; }
.cert table { margin-top: 30px; text-align: left; font-size: 13px; }
.cert .sig { margin-top: 34px; display: flex; gap: 30px; justify-content: space-between;
             font-size: 12.5px; color: var(--ink-soft); text-align: left; }

@media print {
  header.topbar, .noprint { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card, .cert, .kpi { box-shadow: none; break-inside: avoid; }
  .qrow { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

@media (max-width: 620px) {
  main { padding: 20px 14px 60px; }
  .mod { flex-wrap: wrap; }
  .mod .meta { margin-left: 50px; text-align: left; }
  .cert { padding: 28px 22px; }
  .cert .who { font-size: 25px; }
}
