:root {
  --accent: #3c4f65;
  --accent-ink: #243140;
  --ink: #14181d;
  --muted: #66707a;
  --bg: #e8eaee;
  --card: #fbfcfd;
  --input: #f3f4f6;
  --input-focus: #fff;
  --chip: #eef0f3;
  --line: rgba(20, 24, 29, 0.08);
  --shadow: 0 1px 1px rgba(20, 24, 29, 0.04), 0 18px 48px rgba(20, 24, 29, 0.06);
  --r: 20px;
  --r-sm: 12px;
  --pv: #e6b800;
  --batt: #6b5b95;
  --ev: #3b6ff0;
  --ol: #d4652a;
  --meter: #1c1c1c;
}

html { color-scheme: light; }
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8eaee;
  --muted: #9aa0a8;
  --bg: #14181d;
  --card: #1c2028;
  --input: #16181e;
  --input-focus: #22262e;
  --chip: #262a33;
  --line: rgba(244, 246, 248, 0.08);
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 18px 48px rgba(0, 0, 0, 0.3);
  --accent: #c5d0dc;
  --accent-ink: #d5dde6;
  --meter: #e8eaee;
}

* { box-sizing: border-box; }
html {
  min-height: 100%;
  scrollbar-gutter: stable;
  overflow-x: clip;
}
body { min-height: 100%; overflow-x: clip; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(60, 79, 101, 0.16), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(20, 24, 29, 0.05), transparent 50%),
    var(--bg);
  font-family: "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: "ss01" 1;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(60, 79, 101, 0.12), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(0, 0, 0, 0.4), transparent 50%),
    var(--bg);
}

