/* Theme controls and palette, shared across the Factory Toolbox projects. */
:root{color-scheme:light}
.theme-toggle{--theme-travel:28px;position:relative;isolation:isolate;display:inline-flex;align-items:center;justify-content:space-around;flex:0 0 auto;direction:ltr;width:62px;height:36px;padding:3px;border:1px solid #cbd9df;border-radius:20px;background:#e9f0f3;color:#738791;cursor:pointer;vertical-align:middle}
.theme-toggle .theme-thumb{position:absolute;z-index:-1;top:4px;left:4px;width:26px;height:26px;background:#fff;border-radius:50%;box-shadow:0 1px 4px #172f3d22;transition:transform .2s ease,background .2s ease;pointer-events:none}
.theme-toggle svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
.theme-toggle .theme-sun{color:#b77b19}.theme-toggle:focus-visible{outline:3px solid #e49b58;outline-offset:3px}.theme-toggle:hover{border-color:#0b9a90}
@media screen{
 html[data-theme=dark]{color-scheme:dark;--ink:#e0ebf1;--muted:#a4bac7;--line:#324957;--panel:#192b37;--bg:#101c26;--orange:#ff9a63;--orange-dark:#e48852;--teal:#42c4b8;--teal-soft:#173b3b;--navy:#0c1720}
 html[data-theme=dark] .theme-toggle{background:#1c3545;border-color:#3b5b6c;color:#819aa9}
 html[data-theme=dark] .theme-toggle .theme-thumb{transform:translateX(var(--theme-travel));background:#355c71;box-shadow:none}
 html[data-theme=dark] .theme-toggle .theme-sun{color:#819aa9}html[data-theme=dark] .theme-toggle .theme-moon{color:#a5e7ef}
}
@media(max-width:760px){.theme-toggle{--theme-travel:20px;width:48px;height:30px;padding:2px}.theme-toggle .theme-thumb{top:3px;left:3px;width:22px;height:22px}.theme-toggle svg{width:16px;height:16px}}
@media(prefers-reduced-motion:reduce){.theme-toggle .theme-thumb{transition:none}}
@media print{.theme-toggle{display:none!important}}

.unit-toggle{--unit-travel:28px;position:relative;isolation:isolate;display:inline-flex;align-items:center;justify-content:space-around;flex:0 0 auto;direction:ltr;width:62px;height:36px;padding:3px;border:1px solid #cbd9df;border-radius:20px;background:#e9f0f3;color:#738791;cursor:pointer;vertical-align:middle;font:700 11px/1 inherit;letter-spacing:.02em}
.unit-toggle .unit-thumb{position:absolute;z-index:-1;top:4px;left:4px;width:26px;height:26px;background:#fff;border-radius:50%;box-shadow:0 1px 4px #172f3d22;transition:transform .2s ease,background .2s ease;pointer-events:none}
.unit-toggle span.unit-mm,.unit-toggle span.unit-in{pointer-events:none;color:#738791}
.unit-toggle span.unit-mm{color:#172f3d}
.unit-toggle:focus-visible{outline:3px solid #e49b58;outline-offset:3px}.unit-toggle:hover{border-color:#0b9a90}
html[data-unit=in] .unit-toggle .unit-thumb{transform:translateX(var(--unit-travel))}
html[data-unit=in] .unit-toggle span.unit-mm{color:#738791}
html[data-unit=in] .unit-toggle span.unit-in{color:#172f3d}
@media screen{
 html[data-theme=dark] .unit-toggle{background:#1c3545;border-color:#3b5b6c;color:#819aa9}
 html[data-theme=dark] .unit-toggle .unit-thumb{background:#355c71;box-shadow:none}
 html[data-theme=dark] .unit-toggle span.unit-mm{color:#e0ebf1}
 html[data-theme=dark] .unit-toggle span.unit-in{color:#819aa9}
 html[data-theme=dark][data-unit=in] .unit-toggle span.unit-mm{color:#819aa9}
 html[data-theme=dark][data-unit=in] .unit-toggle span.unit-in{color:#e0ebf1}
}
@media(max-width:760px){.unit-toggle{--unit-travel:20px;width:48px;height:30px;padding:2px;font-size:9px}.unit-toggle .unit-thumb{top:3px;left:3px;width:22px;height:22px}}
@media(prefers-reduced-motion:reduce){.unit-toggle .unit-thumb{transition:none}}
@media print{.unit-toggle{display:none!important}}

/* Screen-only overrides: hardcoded light colors that CSS variables alone don't reach. */
@media screen{
html[data-theme=dark] body{background:var(--bg);color:var(--ink)}
html[data-theme=dark] .topbar{background:var(--panel)}
html[data-theme=dark] .language-trigger{background:#152430}
html[data-theme=dark] .language-trigger:hover,html[data-theme=dark] .language-trigger[aria-expanded="true"]{background:var(--panel)}
html[data-theme=dark] .language-menu{background:var(--panel);border-color:#3b5567;box-shadow:0 12px 30px #0007}
html[data-theme=dark] .language-menu button:hover,html[data-theme=dark] .language-menu button:focus-visible{background:#173b3b}
html[data-theme=dark] .language-menu button[aria-selected="true"]{color:#79ece8}
html[data-theme=dark] .sidebar{background:#152430}
html[data-theme=dark] .tool-button{background:var(--panel);border-color:#3b5567;color:var(--muted)}
html[data-theme=dark] .tool-button.active{background:#3d2a1f}
html[data-theme=dark] .field-grid label,html[data-theme=dark] label{color:var(--muted)}
html[data-theme=dark] input,html[data-theme=dark] select{background:#152430;border-color:#3b5567;color:var(--ink)}
html[data-theme=dark] .danger-button{background:#3a2420;border-color:#5c332c;color:#f0a49a}
html[data-theme=dark] .danger-button:hover{background:#48281f}
html[data-theme=dark] .icon-text-button,html[data-theme=dark] .secondary-button,html[data-theme=dark] .icon-button{background:var(--panel);border-color:#3b5567;color:var(--muted)}
html[data-theme=dark] .message.error{color:#f0a49a}
html[data-theme=dark] .message.success{color:#7fe0b8}
html[data-theme=dark] .workspace{background:#0d1922}
html[data-theme=dark] .export-button{background:var(--teal);border-color:var(--teal);color:#04211d}
html[data-theme=dark] .canvas-wrap{background-color:#111f2a;background-image:radial-gradient(#25384a 1px,transparent 1px);border-color:#324957;box-shadow:inset 0 0 30px #0006}
html[data-theme=dark] .empty-graphic span{border-color:#3b5567;background:rgba(25,43,55,.65)}
html[data-theme=dark] .empty-graphic span:nth-child(2){border-color:#4c6b7d}
html[data-theme=dark] .coord-readout,html[data-theme=dark] .zoom-hint{color:var(--muted);background:rgba(16,28,38,.82);border-color:#3b5567}
html[data-theme=dark] footer{background:var(--panel);color:var(--muted)}
}
