/* v0.3: login, site selector, user menu, portfolio, equipment tree and cards, users */
.small { font-size: 12px; }
.na { color: var(--dim); font-style: italic; }
.nowrap { white-space: nowrap; }
.wide { width: 100%; }
.narrow { max-width: 760px; }
.search { font: inherit; font-size: 13px; color: var(--text); background: var(--well); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 10px; min-width: 220px; }
.chip.warn { color: var(--warn); border-color: var(--warn); }
.chip.demo { color: var(--warn); border-color: var(--warn); font-weight: 600; }

/* login */
.loginpage { display: grid; place-items: center; min-height: 100vh; padding: 16px; box-sizing: border-box; }
.loginbox { width: min(400px, 100%); padding: 26px 24px; box-shadow: 0 16px 50px var(--shadow); }
.loginlogo { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.loginlogo b { display: block; font-size: 20px; font-family: var(--display, inherit); }
.loginlogo small { color: var(--muted); font-size: 12px; }
.pwrow { display: flex; gap: 6px; }
.pwrow input { flex: 1; }
.loginerr { color: var(--alarm); font-size: 13px; margin: 4px 0 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* header: site picker and user menu */
.sitepick { position: relative; }
.sitebtn, .userbtn { font: inherit; font-size: 13px; border-radius: 8px; padding: 6px 12px; cursor: pointer; max-width: 300px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); }
.sitebtn::after { content: " ▾"; }
.sitemenu, .umenu { position: absolute; top: calc(100% + 6px); z-index: 30; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px;
  box-shadow: 0 12px 34px var(--shadow); color: var(--text); }
.sitemenu { left: 0; width: min(380px, 92vw); padding: 8px; }
.sitemenu input { width: 100%; box-sizing: border-box; font: inherit; padding: 7px 9px; border-radius: 7px; border: 1px solid var(--line2); background: var(--well); color: var(--text); }
.sitemenu ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 320px; overflow: auto; }
.sitemenu li { padding: 8px; border-radius: 7px; cursor: pointer; }
.sitemenu li:hover, .sitemenu li.on { background: var(--well); }
.sitemenu li b { display: block; font-size: 13px; }
.sitemenu li small { color: var(--muted); font-size: 11px; }
.usermenu { position: relative; }
.umenu { right: 0; min-width: 230px; padding: 6px; }
.umenu .who { padding: 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.umenu .who small { display: block; color: var(--muted); font-size: 11px; }
.umenu a, .umenu button { display: block; width: 100%; text-align: left; padding: 8px; border-radius: 7px; color: var(--text); text-decoration: none;
  font: inherit; font-size: 13px; background: none; border: 0; cursor: pointer; }
.umenu a:hover, .umenu button:hover { background: var(--well); }

/* portfolio */
.sitegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.sitecard { cursor: pointer; }
.sitecard.current { box-shadow: inset 0 0 0 2px var(--bess); }
.sitecard:focus-visible { outline: 2px solid var(--bess); }
.sc-head { display: flex; gap: 8px; justify-content: space-between; align-items: start; }
.sc-head h3 { margin: 0; font-size: 16px; }
.sc-state { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 10px; font-size: 13px; }
.kv { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv b { font-variant-numeric: tabular-nums; }
.sc-foot { margin-top: 10px; }

/* equipment */
.eqgrid { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 14px; align-items: start; }
.eqgrid > * { min-width: 0; }
.eqtree .search { width: 100%; box-sizing: border-box; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.filters select { font: inherit; font-size: 12px; padding: 5px 7px; border-radius: 7px; border: 1px solid var(--line2); background: var(--well); color: var(--text); }
.chk { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-right: 10px; }
.treebtns { display: flex; gap: 6px; margin-bottom: 8px; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 16px; border-left: 1px dashed var(--line2); margin-left: 9px; }
.tree { max-height: calc(100vh - 290px); min-height: 200px; overflow: auto; }
.station > .sname { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--h2); margin: 10px 0 4px; }
.tnode { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 7px; cursor: pointer; }
.tnode:hover { background: var(--well); }
.tree li.sel > .tnode { background: var(--well); box-shadow: inset 3px 0 0 var(--bess); }
.tog { width: 18px; flex: none; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.tname { min-width: 0; flex: 1; }
.tname b { display: block; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tname small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnt { font-size: 11px; color: var(--muted); border: 1px solid var(--line2); border-radius: 999px; padding: 0 6px; }
.cardhead { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cardtitle { margin: 0; font-size: 20px; }
.cardstate { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; }
.cardstate .led { display: inline-block; margin-right: 4px; }
.cardtabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.cardtabs button, .pagetabs button { background: transparent; border: 1px solid transparent; color: var(--muted); border-radius: 7px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.cardtabs button.on, .pagetabs button.on { color: var(--text); border-color: var(--line2); background: var(--well); }
.pagetabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.dimrow td { color: var(--muted); }
.limits3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.limits3 h4, .trend h4 { margin: 0 0 6px; font-size: 13px; }
.spark { width: 100%; height: 110px; display: block; }
.trend { margin-bottom: 14px; }
.scroll.tall { max-height: 70vh; }
.temppw code { font-size: 20px; letter-spacing: 1px; user-select: all; }
code { font-family: Consolas, monospace; font-size: 12px; }

@media (max-width: 900px) {
  .eqgrid { grid-template-columns: 1fr; }
  .tree { max-height: 50vh; }
  .limits3 { grid-template-columns: 1fr; }
  .sitebtn { max-width: 200px; }
}
@media (max-width: 760px) {
  .search { min-width: 0; width: 100%; }
  .cardstate { align-items: flex-start; }
  .sitegrid { grid-template-columns: 1fr; }
}

.brand b { white-space: nowrap; }
.top .sitebtn { max-width: 260px; }
.top .brand small { display: none; }
.top .brand { flex: none; }

/* inputs */
.ingrid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.ingrid > * { min-width: 0; }
.wizard .step { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.wizard #w-map:not([hidden]), .wizard #w-result:not([hidden]) { display: block; }
.mapgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 12px; }
.sheetprev { max-height: 360px; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; }
.tbl.sheet th, .tbl.sheet td { font-size: 11px; padding: 3px 6px; white-space: nowrap; border-right: 1px solid var(--line); }
.tbl.sheet th small { display: block; color: var(--dim); font-weight: 400; }
.issues { list-style: none; padding: 0; margin: 8px 0; max-height: 220px; overflow: auto; font-size: 13px; }
.issues li { padding: 4px 8px; border-left: 3px solid var(--warn); margin-bottom: 4px; background: var(--well); }
.issues li.error { border-left-color: var(--alarm); }
.planv { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.planv.approved { border-color: var(--ok); }
.planv.superseded { opacity: .7; }
.pv-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pv-head button { margin-left: auto; }
.hgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.hgrid span { background: var(--well); border-radius: 6px; padding: 4px 6px; }
.hgrid small { display: block; color: var(--muted); }
.hgrid em { display: block; font-style: normal; font-size: 11px; }
@media (max-width: 1100px) { .ingrid { grid-template-columns: 1fr; } .mapgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .mapgrid { grid-template-columns: 1fr; } .hgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
[hidden] { display: none !important; }

/* site plan */
.spgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.spgrid.editing { grid-template-columns: 280px minmax(0, 1fr); }
.spgrid > * { min-width: 0; }
.sp-view { padding: 8px; }
.viewport { position: relative; overflow: hidden; height: calc(100vh - 210px); min-height: 360px; background: var(--well); border-radius: 10px; touch-action: none; cursor: grab; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage img { display: block; width: 100%; height: 100%; user-select: none; pointer-events: none; }
#markers { position: absolute; inset: 0; }
.mk { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.mk i { width: var(--s); height: var(--s); border-radius: 50%; border: calc(var(--s) / 9) solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .35); background: var(--none); flex: none; }
.mk.ok i { background: var(--ok); } .mk.bad i { background: var(--alarm); } .mk.stale i { background: var(--warn); }
.mk.alarm i { animation: pulse 1.6s infinite; }
.mk.sel i { outline: 3px solid var(--bess); }
.mk span { font-size: calc(var(--s) * .42); background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 6px; padding: 1px 5px; line-height: 1.25; }
.mk span em { display: block; font-style: normal; color: var(--muted); }
.unplaced { list-style: none; padding: 0; margin: 8px 0; max-height: 40vh; overflow: auto; }
.unplaced li { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; margin-bottom: 5px; cursor: grab; background: var(--panel); }
.unplaced li b { display: block; font-size: 13px; font-weight: 500; }
.unplaced li small { color: var(--muted); font-size: 11px; }
@media (max-width: 900px) { .spgrid.editing { grid-template-columns: 1fr; } .viewport { height: 60vh; } }

/* control panel (demo): status bar, manual block, settings, "why" */
.ctlbar { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-bottom: 14px; }
.ctlbar > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ctlbar small { color: var(--muted); font-size: 11px; }
.ctlbar b { font-size: 13px; }
.ctlbar select { max-width: 260px; }
.ctlbar .full { flex-basis: 100%; margin: 0; }
.ctlbar .chip { align-self: flex-start; }
.manual { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.manual .seg { align-self: end; }
.settings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.actions .btn { width: 100%; }
.actions p { margin: 0; }
.why p { margin: 0 0 8px; }
.planbox { border: 1px solid var(--line2); border-radius: 10px; padding: 10px; margin: 10px 0; }
@media (max-width: 1200px) { .manual { grid-template-columns: 1fr 1fr; } .settings { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .manual, .settings { grid-template-columns: 1fr; } .ctlbar > div { flex-basis: 45%; } .ctlbar select { max-width: 100%; } }
/* nine menu items do not fit next to the status pills below ~1600 px: menu moves to its own row */
@media (max-width: 1600px) { .top { flex-wrap: wrap; } .nav { order: 5; width: 100%; margin-left: 0; overflow-x: auto; } }
/* on a phone the wrapped header is ~300 px tall: do not pin it, or it covers a third of the screen */
@media (max-width: 760px) { .top { position: static; } }

/* HOR brand: wordmark cut from the owner's PNG; the theme picks the black or the white version */
.brand { text-decoration: none; color: inherit; }
.brand .hor { height: 30px; width: auto; display: block; }
.brand b { font-family: var(--display, inherit); font-size: 15px; letter-spacing: .5px; }
.hor-d { display: none !important; }
html[data-theme="dark"] .hor-l { display: none !important; }
html[data-theme="dark"] .hor-d { display: block !important; }
html[data-theme="dark"] .hd .logo img { content: url("/static/horems-logo-dark.svg"); }
.loginlogo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; text-align: center; }
.loginlogo .hor { width: min(280px, 80%); height: auto; }

/* ---- HOR v3 (03.11.2026, owner: design of the HOR Energy investment offer) ----
   White page, flat light-grey blocks #D9D9D9 with large round corners, no shadows and no borders,
   HOR orange #F49415 for accents and highlighted blocks (black text on orange), mid greys #AFAFAF/#969696
   for secondary marks, black Montserrat. Night theme is not changed. */
html:not([data-theme="dark"]) {
  --bg: #ffffff; --panel: #d9d9d9; --panel2: #ffffff; --card: #ffffff; --well: #ececec;
  --line: #c4c4c4; --line2: #b3b3b3; --text: #111111; --text2: #1f1f1f; --h2: #111111;
  --muted: #3d3d3d; --dim: #4d4d4d; --zero: #969696; --gridpat: #cfcfcf; --hor-grey: #afafaf; --hor-orange: #f49415;
  --card-shadow: none;
}
html:not([data-theme="dark"]) body { background: #fff; font-family: var(--display); font-weight: 500; color: var(--text); }
html:not([data-theme="dark"]) .top { background: #fff; box-shadow: none; border-bottom: 0; }
html:not([data-theme="dark"]) .panel { background: var(--panel); box-shadow: none; border: 0; border-radius: 28px; padding: 22px 24px; }
html:not([data-theme="dark"]) .panel .panel { background: #fff; border-radius: 18px; padding: 14px 16px; }
html:not([data-theme="dark"]) .kpis .panel, html:not([data-theme="dark"]) .mkpis .panel { box-shadow: none; }
html:not([data-theme="dark"]) .phead h2 { font-size: 19px; font-weight: 700; color: #000; }
html:not([data-theme="dark"]) .kpi .val { color: #000; }
html:not([data-theme="dark"]) .banner { background: var(--panel); box-shadow: none; border-radius: 20px; }
html:not([data-theme="dark"]) .banner.demo { background: var(--hor-orange); color: #000; }
html:not([data-theme="dark"]) .tbl th { background: var(--panel); color: #000; font-weight: 700; border-bottom-color: var(--line2); }
html:not([data-theme="dark"]) .tbl td { border-bottom-color: var(--line); }
html:not([data-theme="dark"]) .panel .panel .tbl th { background: #fff; }
html:not([data-theme="dark"]) .field input, html:not([data-theme="dark"]) .field select, html:not([data-theme="dark"]) .field textarea,
html:not([data-theme="dark"]) .search, html:not([data-theme="dark"]) .filters select, html:not([data-theme="dark"]) .ctlbar select {
  background: #fff; border-color: var(--line2); border-radius: 12px; }
html:not([data-theme="dark"]) .bar { background: var(--hor-grey); }
html:not([data-theme="dark"]) .gridline { stroke: #c4c4c4; }
/* highlighted = HOR orange block with black text, as in the offer */
html:not([data-theme="dark"]) .modebtn { background: #fff; border: 0; border-radius: 18px; }
html:not([data-theme="dark"]) .modebtn.on { background: var(--hor-orange); box-shadow: none; }
html:not([data-theme="dark"]) .modebtn.on span { color: #000; }
html:not([data-theme="dark"]) .tabs button.on, html:not([data-theme="dark"]) .seg button.on,
html:not([data-theme="dark"]) .cardtabs button.on, html:not([data-theme="dark"]) .pagetabs button.on {
  background: var(--hor-orange); border: 2px solid var(--hor-orange); color: #000; font-weight: 700; }
html:not([data-theme="dark"]) .btn { border-radius: 999px; }
html:not([data-theme="dark"]) .btn.primary { background: var(--hor-orange); border-color: var(--hor-orange); color: #000; font-weight: 600; }
html:not([data-theme="dark"]) .nav a { color: #3d3d3d; }
html:not([data-theme="dark"]) .nav a.on { color: #000; font-weight: 700; border-bottom: 3px solid var(--hor-orange); }
html:not([data-theme="dark"]) .pill, html:not([data-theme="dark"]) .pill.demo, html:not([data-theme="dark"]) .pill.mode { background: var(--panel); color: #000; }
html:not([data-theme="dark"]) .pill.mode { background: var(--hor-orange); }
html:not([data-theme="dark"]) .themebtn, html:not([data-theme="dark"]) .alarmcount { background: var(--panel); }
html:not([data-theme="dark"]) .chip, html:not([data-theme="dark"]) .tag { background: #fff; color: #000; }
html:not([data-theme="dark"]) .chip.demo { background: var(--hor-orange); color: #000; }
html:not([data-theme="dark"]) .tree li.sel > .tnode, html:not([data-theme="dark"]) .sitemenu li.on { background: #fff; box-shadow: inset 4px 0 0 var(--hor-orange); }
html:not([data-theme="dark"]) .tnode:hover { background: #ececec; }
html:not([data-theme="dark"]) .modal .box { border: 0; border-radius: 24px; }
html:not([data-theme="dark"]) .viewport { background: #ececec; border-radius: 20px; }
html:not([data-theme="dark"]) .planbox { border: 0; background: #fff; border-radius: 18px; }
html:not([data-theme="dark"]) .loginpage { background: #fff; }
html:not([data-theme="dark"]) .loginbox { background: var(--panel); border-radius: 32px; box-shadow: none; }
html:not([data-theme="dark"]) .muted { color: var(--muted); }
@media (max-width: 760px) { html:not([data-theme="dark"]) .panel { border-radius: 22px; padding: 16px; } }
html:not([data-theme="dark"]) .pill.ok { color: #0e6a3f; }
html:not([data-theme="dark"]) .dev.pos { color: #7a4500; }
html:not([data-theme="dark"]) .res-ok { color: #0e6a3f; }
html:not([data-theme="dark"]) .res-bad, html:not([data-theme="dark"]) .na { color: #a1101d; }

/* ---- design review A (03.11.2026): control panel safety ---- */
.scopeseg { display: flex; flex-wrap: wrap; gap: 8px; }
.scopeseg button { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 2px solid #111; background: #fff; color: #111; font: inherit; font-weight: 600; cursor: pointer; }
.scopeseg button.on { background: #f49415; border-color: #f49415; color: #000; }
.scopeseg button:disabled { border: 2px dashed #767676; color: #4d4d4d; background: #ececec; cursor: not-allowed; }
#scopenote { margin: 10px 0 0; }
.nowmode { font-size: 16px; margin: 0 0 12px; }
.modes .modecard { display: flex; flex-direction: column; gap: 6px; text-align: left; background: #fff; border-radius: 18px; padding: 14px; color: #111; min-height: 120px; }
.modes .modecard b { font-size: 14px; font-weight: 700; }
.modes .modecard span { font-size: 13px; color: #3d3d3d; flex: 1; }
.modes .modecard .btn { align-self: flex-start; }
.modes .modecard.on { background: #f49415; }
.modes .modecard.on span { color: #000; }
.nowtag { align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: .4px; background: #111; color: #fff; border-radius: 999px; padding: 4px 10px; }
#dir button { min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; border: 2px solid #111; background: #fff; color: #111; font-weight: 600; border-radius: 999px; padding: 4px 16px; }
#dir button small { font-size: 12px; font-weight: 400; }
#dir button.on { background: #111; border-color: #111; color: #fff; }
.manual { grid-template-columns: auto repeat(3, minmax(0, 1fr)); }
.manual .field small { display: block; margin-top: 4px; font-size: 12px; }
.sendbtn { width: 100%; min-height: 48px; font-size: 15px; margin: 6px 0 12px; }
.sendbtn:disabled, .btn:disabled { opacity: 1; background: #ececec !important; border-color: #ececec !important; color: #4d4d4d !important; cursor: not-allowed; }
.zerobtn { border: 2px solid #111 !important; background: #fff !important; color: #111 !important; font-weight: 700; min-height: 44px; }
.infoline { margin: 4px 0 0; font-size: 13px; color: #3d3d3d; }
.secflow { font-size: 22px; display: block; }
.ctlbar .ownerline b { font-size: 18px; }
.modal .who { font-size: 18px; font-weight: 700; margin: 0 0 8px; }
.modal .ack { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 12px 0 0; }
.modal .ack input { width: 20px; height: 20px; accent-color: #111; }
.modal .dangerbox { border: 3px solid #c62334 !important; }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2::after { content: " ▾"; font-size: 14px; }
details.fold:not([open]) > summary { margin-bottom: 0; }
details.fold:not([open]) > summary h2::after { content: " ▸"; }
@media (max-width: 1200px) { .manual { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .manual { grid-template-columns: 1fr; } .scopeseg button { flex: 1 1 100%; } }
.modes .modecard span.nowtag, .modes .modecard.on span.nowtag { color: #fff; }
html:not([data-theme="dark"]) .scopeseg button { border: 2px solid #111; border-radius: 999px; padding: 0 18px; background: #fff; color: #111; }
html:not([data-theme="dark"]) .scopeseg button.on { background: #f49415; border-color: #f49415; color: #000; }
html:not([data-theme="dark"]) .scopeseg button:disabled { border: 2px dashed #767676; background: #ececec; color: #4d4d4d; }
html:not([data-theme="dark"]) #dir button { border: 2px solid #111; padding: 4px 16px; background: #fff; color: #111; }
html:not([data-theme="dark"]) #dir button.on { background: #111; border-color: #111; color: #fff; }

/* ---- design review B (03.11.2026): header, ДЕМО, colour meaning, focus, type scale ----
   Orange = "selected" or "the main action" only. Data and states have their own colours, always with a shape or a word:
   battery/discharge #111, charge #6b6b6b, sun #8a6a00, norm green ●, warning yellow ▲, alarm red ■, no data grey dashed. */
html:not([data-theme="dark"]) {
  --bess: #111111; --charge: #6b6b6b; --pv: #8a6a00; --ok: #0e6a3f; --warn: #ffd21f; --warn-ink: #111111;
  --alarm: #c62334; --none: #6b6b6b; --zero: #afafaf; --hi: #4d4d4d; --plan: #4d4d4d; --info: #1f4f99;
}
:root { --charge: #6b6b6b; }
html:not([data-theme="dark"]) body { font-weight: 400; }
html:not([data-theme="dark"]) b, html:not([data-theme="dark"]) strong { font-weight: 700; }

/* header: row 1 (64 px) logo, object, status block; row 2 menu. Same on every page. */
html:not([data-theme="dark"]) .top { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; padding: 0 24px; min-height: 64px; }
html:not([data-theme="dark"]) .top .brand { height: 64px; }
html:not([data-theme="dark"]) .top .nav { order: 5; flex-basis: 100%; width: 100%; margin: 0; height: 44px; align-items: center; overflow-x: auto; }
html:not([data-theme="dark"]) .top .sitebtn { max-width: 360px; min-height: 40px; border: 1px solid #767676; border-radius: 999px; }
.top .status { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.demotag { display: inline-block; background: #111; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .6px; border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.spill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; border-radius: 999px; padding: 6px 12px; background: #d9d9d9; color: #111; }
.spill.readonly { background: #fff; border: 1px solid #111; }
.spill.bad { background: #c62334; color: #fff; }
html:not([data-theme="dark"]) .alarmcount { width: auto; height: auto; display: inline-flex; border-radius: 999px; padding: 6px 12px; background: #d9d9d9; color: #111; font-size: 13px; font-weight: 400; }
html:not([data-theme="dark"]) .alarmcount.on { background: #c62334; color: #fff; font-weight: 700; }
html:not([data-theme="dark"]) .link { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 1.5px #fff; }
html:not([data-theme="dark"]) .link.down { background: #fff; border-radius: 0; }
.top .clock { text-align: right; }
.top .clock small { font-size: 12px; }
.loginlogo .demotag { margin-top: 4px; }

/* ДЕМО: one tag everywhere; the old orange banners become calm grey blocks */
html:not([data-theme="dark"]) .banner, html:not([data-theme="dark"]) .banner.demo { background: #d9d9d9; color: #111; border: 0; box-shadow: none; }
html:not([data-theme="dark"]) .banner.demo b:first-child::before { content: "ДЕМО"; display: inline-block; background: #111; color: #fff; border-radius: 999px; padding: 2px 10px; margin-right: 8px; font-size: 12px; letter-spacing: .5px; }
html:not([data-theme="dark"]) .chip.demo, html:not([data-theme="dark"]) .pill.demo { background: #111; color: #fff; border: 0; font-weight: 700; }

/* states: shape + colour + word */
html:not([data-theme="dark"]) .led { width: 12px; height: 12px; box-shadow: 0 0 0 1.5px #111; }
html:not([data-theme="dark"]) .led.ok { background: var(--ok); }
html:not([data-theme="dark"]) .led.stale { background: var(--warn); border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); box-shadow: none; }
html:not([data-theme="dark"]) .led.bad { background: var(--alarm); border-radius: 2px; }
html:not([data-theme="dark"]) .led.none { background: transparent; box-shadow: none; border: 2px dashed #4d4d4d; }
html:not([data-theme="dark"]) .dot { stroke: #111; stroke-width: 1.2; }
html:not([data-theme="dark"]) .dot.none { fill: #fff; stroke: #4d4d4d; stroke-dasharray: 2 2; }
html:not([data-theme="dark"]) .chip.warn, html:not([data-theme="dark"]) .tag.warn { background: var(--warn); color: #111; border: 0; }
html:not([data-theme="dark"]) .chip.warn::before { content: "▲ "; }
html:not([data-theme="dark"]) .events li.warning .lv { background: var(--warn); box-shadow: 0 0 0 1px #111; }
html:not([data-theme="dark"]) .node.stale rect, html:not([data-theme="dark"]) .blk.stale .card { stroke: #111; stroke-dasharray: 6 3; }
html:not([data-theme="dark"]) .issues li { border-left: 4px solid #111; background: #fff7cc; }
html:not([data-theme="dark"]) .dev.pos, html:not([data-theme="dark"]) .dev.neg, html:not([data-theme="dark"]) .dev.okv { color: #111; font-weight: 700; }
html:not([data-theme="dark"]) .na, html:not([data-theme="dark"]) .muted.na { color: #4d4d4d; font-style: italic; }
html:not([data-theme="dark"]) .tag.charge, html:not([data-theme="dark"]) .chip.charge { background: #fff; color: #111; border: 1px solid #111; }
html:not([data-theme="dark"]) .tag.discharge, html:not([data-theme="dark"]) .chip.discharge { background: #111; color: #fff; border: 0; }
html:not([data-theme="dark"]) .socfill { fill: #4d4d4d; opacity: 1; }
html:not([data-theme="dark"]) .sitecard.current { box-shadow: inset 0 0 0 3px #f49415; }
html:not([data-theme="dark"]) .mk.sel i { outline: 3px solid #111; }
html:not([data-theme="dark"]) .mk i { box-shadow: 0 0 0 1.5px #111; }
html:not([data-theme="dark"]) .mk.stale i { background: var(--warn); }

/* focus, touch, links, form controls */
:focus-visible { outline: 3px solid #000 !important; outline-offset: 2px; }
html:not([data-theme="dark"]) .wrap a:not(.btn), html:not([data-theme="dark"]) .umenu a { color: #000; text-decoration: underline 1px; text-underline-offset: 3px; }
html:not([data-theme="dark"]) .nav a { text-decoration: none; }
html:not([data-theme="dark"]) select { appearance: none; -webkit-appearance: none; font: inherit; color: #111; background: #fff url("/static/chevron.svg") no-repeat right 14px center;
  border: 1px solid #767676; border-radius: 12px; min-height: 40px; padding: 0 38px 0 12px; max-width: 100%; }
html:not([data-theme="dark"]) .field input, html:not([data-theme="dark"]) .search, html:not([data-theme="dark"]) .field textarea,
html:not([data-theme="dark"]) .sitemenu input { border: 1px solid #767676; border-radius: 12px; min-height: 40px; }
html:not([data-theme="dark"]) input[type="file"] { font: inherit; font-size: 13px; }
html:not([data-theme="dark"]) input[type="file"]::file-selector-button { font: inherit; font-weight: 600; border: 2px solid #111; background: #fff; color: #111; border-radius: 999px; padding: 8px 16px; margin-right: 10px; cursor: pointer; }
html:not([data-theme="dark"]) input[type="checkbox"] { width: 18px; height: 18px; accent-color: #111; }
@media (pointer: coarse), (max-width: 760px) {
  .btn, .seg button, .tabs button, .cardtabs button, .pagetabs button, .tog, select, input:not([type="checkbox"]), .nav a { min-height: 44px; }
  .tog { min-width: 44px; }
}

/* one type scale (min 12 px for data) and one radius scale: 28 panel / 18 inner card / 12 fields / 999 pills */
html:not([data-theme="dark"]) .chip, html:not([data-theme="dark"]) .tag, html:not([data-theme="dark"]) .ctlbar small,
html:not([data-theme="dark"]) .tname small, html:not([data-theme="dark"]) .tbl.sheet td, html:not([data-theme="dark"]) .tbl.sheet th,
html:not([data-theme="dark"]) .hint, html:not([data-theme="dark"]) .small { font-size: 12px; }
html:not([data-theme="dark"]) .tabs button, html:not([data-theme="dark"]) .sitemenu li, html:not([data-theme="dark"]) .tree li.sel > .tnode { border-radius: 999px; }
html:not([data-theme="dark"]) .toast { border-radius: 18px; }
html:not([data-theme="dark"]) .sheetprev { border-radius: 12px; }

/* control settings: MW, fields aligned to the bottom, selects wide enough for their text */
.settings { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); align-items: end; }
.settings .field.wide, .manual .field.wide { grid-column: span 2; }
.manual { grid-template-columns: auto repeat(2, minmax(0, 1fr)) minmax(240px, 1.4fr); align-items: start; }
@media (max-width: 1200px) { .manual { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .manual { grid-template-columns: 1fr; } .settings .field.wide { grid-column: auto; } }
@media (max-width: 760px) {
  html:not([data-theme="dark"]) .top { padding: 0 12px; gap: 6px 10px; }
  html:not([data-theme="dark"]) .top .brand { height: 52px; }
  .top .status { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .top .sitepick { order: 4; flex-basis: 100%; }
  html:not([data-theme="dark"]) .top .sitebtn { max-width: 100%; width: 100%; }
}

/* ---- design review В (03.11.2026): phone 390 px ---- */
.bottomnav, .swipehint { display: none; }
.sldscroll { width: 100%; }
@media (max-width: 760px) {
  html:not([data-theme="dark"]) .top .nav { display: none; }
  html:not([data-theme="dark"]) .top .clock small, html:not([data-theme="dark"]) .top .brand small { display: none; }
  html:not([data-theme="dark"]) .top .clock b { font-size: 18px; }
  body { padding-bottom: 72px; }
  .bottomnav { display: flex; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: 60px; background: #fff;
    border-top: 1px solid #b3b3b3; padding: 0 4px env(safe-area-inset-bottom); }
  .bottomnav > a, .bottomnav > button { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 44px; font: inherit;
    font-size: 13px; font-weight: 600; color: #3d3d3d; text-decoration: none; background: none; border: 0; border-top: 3px solid transparent; }
  .bottomnav > a.on, .bottomnav > button.on { color: #000; border-top-color: #f49415; }
  .moresheet { position: fixed; left: 8px; right: 8px; bottom: 68px; background: #fff; border: 1px solid #b3b3b3; border-radius: 18px; padding: 6px; display: grid; }
  .moresheet[hidden] { display: none; }
  .moresheet a { padding: 12px 14px; min-height: 44px; color: #111; text-decoration: none; border-radius: 12px; font-weight: 600; }
  .moresheet a.on { background: #f49415; }
  .swipehint { display: block; margin: 0 0 6px; font-size: 12px; color: #3d3d3d; }
  .sldscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sldscroll #sld { min-width: 900px; }
  .tree { max-height: none; }
  .totree { margin-bottom: 10px; }
  .viewport { height: 62vh; }
  .toolbar select, .viewport select, .planbar select { max-width: 100%; }
}
/* every table that can be wider than the screen scrolls inside its block, with a fading edge as a hint */
.scroll { overflow-x: auto;
  background: linear-gradient(to right, #d9d9d9 30%, rgba(217,217,217,0)) left / 24px 100% no-repeat local,
              linear-gradient(to left, #d9d9d9 30%, rgba(217,217,217,0)) right / 24px 100% no-repeat local,
              linear-gradient(to right, rgba(0,0,0,.18), rgba(0,0,0,0)) left / 10px 100% no-repeat scroll,
              linear-gradient(to left, rgba(0,0,0,.18), rgba(0,0,0,0)) right / 10px 100% no-repeat scroll; }
@media (max-width: 600px) {
  /* users table as cards */
  #users thead { display: none; }
  #users, #users tbody, #users tr, #users td { display: block; width: 100%; }
  #users tr { background: #fff; border-radius: 18px; padding: 10px 12px; margin-bottom: 10px; }
  #users td { border: 0; padding: 4px 0; text-align: left; }
}
@media (max-width: 760px) { .grid, .grid > *, .panel.diagram { min-width: 0; max-width: 100%; } .sldscroll { max-width: 100%; } }
@media (max-width: 760px) { html:not([data-theme="dark"]) .top .clock { display: none; } .bottomnav > a, .bottomnav > button { font-size: 12px; padding: 0 3px; text-align: center; } .top .status .spill, .top .status .demotag, html:not([data-theme="dark"]) .top .alarmcount { padding: 5px 9px; font-size: 12px; } html:not([data-theme="dark"]) .top .userbtn { min-height: 36px; padding: 4px 10px; } }
@media (max-width: 760px) { html:not([data-theme="dark"]) .top .brand > div { display: none; } html:not([data-theme="dark"]) .top .brand .hor { height: 24px; } .top .status { flex-wrap: nowrap; } }
@media (max-width: 760px) { html:not([data-theme="dark"]) .top .userbtn { max-width: 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
