/* CraftsmanTeams additions on top of the Academy's app.css (same look, same tokens). The Academy follows the phone's
   light/dark setting only; Teams adds an explicit toggle, so the dark tokens are repeated under [data-theme=dark]
   and the light ones restored under [data-theme=light]. */
:root[data-theme="dark"] {
    --ground: #16170E;
    --surface: #1F2018;
    --raised: #2A2B20;
    --chip: #34362A;
    --text: var(--cream);
    --muted: rgba(240, 233, 200, .74);
    --soft: rgba(240, 233, 200, .62);
    --line: rgba(240, 233, 200, .14);
    --line-strong: rgba(240, 233, 200, .32);
    --action: #C0533B;
    --selected: var(--cream);
    --on-selected: var(--olive);
    --done: var(--cream);
    --here: rgba(240, 233, 200, .07);
    --track: rgba(240, 233, 200, .14);
    --ok: #8CC79B;
    --ok-soft: rgba(140, 199, 155, .12);
    --bad: #E0876F;
    --bad-soft: rgba(224, 135, 111, .12);
}
:root[data-theme="light"] {
  --ground: #F8F5EA; --surface: #FFFDF8; --raised: #F1EDDF; --chip: var(--cream); --text: var(--olive); --muted: #454A35;
  --soft: #6B6F5A; --line: rgba(41, 43, 28, .16); --line-strong: rgba(41, 43, 28, .30); --action: var(--brick);
  --selected: var(--olive); --on-selected: var(--cream); --done: var(--olive); --here: rgba(41, 43, 28, .06);
  --track: rgba(41, 43, 28, .10); --ok: #2E5A36; --ok-soft: rgba(46, 90, 54, .10); --bad: var(--brick); --bad-soft: rgba(168, 65, 44, .09);
}
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

.topright { display: inline-flex; gap: var(--s2); align-items: center; }
.themebtn { padding: 0; width: 44px; font-size: 1.15rem; cursor: pointer; }
.top.inner .themebtn { min-height: 36px; width: 36px; }
.top.inner .brand { display: none; }   /* phone: the page name needs the room; the badge returns on desktop */
@media (min-width: 640px) { .top.inner .brand { display: inline-flex; } }

.form { display: grid; gap: var(--s4); padding: var(--s5) var(--s4); max-width: 28rem; }
.form label { display: grid; gap: var(--s2); font-weight: 600; font-size: .98rem; }
.form input { font: inherit; font-weight: 400; min-height: 48px; padding: 0 var(--s4); border-radius: var(--small-radius);
  border: 1px solid var(--line-strong); background: var(--ground); color: var(--text); width: 100%; }
.form input:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.form p { margin: 0; }
.btn.primary { background: var(--selected); color: var(--on-selected); border-color: var(--selected); min-height: 48px; cursor: pointer; font: inherit; font-weight: 600; }
button.btn { cursor: pointer; font: inherit; font-weight: 600; }
.formmsg { min-height: 1.4em; color: var(--bad); font-weight: 600; font-size: .95rem; }
.formmsg.ok { color: var(--ok); }
.signin { padding-top: var(--s4); }
.page-signin main { padding-top: var(--s5); }

.playbooklist .mhead { border-bottom: 1px solid var(--line); }
.playbooklist { max-width: 42rem; }
.adminpage { max-width: 60rem; }
table.grid { border-collapse: collapse; width: 100%; font-size: .95rem; }
table.grid th { text-align: left; font-weight: 600; font-size: .82rem; padding: var(--s3); border-bottom: 1.5px solid var(--line-strong); white-space: nowrap; }
table.grid td { padding: var(--s3); border-bottom: 1px solid var(--line); }
table.grid td.yes { color: var(--ok); font-weight: 700; text-align: center; }
table.grid th.lh { text-align: center; max-width: 7rem; white-space: normal; font-weight: 500; }
.adminpage .tablewrap { padding: 0; }
.offline-note { color: var(--soft); font-size: .85rem; }
.page-lessonpage main, .page-playbook main { padding-top: var(--s3); }

