/* What the built studio needs on top of the design's CSS (studio.css): the design used buttons
   where the app uses links, and had no real forms around its controls. */
a.nav-a, a.idlink, a.btn, a.bp-card, .crumbs a, a.link { text-decoration: none }
a.idlink:hover, .crumbs a:hover { text-decoration: underline }
.crumbs a { color: var(--primary); font-weight: 600 }
a.link, .link { color: var(--primary); font-weight: 700; cursor: pointer }
a.bp-card { color: inherit }
.nav-a[aria-disabled="true"] { color: #8b898d; cursor: default; background: transparent }
.side { display: flex; flex-direction: column; gap: 14px }
.side form { margin: 0 }
.side .signout { font-size: 14px; min-height: 36px; color: var(--muted) }
.h1 .code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: inherit; letter-spacing: -0.02em }
.opt-row--app { grid-template-columns: 34px minmax(0, 1fr) auto }
form.inline { display: inline-flex; margin: 0 }
details > summary { cursor: pointer; list-style: none }
details > summary::-webkit-details-marker { display: none }
.sec-h form { margin: 0 }
.secrow + .secrow { margin-top: 0 }
.stage { min-height: 100vh }
.inline-menu { position: relative }
.inline-menu > summary { list-style: none }
.inline-menu .popover { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; padding: 10px; background: var(--moon); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-float); min-width: 320px }
a.cat-open, a.link-btn, a.subcat { text-decoration: none }
a.link-btn { text-decoration: none }
.ttog { display: inline-flex; align-items: center; justify-content: center }
.ttog svg { transition: transform .15s }
.ttog[aria-expanded="true"] svg { transform: rotate(90deg) }
.ttog:hover { background: rgba(33,86,65,.08) }
a.rtype { text-decoration: none; color: var(--ink) }
.rtype[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink) }
.rtype span { font-size: 12px; background: #eef1ef; color: var(--muted); border-radius: 999px; padding: 2px 8px }
.rtype[aria-pressed="true"] span { background: rgba(255,255,255,.18); color: #fff }
.ntype[aria-current="true"] { border-color: var(--primary); background: var(--primary-tint) }
.pin--new { background: var(--accent-red) }
.segs li { padding: 2px 0 }
a.tag { text-decoration: none }
.seg--radio label { font: inherit; font-size: 14px; font-weight: 600; min-height: 34px; padding: 0 12px; border-radius: 8px; display: inline-flex; align-items: center; color: var(--muted); cursor: pointer; position: relative }
.seg--radio input { position: absolute; opacity: 0; pointer-events: none }
.seg--radio label:has(input:checked) { background: var(--moon); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08) }
.seg--radio label:has(input:focus-visible) { box-shadow: var(--focus) }
fieldset[disabled] .input, fieldset[disabled] .select, fieldset[disabled] .textarea { background: #f3f4f3; color: var(--muted) }
.hist li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line) }
.comment--returned { background: var(--warning-tint); border-radius: 8px; padding: 10px 8px }
.pv-audio { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #f5f7f6 }
.pv-play { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px }
.pv-track { display: block; height: 4px; border-radius: 4px; background: #dfe5e2 }
.ph { border-radius: 12px; background: #e7ebe9; min-height: 120px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px }
.cloze-n { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 6px; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; margin: 0 4px }
.cloze-in, .drop { display: inline-block; min-width: 90px; height: 26px; vertical-align: middle; border-bottom: 2px solid var(--line-strong); margin-right: 4px }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 8px }
.bank { display: flex; flex-wrap: wrap; gap: 6px }
.stim-text { white-space: pre-line; font-size: 15px; line-height: 1.65; color: var(--ink); background: #f5f7f6; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; max-height: 320px; overflow: auto }
.stim-text--sheet { background: var(--moon); max-height: 240px }
.stim-img { display: block; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line) }
.stim-new > summary { list-style: none; display: inline-flex }
.stim-new[open] { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #f9faf9 }
.stim-new[open] > summary { margin-bottom: 10px }
a.seg-a { font: inherit; font-size: 14px; font-weight: 600; min-height: 34px; padding: 0 12px; border-radius: 8px; display: inline-flex; align-items: center; color: var(--muted); text-decoration: none }
a.seg-a[aria-pressed="true"] { background: var(--moon); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08) }
a.lvseg { color: var(--ink) }
a.lvseg[aria-pressed="true"] { color: #fff }
a.link-btn .cefr { text-decoration: none }
.cmp thead th.is-hl { background: var(--primary-tint) }
.crit { border: 0; padding: 0; margin: 0 0 4px; min-width: 0 }
.crit legend { padding: 0 0 6px; font-size: 14px; color: var(--ink) }
.bandrow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px }
.bandcell { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--moon); cursor: pointer; font-size: 11px; line-height: 1.35; color: var(--muted); min-height: 92px }
.bandcell b { font-size: 15px; color: var(--ink) }
.bandcell input { position: absolute; opacity: 0; pointer-events: none }
.bandcell:hover { border-color: var(--primary) }
.bandcell:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); color: var(--ink) }
.bandcell:has(input:focus-visible) { box-shadow: var(--focus) }
.grade-total { display: flex; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: 12px; background: #f5f7f6; border: 1px solid var(--line) }
.grade-total b { font-size: 18px; color: var(--ink) }
.answer-text { white-space: pre-line; font-size: 15px; line-height: 1.7; color: var(--ink); background: #f9faf9; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px }
.warn-text { color: var(--warning-ink); font-weight: 700 }
.comment .av { width: auto; min-width: 42px; padding: 0 6px; border-radius: 10px; font-size: 12px }
@media (max-width: 900px) { .bandrow { grid-template-columns: repeat(3, minmax(0, 1fr)) } }

/* ---------- CEFR framework ---------- */
[data-cefr] { transition: opacity .15s }
[data-cefr].htmx-request { opacity: .55 }
.cf-scale { padding: 18px 20px 14px }
.cf-scale-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px }
.cf-ruler { position: relative; padding-bottom: 22px }
.cf-bar { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0 }
.cf-bar li { display: flex; min-width: 0 }
.cf-bar li > a { flex: 1 }
.cf-seg { position: relative; display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 10px 12px 9px; border-radius: 12px; border: 1.5px solid var(--line); background: #f5f7f6; color: var(--ink); text-decoration: none; transition: border-color .15s, background .15s, transform .15s }
.cf-seg:hover { border-color: var(--primary); transform: translateY(-1px) }
.cf-seg b { font-size: 18px; line-height: 1.1 }
.cf-seg-name { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.cf-seg-range { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums }
.cf-seg.is-on { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(33, 86, 65, .25) }
.cf-seg.is-on .cf-seg-name, .cf-seg.is-on .cf-seg-range { color: #e3eee9 }
.cf-seg.is-on::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 14px; height: 14px; background: var(--primary); transform: translateX(-50%) rotate(45deg); border-radius: 2px }
.cf-ticks { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; border-top: 1px dashed var(--line) }
.cf-ticks span { position: absolute; top: 3px; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums }
.cf-ticks span:first-child { transform: none }
.cf-ticks span:last-child { transform: translateX(-100%) }
.cf-hero { display: flex; gap: 20px; align-items: flex-start; padding: 22px 24px }
.cf-code { width: 76px; height: 76px; border-radius: 20px; background: linear-gradient(145deg, var(--primary), var(--ink)); color: #fff; font-weight: 800; font-size: 30px; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 8px 20px rgba(19, 36, 29, .2) }
.cf-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--primary-tint); color: var(--primary); font-variant-numeric: tabular-nums }
.cf-quote { color: var(--ink) }
.cf-global { font-size: 17px; line-height: 1.6; color: var(--ink); max-width: 72ch; margin-top: 4px }
.cf-step { display: flex; gap: 6px; flex: none }
.cf-skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px 20px }
.cf-skill { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: #f7f9f8; border: 1px solid var(--line); font-size: 14px; line-height: 1.55 }
.cf-skill b { color: var(--ink); font-size: 15px }
.cf-ico { width: 38px; height: 38px; border-radius: 12px; background: var(--primary-tint); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex: none }
.cf-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch }
.cf-two > .card { display: flex; flex-direction: column }
.cf-count { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef1ef; color: var(--muted) }
.cf-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; font-size: 14.5px; line-height: 1.45 }
.cf-checks li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line) }
.cf-checks li:last-child { border-bottom: 0 }
.cf-checks svg { color: var(--accent-green); flex: none; margin-top: 3px }
.cf-big { font-size: 30px; font-weight: 800; color: var(--ink); letter-spacing: -.02em }
.cf-vbars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; height: 132px; padding: 4px 0 0 }
.cf-vbar-n { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums }
.cf-vbar.is-on .cf-vbar-n { color: var(--primary) }
.cf-vbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px }
.cf-vbar-fill { width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: #dbe4df }
.cf-vbar b { font-size: 11px; color: var(--muted) }
.cf-vbar.is-on .cf-vbar-fill { background: var(--primary) }
.cf-vbar.is-on b { color: var(--primary) }
.cf-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px }
.cf-tile-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.cf-tile { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: #f7f9f8 }
.cf-tile b { font-size: 26px; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums }
.cf-tile-bar { display: block; height: 4px; border-radius: 4px; background: #e3e8e5; overflow: hidden }
.cf-tile-bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px }
.cf-tile.is-empty b { color: #9aa29e }
.cf-tile.is-empty .link { color: var(--muted); font-weight: 600 }
.cf-empty { padding: 14px; border-radius: 12px; border: 1.5px dashed var(--line); color: var(--muted); font-size: 14px }
.cf-eq-own { background: var(--primary); border-color: var(--primary); color: #e3eee9 }
.cf-eq-own b { color: #fff }
.eq.is-empty b { color: #9aa29e }
.cf-scroll { max-height: 70vh; overflow: auto }
.cf-sticky thead th { position: sticky; top: 0; z-index: 2 }
.cf-sticky tbody th, .cf-sticky thead th:first-child { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--line) }
.cf-sticky thead th:first-child { z-index: 3 }
.cf-compare td { min-width: 190px }
.cf-compare td.is-hl, .cf-compare th.is-hl { background: var(--primary-tint) }
.cf-num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink) }
.cf-dash { color: #9aa29e }
@container stage (max-width: 980px) {
  .cf-two, .cf-skills { grid-template-columns: 1fr }
  .cf-hero { flex-wrap: wrap }
  .cf-seg-name { display: none }
}
@container stage (max-width: 620px) {
  .cf-seg { padding: 8px 6px }
  .cf-seg-range { display: none }
  .cf-ticks span:not(:first-child):not(:last-child) { display: none }
}
.cf-sticky tbody th { min-width: 210px }
.exm.cf-sticky td { min-width: 96px }
@container stage (max-width: 760px) {
  .cf-hero { flex-direction: column; gap: 14px; padding: 18px }
  .cf-code { width: 56px; height: 56px; font-size: 22px; border-radius: 16px }
  .cf-step { align-self: stretch; justify-content: space-between }
  .cf-global { font-size: 16px }
}

/* Home (`/`): what needs attention, the person's sections with counts, their permissions. */
.main > .card + .stack, .main > .stack + .card { margin-top: 0 }
.hm-list { list-style: none; margin: 0; padding: 0 }
.hm-list li + li { border-top: 1px solid var(--line) }
.hm-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 18px; color: inherit; text-decoration: none }
.hm-row:hover { background: var(--row-hover) }
.hm-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--primary) }
.hm-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0 }
.hm-txt b { color: var(--ink) }
.hm-n { min-width: 34px; text-align: center; font-weight: 800; font-size: 15px; padding: 3px 10px; border-radius: 999px; font-variant-numeric: tabular-nums }
.hm-n--review { background: var(--warning-tint); color: var(--warning-ink) }
.hm-n--grade { background: var(--primary-tint); color: var(--primary) }
.hm-n--returned { background: var(--accent-red-tint); color: var(--accent-red-text) }
.hm-ico--review { background: var(--warning-tint); color: var(--warning-ink) }
.hm-ico--returned { background: var(--accent-red-tint); color: var(--accent-red-text) }
.hm-go { color: var(--dollar-gray) }
.hm-row:hover .hm-go { color: var(--primary) }
.hm-clear { display: flex; align-items: center; gap: 12px; margin: 0; padding: 14px 18px }
.hm-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: stretch }
.hm-cards > li { display: flex }
.hm-card { flex: 1; gap: 10px }
.hm-head { display: flex; align-items: center; gap: 10px }
.hm-stat { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px }
.hm-big { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums }
.hm-unit { font-size: 13px; color: var(--muted) }
.hm-none { font-size: 14px; font-weight: 600; color: var(--dollar-gray) }
.hm-note { flex-basis: 100%; min-height: 1.4em; font-size: 12.5px; color: var(--muted) }
.hm-perm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 18px 8px }
.hm-perm-h { margin: 0; font-weight: 700; color: var(--ink) }
.hm-perm-p { margin: 0; padding: 0 18px 14px }
@container stage (max-width: 640px) { .hm-row { padding: 12px 14px; gap: 10px } .hm-go { display: none } }

