/* Simplex design language. See docs/design-language.md.
   It follows the Physio by Design website: a warm dark surface, cream text, an orange accent,
   Playfair Display for titles and Inter for everything else. Quiet by default; colour supports
   a written label and never replaces it. Sized for a tablet in a clinic: 44px targets, 17px text. */

/* The two typefaces are served by Simplex itself. Nothing is fetched from another site. */
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/inter-latin-variable.woff2") format("woff2");
}

@font-face {
    font-family: "Playfair Display";
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url("fonts/playfair-display-latin-variable.woff2") format("woff2");
}

:root {
    color-scheme: dark;

    /* Surfaces and ink: the warm dark of the Physio by Design website */
    --paper: #16130d;
    --paper-deep: #100e08;
    --surface: #1e1b15;
    --surface-sunk: #100e08;
    --surface-raised: #221f19;
    --ink: #f5f1ea;
    --ink-soft: #ddc1b2;
    --line: rgb(74 74 72 / 55%);
    --line-strong: #5d5a54;

    /* The one accent: orange for the primary action, peach for links and the current place */
    --accent: #e9782a;
    --accent-strong: #f08a42;
    --on-accent: #16130d;
    --accent-text: #ffb68d;
    --accent-tint: rgb(255 182 141 / 15%);

    /* Meaning, always paired with words */
    --attention-bg: rgb(242 193 78 / 13%);
    --attention-ink: #f3d48e;
    --attention-line: #8f7226;
    --problem-bg: rgb(240 110 95 / 14%);
    --problem-ink: #ffb9ad;
    --problem-line: #9c4a40;
    --ok-bg: rgb(120 190 140 / 13%);
    --ok-ink: #aadfba;
    --ok-line: #4d7d5c;
    --note-bg: rgb(160 180 210 / 13%);
    --note-ink: #c6d3e8;
    --note-line: #56647c;

    /* Reserved for the fictional-data banner and nothing else: the only light band in Simplex */
    --fictional-bg: #f5f1ea;
    --fictional-ink: #16130d;

    --radius: 4px;
    --radius-large: 8px;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --target: 2.75rem;
    --measure: 68rem;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Playfair Display", "Playfair", Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
    --shadow: none;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 106.25%; /* 17px */
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    line-height: 1.5;
}

/* ---------- Type */

h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 var(--space-3);
    letter-spacing: -0.01em;
}

h1, h2 {
    font-family: var(--font-display);
    letter-spacing: 0;
}

h1 {
    font-size: 2.1rem;
    font-weight: 700;
}

h1:focus {
    outline: none;
}

h2 {
    font-size: 1.5rem;
    margin-top: var(--space-6);
}

h3 {
    font-size: 1.1rem;
    margin-top: var(--space-5);
}

h4 {
    font-size: 1rem;
}

p {
    margin: 0 0 var(--space-4);
    max-width: 46rem;
}

a {
    color: var(--accent-text);
    text-underline-offset: 0.15em;
}

a:hover {
    color: var(--ink);
}

/* A small uppercase label above or beside content, as on the website. */
.eyebrow {
    color: var(--accent-text);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.lead {
    color: var(--ink-soft);
    font-size: 1.05rem;
}

.quiet {
    color: var(--ink-soft);
}

.small {
    font-size: 0.875rem;
}

.numeric {
    font-variant-numeric: tabular-nums;
}

:focus-visible {
    outline: 3px solid var(--accent-text);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ---------- Frame */

.mode-banner {
    position: sticky;
    top: 0;
    z-index: 1100;
    padding: var(--space-2) var(--space-4);
    background: var(--fictional-bg);
    background-image: repeating-linear-gradient(135deg, transparent 0 14px, rgb(22 19 13 / 9%) 14px 28px);
    color: var(--fictional-ink);
    font-size: 0.875rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-align: center;
}

.masthead {
    background: var(--paper);
    border-bottom: 1px solid rgb(74 74 72 / 20%);
}

.masthead-inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-5);
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--space-5);
    min-height: 3.5rem;
}

.wordmark {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
}

/* The mark: a full circle underneath, a single line on top. Comprehensive underneath, simple in use. */
.wordmark-mark {
    display: inline-block;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: linear-gradient(var(--on-accent), var(--on-accent)) center / 60% 2px no-repeat, var(--accent);
}

.main-nav {
    display: flex;
    gap: var(--space-1);
    align-self: stretch;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--space-3);
    border-bottom: 3px solid transparent;
    border-top: 3px solid transparent;
    color: var(--ink-soft);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-decoration: none;
    min-height: var(--target);
}

.main-nav a:hover {
    color: var(--ink);
}

/* As on the website: the current place is in peach and bold, with no underline. */
.main-nav a.active {
    color: var(--accent-text);
    font-weight: 700;
}

.user-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin-left: auto;
    font-size: 0.9rem;
}

.user-bar form {
    display: inline;
}

.page {
    max-width: var(--measure);
    margin: 0 auto;
    padding: var(--space-6) var(--space-5) var(--space-7);
}

.page-narrow {
    max-width: 27rem;
    margin: var(--space-6) auto 0;
}

/* ---------- Surfaces */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

.card > :last-child {
    margin-bottom: 0;
}

/* A card's title, as on the website's cards: Playfair, quietly sized. */
.card > h2:first-child, .card > h3:first-child {
    margin-top: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: var(--space-4);
}

a.card {
    color: inherit;
    text-decoration: none;
    margin-bottom: 0;
}

