*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #eef0f3;
  --panel-bg:     #ffffff;
  --border:       #cdd1d8;
  --text:         #1a1c20;
  --text-dim:     #5a6070;
  --accent:       #0052cc;
  --green:        #1a6e2e;
  --red:          #b81c1c;
  --orange:       #a85400;
  --gray:         #7a8494;
  --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:         'Consolas', 'Courier New', monospace;
  --hdr-h:        46px;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  height: var(--hdr-h);
  background: #1b2637;
  color: #dce3ec;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  flex-shrink: 0;
  border-bottom: 2px solid var(--accent);
}

.hdr-brand { display: flex; align-items: baseline; gap: 6px; }
.brand-name { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: 0.3px; }
.brand-model { font-size: 12px; color: #6e8aaa; }

.hdr-conn {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: 8px;
}

.dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-off          { background: #3c4d62; }
.dot-connected    { background: #27c96a; box-shadow: 0 0 5px #27c96a88; }
.dot-error        { background: #e74c3c; }
.dot-idle         { background: #f5a623; box-shadow: 0 0 5px #f5a62388; }
.dot-connecting,
.dot-reconnecting { background: #f5a623; animation: dot-pulse 1s ease-in-out infinite; }

@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

#conn-label { font-size: 12px; color: #8fa3ba; min-width: 130px; }

select, input[type="number"] {
  background: #243347;
  color: #dce3ec;
  border: 1px solid #344d68;
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 12px;
  font-family: var(--font);
}

#port-select { min-width: 130px; }
#baud-input  { width: 84px; font-family: var(--mono); }

button {
  padding: 4px 11px;
  border-radius: 3px;
  border: 1px solid #344d68;
  background: #243347;
  color: #dce3ec;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  white-space: nowrap;
}
button:hover:not(:disabled) { background: #344d68; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: #0d3a7a;
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent); }

.hdr-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ts-label { font-family: var(--mono); font-size: 11px; color: #4a6280; }

.hdr-tel-btn.tel-off { background: #243347; border-color: #344d68; color: #8fa3ba; }
.hdr-tel-btn.tel-on  { background: #16301f; border-color: #2a6e38; color: #4ade80; }
.hdr-tel-btn.tel-on:hover:not(:disabled)  { background: #1b3d27; }

/* ── Replay: "Load Recording" (header) + transport bar ── */
.hdr-replay-load {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid #344d68;
}
#replay-session-select { max-width: 240px; }
.replay-load-status {
  font-size: 11px;
  color: #8fa3ba;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#replay-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 14px;
  flex-shrink: 0;
  background: #16301f;
  color: #dce3ec;
  border-bottom: 2px solid #2a6e38;
}

/* ── Firmware update-available banner ── */
.update-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 14px;
  flex-shrink: 0;
  background: var(--orange);
  color: #fff;
  border-bottom: 2px solid #7a3e00;
}
#update-banner-text { font-size: 12px; font-weight: 600; flex: 1; }
#update-banner-btn {
  background: #fff;
  color: var(--orange);
  border-color: #fff;
  font-weight: 600;
}
#update-banner-btn:hover { background: #ffe9d1; }
.update-banner-dismiss {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.85;
}
.update-banner-dismiss:hover { opacity: 1; }
.replay-bar-name {
  font-size: 12px;
  font-weight: 700;
  color: #4ade80;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#replay-slider { flex: 1; accent-color: #4ade80; }
.replay-time-input {
  width: 84px;
  background: #243347;
  color: #dce3ec;
  border: 1px solid #344d68;
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 12px;
  font-family: var(--mono);
  text-align: center;
}
.replay-time-input.input-err { border-color: #f85149; }
.replay-duration-label { font-family: var(--mono); font-size: 11px; color: #8fa3ba; }

/* ── Main layout ── */
#layout {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 0;
}

/* Grid items must opt-in to shrinking below content size */
#left-panel, #meas-panel { min-height: 0; }

/* ── Left panel ── */
#left-panel {
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 10px 9px;
}

.panel-block { margin-bottom: 14px; }

.block-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-dim);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.kv-table { width: 100%; border-collapse: collapse; }
.kv-table td { padding: 2px 0; vertical-align: top; line-height: 1.45; }
.kv-table td:first-child { color: var(--text-dim); width: 72px; font-size: 12px; }
.kv-table .val { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.kv-table .mono { font-family: var(--mono); }

/* State colours */
.state-run    { color: var(--green); }
.state-error  { color: var(--red); }
.state-off    { color: var(--gray); }
.state-trans  { color: var(--orange); }
.state-normal { color: var(--text); }

/* Relay table */
.relay-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.relay-table th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  padding: 1px 2px 3px;
  border-bottom: 1px solid var(--border);
}
.relay-table td { padding: 2px 2px; vertical-align: middle; line-height: 1.5; }
.relay-table td:first-child { color: var(--text-dim); }

.rl-closed { color: var(--green); font-weight: 600; }
.rl-open   { color: var(--gray); }
.rl-rdy    { color: var(--green); }
.rl-nrdy   { color: var(--gray); }

/* ── Measurements panel ── */
#meas-panel {
  background: var(--bg);
  overflow-y: auto;
  padding: 10px;
}

.meas-row { display: grid; gap: 9px; margin-bottom: 9px; }
.meas-row-3 { grid-template-columns: repeat(3, 1fr); }
.meas-row-4 { grid-template-columns: repeat(4, 1fr); }
.meas-row-log { grid-template-columns: 1fr; }

.meas-block {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
}

.meas-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}

.meas-table { width: 100%; border-collapse: collapse; }
.meas-table td { padding: 2px 0; vertical-align: middle; line-height: 1.45; }
.meas-table td:first-child { color: var(--text-dim); font-size: 11px; width: 60px; }
.meas-table .num  { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--text); }
.meas-table .unit { color: var(--text-dim); font-size: 10px; padding-left: 4px; width: 22px; }
.meas-table .val  { font-size: 12px; font-weight: 600; text-align: right; }
.meas-table .flag { font-weight: 700; }
.meas-table .meas-sep td { padding-top: 5px; border-top: 1px solid var(--border); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--accent); }

/* ── Dashboard log panel ──
   Just the firmware's [ERROR]/[INFO] logger lines (see logger.h) — no CLI
   command echoes/replies and no raw telemetry JSON, both of which stay in
   the Advanced > Console terminal instead. */
.log-block { padding-bottom: 4px; }

.log-block-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 4px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.log-block-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
}
.log-count {
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 6px;
  text-transform: none;
  letter-spacing: normal;
}

.dash-log-box {
  height: 160px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
}

.log-empty { color: var(--text-dim); font-style: italic; }

.log-line { display: flex; gap: 8px; white-space: pre-wrap; word-break: break-word; }
.log-line + .log-line { margin-top: 1px; }
.log-ts    { flex-shrink: 0; color: var(--text-dim); }
.log-level { flex-shrink: 0; width: 44px; font-weight: 700; color: var(--text-dim); }
.log-msg   { color: var(--text); }

.log-line.log-info  .log-level { color: var(--green); }
.log-line.log-error .log-level,
.log-line.log-error .log-msg   { color: var(--red); }
.log-line.log-debug .log-level,
.log-line.log-debug .log-msg   { color: var(--text-dim); }

/* ── Terminal ── */
#term-panel {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 460px;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* contain scroll within #term-output, not the page */
}

.term-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  padding: 5px 10px;
  flex-shrink: 0;
}
.term-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.9px; color: #484f58; }

