:root {
  --bg: #0B0F19;
  --cell: #0E131F;
  --hairline: rgba(255, 255, 255, 0.10);
  --hairline-strong: rgba(255, 255, 255, 0.20);
  --ink: #F8FAFC;
  --muted: #64748B;
  --amber: #F59E0B;
  --emerald: #10B981;
  --rose: #F43F5E;
  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow: hidden;
}

.shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Header */
.topbar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--hairline);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ink);
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.guide-btn {
  border: 1px solid var(--hairline-strong);
  border-radius: 4px;
  background: var(--cell);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 5px 10px;
  cursor: pointer;
}

.guide-btn:hover {
  border-color: var(--amber);
  background: rgba(245, 158, 11, 0.12);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.status-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--emerald);
}

.status-inline.offline {
  color: var(--amber);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  animation: blink 2s step-end infinite;
}

.status-inline.offline .status-dot {
  background: var(--amber);
  animation: none;
}

@keyframes blink {
  0%, 70% { opacity: 1; }
  85% { opacity: 0.35; }
  100% { opacity: 1; }
}

.header-divider {
  width: 1px;
  height: 14px;
  background: var(--hairline);
}

.header-clock {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Main Split */
.main-split {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 368px;
}

.left-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--hairline);
}

/* 4-Cell KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.kpi-cell {
  background: var(--cell);
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-right: 1px solid var(--hairline);
  min-width: 0;
}

.kpi-cell:last-child {
  border-right: none;
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 2.8vw, 2.85rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.kpi-amber {
  color: var(--amber);
}

.kpi-emerald {
  color: var(--emerald);
}

.kpi-unit {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 2px;
}

.kpi-sub {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stage Panel */
.topology-panel {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.panel-bar {
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--bg);
}

.panel-caption {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.panel-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topology-legend {
  display: flex;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.topology-legend.hidden {
  display: none;
}

.topology-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  width: 7px;
  height: 7px;
  display: inline-block;
}

.swatch-amber {
  background: var(--amber);
}

.swatch-emerald {
  background: var(--emerald);
}

.view-tabs {
  display: inline-flex;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  overflow: hidden;
  background: var(--cell);
}

.layout-btn {
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--cell);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 6px 9px;
  cursor: pointer;
}

.layout-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.layout-btn.hidden {
  display: none;
}

.view-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  cursor: pointer;
  border-right: 1px solid var(--hairline);
}

.view-btn:last-child {
  border-right: none;
}

.view-btn.active {
  background: rgba(245, 158, 11, 0.14);
  color: var(--amber);
}

.panel-body {
  position: relative;
  flex: 1;
  min-height: 0;
}

.panel-body.hidden {
  display: none;
}

#networkCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Live Tile Render Stage Overlay */
.render-overlay {
  position: absolute;
  top: 14px;
  right: 18px;
  background: var(--cell);
  border: 1px solid var(--hairline-strong);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
}

.render-overlay.hidden {
  display: none;
}

.render-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--amber);
}

.render-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.render-canvas-wrap {
  position: relative;
  width: 360px;
  height: 225px;
  background: #06080F;
  border: 1px solid var(--hairline);
  transition: width 0.18s ease, height 0.18s ease;
}

.render-canvas-wrap.hidden {
  display: none;
}

#renderCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #06080F;
  image-rendering: pixelated;
}

#renderLabelCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.render-overlay.expanded .render-canvas-wrap {
  width: 544px;
  height: 340px;
}

.stage-metric-box {
  width: 360px;
  background: #06080F;
  border: 1px solid var(--hairline);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.render-overlay.expanded .stage-metric-box {
  width: 544px;
  padding: 24px 18px;
}

.stage-metric-box.hidden {
  display: none;
}

.stage-metric-kicker {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stage-metric-val {
  font-family: var(--font-display);
  font-size: 1.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--emerald);
  font-variant-numeric: tabular-nums;
}

.stage-metric-sub {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--amber);
}