a.card:hover {
    border-color: var(--accent);
}

a.card strong {
    color: var(--accent-text);
    font-family: var(--font-display);
    display: block;
    font-size: 1.1rem;
    margin-bottom: var(--space-1);
}

/* ---------- Actions */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--target);
    padding: 0 var(--space-4);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-decoration: none;
}

.button:hover {
    border-color: var(--ink-soft);
    background: var(--surface-raised);
}

/* One primary action per screen. */
.button-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-accent);
}

.button-primary:hover {
    border-color: var(--accent-strong);
    background: var(--accent-strong);
    color: var(--on-accent);
}

.button-quiet {
    min-height: 0;
    padding: var(--space-1) var(--space-2);
    border-color: transparent;
    background: none;
    color: var(--accent-text);
    font-weight: 500;
    letter-spacing: 0;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.button-quiet:hover {
    background: var(--accent-tint);
    border-color: transparent;
    color: var(--ink);
}

.button-small {
    min-height: 2.25rem;
    padding: 0 var(--space-3);
    font-size: 0.8rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

/* ---------- Forms */

.field {
    margin-bottom: var(--space-4);
}

.field label, .label {
    display: block;
    margin-bottom: var(--space-1);
    font-size: 0.9rem;
    font-weight: 600;
}

.input, input[type="file"].input {
    width: 100%;
    min-height: var(--target);
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--paper-deep);
    color: var(--ink);
    font: inherit;
}

.input::placeholder {
    color: rgb(221 193 178 / 45%);
}

.input:focus-visible {
    border-color: var(--accent-text);
    outline-offset: 0;
}

.input[readonly] {
    background: var(--surface-raised);
    border-style: dashed;
}

.field-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
}

.field-row .field {
    margin-bottom: 0;
    flex: 1 1 14rem;
    max-width: 20rem;
}

.hint {
    color: var(--ink-soft);
    font-size: 0.875rem;
    margin-top: var(--space-1);
}

/* ---------- Messages. The word at the start says what kind it is. */

.notice {
    border: 1px solid var(--note-line);
    border-left-width: 4px;
    border-radius: var(--radius);
    background: var(--note-bg);
    color: var(--note-ink);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    max-width: 46rem;
}

.notice > :last-child {
    margin-bottom: 0;
}

.notice ul {
    margin: 0;
    padding-left: 1.1rem;
}

.notice-attention {
    border-color: var(--attention-line);
    background: var(--attention-bg);
    color: var(--attention-ink);
}

.notice-problem {
    border-color: var(--problem-line);
    background: var(--problem-bg);
    color: var(--problem-ink);
}

.notice-ok {
    border-color: var(--ok-line);
    background: var(--ok-bg);
    color: var(--ok-ink);
}

/* ---------- Tags: short labels for state and provenance. Always words. */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.1em 0.55em;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.tag-accent {
    border-color: var(--accent);
    background: var(--accent-tint);
    color: var(--accent-text);
}

.tag-attention {
    border-color: var(--attention-line);
    background: var(--attention-bg);
    color: var(--attention-ink);
}

.tag-ok {
    border-color: var(--ok-line);
    background: var(--ok-bg);
    color: var(--ok-ink);
}

.tag-note {
    border-color: var(--note-line);
    background: var(--note-bg);
    color: var(--note-ink);
}

.tag-problem {
    border-color: var(--problem-line);
    background: var(--problem-bg);
    color: var(--problem-ink);
}

/* Not answered is an absence, so it looks like one: an empty outline, never a filled colour. */
.tag-empty {
    border-style: dashed;
    background: none;
    color: var(--ink-soft);
}

/* ---------- Tables */

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--line-strong);
    color: var(--accent-text);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.table td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table .code {
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    white-space: nowrap;
}

/* ---------- Progressive disclosure: the summary line is always there, detail one action away. */

.disclosure {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    margin-bottom: var(--space-3);
}

.disclosure {
    overflow: hidden;
}

/* As on the website's glossary: the title in Playfair on the left, a chevron on the right. */
.disclosure > summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--target);
    padding: var(--space-3) var(--space-5);
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    list-style: none;
    transition: background-color 120ms ease;
}

.disclosure > summary:hover {
    background: var(--surface-raised);
}

.disclosure > summary:focus-visible {
    outline-offset: -3px;
}

.disclosure > summary::-webkit-details-marker {
    display: none;
}

.disclosure > summary::after {
    content: "";
    flex: none;
    width: 0.55rem;
    height: 0.55rem;
    margin: 0 0.2rem 0.25rem auto;
    border-right: 2px solid var(--ink-soft);
    border-bottom: 2px solid var(--ink-soft);
    transform: rotate(45deg);
    transition: transform 160ms ease;
}

.disclosure[open] > summary::after {
    margin-bottom: -0.25rem;
    transform: rotate(-135deg);
}

.disclosure > summary .count {
    margin-left: auto;
    color: var(--ink-soft);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 400;
}

/* With a count, the count goes to the right and the chevron follows it. */
.disclosure > summary:has(.count)::after {
    margin-left: 0;
}

.disclosure > summary .icon {
    color: var(--accent-text);
}

.disclosure-body {
    padding: 0 var(--space-5) var(--space-4);
}

.disclosure-body > p:last-child {
    margin-bottom: 0;
    color: var(--ink-soft);
}

/* ---------- Stage navigation: where you are in the workflow, in order. */

.stages {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin: 0 0 var(--space-5);
    padding: 0;
    list-style: none;
    counter-reset: stage;
}