.btn-term-action {
  background: transparent;
  border: 1px solid #30363d;
  color: #484f58;
  padding: 2px 8px;
  font-size: 11px;
}
.btn-term-action:hover:not(:disabled) { background: #21262d; color: #8b9197; border-color: #484f58; }

#term-output {
  flex: 1;
  overflow-y: auto;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-all;
}

.term-cmd { color: #79c0ff; }
.term-out { color: #c9d1d9; }
.term-err { color: #f85149; }
.term-sys { color: #484f58; font-style: italic; }

#term-input-row {
  display: flex;
  align-items: center;
  background: #161b22;
  border-top: 1px solid #21262d;
  padding: 6px 10px;
  flex-shrink: 0;
  gap: 7px;
}

.term-prompt { color: #3fb950; font-family: var(--mono); font-size: 13px; user-select: none; }

#term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e6edf3;
  font-family: var(--mono);
  font-size: 12px;
  caret-color: #3fb950;
}
#term-input::placeholder { color: #30363d; }

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Firmware Update Modal ── */
.fw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.fw-overlay.open { display: flex; }

#fw-modal {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  width: 580px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.fw-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1b2637;
  color: #fff;
  padding: 10px 14px;
  border-radius: 4px 4px 0 0;
  flex-shrink: 0;
  border-bottom: 2px solid var(--accent);
}
.fw-hdr-title { font-weight: 600; font-size: 13px; }
.fw-close-btn {
  background: transparent;
  border: none;
  color: #8fa3ba;
  font-size: 16px;
  padding: 0 2px;
  cursor: pointer;
  line-height: 1;
}
.fw-close-btn:hover { color: #fff; }

.fw-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

.fw-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.fw-file-row input[type="file"] { display: none; }
.fw-file-label {
  padding: 4px 12px;
  background: #243347;
  color: #dce3ec;
  border: 1px solid #344d68;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
.fw-file-label:hover { background: #344d68; }
.fw-file-label:disabled { opacity: 0.5; cursor: not-allowed; }
.fw-file-name { font-size: 12px; color: var(--text-dim); font-family: var(--mono); flex: 1; }
#fw-latest-btn { margin-left: auto; }

.fw-prerelease-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
}
.fw-prerelease-toggle input { cursor: pointer; }

.fw-info {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 10px;
}
.fw-info td { padding: 2px 8px 2px 0; }
.fw-info td:first-child { color: var(--text-dim); width: 70px; }
.fw-info td:last-child  { font-family: var(--mono); }

.fw-log-hdr {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 6px;
}

#fw-log {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 3px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: #c9d1d9;
  height: 180px;
  overflow-y: auto;
  margin-bottom: 14px;
}
.fw-log-info { color: #c9d1d9; }
.fw-log-ok   { color: #3fb950; }
.fw-log-err  { color: #f85149; }
.fw-log-dim  { color: #8b9197; }

#fw-prog-wrap { margin-bottom: 4px; }

.fw-prog-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 5px;
}
#fw-prog-label { color: var(--text-dim); }
#fw-prog-pct   { font-family: var(--mono); font-weight: 700; color: var(--text); }

.fw-prog-track {
  height: 16px;
  background: #d8dde5;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 5px;
}
#fw-prog-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

#fw-prog-detail {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.fw-footer {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  flex-shrink: 0;
}
.fw-reconnect {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff8e1;
  border: 1px solid #e0b020;
  border-radius: 3px;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #6b4c00;
}
.fw-reconnect button {
  flex-shrink: 0;
  background: #e0b020;
  border-color: #c49000;
  color: #3a2800;
}
.fw-reconnect button:hover { background: #c49000; }

.fw-footer-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
#fw-start-btn {
  background: #0d3a7a;
  border-color: var(--accent);
  color: #fff;
  padding: 5px 20px;
  font-size: 13px;
}
#fw-start-btn:hover:not(:disabled) { background: var(--accent); }

/* ── Browse Releases Modal ── */
#rel-modal {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  width: 640px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.rel-list { display: flex; flex-direction: column; gap: 8px; }
.rel-empty { color: var(--text-dim); font-size: 12px; padding: 8px 0; }

.rel-row {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 10px;
  background: var(--bg);
}
.rel-row-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.rel-tag  { font-family: var(--mono); font-weight: 600; font-size: 12px; }
.rel-date { font-size: 11px; color: var(--text-dim); margin-left: auto; white-space: nowrap; }

.rel-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.rel-badge-release { background: #1f6f3f; color: #d7f5e2; }
.rel-badge-dev     { background: #6b4c00; color: #ffe6a8; }

.rel-assets { display: flex; flex-wrap: wrap; gap: 6px; }
.rel-asset-btn {
  font-size: 11px;
  padding: 3px 8px;
  background: #243347;
  color: #dce3ec;
  border: 1px solid #344d68;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--mono);
}
.rel-asset-btn:hover:not(:disabled) { background: #344d68; }
.rel-asset-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rel-no-assets { font-size: 11px; color: var(--text-dim); }

/* ── Tab bar ── */
#tab-bar {
  display: flex;
  align-items: stretch;
  background: #151e2d;
  border-bottom: 1px solid #0e1724;
  flex-shrink: 0;
  padding: 0 8px;
  gap: 2px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 32px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #5a7a9a;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
  white-space: nowrap;
  margin-bottom: -1px;
}
.tab-btn:hover:not(:disabled) { background: #1b2637; color: #9ab4cc; }
.tab-btn.tab-active { color: #dce3ec; border-bottom-color: var(--accent); }

/* Pushed to the far edge of the tab bar, away from the day-to-day tabs — */
/* this is internal dev/service diagnostics, not something to stumble into. */
.tab-btn-adv { margin-left: auto; }

/* ── Graph view ── */
#graph-view {
  flex: 1;
  min-height: 0;
  display: flex;
}

#graph-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 10px 9px;
}

.gsb-block { margin-bottom: 14px; }

.gsb-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-dim);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

#graph-window {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
  font-size: 12px;
  margin-top: 2px;
}

#graph-scroll-slider { width: 100%; margin-top: 8px; accent-color: var(--accent); }
.graph-scroll-label {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-top: 4px;
  text-align: center;
}

.gm-group-hdr {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  padding: 5px 0 2px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.gm-group-hdr:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.gm-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 2px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  line-height: 1.7;
}
.gm-item:hover { background: var(--bg); }
.gm-item input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  cursor: pointer;
}
.gm-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.gm-label { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-unit  { color: var(--text-dim); font-size: 10px; font-family: var(--mono); flex-shrink: 0; }

#graph-canvas-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

#graph-canvas { flex: 1; min-height: 0; }

/* ── Scope view ── */
#scope-view {
  flex: 1;
  min-height: 0;
  display: flex;
}

#scope-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 10px 9px;
}

#scope-freq, #scope-periods {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
  font-size: 12px;
  margin-top: 2px;
}

#scope-canvas-wrap {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  background: #0d1117;
}

#scope-canvas { flex: 1; min-height: 0; }

.yscale-row  { display: flex; align-items: center; gap: 5px; padding: 2px 0; }
.yscale-lbl  { font-size: 11px; color: var(--text-dim); font-family: var(--mono); width: 28px; flex-shrink: 0; text-align: right; }
.yscale-inp  {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 2px 5px;
  font-size: 11px;
  font-family: var(--mono);
  min-width: 0;
}

/* ── Snapshots view ── */
#snapshots-view {
  flex: 1;
  min-height: 0;
  display: flex;
}

