/* Gleuhr Learn — styles. Palette follows the Gleuhr CRM (terracotta accent, cool neutrals). Light and dark follow the
   device setting. Font: Hanken Grotesk (SIL Open Font License, fonts/OFL.txt), served from this site. */
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/static/fonts/HankenGrotesk-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* Layout: phone-first reading column (46rem) under a slim app bar; admin and draft views widen to 68rem.
   The dark strip on top is the design-preview switcher and is NOT part of the real site.
   Palette follows the Gleuhr CRM (terracotta accent, cool neutrals) so staff meet a familiar look. */
:root {
  --bg: #f4f4f6; --panel: #ffffff; --panel-sub: #f8f8fa; --ink: #1c1c1e; --sub: #5d5d64; --faint: #83838a; --line: #e3e3e8;
  --accent: #d75649; --accent-ink: #ad3d31; --accent-fill: #c4473b; --accent-soft: #fcebe8; --on-accent: #ffffff;
  --ok: #1f7a4d; --ok-soft: #e0f1e7; --on-ok: #ffffff;
  --warn: #93490a; --warn-soft: #fbe9d4;
  --bad: #b3261e; --bad-soft: #fae2de; --on-bad: #ffffff;
  --pv-bg: #23262d; --pv-fg: #eceef2; --pv-sub: #a7adb8; --pv-line: #3b404b;
  --shadow: 0 1px 2px rgba(28, 28, 30, .05), 0 6px 18px rgba(28, 28, 30, .05);
  --font: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 14px; --r-sm: 9px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141416; --panel: #1c1c1f; --panel-sub: #232327; --ink: #eceef1; --sub: #b3b7be; --faint: #8d929a; --line: #33353a;
    --accent: #ff6a4d; --accent-ink: #ff8f75; --accent-fill: #c9381b; --accent-soft: #3a211b; --on-accent: #ffffff;
    --ok: #4cc38a; --ok-soft: #16301f; --on-ok: #08190f;
    --warn: #f2a541; --warn-soft: #382a14;
    --bad: #ff7a8a; --bad-soft: #3f1f27; --on-bad: #2a0a10;
    --pv-bg: #0b0c0e; --pv-fg: #e8eaee; --pv-sub: #9aa0aa; --pv-line: #2b2f37;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141416; --panel: #1c1c1f; --panel-sub: #232327; --ink: #eceef1; --sub: #b3b7be; --faint: #8d929a; --line: #33353a;
  --accent: #ff6a4d; --accent-ink: #ff8f75; --accent-fill: #c9381b; --accent-soft: #3a211b; --on-accent: #ffffff;
  --ok: #4cc38a; --ok-soft: #16301f; --on-ok: #08190f;
  --warn: #f2a541; --warn-soft: #382a14;
  --bad: #ff7a8a; --bad-soft: #3f1f27; --on-bad: #2a0a10;
  --pv-bg: #0b0c0e; --pv-fg: #e8eaee; --pv-sub: #9aa0aa; --pv-line: #2b2f37;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.65rem, 4.2vw, 2.15rem); line-height: 1.12; font-weight: 800; letter-spacing: -.015em; }
h2 { font-size: 1.2rem; line-height: 1.25; font-weight: 750; letter-spacing: -.005em; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
.eyebrow { font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--faint); }
.lede { color: var(--sub); font-size: 1.06rem; max-width: 38rem; }
.muted { color: var(--sub); }
.small { font-size: .88rem; }
.num { font-variant-numeric: tabular-nums; }

/* app bar */
.bar { background: var(--panel); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 68rem; margin: 0 auto; display: flex; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; padding-block: .7rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-size: 1.06rem; font-weight: 600; letter-spacing: -.01em; }
.brand b { color: var(--accent-ink); font-weight: 800; }
.brand img { width: 22px; height: auto; }
.bar-nav { display: flex; gap: .2rem; }
.bar-nav a { padding: .35rem .65rem; border-radius: var(--r-sm); text-decoration: none; color: var(--sub); font-weight: 600; font-size: .92rem; }
.bar-nav a[aria-current="page"] { color: var(--ink); background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); }
.who { margin-left: auto; display: flex; align-items: center; gap: .55rem; font-size: .88rem; color: var(--sub); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; font-size: .78rem; flex: none; }
.who .linkish { background: none; border: 0; font: inherit; color: var(--sub); text-decoration: underline; cursor: pointer; padding: 0; }
@media (max-width: 520px) { .who-name { display: none; } }