.stages li {
    counter-increment: stage;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--target);
    padding: 0 var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink-soft);
    font-weight: 500;
}

.stages li::before {
    content: counter(stage);
    display: inline-grid;
    place-items: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: var(--surface-raised);
    font-size: 0.75rem;
    font-weight: 700;
}

.stages li[aria-current] {
    border-color: var(--accent);
    background: var(--accent-tint);
    color: var(--accent-text);
    font-weight: 600;
}

.stages li[aria-current]::before {
    background: var(--accent);
    color: var(--on-accent);
}

/* ---------- Cases: the starting point. Open on the left, the case on the right. */

.case-layout {
    display: grid;
    grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-5);
}

.case-layout .card {
    margin-bottom: 0;
    min-width: 0;
}

.case-open .reference-input {
    max-width: none;
}

.case-note {
    margin-top: var(--space-4);
}

.case-open h2.eyebrow {
    font-family: var(--font);
    margin-top: var(--space-5);
}

.case-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
}

.start-session {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
}

.start-session .choices {
    margin-bottom: 0;
}

.case-detail h2 {
    font-size: 1.2rem;
    margin-top: var(--space-5);
}

.case-consents {
    margin-top: var(--space-5);
    background: transparent;
}

@media (max-width: 52rem) {
    .case-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- A session */

/* Stays in view under the banner: where you are never scrolls away (FR-005). */
.session-bar {
    position: sticky;
    top: 2.1rem;
    z-index: 1000;
    margin: calc(var(--space-6) * -1) calc(var(--space-5) * -1) var(--space-5);
    padding: var(--space-3) var(--space-5) var(--space-2);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.session-id {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-1) var(--space-3);
    margin-bottom: var(--space-2);
}

.session-reference {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 1.35rem;
}

.session-meta {
    color: var(--ink-soft);
}

.save-status {
    margin-left: auto;
    color: var(--ok-ink);
    font-size: 0.875rem;
}

.context-editor {
    margin-bottom: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: var(--surface);
}

.session-bar .stages {
    margin: 0;
}

.stages li {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    min-height: 3rem;
    padding: var(--space-1) var(--space-3);
}

.stages li::before {
    display: none;
}

.stages li > a {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

/* The whole tab is the link, not just its word. */
.stages li {
    position: relative;
}

.stages li > a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.stage-meta {
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.stages li[aria-current] {
    border-bottom: 3px solid var(--accent);
}

.stages li:has(> a):hover {
    border-color: var(--line-strong);
    color: var(--ink);
}

.stages .stage-later {
    border-style: dashed;
    opacity: 0.6;
    font-weight: 600;
}

.stage-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-5);
    margin-bottom: var(--space-3);
}

.stage-title {
    margin: 0;
}

/* Outstanding required items: always there to be found, never shouting while you work. */
.outstanding {
    color: var(--attention-ink);
    font-size: 0.9rem;
}

.outstanding > summary {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.outstanding ul {
    margin: var(--space-2) 0 0;
    padding-left: 1.2rem;
}

.group {
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

.group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-2);
}

.group-head h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
}

.group .disclosure {
    margin: var(--space-3) 0 0;
    background: transparent;
}

/* One item at rest: its label, its control, and a quiet "More". Nothing else until asked. */
.item {
    display: grid;
    grid-template-columns: minmax(9rem, 16rem) minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--line);
}

.item:last-child {
    border-bottom: 0;
    padding-bottom: var(--space-1);
}

.item[data-layout="stacked"] {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: var(--space-3);
}

.item[data-layout="stacked"] .item-control {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: 44rem;
}

/* A choice made in steps (a phase, then its component): each row of choices says what it is. */
.choice-group {
    margin-bottom: var(--space-3);
}

.choice-group-label {
    display: block;
    margin-bottom: var(--space-2);
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 600;
}

.choice-group .choices {
    margin-bottom: 0;
}

/* The selection in words, naming its framework (FR-211): a quiet confirmation, set apart. */
.framework-reading {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-1) 0 var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.framework-text {
    margin-bottom: 0;
}

.item-label-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    min-height: var(--target);
}

.item-label {
    font-weight: 600;
}

.item-control .choices,
.item-control .number-entry {
    margin-bottom: 0;
}

.item-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    margin-top: var(--space-1);
    min-height: 1.5rem;
}

.item-status:empty {
    display: none;
}

.item-status .tag-empty {
    border-color: transparent;
    padding-left: 0;
    font-weight: 400;
    opacity: 0.75;
}

.item-status .button-quiet {
    padding: 0 var(--space-1);
    font-size: 0.85rem;
}

.more-toggle {
    min-height: var(--target);
    padding: 0 var(--space-2);
    border: 0;
    background: none;
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.more-toggle:hover,
.more-toggle[aria-expanded="true"] {
    color: var(--accent-text);
}

.more-toggle::after {
    content: "\00a0\25BE";
}

.more-toggle[aria-expanded="true"]::after {
    content: "\00a0\25B4";
}

.item-more,
.item-problems {
    grid-column: 1 / -1;
}

.item-more {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-large);
    background: var(--surface-raised);
}

.item-more > :last-child {
    margin-bottom: 0;
}

.item-more .actions {
    margin-bottom: var(--space-2);
}

/* Choices are pressed, not ticked: the chosen one is filled and carries a tick as well. */
.choices {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.choice {
    min-height: var(--target);
    padding: 0 var(--space-4);
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
}

.choice:hover {
    border-color: var(--ink-soft);
    background: var(--surface-raised);
}

.choice[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--accent-tint);
    color: var(--accent-text);
    font-weight: 600;
}

