:root {
  color-scheme: dark;
  --bg: #0b0d0f;
  --panel: rgba(24, 27, 31, 0.86);
  --panel-strong: rgba(34, 38, 43, 0.95);
  --line: rgba(255, 255, 255, 0.11);
  --text: #f4f1ea;
  --muted: #a7a296;
  --cyan: #54d6ff;
  --green: #8dff9f;
  --amber: #ffbe5c;
  --red: #ff6a7a;
  --violet: #c69cff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --cell: rgba(12, 14, 16, 0.74);
  --cell-soft: rgba(12, 14, 16, 0.7);
  --input: rgba(10, 12, 14, 0.92);
  --menu-bg: rgba(31, 35, 40, 0.98);
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: rgba(255, 255, 255, 0.97);
  --line: rgba(13, 23, 30, 0.13);
  --text: #172127;
  --muted: #60707a;
  --cyan: #007da3;
  --green: #128a38;
  --amber: #a86600;
  --red: #c73549;
  --violet: #7655b8;
  --shadow: 0 20px 60px rgba(38, 62, 74, 0.16);
  --cell: rgba(255, 255, 255, 0.78);
  --cell-soft: rgba(255, 255, 255, 0.68);
  --input: rgba(255, 255, 255, 0.96);
  --menu-bg: rgba(255, 255, 255, 0.98);
}

body[data-theme="light"] .status-strip,
body[data-theme="light"] .icon-button,
body[data-theme="light"] .section-menu-button,
body[data-theme="light"] .section-nav,
body[data-theme="light"] .tab,
body[data-theme="light"] .module-card,
body[data-theme="light"] .mini-card,
body[data-theme="light"] .thread-card,
body[data-theme="light"] .setup-card,
body[data-theme="light"] .module-title,
body[data-theme="light"] .lab-card.muted-card,
body[data-theme="light"] .stress-bars div,
body[data-theme="light"] .stress-log span {
  background: rgba(23, 33, 39, 0.035);
}

body[data-theme="light"] .panel::before {
  background: linear-gradient(135deg, rgba(0, 125, 163, 0.06), transparent 30%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 12%, rgba(84, 214, 255, 0.16), transparent 30%),
    radial-gradient(circle at 80% 4%, rgba(255, 190, 92, 0.12), transparent 26%),
    linear-gradient(135deg, #08090b 0%, #14100f 45%, #0c1010 100%);
}

.demo-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  display: none;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--cyan) 16%, var(--bg) 84%);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.demo-mode .demo-banner {
  display: block;
}