#snap-sidebar {
  width: 270px;
  flex-shrink: 0;
  background: var(--panel-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 10px 9px;
}

.snap-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.snap-toolbar button { flex: 1 1 calc(50% - 3px); padding: 4px 6px; font-size: 11px; }

.snap-status {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  min-height: 14px;
}
.snap-status-err { color: var(--red); }

.snap-info-panel {
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
}
.snap-info-kv td:first-child { width: 86px; }
.snap-info-slots { width: 100%; border-collapse: collapse; margin-top: 8px; }
.snap-info-slots th, .snap-info-slots td {
  padding: 3px 6px 3px 0;
  font-size: 11px;
  text-align: left;
  line-height: 1.5;
  white-space: nowrap;
}
.snap-info-slots td:nth-child(4) { white-space: normal; }
.snap-info-slots th {
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
}
.snap-info-slots td:first-child, .snap-info-slots td:nth-child(2) { font-family: var(--mono); }
.snap-info-dl-btn { padding: 1px 6px; font-size: 11px; line-height: 1.3; }

.snap-slot-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }

.snap-slot-item {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 9px;
  cursor: pointer;
  background: var(--bg);
}
.snap-slot-item:hover   { border-color: var(--accent); }
.snap-slot-item.snap-slot-active {
  border-color: var(--accent);
  background: #e3edfd;
}

