button.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
button.destroy { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 650; }
button[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--cyan) 16%, transparent); }
.usbprogress { display: block; width: 100%; height: 10px; accent-color: var(--cyan); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
pre { overflow: auto; background: var(--tile); padding: 10px; border-radius: 6px; }
pre.log { max-height: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.setgroup { margin: 0 0 12px; }
.setgroup h3, .setgroup summary h3 { display: inline; font-size: 13px; margin: 0; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; }
.settings { display: grid; gap: 1px; margin-top: 6px; background: var(--line); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; }
.setting { display: grid; grid-template-columns: minmax(12rem, 2fr) minmax(8rem, 1.2fr) minmax(10rem, 1.4fr) auto;
  gap: 10px; align-items: center; padding: 8px 12px; background: var(--panel); }
.setvalue { font-variant-numeric: tabular-nums; }
@media (max-width: 720px) { .setting { grid-template-columns: 1fr auto; } .setstate { grid-column: 1; }
}
details.engineering { margin-top: 14px; }
details.engineering > summary { cursor: pointer; color: var(--muted); }
dialog.dialog { max-width: min(36rem, calc(100vw - 32px)); width: 100%; padding: 18px 20px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); }
dialog.dialog::backdrop { background: rgb(0 0 0 / .4); }
dialog.dialog h3 { margin: 0 0 8px; font-size: 16px; }
dialog.dialog .field { display: grid; gap: 4px; margin: 10px 0; }
.importresult { margin: 10px 0; }
.setapply { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
dialog.dialog h4 { margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
dialog.dialog .formacts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
table.changes { width: 100%; border-collapse: collapse; font-size: 13px; }
table.changes th, table.changes td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.changes td:nth-child(n+2) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.template-editor details.setgroup { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.template-editor summary { cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.template-editor .fields { margin-top: 8px; }
.card h3 { font-size: 13px; margin: 12px 0 6px; font-weight: 650; }
.cardhead input[type="search"] { flex: 0 1 300px; min-width: 180px; }
#view .crumbs { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
#view .crumbs a { text-decoration: none; }
#view .crumbs a:hover { text-decoration: underline; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { margin: 3px 0; }
.perms { columns: 2 260px; }
td.acts { text-align: right; white-space: nowrap; }
td.nested { padding: 10px 12px 14px 24px; background: var(--tile); }
td a { text-decoration: none; font-weight: 600; }
td a:hover { text-decoration: underline; }

.packlink { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tool {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px;
  background: var(--tile); border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
a.tool:hover { border-color: var(--accent); }
.tool.off { opacity: .6; }

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.metric {
  display: flex; flex-direction: column; padding: 10px 12px; border-radius: 8px;
  background: var(--tile); border: 1px solid var(--line); border-top: 3px solid var(--cyan);
}
.mlabel { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mvalue { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.msub { font-size: 12px; color: var(--muted); }

.form {
  margin: 12px 0; padding: 12px 14px; border-radius: 8px;
  background: color-mix(in srgb, var(--cyan) 7%, var(--panel)); border: 1px solid var(--line);
}
.form h3 { margin-top: 0; }
.field abbr { text-decoration: none; color: var(--bad); }
.field.wide { grid-column: 1 / -1; }
.field.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 18px; }
.field.check > span { color: var(--ink); font-size: 13px; }
.caps { text-transform: uppercase; }
.field.check input { width: auto; flex: none; }
.checks { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px 12px; }
.checks legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.checks label { display: flex; gap: 6px; align-items: baseline; font-size: 13px; overflow-wrap: anywhere; }
.checks input { padding: 0; }
fieldset.group { display: block; border: 1px dashed var(--line); border-radius: 6px; padding: 8px 10px 10px; margin: 0; }
fieldset.group legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.person-dealer, .person-customer, .person-service, .person-other { display: none; }
form:has(select[name="kind"] option[value="dealer"]:checked) .person-dealer,
form:has(select[name="kind"] option[value="customer"]:checked) .person-customer,
form:has(select[name="kind"] option[value="service"]:checked) .person-service,
form:has(select[name="kind"] option[value="other"]:checked) .person-other { display: flex; }
.scope-party, .scope-installation { display: none; }
form:has(select[name="kind"] option[value="other"]:checked):has(select[name="scope_kind"] option[value="party"]:checked) .scope-party,
form:has(select[name="kind"] option[value="other"]:checked):has(select[name="scope_kind"] option[value="installation"]:checked) .scope-installation { display: flex; }
form:has([data-accountpick]:not([data-mode="new"])) .account-new { display: none; }
.acctpick .acctsearch { display: flex; flex-direction: column; gap: 6px; }
.acctpick [data-account-chosen], .acctpick .acctnew { display: none; }
.acctpick[data-mode="existing"] .acctsearch, .acctpick[data-mode="new"] .acctsearch { display: none; }
.acctpick[data-mode="existing"] [data-account-chosen] { display: block; }
.acctpick[data-mode="new"] .acctnew { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.acctlist { list-style: none; margin: 4px 0 0; padding: 0; max-height: 280px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; }
.acctlist li + li { border-top: 1px solid var(--line); }
.acctrow { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; padding: 8px 10px;
  font: inherit; text-align: left; white-space: normal; color: var(--ink); }
button.acctrow { border: 0; border-radius: 0; background: transparent; justify-content: flex-start; min-height: 0; }
button.acctrow:hover, button.acctrow:focus-visible { background: var(--hover); }
div.acctrow { border: 1px solid var(--line); border-radius: 8px; }
.acctwho { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.acctwho b { font: 600 14px/20px var(--f-body); overflow-wrap: anywhere; }
.acctwho small { font: 400 12px/16px var(--f-body); color: var(--ink-2); overflow-wrap: anywhere; }
.linkrow { display: flex; gap: 8px; align-items: center; }
.linkrow .link { flex: 1; min-width: 0; font: 500 12px/16px var(--f-mono); }
.people > li:has(> .acts) { flex-wrap: wrap; }
.people > li:has(> .acts) > .grow { min-width: 10em; }
.people .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-left: auto; }
.formerr { color: var(--bad); margin: 8px 0 0; font-weight: 600; }
.formacts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
label.inline input, label.inline select { padding: 5px 8px; }

.cellsum { margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.cellkey { margin: 0 0 8px; }
.module h4 { margin: 10px 0 4px; font-size: 13px; }
.cells {
  list-style: none; margin: 0 0 8px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 4px;
}
.cell {
  border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px;
  background: var(--tile); font-variant-numeric: tabular-nums; line-height: 1.3;
}
.cell .ci { display: block; font-size: 10px; color: var(--muted); white-space: nowrap; }
.cell .cv { display: block; font-size: 12.5px; font-weight: 650; }
.cell.lo2 { background: color-mix(in srgb, var(--cyan) 40%, var(--panel)); }
.cell.lo1 { background: color-mix(in srgb, var(--cyan) 16%, var(--panel)); }
.cell.hi1 { background: color-mix(in srgb, var(--warn) 18%, var(--panel)); }
.cell.hi2 { background: color-mix(in srgb, var(--warn) 42%, var(--panel)); }
.cell.min, .cell.max { outline: 2px solid var(--ink); outline-offset: -1px; }
.cell.mmin, .cell.mmax { outline: 1px dashed var(--muted); outline-offset: -1px; }
.cell.swatch { display: inline-block; width: 14px; height: 12px; padding: 0; vertical-align: -1px; margin-left: 6px; }
.cellmap.compact .cells { grid-template-columns: repeat(auto-fill, minmax(16px, 1fr)); gap: 2px; }
.cellmap.compact .cell { height: 16px; padding: 0; border-radius: 3px; }
.cellmap.compact .cell .ci, .cellmap.compact .cell .cv { display: none; }
.temps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.temps li { border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; background: var(--tile); }
.temps li.hot { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, var(--panel)); }

.rangebar { margin-bottom: 10px; }
.rangebar button { padding: 5px 10px; }
.charts { display: grid; gap: 16px; }
.chartbox { margin: 0; }
.chartbox figcaption { font-weight: 650; font-size: 13px; }
.plot { position: relative; }
svg.chart { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.alt { stroke: var(--muted); }
.chart .dashed { stroke-dasharray: 5 4; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .dlabel { fill: var(--ink); font-size: 11px; }
.chart .xhair { stroke: var(--ink); stroke-width: 1; opacity: .45; }
.chart .xdot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.chart .xdot.alt { fill: var(--muted); }
.chart .hit { fill: transparent; pointer-events: all; cursor: crosshair; }
.tip {
  position: absolute; top: 4px; left: 0; padding: 4px 8px; border-radius: 6px;
  background: var(--panel); border: 1px solid var(--line); font-size: 12px;
  pointer-events: none; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.legend { list-style: none; display: flex; gap: 14px; margin: 2px 0 4px; padding: 0; font-size: 12px; }
.key { display: inline-block; width: 18px; border-top: 2px solid var(--accent); vertical-align: middle; margin-right: 6px; }
.key.alt { border-top-color: var(--muted); }
.key.dashed { border-top-style: dashed; }
details.values { margin-top: 12px; }
details.values summary { cursor: pointer; color: var(--accent); }

.result { background: var(--tint); border-radius: 8px; padding: 8px 12px; margin: 8px 0; }
.result p { margin: 2px 0; }
table.config input, table.config select { width: 120px; padding: 4px 6px; }
table.config tr.edited td, table.config tr.edited th { background: color-mix(in srgb, var(--cyan) 12%, transparent); }
table.config tr.conflict td, table.config tr.conflict th { background: color-mix(in srgb, var(--bad) 12%, transparent); }
tr.alarmon td { background: color-mix(in srgb, var(--bad) 8%, transparent); }
.offer { padding: 6px 0; }
.detach { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.detach select, .detach input { padding: 4px 6px; }
.detach .fault { display: none; width: 150px; }
.packcheck { margin: 10px 0 0; }
.packacts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; white-space: normal; }
.chosenbox { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; }
.chosen { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 10px; }
.chosen + .chosen { border-top: 1px solid var(--line); }
.chosen strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.modelpick [data-model-chosen], .modelpick [data-remote-chosen] { margin: 2px 0 0; }
.modelpick .picks { margin-top: 6px; }
.modelpick .picks button { padding: 4px 9px; }
.ups-kva { display: none; }
form:has(input[name="ups"]:checked) .ups-kva { display: flex; }
.packcheck .notice { margin: 6px 0 0; }
.detach:has(option[value="for_repair"]:checked) .fault { display: inline-block; }
svg.map {
  display: block; width: 100%; max-width: 480px; height: auto; margin: 8px 0;
  border: 1px solid var(--line); border-radius: 6px; background: var(--tile);
}
.map .acc { fill: color-mix(in srgb, var(--cyan) 20%, transparent); stroke: var(--deep); stroke-width: 1.5; }
.map .pin { fill: var(--bad); stroke: #fff; stroke-width: 2; }
.map .attr { font-size: 10px; fill: #111921; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.filters { margin: 0 0 10px; }
code.secret {
  display: block; margin: 6px 0; padding: 8px 10px; border-radius: 6px;
  background: var(--panel); font-size: 13px; overflow-wrap: anywhere;
}
#gateNote { margin-top: 18px; }
@media (max-width: 640px) {
  .cardhead input[type="search"] { flex: 1 1 100%; }
  .mvalue { font-size: 19px; }
  #refreshed { display: none; }
}
