/* v3.0.18: additive visual theme; no business-logic changes. */
.theme-picker{display:flex;align-items:center;gap:7px;margin:0;font-size:11px;color:var(--muted);white-space:nowrap}
.theme-picker select{width:auto;min-width:94px;padding:7px 26px 7px 9px;border-radius:8px;font-size:11px;background:var(--white);color:var(--ink)}
:root[data-theme="dark"]{color-scheme:dark;--red:#f04450;--red-dark:#ff737d;--red-soft:#3b2228;--ink:#eff1f5;--char:#d8dce4;--muted:#a9b1bf;--line:#3c434e;--bg:#14171d;--white:#222730;--shadow:0 8px 28px rgba(0,0,0,.27);--border:#3c434e;--red-deep:#ff737d}
:root[data-theme="dark"] body{background:var(--bg);color:var(--ink)}
:root[data-theme="dark"] :is(.login-shell,.sidebar,.topbar,.card,.metric,.qty,.table-wrap,.modal,.workspace-tabs button,.view-role,.register-filterbar,.plan-config-section,.plan-check,.photo-grid a,.project-portal-card,.project-group,.editor-row,.editor-lab-row,.column-picker-menu,.dropdown-menu,.map-panel,.project-hero,.record-summary,.info,.checkbox-list,.code-box,.register-filterbar,.plan-marker,.plan-cluster-compact,.plan-cluster-card,.plan-cluster-map,.plan-preview-map,.no-results){background-color:var(--white);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] :is(input,select,textarea,option){background-color:#292f39;color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] :is(input,select,textarea)::placeholder{color:#9da6b4}
:root[data-theme="dark"] :is(.secondary,.danger,.workspace-tabs button,.pagination button,.view-role,.link-btn,.icon-btn,.row-actions button){background-color:#292f39;border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] :is(.secondary,.link-btn,.danger,.danger-text){color:#ff7b85}
:root[data-theme="dark"] :is(th,thead th){background-color:#313039;color:#e7eaf0;border-color:var(--line)}
:root[data-theme="dark"] :is(td,tr,table){border-color:var(--line);color:var(--ink)}
:root[data-theme="dark"] :is(tr:hover,tbody tr:hover){background-color:#303641}
:root[data-theme="dark"] :is(.info,.record-summary,.register-filterbar,.code-box,.muted-box,.empty-state,.table-note,.no-results){background-color:#292f39;color:var(--muted);border-color:var(--line)}
:root[data-theme="dark"] :is(.pill.neutral,.user-chip,.workspace-tabs button.active,nav button.active,nav button:hover){background-color:#3b2228;color:#ff9099}
:root[data-theme="dark"] :is(.pill,.card .kicker,.qty b){color:#ff828c}
:root[data-theme="dark"] :is(.result-status.recent){background:#18374b;color:#90d6ff;border-color:#35657c}
:root[data-theme="dark"] :is(.result-status.due){background:#483a20;color:#ffdb85;border-color:#6d572b}
:root[data-theme="dark"] :is(.result-status.overdue){background:#4a2428;color:#ffa0a7;border-color:#7b3b43}
:root[data-theme="dark"] :is(.result-status.complete){background:#1d4033;color:#8ce0b3;border-color:#346a52}
:root[data-theme="dark"] :is(.plan-marker,.plan-cluster-map,.plan-cluster-compact,.plan-cluster-card){background:#292f39;color:#f3f4f7}
:root[data-theme="dark"] :is(.leaflet-container,.location-map,.plan-preview-map){background:#252c35}
:root[data-theme="dark"] :is(.leaflet-control-zoom a,.leaflet-control-layers,.leaflet-popup-content-wrapper,.leaflet-popup-tip){background:#292f39;color:#f3f4f7;border-color:#46505e}
:root[data-theme="dark"] :is(.leaflet-control-attribution){background:rgba(35,40,49,.86);color:#c6cbd3}
:root[data-theme="dark"] :is(.leaflet-control-attribution a){color:#9dccff}
:root[data-theme="dark"] :is(.error){background:#48242b;color:#ffb3ba}
:root[data-theme="dark"] :is(.toast){background:#343b46;color:#fff}
:root[data-theme="dark"] :is(.modal-backdrop){background:rgba(0,0,0,.72)}
:root[data-theme="dark"] :is(.brand-stripe){filter:brightness(.7)}
:root[data-theme="dark"] :is(.project-group-title,.section-title,.modal-head,.modal-actions,.card-actions,.sidebar-footer){border-color:var(--line)}
:root[data-theme="dark"] :is(.register-filter-summary b,.project-hero h3,.plan-cluster-map span,.code-box p){color:var(--ink)}
:root[data-theme="dark"] :is(.register-filterbar input,.register-filterbar select){background:#292f39}
@media(max-width:650px){.theme-picker{font-size:0}.theme-picker select{min-width:80px}.topbar-right{gap:6px}}

/* v3.0.19 compact appearance control */
.theme-toggle{width:30px;height:30px;min-width:30px;display:inline-flex;align-items:center;justify-content:center;padding:0;border:1px solid var(--line);border-radius:8px;background:var(--white);color:var(--ink);cursor:pointer;box-shadow:none;font-size:18px;line-height:1}
.theme-toggle:hover{border-color:var(--red);color:var(--red)}
.theme-toggle:focus-visible{outline:2px solid var(--red);outline-offset:2px}
:root[data-theme="dark"]{--text:#eff1f5;--panel:#222730;--nav:#14171d;--nav2:#20252d;color-scheme:dark}
:root[data-theme="dark"] body{background:#14171d!important;color:#eff1f5}
:root[data-theme="dark"] :is(.topbar,.filters,.workspace-tabs,.project-open-zone,.project-portal-card,.card,.metric,.qty,.table-wrap,.modal,.modal-body,.modal-head,.modal-actions,.project-group,.project-hero,.editor-section,.sample-editor,.record-sample,.record-summary-grid>div,.record-note,.photo-pick,.location-readout,.frequency-list,.frequency-list>div,.control-stream,.control-volume-card,.project-group-title,.column-picker-menu,.dropdown-menu,.record-detail-list,.record-detail-list>div,.plan-config-section,.plan-check,.plan-cluster-card,.plan-cluster-compact,.plan-cluster-map,.info,.empty-state,.no-results,.map-panel,.view-role,.checkbox-list,.code-box,.register-filterbar,.login-shell){background:#222730!important;color:#eff1f5!important;border-color:#424b58!important}
:root[data-theme="dark"] :is(.topbar h2,h1,h2,h3,h4,h5,h6,strong,b,label,.metric b,.qty b,.field-title,.section-title h3,.record-summary-grid b,.record-detail-list b,.project-hero h3,.project-group-title h3,.control-volume-main b){color:#f1f3f7}
:root[data-theme="dark"] :is(p,.muted,.meta,.kicker,.record-sample-meta,.record-detail-list span,.record-summary-grid span,.editor-section-head span,.control-volume-main span,.map-legend){color:#b6bfcd}
:root[data-theme="dark"] :is(table,tbody,tr,td,th,thead,thead tr){border-color:#424b58;color:#eff1f5}
:root[data-theme="dark"] :is(thead,thead tr,th){background:#303844!important;color:#f2f4f8!important}
:root[data-theme="dark"] tbody tr:nth-child(even){background:#262d37}
:root[data-theme="dark"] tbody tr:hover{background:#343e4b!important}
:root[data-theme="dark"] :is(input,textarea,select,option,[contenteditable="true"]){background:#2b333e!important;color:#f1f3f7!important;border-color:#566171!important}
:root[data-theme="dark"] :is(input,textarea)::placeholder{color:#aab5c4}
:root[data-theme="dark"] :is(.secondary,.link-btn,.icon-btn,.row-actions button,.pagination button,.theme-toggle,.coord-btn){background:#303844!important;color:#f1f3f7!important;border-color:#566171!important}
:root[data-theme="dark"] :is(.primary,.workspace-tabs button.active){background:#d71929!important;color:#fff!important}
:root[data-theme="dark"] .sidebar{background:linear-gradient(180deg,#17191c,#202328)!important}
:root[data-theme="dark"] .sidebar :is(button,span,strong){color:#f2f3f6}
:root[data-theme="dark"] .view-as-banner{background:#43262b!important;color:#ffb8bf!important;border-color:#70434a!important}
:root[data-theme="dark"] :is(.pill.due,.pill.ahead,.pill.neutral,.record-chip,.result-status){border-color:#566171}
:root[data-theme="dark"] .pill.due{background:#543039;color:#ffc3c8}
:root[data-theme="dark"] .pill.ahead{background:#1b4637;color:#a5e8c4}
:root[data-theme="dark"] .record-chip{background:#3d2932;color:#f4e4e7}
:root[data-theme="dark"] :is(.modal-backdrop){background:rgba(0,0,0,.78)}
:root[data-theme="dark"] :is(.leaflet-popup-content-wrapper,.leaflet-popup-tip,.leaflet-control-zoom a){background:#2b333e!important;color:#f1f3f7!important}
:root[data-theme="dark"] a:not(.primary){color:#ff8993}
@media(max-width:650px){.topbar-right{flex-direction:row;align-items:center;gap:6px}.theme-toggle{width:28px;height:28px;min-width:28px}}

/* v3.0.20 — coherent dark surfaces and readable tables (no data/logic changes) */
:root[data-theme="dark"]{--bg:#171b22;--white:#252b35;--ink:#f2f4f8;--char:#e2e7ef;--muted:#b5bfcd;--line:#414a58;--border:#414a58;--red-soft:#45272e;--shadow:0 6px 20px rgba(0,0,0,.14);color-scheme:dark}
:root[data-theme="dark"] body{background:#171b22!important;color:#f2f4f8!important}
:root[data-theme="dark"] .content{background:transparent!important;color:#f2f4f8!important}
:root[data-theme="dark"] .topbar{background:#232831!important;border-bottom:1px solid #3c4553!important}
:root[data-theme="dark"] .filters{background:#232831!important;border-color:#414a58!important;box-shadow:none!important}
:root[data-theme="dark"] .filters label{color:#e0e5ed!important}
:root[data-theme="dark"] :is(.project-group,.project-open-zone,.project-group-title,.project-admin-actions,.project-portal-card,.project-open-head,.project-open-foot,.project-card-badges,.workspace-tabs,.workspace-tab-group,.workspace-tab-section,.project-hero,.project-header,.plan-config-section,.plan-config-card,.test-plan-section,.test-plan-card,.test-plan-header,.test-control-row,.test-control-location,.control-stream,.control-volume-card,.editor-section,.record-summary,.record-summary-grid>div,.record-detail-list>div,.modal,.modal-body,.modal-head,.modal-actions,.card,.metric,.qty,.table-wrap,.info,.register-filterbar,.column-picker-menu,.dropdown-menu,.import-metrics>div,.project-document-icon,.project-documents-empty,.empty-state,.no-results,.table-note){background-color:#252b35!important;background-image:none!important;color:#f2f4f8!important;border-color:#414a58!important}
:root[data-theme="dark"] :is(.project-group-title,.project-group-title h3,.project-portal-card h3,.project-open-head h3,.project-hero h3,.section-title h3,.card h3,.card h4,.metric b,.qty b,.test-control-location h4,.modal h3,.field-title){color:#f3f5f9!important}
:root[data-theme="dark"] :is(.project-open-head p,.project-open-foot span,.project-hero .meta,.card p,.card span,.metric span,.qty span,.muted,.table-note,.project-group p,.plan-config-section p){color:#b9c4d3!important}
:root[data-theme="dark"] :is(.project-admin-actions,.project-open-foot){border-color:#414a58!important}
:root[data-theme="dark"] :is(table,thead,tbody,tfoot){background:#252b35!important;color:#eef2f7!important;border-color:#414a58!important}
:root[data-theme="dark"] :is(thead,thead tr,thead th,th){background:#343d4b!important;background-image:none!important;color:#f6f8fb!important;border-color:#4a5565!important}
:root[data-theme="dark"] tbody tr, :root[data-theme="dark"] tbody tr:nth-child(odd){background:#252b35!important;color:#f2f4f8!important}
:root[data-theme="dark"] tbody tr:nth-child(even){background:#2d3541!important;color:#f2f4f8!important}
:root[data-theme="dark"] tbody tr:hover{background:#394556!important}
:root[data-theme="dark"] :is(td,td *,th,th *){color:inherit}
:root[data-theme="dark"] td{color:#f0f3f8!important;border-color:#424c5a!important}
:root[data-theme="dark"] td :is(a,.link-btn,.danger-text){color:#ff8d98!important}
:root[data-theme="dark"] td :is(.pill,.record-chip,.result-status){color:#ffb4bd!important}
:root[data-theme="dark"] :is(.workspace-tabs button,.workspace-tab-group button){background:transparent!important;color:#dce3ee!important;border-color:#414a58!important}
:root[data-theme="dark"] :is(.workspace-tabs button.active,.workspace-tab-group button.active){background:#b81829!important;color:#fff!important;border-color:#e34b5c!important}
:root[data-theme="dark"] :is(.workspace-tabs button:hover,.workspace-tab-group button:hover){background:#394251!important;color:#fff!important}
:root[data-theme="dark"] :is(.secondary,.row-actions button,.icon-btn,.theme-toggle,.pagination button){background:#323b49!important;color:#f1f4f8!important;border:1px solid #536071!important}
:root[data-theme="dark"] :is(.secondary:hover,.row-actions button:hover,.icon-btn:hover,.theme-toggle:hover){background:#404b5b!important;border-color:#8290a3!important}
:root[data-theme="dark"] :is(input,textarea,select,option){background:#303947!important;color:#f3f5f9!important;border-color:#566273!important}
:root[data-theme="dark"] :is(input,textarea)::placeholder{color:#aebaca!important}
:root[data-theme="dark"] :is(.project-card-badges .pill,.pill){background:#442931!important;color:#ffacb6!important}
:root[data-theme="dark"] .project-admin-actions{background:#252b35!important}
:root[data-theme="dark"] :is(.sidebar,.sidebar-footer){background:#1b2028!important;border-color:#3d4653!important}
:root[data-theme="dark"] .sidebar nav button:not(.active){color:#dce3ed!important}
:root[data-theme="dark"] .sidebar nav button.active{background:#49252d!important;color:#ffabb4!important}
:root[data-theme="dark"] :is(.login-shell,.login-card){background:#1b2028!important;color:#f2f4f8!important}
:root[data-theme="dark"] :is(.modal-backdrop){background:rgba(5,8,13,.8)!important}
:root[data-theme="dark"] :is(.map-panel,.leaflet-container,.plan-preview-map){background:#28313c!important}
:root[data-theme="dark"] :is(.leaflet-popup-content-wrapper,.leaflet-popup-tip){background:#303947!important;color:#f2f4f8!important}
:root[data-theme="dark"] :is(.pill.ahead,.result-status.complete){background:#214638!important;color:#a5efc8!important}
:root[data-theme="dark"] :is(.pill.due,.result-status.due){background:#4d3d24!important;color:#ffe0a1!important}
:root[data-theme="dark"] :is(.error,.result-status.overdue){background:#512c33!important;color:#ffc3c9!important}
:root[data-theme="dark"] :is(.topbar p,.nav-section-label){color:#b8c3d2!important}
@media(max-width:650px){:root[data-theme="dark"] .filters{padding:12px 16px!important}}

/* v3.0.21: dark-mode contrast and consistent charcoal canvas */
:root[data-theme="dark"]{--bg:#1b2028;--white:#252c36;--line:#404b59;--muted:#bdc7d4;--v301-soft:#252c36;--v301-line:#404b59;--v3-line:#404b59}
:root[data-theme="dark"] :is(html,body,#app,.app-shell,.main,.main-content,.content,.page,.page-content,.workspace-content,.workspace-body,.dashboard-content){background-color:#1b2028!important;color:#e8edf3!important}
:root[data-theme="dark"] :is(.table-wrap,.table-wrap table,table,tbody){background-color:#252c36!important}
:root[data-theme="dark"] :is(.table-wrap tbody tr,.table-wrap tbody tr:nth-child(odd),tbody tr:nth-child(odd)){background-color:#252c36!important}
:root[data-theme="dark"] :is(.table-wrap tbody tr:nth-child(even),tbody tr:nth-child(even)){background-color:#2d3541!important}
:root[data-theme="dark"] :is(.table-wrap tr:hover,.table-wrap tbody tr:hover,tbody tr:hover,.test-plan-config-table tr:hover){background:#394657!important;background-color:#394657!important;background-image:none!important;color:#e8edf3!important}
:root[data-theme="dark"] :is(.table-wrap tr:hover td,.table-wrap tbody tr:hover td,tbody tr:hover td,.test-plan-config-table tr:hover td,.table-wrap tr:hover td *,tbody tr:hover td *){background:#394657!important;background-color:#394657!important;background-image:none!important;color:#e8edf3!important}
:root[data-theme="dark"] :is(.table-wrap tr:hover a,tbody tr:hover a,.table-wrap tr:hover .danger-text,tbody tr:hover .danger-text){color:#ff9aa3!important}
:root[data-theme="dark"] :is(.table-wrap tr:hover button,tbody tr:hover button){background:#303b4a!important;color:#f2f5f9!important;border-color:#657286!important}
:root[data-theme="dark"] :is(.project-open-zone,.project-admin-actions,.project-group,.project-group-title,.project-portal-card,.project-open-head,.project-open-foot,.project-card-badges,.workspace-nav-home,.workspace-nav-group,.workspace-nav-v3,.workspace-tabs,.workspace-tab-group,.workspace-tab-section,.card,.metric,.qty,.table-wrap,.filters,.modal,.modal-body,.modal-head,.modal-actions,.test-control-row,.test-plan-config-table,.frequency-matrix-row,.editor-coordinate-dialog,.test-plan-suggestion-setting.enabled,.test-plan-suggestion-setting.disabled){background:#252c36!important;background-image:none!important;color:#e8edf3!important;border-color:#404b59!important}
:root[data-theme="dark"] :is(.project-open-zone:hover,.project-portal-card:hover,.test-control-row:hover,.frequency-matrix-row:hover){background:#303a48!important;background-image:none!important}
:root[data-theme="dark"] :is(.project-admin-actions,.project-open-foot,.card-actions){background:#29313d!important}
:root[data-theme="dark"] :is(.workspace-group-label,.project-open-zone p,.project-portal-card p,.project-group p,.table-note,.info,.muted,.help-text,.hint,.form-hint,.subtitle){color:#bdc7d4!important}
:root[data-theme="dark"] :is(.workspace-nav-v3 button,.workspace-tabs button){color:#e1e7f0!important}
:root[data-theme="dark"] :is(.workspace-nav-v3 button:hover,.workspace-tabs button:hover){background:#394657!important;color:#fff!important}
:root[data-theme="dark"] :is(.modal input,.modal textarea,.modal select,.editor-coordinate-dialog input,.editor-coordinate-dialog select){background:#303a48!important;color:#f0f4f8!important}
:root[data-theme="dark"] .modal:has(#labImportPreview) .result-status.import-awaiting{background:#343a44!important;color:#d0d5dd!important}
:root[data-theme="dark"] .modal:has(#labImportPreview) .result-status.import-manual{background:#243e60!important;color:#b9d8ff!important}