.choice[aria-pressed="true"]::before {
    content: "\2713\00a0";
}

.number-entry {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.input-number {
    max-width: 7rem;
    font-variant-numeric: tabular-nums;
}

.input-units {
    max-width: 9rem;
}

textarea.input {
    resize: vertical;
}

.reason-form {
    margin-bottom: var(--space-2);
}

.note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--line);
}

.note-text {
    flex: 1 1 18rem;
}

.note-detail {
    flex-basis: 100%;
}

.detail > summary {
    display: inline-block;
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.detail[open] > summary {
    margin-bottom: var(--space-2);
}

.history {
    margin: 0 0 var(--space-2);
    padding-left: 1.2rem;
}

.link-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
}

.stage-next {
    margin-top: var(--space-5);
}

/* Narrower than a laptop: the stage bar becomes one strip that scrolls sideways, so the bar
   that stays on screen never grows taller than two lines. */
@media (max-width: 62rem) {
    .session-bar .stages {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: thin;
        padding-bottom: var(--space-1);
    }

    .session-bar .stages li {
        flex: none;
    }
}

/* A phone: one column, full-width controls, and the session line trimmed to what identifies it. */
@media (max-width: 44rem) {
    html {
        font-size: 100%;
    }

    .page {
        padding-top: var(--space-5);
    }

    /* On a phone the bar would take a quarter of the screen if it stayed put, so it scrolls
       away with the page. The reference is still at the top of every stage. */
    .session-bar {
        position: static;
        margin-top: calc(var(--space-5) * -1);
    }

    .mode-banner {
        font-size: 0.75rem;
        padding: var(--space-1) var(--space-3);
    }

    .user-bar {
        font-size: 0.8rem;
    }

    .session-id .eyebrow {
        display: none;
    }

    .group {
        padding: var(--space-3) var(--space-4);
    }

    .card {
        padding: var(--space-4);
    }

    .choice {
        padding: 0 var(--space-3);
    }

    .input-number {
        max-width: 6rem;
    }

    .masthead-inner {
        min-height: 3rem;
    }

    .item {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .item .item-control {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .session-bar {
        margin-left: calc(var(--space-4) * -1);
        margin-right: calc(var(--space-4) * -1);
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .save-status {
        margin-left: 0;
    }
}

/* ---------- Pilot: feedback and the owner's report */

.page-foot {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--space-5) var(--space-6);
}

.feedback {
    border-top: 1px solid var(--line);
    padding-top: var(--space-3);
}

.feedback > summary {
    cursor: pointer;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.feedback-form {
    max-width: 34rem;
    margin-top: var(--space-3);
}

.stage-pick {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.stage-pick [aria-current="page"] {
    border-color: var(--accent);
    color: var(--accent-text);
}

.figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--space-3) var(--space-5);
    margin: 0 0 var(--space-2);
}

.figures dt {
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.figures dd {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

/* A row's own heading reads as a label, not as a column heading. */
.table tbody th {
    color: var(--ink);
    font-size: inherit;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    border-bottom-color: var(--line);
}

.feedback-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.feedback-list li {
    padding: var(--space-3) 0;
    border-top: 1px solid var(--line);
}

.feedback-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ---------- Measures */

.results {
    margin: 0 0 var(--space-2);
    padding: 0;
    list-style: none;
}

.results li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--line);
}

.results li:last-child {
    border-bottom: 0;
}

.result-text {
    flex: 1 1 18rem;
    font-weight: 600;
}

.result-invalid .result-text {
    color: var(--ink-soft);
    font-weight: 400;
    text-decoration: line-through;
}

/* A new result: labelled fields in one row that wraps whole, the actions on a line of their own. */
.measure-entry {
    margin-top: var(--space-2);
}

.measure-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3) var(--space-4);
}

.measure-field {
    margin-bottom: 0;
    flex: 0 1 auto;
}

.measure-entry .choices {
    margin-bottom: 0;
}

.measure-suffix {
    white-space: nowrap;
}

.measure-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    margin-top: var(--space-3);
}

.input-condition {
    width: auto;
    min-width: 11rem;
    max-width: 16rem;
}

/* The chart: drawn by hand so it carries no library and uses the same colours as everything else. */
/* On a phone the chart keeps a readable size and scrolls sideways inside its own frame. */
.chart-wrap {
    overflow-x: auto;
    margin: var(--space-2) 0 var(--space-3);
}

.chart {
    display: block;
    width: 100%;
    min-width: 30rem;
    max-width: 44rem;
    height: auto;
}

.chart-axis {
    stroke: var(--line-strong);
    stroke-width: 1;
}

.chart-grid {
    stroke: var(--line);
    stroke-width: 1;
    stroke-dasharray: 3 5;
}

.chart-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linejoin: round;
}

.chart-group {
    stroke: var(--ink-soft);
    stroke-width: 1.5;
}

.chart-point {
    fill: var(--accent);
    stroke: var(--paper);
    stroke-width: 2;
}

/* A later result in the same session: an open ring, so it is told apart by shape, not colour. */
.chart-point-later {
    fill: var(--surface);
    stroke: var(--accent-text);
    stroke-width: 2;
}

