:root {
    --page: #eef1ef;
    --surface: #ffffff;
    --surface-soft: #f6f8f7;
    --text: #17201d;
    --muted: #5d6864;
    --line: #d5dcd8;
    --line-strong: #b7c1bc;
    --accent: #1f695e;
    --accent-dark: #164d46;
    --bone: #d9d4c8;
    --path: #82938d;
    --selected: #b74a41;
    --warning-bg: #fff8e7;
    --warning-border: #d5a13b;
    --danger-bg: #fff1ef;
    --danger: #8b2f28;
    --mahogany: #6f3a36;
    --mahogany-soft: #faf5f3;
    --mahogany-line: rgba(111, 58, 54, 0.24);
    --mahogany-dot: rgba(111, 58, 54, 0.12);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--page);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--page);
}

button,
select,
input,
textarea { font: inherit; }

button,
select { border-radius: 3px; }

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible,
[role="application"]:focus-visible {
    outline: 3px solid rgba(31, 105, 94, 0.23);
    outline-offset: 2px;
}

a { color: var(--accent-dark); }

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
    margin-bottom: 8px;
    font-size: clamp(27px, 2.7vw, 38px);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

h2 {
    margin-bottom: 4px;
    font-size: 17px;
    line-height: 1.25;
}

h3 {
    margin: 22px 0 8px;
    font-size: 12px;
    letter-spacing: 0.065em;
    text-transform: uppercase;
}

.app-shell {
    width: min(1540px, calc(100% - 32px));
    margin: 0 auto;
    padding: 20px 0 18px;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 12px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 930px;
}

.app-logo {
    flex: none;
    width: 90px;
    height: 90px;
    object-fit: contain;
}

.app-brand-copy { min-width: 0; }

.eyebrow {
    margin-bottom: 7px;
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 780;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.intro {
    max-width: 760px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.5;
}

.full-body-link {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 750;
    text-underline-offset: 3px;
}

.server-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-top: 4px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    box-shadow: 0 1px 2px rgba(31, 45, 40, 0.08);
}

.server-status > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca5a1;
}

.server-status.online .status-dot { background: #27805f; }
.server-status.offline .status-dot { background: #b4483f; }
.server-status.online { border-color: #bdd7ce; background: #eaf4f0; }
.server-status.offline { border-color: #dfc1bd; background: #faefed; }

.use-boundary {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    align-items: center;
    gap: 8px 14px;
    padding: 9px 12px;
    border: 1px solid var(--warning-border);
    background: var(--warning-bg);
    color: #594315;
    font-size: 12px;
    line-height: 1.4;
}
.use-boundary strong { color: #49360e; }
.use-boundary a { font-weight: 700; white-space: nowrap; }

@media (max-width: 860px) {
    .use-boundary { grid-template-columns: 1fr; gap: 3px; }
    .use-boundary a { white-space: normal; }
}

.panel {
    border: 1px solid var(--line);
    background: var(--surface);
}

.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mode-button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 48px;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.mode-button strong { font-size: 13px; }
.mode-button span { margin-top: 3px; color: var(--muted); font-size: 11px; }

.mode-button.active {
    border-color: var(--accent);
    background: #edf7f4;
    box-shadow: inset 3px 0 0 var(--accent);
}

.workspace {
    margin-top: 10px;
}

.app-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 340px));
    justify-content: center;
    gap: 12px;
    width: 100%;
    margin: 18px auto 2px;
}

.app-tabs button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 82px;
    align-items: center;
    gap: 12px;
    min-height: 92px;
    padding: 8px 10px 8px 18px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    background: var(--surface);
    box-shadow: 0 2px 7px rgba(24, 39, 36, 0.08);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.app-tabs button:hover { transform: translateY(-1px); border-color: var(--accent); }
.app-tabs .app-tab-copy { display: block; min-width: 0; }
.app-tabs .app-tab-copy > span { display: block; font-size: 19px; font-weight: 780; }
.app-tabs .app-tab-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 560; }
.app-tabs .app-tab-visual {
    justify-self: end;
    width: 78px;
    height: 78px;
}
.app-tab-thumbnail { object-fit: contain; }
.diagnosis-tab-icon {
    fill: none;
    stroke: var(--path);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.82;
}

.app-tabs button.active {
    border-color: var(--accent);
    background: #e8f3f0;
    box-shadow: inset 4px 0 0 var(--accent), 0 3px 9px rgba(24, 76, 67, 0.12);
    color: var(--accent-dark);
}

#tab-diagnosis.active {
    border-color: #744638;
    background: #f5ece8;
    box-shadow: inset 4px 0 0 #744638, 0 3px 9px rgba(83, 42, 31, 0.12);
    color: #542d24;
}

.panel-header,
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.panel-header {
    min-height: 62px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
}

.scene-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 5px;
}

body.diagnosis-active #mirror-view {
    display: none;
}

.scene-action-button {
    position: relative;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(74, 99, 91, 0.3);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
    color: var(--accent-dark);
    cursor: pointer;
}

.scene-action-button:hover,
.scene-action-button:focus-visible,
.scene-action-button.active,
.viewer-download-menu[open] > .scene-action-button {
    border-color: var(--accent);
    background: rgba(231, 244, 240, 0.28);
}

.scene-action-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.scene-action-button[data-tooltip]::after {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    z-index: 25;
    padding: 4px 7px;
    border-radius: 3px;
    background: rgba(23, 32, 29, 0.92);
    color: #fff;
    content: attr(data-tooltip);
    font-size: 9px;
    font-weight: 650;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity 100ms ease, transform 100ms ease;
    white-space: nowrap;
}

.scene-action-button[data-tooltip]:hover::after,
.scene-action-button[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateY(0);
}

.viewer-download-menu {
    position: relative;
}

.viewer-download-menu > summary {
    list-style: none;
}

.viewer-download-menu > summary::-webkit-details-marker {
    display: none;
}

.viewer-download-menu[open] > summary::after { display: none; }

.viewer-download-options {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    width: 224px;
    padding: 5px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(31, 48, 43, 0.16);
}

.viewer-download-options button {
    display: grid;
    width: 100%;
    gap: 1px;
    padding: 7px 8px;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}

.viewer-download-options button:hover,
.viewer-download-options button:focus-visible {
    background: var(--surface-soft);
    outline: none;
}

.viewer-download-options button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.viewer-download-options strong {
    font-size: 11px;
    font-weight: 700;
}

.viewer-download-options span,
.viewer-download-status {
    color: var(--muted);
    font-size: 9px;
}

.viewer-download-options .viewer-download-section {
    display: block;
    margin: 4px 5px 2px;
    padding: 6px 3px 2px;
    border-top: 1px solid var(--line);
    color: var(--accent-dark);
    font-size: 8px;
    font-weight: 760;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.viewer-download-status {
    min-height: 13px;
    margin: 2px 8px 0;
}

.pose-viewer-controls {
    display: grid;
    gap: 0;
    margin-bottom: 7px;
    padding: 2px 6px;
    border: 1px solid #d7dfdc;
    border-radius: 5px;
    background: #f5f8f7;
}

.toolbar-group {
    display: grid;
    gap: 4px;
}

.pose-viewer-controls .toolbar-group {
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 2px 0;
    border-bottom: 1px solid #dfe5e2;
}

.pose-viewer-controls .toolbar-group:last-child { border-bottom: 0; }

.pose-viewer-controls .source-controls,
.pose-viewer-controls .layer-toggle-list,
.pose-viewer-controls .mode-switch.compact,
.pose-viewer-controls .path-view-switch {
    width: 100%;
}

.pose-viewer-controls .layer-toggle-list .layer-toggle,
.pose-viewer-controls .mode-switch.compact .mode-button,
.pose-viewer-controls .path-view-switch button {
    position: relative;
    flex: 1;
    min-width: 0;
    min-height: 24px;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 8px;
    line-height: 1.15;
    transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.pose-viewer-controls button:hover:not(:disabled) { background: #edf3f1; color: var(--accent-dark); }

.pose-viewer-controls .mode-switch.compact button.active::before,
.pose-viewer-controls .path-view-switch button.active::before {
    content: "✓";
    margin-right: 5px;
    font-size: 9px;
    font-weight: 850;
}

.pose-viewer-controls button:focus-visible {
    outline: 2px solid rgba(35, 112, 96, 0.35);
    outline-offset: 1px;
}

.pose-viewer-controls button:disabled { cursor: not-allowed; opacity: 0.45; }

.toolbar-label {
    color: #53645e;
    font-size: 7px;
    font-weight: 780;
    letter-spacing: 0.045em;
    line-height: 1.2;
    text-transform: uppercase;
}

.source-controls {
    display: flex;
    align-items: stretch;
    gap: 4px;
}

.layer-toggle-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
}

.layer-toggle-list .layer-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    border: 1px solid #c8d2ce;
    background: #fff;
    color: #46554f;
    font-weight: 680;
    text-align: left;
}

.layer-toggle-list .layer-toggle::before {
    content: "";
    display: grid;
    flex: 0 0 11px;
    width: 11px;
    height: 11px;
    border: 1px solid #899b94;
    border-radius: 2px;
    background: #fff;
    color: #fff;
    font-size: 9px;
    font-weight: 850;
    line-height: 1;
    place-items: center;
}

.layer-toggle-list .layer-toggle.active {
    border-color: #7fa99e;
    background: #eef7f4;
    color: #154f45;
    box-shadow: none;
}

.layer-toggle-list .layer-toggle.active::before {
    content: "\2713";
    border-color: #287060;
    background: #287060;
}

.mode-switch.compact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    padding: 3px;
    border: 1px solid #cbd5d1;
    border-radius: 5px;
    background: #e9eeec;
}