.render-contrib-feed {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 2px;
  max-width: 360px;
}

.render-overlay.expanded .render-contrib-feed {
  max-width: 544px;
}

.contrib-last {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--emerald);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contrib-top {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.contrib-pill {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--hairline-strong);
  color: var(--muted);
}

.contrib-pill.live {
  color: var(--emerald);
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.12);
}

.icon-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.icon-close:hover {
  color: var(--ink);
}

.empty-prompt {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 6px 12px;
  border: 1px solid var(--hairline);
  background: var(--cell);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.empty-prompt.hidden {
  opacity: 0;
}

.telemetry-log {
  position: absolute;
  left: 20px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  line-height: 1.35;
  color: var(--muted);
  background: rgba(11, 15, 25, 0.86);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 6px 10px;
  pointer-events: none;
}

.telemetry-log:empty {
  display: none;
}

.telemetry-line {
  white-space: nowrap;
}

.telemetry-line .t-accent {
  color: var(--emerald);
}

.telemetry-line .t-amber {
  color: var(--amber);
}

/* Fleet Table View */
.fleet-body {
  overflow: auto;
  background: var(--bg);
}

.fleet-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.73rem;
}

.fleet-table thead th {
  position: sticky;
  top: 0;
  background: var(--cell);
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
}

.fleet-table tbody tr {
  cursor: pointer;
}

.fleet-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fleet-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.fleet-table tbody tr.selected {
  background: rgba(245, 158, 11, 0.08);
}

.fleet-empty-row td {
  text-align: center;
  color: var(--muted);
  padding: 40px 14px;
  letter-spacing: 0.08em;
  cursor: default;
}

.tag-api {
  padding: 2px 5px;
  border: 1px solid var(--hairline-strong);
  font-size: 0.63rem;
  margin-left: 6px;
}

.tag-api.webgpu {
  border-color: rgba(16, 185, 129, 0.5);
  color: var(--emerald);
}

.tag-live {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.12);
  color: var(--emerald);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-left: 6px;
}

.device-model-sub {
  color: var(--muted);
  font-size: 0.65rem;
  margin-left: 4px;
}

.ping-good { color: var(--emerald); }
.ping-mid { color: var(--amber); }
.ping-high { color: var(--rose); }
.pwr-ac { color: var(--emerald); }
.pwr-bat { color: var(--amber); }

/* Host Analytics View */
.analytics-body {
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.econ-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.econ-cell {
  background: var(--cell);
  padding: 14px 18px;
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.econ-cell:last-child {
  border-right: none;
}

.econ-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.econ-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.val-emerald { color: var(--emerald); }
.val-amber { color: var(--amber); }

.chart-card {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--hairline);
  flex: 1;
  min-height: 170px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
}

.chart-canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

#analyticsChart {
  width: 100%;
  height: 100%;
  display: block;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  flex-shrink: 0;
}

.bd-cell {
  background: var(--cell);
  padding: 14px 16px;
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.bd-cell:last-child {
  border-right: none;
}

.bd-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.bd-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink);
}

.bd-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.bd-key {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Node Inspector Drawer */
.node-inspector {
  flex-shrink: 0;
  border-top: 1px solid var(--amber);
  background: var(--cell);
  display: flex;
  flex-direction: column;
}

.node-inspector.hidden {
  display: none;
}

.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--amber);
}

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

.insp-cell {
  padding: 9px 14px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.insp-cell:nth-child(4n) {
  border-right: none;
}

.insp-cell:nth-child(n + 5) {
  border-bottom: none;
}

.insp-k {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.insp-v {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right Rail */
.right-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--cell);
}

.rail-section {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qr-section {
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.qr-row {
  display: flex;
  justify-content: center;
  padding: 2px 0;
}

.qr-frame {
  width: min(176px, 19vh);
  height: min(176px, 19vh);
  background: #FFFFFF;
  padding: 9px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  display: block;
}

.join-url {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 7px 10px;
  text-align: center;
  word-break: break-all;
}

.join-sub {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--muted);
  text-align: center;
}

.lan-hint {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--muted);
}

.lan-hint.hidden {
  display: none;
}

/* Job Section */
.job-section {
  flex: 1;
  min-height: 0;
  justify-content: space-between;
}

.job-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
}