/* page frame */
.wrap { max-width: 46rem; margin: 0 auto; padding-block: 1.75rem 4.5rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 1.4rem; }
.wrap.wide { max-width: 68rem; }
.stack { display: flex; flex-direction: column; gap: .6rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1.2rem 1.25rem; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-h { padding: 1rem 1.25rem .85rem; display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }

.btn { font: inherit; font-weight: 700; font-size: .95rem; border-radius: 10px; padding: .68rem 1.1rem; border: 1px solid transparent; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; line-height: 1.2; }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: var(--panel); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--faint); }
.btn.quiet { background: transparent; color: var(--sub); padding-inline: .4rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.sm { font-size: .84rem; padding: .42rem .7rem; }

.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; background: var(--panel-sub); color: var(--sub); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

.meter { height: 8px; border-radius: 99px; background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* course home */
.progress { display: grid; grid-template-columns: 1fr auto; gap: .8rem 1.2rem; align-items: center; }
.progress .meter { grid-column: 1 / -1; }
@media (max-width: 520px) { .progress { grid-template-columns: 1fr; } }
.mod { display: grid; grid-template-columns: 2.3rem minmax(0, 1fr) auto; gap: .85rem; align-items: center; padding: .85rem 1.25rem; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.mod:hover { background: var(--panel-sub); }
.mod-n { width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); font-variant-numeric: tabular-nums; color: var(--sub); }
.mod.done .mod-n { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.mod.next .mod-n { background: var(--accent-fill); color: var(--on-accent); box-shadow: none; }
.mod-t { min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.mod-t b { font-weight: 700; }
.mod-t small { color: var(--sub); font-size: .87rem; }
@media (max-width: 480px) { .mod { grid-template-columns: 2.3rem minmax(0, 1fr); } .mod .chip { grid-column: 2; justify-self: start; } }

.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; margin: 0; }
.rules div { background: var(--panel-sub); border-radius: var(--r-sm); padding: .7rem .8rem; box-shadow: inset 0 0 0 1px var(--line); }
.rules dt { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--faint); }
.rules dd { margin: .15rem 0 0; font-weight: 700; font-size: 1.02rem; }
.rules dd small { display: block; font-weight: 500; color: var(--sub); font-size: .84rem; }

.tries { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; }
.try { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 800; border: 1.5px dashed var(--line); color: var(--faint); font-variant-numeric: tabular-nums; }
.try.x { border: 0; background: var(--bad-soft); color: var(--bad); }
.try.ok { border: 0; background: var(--ok); color: var(--on-ok); }
.try-gap { font-size: .72rem; color: var(--faint); font-family: var(--mono); }

.state { border-radius: var(--r-sm); padding: .85rem 1rem; display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.state.open { background: var(--accent-soft); }
.state.wait { background: var(--warn-soft); color: var(--warn); }
.state.locked { background: var(--bad-soft); color: var(--bad); }
.state.passed { background: var(--ok-soft); color: var(--ok); }
.state p { font-weight: 600; }

/* lesson */
.crumb { font-size: .88rem; color: var(--sub); display: flex; gap: .4rem; flex-wrap: wrap; }
.crumb a { color: var(--sub); }
.learn { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .7rem .9rem; color: var(--sub); }
.learn b { color: var(--ink); }
.prose { font-size: 1.02rem; display: flex; flex-direction: column; gap: .85rem; min-width: 0; }
.prose ul, .prose ol { margin: 0; padding-left: 1.25rem; display: flex; flex-direction: column; gap: .35rem; }
.prose li > p { margin: 0; }
.prose li > ul, .prose li > ol { margin-top: .35rem; }
.prose strong { font-weight: 700; }
.prose em { color: var(--sub); }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); }
.tbl table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: .6rem .8rem; border-bottom: 1px solid var(--line); background: var(--panel-sub); white-space: nowrap; }
.tbl td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tryit { border: 1.5px dashed var(--accent); border-radius: var(--r); padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .4rem; }
.tryit h2 { font-size: 1rem; color: var(--accent-ink); }

