:root{
  --bg:#071016;
  --panel:#0c171e;
  --panel2:#09131a;
  --line:#283943;
  --line2:#1b2b34;
  --text:#eef4f7;
  --muted:#8296a2;
  --cyan:#24d7ff;
  --green:#43ef8a;
  --red:#ff4e59;
  --amber:#e1b963;
  --chart-grid:#1b2d36;
  --chart-axis:#334650;
  --chart-label:#718792;
  --chart-current:#24d7ff;
  --chart-target:#89a3af;
  --font-sans:"Inter","Helvetica Neue",Arial,"Noto Sans TC",sans-serif;
  --font-mono:"JetBrains Mono","Noto Sans Mono",monospace;
}
*{box-sizing:border-box;border-radius:0!important}
html,body{
  margin:0;
  width:100%;
  height:100%;
  overflow:hidden;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-sans);
  font-weight:300;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}
button,input,select,strong,b,h1,h2,h3{font-family:inherit;font-weight:300}
button{cursor:pointer;position:relative}
button:disabled{cursor:not-allowed;opacity:.42}
button.cmdBusy:disabled{opacity:1}
button.cmdBusy{
  border-color:var(--cyan)!important;
  color:var(--cyan)!important;
  background:#0c2029!important;
  overflow:hidden;
}
button.cmdBusy::after{
  content:"";
  position:absolute;
  left:-42%;
  bottom:0;
  width:42%;
  height:2px;
  background:var(--cyan);
  animation:cmdScan 1.05s linear infinite;
}
@keyframes cmdScan{to{left:100%}}
.interactionLocked{opacity:.48!important;pointer-events:none!important;cursor:not-allowed!important}
#controlHintStatus.busy{color:var(--cyan)}
#controlHintStatus.ok{color:var(--green)}
#controlHintStatus.err{color:#ff7c84}
#controlHintStatus.sync{color:var(--amber)}
.devNote{display:none!important}
.topline{height:4px;background:#ff3b31}
.topbar{
  height:60px;
  display:flex;
  align-items:center;
  padding:0 18px;
  border-bottom:1px solid #25343c;
  background:#090f12;
  font-family:var(--font-mono);
  font-size:11px;
  line-height:1;
  letter-spacing:.01em;
  white-space:nowrap;
}
.brandmark{width:3px;height:22px;background:#ff3b31;margin-right:12px}
.brand{letter-spacing:.015em;font-weight:400}
.topspacer{flex:1}
.toplink,.langbtn{
  border:0;
  background:none;
  color:#fff;
  padding:6px 8px;
  text-decoration:none;
  font-family:var(--font-mono);
  font-size:10px;
  line-height:1;
  font-weight:400;
  letter-spacing:.02em;
}
.toplink:hover,.langbtn:hover{color:var(--cyan)}
.cloudState{color:var(--muted);margin-left:10px;font-family:var(--font-mono);font-size:10px}.cloudState.good{color:var(--green)}.cloudState.err{color:var(--red)}
.op{color:var(--green);margin-left:10px;font-family:var(--font-mono);font-size:10px}
.shell{
  display:grid;
  grid-template-columns:245px minmax(560px,1fr) 300px;
  gap:12px;
  padding:10px;
  height:calc(100vh - 116px);
  min-height:0;
  overflow:hidden;
}
.panel{background:var(--panel);border:1px solid var(--line)}
.panelhead{
  display:flex;
  align-items:center;
  min-height:38px;
  padding:0 14px;
  border-bottom:1px solid var(--line2);
}
.paneltitle{font-size:14px;letter-spacing:.08em}
.micro{font-size:10px;color:var(--muted);letter-spacing:.06em}
.live{color:var(--cyan)}
.left{display:flex;flex-direction:column;padding:12px}
.areaLabel{font-size:10px;color:var(--muted);letter-spacing:.11em;margin-bottom:6px}
.areaSelect{
  width:100%;
  height:38px;
  background:#081117;
  border:1px solid #354650;
  color:var(--text);
  padding:0 9px;
  margin-bottom:14px;
  font-size:13px;
}
.device{
  border:1px solid #30424c;
  padding:13px 12px;
  margin-bottom:8px;
  background:#0a141a;
  cursor:pointer;
}
.device.active{border-color:var(--cyan);background:#0b1b22}
.devname{font-size:15px}
.devmeta{font-size:10px;color:var(--muted);margin-top:6px}
.dot{display:inline-block;width:7px;height:7px;background:var(--green);margin-right:6px}
.dot.off{background:#64747d}
.leftfoot{
  margin-top:auto;
  border-top:1px solid var(--line2);
  padding-top:14px;
  color:var(--muted);
  font-family:var(--font-mono);
  font-size:9px;
  line-height:1.7;
  letter-spacing:.18em;
}
.leftfoot strong{font-size:13px;color:#bac7cd;letter-spacing:.28em}
.center{display:grid;grid-template-rows:210px minmax(165px,1fr) 118px;gap:8px;min-height:0;overflow:hidden}
.tempPanel{padding:9px 10px;min-height:0;overflow:hidden}
.sectionbar{
  display:flex;
  align-items:center;
  min-height:27px;
  margin-bottom:6px;
}
.sectionTitle{font-size:15px;letter-spacing:.08em}
.sectionAccent{width:3px;height:18px;background:var(--cyan);margin-right:9px}
.sectionSpacer{flex:1}
.tempGrid{
  display:grid;
  grid-template-columns:1.25fr .75fr;
  gap:10px;
  height:calc(100% - 33px);
  min-height:0;
}
.tempGrid.single{grid-template-columns:1fr}
.tempReadout{
  min-height:0;
  height:100%;
  border:1px solid var(--line2);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
}
.label{font-size:11px;color:#8ea5b1;letter-spacing:.14em}
.current{
  font-size:clamp(46px,5vw,70px);
  line-height:1;
  margin:3px 0 10px;
  font-weight:300;
}
.targetBlock{
  width:62%;
  padding-top:7px;
  border-top:1px solid #41515a;
}
.targetValue{font-size:24px;margin-top:3px}
.output{
  min-height:0;
  height:100%;
  border:1px solid var(--line2);
  padding:13px;
}
.outputState{font-size:20px;margin:3px 0 10px}
.outputPower{font-size:28px;margin:2px 0 7px}
.powerbar{height:8px;border:1px solid #40525c;background:#15232b}
.powerfill{height:100%;width:0;background:var(--amber)}
.outputMeta{margin-top:10px;font-size:9px;color:var(--muted)}
.chartPanel{padding:10px;display:flex;flex-direction:column;min-height:0;overflow:hidden}
.chartHeader{display:flex;align-items:center;margin-bottom:10px}
.legend{display:flex;gap:18px;font-size:9px;color:#8ea5b1}
.legend i{display:inline-block;width:20px;height:2px;vertical-align:middle;margin-right:6px;background:var(--cyan)}
.legend i.targetLine{background:none;border-top:1px dashed #91a7b2}
canvas{
  display:block;
  width:100%;
  height:100%;
  min-height:0;
  flex:1;
  border:1px solid var(--line2);
  background:#08131a;
}
.chartNote{
  margin-top:7px;
  font-size:9px;
  color:var(--muted);
  letter-spacing:.04em;
}
.controlPanel{padding:8px 12px}
.controlHead{display:flex;align-items:center;margin-bottom:8px}
.authorityBadge{
  margin-left:8px;
  border:1px solid #3c4d57;
  padding:5px 8px;
  font-family:var(--font-mono);
  font-size:9px;
  letter-spacing:.05em;
}
.authorityBadge.remote{border-color:#2b7e61;color:var(--green)}
.setRow{
  display:grid;
  grid-template-columns:68px minmax(180px,1fr) 68px 180px;
  gap:10px;
  align-items:stretch;
}
.adjust,.setValue,.takeBtn{
  min-height:44px;
  border:1px solid #3a4c57;
  background:#101e27;
  color:var(--text);
}
.adjust{font-size:28px}
.adjust:hover,.takeBtn:hover{border-color:var(--cyan)}
.setValue{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:31px;
  cursor:pointer;
}
.setValue small{font-size:16px;color:#9fb1ba;margin-left:4px}
.takeBtn{color:var(--cyan);font-size:12px;letter-spacing:.04em}
.takeBtn.release{color:#9fb1ba}
.controlHint{
  text-align:center;
  margin-top:6px;
  font-size:9px;
  color:#718792;
  letter-spacing:.06em;
}
.right{display:flex;flex-direction:column;gap:10px;min-height:0;overflow:hidden}
.side{padding:12px}
.profileCard{border:1px solid #2d414c;padding:12px;margin-top:8px}
.profileCard.active{border-color:var(--cyan)}
.profileName{font-size:17px}
.profileMeta{font-size:10px;color:var(--muted);margin-top:7px}
.statusRow{
  display:flex;
  align-items:center;
  min-height:36px;
  border-bottom:1px solid #22333c;
  font-size:11px;
}
.statusRow:last-child{border-bottom:0}
.statusRow .value{margin-left:auto;text-align:right}
.good{color:var(--green)}.bad{color:var(--red)}
.rightActions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:10px}
.smallBtn{
  min-height:38px;
  border:1px solid #354852;
  background:#0c1920;
  color:#a9bac2;
}
.smallBtn.primary{border-color:#2e7186;color:var(--cyan)}
.bottomnav{
  position:fixed;
  left:0;right:0;bottom:0;
  height:52px;
  display:grid;
  grid-template-columns:repeat(4,minmax(120px,1fr));
  border-top:1px solid var(--line);
  background:#091116;
  z-index:20;
}
.navbtn{
  border:0;border-right:1px solid var(--line2);background:none;color:#8fa1ab;
  font-size:10px;letter-spacing:.05em;display:flex;align-items:center;
  justify-content:center;gap:8px
}
.navbtn svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.navbtn.active{color:var(--cyan);background:#0d1c24}
.toast{
  position:fixed;
  right:18px;
  bottom:70px;
  min-width:280px;
  max-width:440px;
  padding:12px 14px;
  border:1px solid #3b4d57;
  background:#0a151b;
  color:#c5d0d5;
  font-size:11px;
  z-index:50;
  opacity:0;
  transform:translateY(8px);
  pointer-events:none;
  transition:.16s ease;
}
.toast.show{opacity:1;transform:none}
.toast.ok{border-color:#297858;color:var(--green)}
.toast.err{border-color:#913943;color:#ff7c84}
.modalBack{
  position:fixed;inset:0;background:rgba(0,0,0,.68);
  display:none;align-items:center;justify-content:center;
  z-index:80;padding:18px;
}
.modalBack.show{display:flex}
.modal{
  width:min(520px,100%);
  border:1px solid #3b4d57;
  background:#0d181f;
  padding:20px;
}
.modalTitle{font-size:19px;letter-spacing:.05em;margin-bottom:10px}
.modalText{font-size:12px;line-height:1.65;color:#9fb0ba}
.modalInput{
  width:100%;
  height:48px;
  margin-top:14px;
  background:#071117;
  border:1px solid #3a4c57;
  color:#fff;
  padding:0 12px;
  font-size:20px;
}
.modalActions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}
.modalBtn{
  min-height:40px;
  border:1px solid #3a4c57;
  background:#101e27;
  color:#c8d2d7;
  padding:0 14px;
}
.modalBtn.primary{border-color:#2d768d;color:var(--cyan)}
.modalBtn.danger{border-color:#91434a;color:#ff7d84}
.drawer{
  position:fixed;top:62px;right:0;bottom:52px;
  width:min(480px,92vw);
  border-left:1px solid var(--line);
  background:#0a141a;
  z-index:60;
  transform:translateX(100%);
  transition:.18s ease;
  padding:16px;
  overflow:auto;
}
.drawer.show{transform:none}
.drawerHead{display:flex;align-items:center;border-bottom:1px solid var(--line);padding-bottom:12px}
.drawerClose{margin-left:auto;border:0;background:none;color:#9fb0b9;font-size:20px}
.diagRow{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0}
.diagBtn{height:40px;border:1px solid #2f7187;background:#0e2029;color:var(--cyan);padding:0 13px}
.auditRow{
  display:grid;grid-template-columns:80px 1fr;
  gap:8px;padding:7px 0;border-bottom:1px solid #17262e;
  font-size:10px;
}
.auditTime{color:#718993}.auditText{color:#a2b2ba}
.modeNotice{
  margin-top:14px;
  padding:10px;
  border:1px solid #675d37;
  color:#cdbf85;
  font-size:10px;
  line-height:1.55;
}
.flash{animation:flashborder .8s ease 2}
@keyframes flashborder{50%{border-color:var(--cyan)}}

.moduleHidden{display:none!important}
.deviceTypeBadge{
  display:inline-flex;align-items:center;min-height:24px;padding:0 8px;margin-left:8px;
  border:1px solid #354852;color:#90a8b4;font-family:var(--font-mono);
  font-size:9px;letter-spacing:.06em
}
.genericDevicePanel{padding:14px;display:flex;flex-direction:column;min-height:0}
.genericDeviceGrid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:10px}
.genericDeviceCell{border:1px solid var(--line2);background:#08131a;padding:12px;min-width:0}
.genericDeviceLabel{font-size:9px;color:var(--muted);letter-spacing:.1em;margin-bottom:6px}
.genericDeviceValue{font-family:var(--font-mono);font-size:12px;overflow-wrap:anywhere}
.capabilityList{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.capabilityChip{border:1px solid #304854;background:#09171e;color:#9fb5bf;padding:5px 7px;font-size:9px;font-family:var(--font-mono)}
.genericDeviceNotice{margin-top:12px;border:1px solid #5d5739;background:#15170f;color:#cfc287;padding:11px;font-size:10px;line-height:1.6}
.personnelPanel{min-height:0}
.personnelList{margin-top:4px;border-top:1px solid var(--line2)}
.personnelRow{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;min-height:38px;border-bottom:1px solid #22333c;font-family:var(--font-mono);font-size:10px}
.personnelIdentity{display:flex;align-items:center;min-width:0}
.personnelDot{width:8px;height:8px;margin-right:8px;background:#61737c;flex:0 0 auto}
.personnelDot.control{background:var(--green);box-shadow:0 0 7px rgba(67,239,138,.45)}
.personnelDot.local{background:var(--amber)}
.personnelDot.me{background:var(--cyan)}
.personnelName{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.personnelRole{color:var(--amber);white-space:nowrap}
.personnelRole.view{color:#8fa4ae}
.personnelMeta{font-size:9px;color:var(--muted);line-height:1.55;margin-top:9px}
.center.genericOnly{grid-template-rows:minmax(220px,1fr)}
.right{overflow-y:auto;scrollbar-width:thin}

@media(max-width:1150px){
  .shell{grid-template-columns:220px minmax(480px,1fr)}
  .right{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;overflow:visible}
  .personnelPanel{grid-column:1/-1}
}
@media(max-width:760px){
  html,body{height:auto;min-height:100%;overflow-x:hidden;overflow-y:auto}
  body{padding-bottom:62px}
  .topbar{
    position:sticky;top:0;z-index:35;height:auto;min-height:60px;padding:8px 10px;
    font-size:10px;flex-wrap:wrap;row-gap:2px
  }
  .brandmark{margin-right:7px}
  .brand{max-width:calc(100vw - 176px);overflow:hidden;text-overflow:ellipsis}
  .toplink,.langbtn{padding:5px 5px;font-size:9px;color:#fff}
  .cloudState{display:none}
  .op{order:5;width:100%;margin:0 0 0 13px;padding-bottom:2px;font-size:9px;overflow:hidden;text-overflow:ellipsis}
  .appView{height:auto;min-height:calc(100dvh - 136px);overflow:visible}
  .pageWrap{height:auto;min-height:calc(100dvh - 136px);overflow:visible;padding:10px 8px 18px}
  .shell{display:flex;flex-direction:column;height:auto;min-height:0;overflow:visible;padding:8px 8px 18px;gap:10px}
  .left{min-height:auto;order:0}
  .leftfoot{display:none}
  #devices{display:flex;gap:8px;overflow-x:auto;overscroll-behavior-x:contain;padding-bottom:3px;scrollbar-width:thin}
  .device{min-width:190px;margin-bottom:0;padding:11px}
  .center{display:flex;flex-direction:column;order:1;overflow:visible;gap:10px}
  .right{display:flex;flex-direction:column;order:2;overflow:visible;gap:10px}
  .right .panel{margin-bottom:0}
  .tempPanel,.chartPanel,.controlPanel,.genericDevicePanel{overflow:visible}
  .tempGrid{grid-template-columns:1fr;height:auto}
  .tempReadout,.output{height:auto;min-height:160px}
  .current{font-size:54px}
  .targetBlock{width:78%}
  .chartPanel{min-height:290px}
  .chartPanel canvas{height:220px;min-height:220px;flex:none}
  .chartHeader{align-items:flex-start;flex-wrap:wrap;gap:7px}
  .legend{width:100%;gap:12px;flex-wrap:wrap}
  .controlHead{align-items:flex-start;flex-wrap:wrap;gap:6px}
  #controlHintStatus{width:100%;line-height:1.45}
  .setRow{grid-template-columns:58px minmax(120px,1fr) 58px;gap:8px}
  .adjust,.setValue,.takeBtn{min-height:50px}
  .takeBtn{grid-column:1/-1}
  .controlHint{text-align:left;line-height:1.45}
  .sectionbar{flex-wrap:wrap}
  .genericDeviceGrid{grid-template-columns:1fr}
  .bottomnav{height:58px;grid-template-columns:repeat(4,1fr)}
  .navbtn{min-width:0;gap:4px;flex-direction:column;font-size:8px;padding:4px 1px}
  .navbtn svg{width:17px;height:17px}
  .toast{left:8px;right:8px;bottom:68px;min-width:0;max-width:none}
  .modalBack{align-items:flex-end;padding:0}
  .modal{width:100%;max-height:calc(100dvh - 68px);overflow:auto;padding:18px 14px;border-left:0;border-right:0;border-bottom:0}
  .modalActions{position:sticky;bottom:-18px;background:#0d181f;padding:12px 0 2px;flex-wrap:wrap}
  .modalBtn{min-height:46px;flex:1 1 130px}
  .drawer{top:0;bottom:58px;width:100%;padding-top:18px}
  .profileEditorBack{inset:0 0 58px;padding:0;align-items:stretch}
  .profileEditor{width:100%;height:100%;max-height:none;border-left:0;border-right:0;border-top:0}
  .profileEditorHead{position:sticky;top:0;background:#0b171e;z-index:2;flex-wrap:wrap}
  .profileEditorMeta{width:100%;margin:5px 0 0}
  .profileBank{grid-template-columns:1fr 1fr}
  .profileRunBar{flex-wrap:wrap}
  .profileRunBtn{min-height:44px;flex:1 1 130px}
  .profileRunInfo{width:100%;margin-left:0}
  .profileStepRow{grid-template-columns:1fr 1fr;gap:8px;padding:12px 0}
  .profileStepState{grid-column:1/-1}
  .profileStepAction{grid-column:1/-1;min-height:44px}
  .profileAdd{grid-template-columns:1fr 1fr}
  .profileAdd .profileStepAction{grid-column:1/-1}
  .historyHeader{display:none}
  .historyEvent{display:block;padding:12px;margin:8px;border:1px solid var(--line2);background:#09141a}
  .historyEvent span{display:block!important;margin:0 0 5px}
  .historyEvent span::before{content:attr(data-label);display:inline-block;width:70px;color:var(--muted);font-size:8px;letter-spacing:.08em}
  .settingsRow{grid-template-columns:1fr;gap:4px}
  .pageActions{width:100%;display:grid;grid-template-columns:1fr 1fr}
  .pageActions .actionBtn:last-child{grid-column:1/-1}
  .actionBtn{min-height:46px}
  .areaCard{padding:13px}
  .areaStats{gap:5px}
  .areaDeviceRow{align-items:flex-start;gap:8px}
  .areaDeviceMeta{text-align:right}
  .personnelRow{min-height:42px}
}
@media(max-width:430px){
  .brand{max-width:calc(100vw - 160px);font-size:9px}
  .toplink{font-size:9px}
  .gatewaySummary{grid-template-columns:1fr 1fr;gap:7px}
  .summaryCard{padding:10px}
  .summaryValue{font-size:25px}
  .areaGrid{grid-template-columns:1fr}
  .pageActions{grid-template-columns:1fr}
  .pageActions .actionBtn:last-child{grid-column:auto}
  .setRow{grid-template-columns:52px minmax(100px,1fr) 52px}
  .setValue{font-size:27px}
  .profileBank{grid-template-columns:1fr 1fr}
  .personnelRow{grid-template-columns:minmax(0,1fr);gap:3px;padding:7px 0}
  .personnelRole{padding-left:16px}
}

.appView{display:none;height:calc(100vh - 116px);overflow:hidden}
.appView.active{display:block}
.pageWrap{padding:12px;height:100%;min-height:0;overflow:hidden;display:flex;flex-direction:column}
.pageHead{display:flex;align-items:flex-end;gap:14px;margin-bottom:16px}
.pageHead h1{margin:0;font-size:26px;letter-spacing:.04em}
.pageHeadText{font-size:11px;color:var(--muted);line-height:1.55;max-width:720px}
.pageActions{margin-left:auto;display:flex;gap:8px;flex-wrap:wrap}
.actionBtn{
  min-height:40px;border:1px solid #3a4c57;background:#0d1a21;
  color:#c7d2d7;padding:0 14px;font-size:11px;letter-spacing:.04em
}
.actionBtn.primary{border-color:#2b7b94;color:var(--cyan)}
.gatewaySummary{display:grid;grid-template-columns:repeat(4,minmax(150px,1fr));gap:10px;margin-bottom:14px}
.summaryCard{border:1px solid var(--line);background:var(--panel);padding:14px}
.summaryLabel{font-size:9px;color:var(--muted);letter-spacing:.12em}
.summaryValue{font-size:30px;margin-top:8px}
.areaGrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:12px}
.areaCard{border:1px solid var(--line);background:var(--panel);padding:16px;cursor:pointer}
.areaCard:hover{border-color:#3d6374}
.areaCardHead{display:flex;align-items:center}
.areaName{font-size:19px}
.areaState{margin-left:auto;font-family:var(--font-mono);font-size:10px}
.areaState.online{color:var(--green)}
.areaStats{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;margin-top:18px}
.areaStat{border-top:1px solid var(--line2);padding-top:8px}
.areaStatValue{font-size:18px}
.areaStatLabel{font-size:9px;color:var(--muted);margin-top:3px}
.areaDevices{margin-top:14px;border-top:1px solid var(--line2)}
.areaDeviceRow{display:flex;align-items:center;padding:8px 0;border-bottom:1px solid #17262e;font-size:11px}
.areaDeviceRow:last-child{border-bottom:0}
.areaDeviceMeta{margin-left:auto;color:var(--muted);font-size:9px}
.emptyPanel{border:1px solid var(--line);background:var(--panel);padding:24px;color:var(--muted)}
.historyToolbar,.settingsGrid{display:grid;grid-template-columns:1fr 1fr;gap:12px;overflow:auto;min-height:0}
.historyToolbar{grid-template-columns:220px 260px 1fr;margin-bottom:12px}
.historySelect,.settingsInput{
  height:40px;border:1px solid #3a4c57;background:#081117;color:var(--text);
  padding:0 10px;font-size:12px
}
.historyTable{border:1px solid var(--line);background:var(--panel);flex:1;min-height:0;overflow:auto}
.historyHeader,.historyEvent{
  display:grid;grid-template-columns:110px 160px 180px minmax(260px,1fr);
  gap:12px;padding:10px 12px;border-bottom:1px solid var(--line2);font-size:10px
}
.historyHeader{color:var(--muted);letter-spacing:.08em}
.historyEvent:last-child{border-bottom:0}
.historyPrimary{color:#dce6ea}
.settingsCard{border:1px solid var(--line);background:var(--panel);padding:16px}
.settingsCard h2{margin:0 0 14px;font-size:16px;letter-spacing:.06em}
.settingsRow{display:grid;grid-template-columns:170px 1fr;gap:12px;align-items:center;padding:9px 0;border-bottom:1px solid var(--line2);font-size:11px}
.settingsRow:last-child{border-bottom:0}
.settingsHelp{font-size:9px;color:var(--muted);line-height:1.55;margin-top:4px}
.settingsDiag{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.gatewayFooter{margin-top:14px;font-size:9px;color:#647983;letter-spacing:.08em}
@media(max-width:850px){
 .gatewaySummary{grid-template-columns:1fr 1fr}
 .pageHead{align-items:flex-start;flex-direction:column}
 .pageActions{margin-left:0}
 .historyToolbar{grid-template-columns:1fr}
 .historyHeader,.historyEvent{grid-template-columns:110px 120px 150px minmax(220px,1fr)}
 .historyTable{overflow:auto}
 .settingsGrid{grid-template-columns:1fr}
}


.profileCurrentBar{height:5px;background:#1a2a32;margin-top:8px;overflow:hidden}
.profileCurrentFill{height:100%;background:var(--amber);width:0}
.profileEditorBack{position:fixed;inset:62px 0 58px;background:rgba(0,0,0,.76);display:none;align-items:center;justify-content:center;z-index:90;padding:16px}
.profileEditorBack.show{display:flex}
.profileEditor{width:min(980px,96vw);height:min(720px,92%);border:1px solid #3b4d57;background:#0b171e;display:flex;flex-direction:column;min-height:0}
.profileEditorHead{display:flex;align-items:center;padding:14px 16px;border-bottom:1px solid var(--line)}
.profileEditorTitle{font-size:18px;letter-spacing:.07em}
.profileEditorMeta{margin-left:14px;font-size:10px;color:var(--muted)}
.profileEditorClose{margin-left:auto;border:0;background:none;color:#a9b8c0;font-size:22px}
.profileEditorBody{padding:12px 14px;overflow:auto;min-height:0;flex:1}
.profileRule{border:1px solid #59603b;color:#d5c98a;background:#15190f;padding:9px 11px;font-size:10px;line-height:1.6;margin-bottom:10px}
.profileStepRow{display:grid;grid-template-columns:82px minmax(120px,1fr) 110px 110px 150px;gap:8px;align-items:center;padding:9px 0;border-bottom:1px solid var(--line2)}
.profileStepState{font-size:9px;letter-spacing:.08em;color:var(--muted)}
.profileStepState.current{color:var(--amber)}
.profileStepState.completed{color:#78909b}
.profileStepState.upcoming{color:var(--cyan)}
.profileField{height:38px;border:1px solid #3a4c57;background:#071117;color:var(--text);padding:0 9px;font-size:12px;width:100%}
.profileField:disabled{color:#7d8d95;background:#0b1419;border-color:#273640}
.profileStepAction{height:38px;border:1px solid #33758a;background:#0e222b;color:var(--cyan);font-size:10px}
.profileStepAction.skip{border-color:#936c31;color:#f2c76e;background:#251b0c}
.profileAdd{margin-top:14px;border-top:1px solid var(--line);padding-top:12px;display:grid;grid-template-columns:minmax(120px,1fr) 110px 110px 170px;gap:8px}
.profileAddTitle{grid-column:1/-1;font-size:12px;letter-spacing:.06em}
.profileEditorFoot{padding:10px 14px;border-top:1px solid var(--line);font-size:9px;color:var(--muted)}
@media(max-height:850px){
 .current{font-size:58px;margin:4px 0 10px}
 .tempReadout,.output{min-height:0}
 .outputState{margin-bottom:10px}
 .controlPanel{padding-top:7px;padding-bottom:8px}
 .pageHead{margin-bottom:8px}
}


.areaCardHeadActions{margin-left:auto;display:flex;gap:5px}
.iconBtn{width:28px;height:28px;border:1px solid #334650;background:#0b171e;color:#9db0b9;display:inline-flex;align-items:center;justify-content:center;padding:0}
.iconBtn:hover{border-color:var(--cyan);color:var(--cyan)}
.iconBtn.danger:hover{border-color:var(--red);color:#ff7b83}
.iconBtn svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.dangerBtn{border-color:#84353d!important;color:#ff737b!important}
.profileBank{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;padding:10px 14px;border-bottom:1px solid var(--line)}
.profileBankBtn{min-height:42px;border:1px solid #334650;background:#09151b;color:#98aab3;padding:6px 8px;text-align:left;font-size:10px}
.profileBankBtn.active{border-color:var(--cyan);color:var(--cyan);background:#0b1e26}
.profileBankBtn.running{box-shadow:inset 3px 0 0 var(--green)}
.profileRunBar{display:flex;gap:8px;padding:10px 14px;border-bottom:1px solid var(--line2)}
.profileRunBtn{height:38px;border:1px solid #33758a;background:#0e222b;color:var(--cyan);padding:0 15px}
.profileRunBtn.stop{border-color:#84353d;color:#ff737b}
.profileRunInfo{margin-left:auto;align-self:center;font-size:10px;color:var(--muted)}
.deleteConditions{margin-top:10px;border:1px solid #5b4b33;padding:9px;color:#cfbd83;font-size:10px;line-height:1.55}

.pairingSteps{margin-top:10px;border:1px solid #274754;padding:10px;color:#8fb9c9;font-size:10px;line-height:1.7;white-space:pre-line}
.pairingStatus{margin-top:10px;border:1px solid #40545e;padding:10px;min-height:38px;color:#24d7ff;font-size:10px;line-height:1.6;white-space:pre-line}
.pairingStatus.ok{border-color:#2b7253;color:#55e89a}
.pairingStatus.err{border-color:#7e3b42;color:#ff7d84}
.systemValue{font-family:var(--font-mono);color:#b8c9d1}
.systemValue.good{color:var(--green)}
.systemValue.warn{color:var(--amber)}
.systemValue.err{color:#ff7d84}


.authGate{position:fixed;inset:0;z-index:9999;background:rgba(3,8,11,.97);display:flex;align-items:center;justify-content:center;padding:24px}
.authGate.hidden{display:none}
.authGateBox{width:min(560px,94vw);border:1px solid #34464f;background:#081117;padding:28px;font-family:var(--font-mono)}
.authGateTitle{font-size:16px;letter-spacing:.08em;color:#eef4f7;margin-bottom:14px}
.authGateText{font-size:11px;line-height:1.8;color:#8296a2;white-space:pre-line}
.authGateStatus{margin-top:18px;color:#24d7ff;font-size:11px}
.authGateBtn{margin-top:20px;border:1px solid #40545e;background:#0a151b;color:#eef4f7;padding:10px 14px;font-size:11px}
.authGateBtn:hover{border-color:#24d7ff;color:#24d7ff}


/* Stage 7.6 RC2.1 mobile cascade hotfix.
   This block intentionally lives LAST so desktop/base rules cannot override
   responsive layout. It also makes the viewport scroll at the document level,
   which keeps the sticky header stable on mobile browsers. */
@media(max-width:760px){
  html{height:auto;min-height:100%;overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:none}
  body{height:auto;min-height:100dvh;overflow:visible;overflow-x:hidden;overscroll-behavior-y:none}
  body{padding-bottom:calc(62px + env(safe-area-inset-bottom))}
  .topbar{
    position:sticky;top:0;z-index:35;height:auto;min-height:60px;padding:8px 10px;
    font-size:10px;flex-wrap:wrap;row-gap:2px
  }
  .brandmark{margin-right:7px}
  .brand{max-width:calc(100vw - 176px);overflow:hidden;text-overflow:ellipsis}
  .toplink,.langbtn{padding:5px 5px;font-size:9px;color:#fff}
  .cloudState{display:none}
  .op{order:5;width:100%;margin:0 0 0 13px;padding-bottom:2px;font-size:9px;overflow:hidden;text-overflow:ellipsis}
  .appView{height:auto;min-height:calc(100dvh - 136px);overflow:visible}
  .pageWrap{height:auto;min-height:calc(100dvh - 136px);overflow:visible;padding:10px 8px 18px}
  .shell{display:flex;flex-direction:column;height:auto;min-height:0;overflow:visible;padding:8px 8px 18px;gap:10px}
  .left{min-height:auto;order:0}
  .leftfoot{display:none}
  #devices{display:flex;gap:8px;overflow-x:auto;overscroll-behavior-x:contain;padding-bottom:3px;scrollbar-width:thin}
  .device{min-width:190px;margin-bottom:0;padding:11px}
  .center{display:flex;flex-direction:column;order:1;overflow:visible;gap:10px}
  .right{display:flex;flex-direction:column;order:2;overflow:visible;gap:10px}
  .right .panel{margin-bottom:0}
  .tempPanel,.chartPanel,.controlPanel,.genericDevicePanel{overflow:visible}
  .tempGrid{grid-template-columns:1fr;height:auto}
  .tempReadout,.output{height:auto;min-height:160px}
  .current{font-size:54px}
  .targetBlock{width:78%}
  .chartPanel{min-height:290px}
  .chartPanel canvas{height:220px;min-height:220px;flex:none}
  .chartHeader{align-items:flex-start;flex-wrap:wrap;gap:7px}
  .legend{width:100%;gap:12px;flex-wrap:wrap}
  .controlHead{align-items:flex-start;flex-wrap:wrap;gap:6px}
  #controlHintStatus{width:100%;line-height:1.45}
  .setRow{grid-template-columns:58px minmax(120px,1fr) 58px;gap:8px}
  .adjust,.setValue,.takeBtn{min-height:50px}
  .takeBtn{grid-column:1/-1}
  .controlHint{text-align:left;line-height:1.45}
  .sectionbar{flex-wrap:wrap}
  .genericDeviceGrid{grid-template-columns:1fr}
  .bottomnav{height:calc(58px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);grid-template-columns:repeat(4,1fr)}
  .navbtn{min-width:0;gap:4px;flex-direction:column;font-size:8px;padding:4px 1px}
  .navbtn svg{width:17px;height:17px}
  .toast{left:8px;right:8px;bottom:calc(68px + env(safe-area-inset-bottom));min-width:0;max-width:none}
  .modalBack{align-items:flex-end;padding:0}
  .modal{width:100%;max-height:calc(100dvh - 68px);overflow:auto;padding:18px 14px;border-left:0;border-right:0;border-bottom:0}
  .modalActions{position:sticky;bottom:-18px;background:#0d181f;padding:12px 0 2px;flex-wrap:wrap}
  .modalBtn{min-height:46px;flex:1 1 130px}
  .drawer{top:0;bottom:calc(58px + env(safe-area-inset-bottom));width:100%;padding-top:18px}
  .profileEditorBack{inset:0 0 calc(58px + env(safe-area-inset-bottom));padding:0;align-items:stretch}
  .profileEditor{width:100%;height:100%;max-height:none;border-left:0;border-right:0;border-top:0}
  .profileEditorHead{position:sticky;top:0;background:#0b171e;z-index:2;flex-wrap:wrap}
  .profileEditorMeta{width:100%;margin:5px 0 0}
  .profileBank{grid-template-columns:1fr 1fr}
  .profileRunBar{flex-wrap:wrap}
  .profileRunBtn{min-height:44px;flex:1 1 130px}
  .profileRunInfo{width:100%;margin-left:0}
  .profileStepRow{grid-template-columns:1fr 1fr;gap:8px;padding:12px 0}
  .profileStepState{grid-column:1/-1}
  .profileStepAction{grid-column:1/-1;min-height:44px}
  .profileAdd{grid-template-columns:1fr 1fr}
  .profileAdd .profileStepAction{grid-column:1/-1}
  .historyHeader{display:none}
  .historyEvent{display:block;padding:12px;margin:8px;border:1px solid var(--line2);background:#09141a}
  .historyEvent span{display:block!important;margin:0 0 5px}
  .historyEvent span::before{content:attr(data-label);display:inline-block;width:70px;color:var(--muted);font-size:8px;letter-spacing:.08em}
  .settingsRow{grid-template-columns:1fr;gap:4px}
  .pageActions{width:100%;display:grid;grid-template-columns:1fr 1fr}
  .pageActions .actionBtn:last-child{grid-column:1/-1}
  .actionBtn{min-height:46px}
  .areaCard{padding:13px}
  .areaStats{gap:5px}
  .areaDeviceRow{align-items:flex-start;gap:8px}
  .areaDeviceMeta{text-align:right}
  .personnelRow{min-height:42px}
}
@media(max-width:430px){
  .brand{max-width:calc(100vw - 160px);font-size:9px}
  .toplink{font-size:9px}
  .gatewaySummary{grid-template-columns:1fr 1fr;gap:7px}
  .summaryCard{padding:10px}
  .summaryValue{font-size:25px}
  .areaGrid{grid-template-columns:1fr}
  .pageActions{grid-template-columns:1fr}
  .pageActions .actionBtn:last-child{grid-column:auto}
  .setRow{grid-template-columns:52px minmax(100px,1fr) 52px}
  .setValue{font-size:27px}
  .profileBank{grid-template-columns:1fr 1fr}
  .personnelRow{grid-template-columns:minmax(0,1fr);gap:3px;padding:7px 0}
  .personnelRole{padding-left:16px}
}

/* Stage 8 Cloud OTA */
.otaCard{grid-column:span 2}
.otaSection{margin-top:16px;padding-top:14px;border-top:1px solid var(--line);display:grid;gap:9px}
.otaLabel{font:600 10px var(--mono);letter-spacing:.12em;color:var(--muted2)}
.otaFull{width:100%;box-sizing:border-box}
.otaFileInput{padding:10px}
#otaSafetyGate.good,#otaCapability.good,#otaRuntimeState.good{color:var(--ok)}
#otaSafetyGate.err,#otaCapability.err,#otaRuntimeState.err{color:var(--danger)}
#otaUploadStatus.good{color:var(--ok)}
#otaUploadStatus.err{color:var(--danger)}
@media(max-width:760px){.otaCard{grid-column:auto}}

/* Production CSP helpers */
#authGateBtn{display:none}
.mt3{margin-top:3px}
.mt6{margin-top:6px}
.mt10{margin-top:10px}
.mt12{margin-top:12px}
.mt14{margin-top:14px}
.mt20{margin-top:20px}
.pt10{padding-top:10px}
.pairCodeFormat{text-transform:uppercase;letter-spacing:.18em}
.profileNameField{width:210px;margin-left:14px}
.profileNameSave{width:105px;margin-left:8px}
.profileBankName{margin-top:3px;font-size:11px}
.profileStepLabel{font-size:14px;margin-top:3px}



/* v1.1.2 Light theme — NSASRC Engineering Control Interface */
body[data-theme="light"]{
  --bg:#edf3f6;
  --panel:#ffffff;
  --panel2:#f5f9fb;
  --line:#cdd8de;
  --line2:#dbe5ea;
  --text:#10212a;
  --muted:#5f7480;
  --cyan:#1396bb;
  --green:#1f8b5d;
  --red:#c65363;
  --amber:#9a7230;
  background:var(--bg);
  color:var(--text);
}
body[data-theme="light"] .topbar{background:#f7fbfd;border-bottom-color:#d9e3e8;color:var(--text)}
body[data-theme="light"] .toplink,
body[data-theme="light"] .langbtn{color:#20313a}
body[data-theme="light"] .toplink:hover,
body[data-theme="light"] .langbtn:hover{color:var(--cyan)}
body[data-theme="light"] .cloudState{color:#60757f}
body[data-theme="light"] .brand{color:#11232c}
body[data-theme="light"] .panel,
body[data-theme="light"] .summaryCard,
body[data-theme="light"] .areaCard,
body[data-theme="light"] .emptyPanel,
body[data-theme="light"] .historyTable,
body[data-theme="light"] .settingsCard{background:#ffffff;border-color:#ccd8de}
body[data-theme="light"] .panelhead,
body[data-theme="light"] .leftfoot,
body[data-theme="light"] .drawerHead,
body[data-theme="light"] .profileEditorHead,
body[data-theme="light"] .profileBank,
body[data-theme="light"] .profileRunBar,
body[data-theme="light"] .profileEditorFoot{border-color:#dbe5ea}
body[data-theme="light"] .leftfoot strong{color:#4b616d}
body[data-theme="light"] .device{background:#f7fbfd;border-color:#cad7dd}
body[data-theme="light"] .device.active{background:#eef7fb;border-color:var(--cyan)}
body[data-theme="light"] .tempReadout,
body[data-theme="light"] .output,
body[data-theme="light"] .genericDeviceCell{background:#f9fcfd;border-color:#dbe5ea}
body[data-theme="light"] canvas{background:#fbfeff;border-color:#dbe5ea}
body[data-theme="light"] .powerbar{background:#ecf3f6;border-color:#c9d7dd}
body[data-theme="light"] .smallBtn,
body[data-theme="light"] .actionBtn,
body[data-theme="light"] .modalBtn,
body[data-theme="light"] .profileRunBtn,
body[data-theme="light"] .profileStepAction,
body[data-theme="light"] .diagBtn,
body[data-theme="light"] .adjust,
body[data-theme="light"] .setValue,
body[data-theme="light"] .takeBtn,
body[data-theme="light"] .iconBtn,
body[data-theme="light"] .profileBankBtn{
  background:#f8fbfd;
  border-color:#c7d4da;
  color:#20323b;
}
body[data-theme="light"] .actionBtn.primary,
body[data-theme="light"] .smallBtn.primary,
body[data-theme="light"] .diagBtn,
body[data-theme="light"] .takeBtn,
body[data-theme="light"] .profileRunBtn,
body[data-theme="light"] .profileStepAction,
body[data-theme="light"] .profileBankBtn.active,
body[data-theme="light"] .navbtn.active{
  color:var(--cyan);
  border-color:#7db9cc;
  background:#eef7fb;
}
body[data-theme="light"] .profileRunBtn.stop,
body[data-theme="light"] .dangerBtn,
body[data-theme="light"] .modalBtn.danger{border-color:#cc8e96!important;color:var(--red)!important;background:#fff7f8}
body[data-theme="light"] .takeBtn.release{color:#627782}
body[data-theme="light"] .historyEvent,
body[data-theme="light"] .historyHeader,
body[data-theme="light"] .statusRow,
body[data-theme="light"] .settingsRow,
body[data-theme="light"] .areaDeviceRow,
body[data-theme="light"] .personnelRow,
body[data-theme="light"] .auditRow,
body[data-theme="light"] .otaSection,
body[data-theme="light"] .profileStepRow{border-color:#dbe5ea}
body[data-theme="light"] .historyEvent{background:#ffffff}
body[data-theme="light"] .historyPrimary{color:#15303a}
body[data-theme="light"] .settingsInput,
body[data-theme="light"] .historySelect,
body[data-theme="light"] .areaSelect,
body[data-theme="light"] .profileField,
body[data-theme="light"] .modalInput{
  background:#ffffff;
  border-color:#c8d5db;
  color:#11232b;
}
body[data-theme="light"] .modal,
body[data-theme="light"] .profileEditor,
body[data-theme="light"] .drawer,
body[data-theme="light"] .authGateBox{
  background:#ffffff;
  border-color:#cad7dd;
  color:#11232b;
}
body[data-theme="light"] .modalBack{background:rgba(232,239,243,.82)}
body[data-theme="light"] .profileEditorBack{background:rgba(232,239,243,.86)}
body[data-theme="light"] .authGate{background:rgba(237,243,246,.97)}
body[data-theme="light"] .authGateTitle{color:#10222a}
body[data-theme="light"] .authGateText{color:#5f7480}
body[data-theme="light"] .authGateBtn{background:#f8fbfd;border-color:#cad7dd;color:#10222a}
body[data-theme="light"] .authGateBtn:hover{border-color:var(--cyan);color:var(--cyan)}
body[data-theme="light"] .genericDeviceNotice{background:#fffaf0;border-color:#d8c79f;color:#8e6d2d}
body[data-theme="light"] .modeNotice,
body[data-theme="light"] .profileRule,
body[data-theme="light"] .deleteConditions{background:#fffaf0;border-color:#dbc89c;color:#8c6d30}
body[data-theme="light"] .pairingSteps{background:#f2fbff;border-color:#b6d8e5;color:#2f697d}
body[data-theme="light"] .pairingStatus{background:#f8fbfd;border-color:#cbd8de;color:#158fb3}
body[data-theme="light"] .pairingStatus.ok{background:#f4fcf7;border-color:#abd2bb;color:var(--green)}
body[data-theme="light"] .pairingStatus.err{background:#fff7f8;border-color:#d9aeb4;color:var(--red)}
body[data-theme="light"] .profileCurrentBar{background:#e5edf1}
body[data-theme="light"] .profileCard{border-color:#d0dbe1;background:#fbfdfe}
body[data-theme="light"] .profileCard.active{border-color:var(--cyan)}
body[data-theme="light"] .capabilityChip{background:#f4fafc;border-color:#cad7dd;color:#526972}
body[data-theme="light"] .authorityBadge,
body[data-theme="light"] .deviceTypeBadge{border-color:#c8d5db;color:#536973}
body[data-theme="light"] .authorityBadge.remote{border-color:#8ac6ab;color:var(--green)}
body[data-theme="light"] .bottomnav{background:#f7fbfd;border-top-color:#ccd8de}
body[data-theme="light"] .navbtn{color:#6b808a;border-right-color:#dde6eb}
body[data-theme="light"] .navbtn.active{background:#eef7fb}
body[data-theme="light"] .toast{background:#ffffff;border-color:#cad7dd;color:#17323b}
body[data-theme="light"] .toast.ok{border-color:#97caab;color:var(--green)}
body[data-theme="light"] .toast.err{border-color:#d7a5ae;color:var(--red)}
body[data-theme="light"] .micro,
body[data-theme="light"] .label,
body[data-theme="light"] .devmeta,
body[data-theme="light"] .chartNote,
body[data-theme="light"] .pageHeadText,
body[data-theme="light"] .settingsHelp,
body[data-theme="light"] .profileMeta,
body[data-theme="light"] .outputMeta,
body[data-theme="light"] .gatewayFooter,
body[data-theme="light"] .areaStatLabel,
body[data-theme="light"] .areaDeviceMeta,
body[data-theme="light"] .personnelMeta,
body[data-theme="light"] .auditTime,
body[data-theme="light"] .auditText{color:#627782}
body[data-theme="light"] .systemValue{color:#304752}
body[data-theme="light"] .systemValue.good{color:var(--green)}
body[data-theme="light"] .systemValue.warn{color:var(--amber)}
body[data-theme="light"] .systemValue.err{color:var(--red)}


/* v1.1.3 — light palette normalization
   NSASRC Engineering Control Interface
   Goal: low-glare neutral surfaces, restrained accents, consistent state colors. */
body[data-theme="light"]{
  --bg:#eef2f4;
  --panel:#f9fbfc;
  --panel2:#f3f7f9;
  --line:#c8d2d7;
  --line2:#dbe3e7;
  --text:#17262e;
  --muted:#687b85;
  --cyan:#1683a0;
  --green:#2f8661;
  --red:#b95761;
  --amber:#8d7142;
  --chart-grid:#d5dee2;
  --chart-axis:#99aab2;
  --chart-label:#738791;
  --chart-current:#1592b2;
  --chart-target:#7f929b;
  background:#eef2f4;
  color:#17262e;
}

/* Accent restraint */
body[data-theme="light"] .topline{background:#d9574d}
body[data-theme="light"] .brandmark{background:#d9574d}
body[data-theme="light"] .sectionAccent{background:#1789a7}
body[data-theme="light"] .live{color:#68818d}
body[data-theme="light"] .dot{background:#3a916b}
body[data-theme="light"] .dot.off{background:#9aabb3}
body[data-theme="light"] .good{color:#2f8661}
body[data-theme="light"] .bad{color:#b95761}
body[data-theme="light"] #controlHintStatus.err{color:#b95761}
body[data-theme="light"] #controlHintStatus.sync{color:#8d7142}

/* Global shell / navigation */
body[data-theme="light"] .topbar{
  background:#f5f8fa;
  border-bottom-color:#ccd6db;
  color:#20323a;
}
body[data-theme="light"] .brand{color:#20323a}
body[data-theme="light"] .toplink,
body[data-theme="light"] .langbtn{color:#273942}
body[data-theme="light"] .toplink:hover,
body[data-theme="light"] .langbtn:hover{color:#147e9a}
body[data-theme="light"] .cloudState{color:#70838d}
body[data-theme="light"] .cloudState.good{color:#2f8661}
body[data-theme="light"] .cloudState.err{color:#b95761}
body[data-theme="light"] .op{color:#2f8661}
body[data-theme="light"] .bottomnav{
  background:#f6f9fa;
  border-top-color:#c9d3d8;
  box-shadow:0 -1px 6px rgba(32,52,62,.04);
}
body[data-theme="light"] .navbtn{
  color:#697d87;
  border-right-color:#dce4e8;
}
body[data-theme="light"] .navbtn:hover{color:#3c5b69;background:#f0f5f7}
body[data-theme="light"] .navbtn.active{
  color:#147e9a;
  background:#eaf3f6;
}

/* Panels and cards across STATUS / CONTROL / HISTORY / SETTINGS */
body[data-theme="light"] .panel,
body[data-theme="light"] .summaryCard,
body[data-theme="light"] .areaCard,
body[data-theme="light"] .emptyPanel,
body[data-theme="light"] .historyTable,
body[data-theme="light"] .settingsCard{
  background:#f9fbfc;
  border-color:#c8d2d7;
}
body[data-theme="light"] .summaryCard,
body[data-theme="light"] .areaCard,
body[data-theme="light"] .settingsCard{
  box-shadow:0 1px 2px rgba(34,55,65,.025);
}
body[data-theme="light"] .areaCard:hover{border-color:#9db5c0}
body[data-theme="light"] .panelhead,
body[data-theme="light"] .leftfoot,
body[data-theme="light"] .drawerHead,
body[data-theme="light"] .profileEditorHead,
body[data-theme="light"] .profileBank,
body[data-theme="light"] .profileRunBar,
body[data-theme="light"] .profileEditorFoot,
body[data-theme="light"] .settingsRow,
body[data-theme="light"] .statusRow,
body[data-theme="light"] .areaDeviceRow,
body[data-theme="light"] .personnelRow,
body[data-theme="light"] .auditRow,
body[data-theme="light"] .historyHeader,
body[data-theme="light"] .historyEvent,
body[data-theme="light"] .profileStepRow,
body[data-theme="light"] .otaSection{
  border-color:#dbe3e7;
}

/* Secondary text — readable without becoming visually dominant */
body[data-theme="light"] .micro,
body[data-theme="light"] .label,
body[data-theme="light"] .devmeta,
body[data-theme="light"] .chartNote,
body[data-theme="light"] .pageHeadText,
body[data-theme="light"] .settingsHelp,
body[data-theme="light"] .profileMeta,
body[data-theme="light"] .outputMeta,
body[data-theme="light"] .gatewayFooter,
body[data-theme="light"] .areaStatLabel,
body[data-theme="light"] .areaDeviceMeta,
body[data-theme="light"] .personnelMeta,
body[data-theme="light"] .auditTime,
body[data-theme="light"] .auditText,
body[data-theme="light"] .controlHint,
body[data-theme="light"] .profileEditorMeta,
body[data-theme="light"] .profileEditorFoot,
body[data-theme="light"] .historyHeader{
  color:#687b85;
}
body[data-theme="light"] .leftfoot{color:#71838c}
body[data-theme="light"] .leftfoot strong{color:#4f626b}

/* Device / data surfaces */
body[data-theme="light"] .device{
  background:#f6f9fa;
  border-color:#cbd5da;
}
body[data-theme="light"] .device:hover{border-color:#a9bdc6}
body[data-theme="light"] .device.active{
  background:#eaf3f6;
  border-color:#4b9bb2;
}
body[data-theme="light"] .tempReadout,
body[data-theme="light"] .output,
body[data-theme="light"] .genericDeviceCell{
  background:#f7fafb;
  border-color:#d5dfe3;
}
body[data-theme="light"] .targetBlock{border-top-color:#aab9c0}
body[data-theme="light"] canvas{
  background:#f8fafb;
  border-color:#d5dfe3;
}
body[data-theme="light"] .legend{color:#71848e}
body[data-theme="light"] .legend i{background:#1592b2}
body[data-theme="light"] .legend i.targetLine{background:none;border-top-color:#83969f}
body[data-theme="light"] .powerbar{
  background:#e8eef1;
  border-color:#c5d1d7;
}
body[data-theme="light"] .powerfill{background:#a98a50}

/* Controls */
body[data-theme="light"] .adjust,
body[data-theme="light"] .setValue,
body[data-theme="light"] .takeBtn,
body[data-theme="light"] .smallBtn,
body[data-theme="light"] .actionBtn,
body[data-theme="light"] .modalBtn,
body[data-theme="light"] .profileRunBtn,
body[data-theme="light"] .profileStepAction,
body[data-theme="light"] .diagBtn,
body[data-theme="light"] .iconBtn,
body[data-theme="light"] .profileBankBtn{
  background:#f5f8fa;
  border-color:#c4d0d6;
  color:#263942;
}
body[data-theme="light"] .adjust:hover,
body[data-theme="light"] .setValue:hover,
body[data-theme="light"] .takeBtn:hover,
body[data-theme="light"] .smallBtn:hover,
body[data-theme="light"] .actionBtn:hover,
body[data-theme="light"] .modalBtn:hover,
body[data-theme="light"] .profileRunBtn:hover,
body[data-theme="light"] .profileStepAction:hover,
body[data-theme="light"] .diagBtn:hover,
body[data-theme="light"] .iconBtn:hover{
  border-color:#7faabb;
  color:#116f89;
  background:#edf4f6;
}
body[data-theme="light"] .actionBtn.primary,
body[data-theme="light"] .smallBtn.primary,
body[data-theme="light"] .diagBtn,
body[data-theme="light"] .takeBtn,
body[data-theme="light"] .profileRunBtn,
body[data-theme="light"] .profileStepAction,
body[data-theme="light"] .profileBankBtn.active{
  color:#147e9a;
  border-color:#83b3c3;
  background:#eff6f8;
}
body[data-theme="light"] button:disabled{opacity:.48}
body[data-theme="light"] button.cmdBusy{
  border-color:#5ca2b7!important;
  color:#126f88!important;
  background:#e9f3f6!important;
}
body[data-theme="light"] button.cmdBusy::after{background:#1683a0}
body[data-theme="light"] .takeBtn.release{color:#697b84}

/* Inputs/selects */
body[data-theme="light"] .settingsInput,
body[data-theme="light"] .historySelect,
body[data-theme="light"] .areaSelect,
body[data-theme="light"] .profileField,
body[data-theme="light"] .modalInput{
  background:#fbfcfd;
  border-color:#c6d1d7;
  color:#1c2d35;
}
body[data-theme="light"] .settingsInput:focus,
body[data-theme="light"] .historySelect:focus,
body[data-theme="light"] .areaSelect:focus,
body[data-theme="light"] .profileField:focus,
body[data-theme="light"] .modalInput:focus{
  outline:none;
  border-color:#6fa7b9;
  box-shadow:0 0 0 2px rgba(22,131,160,.08);
}
body[data-theme="light"] .profileField:disabled{
  color:#87969d;
  background:#eef2f4;
  border-color:#d4dde1;
}

/* State badges */
body[data-theme="light"] .authorityBadge,
body[data-theme="light"] .deviceTypeBadge{
  border-color:#c3cfd5;
  color:#586c76;
  background:#f7fafb;
}
body[data-theme="light"] .authorityBadge.remote{
  border-color:#8abda4;
  color:#2d7d5b;
  background:#f2f8f4;
}
body[data-theme="light"] .personnelDot{background:#91a1a9}
body[data-theme="light"] .personnelDot.control{
  background:#3c8b68;
  box-shadow:0 0 5px rgba(60,139,104,.18);
}
body[data-theme="light"] .personnelDot.local{background:#9b7a42}
body[data-theme="light"] .personnelDot.me{background:#278da8}
body[data-theme="light"] .personnelRole{color:#8b6b36}
body[data-theme="light"] .personnelRole.view{color:#667c86}

/* Profile / generic / warning surfaces */
body[data-theme="light"] .profileCard{
  background:#f7fafb;
  border-color:#ccd7dc;
}
body[data-theme="light"] .profileCard.active{border-color:#6ea7b9}
body[data-theme="light"] .profileCurrentBar{background:#e4ebee}
body[data-theme="light"] .profileCurrentFill{background:#9b7a42}
body[data-theme="light"] .capabilityChip{
  background:#f2f6f8;
  border-color:#cbd6db;
  color:#526974;
}
body[data-theme="light"] .genericDeviceNotice,
body[data-theme="light"] .modeNotice,
body[data-theme="light"] .profileRule,
body[data-theme="light"] .deleteConditions{
  background:#f8f5ed;
  border-color:#d8ccb1;
  color:#79643d;
}
body[data-theme="light"] .profileStepState.current{color:#8b6d3e}
body[data-theme="light"] .profileStepState.completed{color:#788b94}
body[data-theme="light"] .profileStepState.upcoming{color:#177d98}

/* Modals / drawers / auth */
body[data-theme="light"] .modal,
body[data-theme="light"] .profileEditor,
body[data-theme="light"] .drawer,
body[data-theme="light"] .authGateBox{
  background:#f9fbfc;
  border-color:#c8d2d7;
  color:#17262e;
  box-shadow:0 12px 36px rgba(31,48,58,.10);
}
body[data-theme="light"] .modalBack{background:rgba(228,235,239,.76)}
body[data-theme="light"] .profileEditorBack{background:rgba(228,235,239,.80)}
body[data-theme="light"] .authGate{background:rgba(238,242,244,.97)}
body[data-theme="light"] .modalText{color:#667a84}
body[data-theme="light"] .drawerClose,
body[data-theme="light"] .profileEditorClose{color:#637781}
body[data-theme="light"] .authGateTitle{color:#17262e}
body[data-theme="light"] .authGateText{color:#687b85}
body[data-theme="light"] .authGateStatus{color:#167e9a}
body[data-theme="light"] .authGateBtn{
  background:#f5f8fa;
  border-color:#c4d0d6;
  color:#263942;
}

/* Pairing / feedback */
body[data-theme="light"] .pairingSteps{
  background:#eef6f8;
  border-color:#bdd2da;
  color:#426c7b;
}
body[data-theme="light"] .pairingStatus{
  background:#f4f8fa;
  border-color:#c8d4da;
  color:#187f9b;
}
body[data-theme="light"] .pairingStatus.ok{
  background:#f1f7f3;
  border-color:#b8d0c2;
  color:#2f7f5d;
}
body[data-theme="light"] .pairingStatus.err{
  background:#faf3f4;
  border-color:#d7bdc1;
  color:#ae515b;
}
body[data-theme="light"] .toast{
  background:#fbfcfd;
  border-color:#c7d2d7;
  color:#20343d;
  box-shadow:0 6px 20px rgba(33,51,61,.08);
}
body[data-theme="light"] .toast.ok{border-color:#a6c8b5;color:#2f7f5d}
body[data-theme="light"] .toast.err{border-color:#d4b0b5;color:#ae515b}

/* Danger controls */
body[data-theme="light"] .profileRunBtn.stop,
body[data-theme="light"] .dangerBtn,
body[data-theme="light"] .modalBtn.danger{
  border-color:#caa3a8!important;
  color:#a94e58!important;
  background:#faf4f5;
}
body[data-theme="light"] .iconBtn.danger:hover{
  border-color:#bd6c75;
  color:#a94e58;
  background:#faf1f2;
}

/* History / system / OTA */
body[data-theme="light"] .historyEvent{background:#f9fbfc}
body[data-theme="light"] .historyPrimary{color:#243a44}
body[data-theme="light"] .systemValue{color:#344b55}
body[data-theme="light"] .systemValue.good,
body[data-theme="light"] #otaSafetyGate.good,
body[data-theme="light"] #otaCapability.good,
body[data-theme="light"] #otaRuntimeState.good,
body[data-theme="light"] #otaUploadStatus.good{color:#2f8661}
body[data-theme="light"] .systemValue.warn{color:#8d7142}
body[data-theme="light"] .systemValue.err,
body[data-theme="light"] #otaSafetyGate.err,
body[data-theme="light"] #otaCapability.err,
body[data-theme="light"] #otaRuntimeState.err,
body[data-theme="light"] #otaUploadStatus.err{color:#b95761}
body[data-theme="light"] .otaLabel{color:#637782}
body[data-theme="light"] .otaFilePicker{
  min-height:42px;
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid #c6d1d7;
  background:#fbfcfd;
  padding:5px 8px;
}
body[data-theme="light"] .otaFileChoose{
  min-height:30px;
  flex:0 0 auto;
}
body[data-theme="light"] .otaFileName{
  color:#5e727c;
  font-size:10px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Custom OTA file input — avoids OS-localized native labels in English UI. */
.otaNativeFile{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;
  clip-path:inset(50%)!important;
}
.otaFilePicker{
  min-height:42px;
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid #3a4c57;
  background:#081117;
  padding:5px 8px;
}
.otaFileChoose{min-height:30px;flex:0 0 auto}
.otaFileName{
  color:var(--muted);
  font-size:10px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Mobile light-mode surfaces must override dark responsive fallbacks. */
@media(max-width:760px){
  body[data-theme="light"] .modalActions{background:#f9fbfc}
  body[data-theme="light"] .profileEditorHead{background:#f9fbfc}
  body[data-theme="light"] .historyEvent{background:#f9fbfc}
  body[data-theme="light"] .topbar{box-shadow:0 1px 4px rgba(32,52,62,.04)}
}
