/* PM Booster app. Same design language as viktorcessan.com: warm off-white surfaces, near-black
   text, gold accent, DM Serif Display for headings, DM Sans for everything else, generous room.
   The cohort accent overrides --accent at runtime; every tint is derived from it with color-mix so
   a dark accent (teal, navy, plum) works as well as the default gold. */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f5f2;
    --bg-card: #f0efec;
    --bg-card-hover: #e8e7e3;
    --text-primary: #1a1a1f;
    --text-secondary: #52514d;
    --text-muted: #8a8983;
    --accent: #9a7b2e;
    --accent-ink: #ffffff;
    --accent-soft: color-mix(in srgb, var(--accent) 9%, #ffffff);
    --accent-tint: color-mix(in srgb, var(--accent) 5%, #fbfaf7);
    --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);
    --accent-ring: color-mix(in srgb, var(--accent) 22%, transparent);
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.16);
    --ok: #2e7d4f;
    --warn: #b9731f;
    --danger: #b3261e;
    --info: #3a6ea5;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    --topbar-h: 64px;
    --progress-h: 3px;
    --menu-w: 276px;
    --chat-w: 400px;
    --measure: 62rem;
    --shadow: 0 10px 30px rgba(26, 26, 31, 0.08);
    --shadow-lg: 0 24px 60px rgba(26, 26, 31, 0.16);
    --gap: .6rem;
}

/* ---- profile menu, health, progress, radar, program table (admin rework) ---- */
.profile { position: relative; margin-left: .6rem; }
.profile-btn { display: inline-flex; align-items: center; gap: .3rem; background: none; border: 0; cursor: pointer; padding: 4px; border-radius: 999px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--text-primary); color: var(--bg-primary); font-size: .72rem; font-weight: 600; letter-spacing: .04em; }
.profile-btn:hover .avatar { background: var(--accent); color: var(--accent-ink); }
.profile-btn .badge { margin-left: 0; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: .5rem; z-index: 200; display: flex; flex-direction: column; }
.profile-head { padding: .6rem .75rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .35rem; display: flex; flex-direction: column; gap: .1rem; }
.profile-head strong { font-size: .95rem; }
.profile-menu a, .profile-menu button[role=menuitem] { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; font-size: .9rem; color: var(--text-primary); padding: .55rem .75rem; border-radius: 6px; text-decoration: none; cursor: pointer; }
.profile-menu a:hover, .profile-menu button[role=menuitem]:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.profile-theme { display: flex; align-items: center; gap: .3rem; padding: .5rem .75rem; border-top: 1px solid var(--border); margin-top: .35rem; }
.profile-theme .small { flex: 1; }
.profile-theme button { font: inherit; font-size: .75rem; font-weight: 600; padding: .25rem .55rem; border-radius: 999px; border: 1px solid var(--border-strong); background: none; color: var(--text-secondary); cursor: pointer; }
.profile-theme button.on { background: var(--text-primary); color: var(--bg-primary); border-color: var(--text-primary); }
.profile-signout { color: var(--text-muted) !important; border-top: 1px solid var(--border); margin-top: .35rem; border-radius: 0 0 6px 6px !important; }
.h-small { font-size: 1.5rem; }
.health { display: inline-block; width: 90px; height: 8px; border-radius: 999px; background: rgba(128, 128, 128, .18); vertical-align: middle; overflow: hidden; }
.health i { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.health.mid i { background: var(--warn); } .health.low i { background: var(--danger); }
.health-n { margin-left: .5rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.health-cell { white-space: nowrap; }
.health-big { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--ok); line-height: 1; }
.health-big b { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; }
.health-big span { font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); margin-top: .15rem; }
.health-big.mid { border-color: var(--warn); } .health-big.low { border-color: var(--danger); } .health-big:not(.good):not(.mid):not(.low) { border-color: var(--border-strong); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.tile { background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem .9rem; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.tile-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.tile b { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.table.compact th, .table.compact td { padding: .45rem .6rem; font-size: .88rem; }
.progress-row { display: inline-flex; gap: 4px; }
.prog { position: relative; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; font-size: .68rem; font-weight: 600; background: rgba(128, 128, 128, .12); color: var(--text-muted); }
.prog.off { opacity: .35; } .prog.h1 { background: rgba(185, 115, 31, .22); color: #7a4b12; } .prog.h2 { background: rgba(154, 123, 46, .3); color: #5e4a19; } .prog.h3 { background: rgba(46, 125, 79, .22); color: #1f5a37; }
.prog.ex::after { content: ''; position: absolute; right: 3px; bottom: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--text-primary); }
.prog .pdf { position: absolute; left: 2px; top: 1px; font-size: .5rem; font-style: normal; opacity: .7; }
.table.people td { vertical-align: middle; }
.table.people td:first-child { white-space: nowrap; }
.table.people td:first-child .small { white-space: nowrap; }
.table.program td { vertical-align: top; }
.table.program td:first-child { width: 22%; }
.pre-row + .pre-row { margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--border); }
.pre-title { font-weight: 600; }
.codebig { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .12em; }
.game-line .small { margin-top: .2rem; }
.table.attendance .att-col { text-align: center; }
.table.attendance th.att-col b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; }
.table.attendance th.att-col span { display: block; font-size: .65rem; letter-spacing: .04em; text-transform: none; font-weight: 400; }
.table.attendance input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.table.schedule input[type=datetime-local] { width: 11.5rem; }
.table.schedule select { min-width: 7rem; }
.table.schedule td { vertical-align: middle; }
.tl-session { margin-top: .25rem; }
.tl-session .code { font-family: var(--font-display); letter-spacing: .1em; font-size: 1rem; color: var(--text-primary); }
.tl-session .btn { margin-left: .4rem; }
.pdf-link { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; border: 1px solid var(--border-strong); border-radius: 999px; padding: .1rem .55rem; color: var(--text-secondary); }
.pdf-link:hover { border-color: var(--text-primary); color: var(--text-primary); }
.assess-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.5rem; align-items: start; }
.radar-card { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.radar-wrap { max-width: 360px; margin: 0 auto; }
.radar { width: 100%; height: auto; display: block; overflow: visible; }
.radar-ring { fill: none; stroke: var(--border-strong); stroke-width: 1; }
.radar-spoke { stroke: var(--border); stroke-width: 1; }
.radar-label { font-size: 10.5px; fill: var(--text-secondary); font-family: var(--font-body); }
.radar-series polygon { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.radar-series circle { fill: var(--accent); }
.radar-series.start polygon { fill: color-mix(in srgb, var(--text-muted) 18%, transparent); stroke: var(--text-muted); stroke-dasharray: 4 3; }
.radar-series.start circle { fill: var(--text-muted); }
.radar-series.end polygon { fill: color-mix(in srgb, var(--accent) 24%, transparent); stroke: var(--accent); }
.radar-series.end circle { fill: var(--accent); }
.radar-legend { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; font-size: .8rem; color: var(--text-secondary); margin-top: .4rem; }
.radar-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -2px; background: var(--accent); }
.radar-legend .start i { background: var(--text-muted); }
@media (max-width: 900px) { .assess-grid { grid-template-columns: 1fr; } .radar-card { position: static; } .profile-menu { right: auto; left: 0; } .topnav .profile { margin: .5rem 0 0; } .health { width: 60px; } }

/* ---- base ---- */
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 72px); scrollbar-gutter: stable; }
body { margin: 0; font-family: var(--font-body); font-size: 16px; line-height: 1.6; color: var(--text-primary); background: var(--bg-primary); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
::selection { background: #000; color: #fff; }
a { color: var(--text-primary); text-decoration-color: var(--accent-line); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .2s, text-decoration-color .2s; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; text-wrap: balance; }
.h-serif { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.02em; font-size: clamp(1.9rem, 3.4vw, 2.7rem); line-height: 1.1; }
p { margin: 0 0 1em; }
.lead { font-size: 1.1rem; line-height: 1.65; color: var(--text-secondary); max-width: 60ch; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 500; background: var(--text-primary); color: #fff; padding: .5rem .8rem; border-radius: var(--radius-sm); }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- layout primitives ---- */
.section-label { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); margin-bottom: .6rem; }
.section-label a { color: inherit; text-decoration: none; }
.container { max-width: 1100px; margin: 0 auto; padding-block: 2rem 6rem; padding-inline: 2rem; }
.container.narrow { max-width: 620px; }
.container.narrow-wide { max-width: 840px; }
.page-head { margin-bottom: 2rem; }
.page-head .lead { margin-bottom: 0; }
.page-head.between { align-items: flex-end; }
.mt { margin-top: 1.2rem; } .mt-s { margin-top: .6rem; } .mt-xs { margin-top: .3rem; } .mt-l { margin-top: 3.5rem; } .mb { margin-bottom: 1.2rem; } .mb-s { margin-bottom: .6rem; }
.row { display: flex; align-items: center; gap: var(--gap); } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; }
.gap-xs { gap: .35rem; } .gap-s { gap: var(--gap); } .grow { flex: 1; min-width: 0; } .spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 1rem; } .stack-s { display: flex; flex-direction: column; gap: .5rem; }
.stack > .btn, .stack-s > .btn { align-self: flex-start; }
.auth-card .stack > .btn { align-self: stretch; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; align-items: start; }
.cards { display: grid; gap: 1.25rem; } .cards.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.4rem 1.5rem; min-width: 0; }
.card strong { display: block; }
.card > strong { font-size: 1.05rem; margin-bottom: .2rem; }
.card p:last-child { margin-bottom: 0; }
.card .btn { margin-top: .9rem; }
.card .row .btn, .card .table .btn, .card form .btn { margin-top: 0; }
.card-attention { border-color: var(--accent); background: var(--accent-tint); }
.card-link { text-decoration: none; display: flex; flex-direction: column; gap: .2rem; transition: background .2s, border-color .2s; }
.card-link:hover { background: var(--bg-card-hover); border-color: var(--border-strong); color: inherit; }
.card-locked { opacity: .6; }
.kpi b { font-size: 2rem; font-family: var(--font-display); font-weight: 400; line-height: 1; display: block; }
.notice { background: var(--bg-secondary); border: 1px solid var(--border); padding: .9rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.2rem; }
.notice.warn { background: color-mix(in srgb, var(--warn) 10%, var(--bg-secondary)); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .75rem 1.5rem; min-height: 44px; font: inherit; font-size: .88rem; font-weight: 600; line-height: 1.3; letter-spacing: .01em; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .2s, border-color .2s, color .2s, transform .15s; white-space: nowrap; vertical-align: middle; }
.btn-primary { background: var(--text-primary); color: #fff; }
.btn-primary:hover { background: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--text-secondary); border-color: var(--border-strong); }
.btn-secondary:hover { color: var(--text-primary); border-color: var(--text-primary); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-s { padding: .45rem .95rem; min-height: 36px; font-size: .82rem; }
.btn:disabled, .btn.is-busy { opacity: .55; cursor: progress; transform: none; }
/* Buttons never touch: siblings get a gap wherever they are not already in a gapped flex row. */
.btn + .btn, .btn + .linklike, .linklike + .btn { margin-inline-start: var(--gap); }
:is(.row, .stack, .stack-s, .workbook-foot, .modal-actions, .figure-tools, .article-pn, .tool-actions) > .btn + .btn { margin-inline-start: 0; }
.table td .btn { margin: .15rem var(--gap) .15rem 0; }
.table td .btn:last-child { margin-right: 0; }
.iconbtn-text { background: none; border: 0; color: var(--text-secondary); font: inherit; font-size: .8rem; font-weight: 600; letter-spacing: .02em; cursor: pointer; padding: .35rem .55rem; border-radius: 6px; }
.iconbtn-text:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; cursor: pointer; }
.linklike:hover { color: var(--accent); }

