/* Marcellus draws 0 and 1 like O and I, so digits fall through to Karla. */
@font-face { font-family: Marcellus; src: url(../fonts/marcellus-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; unicode-range: U+0020-002F, U+003A-00FF, U+2000-206F }
@font-face { font-family: Karla; src: url(../fonts/karla-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap }
@font-face { font-family: Karla; src: url(../fonts/karla-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap }
@font-face { font-family: Karla; src: url(../fonts/karla-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap }
@font-face { font-family: Karla; src: url(../fonts/karla-latin-700-normal.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap }
@font-face { font-family: Karla; src: url(../fonts/karla-latin-700-italic.woff2) format("woff2"); font-weight: 700; font-style: italic; font-display: swap }
/* One calm column. Tokens match the worksheet prototype. */
:root {
  --paper: #f7f2ea; --surface: #fffcf7; --ink: #241923; --muted: #5f4f5d; --line: #dcd2c8;
  --accent: #5b3f6e; --on-accent: #f4eee6; --wash: #ede4da; --gold: #c9a56f; --gold-wash: #f6e9cf;
  --alert: #7a5519; --error: #a12a2a; --gate: #b3261e; --iris: #6a4f86;
  --display: Marcellus, Karla, Georgia, serif;
  --read: Karla, "Segoe UI", system-ui, sans-serif;
  --ui: Karla, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root {
  --paper: #241923; --surface: #30222f; --ink: #f4eee6; --muted: #bbaeba; --line: #493747;
  --accent: #e6c48e; --on-accent: #241923; --wash: #3b2b39; --gold: #e6c48e; --gold-wash: #3d2f2c;
  --alert: #e6c48e; --error: #f2a9a0; --gate: #f07a70; --iris: #ae96c4; color-scheme: dark } }
* { box-sizing: border-box }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.55 var(--ui) }
a { color: var(--accent) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.wrap { max-width: 44rem; margin-inline: auto; padding-inline: 16px }
main.wrap { padding-block: 2rem 4rem }
header.top { background: var(--surface); border-bottom: 1px solid var(--line) }
.top-row { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; align-items: center; padding-block: .6rem }
nav { display: flex; flex-wrap: wrap; gap: 1.1rem; align-items: center; margin-left: auto }
nav a { color: var(--muted); text-decoration: none; font-weight: 500 }
h1 { font: 400 2.2rem/1.15 var(--display); margin: 0 0 .5rem; text-wrap: balance }
h2 { font: 600 1.2rem var(--ui); margin: 2rem 0 .5rem }
.lede { color: var(--muted); margin: 0 0 1.5rem }
.head-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1rem }
.stack { display: grid; gap: .35rem; max-width: 26rem; margin-bottom: 1rem }
label { font-weight: 600; margin-top: .6rem }
label.check { font-weight: 400; display: flex; gap: .5rem; align-items: center }
small { color: var(--muted) }
input:not([type=checkbox]), select { width: 100%; padding: .6rem .7rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font: inherit }
.btn { display: inline-block; border: 1px solid var(--accent); background: transparent; color: var(--accent); border-radius: 6px; padding: .5rem .95rem; font: 600 1rem var(--ui); cursor: pointer; text-decoration: none }
.btn.primary { background: var(--accent); color: var(--on-accent) }
.btn.quiet { border-color: var(--line); color: var(--ink); margin-top: .75rem }
.stack .btn { margin-top: .9rem; justify-self: start }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer }
.error { color: var(--error); margin: .1rem 0; font-size: .95rem }
.notice { background: var(--wash); padding: .7rem 1rem; border-radius: 6px }
.notice.warn { background: var(--gold-wash); color: var(--alert) }
.codes { background: var(--wash); padding: .7rem 1rem; border-radius: 6px; font-size: 1rem; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere }
.qr { background: #fff; display: inline-block; padding: .75rem; border-radius: 6px }
.scroll { overflow-x: auto }
table { width: 100%; border-collapse: collapse; background: var(--surface); min-width: 32rem }
th, td { text-align: left; vertical-align: top; padding: .6rem .7rem; border-bottom: 1px solid var(--line) }
th { color: var(--muted); font-size: .9rem }
details { margin-top: 1rem }
summary { cursor: pointer; color: var(--accent) }

.path { display: grid; gap: .5rem }
.step { display: flex; gap: 1rem; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .85rem 1rem; text-decoration: none; color: inherit }
a.step:hover { border-color: var(--accent) }
.step > div { min-width: 0 }
.step .t { font-weight: 700 }
.step .k { color: var(--muted); font-size: .9rem }
.step.locked { background: transparent; border-style: dashed; color: var(--muted) }
.step.here { border-color: var(--gold); border-width: 2px }
.here-tag { font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--alert) }
.pill { flex: none; font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; background: var(--wash); color: var(--muted); white-space: nowrap }
.pill.draft, .pill.editing { background: var(--gold-wash); color: var(--alert) }
.pill.complete { background: var(--accent); color: var(--on-accent) }
article { font: 400 1.13rem/1.65 var(--read); padding-bottom: 6rem; overflow-wrap: anywhere }
article h1 { margin-bottom: .25rem }
article .sub { font: 400 .95rem var(--ui); color: var(--muted); margin: 0 0 2rem }
article h2 { font: 400 1.5rem/1.25 var(--display); margin: 2.5rem 0 .75rem }
article h3 { font: 600 1.08rem/1.3 var(--ui); margin: 1.75rem 0 .5rem }
article p, article ul { margin: 0 0 1rem }
article blockquote { margin: 1.25rem 0; padding: .75rem 1rem; background: var(--wash); border-radius: 6px }
article img { display: block; max-width: 100%; height: auto; margin: 1.5rem auto; border-radius: 4px; background: #fff }
.film { aspect-ratio: 16/9; max-width: 100%; background: var(--wash); border-radius: 6px; display: grid; place-items: center; text-align: center; color: var(--muted); font: 500 1rem var(--ui); padding: 1rem }
.field { margin: 0 0 1.5rem }
textarea { display: block; width: 100%; padding: .65rem .75rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font: 400 1.05rem/1.5 var(--read); resize: none; overflow: hidden; min-height: 2.8rem }
.cells { margin: 1rem 0 1.5rem; font: 400 1rem/1.45 var(--ui) }
.r { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .5rem 1rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line) }
.cells.pairs .r { grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) }
.cells.plain .r { border-bottom: 0; padding: 0 }
.c .field, .c .answer { margin: 0 }
.c .field + .field, .c .answer + .answer { margin-top: .5rem }
.cap { display: none; font-size: .85rem; color: var(--muted); margin-bottom: .2rem }
.answer { margin: 0 0 1.5rem; padding: .6rem .8rem; background: var(--wash); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem }
.answer.blank { color: var(--muted); font-style: italic; background: transparent; border: 1px dashed var(--line) }
.bar { position: fixed; inset: auto 0 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line) }
.bar .wrap { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; padding-block: .6rem }
.saved { margin-right: auto; color: var(--muted); font-size: .9rem; min-width: 7rem }
.ask { width: 100%; font-size: 1rem }
.ask p { margin: 0 0 .5rem }
.row { display: flex; flex-wrap: wrap; gap: .5rem }
.begin p { font: 400 1.15rem/1.65 var(--read); margin: 0 0 1.2rem; max-width: 36rem }
dialog.begin { width: min(36rem, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 1.75rem; background: var(--surface); color: var(--ink) }
dialog.begin h2 { font: 400 1.9rem/1.2 var(--display); margin: 0 0 1rem }
dialog.begin::backdrop { background: rgba(24, 17, 23, .7) }
.weeks { display: grid; gap: .5rem; margin-top: 1.5rem }
.wk { display: block; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none }
.wk summary { display: flex; flex-wrap: wrap; gap: .1rem 1rem; align-items: baseline; padding: .85rem 1rem; cursor: pointer; list-style: none }
.wk summary::-webkit-details-marker { display: none }
.wk summary::before { content: ""; align-self: center; width: .5rem; height: .5rem; margin-left: .1rem; margin-right: -.2rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s ease-out }
.wk[open] summary::before { transform: rotate(45deg) }
.wk .path { padding: 0 .75rem .75rem }
.wk-name { font: 400 1.2rem var(--display) }
.wk summary .k { margin-left: auto }
.wk.shut, a.wk.lit { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .85rem 1rem }
.wk.shut { background: transparent; border-style: dashed }
.wk.shut .wk-name { color: var(--muted) }
a.wk.lit:hover { border-color: var(--accent) }
.step { background: var(--paper) }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1rem; margin-bottom: .75rem }
.card h2 { margin: 0 0 .25rem }
.q { font-weight: 600; margin: .9rem 0 .2rem }
.map { display: grid; grid-template-columns: repeat(9, minmax(1.5rem, 1fr)); gap: 3px; margin: .35rem 0 .3rem; min-width: 15rem }
.map span { position: relative; height: 1.6rem; border-radius: 3px; background: var(--wash); font-size: .75rem; color: var(--muted); display: grid; place-items: center }
.map .past { background: var(--line) }
.map .now { background: var(--accent); color: var(--on-accent); font-weight: 700 }
.tick { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--gate); border-radius: 1px }
.tick.done { background: var(--muted); opacity: .45 }
.tick.hold { width: 4px; margin-left: -2px; box-shadow: 0 0 0 2px var(--paper) }
.where { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; font-size: .9rem }
.where .stamp { font-weight: 700 }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; line-height: 1.3; padding: .15rem .6rem; border-radius: 99px; border: 1px solid var(--line); background: var(--wash); color: var(--ink); white-space: nowrap }
.tag.gate { border-color: var(--gate); color: var(--gate); background: transparent }
.eyebrow { font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 .25rem }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: .75rem; margin: 1rem 0 1.5rem }
.cards .card { margin: 0 }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .35rem 1rem; margin: .5rem 0 0 }
.facts dt { color: var(--muted) }
.facts dd { margin: 0; overflow-wrap: anywhere }
.sheet summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; cursor: pointer }
.brand { display: block; line-height: 0; margin-right: 0 }
.brand img { height: 52px; width: auto }
.flag { padding: .6rem .9rem; background: var(--gold-wash); margin: 0 0 .5rem; border-radius: 6px; display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: space-between }
.gate-row { display: flex; flex-wrap: wrap; gap: .25rem 1rem; justify-content: space-between; align-items: center; padding: .5rem 0; border-bottom: 1px solid var(--line) }
@media (max-width: 34rem) { .r, .cells.pairs .r { grid-template-columns: minmax(0, 1fr) } .c.empty, .r.head { display: none } .cap { display: block } h1 { font-size: 1.75rem } .saved { width: 100%; margin-right: 0 } article { font-size: 1.12rem } }
@media (prefers-reduced-motion: no-preference) {
  .step.just { animation: earned 1.8s ease-out } @keyframes earned { from { background: var(--gold-wash) } }
  .step.just .pill { animation: stamp .35s ease-out } @keyframes stamp { from { transform: scale(1.25) } }
}