.mode-switch.compact .mode-button {
    min-height: 28px;
    padding: 4px 9px;
    border: 0;
    background: transparent;
    font-size: 11px;
    font-weight: 680;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.mode-switch.compact .mode-button.active {
    background: #dceee9;
    color: #154f45;
    box-shadow: inset 0 0 0 1px #7fa99e, 0 1px 2px rgba(31, 65, 57, 0.08);
}

.panel-header p,
.section-header p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.path-view-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
    padding: 2px;
    border: 1px solid #cbd5d1;
    border-radius: 5px;
    background: #e9eeec;
}

.path-view-switch button {
    min-height: 22px;
    padding: 2px 5px;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 8px;
    font-weight: 680;
}

.path-view-switch button.active {
    background: #dceee9;
    color: #154f45;
    box-shadow: inset 0 0 0 1px #7fa99e, 0 1px 2px rgba(31, 65, 57, 0.08);
}

.quiet-button,
.text-button {
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    cursor: pointer;
    font-size: 12px;
    font-weight: 680;
}

.quiet-button {
    min-height: 31px;
    padding: 6px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    background: #f8faf9;
    box-shadow: 0 1px 1px rgba(25, 40, 35, 0.04);
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.quiet-button:hover:not(:disabled) {
    border-color: #8ba39a;
    background: #eef5f2;
    box-shadow: 0 1px 3px rgba(25, 40, 35, 0.1);
}

.quiet-button:focus-visible { outline: 3px solid rgba(35, 112, 96, 0.18); outline-offset: 2px; }
.quiet-button:disabled { cursor: not-allowed; color: #9aa39f; background: #f0f2f1; box-shadow: none; }

.quiet-button.active {
    border-color: var(--accent);
    background: #e7f4f0;
}

.scene-wrap {
    position: relative;
    min-height: 680px;
    overflow: hidden;
    background: #e8ece9;
    touch-action: none;
}

.viewer-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 276px;
}

.viewer-drawer {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 6;
    width: min(300px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    overflow: hidden;
    border: 1px solid rgba(157, 169, 163, 0.28);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.viewer-drawer.muscle-panel {
    width: min(320px, calc(100% - 24px));
    overflow-y: auto;
}

.activation-panel.collapsed {
    width: min(300px, calc(100% - 24px));
}

.activation-panel.collapsed .drawer-content { display: none; }
.muscle-panel.collapsed .drawer-content { display: none; }

.pose-dock {
    position: relative;
    max-height: 680px;
    padding: 8px 9px;
    overflow: hidden;
    border-left: 1px solid var(--line);
    background: #fbfcfb;
}

.region-picker {
    display: grid;
    grid-template-columns: 67px minmax(0, 1fr);
    align-items: center;
    gap: 4px 6px;
    margin: 0 0 7px;
    padding: 0 0 8px;
    border-bottom: 1px solid var(--line);
}

.region-picker label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 680;
}

.region-picker select {
    width: 100%;
    min-height: 34px;
    padding: 5px 28px 5px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 10px;
    font-weight: 700;
}

.region-picker p {
    grid-column: 2;
    margin: 0;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.35;
}

.region-picker .region-support-note {
    color: var(--muted-strong);
    font-weight: 650;
}

.presentation-control-row {
    display: grid;
    grid-template-columns: 67px minmax(0, 1fr);
    grid-column: 1 / -1;
    align-items: center;
    gap: 6px;
}

.presentation-control-row > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 680;
}

.segmented-control {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    overflow: hidden;
}

.segmented-control button {
    min-height: 30px;
    padding: 4px 8px;
    border: 0;
    border-left: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted-strong);
    font: inherit;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.segmented-control button:first-child { border-left: 0; }
.segmented-control button:hover { background: #f0f7f5; color: var(--accent-dark); }
.segmented-control button.active { background: #e2f1ed; color: var(--accent-dark); box-shadow: inset 0 -2px 0 var(--accent); }

.region-presentation-controls {
    display: grid;
    gap: 5px;
    margin: -1px 0 7px;
    padding: 7px 0 8px;
    border-bottom: 1px solid var(--line);
}

.presentation-control-row select {
    width: 100%;
    min-height: 32px;
    padding: 4px 26px 4px 7px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 10px;
    font-weight: 680;
}

.preset-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.pose-dock-header {
    position: relative;
    z-index: 14;
    display: grid;
    grid-template-columns: auto minmax(54px, 1fr) auto;
    align-items: center;
    gap: 5px;
    min-height: 25px;
    margin-bottom: 5px;
    background: #fbfcfb;
}
.pose-dock-header h2 { margin: 0; font-size: 16px; }
.pose-dock-header .text-button { padding: 2px 0; font-size: 10px; }
.pose-dock-header .text-button.active { color: var(--accent-dark); text-decoration: underline; }

.library-button {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 18px auto auto;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 31px;
    padding: 5px 10px;
    border: 1px solid #8eb6ab;
    border-radius: 3px;
    background: #edf7f4;
    color: var(--accent-dark);
    cursor: pointer;
    font-size: 11px;
    font-weight: 720;
}

.library-button:hover,
.library-button.active {
    border-color: var(--accent);
    background: #dfeeea;
}

.library-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
}

.library-button small {
    min-width: 20px;
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(34, 111, 94, 0.12);
    font-size: 8px;
    font-weight: 720;
}

.position-status {
    display: flex;
    align-items: baseline;
    gap: 3px;
    min-width: 0;
    margin: 0;
    padding: 2px 4px;
    overflow: hidden;
    border: 0;
    border-left: 2px solid;
    font-size: 7px;
    line-height: 1.1;
    white-space: nowrap;
}

.position-status strong { flex: none; font-size: 8px; white-space: nowrap; }
.position-status span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.position-status.effort { border-color: #9fb2e2; background: #f2f6ff; color: #33456f; }
.position-status.static { border-color: #8cbcaf; background: #edf8f5; color: #28574b; }
.position-status.manual { border-color: #c4cbc8; background: #f1f3f2; color: #4e5a56; }
.position-status.unavailable { border-color: var(--warning-border); background: var(--warning-bg); color: #604b22; }

.preset-section {
    margin-bottom: 7px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
}

.preset-catalog {
    position: absolute;
    inset: 145px 7px 7px;
    z-index: 12;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    background: #fbfcfb;
    box-shadow: 0 8px 24px rgba(25, 36, 32, 0.12);
    scrollbar-color: rgba(86, 98, 93, 0.45) transparent;
    scrollbar-width: thin;
}

.preset-catalog::-webkit-scrollbar { width: 7px; }
.preset-catalog::-webkit-scrollbar-track { background: transparent; }
.preset-catalog::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(86, 98, 93, 0.45); }

.preset-heading { align-items: baseline; margin-bottom: 4px; }
.preset-heading h3 { margin: 0; font-size: 10px; }
.preset-heading span { color: var(--muted); font-size: 8px; text-align: right; }

.catalog-note {
    margin: 0 0 7px;
    color: var(--muted);
    font-size: 8px;
    line-height: 1.25;
}

.preset-groups {
    display: grid;
    gap: 9px;
}

.preset-group h4 {
    margin: 0 0 3px;
    color: var(--muted-strong);
    font-size: 8px;
    font-weight: 720;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pose-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}

.pose-presets button {
    display: grid;
    grid-template-columns: 37px minmax(0, 1fr);
    align-items: center;
    gap: 3px;
    min-height: 42px;
    padding: 2px 4px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 9px;
    line-height: 1.12;
    text-align: left;
}

.preset-thumbnail {
    display: block;
    width: 36px;
    height: 36px;
    background: transparent;
    opacity: 0;
    transition: opacity 120ms ease;
}

.preset-thumbnail.ready { opacity: 1; }

.pose-presets button:hover { border-color: var(--accent); background: #f0f7f5; }
.pose-presets button.active { border-color: var(--accent); background: #e7f4f0; box-shadow: inset 3px 0 0 var(--accent); }

.coordinate-controls.compact .coordinate-control + .coordinate-control {
    margin-top: 3px;
    padding-top: 3px;
}

.coordinate-controls.compact .coordinate-label { margin-bottom: 0; font-size: 9px; line-height: 1.15; }
.coordinate-controls.compact .coordinate-label output { min-width: 50px; font-size: 9px; }
.coordinate-controls.compact input[type="range"] { display: block; height: 15px; cursor: pointer; }
.coordinate-controls.compact .coordinate-limits { margin-top: -1px; font-size: 7px; line-height: 1; }

.coordinate-group {
    margin-top: 5px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.38);
}

.coordinate-group:first-child { margin-top: 0; }

.coordinate-group > summary {
    min-height: 30px;
    padding: 7px 9px;
    color: var(--accent-dark);
    cursor: pointer;
    font-size: 10px;
    font-weight: 760;
}

.coordinate-group-body { padding: 3px 9px 8px; border-top: 1px solid var(--line); }
.coordinate-group-body .coordinate-control + .coordinate-control { margin-top: 4px; padding-top: 4px; }

.static-actions {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.static-actions .quiet-button { width: 100%; min-height: 27px; padding: 4px 7px; font-size: 10px; }
.static-actions .quiet-button:disabled { cursor: wait; opacity: 0.68; }
.solver-details summary { color: var(--muted); cursor: pointer; font-size: 9px; font-weight: 700; }
.solver-details[open] summary { margin-bottom: 6px; }

.pose-dock input[type="range"] {
    --range-progress: 50%;
    appearance: none;
    -webkit-appearance: none;
    height: 13px;
    background: transparent;
}

.pose-dock input[type="range"]::-webkit-slider-runnable-track {
    height: 2px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(
        to right,
        var(--accent) 0 var(--range-progress),
        #cfd5d2 var(--range-progress) 100%
    );
}

.pose-dock input[type="range"]::-webkit-slider-thumb {
    width: 8px;
    height: 8px;
    margin-top: -3px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    -webkit-appearance: none;
}

.pose-dock input[type="range"]::-moz-range-track {
    height: 2px;
    border: 0;
    border-radius: 999px;
    background: #cfd5d2;
}

.pose-dock input[type="range"]::-moz-range-progress {
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
}

.pose-dock input[type="range"]::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
}

#scene { position: absolute; inset: 0; }

#scene canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#scene canvas:active { cursor: grabbing; }

.scene-legend {
    position: absolute;
    border: 1px solid rgba(177, 187, 182, 0.88);
    background: rgba(255, 255, 255, 0.05);
    color: #48534f;
    box-shadow: 0 2px 10px rgba(34, 44, 40, 0.06);
}

.scene-legend {
    left: 12px;
    bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 15px;
    max-width: calc(100% - 24px);
    padding: 8px 10px;
    font-size: 10px;
}

.scene-legend span { display: inline-flex; align-items: center; gap: 6px; }
.scene-legend i { display: inline-block; width: 18px; height: 4px; }
.bone-key { background: var(--bone); }
.path-key { background: var(--path); }
.selected-key { background: var(--selected); }

.capacity-view-loading {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 150px;
    padding: 9px 12px;
    border: 1px solid rgba(111, 126, 119, 0.42);
    background: rgba(250, 252, 251, 0.92);
    box-shadow: 0 5px 18px rgba(29, 42, 38, 0.13);
    color: var(--text);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.capacity-view-loading span { width: 14px; height: 14px; flex: 0 0 auto; border: 2px solid #c8d4d0; border-top-color: var(--accent); border-radius: 50%; animation: loading-spin 0.75s linear infinite; }
.capacity-view-loading strong { font-size: 10px; font-weight: 720; }
body:not(.diagnosis-active) .capacity-view-loading { display: none !important; }
@keyframes loading-spin { to { transform: rotate(360deg); } }

.capacity-angle-overlay {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 5;
    width: 174px;
    padding: 6px 7px;
    border: 1px solid rgba(157, 169, 163, 0.3);
    background: rgba(255, 255, 255, 0.08);
    color: #48534f;
}

.capacity-angle-overlay > strong {
    display: block;
    margin-bottom: 4px;
    font-size: 8px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.capacity-angle-overlay dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 9px;
    margin: 0;
}

.capacity-angle-overlay dl > div {
    display: flex;
    justify-content: space-between;
    gap: 5px;
    min-width: 0;
    font-size: 8px;
    line-height: 1.35;
}

.capacity-angle-overlay dt { color: var(--muted); white-space: nowrap; }
.capacity-angle-overlay dd { margin: 0; font-weight: 720; font-variant-numeric: tabular-nums; white-space: nowrap; }
body:not(.diagnosis-active) .capacity-angle-overlay { display: none !important; }

.activation-legend {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(177, 187, 182, 0.45);
    color: #48534f;
}

.legend-heading,
.activation-labels {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.legend-title {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.legend-heading strong { font-size: 10px; }
.legend-heading span,
.activation-legend small { color: var(--muted); font-size: 8px; }

.activation-ramp {
    height: 6px;
    margin: 4px 0 2px;
    border: 1px solid rgba(44, 53, 68, 0.25);
    background: linear-gradient(90deg, hsl(240 78% 49%) 0%, hsl(180 78% 49%) 1.56%, hsl(120 78% 49%) 7.29%, hsl(60 78% 49%) 17.94%, hsl(0 78% 49%) 34%, hsl(0 78% 41.4%) 50%, hsl(0 78% 31.9%) 75%, hsl(0 78% 24%) 100%);
}

.activation-labels { color: var(--muted); font-size: 8px; }
.activation-legend small { display: block; margin-top: 3px; line-height: 1.2; }

.activation-list-toggle {
    display: block;
    margin: 2px 0 0 auto;
    padding: 1px 0;
    font-size: 9px;
}

.loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(239, 242, 240, 0.94);
    color: var(--text);
    font-size: 14px;
    z-index: 20;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--line-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

select {
    width: 100%;
    min-height: 36px;
    padding: 6px 9px;
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--text);
}

.primary-button {
    min-height: 36px;
    padding: 7px 13px;
    border: 1px solid var(--accent-dark);
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 680;
}

.muscle-panel,
.activation-panel { padding: 8px; }

.section-header {
    margin-bottom: 13px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--line);
}

.drawer-header {
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
    padding-bottom: 6px;
}

.drawer-header h2 {
    margin: 0;
    font-size: 14px;
}

.drawer-title {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.drawer-source {
    color: var(--muted);
    font-size: 8px;
    font-weight: 680;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.drawer-header .text-button {
    padding: 2px 3px;
    font-size: 10px;
}

.muscle-drawer-header {
    display: grid;
    grid-template-columns: auto minmax(120px, 1fr) auto;
}

.muscle-heading {
    min-width: 0;
}

.muscle-heading h2 {
    overflow: hidden;
    max-width: 145px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.muscle-heading small {
    display: block;
    overflow: hidden;
    max-width: 145px;
    margin-top: 1px;
    color: var(--muted);
    font-size: 7px;
    font-weight: 620;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.muscle-drawer-header select {
    min-width: 0;
    min-height: 28px;
    padding: 3px 6px;
    background: rgba(255, 255, 255, 0.05);
}

.muscle-back-button {
    grid-column: 1 / -1;
    justify-self: start;
    padding: 1px 0;
    font-size: 9px;
}

.activation-panel { border-top: 3px solid #315ed3; }
.activation-panel .drawer-source { color: #315293; }
.activation-panel.static-source { border-top-color: var(--accent); }
.activation-panel.static-source .drawer-source { color: var(--accent-dark); }

.effort-empty {
    display: grid;
    gap: 5px;
    padding: 8px;
    border: 1px solid var(--line-strong);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.effort-empty strong { color: var(--text); font-size: 12px; }

.coordinate-control + .coordinate-control {
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid #e6eae8;
}

.coordinate-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    font-size: 12px;
}

.coordinate-label output {
    min-width: 68px;
    color: var(--accent-dark);
    font-variant-numeric: tabular-nums;
    font-weight: 720;
    text-align: right;
}

input[type="range"] { width: 100%; margin: 0; accent-color: var(--accent); }
input[type="range"]:disabled { cursor: default; opacity: 0.5; }

.range-limits,
.coordinate-limits {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.key-readings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin: 8px 0 0;
}

.key-readings > div {
    padding: 6px;
    border: 1px solid var(--line);
    background: rgba(246, 248, 247, 0.05);
}

.key-readings > .activation-reading {
    grid-column: 1 / -1;
    border-color: #bcc9e7;
    background: rgba(244, 247, 255, 0.05);
}

.key-readings dt {
    min-height: 20px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.35;
}

.key-readings dd {
    margin: 4px 0 0;
    font-variant-numeric: tabular-nums;
}

.key-readings strong { font-size: 17px; }
.key-readings span { color: var(--muted); font-size: 9px; }

.muscle-panel h3 { margin: 12px 0 5px; font-size: 10px; }

.moment-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 4px 0;
    border-top: 1px solid #e6eae8;
    font-size: 10px;
}

.moment-row span:first-child {
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.moment-row strong { font-variant-numeric: tabular-nums; }

.activation-ranking {
    display: grid;
    gap: 2px;
    max-height: min(52vh, 440px);
    padding-left: 2px;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-color: rgba(86, 98, 93, 0.5) transparent;
    scrollbar-width: thin;
    direction: rtl;
}

.activation-ranking::-webkit-scrollbar { width: 8px; }
.activation-ranking::-webkit-scrollbar-track { background: transparent; }
.activation-ranking::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(86, 98, 93, 0.5);
    background-clip: padding-box;
}

.activation-ranking-more {
    width: 100%;
    margin-top: 7px;
    padding: 7px;
    border-top: 1px solid rgba(213, 220, 216, 0.5);
    color: var(--accent-dark);
    font-size: 9px;
    font-weight: 720;
    text-align: center;
}

.activation-row {
    display: grid;
    grid-template-columns: minmax(105px, 0.75fr) minmax(70px, 1fr) 36px;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-height: 36px;
    padding: 3px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    direction: ltr;
}

.activation-row:nth-child(odd) { background: rgba(247, 249, 248, 0.04); }
.activation-row:hover { background: rgba(237, 243, 241, 0.12); }
.activation-row:hover .rank-name { color: var(--accent-dark); text-decoration: underline; }
.rank-label { display: grid; min-width: 0; gap: 1px; }
.rank-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.15;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.rank-id { overflow: hidden; color: var(--muted); font-size: 7px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { height: 6px; overflow: hidden; border: 1px solid rgba(173, 184, 179, 0.4); background: rgba(237, 240, 238, 0.12); }
.rank-fill { display: block; height: 100%; min-width: 1px; }
.rank-value { font-size: 9px; font-variant-numeric: tabular-nums; text-align: right; }

code { font-size: 0.94em; }

.model-information {
    margin-top: 14px;
}

.model-information-header {
    display: grid;
    grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
    align-items: baseline;
    gap: 18px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
}

.model-information-header h2 { margin: 0; }

.model-disclosure {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 3px 7px;
    padding: 8px 10px;
    border: 1px solid #dfc97f;
    border-left: 4px solid #c28b22;
    background: #fff7dc;
    color: #594315;
    font-size: 12px;
    line-height: 1.45;
}

.model-disclosure strong {
    color: #624712;
}

.model-information-body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px 20px;
    padding: 14px;
}

.model-information-body p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.model-information-groups .model-information-section + .model-information-section { border-top: 1px solid var(--line); }
.model-information-groups .model-information-section > h3 {
    margin: 0;
    padding: 11px 14px;
    color: var(--text);
    font-size: 12px;
    font-weight: 760;
}
.model-information-groups .model-information-section > h3 { border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.legal-grid a { overflow-wrap: anywhere; }

.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    padding: 16px 2px 4px;
    color: var(--muted);
    font-size: 11px;
}
.app-footer p { margin: 0; }
.app-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px 14px; }
.app-footer a { font-weight: 680; }

.diagnosis-workspace {
    margin-top: 10px;
}

.diagnosis-privacy-overview { margin-top: 12px; border-color: var(--mahogany-line); background: var(--mahogany-soft); }
.diagnosis-privacy-overview > header { padding: 16px 20px 12px; border-bottom: 1px solid var(--mahogany-line); }
.diagnosis-privacy-overview > header h2 { margin: 3px 0 0; font-size: 20px; }
.diagnosis-privacy-overview > header p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.diagnosis-privacy-overview-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 20px 16px; }
.diagnosis-privacy-overview-body p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.diagnosis-privacy-overview-body strong { color: var(--text); }
.diagnosis-privacy-start { display: flex; justify-content: flex-end; padding: 0 20px 16px; }
.diagnosis-privacy-start .primary-button { min-width: 150px; }

.diagnosis-safety-landing {
    width: min(820px, 100%);
    margin: 22px auto 0;
    overflow: hidden;
    border-color: var(--mahogany-line);
    background-color: var(--mahogany-soft);
    background-image: radial-gradient(circle, var(--mahogany-dot) 0.75px, transparent 0.9px);
    background-size: 10px 10px;
}

.diagnosis-safety-landing > header {
    padding: 20px 22px 15px;
    border-bottom: 1px solid var(--mahogany-line);
    background: rgba(255, 255, 255, 0.34);
}

.diagnosis-safety-landing > header h2 { margin: 3px 0 0; font-size: 24px; }
.diagnosis-safety-landing > header p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 11px; }

.diagnosis-safety-body {
    display: grid;
    grid-template-columns: minmax(190px, 0.55fr) minmax(360px, 1fr);
    gap: 22px;
    padding: 20px 22px 22px;
}

.diagnosis-safety-intro h3 { margin: 0 0 8px; font-size: 15px; }
.diagnosis-safety-intro p { margin: 0 0 10px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.diagnosis-safety-table { width: 100%; border-collapse: collapse; }
.diagnosis-safety-table th,
.diagnosis-safety-table td { border: 1px solid var(--mahogany-line); }
.diagnosis-safety-table thead th { padding: 7px 8px; background: rgba(111, 58, 54, 0.07); color: var(--mahogany); font-size: 9px; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; }
.diagnosis-safety-table tbody th,
.diagnosis-safety-table tbody td { background: rgba(255, 255, 255, 0.28); }
.diagnosis-safety-table thead th:not(:first-child) { width: 58px; text-align: center; }
.diagnosis-safety-table tbody th { padding: 8px 10px; font-size: 9px; font-weight: 500; line-height: 1.4; text-align: left; }
.diagnosis-safety-table tbody th strong { display: block; margin-bottom: 2px; color: var(--danger); font-size: 8px; letter-spacing: 0.03em; text-transform: uppercase; }
.diagnosis-safety-table tbody th span { display: block; }
.diagnosis-safety-table tbody td { width: 58px; padding: 0; text-align: center; }
.diagnosis-safety-table tbody td label { display: grid; place-items: center; min-height: 54px; cursor: pointer; }
.diagnosis-safety-table tbody td label:hover { background: var(--surface-soft); }
.diagnosis-safety-table tbody td input {
    display: grid;
    place-content: center;
    width: 18px;
    height: 18px;
    margin: 0;
    appearance: none;
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    background: var(--surface);
    color: var(--accent-dark);
    cursor: pointer;
}
.diagnosis-safety-table tbody td input::before {
    content: "×";
    font-size: 18px;
    font-weight: 800;
    line-height: 14px;
    transform: scale(0);
}
.diagnosis-safety-table tbody td input:checked::before { transform: scale(1); }
.diagnosis-safety-table tbody td input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.diagnosis-safety-table tbody td span { margin-top: 3px; color: var(--muted); font-size: 8px; }
.diagnosis-safety-table .warning-answer input { color: var(--danger); }
.diagnosis-safety-table .warning-answer:has(input:checked) { background: var(--danger-bg); }
.diagnosis-safety-table td:has(input[value="no"]:checked) { background: #edf6f3; }
.diagnosis-safety-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.diagnosis-safety-footer span { color: var(--muted); font-size: 10px; }
.diagnosis-safety-footer .primary-button { min-width: 190px; }
.diagnosis-safety-footer .primary-button:disabled { cursor: not-allowed; opacity: 0.45; }

.diagnosis-intake {
    width: min(900px, 100%);
    margin: 14px auto 0;
    overflow: hidden;
    border-color: var(--mahogany-line);
    background-color: var(--mahogany-soft);
    background-image: radial-gradient(circle, var(--mahogany-dot) 0.75px, transparent 0.9px);
    background-size: 10px 10px;
}

.diagnosis-records { margin-bottom: 10px; overflow: hidden; background: #f4f7f6; }
.diagnosis-records > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; border-bottom: 1px solid #ccd7d3; background: #eaf1ee; }
.diagnosis-records > header > div { display: grid; gap: 2px; }
.diagnosis-records > header > .diagnosis-record-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.diagnosis-record-actions button:disabled { cursor: not-allowed; opacity: 0.45; }
.diagnosis-record-actions #diagnosis-delete-all-data { border-color: #cbb8b4; color: #74433d; background: #fbf8f7; }
.diagnosis-record-actions #diagnosis-delete-all-data:hover { border-color: #a86c64; background: #f5e9e7; color: #69332d; }
.diagnosis-record-actions #diagnosis-new-assessment { border-color: var(--accent-dark); background: var(--accent-dark); color: #fff; }
.diagnosis-record-actions #diagnosis-new-assessment:hover { border-color: #174f44; background: #174f44; color: #fff; }
.diagnosis-record-actions #diagnosis-new-assessment::before { content: "+"; margin-right: 5px; font-size: 13px; font-weight: 500; }
.diagnosis-records h2 { margin: 0; font-size: 16px; }
.diagnosis-records #diagnosis-draft-state { color: var(--muted); font-size: 9px; }
.diagnosis-records-privacy { margin: 0; padding: 7px 13px; border-top: 1px solid #d5deda; background: #eef3f1; color: #64716c; font-size: 9px; }
.saved-report-empty { margin: 0; padding: 18px 13px; color: var(--muted); font-size: 10px; }
.saved-report-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 10px; }
.saved-report-table th,
.saved-report-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.saved-report-table th { padding: 7px 12px; border-bottom: 1px solid var(--line); background: #edf2f0; color: #64716c; font-size: 8px; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; }
.saved-report-table th:nth-child(1) { width: 20%; }
.saved-report-table th:nth-child(2) { width: 27%; }
.saved-report-table th:nth-child(3) { width: 23%; }
.saved-report-table th:nth-child(4) { width: 30%; }
.saved-report-table tbody tr:last-child td { border-bottom: 0; }
.saved-report-table td { background: #f9fbfa; }
.saved-report-table tbody tr:hover td { background: #f3f7f5; }
.saved-report-record,
.saved-report-patient { display: grid; gap: 2px; }
.saved-report-record time,
.saved-report-patient span,
.saved-report-assessment span { color: var(--muted); font-size: 8px; line-height: 1.3; }
.saved-report-patient strong,
.saved-report-assessment strong { font-size: 11px; }
.saved-report-assessment { display: grid; gap: 3px; }
.saved-report-status { justify-self: start; margin-top: 2px; padding: 2px 6px; border: 1px solid #c5cfcb; border-radius: 999px; background: #f4f7f6; color: #52615b; font-size: 7px; font-weight: 760; letter-spacing: 0.035em; text-transform: uppercase; }
.saved-report-status.complete { border-color: #b8d4ca; background: #edf6f2; color: #285d50; }
.saved-report-status.review-needed { border-color: #dccb9f; background: #faf4e4; color: #6d5724; }
.saved-report-status.archived { border-color: #c8cdd1; background: #f1f3f4; color: #566069; }
.saved-report-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.saved-report-action { min-height: 26px; padding: 4px 8px; border: 1px solid #bdc9c5; border-radius: 3px; background: #fff; color: #30423c; cursor: pointer; font: inherit; font-size: 8px; font-weight: 720; white-space: nowrap; }
.saved-report-action.open { border-color: #236d5d; background: #236d5d; color: #fff; }
.saved-report-action.reuse { background: #edf5f2; color: #235448; }
.saved-report-action.delete { display: grid; width: 26px; min-width: 26px; height: 26px; min-height: 26px; padding: 0; border-color: #d8c1bd; background: #fbf7f6; color: #7a4943; place-items: center; }
.saved-report-action.delete svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.saved-report-action:hover { border-color: #6e9187; background: #e5f0ec; color: #173f36; }
.saved-report-action.open:hover { border-color: #174f44; background: #174f44; color: #fff; }
.saved-report-action.delete:hover { border-color: #d8c1bd; background: #f8efed; color: #69332d; }
.saved-report-action:focus-visible { outline: 2px solid rgba(35, 112, 96, 0.35); outline-offset: 1px; }
.diagnosis-intake > header { padding: 18px 20px 14px; border-bottom: 1px solid var(--mahogany-line); background: rgba(255, 255, 255, 0.34); }
.diagnosis-intake > header h2 { margin: 3px 0 0; font-size: 21px; }
.diagnosis-intake > header p:last-child { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
#diagnosis-intake-form { padding: 0 20px 18px; }
.diagnosis-intake-section { padding: 16px 0; border-bottom: 1px solid var(--mahogany-line); }
.diagnosis-intake-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.diagnosis-intake-heading h3 { margin: 0; font-size: 13px; }
.diagnosis-intake-heading span { color: var(--muted); font-size: 8px; }
.diagnosis-intake-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.diagnosis-intake-grid .span-2 { grid-column: span 2; }
.diagnosis-intake-checks { grid-column: span 2; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; padding: 8px; border: 1px solid var(--mahogany-line); background: rgba(255, 255, 255, 0.28); }
.diagnosis-intake-checks legend { padding: 0 4px; color: var(--muted); font-size: 9px; font-weight: 700; }
.diagnosis-intake-checks label { display: flex; align-items: center; gap: 6px; font-size: 9px; }
.diagnosis-privacy-consent { margin: 12px 0; border: 1px solid var(--mahogany-line); background: rgba(255, 255, 255, 0.38); }
.diagnosis-privacy-details { border-bottom: 1px solid var(--mahogany-line); }
.diagnosis-privacy-details h3 { margin: 0; padding: 9px 11px; color: var(--text); font-size: 10px; font-weight: 760; }
.diagnosis-privacy-copy { padding: 0 11px 9px; }
.diagnosis-privacy-consent p { margin: 5px 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.diagnosis-privacy-accept { display: flex; align-items: center; gap: 8px; padding: 10px 11px; color: var(--text); font-size: 10px; font-weight: 720; cursor: pointer; }
.diagnosis-privacy-accept input { width: 17px; height: 17px; margin: 0; accent-color: var(--teal); }
.diagnosis-intake-actions { display: flex; align-items: center; gap: 9px; }
.diagnosis-intake-actions span { margin-left: auto; color: var(--muted); font-size: 9px; }
.diagnosis-intake-actions button { min-height: 34px; }

.diagnosis-assessment {
    display: grid;
    grid-template-columns: minmax(590px, 0.86fr) minmax(560px, 1.14fr);
    grid-template-areas:
        "bar bar"
        "tests instructions"
        "tests viewer";
    gap: 10px;
    align-items: start;
}

.diagnosis-assessment-bar {
    grid-area: bar;
    display: grid;
    grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
}

.diagnosis-assessment-title { min-width: 190px; }
.diagnosis-assessment-bar h2 { margin: 1px 0 0; font-size: 15px; }
.diagnosis-assessment-bar .eyebrow { margin: 0; }
.diagnosis-assessment-summary { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; white-space: nowrap; }
#diagnosis-restart,
#diagnosis-report-restart { justify-self: end; min-width: 150px; }
#diagnosis-restart::before,
#diagnosis-report-restart::before { content: "↻"; margin-right: 6px; font-size: 14px; font-weight: 500; }
.diagnosis-patient-header {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #cbd2cf;
    border-radius: 3px;
    background: #fff;
}
.diagnosis-patient-identity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 9px;
    border-bottom: 1px solid #d9dedc;
    background: #f6f7f6;
}
.diagnosis-patient-identity > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.diagnosis-patient-identity > div > span { color: #6b7470; font-size: 7px; font-weight: 800; letter-spacing: 0.075em; text-transform: uppercase; }
.diagnosis-patient-identity > div > strong { overflow: hidden; color: #28312e; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.diagnosis-patient-identifiers { display: flex !important; align-items: center !important; gap: 6px !important; overflow: visible !important; }
.diagnosis-record-code {
    flex: none;
    padding: 2px 7px;
    border: 1px solid #c2c9c6;
    border-radius: 2px;
    background: #fff;
    color: #69726e;
    font-size: 7px;
    font-weight: 760;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}
.diagnosis-record-code strong { color: #28312e; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 9px; letter-spacing: 0.08em; }
.diagnosis-patient-arm {
    flex: none;
    padding: 2px 7px;
    border: 1px solid #aac0b8;
    border-radius: 999px;
    color: #315c50;
    font-size: 8px;
    text-transform: lowercase;
}
.diagnosis-patient-arm strong { text-transform: capitalize; }
.diagnosis-patient-groups { display: grid; grid-template-columns: 1fr; }
.diagnosis-patient-groups > section { min-width: 0; padding: 7px 9px 8px; }
.diagnosis-patient-groups > section + section {
    border-top: 1px solid #d9dedc;
    background: #fcfaf8;
}
.diagnosis-patient-groups h3 { margin: 0 0 5px; color: #68716e; font-size: 7px; letter-spacing: 0.075em; }
.diagnosis-patient-groups > section:last-child h3 { color: #80534d; }
.diagnosis-patient-groups dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
}
.diagnosis-patient-groups dl > div {
    min-width: 0;
    padding: 0 7px;
}
.diagnosis-patient-groups dl > div:first-child { padding-left: 0; }
.diagnosis-patient-groups dl > div + div { border-left: 1px solid #e1e5e3; }
.diagnosis-patient-header dt { color: #66716d; font-size: 7px; font-weight: 800; letter-spacing: 0.055em; text-transform: uppercase; }
.diagnosis-patient-header dd { margin: 2px 0 0; overflow: hidden; color: #1f2926; font-size: 9px; font-weight: 700; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.diagnosis-center { display: contents; }
.diagnosis-center > .diagnosis-instructions { grid-area: instructions; }
.diagnosis-center > .diagnosis-viewer-slot { grid-area: viewer; }
.diagnosis-tests-panel { grid-area: tests; }

.diagnosis-tests-panel,
.diagnosis-instructions {
    min-width: 0;
}

.diagnosis-tests-panel {
    max-height: 760px;
    overflow-y: auto;
    scrollbar-color: rgba(86, 98, 93, 0.45) transparent;
    scrollbar-width: thin;
}

.diagnosis-tests-panel {
    border-color: var(--mahogany-line);
    background-color: var(--mahogany-soft);
    background-image: radial-gradient(circle, var(--mahogany-dot) 0.75px, transparent 0.9px);
    background-size: 10px 10px;
}

.diagnosis-tests-panel > header {
    padding: 12px;
    border-bottom: 1px solid var(--line);
}
.diagnosis-tests-panel > header { border-bottom-color: var(--mahogany-line); background: rgba(255, 255, 255, 0.34); }

.diagnosis-tests-panel header h2 { margin: 0; }
.diagnosis-tests-panel header p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }

#capacity-screen-intro {
    margin: 8px 10px 0;
    padding: 8px;
    border: 1px solid var(--mahogany-line);
    background: rgba(255, 255, 255, 0.34);
}

#capacity-screen-intro strong { font-size: 10px; }
#capacity-screen-intro p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.4; }
.diagnosis-test-number { color: var(--accent-dark); font-size: 10px; font-weight: 780; }
.diagnosis-test-copy { display: grid; gap: 2px; min-width: 0; }
.diagnosis-test-copy strong { font-size: 10px; line-height: 1.25; }
.diagnosis-test-copy span { color: var(--muted); font-size: 8px; line-height: 1.25; }
.diagnosis-test-copy span.pain { color: var(--danger); font-weight: 700; }
.diagnosis-test-copy span.complete { color: var(--accent-dark); }

.capacity-record-wrap { overflow: auto; }
.capacity-record-table { width: 100%; min-width: 650px; border-collapse: collapse; table-layout: fixed; }
.capacity-record-table th,
.capacity-record-table td { border: 1px solid var(--mahogany-line); }
.capacity-record-table thead th { position: sticky; top: 0; z-index: 2; height: 27px; padding: 4px 2px; background: #f2e8e5; color: var(--mahogany); font-size: 7px; font-weight: 760; letter-spacing: 0.02em; text-align: center; text-transform: uppercase; }
.capacity-record-table thead th:first-child { width: 26%; padding-left: 7px; text-align: left; }
.capacity-record-table thead th:nth-child(2) { width: 12%; }
.capacity-record-table thead th:nth-child(3),
.capacity-record-table thead th:nth-child(4),
.capacity-record-table thead th:nth-child(5) { width: 9%; }
.capacity-record-table thead th:nth-child(6) { width: 13%; }
.capacity-record-table thead th:last-child { width: 22%; padding-left: 6px; text-align: left; }
.capacity-record-table tbody th { padding: 0; text-align: left; }
.capacity-record-table tbody td { height: 34px; padding: 3px 2px; text-align: center; vertical-align: middle; }
.capacity-record-table tbody th,
.capacity-record-table tbody td { background: rgba(255, 255, 255, 0.22); }
.capacity-record-table tbody tr.active > th,
.capacity-record-table tbody tr.active > td { background: rgba(111, 58, 54, 0.09); }
.capacity-record-table tbody tr.active { box-shadow: inset 3px 0 0 var(--mahogany); }
.capacity-position-open { display: grid; grid-template-columns: 25px minmax(0, 1fr); align-items: start; gap: 4px; width: 100%; min-height: 34px; padding: 5px 6px; border: 0; background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.capacity-position-open:hover { background: rgba(74, 88, 82, 0.05); }
.capacity-position-open:disabled { cursor: not-allowed; opacity: 0.38; }
.capacity-position-open:disabled:hover { background: transparent; }
.capacity-record-table tr.locked { background: rgba(58, 64, 62, 0.025); }
.capacity-record-table tr.locked td { color: #a6aaa8; }
.capacity-record-table tr.clickable { cursor: pointer; }
.capacity-record-table tr.clickable:hover { background: rgba(35, 112, 96, 0.055); }
.capacity-record-table tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.capacity-record-table tr.clickable.active:hover { background: rgba(35, 112, 96, 0.09); }
.capacity-position-open > span { color: var(--accent-dark); font-size: 8px; font-weight: 780; }
.capacity-position-open > strong { font-size: 8px; font-weight: 680; line-height: 1.25; }
.capacity-position-open > em { grid-column: 2; color: var(--muted); font-size: 7px; font-style: normal; font-weight: 650; }
.capacity-record-table input[type="radio"] { display: grid; place-content: center; width: 17px; height: 17px; margin: auto; appearance: none; border: 1px solid #9aa39f; border-radius: 2px; background: #fff; color: #2f3935; cursor: pointer; }
.capacity-record-table input[type="radio"]::before { content: "X"; font-size: 12px; font-weight: 800; line-height: 1; transform: scale(0); }
.capacity-record-table input[type="radio"]:checked::before { transform: scale(1); }
.capacity-record-table input[type="radio"]:focus-visible { outline: 2px solid #66716d; outline-offset: 2px; }
.capacity-record-mark { color: #2f3935; font-size: 11px; font-weight: 800; }
.capacity-choice-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; width: 100%; }
.capacity-choice-group.completion { grid-template-columns: minmax(0, 1fr); }
.capacity-choice-button {
    --choice-bg: #f7f8f7;
    --choice-border: #c3cac7;
    --choice-ink: #46514d;
    --choice-selected: #e7ecea;
    min-width: 0;
    min-height: 22px;
    padding: 2px 1px;
    border: 1px solid var(--choice-border);
    border-radius: 2px;
    background: var(--choice-bg);
    color: var(--choice-ink);
    cursor: pointer;
    font: inherit;
    font-size: 7px;
    font-weight: 650;
    line-height: 1.05;
}
.capacity-choice-button.value-full,
.capacity-choice-button.value-no { --choice-bg: #f0f7f4; --choice-border: #bdd5cc; --choice-ink: #28584d; --choice-selected: #dceee7; }
.capacity-choice-button.value-partial,
.capacity-choice-button.value-yes { --choice-bg: #fbf6e9; --choice-border: #dfd0a8; --choice-ink: #665425; --choice-selected: #f3e7c5; }
.capacity-choice-button.value-unable { --choice-bg: #f0f3f6; --choice-border: #c8d0d8; --choice-ink: #46535e; --choice-selected: #e0e6eb; }
.capacity-choice-button.value-stopped { --choice-bg: #f7f0ed; --choice-border: #d9c4bd; --choice-ink: #6c4942; --choice-selected: #eddeda; }
.capacity-choice-button.value-skipped,
.capacity-choice-button.value-uncertain { --choice-bg: #f4f4f1; --choice-border: #cecfca; --choice-ink: #595c56; --choice-selected: #e7e7e1; }
.capacity-choice-button:hover { border-color: var(--choice-ink); filter: brightness(0.985); }
.capacity-choice-button.selected { border-color: var(--choice-ink); background: var(--choice-selected); color: var(--choice-ink); box-shadow: inset 0 0 0 1px var(--choice-ink); font-weight: 780; }
.capacity-choice-button.selected::before { content: "X"; margin-right: 4px; font-weight: 850; }
.capacity-choice-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.capacity-record-value { display: inline-block; color: #2f3935; font-size: 8px; font-weight: 720; line-height: 1.2; }
.capacity-record-comments { display: block; width: 100%; min-height: 29px; max-height: 56px; padding: 4px 5px; border: 1px solid #aeb6b2; border-radius: 2px; background: #fff; color: var(--text); font: inherit; font-size: 8px; line-height: 1.25; resize: vertical; }
.capacity-record-comment-text { display: block; max-height: 30px; overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1.25; text-align: left; }
.capacity-record-table .capacity-detail-row td { padding: 6px 7px; background: rgba(255, 255, 255, 0.38); text-align: left; }
.capacity-detail-fields { display: flex; align-items: end; flex-wrap: wrap; gap: 6px; }
.capacity-detail-field { display: grid; gap: 2px; min-width: 82px; color: var(--muted); font-size: 7px; font-weight: 720; text-transform: uppercase; }
.capacity-detail-field select { min-height: 27px; padding: 3px 5px; border: 1px solid #aeb6b2; border-radius: 2px; background: #fff; color: var(--text); font: inherit; font-size: 8px; text-transform: none; }
.capacity-detail-help { flex: 1 1 145px; align-self: center; color: var(--muted); font-size: 8px; line-height: 1.3; }
.capacity-record-table .capacity-section-divider th { padding: 6px 7px; border: 1px solid var(--mahogany-line); background: #efe2de; }
.capacity-record-table .capacity-section-divider strong,
.capacity-record-table .capacity-section-divider span { display: block; }
.capacity-record-table .capacity-section-divider strong { font-size: 8px; }
.capacity-record-table .capacity-section-divider span { margin-top: 1px; color: var(--muted); font-size: 7px; font-weight: 500; }
.capacity-report-list-item td { padding: 0 !important; border-top: 2px solid #c9a85d; }
.capacity-report-list-button { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 7px; width: 100%; min-height: 48px; padding: 7px 10px; border: 0; background: #fff8e7; box-shadow: inset 3px 0 0 #c49a3a; color: var(--text); cursor: pointer; text-align: left; }
.capacity-report-list-button:hover { background: #f9edcf; }
.capacity-report-list-button:disabled { cursor: not-allowed; filter: grayscale(0.75); opacity: 0.5; }
.capacity-report-list-button:disabled:hover { background: #fff8e7; }
.capacity-report-list-button .diagnosis-test-number { color: #806018; font-size: 14px; }
.capacity-report-list-button .diagnosis-test-copy strong { color: #4e3c13; }

.diagnosis-stop-warning {
    margin: 10px;
    padding: 9px 10px;
    border: 1px solid #d49c97;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.4;
}

.diagnosis-center { min-width: 0; }
.diagnosis-instructions { padding: 12px 14px; }
.diagnosis-test-heading { display: flex; align-items: baseline; gap: 8px; }
.diagnosis-test-heading h2 { margin: 0; }
.diagnosis-test-id { color: var(--accent-dark); font-size: 10px; font-weight: 780; letter-spacing: 0.05em; text-transform: uppercase; }
.diagnosis-instructions > p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.capacity-position-actions { display: grid; grid-template-columns: auto auto minmax(150px, 1fr); align-items: center; gap: 8px; }
.capacity-quick-actions { display: flex; gap: 5px; }
.quick-response-button {
    min-height: 31px;
    padding: 6px 11px;
    border: 1px solid var(--accent-dark);
    border-radius: 3px;
    background: var(--accent-dark);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 10px;
    font-weight: 720;
}
.quick-response-button:hover { background: #174f44; }
.capacity-position-actions #capacity-save-state { color: var(--muted); font-size: 8px; text-align: right; }
.saved-report-code { color: var(--accent-dark); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }

.diagnosis-hint { padding-left: 8px; border-left: 2px solid var(--warning-border); color: #594619 !important; }

.diagnosis-viewer-slot { min-width: 0; }
.diagnosis-viewer-slot .viewer-panel { width: 100%; min-width: 0; }
.diagnosis-viewer-slot .viewer-stage { grid-template-columns: 1fr; }
.diagnosis-viewer-slot .scene-wrap { min-height: 620px; }
.diagnosis-tests-panel { position: sticky; top: 8px; align-self: start; }
.diagnosis-viewer-slot .pose-dock { display: none; }

.diagnosis-field { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 9px; font-weight: 680; }
.diagnosis-field.full { grid-column: 1 / -1; }
.diagnosis-field input,
.diagnosis-field select,
.diagnosis-field textarea {
    width: 100%;
    min-height: 31px;
    padding: 5px 7px;
    border: 1px solid var(--line-strong);
    border-radius: 3px;
    background: var(--surface);
    color: var(--text);
    font-size: 10px;
}
.diagnosis-field textarea { min-height: 70px; resize: vertical; }

.capacity-position-actions { display: grid; grid-template-columns: auto minmax(130px, 1fr) auto; align-items: center; gap: 8px; margin-top: 10px; }
.capacity-position-actions button { min-height: 32px; }
.capacity-position-actions > span { color: var(--muted); font-size: 8px; text-align: center; }
.capacity-position-actions button:disabled { border-color: #d7dcda; background: #e5e8e6; color: #979f9b; cursor: not-allowed; opacity: 0.7; box-shadow: none; }
.diagnosis-report {
    position: relative;
    isolation: isolate;
    grid-column: 1 / -1;
    min-width: 0;
    overflow: hidden;
}
.diagnosis-report-screen { display: grid; gap: 10px; }
.diagnosis-report-screen-header { display: flex; align-items: center; gap: 12px; padding: 11px 13px; }
.diagnosis-report-screen-header > div:first-child { margin-right: auto; }
.diagnosis-report-screen-header h2 { margin: 1px 0 0; font-size: 15px; }
.diagnosis-report-screen-header .eyebrow { margin: 0; }
.diagnosis-report-screen-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.diagnosis-report-watermark {
    position: absolute;
    top: 175px;
    left: 50%;
    z-index: 0;
    display: grid;
    justify-items: center;
    gap: 8px;
    width: min(520px, 70%);
    color: #17201d;
    opacity: 0.045;
    pointer-events: none;
    transform: translateX(-50%);
    user-select: none;
}
.diagnosis-report-watermark img { width: min(290px, 70%); height: auto; filter: grayscale(1); }
.diagnosis-report-watermark span { font-size: clamp(24px, 4vw, 42px); font-weight: 760; letter-spacing: -0.025em; white-space: nowrap; }
.diagnosis-report > header,
#diagnosis-report-content { position: relative; z-index: 1; }
.diagnosis-report > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.94); }
.diagnosis-report-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.diagnosis-report-brand img { flex: none; width: 42px; height: 42px; object-fit: contain; }
.diagnosis-report-brand-name { display: block; margin-bottom: 2px; color: var(--accent-dark) !important; font-size: 8px !important; font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; }
.diagnosis-report > header h2 { margin: 0; }
.diagnosis-report > header span { color: var(--muted); font-size: 9px; }
#diagnosis-report-content { padding: 14px; }
.diagnosis-report-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.diagnosis-report-summary > div { padding: 9px; border: 1px solid var(--line); background: var(--surface-soft); }
.diagnosis-report-summary span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.diagnosis-report-summary strong { display: block; margin-top: 3px; font-size: 11px; }
.diagnosis-report h3 { margin: 14px 0 6px; }
.diagnosis-report p,
.diagnosis-report li { color: var(--muted); font-size: 10px; line-height: 1.5; }
.diagnosis-report-table-wrap { overflow-x: auto; }
.diagnosis-report table { width: 100%; border-collapse: collapse; font-size: 9px; }
.diagnosis-report th,
.diagnosis-report td { padding: 6px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.diagnosis-report th { background: var(--surface-soft); color: var(--muted); }
.error {
    margin-bottom: 14px;
    padding: 12px 15px;
    border: 1px solid #d49c97;
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 12px;
}

.app-dialog {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 20px;
}
.app-dialog-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(21, 28, 27, 0.48); cursor: default; }
.app-dialog-card { position: relative; width: min(430px, 100%); padding: 20px; border: 1px solid var(--line-strong); border-top: 4px solid var(--accent); background: var(--surface); box-shadow: 0 18px 55px rgba(18, 26, 24, 0.28); }
.app-dialog-card.danger { border-top-color: #8d392e; }
.app-dialog-card h2 { margin: 0; font-size: 18px; }
.app-dialog-card p { margin: 9px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.app-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.app-dialog-actions .primary-button { width: auto; min-width: 110px; }
.app-dialog-card.danger .primary-button { background: #7d3027; border-color: #7d3027; }

.hidden { display: none !important; }

@media (max-width: 1120px) {
    .scene-wrap { min-height: 610px; }
    .pose-dock { max-height: 610px; }
    .model-information-body { grid-template-columns: 1fr 1fr; }
    .diagnosis-assessment {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "bar"
            "instructions"
            "tests"
            "viewer";
    }
    .diagnosis-assessment-bar { grid-template-columns: minmax(180px, auto) auto; }
    .diagnosis-patient-header { grid-column: 1 / -1; grid-row: 2; }
    .diagnosis-intake-grid { grid-template-columns: 1fr 1fr; }
    .diagnosis-tests-panel { position: static; max-height: 520px; }
    .diagnosis-report-screen-header { align-items: stretch; flex-direction: column; }
    .diagnosis-report-screen-header > div:first-child { margin: 0; }
    .diagnosis-report-screen-actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 880px) {
    .scene-wrap { min-height: 560px; }
}

@media (max-width: 700px) {
    .app-shell { width: min(100% - 18px, 660px); padding-top: 16px; }
    .page-header { gap: 13px; }
    .viewer-header { flex-direction: column; gap: 13px; }
    .app-brand { align-items: flex-start; gap: 11px; }
    .app-logo { width: 52px; height: 52px; }
    .intro { font-size: 14px; }
    .server-status { width: 22px; height: 22px; padding: 0; }
    .use-boundary { padding: 8px 10px; font-size: 11px; }
    .scene-actions { top: 8px; right: 8px; }
    .source-group { flex: 1 1 100%; }
    .source-controls { align-items: stretch; }
    .mode-switch.compact { flex: 1; }
    .mode-switch.compact .mode-button { flex: 1; justify-content: center; }
    .model-information-body { grid-template-columns: 1fr; }
    .model-information-header { grid-template-columns: 1fr; gap: 5px; }
    .scene-wrap { min-height: 470px; touch-action: pan-y; }
    .viewer-drawer.muscle-panel {
        top: auto;
        right: 8px;
        bottom: 8px;
        left: 8px;
        width: auto;
        max-height: 58%;
    }
    .viewer-stage { grid-template-columns: 1fr; }
    .pose-dock { max-height: none; border-top: 1px solid var(--line); border-left: 0; }
    .region-picker { grid-template-columns: 1fr; gap: 5px; }
    .region-picker select { min-height: 46px; font-size: 12px; }
    .region-picker p { grid-column: 1; font-size: 9px; }
    .presentation-control-row { grid-template-columns: 58px minmax(0, 1fr); }
    .presentation-control-row select { min-height: 44px; font-size: 11px; }
    .preset-catalog { position: static; max-height: 470px; margin-bottom: 8px; }
    .pose-dock .coordinate-controls { grid-template-columns: 1fr; gap: 0; }
    .coordinate-controls.compact .coordinate-control + .coordinate-control { margin-top: 5px; padding-top: 5px; border-top: 1px solid #e6eae8; }
    .primary-button { width: 100%; }
    .app-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 13px; }
    .app-tabs button { grid-template-columns: minmax(0, 1fr); min-height: 56px; gap: 0; padding: 7px 11px; }
    .app-tabs .app-tab-copy > span { font-size: 15px; }
    .app-tabs .app-tab-visual { display: none; }
    .diagnosis-records > header { align-items: stretch; flex-direction: column; }
    .diagnosis-records > header button { width: 100%; }
    .diagnosis-records > header > .diagnosis-record-actions { display: grid; grid-template-columns: 1fr; }
    .diagnosis-privacy-overview-body { grid-template-columns: 1fr; padding: 12px 16px 15px; }
    .saved-report-table thead { display: none; }
    .saved-report-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 8px; border-bottom: 1px solid var(--line); }
    .saved-report-table td { min-width: 0; padding: 7px 8px; border: 0; }
    .saved-report-table td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: #73807b; font-size: 7px; font-weight: 760; letter-spacing: 0.04em; text-transform: uppercase; }
    .saved-report-actions-cell { grid-column: 1 / -1; padding-top: 9px !important; }
    .saved-report-actions { justify-content: stretch; }
    .saved-report-action.open,
    .saved-report-action.reuse { flex: 1; }
    .saved-report-action.delete { flex: 0 0 30px; width: 30px; height: 30px; min-height: 30px; }
    .diagnosis-safety-landing { margin-top: 10px; }
    .diagnosis-safety-landing > header { padding: 16px; }
    .diagnosis-safety-body { grid-template-columns: 1fr; gap: 10px; padding: 14px 16px 16px; }
    .diagnosis-safety-table thead th:not(:first-child),
    .diagnosis-safety-table tbody td { width: 46px; }
    .diagnosis-safety-table tbody th { padding: 7px; }
    .diagnosis-safety-footer { align-items: stretch; flex-direction: column; }
    #diagnosis-intake-form { padding-inline: 14px; }
    .diagnosis-intake-grid { grid-template-columns: 1fr; }
    .diagnosis-intake-grid .span-2,
    .diagnosis-intake-checks { grid-column: auto; }
    .diagnosis-intake-checks { grid-template-columns: 1fr; }
    .diagnosis-intake-actions { flex-direction: column; align-items: stretch; }
    .diagnosis-intake-actions span { order: -1; margin: 0; }
    .diagnosis-assessment {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "bar"
            "instructions"
            "viewer"
            "tests";
    }
    .diagnosis-assessment-bar { align-items: stretch; grid-template-columns: minmax(0, 1fr) auto; }
    .diagnosis-patient-groups { grid-template-columns: 1fr; }
    .diagnosis-patient-groups > section + section { border-top: 1px solid #d9dedc; border-left: 0; }
    .diagnosis-tests-panel { max-height: none; }
    .diagnosis-tests-panel { position: static; }
    .diagnosis-report-summary { grid-template-columns: 1fr; }
    .capacity-record-wrap { overflow: visible; }
    .capacity-record-table { display: block; width: 100%; min-width: 0; }
    .capacity-record-table thead { display: none; }
    .capacity-record-table tbody { display: grid; gap: 4px; }
    .capacity-record-table tbody tr { display: block; border: 1px solid var(--mahogany-line); }
    .capacity-record-table tbody th { display: block; border: 0; }
    .capacity-record-table tbody tr:not(.active):not(.capacity-detail-row):not(.capacity-report-list-item) td { display: none; }
    .capacity-record-table tbody tr.active > td {
        display: grid;
        grid-template-columns: minmax(82px, 0.35fr) minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        min-height: 48px;
        padding: 7px 9px;
        border-width: 1px 0 0;
        text-align: left;
    }
    .capacity-record-table tbody tr.active > td::before {
        color: var(--muted);
        content: attr(data-label);
        font-size: 8px;
        font-weight: 780;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }
    .capacity-position-open { min-height: 44px; align-items: center; padding: 7px 9px; }
    .capacity-position-open > span,
    .capacity-position-open > strong { font-size: 10px; }
    .capacity-choice-button { min-height: 38px; }
    .capacity-record-comments { min-height: 58px; font-size: 10px; }
    .capacity-record-table .capacity-detail-row td { display: block; border: 0; padding: 9px; }
    .capacity-record-table .capacity-detail-row td::before { content: none; }
    .capacity-detail-fields { align-items: stretch; flex-direction: column; }
    .capacity-detail-field select { min-height: 44px; font-size: 10px; }
    .capacity-report-list-item td { display: block; border: 0; }
    .app-footer { align-items: flex-start; flex-direction: column; }
    .app-footer nav { justify-content: flex-start; }
}

@media (pointer: coarse) {
    .scene-action-button { width: 44px; height: 44px; }
    .scene-actions { gap: 4px; }
    .pose-viewer-controls .layer-toggle-list .layer-toggle,
    .pose-viewer-controls .mode-switch.compact .mode-button,
    .pose-viewer-controls .path-view-switch button,
    .segmented-control button,
    .library-button,
    .pose-presets button { min-height: 44px; }
}

@media (max-width: 450px) {
    .source-controls { flex-direction: column; }
    .path-view-switch { align-self: stretch; }
    .path-view-switch button { flex: 1; }
    .scene-legend { right: 8px; left: 8px; bottom: 8px; }
}

@media print {
    .diagnosis-report-watermark {
        position: fixed;
        top: 38%;
        opacity: 0.04;
    }
}

/* MS-Human browser runtime additions. The surrounding explorer layout remains
   intentionally shared with the established interface. */
.context-key {
    background: rgba(109, 127, 119, 0.28);
    border: 1px solid rgba(70, 91, 82, 0.32);
}

.solver-mini-readout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0;
}

.solver-mini-readout div {
    min-width: 0;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    background: rgba(255, 255, 255, 0.55);
}

.solver-mini-readout dt {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.solver-mini-readout dd {
    margin: 0.12rem 0 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
    text-overflow: ellipsis;
    white-space: nowrap;
}