body[data-theme="light"] {
  background:
    radial-gradient(circle at 18% 12%, rgba(0, 125, 163, 0.12), transparent 30%),
    radial-gradient(circle at 82% 6%, rgba(168, 102, 0, 0.1), transparent 24%),
    linear-gradient(135deg, #edf4f6 0%, #f8fbfc 46%, #eef6f2 100%);
}

.shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  column-gap: 18px;
  align-items: start;
  width: min(1480px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.shell > :not(.section-nav) {
  grid-column: 2;
  min-width: 0;
}

.topbar,
.hero-grid,
.metric-grid,
.two-col {
  display: grid;
  gap: 16px;
}

.topbar {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-bottom: 16px;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--amber);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 42px; font-weight: 780; }
h2 { font-size: 20px; font-weight: 720; }

.status-strip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: min(430px, 48vw);
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

#updatedAt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.is-loading .status-strip,
body.load-failed .status-strip {
  border-color: rgba(84, 214, 255, 0.28);
}

.update-status {
  min-width: 0;
  padding-left: 9px;
  border-left: 1px solid var(--line);
  color: var(--cyan);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.svg-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

.icon-button .svg-icon {
  width: 18px;
  height: 18px;
}

.icon-button:hover,
.tab:hover,
.section-menu-button:hover {
  border-color: rgba(84, 214, 255, 0.55);
  background: rgba(84, 214, 255, 0.09);
}

.icon-button:focus-visible,
.section-menu-button:focus-visible,
.tab:focus-visible,
.command-button:focus-visible,
.setup-card:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(84, 214, 255, 0.16);
}

.section-nav {
  position: relative;
  grid-column: 1;
  grid-row: 1 / span 40;
  z-index: 35;
  display: flex;
  flex-direction: column;
  width: 216px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(84, 214, 255, 0.1), transparent 34%),
    color-mix(in srgb, var(--menu-bg) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.demo-mode .section-nav {
  top: auto;
}

.section-nav::before {
  content: "RigScope";
  display: block;
  padding: 8px 10px 2px;
  color: var(--text);
  font-size: 20px;
  font-weight: 850;
}

.section-nav::after {
  content: "Desktop control";
  display: block;
  order: -1;
  padding: 2px 10px 0;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.section-menu-button {
  display: none;
  align-items: center;
  gap: 10px;
  min-width: 178px;
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(84, 214, 255, 0.08), transparent 70%),
    rgba(255,255,255,0.045);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.menu-glyph {
  display: inline-grid;
  place-items: center;
  color: var(--cyan);
}

.menu-glyph .svg-icon {
  width: 19px;
  height: 19px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  width: 100%;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(84, 214, 255, 0.38) transparent;
  margin-top: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  pointer-events: auto;
}

.tab {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.tab .svg-icon {
  width: 16px;
  height: 16px;
  color: var(--cyan);
  opacity: 0.82;
}

.tab.active {
  color: var(--text);
  border-color: rgba(84, 214, 255, 0.38);
  background:
    linear-gradient(90deg, rgba(84, 214, 255, 0.17), rgba(141, 255, 159, 0.08)),
    rgba(255,255,255,0.04);
}

.tab.active .svg-icon {
  color: var(--green);
  opacity: 1;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px var(--green);
}

.hero-grid { grid-template-columns: 1.2fr 0.8fr; }
.metric-grid { grid-template-columns: repeat(4, 1fr); margin-top: 16px; }
.two-col { grid-template-columns: 1fr 1fr; margin-top: 16px; }
.two-col.wide-left { grid-template-columns: 0.9fr 1.1fr; }
.inventory-panel { margin-top: 16px; }

body:not([data-view="overview"]) .hero-grid,
body:not([data-view="overview"]) .metric-grid {
  display: none;
}

.view {
  display: none;
  margin-top: 16px;
}

.view.active {
  display: block;
}

.view > .panel + .two-col,
.view > .two-col + .two-col {
  margin-top: 16px;
}

.view[data-view-panel="lab"] > .inventory-panel {
  display: none;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent 28%);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  position: relative;
}

.panel-head > div {
  min-width: 0;
}

.panel-head h2 {
  overflow-wrap: anywhere;
}

.panel-head.compact { padding-bottom: 10px; }

.icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(84, 214, 255, 0.08);
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.icon .svg-icon {
  width: 18px;
  height: 18px;
}

.panel:hover .icon {
  border-color: rgba(84, 214, 255, 0.34);
  background: rgba(84, 214, 255, 0.12);
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.spec-grid div {
  min-height: 84px;
  padding: 18px;
  background: var(--cell);
}

.spec-grid span,
.metric-top span,
.state-row span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.spec-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.35;
}

.gauge-panel {
  min-height: 304px;
  display: grid;
  place-items: center;
}

#radarCanvas {
  width: 100%;
  height: 250px;
  display: block;
}

.radar-caption {
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px 18px;
  color: var(--muted);
}

.radar-caption strong { color: var(--green); }

.metric { padding: 18px; }

.metric-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}

.metric-top span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.metric-top .svg-icon {
  width: 15px;
  height: 15px;
  color: var(--cyan);
}

.metric-top strong { font-size: 28px; }

.bar {
  height: 10px;
  margin: 18px 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 260ms ease;
}

.metric p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.net-pills {
  display: flex;
  gap: 8px;
  margin: 17px 0 12px;
}

.net-pills span {
  flex: 1;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  text-align: center;
}

.disk-list,
.table-list,
.event-list,
.kv-list,
.module-list,
.module-grid,
.compact-grid,
.diagnostic-list {
  position: relative;
  padding: 8px 20px 20px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}

.suite-grid,
.lab-grid {
  position: relative;
  display: grid;
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.suite-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lab-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.suite-card,
.lab-card {
  min-height: 126px;
  padding: 18px;
  background: var(--cell);
}

.lab-card {
  border-top: 2px solid rgba(84, 214, 255, 0.32);
}

.suite-title,
.lab-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.suite-title strong,
.lab-title strong {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.suite-icon {
  display: inline-grid;
  place-items: center;
  color: var(--cyan);
}

.suite-icon .svg-icon {
  width: 17px;
  height: 17px;
}

.suite-title span,
.lab-title span {
  flex: 0 0 auto;
  max-width: 46%;
  padding: 4px 8px;
  border: 1px solid rgba(141, 255, 159, 0.24);
  border-radius: 7px;
  color: var(--green);
  background: rgba(141, 255, 159, 0.07);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.suite-card p,
.lab-card p {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.lab-card.muted-card {
  background: rgba(24, 27, 31, 0.62);
}

.lab-meter {
  height: 10px;
  margin: 18px 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.lab-meter i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 420ms cubic-bezier(.2, .8, .2, 1);
}

#gpuBenchCanvas {
  display: block;
  width: 100%;
  height: 78px;
  margin: 16px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(84, 214, 255, 0.12), rgba(141, 255, 159, 0.05)),
    rgba(255,255,255,0.04);
}

#gpuStressCanvas {
  display: block;
  width: 100%;
  height: 220px;
  border: 0;
  border-top: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(84, 214, 255, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(141, 255, 159, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 72% 42%, rgba(84, 214, 255, 0.16), transparent 32%),
    linear-gradient(135deg, #061317, #11181a 58%, #0c1512);
  background-size: 72px 72px, 72px 72px, auto, auto;
}

.command-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(84, 214, 255, 0.38);
  border-radius: 8px;
  color: var(--text);
  background: rgba(84, 214, 255, 0.11);
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.command-button .svg-icon {
  width: 16px;
  height: 16px;
  color: var(--cyan);
}

.command-button.danger .svg-icon {
  color: var(--red);
}

.command-button:hover {
  background: rgba(84, 214, 255, 0.18);
}

.command-button.danger {
  border-color: rgba(255, 106, 122, 0.52);
  background: rgba(255, 106, 122, 0.13);
}

.command-button.danger:hover {
  background: rgba(255, 106, 122, 0.21);
}

.command-button.ghost {
  border-color: var(--line);
  background: rgba(255,255,255,0.05);
}

.command-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.command-button.is-busy:disabled {
  cursor: wait;
}

.stress-board {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.stress-controls,
.stress-live {
  padding: 18px;
  background: var(--cell);
}

.stress-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.toggle-card,
.stress-select {
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.045);
}

.toggle-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 10px;
  align-items: center;
  cursor: pointer;
}

.toggle-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.toggle-card span,
.stress-select span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.toggle-card strong {
  grid-column: 1 / -1;
  color: var(--text);
  font-size: 18px;
}

.stress-select {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stress-select select {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(84, 214, 255, 0.28);
  border-radius: 8px;
  color: var(--text);
  background: var(--input);
  font: inherit;
  font-weight: 800;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.settings-card {
  min-height: 146px;
  padding: 18px;
  background: var(--cell);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-status-card {
  grid-column: 1 / -1;
}

.settings-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-card small {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.settings-card select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(84, 214, 255, 0.28);
  border-radius: 8px;
  color: var(--text);
  background: var(--input);
  font: inherit;
  font-weight: 800;
}

.settings-status-card strong {
  color: var(--green);
  font-size: 22px;
  line-height: 1.2;
}

.stress-actions {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.stress-actions .command-button {
  flex: 1;
  margin-top: 0;
}

.stress-live {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 18px;
  align-items: center;
}

.stress-ring {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px solid rgba(84, 214, 255, 0.28);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(84, 214, 255, 0.12), transparent 58%),
    rgba(255,255,255,0.04);
}

.stress-ring strong {
  font-size: 34px;
  color: var(--amber);
  line-height: 1;
}

.stress-ring span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.stress-bars {
  display: grid;
  gap: 8px;
}

.stress-bars div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
}

.stress-bars span {
  color: var(--muted);
}

.stress-meter {
  height: 9px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.stress-meter i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--green), var(--amber));
  transition: width 520ms cubic-bezier(.2, .8, .2, 1);
}

.stress-log {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 18px 18px;
  color: var(--muted);
}

.stress-log span {
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.045);
  overflow-wrap: anywhere;
  white-space: normal;
}

.score-panel {
  min-height: 100%;
}

.score-core {
  position: relative;
  padding: 10px 20px 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.score-core strong {
  font-size: 58px;
  line-height: 1;
  color: var(--green);
}

.score-core span {
  color: var(--muted);
  text-align: right;
}

.score-breakdown {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.score-breakdown div {
  min-height: 62px;
  padding: 12px 14px;
  background: var(--cell-soft);
}

.score-breakdown span,
.score-breakdown strong {
  display: block;
}

.score-breakdown span {
  color: var(--muted);
  font-size: 12px;
}

.score-breakdown strong {
  margin-top: 7px;
  overflow-wrap: anywhere;
}

.summary-card {
  min-height: 104px;
  padding: 16px;
  background: var(--cell);
}

.summary-card span,
.summary-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 17px;
  line-height: 1.25;
}

.disk {
  margin-top: 12px;
}

.disk-meta,
.table-row,
.event-row,
.state-row,
.kv-row,
.module-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.disk-meta > *,
.table-row > *,
.event-row > *,
.state-row > *,
.kv-row > *,
.module-row > * {
  min-width: 0;
}

.disk-meta strong,
.table-row strong,
.event-row strong,
.state-row strong,
.kv-row strong,
.module-row strong {
  overflow-wrap: anywhere;
}

.disk-meta span,
.table-row span,
.event-row span,
.state-row span,
.kv-row span,
.module-row span {
  overflow-wrap: anywhere;
}

.disk-meta span,
.table-row span,
.event-row span,
.kv-row span,
.module-row span { color: var(--muted); }

.disk .bar { margin: 8px 0 0; }

.state-row {
  min-height: 54px;
  padding: 0 20px;
  border-top: 1px solid var(--line);
}

.state-row strong.ok { color: var(--green); }
.state-row strong.warn { color: var(--amber); }
.state-row strong.bad { color: var(--red); }

.table-row {
  min-height: 42px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.table-row:first-child { border-top: 0; }
.table-row.tall {
  min-height: 58px;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
}

.empty-row {
  grid-column: 1 / -1;
  min-height: 54px;
  color: var(--muted);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cell-soft);
}

.loading-card span,
.loading-card strong,
.loading-card small,
.loading-line,
body.is-loading .metric .metric-top strong,
body.is-loading .metric p,
body.is-loading .system-panel strong {
  position: relative;
  overflow: hidden;
  color: transparent !important;
}

.loading-card span,
.loading-card strong,
.loading-card small {
  display: block;
  min-height: 13px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

.loading-card strong { min-height: 22px; }
.loading-card small { width: 72%; }

.loading-line {
  min-height: 42px;
  border-radius: 8px;
  background: rgba(255,255,255,0.055);
}

.loading-card span::after,
.loading-card strong::after,
.loading-card small::after,
.loading-line::after,
body.is-loading .metric .metric-top strong::after,
body.is-loading .metric p::after,
body.is-loading .system-panel strong::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(84, 214, 255, 0.24), transparent);
  animation: loading-sweep 1.2s ease-in-out infinite;
}

body.is-loading .metric .metric-top strong,
body.is-loading .metric p,
body.is-loading .system-panel strong {
  min-height: 1.1em;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

body.is-loading .pulse {
  animation: pulse-loading 900ms ease-in-out infinite alternate;
}

body.load-failed .status-strip {
  border-color: rgba(255, 106, 122, 0.38);
}

@keyframes loading-sweep {
  to { transform: translateX(100%); }
}

@keyframes pulse-loading {
  from { opacity: 0.35; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1.08); }
}

.diagnostic-row {
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.diagnostic-row:first-child { border-top: 0; }

.diagnostic-row strong {
  min-width: 0;
}

.diagnostic-row span {
  max-width: 62%;
  color: var(--muted);
  text-align: right;
  overflow-wrap: anywhere;
}

.diagnostic-row.ok strong { color: var(--green); }
.diagnostic-row.warn strong { color: var(--amber); }
.diagnostic-row.bad strong { color: var(--red); }

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-grid.dense {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.thread-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 8px 20px 20px;
}

.thread-card {
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
}

.thread-head,
.thread-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.thread-head span,
.thread-meta {
  color: var(--muted);
  font-size: 12px;
}

.thread-bar {
  height: 8px;
  margin: 14px 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.thread-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
}

.community-hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 10px 20px 20px;
}

.community-hero strong,
.community-hero span {
  display: block;
}

.community-hero strong {
  font-size: 22px;
}

.community-hero span {
  margin-top: 6px;
  color: var(--muted);
}

.community-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.setup-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px 20px;
}

.setup-card {
  min-height: 148px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255,255,255,0.035);
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.setup-card:hover,
.setup-card.active {
  border-color: rgba(141, 255, 159, 0.48);
  background: rgba(141, 255, 159, 0.08);
}

.setup-card span,
.setup-card small {
  display: block;
  color: var(--muted);
}

.setup-card strong {
  display: block;
  margin-top: 10px;
  font-size: 18px;
  line-height: 1.25;
}

.setup-card em {
  display: block;
  margin: 14px 0;
  color: var(--green);
  font-size: 34px;
  font-style: normal;
  font-weight: 850;
  line-height: 1;
}

.module-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.035);
  overflow: hidden;
}