.snap-slot-hdr   { display: flex; align-items: center; justify-content: space-between; }
.snap-slot-seq   { font-family: var(--mono); font-weight: 700; font-size: 12px; }
.snap-slot-badges{ display: flex; gap: 4px; }
.snap-crc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
}
.snap-crc-ok  { background: #dcf5e3; color: var(--green); }
.snap-crc-bad { background: #fbdede; color: var(--red); }

.snap-slot-meta { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

.snap-slot-errs { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.snap-err-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
.snap-err-crit { background: #fbdede; color: var(--red); }
.snap-err-warn { background: #fdf0d5; color: var(--orange); }

#snap-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  background: var(--bg);
}

.snap-empty {
  color: var(--text-dim);
  font-size: 12px;
  padding: 30px 10px;
  text-align: center;
}

.snap-parse-debug-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.snap-parse-debug-msg { color: var(--red); font-size: 12px; font-family: var(--mono); flex: 1; }
.snap-parse-debug-text {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 70vh;
  overflow-y: auto;
}
.snap-parse-debug-text .err-line { background: rgba(220, 38, 38, 0.18); }

.snap-detail-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.snap-detail-title { font-size: 15px; font-weight: 700; font-family: var(--mono); }

.snap-dtab-bar { display: flex; gap: 2px; }
.snap-dtab {
  padding: 5px 12px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  border-radius: 3px;
}
.snap-dtab:hover:not(:disabled) { color: var(--text); }
.snap-dtab.snap-dtab-active     { color: #fff; background: var(--accent); border-color: var(--accent); }

.snap-dview {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
}

.snap-overview-table { max-width: 480px; }
.snap-overview-table td:first-child { width: 110px; }

.snap-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin: 18px 0 6px;
}
.snap-dim { color: var(--text-dim); font-size: 12px; padding: 4px 0; }

.snap-error-table { border-collapse: collapse; }
.snap-error-table td { padding: 2px 0; line-height: 1.6; }
.snap-error-table td:first-child { padding-right: 16px; white-space: nowrap; font-size: 12px; }

.snap-log-box {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 3px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: #c9d1d9;
  max-height: 560px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.snap-log-ts {
  display: inline-block;
  min-width: 68px;
  margin-right: 8px;
  color: #6e7681;
  font-size: 11px;
}

.snap-log-future  { opacity: 0.35; }
.snap-log-current { background: rgba(37, 99, 235, 0.18); border-radius: 2px; }

.snap-raw-pre {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 3px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: #c9d1d9;
  max-height: 620px;
  overflow: auto;
  white-space: pre;
}

/* Replay */
.snap-replay-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}
.snap-replay-controls input[type="range"] { flex: 1; accent-color: var(--accent); }
.snap-rf-counter { font-size: 11px; color: var(--text-dim); font-family: var(--mono); min-width: 64px; text-align: right; }

.snap-replay-grid {
  display: grid;
  grid-template-columns: 230px 200px minmax(260px, 1fr);
  gap: 18px;
  align-items: start;
}
.snap-replay-state td:first-child { width: 100px; }
.snap-replay-relays { font-size: 11px; }

.snap-rf-lower {
  display: grid;
  grid-template-columns: minmax(320px, 1.3fr) minmax(260px, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}
.snap-rf-graph-wrap {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
}
/* Chart.js with responsive:true + maintainAspectRatio:false fills its
 * parent's height - without an explicit, bounded height here the parent's
 * height is driven by the canvas itself, which is a feedback loop that
 * grows the canvas taller every layout pass. position:relative is also
 * required per Chart.js's own sizing docs for this combination. */
.snap-rf-graph-canvas-box { position: relative; height: 220px; margin-top: 8px; }

.snap-rf-metric-picker { margin-top: 4px; }
.snap-rf-metric-picker > summary {
  cursor: pointer;
  font-size: 11px;
  color: var(--text-dim);
  user-select: none;
}
.snap-rf-metric-list {
  max-height: 220px;
  overflow-y: auto;
  margin-top: 6px;
  padding-right: 4px;
}

.snap-rf-logs-wrap { min-width: 0; }
.snap-rf-logs { max-height: 240px; }

.snap-rf-meas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  align-content: start;
}
.snap-meas-grp-hdr {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--accent);
  margin-bottom: 3px;
}
.snap-meas-grp .meas-table td:first-child { color: var(--text-dim); font-size: 11px; }

/* ── Generator parameters view ── */
#generator-view {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  background: var(--bg);
}

#gen-main {
  width: 100%;
  max-width: 920px;
  padding: 18px 20px 40px;
}

.gen-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg);
  padding-bottom: 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.gen-toolbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
}