/* ---- pills, badges ---- */
.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; line-height: 1.5; vertical-align: middle; white-space: nowrap; }
.pill.ok { background: rgba(46, 125, 79, .12); color: var(--ok); }
.pill.warn { background: rgba(185, 115, 31, .14); color: #8a5416; }
.pill.off { background: rgba(0, 0, 0, .06); color: var(--text-muted); }
.pill.info { background: rgba(58, 110, 165, .12); color: var(--info); }
.pill.new { background: var(--accent); color: var(--accent-ink); }
.badge { display: inline-block; min-width: 1.2rem; padding: 0 .35rem; margin-left: .35rem; background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: .7rem; text-align: center; line-height: 1.2rem; }

/* ---- form controls: one look everywhere ---- */
label { display: block; font-size: .82rem; font-weight: 600; letter-spacing: .01em; margin-bottom: .35rem; color: var(--text-secondary); }
label.row { font-weight: 500; font-size: .92rem; color: var(--text-primary); margin: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text-primary); background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .6rem .8rem; width: 100%; min-height: 42px; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:hover, textarea:hover, select:hover { border-color: rgba(0, 0, 0, .28); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
textarea { resize: vertical; line-height: 1.55; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2352514d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .85rem center; cursor: pointer; }
input[type=file] { padding: .45rem .6rem; font-size: .9rem; cursor: pointer; }
input[type=file]::file-selector-button { font: inherit; font-size: .8rem; font-weight: 600; color: var(--text-secondary); background: var(--bg-secondary); border: 1px solid var(--border-strong); border-radius: 6px; padding: .3rem .7rem; margin-right: .7rem; cursor: pointer; }
input[type=date], input[type=datetime-local] { min-width: 0; }
input[type=color] { padding: 2px; width: 42px; }
input[type=checkbox], input[type=radio] { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; border: 1.5px solid rgba(0, 0, 0, .3); border-radius: 4px; background: #fff; display: inline-grid; place-content: center; vertical-align: -3px; cursor: pointer; transition: background .12s, border-color .12s; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover, input[type=radio]:hover { border-color: var(--text-primary); }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--text-primary); border-color: var(--text-primary); }
input[type=checkbox]::before { content: ''; width: 10px; height: 10px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 5.2l2.3 2.3 4.7-4.9' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; transform: scale(0); transition: transform .12s; }
input[type=radio]::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .12s; }
input[type=checkbox]:checked::before, input[type=radio]:checked::before { transform: scale(1); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); border-color: var(--accent); }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: default; }
.stack label + input, .stack label + textarea, .stack label + select { margin-top: -.5rem; }
fieldset { border: 0; padding: 1.4rem 1.5rem; margin: 0; min-width: 0; }
legend { padding: 0; float: left; width: 100%; }
legend + * { clear: both; }
fieldset > label { margin-top: 1rem; }
fieldset > label + input, fieldset > label + select, fieldset > label + textarea { margin-top: 0; }
fieldset > legend + label { margin-top: 0; }

/* ---- top bar ---- */
.topbar { position: sticky; top: 0; z-index: 100; background: rgba(255, 255, 255, .88); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 0 2rem; height: var(--topbar-h); display: flex; align-items: center; gap: 1.5rem; }
body.reading .topbar-inner { max-width: none; padding: 0 1.5rem; }
.brand { display: flex; align-items: center; gap: .9rem; min-width: 0; text-decoration: none; color: var(--text-primary); cursor: default; }
.brand:hover { color: var(--text-primary); }
.brand-mark { font-family: var(--font-display); font-size: 1.15rem; letter-spacing: -0.01em; white-space: nowrap; }
.brand-cohort { display: flex; align-items: center; min-width: 0; padding-left: .9rem; border-left: 1px solid var(--border-strong); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-cohort img { height: 24px; width: auto; max-width: 140px; }
.topnav { display: flex; align-items: center; gap: .15rem; margin-left: auto; }
.topnav a, .topnav-signout { position: relative; color: var(--text-secondary); text-decoration: none; font-size: .85rem; letter-spacing: .03em; padding: .45rem .7rem; border-radius: 6px; background: none; border: 0; font-family: inherit; cursor: pointer; transition: color .2s; }
.topnav a:hover, .topnav-signout:hover { color: var(--text-primary); }
.topnav a.on { color: var(--text-primary); font-weight: 600; }
.topnav a.on::after { content: ''; position: absolute; left: .7rem; right: .7rem; bottom: 0; height: 2px; background: var(--accent); border-radius: 2px; }
.topnav-signout { margin-left: .6rem; color: var(--text-muted); }
.topnav a.login-btn { margin-left: .6rem; background: var(--text-primary); color: #fff; font-weight: 600; padding: .45rem 1rem; border-radius: var(--radius-sm); }
.topnav a.login-btn.on { background: var(--accent); color: var(--accent-ink); }
.topnav a.login-btn.on::after { display: none; }
.topnav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 6px; margin-left: auto; }
.topnav-toggle span { display: block; width: 22px; height: 1.5px; background: var(--text-secondary); }

/* ---- auth ---- */
.auth { min-height: calc(100vh - var(--topbar-h)); display: grid; place-items: center; padding: 3rem 1.5rem; background: var(--bg-secondary); }
.auth-card { width: 100%; max-width: 460px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.5rem 2.4rem; box-shadow: var(--shadow); }
.auth-card .h-serif { font-size: 2.2rem; margin-bottom: .6rem; }
.auth-card .stack { margin-top: 1.4rem; }
.auth-card .privacy { margin-top: 1.6rem; font-size: .85rem; color: var(--text-muted); }
.auth-card .privacy summary { cursor: pointer; }
.auth-card .privacy p { margin: .5rem 0 0; }

/* ---- program timeline (home) ---- */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.tl-item { display: grid; grid-template-columns: 60px 1fr; gap: 1rem; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.25rem 1.5rem; }
.tl-item.locked { opacity: .6; }
.tl-num { font-family: var(--font-display); font-size: 2.4rem; line-height: 1; color: var(--accent); }
.tl-title { font-size: 1.08rem; }
.tl-artifact { font-size: .85rem; margin-bottom: .7rem; }
.tl-parts { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.tl-parts li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* ---- lists, tables, tabs ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; padding: 1rem 0; border-top: 1px solid var(--border); }
.list-item:first-child { border-top: 0; padding-top: .2rem; }
.list-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.entry-text { white-space: pre-wrap; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem 1rem; margin: .6rem 0; font-size: .95rem; line-height: 1.55; }
.comment { background: var(--accent-tint); border: 1px solid var(--border); padding: .7rem 1rem; border-radius: var(--radius-sm); margin: .6rem 0; font-size: .95rem; line-height: 1.5; }
.entry + .entry { margin-top: 1rem; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .7rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table th { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table input, .table select { min-height: 36px; padding: .35rem .6rem; }
.table tr.muted td { color: var(--text-muted); }
.heat { display: inline-block; padding: .2rem .55rem; border-radius: 6px; font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.h0 { background: rgba(0, 0, 0, .05); color: var(--text-muted); }
.h1 { background: rgba(185, 115, 31, .18); color: #7a4b12; }
.h2 { background: rgba(154, 123, 46, .22); color: #5e4a19; }
.h3 { background: rgba(46, 125, 79, .18); color: #1f5a37; }
.tabs { display: flex; gap: .2rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 1.8rem; }
.tabs a { text-decoration: none; padding: .65rem .9rem; font-size: .88rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .2s; }
.tabs a:hover { color: var(--text-primary); }
.tabs a.on { color: var(--text-primary); border-bottom-color: var(--accent); }
.swatches { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.swatches { gap: .3rem; }
.swatches input[name=accent] { width: 5.6rem !important; flex: none; font-size: .9rem; padding-inline: .6rem; margin-left: .3rem; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px #fff; transition: transform .15s; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { border-color: var(--text-primary); }
.logo-preview { height: 32px; width: auto; }
.link-row input { min-width: 0; }
.email-preview { border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 60vh; overflow: auto; background: #fff; }
.rating { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; padding: .8rem 0; border-top: 1px solid var(--border); }
.rating:first-of-type { border-top: 0; }
.rating-label { font-size: 1rem; }
.rating-scale { display: flex; gap: .35rem; }
.rating-scale label { margin: 0; cursor: pointer; }
.rating-scale input { position: absolute; opacity: 0; width: 0; height: 0; }
.rating-scale span { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-weight: 600; background: #fff; transition: border-color .15s, background .15s; }
.rating-scale label:hover span { border-color: var(--text-primary); }
.rating-scale input:checked + span { background: var(--text-primary); color: #fff; border-color: var(--text-primary); }
.rating-scale input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---- toast, modal ---- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 10px); background: var(--text-primary); color: #fff; padding: .75rem 1.2rem; border-radius: var(--radius-sm); font-size: .9rem; z-index: 300; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: min(90vw, 560px); box-shadow: var(--shadow-lg); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.modal-root { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 1rem; }
.modal-root[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(26, 26, 31, .45); }
.modal { position: relative; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: #fff; border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-lg); }
.modal h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; letter-spacing: -0.01em; margin-bottom: 1rem; }
.modal-body { display: flex; flex-direction: column; gap: .5rem; }
.modal-body label { margin-top: .5rem; }
.modal-body p { margin: 0; color: var(--text-secondary); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--gap); margin-top: 1.6rem; }

/* ---- reader layout: menu | article | assistant ---- */
body.reading .view { padding: 0; }
.reader { display: grid; grid-template-columns: var(--menu-w) minmax(0, 1fr) 0; transition: grid-template-columns .25s ease; min-height: calc(100vh - var(--topbar-h)); position: relative; }
.reader.chat-open { grid-template-columns: var(--menu-w) minmax(0, 1fr) var(--chat-w); }
.reader.menu-closed { grid-template-columns: 0 minmax(0, 1fr) 0; }
.reader.menu-closed.chat-open { grid-template-columns: 0 minmax(0, 1fr) var(--chat-w); }
.progress { position: sticky; top: var(--topbar-h); grid-column: 1 / -1; height: var(--progress-h); background: var(--border); z-index: 20; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
/* overflow: clip (not hidden) keeps the column from becoming a scroll container, so the sticky menu works */
.reader-menu { background: var(--bg-secondary); border-right: 1px solid var(--border); overflow: clip; }
.reader-menu-inner { position: sticky; top: calc(var(--topbar-h) + var(--progress-h)); width: var(--menu-w); max-height: calc(100vh - var(--topbar-h) - var(--progress-h)); overflow-y: auto; padding: 1.6rem 1.4rem 3rem; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .15) transparent; }
.menu-module { margin-bottom: 1.4rem; }
.menu-module-title a { color: inherit; text-decoration: none; }
.menu-module-title a:hover { color: var(--accent); }
.menu-module.current .menu-module-title { color: var(--text-primary); }
.menu-module-title { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; display: flex; gap: .55rem; align-items: baseline; margin-bottom: .35rem; }
.menu-module.locked .menu-module-title { color: var(--text-muted); }
.menu-num { color: var(--accent); font-family: var(--font-display); font-size: 1.05rem; letter-spacing: 0; }
.menu-module.locked .menu-num { color: var(--text-muted); }
.menu-when { margin-left: auto; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: .75rem; }
.menu-part-link { display: block; text-decoration: none; font-size: .92rem; line-height: 1.4; padding: .3rem 0; color: var(--text-primary); transition: color .2s; }
a.menu-part-link:hover { color: var(--accent); }
.menu-part.current > .menu-part-link { font-weight: 600; }
.menu-sections { list-style: none; margin: .25rem 0 .6rem; padding: 0 0 0 .75rem; border-left: 1px solid var(--border-strong); }
.menu-sections a { display: block; text-decoration: none; font-size: .84rem; color: var(--text-secondary); padding: .26rem 0 .26rem .7rem; margin-left: calc(-.75rem - 1px); border-left: 2px solid transparent; line-height: 1.4; transition: color .2s, border-color .2s; }
.menu-sections a:hover { color: var(--text-primary); }
.menu-sections a.on { color: var(--text-primary); font-weight: 600; border-left-color: var(--accent); }
.reader-article { min-width: 0; background: var(--bg-primary); }
.reader-bar { position: sticky; top: calc(var(--topbar-h) + var(--progress-h)); z-index: 15; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: .8rem; padding: .55rem 1.5rem; }
.reader-bar > .muted { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-bar .btn-short { display: none; }
.iconbtn { flex: none; width: 36px; height: 36px; display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; align-items: center; background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .2s; }
.iconbtn:hover { border-color: var(--text-primary); }
.iconbtn span { display: block; width: 16px; height: 1.5px; background: var(--text-secondary); }
.reader-inner { max-width: calc(var(--measure) + 3rem); margin: 0 auto; padding: 3.5rem 1.5rem 6rem; }
.article-head { margin-bottom: 2.5rem; }
.article-head .section-label { margin-bottom: 1rem; }
.article-head .h-serif { font-size: clamp(2.3rem, 4vw, 3.2rem); margin-bottom: .3em; }
.cohort-note { background: var(--accent-tint); border: 1px solid var(--border); padding: .9rem 1.2rem; border-radius: var(--radius-sm); margin-top: 1.4rem; font-size: .98rem; line-height: 1.6; }

/* ---- reading typography ---- */
.article-body { font-size: 1.0625rem; line-height: 1.72; color: var(--text-primary); }
.article-body > p:first-child > em:only-child { display: block; font-family: var(--font-display); font-style: italic; font-size: 1.45rem; line-height: 1.4; letter-spacing: -0.005em; color: var(--text-secondary); margin: 0 0 2.5rem; text-wrap: pretty; }
.article-body h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.9rem; line-height: 1.15; letter-spacing: -0.015em; margin: 3.4rem 0 1.1rem; }
.article-body h2::before { content: ''; display: block; width: 2.25rem; height: 2px; background: var(--accent); margin-bottom: 1.1rem; border-radius: 2px; }
.article-body h2:first-child { margin-top: 0; }
.article-body h3 { font-size: 1.2rem; font-weight: 600; line-height: 1.3; margin: 2.2rem 0 .7rem; }
.article-body h4 { font-size: .98rem; font-weight: 600; letter-spacing: .01em; margin: 1.8rem 0 .5rem; }
.article-body h2 + h3, .article-body h3 + h4 { margin-top: .8rem; }
.article-body p { margin: 0 0 1.25em; text-wrap: pretty; }
.article-body ul, .article-body ol { padding-left: 1.4rem; margin: 0 0 1.35em; }
.article-body li { margin-bottom: .5em; padding-left: .2rem; }
.article-body li::marker { color: var(--accent); font-weight: 600; }
.article-body li > p { margin-bottom: .5em; }
.article-body ul ul, .article-body ol ol, .article-body ul ol, .article-body ol ul { margin: .4em 0 .4em; }
.article-body strong { font-weight: 600; }
.article-body blockquote { margin: 2rem 0; padding: .2rem 0 .2rem 1.5rem; border-left: 2px solid var(--accent); font-family: var(--font-display); font-style: italic; font-size: 1.28rem; line-height: 1.45; color: var(--text-primary); }
.article-body blockquote p { margin-bottom: .6em; }
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.article-body figure { margin: 2.2rem 0; }
.article-body pre { background: var(--bg-secondary); padding: 1rem 1.2rem; border-radius: var(--radius-sm); overflow-x: auto; font-size: .88rem; line-height: 1.55; }
.article-body code { font-size: .92em; background: var(--bg-secondary); padding: .1em .35em; border-radius: 4px; }
.article-body pre code { background: none; padding: 0; }
.article-body hr { border: 0; height: 1px; background: var(--border); margin: 3rem 0; }
.article-body a { color: var(--text-primary); overflow-wrap: anywhere; }
.bz-table { overflow-x: auto; margin: 2rem 0; -webkit-overflow-scrolling: touch; }
.bz-table table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.5; }
.bz-table th, .bz-table td { border: 0; border-bottom: 1px solid var(--border); padding: .7rem .8rem; text-align: left; vertical-align: top; }
.bz-table th:first-child, .bz-table td:first-child { padding-left: 0; }
.bz-table th:last-child, .bz-table td:last-child { padding-right: 0; }
.bz-table thead th { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border-strong); padding-top: 0; }
.bz-table tbody th { font-weight: 600; }
.bz-table td > p:last-child, .bz-table th > p:last-child { margin-bottom: 0; }
.bz-callout { margin: 2.2rem 0; padding: 1.4rem 1.6rem; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: .98rem; line-height: 1.65; }
.bz-callout-title { font-size: .7rem; font-weight: 600; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); margin-bottom: .7rem; }
.bz-callout-exercise { background: var(--accent-tint); border-color: var(--accent-line); }
.bz-callout > :last-child { margin-bottom: 0; }
.bz-callout h3, .bz-callout h4 { margin-top: .4rem; }
.bz-video { margin: 2.2rem 0; }
.bz-video-frame { aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: var(--radius-md); overflow: hidden; }
.bz-video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.bz-video figcaption, .bz-figure figcaption { font-size: .85rem; line-height: 1.5; color: var(--text-muted); margin-top: .7rem; }
.bz-figure { margin: 2.2rem 0; }
.bz-figure-stage { position: relative; overflow: hidden; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); touch-action: none; cursor: grab; user-select: none; }
.bz-figure-stage.dragging { cursor: grabbing; }
.bz-figure-stage svg { display: block; width: 100%; height: auto; max-height: 70vh; transform-origin: 0 0; transition: transform .05s linear; }
.bz-figure-plain .bz-figure-stage { background: none; border: 0; cursor: default; touch-action: auto; user-select: auto; overflow: visible; }
.bz-figure-plain .bz-figure-stage svg { max-height: none; max-width: 860px; margin: 0 auto; }
.bz-figure-plain figcaption { max-width: 860px; margin-left: auto; margin-right: auto; }
.bz-figure:fullscreen { background: #fff; padding: 2rem; display: grid; place-items: center; }
.bz-figure:fullscreen .bz-figure-stage { width: 100%; height: 90vh; }
.bz-figure:fullscreen .bz-figure-stage svg { max-height: 90vh; height: 100%; }
.figure-tools { position: absolute; top: .6rem; right: .6rem; display: flex; gap: .3rem; z-index: 2; opacity: 0; transition: opacity .2s; }
.bz-figure-stage:hover .figure-tools, .bz-figure-stage:focus-within .figure-tools, .bz-figure:fullscreen .figure-tools { opacity: 1; }
@media (hover: none) { .figure-tools { opacity: 1; } }
.figure-tools button { width: 34px; height: 34px; border: 1px solid var(--border-strong); background: rgba(255, 255, 255, .95); color: var(--text-primary); border-radius: 6px; font-size: 1.05rem; line-height: 1; cursor: pointer; transition: border-color .2s; }
.figure-tools button:hover { border-color: var(--text-primary); }
.figure-info { margin-top: .7rem; padding: .8rem 1.1rem; background: var(--accent-tint); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .95rem; line-height: 1.55; }
svg .has-info { cursor: pointer; }
svg .has-info:hover rect, svg .has-info.selected rect { stroke: var(--accent); stroke-width: 2.5; }
.bz-parallax { margin: 2.6rem 0; padding: 1.6rem 1.6rem 1.2rem; border-radius: var(--radius-md); background: var(--bg-card); border: 1px solid var(--border); overflow: hidden; }
.bz-parallax-art { position: relative; will-change: transform; }
.bz-parallax-art svg, .bz-parallax-art img { width: 100%; height: auto; display: block; }
.bz-parallax-text { margin-top: 1rem; text-align: center; font-family: var(--font-display); font-size: 1.35rem; line-height: 1.35; color: var(--text-primary); }

/* ---- workbook fields: a worksheet inside the text ---- */
.bz-workbook, .bz-quiz { margin: 2.4rem 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-secondary); }
.bz-workbook + .bz-workbook, .bz-quiz + .bz-workbook, .bz-workbook + .bz-quiz { margin-top: .8rem; }
.bz-workbook-head, .bz-quiz-head { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'kicker chev' 'label chev' 'note chev'; column-gap: 1rem; width: 100%; padding: 1.1rem 1.6rem; cursor: pointer; font: inherit; color: inherit; border-radius: var(--radius-md); }
.bz-workbook-head:hover .bz-workbook-chev, .bz-quiz-head:hover .bz-workbook-chev { border-color: var(--text-primary); }
.bz-workbook-head:focus-visible, .bz-quiz-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.bz-workbook-kicker { grid-area: kicker; display: block; font-size: .7rem; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: .3rem; }
.bz-workbook-label { grid-area: label; display: block; font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; line-height: 1.25; letter-spacing: -0.01em; color: var(--text-primary); text-wrap: balance; }
.bz-quiz-title { grid-area: label; display: block; font-weight: 600; font-size: 1.05rem; line-height: 1.35; }
.bz-quiz-note { grid-area: note; display: block; margin-top: .25rem; }
.bz-quiz-head { cursor: pointer; }
.bz-workbook-chev { grid-area: chev; align-self: center; width: 30px; height: 30px; border: 1px solid var(--border-strong); border-radius: 50%; position: relative; transition: transform .25s, border-color .2s; }
.bz-workbook-chev::before { content: ''; position: absolute; left: 10px; top: 8px; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.open > .bz-workbook-head .bz-workbook-chev, .open > .bz-quiz-head .bz-workbook-chev { transform: rotate(180deg); }
.bz-workbook-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s ease; }
.open > .bz-workbook-panel { grid-template-rows: 1fr; }
.bz-workbook-panel-inner { min-height: 0; overflow: hidden; visibility: hidden; padding: 0 1.6rem 1.3rem; }
.open > .bz-workbook-panel > .bz-workbook-panel-inner { visibility: visible; }
.bz-quiz .quiz { padding-top: .2rem; }
.quiz-options-list { grid-template-columns: 1fr; }
.bz-workbook-help { font-size: .95rem; line-height: 1.6; color: var(--text-secondary); }
.bz-workbook-help p:last-child { margin-bottom: .9rem; }
.bz-workbook-help ul, .bz-workbook-help ol { margin-bottom: .9rem; }
.bz-workbook textarea { font-size: 1rem; line-height: 1.6; min-height: 140px; padding: .8rem 1rem; }
.workbook-foot { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; margin-top: .8rem; }
.workbook-state { margin-left: auto; font-size: .8rem; }
.workbook-comments { margin-top: .4rem; }
.workbook-comments:empty { display: none; }
.bz-tool { margin: 2.4rem 0; }
.bz-tool-fallback { display: none; }
.article-pn { display: flex; justify-content: space-between; gap: 1.5rem; margin-top: 4rem; padding-top: 1.6rem; border-top: 1px solid var(--border); flex-wrap: wrap; }
.article-pn a { text-decoration: none; display: flex; flex-direction: column; gap: .15rem; max-width: 48%; font-size: 1.05rem; }
.article-pn a:hover strong { color: var(--accent); }
.article-pn strong { transition: color .2s; }
.pn-next { text-align: right; margin-left: auto; }

/* ---- assistant panel ---- */
.reader-chat { border-left: 1px solid var(--border); background: var(--bg-secondary); overflow: clip; }
.reader-chat .chat { position: sticky; top: calc(var(--topbar-h) + var(--progress-h)); height: calc(100vh - var(--topbar-h) - var(--progress-h)); width: var(--chat-w); }
.chat { display: flex; flex-direction: column; background: var(--bg-secondary); }
.chat-standalone { height: min(70vh, 640px); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); background: var(--bg-secondary); }
.chat-head > div:first-child { min-width: 0; }
.chat-head strong { font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; letter-spacing: -0.01em; display: block; line-height: 1.2; }
.chat-head .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: .15rem; }
.chat-head .row { flex: none; }
.chat-log { flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .8rem; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .15) transparent; }
.msg { max-width: 92%; padding: .75rem 1rem; border-radius: var(--radius-md); font-size: .93rem; line-height: 1.55; }
.msg p { margin: 0 0 .55em; } .msg p:last-child { margin: 0; } .msg ul { margin: .3em 0; padding-left: 1.2rem; } .msg li { margin-bottom: .25em; } .msg li::marker { color: var(--accent); }
.msg code { font-size: .9em; background: rgba(0, 0, 0, .05); padding: .1em .3em; border-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--text-primary); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.pending { color: var(--text-muted); font-style: italic; }
.msg.error { border-color: var(--danger); color: var(--danger); }
.chat-form { display: flex; gap: var(--gap); padding: .9rem 1rem .5rem; border-top: 1px solid var(--border); background: var(--bg-secondary); align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; padding: .7rem .9rem; }
.chat-form .btn { min-height: 44px; }
.chat-quota { padding: .2rem 1.25rem .9rem; background: var(--bg-secondary); font-size: .78rem; }
.chat-history { padding: .5rem; border-bottom: 1px solid var(--border); background: #fff; max-height: 40%; overflow: auto; }
.chat-history p { padding: .4rem .6rem; margin: 0; }
.chat-history-item { display: flex; justify-content: space-between; gap: .5rem; width: 100%; text-align: left; background: none; border: 0; padding: .5rem .7rem; font: inherit; font-size: .88rem; border-radius: 6px; cursor: pointer; }
.chat-history-item:hover { background: var(--bg-secondary); }
.admin-conv { max-height: 400px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: .8rem; background: var(--bg-secondary); }
.tool-chat { margin-top: 1.2rem; }

/* ---- tools ---- */
.tool { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-secondary); padding: 1.5rem 1.6rem; }
.tool-host { padding: 0; border: 0; background: none; }
/* standalone tool pages already carry the title in the page head, so the frame's own head steps back */
.tool-host > .tool-head { border-top: 1px solid var(--border); padding-top: 1.4rem; margin-top: .5rem; align-items: baseline; }
.tool-host > .tool-head .section-label { display: none; }
.tool-host > .tool-head .tool-title { font-family: var(--font-body); font-weight: 600; font-size: 1.05rem; }
.tool-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: .5rem; }
.tool-title { font-family: var(--font-display); font-weight: 400; font-size: 1.5rem; letter-spacing: -0.01em; line-height: 1.2; }
.tool-status { font-size: .8rem; white-space: nowrap; }
.tool-intro { margin-bottom: 1.2rem; color: var(--text-secondary); }
.tool-body label { margin-top: .6rem; }
.quiz-progress { font-size: .8rem; }
.quiz-q { font-size: 1.15rem; font-weight: 600; line-height: 1.4; margin: .4rem 0 1rem; }
.quiz-options { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.quiz-opt { text-align: left; background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .85rem 1rem; font: inherit; line-height: 1.45; cursor: pointer; display: flex; flex-direction: column; gap: .15rem; transition: border-color .15s, background .15s; }
.quiz-opt:hover { border-color: var(--text-primary); }
.quiz-opt.right { border-color: var(--ok); background: rgba(46, 125, 79, .08); }
.quiz-opt.wrong { border-color: var(--danger); background: rgba(179, 38, 30, .07); }
.quiz-feedback { margin-top: 1rem; padding: .9rem 1.1rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; line-height: 1.5; }
.quiz-feedback-text { flex: 1 1 16rem; min-width: 0; }
.quiz-feedback [data-next] { margin-left: auto; }
.quiz-done { padding-top: .3rem; }
.quiz-summary { list-style: none; padding: 0; margin: .4rem 0 1rem; display: grid; gap: .3rem; font-size: .92rem; }
.quiz-summary li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem .7rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.quiz-score { font-family: var(--font-display); font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.quiz-review { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: var(--gap); }
.quiz-review li { padding: .7rem .9rem; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.embryo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1.4rem; }
.embryo-src { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: var(--gap); }
.embryo-src.empty { border-style: dashed; background: transparent; }
.embryo-src .section-label { margin-bottom: .2rem; }
.mmap { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; color: var(--accent); }
.mmap-edges { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.mmap-col { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: .8rem; min-height: 220px; display: flex; flex-direction: column; gap: .5rem; color: var(--text-primary); transition: border-color .15s, background .15s; }
.mmap-col.over { border-color: var(--accent); background: var(--accent-tint); }
.mmap-col-head { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.mmap-cards { display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.mmap-card { position: relative; z-index: 2; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .7rem; font-size: .9rem; line-height: 1.4; cursor: grab; display: flex; justify-content: space-between; gap: .4rem; align-items: flex-start; }
.mmap-card.linking { outline: 2px solid var(--accent); outline-offset: 1px; }
.mmap-actions { display: flex; gap: .1rem; flex: none; }
.mmap-actions button { background: none; border: 0; cursor: pointer; color: var(--text-muted); font-size: .95rem; padding: 0 .25rem; border-radius: 4px; }
.mmap-actions button:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.mmap-add { background: none; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: .45rem; font: inherit; font-size: .82rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: border-color .15s, color .15s; }
.mmap-add:hover { border-color: var(--text-primary); color: var(--text-primary); }
.nnl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.nnl-col { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: .9rem; min-height: 260px; display: flex; flex-direction: column; gap: .6rem; transition: border-color .15s, background .15s; }
.nnl-col.over { border-color: var(--accent); background: var(--accent-tint); }
.nnl-head strong { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin-bottom: .2rem; }
.nnl-head .small { font-size: .82rem; line-height: 1.45; }
.nnl-cards { display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.nnl-card { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .9rem; cursor: grab; line-height: 1.45; }
.nnl-card strong { display: block; margin-bottom: .2rem; }
.table.cod input, .table.cod select { width: 100%; min-width: 7rem; }
.table.cod td:first-child input { min-width: 12rem; }

/* ---- responsive ---- */
@media (max-width: 1180px) { :root { --menu-w: 250px; --chat-w: 360px; } }
@media (max-width: 1100px) {
    .reader.chat-open .reader-menu { display: none; }
    .reader.chat-open { grid-template-columns: minmax(0, 1fr) var(--chat-w); }
    .reader.chat-open .progress { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
    .topbar-inner, body.reading .topbar-inner { padding: 0 1.25rem; }
    .topnav { display: none; position: absolute; top: var(--topbar-h); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; background: #fff; border-bottom: 1px solid var(--border); padding: .6rem 1rem 1rem; box-shadow: var(--shadow); }
    .topnav.open { display: flex; }
    .topnav a, .topnav-signout { padding: .75rem .5rem; font-size: 1rem; text-align: left; margin: 0; }
    .topnav a.on::after { display: none; }
    .topnav a.on { color: var(--accent); }
    .topnav-toggle { display: flex; }
    .reader, .reader.chat-open, .reader.menu-closed, .reader.menu-closed.chat-open { grid-template-columns: minmax(0, 1fr); }
    .reader-menu { display: none; position: fixed; top: calc(var(--topbar-h) + var(--progress-h)); left: 0; bottom: 0; width: min(85vw, 320px); z-index: 30; box-shadow: var(--shadow-lg); border-right: 0; overflow: auto; }
    .reader:not(.menu-closed) .reader-menu { display: block; }
    .reader:not(.menu-closed)::before { content: ''; position: fixed; inset: calc(var(--topbar-h) + var(--progress-h)) 0 0 0; background: rgba(26, 26, 31, .3); z-index: 29; }
    .reader-menu-inner { position: static; width: auto; max-height: none; padding: 1.4rem 1.25rem 3rem; }
    .reader-chat { display: none; }
    .reader.chat-open .reader-chat { display: block; position: fixed; inset: calc(var(--topbar-h) + var(--progress-h)) 0 0 0; z-index: 40; border-left: 0; }
    .reader-chat .chat, .reader.chat-open .reader-chat .chat { position: static; width: auto; height: 100%; }
    .chat-log { padding: 1rem 1.25rem; }
    .reader-bar { padding: .5rem 1rem; gap: .6rem; }
    .reader-inner { padding: 2.2rem 1.25rem 4rem; }
    .article-head .h-serif { font-size: 2.1rem; }
    .article-body { font-size: 1.03rem; }
    .article-body h2 { font-size: 1.65rem; margin-top: 2.8rem; }
    .article-body blockquote { font-size: 1.15rem; padding-left: 1.1rem; }
    .bz-callout { padding: 1.2rem 1.25rem; }
    .bz-workbook-head, .bz-quiz-head { padding: 1rem 1.2rem; }
    .bz-workbook-panel-inner { padding: 0 1.2rem 1.1rem; }
    .bz-workbook-label { font-size: 1.2rem; }
    .workbook-state { margin-left: 0; flex-basis: 100%; }
    .container { padding-inline: 1.25rem; padding-block: 2.2rem 4rem; }
    .page-head { margin-bottom: 1.8rem; }
    .mmap { grid-template-columns: 1fr 1fr; } .mmap-edges { display: none; }
    .nnl { grid-template-columns: 1fr; }
    .embryo-grid { grid-template-columns: 1fr; }
    .tl-item { grid-template-columns: 44px 1fr; gap: .8rem; padding: 1rem 1.1rem; }
    .tl-num { font-size: 1.8rem; }
    .rating { grid-template-columns: 1fr; gap: .5rem; }
    fieldset { padding: 1.2rem 1.25rem; }
    .auth { padding: 1.5rem 1rem; align-items: start; }
    .auth-card { padding: 1.8rem 1.4rem; }
    .modal { padding: 1.5rem 1.25rem; }
    .list-item { flex-direction: column; }
}
@media (max-width: 560px) {
    .reader-bar .btn-long { display: none; }
    .reader-bar .btn-short { display: inline; }
    .reader-bar > .muted { font-size: .8rem; }
    .brand-cohort { max-width: 34vw; }
    .mmap { grid-template-columns: 1fr; }
    .article-pn { flex-direction: column; }
    .article-pn a { max-width: 100%; }
    .pn-next { text-align: left; margin-left: 0; }
    .btn { padding-inline: 1.15rem; }
    .btn-s { padding-inline: .8rem; }
    .cards.three { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .rating-scale { width: 100%; } .rating-scale label { flex: 1; } .rating-scale span { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .reader, .progress i, .btn, .toast, .swatch { transition: none; } .bz-parallax-art { transform: none !important; } }
@media print { .topbar, .reader-menu, .reader-chat, .reader-bar, .progress, .article-pn, .workbook-foot { display: none !important; } .reader { display: block; } .reader-inner { max-width: none; padding: 0; } }


/* ---- sources, reading library, attachments, template editor ---- */
.bz-sources { list-style: none; margin: 1rem 0 2rem; padding: 0; display: grid; gap: .5rem; }
.bz-source { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); gap: .8rem; align-items: baseline; padding: .65rem .9rem; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.bz-source-kind { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 600; line-height: 1.45; }
.bz-source-main { min-width: 0; }
.bz-source a { font-weight: 600; font-size: .95rem; line-height: 1.45; }
.bz-source-by { display: block; font-size: .82rem; color: var(--text-muted); margin-top: .1rem; line-height: 1.4; }
.bz-reading { padding-left: 1.2rem; margin: .6rem 0 2rem; }
.bz-reading li { margin-bottom: .4rem; }
.bz-callout > .bz-callout-title:only-child { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; line-height: 1.35; margin: 0; letter-spacing: -0.01em; }
.workbook-files { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.workbook-file { display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .7rem; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 999px; font-size: .85rem; }
.workbook-file a { text-decoration: none; font-weight: 600; }
.tpl { border-top: 1px solid var(--border); padding: .7rem 0; }
.tpl summary { cursor: pointer; }
.tpl label { margin-top: .6rem; }
.tpl-default { white-space: pre-wrap; font: inherit; font-size: .82rem; color: var(--text-muted); background: var(--bg-secondary); padding: .6rem .8rem; border-radius: var(--radius-sm); margin: .3rem 0 0; }
.theme-toggle { background: none; border: 1px solid var(--border-strong); border-radius: 999px; width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0; color: var(--text-secondary); cursor: pointer; margin-left: .5rem; }
.theme-toggle svg { display: block; }
.theme-toggle:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* ---- dark mode: system preference by default, the toggle overrides both ways ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg-primary: #16171a; --bg-secondary: #1d1e22; --bg-card: #232428; --bg-card-hover: #2a2b30; --text-primary: #ecebe6; --text-secondary: #bcbab2; --text-muted: #8a8983; --border: rgba(255, 255, 255, 0.09); --border-strong: rgba(255, 255, 255, 0.18); --shadow: 0 10px 30px rgba(0, 0, 0, 0.45); color-scheme: dark; }
}
:root[data-theme="dark"] { --bg-primary: #16171a; --bg-secondary: #1d1e22; --bg-card: #232428; --bg-card-hover: #2a2b30; --text-primary: #ecebe6; --text-secondary: #bcbab2; --text-muted: #8a8983; --border: rgba(255, 255, 255, 0.09); --border-strong: rgba(255, 255, 255, 0.18); --shadow: 0 10px 30px rgba(0, 0, 0, 0.45); color-scheme: dark; }
/* surfaces that used literal white */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar, :root:not([data-theme="light"]) .reader-bar { background: rgba(22, 23, 26, .9); } :root:not([data-theme="light"]) .auth-card, :root:not([data-theme="light"]) .modal, :root:not([data-theme="light"]) .chat-head, :root:not([data-theme="light"]) .chat-form, :root:not([data-theme="light"]) .chat-quota, :root:not([data-theme="light"]) .msg.ai, :root:not([data-theme="light"]) input, :root:not([data-theme="light"]) textarea, :root:not([data-theme="light"]) select, :root:not([data-theme="light"]) .bz-workbook, :root:not([data-theme="light"]) .entry-text, :root:not([data-theme="light"]) .quiz-opt, :root:not([data-theme="light"]) .mmap-col, :root:not([data-theme="light"]) .nnl-col, :root:not([data-theme="light"]) .embryo-src, :root:not([data-theme="light"]) .figure-tools button, :root:not([data-theme="light"]) .rating-scale span, :root:not([data-theme="light"]) .quiz-review li, :root:not([data-theme="light"]) .quiz-feedback { background: var(--bg-card); color: var(--text-primary); } :root:not([data-theme="light"]) .msg.me, :root:not([data-theme="light"]) .btn-primary, :root:not([data-theme="light"]) .rating-scale input:checked + span { background: var(--text-primary); color: var(--bg-primary); } :root:not([data-theme="light"]) .card-attention, :root:not([data-theme="light"]) .comment, :root:not([data-theme="light"]) .cohort-note, :root:not([data-theme="light"]) .figure-info { background: #26231b; } :root:not([data-theme="light"]) .bz-figure-stage, :root:not([data-theme="light"]) .bz-parallax { background: #f6f5f2; } :root:not([data-theme="light"]) .brand-cohort img { background: #f6f5f2; padding: 2px 6px; border-radius: 4px; } }
:root[data-theme="dark"] .topbar, :root[data-theme="dark"] .reader-bar { background: rgba(22, 23, 26, .9); }
:root[data-theme="dark"] .auth-card, :root[data-theme="dark"] .modal, :root[data-theme="dark"] .chat-head, :root[data-theme="dark"] .chat-form, :root[data-theme="dark"] .chat-quota, :root[data-theme="dark"] .msg.ai, :root[data-theme="dark"] input, :root[data-theme="dark"] textarea, :root[data-theme="dark"] select, :root[data-theme="dark"] .bz-workbook, :root[data-theme="dark"] .entry-text, :root[data-theme="dark"] .quiz-opt, :root[data-theme="dark"] .mmap-col, :root[data-theme="dark"] .nnl-col, :root[data-theme="dark"] .embryo-src, :root[data-theme="dark"] .figure-tools button, :root[data-theme="dark"] .rating-scale span, :root[data-theme="dark"] .quiz-review li, :root[data-theme="dark"] .quiz-feedback { background: var(--bg-card); color: var(--text-primary); }
:root[data-theme="dark"] .msg.me, :root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .rating-scale input:checked + span { background: var(--text-primary); color: var(--bg-primary); }
:root[data-theme="dark"] .card-attention, :root[data-theme="dark"] .comment, :root[data-theme="dark"] .cohort-note, :root[data-theme="dark"] .figure-info { background: #26231b; }
:root[data-theme="dark"] .bz-figure-stage, :root[data-theme="dark"] .bz-parallax { background: #f6f5f2; }
:root[data-theme="dark"] .brand-cohort img { background: #f6f5f2; padding: 2px 6px; border-radius: 4px; }
:root[data-theme="dark"] .alm-detail, :root[data-theme="dark"] .quiz-summary li { background: var(--bg-card); }
:root[data-theme="dark"] .profile-menu, :root[data-theme="dark"] .tile { background: var(--bg-card); }
:root[data-theme="dark"] .prog.h1 { color: #e0b27a; } :root[data-theme="dark"] .prog.h2 { color: #d9c27a; } :root[data-theme="dark"] .prog.h3 { color: #8fd0a8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .alm-detail, :root:not([data-theme="light"]) .quiz-summary li { background: var(--bg-card); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .profile-menu, :root:not([data-theme="light"]) .tile { background: var(--bg-card); } :root:not([data-theme="light"]) .prog.h1 { color: #e0b27a; } :root:not([data-theme="light"]) .prog.h2 { color: #d9c27a; } :root:not([data-theme="light"]) .prog.h3 { color: #8fd0a8; } }

/* ---- automation calculator ---- */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.calc-field { display: flex; flex-direction: column; gap: .2rem; }
.calc-field span { font-size: .82rem; font-weight: 600; color: var(--text-secondary); }
.calc-field small { font-size: .74rem; }
.calc-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; margin: .5rem 0 1rem; }
.calc-tile { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .9rem; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.calc-tile b { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; line-height: 1.15; }
.calc-tile small { font-size: .74rem; line-height: 1.35; }
.calc-chart { width: 100%; height: auto; display: block; margin: .6rem 0 1rem; color: var(--text-primary); }
.calc-verdict p { margin: 0 0 .6em; font-size: .95rem; }

/* metrics map: a free canvas with the property and time axes as the background */
.mcv-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .7rem; }
.mcv-bar label { margin: 0; }
.mcv { position: relative; aspect-ratio: 760 / 420; background-color: #fff; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.mcv-axes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mcv-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; color: #1a1a1f; }
.mcv-note { position: absolute; width: 150px; transform: translate(-50%, -50%); background: #e9dfc4; border: 1.5px solid #9a7b2e; border-radius: 8px; padding: .55rem .65rem .35rem; font-size: .85rem; line-height: 1.35; font-weight: 600; color: #1a1a1f; cursor: grab; box-shadow: 0 4px 12px rgba(26, 26, 31, .08); overflow-wrap: anywhere; text-align: center; transition: background .2s, border-color .2s; }
.mcv-note.good { background: #dcebe1; border-color: #3e8a5a; }
.mcv-note.bad { background: #f3e2d6; border-color: #c0703a; }
.mcv-note.dragging { cursor: grabbing; box-shadow: 0 10px 24px rgba(26, 26, 31, .18); z-index: 3; }
.mcv-note.linking { outline: 2px solid #9a7b2e; outline-offset: 2px; }
.mcv.linking .mcv-note:not(.linking) { cursor: crosshair; }
.mcv-note-actions { display: flex; justify-content: flex-end; gap: .1rem; margin-top: .25rem; opacity: 0; transition: opacity .15s; }
.mcv-note:hover .mcv-note-actions, .mcv-note:focus-within .mcv-note-actions, .mcv-note.linking .mcv-note-actions { opacity: 1; }
.mcv-note-actions button { background: none; border: 0; cursor: pointer; color: #6b5a1e; font: inherit; font-size: .78rem; font-weight: 600; padding: .1rem .4rem; border-radius: 4px; }
.mcv-note-actions button:hover { background: rgba(0, 0, 0, .07); }
.mcv-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--text-muted); font-size: .9rem; padding: 2rem; pointer-events: none; }
.mcv-hint { font-size: .85rem; color: var(--text-muted); margin: .6rem 0 0; }
@media (hover: none) { .mcv-note-actions { opacity: 1; } }
@media (max-width: 600px) { .mcv-note { width: 104px; font-size: .74rem; padding: .4rem .45rem .25rem; } }

/* alignment matrix: games across, metric families down */
.alm { display: grid; grid-template-columns: minmax(130px, 1.4fr) repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: .4rem; }
.alm-h { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--text-muted); padding: .4rem .25rem; text-align: center; align-self: end; line-height: 1.3; transition: color .2s; }
.alm-h.on { color: var(--text-primary); }
.alm-r { padding: .5rem .5rem .5rem 0; font-size: .86rem; font-weight: 600; line-height: 1.25; align-self: center; }
.alm-r small { display: block; font-weight: 400; color: var(--text-muted); font-size: .72rem; margin-top: .1rem; }
.alm-c { border: 1px solid transparent; border-radius: 6px; padding: .6rem .2rem; font: inherit; font-size: .74rem; font-weight: 600; cursor: pointer; transition: opacity .2s, box-shadow .15s; }
.alm-c.strong { background: var(--ok); color: #fff; }
.alm-c.partial { background: #c9a84c; color: #1a1a1f; }
.alm-c.misaligned { background: rgba(192, 112, 58, .14); color: #8a4a1e; }
.alm-c.dim { opacity: .3; }
.alm-c.sel { box-shadow: 0 0 0 2px var(--bg-secondary), 0 0 0 4px var(--text-primary); }
.alm-detail { margin-top: 1rem; padding: .9rem 1.1rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .95rem; line-height: 1.55; }
.alm-detail p { margin: 0 0 .5em; }
.alm-detail p:last-child { margin-bottom: 0; }
.alm-legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .78rem; color: var(--text-secondary); margin-top: .6rem; }
.alm-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
@media (max-width: 640px) { .alm { grid-template-columns: minmax(84px, 1fr) repeat(4, minmax(0, 1fr)); gap: 3px; } .alm-c { font-size: .6rem; padding: .45rem .05rem; } .alm-r { font-size: .74rem; } .alm-r small { display: none; } .alm-h { font-size: .58rem; } }

/* interactive strategic context */
.ctx-sizes { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.ctx-sizes button { font: inherit; font-size: .82rem; font-weight: 600; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent; color: var(--text-secondary); cursor: pointer; }
.ctx-sizes button.on { background: var(--text-primary); color: var(--bg-primary); border-color: var(--text-primary); }
.ctx-stage svg { width: 100%; height: auto; display: block; }
.ctx-note { font-size: .9rem; color: var(--text-secondary); margin: .6rem 0 0; }
