/* The nine training lessons keep the KAST Next look: its two stylesheets are byte-identical copies
   (kast-card.lock.json, "training") and sit in a cascade layer, so every rule of this file wins over them. */
@import url("kast-next-styles.css") layer(kast-next);
@import url("kast-next-home.css") layer(kast-next);
/* My KAST M1 synthetic preview. Look: KAST Next, design baseline v1.12 ("Soft white, Geist").
   Tokens, radii, shadow and type scale are the ones in kast-next-web/public/styles.css and home.css
   of the kast repository; no colour is defined here that is not there. The KAST Card itself is
   styled only by kast-card/locked-card.css, a locked copy that is not overridden here: the comment
   layer and the fourteen compound colours stay outside this file. */
@font-face { font-family: "Geist"; src: url("fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  color-scheme: light;
  --font-sans: "Geist", "Geist Variable", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono", "Geist Mono Variable", ui-monospace, "SF Mono", Menlo, monospace;
  --surface: #fff;
  --surface-2: #fafaf7;
  --surface-tint: #f5f5f0;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --text-dim: #a8a8a8;
  --heading: oklch(.141 .005 285.823);
  --border: #ececea;
  --border-soft: #f1f1ee;
  --border-hover: #9b9b96;
  --orange: #c8743a;
  --orange-soft: #ecd6c1;
  --orange-deep: #a75d27;
  --error: #a32d2d;
  --cream: #f4ede1;
  --r-card: 24px;
  --r-sheet: 28px;
  --r-tile: 16px;
  --r-input: 14px;
  --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(41,37,36,.04), 0 14px 34px -22px rgba(41,37,36,.28);
  --ring: inset 0 0 0 1px var(--border-soft);
  --ease: cubic-bezier(.23,1,.32,1);
  --gutter: 20px;
  --bar: 36px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--surface-2); color: var(--text); font: 400 15px/1.5 var(--font-sans); font-feature-settings: "cv11","ss01"; -webkit-font-smoothing: antialiased; }
button:where(:not(.training *)), select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, .canvas-node:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* Buttons are pills, as on KAST Next (.btn, .pc-btn). */
/* Element rules stop at the lessons (.training), which keep the KAST Next styles from the layer above. */
button:where(:not(.training *)) { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 22px; border: 0; border-radius: var(--r-pill); background: var(--text); color: var(--surface); font: 500 15px/1 var(--font-sans); transition: transform .15s var(--ease), background-color .15s var(--ease); }
button:where(:not(.training *)):active { transform: scale(.97); }
button[disabled] { opacity: .45; cursor: not-allowed; }
button.ghost, button.chip, button.node-action { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
button.ghost:hover, button.chip:hover, button.node-action:hover { box-shadow: inset 0 0 0 1px var(--border-hover); }
button.small, button.node-action { min-height: 36px; padding: 0 14px; font-size: 13px; }
button.link { min-height: 44px; padding: 0 4px; background: none; color: var(--text-muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Watermark: always visible, also on the phone layout. */
.safety { position: sticky; top: 0; z-index: 20; min-height: var(--bar); display: flex; align-items: center; justify-content: center; padding: 8px var(--gutter); background: var(--orange-soft); color: var(--text); font: 500 11px/1.3 var(--font-mono); letter-spacing: .08em; text-align: center; }

/* Frame: a soft-white page, a rounded side panel, white rounded cards. */
.shell { display: grid; grid-template-columns: 264px minmax(0,1fr); gap: 8px; min-height: calc(100vh - var(--bar)); padding: 16px; }
.sidebar { position: sticky; top: calc(var(--bar) + 16px); align-self: start; display: flex; flex-direction: column; min-height: calc(100vh - var(--bar) - 32px); background: var(--surface); border-radius: var(--r-sheet); box-shadow: var(--shadow-card), var(--ring); padding: 28px 18px 22px; }
.logo { margin: 2px 12px 44px; display: grid; gap: 8px; }
.mk { width: 13px; height: 18px; flex: none; }
.sidebar nav { display: grid; gap: 6px; }
.nav { display: block; width: 100%; min-height: 44px; background: none; border: 0; padding: 0 18px; text-align: left; color: var(--text-muted); border-radius: var(--r-pill); font: 500 15px/1 var(--font-sans); transition: background-color .15s var(--ease), color .15s var(--ease); }
.nav:hover { background: var(--surface-tint); }
.nav:active, .card-hit:active { transform: none; }
.nav.active { background: var(--text); color: var(--surface); }
label:where(:not(.training *)), .field-label { font: 500 12.5px/1.3 var(--font-sans); color: var(--text-muted); }
.field-label { margin: 0; }
select, input:not([type=range]), textarea { width: 100%; min-width: 0; min-height: 48px; padding: 12px 18px; background: var(--surface); border: 0; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--border); transition: box-shadow .15s var(--ease); }
textarea { border-radius: var(--r-card); padding: 16px 18px; resize: vertical; }
select:hover, input:not([type=range]):hover, textarea:hover { box-shadow: inset 0 0 0 1px var(--border-hover); }

main { margin: 0; padding: 0 32px 48px; min-width: 0; max-width: 1180px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 132px; }
.eyebrow { margin: 0 0 6px; font: 500 11px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
h1:where(:not(.training *)) { margin: 0; font: 700 clamp(34px, 4.2vw, 48px)/1.02 var(--font-sans); letter-spacing: -.04em; color: var(--heading); }
h2:where(:not(.training *)) { margin: 0; font: 600 22px/1.25 var(--font-sans); letter-spacing: -.015em; color: var(--heading); }
h3:where(:not(.training *)) { margin: 18px 0 6px; font: 500 11px/1.2 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--orange-deep); }
.muted, .tool small { color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.intro { margin: 0 0 28px; max-width: 46ch; font-size: 17px; line-height: 1.5; color: var(--text-muted); }
.stamp { display: block; font: 500 11px/1.4 var(--font-mono); letter-spacing: .04em; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tool { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card), var(--ring); padding: 28px; margin: 0 0 20px; display: grid; gap: 16px; max-width: 640px; }
.tool p { margin: 0; }
.tool > button { justify-self: start; }
.controls { display: flex; gap: 10px; }
.controls button { flex-shrink: 0; }
.reminder { background: var(--cream); box-shadow: none; }

/* Library: one Profile per card, with its KAST Card. */
.library-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
/* One frame and one display size for the KAST Card in My KAST -> Collection and in Canvas (owner decision kast#51 6970985217): the same
   rules for both, never a second sizing path. --kast-card-w is the Card's rendered width (250 px, the Collection cap; in the fit frame the
   Collection rule below); --frame-pad is the frame's padding. Display size and frame only: the locked Card and its stylesheet are untouched. */
:root { --kast-card-w: 250px; } /* fallback for a browser without @property (kast-care#78 review 6972931156) */
@property --kast-card-w { syntax: '<length>'; inherits: true; initial-value: 250px; }
.library-card, .canvas-card { --frame-pad: 28px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card), var(--ring); padding: var(--frame-pad); display: grid; gap: 14px; justify-items: center; }
.library-card .card-host, .canvas-card .card-host { max-width: var(--kast-card-w); }
.library-card .code { justify-self: start; font: 500 11px/1.2 var(--font-mono); letter-spacing: .1em; color: var(--text-muted); }
.library-card h2 { justify-self: start; font: 600 18px/1.25 var(--font-sans); letter-spacing: -.02em; }
.library-card .actions { justify-self: start; }
.card-host { width: 100%; max-width: 250px; }
.card-unavailable { padding: 28px 14px; border-radius: var(--r-tile); background: var(--surface-tint); color: var(--text-muted); font-size: 13px; text-align: center; }

/* Canvas: the KAST Card in the centre, the user's own notes around it. */
.canvas-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 20px; align-items: start; }
.canvas-board { position: relative; overflow: hidden; min-height: 760px; border-radius: var(--r-sheet); background-color: var(--surface); background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 22px 22px; box-shadow: var(--shadow-card), var(--ring); }
#edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#edges path { fill: none; stroke: var(--border-hover); stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.canvas-card { position: absolute; left: 38%; top: 48%; transform: translate(-50%, -50%); width: calc(var(--kast-card-w) + 2 * var(--frame-pad)); }
#canvas-code, #checkin-code { font: 500 11px/1.3 var(--font-mono); letter-spacing: .1em; color: var(--text-muted); text-align: center; }

/* Comment layer above the Card. It is our own box and our own buttons; the Card under it is untouched. */
.card-stage { position: relative; }
.card-overlay { position: absolute; inset: 0; }
.card-hit { position: absolute; display: block; min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; border-radius: 8px; cursor: pointer; transition: background-color .15s var(--ease), box-shadow .15s var(--ease); }
.card-hit:hover, .card-hit.has-comments:hover { background: color-mix(in srgb, var(--orange) 14%, transparent); box-shadow: inset 0 0 0 1px var(--orange); }
.card-hit.is-picked, .card-hit.is-picked:hover { background: color-mix(in srgb, var(--orange) 22%, transparent); box-shadow: inset 0 0 0 2px var(--orange); }
.card-hit.has-comments { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--orange) 45%, transparent); }
.card-marker { position: absolute; top: 50%; right: -9px; transform: translateY(-50%); min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-pill); background: var(--orange); color: var(--surface); font: 600 10px/1 var(--font-mono); box-shadow: 0 0 0 2px var(--surface); }
.card-hit-header .card-marker { right: -22px; }
.card-hit-total .card-marker { top: -2px; right: -6px; transform: none; }
.card-tip { display: none; position: absolute; z-index: 3; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: 240px; padding: 9px 13px; border-radius: var(--r-tile); background: var(--text); color: var(--surface); font: 500 12px/1.4 var(--font-sans); text-align: left; overflow-wrap: anywhere; box-shadow: var(--shadow-card); pointer-events: none; }
.card-hit:hover .card-tip, .card-hit:focus-visible .card-tip { display: block; }
.card-hit:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; background: color-mix(in srgb, var(--orange) 14%, transparent); }
.card-sheet .card-host { max-width: 300px; margin: 0 auto 18px; }

