/* 2.11: shared visual hierarchy, design tokens and responsive workspace. */
:root {
 --canvas:#0d141f; --surface:#17212e; --surface-2:#1c2938; --input:#101a27;
 --ink:#eef3f9; --field-ink:#d9e2ed; --muted:#a8b7c9; --muted-2:#91a3b9;
 --line:#334357; --line-strong:#566b84; --row-line:#2c3b4e;
 --blue:#79b5ff; --blue-dark:#a2ccff; --blue-soft:#213c5c; --hover:#213146;
 --topbar:#121d2b; --table-head:#223246; --panel-edge:#42556e;
 --section-band:#202e40; --control-edge:#637991; --section-fill:#141f2d;
 --primary-fill:#326fc1; --primary-hover:#255da5; --header-height:76px;
 --shadow:0 2px 5px #00000012; --radius:8px;
}
.patient-query-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:12px; padding:16px; border-top:1px solid var(--line); background:var(--surface-2); }
.patient-query-toolbar label { display:flex; align-items:center; gap:8px; margin:0; }
.patient-query-toolbar select { min-height:44px; max-width:280px; background:var(--input); color:var(--ink); border:1px solid var(--control-edge); border-radius:6px; padding:8px; }
.patient-query-toolbar input[type=checkbox] { width:20px; height:20px; accent-color:var(--primary-fill); }
.patient-sort-heading { color:inherit; background:transparent; border:0; font:inherit; font-weight:700; text-align:left; cursor:pointer; min-height:44px; padding:4px 0; }
.patient-all-table th[aria-sort=ascending], .patient-all-table th[aria-sort=descending] { box-shadow:inset 0 -3px var(--blue); }
.patient-column-filters td { padding:10px; min-width:180px; vertical-align:top; background:var(--surface-2); }
.patient-column-filters input, .patient-column-filters select { display:block; width:100%; max-width:260px; min-height:40px; margin:4px 0; padding:6px; background:var(--input); color:var(--ink); border:1px solid var(--control-edge); border-radius:4px; }
.patient-column-filters small { color:var(--muted); display:block; }
.patient-column-filters[hidden], .patient-no-results[hidden], .patient-all-table tr[hidden] { display:none !important; }
.patient-no-results { margin:0; padding:22px; color:var(--muted); }
@media(max-width:600px) { .patient-query-toolbar > label:first-child { width:100%; } .patient-query-toolbar select { min-width:0; max-width:100%; flex:1; } }
:root[data-theme="light"] {
 --canvas:#eef2f6; --surface:#fff; --surface-2:#f5f7fa; --input:#fff;
 --ink:#182a3e; --field-ink:#2d4055; --muted:#53657a; --muted-2:#63758a;
 --line:#d2dbe5; --line-strong:#a0afc0; --row-line:#e0e6ee;
 --blue:#205fa9; --blue-dark:#164f94; --blue-soft:#e9f1fb; --hover:#f0f5fb;
 --topbar:#fff; --table-head:#eaf0f7; --panel-edge:#bcc9d8;
 --section-band:#edf2f8; --control-edge:#879bb2; --section-fill:#fafbfd;
 --primary-fill:#245fa6; --primary-hover:#194d8b;
}
body { font-family:'Segoe UI',system-ui,-apple-system,sans-serif; font-size:15px; }
:focus-visible { outline:3px solid var(--blue); outline-offset:3px; }
.content { max-width:1520px; padding:32px clamp(20px,3vw,48px) 64px; }
.app-header { background:var(--topbar); backdrop-filter:none; border-top:3px solid var(--primary-fill); }
.header-inner { min-height:72px; max-width:1520px; margin:auto; gap:28px; flex-wrap:nowrap; }
.header-brand { min-width:140px; max-width:230px; }
.header-brand strong { font-size:22px; font-weight:700; letter-spacing:-.6px; }
.header-brand span { font-size:11px; letter-spacing:.02em; }
.header-nav-link { font-size:14px; font-weight:600; padding:0 15px; }
.header-nav-link.active { color:var(--blue-dark); }
.header-search { max-width:230px; }
.header-search input { width:100%; font-size:13px; }
.header-tools { gap:12px; }
.header-menu-panel,.account-menu-panel { border-color:var(--panel-edge); border-radius:6px; }
.header-menu-panel a,.account-menu-panel a,.account-menu-panel button { min-height:44px; font-size:14px; }
.account-menu summary strong { max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.account-menu summary small { font-size:11px; }
.page-heading { padding-bottom:22px; margin-bottom:24px; border-bottom:1px solid var(--line); }
.page-heading h1 { font-size:30px; font-weight:650; line-height:1.25; }
.page-heading p { max-width:800px; margin-top:8px; font-size:14px; line-height:1.6; }
.page-heading .eyebrow { display:block; text-transform:none; letter-spacing:0; margin-bottom:8px; }
.heading-actions { gap:10px; }
.button { min-height:44px; font-size:14px; font-weight:600; box-shadow:none; border-radius:6px; }
.button:hover { transform:none; }
.button.primary { color:white; background:var(--primary-fill); }
.button.primary:hover { background:var(--primary-hover); }
.button.danger { color:white; background:#a82e31; }
.button.small { min-height:38px; }
.button[disabled] { opacity:.65; cursor:wait; }
.card,.study-workspace { border:1px solid var(--panel-edge); box-shadow:var(--shadow); }
.card-head,.study-toolbar { background:var(--section-band); border-bottom:1px solid var(--panel-edge); border-radius:7px 7px 0 0; padding:20px 24px; }
.card-head h2 { font-size:18px; font-weight:650; }
.card-head p { font-size:13px; margin-top:5px; }
.overview-bar { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin:0 0 26px; border:0; background:none; }
.overview-bar > div { display:flex; flex-direction:column; align-items:flex-start; min-width:0; gap:8px; padding:20px 24px; background:var(--surface); border:1px solid var(--panel-edge); border-radius:8px; margin:0; }
.overview-bar > div:last-child { border-right:1px solid var(--panel-edge); }
.overview-bar span { font-size:14px; color:var(--field-ink); font-weight:600; }
.overview-bar strong { font-size:34px; line-height:1.1; font-weight:650; color:var(--ink); }
.overview-bar small { color:var(--muted); font-size:12px; }
.recovery-notice { display:flex; justify-content:space-between; gap:16px; align-items:center; padding:13px 18px; margin-bottom:22px; border-left:3px solid var(--blue); background:var(--blue-soft); font-size:13px; }
.recovery-notice a { color:var(--blue-dark); font-weight:650; white-space:nowrap; }
.study-workspace { margin-bottom:24px; }
.study-filters .table-search { width:min(29vw,320px); min-width:200px; }
.study-filters select,.table-search { border-color:var(--control-edge); }
.table-search input { color:var(--ink); min-height:44px; }
.table-search:focus-within { outline:2px solid var(--blue); outline-offset:2px; }
.study-filters select { min-height:44px; max-width:240px; }
.list-options { display:flex; align-items:center; gap:16px; padding:10px 24px; border-bottom:1px solid var(--line); color:var(--muted); font-size:13px; flex-wrap:wrap; }
.list-options > label { display:flex; align-items:center; gap:10px; margin-left:auto; }
.list-options select { min-height:36px; padding:4px 8px; border:1px solid var(--line-strong); border-radius:5px; color:var(--ink); background:var(--input); }
.list-options .button { min-height:32px; font-size:12px; }
.study-list-head,.study-row { grid-template-columns:minmax(280px,1fr) 190px 64px 82px 72px 45px; gap:18px; padding-left:24px; padding-right:24px; }
.study-list-head { min-height:42px; font-size:12px; font-weight:600; letter-spacing:0; text-transform:none; background:var(--table-head); }
.study-row { min-height:112px; padding-top:18px; padding-bottom:18px; border-bottom:1px solid var(--line); }
.study-row:nth-child(odd) { background:var(--surface-2); }
.study-row:hover { background:var(--hover); }
.study-identity-cell > strong { color:var(--blue-dark); font-size:14px; }
.study-identity-cell > span { font-size:15px; line-height:1.45; white-space:normal; font-weight:600; margin:6px 0; }
.study-identity-cell > small { font-size:12px; }
.study-number { font-size:19px; font-weight:600; }
.study-row > .status { white-space:normal; justify-self:start; text-align:left; justify-content:flex-start; line-height:1.45; }
.row-open-link { min-height:44px; display:grid; align-content:center; font-size:14px; }
.status { font-size:12px; font-weight:600; padding:5px 9px; }
.section-nav { top:calc(var(--header-height) + 8px); border-color:var(--panel-edge); background:var(--surface); }
.section-nav a { font-size:14px; }
.section-nav a.is-current { color:var(--blue-dark); border-bottom-color:var(--blue); background:var(--blue-soft); }
.anchor-section { scroll-margin-top:calc(var(--header-height) + 80px); }
.content .form-section { margin:20px; padding:24px; border:1px solid var(--panel-edge); border-radius:7px; background:var(--section-fill); }
.content .form-section:last-of-type { border-bottom:1px solid var(--panel-edge); }
.section-title { padding:0 0 17px 0; margin-bottom:24px; border-bottom:1px solid var(--line); }
.section-title > span { display:none; }
.section-title h2 { font-size:18px; font-weight:650; }
.section-title p { font-size:13px; margin-top:5px; }
.form-grid { gap:22px 24px; }
.field > span:first-child { color:var(--ink); font-size:14px; font-weight:600; }
.field input:not([type=checkbox]):not([type=radio]),.field select,.field textarea { background:var(--input); border:1px solid var(--control-edge); border-radius:5px; min-height:46px; color:var(--ink); }
.field input:focus,.field select:focus,.field textarea:focus { outline:2px solid var(--blue); outline-offset:2px; box-shadow:none; }
.field small { line-height:1.5; color:var(--muted); }
.field-history-button { min-height:30px; font-size:12px; color:var(--blue-dark); background:transparent; border:1px solid var(--line-strong); }
.form-actions { background:var(--section-band); border-top:1px solid var(--panel-edge); box-shadow:0 -3px 14px #00000012; }
.save-guidance[data-dirty=true] { color:var(--amber); font-weight:600; }
.change-reason-panel { background:var(--section-band); border-top:1px solid var(--panel-edge); }
.simple-study-hero { margin-bottom:20px; }
.study-stats-bar { margin:22px 0; border-color:var(--panel-edge); }
.study-stats-bar strong { color:var(--ink); font-size:26px; }
.study-stats-bar small { color:var(--muted); font-size:12px; }
.study-core-grid { gap:20px; }
.study-core-grid > .card { margin-top:0; }
.preserve-lines { white-space:pre-line; overflow-wrap:anywhere; }
.study-treatment-card { grid-column:1 / -1; }
.treatment-plan { display:grid; grid-template-columns:1fr 1fr; gap:20px; padding:22px 24px; }
.treatment-plan > div { padding:18px; background:var(--section-fill); border:1px solid var(--line); border-radius:6px; min-width:0; }
.treatment-plan h3 { margin:0 0 12px; font-size:14px; color:var(--muted); }
.treatment-plan p { margin:0; color:var(--field-ink); font-size:15px; }
.plain-detail-list dt { color:var(--muted); font-size:12px; }
.plain-detail-list dd { font-size:14px; line-height:1.5; }
.patient-view-toolbar { display:flex; flex-wrap:wrap; gap:16px; align-items:center; padding:12px 24px; border-bottom:1px solid var(--line); }
.patient-view-toolbar label { display:flex; align-items:center; gap:9px; font-size:14px; font-weight:600; }
.patient-view-toolbar input { width:18px; height:18px; accent-color:var(--primary-fill); }
.patient-view-toolbar > span { color:var(--muted); font-size:12px; }
.patient-view-toolbar > span:last-child { margin-left:auto; }
.patient-table-scroll { max-height:70vh; scrollbar-width:auto; }
.patient-all-table { font-size:14px; }
.patient-all-table th { font-size:13px; text-transform:none; letter-spacing:0; padding:16px; background:var(--table-head); border-bottom:2px solid var(--panel-edge); }
.patient-all-table td { padding:16px; border-bottom:1px solid var(--line); }
.patient-all-table .sticky-actions { display:table-cell; left:auto; bottom:auto; min-width:270px; width:270px; backdrop-filter:none; }
.patient-all-table .patient-actions { flex-wrap:nowrap; }
.patient-all-table tbody tr:nth-child(even) td { background:var(--surface-2); }
.patient-all-table tbody tr:hover td,.patient-all-table tbody tr:target td { background:var(--hover); }
.patient-all-table th:nth-child(6),.patient-all-table td:nth-child(6),.patient-all-table th:nth-child(13),.patient-all-table td:nth-child(13),.patient-all-table th:nth-child(24),.patient-all-table td:nth-child(24) { border-left:2px solid var(--panel-edge); }
.patient-all-table.summary-view tr > :not(:nth-child(1)):not(:nth-child(3)):not(:nth-child(7)):not(:nth-child(8)):not(:nth-child(9)):not(:nth-child(10)):not(:last-child):not(.radiology-column) { display:none; }
.document-slot { background:var(--section-fill); border:1px solid var(--panel-edge); }
.document-slot-head { padding-bottom:14px; border-bottom:1px solid var(--line); }
.admin-tabs { display:flex; gap:6px; overflow:auto; margin:-8px 0 28px; padding:0 0 12px; border-bottom:1px solid var(--line); }
.admin-tabs a { min-height:42px; padding:9px 14px; border:1px solid transparent; border-radius:5px; white-space:nowrap; text-decoration:none; color:var(--muted); font-size:14px; }
.admin-tabs a[aria-current=page] { background:var(--surface); color:var(--blue-dark); border-color:var(--panel-edge); font-weight:600; }
.admin-tabs a:hover { background:var(--hover); }
.admin-action-list { border-color:var(--panel-edge); }
.admin-action-list > a { padding:20px 22px; }
.admin-action-list strong { font-size:16px; font-weight:600; }
.admin-action-list span { font-size:13px; }
.admin-action-list b { font-size:14px; }
th { font-size:12px; letter-spacing:0; text-transform:none; }
.flash { border-radius:6px; box-shadow:none; font-size:14px; }
.flash [data-dismiss] { min-width:40px; min-height:40px; }
.error-page { max-width:660px; margin:60px auto; padding:32px; border:1px solid var(--panel-edge); background:var(--surface); border-radius:8px; }
.error-page p { color:var(--muted); }
.one-time-secret { overflow-wrap:anywhere; }
.one-time-secret h2 { margin-top:0; font-size:20px; }
.one-time-secret > .button { margin-top:18px; }
.auth-card { border:1px solid var(--panel-edge); border-radius:10px; box-shadow:0 16px 50px #00000020; }
.auth-heading h2 { font-size:28px; font-weight:650; letter-spacing:-.5px; }
.auth-logo .brand-mark { display:none; }
.auth-logo small { color:var(--muted); opacity:1; }
@media (max-width:1180px) {
 .header-inner { gap:14px; } .header-search { max-width:170px; }
 .study-list-head,.study-row { grid-template-columns:minmax(240px,1fr) 160px 55px 76px 65px 35px; gap:12px; }
}
@media (max-width:980px) {
 .header-inner { min-height:64px; } .header-search { max-width:none; }
 .header-nav-link { padding:0 12px; } .study-list-head { display:none; }
 .study-row { grid-template-columns:minmax(0,1fr) auto; }
 .study-number { font-size:16px; } .study-number::before { font-size:12px; }
 .study-filters { flex-wrap:wrap; }
 .study-toolbar { flex-direction:column; align-items:stretch; gap:14px; }
 .study-filters .table-search { width:auto; flex:1; }
 .overview-bar { gap:10px; } .overview-bar > div { padding:18px; }
 .patient-all-table .sticky-actions { position:static; box-shadow:none; }
}
@media (max-width:690px) {
 .content { padding:22px 14px 44px; } .page-heading h1 { font-size:26px; }
 .overview-bar { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
 .overview-bar strong { font-size:30px; } .overview-bar small { font-size:11px; }
 .card-head,.study-toolbar,.study-row { padding:18px 16px; }
 .study-row > .status { max-width:118px; font-size:11px; }
 .study-identity-cell > span { font-size:14px; }
 .list-options { padding:10px 16px; gap:8px; }
 .list-options > label { width:100%; margin:0; justify-content:space-between; }
 .content .form-section { margin:12px; padding:18px 16px; }
 .section-title { padding-bottom:14px; } .section-title h2 { font-size:17px; }
 .treatment-plan { grid-template-columns:1fr; padding:16px; }
 .patient-view-toolbar { padding:12px 16px; gap:10px; }
 .patient-view-toolbar > span:last-child { margin-left:0; }
 .patient-all-table .sticky-patient { min-width:145px; max-width:145px; }
 .study-stats-bar { grid-template-columns:repeat(4,minmax(0,1fr)); }
 .study-stats-bar > div { padding:12px 6px; min-width:0; }
 .study-stats-bar small { font-size:10px; white-space:normal; }
 .recovery-notice { flex-direction:column; align-items:flex-start; gap:8px; }
 .auth-card { padding:25px 22px; } .admin-tabs { margin-bottom:22px; }
 .heading-actions .table-search { min-width:0; width:100%; }
 .form-grid { gap:20px; } .error-page { margin:20px auto; padding:24px; }
}
@media print {
 .admin-tabs,.list-options,.patient-view-toolbar,.recovery-notice { display:none; }
 .patient-table-scroll { max-height:none; overflow:visible; } .card { border-color:#aaa; }
}
.content .access-card { padding:24px; }
.access-card h2 { margin-top:0; }
.access-card form > .button { margin-top:18px; }
.arm-option { padding:18px 0; border-bottom:1px solid var(--border); margin-bottom:18px; }
.arm-option > button { justify-self:start; }
@media (max-width:600px) { .content .access-card { padding:18px; } }