/* Question bank, categories (`/questionbank/categories`). */
.ct-bar { position: sticky; top: 0; z-index: 5; background: var(--moon); border-radius: var(--radius-card) var(--radius-card) 0 0; align-items: center }
.ct-bar.is-stuck { box-shadow: 0 6px 14px -10px rgba(19,36,29,.35) }
.ct-all button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px }
.ct-sum { white-space: nowrap }
.cattable th { position: static }
.cattable td { padding-top: 6px; padding-bottom: 6px }
.cattable th.num-r { text-align: right }
.cattable th:nth-child(2), .cattable td:nth-child(2) { width: 110px }
.cattable th:nth-child(3), .cattable td:nth-child(3) { width: 220px }
.cattable tbody tr:not(.cat-all):hover td { background: var(--row-hover) }
.cname { gap: 8px }
.ttog { width: 32px; height: 32px; border: 1px solid transparent; color: var(--ink) }
.ttog:hover { border-color: var(--line); background: var(--moon) }
.ttog:focus-visible { outline: none; box-shadow: var(--focus) }
.tsp { width: 32px }
.ct-ico { width: 30px; height: 30px; border-radius: 9px }
.ct-subs { font-size: 12px; font-weight: 600; color: var(--muted); background: #eef1ef; border-radius: 999px; padding: 2px 8px; white-space: nowrap }
.cq-n { font-weight: 700; color: var(--ink) }
.cq-empty { font-size: 13px; color: var(--dollar-gray) }
.catrow--empty .cat-open { font-weight: 500; color: var(--muted) }
.catrow--top.catrow--empty .cat-open { font-weight: 800; color: var(--ink) }
.cq { display: inline-flex; align-items: center; gap: 10px }
.cq-bar { width: 90px; height: 6px; border-radius: 6px; background: #e3e7e5; overflow: hidden; flex: none }
.cq-bar > span { display: block; height: 100%; background: var(--accent-green); border-radius: 6px }
.cq-t { font-size: 13px; color: var(--muted); white-space: nowrap }
.ct-none { margin: 0; padding: 22px 18px; text-align: center; color: var(--muted) }
.ct-new > summary { display: none }
.ct-new:not([open]) { display: none }
.ct-new-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line) }
.ct-new-b { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 16px 18px }
.ct-new-b > .btn { margin-top: 24px }
.ct-new-b [data-cat-skill][hidden] { display: none }
@container stage (max-width: 860px) { .ct-new-b { grid-template-columns: 1fr 1fr } .ct-new-b > .btn { margin-top: 0; justify-self: start } }
@container stage (max-width: 640px) {
  .ct-new-b { grid-template-columns: 1fr }
  .cattable th:nth-child(3), .cattable td:nth-child(3) { width: auto }
  .cq-bar { width: 48px }
  .ct-subs { display: none }
}