.chart-text {
    fill: var(--ink);
    font-family: var(--font);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.chart-text-soft {
    fill: var(--ink-soft);
    font-size: 12px;
}

.table caption {
    caption-side: top;
    padding-bottom: var(--space-1);
    text-align: left;
}

/* ---------- Summary: concise points, the reason one action away */

.finding {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--line);
}

.finding:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.finding-main {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
}

.finding-points {
    flex: 1 1 20rem;
    margin: 0;
    padding-left: 1.2rem;
}

.finding-points li {
    margin-bottom: var(--space-1);
}

.finding-points a {
    color: var(--ink);
    text-decoration-color: var(--line-strong);
}

.finding .item-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.finding .item-more {
    margin-top: var(--space-2);
}

/* ---------- Review and export */

.note-preview {
    max-width: 52rem;
}

.note-section + .note-section {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--line);
}

.note-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
}

.note-section-head h3 {
    margin: 0 0 var(--space-2);
    color: var(--accent-text);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.note-preview ul {
    margin: 0;
    padding-left: 1.2rem;
}

.note-preview li {
    margin-bottom: var(--space-1);
}

/* The note as it will be pasted: plain text, in a fixed-width face, wrapped not cut. */
.note-text {
    max-width: 52rem;
    margin: var(--space-1) 0 var(--space-2);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--paper-deep);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

textarea.note-text {
    width: 100%;
    resize: vertical;
}

.confirm-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-7);
    margin-bottom: var(--space-4);
}

.export-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    margin-bottom: var(--space-4);
}

/* ---------- The case reference: the only thing that identifies a case. */

.reference {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.reference-input {
    max-width: 13rem;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-align: center;
}

.item-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--line);
}

.item-row:last-child {
    border-bottom: 0;
}

.item-row .item-label {
    flex: 1 1 16rem;
    font-weight: 550;
}

.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.swatch {
    width: 8.5rem;
    font-size: 0.8rem;
}

.swatch-colour {
    height: 3rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: var(--space-1);
}

/* ---------- Framework */

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1200;
    padding: var(--space-3) var(--space-5);
    border-top: 2px solid var(--problem-line);
    background: var(--problem-bg);
    color: var(--problem-ink);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}

.blazor-error-boundary {
    padding: var(--space-4);
    background: var(--problem-bg);
    color: var(--problem-ink);
}

.blazor-error-boundary::after {
    content: "Something went wrong in this part of the page.";
}

@media (max-width: 40rem) {
    .masthead-inner, .page {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .user-bar {
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* ---------- Target size (WCAG 2.2, 2.5.8): nothing that is pressed is under 24 px high */

summary,
.button-quiet,
a.small {
    min-height: 1.5rem;
}

a.small {
    display: inline-flex;
    align-items: center;
}

/* ---------- Icons: a drawn mark beside the words, in the words' own colour, never instead of them */

.icon {
    flex: none;
    width: 1.1em;
    height: 1.1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.18em;
}

.button .icon,
.main-nav .icon,
a.small .icon,
.feedback > summary .icon {
    margin-right: 0.4em;
}

/* A mark that follows its words, such as the arrow on "Continue". */
.button .icon:last-child:not(:first-child) {
    margin-right: 0;
    margin-left: 0.4em;
}

.stage-meta .icon {
    margin-right: 0.3em;
}

.main-nav a {
    white-space: nowrap;
}

/* The owner's menu is longer than a phone is wide, so it wraps there and is never cut off. */
@media (max-width: 40rem) {
    .main-nav {
        flex-wrap: wrap;
    }
}

/* ---------- A session as a hub, after the Educational Hub on the practice website.
   Wide: the session down the left, the stage on the right. Narrow: the strip at the top, with
   Back and Continue at the foot of the screen, as the website keeps Book Online and Call. */

.page:has(> .hub) {
    max-width: none;
    padding: 0;
}

.hub .session-bar {
    margin: 0;
}

.hub-main {
    max-width: var(--measure);
    margin: 0 auto;
    padding: var(--space-5) var(--space-5) var(--space-7);
}

.stages li > a {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
}

.only-wide {
    display: none;
}

.hub-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--space-4);
    margin: var(--space-5) 0 0;
    padding: var(--space-3) 0 0;
    border-top: 1px solid var(--line);
    list-style: none;
}

.hub-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    min-height: var(--target);
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
}

.hub-links a:hover {
    color: var(--ink);
}

/* Getting back (BackLink): the way back to the list or page this one was opened from. Always
   first in the side panel, or at the top of a page without one, with the back arrow. */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    min-height: var(--target);
    color: var(--ink-soft);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
}

.back-link:hover {
    color: var(--ink);
}

.hub .session-id .back-link,
.hub-side > .back-link {
    margin-bottom: var(--space-2);
}

.hub-side > .back-link {
    display: flex;
}

.hub-next:empty {
    display: none;
}

@media (max-width: 59.99rem) {
    .hub-next {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1050;
        display: flex;
        gap: var(--space-3);
        padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));
        background: rgb(22 19 13 / 94%);
        border-top: 1px solid rgb(74 74 72 / 35%);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }

    .hub-next .button {
        flex: 1 1 0;
        min-width: 0;
    }

    body:has(.hub-next) {
        padding-bottom: 5rem;
    }
}

/* A phone: "Back to" and "Continue to" are dropped, leaving the arrow and the stage. */
@media (max-width: 44rem) {
    .hub-next-verb {
        display: none;
    }

    .hub-main {
        padding: var(--space-4) var(--space-4) var(--space-6);
    }
}

