/* Property of Sistema THEAD. All rights reserved. */
/* teachers.css — lesson-plan library + generator (teachers.html).
 * The design is the teachers mockup (v8), unchanged; additions for the real
 * page are at the end. Brand values mirror tokens.css. */
:root {
  /* Brand (mirrors apps/client/public/assets/styles/tokens.css) */
  --ink: #03283f;
  --blue: #0080C9;
  --blue-deep: #006ba8;
  --blue-hover: #0072b3;
  --blue-soft: #e5f2fa;
  --yellow: #F59C00;
  --yellow-hover: #e08e00;
  --yellow-soft: #fff3dc;

  /* Studio UI */
  --ui-bg: #ffffff;
  --ui-soft: #f4f7f9;
  --ui-line: #e2e8ec;
  --ui-line-strong: #cdd6dc;
  --ui-text: #14262f;
  --ui-muted: #607480;
  --canvas: #dde6ec;
  --danger: #b3261e;
  --radius: 6px;
  --side-w: 380px;
  --ui-font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Printed document: ink + brand blue, brand yellow as second spot colour */
  --doc-serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --d-ink: #17252d;
  --d-spot: #0077bb;
  --d-tint: #e8f3fa;
  --d-hair: #c7d0d6;
  --d-muted: #5a6972;
  --d-yellow: #F59C00;
  --d-yellow-tint: #fff4df;
  --d-yellow-ink: #845000;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  font-family: var(--ui-font); font-size: 14px; line-height: 1.45;
  color: var(--ui-text); background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ================= App frame ================= */
.app { position: relative; height: 100vh; height: 100dvh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.gutter { position: absolute; top: 0; bottom: 0; z-index: 5; left: calc(var(--side-w) - 4px); width: 9px; cursor: col-resize; touch-action: none; }
.gutter::after { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; width: 1px; transition: background .15s; }
.gutter:hover::after, .gutter.is-drag::after, .gutter:focus-visible::after { background: var(--blue); width: 2px; left: 3px; }
.gutter:focus-visible { outline: none; }

/* ================= Left pane ================= */
.side { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--ui-bg); border-right: 1px solid var(--ui-line); }
.side-head { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 14px; background: var(--blue); color: #fff; }
.side-head img { height: 38px; width: auto; display: block; flex: none; }
.side-name { flex: 1; min-width: 0; line-height: 1.2; }
.side-name strong { display: block; font-size: 14px; font-weight: 700; }
.side-name span { display: block; font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 32px; height: 32px; flex: none; display: inline-grid; place-items: center; border: 0; border-radius: var(--radius); background: none; color: inherit; cursor: pointer; }
.side-head .icon-btn:hover { background: rgba(255,255,255,.16); }
.side-head .icon-btn:focus-visible { outline-color: #fff; }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 20px; }

/* ---- Filters ---- */
.f-title { font-size: 20px; font-weight: 700; letter-spacing: -0.012em; line-height: 1.25; margin: 16px 0 4px; }
.f-sub { margin: 0 0 14px; color: var(--ui-muted); font-size: 13px; }
.search { position: relative; }
.search svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ui-muted); }
.search input {
  width: 100%; min-height: 40px; padding: 8px 12px 8px 34px; font-size: 14px;
  border: 1px solid var(--ui-line-strong); border-radius: var(--radius); background: #fff;
}
.search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,128,201,.16); }
.group-label { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; font-weight: 600; color: var(--ui-muted); margin: 18px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 5px 11px;
  border: 1px solid var(--ui-line-strong); border-radius: var(--radius);
  font-size: 13px; font-weight: 500; background: #fff; cursor: pointer; user-select: none;
}
.chip:hover { border-color: var(--blue); }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.chip svg.i { width: 13px; height: 13px; stroke-width: 2.4; display: none; }
.chip.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.is-on svg.i { display: block; }
.chip.is-focus { outline: 2px solid var(--ink); outline-offset: 2px; }
.props { margin-top: 18px; border-top: 1px solid var(--ui-line); }
.prop { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; min-height: 42px; border-bottom: 1px solid var(--ui-line); }
.prop > label { font-size: 13px; color: var(--ui-muted); }
.prop select, .prop input {
  -webkit-appearance: none; appearance: none; width: 100%; min-height: 34px;
  border: 1px solid transparent; border-radius: var(--radius); background-color: transparent;
  font-size: 13.5px; font-weight: 500; padding: 6px 28px 6px 8px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23607480' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.prop input { background-image: none; padding-right: 8px; }
.prop select:hover, .prop input:hover { background-color: var(--ui-soft); }
.prop select:focus-visible, .prop input:focus-visible { outline: none; border-color: var(--blue); background-color: #fff; }
.prop.is-set select { color: var(--blue-deep); font-weight: 700; }
.side-foot { padding: 12px 16px 14px; border-top: 1px solid var(--ui-line); background: #fff; }
.count-row { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; font-size: 13px; color: var(--ui-muted); }
.count-row strong { color: var(--blue-deep); font-size: 15px; }
.linkish { border: 0; background: none; padding: 0; font-size: inherit; color: var(--blue-deep); font-weight: 600; cursor: pointer; }
.linkish:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--radius); font-weight: 600; font-size: 14px; cursor: pointer; border: 1px solid transparent; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-accent { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.btn-accent:hover:not(:disabled) { background: var(--yellow-hover); border-color: var(--yellow-hover); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover:not(:disabled) { background: var(--blue-hover); }
.btn-quiet { background: #fff; border-color: var(--ui-line-strong); }
.btn-quiet:hover { background: var(--ui-soft); }
.btn-wide { width: 100%; }
.btn svg.i { width: 15px; height: 15px; fill: currentColor; stroke: none; }

/* ---- Plan view / thread ---- */
.back { display: inline-flex; align-items: center; gap: 4px; margin: 12px 0 12px -6px; padding: 5px 8px; border: 0; border-radius: var(--radius); background: none; color: var(--blue-deep); font-weight: 600; font-size: 13px; cursor: pointer; }
.back:hover { background: var(--blue-soft); }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.m-origin { border: 1px solid var(--ui-line); border-left: 3px solid var(--blue); background: var(--ui-soft); border-radius: var(--radius); padding: 11px 12px 10px; }
.m-origin.is-ai { border-left-color: var(--yellow); }
.m-origin .who { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--ui-muted); margin: 0 0 3px; }
.m-origin .who svg.i { width: 14px; height: 14px; }
.m-origin.is-ai .who svg.i { fill: var(--yellow); stroke: none; }
.m-origin .q { font-size: 14.5px; font-weight: 700; margin: 0 0 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11.5px; padding: 2px 7px; background: #fff; border: 1px solid var(--ui-line); border-radius: 4px; color: #45575f; }
.m-user { align-self: flex-end; max-width: 88%; background: var(--blue-soft); border: 1px solid #cfe5f3; border-radius: 8px; padding: 8px 12px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.m-ai { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; font-size: 14px; }
.m-ai .mark { width: 20px; height: 20px; margin-top: 1px; color: var(--yellow); }
.m-ai .mark svg { width: 20px; height: 20px; fill: currentColor; }
.m-ai p { margin: 0 0 6px; }
.m-ai .muted { color: var(--ui-muted); }
.ver { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 6px; padding: 8px 12px 8px 8px; text-align: left; cursor: pointer; border: 1px solid var(--ui-line-strong); border-radius: 8px; background: #fff; }
.ver:hover { border-color: var(--blue); }
.ver[aria-current="true"] { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.ver .thumb {
  width: 28px; height: 38px; flex: none; border: 1px solid var(--ui-line-strong); background: #fff;
  background-image: linear-gradient(var(--yellow), var(--yellow)), linear-gradient(var(--blue), var(--blue)),
    linear-gradient(#c9d0d5, #c9d0d5), linear-gradient(#c9d0d5, #c9d0d5), linear-gradient(#c9d0d5, #c9d0d5);
  background-size: 6px 2px, 16px 3px, 18px 2px, 12px 2px, 18px 2px;
  background-position: 5px 5px, 5px 9px, 5px 16px, 5px 21px, 5px 26px; background-repeat: no-repeat;
}
.ver .txt { flex: 1; min-width: 0; line-height: 1.3; }
.ver strong { display: block; font-size: 13.5px; }
.ver small { display: block; font-size: 12px; color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ver .now { font-size: 11px; font-weight: 700; color: var(--blue-deep); white-space: nowrap; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; color: var(--ui-muted); }
.steps li { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.steps li.done { color: var(--ui-text); }
.steps li.done svg.i { color: var(--blue); }
.steps li .dot { width: 14px; height: 14px; display: inline-grid; place-items: center; flex: none; }
.steps li .dot::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--ui-line-strong); }
.steps li.done .dot::before { content: none; }
.steps li.now .dot::before { width: 12px; height: 12px; background: none; border: 2px solid var(--ui-line-strong); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Composer ---- */
.composer-wrap { padding: 10px 14px 12px; border-top: 1px solid var(--ui-line); background: #fff; }
.editing-on { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ui-muted); margin: 0 2px 8px; }
.suggest { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.suggest::-webkit-scrollbar { display: none; }
.suggest button { flex: none; font-size: 12.5px; padding: 5px 10px; cursor: pointer; border: 1px solid var(--ui-line-strong); border-radius: var(--radius); background: #fff; color: #37505c; }
.suggest button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue-deep); }
.suggest button:disabled { opacity: .5; cursor: default; }
.code-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 8px 6px 10px; background: var(--yellow-soft); border-radius: var(--radius); font-size: 12.5px; }
.code-row label { font-weight: 600; color: var(--d-yellow-ink); }
.code-row input { min-height: 30px; padding: 4px 8px; border: 1px solid #efd7a7; border-radius: 4px; background: #fff; font-size: 13px; }
.code-row input:focus { outline: none; border-color: var(--blue); }
.code-row.is-invalid input { border-color: var(--danger); }
.composer { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--ui-line-strong); border-radius: 8px; padding: 8px 8px 8px 12px; background: #fff; }
.composer:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 128, 201, 0.15); }
.composer textarea { flex: 1; min-width: 0; min-height: 22px; max-height: 160px; resize: none; border: 0; outline: 0; padding: 4px 0; font-size: 14px; line-height: 1.45; background: transparent; }
.send { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--radius); background: var(--blue); color: #fff; cursor: pointer; }
.send:hover:not(:disabled) { background: var(--blue-hover); }
.send:disabled { background: var(--ui-line-strong); cursor: default; }
.fine { font-size: 11.5px; color: var(--ui-muted); margin: 8px 2px 0; text-align: center; }
.fine .linkish { font-weight: 500; color: inherit; text-decoration: underline; }

/* ================= Right pane ================= */
.viewer { position: relative; min-width: 0; min-height: 0; background: var(--canvas); }
.viewer-scroll { position: absolute; inset: 0; overflow: auto; padding: 28px 32px 96px; outline: none; }

/* ---- Library gallery ---- */
.gallery { max-width: 1180px; margin: 0 auto; }
.g-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 20px; }
.g-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.012em; }
.g-head p { margin: 2px 0 0; color: var(--ui-muted); font-size: 13px; }
.g-count { flex: none; padding: 4px 10px; border-radius: 999px; background: var(--blue); color: #fff; font-size: 12.5px; font-weight: 700; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, 232px); gap: 28px 24px; justify-content: start; }
.g-card { display: flex; flex-direction: column; gap: 3px; width: 232px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.g-thumb { position: relative; display: block; width: 232px; height: 328px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.08); transition: box-shadow .15s, transform .15s; margin-bottom: 8px; }
.g-thumb > .page { position: absolute; top: 0; left: 0; transform-origin: 0 0; transform: scale(0.2922); pointer-events: none; }
.g-card:hover .g-thumb, .g-card:focus-visible .g-thumb { box-shadow: 0 0 0 2px var(--blue), 0 10px 24px rgba(0,60,100,0.16); transform: translateY(-2px); }
.g-card:focus-visible { outline: none; }
.g-title { font-size: 14px; font-weight: 700; line-height: 1.3; }
.g-meta { font-size: 12px; color: var(--ui-muted); }
.g-uses { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--blue-deep); }
.g-uses svg.i { width: 14px; height: 14px; }
.g-badge { position: absolute; top: 10px; left: 10px; z-index: 1; padding: 3px 8px; background: var(--yellow); color: var(--ink); font-size: 11px; font-weight: 700; }
.g-new .g-thumb { display: grid; place-items: center; align-content: center; gap: 10px; background: var(--yellow-soft); box-shadow: inset 0 0 0 2px var(--yellow); color: var(--d-yellow-ink); text-align: center; padding: 24px; }
.g-new .g-thumb svg { width: 34px; height: 34px; fill: var(--yellow); }
.g-new .g-thumb strong { font-size: 15px; color: var(--ink); }
.g-new .g-thumb span { font-size: 12.5px; }
.g-new:hover .g-thumb, .g-new:focus-visible .g-thumb { box-shadow: inset 0 0 0 2px var(--yellow), 0 10px 24px rgba(120,80,0,0.14); }
.g-empty { max-width: 460px; margin: 60px auto 0; text-align: center; }
.g-empty > svg.i { width: 40px; height: 40px; color: var(--blue); stroke-width: 1.4; }
.g-empty h3 { margin: 10px 0 6px; font-size: 18px; }
.g-empty p { margin: 0 0 18px; color: var(--ui-muted); }
.g-empty .row { display: flex; gap: 8px; justify-content: center; }

/* ---- Document pages ---- */
.pages { position: relative; display: flex; flex-direction: column; align-items: center; gap: 20px; transition: opacity .2s; }
.viewer.is-updating .pages { opacity: 0.45; }
.pg-wrap { position: relative; flex: none; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.06), 0 2px 6px rgba(0,0,0,0.08), 0 12px 28px rgba(0,0,0,0.06); }
.pg-wrap > .page { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.update-pill { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--blue); color: #fff; font-size: 12.5px; font-weight: 600; border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,60,100,.25); }
.update-pill::before { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }
.vbar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 2px; padding: 4px; background: #fff; border: 1px solid var(--ui-line-strong); border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 40, 55, 0.16); white-space: nowrap; }
.vbar button { height: 32px; min-width: 32px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 5px; background: none; font-size: 13px; cursor: pointer; }
.vbar button:hover:not(:disabled) { background: var(--blue-soft); }
.vbar button:disabled { opacity: .35; cursor: default; }
.vbar .readout { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; color: #37505c; }
.vbar .sep { width: 1px; height: 20px; background: var(--ui-line); margin: 0 4px; }
.vbar .primary { background: var(--yellow); color: var(--ink); font-weight: 700; padding: 0 12px; }
.vbar .primary:hover:not(:disabled) { background: var(--yellow-hover); }
.menu-anchor { position: relative; }
.menu { position: absolute; right: 0; bottom: calc(100% + 10px); width: max-content; min-width: 230px; padding: 4px; background: #fff; border: 1px solid var(--ui-line-strong); border-radius: 8px; box-shadow: 0 10px 30px rgba(20, 40, 55, 0.16); }
.menu button { display: flex; width: 100%; justify-content: flex-start; height: 34px; padding: 0 12px; }
.menu .menu-sep { height: 1px; background: var(--ui-line); margin: 4px 2px; }
.toast { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 6; max-width: calc(100% - 32px); padding: 9px 14px; border-radius: var(--radius); background: var(--ink); color: #fff; font-size: 13px; font-weight: 500; box-shadow: 0 8px 22px rgba(0,0,0,.2); }

/* ================= The printed page ================= */
.page {
  width: 794px; height: 1123px; overflow: hidden; background: #fff;
  font-family: var(--doc-serif); font-size: 13.5px; line-height: 1.52; color: var(--d-ink);
  font-optical-sizing: auto; font-kerning: normal; hyphens: auto;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.pg-head, .pg-foot { position: absolute; left: 68px; right: 68px; display: flex; justify-content: space-between; align-items: center; font-family: var(--ui-font); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--d-muted); }
.pg-head { top: 38px; padding-bottom: 8px; border-bottom: 0.75px solid var(--d-hair); }
.pg-head .brand { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--d-spot); }
.pg-head .brand i { width: 8px; height: 8px; background: var(--d-yellow); display: inline-block; }
.pg-foot { bottom: 34px; padding-top: 8px; border-top: 0.75px solid var(--d-hair); letter-spacing: 0.06em; text-transform: none; }
.pg-foot .num { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; background: var(--d-spot); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0; }
.pg-body { position: absolute; top: 84px; left: 68px; right: 68px; height: 966px; overflow: hidden; display: flow-root; }
.pg-body > .atom:first-child > :first-child { margin-top: 0; }

.d-accent { display: flex; gap: 4px; margin: 6px 0 14px; }
.d-accent i { display: block; height: 6px; }
.d-accent i:first-child { width: 44px; background: var(--d-spot); }
.d-accent i:last-child { width: 18px; background: var(--d-yellow); }
.d-kicker { font-family: var(--ui-font); font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--d-spot); margin: 0 0 10px; }
.d-title { font-family: var(--doc-serif); font-weight: 600; font-size: 38px; line-height: 1.08; letter-spacing: -0.018em; margin: 0 0 12px; }
.d-dek { font-style: italic; font-size: 16px; line-height: 1.45; color: #3a4850; margin: 0 0 22px; max-width: 590px; }
.d-ficha { display: grid; grid-template-columns: 1fr 1fr 1fr; margin: 0 0 22px; border-top: 2px solid var(--d-spot); border-bottom: 1.5px solid var(--d-ink); }
.d-ficha > div { padding: 8px 12px 9px; border-left: 0.75px solid var(--d-hair); }
.d-ficha > div:nth-child(3n+1) { border-left: 0; padding-left: 0; }
.d-ficha > div:nth-child(n+4) { border-top: 0.75px solid var(--d-hair); }
.d-ficha dt { font-family: var(--ui-font); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--d-muted); margin: 0 0 2px; }
.d-ficha dd { margin: 0; font-family: var(--ui-font); font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.d-glance { margin: 0 0 8px; }
.d-glance-h { display: flex; justify-content: space-between; font-family: var(--ui-font); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--d-muted); margin: 0 0 6px; }
.d-bar, .d-bar-l { display: flex; gap: 2px; }
.d-bar span { height: 20px; display: flex; align-items: center; padding-left: 6px; font-family: var(--ui-font); font-size: 10px; font-weight: 700; min-width: 0; background: var(--d-spot); color: #fff; }
.d-bar span:nth-child(even) { background: var(--d-yellow); color: var(--ink); }
.d-bar-l span { hyphens: manual; font-family: var(--ui-font); font-size: 9.5px; line-height: 1.25; padding: 5px 4px 0 0; min-width: 0; }

.d-h { hyphens: manual; display: flex; align-items: center; gap: 10px; margin: 26px 0 10px; padding-bottom: 7px; border-bottom: 1.5px solid var(--d-ink); font-family: var(--ui-font); font-size: 16.5px; font-weight: 700; letter-spacing: -0.005em; line-height: 1.2; }
.d-h .n { width: 22px; height: 22px; display: inline-grid; place-items: center; flex: none; background: var(--d-spot); color: #fff; font-size: 12px; box-shadow: 3px 3px 0 var(--d-yellow); }
.d-h .cont { margin-left: auto; font-size: 10px; font-weight: 500; font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; color: var(--d-muted); }
.d-lead { margin: 0 0 8px; }
.d-li { display: grid; grid-template-columns: 26px 1fr; margin: 0 0 7px; }
.d-li b { font-family: var(--ui-font); font-size: 13px; color: var(--d-spot); padding-top: 1px; }
.d-li.dash b { color: var(--d-yellow); font-size: 9px; padding-top: 4px; }
.d-th, .d-row { display: grid; grid-template-columns: 112px 1fr; gap: 0 16px; }
.d-th { font-family: var(--ui-font); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--d-muted); padding: 0 0 5px; border-bottom: 0.75px solid var(--d-ink); }
.d-row { padding: 7px 0 8px; border-bottom: 0.75px solid var(--d-hair); }
.d-row .k { font-family: var(--ui-font); font-size: 12px; font-weight: 700; padding-top: 1px; }
.d-box { background: var(--d-tint); padding: 0 18px; margin: 0; }
.d-box.first { padding-top: 14px; }
.d-box.last { padding-bottom: 6px; }
.d-box-h { font-family: var(--ui-font); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--d-spot); margin: 0; padding-bottom: 9px; }
.d-checks { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.d-checks li { position: relative; padding-left: 21px; padding-bottom: 8px; font-size: 13px; line-height: 1.4; }
.d-checks li::before { content: ""; position: absolute; left: 0; top: 3px; width: 10px; height: 10px; border: 1.2px solid var(--d-ink); background: #fff; }
.d-phase { display: grid; grid-template-columns: 70px 1fr; gap: 0 18px; padding: 12px 0; border-bottom: 0.75px solid var(--d-hair); }
.d-phase .t { font-family: var(--ui-font); border-right: 2px solid var(--d-yellow); padding-right: 10px; }
.d-phase .t b { display: block; font-size: 24px; line-height: 1; font-weight: 700; color: var(--d-spot); }
.d-phase .t b small { font-size: 11px; font-weight: 600; margin-left: 2px; }
.d-phase .t span { display: block; margin-top: 5px; font-size: 9.5px; color: var(--d-muted); letter-spacing: 0.04em; }
.d-phase h3 { margin: 0 0 5px; font-family: var(--ui-font); font-size: 14px; font-weight: 700; }
.d-phase p { margin: 0 0 4px; }
.d-lbl { font-family: var(--ui-font); font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--d-spot); margin-right: 6px; }
.d-tip { margin: 14px 0 0; padding: 10px 14px 11px; background: var(--d-yellow-tint); border-left: 4px solid var(--d-yellow); }
.d-tip .d-lbl { color: var(--d-yellow-ink); display: block; margin: 0 0 2px; }
.d-tip p { margin: 0; }
.d-rub { display: grid; grid-template-columns: 1fr 74px 74px 74px; align-items: center; border-bottom: 0.75px solid var(--d-hair); }
.d-rub > div { padding: 8px 0; }
.d-rub > .c { text-align: center; }
.d-rub > .c i { display: inline-block; width: 12px; height: 12px; border: 1.2px solid var(--d-ink); vertical-align: middle; }
.d-rub.head { border-bottom-color: var(--d-ink); }
.d-rub.head > div { padding: 0 0 5px; font-family: var(--ui-font); font-size: 9px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--d-muted); }
.d-p { margin: 10px 0 0; }
.d-p strong { font-family: var(--ui-font); font-size: 12.5px; }
.d-flag { margin: 14px 0 0; padding: 9px 14px; border: 1.5px solid var(--d-yellow); font-family: var(--ui-font); font-size: 12px; }
.d-missing { margin: 0; padding: 8px 0; font-style: italic; color: var(--d-muted); }
.d-notes-h { margin: 28px 0 0; font-family: var(--ui-font); font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--d-spot); }
.d-notes { background: repeating-linear-gradient(to bottom, transparent 0 27px, var(--d-hair) 27px 28px); }
.d-note { margin: 26px 0 0; padding-top: 8px; border-top: 0.75px solid var(--d-hair); font-size: 11px; font-style: italic; color: var(--d-muted); }
.sk { background: #e9eef1; margin: 0 0 12px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* ================= Modal ================= */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(3, 40, 63, 0.45); }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal-top { height: 5px; background: linear-gradient(90deg, var(--blue) 0 70%, var(--yellow) 70%); }
.modal-in { padding: 20px 22px 18px; }
.modal h2 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.modal p { margin: 0 0 10px; color: #37505c; }
.m-label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 6px; }
.m-field { width: 100%; padding: 9px 11px; border: 1px solid var(--ui-line-strong); border-radius: var(--radius); font-size: 14px; resize: vertical; background: #fff; }
.m-field:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,128,201,.15); }
.m-field[aria-invalid="true"] { border-color: var(--danger); }
.m-hint { font-size: 12.5px; color: var(--ui-muted); margin: 12px 0 0 !important; }
.modal .tags { margin-top: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ================= Narrow screens ================= */
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { display: block; height: auto; }
  .gutter { display: none; }
  .side { border-right: 0; border-bottom: 1px solid var(--ui-line); }
  .side-scroll { overflow: visible; }
  .viewer { height: 88vh; }
  .viewer-scroll { padding: 16px 16px 84px; }
  .g-grid { justify-content: center; }
  .vbar .hide-sm { display: none; }
}

/* ================= Print: the pages, 1:1 A4 ================= */
@media print {
  @page { size: A4; margin: 0; }
  html, body { height: auto; overflow: visible; background: #fff; }
  .side, .gutter, .vbar, .toast, .modal-back, .update-pill, .gallery { display: none !important; }
  .app { display: block; height: auto; }
  .viewer, .viewer-scroll { position: static; overflow: visible; padding: 0; background: #fff; }
  .pages { display: block; opacity: 1 !important; }
  .pg-wrap { width: auto !important; height: auto !important; box-shadow: none; break-after: page; }
  .pg-wrap:last-child { break-after: auto; }
  .pg-wrap > .page { position: relative; transform: none !important; width: 210mm; height: 297mm; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= Additions for the live page ================= */
.noscript { padding: 20px; font-weight: 700; }
.svg-defs { position: absolute; }
.measure-host { position: absolute; left: -10000px; top: 0; visibility: hidden; }
.home-link { display: block; flex: none; border-radius: var(--radius); }
.home-link:focus-visible { outline-color: #fff; }
.notice { margin: 0 0 14px; padding: 9px 12px; border-radius: var(--radius); background: var(--yellow-soft); color: var(--d-yellow-ink); font-size: 13px; font-weight: 600; }
.g-badge.team { background: var(--blue); color: #fff; }
.g-grid[aria-busy="true"]:empty::before { content: ""; display: block; width: 232px; height: 328px; background: #fff; opacity: .6; animation: pulse 1.4s ease-in-out infinite; }
.m-ai.is-error p { color: var(--danger); }
.m-ai .retry { margin-top: 6px; }
.btn[aria-disabled="true"] { opacity: .6; cursor: default; }

/* The curriculum row: the official name under the code's explanation. */
.d-row .std-name { display: block; margin-top: 3px; font-family: var(--ui-font); font-size: 10.5px; color: var(--d-muted); }

/* The example program: the cards, in order, as the children lay them out. */
.d-prog { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; counter-reset: card; }
.d-prog li { counter-increment: card; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 6px; border: 1.2px solid var(--d-spot); background: var(--d-tint); font-family: var(--ui-font); font-size: 12px; font-weight: 600; }
.d-prog li::before { content: counter(card); display: inline-grid; place-items: center; min-width: 18px; height: 18px; background: var(--d-spot); color: #fff; font-size: 10px; font-weight: 700; }
.d-prog li.mod { border-color: var(--d-yellow); background: var(--d-yellow-tint); }
.d-prog li.mod::before { background: var(--d-yellow); color: var(--ink); }

.boot-fail { position: fixed; top: 0; left: 0; right: 0; z-index: 99; margin: 0; padding: 12px; background: #fdf0ef; color: #7a1a13; font: 600 14px var(--ui-font); }