.cards.one { grid-template-columns: minmax(0, 1fr) }
.card + .card { margin-top: .75rem }
.card-head { display: flex; gap: 1rem; align-items: center; justify-content: space-between }
.card-head h2 { margin: 0 }
.switch { display: inline-flex; align-items: center; gap: .5rem; margin: 0; padding: 0; background: none; border: 0; color: var(--muted); font: 600 .9rem var(--ui); cursor: pointer }
.switch::before { content: ""; order: 2; width: 2.6rem; height: 1.5rem; border-radius: 99px; background: var(--wash); border: 1px solid var(--line); transition: background .15s }
.switch .knob { order: 2; width: 1.1rem; height: 1.1rem; margin-left: -2.45rem; margin-right: 1.3rem; border-radius: 50%; background: var(--muted); transition: transform .15s ease-out }
.switch.on { color: var(--ink) }
.switch.on::before { background: var(--accent); border-color: var(--accent) }
.switch.on .knob { transform: translateX(1.1rem); background: var(--on-accent) }
.switch[aria-disabled="true"] { cursor: default; opacity: .75 }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px }
.devices { margin: .75rem 0 }
.devices summary { cursor: pointer; font-weight: 600 }
.wk summary .here-tag { margin: 0 }
.gate-line { display: flex; gap: .6rem; align-items: center; margin: .6rem .1rem .2rem; font-size: .88rem; color: var(--gate) }
.gate-line::before, .gate-line::after { content: ""; flex: 1; border-top: 1px dashed var(--gate); opacity: .6 }
.gate-line span { flex: none; max-width: 80%; text-align: center }
.step.locked .t { font-weight: 600; color: var(--muted) }
.row form .btn { margin-top: 0 }
#confirm h2 { font: 400 1.6rem/1.2 var(--display); margin: 0 0 .75rem }

