/* HUA YI Theme Switcher v1.1 — display only */
:root,[data-hy-theme="light"]{color-scheme:light;--hy-bg:#edf2f8;--hy-surface:#fff;--hy-sidebar:#f7f7f8;--hy-text:#192d4a;--hy-muted:#62758e;--hy-border:#d4dfed;--hy-input:#fff;--hy-accent:#315eab;--hy-hover:#e8eef7;--hy-head:#192d4d;--hy-soft:#f3f7fc}
[data-hy-theme="dark"]{color-scheme:dark;--hy-bg:#101827;--hy-surface:#202e43;--hy-sidebar:#152236;--hy-text:#eaf1fc;--hy-muted:#b3c3d7;--hy-border:#41536e;--hy-input:#273a53;--hy-accent:#8eb9f9;--hy-hover:#304560;--hy-head:#0c1628;--hy-soft:#273a53}
[data-hy-theme="green"]{color-scheme:light;--hy-bg:#e8f4ee;--hy-surface:#fff;--hy-sidebar:#e0f0e8;--hy-text:#174c41;--hy-muted:#557e72;--hy-border:#c7e2d5;--hy-input:#fff;--hy-accent:#157b65;--hy-hover:#cce9de;--hy-head:#126451;--hy-soft:#f1f9f5}
html,body{background:var(--hy-bg)!important;color:var(--hy-text)!important}
.hy-sidebar,.hy-mobile{background:var(--hy-sidebar)!important;color:var(--hy-text)!important;border-color:var(--hy-border)!important}
.hy-link,.hy-brand,.hy-iconbtn,.hy-sidebar-bottom,.hy-sidebar-bottom a{color:var(--hy-text)!important}
.hy-link:hover,.hy-iconbtn:hover,.hy-link.selected{background:var(--hy-hover)!important}
.hy-navlabel,.muted,.subtitle,.sub,.footer{color:var(--hy-muted)!important}
.head,header:not(.hy-mobile){background:var(--hy-head)!important;color:#fff!important}
.head h1,.head p,header:not(.hy-mobile) h1,header:not(.hy-mobile) a{color:#fff!important}
.panel,.card,.metric,.stat,.kpi,.tile,.machine:not(.connected):not(.stopped),.box-card,.modal-content,main>section,.dt-card{background:var(--hy-surface)!important;color:var(--hy-text)!important;border-color:var(--hy-border)!important}
input,select,textarea{background:var(--hy-input)!important;color:var(--hy-text)!important;border-color:var(--hy-border)!important}
input::placeholder,textarea::placeholder{color:var(--hy-muted)!important}
table,th,td,tr{color:var(--hy-text);border-color:var(--hy-border)!important}
thead,thead th{background:var(--hy-soft)!important}
[data-hy-theme="dark"] .machine:not(.connected):not(.stopped),[data-hy-theme="dark"] .chart,[data-hy-theme="dark"] .notice{background:var(--hy-surface)!important;color:var(--hy-text)!important;border-color:var(--hy-border)!important}
[data-hy-theme="dark"] .metric:nth-child(n),[data-hy-theme="dark"] .machine.connected{background:var(--hy-surface)!important;color:var(--hy-text)!important}
[data-hy-theme="dark"] .pill:not(.ok):not(.stopped){background:var(--hy-hover)!important;color:var(--hy-text)!important}
[data-hy-theme="dark"] .metric small,[data-hy-theme="dark"] .machine small,[data-hy-theme="dark"] .legend,[data-hy-theme="dark"] .panel small{color:var(--hy-muted)!important}
[data-hy-theme="dark"] .chart{background:repeating-linear-gradient(to bottom,var(--hy-surface) 0,var(--hy-surface) 46px,var(--hy-border) 47px,var(--hy-surface) 48px)!important}
[data-hy-theme="green"] .metric:nth-child(n){background:#f3faf6!important}
[data-hy-theme="green"] .machine:not(.stopped){background:#f3faf6!important}
[data-hy-theme="dark"] [style*="background:#fff"],[data-hy-theme="dark"] [style*="background: #fff"],[data-hy-theme="dark"] [style*="background:white"],[data-hy-theme="dark"] [style*="background: white"]{background:var(--hy-surface)!important}
[data-hy-theme="dark"] [style*="color:#15243c"],[data-hy-theme="dark"] [style*="color:#172c47"]{color:var(--hy-text)!important}
[data-hy-theme="dark"] .panel a,[data-hy-theme="dark"] main a{color:#a5ccff}
/* Fixed top-right button is independent of sidebar expansion */
.hy-theme-trigger{position:fixed;top:102px;right:20px;z-index:9997;display:flex;align-items:center;gap:7px;border:1px solid var(--hy-border);border-radius:999px;background:var(--hy-surface);color:var(--hy-text);padding:9px 13px;cursor:pointer;font:600 13px system-ui,sans-serif;box-shadow:0 4px 16px #0002}
.hy-theme-trigger:hover{background:var(--hy-hover)}
.hy-theme-panel{position:fixed;top:150px;right:20px;z-index:9998;width:min(320px,calc(100vw - 24px));padding:16px;border:1px solid var(--hy-border);border-radius:14px;background:var(--hy-surface);color:var(--hy-text);box-shadow:0 15px 50px #0005;display:none;font:14px system-ui,sans-serif}
.hy-theme-panel[data-open="true"]{display:block}.hy-theme-panel h3{margin:0 0 5px;font-size:16px}.hy-theme-panel p{font-size:12px;color:var(--hy-muted);margin:0 0 12px}.hy-theme-options{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.hy-theme-choice{padding:9px 4px 7px;border:2px solid var(--hy-border);border-radius:10px;background:var(--hy-surface);color:var(--hy-text);cursor:pointer;font:inherit;font-size:12px}.hy-theme-choice[aria-pressed="true"]{border-color:var(--hy-accent);font-weight:700}.hy-theme-swatch{display:block;height:28px;border-radius:6px;margin-bottom:6px}.hy-theme-close{position:absolute;right:10px;top:8px;border:0;background:transparent;color:var(--hy-text);cursor:pointer;font-size:20px}
@media(max-width:760px){.hy-theme-trigger{top:62px;right:10px;padding:8px 10px}.hy-theme-panel{top:105px;right:10px}}

/* HUA YI Theme Switcher - Fixed Position v1.2 */
html body #hyThemeTrigger.hy-theme-trigger {
    position: fixed !important;
    top: 102px !important;
    right: 20px !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 99997 !important;
}

html body #hyThemePanel.hy-theme-panel {
    position: fixed !important;
    top: 150px !important;
    right: 20px !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 99998 !important;
}

@media (max-width: 760px) {
    html body #hyThemeTrigger.hy-theme-trigger {
        top: 62px !important;
        right: 10px !important;
    }

    html body #hyThemePanel.hy-theme-panel {
        top: 105px !important;
        right: 10px !important;
    }
}

/* Theme button position lock v1.3 */
html body > #hyThemeTrigger {
    position: fixed !important;
    top: 16px !important;
    right: 20px !important;
    bottom: auto !important;
    left: auto !important;
    margin: 0 !important;
    transform: none !important;
    translate: none !important;
    z-index: 2147483646 !important;
}

html body > #hyThemePanel {
    position: fixed !important;
    top: 62px !important;
    right: 20px !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    translate: none !important;
    z-index: 2147483647 !important;
}

@media (max-width: 760px) {
    html body > #hyThemeTrigger {
        top: 12px !important;
        right: 10px !important;
    }

    html body > #hyThemePanel {
        top: 56px !important;
        right: 10px !important;
    }
}

/* Theme Switcher v1.4 - Header Position */
html body header.head #hyThemeTrigger.hy-theme-in-header {
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    translate: none !important;
    display: inline-flex !important;
    margin: 8px 0 0 !important;
    vertical-align: middle;
    z-index: auto !important;
}