.mode-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 8px 6px;
  cursor: pointer;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  transition: background 0.15s ease, color 0.15s ease;
}

.mode-btn:nth-child(2n) {
  border-right: none;
}

.mode-btn:nth-child(n + 3) {
  border-bottom: none;
}

.mode-btn.active {
  background: rgba(245, 158, 11, 0.14);
  color: var(--amber);
}

.mode-explainer {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  line-height: 1.4;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 6px 9px;
}

.duration-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 64px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg);
}

.duration-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 6px 4px;
  cursor: pointer;
  border-right: 1px solid var(--hairline);
  transition: background 0.15s ease, color 0.15s ease;
}

.duration-btn.active {
  background: rgba(16, 185, 129, 0.14);
  color: var(--emerald);
}

.duration-input {
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  padding: 5px 4px;
  outline: none;
  width: 100%;
}

.duration-input::placeholder {
  color: var(--muted);
}

.duration-input::-webkit-inner-spin-button,
.duration-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.run-job-btn {
  width: 100%;
  border: none;
  border-radius: 4px;
  padding: 13px 16px;
  background: var(--amber);
  color: #0B0F19;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.run-job-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.run-job-btn.stop-mode {
  background: var(--rose);
  color: #F8FAFC;
}

.run-job-btn:disabled {
  cursor: not-allowed;
  background: var(--emerald);
  color: #0B0F19;
}

.progress-block {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

#progressPct {
  color: var(--ink);
}

.progress-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--amber);
  transition: width 0.12s linear, background 0.2s ease;
}

.progress-fill.done {
  background: var(--emerald);
}

.readout-block {
  border: 1px solid var(--hairline);
  background: var(--bg);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.readout-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border-bottom: 1px solid var(--hairline);
}

.readout-row:last-child {
  border-bottom: none;
}

.readout-primary {
  padding: 9px 11px;
}

.readout-key {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex-shrink: 0;
}

.readout-val {
  font-family: var(--font-mono);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--emerald);
  font-variant-numeric: tabular-nums;
}

.readout-val-sm {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--cell);
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 4px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 50;
  transition: opacity 0.2s ease;
}

.toast.hidden {
  opacity: 0;
  pointer-events: none;
}

.guide-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 15, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}

.guide-modal.hidden {
  display: none;
}

.guide-card {
  width: min(760px, 100%);
  background: var(--cell);
  border: 1px solid var(--amber);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--amber);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-item {
  padding: 14px 18px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.guide-item:nth-child(2n) {
  border-right: none;
}

.guide-item:nth-child(n + 5) {
  border-bottom: none;
}

.guide-item strong {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--emerald);
}

.guide-item p {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink);
}

.guide-foot {
  padding: 10px 18px;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

@media (max-width: 680px) {
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .guide-item {
    border-right: none;
  }
  .guide-item:nth-child(n + 5) {
    border-bottom: 1px solid var(--hairline);
  }
  .guide-item:last-child {
    border-bottom: none;
  }
}

@media (max-width: 1120px) {
  body {
    overflow: auto;
  }
  .shell {
    height: auto;
    min-height: 100vh;
  }
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi-cell:nth-child(2n) {
    border-right: none;
  }
  .kpi-cell:nth-child(-n + 2) {
    border-bottom: 1px solid var(--hairline);
  }
  .main-split {
    grid-template-columns: 1fr;
  }
  .left-pane {
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .panel-body {
    min-height: 400px;
  }
  .breakdown-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .inspector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