@media (min-width: 60rem) {
    .only-wide {
        display: block;
    }

    .only-narrow {
        display: none;
    }

    .hub {
        display: grid;
        grid-template-columns: 17rem minmax(0, 1fr);
        min-height: calc(100vh - 6rem);
    }

    .hub .session-bar {
        position: sticky;
        top: 2.3rem;
        z-index: 10;
        align-self: stretch;
        max-height: calc(100vh - 2.3rem);
        overflow-y: auto;
        padding: var(--space-6) var(--space-3) var(--space-5);
        background: var(--surface);
        border-bottom: 0;
        border-right: 1px solid rgb(74 74 72 / 20%);
    }

    .hub .session-id {
        display: block;
        margin: 0 0 var(--space-4);
        padding: 0 var(--space-3);
    }

    .hub .session-id .eyebrow {
        display: block;
    }

    .hub .session-reference {
        display: block;
        margin: var(--space-1) 0 var(--space-1);
        font-size: 1.65rem;
        line-height: 1.2;
    }

    .hub .session-meta {
        display: block;
        font-size: 0.9rem;
    }

    .hub .session-id .button-quiet {
        margin-left: calc(var(--space-2) * -1);
    }

    .hub .save-status {
        display: block;
        margin: var(--space-1) 0 0;
        font-size: 0.8rem;
    }

    .hub .context-editor {
        padding: var(--space-3);
    }

    .hub .session-bar .stages {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 2px;
        overflow: visible;
        margin: 0;
        padding: 0;
    }

    .hub .session-bar .stages li {
        flex: none;
        align-items: stretch;
        min-height: 0;
        padding: 0.55rem var(--space-3);
        border: 0;
        border-radius: var(--radius-large);
        background: transparent;
        color: var(--ink-soft);
    }

    .hub .session-bar .stages li > a {
        gap: 0.7rem;
        font-weight: 500;
    }

    .hub .session-bar .stages li > a .icon {
        width: 1.25rem;
        height: 1.25rem;
    }

    .hub .session-bar .stage-meta {
        padding-left: 1.95rem;
    }

    .hub .session-bar .stages li:has(> a):hover {
        background: var(--surface-raised);
        color: var(--ink);
    }

    .hub .session-bar .stages li[aria-current] {
        background: rgb(233 120 42 / 15%);
        color: var(--accent-text);
    }

    .hub .session-bar .stages li[aria-current] > a {
        font-weight: 700;
    }

    .hub-next {
        display: flex;
        flex-direction: column-reverse;
        gap: var(--space-2);
        margin-top: var(--space-5);
        padding: 0 var(--space-1);
    }

    .hub-next .button {
        width: 100%;
        padding: 0 var(--space-3);
        letter-spacing: 0.01em;
        white-space: nowrap;
    }

    .hub-links {
        flex-direction: column;
        margin-top: var(--space-4);
        padding: var(--space-3) var(--space-3) 0;
    }

    .hub-links a {
        min-height: 2.4rem;
    }

    .hub-main {
        width: 100%;
        padding: var(--space-6) var(--space-6) var(--space-7);
    }

    .stage-title {
        font-size: 2.1rem;
    }

    h1 {
        font-size: 2.5rem;
    }
}

/* ---------- Glossary, after the glossary on the practice website */

.kicker {
    margin: calc(var(--space-2) * -1) 0 var(--space-2);
    color: #fab890;
}

.glossary-page {
    max-width: 52rem;
}

.glossary-search {
    position: relative;
    margin: var(--space-5) 0 var(--space-4);
}

.glossary-search .icon {
    position: absolute;
    top: 50%;
    left: 0.9rem;
    color: var(--ink-soft);
    transform: translateY(-50%);
    pointer-events: none;
}

.glossary-search .input {
    padding-left: 2.6rem;
}

.glossary {
    display: grid;
    gap: var(--space-3);
}

.glossary .disclosure {
    margin: 0;
}

/* ---------- The top bar, as in a business application: one line, the full width of the screen.
   The mark and Simplex on the left, then the places, then the role toggle and the person. */

.masthead-inner {
    flex-wrap: nowrap;
    gap: var(--space-4);
    max-width: none;
    min-height: 3.5rem;
    padding: 0 var(--space-5);
}

.wordmark {
    flex: none;
}

.main-nav {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
    display: none;
}

.main-nav a {
    flex: none;
    gap: 0.45em;
    padding: 0 0.65rem;
    white-space: nowrap;
}

.user-bar {
    flex: none;
    flex-wrap: nowrap;
    gap: var(--space-4);
    margin-left: auto;
}

/* The role toggle: one pill, the current role filled. */
.role-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.role-switch-label {
    padding: 0 var(--space-2) 0 var(--space-3);
    color: var(--ink-soft);
    font-size: 0.75rem;
    white-space: nowrap;
}

.role-option {
    min-height: 2rem;
    padding: 0 var(--space-4);
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.role-option:hover {
    background: var(--surface-raised);
    color: var(--ink);
}

.role-option[aria-pressed="true"] {
    background: var(--accent);
    color: var(--on-accent);
    cursor: default;
}

/* The person: a circle with their initials, opening a small menu. */
.account {
    position: relative;
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--accent-text);
    border-radius: 50%;
    background: var(--accent-tint);
    color: var(--accent-text);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    list-style: none;
    user-select: none;
}

summary.avatar {
    cursor: pointer;
}

summary.avatar::-webkit-details-marker {
    display: none;
}

summary.avatar:hover,
.account[open] > summary.avatar {
    background: var(--accent);
    color: var(--on-accent);
}