.module-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
}

.module-title strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.module-title span {
  flex: 0 0 auto;
  color: var(--cyan);
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.mini-card {
  min-height: 94px;
  padding: 12px;
}

.mini-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.mini-title strong {
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.mini-title span {
  flex: 0 0 auto;
  max-width: 42%;
  padding: 4px 7px;
  border: 1px solid rgba(84, 214, 255, 0.22);
  border-radius: 7px;
  color: var(--cyan);
  background: rgba(84, 214, 255, 0.07);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.mini-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.module-specs {
  display: grid;
  grid-template-columns: minmax(120px, 0.52fr) minmax(0, 1fr);
  gap: 1px;
  background: var(--line);
}

.module-specs span,
.module-specs strong {
  min-height: 38px;
  padding: 10px 12px;
  background: var(--cell-soft);
  overflow-wrap: anywhere;
}

.module-specs span {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.module-specs strong {
  text-align: right;
  word-break: normal;
}

.kv-row,
.module-row {
  min-height: 46px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.kv-row:first-child,
.module-row:first-child { border-top: 0; }

.kv-row strong {
  max-width: 62%;
  text-align: right;
  overflow-wrap: anywhere;
}

.module-row {
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
}

.event-row {
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.event-row:first-child { border-top: 0; }

.event-main {
  min-width: 0;
}

.event-main strong,
.event-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-id {
  flex: 0 0 auto;
  color: var(--amber);
  font-weight: 800;
}

.ok { color: var(--green); }
.warn { color: var(--amber); }
.bad { color: var(--red); }

@media (max-width: 1050px) {
  .hero-grid,
  .metric-grid,
  .summary-grid,
  .suite-grid,
  .lab-grid,
  .module-grid,
  .compact-grid,
  .compact-grid.dense,
  .thread-grid,
  .setup-grid,
  .settings-grid {
    grid-template-columns: 1fr 1fr;
  }
  .stress-board,
  .two-col,
  .two-col.wide-left {
    grid-template-columns: 1fr;
  }
  .stress-controls { grid-template-columns: 1fr 1fr; }
  .stress-live { grid-template-columns: 120px 1fr; }
  .shell {
    display: block;
    width: calc(100vw - 96px);
    margin: 0 16px 0 80px;
    padding-top: 18px;
  }
  .section-nav {
    position: fixed;
    inset: 12px auto 12px 12px;
    width: 56px;
    padding: 10px 7px;
    border-radius: 14px;
  }

  .demo-mode .section-nav { top: 44px; }

  .section-nav::before,
  .section-nav::after {
    display: none;
  }

  .tabs {
    grid-template-columns: 1fr;
    gap: 7px;
    margin-top: 0;
  }

  .tab {
    justify-content: center;
    min-height: 40px;
    padding: 0;
    font-size: 0;
  }

  .tab .svg-icon {
    width: 19px;
    height: 19px;
  }
}

@media (max-width: 760px) {
  .shell {
    width: calc(100vw - 88px);
    margin: 0 12px 0 76px;
    padding-top: 14px;
  }
  .topbar,
  .hero-grid,
  .metric-grid,
  .two-col,
  .two-col.wide-left,
  .spec-grid {
    grid-template-columns: 1fr;
  }
  .actions { align-items: stretch; flex-wrap: wrap; }
  .summary-grid,
  .suite-grid,
  .lab-grid,
  .module-grid,
  .compact-grid,
  .compact-grid.dense,
  .thread-grid,
  .setup-grid,
  .settings-grid,
  .stress-board,
  .stress-controls,
  .stress-live { grid-template-columns: 1fr; }
  .community-hero { align-items: stretch; flex-direction: column; }
  .community-actions { justify-content: flex-start; }
  h1 { font-size: 32px; }
  .status-strip {
    justify-content: center;
    width: 100%;
    max-width: 100%;
  }
  .section-nav {
    inset: 10px auto 10px 10px;
    width: 52px;
    padding: 8px 6px;
  }
}