/* Note nodes: rounded cards with pill buttons. */
.canvas-node { position: absolute; max-width: 220px; min-width: 170px; padding: 18px 18px 14px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card), var(--ring); touch-action: none; cursor: grab; user-select: none; overflow-wrap: break-word; }
.canvas-node:active { cursor: grabbing; }
/* Notes may overlap on a short board: the one under the pointer or keyboard comes to the front, so its Edit and Delete stay reachable. */
.canvas-node:hover, .canvas-node:focus-within { z-index: 2; }
.canvas-node strong { display: block; font: 500 11px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--orange-deep); }
.canvas-node p { margin: 6px 0 8px; font-size: 14px; line-height: 1.45; }
.canvas-node button.node-action { min-height: 32px; margin: 12px 6px 0 0; font-size: 12px; }
.tools { background: var(--surface); border-radius: var(--r-sheet); box-shadow: var(--shadow-card), var(--ring); padding: 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.tools h2 { font: 600 18px/1.25 var(--font-sans); letter-spacing: -.02em; }
.tools p { margin: 0; }
.tools hr { border: 0; border-top: 1px solid var(--border-soft); width: 100%; margin: 12px 0; }
.tools > button { align-self: flex-start; }
#sent-invites > div, #invitations > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
#invitations p { margin: 0; }
#notice { margin: 20px 0; min-height: 20px; color: var(--orange-deep); font-size: 13px; }

/* Chips: Card elements, check-in choices, the Profile picker. */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
button.chip { min-height: 44px; padding: 0 18px; font-size: 14px; }
.tools button.chip { min-height: 36px; padding: 0 13px; font-size: 13px; }
button.chip[aria-pressed="true"] { background: var(--text); color: var(--surface); box-shadow: none; }
button.chip.has-comments { box-shadow: inset 0 0 0 1px var(--orange); }
.chip-count { min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-pill); background: var(--orange); color: var(--surface); font: 600 10px/1 var(--font-mono); }
button.chip-clear { min-height: 32px; padding: 0 12px; font-size: 12px; margin-left: auto; }

/* Sheets: the note editor and the comment timeline. */
.draft-editor { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 80px); border: 0; border-radius: var(--r-sheet); padding: 32px 28px 28px; color: var(--text); box-shadow: var(--shadow-card), var(--ring); }
.draft-editor::backdrop { background: color-mix(in srgb, var(--text) 35%, transparent); }
.draft-editor h2 { margin: 0 0 14px; }
.draft-editor label { display: block; margin: 16px 0 8px; }
.draft-editor [role=status] { color: var(--error); min-height: 22px; margin: 6px 0; font-size: 13px; }
.sheet-head p { margin: 0 0 6px; }
.sheet-head h2 { margin: 0 0 8px; }
.timeline { list-style: none; margin: 18px 0 4px; padding: 0 0 0 18px; display: grid; gap: 10px; border-left: 2px solid var(--orange-soft); }
.timeline-entry { position: relative; padding: 14px 16px; border-radius: var(--r-tile); background: var(--surface-2); box-shadow: var(--ring); }
.timeline-entry::before { content: ""; position: absolute; left: -25px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px var(--surface); }
.timeline-entry p { margin: 6px 0 10px; font-size: 15px; overflow-wrap: anywhere; }
.empty-line { margin: 18px 0; }
.comment-sheet > .actions { margin-top: 18px; }

/* Today: the check-in, one question per screen, next to the KAST it is about. */
.checkin-layout { display: grid; grid-template-columns: 250px minmax(0, 640px); gap: 32px; align-items: start; }
.checkin-side { position: sticky; top: calc(var(--bar) + 24px); display: grid; gap: 10px; justify-items: center; }
.checkin-step { gap: 18px; }
.field-scale { gap: 4px; }
/* Outside the fit frame (phones, small windows) the step keeps its order: the note, the Back · Skip · Next row, then Discard. */
.step-note { display: contents; }
.checkin-step > .actions { order: 1; }
.step-note > #checkin-discard { order: 2; justify-self: start; }
.progress { height: 10px; border-radius: var(--r-pill); background: var(--surface-tint); overflow: hidden; }
.progress-fill { display: block; height: 100%; border-radius: var(--r-pill); background: var(--orange); transition: width .3s var(--ease); }
.checkin-step h2 { font: 600 28px/1.15 var(--font-sans); letter-spacing: -.03em; }
.field { display: grid; gap: 10px; }
.checkin-step .eyebrow { margin: 0; }
/* Screen 1: the user's Cards as large tap targets. */
.kast-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
button.kast-tile { display: grid; gap: 10px; justify-items: center; min-height: 0; padding: 14px 12px 16px; border-radius: var(--r-card); background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); font-size: 13px; line-height: 1.3; text-align: center; }
button.kast-tile:hover { box-shadow: inset 0 0 0 1px var(--border-hover); }
button.kast-tile[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--orange); }
.kast-tile .card-host { max-width: 130px; pointer-events: none; }
/* Faces: five plain line faces. */
.faces { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
button.face-button { display: grid; gap: 6px; justify-items: center; min-height: 0; padding: 12px 4px; border-radius: var(--r-card); background: var(--surface); color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--border); font-size: 12px; line-height: 1.2; }
button.face-button:hover { box-shadow: inset 0 0 0 1px var(--border-hover); }
button.face-button[aria-pressed="true"] { background: var(--text); color: var(--surface); box-shadow: none; }
.face { width: 44px; height: 44px; }
.face-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.face-dot { fill: currentColor; }
/* Sliders: four on one screen; on the "after" screen the "before" value stays as a ghost mark. */
.scale-track { position: relative; }
.scale-ghost { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 2px var(--text-dim); pointer-events: none; }
.scale-before { font: 500 11px/1.4 var(--font-mono); color: var(--text-muted); }
.smell-card { max-width: 300px; justify-self: center; }
.day-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 18px; align-items: center; }
.day-card { max-width: 96px; }
.day-head p { margin: 0 0 6px; }
.scale-head { display: flex; align-items: baseline; gap: 10px; }
.scale-value { font: 700 30px/1 var(--font-sans); letter-spacing: -.04em; color: var(--heading); font-variant-numeric: tabular-nums; margin-left: 4px; }
.scale-state { font-size: 13px; color: var(--text-muted); }
input.range { position: relative; display: block; width: 100%; height: 36px; margin: 0; padding: 0; accent-color: var(--orange); cursor: pointer; }
input.range.unset { accent-color: var(--text-muted); opacity: .55; }
.scale-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--text-muted); }
.complete { display: grid; justify-items: center; gap: 8px; padding: 32px 24px; margin: 0 0 20px; max-width: 640px; border-radius: var(--r-card); background: var(--cream); text-align: center; }
.complete p { margin: 0; }
.complete-badge { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: var(--surface); font: 600 26px/1 var(--font-sans); }
.answers { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px 16px; font-size: 15px; }
.answers dt { color: var(--text-muted); }
.answers dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.compare { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare th, .compare td { padding: 10px 8px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; overflow-wrap: break-word; }
.compare tr:first-child th { font: 500 11px/1.3 var(--font-mono); letter-spacing: .06em; color: var(--text-muted); }
.compare th[scope=row] { font-weight: 400; color: var(--text-muted); }
.calendar { max-width: 360px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head, .cal-day, .cal-blank { aspect-ratio: 1; display: grid; place-items: center; font: 500 12px/1 var(--font-mono); }
.cal-head { color: var(--text-dim); }
.cal-day { border-radius: 50%; color: var(--text-muted); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--border-hover); color: var(--text); }
.cal-day.filled { background: var(--orange); color: var(--surface); box-shadow: none; }
#history h2 { margin: 12px 0 8px; font: 600 18px/1.25 var(--font-sans); letter-spacing: -.02em; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 640px; padding: 16px 20px; margin: 0 0 10px; border-radius: var(--r-tile); background: var(--surface); box-shadow: var(--ring); }
.history-row p { margin: 4px 0 0; font-size: 14px; overflow-wrap: anywhere; }

@media (max-width: 850px) {
  /* One column: the menu card, then the page. The rows take their own height and sit at the top (audit finding UI-06, kast issue 206), so a short page
     starts right under the menu instead of the spare screen height being shared out between the two rows. */
  .shell { grid-template-columns: minmax(0,1fr); align-content: start; padding: 12px; gap: 4px; }
  .sidebar { position: static; display: block; min-height: 0; padding: 16px; border-radius: var(--r-card); }
  .logo { margin: 0 4px 12px; display: flex; align-items: center; justify-content: space-between; }
  .sidebar nav { display: flex; gap: 6px; overflow-x: auto; }
  .nav { flex: none; width: auto; }
  main { padding: 0 8px 32px; }
  .top { min-height: 96px; }
  .tool { padding: 22px; }
  .library-card, .canvas-card { --frame-pad: 22px; }
  .canvas-layout { grid-template-columns: minmax(0,1fr); }
  /* Phone: the Card first, in its Collection frame at the Collection size (kast#51 6970985217: the whole face in the screen width, no
     sideways cut, no zoom); the notes follow as a list. */
  .canvas-board { min-height: 0; display: grid; gap: 14px; justify-items: center; padding: 22px 8px; }
  #edges { display: none; }
  .canvas-card { position: static; transform: none; width: min(100%, calc(var(--kast-card-w) + 2 * var(--frame-pad))); }

  #nodes { width: 100%; display: grid; gap: 12px; }
  .canvas-node { position: static; max-width: none; min-width: 0; touch-action: auto; cursor: default; }
  .card-marker { right: -4px; }
  .controls { flex-wrap: wrap; }
  .library-cards { grid-template-columns: minmax(0,1fr); }
  .checkin-layout { grid-template-columns: minmax(0,1fr); gap: 16px; }
  .checkin-side { position: static; grid-template-columns: 112px minmax(0,1fr); align-items: center; justify-items: start; gap: 16px; padding: 14px 18px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--ring); }
  .checkin-side .card-host { max-width: 112px; }
  #checkin-code { text-align: left; }
  .checkin-step h2 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  button:where(:not(.training *)):active { transform: none; }
}