/* A category's questions (`/questionbank/categories/{id}/questions`). */
.btn-ghost[disabled] { background: transparent; border-color: transparent; color: var(--dollar-gray); opacity: .55 }
.ca { display: flex; flex-direction: column; gap: 0 }
.ca-bar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--moon) }
.ca:has(.ca-panel.is-open, .ca-panel:target) .ca-bar { border-radius: var(--radius-card) var(--radius-card) 0 0 }
.ca-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 0 8px 0 6px }
.ca-bar .btn { gap: 6px }
.ca-bar a.btn[aria-expanded="true"] { background: var(--primary-tint); color: var(--primary) }
.ca-icon { width: 36px; padding: 0 }
.ca-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px }
.ca-del { color: var(--accent-red-text) }
.ca-bar .ca-del:hover, .ca-bar a.ca-del[aria-expanded="true"] { background: var(--accent-red-tint); color: var(--accent-red-text) }
.ca-panel { display: none; align-items: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-card) var(--radius-card); background: #f7f8f7 }
.ca-panel.is-open, .ca-panel:target { display: flex }
.ca:has(.ca-panel.is-open) .ca-panel:target:not(.is-open) { display: none }
.ca-panel .field { flex: 0 1 380px; margin: 0 }
.ca-panel--danger { background: var(--accent-red-tint); align-items: center }
.ca-panel--danger p { margin: 0; flex: 1 1 260px }
.ca-del-yes { background: var(--accent-red); color: #fff; border-color: var(--accent-red) }
.ca-del-yes:hover { background: var(--accent-red-text) }
.subcat--empty { color: var(--muted); border-color: var(--line) }
.filters .cq-scope { border: 0; padding: 0; margin: 0; min-width: 0; flex: 0 0 auto }
.cq-scope .seg { flex-wrap: nowrap }
.cq-scope .seg label { white-space: nowrap }
.cq-results { transition: opacity .15s }
.cq-results.htmx-request { opacity: .5 }
.qtype { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap }
.qtype svg { color: var(--primary); flex: none }
.cq-empty .h3 { margin: 0 }
.cq-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; width: min(100%, 560px) }
.cq-type { font: inherit; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--moon); color: var(--ink); cursor: pointer; text-align: left }
.cq-type svg { color: var(--primary); flex: none }
.cq-type:hover { border-color: var(--primary); background: var(--primary-tint) }
.cq-type:focus-visible { outline: none; box-shadow: var(--focus) }
@container stage (max-width: 640px) { .cq-types { grid-template-columns: 1fr 1fr } .ca-h { display: none } }
.cq-scope > legend { float: left; width: 100%; padding: 0 }
.cq-scope > legend + * { clear: both }
@container stage (max-width: 640px) {
  .filters .cq-scope { flex: 1 1 100% }
  .cq-scope .seg { display: flex }
  .cq-scope .seg label { flex: 1; justify-content: center }
  .cq-wide { display: none }
}