.avatar-large {
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 0.95rem;
}

.account-menu {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    z-index: 1200;
    width: 17rem;
    padding: var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: var(--surface);
    box-shadow: 0 12px 32px rgb(0 0 0 / 45%);
}

.account-who {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    margin-bottom: var(--space-1);
    border-bottom: 1px solid var(--line);
}

.account-name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.account-menu form {
    display: block;
}

.account-item {
    display: flex;
    align-items: center;
    gap: 0.6em;
    width: 100%;
    min-height: var(--target);
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.account-item:hover {
    background: var(--surface-raised);
}

.account-item .icon {
    color: var(--ink-soft);
}

.role-switch-narrow {
    display: none;
    padding: var(--space-2) var(--space-3) var(--space-3);
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--space-1);
}

.role-switch-narrow .role-switch {
    display: flex;
    flex-wrap: wrap;
    border-radius: var(--radius-large);
}

.role-switch-narrow .role-option {
    flex: 1 1 auto;
}

.role-switch-narrow .role-switch-label {
    flex-basis: 100%;
    padding: var(--space-1) var(--space-2);
}

/* Narrower than a laptop: the role toggle moves into the person's menu. */
@media (max-width: 63.99rem) {
    .role-switch-wide {
        display: none;
    }

    .role-switch-narrow {
        display: block;
    }

    .masthead-inner {
        gap: var(--space-3);
        padding: 0 var(--space-4);
    }

    /* A tablet: the places by their words alone, which fit on one line and read more clearly than marks. */
    .main-nav a .icon {
        display: none;
    }

    .main-nav a {
        padding: 0 0.5rem;
    }
}

/* A phone: the places are shown by their marks alone, still named for assistive technology,
   and Simplex by its mark, so everything stays on one line. */
@media (max-width: 44rem) {
    .wordmark-text,
    .nav-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .main-nav a {
        padding: 0 0.55rem;
    }

    .main-nav a .icon {
        display: inline-block;
        width: 1.3rem;
        height: 1.3rem;
        margin: 0;
    }

    .masthead-inner {
        min-height: 3.25rem;
        padding: 0 var(--space-3);
    }

    .account-menu {
        width: min(17rem, calc(100vw - 1.5rem));
    }
}

/* ---------- Cases, laid out like a session: finding a case on the left, the case on the right. */

.case-side {
    padding: var(--space-5) var(--space-4) var(--space-4);
    background: var(--surface);
    border-bottom: 1px solid rgb(74 74 72 / 20%);
}

.hub-title {
    margin: 0 0 var(--space-1);
    font-size: 2rem;
}

.hub-subtitle {
    margin: 0 0 var(--space-4);
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.case-find .label {
    display: block;
    margin-bottom: var(--space-1);
}

.case-find-row {
    display: flex;
    gap: var(--space-2);
}

.case-find-row .input {
    flex: 1 1 auto;
    min-width: 0;
}

.case-create {
    width: 100%;
    margin-top: var(--space-3);
}

.case-side .case-note {
    margin: var(--space-3) 0 0;
}

.case-list-title {
    margin: var(--space-5) 0 var(--space-2);
}

.case-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.case-link {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    min-height: var(--target);
    padding: 0 var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    cursor: pointer;
}

.case-link .reference {
    font-size: 0.95rem;
}

.case-link:hover {
    background: var(--surface-raised);
    color: var(--ink);
}

.case-list li[aria-current] .case-link {
    border-color: transparent;
    background: rgb(233 120 42 / 15%);
    color: var(--accent-text);
    font-weight: 700;
}

.case-empty {
    padding: var(--space-7) var(--space-5);
    text-align: center;
}

.case-empty > .icon {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: var(--space-3);
    color: var(--accent-text);
}

.case-empty p {
    margin: 0 auto;
    color: var(--ink-soft);
}

.case-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
}

.case-reference {
    margin: var(--space-1) 0 0;
    font-family: var(--font-mono);
    font-size: 2rem;
    letter-spacing: 0.02em;
}

.start-card .start-session {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}

.start-card .choices {
    margin: 0;
}

.section-title {
    margin: var(--space-5) 0 var(--space-3);
    font-family: var(--font-display);
    font-size: 1.3rem;
}

/* Each session a card that opens it, as the website's cards open their topic. */
.session-list {
    display: grid;
    gap: var(--space-2);
    margin: 0 0 var(--space-5);
    padding: 0;
    list-style: none;
}

.session-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: var(--space-1) var(--space-4);
    min-height: var(--target);
    padding: var(--space-3) var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.session-card:hover {
    border-color: var(--line-strong);
    background: var(--surface-raised);
}

.session-card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
}