/* questions */
.q { display: flex; flex-direction: column; gap: .7rem; }
.q-text { font-size: 1.06rem; font-weight: 650; }
.opts { display: grid; gap: .5rem; }
.opt { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .7rem; align-items: center; text-align: left; width: 100%; font: inherit; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--faint); }
.opt:disabled { cursor: default; }
.opt .l { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .82rem; background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); color: var(--sub); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .l { background: var(--accent-fill); color: var(--on-accent); box-shadow: none; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .l { background: var(--ok); color: var(--on-ok); box-shadow: none; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .l { background: var(--bad); color: var(--on-bad); box-shadow: none; }
.fb { font-size: .95rem; font-weight: 600; }
.fb.ok { color: var(--ok); }
.fb.bad { color: var(--bad); }
.fb span { color: var(--sub); font-weight: 500; }
.modnav { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); padding-top: 1.2rem; }

/* test */
.testtop { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.timer { font-family: var(--mono); font-weight: 600; font-size: .92rem; padding: .25rem .6rem; border-radius: 999px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.timer.low { color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.segs { display: grid; grid-template-columns: repeat(25, minmax(0, 1fr)); gap: 3px; }
.seg { height: 9px; border-radius: 3px; background: var(--line); border: 0; padding: 0; cursor: pointer; }
.seg.a { background: var(--accent); }
.seg.cur { outline: 2px solid var(--ink); outline-offset: 1px; }
.qbig { font-size: clamp(1.15rem, 3vw, 1.35rem); font-weight: 700; line-height: 1.35; }
.testnav { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.unans { display: flex; flex-wrap: wrap; gap: .35rem; }

/* result */
.score { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem 1.4rem; align-items: center; }
.score-big { font-size: clamp(2.6rem, 9vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.score-big small { font-size: .38em; color: var(--sub); font-weight: 700; letter-spacing: 0; }
.passbar { position: relative; padding-top: 1.35rem; }
.passbar .cells { display: grid; grid-template-columns: repeat(25, minmax(0, 1fr)); gap: 2px; }
.passbar .cells i { height: 14px; border-radius: 2px; background: var(--line); }
.passbar.won .cells i.f { background: var(--ok); }
.passbar.lost .cells i.f { background: var(--bad); }
.passbar .line { position: absolute; top: 0; bottom: -4px; left: calc(80% - 1px); border-left: 2px solid var(--ink); }
.passbar .line span { position: absolute; top: 0; left: .35rem; font-size: .72rem; font-weight: 700; white-space: nowrap; font-family: var(--mono); }
@media (max-width: 520px) { .score { grid-template-columns: 1fr; } }
.bymod { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .45rem; }
.bymod a, .bymod div { display: flex; justify-content: space-between; gap: .6rem; padding: .55rem .75rem; border-radius: var(--r-sm); background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; color: var(--ink); font-size: .92rem; }
.bymod .weak { background: var(--bad-soft); box-shadow: none; }
.bymod .weak b { color: var(--bad); }
.review-item { display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--line); }

/* forms */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label { font-weight: 650; font-size: .88rem; }
.field input, .field select { font: inherit; width: 100%; padding: .62rem .72rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--faint); }
.check { display: flex; gap: .55rem; align-items: flex-start; font-size: .92rem; }
.check input { margin-top: .25rem; accent-color: var(--accent-fill); }
.err { color: var(--bad); font-weight: 600; font-size: .9rem; }
.note { background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--r-sm); padding: .75rem .9rem; font-size: .92rem; color: var(--sub); }
.note.ok { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.auth { max-width: 25rem; width: 100%; margin: 2.5rem auto 0; }
.auth .logo { width: 44px; height: auto; }

/* admin table */
.ptable td .sub { display: block; color: var(--faint); font-size: .82rem; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.fchip { font: inherit; font-size: .84rem; font-weight: 650; padding: .32rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--sub); cursor: pointer; }
.fchip[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.minitries { display: flex; gap: .3rem; flex-wrap: wrap; }
.minitries span { font-family: var(--mono); font-size: .78rem; font-weight: 600; padding: .1rem .4rem; border-radius: 6px; }
.minitries .x { background: var(--bad-soft); color: var(--bad); }
.minitries .ok { background: var(--ok-soft); color: var(--ok); }

/* draft review */
.jump { display: flex; flex-wrap: wrap; gap: .35rem; }
.jump a { font-size: .84rem; font-weight: 650; padding: .3rem .65rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.draft-mod { display: flex; flex-direction: column; gap: 1rem; padding-top: .5rem; scroll-margin-top: 1rem; }
.qa { display: flex; flex-direction: column; gap: .4rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); }
.qa .qid { font-family: var(--mono); font-size: .74rem; color: var(--faint); font-weight: 600; }
.qa ol { margin: 0; padding-left: 1.4rem; list-style: upper-alpha; display: flex; flex-direction: column; gap: .15rem; }
.qa li.ans { color: var(--ok); font-weight: 700; }
.qa li.ans::after { content: "  ✓ correct"; font-size: .78rem; }
.qa .why { font-size: .9rem; color: var(--sub); }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: .6rem; }

@media (prefers-reduced-motion: no-preference) {
  .opt, .btn, .seg, .mod { transition: background-color .15s, border-color .15s, filter .15s; }
}

/* ---- real-site additions ---- */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img { max-width: 100%; }
.inline { display: inline; margin: 0; }
.gap-xs { gap: .25rem; } .gap-sm { gap: .6rem; } .gap-md { gap: 1rem; } .gap-lg { gap: 1.25rem; }
.row.between { justify-content: space-between; }
.h-md { font-size: 1.5rem; }
.note.bad { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.tbl.flat { border: 0; border-radius: 0; }
fieldset { border: 1px solid var(--line); margin: 0; min-width: 0; }
legend { padding: 0; float: left; width: 100%; margin-bottom: .9rem; }
legend + * { clear: both; }
label.opt { cursor: pointer; }
label.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
label.opt:has(input:checked) .l { background: var(--accent-fill); color: var(--on-accent); box-shadow: none; }
label.opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
progress.meter { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--panel-sub); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
progress.meter::-webkit-progress-bar { background: var(--panel-sub); border-radius: 99px; }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
a.fchip { text-decoration: none; }
.fchip[aria-current="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.wrap > .note { margin: 0; }
.modnav form { margin: 0; }
.state form { margin: 0; }
.testnav form { margin: 0; }
.qa .q-text { font-size: 1rem; }
