/* Workspace surfaces; the clinical question text keeps its existing typography. */
:root { --workspace-accent: #384b9b; --workspace-muted: #626b81; --workspace-border: #dfe3ed; }
[hidden] { display: none !important; }
:where(button, a, input, select, summary, textarea):focus-visible { outline: 3px solid #7185dc; outline-offset: 3px; }
.workspace-shell { --workspace-width: 72px; --ff-paper: #f5f6fa; --ff-font-serif: 'IBM Plex Sans', sans-serif; --ff-radius-control: 6px; --ff-nav-text: #5c6386; padding-left: var(--workspace-width); min-height: 100vh; }
html:has(> body.workspace-shell) { background: #f5f6fa; }
.workspace-shell.workspace-expanded { --workspace-width: 220px; }
.workspace-shell .ff-header { padding: 0 32px; background: #f5f6fa; color: #1a2140; border-bottom: 1px solid #e8ebf3; }
.workspace-shell .ff-wordmark { color: #1c2a6b; font-size: 20px; font-weight: 600; letter-spacing: -.4px; }
.workspace-shell .ff-wordmark-suffix { display: none; }
.workspace-shell .ff-avatar { background: #e9edf6; color: #23366f; }
.workspace-shell .ff-btn-ghost { color: #526077; border: 1px solid #d6deea; padding: 7px 12px; }
.workspace-shell .ff-btn-ghost:hover { background: #f0f3f8; color: #23366f; }
.workspace-shell .ff-nav > .ff-nav-link { display: none; }
.workspace-shell :is(.ff-main, .prev-content, .stats-content, .report-content) { padding-top: 32px; max-width: 1280px; min-width: 0; }
.workspace-shell .ff-page-title { font-size: 30px; font-weight: 600; letter-spacing: -.6px; }
.workspace-shell .ff-page-sub { max-width: 720px; line-height: 1.55; }
.workspace-nav { width: var(--workspace-width); position: fixed; inset: 0 auto 0 0; z-index: 110; background: #1c2a6b; color: #9aa5d8; display: flex; flex-direction: column; padding: 0 0 16px; }
.workspace-brand { height: 64px; flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; color: #fff; border-bottom: 1px dashed #ffffff26; font-weight: 600; }
.workspace-brand img { border-radius: 50%; border: 2px solid #ffffff26; }
.workspace-label { display: none; }
.workspace-expanded .workspace-label { display: inline; }
.workspace-links { display: grid; padding-top: 12px; }
.workspace-links a, .workspace-collapse { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 10px 16px; color: #9aa5d8; font: 500 13px/1.4 'IBM Plex Sans', sans-serif; white-space: nowrap; }
.workspace-links a:hover, .workspace-collapse:hover { background: #ffffff14; color: #fff; }
.workspace-links a[aria-current] { background: #ffffff1f; color: #fff; }
.workspace-icon { flex: none; width: 20px; height: 20px; }
.workspace-collapse-icon { display: flex; }
@media (min-width: 761px) { body:not(.workspace-expanded) :is(.workspace-links a, .workspace-collapse) { justify-content: center; padding-left: 0; padding-right: 0; } }
.workspace-collapse { margin-top: auto; border: 0; border-top: 1px solid #ffffff14; background: none; text-align: left; cursor: pointer; }
.workspace-menu, .workspace-backdrop { display: none; }
.builder-heading h1 { margin: 4px 0 20px; font: 650 30px/1.2 'IBM Plex Sans', sans-serif; letter-spacing: -.6px; }
.builder-heading > p:last-child { color: var(--text-muted); margin: 0 0 20px; }
.builder-switch, .studio-workflow { display: inline-flex; align-self: flex-start; padding: 4px; gap: 4px; background: var(--hover, #e9edf7); border: 1px solid var(--border, #dfe3ed); border-radius: 10px; margin: 0 0 16px; }
.builder-switch button, .studio-workflow button { border: 0; background: transparent; color: var(--body-text, #1a2140); padding: 11px 20px; border-radius: 7px; font: 600 14px 'IBM Plex Sans', sans-serif; cursor: pointer; }
.builder-switch button[aria-pressed=true], .studio-workflow button[aria-pressed=true] { color: #fff; background: var(--workspace-accent); box-shadow: 0 1px 3px #0002; }
.filter-summary { display: flex; gap: 16px; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
.clear-filters { background: none; border: 0; color: var(--body-text); text-decoration: underline; white-space: nowrap; cursor: pointer; font: inherit; }
.advanced-selection { border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin: 4px 0 20px; }
.advanced-selection summary { cursor: pointer; font-weight: 500; }
.advanced-selection[open] summary { margin-bottom: 16px; }
.section-heading-button { border: 0; background: none; font: inherit; color: inherit; padding: 4px 0; cursor: pointer; }
.selector-container .selector-section { border-radius: 10px; }
.selector-container .selector-bottom { flex-wrap: wrap; gap: 14px; border-top: 1px solid var(--border); padding-top: 16px; padding-bottom: 20px; }
.selector-actions { flex-wrap: wrap; }
#examBlockLabel { flex-wrap: wrap; max-width: 440px; }
#examModeHint { font-size: 12px; line-height: 1.5; }
.exam-builder :is(#subjectsSection, #systemsSection, #questionStatusSection, #keywordSelection, .clear-filters) { display: none; }
.qbank-builder #examSourcesSection { display: none; }
.id-builder :is(#subjectsSection, #systemsSection, #questionStatusSection, #keywordSelection, #examSourcesSection, .clear-filters) { display: none; }
.question-status-section h2 { font-size: 14px; font-weight: 600; margin: 0; }
.selection-summary { font-size: 12px; color: var(--textBlackSecondary); font-weight: 400; }
.selector-section:has(> .section-body.collapsed) .expand-all { display: none; }
.question-status-section .mode-bar { border: 0; padding: 12px 0 20px; margin: 0; }
.exam-source-group { border: 0; min-width: 0; padding: 8px 0 12px; }
.exam-source-group + .exam-source-group { border-top: 1px solid var(--table-border); padding-top: 16px; }
.exam-source-group legend { padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--textBlackSecondary); }
.exam-source-group input[type="radio"] { accent-color: var(--btn-blue-bg-color); }
.selector-container > #examBlockLabel { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; font-size: 14px; }
.builder-empty { padding: 8px; font-size: 14px; }
.system-expand { font: inherit; color: inherit; background: transparent; border: 1px solid var(--border); min-width: 28px; min-height: 28px; border-radius: 4px; cursor: pointer; }
.system-parent > label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; }
button.sidebar-item { width: 100%; border: 0; color: inherit; font: inherit; text-align: left; }
.lab-header .lab-close, .lab-header .lab-si-toggle { color: inherit; }
.lab-search { margin: 10px 16px; padding: 9px 12px; border: 1px solid var(--border); background: var(--content-bg-color); color: var(--body-text); border-radius: 6px; font: inherit; min-width: 0; }
.history-toolbar { display: flex; align-items: end; gap: 16px; margin: 24px 0 0; flex-wrap: wrap; }
.history-toolbar label { display: grid; gap: 6px; font-size: 12px; color: var(--workspace-muted); }
.history-toolbar label:first-child { flex: 1; min-width: 180px; }
.history-toolbar :is(input, select) { padding: 10px 12px; min-height: 42px; font: inherit; border: 1px solid var(--workspace-border); border-radius: 7px; background: #fff; color: #1a2140; }
.history-count { color: var(--workspace-muted); font-size: 13px; margin: 12px 0; }
.workspace-shell .tests-table-wrap { margin-top: 12px; overflow-x: auto; }
.tests-table { min-width: 700px; }
.tests-table th { letter-spacing: .5px; }
.history-details { max-width: 350px; line-height: 1.6; }
.history-details summary { cursor: pointer; color: var(--workspace-accent); }
.history-details .qids-cell { overflow-wrap: anywhere; white-space: normal; margin: 8px 0; }
.history-details .tag-wrap { max-height: 160px; overflow-y: auto; }
.history-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 16px; }
.history-pagination button { padding: 8px 12px; border: 1px solid var(--workspace-border); background: #fff; border-radius: 6px; font: inherit; cursor: pointer; }
.history-pagination button:disabled { opacity: .4; cursor: default; }
.review-link { display: inline-block; padding: 7px 12px; background: #edf0fb; border-radius: 6px; color: var(--workspace-accent); font-weight: 600; }
.stats-scope-note { color: var(--workspace-muted); font-size: 13px; margin: 20px 0 -12px; }
.workspace-shell .nb-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.studio-workflow { margin-top: 22px; }
.workspace-shell .studio-grid { margin-top: 8px; }
.workspace-shell #missesCard { margin-top: 0 !important; }
@media (min-width: 641px) {
    .left-nav { width: 72px; min-width: 72px; }
    .left-nav.nav-pinned-open { width: 220px; min-width: 220px; }
}
@media (max-width: 760px) {
    .workspace-shell, .workspace-shell.workspace-expanded { --workspace-width: 0px; padding-left: 0; }
    .workspace-nav, .workspace-expanded .workspace-nav { width: 240px; transform: translateX(-100%); visibility: hidden; }
    .workspace-menu-open .workspace-nav { transform: none; visibility: visible; }
    .workspace-nav .workspace-label { display: inline; }
    .workspace-collapse { display: none; }
    .workspace-menu { display: inline-flex; border: 1px solid #d6deea; border-radius: 6px; background: #fff; color: #23366f; padding: 8px 10px; font: inherit; }
    .workspace-menu-open .workspace-backdrop { display: block; position: fixed; inset: 0; border: 0; background: #10162b66; z-index: 105; }
    .workspace-menu-open .workspace-menu { position: fixed; left: 248px; top: 12px; z-index: 111; background: #fff; }
    .workspace-shell .ff-header { padding: 0 16px; gap: 12px; }
    .workspace-shell .ff-wordmark { font-size: 18px; }
    .workspace-shell .ff-wordmark-suffix { display: none; }
    .workspace-shell .ff-nav { gap: 8px; }
    .workspace-shell :is(.ff-main, .prev-content, .stats-content, .report-content) { padding-left: 16px; padding-right: 16px; padding-top: 24px; }
    .builder-heading h1 { font-size: 26px; }
    .selector-container { padding: 20px 16px 0; }
    .selector-bottom { position: static; }
    .selector-actions, #startBlockBtn { width: 100%; }
    #examBlockLabel, #examBlockSelector { width: 100%; max-width: 100%; min-width: 0 !important; }
}
@media (prefers-reduced-motion: reduce) { .workspace-shell *, .selector-container * { animation: none !important; scroll-behavior: auto !important; } }

.test-mode-toggles { align-items: start; gap: 24px; }
.test-mode-toggles .toggle-switch-label { align-items: start; flex: 1; }
.builder-settings {
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--content-bg-color);
}
.builder-settings .toggle-switch { flex: 0 0 44px; }
.builder-settings input:focus-visible + .toggle-slider {
    outline: 2px solid var(--btn-blue-bg-color);
    outline-offset: 3px;
}
.toggle-description { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.toggle-description .test-mode-hint { display: block; white-space: normal; margin: 0; line-height: 1.5; font-size: 12px; }
.resume-banner {
    margin-bottom: 20px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--content-bg-color);
    font-size: 14px;
}
.resume-header, .resume-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.resume-header h2 { margin: 0; font-size: 14px; }
.resume-row { padding: 8px 0; border-top: 1px solid var(--border); }
.resume-actions { display: flex; gap: 8px; }
.resume-banner button, .resume-banner .btn-resume {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--body-text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.resume-banner button:hover { background: var(--hover); }
.resume-banner .btn-resume { background: var(--btn-blue-bg-color); color: #fff; }
.resume-banner .btn-resume:hover { filter: brightness(1.15); }
.resume-banner .resume-delete, .resume-banner .resume-check { border-color: var(--table-border, var(--workspace-border)); }
.attempt-save-status {
    position: fixed;
    bottom: 76px;
    right: 16px;
    z-index: 1500;
    width: max-content;
    max-width: min(430px, calc(100% - 32px));
    padding: 12px 14px;
    border: 1px solid var(--table-border, var(--workspace-border));
    border-radius: 8px;
    background: var(--bg-card, var(--content-bg-color, #fff));
    color: var(--body-text);
    font: 14px/1.45 'IBM Plex Sans', sans-serif;
    box-shadow: 0 2px 8px #0002;
}
.attempt-save-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attempt-save-actions button, .attempt-recovery button {
    padding: 6px 10px;
    border: 1px solid var(--table-border, var(--workspace-border));
    border-radius: 6px;
    background: var(--hover, transparent);
    color: var(--body-text);
    font: inherit;
    cursor: pointer;
}
.attempt-save-actions .attempt-save-check { background: var(--btn-blue-bg-color); color: #fff; }
.attempt-recovery { margin-bottom: 16px; font-size: 13px; color: var(--textBlackSecondary); }
.attempt-recovery summary { cursor: pointer; }
.attempt-recovery p { margin: 8px 0; }
.expand-all { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.lab-empty { padding: 0 16px; line-height: 1.5; }
@media (max-width: 640px) { .test-mode-toggles { flex-direction: column; gap: 20px; } }

.id-builder > .search-bar { display: none; }