.gen-toolbar-actions { display: flex; align-items: center; gap: 10px; }
.gen-toolbar-actions .snap-status { margin-top: 0; min-height: 0; }

.gen-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.gen-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 16px 8px;
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.04);
}

.gen-card-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--text-dim);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.gen-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #f0f1f3;
}
.gen-field:last-child { border-bottom: none; }

.gen-field label {
  font-size: 12.5px;
  color: var(--text);
  flex: 1;
}

.gen-field-desc {
  display: block;
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 1px;
}

.gen-input-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.gen-input-wrap input[type="number"] {
  width: 96px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 7px;
  font-size: 12px;
  font-family: var(--mono);
  text-align: right;
  transition: border-color 0.15s, background 0.15s;
}
.gen-input-wrap input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}
.gen-input-wrap input[type="number"].gen-dirty {
  border-color: var(--accent);
  background: #eaf1fc;
}

.gen-unit {
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--mono);
  width: 22px;
}

.gen-field input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
  flex-shrink: 0;
}

.gen-form-disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Errors view ── */
#errors-view {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  background: var(--bg);
}

#errors-main {
  width: 100%;
  max-width: 760px;
  padding: 18px 20px 40px;
}

.err-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.err-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  padding: 0 0 6px;
  border-bottom: 1px solid var(--border);
}
.err-table td { padding: 6px 0; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.err-table tr:last-child td { border-bottom: none; }
.err-table td:first-child { color: var(--text-dim); width: 26px; font-family: var(--mono); }
.err-table td.err-status { width: 90px; font-weight: 700; }
.err-table td.err-action { width: 70px; text-align: right; }
.err-row-active td { color: var(--text); }

/* ── Device info view ── */
#deviceinfo-view {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  background: var(--bg);
}