.session-card-meta {
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.session-card > .icon {
    color: var(--ink-soft);
}

@media (min-width: 60rem) {
    .hub .case-side {
        position: sticky;
        top: 2.3rem;
        z-index: 10;
        align-self: stretch;
        max-height: calc(100vh - 2.3rem);
        overflow-y: auto;
        padding: var(--space-6) var(--space-4) var(--space-5);
        border-bottom: 0;
        border-right: 1px solid rgb(74 74 72 / 20%);
    }

    .case-list {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 2px;
    }

    .case-link {
        width: 100%;
        border-color: transparent;
    }
}

/* A phone: once a case is open, the finder above it shrinks to the reference box and its
   buttons, and each session card puts its status on a line of its own. */
@media (max-width: 44rem) {
    .has-case .case-side .hub-subtitle,
    .has-case .case-side .case-note {
        display: none;
    }

    .has-case .case-side .hub-title {
        font-size: 1.5rem;
    }

    .case-reference {
        font-size: 1.6rem;
    }

    .session-card {
        grid-template-columns: minmax(0, 1fr) auto;
        padding: var(--space-3) var(--space-4);
    }

    .session-card-meta {
        grid-column: 1;
    }

    .session-card .tag {
        grid-column: 1;
        justify-self: start;
    }

    .session-card > .icon {
        grid-column: 2;
        grid-row: 1 / span 3;
    }

    .case-empty {
        padding: var(--space-6) var(--space-4);
    }
}


/* A small capitals label stays in Inter, even when it is a heading. */
h2.eyebrow,
h3.eyebrow {
    font-family: var(--font);
    font-size: 0.75rem;
    letter-spacing: 0.03em;
}

/* Capacity against demand (feature 002, FW-C). Bars share one scale only when the buffer is worked
   out. A prediction is drawn as an outline, and every bar is also labelled in words. */
.capacity-bars { display: grid; gap: 0.5rem; margin: 1rem 0; }
.capacity-bar { display: grid; grid-template-columns: minmax(12rem, 18rem) 1fr; align-items: center; gap: 0.75rem; }
.capacity-bar-track { display: block; height: 1.25rem; border-bottom: 1px solid currentColor; }
.capacity-bar-fill { display: block; height: 100%; background: currentColor; opacity: 0.35; }
.capacity-bar-fill.is-prediction { background: transparent; border: 2px dashed currentColor; opacity: 0.8; }
@media (max-width: 40rem) { .capacity-bar { grid-template-columns: 1fr; } }

/* Catalogue and rules editor (feature 003), laid out like a case: the draft and its items in the
   side panel, the chosen item on the right. It uses the case styles; these are only the extras. */
.draft-save { margin: var(--space-4) 0 0; }
.draft-find { margin-top: var(--space-5); }
.case-list-title + .draft-group { margin-top: 0; }
.draft-group { margin: var(--space-3) 0 var(--space-1); padding: 0 var(--space-3); font-weight: 600; }
.draft-item { height: auto; padding-block: var(--space-2); text-align: left; flex-wrap: wrap; }
.draft-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.draft-item-text .code { color: var(--ink-soft); overflow-wrap: anywhere; }
.draft-item-title { margin: var(--space-1) 0 0; }
.draft-freeze { margin-top: var(--space-5); }
.item-form .field-row { align-items: flex-start; margin-bottom: var(--space-4); }
.item-form .field-row:last-child { margin-bottom: 0; }
/* Shared: the one-line explanation under a card's title (the editor's sections, a stage's notes). */
.card-hint { margin: calc(-1 * var(--space-2)) 0 var(--space-4); }

/* Shared: a label kept for screen readers when the field's purpose is already shown. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* A stage's notes: one line to write a note and add it, the button the same height as the box. */
/* Demo accounts on the fictional test site's sign-in screen. */
.demo-accounts h2 { font-size: 1.1rem; margin-bottom: var(--space-2); }
.demo-list { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.demo-list li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }

/* Reuse of earlier sessions (FR-014): the panel above a stage's items, and the line under a reused item. */
.reuse { margin-bottom: var(--space-4); }
.reuse-session { border: 0; margin: 0 0 var(--space-4); padding: 0; }
.reuse-session legend { padding: 0; margin-bottom: var(--space-2); color: var(--accent-text); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.reuse-entry { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); min-height: var(--target); padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
.reuse-entry input[type="checkbox"] { width: 1.25rem; height: 1.25rem; flex: none; accent-color: var(--accent); }
.reuse-entry label { flex: 1 1 18rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.reuse-item { color: var(--ink-soft); }
.reuse-actions { margin-top: var(--space-3); }
.reuse-note { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: var(--space-2) 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.note-add { display: flex; gap: var(--space-2); max-width: 44rem; margin-top: var(--space-3); }
.note-add .input { flex: 1 1 auto; }
.note-add .button { flex: none; white-space: nowrap; }
.draft-move { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }
.draft-choices { margin: var(--space-2) 0 0; }
.draft-remove { margin: var(--space-5) 0; }
.draft-remove .hint { margin-top: var(--space-1); }
.list-editor { border: 0; margin: 0 0 var(--space-5); padding: 0; }
.list-editor > .hint { margin: 0 0 var(--space-2); }
.list-editor-items { margin: 0 0 var(--space-2); padding: 0; list-style: none; max-width: 40rem; }
.list-editor-add { display: flex; gap: var(--space-2); max-width: 40rem; }
.list-editor-add .input { flex: 1 1 auto; }
.list-editor-items li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) 0; border-bottom: 1px solid var(--line); }

/* Rules editor (feature 003, User Story 4): a condition, and the conditions nested in "all of" or "any of". */
.condition { margin-bottom: var(--space-4); }
.condition .field-row { align-items: flex-start; margin-bottom: var(--space-3); }
.condition-nested { margin-bottom: var(--space-2); }
.condition-children { margin: 0 0 var(--space-2) var(--space-2); padding-left: var(--space-4); border-left: 2px solid var(--line-strong); }
.condition-child { margin-bottom: var(--space-3); }
.condition-short { flex: 0 1 9rem; }
.draft-discard { margin-top: var(--space-4); }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); padding: var(--space-1) 0; border-bottom: 1px solid var(--line); }