.top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 1.6rem;
  background: #171a1f;
  color: #f4f6f8;
}
.brand { display: flex; align-items: center; gap: 0.9rem; }
.logo-img { display: block; height: 28px; width: auto; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.theme-btn {
  border: 0;
  background: #262a31;
  color: #f4f6f8;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 650;
}
h1 { margin: 0; font-size: 1.15rem; font-weight: 620; letter-spacing: -0.02em; }
.tag { margin: 0.1rem 0 0; font-size: 0.75rem; color: #9aa0a8; }
.tabs { display: flex; gap: 0.3rem; padding: 0.2rem; background: #262a31; border-radius: 999px; }
.tab, .langs button {
  border: 0;
  background: transparent;
  color: #c5c9d0;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  border-radius: 999px;
  font-size: 0.85rem;
}
.tab.on, .langs button.on {
  background: #fff;
  color: #171a1f;
  font-weight: 650;
}
.langs { display: flex; gap: 0.15rem; padding: 0.2rem; background: #262a31; border-radius: 999px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 1.6rem 1.4rem 3rem; min-width: 0; }
.hidden { display: none !important; }

.status {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.85rem;
  align-items: stretch;
  margin-bottom: 1.1rem;
}
.status div, .card, .knob, .chart-box, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.status div { padding: 0.95rem 1.1rem; }
.status .time-btn { margin-top: 0.55rem; }
.status .primary { border-radius: var(--r); }
.status span { display: block; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.status strong { display: block; margin-top: 0.25rem; font-size: 1.2rem; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.primary {
  background: var(--ink);
  color: #fff;
  border: 0;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  font-weight: 650;
  border-radius: 999px;
  letter-spacing: -0.01em;
}
.primary:hover { background: #2c323a; }
.primary:disabled { opacity: 0.5; cursor: wait; }
html[data-theme="dark"] .primary { background: #f4f6f8; color: #171a1f; }
html[data-theme="dark"] .primary:hover { background: #fff; }

.synoptic {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}
.card, .knob { padding: 1rem 1.05rem 1.05rem; position: relative; overflow: hidden; }
.card::before, .knob::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}
.card.pv::before, .knob.pv::before { background: var(--pv); }
.card.eess::before, .knob.eess::before { background: var(--batt); }
.card.ev::before, .knob.ev::before { background: var(--ev); }
.card.other_load::before, .knob.other_load::before { background: var(--ol); }
.card.meter::before { background: var(--meter); }
.card h3, .knob h3 { margin: 0 0 0.45rem; font-size: 0.8rem; font-weight: 650; color: var(--muted); letter-spacing: 0.03em; text-transform: uppercase; }
.card .kw { font-size: 1.65rem; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.card .sub { margin-top: 0.35rem; font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.card.faulted { opacity: 0.5; }

.knobs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}
.knob label { display: block; font-size: 0.85rem; margin-bottom: 0.4rem; }
.knob input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  height: 0.35rem;
}
.knob label.knob-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 1.25rem;
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  line-height: 1;
}
.knob label.knob-check span {
  position: relative;
  top: -0.12em;
}
.knob-check input[type="checkbox"] {
  accent-color: var(--ink);
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex: 0 0 auto;
}
.knob-extra { margin-top: 0.1rem; }
.knob-soc {
  display: block;
  width: fit-content;
  margin: 1rem auto 0;
  padding: 0.42rem 1.05rem;
  font-size: 0.82rem;
}

.charts { display: grid; gap: 0.85rem; margin-bottom: 0.2rem; }
.chart-box { padding: 1.05rem 1.15rem 0.7rem; }
.chart-box h2 { margin: 0 0 0.65rem; font-size: 0.95rem; font-weight: 650; letter-spacing: -0.02em; }
canvas { width: 100%; height: auto; display: block; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.05rem;
  margin: 0.65rem 0 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.legend label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}
.legend input[type="checkbox"] {
  accent-color: var(--ink);
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
}
.dot { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 99px; flex: 0 0 auto; }
.dot.pv { background: var(--pv); }
.dot.eess { background: var(--batt); }
.dot.ev { background: var(--ev); }
.dot.ol { background: var(--ol); }
.dot.meter { background: var(--meter); }

.settings .intro { color: var(--muted); line-height: 1.45; margin: 0 0 1.1rem; max-width: 46rem; }
.subtabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.28rem;
  margin-bottom: 1.1rem;
  width: fit-content;
  background: #171a1f;
  border-radius: 999px;
}
.subtab {
  border: 0;
  background: transparent;
  color: #c5c9d0;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 999px;
  font-size: 0.85rem;
}
.subtab.on { background: var(--accent); color: #171a1f; font-weight: 700; }

.panel { padding: 1.25rem 1.3rem 1.35rem; min-width: 0; overflow: hidden; }
.settings { min-width: 0; }
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.table-scroll .grid {
  width: max-content;
  min-width: 100%;
}

.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
}
.grid th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.45rem 0.7rem 0.7rem;
  border-bottom: 1px solid var(--line);
}
.grid td {
  padding: 0.7rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: rgba(60, 79, 101, 0.05); }
.grid input[type="text"], .grid input[type="number"], .grid select,
.sz-f input, .sz-f select, .sz-pick select, .sz-in input, .sz-week input,
.map-add select {
  width: 100%;
  max-width: 13rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input);
  color: var(--ink);
  font: inherit;
  color-scheme: inherit;
}
.grid input:focus, .grid select:focus, .sz-f input:focus, .sz-f select:focus, .sz-pick select:focus, .sz-in input:focus,
.map-add select:focus {
  outline: 2px solid rgba(60, 79, 101, 0.45);
  border-color: var(--accent);
  background: var(--input-focus);
}
.grid button, .upload, .row-btn {
  border: 0;
  background: var(--chip);
  color: var(--ink);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 650;
  font-size: 0.8rem;
}
.upload { display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 1.1rem; }
.upload input { font-size: 0.8rem; }

.actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.2rem; }
.actions .primary {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}
.toasts {
  position: fixed;
  right: 1.15rem;
  bottom: 1.15rem;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  width: 100%;
  padding: 0.8rem 0.95rem 0.8rem 1rem;
  border-radius: 14px;
  font-size: 0.86rem;
  font-weight: 550;
  line-height: 1.4;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(20, 24, 29, 0.12);
  cursor: pointer;
  animation: toast-in 0.26s ease;
}
.toast.ok { border-left: 3px solid var(--accent-ink); }
.toast.err { border-left: 3px solid #b42318; }
html[data-theme="dark"] .toast {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .toast.err { border-left-color: #ff8a7a; }
@keyframes toast-in {
  from { opacity: 0; transform: translate3d(0.7rem, 0.4rem, 0); }
  to { opacity: 1; transform: none; }
}
.hint {
  grid-column: 1 / -1;
  margin: 0 0 0.15rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
  max-width: 46rem;
}
.net-legend {
  list-style: none;
  margin: 0 0 1.2rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.net-legend li {
  margin: 0;
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.4;
  background: var(--input);
  border-radius: 10px;
}
.net-h {
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.net-eth { margin: 0 0 1.35rem; }
.mb-trace-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0.35rem 0 0.65rem;
}
.mb-trace-state {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.mb-trace-bar .row-btn.on {
  background: var(--accent);
  color: #171a1f;
}
.mb-trace-log {
  margin: 0;
  max-height: 16rem;
  overflow: auto;
  padding: 0.75rem 0.9rem;
  background: var(--input);
  border-radius: 12px;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.upload-inline {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 0.2rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}
html[data-theme="dark"] .upload-inline { background: #f4f6f8; color: #171a1f; }
.upload-inline input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.row-btn { padding: 0.4rem 0.85rem; border-radius: 999px; cursor: pointer; font-weight: 650; font-size: 0.8rem; }
.row-btn.add { background: var(--ink); color: #fff; }
html[data-theme="dark"] .row-btn.add { background: #f4f6f8; color: #171a1f; }

.sz-pick { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 1.15rem; font-weight: 650; }
.sz-pick select { max-width: 22rem; }
.sz-csv { grid-column: 1 / -1; }
.sz-csv-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.sz-csv-row input[type="text"] { max-width: 22rem; }
.sz-csv-row .upload-inline { margin-top: 0; flex-shrink: 0; }
.sz-form .ol-help {
  grid-column: 1 / -1;
  margin: 0.55rem 0 0;
}
.sz-mode { grid-column: 1 / -1; }
.mode-tabs {
  display: flex;
  gap: 0.25rem;
  width: fit-content;
  padding: 0.2rem;
  background: var(--chip);
  border-radius: 999px;
}
.mode-tab {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
}
.mode-tab.on { background: var(--accent); color: #171a1f; }

.sz-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.9rem 1rem; }
.sz-f {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.sz-in { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.sz-in input { max-width: none; }
.u { color: var(--ink); font-weight: 700; font-size: 0.8rem; white-space: nowrap; }
.sz-rows, .sz-week { grid-column: 1 / -1; }
.sz-rowhead { margin-bottom: 0.45rem; }
.sz-rows .grid td { padding: 0.28rem 0.45rem; }
.sz-rows .grid th { padding: 0.35rem 0.45rem 0.45rem; }
.sz-rows .grid input[type="text"],
.sz-rows .grid input[type="number"] {
  font-size: 0.78rem;
  max-width: 8.5rem;
}
.sz-rows .row-btn.add { margin-top: 0.55rem; }

.top .apply-btn {
  background: var(--accent);
  color: #171a1f;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
}
.top .apply-btn:hover { background: #c5d0dc; }
html[data-theme="dark"] .top .apply-btn {
  background: var(--accent);
  color: #171a1f;
}
.top .discard-btn {
  border: 0;
  background: #262a31;
  color: #f4f6f8;
  padding: 0.45rem 0.95rem;
  cursor: pointer;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 650;
}
.top .discard-btn:hover { background: #323842; }
.top .power-btn { color: #f3c6c2; }
.top .power-btn:hover { background: #2a1818; color: #ffd7d4; }

.modal {
  border: 0;
  border-radius: var(--r);
  padding: 1.35rem 1.4rem 1.2rem;
  width: min(26rem, calc(100vw - 2rem));
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(15, 20, 16, 0.48); }
.modal h2 { margin: 0 0 0.45rem; font-size: 1.1rem; font-weight: 680; letter-spacing: -0.02em; }
.modal p { margin: 0 0 1.15rem; color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.modal-cancel, .modal-danger {
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
}
.modal-cancel { background: var(--chip); color: var(--ink); }
.modal-danger { background: #b42318; color: #fff; }
.modal-danger:hover { background: #8f1b13; }
.modal-danger:disabled { opacity: 0.5; cursor: wait; }

.map-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-bottom: 0.7rem;
}
#pane-map #asset-table { margin-bottom: 2.4rem; }
#pane-dim #dim-table { margin-bottom: 2.4rem; }
#pane-map .sz-pick { margin-top: 0.2rem; }
.map-profile { max-width: 18rem !important; }
.map-dir {
  width: 2.1rem;
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 650;
}
#map-regs { font-size: 0.78rem; }
#map-regs th { font-size: 0.62rem; padding: 0.3rem 0.45rem 0.5rem; }
#map-regs td { padding: 0.32rem 0.45rem; }
#map-regs input[type="number"],
#map-regs input[type="text"],
#map-regs select {
  max-width: 8.5rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
}
#map-regs input[data-f="address"] { max-width: 5.5rem; }
#map-regs input[data-f="divisor"] { max-width: 5.5rem; }
.map-io { white-space: nowrap; }
.map-io .row-btn { margin-right: 0.35rem; }
.map-add { margin-top: 0.7rem; }
.map-add select { max-width: 22rem; }
.map-help {
  margin-top: 1.8rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1.15rem 1.75rem;
}
@media (min-width: 840px) {
  .map-help { grid-template-columns: repeat(3, 1fr); }
}
.map-help article {
  padding: 0.95rem 1.05rem 1.05rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.map-help h3 {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.map-help p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink);
}
.sz-hint {
  display: block;
  margin: 0 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--muted);
  letter-spacing: 0.01em;
  line-height: 1.55;
}
.sz-week {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--input);
}
.sz-week legend { font-weight: 700; padding: 0 0.35rem; }
.sz-week label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.sz-week input { width: 4.6rem; max-width: 4.6rem; }

@media (max-width: 900px) {
  .synoptic { grid-template-columns: repeat(2, 1fr); }
  .status { grid-template-columns: 1fr 1fr; }
  .status .primary { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .top { flex-wrap: wrap; gap: 0.75rem 1rem; padding: 0.75rem 0.9rem; }
  .tools { margin-left: 0; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .synoptic { grid-template-columns: 1fr 1fr; }
  .wrap { padding: 1rem 0.7rem 2.2rem; }
  .subtabs {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .subtab { white-space: nowrap; padding: 0.45rem 0.8rem; }
  .panel { padding: 0.95rem 0.8rem 1.1rem; }
  .hint { max-width: none; overflow-wrap: anywhere; }
  .grid input[type="text"],
  .grid input[type="number"],
  .grid select,
  .sz-f input,
  .sz-f select,
  .sz-pick select,
  .sz-in input,
  .map-add select {
    max-width: none;
    min-width: 0;
  }
  .map-profile { max-width: none !important; }
  .sz-pick { flex-wrap: wrap; }
  .sz-pick select { max-width: none; flex: 1 1 12rem; }
  .sz-form { grid-template-columns: 1fr; }
  .net-eth { grid-template-columns: 1fr; }
  .sz-csv-row input[type="text"] { max-width: none; min-width: 0; flex: 1 1 8rem; }
  .sz-rows .grid input[type="text"],
  .sz-rows .grid input[type="number"] {
    max-width: none;
  }
  .map-toolbar { flex-wrap: wrap; }
  .map-io {
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .mode-tabs { width: 100%; flex-wrap: wrap; }
  .sz-week input { width: 100%; max-width: 5.2rem; }
  .table-scroll .stack-table {
    width: 100%;
    min-width: 0;
  }
  .stack-table thead { display: none; }
  .stack-table,
  .stack-table tbody,
  .stack-table tr {
    display: block;
    width: 100%;
  }
  .stack-table tr {
    padding: 0.75rem 0 0.9rem;
    border-bottom: 1px solid var(--line);
  }
  .stack-table tbody tr:last-child { border-bottom: 0; }
  .stack-table td {
    display: grid;
    grid-template-columns: 7.2rem minmax(0, 1fr);
    align-items: center;
    gap: 0.35rem 0.6rem;
    width: 100%;
    padding: 0.28rem 0;
    border-bottom: 0;
  }
  .stack-table td::before {
    content: attr(data-th);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .stack-table td.stack-title {
    display: block;
    font-weight: 700;
    padding: 0 0 0.4rem;
  }
  .stack-table td.stack-title::before,
  .stack-table td.map-dir::before,
  .stack-table td.map-io::before,
  .stack-table td.stack-actions::before {
    content: none;
  }
  .stack-table td.map-io,
  .stack-table td.stack-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-top: 0.45rem;
  }
  .stack-table input,
  .stack-table select {
    min-width: 0;
    width: 100%;
    max-width: none;
  }
  #map-regs tr {
    display: grid;
    grid-template-columns: 1.7rem minmax(0, 1fr);
    gap: 0 0.35rem;
  }
  #map-regs td.map-dir {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 0.4rem;
  }
  #map-regs td.stack-title {
    grid-column: 2;
    grid-row: 1;
    padding: 0 0 0.4rem;
  }
  #map-regs td:nth-child(n + 3) { grid-column: 1 / -1; }
}

.subtab.on,
.mode-tab.on,
.top .apply-btn,
html[data-theme="dark"] .top .apply-btn,
.mb-trace-bar .row-btn.on {
  background: #e7ebf0;
  color: #171a1f;
}
.top .apply-btn:hover,
html[data-theme="dark"] .top .apply-btn:hover { background: #ffffff; }
.status strong { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .card .kw { font-size: 1.25rem; }
}