.wrap.wide { max-width: 76rem }
table.clients td { vertical-align: top }
table.clients .map { min-width: 16rem }
.nowrap { white-space: nowrap }
.tags { display: flex; flex-wrap: wrap; gap: .3rem }
.tag.hold { border-color: var(--alert); color: var(--alert); background: transparent }
h1 .tag { vertical-align: middle; margin-left: .5rem; font-family: var(--ui) }
.sorts { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: 1rem 0 .5rem }
.sorts a.tag { text-decoration: none; color: var(--muted) }
.sorts a.tag.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent) }
h2.level { font: 400 1.5rem/1.2 var(--display); margin: 2.25rem 0 .75rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line) }
.devices .gate-row, .gate-row.device { background: var(--wash); border: 0; border-radius: 6px; padding: .6rem .8rem; margin: .5rem 0 }
.kind { display: inline-block; vertical-align: .1em; margin-left: .45rem; font: 700 .66rem/1 var(--ui); letter-spacing: .06em; text-transform: uppercase; padding: .22rem .45rem; border-radius: 99px; border: 1px solid var(--iris); color: var(--iris) }
a.card.program { display: block; color: inherit; text-decoration: none; padding: 1.1rem 1.2rem }
a.card.program:hover { border-color: var(--accent) }
.program-head { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: .6rem }
.program-name { font: 400 1.5rem/1.2 var(--display) }
.program-line { margin: .5rem 0 0; color: var(--ink) }
.client-map { min-width: 0 }
.news h3 { margin: 0 0 .35rem; font: 400 1.25rem var(--display) }
.wrap.mid { max-width: 60rem }
details.program { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin: 0 0 .75rem }
details.program > summary { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: 1rem 1.1rem; cursor: pointer; list-style: none }
details.program > summary::-webkit-details-marker { display: none }
details.program > summary::before { content: ""; width: .5rem; height: .5rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s ease-out }
details.program[open] > summary::before { transform: rotate(45deg) }
details.program > summary .program-name { margin-right: auto }
details.program > summary .map { flex-basis: 100%; margin: 0 }
details.program .inner { padding: 0 1.1rem 1rem }
details.program .inner h3 { font: 600 1.05rem var(--ui); margin: 1.25rem 0 .4rem }
.id-card h1 { margin: 0 0 .15rem }
.id-card .tags { margin: .5rem 0 .25rem }
details.program > summary { color: var(--ink) }
details.program > summary .k { color: var(--muted) }