/* The question editor (`.../questions/{code}`). */
.qe-top { position: sticky; top: 0; z-index: 15; margin: -18px -28px 0; padding: 18px 28px 12px; background: transparent; transition: box-shadow .15s, background .15s }
.qe-top.is-stuck { background: var(--g-fill); backdrop-filter: blur(var(--g-blur)) saturate(var(--g-sat)); -webkit-backdrop-filter: blur(var(--g-blur)) saturate(var(--g-sat)); box-shadow: 0 8px 18px -14px rgba(19,36,29,.45); border-bottom: 1px solid var(--line); padding-top: 10px; padding-bottom: 10px }
.qe-top.is-stuck .crumbs { display: none }
.qe-top.is-stuck .h1 { font-size: 20px !important }
.qe-dirty { color: var(--warning-ink); font-weight: 700; display: inline-flex; align-items: center; gap: 6px }
.qe-dirty::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warning-line) }
.qe-dirty[hidden] { display: none }
.qe-dirty[data-state="saved"] { color: var(--accent-green-ink) }
.qe-dirty[data-state="saved"]::before { background: var(--accent-green) }
.qe-dirty[data-state="error"] { color: var(--accent-red-text) }
.qe-dirty[data-state="error"]::before { background: var(--accent-red) }
.qe-msgs { scroll-margin-top: calc(var(--qe-top, 80px) + 12px) }
.qe-save.is-dirty { background: var(--primary); color: #fff; border-color: var(--primary) }
.qe-save.htmx-request { opacity: .6; pointer-events: none }
.qe-msgs:empty { display: none }
.qe-msgs { display: flex; flex-direction: column; gap: 10px }
.qe-flash { animation: qe-flash .9s ease-out }
@keyframes qe-flash { from { box-shadow: 0 0 0 4px rgba(22,122,61,.35) } to { box-shadow: 0 0 0 0 rgba(22,122,61,0) } }
.qe-side { top: calc(var(--qe-top, 80px) + 12px); max-height: calc(100vh - var(--qe-top, 80px) - 24px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-bottom: 2px }
.stim-tabs { display: flex; flex-direction: column; gap: 0 }
.stim-seg { align-self: flex-start; border-radius: 10px 10px 0 0 }
.stim-seg label { gap: 6px }
.stim-seg svg { flex: none }
.stim-panel { display: none; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 0 12px 12px 12px; background: #f9faf9 }
.stim-panel > .btn { align-self: flex-start }
.stim-tabs:has(input[value="lib"]:checked) .stim-panel[data-tab="lib"],
.stim-tabs:has(input[value="passage"]:checked) .stim-panel[data-tab="passage"],
.stim-tabs:has(input[value="audio"]:checked) .stim-panel[data-tab="audio"],
.stim-tabs:has(input[value="video"]:checked) .stim-panel[data-tab="video"],
.stim-tabs:has(input[value="image"]:checked) .stim-panel[data-tab="image"] { display: flex }
@container stage (max-width: 980px) {
  .qe-side { max-height: none; overflow: visible }
  .qe-top { margin: -8px -4px 0; padding: 8px 4px 10px }
}
@container stage (max-width: 640px) {
  .stim-seg { align-self: stretch; border-radius: 10px }
  .stim-panel { border-radius: 12px; margin-top: 8px }
}
.qe-type { font-size: 13px; font-weight: 700; color: var(--ink); background: var(--primary-tint); border-radius: 999px; padding: 3px 10px 3px 8px }

/* ---------- blueprint: preview in sala (dialog with the sala page in a frame) ---------- */
.bp-pv-ico { width: 18px; height: 18px; flex: none }
.bp-pv { width: min(1320px, calc(100vw - 32px)); height: calc(100vh - 32px); max-width: none; max-height: none; padding: 0; border: 0; border-radius: 20px; background: var(--paper); box-shadow: 0 24px 60px rgba(0,0,0,.3); overflow: hidden }
.bp-pv[open] { display: flex; flex-direction: column }
.bp-pv::backdrop { background: rgba(19,36,29,.55) }
.bp-pv-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--moon); border-bottom: 1px solid var(--line) }
.bp-pv-what { min-width: 0; flex: 1 1 320px }
.bp-pv-what b { color: var(--ink) }
.bp-pv-bar .spacer { display: none }
.bp-pv-from { width: auto; max-width: 260px; min-height: 36px; font-size: 14px }
.bp-pv-body { flex: 1; min-height: 0; display: flex; justify-content: center; padding: 16px; overflow: auto; background: #dfe3e0 }
.bp-pv-dev { width: 100%; height: 100%; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.15); background: var(--paper); transition: width .2s }
.bp-pv-dev iframe { display: block; width: 100%; height: 100%; border: 0 }
.bp-pv-dev.is-phone { width: 410px; height: min(864px, 100%); flex: none; border: 10px solid #1c191c; border-radius: 44px }
@media (prefers-reduced-motion: reduce) { .bp-pv-dev { transition: none } }

/* Attempts (.at-) */
.at-ev { min-height: 34px; font-size: 14px; width: auto; min-width: 11rem }
.at-due { white-space: nowrap }
.at-due--soon { color: var(--warning-ink); font-weight: 600 }
.at-due--late { color: var(--accent-red-text); font-weight: 600 }

/* Sidebar foot: the account link (name only) and sign out, pinned to the bottom of the menu. */
.app > .side { min-height: calc(100dvh - 24px) }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line) }
.side-foot .me { margin: 0; border: 0; padding: 6px; flex: 1; min-width: 0; border-radius: 12px; color: var(--ink); text-decoration: none }
.side-foot .me:hover, .side-foot .me[aria-current="page"] { background: var(--primary-tint) }
.side-foot .me b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.side-foot .signout { color: var(--muted); min-height: 40px; min-width: 40px }
.acc-who { align-items: center }
.acc-av { width: 56px; height: 56px; font-size: 20px }
@container stage (max-width:980px) {
  .app > .side { min-height: 0 }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0 }
  .side-foot .me { display: flex; flex: none }
  .side-foot .me b { display: none }
}
