:root[data-theme="dark"]{color-scheme:dark;--ink:#b8cbd4;--text:#e0e5e7;--paper:#20272b;--surface:#293237;--secondary:#303c43;--muted:#a7b3ba;--line:#465259;--ui-3e3b37:#e0e5e7;--ui-3e4140:#e0e5e7;--ui-414846:#e0e5e7;--ui-42403c:#e0e5e7;--ui-435963:#c0cdd2;--ui-435b66:#c0cdd2;--ui-435d69:#c0cdd2;--ui-435f6b:#c0cdd2;--ui-44626f:#c0cdd2;--ui-476570:#c0cdd2;--ui-4c6773:#c0cdd2;--ui-4c6976:#c0cdd2;--ui-536f7b:#c0cdd2;--ui-5b7884:#c0cdd2;--ui-5c5a56:#c0cdd2;--ui-5e5851:#c0cdd2;--ui-606e76:#c0cdd2;--ui-615f5b:#c0cdd2;--ui-626b6e:#c0cdd2;--ui-63615d:#c0cdd2;--ui-637c86:#c0cdd2;--ui-666460:#c0cdd2;--ui-668692:#a3b3bb;--ui-668794:#a3b3bb;--ui-676561:#c0cdd2;--ui-696763:#c0cdd2;--ui-69767a:#c0cdd2;--ui-697773:#c0cdd2;--ui-6b767b:#c0cdd2;--ui-6c665e:#c0cdd2;--ui-6c6a66:#c0cdd2;--ui-6d706b:#c0cdd2;--ui-6e6c68:#c0cdd2;--ui-6e7473:#c0cdd2;--ui-706e6a:#c0cdd2;--ui-707a7e:#c0cdd2;--ui-716b63:#c0cdd2;--ui-72706c:#c0cdd2;--ui-727773:#c0cdd2;--ui-74726e:#c0cdd2;--ui-756f67:#c0cdd2;--ui-767470:#c0cdd2;--ui-78664f:#c0cdd2;--ui-797773:#c0cdd2;--ui-7a7874:#c0cdd2;--ui-7c7a76:#c0cdd2;--ui-7f7d79:#a3b3bb;--ui-805d3d:#c0cdd2;--ui-807e7a:#a3b3bb;--ui-809ba5:#a3b3bb;--ui-818689:#a3b3bb;--ui-84827e:#a3b3bb;--ui-85837f:#a3b3bb;--ui-878581:#a3b3bb;--ui-8a8884:#a3b3bb;--ui-8b8985:#a3b3bb;--ui-8c8a86:#a3b3bb;--ui-8e8c88:#a3b3bb;--ui-908e8a:#a3b3bb;--ui-918f8b:#a3b3bb;--ui-946d43:#c0cdd2;--ui-95938f:#a3b3bb;--ui-965d4f:#c0cdd2;--ui-9aa4a3:#a3b3bb;--ui-9b5143:#c0cdd2;--ui-9f9d99:#a3b3bb;--ui-a6a4a0:#a3b3bb;--ui-a9a7a3:#a3b3bb;--ui-aba9a5:#a3b3bb;--ui-afada9:#56636a;--ui-b2b0ac:#56636a;--ui-bbc5c7:#56636a;--ui-bcbab6:#56636a;--ui-bfbdb9:#56636a;--ui-c2c0bc:#56636a;--ui-c4cccf:#56636a;--ui-cac8c4:#56636a;--ui-cdcbc7:#56636a;--ui-cdd8d9:#56636a;--ui-d0ceca:#56636a;--ui-d4d2ce:#56636a;--ui-d5d3cf:#56636a;--ui-d7bdb3:#56636a;--ui-d8dedb:#56636a;--ui-d9d5cc:#56636a;--ui-d9d7d3:#56636a;--ui-dad8d4:#56636a;--ui-ddd8d0:#56636a;--ui-ddd9d1:#56636a;--ui-dedcd8:#56636a;--ui-deded7:#56636a;--ui-dfddd9:#252d32;--ui-e1dfdb:#252d32;--ui-e1ebed:#252d32;--ui-e4e2de:#252d32;--ui-e6ebea:#252d32;--ui-e7e5e1:#252d32;--ui-e8e6e2:#252d32;--ui-eaf0f1:#252d32;--ui-ebe9e5:#252d32;--ui-ece6dc:#252d32;--ui-eceae6:#252d32;--ui-eeebe5:#252d32;--ui-efefea:#252d32;--ui-f0eeea:#252d32;--ui-f0f1ed:#252d32;--ui-f1efeb:#252d32;--ui-f2f0ec:#252d32;--ui-f3f1ed:#252d32;--ui-f3f4f1:#252d32;--ui-f4f2ee:#252d32;--ui-f5f3ef:#252d32;--ui-f6f4f0:#252d32;--ui-f7f5f1:#252d32;--ui-f9f7f2:#20272b;--ui-fcfaf6:#20272b;--ui-fcfbf8:#20272b;--ui-fdfbf7:#20272b;--ui-fff5e8:#252d32;--ui-fffefa:#20272b;--ui-ffffff:#20272b;}

:root[data-theme="dark"] body{background:#20272b;color:#e0e5e7}
:root[data-theme="dark"] :is(button,input,select,dialog,.panel){color:#d6e0e5}
:root[data-theme="dark"] :is(input,select,dialog,.studioDialog,.referenceDialog,#surfacePanel){background:#293237;border-color:#465259}
:root[data-theme="dark"] :is(.primary,button[aria-pressed=true],.startButton){background:#526f7d!important;color:#fff!important;border-color:#526f7d!important}
:root[data-theme="dark"] :is(.canvasTabs,.toolbar,#phoneViewMenu>div,.contextTools,.canvasHistory,.walkTop>span,.walkHelp){background:#293237;color:#d6e0e5;border-color:#465259}
:root[data-theme="dark"] .canvasTabs button[aria-pressed=true]{background:#526f7d!important;color:#fff!important}
:root[data-theme="dark"] :is(.aboutIdentity img,.startArt img){filter:brightness(1.5)}
:root[data-theme="dark"] .preferenceRow input{background:radial-gradient(circle at 14px 22px,#bfcbd0 0 9px,transparent 10px),linear-gradient(#465259,#465259) center/44px 26px no-repeat}
:root[data-theme="dark"] .preferenceRow input:checked{background:radial-gradient(circle at 34px 22px,#fff 0 9px,transparent 10px),linear-gradient(#6e93a2,#6e93a2) center/44px 26px no-repeat}
:root[data-theme="dark"] #walkMiniMap{background:#293237}
:root[data-theme="dark"] #walkMiniMap path,:root[data-theme="dark"] #walkMapPanel path{stroke:#b8cbd4}
:root[data-theme="dark"] #walkMiniMap svg,:root[data-theme="dark"] #walkMapPanel svg{background:#293237}

:root[data-theme="dark"] #plan>rect:first-of-type,:root[data-theme="dark"] #magnifierPlan>rect:first-of-type{fill:#20272b}
:root[data-theme="dark"] :is(#plan,#magnifierPlan) pattern[id$="grid"] path{stroke:#465259}
:root[data-theme="dark"] :is(#designLinework,#magnifierPlan) line[stroke="#475351"]{stroke:#b5c3c4}
:root[data-theme="dark"] :is(#designLinework,#magnifierPlan)>text[fill="#6b6965"]{fill:#c0cdd2;stroke:#20272b}
:root[data-theme="dark"] .aboutContacts a,:root[data-theme="dark"] .settingsLinks a{color:#b8cbd4}
:root[data-theme="dark"] input[data-preference]{background:radial-gradient(circle at 14px 22px,#bfcbd0 0 9px,transparent 10px),linear-gradient(#465259,#465259) center/44px 26px no-repeat!important}
:root[data-theme="dark"] input[data-preference]:checked{background:radial-gradient(circle at 34px 22px,#fff 0 9px,transparent 10px),linear-gradient(#6e93a2,#6e93a2) center/44px 26px no-repeat!important}
:root[data-theme="dark"]{--ui-3f5965:#c0cdd2;--ui-435963:#c0cdd2;--ui-526e7b:#c0cdd2;--ui-5c7885:#c0cdd2;--ui-66757c:#c0cdd2;--ui-bdc9ce:#56636a;--ui-cbd5d8:#56636a;--ui-d9d8d2:#56636a;--ui-e4ecef:#252d32;--ui-f7f5f1:#252d32;--ui-fbfaf7:#20272b;}
:root[data-theme="dark"] #walkJoystick{background:#293237b3;border-color:#71899477}
/* Walkthrough action: preserve readable contrast independently of generic theme tokens. */
:root[data-theme="dark"] #enterWalk{background:#526f7d;color:#ffffff;-webkit-text-fill-color:currentColor;border-color:#526f7d;opacity:1;transition:none}
:root[data-theme="dark"] #enterWalk:hover:not(:disabled){background:#466370;border-color:#466370}
:root[data-theme="dark"] #enterWalk:disabled{background:#38474e;color:#c4d0d6;-webkit-text-fill-color:currentColor;border-color:#56666f;opacity:1;cursor:default}

/* Canvas actions need opaque dark surfaces over reference images. */
:root[data-theme="dark"] :is(#lineworkToggle,#phoneFit){background:#293237;color:#e0e5e7;-webkit-text-fill-color:currentColor;border-color:#71838d;opacity:1}
:root[data-theme="dark"] :is(#lineworkToggle,#phoneFit):hover{background:#35434b}
:root[data-theme="dark"] #lineworkToggle[aria-pressed="true"]{background:#526f7d;color:#fff;-webkit-text-fill-color:currentColor;border-color:#8aa4b0}
:root[data-theme="dark"] :is(#lineworkToggle,#phoneFit):focus-visible{outline:2px solid #b8cbd4;outline-offset:3px}

/* Explicit overlay surfaces: never pair inherited light text with a translucent white panel. */
:root[data-theme="dark"] #editorMain :is(.selectedChip:not([hidden]),#wallConfirm,#referencePickBar,#notice.error,.toolbar),
:root[data-theme="dark"] :is(.walkTop>button,.walkTop>span,.walkHelp,#studioStatus){background:#293237;color:#e0e5e7;-webkit-text-fill-color:currentColor;border-color:#71838d;backdrop-filter:none;-webkit-backdrop-filter:none}
:root[data-theme="dark"] #editorMain .selectedChip:not([hidden]):hover{background:#35434b}
:root[data-theme="dark"] #wallDrawReadout{background:#526f7d;color:#fff}
:root[data-theme="dark"] #confirmWall{background:#526f7d;color:#fff;border-color:#8aa4b0}
:root[data-theme="dark"] :is(.contextTools,.canvasHistory,#phoneViewMenu,.inspector,.furnitureCatalog,#referenceDialog,#surfacePanel,.studioDialog) button:not(.primary):not([aria-pressed="true"]){background:#293237;color:#e0e5e7;-webkit-text-fill-color:currentColor;border-color:#71838d}
:root[data-theme="dark"] :is(.contextTools,.canvasHistory,#phoneViewMenu,.inspector,.furnitureCatalog,#referenceDialog,#surfacePanel,.studioDialog) button:not(.primary):not([aria-pressed="true"]):hover:not(:disabled){background:#35434b}
:root[data-theme="dark"] button:disabled{opacity:1;color:#aebbc2;-webkit-text-fill-color:currentColor;background:#303a40;border-color:#52616a}
:root[data-theme="dark"] #wallMagnifier .lensCrosshair{border-color:#c0cdd2}
:root[data-theme="dark"] .lensCrosshair::before,:root[data-theme="dark"] .lensCrosshair::after{background:#c0cdd2}

:root[data-theme="dark"] :is(#walkMiniMap,#walkMapPanel) [data-map-room]{stroke:none}

/* Tool popovers pair the surface and text, including the label itself. */
:root[data-theme="dark"] #editorMain :is(#newDoorLabel,#newWindowLabel){background:#293237;color:#e0e5e7;-webkit-text-fill-color:currentColor;border-color:#71838d;backdrop-filter:none;-webkit-backdrop-filter:none}
:root[data-theme="dark"] :is(#newDoorLabel,#newWindowLabel) :is(select,option){background:#20272b;color:#e0e5e7;-webkit-text-fill-color:currentColor;border-color:#71838d}

/* Stronger control outlines; drawing geometry and disabled/selected states stay intact. */
:root{--control-outline:#83949a;--control-icon:#405d69}
:root[data-theme="dark"]{--control-outline:#91a3ad;--control-icon:#e1eaf0}
:is(button,a.button):not(:disabled):not(.primary):not([aria-pressed="true"]):not(.active):not(.chosen)>.icon{color:var(--control-icon)}
:is(#editorBar,.headerUtilities,.canvasHistory,.contextTools,.panelHead,.previewFoot) :is(button,a.button):not(:disabled){border-color:var(--control-outline)}
button.iconButton:not(:disabled),#editorMain .toolbar{border-color:var(--control-outline)}