#devinfo-main {
  width: 100%;
  max-width: 640px;
  padding: 18px 20px 40px;
}

.devinfo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

.gen-field-val {
  font-size: 12.5px;
  font-weight: 600;
  flex-shrink: 0;
  text-align: right;
}
.gen-field-val.mono { font-family: var(--mono); }

/* ── Advanced / Firmware Profiling ── */

#advanced-view {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  background: var(--bg);
}

#adv-main {
  width: 100%;
  max-width: 920px;
  padding: 18px 20px 40px;
}

.adv-subtitle {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.adv-sub {
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 400;
}

.adv-empty {
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 0;
}

.adv-cpu-card { display: flex; flex-direction: column; gap: 2px; }

.adv-cpu-big {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
  font-family: var(--mono);
}

.adv-cpu-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 4px;
  font-family: var(--font);
}

.prof-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.prof-table th {
  text-align: right;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  padding: 0 0 5px;
  border-bottom: 1px solid var(--border);
}
.prof-table th:first-child { text-align: left; }
.prof-table td { padding: 4px 0; border-bottom: 1px solid #f0f1f3; }
.prof-table tr:last-child td { border-bottom: none; }
.prof-table td:first-child { color: var(--text); }
.prof-table td.num { text-align: right; font-family: var(--mono); color: var(--text-dim); }

/* Advanced tab's own Profiling/Limits sub-tabs — a separate class from
   .snap-dtab so it doesn't get picked up by the snapshot-detail tab wiring,
   which binds a click handler to every .snap-dtab element on the page. */
.adv-dtab-bar { display: flex; gap: 2px; margin-bottom: 16px; }
.adv-dtab {
  padding: 5px 12px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  border-radius: 3px;
}
.adv-dtab:hover:not(:disabled) { color: var(--text); }
.adv-dtab.adv-dtab-active      { color: #fff; background: var(--accent); border-color: var(--accent); }

.adv-settings-row { margin: -8px 0 16px; }

.adv-warning {
  background: #fdecea;
  border: 1px solid var(--red);
  border-radius: 6px;
  color: var(--red);
  font-size: 12.5px;
  line-height: 1.55;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.adv-warning code {
  background: rgba(184, 28, 28, 0.1);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--mono);
}

/* ── Advanced / Measurement Overrides ── */

.ovr-field { flex-wrap: wrap; }

.ovr-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--red);
  background: rgba(184, 28, 28, 0.1);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
}

.ovr-input-wrap { gap: 8px; }

