/* 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;--surface:#192b37;--panel:#192b37;--bg:#101c26;--canvas:#111f2a;--teal:#42c4b8;--teal-dark:#6ad8cb;--teal-soft:#173b3b;--orange:#ff9a63;--orange-dark:#e48852;--blue:#83b6e2;--danger:#ff9a91;--shadow:0 8px 24px #0004}
 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: paper, result geometry and printed output retain their colors. */
@media screen{
html[data-theme=dark] .topbar{background-color:#192b37}
html[data-theme=dark] .language-trigger{background-color:#21364d}
html[data-theme=dark] .language-trigger:hover,html[data-theme=dark] .language-trigger[aria-expanded="true"]{background-color:#192b37}
html[data-theme=dark] .language-menu{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:#192b37}
html[data-theme=dark] .language-menu button:hover,html[data-theme=dark] .language-menu button:focus-visible{background-color:#193c3b}
html[data-theme=dark] .language-menu button[aria-selected="true"]{color:#79ece8}
html[data-theme=dark] .sidebar{background-color:#21364d}
html[data-theme=dark] .drop-zone{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:#193c3b}
html[data-theme=dark] .drop-zone:hover,html[data-theme=dark] .drop-zone.drag{background-color:#3d3025}
html[data-theme=dark] .upload-icon{background-color:#3d3025}
html[data-theme=dark] .file-item{background-color:#152530;border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360}
html[data-theme=dark] .remove-file{color:#a9bfcc}
html[data-theme=dark] .remove-file:hover{color:#e08d85}
html[data-theme=dark] .sheet-stock{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:#21364d}
html[data-theme=dark] .sheet-stock-title{color:#a9bfcc}
html[data-theme=dark] .sheet-row{border-bottom-color:#375360}
html[data-theme=dark] .remove-sheet{color:#a9bfcc}
html[data-theme=dark] .remove-sheet:hover:not(:disabled){color:#e08d85;background-color:#3d3025}
html[data-theme=dark] .add-sheet-button{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:#192b37}
html[data-theme=dark] label{color:#a9bfcc}
html[data-theme=dark] input,html[data-theme=dark] select{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:#192b37}
html[data-theme=dark] .progress-panel{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:#192b37}
html[data-theme=dark] .progress-track{background-color:#152530}
html[data-theme=dark] .message.error{color:#de8e87}
html[data-theme=dark] .message.success{color:#80e5c3}
html[data-theme=dark] .workspace{background-color:#152530}
html[data-theme=dark] .icon-button,html[data-theme=dark] .secondary-button{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:#192b37;color:#a9bfcc}
html[data-theme=dark] .canvas-wrap{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:#21364d;background-image:radial-gradient(#152530 1px, transparent 1px)}
html[data-theme=dark] .empty-graphic span{border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360;background-color:rgba(25,43,55,0.65)}
html[data-theme=dark] .empty-graphic span:nth-child(2){border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360}
html[data-theme=dark] .zoom-hint{color:#a9bfcc;background-color:rgba(25,43,55,0.82);border-top-color:#375360;border-right-color:#375360;border-bottom-color:#375360;border-left-color:#375360}
html[data-theme=dark] .metrics > div{background-color:#192b37}
html[data-theme=dark] .metric-icon.usage{background-color:#3d3025}
html[data-theme=dark] .metric-icon.parts{color:#9baeca;background-color:#21364d}
html[data-theme=dark] .metric-icon.waste{color:#d4ba91;background-color:#3d3025}
html[data-theme=dark] footer{background-color:#192b37;color:#a9bfcc}
html[data-theme=dark] body{background:#101c26;color:#e0ebf1}
html[data-theme=dark] .primary-button,html[data-theme=dark] .primary,html[data-theme=dark] .drawing-tools button[aria-pressed=true],html[data-theme=dark] .axis-buttons button.active{background:#197c76;color:#fff}
html[data-theme=dark] .primary-button:hover,html[data-theme=dark] .primary:hover{background:#226e69}
html[data-theme=dark] .language-menu button[aria-selected=true]{background:#226e69;color:#fff}
html[data-theme=dark] .brand-mark,html[data-theme=dark] .section-heading>span,html[data-theme=dark] .empty-state>b{background:#244553;color:#fff}
html[data-theme=dark] .loading{background:rgba(17,31,42,.96)}
html[data-theme=dark] .orientation-axes text{stroke:#111f2a}
html[data-theme=dark] .drawing-paper-wrap>svg{background:#fff;color:#172e3a;color-scheme:light}
html[data-theme=dark] .empty-graphic i,html[data-theme=dark] .empty-graphic span{background:rgba(33,60,72,.75)}

}

@media(max-width:760px){.header-actions,.topbar-actions,.top-actions{gap:8px}}

@media screen{
 html[data-theme=dark] .sidebar{background:#13232e}
 html[data-theme=dark] .workspace{background:#101c26}
 html[data-theme=dark] .drop-zone{background:#152d38}
 html[data-theme=dark] .drop-zone:hover{background:#1b3d43}
 html[data-theme=dark] .brand-mark i{border-color:#e9f3f6}
 html[data-theme=dark] .canvas-wrap{background-color:#111f2a;background-image:radial-gradient(#304959 1px,transparent 1px)}
}
@media screen{html[data-theme=dark] .primary,html[data-theme=dark] .primary-button{background:#b65122;color:white}html[data-theme=dark] .primary:hover,html[data-theme=dark] .primary-button:hover:not(:disabled){background:#9f451c}}