/* ---------------------------------------------------------------- lesson reader: one idea per screen, room to breathe */
.page-lessonpage main { padding-top: var(--s2); }
.reader { display: flex; flex-direction: column; min-height: calc(100svh - 9rem); padding: var(--s4) var(--s1) var(--s6); font-size: 1.125rem; line-height: 1.6; }
.reader .lessontitle { font-size: clamp(1.9rem, 8vw, 2.4rem); line-height: 1.12; margin: 0 0 var(--s5); }
.reader .stephead { font-size: clamp(1.6rem, 7vw, 2.1rem); line-height: 1.15; margin: var(--s4) 0 var(--s5); }
.reader .lchips { margin: var(--s4) 0 var(--s3); }
.reader .kicker { margin: 0 0 var(--s4); font-family: var(--label); font-weight: 700; text-transform: uppercase; letter-spacing: .09em; font-size: .8rem; color: var(--soft); }
.reader .lead { color: var(--muted); margin: 0 0 var(--s5); }
.reader .prose { flex: 1; }
.reader .prose p { margin: 0 0 var(--s5); }
.reader .prose h2 { font-size: 1.6rem; line-height: 1.2; margin: var(--s6) 0 var(--s4); }
.reader .prose > h2:first-child { margin-top: var(--s2); }
.reader .prose ul, .reader .prose ol { padding-left: 1.4rem; margin: 0 0 var(--s5); }
.reader .prose li { margin-bottom: var(--s4); padding-left: var(--s1); }

.stepbar { margin: 0 0 var(--s4); }
.steptxt { margin: 0 0 var(--s2); font-size: .88rem; font-weight: 600; color: var(--soft); line-height: 1.3; }
.segs { display: flex; gap: 4px; }
.seg { flex: 1; height: 5px; border-radius: 3px; background: var(--track); }
.seg.on { background: var(--selected); }

.actions { display: grid; gap: var(--s3); margin-top: var(--s6); padding-top: var(--s2); }
.bigbtn { display: flex; align-items: center; justify-content: center; gap: var(--s2); width: 100%; min-height: 3.5rem; padding: var(--s3) var(--s5);
  border-radius: 999px; border: 1px solid var(--selected); font: inherit; font-size: 1.05rem; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; text-align: center; }
.bigbtn.primary { background: var(--selected); color: var(--on-selected); }
.bigbtn.quiet { background: transparent; color: var(--text); border-color: var(--line-strong); }
.bigbtn:disabled { opacity: .4; cursor: default; }
.bigbtn:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.bigbtn.mark.on { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.bigbtn .tick { width: 1.5rem; height: 1.5rem; }
.bigbtn.mark .tick circle, .bigbtn.mark .tick path { stroke: currentColor; }
.reader .nextlink { padding: var(--s4); }

/* the check: with script, one screen at a time; without, they stack with room between */
.checkpage .screen { margin: 0 0 var(--s7); }
.js .checkpage .screen { display: none; margin: 0; }
.js .checkpage .screen.cur { display: block; }
.checkpage .q { margin: 0; }
.checkpage .q legend { font-size: 1.3rem; line-height: 1.35; font-weight: 600; margin-bottom: var(--s5); gap: var(--s3); }
.checkpage .qn { width: 2rem; height: 2rem; }
.checkpage .opts { gap: var(--s3); }
.checkpage .opt { padding: var(--s4); min-height: 3.5rem; font-size: 1.05rem; line-height: 1.45; }
.checkpage .feedback { margin-top: var(--s5); }
.checkpage .feedback .verdict { font-size: 1.05rem; line-height: 1.5; margin: 0 0 var(--s3); }
.checkpage .retry { min-height: 44px; padding: 0 var(--s4); font: inherit; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--text); cursor: pointer; }
.checkpage .actions { margin-top: var(--s6); }

/* ---------------------------------------------------------------- back link and playbook lesson cards */
.backlink { display: inline-flex; align-items: center; gap: var(--s1); min-height: 44px; margin: var(--s2) 0 0 -6px; padding: 0 var(--s3) 0 var(--s1);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 1rem; border-radius: 999px; }
.backlink .chev { width: 1.3rem; height: 1.3rem; }
.backlink:hover { background: var(--here); }
.backlink:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.playbookprog { max-width: 42rem; padding: var(--s2) 0 var(--s4); }