.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; line-height: 1 }
.brand-name { font: 400 1.35rem/1.1 var(--display); color: var(--ink); white-space: nowrap }
@media (max-width: 30rem) { .brand-name { display: none } }
.goes-by { font: 400 .65em var(--display); color: var(--muted) }
.facts.cols { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); column-gap: 1.25rem }
@media (max-width: 44rem) { .facts.cols { grid-template-columns: auto minmax(0, 1fr) } }
.shelves { margin: .25rem 0 1.25rem }
.shelves .btn { margin-top: 0 }
.count { display: inline-grid; place-items: center; min-width: 1.4em; height: 1.4em; margin-left: .35rem; padding: 0 .35em; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: .8em; font-weight: 700 }
.btn.small { margin-top: 0; padding: .3rem .75rem; font-size: .85rem }
details.program > summary form { margin: 0 }

.code { font: 600 .85em var(--ui); letter-spacing: .02em; color: var(--muted); margin-right: .4rem; white-space: nowrap }
h1 .code { font-size: .55em; vertical-align: .25em }
.library-search input { width: 100%; max-width: 28rem; padding: .55rem .75rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font: inherit }
.library .gate-row { align-items: flex-start }
a.tag { text-decoration: none }
.answer.blank.preview { font: 500 .75rem var(--ui); color: var(--muted); min-height: 2.2rem; display: flex; align-items: flex-start }
article.library-doc { max-width: 44rem }
article.library-doc > p.code { margin: 0 0 .25rem }
/* Levels: the same header and buttons on the portal and on every program. */
.level-head { margin-bottom: 1.25rem }
.level-head h1 { margin-bottom: .6rem }
.level-actions { display: flex; flex-wrap: wrap; gap: .5rem }
.level-actions .btn { margin: 0; padding: .4rem .8rem; font-size: .92rem; display: inline-flex; align-items: center }
.level-actions .btn.done { border-color: var(--line); color: var(--ink) }
.level-actions .btn.off { border-style: dashed; border-color: var(--line); color: var(--muted); cursor: default }
.level-actions .done-mark { margin-left: .35rem; color: var(--accent); font-weight: 700 }
.weeks > details.wk .path { display: grid; gap: .5rem }
.card.program.off { opacity: .6; pointer-events: none }
.wk .path .card.program { margin: 0 }
.pill.locked { background: transparent; border: 1px dashed var(--line) }
.step .kind { margin-left: .4rem; color: var(--muted); font-weight: 400 }
article.paperwork form.sign { display: grid; gap: .5rem; max-width: 26rem; font: 400 1rem var(--ui) }
article.paperwork form.sign input[type=text] { font: 400 1.1rem var(--read) }
article.paperwork .check { display: flex; gap: .5rem; align-items: flex-start }
article.paperwork .check input { margin-top: .3rem }
.paid-form { display: flex; gap: .5rem; align-items: center; margin: 0 }
.paid-form input[type=date] { width: auto; margin: 0; padding: .3rem .5rem }
.cells.sized .r { grid-template-columns: var(--cols); align-items: start }
@media (max-width: 34rem) { .cells.sized .r { grid-template-columns: minmax(0, 1fr) } }
.dropzone { margin-top: .75rem }
.drop-target { display: grid; gap: .25rem; justify-items: center; text-align: center; padding: 1.25rem 1rem; border: 2px dashed var(--line); border-radius: 8px; cursor: pointer; background: var(--paper) }
.drop-target input { position: absolute; width: 1px; height: 1px; opacity: 0 }
.dropzone.over .drop-target { border-color: var(--accent); background: var(--wash) }
.drop-list { display: grid; gap: .5rem; margin-top: .6rem }
.drop-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: .2rem .75rem; align-items: center; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px }
.drop-row input[type=text] { grid-column: 1; margin: 0 }
.drop-row small { grid-column: 1; grid-row: 2 }
.drop-row progress { grid-column: 2; grid-row: 1 / span 2; width: 7rem }
.drop-row .drop-state { grid-column: 3; grid-row: 1 / span 2; min-width: 7.5rem }
.drop-row button { grid-column: 4; grid-row: 1 / span 2; font-size: 1.2rem }
.drop-row.ok { border-color: var(--accent) } .drop-row.ok button { display: none }
.drop-row.bad { border-color: var(--error) }
.drop-go { margin-top: .6rem; justify-content: space-between; align-items: center }
@media (max-width: 34rem) { .drop-row { grid-template-columns: minmax(0, 1fr) auto } .drop-row progress, .drop-row .drop-state { grid-column: 1 / -1; grid-row: auto; width: 100% } }
[hidden] { display: none !important }
.drop-row progress { accent-color: var(--accent) }
.notice.next-session { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap }
.notice.next-session .btn { margin: 0 }
