/* Inter 4.1, official unmodified WOFF2; SIL OFL 1.1 in public/fonts. */
@font-face {
    font-family: "Inter";
    src: url("../fonts/inter-variable-4.1.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

/* One component system; only these semantic values change between themes. */
:root,[data-theme="light"] {
    color-scheme:light;
    --bg-app:#edf2f8; --bg-surface:#ffffff; --bg-surface-elevated:#f8fafd; --bg-surface-muted:#e7eef6;
    --text-primary:#172c46; --text-secondary:#405773; --text-muted:#536881;
    --border-subtle:#d6e0ec; --border-strong:#8b9eb5;
    --accent-primary:#185bb5; --accent-secondary:#087187; --accent-soft:#e5effc; --on-accent:#ffffff;
    --status-success:#17633e; --success-soft:#e5f3eb; --status-warning:#864600; --warning-soft:#fff0dc;
    --status-danger:#aa302e; --danger-soft:#fceae8; --status-info:#185bb5; --info-soft:#e5effc;
    --scenario:#70419b; --scenario-soft:#f0eafa;
    --shadow-soft:0 3px 14px rgb(21 44 75 / 5%);
    --radius-sm:6px; --radius-md:10px; --radius-lg:14px;
    --space-panel:1rem; --nav-bg:#101f35; --nav-surface:#1c334f; --nav-text:#e4edf9; --nav-accent:#8ec7ff;
    --clock-bg:#152b45; --clock-text:#f4f8ff; --focus:#185bb5;
}
[data-theme="dark"] {
    color-scheme:dark;
    --bg-app:#15171c; --bg-surface:#1c1f25; --bg-surface-elevated:#252830; --bg-surface-muted:#2b2e36;
    --text-primary:#f4f5f7; --text-secondary:#b9bdc5; --text-muted:#a9aeb8;
    --border-subtle:#393d45; --border-strong:#777d88;
    --accent-primary:#ff9466; --accent-secondary:#f4a58d; --accent-soft:#382b29; --on-accent:#15171c;
    --status-success:#8ce0b2; --success-soft:#173d33; --status-warning:#ffc789; --warning-soft:#433320;
    --status-danger:#ffaaa5; --danger-soft:#442a35; --status-info:#8bc2ff; --info-soft:#213e62;
    --scenario:#d1b4f4; --scenario-soft:#342e50;
    --shadow-soft:0 3px 14px rgb(0 0 0 / 15%); --clock-bg:#111216; --clock-text:#f4f5f7; --focus:#ff9466;
    --nav-bg:#191b20; --nav-surface:#2b2e36; --nav-text:#f4f5f7; --nav-accent:#ff9466;
    --brand-orange:#FF5A00; --brand-red:#F12B24; --brand-magenta:#D8175B;
    /* Darker brand stops preserve AA contrast with white button labels. */
    --brand-gradient:linear-gradient(105deg,#b83f00,#cc241f,#b3144b);
    --on-brand:#ffffff;
}
/* Keep semantic information blue; brand orange must not replace status meanings. */
[data-theme="dark"] .preparation-shell .exercise-status-preparation { color:var(--status-info); }
[data-theme="dark"] :is(.stimulus-dialog,.rich-editor dialog)::backdrop { background:rgb(0 0 0 / 65%); }
[data-theme="dark"] .video-conference[data-expanded="true"] { box-shadow:0 0 0 100vmax rgb(0 0 0 / 80%); }

body,body:has(>.preparation-shell),.operational-layout { background:var(--bg-app); color:var(--text-primary); --operational-elevation:var(--shadow-soft); --op-blue:var(--status-info); --op-orange:var(--status-warning); --op-red:var(--status-danger); --op-green:var(--status-success); }
body { font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif; }
h1,h2,h3 { color:var(--text-primary); letter-spacing:-.025em; }
:where(a,button,input,select,textarea,summary,[tabindex]):focus-visible { outline:3px solid var(--focus); outline-offset:3px; }
button,input,select,textarea { font:inherit; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),select,textarea { color:var(--text-primary); background:var(--bg-surface); border:1px solid var(--border-strong); border-radius:var(--radius-sm); }
input::placeholder,textarea::placeholder { color:var(--text-muted); opacity:1; }
input[type="checkbox"],input[type="radio"] { accent-color:var(--accent-primary); }
:disabled { cursor:not-allowed; opacity:.65; }
.site-header,.operational-header { background:var(--bg-surface); border-color:var(--border-subtle); }
.header-inner,.operational-header { padding-block:.7rem; }
.brand,.operational-brand { color:var(--text-primary); letter-spacing:-.04em; }
/* Original SVG proportions; theme.js sets the theme before styles are painted. */
.brand-logo { display:inline-flex; vertical-align:middle; flex-shrink:0; width:9rem; max-width:40vw; }
.brand-logo img { display:block; width:100%; height:auto; transform:scale(1.25); transform-origin:40% center; }
.brand-logo .brand-asset-dark,[data-theme="dark"] .brand-logo .brand-asset-light { display:none; }
[data-theme="dark"] .brand-logo .brand-asset-dark { display:block; }
.operational-header>.theme-control { margin-left:auto; }
.operational-header:has(.operational-dashboard-link)>.theme-control { margin-left:0; }
.theme-control { display:inline-flex; width:fit-content; gap:2px; padding:3px; border:1px solid var(--border-subtle); background:var(--bg-surface-muted); border-radius:var(--radius-sm); font-size:.75rem; }
.theme-control[hidden] { display:none; }
.theme-control button { display:inline-flex; gap:.35rem; align-items:center; min-height:30px; padding:.2rem .55rem; border:0; border-radius:4px; color:var(--text-secondary); background:transparent; cursor:pointer; }
.theme-control button[aria-pressed="true"] { background:var(--bg-surface); color:var(--accent-primary); box-shadow:var(--shadow-soft); font-weight:650; }
.dashboard-label,.form-label { color:var(--accent-secondary); letter-spacing:.12em; }
:is(.preparation-shell,.operational-layout,body) .button { background:var(--accent-primary); color:var(--on-accent); border-color:transparent; border-radius:var(--radius-sm); }
:is(.preparation-shell,.operational-layout,body) .button-secondary { background:var(--bg-surface-muted); color:var(--text-primary); border-color:var(--border-subtle); }
:is(.preparation-shell,.operational-layout,body) :is(.button-danger,.button-danger-small) { background:var(--danger-soft); color:var(--status-danger); border-color:var(--status-danger); }
:is(.preparation-shell,.operational-layout,body) .button-warning { background:var(--warning-soft); color:var(--status-warning); border-color:var(--status-warning); }
:is(.preparation-shell,.operational-layout,body) .button:hover { filter:brightness(.95); }
[data-theme="dark"] .button:hover { filter:brightness(1.1); }
.operational-sidebar { background:var(--nav-bg); border-color:var(--nav-surface); color:var(--nav-text); }
.operational-sidebar a { color:var(--nav-text); }
.operational-sidebar a:hover,.operational-sidebar .sidebar-link[aria-current],.operational-sidebar .sidebar-toggle { background:var(--nav-surface); color:var(--nav-text); }
.operational-sidebar .sidebar-link[aria-current] { box-shadow:none; }
.operational-sidebar :is(a,button):focus-visible { outline-color:var(--nav-accent); }
.preparation-shell,.dashboard-card,.form-card,.login-card,.operational-card,.instrument-panel,.exercise-chat,.participant-reader,.participant-feed,.cockpit-feed,.survey-answer,.survey-question { background:var(--bg-surface); border:1px solid var(--border-subtle); border-radius:var(--radius-md); box-shadow:var(--shadow-soft); }
.dashboard-page.preparation-shell { background:transparent; border:0; box-shadow:none; padding-top:0; }
.preparation-shell .exercise-item { background:var(--bg-surface-elevated); border:1px solid var(--border-subtle); border-radius:var(--radius-md); padding:1.1rem; }
.exercise-item h3 a { color:var(--text-primary); }
.exercise-item h3 a:hover { color:var(--accent-primary); }
.exercise-archive-actions .button { font-size:.78rem; }
:is(.stimulus-dialog,.rich-editor dialog),.stimulus-dialog-header,.archive-dialog { color:var(--text-primary); background:var(--bg-surface); border-color:var(--border-subtle); }
.stimulus-dialog { box-shadow:var(--shadow-soft); border-radius:var(--radius-lg); }
.stimulus-dialog-header { border-bottom:1px solid var(--border-subtle); margin-bottom:1rem; }
.stimulus-dialog::backdrop { background:rgb(3 12 25 / 65%); }
.survey-rating:has(input:checked) { background:var(--accent-soft); border-color:var(--accent-primary); }
.survey-answer dd { color:var(--accent-primary); }
.status-badge,.exercise-status { background:var(--bg-surface-muted); color:var(--text-secondary); border:1px solid var(--border-subtle); }
:is(.status-badge-success,.exercise-status-open,.participant-state-open) { color:var(--status-success); background:var(--success-soft); border-color:var(--status-success); }
:is(.status-badge-warning,.exercise-status-paused,.participant-state-paused) { color:var(--status-warning); background:var(--warning-soft); border-color:var(--status-warning); }
:is(.status-badge-danger,.field-error,.form-error) { color:var(--status-danger); }
.stimulus-level-information { color:var(--status-info); background:var(--info-soft); border-color:var(--status-info); }
.stimulus-level-important { color:var(--status-warning); background:var(--warning-soft); border-color:var(--status-warning); }
.stimulus-level-action_required { color:var(--status-danger); background:var(--danger-soft); border-color:var(--status-danger); }
.scenario-clock h2,.scenario-clock strong { color:var(--scenario); }
.planned-scenario-time { color:var(--scenario); background:var(--scenario-soft); border-color:var(--scenario); }
.flap-cell,.flap-face { background:var(--clock-bg); color:var(--clock-text); }
.cockpit-heading h1 { font-size:1.35rem; }
.cockpit-information { padding:.7rem; border:1px solid var(--border-subtle); background:var(--bg-surface); border-radius:var(--radius-md); box-shadow:var(--shadow-soft); gap:.55rem; }
.cockpit-information .instrument-panel { padding:.65rem; background:var(--bg-surface-elevated); box-shadow:none; }
.cockpit-information .operational-metrics > div { background:transparent; padding:.25rem .15rem; border-radius:0; border-bottom:1px solid var(--border-subtle); }
.cockpit-information .operational-metrics dt { font-size:.72rem; white-space:normal; }
.cockpit-information .operational-metrics dd { color:var(--text-primary); }
.cockpit-information .operational-control>.operational-actions { grid-template-columns:1fr; }
.cockpit-information .exercise-close-confirmation[open]>summary { width:100%; }
.cockpit-information .operational-control .button { white-space:nowrap; }
.cockpit-information .exercise-close-panel .button { white-space:normal; }
.cockpit-information .instrument-panel h2 { font-size:.65rem; letter-spacing:.07em; }
.cockpit-information .instrument-panel p { font-size:.68rem; }
.cockpit-primary>[data-block]>.operational-card { padding:var(--space-panel); }
.cockpit-feed .operational-feed { border:0; box-shadow:none; background:transparent; }
.dispatch-timeline .dispatch-event,.participant-event a,.participant-notice { background:var(--bg-surface-elevated); border:1px solid var(--border-subtle); border-left:3px solid var(--accent-primary); border-radius:var(--radius-sm); }
.dispatch-event h3,.participant-event strong { line-height:1.45; }
.participant-event a[aria-current="true"] { background:var(--accent-soft); border-color:var(--accent-primary); }
.participant-event a:hover { background:var(--bg-surface-muted); }
.video-conference-lobby,.participant-video-placeholder,.cockpit-instruments .video-placeholder { background:var(--bg-surface-elevated); color:var(--text-secondary); border-color:var(--border-subtle); border-radius:var(--radius-md); }
.video-conference[data-expanded="true"] { background:var(--bg-app); color:var(--text-primary); }
.cockpit-body:has(>.exercise-chat) .video-conference-lobby,.cockpit-body:has(>.exercise-chat) .video-conference:not([data-expanded="true"]) .video-conference-frame { min-height:280px; }
/* The chat is a separate component, not part of the event rail. */
.exercise-chat { padding:var(--space-panel); }
.exercise-chat h2 { font-size:.95rem; padding-bottom:.65rem; border-bottom:1px solid var(--border-subtle); }
.chat-intro { color:var(--text-muted); font-size:.7rem; line-height:1.5; }
.chat-messages { height:clamp(18rem,44vh,30rem); padding-block:.15rem; padding-inline-start:0; }
.chat-message { width:fit-content; max-width:100%; margin:0 0 .7rem; padding:.65rem .75rem; border:1px solid var(--border-subtle); border-radius:var(--radius-md); background:var(--bg-surface-elevated); color:var(--text-primary); font-size:.8rem; }
.chat-message-animator { background:var(--accent-soft); }
.chat-message strong { font-size:.74rem; line-height:1.5; }
.chat-message time { color:var(--text-muted); font-size:.68rem; }
.chat-message p { margin-top:.4rem; line-height:1.6; }
.chat-history .chat-message { font-size:.95rem; }
.chat-history .chat-message strong { font-size:.85rem; }
[data-chat-form] { border-top:1px solid var(--border-subtle); padding-top:.75rem; }
[data-chat-form] label { font-size:.75rem; font-weight:600; }
[data-chat-form] textarea { padding:.6rem; min-height:4.5rem; border-radius:var(--radius-sm); }
[data-chat-form] .button { min-height:34px; font-size:.8rem; }
[data-chat-status] { color:var(--text-secondary); }
.participant-heading h1 { font-size:1.4rem; }
.participant-timebar { gap:1rem; }
.participant-timebar .participant-visio { min-width:0; }
.participant-instrumentation .instrument-panel { padding:.75rem; }
.participant-instrumentation .instrument-panel h2 { font-size:.65rem; letter-spacing:.07em; }
.participant-instrumentation .instrument-panel p { font-size:.72rem; }
.participant-workspace { border:0; border-radius:0; overflow:visible; background:transparent; box-shadow:none; gap:1rem; }
.participant-reader,.participant-feed { min-width:0; padding:var(--space-panel); }
.participant-reader { border-top:1px solid var(--border-subtle); }
.participant-feed h2 { font-size:1rem; }
.participant-message-heading h2 { font-size:1.35rem; }
.participant-visio .video-conference-lobby,.participant-visio .video-conference:not([data-expanded="true"]) .video-conference-frame { height:clamp(260px,22vw,340px); min-height:260px; }
/* Authored stimuli retain their own document colours and layout in a light canvas. */
.rich-content:has(criselab-stimulus) { color-scheme:light; background:#fff; color:#18202b; border-radius:var(--radius-sm); }
.rich-editor .ql-toolbar,.rich-editor .ql-container,.editor-rich-preview { color-scheme:light; background:#fff; color:#18202b; }
@media(min-width:1280px) {
    .cockpit-body:has(>.exercise-chat) { grid-template-columns:minmax(0,53fr) minmax(0,24fr) minmax(0,23fr); }
    .cockpit-body:has(>.exercise-chat) .cockpit-instruments.cockpit-video-workspace { grid-template-columns:minmax(210px,32fr) minmax(0,68fr); gap:.8rem; }
    .cockpit-body:has(>.exercise-chat) .cockpit-video-workspace>.instrument-optional { grid-column:2; grid-row:1; }
    .participant-cockpit { display:grid; grid-template-columns:minmax(195px,18fr) minmax(0,34fr) minmax(0,23fr) minmax(0,25fr); gap:1rem; align-items:start; }
    .participant-heading { grid-column:1/-1; margin-bottom:0; }
    .participant-timebar,.participant-workspace { display:contents; }
    .participant-instrumentation { grid-column:1; grid-row:2; }
    .participant-timebar > .participant-video-column { grid-column:2/4; grid-row:2; }
    .participant-timebar>.exercise-chat { grid-column:4; grid-row:2/4; }
    .participant-reader { grid-column:1/3; grid-row:3; }
    .participant-feed { grid-column:3; grid-row:3; }
}
@media(min-width:800px) and (max-width:1279px) {
    .participant-timebar { grid-template-columns:minmax(195px,24fr) minmax(0,42fr) minmax(230px,34fr); }
    .participant-timebar>.exercise-chat { grid-column:3; grid-row:1; }
    .participant-timebar > .participant-video-column { grid-column:2; grid-row:1; }
    .participant-workspace { grid-template-columns:minmax(0,68fr) minmax(0,32fr); }
}
@media(max-width:799px) {
    .participant-timebar,.participant-workspace { display:grid; grid-template-columns:minmax(0,1fr); }
    .participant-timebar>* { grid-column:1; }
    .operational-header { gap:.6rem; padding:.7rem 1rem; }
    .header-inner { gap:.7rem; padding-inline:1rem; }
    .main-nav { flex-wrap:wrap; gap:.7rem; }
}
@media(prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } }

.chat-message:has(+.chat-message-continuation) { margin-bottom:.2rem; }
.chat-message-continuation { border-top-left-radius:var(--radius-sm); }

.cockpit-feed { align-self:start; }
.participant-instrumentation .scenario-clock strong { font-size:1.05rem; line-height:1.5; }
/* Shared status semantics also apply to fragments replaced by polling. */
.presence-summary-item { color:var(--text-secondary); background:var(--bg-surface-muted); border-color:var(--border-subtle); }
.presence-summary-item.is-connected { color:var(--status-success); background:var(--success-soft); border-color:var(--status-success); }
.presence-led-connected { background:var(--status-success); box-shadow:0 0 0 2px var(--success-soft); }
.dispatch-event-meta .status-badge,.operational-feed :is(.dispatch-planned,.dispatch-scenario) { color:var(--status-info); background:var(--info-soft); border-color:var(--status-info); }
.dispatch-event-resend .dispatch-event-meta .status-badge,.operational-feed .dispatch-event-resend :is(.dispatch-planned,.dispatch-scenario) { color:var(--status-warning); background:var(--warning-soft); border-color:var(--status-warning); }
.operational-layout:has([data-cockpit][data-status="open"]) .operational-header .status-badge { color:var(--status-success); background:var(--success-soft); border-color:var(--status-success); }
.operational-layout:has([data-cockpit][data-status="paused"]) .operational-header .status-badge { color:var(--status-warning); background:var(--warning-soft); border-color:var(--status-warning); }
.preparation-shell .exercise-item { padding:.8rem 1rem; }
@media(max-width:600px) { .steps { grid-template-columns:1fr; } .hero h1 { font-size:3rem; } }

.cockpit-information .operational-metrics dt { line-height:1.4; }
.dashboard-page-heading { margin-top:1rem; }

/* Public primary actions only; operational and light-theme buttons stay solid. */
[data-theme-scope="public"] .button:not(.button-secondary):not(.button-danger):not(.nav-logout) { background:var(--brand-gradient); color:var(--on-brand); }
[data-theme-scope="public"] .button:not(.button-secondary):hover { filter:brightness(.96); }
.main-nav .public-login { color:var(--text-primary); background:none; border:0; padding:0; }
.main-nav .public-login:hover { color:var(--text-secondary); }
.homepage .step { border-color:var(--border-subtle); }
/* Keep the original layout slot and vertical centre; only the image is scaled. */
@media(max-width:360px) { .brand-logo img { transform:scale(1.15); } }
@media(max-width:600px) { .operational-brand .brand-logo img { transform:scale(1.15); } }

/* The supplied artwork remains intact; text and navigation are real HTML. */
.homepage { isolation:isolate; --homepage-header-height:70px; }
.homepage .site-header { background:transparent; border-bottom-color:transparent; transition:background-color 160ms ease; }
.homepage.homepage-scrolled .site-header { background:var(--bg-surface); }
.homepage .hero { position:relative; background:transparent; min-height:620px; }
.homepage .hero-content { position:relative; z-index:1; }
.homepage .hero h1 { max-width:8.4em; font-size:clamp(2.5rem,5vw,4.5rem); line-height:1.12; font-weight:400; letter-spacing:-.035em; text-wrap:wrap; }
.homepage .hero-signature { max-width:min(44vw,570px); font-size:clamp(1.1rem,1.7vw,1.5rem); font-weight:400; color:var(--text-secondary); }
.homepage .hero-actions { margin-top:36px; }
.homepage .hero-actions .button { gap:1rem; }
.homepage .hero-illustration { position:absolute; inset:calc(-1 * var(--homepage-header-height)) 0 0; z-index:-1; pointer-events:none; }
.homepage .hero-illustration img { display:block; width:100%; height:100%; object-fit:cover; object-position:center; }
/* A shallow veil only under navigation keeps its links legible on bright shapes. */
.homepage .hero-illustration::after { content:""; position:absolute; inset:0; background:linear-gradient(180deg,rgb(0 0 0 / 60%),transparent 22%); }
@media(max-width:900px) {
    .homepage .hero { min-height:580px; }
    .homepage .hero-content { padding-block:64px; }
    .homepage .hero h1 { max-width:520px; }
    .homepage .hero-signature { max-width:460px; }
    .homepage .hero-illustration img { object-position:left center; }
}
@media(max-width:600px) {
    .homepage .hero { min-height:560px; }
    .homepage .hero-content { padding:56px 24px; }
    .homepage .hero h1 { font-size:clamp(2.25rem,9vw,3.25rem); }
    .homepage .hero-illustration img { object-position:18% center; }
}
@media(prefers-reduced-motion:reduce) { .homepage .site-header { transition:none; } }

.ui-icon { flex-shrink:0; vertical-align:middle; }
.success-notification {
    position:fixed; z-index:50; top:max(.75rem,env(safe-area-inset-top)); right:max(.75rem,env(safe-area-inset-right));
    max-width:min(26rem,calc(100% - max(.75rem,env(safe-area-inset-left)) - max(.75rem,env(safe-area-inset-right))));
    pointer-events:none;
}
.success-toast {
    display:flex; align-items:center; gap:.65rem; box-sizing:border-box; min-height:52px; padding:.65rem 3.25rem .65rem .85rem;
    border:1px solid var(--status-success); border-radius:var(--radius-md); background:var(--success-soft); color:var(--status-success);
    box-shadow:var(--shadow-soft); font-weight:600; overflow-wrap:anywhere; pointer-events:auto;
}
.success-toast-close {
    position:absolute; right:4px; top:50%; transform:translateY(-50%); display:grid; place-items:center;
    width:44px; height:44px; padding:0; border:0; border-radius:var(--radius-sm); color:var(--status-success); background:transparent; cursor:pointer; pointer-events:auto;
}
.success-toast-close:is(:hover,:focus-visible) { background:var(--bg-surface); }
.success-notification [hidden] { display:none; }
@media (prefers-reduced-motion:no-preference) {
    .success-notification[data-state="visible"] { animation:success-toast-in 140ms ease-out; }
    @keyframes success-toast-in { from { opacity:0; transform:translateY(-4px); } }
}
@media (scripting:none) {
    .success-notification { animation:success-toast-timeout 5s step-end forwards; }
    .success-notification:is(:hover,:focus-within,:active) { animation-play-state:paused; }
    @keyframes success-toast-timeout { to { visibility:hidden; } }
}
.step-icon { display:flex; align-items:center; justify-content:center; width:44px; height:44px; margin-bottom:18px; border:1px solid var(--border-subtle); border-radius:10px; background:var(--bg-surface-muted); color:var(--accent-primary); }
.step-icon .ui-icon { width:25px; height:25px; }
.step-icon-play { color:var(--accent-secondary); }
.step-icon-eye { color:var(--accent-tertiary); }

/* Approved cockpit direction, shared by authenticated and participant spaces.
   Public pages keep their existing palette and components. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) {
    --bg-app:#ececef; --bg-surface:#fff; --bg-surface-elevated:#f5f5f7; --bg-surface-muted:#e5e5eb;
    --text-primary:#24252d; --text-secondary:#4b4e5a; --text-muted:#606371;
    --border-subtle:#d7d8e0; --border-strong:#8a8d99;
    --accent-primary:#aa370d; --accent-secondary:#a53851; --accent-soft:#fff0e7; --on-accent:#fff;
    --nav-bg:#fff; --nav-surface:#fff0e7; --nav-text:#353741; --nav-accent:#aa370d;
    --clock-bg:#262830; --clock-text:#fff; --focus:#aa370d;
    --shadow-soft:0 8px 22px rgb(30 32 44 / 9%),0 2px 4px rgb(30 32 44 / 5%);
    --ui-card-shadow:0 3px 9px rgb(30 32 44 / 9%);
    --ui-primary:linear-gradient(105deg,#ad3906,#bd2636,#a71853);
    --ui-danger:#b32e3e; --ui-warning:#925400;
    --radius-md:12px; --radius-sm:8px;
    background:var(--bg-app); color:var(--text-primary);
}
:is([data-theme-scope="animator"],[data-theme-scope="participant"])[data-theme="dark"] {
    --bg-app:#111318; --bg-surface:#21242c; --bg-surface-elevated:#2e323d; --bg-surface-muted:#373c48;
    --text-primary:#f6f7fa; --text-secondary:#ccd0d9; --text-muted:#b2b8c6;
    --border-subtle:#414753; --border-strong:#808a9d;
    --accent-primary:#ffac7c; --accent-secondary:#f9a8bf; --accent-soft:#3e2c2c; --on-accent:#17181c;
    --nav-bg:#1b1e25; --nav-surface:#3e2c2c; --nav-text:#e1e3ea; --nav-accent:#ffac7c;
    --focus:#ffac7c;
    --shadow-soft:0 10px 26px rgb(0 0 0 / 28%),0 2px 4px rgb(0 0 0 / 20%);
    --ui-card-shadow:0 5px 12px rgb(0 0 0 / 23%);
}
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-heading h1 { font-size:1.5rem; letter-spacing:-.025em; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) :is(.operational-card,.exercise-chat,.cockpit-information,.cockpit-feed) { border-radius:12px; box-shadow:var(--shadow-soft); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) :is(.operational-card,.exercise-chat)>h2 { font-size:1.05rem; display:flex; align-items:center; gap:.6rem; line-height:1.4; margin-top:0; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .heading-icon { display:inline-block; width:22px; height:22px; margin:0; padding:6px; box-sizing:content-box; background:var(--accent-soft); border-radius:9px; color:var(--accent-primary); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .nav-icon { display:inline-block; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-sidebar { border-right:1px solid var(--border-subtle); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .sidebar-link { min-height:44px; border-radius:8px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-sidebar .sidebar-icon { width:21px; height:21px; color:var(--text-secondary); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .sidebar-link[aria-current] { font-weight:700; background:var(--accent-soft); color:var(--accent-primary); box-shadow:none; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .sidebar-link[aria-current] .sidebar-icon { color:var(--accent-primary); }
/* Solid semantic actions: no conflicting outline, consistent label centring. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .button { display:inline-flex; align-items:center; justify-content:center; gap:.4rem; min-height:36px; box-sizing:border-box; line-height:1.3; padding:.5rem .75rem; border:1px solid transparent; font-weight:650; background:var(--ui-primary); color:#fff; border-radius:8px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .button-secondary { background:var(--bg-surface-muted); color:var(--text-primary); border-color:transparent; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body :is(.button-danger,.button-danger-small) { background:var(--ui-danger); border-color:transparent; color:#fff; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .button-warning { background:var(--ui-warning); border-color:transparent; color:#fff; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .button:hover:not(:disabled) { filter:brightness(1.12); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .button:active:not(:disabled) { filter:brightness(.94); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .button:disabled { opacity:.55; filter:none; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body :is(button,a,summary,input,textarea,select):focus-visible { outline:3px solid var(--focus); outline-offset:3px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .cockpit-information .operational-control .button { min-height:36px; line-height:1.3; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body [data-chat-form] .button { background:var(--ui-primary); color:#fff; min-width:92px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body :is(.status-badge,.exercise-status,.stimulus-level) { display:inline-flex; align-items:center; justify-content:center; min-height:26px; box-sizing:border-box; padding:.3rem .55rem; line-height:1.15; font-size:.75rem; font-weight:650; border:0; border-radius:6px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .status-badge-success { background:var(--success-soft); color:var(--status-success); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .status-badge-warning,
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body:has([data-cockpit][data-status="paused"]) .operational-header .status-badge { background:var(--warning-soft); color:var(--status-warning); }
/* The same name always receives the same one of four accessible brand tones. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .person-avatar { display:inline-flex; flex:0 0 36px; width:36px; height:36px; align-items:center; justify-content:center; border-radius:50%; background:#a53a18; color:#fff; font-size:12px; font-weight:750; line-height:1; letter-spacing:.02em; vertical-align:middle; box-shadow:inset 0 0 0 1px rgb(255 255 255 / 16%); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .person-avatar[data-avatar-tone="1"] { background:#ac2854; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .person-avatar[data-avatar-tone="2"] { background:#744385; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .person-avatar[data-avatar-tone="3"] { background:#38626b; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-card-name { align-items:center; gap:.5rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .presence-summary-item { display:flex; align-items:center; gap:.55rem; padding:.45rem .65rem; background:var(--bg-surface-elevated); border:1px solid var(--border-subtle); border-radius:9px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .presence-summary-item .person-avatar { width:32px; height:32px; flex-basis:32px; font-size:11px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) :is(.participant-card,.available-stimulus-card) { background:var(--bg-surface-elevated); border:1px solid var(--border-subtle); border-radius:10px; box-shadow:var(--ui-card-shadow); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-information { padding:.85rem; gap:.75rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-information .instrument-panel { padding:.85rem; border:0; border-radius:9px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-information .instrument-panel h2 { font-size:.68rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-information .scenario-clock strong { font-size:1.65rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-information .operational-metrics { gap:.4rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-information .operational-metrics>div { background:var(--bg-surface-elevated); border:0; border-radius:7px; padding:.45rem .6rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-information .operational-metrics dd { font-size:1.25rem; font-variant-numeric:tabular-nums; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .video-conference-lobby { box-shadow:var(--ui-card-shadow); border-color:var(--border-subtle); }
/* Chat: stronger bubbles, clear identity, wrapping without fixed content widths. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-messages { padding-block:.25rem; padding-inline-start:.1rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-message { width:auto; margin-bottom:.8rem; padding:.8rem; border:0; border-radius:10px; background:var(--bg-surface-elevated); box-shadow:var(--ui-card-shadow); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-message-animator { background:var(--accent-soft); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-message>.person-avatar { float:left; margin:0 .6rem .4rem 0; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-message::after { content:""; display:block; clear:both; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-message strong { font-size:.78rem; line-height:1.45; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-message time { font-size:.7rem; font-variant-numeric:tabular-nums; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-message p { clear:both; padding-top:.3rem; font-size:.83rem; line-height:1.6; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) [data-chat-form] textarea { background:var(--bg-surface-elevated); border:1px solid var(--border-strong); min-height:5.5rem; }
/* Distinct event log, with filled semantic counters and a continuous rail. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-timeline-list { list-style:none; padding-left:0; counter-reset:operation-event; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-timeline-list .operation-event { --event-tone:var(--status-info); --event-soft:var(--info-soft); position:relative; counter-increment:operation-event; padding:.8rem .5rem 1rem 3.2rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operation-event::before { content:counter(operation-event); position:absolute; left:0; top:.7rem; z-index:1; width:34px; height:34px; display:grid; place-items:center; border:0; border-radius:50%; background:var(--event-soft); color:var(--event-tone); font-size:14px; font-weight:750; box-shadow:0 0 0 3px var(--bg-surface); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operation-event:not(:last-child)::after { content:""; position:absolute; left:16px; top:2.5rem; bottom:-.7rem; border-left:2px solid var(--border-strong); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-timeline-list :is(.operation-event-opened,.operation-event-resumed) { --event-tone:var(--status-success); --event-soft:var(--success-soft); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-timeline-list :is(.operation-event-paused,.operation-event-resent) { --event-tone:var(--status-warning); --event-soft:var(--warning-soft); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-timeline-list .operation-event-closed { --event-tone:var(--text-secondary); --event-soft:var(--bg-surface-muted); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operation-event>time { display:block; font-size:.75rem; color:var(--text-muted); font-variant-numeric:tabular-nums; margin-bottom:.3rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operation-event>strong { display:block; font-size:.9rem; margin-bottom:.2rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operation-event-separator { display:none; }
/* Stimuli keep the existing initial-send/resend semantics and access actions. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dispatch-timeline { border-left:2px solid var(--border-strong); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dispatch-timeline .dispatch-event { background:var(--bg-surface-elevated); border:1px solid var(--border-subtle); border-left:3px solid var(--event-accent); border-radius:10px; box-shadow:var(--ui-card-shadow); padding:.85rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dispatch-event::before { width:12px; height:12px; border:3px solid var(--bg-surface); left:-1.65rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dispatch-event-meta { padding-bottom:.6rem; border-bottom:1px solid var(--border-subtle); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dispatch-event-meta .status-badge { background:var(--success-soft); color:var(--status-success); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dispatch-event-resend .status-badge { background:var(--warning-soft); color:var(--status-warning); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dispatch-event h3 { font-size:1rem; line-height:1.5; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) :is(.dispatch-planned,.dispatch-scenario) { border:0; padding:.3rem .4rem; line-height:1.4; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dispatch-event .operational-actions { gap:.4rem; padding-block:.4rem; }
@media(max-width:600px) {
    :is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-heading h1 { font-size:1.3rem; }
    :is([data-theme-scope="animator"],[data-theme-scope="participant"]) .heading-icon { width:19px; height:19px; padding:5px; }
    :is([data-theme-scope="animator"],[data-theme-scope="participant"]) .cockpit-information { padding:.7rem; }
}

:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .chat-author-role { font-weight:400; color:var(--text-secondary); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .button[hidden] { display:none; }

@media(max-width:800px) { :is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .sidebar-toggle { display:none; } }
@media(min-width:801px) {
    :is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-sidebar .sidebar-link { gap:.3rem; padding-inline:.25rem; }
    :is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-sidebar .sidebar-icon { width:18px; height:18px; }
}
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) body .sidebar-toggle { padding:.3rem .2rem; gap:.25rem; font-size:.75rem; font-weight:500; }
/* Shared preparation cards, participant reader and archive consultation. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) :is(.dashboard-card,.form-card,.preparation-shell,.participant-reader,.participant-feed,.survey-answer,.survey-question,.archive-dialog) { border-radius:var(--radius-md); box-shadow:var(--shadow-soft); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .dashboard-page.preparation-shell { box-shadow:none; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) :is(.exercise-item,.participant-event a,.stimulus-row,.media-item) { background:var(--bg-surface-elevated); border-color:var(--border-subtle); border-radius:10px; box-shadow:var(--ui-card-shadow); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) :is(.dashboard-card-header,.participant-feed,.participant-reader)>h2 { display:flex; align-items:center; gap:.6rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .nav-icon { width:18px; height:18px; margin-right:.4rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .exercise-navigation a { display:inline-flex; align-items:center; min-height:40px; border-radius:8px; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .row-content:has(>.person-avatar) { display:grid; grid-template-columns:36px minmax(0,1fr); column-gap:.7rem; align-items:center; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .row-content>.person-avatar { grid-column:1; grid-row:1/3; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .row-content:has(>.person-avatar)>:not(.person-avatar) { grid-column:2; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-timeline { border-left:2px solid var(--border-strong); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-event::before { width:12px; height:12px; background:var(--accent-primary); box-shadow:0 0 0 3px var(--bg-surface); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-event a { padding:.85rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-event a[aria-current="true"] { background:var(--accent-soft); border-color:var(--accent-primary); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-event strong { font-size:.95rem; line-height:1.5; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-event time { font-variant-numeric:tabular-nums; padding-block:.3rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-instrumentation .instrument-panel { box-shadow:var(--ui-card-shadow); }
/* Public cards retain the three existing icon accents. */
[data-theme-scope="public"] { --accent-tertiary:#f49aba; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-event:has(.stimulus-level-information)::before { background:var(--status-info); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-event:has(.stimulus-level-important)::before { background:var(--status-warning); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .participant-event:has(.stimulus-level-action_required)::before { background:var(--status-danger); }
/* Presence retains its operational meaning alongside the identity avatar. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .presence-summary-item.is-connected { background:var(--success-soft); color:var(--status-success); border-color:var(--status-success); }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .preparation-shell .exercise-item { padding:.65rem 1rem; }

/* Active session clock: 35% larger; narrow instrument columns stay contained. */
.operational-clock { container-type:inline-size; --flap-width:1.8225rem; --flap-height:3.105rem; --flap-font:1.755rem; --flap-gap:.162rem; }
.participant-instrumentation .operational-clock { --flap-width:1.89rem; --flap-height:3.24rem; --flap-font:1.8225rem; --flap-gap:.3375rem; }
.operational-clock .split-flap { justify-content:center; gap:var(--flap-gap); }
.operational-clock .flap-cell { width:var(--flap-width); height:var(--flap-height); }
.operational-clock .flap-face { font-size:min(var(--flap-font),18cqi); }
.operational-clock .flap-separator { font-size:min(1.89rem,17cqi); line-height:1; }
@container (max-width:240px) {
    .operational-clock .split-flap { gap:min(var(--flap-gap),.162rem); }
}

/* Page titles and homepage section headings; hero, cards and document headings are unchanged. */
.homepage .content-section > .content-inner > h2,
.homepage .preparation-statement > h2,
.operational-main > h1,
.operational-content > h1,
.survey-page > h1,
.login-card h1,
.dashboard-page-heading h1,
.dashboard-header h1,
.form-card > h1,
.preparation-shell > h1,
.cockpit-heading h1,
.participant-heading h1,
.administration-shell > h1,
.administration-shell > .operational-card > h1,
.account-shell h1 { font-weight: 600; }
.account-shell .operational-card { margin-block: 1.25rem; }
.account-shell .administration-form { max-width: 720px; }
.security-operation-picker { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; margin-block: 1.5rem; }
.security-operation-picker .form-group { flex: 1 1 230px; margin: 0; }
.security-operation-picker button { flex-shrink: 0; }
.account-shell input, .account-shell select { max-width: 100%; box-sizing: border-box; }
.account-shell .cockpit-heading { flex-wrap: wrap; }
.account-shell .administration-form form { display: grid; gap: 1rem; }
.account-shell .administration-codes { overflow-wrap: anywhere; line-height: 2; padding-left: 1.25rem; }
.account-shell .operational-card { overflow-wrap: anywhere; }

/* Exterior pages share one normal-flow footer, never over the form. */
.public-layout { min-height:100vh; min-height:100svh; display:flex; flex-direction:column; }
.public-layout > main,.public-layout > .operational-workspace { flex:1; }
.public-layout > .public-footer { margin-top:auto; flex-shrink:0; }
.public-layout .login-page { min-height:0; width:100%; box-sizing:border-box; }
.exercise-summary { color:var(--text-muted); font-size:.8rem; line-height:1.6; overflow-wrap:anywhere; margin:.3rem 0; }
/* Semantic presence belongs only to components receiving live presence data. */
.person-avatar[data-presence-avatar].person-avatar-connected { background:var(--status-success); }
.person-avatar[data-presence-avatar].person-avatar-offline { background:var(--border-strong); }
.dispatch-event .dispatch-scenario { color:var(--scenario); background:var(--scenario-soft); border-color:var(--scenario); }
.dispatch-event .dispatch-planned { color:var(--status-warning); background:var(--warning-soft); border-color:var(--status-warning); }
/* Active navigation keeps its background, colour and keyboard focus. */
[data-theme-scope]:not([data-theme-scope="public"]) .exercise-navigation a[aria-current="page"] { box-shadow:none; border-color:transparent; background:var(--accent-soft); color:var(--accent-primary); }

[data-event-stream].operational-timeline-list { max-height:480px; overflow-y:auto; overscroll-behavior-y:contain; overflow-anchor:none; }
.timeline-status { color:var(--text-muted); font-size:.75rem; }
@media(max-width:600px) { [data-event-stream].operational-timeline-list { max-height:min(480px,65vh); } }

/* Shared identity icon; presence colours are reserved for live presence components. */
.person-avatar .avatar-user-icon { width:20px; height:20px; flex:none; }
.person-avatar[data-presence-avatar].person-avatar-offline { color:#17202a; }
[data-theme="dark"] .person-avatar[data-presence-avatar].person-avatar-connected { color:#10271b; }
.participant-unified-header { box-sizing:border-box; gap:.65rem 1rem; }
.participant-header-identity { display:flex; align-items:center; gap:1rem; flex:1 1 22rem; min-width:0; }
.participant-header-identity>.brand-logo { flex:0 0 auto; }
.participant-header-identity>div { min-width:0; }
.participant-header-identity h1 { margin:0; font-size:1rem; font-weight:600; line-height:1.35; overflow-wrap:anywhere; }
.participant-header-identity p { margin:.2rem 0 0; font-size:.75rem; color:var(--text-secondary); overflow-wrap:anywhere; }
.participant-header-actions { display:flex; align-items:center; flex-wrap:wrap; gap:.5rem .8rem; }
.participant-unified-header>.theme-control { margin-left:0; flex-shrink:0; }
.participant-header-actions .participant-sync-tools { margin:0; }
.scenario-badge { display:inline-flex; width:fit-content; max-width:100%; box-sizing:border-box; align-items:center; padding:.25rem .45rem; border-radius:4px; font-size:.75rem; line-height:1.4; color:var(--scenario); background:var(--scenario-soft); overflow-wrap:anywhere; }
.participant-event .scenario-badge { margin-block:.25rem; }
.visualization-history { margin-top:.8rem; }
.visualization-history summary { cursor:pointer; font-weight:600; }
@media(max-width:600px) {
 .participant-header-identity { flex-basis:100%; gap:.7rem; }
 .participant-header-identity .brand-logo { max-width:100px; }
 .participant-header-actions { flex:1 1 12rem; gap:.4rem; }
 .participant-header-actions .participant-sync-tools { flex-wrap:wrap; }
}

/* Public legal documents: scoped reading width and semantic Markdown layout. */
.public-legal-main { width:min(100% - 2rem,1040px); box-sizing:border-box; margin:0 auto; padding:3rem 0; }
.legal-document { line-height:1.75; overflow-wrap:anywhere; color:var(--text-primary); }
.legal-document h1 { font-size:clamp(1.75rem,4vw,2.4rem); line-height:1.25; font-weight:600; margin:1rem 0 2rem; }
.legal-document h2 { font-size:1.3rem; line-height:1.4; font-weight:600; margin:2rem 0 .8rem; }
.legal-document h3 { font-size:1.08rem; line-height:1.4; font-weight:600; margin:1.4rem 0 .6rem; }
.legal-document p,.legal-document ul { margin:.8rem 0; }
.legal-document ul { padding-left:1.4rem; }
.legal-document table { width:100%; table-layout:fixed; border-collapse:collapse; margin:1.3rem 0; font-size:.9rem; }
.legal-document th,.legal-document td { border:1px solid var(--border-subtle); padding:.65rem; vertical-align:top; text-align:left; }
.legal-document th { background:var(--bg-surface-elevated); }
.legal-document a { color:var(--accent-primary); text-decoration:underline; }
.legal-version { color:var(--text-secondary); font-size:.8rem; }
.public-legal-main>.public-return { display:inline-block; margin-top:1.5rem; }
@media(max-width:600px) { .public-legal-main { padding:1.5rem 0; } .legal-document table { font-size:.8rem; } .legal-document th,.legal-document td { padding:.4rem; } }

/* Informational acknowledgement, always dark, independent of workspace theme. */
html { scroll-padding-bottom: var(--cookie-information-height, 0px); }
[data-cookie-information-space] { flex-shrink: 0; }
.cookie-information[hidden] { display: none; }
.cookie-information {
    position: fixed; inset: auto 0 0; z-index: 40;
    display: flex; align-items: center; justify-content: center; gap: 1.5rem;
    box-sizing: border-box; width: 100%; max-height: 40dvh; overflow-y: auto;
    padding: 1rem max(var(--scroll-content-gap), env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: #202329; color: #f2f3f5; border-top: 1px solid #494d55;
    color-scheme: dark;
}
.cookie-information-copy { min-width: 0; max-width: 960px; }
.cookie-information h2 { margin: 0 0 .3rem; color: #f2f3f5; font-size: 1rem; font-weight: 600; line-height: 1.4; }
.cookie-information p { margin: 0; color: #e0e2e6; font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.cookie-information a { color: #ffad94; text-decoration: underline; text-underline-offset: .15em; }
.cookie-information-button {
    flex-shrink: 0; min-height: 44px; padding: .65rem 1.2rem; border: 1px solid #d26279; border-radius: 6px;
    background: linear-gradient(110deg, #b9360a, #ab164b); color: #fff; font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
}
.cookie-information :is(a, button):focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (max-width: 600px) {
    .cookie-information { gap: .75rem; flex-wrap: wrap; justify-content: flex-start; padding-top: .75rem; }
    .cookie-information-button { margin-left: auto; }
}

/* Global dispatch numbers, with room for three digits and larger counts. */
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-feed .dispatch-timeline { margin-left: 1.25rem; padding-left: 1.8rem; }
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .operational-feed .dispatch-event::before { display: none; }
.operational-feed .dispatch-operation-number {
    position: absolute; left: -1.95rem; top: .9rem; transform: translateX(-50%);
    display: grid; place-items: center; min-width: 2rem; min-height: 2rem; padding: .15rem .3rem;
    box-sizing: border-box; border-radius: 999px; border: 2px solid var(--bg-surface);
    background: #ed9461; color: #25160d; font-size: .7rem; line-height: 1.2; font-weight: 600;
    font-variant-numeric: tabular-nums; white-space: nowrap; z-index: 1;
}

/* Shared account/security view only; other account and administrative screens keep their layout. */
.account-security-workspace { display: grid; grid-template-columns: minmax(260px,300px) minmax(0,750px); gap: 20px; width: 100%; max-width: 1070px; box-sizing: border-box; align-items: start; }
.account-security-workspace > .operational-card { padding: 1rem; min-width: 0; width: 100%; box-sizing: border-box; margin-block: 0; }
.account-security-workspace h2 { margin: 0 0 .6rem; }
.account-security-workspace p { margin: .5rem 0; overflow-wrap: anywhere; }
.account-security-workspace .administration-form { max-width: none; }
.account-security-workspace .administration-form > p { max-width: 70ch; }
/* Scoped, container-responsive grid: no effect on other application forms. */
.account-form-panel { container-type:inline-size; }
.administration-form .account-form-grid { display:grid; grid-template-columns:minmax(0,1fr); gap:1rem; max-width:none; width:100%; align-items:start; justify-items:stretch; }
.account-form-grid > * { min-width:0; }
.account-form-grid .account-form-wide { grid-column:1 / -1; }
.account-form-grid .form-group { margin:0; min-width:0; width:100%; }
.account-form-grid .form-group label { display:block; font-size:.8125rem; margin-bottom:0; line-height:1.4; }
.account-form-grid .form-group :is(input,select) { width:100%; max-width:none; min-width:0; min-height:42px; box-sizing:border-box; }
.account-form-grid h2 { font-size:1rem; margin:0; line-height:1.5; }
.account-form-panel .account-form-help { display:block; color:var(--text-secondary); font-size:.8125rem; line-height:1.5; margin:.35rem 0 0; overflow-wrap:anywhere; }
.account-form-grid > .account-form-help { margin:0; }
.account-form-notice { font-size:.8125rem; line-height:1.5; padding:.75rem; border:1px solid var(--border-subtle); border-radius:var(--radius-sm); background:var(--bg-surface); }
.account-form-actions { display:flex; flex-wrap:wrap; align-items:center; gap:.75rem 1rem; }
.account-form-actions .button { width:auto; max-width:100%; white-space:normal; }
.account-form-panel :is(input,select):focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
@container (min-width:460px) {
    .administration-form .account-form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .account-form-grid .form-group:not(.account-form-wide) label { min-height:2.8em; }
}

/* Server-rendered navigation between account views, independent of the POST form. */
.account-security-workspace .account-security-tabs { display: flex; flex-wrap: wrap; align-items: stretch; gap: .2rem .6rem; margin: .75rem 0 .9rem; padding-bottom: .25rem; border-bottom: 1px solid var(--border-subtle); }
.account-security-tabs a { display: inline-flex; align-items: center; padding: .45rem .15rem; border-bottom: 2px solid transparent; color: var(--text-secondary); font-size: .8rem; line-height: 1.4; text-decoration: none; }
.account-security-tabs a:hover { color: var(--text-primary); }
.account-security-tabs a[aria-current="page"] { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--accent-primary); }
.account-security-tabs a:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; border-radius: 2px; }

.account-deletion-link { color:var(--accent-primary); text-decoration:underline; text-underline-offset:.2em; }
.account-deletion-link:hover { text-decoration-thickness:2px; }
.account-deletion-link:focus-visible { outline:3px solid var(--focus); outline-offset:3px; }

.account-delete-divider{border-top:1px solid var(--border-color,#526078);margin-top:1.4rem;padding-top:1rem}

/* Content links share theme-aware contrast; buttons and navigation retain their components. */
:is(main,.operational-main) a[href]:not(.button):not(.brand):not(.sidebar-link):not(.exercise-back):not(.animator-back-link):not(nav a):not(.operational-dashboard-link):not([data-select-dispatch]),
a.commercial-secondary-link {
    color:var(--accent-primary); text-decoration:underline; text-underline-offset:.2em; text-decoration-thickness:1px;
}
:is(main,.operational-main) a[href]:not(.button):not(.brand):not(.animator-back-link):not(nav a):hover,
a.commercial-secondary-link:hover { text-decoration-thickness:2px; }
a:focus-visible { outline:3px solid var(--focus); outline-offset:4px; border-radius:2px; }
.no-exercises-page { width:calc(100% - 2rem); max-width:800px; margin:2rem auto; padding:clamp(1rem,3vw,2rem); box-sizing:border-box; background:var(--bg-surface); border-radius:var(--radius-md); }
.internal-authorization-badge { color:var(--status-success); background:var(--success-soft); border:1px solid var(--status-success); padding:.55rem .75rem; border-radius:var(--radius-sm); font-weight:600; }
.checkout-action { margin:1.5rem 0; }
.accepted-cards { color:var(--text-secondary); font-size:.875rem; margin:1rem 0; }
.accepted-cards>div { display:flex; gap:.75rem; margin-top:.5rem; }
.accepted-cards img { display:block; padding:0 .5rem; background:#fff; border:1px solid #d6e0ec; border-radius:4px; object-fit:contain; box-sizing:content-box; }
.lifecycle-summary { display:grid; grid-template-columns:minmax(10rem,1fr) minmax(0,2fr); gap:.75rem 1rem; }
.lifecycle-summary dt { font-weight:600; }
.lifecycle-summary dd { margin:0; overflow-wrap:anywhere; }
.lifecycle-technical { margin-top:1.5rem; }
.lifecycle-technical summary { cursor:pointer; color:var(--accent-primary); text-decoration:underline; }
@media(max-width:600px) { .lifecycle-summary { grid-template-columns:1fr; gap:.35rem; } .lifecycle-summary dd { margin-bottom:.75rem; } }

.animator-management-container { width:calc(100% - 32px); max-width:1120px; margin:1.25rem auto; box-sizing:border-box; }
.dashboard-page-heading.animator-management-container { padding-inline:0; margin-bottom:0; }
.dashboard-page.preparation-shell.animator-management-container,
.form-page.preparation-shell.animator-management-container { max-width:1120px; padding-inline:0; }
.account-shell.animator-management-container .account-security-workspace { max-width:none; grid-template-columns:minmax(0,2fr) minmax(0,3fr); }
.animator-management-container>.form-card { max-width:720px; margin-inline:0; padding-inline:0; }
.animator-return { margin:0 0 1rem; }
.exercise-back-container:has(+ .preparation-shell) { box-sizing:border-box; padding-inline:1.25rem; margin-top:1.25rem; margin-bottom:1rem; }
.animator-return+h1,.animator-return+.cockpit-heading h1 { margin-top:0; }
a.animator-back-link,
:is(.animator-management-container,.preparation-shell,.exercise-back-container,.no-exercises-page) a.animator-back-link { color:var(--status-warning); font-size:.9rem; font-weight:600; text-decoration:underline; text-underline-offset:.2em; padding:0; }
:is(.animator-management-container,.preparation-shell,.exercise-back-container,.no-exercises-page) a.animator-back-link:hover { color:var(--status-warning); text-decoration-thickness:2px; }
a.animator-back-link:focus-visible { outline:3px solid var(--focus); outline-offset:4px; }
@media(max-width:850px) { .account-security-workspace, .account-shell.animator-management-container .account-security-workspace { grid-template-columns:1fr; } }
@media(max-width:640px) { .animator-management-container { width:calc(100% - 24px); } }

/* Ordinary preparation pages only; operational cockpit layouts are excluded. */
:is(.dashboard-page,.form-page).preparation-shell.preparation-management-container { max-width:1120px; }
.exercise-back-container:has(+ .preparation-management-container) { max-width:1120px; }
.preparation-management-container .form-card { margin-inline:0; max-width:800px; }
.preparation-management-container > * { min-width:0; }
.account-shell .administration-form.account-deletion-panel { max-width:800px; }
.account-deletion-confirmation { display:flex; align-items:flex-start; gap:.65rem; font-size:.875rem; line-height:1.5; }
.account-deletion-confirmation input { flex:0 0 auto; margin-top:.25rem; }
.no-exercises-page.animator-management-container { display:block; max-width:1120px; padding:0; background:transparent; }
.no-exercises-page.animator-management-container > section { max-width:640px; margin:1.5rem auto; padding:clamp(1rem,3vw,2rem); background:var(--bg-surface); border:1px solid var(--border-subtle); border-radius:var(--radius-md); box-sizing:border-box; }

.account-shell.animator-management-container.account-simple-shell,
.no-exercises-page.animator-management-container { max-width:580px; }
.account-simple-shell .account-code-activation .login-form button { align-self:flex-start; width:auto; justify-self:start; }
.account-simple-shell .account-code-activation .administration-form { max-width:100%; }
[data-profile-fr][hidden], [data-profile-foreign][hidden] { display:none; }

/* Standalone error view: no account, navigation or session dependencies. */
body.not-found-page { margin:0; min-height:100vh; min-height:100dvh; display:grid; place-items:center; padding:24px 12px; box-sizing:border-box; }
.not-found-card { width:100%; max-width:520px; min-width:0; padding:clamp(24px,5vw,40px); box-sizing:border-box; text-align:center; background:var(--bg-surface); border:1px solid var(--border-subtle); border-radius:var(--radius-md); box-shadow:var(--shadow-soft); overflow-wrap:anywhere; }
.not-found-card .brand-logo { width:180px; max-width:100%; }
.not-found-card .brand-logo img { transform:none; }
.not-found-card h1 { font-size:clamp(1.35rem,4vw,1.75rem); margin:1.75rem 0 .75rem; }
.not-found-card p { color:var(--text-secondary); line-height:1.6; margin:0 0 1.5rem; }
.not-found-card .button { width:auto; max-width:100%; white-space:normal; }

[data-address-region][hidden] { display:none; }

.exercise-create-page, .exercise-back-container.exercise-create-width { max-width:800px; margin-inline:auto; }
.exercise-create-page { padding:0 20px 40px; }
.exercise-create-page.exercise-new { padding-block-start:clamp(24px,3vw,32px); }
.scenario-origin-help { display:grid; gap:.5rem; color:var(--text-secondary); font-size:.875rem; }
.scenario-origin-help p { margin:0; }
.exercise-create-page > .form-card { max-width:none; margin:0; padding:clamp(20px,4vw,32px); }
.exercise-create-page .exercise-form { gap:20px; }
.exercise-create-page .form-group { min-width:0; }
.exercise-create-page .form-actions { flex-wrap:wrap; }
.exercise-create-page .form-card h1 { font-size:clamp(26px,4vw,32px); }

/* Lot 4.8.7: scoped animator presentation, without changes to form behavior. */
.dashboard-page.animator-management-container .exercise-list { row-gap:14px; }
.stimulus-preparation-list { display:grid; gap:14px; }
.stimulus-preparation-card { min-width:0; padding:1rem; background:var(--bg-surface-elevated); border:1px solid var(--border-strong); border-radius:var(--radius-md); overflow-wrap:anywhere; }
.stimulus-preparation-card h2 { margin:0 0 .6rem; }
.stimulus-preparation-metadata { display:flex; flex-wrap:wrap; gap:.25rem 1rem; color:var(--text-secondary); }
.stimulus-preparation-metadata p { margin:0; }
.stimulus-preparation-chronology { margin-block:.6rem; }
.stimulus-preparation-card .row-actions { margin-top:.8rem; align-items:flex-start; }
.stimulus-preparation-card .row-actions > details[open] { flex-basis:100%; min-width:0; }
.stimulus-preparation-card .row-actions > details[open] form { padding:.8rem; margin-top:.5rem; border:1px solid var(--border-subtle); border-radius:var(--radius-sm); }
.stimulus-preparation-card .form-actions { flex-wrap:wrap; }
.stimuli-preparation-page .form-card { max-width:none; width:100%; padding:1rem; box-sizing:border-box; }
.stimulus-form { min-width:0; width:100%; max-width:none; box-sizing:border-box; }
.stimulus-form .console-fields { display:grid; }
.stimulus-form > * { min-width:0; max-width:100%; box-sizing:border-box; }
.stimulus-form :is(.planned-roles,.visibility-options) { min-width:0; padding:1rem; margin-inline:0; overflow-wrap:anywhere; }
.preparation-shell .stimulus-form :is(.planned-roles,.visibility-options) { padding:1rem; }
.stimulus-form :is(small,legend,label) { overflow-wrap:anywhere; }
.stimulus-form .form-actions { flex-wrap:wrap; }
.operational-writing.stimulus-form-panel { width:100%; max-width:1120px; margin-inline:auto; box-sizing:border-box; }
.account-page .account-form-grid .form-group { gap:.35rem; }
.account-page .account-form-grid .form-group :is(input[readonly],select:disabled) {
    background:var(--bg-surface-muted); color:var(--text-primary); opacity:1;
}
.account-page .account-form-grid .form-group label { min-height:0; margin:0; }

/* Lot 4.9.1: content-sized catalogue rows and compact preparation cards. */
.role-catalogue-page .role-catalogue-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:1rem; }
.role-catalogue-text { min-width:0; overflow-wrap:anywhere; }
.role-catalogue-text p { margin:.35rem 0 0; }
.role-catalogue-heading { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:1rem; }
.role-catalogue-heading h2 { margin:0; }
.stimulus-preparation-list { align-content:start; grid-auto-rows:max-content; }
.stimulus-preparation-content { min-width:0; }
.stimulus-preparation-content h2 { margin:0 0 .25rem; font-size:1rem; }
.stimulus-preparation-content p { margin:0; }
.stimulus-preparation-facts, .stimulus-preparation-chronology { display:flex; flex-wrap:wrap; gap:.2rem .8rem; }
.stimulus-preparation-chronology { margin:0; }
.stimulus-preparation-facts { font-size:.85rem; margin-bottom:.2rem; }
@media (max-width:760px) {
    .role-catalogue-page .role-catalogue-row { grid-template-columns:minmax(0,1fr); }
    .role-catalogue-row > form, .role-catalogue-row > button { justify-self:start; }
}

/* Lot 4.9.2: shared library and personal catalogue aligned at the top. */
.role-catalogue-panels { display:grid; grid-template-columns:minmax(0,3fr) minmax(0,2fr); align-items:start; gap:1rem; }
.role-catalogue-panels > .dashboard-card { min-width:0; margin:0; }
.role-catalogue-panels .role-catalogue-row { grid-template-columns:minmax(0,1fr) auto; }
.role-catalogue-panels .preparation-list { display:grid; gap:.5rem; }
.role-catalogue-panels .preparation-list > .role-catalogue-row {
    padding:.6rem .75rem; border:1px solid var(--border-subtle); border-radius:var(--radius-sm); background:var(--bg-surface);
}
.catalogue-status { display:inline-flex; align-items:center; gap:.35rem; }
.catalogue-status .ui-icon { flex:none; }
.icon-action-pair { display:inline-grid; grid-template-columns:repeat(2,44px); gap:.25rem; align-items:center; }
.icon-action-pair form, .role-catalogue-row > form { margin:0; }
@media (max-width:1000px) {
    .role-catalogue-panels { grid-template-columns:minmax(0,1fr); }
}
@media (max-width:760px) {
    .role-catalogue-panels .role-catalogue-row { grid-template-columns:minmax(0,1fr); }
}

/* Lot 4.9.3: compact descriptions, with full personal text available on demand. */
.role-catalogue-panels .role-catalogue-text p { font-size:.875rem; line-height:1.45; }
.role-description { margin-top:.35rem; font-size:.875rem; }
.role-description summary { cursor:pointer; }
.role-description[open] + .role-description-preview { display:none; }
.role-description p { white-space:pre-wrap; overflow-wrap:anywhere; }

/* Lot 4.9.4: only the animator dashboard and preparation catalogues. */
[data-theme-scope="animator"] .animator-workspace :is(.dashboard-card,.exercise-item,.stimulus-preparation-card) {
    border:1px solid var(--border-subtle); border-radius:var(--radius-md); box-shadow:var(--ui-card-shadow);
}
[data-theme-scope="animator"] .animator-workspace .button {
    min-height:36px; padding:.5rem .75rem; margin:0; font-size:.875rem; line-height:1.3; text-align:center; white-space:normal;
}
[data-theme-scope="animator"] .animator-workspace .button:disabled {
    opacity:1; background:var(--bg-surface-muted); color:var(--text-secondary); border-color:var(--border-subtle); cursor:not-allowed;
}
.animator-workspace .row-actions { gap:.5rem; }
.animator-workspace .role-usage-note { max-width:12rem; font-size:.8rem; color:var(--text-secondary); overflow-wrap:anywhere; }
.preparation-shell .role-template-form { display:flex; flex-direction:column; align-items:stretch; gap:1rem; }
.preparation-shell .role-template-form .form-group { width:100%; min-width:0; }
.preparation-shell .role-template-form :is(input,textarea) { width:100%; box-sizing:border-box; }
.preparation-shell .role-template-form textarea { min-height:7rem; resize:vertical; }
.preparation-shell .role-template-form .form-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.5rem; }
[data-theme-scope="animator"] .animator-workspace .exercise-status { cursor:default; box-shadow:none; border-radius:var(--radius-sm); }
[data-theme-scope="animator"] .animator-workspace .exercise-status-preparation { color:var(--status-info); background:var(--info-soft); }
[data-theme-scope="animator"] .animator-workspace :is(.exercise-status-waiting_room,.exercise-status-paused) { color:var(--status-warning); background:var(--warning-soft); }
[data-theme-scope="animator"] .animator-workspace .exercise-status-open { color:var(--status-success); background:var(--success-soft); }
[data-theme-scope="animator"] .animator-workspace .exercise-status-closed { color:var(--text-secondary); background:var(--bg-surface-muted); }

/* Lot 4.9.5: separate pagination and creation without changing card geometry. */
.stimuli-preparation-page .stimulus-pagination { margin-block:1.5rem; padding-block:.5rem; gap:.75rem; }

/* Exercise stimuli: the shared navigation shell keeps its ordinary width and padding. */
.dashboard-page.stimulus-page-heading { margin-bottom:0; padding-bottom:0; }
.stimulus-page-heading .exercise-navigation { margin-bottom:0; }
.dashboard-page.preparation-shell.stimuli-preparation-page {
    width:calc(100% - 2rem); max-width:1900px; margin-top:1rem; box-sizing:border-box;
}
.stimulus-introduction { display:grid; gap:1rem; margin-bottom:1rem; }
.stimulus-introduction :is(h1,p) { margin:0; }
.stimulus-construction {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:start;
    grid-template-areas:". create" "library exercise"; gap:1rem 1.25rem;
}
.stimulus-construction > * { min-width:0; }
.stimulus-construction.exercise-only { grid-template-columns:minmax(0,1fr); grid-template-areas:"create" "exercise"; }
.stimulus-create-action { grid-area:create; justify-self:end; margin:0; }
.stimulus-construction #exercise-stimuli { grid-area:exercise; margin:0; }
.stimulus-construction #exercise-stimuli > h2 { margin:0; }

.stimulus-construction .common-stimulus-library {
    grid-area:library; display:flex; flex-direction:column; gap:.65rem; box-sizing:border-box;
    margin:0; padding:1rem; background:var(--bg-surface);
}
.common-stimulus-library > :is(h2,p), .common-stimulus-library form, .common-stimulus-library :is(.catalogue-selection-help,[data-catalogue-status]) { margin:0; }
.common-stimulus-filters { display:grid; grid-template-columns:minmax(0,1.3fr) minmax(0,1fr); gap:.5rem .75rem; align-items:end; }
.common-stimulus-filters .form-group { margin:0; }
.common-stimulus-filters :is(input,select) { width:100%; box-sizing:border-box; }
.catalogue-filter-actions, .catalogue-selection-tools { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem .85rem; }
.catalogue-filter-actions { grid-column:1 / -1; }
.common-stimulus-library [data-catalogue-add] { display:flex; flex-direction:column; gap:.5rem; }
.catalogue-selection-tools { justify-content:space-between; }
.catalogue-selection-help { font-size:.85rem; color:var(--text-secondary); }
.common-stimulus-library [data-catalogue-status]:empty { display:none; }
.common-stimulus-library [data-catalogue-retry] { align-self:start; }
.common-stimulus-scroll {
    max-block-size:calc(100vh - 3rem); max-block-size:calc(100dvh - 3rem); box-sizing:border-box;
    overscroll-behavior-y:contain;
    padding-block:.35rem; padding-inline-start:.35rem;
}
.common-stimulus-scroll:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
.common-stimulus-items { display:grid; gap:12px; }
.common-stimulus-item {
    display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"name preview" "meta preview";
    gap:0 .5rem; padding:.5rem .5rem; border:1px solid var(--border-subtle); border-radius:var(--radius-sm);
    background:var(--bg-surface); overflow-wrap:anywhere;
}
.common-stimulus-item label { grid-area:name; display:flex; align-items:baseline; gap:.5rem; line-height:1.35; }
.common-stimulus-item input { margin:0; width:1rem; flex:none; }
.common-stimulus-preview-link {
    grid-area:preview; align-self:center; display:grid; place-items:center; width:44px; height:44px;
    margin-block:-.3rem; border-radius:var(--radius-sm);
}
.common-stimulus-preview-link .ui-icon { color:var(--text-secondary); }
.common-stimulus-preview-link:is(:hover,:focus-visible) { background:var(--bg-surface-muted); }
.common-stimulus-item p { grid-area:meta; margin:0 0 0 1.5rem; font-size:.85rem; line-height:1.35; color:var(--text-secondary); }
.common-stimulus-item[draggable="true"] { cursor:grab; }
.common-stimulus-html { padding:0 .25rem; border:1px solid var(--border-subtle); border-radius:4px; }
.common-stimulus-preview { display:block; width:100%; height:55vh; min-height:260px; box-sizing:border-box; border:1px solid var(--border-subtle); }
[data-catalogue-drop] { padding:.75rem; border:2px dashed var(--border-subtle); border-radius:var(--radius-md); }
[data-catalogue-drop].catalogue-drag-over { border-color:var(--accent-primary); background:var(--bg-surface-muted); }
.common-stimulus-drop-hint, .stimulus-incomplete { color:var(--text-secondary); }
.stimulus-timeline-entry { min-width:0; position:relative; }
.stimulus-timeline-entry.is-scheduled { padding-left:5rem; }
.stimulus-timeline-entry.is-scheduled::before { content:""; position:absolute; left:2rem; top:0; bottom:-1rem; width:2px; background:var(--border-strong); }
.stimulus-timeline-entry.is-scheduled:has(+ :not(.is-scheduled))::before, .stimulus-timeline-entry.is-scheduled:last-child::before { bottom:50%; }
.stimulus-timeline-entry.is-scheduled::after { content:""; position:absolute; left:2rem; top:50%; width:3rem; height:2px; background:var(--border-strong); }
.stimulus-timeline-node { position:absolute; z-index:1; left:0; top:50%; transform:translateY(-50%); width:4rem; min-height:2.5rem; padding:.35rem .15rem; box-sizing:border-box; display:grid; place-items:center; border:2px solid var(--border-strong); border-radius:.7rem; background:var(--bg-surface-elevated); color:var(--text-primary); font-size:.8rem; font-weight:700; overflow-wrap:anywhere; }
.stimulus-incomplete-heading { margin:.8rem 0 0; padding-top:1rem; border-top:1px solid var(--border-subtle); }
@media(max-width:600px) { .dashboard-page.preparation-shell.stimuli-preparation-page { width:calc(100% - 1rem); } .stimulus-timeline-entry.is-scheduled { padding-left:4rem; } .stimulus-timeline-node { width:3.5rem; font-size:.7rem; } .stimulus-timeline-entry.is-scheduled::after { width:2rem; } }
[data-stimulus-delete][open] > summary { display:none; }
/* Exercise cards use an intrinsic action row in DOM and keyboard order. */
.stimuli-preparation-page .stimulus-preparation-card {
    display:flex; flex-direction:column; align-items:stretch; gap:.5rem; padding:.65rem .85rem;
}
.stimulus-preparation-actions { display:flex; flex-wrap:wrap; align-items:flex-start; gap:.35rem; }
.stimulus-preparation-actions > details[open] { flex-basis:100%; }
.stimulus-preparation-actions > details[open] form { padding:.6rem; border:1px solid var(--border-subtle); }
.stimuli-preparation-page .stimulus-preparation-actions .button {
    display:inline-flex; align-items:center; justify-content:center; box-sizing:border-box;
    width:auto; min-height:32px; padding:.3rem .55rem; font-size:.8125rem; line-height:1.3; white-space:nowrap;
}
.stimulus-preparation-actions [data-stimulus-delete][open] > summary { display:none; }
@media (max-width:1100px) {
    .stimulus-construction { grid-template-columns:minmax(0,1fr); grid-template-areas:"library" "create" "exercise"; }
}
@media (max-width:1100px), (max-height:600px) {
    .common-stimulus-scroll { max-block-size:65vh; max-block-size:65dvh; overscroll-behavior-y:auto; }
}
@media (max-width:560px) {
    .common-stimulus-filters { grid-template-columns:minmax(0,1fr); }
    .stimulus-construction .common-stimulus-library { padding:.75rem; }
}

.stimulus-workspace-dialog { width:min(1200px,96vw); max-width:96vw; max-height:94dvh; overflow-y:auto; box-sizing:border-box; padding:1.2rem; background:var(--bg-surface); color:var(--text-primary); border:1px solid var(--border-strong); border-radius:var(--radius-md); }
.stimulus-workspace-dialog:is([data-mode="edit"],[data-mode="create"]) { width:min(1400px,98vw); }
.stimulus-workspace-dialog[data-mode="duplicate"], .stimulus-workspace-dialog[data-mode="delete"] { width:min(560px,94vw); }
.stimulus-workspace-dialog::backdrop { background:rgba(0,0,0,.65); }
.stimulus-workspace-dialog > header { display:flex; justify-content:space-between; align-items:center; gap:1rem; }
.stimulus-workspace-dialog [data-workspace-error] { color:var(--status-danger); white-space:pre-line; }
.stimulus-workspace-dialog [data-workspace-content] { min-width:0; overflow-wrap:anywhere; }
.stimulus-workspace-dialog .rich-content { max-width:100%; overflow:auto; }
.stimulus-workspace-dialog [hidden] { display:none!important; }
.stimulus-workspace-highlight { outline:3px solid var(--accent-primary); outline-offset:3px; }
@media(prefers-reduced-motion:reduce) { .stimuli-preparation-page { scroll-behavior:auto; } }
body:has(.stimulus-workspace-dialog[open]) { overflow:hidden; }

/* Ordinary animator pages follow the content edges of the site header. */
[data-theme-scope="animator"] {
    --site-width:1200px;
    --site-inset:32px;
    --field-gap:.4375rem;
    --group-gap:1rem;
    --section-gap:1.5rem;
}
@media (max-width:799px) {
    [data-theme-scope="animator"] { --site-inset:1rem; }
}
[data-theme-scope="animator"] .site-header .header-inner,
[data-theme-scope="animator"] :is(.dashboard-page-heading,.dashboard-page,.form-page,.account-shell):is(.animator-management-container,.preparation-management-container):not(.account-simple-shell,.stimuli-preparation-page,.no-exercises-page),
[data-theme-scope="animator"] .exercise-back-container:has(+ .preparation-management-container) {
    box-sizing:border-box;
    width:100%;
    max-width:var(--site-width);
    padding-inline:var(--site-inset);
    margin-inline:auto;
}
[data-theme-scope="animator"] .form-page.preparation-management-container {
    background:transparent; border:0; box-shadow:none;
}
[data-theme-scope="animator"] .preparation-people .console-disclosure,
[data-theme-scope="animator"] .dashboard-card :is(.opening-report,.invitation-preflight .preparation-notice) {
    background:transparent; border:0; border-radius:0; box-shadow:none; padding-inline:0;
}
[data-theme-scope="animator"] :is(.preparation-shell,.stimulus-workspace-dialog) .stimulus-form :is(.planned-roles,.visibility-options) {
    background:transparent; border:0; box-shadow:none;
}
[data-theme-scope="animator"] :is(.preparation-shell,.account-shell,.preparation-dialog,.stimulus-workspace-dialog) .form-group {
    gap:var(--field-gap); min-width:0;
}
[data-theme-scope="animator"] :is(.preparation-shell,.preparation-dialog,.stimulus-workspace-dialog,.account-shell) :is(.exercise-form,.console-fields,.participant-fields) {
    row-gap:var(--group-gap);
}
[data-theme-scope="animator"] :is(.preparation-shell,.preparation-dialog,.stimulus-workspace-dialog,.account-shell) .form-group :is(select,input:not([type=checkbox],[type=radio],[type=file],[type=hidden])) {
    box-sizing:border-box; min-height:2.625rem; padding:.5rem .65rem;
}
.account-form-grid h2.account-section-divider {
    margin-top:.5rem; padding-top:.75rem; border-top:1px solid var(--border-subtle);
}
.icon-action,.dialog-close {
    box-sizing:border-box; display:inline-flex; align-items:center; justify-content:center;
    min-height:44px; border:0; border-radius:var(--radius-sm); color:var(--text-secondary);
    background:transparent; cursor:pointer; font:inherit;
}
.icon-action,.dialog-close { width:44px; height:44px; flex:0 0 44px; padding:0; }
:is(.icon-action,.dialog-close):hover { color:var(--text-primary); background:var(--bg-surface-elevated); }
:is(.icon-action,.dialog-close):focus-visible { outline:3px solid var(--focus); outline-offset:2px; }
.preparation-dialog {
    box-sizing:border-box; width:min(42rem,94vw); max-height:90dvh; overflow:auto;
    border:1px solid var(--border-subtle); border-radius:var(--radius-md); padding:1.25rem;
    color:var(--text-primary); background:var(--bg-surface); box-shadow:var(--shadow-soft);
}
.preparation-dialog:has(.media-details) { width:min(60rem,94vw); }
.preparation-dialog::backdrop { background:rgb(0 0 0 / .65); }
.dialog-heading { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1rem; }
.dialog-heading h2 { margin:0; overflow-wrap:anywhere; }
.dialog-error { margin-bottom:1rem; white-space:pre-line; }
.preparation-dialog .role-template-form textarea { min-height:7rem; }
.preparation-dialog .form-actions { justify-content:flex-end; }
.role-catalogue-row .role-usage-note { font-size:.8rem; color:var(--text-secondary); }
.preparation-shell .media-list { display:grid; gap:12px; }
.preparation-shell .media-list > .media-card {
    padding:1rem; border:1px solid var(--border-subtle); border-radius:var(--radius-md); background:var(--bg-surface);
}
.media-details .media-preview { max-height:48dvh; }
.media-details > :is(h2,details) { margin-block-start:var(--section-gap,1.5rem); }
.stimulus-form .scenario-fields.stimulus-times {
    display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,13rem),1fr)); align-items:start; gap:1rem;
}

[data-role-chooser][hidden] { display:none; }
:is(.preparation-shell,.stimulus-workspace-dialog) .stimulus-form > :is(section,fieldset,.rich-editor) {
    margin-block:0;
    margin-block-start:calc(var(--section-gap,1.5rem) - var(--group-gap,1rem));
}

/* Operational identities can wrap even in a narrow instrument or recipient list. */
.operational-person { display:grid; min-width:0; gap:.12rem; overflow-wrap:anywhere; line-height:1.35; }
.operational-person > strong { color:var(--text-primary); }
.operational-person > span { color:var(--text-secondary); font-size:.85rem; }
.operational-layout .person-avatar[data-presence-avatar].person-avatar-connected { background:var(--status-success); }
.operational-layout .person-avatar[data-presence-avatar].person-avatar-offline { background:var(--border-strong); }
.cockpit-send-dialog .local-send-form { margin:0; padding:0; border:0; }
.cockpit-send-dialog [data-send-state]:empty, .cockpit-send-dialog [data-local-send-error]:empty { display:none; }
.operational-layout .recipient-selection label { align-items:center; min-width:0; }
.cockpit-send-dialog .recipient-selection {
    display:grid; grid-template-columns:repeat(auto-fit,minmax(min(15rem,100%),1fr)); gap:.5rem;
    max-height:min(40dvh,22rem); overflow-y:auto;
}
.operational-layout .stimulus-card-actions summary.icon-action { list-style:none; }
.operational-layout .stimulus-card-actions summary.icon-action::-webkit-details-marker { display:none; }
.operational-layout .participant-event a > strong { color:var(--accent-primary); text-decoration:underline; text-underline-offset:.2em; }
.operational-layout .participant-event a:hover > strong { text-decoration-thickness:2px; }
[data-cockpit] [data-dispatch-feed-scroll] {
    box-sizing:border-box; min-width:0; max-height:clamp(14rem,calc(100dvh - 12rem),68rem);
    overflow-y:auto; overflow-wrap:anywhere; overscroll-behavior-y:contain;
}
:is([data-cockpit],[data-participant-space]) .exercise-chat:not([hidden]) {
    display:flex; flex-direction:column; box-sizing:border-box; min-width:0;
    height:clamp(22rem,calc(100dvh - 9rem),72rem);
}
:is([data-cockpit],[data-participant-space]) .exercise-chat .chat-messages {
    box-sizing:border-box; flex:1 1 auto; min-height:0; height:auto;
    overflow-wrap:anywhere;
}
:is([data-cockpit],[data-participant-space]) .exercise-chat > form { flex:none; }

/* Only the element that scrolls owns the gutter. Horizontal table and media wrappers
   keep their full width. The feed and library inset their cards inside the scrollport. */
:root { --scroll-content-gap:12px; }
.scroll-region { box-sizing:border-box; min-inline-size:0; overflow-y:auto; }
.scroll-region, .rich-editor .ql-editor, .editor-rich-preview, textarea,
dialog, .cookie-information { scrollbar-gutter:stable; }
.scroll-region, dialog:is(.preparation-dialog,.stimulus-dialog,.stimulus-workspace-dialog),
.rich-editor :is(dialog,.ql-editor,textarea), .editor-rich-preview,
textarea, .form-group textarea, .preparation-shell .form-group textarea, [data-chat-form] textarea {
    padding-inline-end:var(--scroll-content-gap);
}
.scroll-region:has(> .scroll-content) { padding-inline-end:0; }
.scroll-region > .scroll-content { min-inline-size:0; margin-inline-end:var(--scroll-content-gap); }

.participant-video-column { display:grid; min-width:0; align-content:start; gap:.75rem; }
.participant-video-column > .participant-visio { grid-area:auto; min-width:0; }
.presence-scroll { --presence-row:3.4rem; --presence-gap:.4rem; max-block-size:calc(var(--presence-row) + var(--presence-row) + var(--presence-gap)); }
.presence-summary-list {
    display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,9.75rem),1fr));
    grid-auto-rows:1fr; gap:var(--presence-gap);
}
:is([data-theme-scope="animator"],[data-theme-scope="participant"]) .presence-summary-item {
    min-block-size:var(--presence-row); gap:.4rem; padding:.3rem .45rem;
}
.presence-summary-item .operational-person { font-size:.8rem; line-height:1.28; }
.presence-summary-item .operational-person > span { font-size:.75rem; }
.presence-summary-empty { grid-column:1/-1; }
.presence-scroll:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }

.participant-feed [data-participant-received] {
    max-height:clamp(16rem,calc(100dvh - 2rem),80rem);
    overscroll-behavior-y:contain; overflow-wrap:anywhere;
}
@media (max-width:599px), (max-height:550px) {
    .participant-feed [data-participant-received] { max-height:76dvh; }
}
.participant-feed .participant-event { margin-block-end:.55rem; }
[data-theme-scope="participant"] .participant-feed .participant-event a { padding:.65rem; }
[data-theme-scope="participant"] .participant-feed .participant-event time { padding-block:0; margin-block-start:.2rem; }
.participant-feed .participant-dispatch-recipients { margin-block:.3rem; }

.available-stimulus-card { display:flex; flex-direction:column; gap:.3rem; overflow-wrap:anywhere; }
.available-stimulus-card h3 { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.operational-list .available-stimulus-card > p { margin:0; }
.available-stimulus-card .stimulus-planning { display:grid; justify-items:start; gap:.15rem; }
.available-stimulus-card .stimulus-planning .stimulus-planned-time { margin:0; }
.operational-list .available-stimulus-card .stimulus-readiness {
    margin-block-start:auto; padding-block-start:.3rem; color:var(--text-secondary);
    font-size:.8rem; font-weight:600;
}
.available-stimulus-card .stimulus-readiness[data-ready] { color:var(--status-success); }
.stimulus-card-actions { display:flex; flex-wrap:wrap; align-items:flex-start; gap:.25rem; }
.stimulus-card-actions .icon-action {
    background:var(--bg-surface-muted); color:var(--text-primary);
    border:1px solid var(--border-subtle); border-radius:var(--radius-sm);
}
.stimulus-card-actions .stimulus-delete-confirmation .icon-action { color:var(--status-danger); }
.stimulus-card-actions .icon-action:hover { background:var(--bg-surface); border-color:var(--border-strong); }
.stimulus-card-actions .icon-action:active { background:var(--accent-soft); border-color:var(--accent-primary); }
.stimulus-card-actions details[open] { flex-basis:100%; min-width:0; }
.stimulus-card-actions .stimulus-send-action {
    box-sizing:border-box; min-height:44px; margin-inline-start:auto; padding-inline:.65rem;
    display:inline-flex; align-items:center; justify-content:center;
}
.stimulus-card-actions .stimulus-send-action:disabled {
    color:var(--text-secondary); background:var(--bg-surface-muted); border-color:var(--border-subtle); cursor:not-allowed;
}