.lessoncards { list-style: none; margin: 0; padding: 0; max-width: 42rem; display: grid; gap: var(--s5); }
.lessoncard { padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.lessoncard a { display: grid; grid-template-columns: auto 1fr; gap: var(--s4); align-items: start; padding: var(--s4); text-decoration: none; color: var(--text); min-height: 6.5rem; }
.lessoncard a:hover { background: var(--here); }
.lessoncard a:focus-visible { outline: 3px solid var(--action); outline-offset: -3px; }
.lnum { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 4.4rem; height: 4.4rem; border-radius: var(--small-radius);
  background: var(--selected); color: var(--on-selected); font-family: var(--label); text-transform: uppercase; line-height: 1; }
.lnum small { font-size: .68rem; font-weight: 700; letter-spacing: .1em; margin-bottom: 2px; }
.lnum b { font-size: 2.1rem; font-weight: 800; }
.lbody { display: grid; gap: var(--s2); min-width: 0; }
.lk { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lt { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.ls { color: var(--muted); font-size: 1rem; line-height: 1.45; }
.lm { color: var(--soft); font-size: .88rem; font-weight: 600; letter-spacing: .02em; }
.ldone { display: none; grid-column: 1 / -1; align-items: center; gap: var(--s2); color: var(--ok); font-weight: 700; font-size: .95rem; padding-top: var(--s3); border-top: 1px solid var(--line); }
.ldone .state { display: inline-flex; }
.ldone .tick circle { fill: var(--ok); stroke: var(--ok); }
.ldone .tick path { stroke: var(--surface); }
.lessoncard.is-done .ldone { display: flex; }
.lessoncard.is-done { border-color: var(--ok); }

/* narration player at the top of a step */
.listen { margin: 0 0 var(--s4); }
.listenlbl { margin: 0 0 var(--s2); font-size: .88rem; font-weight: 600; color: var(--soft); }
.listen audio { display: block; width: 100%; min-height: 54px; }

/* ---------------------------------------------------------------- admin: People (owner only), phone first */
.peoplebox { max-width: 42rem; margin-bottom: var(--s6); }
.peoplebox > .muted { margin: 0 0 var(--s3); }
.peoplebox > .formmsg:empty { min-height: 0; }
.peoplelist { list-style: none; margin: 0 0 var(--s4); padding: 0; display: grid; gap: var(--s3); }
.personcard { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: var(--s4); display: grid; gap: var(--s2); }
.personcard.st-off { opacity: .78; border-style: dashed; }
.prow { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.pname { font-size: 1.15rem; font-weight: 700; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.pstatus { flex: none; font-size: .82rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--chip); color: var(--text); }
.st-active .pstatus { background: var(--ok-soft); color: var(--ok); }
.st-off .pstatus { background: var(--bad-soft); color: var(--bad); }
.pmeta { margin: 0; color: var(--muted); font-size: .95rem; overflow-wrap: anywhere; }
.pacts { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.pbtn { min-height: 48px; padding: 0 var(--s4); border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); flex: 1 1 8rem; }
.pbtn.primary { background: var(--selected); color: var(--on-selected); border-color: var(--selected); }
.pbtn:disabled { opacity: .5; cursor: default; }
.pbtn:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.pconfirm { border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s2); }
.pq { margin: 0; font-weight: 600; }
.addopen { margin-bottom: var(--s4); }
.addform { margin-bottom: var(--s4); }
.form select { font: inherit; font-weight: 400; min-height: 48px; padding: 0 var(--s4); border-radius: var(--small-radius);
  border: 1px solid var(--line-strong); background: var(--ground); color: var(--text); width: 100%; }
.form select:focus-visible { outline: 3px solid var(--action); outline-offset: 2px; }
.form .hint { font-weight: 400; font-size: .85rem; color: var(--soft); }
.form .btn { min-height: 48px; }
.form[hidden], .pconfirm[hidden] { display: none; }   /* .form sets display: grid, which would beat the hidden attribute */