/* Fit to the screen (owner decision kast-care#16 6857174487). A window of 1024 x 640 px or larger, or 1180 x 560 px or larger (700 px tall until kast#51 6895239899;
   kast-care#58 review 6896196095: the frame starts only where every check-in step fits), never scrolls the page: the watermark bar, the sidebar and the working area share the window height, and long content scrolls
   inside its own panel. The KAST Card is scaled as a whole to the height it has (53 : 86 kept, never cropped);
   only the width of the box that holds it changes, the locked Card and its stylesheet are untouched.
   Outside that (narrower than 1024 px, shorter than 560 px, or below 1180 px wide and 640 px tall) the page scrolls as before. */
@media (min-width: 1024px) and (min-height: 640px), (min-width: 1180px) and (min-height: 560px) {
  body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
  .safety { flex: none; }
  .shell { flex: 1 1 auto; min-height: 0; padding: 12px 16px 16px; }
  .sidebar { position: static; min-height: 0; height: 100%; overflow-y: auto; padding: 22px 18px 18px; }
  .logo { margin-bottom: 28px; }
  main { display: flex; flex-direction: column; min-height: 0; height: 100%; padding: 0 24px 0 32px; }
  .top { flex: none; min-height: 0; padding: 14px 0 6px; }
  .top h1 { font-size: clamp(30px, 3vw, 38px); white-space: nowrap; overflow-wrap: normal; }
  .eyebrow { margin-bottom: 4px; }
  .intro { flex: none; margin: 0 0 14px; max-width: 110ch; font-size: 15px; line-height: 1.45; }
  /* The height of the Collection's one-line intro and its margin (the rule above; 14 px and 10 px below 700 px tall). */
  :root { --intro-block: calc(15px * 1.45 + 14px); }
  /* The Card size of Collection, shared with Canvas (kast#51 6970985217). Collection's Cards panel is the screen less the intro row,
     and the Card is held to that panel's height less 170 px (its title, code and buttons) and the panel's 18 px padding, 53 : 86 kept.
     The two screens have the same height, so the rule is written once against the screen: Canvas gets exactly the Collection width. */
  #library:not([hidden]), #canvas:not([hidden]) { container-type: size; }
  #library > *, #canvas > * { --kast-card-w: min(250px, calc((100cqh - var(--intro-block) - 188px) * 53 / 86)); }
  .screen:not([hidden]) { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; }
  #notice { flex: none; margin: 6px 0 8px; min-height: 18px; }

  /* My KAST: the tools on the left, the Cards in their own scrolling panel. */
  /* Rows: intro, reminder, code, invitations (the one that grows, and scrolls inside its box), Admin panel. */
  #library:not([hidden]) { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto; column-gap: 20px; overflow: hidden; }
  #library > * { grid-column: 1; }
  #library > .intro { grid-column: 1 / -1; grid-row: 1; }
  #library > #reminder { grid-row: 2; }
  #library > .tool:not([id]) { grid-row: 3; }
  #library > #invitations { grid-row: 4; align-self: start; max-height: 100%; overflow-y: auto; }
  #library > #admin-panel { grid-row: 5; }
  #library > .tool { margin-bottom: 12px; padding: 18px 20px; gap: 12px; }
  #library > .reminder .actions { gap: 8px; }
  #library > .reminder button { min-height: 38px; padding: 0 16px; font-size: 14px; }
  #library > .library-cards { grid-column: 2; grid-row: 2 / -1; min-height: 0; height: 100%; overflow-y: auto; align-content: start; margin: 0; padding: 2px 6px 16px 2px; container-type: size; }
  .library-cards { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
  .library-card, .canvas-card { --frame-pad: 20px; gap: 10px; }
  .library-card .actions { flex-wrap: nowrap; }
  .library-card .actions button { min-height: 40px; padding: 0 16px; font-size: 14px; white-space: nowrap; }

  /* Canvas: the board takes the height that is left; the tools scroll inside their panel. */
  .canvas-layout { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  /* The board scrolls inside its panel. Notes stay where they were saved or dropped. */
  .canvas-board { min-height: 0; height: 100%; container-type: size; overflow: auto; }
  #edges { overflow: visible; }
  /* The Card sits at 38 % of the board, so its frame is also held to what fits on the left of that point (76 % less a margin). */
  .canvas-card { width: min(calc(var(--kast-card-w) + 2 * var(--frame-pad)), calc(76cqw - 32px)); }
  /* A board too narrow for a note beside the Card (app.mjs arrangeNotes, e.g. 1024 x 700): the Card on top at the height there
     is, the notes as a list below it at the board's width; the board scrolls up and down only, never sideways, and no note lies
     over the Card. Notes are not dragged here; their saved places are kept for a wider board. */
  .canvas-board.notes-list { display: grid; align-content: start; justify-items: center; gap: 14px; padding: 16px; overflow-x: hidden; overflow-y: auto; }
  .canvas-board.notes-list #edges { display: none; }
  .canvas-board.notes-list .canvas-card { position: static; transform: none; width: min(calc(var(--kast-card-w) + 2 * var(--frame-pad)), calc(100cqw - 32px)); }
  .canvas-board.notes-list #nodes { width: 100%; display: grid; gap: 12px; }
  .canvas-board.notes-list .canvas-node { position: static; max-width: none; min-width: 0; touch-action: auto; cursor: default; }
  .tools { min-height: 0; overflow-y: auto; padding: 22px 20px; }

  /* Today (kast#51 6895239899): the Card on the left at the height there is; each check-in step (1 to 11) fills the column
     and never scrolls: the question at the top, the Back · Skip · Next row at the bottom of the panel, the answers in the
     height between them. Only the calendar and the history, drawn below steps 1 and 11, are reached by scrolling the column. */
  /* On a narrow window the Card column gives way first (down to 170 px), so the 2 x 2 scales keep one line each. */
  .checkin-layout { flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(170px, 250px) minmax(440px, 640px); grid-template-rows: minmax(0, 1fr); align-items: stretch; gap: 24px; }
  .checkin-side { position: static; align-content: start; container-type: size; }
  .checkin-side .card-host { max-width: min(250px, 100cqw, calc((100cqh - 40px) * 53 / 86)); }
  .checkin-main { min-height: 0; overflow-y: auto; padding: 2px 6px 0 2px; container: checkin-main / size; }
  #checkin { height: calc(100cqh - 4px); display: flex; flex-direction: column; }
  #checkin > * { flex: none; }
  #checkin > .tool { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding: 18px 22px; gap: 12px; }
  #checkin > .tool > * { flex: none; }
  #checkin > .complete { margin: 0 0 12px; padding: 12px 20px; max-width: none; grid-template-columns: auto 1fr; justify-items: start; text-align: left; column-gap: 14px; row-gap: 2px; }
  #checkin > .complete .complete-badge { grid-row: 1 / 3; width: 40px; height: 40px; font-size: 20px; }
  #checkin > .complete h2 { font-size: 20px; }
  .checkin-step h2 { font-size: 24px; }
  #checkin > .tool > .step-fields, #checkin > .tool > .summary-answers { flex: 1 1 auto; }
  /* overflow-y: auto is only a safety net: at every tested size nothing overflows (fit-browser.test.mjs), but at a size nobody tested an answer is scrolled to rather than hidden (kast-care#58 review 6896243641). */
  .checkin-step .step-fields { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; container-type: size; }
  .checkin-step .muted { margin: 0; font-size: 13px; }
  .checkin-step > .actions, .summary-card > .actions { margin-top: auto; }
  .step-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 12px; }
  .step-note button.link { min-height: 24px; padding: 0 2px; }
  #checkin .actions button { min-height: 40px; }
  #diary-calendar:not(:empty), #history:not(:empty) { padding-top: 16px; }
  /* Step 1: the KAST tiles; their Cards scale to the height of the box. */
  .checkin-step .kast-tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .checkin-step button.kast-tile { padding: 10px 8px 12px; gap: 6px; }
  .checkin-step .kast-tile .card-host { max-width: min(130px, calc((100cqh - 76px) * 53 / 86)); }
  /* Steps 3 and 7: the four 0-10 scales as a 2 x 2 grid. */
  .checkin-step .step-fields:has(> .field-scale) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 10px 20px; }
  /* Label, value and Clear on one line; on step 7 the "Before" value goes to a second line when the column is narrow. */
  .checkin-step .field-scale { min-width: 0; }
  .field-scale .scale-head { flex-wrap: wrap; column-gap: 6px; row-gap: 0; }
  .field-scale .scale-head > * { white-space: nowrap; }
  .field-scale .scale-value { font-size: 22px; margin-left: 2px; }
  .field-scale .scale-state, .field-scale .scale-before { font-size: 12px; }
  .field-scale button.chip-clear { min-height: 26px; padding: 0 9px; font-size: 11.5px; }
  .field-scale .scale-ends { font-size: 11.5px; line-height: 1.2; white-space: nowrap; }
  .field-scale .scale-head { min-height: 26px; align-items: center; }
  .field-scale input[type=range] { display: block; width: 100%; height: 20px; margin: 0; }
  .checkin-step .field-scale { gap: 2px; }
  /* Steps 4, 5, 8 and 10: the choices as compact chips. Step 4: When on its own row, How much and Unit side by side where the check-in column
     (the named container checkin-main, so the grid and its first row follow the same width) is 470 px wide or more. */
  .checkin-step .field { gap: 6px; }
  .checkin-step button.chip { min-height: 34px; padding: 0 13px; font-size: 13px; }
  .checkin-step .chips { gap: 6px; }
  .checkin-step .field-label { margin: 0; }
  .checkin-step input:not([type=range]) { min-height: 40px; padding: 8px 16px; }
  .checkin-step .field:has(> input[type=text]) { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px; }
  .checkin-step[data-screen="4"] .field:has(> input[type=text]) { grid-template-columns: minmax(0, 1fr); }
  .checkin-step[data-screen="4"] .step-fields { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 12px 18px; }
  @container checkin-main (min-width: 470px) { .checkin-step[data-screen="4"] .step-fields { grid-template-columns: minmax(150px, .8fr) minmax(0, 1.2fr); } .checkin-step[data-screen="4"] .step-fields > :first-child { grid-column: 1 / -1; } }
  /* Step 6: the Card beside its fourteen positions, the Card at the height of the box and at most a third of its width, so the positions keep two to a row. */
  .checkin-step[data-screen="6"] .field { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-items: start; column-gap: 16px; height: 100%; min-height: 0; }
  .checkin-step[data-screen="6"] .smell-card { grid-row: 1 / 3; width: min(220px, calc(100cqh * 53 / 86), 34cqw); max-width: none; margin: 0; }
  .checkin-step[data-screen="6"] .field-label { font-size: 13px; }
  .checkin-step[data-screen="6"] button.chip { min-height: 28px; padding: 0 10px; font-size: 12px; }
  .checkin-step[data-screen="6"] .chips { gap: 5px; }
  /* Step 11, the day card: the head and the Done row stay; a long list of answers scrolls in its own box. */
  .summary-card { gap: 10px; }
  .summary-card .day-head { grid-template-columns: 60px minmax(0, 1fr); gap: 14px; }
  .summary-card .day-card { max-width: 60px; }
  .summary-card .day-head h2 { font-size: 22px; }
  .summary-card .summary-answers { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .summary-card .answers { font-size: 14px; gap: 4px 16px; }
  .summary-actions { flex-wrap: nowrap; align-items: end; justify-content: space-between; }
  .summary-actions .field { gap: 4px; min-width: 0; }
  .summary-actions select { min-height: 40px; }
  @container (min-width: 480px) { .summary-card .answers { grid-template-columns: repeat(2, minmax(0, .9fr) minmax(0, 1.1fr)); } }

  /* Up to 799 px tall the menu items sit a little closer. */
  @media (max-height: 799px) {
    .sidebar nav { gap: 3px; }
    .nav { min-height: 40px; }
    .logo { margin-bottom: 20px; }
  }
  /* A short window (e.g. 1180 x 580, a laptop browser with a bookmarks bar), anything below 700 px tall (659 px until kast-care#58 tester FAIL 6896411334): a tighter header, so the check-in step keeps its height. */
  @media (max-height: 699px) {
    .shell { padding: 8px 12px 10px; }
    .sidebar { padding: 16px 16px 14px; }
    .logo { margin-bottom: 10px; }
    .sidebar nav { gap: 2px; }
    .nav { min-height: 36px; font-size: 14px; }
    .top { padding: 8px 0 2px; }
    .top h1 { font-size: 30px; }
    .intro { margin: 0 0 10px; font-size: 14px; }
    :root { --intro-block: calc(14px * 1.45 + 10px); }
    #notice { margin: 4px 0; min-height: 16px; }
    #checkin > .tool { padding: 14px 20px; gap: 8px; }
    .checkin-step .step-fields:has(> .field-scale) { row-gap: 6px; }
    .field-scale .scale-head { min-height: 24px; }
    .field-scale button.chip-clear { min-height: 24px; }
    /* The day card: the same Card is on the left, so its small copy in the head is left out here; the answers get the height. */
    .summary-card .day-head { grid-template-columns: minmax(0, 1fr); }
    .summary-card .day-card { display: none; }
    .summary-actions .field { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 10px; }
    .checkin-step h2 { font-size: 22px; }
  }

  /* Friends: each column scrolls by itself. */
  #friends-host { flex: 1 1 auto; min-height: 0; }
  #friends-host .friends-layout { height: 100%; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  #friends-host .friends-layout > * { min-height: 0; overflow-y: auto; padding: 2px 6px 16px 2px; }
  /* Share with a clinician: the same two columns, each scrolling by itself. */
  #clinicians-host { flex: 1 1 auto; min-height: 0; }
  #clinicians-host .friends-layout { height: 100%; grid-template-rows: minmax(0, 1fr); align-items: stretch; }
  #clinicians-host .friends-layout > * { min-height: 0; overflow-y: auto; padding: 2px 6px 16px 2px; }

  /* Learn: the lessons scroll inside the Learn panel. */
  #learn-host { padding-bottom: 16px; }
}

/* Friends: lists on one side, one private conversation on the other. */
.friends-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.friends-card, .thread-card { max-width: none; }
.friend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r-tile); background: var(--surface-2); box-shadow: var(--ring); }
.friend-row strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.join-code { display: inline-block; margin: 6px 0 4px; padding: 4px 12px; border-radius: var(--r-pill); background: var(--cream); font: 500 13px/1.5 var(--font-mono); letter-spacing: .06em; }
.join .stamp { overflow-wrap: anywhere; }
.thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.thread-head p { margin: 0 0 4px; }
.thread { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.msg { display: grid; gap: 4px; justify-items: start; max-width: 86%; }
.msg.mine { justify-self: end; justify-items: end; }
.bubble { display: grid; gap: 10px; padding: 14px 16px; border-radius: var(--r-card); background: var(--surface-2); box-shadow: var(--ring); }
.msg.mine .bubble { background: var(--cream); box-shadow: none; }
.msg-text { margin: 0; font-size: 15px; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg-foot { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.msg-foot button.link { min-height: 24px; font-size: 12px; }
.reported { color: var(--orange-deep); }
.kast-msg { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 14px; align-items: center; }
.kast-msg .card-host { max-width: 104px; }
.kast-msg strong, .kast-msg .muted { display: block; }
.kast-msg .actions { margin-top: 10px; }
.composer { display: grid; gap: 10px; justify-items: start; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.composer textarea { border-radius: var(--r-card); }

/* Share with a clinician: the approved consent text, the choice of KASTs and notes, the list with "Stop sharing". */
#clinicians-host .friends-main { display: grid; gap: 16px; align-content: start; }
.clinician-consent { max-width: none; }
.clinician-consent p { margin: 0; }
.clinician-choose { display: grid; gap: 10px; margin: 0; padding: 14px 16px; border: 0; border-radius: var(--r-tile); background: var(--surface-2); box-shadow: var(--ring); }
/* The question title is an ordinary first row inside the box (kast#51 6901205902): a floated legend is not drawn on the fieldset's
   top edge, and inside the grid it is a grid item like the rows under it, so the box's own padding sits above it. */
.clinician-choose legend, .summary-choose legend { float: left; width: 100%; margin: 0; padding: 0; font-weight: 600; }
.clinician-kast { display: grid; gap: 6px; }
.clinician-tick, .clinician-note { display: flex; align-items: center; gap: 10px; }
.clinician-notes { display: grid; gap: 4px; padding-left: 28px; }
.clinician-choose input[type="checkbox"] { flex: none; width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--orange-deep); }
.clinician-choose label.check { margin: 0; font: 400 14px/1.4 var(--font-sans); color: var(--text); overflow-wrap: anywhere; }
.clinician-card .friend-row span { display: block; }
/* Clinician intake (kast#51 6894262248 item 2): the invitation form under Find, the same box as the chooser. */
.clinician-invite { display: grid; gap: 6px; margin: 10px 0 0; padding: 12px 14px; border: 0; border-radius: var(--r-tile); background: var(--surface-2); box-shadow: var(--ring); min-width: 0; }
.clinician-invite legend { float: left; width: 100%; padding: 0; margin: 0 0 4px; font-weight: 600; }
.clinician-invite legend + * { clear: both; }
.clinician-invite p { margin: 0; }
.error-line { margin: 0; color: var(--error); }
/* Make my summary (summary-view.mjs): one step at a time; the preview scrolls inside its own panel. */
.summary-step { display: grid; gap: 12px; max-width: 900px; }
.summary-step h2 { margin: 0; }
.summary-choose { display: grid; gap: 10px; margin: 0; padding: 14px 16px; border: 0; border-radius: var(--r-tile); background: var(--surface-2); box-shadow: var(--ring); }
.summary-tick { display: flex; align-items: center; gap: 10px; }
.summary-choose input[type="checkbox"], .summary-choose input[type="radio"] { flex: none; width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--orange-deep); }
.summary-choose label.check { margin: 0; font: 400 14px/1.4 var(--font-sans); color: var(--text); overflow-wrap: anywhere; }
.summary-kast-name { margin: 6px 0 0; font-weight: 600; }
.summary-dates { flex-wrap: wrap; }
.summary-preview { max-height: 60vh; overflow: auto; padding: 16px; border-radius: var(--r-tile); background: #fff; box-shadow: var(--ring); }
.summary-warning { margin: 0; font-weight: 600; }
@media (min-width: 1024px) and (min-height: 700px) {
  #summary:not([hidden]) { overflow: hidden; }
  #summary-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .summary-step { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-content: start; }
  .summary-step[data-step="5"] { display: flex; flex-direction: column; overflow: hidden; }
  .summary-step[data-step="5"] > * { flex: none; }
  .summary-step[data-step="5"] > .summary-preview { flex: 1 1 auto; max-height: none; min-height: 0; }
}

/* Learn: the lessons as KAST Next draws them, inside the My KAST frame. */
#learn-host { display: grid; gap: 12px; justify-items: start; max-width: 1100px; }
#learn-host .training { width: 100%; }
#learn-host .t-head { padding-left: 0; padding-right: 0; padding-top: 8px; }
#learn-host .t-list ol, #learn-host .perceive { padding-left: 0; padding-right: 0; }
#learn-host .t-refs, #learn-host .t-health { margin-left: 0; margin-right: 0; }
@media (max-width: 850px) {
  .friends-layout { grid-template-columns: minmax(0,1fr); }
  .msg { max-width: 100%; }
  .kast-msg { grid-template-columns: 88px minmax(0, 1fr); }
  .kast-msg .card-host { max-width: 88px; }
}

/* Backend mode: sign-in, consent and the Account section. Shown only when the backend switch is on. */
.account-gate { max-width: 680px; margin: 0 auto; padding: 40px 20px; }
.account-gate .tool, #account .tool, #diary-consent .tool { max-width: 640px; }
.account-status { min-height: 1.4em; color: var(--text); font-size: 14px; }
.account-privacy h3 { margin: 14px 0 4px; font-size: 14px; }
.consent-text { line-height: 1.6; }

/* Help: "How to use My KAST", the patient guide (guide/guide.mjs). One chapter per page; the page scrolls inside the Help panel. */
#help-host { display: grid; gap: 16px; max-width: 980px; padding-bottom: 16px; }
.guide-index h2, .guide-title { margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.guide-toc { margin: 12px 0 18px; padding-left: 1.6em; display: grid; gap: 4px; }
.guide-toc-link { min-height: 32px; padding: 0; font-size: 16px; text-align: left; }
/* KAST Care Help: "About KAST Care" above the task list (care-help-view.mjs, kast#51 7013471211). */
.care-about { margin: 12px 0 4px; padding: 12px 16px; border-radius: var(--r-tile); background: var(--surface-2); box-shadow: var(--ring); }
.care-headline { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.care-authority { margin: 0 0 6px; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.care-status { margin: 0; font-size: 13px; }
.guide-goal { margin: 0 0 12px; font-size: 16px; line-height: 1.5; }
.guide-pending, .guide-note, .guide-contact { margin: 0 0 12px; padding: 10px 14px; border-radius: var(--r-tile); background: var(--surface-2); box-shadow: var(--ring); font-size: 14px; }
.guide-pending { background: var(--cream); box-shadow: none; }
.guide-steps { margin: 0 0 14px; padding-left: 1.6em; display: grid; gap: 8px; }
.guide-step { font-size: 15px; line-height: 1.5; }
.guide-shot { margin: 0 0 14px; }
.guide-shot img { display: block; width: 100%; max-width: 760px; height: auto; border-radius: var(--r-tile); box-shadow: var(--shadow-card), var(--ring); }
.guide-example { margin: 0 0 12px; padding: 14px 18px; border-radius: var(--r-card); background: var(--cream); }
.guide-example h3, .guide-disclaimers h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.guide-example p { margin: 0; font-size: 15px; line-height: 1.5; }
.guide-disclaimers { padding-top: 12px; border-top: 1px solid var(--border-soft); }
.guide-disclaimers p { margin: 0 0 6px; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
.guide-nav { gap: 8px; flex-wrap: wrap; }
@media (max-width: 600px) { .guide-shot img { max-width: 100%; } }
/* KAST Care (care.html, care-app.mjs): the My KAST shell, the same sidebar, menu and account item (kast#51 6954222634). */
.care-main { min-width: 0; padding: 0 16px 32px; }
.care-account-line { margin: 0; padding: 8px 10px 0; font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.care-card { max-width: none; }
.care-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.care-row, .care-item { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--border-soft); min-width: 0; overflow-wrap: anywhere; }
.care-row > button { justify-self: start; }
.care-items { display: grid; gap: 4px; }
.care-person { display: grid; gap: 2px; margin: 12px 0; }
.care-person h2 { margin: 0; overflow-wrap: anywhere; }
#care-mount > button { justify-self: start; align-self: flex-start; }
.care-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* By batch (kast#51 6897906777 item 3): two batches side by side, each its whole Card beside the check-ins recorded against it. */
.care-batch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.care-batch > p { margin: 0; }
.care-batch-col { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; min-width: 0; padding: 14px 16px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-card), var(--ring); }
.care-batch-top { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.care-batch-top select { max-width: 100%; min-width: 0; }
.care-batch-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 12px; min-height: 0; }
.care-batch-card { min-width: 0; min-height: 0; }
.care-batch-card .card-host { max-width: 220px; margin: 0; }
.care-batch-items { display: grid; align-content: start; gap: 2px; min-width: 0; min-height: 0; overflow-y: auto; }
@media (max-width: 760px) {
  .care-batch { grid-template-columns: minmax(0, 1fr); }
  .care-batch-body { grid-template-columns: minmax(0, 1fr); }
  .care-batch-card .card-host { max-width: 200px; margin: 0 auto; }
}
@media (min-width: 1024px) and (min-height: 640px), (min-width: 1180px) and (min-height: 560px) {
  .care-main { padding: 0 24px 0 32px; }
  /* By batch is one page that does not scroll: the Card is scaled as a whole to the height its box has (53 : 86 kept, the locked
     stylesheet untouched) and only a long list of check-ins scrolls, inside its own box. */
  #care-mount[data-screen="care-batch"] { flex: 1 1 auto; min-height: 0; overflow: hidden; padding-bottom: 12px; }
  #care-mount[data-screen="care-batch"] .care-person { margin: 6px 0 8px; }
  #care-mount[data-screen="care-batch"] .care-batch { flex: 1 1 auto; min-height: 0; }
  .care-batch-col { min-height: 0; overflow: hidden; }
  .care-batch-card { container-type: size; }
  .care-batch-card .card-host { width: min(260px, 100cqw, calc(100cqh * 53 / 86)); max-width: none; }
}
/* KAST Care, registration and review (care-register-view.mjs, care-review-view.mjs; kast#51 6891833338). */
.care-personas [aria-pressed="true"] { border-color: var(--border-hover); color: var(--heading); box-shadow: var(--ring); }
.care-personas button { min-height: 36px; padding-top: 0; padding-bottom: 0; }
.care-field { display: grid; gap: 4px; margin: 0 0 10px; }
.care-field input, .care-field select { max-width: 100%; }
.care-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 4px 0; }
.care-details dt { color: var(--text-muted); }
.care-details dd { margin: 0; overflow-wrap: anywhere; }
.care-row .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* KAST Care applicant (kast#51 7005070463): Apply › Status is a four-step line, Apply › Application a read-only table, and Training the six
   lessons in the Learn › Lessons cards. On phones (≤ 850 px) the steps stack. No new colour: only the existing tokens. */
.care-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.care-steps li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-card); background: var(--surface-2); }
.care-steps small { grid-column: 2; }
.care-step-mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; box-shadow: var(--ring); background: var(--surface); font: 600 13px/1 var(--font-sans); }
.care-steps li[data-done="true"] .care-step-mark { background: var(--text); color: var(--surface); box-shadow: none; }
.care-step-label { font-weight: 600; overflow-wrap: anywhere; }
.care-status-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.care-application { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card), var(--ring); overflow: hidden; font-size: 14px; }
.care-application th, .care-application td { padding: 10px 14px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.care-application th { width: 1%; white-space: nowrap; font-weight: 500; color: var(--text-muted); }
.care-application tr + tr > * { border-top: 1px solid var(--border-soft); }
.care-lessons { display: grid; gap: 8px; }
.care-lessons p { margin: 0; }
.care-lessons .t-list ol { padding-left: 0; padding-right: 0; }
/* Each lesson card is a button that opens the lesson (kast#51 7060040828): the card look of .t-item, not the pill button. */
.care-lessons button.t-item { width: 100%; height: 100%; min-height: 0; padding: 20px; border-radius: var(--r-card); background: var(--surface); color: var(--text); box-shadow: var(--shadow-card), var(--ring); text-align: left; font: inherit; justify-content: stretch; display: grid; }
.care-lessons button.t-item:hover { box-shadow: var(--shadow-card), inset 0 0 0 1px var(--border-hover); }
@media (max-width: 850px) { .care-steps { grid-template-columns: minmax(0, 1fr); } }

/* Cycle (cycle-view.mjs, kast#51 6895521219): the switch and the set-once answers on top, "By cycle" below it, full width. Period days are marked
   with an underline in the existing orange token (no new colour): thicker for a heavier period, dotted for spotting. */
.cycle-layout { display: grid; gap: 14px; }
.cycle-layout > .tool, #cycle-host > .tool { max-width: none; margin: 0; }
.cycle-settings { gap: 10px; padding: 18px 22px; }
.cycle-settings p { margin: 0; }
.cycle-switch { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cycle-switch h2 { margin: 0; font-size: 20px; }
.cycle-state { padding: 2px 12px; border-radius: var(--r-pill); background: var(--surface-tint); font: 500 12px/1.6 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.cycle-state[data-cycle-state="on"] { background: var(--cream); color: var(--orange-deep); }
.cycle-once { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.cycle-setting { display: grid; gap: 4px; }
.cycle-setting .field-label { margin: 0; font-size: 13px; color: var(--text-muted); }
.cycle-setting .chips { gap: 6px; }
.cycle-setting button.chip { min-height: 34px; padding: 0 12px; font-size: 13px; }
.cycle-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.cycle-foot .muted { font-size: 13px; }
.cycle-foot button.link { min-height: 32px; color: var(--error); }
.cycle-consent { max-width: 760px; gap: 12px; }
.cycle-consent p { margin: 0; }
.cycle-by { gap: 10px; padding: 18px 22px; align-content: start; }
/* The Today card on the Cycle page (kast#51 6945165503): closed, one line with today's answers and its button; open, the three fields of the
   check-in step Cycle and Save. Existing tokens and the check-in's field styles only. */
.cycle-today { gap: 10px; padding: 14px 22px; align-content: start; }
.cycle-today p { margin: 0; }
.cycle-today-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cycle-today-head h2 { margin: 0; font-size: 20px; }
.cycle-today-head button { margin-left: auto; min-height: 36px; }
.cycle-today-said { font-size: 14px; color: var(--text-muted); }
.cycle-today-said [data-row] { color: var(--text); }
.cycle-today-fields { display: grid; gap: 12px 20px; }
.cycle-today .field { display: grid; gap: 6px; }
.cycle-today .field-label { margin: 0; font-size: 13px; color: var(--text-muted); }
.cycle-today .chips { gap: 6px; }
.cycle-today button.chip { min-height: 36px; padding: 0 13px; font-size: 13px; }
.cycle-today .actions { display: flex; gap: 10px; flex-wrap: wrap; }
@media (min-width: 851px) { .cycle-today-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cycle-today-fields > .field:last-child { grid-column: 1 / -1; } }
.cycle-by h2, .cycle-by p { margin: 0; }
.cycle-by h2 { font-size: 20px; }
.by-cycle-scroll { overflow-x: auto; }
table.by-cycle { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font: 500 11px/1.2 var(--font-mono); }
table.by-cycle th { font-weight: 500; color: var(--text-muted); text-align: center; padding: 2px 0; }
table.by-cycle th[scope="row"], table.by-cycle tr:first-child th:first-child { width: 128px; text-align: left; padding-right: 6px; font-family: var(--font-sans); font-size: 12px; overflow-wrap: anywhere; }
table.by-cycle td { height: 28px; padding: 0; text-align: center; vertical-align: middle; border-radius: 4px; background: var(--surface-2); overflow-wrap: anywhere; }
table.by-cycle td.by-none { background: none; }
table.by-cycle td.period-spotting { border-bottom: 2px dotted var(--orange-deep); }
table.by-cycle td.period-light { border-bottom: 2px solid var(--orange-deep); }
table.by-cycle td.period-medium { border-bottom: 4px solid var(--orange-deep); }
table.by-cycle td.period-heavy { border-bottom: 6px solid var(--orange-deep); }
.by-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; }
.by-legend li[data-mark] { font-weight: 500; }
.by-legend .by-key { color: var(--text-muted); }
@media (max-width: 850px) { table.by-cycle { width: auto; min-width: 100%; } table.by-cycle td, table.by-cycle th.by-day { min-width: 18px; } }
@media (min-width: 1024px) and (min-height: 640px), (min-width: 1180px) and (min-height: 560px) {
  #cycle:not([hidden]) { overflow: hidden; }
  #cycle-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #cycle-host > .tool { flex: none; }
  #cycle-host > .cycle-consent { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
  .cycle-layout { flex: 1 1 auto; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); }
  .cycle-layout[data-today-open="true"] { grid-template-rows: minmax(0, auto) auto; align-content: start; }
  .cycle-layout[data-today-open="true"] > .cycle-today { min-height: 0; overflow-y: auto; }
  .cycle-by { min-height: 0; overflow-y: auto; }
  .cycle-settings, .cycle-by { padding: 14px 20px; gap: 8px; }
  /* The check-in step "Cycle": Period today beside Period pain, the symptoms below them across the width. */
  .checkin-step[data-step="cycle"] .step-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 10px 20px; }
  .checkin-step[data-step="cycle"] .step-fields > :last-child { grid-column: 1 / -1; }
  .checkin-step[data-step="cycle"] button.chip { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
  @media (max-height: 699px) {
    .checkin-step[data-step="cycle"] .step-fields { row-gap: 6px; }
    .checkin-step[data-step="cycle"] .field { gap: 4px; }
    .checkin-step[data-step="cycle"] .chips { gap: 5px; }
    .checkin-step[data-step="cycle"] button.chip { min-height: 26px; padding: 0 8px; font-size: 11.5px; }
  }
}
/* KAST Care, Introductions (care-matching-view.mjs; kast#51 6891754191 item 1). */
.care-introduce { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 12px; align-items: end; }
.care-introduce > button { justify-self: start; margin: 0 0 10px; }
.care-introduce input { width: 100%; box-sizing: border-box; }
/* KAST Care, Reading KAST (care-training-view.mjs; kast#51 6897871467): one lesson page at a time. From the fit frame the page fits
   the window with no scroll: the Card(s) beside the words, sized to the window height, whole at 53 : 86. Phone: one column, the page scrolls. */
.training-lesson { display: grid; gap: 10px; }
.training-head h2 { margin: 0; }
.training-head .eyebrow { margin: 0 0 4px; }
.training-body { display: grid; gap: 16px; }
.training-cards { display: flex; gap: 12px; justify-content: center; }
.training-card { margin: 0; display: grid; gap: 4px; justify-items: center; }
.training-card .card-host { width: min(180px, 42vw); max-width: none; }
.training-cards[data-cards="2"] .card-host { width: min(160px, 30vw); }
.training-card figcaption { font-size: 13px; }
.training-copy { min-width: 0; overflow-wrap: anywhere; }
.training-copy p, .training-step p { margin: 0 0 8px; line-height: 1.45; }
.training-copy h3 { margin: 0 0 6px; font-size: 16px; }
.training-notes { padding-top: 8px; border-top: 1px solid var(--border-soft); }
.training-notes p { color: var(--text-muted); font-size: 14px; }
/* The small label of the doctor lesson 8 health note (kast-care#92 7043850994) sits on the note's top rule, like a legend, so it adds no height. */
#training-health:has(> .training-notes-label) { position: relative; padding-top: 12px; }
.training-notes-label { position: absolute; top: 0; left: 0; transform: translateY(-50%); padding-right: 8px; background: var(--surface); font: 600 11px/1 var(--font-sans); color: var(--text-muted); }
.training-question { font-weight: 600; }
.training-choices { display: grid; gap: 6px; margin: 0 0 8px; }
.training-choice { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.training-choice input[type="radio"] { flex: none; width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--orange-deep); }
.training-refs { margin: 4px 0 0; padding-left: 22px; font-size: 13px; color: var(--text-muted); }
.training-nav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* The figure of a lesson (training-diagram.mjs, D-1120-TRAINING-V2): the locked Card(s) with a highlight layer laid over each in the
   Card's own coordinates, and the figure's own controls ‹ ▶ › under it. The Card is never changed: the layer is a separate SVG. */
.training-diagram { margin: 0; display: grid; gap: 4px; justify-items: center; align-content: start; }
.dg-stage { position: relative; display: grid; place-items: center; }
.training-diagram .card-host { position: relative; }
/* D-1121-COLOUR-LESSON: one step of lesson 9 shows the whole figure without colour, as a display filter on the figure element only. */
.training-diagram[data-gray] { filter: grayscale(1); }
.dg-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.dg-ring { fill: none; stroke: var(--orange); stroke-width: 5; transition: all .35s var(--ease); }
.dg-veil { fill: #fff; opacity: .94; }
.training-card[data-off] { visibility: hidden; }
.dg-name { margin: 0; font-size: 12px; line-height: 1.2; }
.dg-inputs { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--surface); }
.dg-inputs[data-off] { display: none; }
.dg-node { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; transition: all .35s var(--ease); }
.dg-word { font: 600 15px var(--font-sans); fill: var(--text-muted); }
.dg-flow { fill: none; stroke: var(--border); stroke-width: 2; transition: stroke .35s var(--ease); }
.dg-node.on { stroke: var(--orange); fill: color-mix(in srgb, var(--orange) 10%, var(--surface)); }
.dg-word.on { fill: var(--heading); }
.dg-flow.on { stroke: var(--orange); }
.dg-batch.on { stroke-width: 2.5; }
.dg-controls { display: flex; gap: 4px; align-items: center; justify-content: center; max-width: 100%; }
.dg-controls .dg-btn { min-height: 32px; min-width: 36px; padding: 0 10px; }
.dg-controls .dg-btn[hidden] { display: none; }
.dg-where { margin: 0; min-width: 0; font: 500 12px/1.25 var(--font-mono); color: var(--text-muted); text-align: center; max-width: 30ch; }
@media (prefers-reduced-motion: reduce) { .dg-ring, .dg-node, .dg-flow { transition: none; } }
/* My KAST › Learn › Reading without smelling (reading-view.mjs, D-1120-TRAINING-V2 item 3) and Reading without colour (D-1121-COLOUR-LESSON):
   the lesson 8 or 9 figure beside its words. */
.reading-page { max-width: 980px; }
.reading-page h2 { margin: 0; }
@media (min-width: 1024px) and (min-height: 640px), (min-width: 1180px) and (min-height: 560px) {
  .reading-page { padding: 18px 24px; gap: 10px; }
  #reading-page .dg-where, #colour-page .dg-where { max-width: 20ch; }
  #reading-page .training-copy p, #colour-page .training-copy p { font-size: 15px; line-height: 1.42; }
  #reading-page .training-diagram .card-host, #colour-page .training-diagram .card-host { width: min(180px, calc((100dvh - 440px) * 53 / 86), calc((100vw - 760px) / 2)); }
  /* The screen never scrolls, whatever font the browser ends up with (kast#51 7066505544: release run #40 measured the Learn screen at
     552 > 535 px at 1024 x 700 with the runner's fonts, while it fitted exactly in PR CI). The page is held to the screen and its words
     scroll on their own, as the Learn lesson text does (#learn-host .lesson-copy). Layout only: no wording and no Card change. */
  #reading:not([hidden]), #colour:not([hidden]) { overflow: hidden; }
  #reading-host, #colour-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .reading-page { flex: 0 1 auto; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
  .reading-page .training-body { min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .reading-page .training-copy { min-height: 0; max-height: 100%; overflow-y: auto; padding-right: 4px; }
}
/* Phone (D-1120-TRAINING-V2 item 1): a lesson page fits one screen at 390 x 844 with no scroll. The page title gives way to the lesson
   title, the figure sits small above the words, and the words take a compact size. Layout only, no wording. */
@media (max-width: 850px) {
  .care-shell:has(#care-mount[data-screen="care-training"] #training-lesson) { min-height: 0; padding-bottom: 0; }
  .care-main:has(#care-mount[data-screen="care-training"] #training-lesson) { padding-bottom: 6px; }
  .care-main:has(#care-mount[data-screen="care-training"] #training-lesson) .top { display: none; }
  #care-mount[data-screen="care-training"] .training-lesson { padding: 10px 14px; gap: 6px; margin-top: 8px; }
  .training-head .eyebrow { font-size: 10px; letter-spacing: .08em; }
  .training-head h2 { font-size: 18px; }
  .training-body { gap: 8px; }
  .training-diagram .training-cards { gap: 8px; }
  .training-diagram .card-host { width: min(112px, calc((100dvh - 640px) * 53 / 86)); min-width: 84px; }
  .training-diagram[data-cards="2"] .card-host { width: min(90px, calc((100dvh - 640px) * 53 / 86)); }
  .training-diagram .dg-name { font-size: 11px; }
  #training-health .t-refs summary { font-size: 12.5px; }
  #training-health { padding-top: 5px; }
  #training-health > p { margin: 0 0 2px; }
  #training-health .t-refs { margin: 0; }
  #training-health:has(> .training-notes-label) { padding-top: 6.5px; }
  #training-health .training-notes-label { font-size: 10.5px; }
  .dg-inputs { inset: 0 -40px; width: calc(100% + 80px); }
  .training-copy, .training-copy p, .training-step p { font-size: 13.5px; line-height: 1.38; }
  .training-copy p, .training-step p { margin: 0 0 5px; }
  .training-copy h3 { font-size: 13px; margin: 0 0 4px; }
  .training-notes p { font-size: 12.5px; }
  .training-nav button { min-height: 38px; padding: 0 16px; }
  .dg-controls .dg-btn { min-height: 30px; min-width: 32px; }
  /* Lesson 8, the longest page (D-1121-CLINICAL-TERMS): smaller whole Cards and slightly smaller words, so it fits 390 x 844. Layout only. */
  #training-lesson[data-lesson="cannot-smell"] .training-diagram[data-cards="2"] .card-host { width: 74px; min-width: 0; }
  #training-lesson[data-lesson="cannot-smell"] .training-copy p { font-size: 13px; line-height: 1.34; }
}
@media (min-width: 1024px) and (min-height: 640px), (min-width: 1180px) and (min-height: 560px) {
  .training-body { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .training-body > .training-copy:only-child { grid-column: 1 / -1; max-width: 68ch; }
  .training-cards[data-cards="1"] .card-host, .training-cards[data-cards="2"] .card-host { width: min(200px, calc((100dvh - 350px) * 53 / 86)); }
  /* Two Cards side by side leave the words room enough at 1024 px too (D-1120-TRAINING-V2). */
  #care-mount .training-diagram[data-cards="2"] .card-host { width: min(170px, calc((100dvh - 350px) * 53 / 86), calc((100vw - 640px) / 2)); }
  /* Lesson 8 has the most words (D-1121-CLINICAL-TERMS added one sentence): its two Cards are drawn smaller, whole, so the page still fits. */
  #care-mount #training-lesson[data-lesson="cannot-smell"] .training-diagram[data-cards="2"] .card-host { width: min(104px, calc((100dvh - 350px) * 53 / 86), calc((100vw - 640px) / 2)); }
  #care-mount #training-lesson[data-lesson="cannot-smell"] .dg-where { max-width: 12ch; }
  /* A Reading KAST lesson page (Training, kast#51 7005070463): a compact title, so the lesson fits the window. */
  .care-main:has(#care-mount[data-screen="care-training"] #training-lesson) .top { min-height: 0; padding: 8px 0 4px; }
  .care-main:has(#care-mount[data-screen="care-training"] #training-lesson) .top h1 { font-size: 26px; margin: 0; }
  #care-mount[data-screen="care-training"] .training-lesson { padding: 14px 20px; }
  #care-mount[data-screen="care-training"] { padding-bottom: 8px; }
  .care-main:has(#care-mount[data-screen="care-training"] #training-lesson) :is(.top .eyebrow, #care-who) { display: none; }
  #care-mount[data-screen="care-training"] .training-card figcaption { font-size: 12px; line-height: 1.2; }
}

/* Learn fits the window (kast#51 6911985931 item 6), in the same fit frame as the other My KAST screens: the Learn screen does not scroll.
   The lesson title takes the size of the other section titles; the figure scales to the height left; the text, pager, References and
   Disclaimers sit beside it in a column that scrolls on its own only when what is opened there needs it. Layout only, no wording. */
@media (min-width: 1024px) and (min-height: 640px), (min-width: 1180px) and (min-height: 560px) {
  #learn:not([hidden]) { overflow: hidden; }
  #learn-host { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: stretch; gap: 6px; max-width: none; }
  #learn-host { position: relative; }
  #learn-host > #learn-back { position: absolute; top: 0; right: 0; z-index: 1; }
  #learn-host > #learn-back + .training .t-head { padding-right: 180px; }
  #learn-host .training { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
  #learn-host .training > * { flex: none; }
  #learn-host .t-head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 14px; padding: 2px 0 0; }
  #learn-host .t-head h1 { font: 700 clamp(26px, 2.4vw, 32px)/1.05 var(--font-sans); letter-spacing: -.03em; }
  #learn-host .t-head p { margin: 4px 0 0; font-size: 15px; }
  #learn-host .t-list ol { padding: 10px 0; gap: 10px; }
  /* The lesson list: Disclaimers and References open inside it, and it scrolls on its own when they need the room. */
  #learn-host .training[data-training="index"] { overflow-y: auto; }
  #learn-host .training[data-training="index"] > .t-refs { margin-top: 0; }
  #learn-host .perceive { flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; gap: 28px; padding: 8px 0 0; max-width: 1180px; }
  #learn-host .perceive .pv-fig { min-height: 0; display: flex; flex-direction: column; padding: 44px 0 50px; }
  #learn-host .perceive #head { flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; }
  #learn-host .lesson-copy { min-height: 0; overflow-y: auto; padding-right: 4px; }
  #learn-host .lesson-copy .pager { max-width: none; }
  /* Lessons 07 to 09 list the fourteen compounds, the brain regions or the six steps beside a long caption: every lesson fits with
     References and Disclaimers closed (kast-care#73 review 6946478170). The step numbers take less width so the text column gets it; the
     References and Disclaimers summaries and the pager share one row under the text; the caption, notes and chips are set tighter. */
  #learn-host .pv-steps { gap: 3px; }
  #learn-host .pv-steps a { width: 30px; height: 30px; font-size: 12px; }
  #learn-host .perceive { grid-template-columns: minmax(290px, .75fr) minmax(0, 1.25fr); gap: 24px; padding-top: 4px; }
  #learn-host .lesson-copy { display: flex; flex-wrap: wrap; align-content: flex-start; align-items: center; column-gap: 4px; }
  #learn-host .lesson-copy > * { flex: 1 0 100%; }
  #learn-host .lesson-copy > details.t-refs { flex: 0 0 auto; margin: 0 10px 0 0; }
  #learn-host .lesson-copy > details.t-refs[open] { flex-basis: 100%; }
  #learn-host .lesson-copy > details.t-refs > summary { padding: 8px 0; }
  #learn-host .lesson-copy > .pager { order: 1; flex: 0 0 auto; margin: 0 0 0 auto; padding: 2px 0 0; gap: 8px; }
  #learn-host .lesson-copy > .pager .btn { height: 34px; }
  /* The reference numbers keep their 24 px target but no longer open up the line they sit in. */
  #learn-host .lesson-copy .perceive-panel .ref { margin-block: -3px; }
  #learn-host .lesson-copy .pv-title { font-size: 20px; margin-bottom: 2px; }
  #learn-host .lesson-copy .perceive-panel { padding-top: 0; }
  #learn-host .lesson-copy .perceive-panel p { font-size: 14px; line-height: 1.4; margin-bottom: 6px; }
  #learn-host .lesson-copy .c7-note { font-size: 13px; line-height: 1.4; margin-bottom: 4px; }
  #learn-host .lesson-copy .c7-list { gap: 3px 4px; }
  #learn-host .lesson-copy .c7-chip { min-height: 26px; padding: 0 8px 0 6px; }
  #learn-host .lesson-copy .c9-steps { font-size: 13px; line-height: 1.4; }
  /* Lesson 06: the legend under the two heads is one fixed line in the locked training.js. At 11px it is 441 of the figure's 460 units wide
     in a 0.6em monospace, so a slightly wider runner font clipped it once the figure column narrowed (kast-care#73 tester 6947120247).
     At 10px it is about 400 units; learn-view.mjs also fixes its length at 400 units (textLength), so a wider font cannot push it out
     (kast-care#73 tester 6948795591). */
  #learn-host .pair-key { font-size: 10px; }
}

/* Canvas: the KAST on the board, when the person holds two or more; or the way to add a first one (kast#51 6911857991 item 1). */
.canvas-pick { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 12px; }
.canvas-pick[hidden] { display: none; }
.canvas-pick select { width: auto; max-width: min(100%, 460px); }
.canvas-pick p { margin: 0; }

/* The menu (kast#51 6960564208): four items and the account item at the bottom of the sidebar, which opens Settings and the demo account
   controls above it. The pages under each item are tabs: a segmented control under the page title. */
.nav-main { display: grid; gap: 6px; }
.account-item { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border-soft); display: grid; gap: 10px; }
.account-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--r-pill); background: none; color: var(--text-muted); font: 500 15px/1 var(--font-sans); text-align: left; }
.account-toggle:hover { background: var(--surface-tint); }
.account-toggle.active { background: var(--text); color: var(--surface); }
.account-toggle:active { transform: none; }
.account-toggle #account-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-toggle .caret { font-size: 12px; transition: transform .15s var(--ease); }
.account-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }
.account-panel { display: grid; gap: 10px; padding: 6px; border-radius: var(--r-card); background: var(--surface-tint); }
.account-panel[hidden] { display: none; }
.account-links { display: grid; gap: 2px; }
.account-link { display: flex; align-items: center; justify-content: flex-start; width: 100%; min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: none; color: var(--text-muted); font: 500 14px/1 var(--font-sans); text-align: left; }
.account-link:hover { background: var(--surface); }
.account-link.active { color: var(--text); background: var(--surface); box-shadow: var(--ring); }
.account-link:active { transform: none; }
.demo-box { display: grid; gap: 8px; padding: 8px 6px 4px; border-top: 1px solid var(--border-soft); }
.demo-box[hidden] { display: none; }
.demo-box select, .demo-box button { min-height: 38px; padding-top: 0; padding-bottom: 0; }
/* The header: the page title and the tabs under the title. On a short desktop window (below 760 px tall) the
   tabs sit in the title row, so each page keeps the height it had. */
.top:has(> .tabs) { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "title status" "tabs tabs"; align-items: center; column-gap: 16px; }
.top > div:first-child { grid-area: title; }
.top > .tabs { grid-area: tabs; justify-self: start; }
.tabs { display: flex; gap: 4px; width: max-content; max-width: 100%; margin: 12px 0 0; padding: 4px; overflow-x: auto; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--ring); scrollbar-width: none; }
.tab { flex: none; min-height: 36px; padding: 0 16px; border: 0; border-radius: var(--r-pill); background: none; color: var(--text-muted); font: 500 14px/1 var(--font-sans); white-space: nowrap; }
.tab:hover { background: var(--surface-tint); }
.tab.active { background: var(--text); color: var(--surface); }
.tab:active { transform: none; }
.tab[hidden] { display: none; }
/* Settings → Features: one row per opt-in with an on/off switch. */
button.switch { min-height: 36px; min-width: 64px; padding: 0 14px; margin-left: auto; border-radius: var(--r-pill); background: var(--surface-tint); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); font: 500 13px/1 var(--font-sans); }
button.switch[aria-checked="true"] { background: var(--text); color: var(--surface); box-shadow: none; }
#features-host, #privacy-host, #profile-host { display: grid; gap: 14px; align-content: start; }
#features-host > .tool, #privacy-host > .tool, #profile-host > .tool { max-width: 760px; margin: 0; }
#privacy-host .tool p, #profile-host .tool p { margin: 0; }
button.link.danger { color: var(--error); }
.cycle-settings-link { margin: 0; font-size: 14px; color: var(--text-muted); }
.cycle-settings-link button.link { min-height: 32px; }
@media (max-width: 850px) {
  /* Phone and narrow windows: the four items and the account item in one row; the account panel opens under it. */
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 8px; }
  .logo { grid-column: 1 / -1; }
  .nav-main { display: flex; gap: 4px; overflow-x: auto; }
  .account-item { display: contents; }
  .nav-main .nav { padding: 0 12px; font-size: 14px; }
  /* The account item is the gear only here; its name stays readable to a screen reader. */
  .account-toggle { width: auto; padding: 0 12px; gap: 6px; }
  .account-toggle #account-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .account-panel { grid-column: 1 / -1; grid-row: 3; margin-top: 10px; }
  .tabs { width: auto; }
}
@media (min-width: 1024px) and (min-height: 640px), (min-width: 1180px) and (min-height: 560px) {
  /* The account item stays in view; on a short window the menu and the open account panel tighten. */
  .sidebar { overflow: hidden; }
  .logo, .account-item { flex: none; }
  .nav-main { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
  .top:has(> .tabs) { padding-bottom: 12px; }
  .tabs { margin-top: 10px; }
  @media (max-height: 759px) {
    .top:has(> .tabs) { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "title tabs status"; align-items: end; padding-bottom: 6px; }
    .top > .tabs { margin: 0 0 2px; }
  }
  @media (max-height: 799px) {
    .logo { margin-bottom: 16px; }
    .sidebar .nav, .account-toggle { min-height: 40px; }
    .account-panel { gap: 6px; }
    .demo-box label { display: none; }
    .demo-box select, .demo-box button { min-height: 34px; }
  }
  @media (max-height: 699px) {
    .logo { margin-bottom: 8px; gap: 0; }
    .sidebar .nav, .account-toggle { min-height: 36px; font-size: 14px; }
    .nav-main { gap: 2px; }
    .account-item { padding-top: 8px; gap: 6px; }
    .account-link { min-height: 30px; font-size: 13.5px; }
    .demo-box { gap: 6px; padding-top: 6px; }
    .demo-box select, .demo-box button { min-height: 32px; font-size: 12.5px; }
    .tabs { padding: 3px; }
    .tab { min-height: 30px; font-size: 13.5px; }
  }
  #features:not([hidden]), #privacy:not([hidden]), #profile:not([hidden]) { overflow-y: auto; }
}

/* KAST Care, My patients as a table and a person's page with tabs (care-view.mjs; kast#51 6954222634 items 2 and 3). The table takes the
   full content width; on a phone (below 768 px) each person is one card and nothing scrolls sideways. */
.care-find { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; margin: 0 0 12px; }
.care-find .care-field { flex: 1 1 260px; max-width: 420px; margin: 0; }
.care-find input { width: 100%; box-sizing: border-box; }
.care-refresh { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; font-size: 13px; }
.care-refresh > span[aria-hidden] { font-size: 15px; line-height: 1; }
.care-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card), var(--ring); overflow: hidden; font-size: 14px; }
.care-table[hidden] { display: none; }
.care-table th { text-align: left; font: 600 12px/1.2 var(--font-sans); letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
.care-table td { padding: 10px 14px; border-top: 1px solid var(--border-soft); vertical-align: top; overflow-wrap: anywhere; }
.care-table tr.care-row { display: table-row; padding: 0; border: 0; }
.care-table td small { display: block; }
.care-table td[data-col="kasts"], .care-table td[data-col="new"] { width: 1%; white-space: nowrap; text-align: center; }
.care-table button.link { min-height: 32px; padding: 0; font-weight: 600; color: var(--text); background: none; border: 0; text-align: left; }
.care-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--text); }
.care-person { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.care-person-name { display: grid; gap: 2px; min-width: 0; }
.care-person-tabs { flex: none; margin: 0 0 12px; }
#care-mount > :not(.care-batch) { flex-shrink: 0; }
.care-panel[hidden] { display: none; }
.care-panel > .tool, .care-overview > .tool { margin: 0 0 12px; }
.care-overview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.care-overview-card .card-host { max-width: 220px; margin: 0; }
@media (min-width: 1024px) {
  .care-overview { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .care-overview > .tool { margin: 0; }
}
@media (max-width: 767px) {
  .care-table, .care-table tbody { display: block; background: none; box-shadow: none; border-radius: 0; overflow: visible; }
  .care-table thead { display: none; }
  .care-table tr.care-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; margin: 0 0 8px; padding: 12px 14px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow-card), var(--ring); }
  .care-table td { display: block; padding: 0; border: 0; text-align: left; width: auto; }
  .care-table td[data-col="new"] { grid-column: 2; grid-row: 1; text-align: right; }
  .care-table td:not([data-label="Person"]):not([data-col="new"])::before { content: attr(data-label) ": "; color: var(--text-muted); }
  .care-table td[data-col="kasts"] { width: auto; text-align: left; white-space: normal; }
  .care-table td[data-col="new"] { width: auto; }
  .care-table td:not([data-col="new"]) { grid-column: 1; }
  .care-overview-card .card-host { max-width: 200px; margin: 0 auto; }
}
@media (min-width: 1024px) and (min-height: 640px), (min-width: 1180px) and (min-height: 560px) {
  /* The person's page fits: the Card is scaled to the height its box has (53 : 86 kept); a long list scrolls inside the page. */
  .care-overview-card .card-host { width: min(240px, calc((100dvh - 430px) * 53 / 86)); max-width: none; }
}

/* Open sign-up with approval (kast#51 6977875515): "Which best describes you?", one question on one screen. */
.user-type-options { border: 0; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.user-type-options legend { float: left; width: 100%; font-weight: 600; margin: 0 0 8px; padding: 0; }
.user-type-options legend + * { clear: both; }
.user-type-option { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.user-type-option input { width: 20px; height: 20px; margin: 0; }

/* My KAST Pharmacy, the patient side (kast#51 7011755445 item 2; mockups of 7006626046). Layout only: the screens use the approved
   .tool, .intro, .eyebrow, button.chip and button.kast-tile; nothing here adds a colour, a font or a new component look. */
.find-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 20px; }
.find-steps .tool { margin: 0; padding: 20px; gap: 6px; max-width: none; }
.find-tiles { grid-template-columns: repeat(auto-fill, minmax(160px, 200px)); }
.chips.stack { flex-direction: column; align-items: stretch; }
.chips.stack button.chip { justify-content: flex-start; text-align: left; }
.pharmacy-held { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 14px; align-items: start; }
.pharmacy-held .card-host { max-width: 100px; }
.pharmacy-held-text { display: grid; gap: 4px; align-content: start; }
@media (max-width: 850px) { .find-steps { grid-template-columns: minmax(0, 1fr); } }