.ovr-subfield {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ovr-subfield span {
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.ovr-subfield input[type="number"] { width: 72px; }

.ovr-clear-btn { padding: 4px 10px; }

/* ── PLC view ── */
#plc-view {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  background: var(--bg);
}

#plc-main {
  width: 100%;
  max-width: 860px;
  padding: 18px 20px 40px;
}

.plc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.plc-role-group { display: flex; gap: 4px; }
.plc-role-btn {
  padding: 4px 10px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  border-radius: 3px;
}
.plc-role-btn:hover:not(:disabled) { color: var(--text); }
.plc-role-btn.plc-role-btn-active  { color: #fff; background: var(--accent); border-color: var(--accent); }

.plc-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.plc-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  padding: 0 6px 6px 0;
  border-bottom: 1px solid var(--border);
}
.plc-table td { padding: 6px 6px 6px 0; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.plc-table tr:last-child td { border-bottom: none; }
.plc-table td.mono { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

/* ── Generator Debug view (Phasors / Trends / Control Loops) ── */
#gendebug-view {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  background: var(--bg);
}

#gd-main {
  width: 100%;
  max-width: 1100px;
  padding: 18px 20px 40px;
}

/* Own sub-tab classes, deliberately not .adv-dtab — that class already has a
   page-wide click handler bound to it (see the Advanced tab's own sub-tab
   wiring), which would fire on these buttons too if reused here. */
.gd-dtab-bar { display: flex; gap: 2px; margin-bottom: 16px; }
.gd-dtab {
  padding: 5px 12px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  border-radius: 3px;
}
.gd-dtab:hover:not(:disabled) { color: var(--text); }
.gd-dtab.gd-dtab-active        { color: #fff; background: var(--accent); border-color: var(--accent); }

.gd-channel-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 14px;
  padding: 8px 10px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.gd-north-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}
.gd-north-picker select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 5px;
  font-size: 11px;
}

.gd-phasor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.gd-phasor-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px 14px;
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.04);
}

.gd-phasor-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.gd-phasor-title .gd-phasor-scales {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  font-family: var(--mono);
}

.gd-phasor-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin-top: 6px;
}
.gd-phasor-canvas-wrap canvas { width: 100%; height: 100%; display: block; }

.gd-phasor-legend { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 10.5px; }
.gd-phasor-legend td { padding: 1.5px 4px 1.5px 0; white-space: nowrap; }
.gd-phasor-legend td.num { font-family: var(--mono); text-align: right; color: var(--text); }
.gd-phasor-legend tr.gd-row-dim td { color: var(--text-dim); }
.gd-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.gd-swatch-current { border-radius: 2px; }

.gd-trend-signals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 4px 18px;
  margin-top: 14px;
  padding: 10px 12px 8px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.gd-trend-signal-hdr {
  border-top: none !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 2px;
}

.gd-trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.gd-trend-card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px 8px;
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.04);
  display: flex;
  flex-direction: column;
}
.gd-trend-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-dim);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.gd-trend-unit { font-weight: 400; text-transform: none; letter-spacing: 0; font-family: var(--mono); }
.gd-trend-canvas-wrap { position: relative; height: 190px; }

.gd-yrange {
  display: flex;
  align-items: center;
  gap: 3px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
}
.gd-yrange input[type="checkbox"] {
  accent-color: var(--accent);
  width: 11px;
  height: 11px;
  cursor: pointer;
  flex-shrink: 0;
}
.gd-yrange-inp {
  width: 44px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 3px;
  font-size: 10px;
  font-family: var(--mono);
  text-align: right;
}
.gd-yrange-inp:disabled { opacity: 0.5; }

#gd-trend-window {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  padding: 3px 5px;
}

.gd-loops-state {
  margin-top: 14px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  overflow-x: auto;
}
.gd-loops-state:empty { display: none; }
.gd-state-table { border-collapse: collapse; font-size: 11.5px; width: 100%; }
.gd-state-table th {
  text-align: right;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  padding: 0 8px 5px 0;
}
.gd-state-table th:first-child { text-align: left; }
.gd-state-table td { padding: 2px 8px 2px 0; text-align: right; font-family: var(--mono); }
.gd-state-table td:first-child { text-align: left; font-family: var(--font); color: var(--text-dim); }

#gd-loops-form { margin-top: 16px; }
