:root{color-scheme:dark;--bg:#061017;--side:#06121a;--panel:#0b1c26;--panel2:#0e2430;--panel3:#102a36;--line:#1b3b4b;--line2:#28556a;--text:#eef8fb;--muted:#82a0ae;--blue:#24aef2;--cyan:#48d6e8;--green:#29d27d;--red:#ff5b67;--amber:#f1b947;--shadow:0 18px 50px rgba(0,0,0,.28)}*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial;background:var(--bg);color:var(--text)}button,input,select{font:inherit}.shell{min-height:100vh;display:grid;grid-template-columns:190px minmax(0,1fr)}.sidebar{position:sticky;top:0;height:100vh;background:var(--side);border-right:1px solid #183544;padding:0 10px 8px;display:flex;flex-direction:column}.brand{height:80px;display:flex;align-items:center;gap:10px;padding:0 9px;border-bottom:1px solid #17303b}.brandmark{width:38px;height:38px;border:1px solid #27627a;border-radius:10px;display:grid;place-items:center;color:#5ee7f5;background:#08212c;font-weight:900}.brand strong{font-size:14px;line-height:1.12;letter-spacing:.06em}.brand span{display:block;color:#7896a4;font-size:9px;margin-top:5px}.sidebar nav{padding-top:16px;display:grid;gap:3px}.nav{border:0;background:transparent;color:#9ab2be;display:flex;align-items:center;gap:9px;width:100%;min-height:42px;padding:10px 11px;border-radius:7px;text-align:left;font-size:11px;font-weight:750;cursor:pointer}.nav:hover,.nav.active{background:#0b2a3b;color:white}.nav.active{box-shadow:inset 3px 0 0 var(--blue)}.badge-count{margin-left:auto;background:#158dcc;color:#fff;border-radius:999px;padding:2px 6px;font-size:9px}.spacer{flex:1}.switcher{display:grid;gap:2px;padding:5px 0;margin-bottom:4px;border-top:1px solid #183544;border-bottom:1px solid #183544}.switcher a{height:30px;display:flex;align-items:center;gap:7px;padding:4px 8px;border:1px solid transparent;border-radius:7px;color:#b2c7d0;text-decoration:none;font-size:10px}.switcher a:hover,.switcher a.current{background:#0c2b3b;border-color:#1f6681;color:white}.switcher a.current{box-shadow:inset 2px 0 0 var(--blue)}.switcher i{font-style:normal;width:20px;height:20px;display:grid;place-items:center;border:1px solid #27627a;border-radius:5px;color:#54d9ef;font-size:8px}.user{padding:6px 8px;border-bottom:1px solid #183544}.user strong{display:block;font-size:11px}.user span{font-size:9px;color:#7896a4}.nav.compact{height:30px;min-height:30px;padding:4px 8px;margin-top:1px}.version{padding:6px 8px 0;color:#668695;font-size:8px}main{min-width:0}header{height:80px;display:flex;align-items:center;justify-content:space-between;padding:0 25px;background:#07151d;border-bottom:1px solid #183544;position:sticky;top:0;z-index:20}header h1{font-size:22px;margin:0}.online{font-size:10px;color:var(--green);margin-top:5px}.online span{display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--green);margin-right:6px}.page{display:none;padding:26px;max-width:1650px}.page.active{display:block}.pagehead{display:flex;justify-content:space-between;gap:20px;align-items:flex-end;margin-bottom:20px}.pagehead h2{font-size:26px;margin:4px 0}.pagehead p{color:var(--muted);font-size:12px;margin:0}.eyebrow{font-size:9px;color:#4cd9ee;font-weight:900;letter-spacing:.18em}.stats{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;margin-bottom:18px}.stats article{background:linear-gradient(180deg,var(--panel2),var(--panel));border:1px solid var(--line);border-radius:12px;padding:14px 16px}.stats span{font-size:10px;color:var(--muted)}.stats strong{display:block;font-size:26px;margin-top:5px}.primary,.secondary,.danger{border-radius:8px;padding:9px 13px;font-weight:750;font-size:11px;cursor:pointer}.primary{border:1px solid #198fd0;background:linear-gradient(180deg,#1aa9f3,#1688d1);color:white;box-shadow:0 6px 18px rgba(36,174,242,.16)}.secondary{border:1px solid var(--line);background:#0a1b24;color:#d9e9ef}.danger{border:1px solid #9e3640;background:#5c1c24;color:#ffd7da}.toolbar{display:flex;align-items:center;gap:9px;margin-bottom:16px}.toolbar input,.toolbar select,.fields input,.fields select,.modal>label select,.assignment-row input,.assignment-row select,.site-browser input{border:1px solid var(--line);background:#071922;color:white;border-radius:8px;padding:9px 10px}.toolbar>input{flex:1}.toolbar label{font-size:11px;color:var(--muted);white-space:nowrap}.hidden{display:none!important}.warning{border:1px solid #80652a;background:#2b220d;color:#ffd96c;border-radius:9px;padding:11px 13px;font-size:11px;margin-bottom:12px}

/* Badass pole cards */
.pole-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:14px}.pole-card{position:relative;overflow:hidden;background:radial-gradient(circle at 92% 8%,rgba(36,174,242,.12),transparent 34%),linear-gradient(180deg,#0d2230,#091820);border:1px solid var(--line);border-radius:15px;padding:15px;box-shadow:var(--shadow)}.pole-card::before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--blue)}.pole-card.solar::before{background:var(--amber)}.cardhead{display:flex;justify-content:space-between;gap:10px}.pole-title{display:flex;gap:10px;align-items:center}.health-ring{width:29px;height:29px;border-radius:50%;display:grid;place-items:center;border:2px solid var(--green);color:var(--green);font-size:14px;box-shadow:0 0 18px rgba(41,210,125,.15)}.health-ring.off{border-color:var(--red);color:var(--red)}.pole-title h3{font-size:14px;margin:0}.sub{font-size:9px;color:var(--muted);margin-top:3px}.profile-badge{font-size:8px;font-weight:900;letter-spacing:.07em;padding:5px 7px;border:1px solid #285267;border-radius:999px;color:#aeefff;background:#0b2531}.profile-badge.solar{color:#ffd36d;border-color:#6d5524;background:#261f0d}.metric-strip{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:12px}.readout{background:linear-gradient(180deg,#0a1a23,#07141a);border:1px solid #1b3440;border-radius:9px;padding:9px;min-height:65px}.readout span{display:block;font-size:8px;color:#7f9ba8;text-transform:uppercase;letter-spacing:.06em}.readout strong{display:block;font-size:18px;margin-top:6px;line-height:1}.readout strong.good{color:#53df9a}.readout strong.bad{color:#ff7d86}.readout strong.warn{color:#ffd36d}.system-tile{position:relative}.system-light{position:absolute;right:9px;bottom:9px;width:18px;height:18px;border-radius:6px;background:#35434a;border:2px solid #72848c}.system-light.on{background:#30ad6e;border-color:#b5ffe0;box-shadow:0 0 20px rgba(48,173,110,.35)}.device-footer{display:flex;gap:7px;flex-wrap:wrap;margin-top:10px;padding-top:9px;border-top:1px solid #18313d}.device-chip{font-size:8px;padding:5px 7px;border:1px solid #244553;border-radius:6px;color:#8fb2c1;background:#07161d}.device-chip b{color:#dcecf2}.solar-preview{margin-top:8px;padding:9px;border:1px dashed #725c2d;border-radius:9px;background:rgba(241,185,71,.04);color:#c8a85c;font-size:9px}

/* Health-style sites */
.site-workspace{display:grid;grid-template-columns:325px minmax(0,1fr);gap:12px;min-height:650px}.site-browser,.site-detail{background:linear-gradient(180deg,#0b1d27,#08171f);border:1px solid var(--line);border-radius:13px}.site-browser{padding:12px}.site-browser-head{display:flex;justify-content:space-between;align-items:end;margin-bottom:10px}.site-browser-head strong{font-size:14px}.site-browser-head span{font-size:9px;color:var(--muted)}.site-browser input{width:100%;margin-bottom:9px}.site-mini{display:grid;grid-template-columns:42px minmax(0,1fr) auto;gap:9px;align-items:center;padding:9px;border:1px solid #173747;border-radius:10px;margin-top:7px;cursor:pointer;background:#091923}.site-mini:hover,.site-mini.active{border-color:#268fc2;background:#0b2736;box-shadow:inset 3px 0 0 var(--blue)}.site-mini-icon{width:42px;height:42px;border-radius:9px;display:grid;place-items:center;background:#0c2b3a;color:#4ad5f0;font-size:16px}.site-mini strong{display:block;font-size:11px}.site-mini small{display:block;color:#6f8d9a;font-size:8px;margin-top:3px}.site-mini-stat{font-size:8px;color:#9cc1ce}.site-detail{padding:14px}.empty-detail{display:grid;place-items:center;text-align:center;color:var(--muted)}.site-detail-head{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px}.site-detail-head h2{margin:0 0 4px;font-size:24px}.site-actions{display:flex;gap:6px}.site-summary{display:flex;gap:17px;margin-top:12px;font-size:9px;color:var(--muted)}.site-summary b{font-size:14px;color:white;margin-right:3px}.site-map{height:320px;border:1px solid var(--line);border-radius:11px;margin-top:14px;overflow:hidden;background:#07151b}.map-hidden-note{padding:18px;border:1px dashed #24434f;border-radius:10px;margin-top:14px;color:#6e8994;font-size:10px}.site-poles-title{display:flex;justify-content:space-between;align-items:center;margin:14px 0 8px}.site-poles-title h3{margin:0;font-size:14px}.site-pole-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:10px}

/* Devices */
.device-list{display:grid;gap:8px}.device-row{display:grid;grid-template-columns:minmax(220px,1.4fr) minmax(160px,1fr) 140px 190px;align-items:center;gap:12px;padding:11px 13px;background:linear-gradient(180deg,#0d2230,#091a23);border:1px solid var(--line);border-radius:11px}.device-name strong{display:block;font-size:12px}.device-name span,.device-row small{font-size:9px;color:var(--muted)}.device-state{font-size:9px}.available{color:var(--green)}.assigned{color:var(--amber)}.device-actions{text-align:right}.mini{padding:6px 8px;border-radius:6px;border:1px solid #285063;background:#0a202b;color:#d9edf3;font-size:9px;cursor:pointer}.mini.dangerish{border-color:#73353d;color:#ffadb3}

/* Modal + profiles */
.modal-bg{position:fixed;inset:0;background:rgba(0,0,0,.74);display:grid;place-items:center;z-index:5000;padding:20px}.modal{width:min(760px,96vw);max-height:90vh;overflow:auto;background:#091b25;border:1px solid #285063;border-radius:15px;padding:17px;box-shadow:0 30px 90px rgba(0,0,0,.48)}.modal.pole-modal{width:min(900px,96vw)}.modal.small{width:min(480px,96vw)}.modal-head{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:14px}.modal-head h3{font-size:20px;margin:3px 0}.x{border:1px solid var(--line);background:#07151d;color:white;border-radius:7px;width:32px;height:32px}.fields{display:grid;gap:10px}.fields.two{grid-template-columns:1fr 1fr}.fields label,.modal>label{display:grid;gap:5px;font-size:10px;color:#a9c0ca}.fields .wide{grid-column:1/-1}.check-row{display:flex!important;align-items:center;gap:8px!important;background:#071922;border:1px solid var(--line);border-radius:8px;padding:9px 10px}.profile-picker{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-bottom:12px}.profile-choice{display:grid;grid-template-columns:38px minmax(0,1fr);grid-template-rows:auto auto;column-gap:10px;text-align:left;border:1px solid #254652;border-radius:11px;background:#071820;color:white;padding:11px;cursor:pointer}.profile-choice:hover,.profile-choice.active{border-color:#2baeea;background:#0a2735;box-shadow:inset 3px 0 0 var(--blue)}.profile-choice[data-profile="solar"].active{border-color:#b58b31;box-shadow:inset 3px 0 0 var(--amber)}.profile-icon{grid-row:1/3;width:38px;height:38px;border-radius:9px;display:grid;place-items:center;background:#0c3040;font-size:19px}.profile-choice[data-profile="solar"] .profile-icon{background:#31270e}.profile-choice strong{font-size:12px}.profile-choice small{color:#7895a1;font-size:8px}.assignment-panel{margin-top:13px;border:1px solid #234451;border-radius:11px;overflow:hidden}.assignment-title{display:flex;justify-content:space-between;align-items:center;padding:9px 11px;background:#0b2632;border-bottom:1px solid #234451}.assignment-title span{font-size:9px;font-weight:900;letter-spacing:.12em;color:#54dbef}.assignment-title small{font-size:8px;color:#6e8994}.assignment-row{display:grid;grid-template-columns:180px 1fr 1.25fr;gap:8px;align-items:center;padding:10px 11px;border-bottom:1px solid #17313b}.assignment-row:last-child{border-bottom:0}.assignment-row strong{display:block;font-size:10px}.assignment-row small{display:block;font-size:8px;color:#6f8d99;margin-top:2px}.modal-actions{display:flex;gap:8px;align-items:center;margin-top:17px}.modal-actions span{flex:1}.toast{position:fixed;right:22px;bottom:22px;background:#0d2c38;border:1px solid #2f6b7f;border-radius:9px;padding:11px 14px;z-index:200;font-size:11px}

.leaflet-container{background:#07151b}
@media(max-width:1100px){.metric-strip{grid-template-columns:repeat(2,1fr)}.site-workspace{grid-template-columns:260px minmax(0,1fr)}.assignment-row{grid-template-columns:1fr}.device-row{grid-template-columns:1fr 1fr}}
@media(max-width:800px){.shell{grid-template-columns:76px 1fr}.brand>div:last-child,.switcher b,.user span,.version{display:none}.page{padding:18px}.stats{grid-template-columns:repeat(2,1fr)}.site-workspace{grid-template-columns:1fr}.site-browser{max-height:300px;overflow:auto}.profile-picker{grid-template-columns:1fr}.fields.two{grid-template-columns:1fr}.fields .wide{grid-column:auto}.device-row{grid-template-columns:1fr}}

#deviceManagementPanel .assignment-row{grid-template-columns:180px minmax(0,1fr) auto}
#deviceManagementPanel .row-actions{display:flex;gap:6px;justify-content:flex-end}

/* v0.3.4 card cleanup */
.device-footer{display:none!important}
.card-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:10px;
  padding-top:9px;
  border-top:1px solid #18313d;
}
.last-seen{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:8px;
  color:#8fb2c1;
  background:#07161d;
  border:1px solid #244553;
  border-radius:6px;
  padding:5px 7px;
}
.last-seen b{color:#dcecf2}
.card-edit-btn{
  min-width:62px;
  height:28px;
  padding:0 12px;
  border-radius:7px;
  border:1px solid #2a647c;
  background:linear-gradient(180deg,#0d3445,#0a2532);
  color:#dff8ff;
  font-size:9px;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 4px 12px rgba(0,0,0,.18);
}
.card-edit-btn:hover{
  border-color:#2bb8f2;
  background:#0d3a4e;
}
.system-tile{min-width:0}
.status-switch-wrap{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-top:5px;
}
.status-switch-wrap strong{
  margin-top:0!important;
}
.status-switch{
  position:relative;
  width:42px;
  height:24px;
  flex:0 0 42px;
  border-radius:999px;
  border:1px solid #3a5560;
  background:#25363d;
  box-shadow:inset 0 2px 5px rgba(0,0,0,.32);
}
.status-switch i{
  position:absolute;
  top:3px;
  left:3px;
  width:16px;
  height:16px;
  border-radius:50%;
  background:#a3b2b8;
  box-shadow:0 1px 4px rgba(0,0,0,.45);
  transition:left .18s ease,background .18s ease;
}
.status-switch.on{
  border-color:#39cf87;
  background:#168a55;
  box-shadow:0 0 14px rgba(41,210,125,.18),inset 0 2px 5px rgba(0,0,0,.18);
}
.status-switch.on i{
  left:21px;
  background:#e8fff4;
}
.status-switch.off{
  border-color:#8b3d45;
  background:#5c242a;
}
.status-switch.off i{
  left:3px;
  background:#ffd7da;
}
.status-switch.unknown{
  opacity:.55;
}

/* v0.3.5 profile badge + live relay control */
.profile-badge{
  align-self:flex-start;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:68px;
  height:24px;
  padding:0 9px;
  border-radius:6px;
  border:1px solid #24546a;
  background:#0a2430;
  color:#9cecff;
  font-size:8px;
  font-weight:900;
  line-height:1;
  letter-spacing:.08em;
  white-space:nowrap;
  box-shadow:none;
}
.profile-badge.solar{
  border-color:#705a2d;
  background:#241d0e;
  color:#ffd36d;
}
.system-tile{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}
.system-control{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-top:5px;
}
.system-control strong{
  margin:0!important;
  font-size:18px;
}
.system-toggle{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  cursor:pointer;
  flex:0 0 auto;
}
.system-toggle .toggle-track{
  position:relative;
  display:block;
  width:46px;
  height:25px;
  border-radius:999px;
  border:1px solid #5d7580;
  background:#2c3f47;
  box-shadow:inset 0 2px 5px rgba(0,0,0,.32);
  transition:.16s ease;
}
.system-toggle .toggle-track i{
  position:absolute;
  top:3px;
  left:3px;
  width:17px;
  height:17px;
  border-radius:50%;
  background:#c7d4d9;
  box-shadow:0 1px 5px rgba(0,0,0,.5);
  transition:left .16s ease,background .16s ease;
}
.system-toggle.on .toggle-track{
  background:#178a56;
  border-color:#40d68c;
  box-shadow:0 0 12px rgba(41,210,125,.16),inset 0 2px 4px rgba(0,0,0,.2);
}
.system-toggle.on .toggle-track i{
  left:24px;
  background:#effff7;
}
.system-toggle.off .toggle-track{
  background:#6b2930;
  border-color:#a84a54;
}
.system-toggle.off .toggle-track i{
  left:3px;
  background:#ffe4e6;
}
.system-toggle.unknown .toggle-track{
  opacity:.55;
}
.system-toggle.pending{
  opacity:.55;
  cursor:wait;
  pointer-events:none;
}
.system-toggle.pending .toggle-track{
  box-shadow:0 0 0 3px rgba(36,174,242,.10);
}
.command-state{
  min-height:11px;
  margin-top:3px;
  color:#6e98a7;
  font-size:7px;
  line-height:1.1;
}

/* v0.3.6 System Status alignment refinement */
.system-tile{
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
}
.system-tile > span{
  margin-bottom:7px;
}
.system-control{
  display:grid;
  grid-template-columns:minmax(0,1fr) 46px;
  align-items:center;
  gap:10px;
  width:100%;
  min-height:28px;
  margin-top:0;
}
.system-control strong{
  display:flex!important;
  align-items:center;
  height:25px;
  line-height:25px!important;
  margin:0!important;
  font-size:18px!important;
}
.system-toggle{
  display:block;
  width:46px;
  height:25px;
  justify-self:end;
  align-self:center;
  line-height:0;
}
.system-toggle .toggle-track{
  display:block;
  width:46px;
  height:25px;
  margin:0;
}
.command-state{
  display:block;
  min-height:9px;
  height:9px;
  margin-top:3px;
  line-height:9px;
}

/* v0.3.7 System Status control - single pill, no overlap */
.system-tile{
  display:flex!important;
  flex-direction:column!important;
  justify-content:flex-start!important;
  min-width:0;
  overflow:hidden;
}
.system-tile > span{
  margin:0 0 8px 0!important;
}
.system-control{
  display:none!important;
}
.system-toggle{
  appearance:none;
  -webkit-appearance:none;
  display:grid!important;
  grid-template-columns:1fr 34px;
  align-items:center;
  width:100%!important;
  min-width:0!important;
  height:32px!important;
  margin:0!important;
  padding:3px 4px 3px 9px!important;
  border-radius:8px!important;
  border:1px solid #4a6570!important;
  background:#17262d!important;
  color:#d9e8ed!important;
  cursor:pointer;
  line-height:1!important;
  box-sizing:border-box!important;
}
.system-toggle .toggle-label{
  display:block;
  min-width:0;
  overflow:hidden;
  font-size:14px;
  font-weight:900;
  line-height:24px;
  text-align:left;
  white-space:nowrap;
}
.system-toggle .toggle-track{
  position:relative;
  display:block!important;
  width:30px!important;
  height:20px!important;
  margin:0!important;
  justify-self:end;
  border-radius:999px!important;
  border:1px solid #637780!important;
  background:#35464d!important;
  box-shadow:inset 0 1px 4px rgba(0,0,0,.32)!important;
}
.system-toggle .toggle-track i{
  position:absolute!important;
  top:2px!important;
  left:2px!important;
  width:14px!important;
  height:14px!important;
  border-radius:50%!important;
  background:#cfd9dd!important;
  transition:left .16s ease!important;
}
.system-toggle.on{
  border-color:#2baf70!important;
  background:#0e3928!important;
  color:#4ee69c!important;
}
.system-toggle.on .toggle-track{
  border-color:#39d087!important;
  background:#168a55!important;
}
.system-toggle.on .toggle-track i{
  left:12px!important;
  background:#f0fff7!important;
}
.system-toggle.off{
  border-color:#94404a!important;
  background:#3a1b20!important;
  color:#ff7f89!important;
}
.system-toggle.off .toggle-track{
  border-color:#a84a54!important;
  background:#6b2930!important;
}
.system-toggle.off .toggle-track i{
  left:2px!important;
  background:#ffe6e8!important;
}
.system-toggle.unknown{
  opacity:.6;
}
.system-toggle.pending{
  opacity:.55!important;
  cursor:wait!important;
  pointer-events:none!important;
}
.command-state{
  display:block!important;
  min-height:9px!important;
  height:9px!important;
  margin-top:3px!important;
  overflow:hidden;
  font-size:7px!important;
  line-height:9px!important;
  white-space:nowrap;
  text-overflow:ellipsis;
}

/* Edit button reliability / hit area */
.card-edit-btn{
  position:relative;
  z-index:3;
  pointer-events:auto!important;
  cursor:pointer!important;
}

/* v0.3.8 definitive System Status alignment */
.system-tile{
  display:flex!important;
  flex-direction:column!important;
  justify-content:flex-start!important;
  overflow:visible!important;
}
.system-tile > span{
  margin:0 0 7px 0!important;
}
.system-state-row{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) 34px!important;
  align-items:center!important;
  column-gap:7px!important;
  width:100%!important;
  min-width:0!important;
  height:24px!important;
}
.system-state-row strong{
  display:block!important;
  min-width:0!important;
  margin:0!important;
  padding:0!important;
  font-size:18px!important;
  line-height:24px!important;
  white-space:nowrap!important;
  overflow:visible!important;
}
.system-toggle{
  appearance:none!important;
  -webkit-appearance:none!important;
  display:block!important;
  justify-self:end!important;
  width:34px!important;
  height:20px!important;
  min-width:34px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:999px!important;
  background:transparent!important;
  line-height:0!important;
  cursor:pointer!important;
}
.system-toggle .toggle-label{display:none!important}
.system-toggle .toggle-track{
  position:relative!important;
  display:block!important;
  width:34px!important;
  height:20px!important;
  margin:0!important;
  border-radius:999px!important;
  border:1px solid #667d87!important;
  background:#34464e!important;
  box-shadow:inset 0 1px 4px rgba(0,0,0,.32)!important;
}
.system-toggle .toggle-track i{
  position:absolute!important;
  top:2px!important;
  left:2px!important;
  width:14px!important;
  height:14px!important;
  border-radius:50%!important;
  background:#d2dde1!important;
  transition:left .16s ease!important;
}
.system-toggle.on .toggle-track{
  border-color:#3bd48a!important;
  background:#168a55!important;
}
.system-toggle.on .toggle-track i{
  left:16px!important;
  background:#f0fff7!important;
}
.system-toggle.off .toggle-track{
  border-color:#a84a54!important;
  background:#6b2930!important;
}
.system-toggle.off .toggle-track i{
  left:2px!important;
  background:#ffe6e8!important;
}
.system-toggle.pending{opacity:.55!important;pointer-events:none!important}
.command-state{
  display:block!important;
  width:100%!important;
  min-height:8px!important;
  height:8px!important;
  margin:2px 0 0 0!important;
  padding:0!important;
  overflow:hidden!important;
  font-size:7px!important;
  line-height:8px!important;
  white-space:nowrap!important;
  text-overflow:ellipsis!important;
}

/* v0.3.9 OFF-state toggle alignment refinement */
.system-toggle.off .toggle-track{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  padding:0!important;
}
.system-toggle.off .toggle-track i{
  position:absolute!important;
  top:2px!important;
  left:2px!important;
  width:14px!important;
  height:14px!important;
  margin:0!important;
  transform:none!important;
}
.system-toggle.off{
  padding:0!important;
  margin:0!important;
}

/* v0.4.0 - definitive compact System Status layout */
.metric-strip{
  grid-template-columns:1fr 1fr 1.08fr 1.12fr!important;
}
.system-tile{
  padding:8px 7px!important;
  min-width:0!important;
}
.system-tile > span{
  display:block!important;
  margin:0 0 8px 0!important;
  font-size:7.5px!important;
  line-height:1.15!important;
  white-space:nowrap!important;
}
.system-state-row{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:4px!important;
  width:100%!important;
  height:22px!important;
  min-width:0!important;
}
.system-state-row strong{
  display:block!important;
  flex:0 0 auto!important;
  margin:0!important;
  padding:0!important;
  font-size:17px!important;
  line-height:22px!important;
  letter-spacing:-0.02em!important;
  white-space:nowrap!important;
}
.system-toggle{
  display:block!important;
  flex:0 0 28px!important;
  width:28px!important;
  min-width:28px!important;
  height:18px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
  border-radius:999px!important;
  line-height:0!important;
}
.system-toggle .toggle-track{
  position:relative!important;
  display:block!important;
  width:28px!important;
  height:18px!important;
  margin:0!important;
  padding:0!important;
  border-radius:999px!important;
  border:1px solid #687e87!important;
  background:#35474e!important;
  box-sizing:border-box!important;
}
.system-toggle .toggle-track i{
  position:absolute!important;
  top:2px!important;
  left:2px!important;
  width:12px!important;
  height:12px!important;
  margin:0!important;
  border-radius:50%!important;
  box-sizing:border-box!important;
}
.system-toggle.on .toggle-track{
  background:#168a55!important;
  border-color:#39d087!important;
}
.system-toggle.on .toggle-track i{
  left:12px!important;
  background:#f0fff7!important;
}
.system-toggle.off .toggle-track{
  background:#6b2930!important;
  border-color:#a84a54!important;
}
.system-toggle.off .toggle-track i{
  left:2px!important;
  background:#ffe6e8!important;
}
.command-state{
  margin-top:2px!important;
  height:7px!important;
  min-height:7px!important;
  line-height:7px!important;
  font-size:6.5px!important;
}

/* v0.4.1 - precision-center the System Status switch knob */
.system-toggle .toggle-track i{
  top:50%!important;
  width:12px!important;
  height:12px!important;
  margin:0!important;
  transform:translateY(-50%)!important;
}
.system-toggle.off .toggle-track i{
  left:2px!important;
}
.system-toggle.on .toggle-track i{
  left:13px!important;
}

/* v0.4.2 - flex-centered switch knob, symmetric in both positions */
.system-toggle{
  width:30px!important;
  min-width:30px!important;
  height:18px!important;
  flex-basis:30px!important;
}
.system-toggle .toggle-track{
  position:relative!important;
  display:flex!important;
  align-items:center!important;
  width:30px!important;
  height:18px!important;
  padding:2px!important;
  margin:0!important;
  box-sizing:border-box!important;
  border-radius:999px!important;
}
.system-toggle .toggle-track i{
  position:static!important;
  display:block!important;
  flex:0 0 12px!important;
  width:12px!important;
  height:12px!important;
  margin:0!important;
  padding:0!important;
  transform:none!important;
  top:auto!important;
  left:auto!important;
}
.system-toggle.off .toggle-track{
  justify-content:flex-start!important;
}
.system-toggle.on .toggle-track{
  justify-content:flex-end!important;
}

/* v0.5.0 Morningstar solar controller profile */
.pole-card.solar{
  grid-column:1 / -1;
  background:
    radial-gradient(circle at 88% 6%,rgba(241,185,71,.12),transparent 30%),
    linear-gradient(180deg,#10232b,#091820);
}
.solar-metrics{
  display:grid;
  grid-template-columns:repeat(10,minmax(88px,1fr));
  gap:6px;
  margin-top:12px;
}
.solar-metrics .readout{
  min-height:66px;
  padding:8px;
}
.solar-metrics .readout span{
  min-height:20px;
  font-size:7px;
  line-height:1.25;
}
.solar-metrics .readout strong{
  font-size:15px;
  margin-top:4px;
}
.solar-secondary{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:8px;
}
.solar-secondary span{
  padding:5px 7px;
  border:1px solid #2b4550;
  border-radius:6px;
  background:#07161d;
  color:#8eb0bd;
  font-size:8px;
}
.solar-secondary b{color:#dcecf2}
.solar-secondary .fault-text{
  border-color:#87424a;
  color:#ff9ba3;
}
.card-footer-actions{
  display:flex;
  align-items:center;
  gap:6px;
}
.solar-reset-btn{
  height:28px;
  padding:0 10px;
  border-radius:7px;
  border:1px solid #80672e;
  background:#2b240f;
  color:#ffd36d;
  font-size:9px;
  font-weight:800;
  cursor:pointer;
}
.solar-reset-btn:hover{
  border-color:#c49a39;
  background:#382d10;
}
@media(max-width:1400px){
  .solar-metrics{grid-template-columns:repeat(5,1fr)}
}
@media(max-width:850px){
  .solar-metrics{grid-template-columns:repeat(2,1fr)}
}

/* v0.5.2 company management */
.company-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(320px,1fr));
  gap:12px;
}
.company-card{
  background:linear-gradient(180deg,#0d2230,#091820);
  border:1px solid var(--line);
  border-radius:13px;
  padding:14px;
  box-shadow:var(--shadow);
}
.company-card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
.company-card h3{
  margin:6px 0 3px;
  font-size:16px;
}
.company-card small{
  color:var(--muted);
  font-size:9px;
}
.company-code{
  display:inline-flex;
  align-items:center;
  min-height:21px;
  padding:0 7px;
  border-radius:6px;
  border:1px solid #2b657b;
  background:#0a2633;
  color:#68e3f1;
  font-size:8px;
  font-weight:900;
  letter-spacing:.09em;
}
.company-sites{
  display:grid;
  gap:6px;
  margin-top:13px;
}
.company-site-row{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  text-align:left;
  border:1px solid #1d3d4a;
  background:#071820;
  color:white;
  border-radius:8px;
  padding:9px 10px;
  cursor:pointer;
}
.company-site-row:hover{
  border-color:#278ab3;
  background:#0a2532;
}
.company-site-row b{
  display:block;
  font-size:10px;
}
.company-site-row small{
  display:block;
  margin-top:2px;
  font-size:8px;
}
.company-site-row em{
  font-style:normal;
  color:#81a8b7;
  font-size:8px;
  white-space:nowrap;
}
.empty-company-sites{
  border:1px dashed #294551;
  color:#6e8994;
  border-radius:8px;
  padding:12px;
  font-size:9px;
}
.company-add-site{
  width:100%;
  margin-top:10px;
  height:32px;
  border:1px solid #1f6781;
  background:#092532;
  color:#9be9f8;
  border-radius:7px;
  font-size:9px;
  font-weight:800;
  cursor:pointer;
}
.company-add-site:hover{
  background:#0d3141;
  border-color:#2ca8d8;
}

/* v0.5.3 edit-pole device assignment */
#poleModal #deviceAssignmentPanel{
  margin-top:10px;
}
#poleModal #deviceManagementPanel + #deviceAssignmentPanel{
  border-top-color:#286078;
}

/* v0.5.4 I/O data + card customization */
.card-head-actions{
  display:flex;
  align-items:center;
  gap:7px;
}
.customize-btn{
  height:24px;
  padding:0 9px;
  border-radius:6px;
  border:1px solid #315a6c;
  background:#091b24;
  color:#a9cbd8;
  font-size:8px;
  font-weight:800;
  cursor:pointer;
}
.customize-btn:hover{
  border-color:#35b8e9;
  color:#dff8ff;
  background:#0b2936;
}
.io-section{
  margin-top:10px;
  padding-top:9px;
  border-top:1px solid #24414c;
}
.io-section-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:7px;
  color:#66dff0;
  font-size:7px;
  font-weight:900;
  letter-spacing:.12em;
}
.io-metrics{
  display:grid;
  grid-template-columns:repeat(4,minmax(100px,1fr));
  gap:6px;
}
.io-metrics .readout{
  min-height:62px;
}
.customize-modal{
  width:min(760px,94vw);
}
.modal-sub{
  margin:4px 0 0;
  color:#7593a0;
  font-size:9px;
}
.customize-toolbar{
  display:flex;
  justify-content:flex-end;
  gap:7px;
  margin-bottom:10px;
}
.customize-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  max-height:58vh;
  overflow:auto;
  padding-right:3px;
}
.customize-group{
  border:1px solid #24414d;
  border-radius:10px;
  background:#071820;
  overflow:hidden;
}
.customize-group-title{
  padding:9px 11px;
  border-bottom:1px solid #24414d;
  color:#66dff0;
  font-size:8px;
  font-weight:900;
  letter-spacing:.09em;
  background:#0a222d;
}
.customize-option{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:39px;
  padding:7px 11px;
  border-bottom:1px solid #142f39;
  cursor:pointer;
  color:#d5e5eb;
  font-size:9px;
}
.customize-option:last-child{border-bottom:0}
.customize-option input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.customize-option i{
  position:relative;
  width:34px;
  height:19px;
  flex:0 0 34px;
  border-radius:999px;
  border:1px solid #536d78;
  background:#263941;
}
.customize-option i:after{
  content:"";
  position:absolute;
  width:13px;
  height:13px;
  top:2px;
  left:2px;
  border-radius:50%;
  background:#cbd7db;
  transition:left .15s ease;
}
.customize-option input:checked + i{
  background:#168a55;
  border-color:#38d087;
}
.customize-option input:checked + i:after{
  left:17px;
  background:#f0fff7;
}
@media(max-width:900px){
  .io-metrics{grid-template-columns:repeat(2,1fr)}
  .customize-grid{grid-template-columns:1fr}
}

/* v0.5.6 Solar disconnect control */
.card-footer-left{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.solar-disconnect-btn{
  height:28px;
  padding:0 11px;
  border-radius:7px;
  border:1px solid #a96933;
  background:#321b0d;
  color:#ffb776;
  font-size:9px;
  font-weight:900;
  cursor:pointer;
}
.solar-disconnect-btn:hover{
  border-color:#e2873b;
  background:#41220d;
}
.solar-disconnect-btn.active{
  border-color:#3f9c73;
  background:#0e3124;
  color:#63e5a3;
}

/* v0.5.7 action-button order */
.card-footer-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:7px;
  flex-wrap:wrap;
}

/* v0.5.9 Customize Card Data moved beside Last Seen */
.footer-customize-btn{
  height:24px;
  padding:0 9px;
  white-space:nowrap;
}

/* v0.6.2 Secure Serve Pole Control branding */
.brand.pole-brand{
  height:104px;
  padding:7px 8px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-bottom:1px solid #17303b;
}
.brand.pole-brand img{
  display:block;
  width:100%;
  max-width:150px;
  max-height:88px;
  object-fit:contain;
}
.sidebar-brand-footer{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:8px 10px 2px;
}
.sidebar-brand-footer img{
  display:block;
  width:108px;
  max-height:68px;
  object-fit:contain;
  opacity:.96;
}

/* v0.7.0 Oyster3 GPS integration */
.gps-strip{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:9px;
  padding-top:9px;
  border-top:1px solid #24414c;
}
.gps-chip{
  min-width:118px;
  border:1px solid #244653;
  border-radius:7px;
  background:#071820;
  padding:6px 8px;
}
.gps-chip span{
  display:block;
  color:#65b9ce;
  font-size:6.5px;
  letter-spacing:.08em;
  margin-bottom:3px;
}
.gps-chip strong{
  display:block;
  color:#e6f4f7;
  font-size:9px;
  line-height:1.2;
}
.gps-chip strong.good{color:#45eda1}
.gps-chip strong.bad{color:#ff6b7b}

/* v0.7.2 all-site-poles map behavior */
.map-status-note{
  margin-top:6px;
  color:#7899a6;
  font-size:8px;
  text-align:right;
}

/* v0.7.3 map interaction + saved view */
.site-map-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:7px 0 6px;
}
.map-hint{
  color:#7899a6;
  font-size:8px;
}
.map-hint b{
  color:#d8eef4;
}
.map-view-actions{
  display:flex;
  align-items:center;
  gap:6px;
}
.map-view-btn{
  height:29px;
  padding:0 10px;
  white-space:nowrap;
}
@media(max-width:700px){
  .site-map-toolbar{
    align-items:flex-start;
    flex-direction:column;
  }
}


/* v0.7.4 Settings + battery warning states */
.settings-layout{display:grid;grid-template-columns:minmax(0,760px);gap:14px}
.settings-card{border:1px solid #1b3a52;border-radius:14px;background:linear-gradient(180deg,#0a1b29,#071522);padding:18px;box-shadow:0 12px 28px rgba(0,0,0,.14)}
.settings-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:18px}
.settings-card-head h3{margin:4px 0 5px;font-size:20px}
.settings-card-head p{margin:0;color:#7f96a9;font-size:10px}
.settings-status-pill{border:1px solid #24506d;border-radius:999px;padding:5px 9px;color:#62c9ff;background:#0a2030;font-size:8px;font-weight:900;letter-spacing:.8px}
.settings-field-row{display:grid;grid-template-columns:minmax(220px,320px) auto;gap:12px;align-items:end}
.voltage-input-wrap{display:grid;grid-template-columns:1fr 42px;border:1px solid #24455f;border-radius:10px;overflow:hidden;background:#06131f}
.voltage-input-wrap input{border:0!important;border-radius:0!important;background:transparent!important}
.voltage-input-wrap span{display:grid;place-items:center;border-left:1px solid #24455f;color:#86a2b7;font-size:11px;font-weight:800}
.settings-save-btn{height:40px}
.settings-rule-preview{display:grid;gap:8px;margin-top:18px;padding-top:16px;border-top:1px solid #17364e}
.settings-rule{display:grid;grid-template-columns:10px 1fr;gap:10px;align-items:center;padding:9px 10px;border:1px solid #16334a;border-radius:9px;background:#081824}
.settings-rule i{width:8px;height:8px;border-radius:50%;background:#21dca3;box-shadow:0 0 9px rgba(33,220,163,.35)}
.settings-rule.warning i{background:#ffc24f;box-shadow:0 0 9px rgba(255,194,79,.35)}
.settings-rule.critical i{background:#ff5b72;box-shadow:0 0 9px rgba(255,91,114,.38)}
.settings-rule strong{display:block;font-size:10px}.settings-rule span{display:block;margin-top:2px;color:#7790a4;font-size:9px}
.settings-meta{margin-top:12px;color:#627d91;font-size:9px}
.readout.battery-readout.battery-low{border-color:rgba(255,194,79,.62)!important;background:linear-gradient(180deg,rgba(88,65,15,.24),rgba(9,25,37,.94))!important;box-shadow:inset 0 0 0 1px rgba(255,194,79,.06)}
.readout.battery-readout.battery-low strong{color:#ffc24f!important;text-shadow:0 0 10px rgba(255,194,79,.18)}
.readout.battery-readout.battery-critical{border-color:rgba(255,91,114,.72)!important;background:linear-gradient(180deg,rgba(92,21,34,.29),rgba(9,25,37,.94))!important;box-shadow:inset 0 0 0 1px rgba(255,91,114,.08)}
.readout.battery-readout.battery-critical strong{color:#ff5b72!important;text-shadow:0 0 11px rgba(255,91,114,.22)}
@media(max-width:760px){.settings-field-row{grid-template-columns:1fr}}


/* v0.7.6 dashboard battery/LVD summary cards */
.dashboard-alert-cards{
  display:flex;
  justify-content:center;
  align-items:stretch;
  gap:14px;
  margin:2px auto 16px;
  width:min(760px,100%);
}
.dashboard-alert-card{
  width:min(330px,46vw);
  min-height:96px;
  display:grid;
  grid-template-columns:42px minmax(0,1fr);
  grid-template-rows:auto auto;
  column-gap:13px;
  align-items:center;
  text-align:left;
  border-radius:13px;
  padding:14px 16px;
  cursor:pointer;
  transition:.15s ease;
  box-shadow:0 10px 24px rgba(0,0,0,.12);
}
.dashboard-alert-card:hover{
  transform:translateY(-1px);
}
.dashboard-alert-card.low{
  border:1px solid rgba(255,194,79,.46);
  background:linear-gradient(145deg,rgba(75,54,12,.30),#0a1922);
}
.dashboard-alert-card.lvd{
  border:1px solid rgba(255,91,114,.46);
  background:linear-gradient(145deg,rgba(78,18,29,.30),#0a1922);
}
.dashboard-alert-card.active.low{
  border-color:#ffc24f;
  box-shadow:0 0 0 1px rgba(255,194,79,.18),0 12px 28px rgba(0,0,0,.18);
}
.dashboard-alert-card.active.lvd{
  border-color:#ff5b72;
  box-shadow:0 0 0 1px rgba(255,91,114,.18),0 12px 28px rgba(0,0,0,.18);
}
.dashboard-alert-icon{
  grid-row:1/3;
  width:38px;height:38px;
  border-radius:50%;
  display:grid;
  place-items:center;
  font-size:20px;
  font-weight:950;
}
.dashboard-alert-card.low .dashboard-alert-icon{
  color:#ffc24f;
  border:1px solid rgba(255,194,79,.5);
  background:rgba(255,194,79,.10);
}
.dashboard-alert-card.lvd .dashboard-alert-icon{
  color:#ff667c;
  border:1px solid rgba(255,91,114,.5);
  background:rgba(255,91,114,.10);
}
.dashboard-alert-copy{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:14px;
}
.dashboard-alert-copy>span{
  color:#dbe9ef;
  font-size:11px;
  font-weight:850;
  text-transform:uppercase;
  letter-spacing:.06em;
}
.dashboard-alert-copy strong{
  font-size:30px;
  line-height:1;
}
.dashboard-alert-card.low .dashboard-alert-copy strong{color:#ffc24f}
.dashboard-alert-card.lvd .dashboard-alert-copy strong{color:#ff667c}
.dashboard-alert-card small{
  grid-column:2;
  color:#77909d;
  font-size:8px;
  margin-top:5px;
}
.dashboard-alert-filter-note{
  display:none;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:28px;
  margin:-8px 0 12px;
  color:#8ca4b0;
  font-size:9px;
}
.dashboard-alert-filter-note.visible{display:flex}
.dashboard-alert-filter-note button{
  border:1px solid #244958;
  border-radius:7px;
  background:#0a1c25;
  color:#9ec8d8;
  font-size:8px;
  padding:5px 8px;
  cursor:pointer;
}
@media(max-width:760px){
  .dashboard-alert-cards{flex-direction:column;align-items:stretch}
  .dashboard-alert-card{width:100%}
}


/* v0.7.7 modal stacking fix: keep all dialogs above Leaflet map panes/controls */
.modal-bg{z-index:5000!important}
.modal-bg .modal{position:relative;z-index:5001}
.toast{z-index:6000!important}

/* pole-source-badges-v0711 */
.pole-source-badge{display:inline-flex!important;width:auto!important;align-items:center;padding:2px 8px;border:1px solid #526777;border-radius:999px;font-size:10px!important;font-weight:800!important;line-height:1.3;white-space:nowrap;margin-top:4px;color:#a8bdca!important;background:#112330}
.pole-source-badge.mydevices{color:#d0afff!important;border-color:#7955bd;background:#211c38}
.pole-source-badge.chirpstack{color:#67ccff!important;border-color:#1674a2;background:#0b293c}
.pole-source-group{display:flex;flex-wrap:wrap;gap:6px 12px;margin-top:6px}
.pole-source-item{display:inline-flex;gap:5px;align-items:center;color:#8ea6b6;font-size:10px}
.pole-source-item .pole-source-badge{margin-top:0}

.reboot-control{display:flex;flex-direction:column;align-items:flex-end;gap:4px;max-width:230px}.reboot-control small{font-size:10px;color:#a9bdca;line-height:1.35;text-align:right}.reboot-btn:disabled{opacity:.65;cursor:wait}
