/* UARE AI Engineering Workstation — Premium Dark Theme v2 */
/* 𒀭𒂗𒆤 — EA — ABZU — all knowledge flows downward from its source */
:root {
  color-scheme: dark;
  --bg:       #0f0904;
  --bg2:      #1a1007;
  --panel:    rgba(26,16,8,0.97);
  --panel2:   rgba(32,20,9,0.98);
  --inset:    rgba(255,255,255,0.018);
  --border:   rgba(255,201,120,0.2);
  --border2:  rgba(255,214,150,0.34);
  --text:     #f8ead3;
  --text2:    #d6b88a;
  --text3:    #8e6f43;
  --cyan:     #c88b2a;
  --cyan2:    #f0be67;
  --violet:   #8a5a22;
  --violet2:  #ffd892;
  --green:    #10b981;
  --green2:   #34d399;
  --amber:    #d6942f;
  --amber2:   #ffd07a;
  --red:      #ef4444;
  --orange:   #f97316;
  --r:        14px;
  --r2:       10px;
  --shadow:   0 24px 64px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.04);
  --glow-cyan: 0 0 20px rgba(218,157,60,.28);
  --glow-violet: 0 0 20px rgba(166,110,39,.26);
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background:
    radial-gradient(ellipse 90% 55% at 15% -5%, rgba(236,173,79,.11), transparent),
    radial-gradient(ellipse 70% 45% at 85% -5%, rgba(173,113,43,.12), transparent),
    radial-gradient(ellipse 50% 60% at 50% 100%, rgba(122,84,32,.07), transparent),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
}
button { border: none; cursor: pointer; font: inherit; }
textarea, input { font: inherit; }

/* ── Ambient Canvas ── */
#ambient-bg {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; opacity: 0.28;
}

/* ── App Shell ── */
#app-shell {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100vh; width: 100vw;
  overflow: hidden;
}

/* ── Top Bar ── */
#topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 98px;
  background: linear-gradient(180deg, rgba(10,15,28,0.99) 0%, rgba(8,12,24,0.98) 100%);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 1px 0 rgba(0,212,255,.06), 0 4px 20px rgba(0,0,0,.4);
  flex-shrink: 0; z-index: 200; position: relative;
}
.brand { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.brand-mark {
  width: 92px; height: 92px; border-radius: 50%;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff;
  isolation: isolate;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,184,77,.42), 0 0 28px rgba(255,153,0,.36), 0 0 62px rgba(255,153,0,.24);
}
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  mix-blend-mode: screen;
  opacity: 0.98;
  transform: scale(1.08);
  filter: brightness(1.08) contrast(1.24) saturate(1.12) drop-shadow(0 0 10px rgba(255,166,43,0.5));
}
.brand-name { font-weight: 800; font-size: 15px; letter-spacing: -0.5px; color: var(--text); }
.brand-sub   { font-size: 10px; color: var(--text3); display: block; margin-top: -2px; letter-spacing: 0.02em; }
#tb-center { flex: 1; display: flex; align-items: center; gap: 12px; overflow: hidden; }
#assembly-name-display { font-size: 13px; font-weight: 500; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  padding: 3px 10px; border-radius: 20px;
  background: rgba(0,212,255,.08); color: var(--cyan2);
  font-size: 11px; border: 1px solid rgba(0,212,255,.22);
  flex-shrink: 0; font-weight: 600; letter-spacing: 0.02em;
  box-shadow: 0 0 10px rgba(0,212,255,.08);
}
.hidden { display: none !important; }
.live-indicator {
  display: flex; align-items: center; gap: 7px;
  padding: 3px 10px; border-radius: 20px;
  background: rgba(0,232,122,.08);
  border: 1px solid rgba(0,232,122,.2);
  font-size: 11px; color: var(--green); flex-shrink: 0;
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  animation: pulse 1.2s ease-in-out infinite;
}
.live-dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}
.live-dots i {
  display: block;
  width: 3.5px;
  height: 3.5px;
  border-radius: 50%;
  background: var(--green);
  opacity: .25;
  animation: liveDot .85s ease-in-out infinite;
}
.live-dots i:nth-child(2) { animation-delay: .17s; }
.live-dots i:nth-child(3) { animation-delay: .34s; }
@keyframes liveDot {
  0%, 100% { opacity: .2; transform: scale(.75); }
  50%       { opacity: 1; transform: scale(1.2); }
}
@keyframes pulse { 0%,100%{opacity:.3;transform:scale(.8)} 50%{opacity:1;transform:scale(1.3)} }
#tb-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.tb-btn {
  padding: 6px 13px; border-radius: 9px;
  background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.08);
  color: var(--text2); font-size: 12px; font-weight: 500;
  transition: all .18s cubic-bezier(.4,0,.2,1);
  white-space: nowrap; letter-spacing: 0.01em;
}
.tb-btn:hover { background: rgba(255,255,255,.1); color: var(--text); border-color: rgba(255,255,255,.16); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.3); }
.tb-btn:active { transform: translateY(0); box-shadow: none; }
.tb-btn.accent {
  background: linear-gradient(135deg, rgba(0,212,255,.18), rgba(124,58,237,.18));
  color: var(--cyan2); border-color: rgba(0,212,255,.28); font-weight: 600;
  box-shadow: 0 0 14px rgba(0,212,255,.12);
}
.tb-btn.accent:hover { background: linear-gradient(135deg, rgba(0,212,255,.32), rgba(124,58,237,.32)); color: #fff; box-shadow: 0 0 20px rgba(0,212,255,.22); }
.tb-btn.ghost { background: transparent; border-color: transparent; color: var(--text3); }
.tb-btn.ghost:hover { background: rgba(255,255,255,.06); color: var(--text2); border-color: transparent; transform: none; }
.tb-btn.sm { padding: 4px 9px; font-size: 11px; }

/* ── Main Split ── */
#split {
  display: grid;
  grid-template-columns: 360px 6px minmax(0, 1fr);
  flex: 1; overflow: hidden;
  position: relative;
}

/* ── Split Drag Handle ── */
#split-drag {
  background: rgba(255,255,255,.06);
  cursor: col-resize;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#split-drag::after {
  content: '⋮';
  color: rgba(255,255,255,.18);
  font-size: 14px;
  line-height: 1;
  transition: color .15s;
  pointer-events: none;
}
#split-drag:hover, #split-drag.dragging {
  background: rgba(0,212,255,.12);
  box-shadow: 0 0 12px rgba(0,212,255,.25), inset 0 0 8px rgba(0,212,255,.05);
}
#split-drag:hover::after, #split-drag.dragging::after {
  color: var(--cyan);
}

/* ── Chat Panel ── */
#chat-panel {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(9,13,24,0.99) 0%, rgba(8,12,22,0.99) 100%);
  border-right: 1px solid rgba(255,255,255,.05);
  overflow: hidden;
}
#chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  background: rgba(0,0,0,.12);
  flex-shrink: 0;
}
.enki-av-wrap { position: relative; flex-shrink: 0; }
.enki-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff;
  box-shadow: 0 0 0 2px rgba(0,212,255,.2), 0 0 24px rgba(0,212,255,.22);
}
.enki-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--panel);
}
.enki-name-lbl { font-weight: 700; font-size: 14px; color: var(--text); }
.enki-sub { font-size: 11px; color: var(--text3); margin-top: 1px; }
#chat-head > div:nth-child(2) { flex: 1; }
.endpoint-health-strip {
  margin-top: 7px;
  padding: 6px 8px;
  border: 1px solid rgba(105, 141, 179, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(15, 27, 46, 0.58) 0%, rgba(11, 20, 35, 0.66) 100%);
  max-width: 390px;
}
.endpoint-health-summary {
  font-size: 10px;
  letter-spacing: 0.02em;
  color: #9ab7d5;
  margin-bottom: 4px;
}
.endpoint-health-summary[data-tone="healthy"] { color: #7fe1b2; }
.endpoint-health-summary[data-tone="degraded"] { color: #f7c679; }
.endpoint-health-summary[data-tone="blocked"] { color: #ff9f9f; }
.endpoint-health-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.endpoint-health-chip {
  font-size: 10px;
  line-height: 1.15;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid rgba(120, 155, 190, 0.36);
  color: #c7dff6;
  background: rgba(20, 34, 58, 0.6);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-align: left;
}
.endpoint-health-chip-main { white-space: nowrap; }
.endpoint-health-chip-spark {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  color: #89abcf;
  opacity: 0.9;
}
.endpoint-health-chip-btn {
  cursor: pointer;
  appearance: none;
}
.endpoint-health-chip-btn:hover {
  border-color: rgba(145, 184, 224, 0.58);
  background: rgba(26, 46, 76, 0.78);
}
.endpoint-health-chip[data-selected="true"] {
  border-color: rgba(122, 231, 187, 0.64);
  box-shadow: 0 0 0 1px rgba(122, 231, 187, 0.25);
}
.endpoint-health-chip[data-state="open"] {
  border-color: rgba(235, 104, 104, 0.52);
  color: #ffc8c8;
  background: rgba(70, 17, 17, 0.58);
}
.endpoint-health-chip[data-state="half_open"] {
  border-color: rgba(235, 181, 104, 0.52);
  color: #ffd8a7;
  background: rgba(68, 42, 10, 0.5);
}
.endpoint-health-server {
  margin-top: 6px;
  font-size: 10px;
  color: #87a4c2;
}
.endpoint-health-server[data-tone="healthy"] { color: #82dfb4; }
.endpoint-health-server[data-tone="degraded"] { color: #f7c679; }
.endpoint-health-server[data-tone="blocked"] { color: #ff9f9f; }
.turn-reliability-trace {
  margin-top: 6px;
  border: 1px solid rgba(103, 138, 172, 0.3);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(9, 18, 31, 0.74);
  font-size: 10px;
  color: #b8d0e8;
}
.turn-reliability-trace.hidden { display: none; }
.turn-reliability-trace[data-status="completed"] { border-color: rgba(98, 209, 158, 0.42); }
.turn-reliability-trace[data-status="degraded"] { border-color: rgba(247, 198, 121, 0.48); color: #f7dca8; }
.turn-reliability-trace[data-status="blocked"] { border-color: rgba(255, 143, 143, 0.5); color: #ffc6c6; }
.turn-reliability-trace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.turn-reliability-trace-title { font-weight: 700; color: #d8eafa; }
.turn-reliability-trace-id {
  font-family: 'JetBrains Mono', monospace;
  color: #89abcf;
  overflow-wrap: anywhere;
}
.turn-reliability-trace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
}
.turn-reliability-trace-label { color: #7ea4cb; margin-right: 5px; }
.turn-reliability-trace-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.endpoint-health-details {
  margin-top: 6px;
  border: 1px solid rgba(103, 138, 172, 0.3);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(10, 18, 33, 0.72);
  font-size: 10px;
  color: #b8d0e8;
}
.endpoint-health-details.hidden { display: none; }
.endpoint-health-details-row {
  margin-bottom: 4px;
  line-height: 1.35;
}
.endpoint-health-details-row:last-child { margin-bottom: 0; }
.endpoint-health-details-label {
  color: #7ea4cb;
  margin-right: 6px;
}
.endpoint-health-details-value code {
  background: rgba(32, 53, 83, 0.7);
  border: 1px solid rgba(93, 128, 167, 0.34);
  border-radius: 4px;
  padding: 1px 4px;
  color: #d3e8fb;
}
.endpoint-health-details-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.endpoint-health-copy-btn {
  appearance: none;
  border: 1px solid rgba(104, 146, 186, 0.48);
  border-radius: 999px;
  background: rgba(19, 36, 59, 0.72);
  color: #c6ddf5;
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
}
.endpoint-health-copy-btn:hover {
  border-color: rgba(132, 190, 236, 0.62);
  background: rgba(28, 52, 81, 0.82);
}
.endpoint-health-copy-feedback {
  color: #8fdab4;
  font-size: 10px;
}
.endpoint-health-sparkline {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.12em;
}
.endpoint-health-json-preview {
  margin-top: 6px;
  border: 1px solid rgba(88, 122, 160, 0.35);
  border-radius: 7px;
  background: rgba(7, 14, 26, 0.82);
  max-height: 170px;
  overflow: auto;
}
.endpoint-health-json-preview pre {
  margin: 0;
  padding: 7px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  line-height: 1.35;
  color: #b6d0ea;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 720px) {
  .endpoint-health-strip {
    max-width: 100%;
    margin-top: 6px;
  }
}

/* ── Messages ── */
#chat-msgs {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.07) transparent;
}
#chat-msgs::-webkit-scrollbar { width: 4px; }
#chat-msgs::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.msg { display: flex; flex-direction: column; max-width: 90%; animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.msg-user { align-self: flex-end; }
.msg-assistant { align-self: flex-start; }
.msg-bubble {
  padding: 10px 14px; border-radius: 14px;
  font-size: 13px; line-height: 1.65; color: var(--text);
}
.msg-user .msg-bubble {
  background: linear-gradient(135deg, rgba(0,212,255,.12), rgba(124,58,237,.12));
  border: 1px solid rgba(0,212,255,.18);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,212,255,.08);
}
.msg-assistant .msg-bubble {
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.msg-bubble strong { color: var(--cyan2); }
.msg-bubble em { color: var(--text2); font-style: italic; }
.msg-bubble code {
  background: rgba(0,212,255,.1); padding: 1px 5px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--cyan2);
}
.msg-bubble pre {
  background: rgba(0,0,0,.35); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; margin-top: 8px;
  overflow-x: auto; font-family: 'JetBrains Mono', monospace; font-size: 11px;
}
.msg-bubble ul { padding-left: 16px; margin-top: 6px; }
.msg-bubble li { margin-bottom: 3px; }
.msg-time { font-size: 10px; color: var(--text3); margin-top: 4px; padding: 0 2px; }
.msg-user .msg-time { text-align: right; }

/* Part-build badge list */
.part-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.part-badge {
  font-size: 10.5px; padding: 3px 10px; border-radius: 20px;
  border: 1px solid rgba(255,255,255,.07); color: var(--text2);
  transition: all .2s; letter-spacing: 0.01em;
}
.part-badge.pending { color: var(--amber2); border-color: rgba(245,158,11,.28); background: rgba(245,158,11,.07); }
.part-badge.building { color: var(--cyan2); border-color: rgba(0,212,255,.32); background: rgba(0,212,255,.09); animation: badgePulse 1s ease-in-out infinite; }
.part-badge.done { color: var(--green2); border-color: rgba(16,185,129,.28); background: rgba(16,185,129,.08); }
@keyframes badgePulse { 0%,100%{opacity:.7} 50%{opacity:1} }

/* Typing indicator */
.typing-dots { display: inline-flex; gap: 4px; align-items: center; padding: 3px 0; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan2); animation: tdot 1.1s infinite;
}
.typing-dots span:nth-child(2) { animation-delay:.18s; }
.typing-dots span:nth-child(3) { animation-delay:.36s; }
@keyframes tdot { 0%,80%,100%{opacity:.2;transform:scale(.75)} 40%{opacity:1;transform:scale(1)} }

/* ── Suggestions Row ── */
#suggestions-row {
  padding: 0 16px 12px;
  display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0;
}
.sug-chip {
  padding: 5px 13px; border-radius: 20px;
  background: rgba(124,58,237,.08);
  border: 1px solid rgba(124,58,237,.22);
  color: var(--violet2); font-size: 11px; cursor: pointer;
  transition: all .18s cubic-bezier(.4,0,.2,1);
  letter-spacing: 0.01em;
}
.sug-chip:hover {
  background: rgba(124,58,237,.18);
  color: #c4b5fd;
  border-color: rgba(124,58,237,.42);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124,58,237,.18);
}

.autonomy-gap-remediation-card {
  margin: 0 16px 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 184, 77, 0.22);
  background: linear-gradient(180deg, rgba(24, 16, 8, 0.92), rgba(14, 10, 5, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.autonomy-gap-remediation-card.stale {
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 1px rgba(239, 68, 68, 0.3);
}

.agr-sev {
  display: inline-flex;
  min-width: 72px;
  justify-content: center;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.agr-sev.sev-critical {
  color: #ffd2d2;
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: rgba(127, 29, 29, 0.55);
}

.agr-sev.sev-high {
  color: #ffe4bf;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(120, 53, 15, 0.42);
}

.agr-sev.sev-medium {
  color: #fef3c7;
  border: 1px solid rgba(217, 119, 6, 0.4);
  background: rgba(120, 75, 18, 0.35);
}

.agr-sev.sev-low {
  color: #d1fae5;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(6, 78, 59, 0.4);
}

.agr-ack-btn {
  padding: 3px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 184, 77, 0.35);
  background: rgba(245, 158, 11, 0.2);
  color: #ffe7bf;
  font-size: 11px;
  font-weight: 600;
}

.agr-ack-btn:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.35);
  border-color: rgba(255, 209, 143, 0.55);
}

.agr-ack-btn:disabled,
.agr-ack-btn.acked {
  opacity: 0.62;
  cursor: default;
}

/* ── Derived CAD Spec Panel ── */
#derived-spec-panel {
  margin: 0 16px 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,212,255,.18);
  background: linear-gradient(180deg, rgba(12,18,32,.96), rgba(8,13,26,.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.03);
  flex-shrink: 0;
}
.derived-spec-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.derived-spec-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cyan2);
}
.derived-spec-status {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text3);
}
.derived-spec-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.derived-spec-questions-block {
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,184,64,.18);
  background: rgba(255,184,64,.05);
}
.derived-spec-question-list {
  margin: 8px 0 0;
  padding-left: 18px;
}
.derived-spec-question-item {
  color: var(--text2);
  font-size: 11px;
  margin-bottom: 5px;
}
.derived-spec-question-item:last-child {
  margin-bottom: 0;
}
.derived-spec-chip {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(84,215,255,.15);
  background: rgba(84,215,255,.08);
  color: var(--text2);
  font-size: 10.5px;
}
.derived-spec-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.derived-spec-section {
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  background: rgba(255,255,255,.02);
  padding: 9px 10px;
  min-height: 88px;
}
.derived-spec-section[data-visual-workflow="true"] {
  grid-column: 1 / -1;
  min-height: 0;
  overflow: visible;
}
.derived-spec-section[data-visual-workflow="true"] svg {
  display: block;
  height: auto;
}
.derived-spec-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 8px;
}
.derived-spec-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.derived-spec-row:last-child { border-bottom: none; }
.derived-spec-label {
  font-size: 10px;
  color: var(--text3);
  white-space: nowrap;
}
.derived-spec-value {
  font-size: 10px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
  word-break: break-word;
}
.derived-spec-empty {
  font-size: 10px;
  color: var(--text3);
}
.derived-spec-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.cad-time-label {
  font-size: 11px;
  color: var(--text3);
  margin-left: 4px;
  white-space: nowrap;
}

#btn-derived-spec-skip {
  background: rgba(255, 170, 0, 0.12);
  border-color: rgba(255, 170, 0, 0.35);
  color: #ffc859;
}
#btn-derived-spec-skip:hover {
  background: rgba(255, 170, 0, 0.22);
  border-color: rgba(255, 170, 0, 0.6);
  color: #ffd97a;
  transform: translateY(-1px);
}

/* ── Chat Input ── */
#chat-input-area {
  border-top: 1px solid var(--border);
  padding: 12px 14px; flex-shrink: 0;
  background: rgba(0,0,0,.15);
}
#chat-input {
  width: 100%; resize: none;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08); border-radius: 12px;
  color: var(--text); padding: 11px 14px;
  font-size: 13px; line-height: 1.5; outline: none;
  transition: all .2s cubic-bezier(.4,0,.2,1);
}
#chat-input:focus {
  border-color: rgba(0,212,255,.45);
  box-shadow: 0 0 0 3px rgba(0,212,255,.08), 0 0 16px rgba(0,212,255,.06);
  background: rgba(255,255,255,.055);
}
#chat-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 9px;
}
.hint-text { font-size: 10.5px; color: var(--text3); }
.hint-text kbd {
  background: rgba(255,255,255,.08); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-family: inherit; font-size: 10px;
}
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--text3); display: flex; align-items: center; justify-content: center;
  font-size: 14px; transition: all .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.09); color: var(--text2); }
#send-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #fff; display: flex; align-items: center; justify-content: center;
  transition: all .18s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 4px 16px rgba(0,212,255,.28), 0 0 0 1px rgba(0,212,255,.2);
}
#send-btn:hover { opacity: .95; transform: scale(1.07); box-shadow: 0 6px 22px rgba(0,212,255,.4), 0 0 0 1px rgba(0,212,255,.3); }
#send-btn:active { transform: scale(.92); }
#send-btn:disabled { opacity: .28; cursor: not-allowed; transform: none; box-shadow: none; }

/* Navigation clarity: keep creation primary and reveal specialist tools on demand. */
#topbar {
  height: 64px;
  padding: 0 16px;
  gap: 12px;
}
.brand { gap: 10px; }
.brand-mark { width: 48px; height: 48px; }
#hud-status-lights { display: none; }
#tb-actions { gap: 7px; }
.tools-menu-wrap { position: relative; }
.tools-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 500;
  display: none;
  width: min(320px, calc(100vw - 24px));
  padding: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border: 1px solid rgba(157,184,212,.24);
  border-radius: 12px;
  background: rgba(10,17,27,.98);
  box-shadow: 0 18px 48px rgba(0,0,0,.48);
}
.tools-menu.open { display: grid; }
.tools-menu > .tb-btn,
.tools-menu > a.tb-btn,
.tools-menu > .tb-dropdown-wrap {
  width: 100%;
  min-height: 38px;
  margin: 0;
  justify-content: flex-start;
  text-align: left;
}
.tools-menu > .tb-btn,
.tools-menu > a.tb-btn { display: flex; align-items: center; }
.tools-menu #export-dropdown-wrap { grid-column: 1 / -1; }
.tools-menu #export-dropdown-wrap { display: block !important; }
.tools-menu #btn-export-more { width: 100%; text-align: left; }
.tools-menu #export-dropdown { position: static; width: 100%; margin-top: 6px; box-shadow: none; }
.platform-tool-belt {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(157,184,212,.18);
}
.platform-tool-belt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--text2);
  font-size: 11px;
}
.platform-tool-belt-head span { color: var(--text3); font-size: 10px; }
.platform-capability-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  max-height: 330px;
  overflow-y: auto;
}
.platform-capability-item {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(157,184,212,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: var(--text2);
  text-align: left;
  cursor: pointer;
}
.platform-capability-item:hover { border-color: rgba(84,215,255,.5); background: rgba(84,215,255,.07); }
.platform-capability-title { display: block; font-size: 11px; font-weight: 650; color: var(--text1); }
.platform-capability-id { display: block; margin-top: 2px; font: 9px/1.3 var(--mono); color: var(--cyan); overflow-wrap: anywhere; }
.platform-capability-desc { display: block; margin-top: 4px; font-size: 9px; line-height: 1.35; color: var(--text3); }

.endpoint-health-strip {
  max-width: 320px;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: transparent;
}
.endpoint-health-strip summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  cursor: pointer;
  list-style: none;
}
.endpoint-health-strip summary::-webkit-details-marker { display: none; }
.endpoint-health-summary { margin: 0; }
.endpoint-health-disclosure { font-size: 9px; color: var(--text3); }
.endpoint-health-strip[open] {
  padding: 7px 8px;
  border: 1px solid rgba(105,141,179,.28);
  background: rgba(11,20,35,.8);
}
.endpoint-health-strip[open] summary { margin-bottom: 6px; }

#ecosystem-activity-rail {
  min-height: 30px;
  padding: 4px 16px;
}
.eco-rail-head { min-width: 150px; }
.eco-rail-title { color: #7893aa; }
.eco-rail-list .eco-rail-item:not(:last-child) { display: none; }

@media (max-width: 1100px) {
  .brand-sub, #tb-center { display: none; }
}
@media (max-width: 640px) {
  #topbar { height: 58px; padding: 0 10px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-name { font-size: 13px; }
  #btn-command-palette { display: none; }
  #btn-new { padding-inline: 10px; }
  #ecosystem-activity-rail { display: none; }
  .tools-menu { position: fixed; top: 76px; right: 10px; left: 10px; width: auto; }
}

/* ── Viewport Panel ── */
#viewport-panel {
  position: relative;
  background: radial-gradient(ellipse 80% 60% at 50% 30%, rgba(0,212,255,.022), transparent),
              radial-gradient(ellipse 60% 80% at 20% 70%, rgba(124,58,237,.018), transparent),
              var(--bg2);
  overflow: hidden;
}
#cad-canvas {
  display: block; width: 100%; height: 100%; outline: none;
  cursor: grab;
}
#cad-canvas:active { cursor: grabbing; }

/* ── Side Panels ── */
.side-panel {
  position: absolute; top: 0; bottom: 0; width: 270px; z-index: 50;
  background: var(--panel2); border: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.side-panel.collapsed { transform: translateX(-105%); opacity: 0; visibility: hidden; pointer-events: none; }
.side-panel:not(.collapsed) { opacity: 1; visibility: visible; }
#asm-tree { left: 0; border-radius: 0 var(--r) var(--r) 0; }
.right-panel { right: 0; left: auto; border-radius: var(--r) 0 0 var(--r); }
.right-panel.collapsed { transform: translateX(105%); }
.side-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text2); flex-shrink: 0;
}
#asm-tree-content { flex: 1; overflow-y: auto; padding: 8px; }
#asm-tree-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.02);
}
.tree-tool-chip {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: var(--text3);
  font-size: 10px;
  cursor: pointer;
  transition: all .12s;
}
.tree-tool-chip:hover {
  border-color: rgba(84,215,255,.42);
  color: var(--text2);
}
.tree-tool-chip.active {
  color: var(--cyan2);
  border-color: rgba(84,215,255,.42);
  background: rgba(84,215,255,.12);
}
.tree-item {
  padding: 7px 10px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--text2); transition: background .1s;
  user-select: none;
}
.tree-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.tree-item.selected { background: rgba(0,212,255,.1); color: var(--cyan2); }
.tree-item.is-filtered-out {
  opacity: .34;
}
.tree-icon { font-size: 14px; flex-shrink: 0; }
.tree-label { flex: 1; }
.tree-sub { font-size: 10px; color: var(--text3); }
#asm-bom {
  padding: 10px; border-top: 1px solid var(--border);
  font-size: 11px; flex-shrink: 0;
}
.bom-header { font-weight: 700; color: var(--text2); margin-bottom: 4px; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; padding: 2px 4px; }
.bom-table { display: flex; flex-direction: column; }
.bom-thead {
  display: grid; grid-template-columns: 22px 1fr 80px 52px 52px;
  gap: 4px; padding: 2px 4px; font-size: 9px; color: var(--text3);
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.bom-row {
  display: grid; grid-template-columns: 22px 1fr 80px 52px 52px;
  gap: 4px; padding: 3px 4px; border-radius: 3px; color: var(--text3);
  font-size: 10px; cursor: pointer; transition: background .1s;
}
.bom-row:hover { background: rgba(255,255,255,.06); color: var(--text2); }
.bom-row.selected { background: rgba(0,212,255,.12); color: var(--text); border-left: 2px solid var(--cyan2); }
.bom-row.is-filtered-out { opacity: .3; }
.bom-idx { color: var(--text3); font-size: 9px; padding-top: 1px; }
.bom-name { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bom-mat { color: var(--text3); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bom-mass { color: var(--cyan2); font-family: 'JetBrains Mono', monospace; font-size: 9px; text-align: right; }
.bom-type { color: #7a8a9a; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bom-notes { font-size: 9px; color: var(--text3); padding: 4px 4px 0; font-style: italic; border-top: 1px solid rgba(255,255,255,.06); margin-top: 2px; }
.bom-row .qty { color: var(--cyan2); font-weight: 600; }
#part-props-content { flex: 1; overflow-y: auto; padding: 8px 12px; }
.props-section { margin-bottom: 8px; }
.props-section-title {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--cyan2); padding: 4px 0 2px; border-bottom: 1px solid rgba(84,215,255,.2);
  margin-bottom: 2px; text-transform: uppercase;
}
.prop-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.04); gap: 8px; }
.prop-row:last-child { border-bottom: none; }
.prop-label { font-size: 10px; color: var(--text3); flex: 0 0 auto; max-width: 48%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prop-val { font-size: 10px; color: var(--text); font-weight: 500; font-family: 'JetBrains Mono', monospace; text-align: right; word-break: break-word; }
.btn-xs { display: inline-block; }

/* ── Viewport Controls ── */
#vp-controls {
  position: absolute; top: 12px; right: 12px;
  display: flex; flex-direction: column; gap: 6px; z-index: 25;
}
.vp-btn-group { display: flex; gap: 3px; }
.section-cut-group {
  align-items: center;
  gap: 5px;
}
.vp-btn {
  padding: 5px 11px; border-radius: 8px;
  background: rgba(5,8,16,.88); border: 1px solid rgba(255,255,255,.08);
  color: var(--text2); font-size: 11px; font-weight: 500;
  backdrop-filter: blur(14px); transition: all .15s cubic-bezier(.4,0,.2,1);
  letter-spacing: 0.02em;
}
.vp-btn:hover { background: rgba(255,255,255,.1); color: var(--text); border-color: rgba(255,255,255,.18); transform: translateY(-1px); }
.vp-btn:active { transform: translateY(0); }
.vp-btn.active { background: rgba(0,212,255,.14); color: var(--cyan2); border-color: rgba(0,212,255,.32); box-shadow: 0 0 10px rgba(0,212,255,.12); }
.vp-btn.warn {
  opacity: 0.4;
  border-color: rgba(255,255,255,.06);
  color: var(--text3);
  cursor: not-allowed;
}
.vp-btn.warn:hover {
  opacity: 0.5;
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.06);
  color: var(--text3);
  transform: none;
}
.vp-btn.good {
  border-color: rgba(16,185,129,.42);
  color: var(--green2);
}
.explode-btn { margin-top: 3px; }
#section-cut-slider {
  width: 98px;
  accent-color: var(--cyan2);
}
#btn-gearbox-explode-mode {
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--text2);
}
#btn-gear-mesh-legend-toggle {
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--text2);
}
#btn-gearbox-explode-reset {
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--text2);
}
#btn-gearbox-explode-mode[data-mode="classic"] {
  border-color: rgba(255,197,96,.35);
  color: #ffd9a8;
}
#btn-gearbox-explode-reset[data-exploded="true"] {
  border-color: rgba(52, 210, 124, .45);
  color: #b8f8d5;
}

#gear-mesh-legend {
  position: absolute;
  right: 14px;
  bottom: 54px;
  width: min(360px, calc(100% - 28px));
  border-radius: 12px;
  border: 1px solid rgba(86, 194, 255, .25);
  background: rgba(8, 13, 26, .9);
  backdrop-filter: blur(10px);
  padding: 10px 11px;
  z-index: 20;
}
.legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.legend-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--cyan2);
  font-weight: 700;
}
.legend-btn {
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: var(--text2);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.legend-btn:hover {
  border-color: rgba(84,215,255,.42);
  color: var(--text);
  background: rgba(84,215,255,.12);
}
.legend-chip {
  font-size: 10px;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(84,215,255,.14);
  border: 1px solid rgba(84,215,255,.26);
  color: var(--text2);
}
.legend-close {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: var(--text2);
  font-size: 11px;
  line-height: 1;
  padding: 0;
}
.legend-close:hover {
  border-color: rgba(255,96,96,.46);
  color: #ffd2d2;
  background: rgba(255,96,96,.12);
}
.legend-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
}
.legend-metric {
  font-size: 10px;
  color: var(--text3);
}
.legend-metric strong {
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.legend-stage-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 2px 0 6px;
}
.legend-stage-pill {
  border-radius: 8px;
  font-size: 10px;
  padding: 4px 6px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: var(--text2);
}
.legend-stage-pill.pass {
  border-color: rgba(52,210,124,.4);
  background: rgba(52,210,124,.12);
}
.legend-stage-pill.fail {
  border-color: rgba(255,96,96,.4);
  background: rgba(255,96,96,.12);
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text3);
  line-height: 1.3;
  margin-top: 3px;
}
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-pass { background: #34d27c; box-shadow: 0 0 0 1px rgba(52,210,124,.35); }
.legend-fail { background: #ff6060; box-shadow: 0 0 0 1px rgba(255,96,96,.35); }
.legend-eq {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text2);
}

/* ── Action Overlay ── */
#action-overlay {
  position: absolute; bottom: 54px; left: 14px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 12px;
  background: rgba(8,13,26,.94); border: 1px solid rgba(0,212,255,.2);
  backdrop-filter: blur(14px); z-index: 20;
  min-width: 200px; flex-wrap: wrap;
}
.action-ring {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--cyan); border-right-color: var(--violet);
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
#action-text { font-size: 12px; color: var(--text); flex: 1; }
#action-progress-bar {
  width: 100%; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.08); margin-top: 2px;
  overflow: hidden;
}
#action-progress-fill {
  height: 100%; width: 0%; border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width .3s ease;
}

#viewport-status-chip {
  position: absolute;
  top: 14px;
  right: 14px;
  max-width: min(560px, calc(100% - 28px));
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(8,13,26,.9);
  color: var(--text2);
  font-size: 11px;
  line-height: 1.35;
  backdrop-filter: blur(8px);
  z-index: 20;
  box-shadow: 0 6px 22px rgba(0,0,0,.35);
}

#viewport-status-chip.warn {
  border-color: rgba(245,158,11,.42);
  background: rgba(245,158,11,.12);
  color: #ffdba0;
}

#viewport-status-chip.info {
  border-color: rgba(64,218,255,.34);
  background: rgba(64,218,255,.11);
  color: #bff3ff;
}

/* ── Coord HUD ── */
#coord-hud {
  position: absolute; bottom: 14px; right: 14px;
  display: flex; gap: 12px;
  background: rgba(8,13,26,.82); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text3);
  backdrop-filter: blur(8px); z-index: 20;
}

/* ── Engineering QA Panel — bottom-docked drawer, no overlap with viewport controls ── */
#engineering-qa-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-height: 310px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 16px 12px;
  border-radius: 14px 14px 0 0;
  background: rgba(5,8,18,.97);
  border: 1px solid rgba(0,212,255,.2);
  border-bottom: none;
  backdrop-filter: blur(18px);
  box-shadow: 0 -8px 40px rgba(0,0,0,.5), 0 -1px 0 rgba(0,212,255,.08);
  z-index: 21;
  transition: max-height .3s cubic-bezier(.4,0,.2,1);
}
/* Collapsed — just shows the header badge tab */
#engineering-qa-panel.is-collapsed {
  max-height: 42px;
  overflow: hidden;
  width: fit-content;
  right: auto;
  border-radius: 12px 12px 0 0;
  border-right: 1px solid rgba(0,212,255,.2);
  min-width: 260px;
}
.qa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}
.qa-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.qa-title {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cyan2);
  font-weight: 700;
}
.qa-toggle {
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: var(--text2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.qa-toggle:hover {
  background: rgba(255,255,255,.10);
  color: var(--text);
}
.qa-toggle:focus-visible {
  outline: 2px solid rgba(84,215,255,.65);
  outline-offset: 2px;
}
.qa-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text2);
  border: 1px solid rgba(84,215,255,.2);
  background: rgba(84,215,255,.10);
  border-radius: 999px;
  padding: 2px 8px;
}
.qa-grade-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: #fde68a;
  border: 1px solid rgba(245,158,11,.4);
  background: rgba(245,158,11,.12);
  border-radius: 999px;
  padding: 3px 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 700;
}
.qa-grade-badge.pass {
  color: var(--green2);
  border-color: rgba(16,185,129,.42);
  background: rgba(16,185,129,.12);
  box-shadow: 0 0 10px rgba(16,185,129,.1);
}
.qa-grade-badge.fail {
  color: #fca5a5;
  border-color: rgba(239,68,68,.44);
  background: rgba(239,68,68,.12);
}
.qa-grade-badge.provisional {
  color: #fde68a;
  border-color: rgba(245,158,11,.45);
  background: rgba(245,158,11,.12);
}
.qa-body {
  display: block;
}
.qa-body[hidden] {
  display: none;
}
.is-collapsed .qa-head {
  margin-bottom: 0;
}
.qa-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}
@media (max-width: 900px) {
  .qa-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.qa-metric {
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  padding: 7px 8px;
  background: rgba(255,255,255,.025);
  transition: border-color .15s;
}
.qa-metric:hover { border-color: rgba(0,212,255,.18); }
.qa-metric span {
  display: block;
  font-size: 9px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.qa-metric strong {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text);
}
.qa-metric strong.pass {
  color: #8fffca;
}
.qa-metric strong.fail {
  color: #ff9aa6;
}
.qa-section {
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 9px;
  background: rgba(255,255,255,.018);
  margin-bottom: 6px;
  overflow: hidden;
}
.qa-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 10px;
  font-size: 10px;
  color: var(--text2);
  border-bottom: 1px solid rgba(255,255,255,.05);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
}
.qa-warned-toggle {
  flex-shrink: 0;
  padding: 2px 7px;
  font-size: 9px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid rgba(255,165,0,.35);
  border-radius: 4px;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1.5;
}
.qa-warned-toggle:hover {
  background: rgba(255,165,0,.12);
  border-color: rgba(255,165,0,.7);
  color: #ffa500;
}
.qa-warned-toggle.active {
  background: rgba(255,140,0,.22);
  border-color: #ff8c00;
  color: #ffb347;
}
.qa-list {
  padding: 4px 8px 7px;
}
.qa-stage-summary {
  margin: 2px 0 8px;
  padding: 7px 8px;
  border: 1px solid rgba(84,215,255,.2);
  background: rgba(84,215,255,.08);
  border-radius: 7px;
  font-size: 10px;
  color: var(--text2);
  line-height: 1.45;
}
.qa-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 10px;
}
.qa-item:last-child {
  border-bottom: none;
}
.qa-item span {
  color: var(--text3);
}
.qa-item strong {
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}
.qa-empty {
  font-size: 10px;
  color: var(--text3);
  padding: 3px 0;
}

/* ── Viewport Empty State ── */
#viewport-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; pointer-events: none; z-index: 10;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, rgba(0,212,255,.035), transparent),
    radial-gradient(ellipse 50% 40% at 20% 80%, rgba(124,92,255,.04), transparent);
}

/* Final layout priorities. This block stays last so legacy theme layers cannot
   restore the oversized header or permanently expose secondary controls. */
#app-shell #topbar { height: 64px; min-height: 64px; padding: 0 16px; gap: 12px; }
#app-shell .brand-mark { width: 48px; height: 48px; }
#app-shell #hud-status-lights { display: none; }
#app-shell .tools-menu { display: none; }
#app-shell .tools-menu.open { display: grid; }
#app-shell #ecosystem-activity-rail { min-height: 30px; padding: 4px 16px; }
#app-shell .eco-rail-list .eco-rail-item:not(:last-child) { display: none; }

@media (max-width: 1100px) {
  #app-shell .brand-sub,
  #app-shell #tb-center { display: none; }
}

@media (max-width: 640px) {
  #app-shell #topbar { height: 58px; min-height: 58px; padding: 0 10px; }
  #app-shell .brand-mark { width: 40px; height: 40px; }
  #app-shell #btn-command-palette { display: none; }
  #app-shell #ecosystem-activity-rail { display: none; }
  #app-shell #sim-bar { display: none; }
  #app-shell #suggestions-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}
.empty-demo-actions {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}
/* animated dot-grid background */
#viewport-empty::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridShift 8s linear infinite;
  pointer-events: none;
}
@keyframes gridShift {
  0%   { background-position: 0 0; }
  100% { background-position: 40px 40px; }
}
.empty-icon {
  font-size: 64px; opacity: .18;
  filter: drop-shadow(0 0 24px rgba(0,212,255,.4));
  animation: emptyFloat 4s ease-in-out infinite;
}
@keyframes emptyFloat {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}
#viewport-empty h3 {
  font-size: 19px; font-weight: 700; color: var(--text2); opacity: .6;
  letter-spacing: -0.4px;
}
#viewport-empty p {
  font-size: 13px; color: var(--text3); text-align: center; max-width: 300px;
  opacity: .45; line-height: 1.8;
}
.empty-hint-chips {
  display: flex; flex-wrap: wrap; gap: 7px; justify-content: center;
  max-width: 340px; margin-top: 4px;
}
.empty-hint-chip {
  padding: 4px 11px; border-radius: 20px;
  border: 1px solid rgba(0,212,255,.15);
  background: rgba(0,212,255,.05);
  color: var(--text3); font-size: 11px; opacity: .7;
}
/* ── Fold Demo ── */
#viewport-fold-demo {
  display: none;
  width: 320px;
  max-width: calc(100% - 32px);
  margin-bottom: 8px;
  pointer-events: none;
}
.fold-scaffold {
  position: relative;
  border-radius: 10px;
  border: 1px solid rgba(0,212,255,.22);
  background: linear-gradient(180deg, rgba(3,9,22,.96) 0%, rgba(5,11,28,.9) 100%);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,212,255,.08), 0 8px 40px rgba(0,0,0,.65), 0 0 50px rgba(84,215,255,.07), inset 0 1px 0 rgba(84,215,255,.06);
}
.fold-svg {
  display: block;
  width: 100%;
  height: auto;
}
/* Isometric face base animation (opacity breathe) */
.fold-face { animation: facePulse 2.8s ease-in-out infinite; }
.fold-face-left  { animation-delay: .35s; }
.fold-face-right { animation-delay: .7s; }
@keyframes facePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .65; }
}
/* Scan line sweeping down */
.fold-scan {
  animation: scanSweep 2.2s linear infinite;
}
@keyframes scanSweep {
  0%   { transform: translateY(-4px); opacity: .7; }
  85%  { opacity: .55; }
  100% { transform: translateY(144px); opacity: 0; }
}
/* Center origin pulse */
.fold-origin {
  animation: originPulse 1.4s ease-in-out infinite;
}
@keyframes originPulse {
  0%, 100% { r: 2.5; opacity: .75; }
  50%      { r: 4.5; opacity: 1; }
}
/* Vertical edges appear progressively during generation */
.fold-edge {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: edgeDraw 1.1s ease forwards;
}
/* Status bar below the SVG */
#viewport-fold-status {
  margin-top: 9px;
  text-align: center;
  font-size: 11px;
  letter-spacing: .07em;
  color: rgba(84,215,255,.9);
  font-family: 'JetBrains Mono', monospace;
  min-height: 18px;
  transition: color .3s;
  text-shadow: 0 0 12px rgba(84,215,255,.4);
}
.fold-step-cursor {
  display: inline-block;
  animation: cursorBlink .9s step-start infinite;
  margin-left: 1px;
  opacity: .7;
}
@keyframes cursorBlink { 0%, 100% { opacity: .7; } 50% { opacity: 0; } }

/* ── is-generating state ── */
#viewport-empty.is-generating #viewport-fold-demo { display: block; }
#viewport-empty.is-generating .empty-icon { opacity: 0; transform: scale(.85); filter: none; transition: all .3s; visibility: hidden; }
#viewport-empty.is-generating h3 { opacity: 0 !important; transition: opacity .25s; }
#viewport-empty.is-generating p { opacity: 0 !important; transition: opacity .25s; }
#viewport-empty.is-generating .empty-hint-chips { opacity: 0; pointer-events: none; transition: opacity .2s; }
#viewport-empty.is-generating .empty-demo-actions { opacity: 0; pointer-events: none; transition: opacity .2s; }

#viewport-empty.hidden { display: none; }

#viewport-approval-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  background: linear-gradient(180deg, rgba(5, 10, 20, 0.96) 0%, rgba(4, 9, 18, 0.98) 100%);
  border: 1px solid rgba(75, 156, 224, 0.28);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.viewport-approval-title {
  font-size: 18px;
  font-weight: 700;
  color: #dcecff;
}

.viewport-approval-subtitle {
  font-size: 12px;
  color: #94adc8;
}

.viewport-approval-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.viewport-approval-card {
  border: 1px solid rgba(112, 149, 183, 0.4);
  border-radius: 10px;
  background: rgba(9, 18, 36, 0.82);
  padding: 10px;
}

.viewport-approval-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #e9f4ff;
}

.viewport-approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.viewport-approval-note {
  padding: 10px;
  border-radius: 8px;
  background: rgba(17, 35, 63, 0.7);
  border: 1px dashed rgba(130, 180, 230, 0.5);
  font-size: 12px;
  color: #bdd8f2;
}

/* ── Simulation Bar ── */
#sim-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px; height: 48px;
  background: linear-gradient(180deg, rgba(8,12,24,0.98) 0%, rgba(6,9,18,0.99) 100%);
  border-top: 1px solid rgba(255,255,255,.05);
  box-shadow: 0 -1px 0 rgba(0,212,255,.05), 0 -4px 20px rgba(0,0,0,.35);
  flex-shrink: 0; z-index: 100; position: relative;
  overflow: hidden;
}
#sim-left {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-width: 0;
}
#sim-left::-webkit-scrollbar { display: none; }
.sim-badge {
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; border: 1px solid transparent;
}
.sim-badge.idle { color: var(--text3); border-color: var(--border); }
.sim-badge.running { color: var(--green); border-color: rgba(0,232,122,.3); background: rgba(0,232,122,.08); }
.sim-badge.complete { color: var(--cyan2); border-color: rgba(0,212,255,.3); background: rgba(0,212,255,.08); }
.sim-badge.fail { color: var(--red); border-color: rgba(255,77,106,.3); background: rgba(255,77,106,.08); }
.sim-btn {
  padding: 5px 12px; border-radius: 8px; font-size: 11.5px; font-weight: 500;
  background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.08); color: var(--text2);
  transition: all .18s cubic-bezier(.4,0,.2,1);
  letter-spacing: 0.01em;
}
.sim-btn:hover:not(:disabled) { background: rgba(255,255,255,.10); color: var(--text); border-color: rgba(255,255,255,.16); transform: translateY(-1px); }
.sim-btn:active:not(:disabled) { transform: translateY(0); }
.sim-btn:disabled { opacity: .28; cursor: not-allowed; }
.sim-btn.primary {
  background: linear-gradient(135deg, rgba(0,212,255,.16), rgba(124,58,237,.16));
  color: var(--cyan2); border-color: rgba(0,212,255,.26);
  box-shadow: 0 0 12px rgba(0,212,255,.1);
}
.sim-btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(0,212,255,.28), rgba(124,58,237,.28));
  box-shadow: 0 0 18px rgba(0,212,255,.18);
}
.sim-sep { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
#engine-bench-panel {
  display: flex; align-items: center; gap: 12px;
  min-width: 0; padding: 5px 10px;
  border-radius: 10px; border: 1px solid rgba(0,212,255,.14);
  background: rgba(8,13,26,.72); flex: 1;
}
#engine-bench-panel.hidden { display: none; }
.bench-control {
  display: flex; align-items: center; gap: 7px; min-width: 0;
}
.bench-control.compact input[type="number"] { width: 82px; }
.bench-control label {
  font-size: 10px; color: var(--text3); text-transform: uppercase;
  letter-spacing: .05em; white-space: nowrap;
}
.bench-control input[type="range"] {
  width: 104px; accent-color: #26d7ff;
}
.bench-control input[type="number"] {
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  color: var(--text); border-radius: 7px; padding: 5px 7px;
  font-size: 11px; font-family: 'JetBrains Mono', monospace;
}
.bench-val {
  min-width: 48px; color: var(--cyan2); text-align: right;
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px;
}
#engine-bench-readout {
  display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0;
}
#engine-bench-readout span {
  color: var(--text2); font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; white-space: nowrap;
}
#sim-metrics {
  display: flex; gap: 18px; flex: 1; justify-content: center; align-items: center;
}
.metric { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
.m-label { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: var(--text3); }
.m-val { font-size: 12px; font-weight: 600; color: var(--text); font-family: 'JetBrains Mono', monospace; }
#sim-result-text {
  font-size: 11.5px; color: var(--text2); flex-shrink: 0;
  max-width: 220px; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Scrollbar Global ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.09); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.15); }

/* ── Utility ── */
.text-cyan   { color: var(--cyan2); }
.text-green  { color: var(--green); }
.text-amber  { color: var(--amber); }
.text-red    { color: var(--red); }
.text-muted  { color: var(--text3); }
.mono        { font-family: 'JetBrains Mono', monospace; }

/* ── Responsive: medium screens (900px) ── */
@media (max-width: 900px) {
  #split { grid-template-columns: 300px 6px minmax(0, 1fr); }
  #engine-bench-panel { order: 3; width: 100%; flex-wrap: wrap; }
  #engine-bench-readout { width: 100%; margin-left: 0; flex-wrap: wrap; }
  #engineering-qa-panel.is-collapsed { min-width: 200px; }
  #gear-mesh-legend { right: 12px; left: 12px; width: auto; bottom: 70px; }
  /* Slim topbar: hide export buttons, brand subtitle */
  #btn-export-step, #btn-export-obj, #btn-export-stl, #btn-export-bom-csv { display: none; }
  .brand-sub { display: none; }
  #topbar { gap: 10px; padding: 0 12px; }
}

/* ── Responsive: narrow panel toggle (700px) ── */
@media (max-width: 700px) {
  #split { grid-template-columns: 1fr; }
  #split-drag { display: none; }
  #sim-bar { height: auto; min-height: 46px; padding: 8px 12px; flex-wrap: wrap; }
  #viewport-panel { display: none; }
  #viewport-panel.vp-active {
    display: block;
    min-height: min(62vh, 560px);
    height: calc(100vh - 136px);
  }
  #viewport-panel.vp-active #cad-canvas {
    min-height: 360px;
  }
  #chat-panel.vp-active { display: none; }
  #panel-tabs { display: flex !important; }
}

/* ── Panel Tabs (visible only <700px) ── */
#panel-tabs {
  display: none;
  align-items: center; gap: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 101;
}
.panel-tab {
  flex: 1; padding: 8px; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--text3);
  border: none; background: transparent; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.panel-tab.active { color: var(--cyan2); border-bottom-color: var(--cyan2); }
.panel-tab:hover:not(.active) { color: var(--text2); }

/* ══════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS MODAL
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(5,8,16,.82); backdrop-filter: blur(18px);
  display: flex; align-items: center; justify-content: center;
  animation: modalFadeIn .18s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}
.modal-box {
  background: var(--panel2);
  border: 1px solid rgba(0,212,255,.14);
  border-radius: 18px;
  box-shadow: 0 32px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(0,212,255,.06), var(--glow-cyan);
  max-width: 780px; width: 92vw;
  max-height: 80vh; overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--cyan2); letter-spacing: .02em; }
.modal-close {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  color: var(--text2); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-close:hover { background: rgba(239,68,68,.18); color: var(--red); border-color: var(--red); }
.modal-body { overflow-y: auto; padding: 20px 22px; flex: 1; }
.shortcuts-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
}
@media (max-width: 600px) { .shortcuts-grid { grid-template-columns: 1fr; } }
.sc-group { display: flex; flex-direction: column; gap: 6px; }
.sc-group-title {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--cyan2); opacity: .8;
  margin-bottom: 4px;
}
.sc-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; color: var(--text2);
}
.sc-row kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 22px; padding: 0 7px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  border-bottom: 2px solid rgba(255,255,255,.1);
  border-radius: 5px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--text); white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}

/* ══════════════════════════════════════════════════════════
   BOM ENHANCEMENTS — TYPE ICONS + EXPORT ROW
   ══════════════════════════════════════════════════════════ */
.bom-export-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; margin-bottom: 2px;
  background: rgba(0,212,255,.04); border-radius: 8px;
  border: 1px solid rgba(0,212,255,.08);
}
.bom-export-bar-title { font-size: 11px; font-weight: 600; color: var(--text2); }
.bom-export-btn {
  font-size: 11px; font-weight: 600;
  padding: 5px 12px; border-radius: 7px;
  background: rgba(0,212,255,.1);
  border: 1px solid rgba(0,212,255,.22);
  color: var(--cyan2); cursor: pointer;
  transition: all .15s;
}
.bom-export-btn:hover {
  background: rgba(0,212,255,.2);
  box-shadow: var(--glow-cyan);
}
.bom-type-icon {
  display: inline-block; width: 16px; height: 16px;
  border-radius: 3px; font-size: 9px; line-height: 16px;
  text-align: center; font-weight: 700; margin-right: 6px;
  flex-shrink: 0;
  color: #fff; opacity: .85;
}
.bom-type-mechanical  { background: #2563eb; }
.bom-type-fastener    { background: #6b7280; }
.bom-type-sealing     { background: #d97706; }
.bom-type-fluid       { background: #0891b2; }
.bom-type-electrical  { background: #7c3aed; }
.bom-type-structural  { background: #16a34a; }
.bom-type-default     { background: #374151; }

/* ══════════════════════════════════════════════════════════
   QA SCORE COUNT-UP ANIMATION
   ══════════════════════════════════════════════════════════ */
@keyframes scoreCountUp {
  from { transform: scale(.85) translateY(4px); opacity: .3; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.qa-score.animating {
  animation: scoreCountUp .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes gradePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .6; }
}
.qa-grade-badge.building {
  animation: gradePulse 1.2s ease infinite;
}

/* ══════════════════════════════════════════════════════════
   ENGINE METRICS SUMMARY IN CHAT
   ══════════════════════════════════════════════════════════ */
.engine-metrics-card {
  background: linear-gradient(135deg, rgba(0,212,255,.06) 0%, rgba(124,58,237,.06) 100%);
  border: 1px solid rgba(0,212,255,.14);
  border-radius: 12px; padding: 14px 16px; margin-top: 10px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.engine-metric-cell {
  display: flex; flex-direction: column; gap: 3px;
  align-items: center; text-align: center;
}
.engine-metric-cell .emc-val {
  font-size: 17px; font-weight: 700; color: var(--cyan2);
  font-family: 'JetBrains Mono', monospace;
}
.engine-metric-cell .emc-label {
  font-size: 10px; font-weight: 600; color: var(--text3);
  text-transform: uppercase; letter-spacing: .06em;
}

/* ══════════════════════════════════════════════════════════
   PART SEARCH IN ASSEMBLY TREE
   ══════════════════════════════════════════════════════════ */
#asm-part-search {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text); font-size: 12.5px;
  padding: 7px 12px 7px 30px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
#asm-part-search:focus {
  border-color: rgba(0,212,255,.35);
  box-shadow: 0 0 0 2px rgba(0,212,255,.12);
}
.asm-search-wrap {
  position: relative; padding: 8px 10px 4px;
}
.asm-search-wrap::before {
  content: '🔍'; position: absolute; left: 20px; top: 50%; transform: translateY(-4px);
  font-size: 11px; opacity: .5; pointer-events: none;
}
.bom-row.bom-filtered { display: none; }

/* ══════════════════════════════════════════════════════════
   PROGRESS BAR DURING ASSEMBLY BUILD
   ══════════════════════════════════════════════════════════ */
#assembly-build-progress {
  position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: rgba(0,212,255,.12); overflow: hidden; z-index: 10;
  border-radius: 0 0 0 0;
}
#assembly-build-progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--violet2) 100%);
  transition: width .35s ease;
  box-shadow: 0 0 8px rgba(0,212,255,.6);
}
#viewport-panel { position: relative; }

/* ══════════════════════════════════════════════════════════
   QA PANEL: CRITICAL FINDINGS LIST STYLING
   ══════════════════════════════════════════════════════════ */
.qa-finding-critical {
  color: var(--red); font-weight: 600;
}
.qa-finding-warning {
  color: var(--amber);
}
.qa-item .qa-item-value.pass-text {
  color: var(--green2); font-weight: 600;
}
.qa-item.qa-item-warn {
  background: rgba(250,204,21,.05);
  border-left: 2px solid #facc15;
}

/* ══════════════════════════════════════════════════════════
   ASSEMBLY TREE: PART TYPE BADGES
   ══════════════════════════════════════════════════════════ */
.tree-part-badge {
  display: inline-block;
  padding: 1px 6px; border-radius: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; margin-left: auto; flex-shrink: 0;
  opacity: .75;
}
.tree-part-badge.mechanical  { background: rgba(37,99,235,.25); color: #93c5fd; }
.tree-part-badge.fastener    { background: rgba(107,114,128,.25); color: #d1d5db; }
.tree-part-badge.sealing     { background: rgba(217,119,6,.25); color: #fcd34d; }
.tree-part-badge.fluid       { background: rgba(8,145,178,.25); color: #67e8f9; }
.tree-part-badge.electrical  { background: rgba(124,58,237,.25); color: #c4b5fd; }

/* ══════════════════════════════════════════════════════════
   TOPBAR: BOM + SHORTCUTS BUTTONS
   ══════════════════════════════════════════════════════════ */
#btn-export-bom-csv {
  background: rgba(16,185,129,.1);
  border-color: rgba(16,185,129,.2);
  color: var(--green2);
}
#btn-export-bom-csv:hover {
  background: rgba(16,185,129,.22);
  box-shadow: 0 0 14px rgba(16,185,129,.25);
}
#btn-shortcuts {
  font-size: 16px;
  padding: 0 10px;
}
#btn-shortcuts:hover {
  background: rgba(0,212,255,.12);
  color: var(--cyan2);
}

/* ══════════════════════════════════════════════════════════
   ASSEMBLY BUILD: PART ADDED FLASH ANIMATION
   ══════════════════════════════════════════════════════════ */
@keyframes partAdded {
  0%   { background: rgba(0,212,255,.18); }
  100% { background: transparent; }
}
.bom-row.part-just-added {
  animation: partAdded .7s ease forwards;
}

/* ══════════════════════════════════════════════════════════
   PART PROPERTIES PANEL ENHANCEMENT
   ══════════════════════════════════════════════════════════ */
.prop-section { margin-bottom: 12px; }
.prop-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3); margin-bottom: 6px;
}
.prop-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 12px;
}
.prop-key { color: var(--text3); min-width: 80px; flex-shrink: 0; }
.prop-val { color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 11.5px; word-break: break-word; }
.prop-notes {
  margin-top: 8px; padding: 8px; border-radius: 6px;
  background: rgba(255,255,255,.04); font-size: 11.5px;
  color: var(--text2); line-height: 1.5;
  border-left: 2px solid rgba(0,212,255,.3);
}

/* ══════════════════════════════════════════════════════════
   BENCH READOUT ENHANCEMENT
   ══════════════════════════════════════════════════════════ */
.bench-live-indicator {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--green2);
  box-shadow: 0 0 6px var(--green2);
  animation: pulseDot .8s ease infinite;
  margin-right: 4px;
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TREE SEARCH  ─  v5.1 additions
   ═══════════════════════════════════════════════════════════════════════════ */
.tree-search-wrap {
  padding: 6px 8px 4px;
  border-bottom: 1px solid #1a2233;
  background: #0a0f18;
  position: sticky;
  top: 0;
  z-index: 2;
}
#tree-part-search {
  width: 100%;
  box-sizing: border-box;
  background: #0f1620;
  border: 1px solid #2a3a4a;
  border-radius: 5px;
  color: #c8d8e8;
  font-size: 11px;
  padding: 4px 8px;
  outline: none;
  transition: border-color .15s;
}
#tree-part-search:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88,166,255,.15);
}
#tree-part-search::placeholder { color: #3a5060; }
.tree-item.tree-filtered { display: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   POWER CURVE SVG  ─  displayed inline in chat and engine metrics card
   ═══════════════════════════════════════════════════════════════════════════ */
.power-curve-svg {
  display: block;
  margin: 8px 0 4px;
  border-radius: 4px;
  border: 1px solid #1a2838;
  max-width: 100%;
}
.engine-metrics-card .power-curve-svg {
  margin-top: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEA / THERMAL / SIMULATION REPORT CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.fea-report {
  background: #0b1520;
  border: 1px solid #1e3050;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 6px 0;
  font-size: 11.5px;
}
.fea-report-header {
  font-size: 13px;
  font-weight: 700;
  color: #c8ddf0;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.fea-icon { font-size: 16px; }
.fea-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.fea-stat {
  background: #101c2c;
  border: 1px solid #1e3050;
  border-radius: 4px;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
}
.fea-stat span { font-size: 14px; font-weight: 700; color: #e0eaff; }
.fea-stat small { font-size: 9px; color: #4a6a8a; margin-top: 1px; }
.fea-stat.pass span { color: #4ade80; }
.fea-stat.fail span { color: #f87171; }
.fea-stat.warn span { color: #facc15; }
.fea-table-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #4a6a8a;
  margin: 8px 0 4px;
  border-bottom: 1px solid #1a2838;
  padding-bottom: 3px;
}
.fea-table { display: flex; flex-direction: column; gap: 2px; }
.fea-row {
  display: grid;
  grid-template-columns: 1fr 90px 70px 1fr;
  gap: 4px;
  align-items: center;
  padding: 3px 4px;
  border-radius: 3px;
  background: #0d1825;
  font-size: 10.5px;
}
.fea-row:hover { background: #111e30; }
.fea-name { color: #a8c0d8; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fea-vm { color: #7090b0; font-variant-numeric: tabular-nums; }
.fea-sf { font-weight: 700; font-variant-numeric: tabular-nums; }
.fea-mat { color: #4a6a8a; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fea-val-wide { color: #a8c0d8; font-variant-numeric: tabular-nums; grid-column: span 3; }
.fea-ok {
  color: #4ade80;
  font-size: 11px;
  padding: 6px 4px;
  font-weight: 500;
}
.fea-notes {
  font-size: 9.5px;
  color: #3a5a70;
  margin-top: 8px;
  border-top: 1px solid #1a2838;
  padding-top: 6px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ENGINE METRICS CARD  ─  12-cell grid + sub-text support
   ═══════════════════════════════════════════════════════════════════════════ */
.engine-metrics-card {
  grid-template-columns: repeat(4, 1fr);
}
.emc-sub {
  font-size: 10px; color: var(--text3); font-weight: 400;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOLERANCE STACK-UP CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.tol-chain {
  background: rgba(255,255,255,.03); border: 1px solid #1e2d40;
  border-radius: 6px; padding: 8px 12px; margin: 6px 0;
}
.tol-chain-name { font-size: 12px; font-weight: 600; color: #a0b8d0; margin-bottom: 6px; }
.tol-target { font-size: 10px; color: #4ade80; margin-left: 8px; }
.tol-chain-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 6px;
}
.tol-cell { text-align: center; }
.tol-cell span { font-size: 9px; color: var(--text3); display: block; text-transform: uppercase; }
.tol-cell strong { font-size: 12px; font-family: 'JetBrains Mono', monospace; color: var(--cyan2); }
.tol-parts { font-size: 10px; color: #4a5a6a; }

/* ═══════════════════════════════════════════════════════════════════════════
   MASS PROPERTIES REPORT
   ═══════════════════════════════════════════════════════════════════════════ */
.mass-prop-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0;
}
.mass-cell { text-align: center; }
.mass-cell span { font-size: 9px; color: var(--text3); display: block; text-transform: uppercase; }
.mass-cell strong { font-size: 13px; font-family: 'JetBrains Mono', monospace; color: var(--cyan2); }
.mass-breakdown-title { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin: 8px 0 4px; }
.mass-breakdown { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.mass-bar-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.mass-bar-row span { width: 80px; color: var(--text2); font-size: 10px; }
.mass-bar-row strong { color: var(--cyan2); font-size: 11px; min-width: 48px; text-align: right; }
.mass-bar { flex: 1; background: #0d1824; border-radius: 3px; height: 6px; overflow: hidden; }
.mass-bar-fill { height: 100%; background: linear-gradient(90deg, #1e6a8a, #58a6ff); border-radius: 3px; min-width: 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   MATERIAL CERTIFICATION CARDS
   ═══════════════════════════════════════════════════════════════════════════ */
.mat-cert-card {
  background: rgba(255,255,255,.03); border: 1px solid #1e2d40;
  border-radius: 6px; padding: 8px 12px; margin: 6px 0;
}
.mat-cert-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.mat-cert-name { font-size: 13px; font-weight: 700; color: #a0c0e0; }
.mat-cert-count { font-size: 10px; color: var(--text3); }
.mat-cert-props { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0; font-size: 10px; color: var(--text3); }
.mat-cert-props b { color: var(--cyan2); }
.mat-cert-std { font-size: 11px; color: #6a8aaa; margin: 2px 0; }
.mat-cert-label { font-weight: 600; color: #4a8a9a; }
.mat-cert-inspect { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.mat-cert-chip { font-size: 10px; background: rgba(74,222,128,.08); color: #4ade80; border: 1px solid rgba(74,222,128,.2); border-radius: 4px; padding: 1px 6px; }
.mat-cert-notes { font-size: 10px; color: var(--text3); font-style: italic; margin-top: 4px; }

/* ═══════════════════════════════════════════════════════════════════════════
   FASTENER AUDIT TABLE
   ═══════════════════════════════════════════════════════════════════════════ */
.fastener-tty-warn {
  background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.25);
  border-radius: 6px; padding: 6px 10px; font-size: 11px; color: #f87171; margin: 6px 0;
}
.tty-badge { background: rgba(248,113,113,.2); color: #fca5a5; font-size: 9px; border-radius: 3px; padding: 1px 4px; margin-left: 4px; font-weight: 700; }
.fastener-table { margin: 8px 0; border-collapse: collapse; width: 100%; }
.fastener-table-header, .fastener-row { display: grid; grid-template-columns: 2fr .6fr .8fr .8fr; gap: 6px; padding: 4px 6px; font-size: 11px; }
.fastener-table-header { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid #1e2d40; }
.fastener-row { border-bottom: 1px solid rgba(255,255,255,.04); }
.fastener-row:hover { background: rgba(255,255,255,.03); }
.fastener-name { color: #a0b8d0; }
.fastener-qty { color: #5a8aaa; text-align: center; }
.fastener-torque { font-family: 'JetBrains Mono', monospace; font-size: 11px; text-align: right; }
.fastener-std { color: #4a6a7a; font-size: 10px; }
.fastener-note { font-size: 10px; color: #3a5a6a; padding: 1px 6px 5px 10px; font-style: italic; }
.fastener-high { color: #f87171; }
.fastener-mid  { color: #facc15; }
.fastener-low  { color: #4ade80; }

/* ═══════════════════════════════════════════════════════════════════════════
   NETLIST REPORT
   ═══════════════════════════════════════════════════════════════════════════ */
.net-section-title { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 4px; }
.net-conn-list { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.net-conn-chip { font-size: 10px; background: rgba(88,166,255,.08); color: #58a6ff; border: 1px solid rgba(88,166,255,.2); border-radius: 4px; padding: 2px 7px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SERVICE INTERVAL TABLE
   ═══════════════════════════════════════════════════════════════════════════ */
.svc-spec-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.svc-spec-row span { font-size: 11px; background: rgba(0,212,255,.07); color: var(--cyan2); border: 1px solid rgba(0,212,255,.15); border-radius: 4px; padding: 2px 8px; }
.svc-table { margin: 8px 0; width: 100%; }
.svc-table-header { display: grid; grid-template-columns: 1.6fr 1fr 2fr; gap: 6px; padding: 4px 6px; font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid #1e2d40; }
.svc-row { display: grid; grid-template-columns: 1.6fr 1fr 2fr; gap: 6px; padding: 5px 6px; border-bottom: 1px solid rgba(255,255,255,.04); font-size: 11px; }
.svc-row:hover { background: rgba(255,255,255,.025); }
.svc-item { font-weight: 600; color: #a0b8d0; }
.svc-interval { font-family: 'JetBrains Mono', monospace; color: var(--cyan2); font-size: 10px; }
.svc-notes { font-size: 10px; color: #5a7a8a; }
.svc-frequent { background: rgba(248,113,113,.04); }
.svc-rare { background: rgba(74,222,128,.03); }

/* ═══════════════════════════════════════════════════════════════════════════
   BOM MODULE BREAKDOWN  ─  compact category chip strip
   ═══════════════════════════════════════════════════════════════════════════ */
.bom-module-breakdown {
  font-size: 10px;
  color: #4a6a8a;
  padding: 2px 10px 6px;
  letter-spacing: .02em;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MISCELLANEOUS POLISH  ─  v5.1
   ═══════════════════════════════════════════════════════════════════════════ */
/* Tree item hover transition */
.tree-item {
  transition: background .1s, border-left-color .1s;
}

/* BOM row highlight */
.bom-row:hover {
  background: rgba(30,48,80,.55) !important;
}

/* Part props panel slide-in */
.side-panel.right-panel {
  transition: transform .18s ease, opacity .18s ease;
}
.side-panel.right-panel.collapsed {
  transform: translateX(12px);
  opacity: 0;
  pointer-events: none;
}
.side-panel.right-panel:not(.collapsed) {
  transform: translateX(0);
  opacity: 1;
}

/* Score color gradient based on value */
#qa-score[data-score-hi] { color: #4ade80 !important; }
#qa-score[data-score-mid] { color: #facc15 !important; }
#qa-score[data-score-lo]  { color: #f87171 !important; }

/* Suggestion chip improvements */
.suggestion-chip {
  transition: background .12s, color .12s, box-shadow .12s;
}
.suggestion-chip:hover {
  box-shadow: 0 0 10px rgba(88,166,255,.25);
}

/* Module filter chips active state glow */
.mod-filter-chip.active {
  box-shadow: 0 0 8px rgba(88,166,255,.3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ASSEMBLY STATS CARD  ─  post-build summary
   ═══════════════════════════════════════════════════════════════════════════ */
.asm-stats-card {
  background: #0b1520;
  border: 1px solid #1e3050;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 11.5px;
}
.asm-stats-title {
  font-size: 12px;
  font-weight: 700;
  color: #7090b0;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 8px;
}
.asm-stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.asm-stat {
  background: #101c2c;
  border: 1px solid #1e3050;
  border-radius: 4px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.asm-stat span { font-size: 14px; font-weight: 700; color: #c8ddf0; }
.asm-stat small { font-size: 9px; color: #4a6a8a; }
.asm-stats-mats {
  font-size: 10px;
  color: #4a6a8a;
  margin-bottom: 6px;
  line-height: 1.5;
}
.asm-stats-mats strong { color: #6a8aaa; }
.asm-stats-mods {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.asm-stats-chip {
  background: #101c2c;
  border: 1px solid #1e3050;
  border-radius: 3px;
  padding: 2px 7px;
  font-size: 10px;
  color: #5a7a9a;
}
.asm-stats-chip strong { color: #a8c0d8; }

/* Feedback row */
.asm-feedback-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #1a2a3a;
  flex-wrap: wrap;
}
.asm-feedback-label {
  font-size: 10.5px;
  color: #4a6a8a;
  margin-right: 2px;
}
.fb-btn {
  background: #101c2c;
  border: 1px solid #1e3050;
  border-radius: 4px;
  color: #7090b0;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.fb-btn:hover:not(:disabled) {
  border-color: #00d4ff;
  color: #00d4ff;
  background: rgba(0,212,255,.06);
}
.fb-btn:disabled { opacity: .45; cursor: default; }
.fb-btn.fb-active { border-color: #00cc7a; color: #00cc7a; }
.fb-status {
  font-size: 10px;
  color: #4a8a6a;
  margin-left: 4px;
}

/* Learning badge */
.asm-learn-row {
  margin-top: 6px;
}
.learn-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  background: rgba(0,212,255,.04);
  border: 1px solid rgba(0,212,255,.12);
  border-radius: 4px;
  font-size: 10.5px;
  flex-wrap: wrap;
}
.learn-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 5px currentColor;
}
.learn-badge-label { color: #4a6a8a; }
.learn-badge-stage { font-weight: 600; text-transform: capitalize; }
.learn-badge-score { color: #c8ddf0; font-weight: 700; }
.learn-badge-trend { font-size: 9.5px; color: #7090b0; }
.learn-badge-samples { color: #3a5a7a; font-size: 10px; margin-left: auto; }
/* ----------------------------------------------------------------------------
   UARE SPACECRAFT HUD � v3 Visual System
   Pilot controls aesthetic: angular chrome, neon readouts, targeting reticles,
   instrument cluster sim bar, amber warning lights, scanline texture.
   ---------------------------------------------------------------------------- */

:root {
  --hud-amber:    #e0a64a;
  --hud-amber2:   #ffd99c;
  --hud-red:      #ff3c5a;
  --hud-green:    #00ff9f;
  --hud-blue:     #f0be67;
  --hud-chrome:   rgba(255,214,150,0.08);
  --hud-scan:     repeating-linear-gradient(0deg,transparent,transparent 2px,rgba(240,190,103,0.02) 2px,rgba(240,190,103,0.02) 4px);
  --hud-border:   rgba(240,190,103,0.24);
  --hud-r:        3px;
  --chamfer:      polygon(8px 0%,100% 0%,100% calc(100% - 8px),calc(100% - 8px) 100%,0% 100%,0% 8px);
  --chamfer-sm:   polygon(5px 0%,100% 0%,100% calc(100% - 5px),calc(100% - 5px) 100%,0% 100%,0% 5px);
}

/* -- Scanline overlay on the whole app -------------------------------------- */
#app-shell::after {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: var(--hud-scan);
  opacity: 0.45;
}

/* -- Topbar � instrument cluster ------------------------------------------- */
#topbar {
  background: linear-gradient(180deg,rgba(4,8,18,1) 0%,rgba(6,10,22,0.99) 100%);
  border-bottom: 1px solid var(--hud-border);
  box-shadow: 0 0 0 1px rgba(0,212,255,0.05), 0 2px 24px rgba(0,0,0,0.7),
              inset 0 1px 0 rgba(0,212,255,0.1);
}
.brand-mark {
  background: transparent;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,184,77,0.42), 0 0 28px rgba(255,153,0,0.36), 0 0 60px rgba(255,153,0,0.16);
  clip-path: none;
}

/* -- HUD Status light cluster ----------------------------------------------- */
#hud-status-lights {
  display: flex; align-items: center; gap: 10px; margin-right: 4px;
}
.hud-light-group { display: flex; align-items: center; gap: 5px; }
.hud-light {
  width: 7px; height: 7px; border-radius: 50%;
  position: relative;
  box-shadow: 0 0 6px currentColor;
}
.hud-light.green  { color: var(--hud-green);  background: var(--hud-green); }
.hud-light.amber  { color: var(--hud-amber);  background: var(--hud-amber); animation: hud-blink 2.4s ease-in-out infinite; }
.hud-light.red    { color: var(--hud-red);    background: var(--hud-red);   animation: hud-blink 0.9s ease-in-out infinite; }
.hud-light.blue   { color: var(--hud-blue);   background: var(--hud-blue);  animation: hud-blink 3.8s ease-in-out infinite; }
.hud-light.off    { color: rgba(60,80,100,0.5); background: rgba(40,50,70,0.6); box-shadow: none; }
.hud-light-lbl { font-size: 9px; color: rgba(100,150,200,0.5); letter-spacing: 0.12em; font-family: 'JetBrains Mono', monospace; text-transform: uppercase; }
@keyframes hud-blink { 0%,100%{opacity:1} 50%{opacity:0.28} }
.hud-sep { width:1px; height:22px; background:rgba(0,212,255,0.1); margin:0 4px; }

/* -- tb-btn spacecraft style ----------------------------------------------- */
.tb-btn {
  clip-path: var(--chamfer-sm);
  border: 1px solid rgba(0,212,255,0.15);
  background: linear-gradient(180deg,rgba(15,25,50,0.95) 0%,rgba(8,14,32,0.98) 100%);
  color: rgba(160,200,240,0.85);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.04em;
  transition: all 0.14s ease;
}
.tb-btn:hover {
  background: linear-gradient(180deg,rgba(0,212,255,0.12) 0%,rgba(0,140,200,0.06) 100%);
  border-color: rgba(0,212,255,0.45);
  color: #e8f8ff;
  box-shadow: 0 0 12px rgba(0,212,255,0.2), inset 0 0 8px rgba(0,212,255,0.05);
}
.tb-btn.accent {
  background: linear-gradient(135deg,rgba(0,212,255,0.22) 0%,rgba(124,58,237,0.22) 100%);
  border-color: rgba(0,212,255,0.45);
  color: #00d4ff;
  box-shadow: 0 0 18px rgba(0,212,255,0.22), inset 0 0 12px rgba(0,212,255,0.06);
}
.tb-btn.accent:hover {
  background: linear-gradient(135deg,rgba(0,212,255,0.35) 0%,rgba(124,58,237,0.32) 100%);
  box-shadow: 0 0 28px rgba(0,212,255,0.4), inset 0 0 16px rgba(0,212,255,0.1);
}
.hud-iterate-btn {
  background: linear-gradient(135deg,rgba(255,179,71,0.18) 0%,rgba(255,80,50,0.1) 100%) !important;
  border-color: rgba(255,179,71,0.4) !important;
  color: var(--hud-amber) !important;
  clip-path: var(--chamfer-sm);
  box-shadow: 0 0 14px rgba(255,179,71,0.2);
}
.hud-iterate-btn:hover {
  background: linear-gradient(135deg,rgba(255,179,71,0.3) 0%,rgba(255,80,50,0.2) 100%) !important;
  box-shadow: 0 0 24px rgba(255,179,71,0.38) !important;
}

/* -- Auto-Iterate button (global component) -------------------------------- */
.btn-auto-iterate {
  display: inline-flex; align-items: center;
  padding: 5px 13px;
  background: linear-gradient(135deg,rgba(255,179,71,0.15) 0%,rgba(255,60,90,0.1) 100%);
  border: 1px solid rgba(255,179,71,0.38);
  border-radius: 0;
  clip-path: var(--chamfer-sm);
  color: var(--hud-amber);
  font-size: 11.5px; font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.14s ease;
  box-shadow: 0 0 10px rgba(255,179,71,0.14), inset 0 0 6px rgba(255,179,71,0.04);
  white-space: nowrap;
}
.btn-auto-iterate:hover {
  background: linear-gradient(135deg,rgba(255,179,71,0.28) 0%,rgba(255,60,90,0.18) 100%);
  border-color: rgba(255,179,71,0.65);
  box-shadow: 0 0 20px rgba(255,179,71,0.35), inset 0 0 10px rgba(255,179,71,0.08);
  color: #ffd580;
}
.btn-auto-iterate:active { transform: scale(0.97); }
.btn-auto-iterate svg { filter: drop-shadow(0 0 4px var(--hud-amber)); }

/* -- Panel corner targeting reticles --------------------------------------- */
.side-panel::before,.side-panel::after,
#engineering-qa-panel::before,#engineering-qa-panel::after,
#derived-spec-panel::before,#derived-spec-panel::after {
  content: '';
  position: absolute; width: 12px; height: 12px;
  pointer-events: none; z-index: 10;
}
.side-panel::before,#engineering-qa-panel::before,#derived-spec-panel::before {
  top: 0; left: 0;
  border-top: 1px solid var(--hud-blue); border-left: 1px solid var(--hud-blue);
}
.side-panel::after,#engineering-qa-panel::after,#derived-spec-panel::after {
  top: 0; right: 0;
  border-top: 1px solid var(--hud-blue); border-right: 1px solid var(--hud-blue);
}

/* -- Chat panel HUD skin ---------------------------------------------------- */
#chat-panel {
  position: relative;
  isolation: isolate;
  background: linear-gradient(180deg,rgba(4,7,18,0.99) 0%,rgba(6,10,22,0.99) 100%);
  border-right: 1px solid rgba(0,212,255,0.09);
  background-image: var(--hud-scan), linear-gradient(180deg,rgba(4,7,18,0.99) 0%,rgba(6,10,22,0.99) 100%);
}
#chat-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  background-image: none;
}
#chat-panel > * {
  position: relative;
  z-index: 1;
}
#chat-head {
  background: linear-gradient(90deg,rgba(0,212,255,0.07) 0%,transparent 60%);
  border-bottom: 1px solid rgba(0,212,255,0.1);
}
.enki-name-lbl {
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em; text-transform: uppercase;
  font-size: 11.5px; font-weight: 700; color: #00d4ff;
  text-shadow: 0 0 12px rgba(0,212,255,0.6);
}
.enki-sub { font-size: 9.5px; letter-spacing: 0.08em; color: rgba(0,212,255,0.45); }
.enki-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--hud-green);
  box-shadow: 0 0 8px var(--hud-green), 0 0 16px rgba(0,255,159,0.3);
  animation: hud-blink 2.8s ease-in-out infinite;
}

/* -- Message styling ------------------------------------------------------- */
.msg-assistant .msg-body {
  background: linear-gradient(135deg,rgba(0,212,255,0.05) 0%,rgba(6,12,28,0.85) 100%);
  border: 1px solid rgba(0,212,255,0.1);
  border-radius: 0 8px 8px 8px;
  position: relative;
}
.msg-assistant .msg-body::before {
  content: ''; position: absolute; top: 8px; left: -1px;
  width: 3px; height: 22px;
  background: linear-gradient(180deg,var(--hud-blue),transparent);
  border-radius: 0 2px 2px 0;
}
.msg-user .msg-body {
  background: linear-gradient(135deg,rgba(124,58,237,0.12) 0%,rgba(8,12,28,0.85) 100%);
  border: 1px solid rgba(124,58,237,0.15);
}

/* -- Send button ----------------------------------------------------------- */
#send-btn {
  clip-path: var(--chamfer-sm);
  background: linear-gradient(135deg,rgba(0,212,255,0.22) 0%,rgba(124,58,237,0.18) 100%);
  border: 1px solid rgba(0,212,255,0.38);
  box-shadow: 0 0 16px rgba(0,212,255,0.2);
  color: #00d4ff;
}
#send-btn:hover {
  background: linear-gradient(135deg,rgba(0,212,255,0.35) 0%,rgba(124,58,237,0.28) 100%);
  box-shadow: 0 0 28px rgba(0,212,255,0.4);
}

/* -- Chat input ------------------------------------------------------------ */
#chat-input {
  background: rgba(4,8,20,0.98);
  border: 1px solid rgba(0,212,255,0.1);
  border-radius: 6px;
  color: rgba(180,215,255,0.9);
  font-family: 'Inter', monospace;
  caret-color: var(--hud-blue);
}
#chat-input:focus {
  border-color: rgba(0,212,255,0.35);
  box-shadow: 0 0 0 2px rgba(0,212,255,0.08), 0 0 20px rgba(0,212,255,0.07);
  outline: none;
}

/* -- Viewport panel HUD ---------------------------------------------------- */
#viewport-panel { position: relative; }
#cad-canvas { display: block; width: 100%; height: 100%; }

/* Corner targeting brackets on the 3D viewport */
#viewport-panel::before,#viewport-panel::after {
  content: ''; position: absolute; width: 20px; height: 20px;
  pointer-events: none; z-index: 50;
}
#viewport-panel::before { top: 60px; left: 0; border-top: 2px solid rgba(0,212,255,0.22); border-left: 2px solid rgba(0,212,255,0.22); }
#viewport-panel::after  { top: 60px; right: 0; border-top: 2px solid rgba(0,212,255,0.22); border-right: 2px solid rgba(0,212,255,0.22); }

/* -- Viewport controls � angular pilot dashboard --------------------------- */
#vp-controls {
  background: linear-gradient(180deg,rgba(3,6,16,0.97) 0%,rgba(5,9,22,0.96) 100%);
  border-bottom: 1px solid rgba(0,212,255,0.09);
  gap: 4px; flex-wrap: wrap;
  box-shadow: 0 2px 16px rgba(0,0,0,0.5), inset 0 -1px 0 rgba(0,212,255,0.05);
}
.vp-btn {
  clip-path: var(--chamfer-sm);
  background: linear-gradient(180deg,rgba(10,18,38,0.95) 0%,rgba(6,12,28,0.98) 100%);
  border: 1px solid rgba(0,212,255,0.12);
  color: rgba(120,170,220,0.75);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.05em;
  padding: 3px 9px; height: 26px;
  transition: all 0.12s ease;
}
.vp-btn:hover {
  background: linear-gradient(180deg,rgba(0,212,255,0.1) 0%,rgba(0,140,200,0.04) 100%);
  border-color: rgba(0,212,255,0.4);
  color: #c8e8ff;
  box-shadow: 0 0 10px rgba(0,212,255,0.16);
}
.vp-btn.active {
  background: linear-gradient(180deg,rgba(0,212,255,0.18) 0%,rgba(0,140,200,0.1) 100%);
  border-color: rgba(0,212,255,0.55);
  color: var(--hud-blue);
  box-shadow: 0 0 14px rgba(0,212,255,0.25), inset 0 0 8px rgba(0,212,255,0.06);
}
.vp-btn-group { display: flex; gap: 2px; align-items: center; }
.explode-btn {
  background: linear-gradient(135deg,rgba(124,58,237,0.2) 0%,rgba(80,20,200,0.12) 100%) !important;
  border-color: rgba(124,58,237,0.4) !important;
  color: #a78bfa !important;
}

/* -- Coord HUD -------------------------------------------------------------- */
#coord-hud {
  background: rgba(3,6,16,0.96);
  border: 1px solid rgba(0,212,255,0.12);
  border-radius: 0;
  clip-path: var(--chamfer-sm);
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: rgba(0,212,255,0.55); letter-spacing: 0.08em;
  box-shadow: 0 0 12px rgba(0,0,0,0.6);
}
#coord-hud span { color: rgba(0,212,255,0.7); }

/* -- Action overlay � launch sequence feel --------------------------------- */
#action-overlay {
  background: radial-gradient(ellipse at 50% 30%, rgba(0,212,255,0.08) 0%, rgba(3,6,18,0.97) 70%);
  border: 1px solid rgba(0,212,255,0.15);
  backdrop-filter: blur(8px);
}
.action-ring {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--hud-blue);
  border-right-color: rgba(0,212,255,0.3);
  animation: spin 0.9s linear infinite;
  box-shadow: 0 0 20px rgba(0,212,255,0.3);
}
@keyframes spin { to { transform: rotate(360deg); } }
#action-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.08em; color: var(--hud-blue);
  text-shadow: 0 0 12px rgba(0,212,255,0.6);
}
#action-progress-bar {
  width: 240px; height: 3px; background: rgba(0,212,255,0.1);
  border-radius: 2px; overflow: hidden;
}
#action-progress-fill {
  height: 100%; background: linear-gradient(90deg,var(--hud-blue),rgba(124,58,237,0.8));
  transition: width 0.5s ease;
  box-shadow: 0 0 8px var(--hud-blue);
}

/* -- Engineering QA Panel � warning board ---------------------------------- */
#engineering-qa-panel {
  background: linear-gradient(180deg,rgba(4,8,20,0.99) 0%,rgba(6,10,24,0.98) 100%);
  border-top: 1px solid rgba(0,212,255,0.1);
  border-left: none; border-right: none;
}
.qa-head {
  background: linear-gradient(90deg,rgba(0,212,255,0.07) 0%,transparent 70%);
  border-bottom: 1px solid rgba(0,212,255,0.08);
}
.qa-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(0,212,255,0.65);
  text-shadow: 0 0 8px rgba(0,212,255,0.3);
}
.qa-score {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700;
}
.qa-score[data-score-hi] { color: var(--hud-green); text-shadow: 0 0 10px rgba(0,255,159,0.5); }
.qa-score[data-score-mid] { color: var(--hud-amber); text-shadow: 0 0 10px rgba(255,179,71,0.5); }
.qa-score[data-score-lo]  { color: var(--hud-red); text-shadow: 0 0 10px rgba(255,60,90,0.5); animation: hud-blink 1.2s ease-in-out infinite; }
.qa-grade-badge {
  clip-path: var(--chamfer-sm); padding: 2px 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.1em;
}
.qa-grade-badge.pass { background: rgba(0,255,159,0.12); border: 1px solid rgba(0,255,159,0.35); color: var(--hud-green); }
.qa-grade-badge.fail { background: rgba(255,60,90,0.12); border: 1px solid rgba(255,60,90,0.35); color: var(--hud-red); }
.qa-grade-badge.provisional { background: rgba(255,179,71,0.12); border: 1px solid rgba(255,179,71,0.35); color: var(--hud-amber); }
.qa-toggle {
  clip-path: var(--chamfer-sm);
  background: rgba(0,212,255,0.07); border: 1px solid rgba(0,212,255,0.2);
  color: rgba(0,212,255,0.65); font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.08em; padding: 2px 9px;
}
.qa-metric span { color: rgba(100,140,180,0.65); font-size: 10px; letter-spacing: 0.05em; }
.qa-metric strong { font-family: 'JetBrains Mono', monospace; }
.qa-metric strong.pass { color: var(--hud-green); text-shadow: 0 0 6px rgba(0,255,159,0.4); }
.qa-metric strong.fail { color: var(--hud-red); text-shadow: 0 0 6px rgba(255,60,90,0.4); }
.qa-section-title {
  font-family: 'JetBrains Mono', monospace; font-size: 9.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(0,212,255,0.4);
  border-bottom: 1px solid rgba(0,212,255,0.06);
  padding-bottom: 4px; margin-bottom: 4px;
}
.qa-item { border-bottom: 1px solid rgba(0,212,255,0.04); font-size: 11px; }
.qa-item-warn { background: rgba(255,60,90,0.04); border-left: 2px solid rgba(255,60,90,0.35); }

/* -- Side panels (part-props, asm-tree) ------------------------------------ */
.side-panel {
  background: linear-gradient(180deg,rgba(4,7,18,0.99) 0%,rgba(5,9,22,0.99) 100%);
  border-right: 1px solid rgba(0,212,255,0.08);
  /* position kept as absolute from base rule — do NOT override */
}
.right-panel { border-right: none; border-left: 1px solid rgba(0,212,255,0.08); }
.side-panel-head {
  background: linear-gradient(90deg,rgba(0,212,255,0.07) 0%,transparent 70%);
  border-bottom: 1px solid rgba(0,212,255,0.1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(0,212,255,0.6);
}
.props-section-title {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(0,212,255,0.38); padding: 4px 0 3px;
  border-bottom: 1px solid rgba(0,212,255,0.06);
}
.prop-label { color: rgba(100,140,180,0.6); font-size: 10px; letter-spacing: 0.04em; }
.prop-val { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: rgba(190,220,255,0.85); }

/* -- Sim bar � cockpit instrument cluster ---------------------------------- */
#sim-bar {
  background: linear-gradient(180deg,rgba(4,7,16,0.99) 0%,rgba(3,5,14,1) 100%);
  border-top: 1px solid rgba(0,212,255,0.12);
  box-shadow: 0 -1px 0 rgba(0,0,0,0.8), inset 0 1px 0 rgba(0,212,255,0.07),
              0 -4px 24px rgba(0,0,0,0.6);
  background-image: var(--hud-scan), linear-gradient(180deg,rgba(4,7,16,0.99) 0%,rgba(3,5,14,1) 100%);
}
.sim-btn {
  clip-path: var(--chamfer-sm);
  background: linear-gradient(180deg,rgba(10,18,40,0.95) 0%,rgba(6,10,28,0.98) 100%);
  border: 1px solid rgba(0,212,255,0.12);
  color: rgba(120,170,220,0.8);
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.03em;
  padding: 4px 12px;
  transition: all 0.13s ease;
}
.sim-btn:hover:not(:disabled) {
  background: linear-gradient(180deg,rgba(0,212,255,0.12) 0%,rgba(0,140,200,0.05) 100%);
  border-color: rgba(0,212,255,0.42);
  color: #c8e8ff;
  box-shadow: 0 0 14px rgba(0,212,255,0.2);
}
.sim-btn.primary {
  background: linear-gradient(135deg,rgba(0,212,255,0.18) 0%,rgba(0,100,180,0.12) 100%);
  border-color: rgba(0,212,255,0.4);
  color: var(--hud-blue);
  box-shadow: 0 0 16px rgba(0,212,255,0.2);
}
.sim-btn.accent {
  background: linear-gradient(135deg,rgba(0,212,255,0.12) 0%,rgba(124,58,237,0.12) 100%);
  border-color: rgba(0,212,255,0.3);
  color: rgba(160,220,255,0.9);
}
.sim-badge {
  font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.1em;
  padding: 3px 9px;
  clip-path: var(--chamfer-sm);
}
.sim-badge.idle  { background: rgba(40,50,70,0.8); color: rgba(100,140,170,0.65); border: 1px solid rgba(0,212,255,0.08); }
.sim-badge.running { background: rgba(0,255,159,0.1); color: var(--hud-green); border: 1px solid rgba(0,255,159,0.3); animation: hud-blink 1.4s ease-in-out infinite; }
.sim-badge.error { background: rgba(255,60,90,0.1); color: var(--hud-red); border: 1px solid rgba(255,60,90,0.3); }

/* -- Metrics panel � instrument gauges ------------------------------------- */
#sim-metrics {
  display: flex; gap: 1px; align-items: stretch;
  border-left: 1px solid rgba(0,212,255,0.08);
  padding-left: 12px;
}
.metric {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 10px;
  border-right: 1px solid rgba(0,212,255,0.06);
}
.m-label {
  font-size: 8.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(0,212,255,0.35); font-family: 'JetBrains Mono', monospace;
}
.m-val {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700;
  color: rgba(0,212,255,0.8); letter-spacing: 0.02em;
  text-shadow: 0 0 8px rgba(0,212,255,0.3);
}

/* -- Assembly tree items --------------------------------------------------- */
.tree-item {
  font-size: 11px; padding: 3px 8px; border-radius: 0;
  border-left: 2px solid transparent;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(140,180,220,0.75);
  cursor: pointer; transition: all 0.1s;
}
.tree-item:hover { background: rgba(0,212,255,0.05); border-left-color: rgba(0,212,255,0.3); color: #c8e8ff; }
.tree-item.selected { background: rgba(0,212,255,0.08); border-left-color: var(--hud-blue); color: var(--hud-blue); }
.tree-item-icon { opacity: 0.65; margin-right: 5px; }

/* -- Suggestions row ------------------------------------------------------- */
#suggestions-row { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 12px 2px; }
.suggestion-chip {
  clip-path: var(--chamfer-sm);
  background: rgba(0,212,255,0.06); border: 1px solid rgba(0,212,255,0.15);
  color: rgba(0,212,255,0.7); font-size: 10.5px;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em;
  padding: 3px 10px; cursor: pointer;
  transition: all 0.12s;
}
.suggestion-chip:hover {
  background: rgba(0,212,255,0.12); border-color: rgba(0,212,255,0.38);
  color: var(--hud-blue); box-shadow: 0 0 10px rgba(0,212,255,0.15);
}

/* -- Derived spec panel ---------------------------------------------------- */
#derived-spec-panel {
  background: linear-gradient(180deg,rgba(4,8,20,0.99) 0%,rgba(6,10,26,0.98) 100%);
  border: 1px solid rgba(0,212,255,0.1);
  border-radius: 0;
  position: relative;
}
.derived-spec-title {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase; color: rgba(0,212,255,0.65);
}
.derived-spec-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; padding: 8px; }

/* -- Modal ----------------------------------------------------------------- */
.modal-box {
  background: linear-gradient(180deg,rgba(4,8,20,0.99) 0%,rgba(6,10,26,0.99) 100%);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: 0; clip-path: polygon(12px 0%,100% 0%,100% calc(100% - 12px),calc(100% - 12px) 100%,0% 100%,0% 12px);
  box-shadow: 0 0 0 1px rgba(0,212,255,0.05), 0 32px 80px rgba(0,0,0,0.8), 0 0 60px rgba(0,212,255,0.07);
}
.modal-head {
  background: linear-gradient(90deg,rgba(0,212,255,0.07) 0%,transparent 70%);
  border-bottom: 1px solid rgba(0,212,255,0.1);
}
.modal-title {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase; color: rgba(0,212,255,0.7);
}
kbd {
  background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.2);
  border-radius: 0; clip-path: var(--chamfer-sm);
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  padding: 1px 5px; color: rgba(0,212,255,0.75);
}
.sc-group-title {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase; color: rgba(0,212,255,0.38);
}

/* -- Empty state ----------------------------------------------------------- */
#viewport-empty .empty-icon {
  color: rgba(0,212,255,0.15); font-size: 48px;
  text-shadow: 0 0 30px rgba(0,212,255,0.2);
  animation: hud-blink 4s ease-in-out infinite;
}
#viewport-empty h3 { font-family: 'JetBrains Mono', monospace; letter-spacing: 0.08em; color: rgba(0,212,255,0.5); }
.empty-hint-chip {
  clip-path: var(--chamfer-sm);
  background: rgba(0,212,255,0.05); border: 1px solid rgba(0,212,255,0.12);
  color: rgba(0,212,255,0.55); font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.06em;
  padding: 3px 10px; cursor: pointer;
  transition: all 0.12s;
}
.empty-hint-chip:hover { background: rgba(0,212,255,0.1); border-color: rgba(0,212,255,0.35); color: var(--hud-blue); }

/* -- Split drag handle ----------------------------------------------------- */
#split-drag {
  width: 5px; background: rgba(0,212,255,0.04);
  border-left: 1px solid rgba(0,212,255,0.06);
  border-right: 1px solid rgba(0,212,255,0.06);
  cursor: col-resize; transition: background 0.15s;
}
#split-drag:hover { background: rgba(0,212,255,0.12); }

/* -- Gear mesh legend ------------------------------------------------------ */
#gear-mesh-legend {
  background: linear-gradient(180deg,rgba(4,8,20,0.99) 0%,rgba(5,9,22,0.98) 100%);
  border: 1px solid rgba(0,212,255,0.12);
}
.legend-title { font-family: 'JetBrains Mono', monospace; letter-spacing: 0.1em; font-size: 10px; text-transform: uppercase; color: rgba(0,212,255,0.6); }
.legend-chip { clip-path: var(--chamfer-sm); background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.25); color: rgba(0,212,255,0.75); font-family: 'JetBrains Mono', monospace; font-size: 9px; padding: 1px 6px; }
.legend-btn { clip-path: var(--chamfer-sm); background: rgba(0,212,255,0.07); border: 1px solid rgba(0,212,255,0.18); color: rgba(0,212,255,0.65); font-family: 'JetBrains Mono', monospace; font-size: 9.5px; padding: 2px 7px; cursor: pointer; }
.legend-eq { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: rgba(255,179,71,0.6); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 6px currentColor; }
.legend-pass { background: var(--hud-green); color: var(--hud-green); }
.legend-fail { background: var(--hud-red); color: var(--hud-red); }

/* -- Dropdown -------------------------------------------------------------- */
.tb-dropdown {
  background: linear-gradient(180deg,rgba(4,8,20,0.99) 0%,rgba(6,10,26,0.99) 100%);
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: 0;
  clip-path: polygon(0 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%);
}
.tb-dropdown-item {
  font-family: 'JetBrains Mono', monospace; font-size: 10.5px; letter-spacing: 0.04em;
  color: rgba(140,180,220,0.75);
}
.tb-dropdown-item:hover { background: rgba(0,212,255,0.07); color: rgba(180,220,255,0.95); }

/* -- Scrollbars ----------------------------------------------------------- */
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: rgba(3,6,16,0.9); }
*::-webkit-scrollbar-thumb { background: rgba(240,190,103,0.22); border-radius: 0; }
*::-webkit-scrollbar-thumb:hover { background: rgba(240,190,103,0.4); }

/* --------------------------------------------------------------------------
   CLEAN EDGE-DOCK VIEWER OVERRIDES
   Keep tools on the perimeter to preserve CAD visibility in the center.
   -------------------------------------------------------------------------- */

:root {
  --bg: #0f0904;
  --bg2: #1a1007;
  --panel: rgba(26, 16, 8, 0.96);
  --panel2: rgba(34, 20, 9, 0.98);
  --border: rgba(255, 204, 130, 0.24);
  --text: #f8ead3;
  --text2: #d9bc93;
  --text3: #8e6f43;
  --cyan: #c88b2a;
  --cyan2: #f0be67;
  --violet: #8a5a22;
  --violet2: #ffd892;
}

body {
  background:
    radial-gradient(120% 75% at 0% 0%, rgba(226,169,84,0.12), transparent 60%),
    radial-gradient(85% 60% at 100% 0%, rgba(162,106,37,0.12), transparent 55%),
    linear-gradient(180deg, #1a1007 0%, #0f0904 100%);
}

#topbar {
  border-bottom: 1px solid rgba(240, 190, 103, 0.22);
  background: linear-gradient(180deg, rgba(34, 20, 9, 0.98), rgba(26, 16, 8, 0.95));
}

.tb-btn {
  background: linear-gradient(180deg, rgba(255,225,174,0.08), rgba(125,82,26,0.08));
  border: 1px solid rgba(240, 190, 103, 0.26);
  color: var(--text2);
}

.tb-btn.active,
.tb-btn[aria-pressed="true"] {
  color: #f3faff;
  border-color: rgba(113, 216, 230, 0.55);
  background: linear-gradient(180deg, rgba(55,195,215,0.22), rgba(55,195,215,0.12));
  box-shadow: 0 0 0 1px rgba(113,216,230,0.25), 0 8px 18px rgba(3, 14, 26, 0.45);
}

#viewport-panel {
  background:
    radial-gradient(100% 75% at 50% 0%, rgba(113, 216, 230, 0.06), transparent 65%),
    radial-gradient(65% 70% at 20% 100%, rgba(63,110,164,0.07), transparent 70%),
    var(--bg2);
}

#vp-controls {
  position: absolute;
  inset: 10px;
  z-index: 45;
  pointer-events: none;
  background: none;
  border: none;
  box-shadow: none;
  gap: 0;
}

#vp-controls .vp-dock {
  position: absolute;
  pointer-events: auto;
}

.vp-dock-top-right { top: 0; right: 0; }
.vp-dock-top-left { top: 0; left: 0; }
.vp-dock-left-mid { top: 50%; left: 0; transform: translateY(-52%); }
.vp-dock-left-low { top: calc(50% + 128px); left: 0; }
.vp-dock-right-mid { top: 142px; right: 0; }
.vp-dock-right-mid-alt { top: 178px; right: 0; }
.vp-dock-right-mid-low { top: 214px; right: 0; }
.vp-dock-bottom-right { right: 0; bottom: 0; }
.vp-dock-bottom-right-alt { right: 0; bottom: 46px; }
.vp-dock-right-rail { top: 56px; right: 0; z-index: 2; }
.vp-dock-right-rail-panel { top: 92px; right: 0; z-index: 1; }

#vp-selection-controls,
#vp-preset-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#vp-edge-rail {
  width: min(244px, calc(100vw - 32px));
  max-height: calc(100vh - 210px);
  overflow-y: auto;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(166, 194, 222, 0.26);
  background: rgba(8, 14, 24, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(1, 6, 14, 0.46);
  transition: transform 0.18s ease, opacity 0.18s ease, visibility 0.18s ease;
}

#vp-edge-rail.is-collapsed {
  transform: translateX(calc(100% + 14px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#btn-edge-rail-toggle[aria-expanded="true"] {
  border-color: rgba(113, 216, 230, 0.62);
  background: linear-gradient(180deg, rgba(55,195,215,0.3), rgba(55,195,215,0.16));
  color: #ffffff;
}

.vp-rail-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

#vp-edge-rail #btn-gearbox-explode-mode,
#vp-edge-rail #btn-gear-mesh-legend-toggle,
#vp-edge-rail #btn-gearbox-explode-reset {
  margin-top: 6px;
}

#vp-camera-controls,
#vp-render-controls,
#vp-section-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.vp-btn {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid rgba(166, 194, 222, 0.26);
  background: rgba(9, 15, 24, 0.88);
  color: var(--text2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(1, 6, 14, 0.38);
  clip-path: none;
}

.vp-btn:hover {
  border-color: rgba(113, 216, 230, 0.58);
  color: #f2f9ff;
  background: rgba(17, 28, 42, 0.92);
  transform: translateY(-1px);
}

.vp-btn.active,
.vp-btn[aria-pressed="true"] {
  color: #fff4df;
  border-color: rgba(240, 190, 103, 0.62);
  background: linear-gradient(180deg, rgba(240,190,103,0.3), rgba(200,139,42,0.16));
  box-shadow: 0 0 0 1px rgba(113,216,230,0.24), 0 8px 20px rgba(8, 24, 38, 0.6);
}

#section-cut-slider {
  width: 118px;
}

.explode-btn {
  min-width: 96px;
}

#coord-hud {
  border-radius: 10px;
  clip-path: none;
  border: 1px solid rgba(166, 194, 222, 0.24);
  color: #b9ccde;
}

#sim-bar {
  border-top: 1px solid rgba(166, 194, 222, 0.16);
  background: linear-gradient(180deg, rgba(10, 16, 26, 0.98), rgba(7, 11, 20, 0.98));
}

.sim-btn.active,
.sim-btn[aria-pressed="true"] {
  border-color: rgba(113, 216, 230, 0.58);
  color: #f5fbff;
  background: linear-gradient(180deg, rgba(55,195,215,0.24), rgba(55,195,215,0.12));
}

@media (max-width: 900px) {
  #vp-controls {
    inset: 8px;
  }

  #vp-camera-controls,
  #vp-render-controls,
  #vp-section-controls {
    max-width: calc(100% - 16px);
  }

  .vp-dock-top-left {
    top: 42px;
    left: 0;
  }

  .vp-dock-right-rail { top: auto; right: 0; bottom: 138px; }
  .vp-dock-right-rail-panel { top: auto; right: 0; bottom: 172px; max-height: 44vh; }
}

/* ── Ecosystem Activity Rail ───────────────────────────────────────────── */
#ecosystem-activity-rail {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(166, 194, 222, 0.16);
  background:
    linear-gradient(120deg, rgba(13, 22, 34, 0.98), rgba(12, 17, 27, 0.98)),
    radial-gradient(circle at 20% 20%, rgba(113, 216, 230, 0.1), transparent 40%);
}

.eco-rail-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}

.eco-rail-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #9ac0d9;
  font-weight: 700;
}

.eco-rail-stage {
  border: 1px solid rgba(113, 216, 230, 0.36);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  color: #d9efff;
  background: rgba(28, 47, 68, 0.52);
}

.eco-rail-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.eco-rail-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  border: 1px solid rgba(166, 194, 222, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10.5px;
  color: #d2e6f7;
  background: rgba(26, 37, 53, 0.65);
  animation: ecoIn .22s ease;
}

.eco-rail-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #71d8e6;
  box-shadow: 0 0 10px rgba(113, 216, 230, 0.6);
}

.eco-rail-item.warn .dot {
  background: #f4b65f;
  box-shadow: 0 0 10px rgba(244, 182, 95, 0.6);
}

@keyframes ecoIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* ── Command Palette ───────────────────────────────────────────────────── */
.command-palette-box {
  width: min(680px, calc(100vw - 28px));
  max-height: min(520px, calc(100vh - 40px));
  border: 1px solid rgba(113, 216, 230, 0.28);
  background: linear-gradient(180deg, rgba(10, 16, 25, 0.98), rgba(9, 14, 22, 0.99));
}

.command-palette-body {
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 330px;
}

#command-palette-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(166, 194, 222, 0.24);
  background: rgba(18, 30, 44, 0.86);
  color: #e8f4ff;
  padding: 10px 12px;
  font-size: 13px;
}

#command-palette-input:focus {
  outline: none;
  border-color: rgba(113, 216, 230, 0.52);
  box-shadow: 0 0 0 2px rgba(113, 216, 230, 0.16);
}

.command-palette-list {
  overflow-y: auto;
  display: grid;
  gap: 8px;
}

.command-palette-item {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  border: 1px solid rgba(166, 194, 222, 0.22);
  background: rgba(23, 35, 50, 0.68);
  color: #dbefff;
  padding: 9px 10px;
}

.command-palette-item:hover,
.command-palette-item.active {
  border-color: rgba(113, 216, 230, 0.5);
  background: rgba(34, 57, 78, 0.72);
}

.cp-item-title {
  font-size: 12px;
  font-weight: 600;
}

.cp-item-desc {
  margin-top: 2px;
  font-size: 10px;
  color: #96b5cf;
}

/* ── Typography Refresh ────────────────────────────────────────────────── */
body,
button,
input,
textarea,
select {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
}

code,
pre,
kbd,
.chip,
.live-indicator,
.msg-bubble code,
.msg-bubble pre,
.prop-val,
.metric .m-val,
#coord-hud {
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Viewport Gizmo + Onboarding + Mobile Controls ─────────────────────── */
#vp-camera-gizmo {
  position: absolute;
  left: 14px;
  bottom: 72px;
  z-index: 44;
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(166, 194, 222, 0.26);
  background: rgba(8, 14, 24, 0.78);
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 22px rgba(1, 6, 14, 0.4);
}

.gizmo-row {
  display: flex;
  gap: 6px;
}

.gizmo-btn {
  min-width: 36px;
  height: 30px;
  border: 1px solid rgba(166, 194, 222, 0.3);
  border-radius: 8px;
  background: rgba(11, 20, 30, 0.9);
  color: #dbefff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.gizmo-btn:hover,
.gizmo-btn.active {
  border-color: rgba(113, 216, 230, 0.62);
  background: rgba(24, 41, 59, 0.92);
}

#vp-onboarding-overlay {
  position: absolute;
  inset: 12px;
  z-index: 46;
  display: grid;
  place-items: end start;
  pointer-events: none;
}

#vp-onboarding-overlay.hidden {
  display: none;
}

.vp-onboarding-card {
  width: min(360px, calc(100% - 8px));
  pointer-events: auto;
  border: 1px solid rgba(113, 216, 230, 0.32);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(10, 16, 25, 0.95), rgba(8, 14, 21, 0.96));
  padding: 12px;
  box-shadow: 0 12px 24px rgba(1, 8, 15, 0.52);
  animation: vpOnboardIn 220ms ease;
}

.vp-onboarding-step {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8fb3ce;
}

#vp-onboarding-title {
  margin: 6px 0;
  font-size: 15px;
  color: #eff8ff;
}

#vp-onboarding-copy {
  margin: 0;
  font-size: 12px;
  color: #b5cde0;
  line-height: 1.4;
}

.vp-onboarding-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes vpOnboardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

#vp-mobile-controls {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 45;
  display: none;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(166, 194, 222, 0.26);
  background: rgba(8, 14, 24, 0.82);
  backdrop-filter: blur(8px);
}

#vp-mobile-controls.hidden {
  display: none;
}

.mobile-vp-btn {
  min-height: 32px;
  border: 1px solid rgba(166, 194, 222, 0.3);
  border-radius: 8px;
  background: rgba(14, 23, 35, 0.9);
  color: #deefff;
  font-size: 11px;
  font-weight: 600;
}

.mobile-vp-btn:active,
.mobile-vp-btn:hover {
  border-color: rgba(113, 216, 230, 0.58);
}

@media (max-width: 900px) {
  #vp-camera-gizmo {
    left: 8px;
    bottom: 132px;
  }

  #vp-mobile-controls {
    display: grid;
  }

  .vp-dock-bottom-right-alt {
    bottom: 98px;
  }
}

/* --------------------------------------------------------------------------
   CHAT CLARITY + BUTTON RELIABILITY OVERRIDES
   -------------------------------------------------------------------------- */

#chat-panel {
  overflow: hidden;
}

#chat-msgs {
  padding: 10px 12px;
  gap: 10px;
  overscroll-behavior: contain;
}

.msg {
  max-width: 100%;
}

.msg-bubble {
  max-width: min(94%, 760px);
  overflow-wrap: anywhere;
}

.msg-assistant .msg-bubble.msg-collapsed {
  max-height: 180px;
  overflow: hidden;
  position: relative;
}

.msg-assistant .msg-bubble.msg-collapsed::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 14, 24, 0), rgba(8, 14, 24, 0.95));
}

.msg-toggle {
  margin-top: 6px;
  margin-left: 2px;
  border: 1px solid rgba(113, 216, 230, 0.35);
  background: rgba(17, 27, 41, 0.9);
  color: #bfe8ff;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  cursor: pointer;
}

.msg-toggle:hover {
  border-color: rgba(113, 216, 230, 0.6);
}

#suggestions-row {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding: 6px 12px 10px;
}

#suggestions-row .sug-chip,
#suggestions-row .suggestion-chip {
  flex: 0 0 auto;
}

#btn-gen-validate-sim {
  position: relative;
  border: 1px solid rgba(98, 213, 255, 0.44);
  background: linear-gradient(135deg, rgba(29, 69, 97, 0.94), rgba(17, 34, 51, 0.94));
  color: #e8f7ff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  transition: transform 120ms ease, box-shadow 180ms ease, border-color 180ms ease, filter 180ms ease;
}

#btn-gen-validate-sim:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(132, 227, 255, 0.78);
  box-shadow: 0 14px 32px rgba(2, 8, 14, 0.36);
  filter: saturate(1.08);
}

#btn-gen-validate-sim:disabled {
  opacity: 0.88;
  cursor: progress;
}

.gen-flow-strip {
  margin: 8px 12px 10px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(136, 184, 212, 0.35);
  background: linear-gradient(140deg, rgba(11, 20, 33, 0.94), rgba(18, 30, 45, 0.9));
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    'status text'
    'bar bar';
  gap: 6px 10px;
  align-items: center;
}

.gen-flow-strip.hidden {
  display: none;
}

.gen-flow-status {
  grid-area: status;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.gen-flow-status.neutral {
  color: #c3e4fb;
  border-color: rgba(154, 200, 227, 0.32);
  background: rgba(53, 84, 108, 0.26);
}

.gen-flow-status.working {
  color: #fff4d7;
  border-color: rgba(255, 205, 112, 0.44);
  background: rgba(155, 103, 32, 0.3);
}

.gen-flow-status.ok {
  color: #d7ffe5;
  border-color: rgba(113, 227, 170, 0.44);
  background: rgba(33, 118, 83, 0.32);
}

.gen-flow-status.warn {
  color: #ffe2d7;
  border-color: rgba(255, 142, 112, 0.48);
  background: rgba(153, 57, 33, 0.3);
}

.gen-flow-text {
  grid-area: text;
  font-size: 12px;
  color: #d4eaf8;
  line-height: 1.35;
}

.gen-flow-progress {
  grid-area: bar;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(176, 216, 238, 0.18);
  overflow: hidden;
}

.gen-flow-progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #6fdaff, #9dffcf);
  transition: width 220ms ease;
}

@media (max-width: 900px) {
  .gen-flow-strip {
    margin: 7px 10px 9px;
    padding: 7px 9px;
  }

  .gen-flow-text {
    font-size: 11px;
  }
}

#chat-input-area {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(8, 14, 24, 0.82), rgba(8, 14, 24, 0.96));
  border-top: 1px solid rgba(113, 216, 230, 0.16);
}

#send-btn:disabled,
#btn-voice:disabled,
#btn-clear:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  #chat-msgs {
    padding: 8px;
  }

  .msg-bubble {
    max-width: 100%;
  }
}

/* --------------------------------------------------------------------------
   PLATFORM VISUAL CLEANUP PASS
   -------------------------------------------------------------------------- */

:root {
  --clean-bg: #0b1119;
  --clean-bg-elev: #101926;
  --clean-panel: rgba(14, 23, 35, 0.92);
  --clean-border: rgba(157, 184, 212, 0.22);
  --clean-border-strong: rgba(157, 184, 212, 0.38);
  --clean-text: #e9f2fc;
  --clean-text-muted: #a9bfd6;
  --clean-accent: #71d8e6;
  --clean-shadow: 0 10px 24px rgba(2, 7, 14, 0.35);
}

body {
  color: var(--clean-text);
  background:
    radial-gradient(130% 80% at 0% 0%, rgba(113, 216, 230, 0.09), transparent 62%),
    radial-gradient(90% 70% at 100% 0%, rgba(65, 96, 140, 0.1), transparent 58%),
    linear-gradient(180deg, #111b2a 0%, var(--clean-bg) 100%);
}

#anunaki-bg {
  opacity: 0.1;
}

#gate-truth-strip {
  height: 16px !important;
  border-bottom: 1px solid rgba(157, 184, 212, 0.22) !important;
  background: rgba(7, 12, 18, 0.9) !important;
  backdrop-filter: blur(8px);
}

#app-shell {
  margin-top: 16px !important;
}

#topbar,
#ecosystem-activity-rail {
  border-color: var(--clean-border);
  background:
    linear-gradient(180deg, rgba(16, 25, 38, 0.98), rgba(12, 19, 30, 0.95));
}

#tb-center,
#tb-actions {
  gap: 10px;
}

#split {
  gap: 10px;
  padding: 10px;
}

#split-drag {
  border-radius: 10px;
  border: 1px solid rgba(157, 184, 212, 0.14);
  background: rgba(20, 30, 45, 0.45);
}

#chat-panel,
#viewport-panel,
.side-panel,
#derived-spec-panel,
#research-ops-panel,
#social-feed-panel,
#engineering-qa-panel {
  border-radius: 12px;
  border: 1px solid var(--clean-border);
  box-shadow: var(--clean-shadow);
  backdrop-filter: blur(8px);
}

#chat-head,
.side-panel-head,
#research-ops-panel .panel-head,
#social-feed-panel .social-panel-head {
  border-bottom-color: rgba(157, 184, 212, 0.2);
}

#chat-msgs,
#asm-tree-content,
#part-props-content,
#social-feed-list,
#research-ops-loop,
#research-ops-backlog {
  scrollbar-width: thin;
}

.tb-btn,
.icon-btn,
#send-btn,
.vp-btn,
.mobile-vp-btn,
.legend-btn,
.tree-tool-chip,
.suggestion-chip,
.sug-chip {
  border-radius: 9px;
  border: 1px solid rgba(157, 184, 212, 0.26);
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.tb-btn,
.icon-btn,
.vp-btn,
.mobile-vp-btn,
.legend-btn,
.tree-tool-chip {
  background: rgba(22, 34, 50, 0.86);
  color: #d9e9fa;
}

.tb-btn:hover,
.icon-btn:hover,
.vp-btn:hover,
.mobile-vp-btn:hover,
.legend-btn:hover,
.tree-tool-chip:hover {
  border-color: var(--clean-border-strong);
  background: rgba(31, 47, 68, 0.9);
  transform: translateY(-1px);
}

.tb-btn.accent,
#send-btn {
  background: linear-gradient(180deg, rgba(77, 157, 190, 0.4), rgba(53, 124, 156, 0.4));
  border-color: rgba(113, 216, 230, 0.6);
  color: #f4fbff;
}

#chat-input,
#command-palette-input,
input[type="text"],
input[type="search"],
textarea,
select {
  border-radius: 10px;
  border: 1px solid rgba(157, 184, 212, 0.26);
  background: rgba(14, 23, 35, 0.92);
  color: var(--clean-text);
}

#chat-input:focus,
#command-palette-input:focus,
input[type="text"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(113, 216, 230, 0.55);
  box-shadow: 0 0 0 2px rgba(113, 216, 230, 0.16);
}

.hint-text,
.enki-sub,
.social-panel-meta,
.eco-rail-title,
.eco-rail-stage,
.cp-item-desc {
  color: var(--clean-text-muted);
}

@media (max-width: 900px) {
  #split {
    padding: 8px;
    gap: 8px;
  }

  #chat-panel,
  #viewport-panel,
  .side-panel,
  #derived-spec-panel,
  #research-ops-panel,
  #social-feed-panel {
    border-radius: 10px;
  }
}

/* Navigation layout must win over the legacy theme layers above. */
#app-shell #topbar { height: 64px; min-height: 64px; padding: 0 16px; gap: 12px; }
#app-shell .brand-mark { width: 48px; height: 48px; }
#app-shell #hud-status-lights { display: none; }
#app-shell .tools-menu { display: none; }
#app-shell .tools-menu.open { display: grid; }
#app-shell #ecosystem-activity-rail { min-height: 30px; padding: 4px 16px; }
#app-shell .eco-rail-list .eco-rail-item:not(:last-child) { display: none; }

@media (max-width: 1100px) {
  #app-shell .brand-sub,
  #app-shell #tb-center { display: none; }
}

@media (max-width: 640px) {
  #app-shell #topbar { height: 58px; min-height: 58px; padding: 0 10px; }
  #app-shell .brand-mark { width: 40px; height: 40px; }
  #app-shell #btn-command-palette { display: none; }
  #app-shell #ecosystem-activity-rail { display: none; }
}

/* --------------------------------------------------------------------------
   OPERATIONAL WORKSTATION LAYOUT PASS
   -------------------------------------------------------------------------- */

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

#anunaki-bg {
  display: none;
}

#app-shell {
  height: calc(100dvh - 16px);
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 6px;
  overflow: hidden;
  padding: 0 8px 8px;
}

#app-shell #topbar {
  min-width: 0;
  height: 54px;
  min-height: 54px;
  padding: 0 10px;
  gap: 8px;
}

#app-shell .brand-mark {
  width: 36px;
  height: 36px;
}

#app-shell .brand-sub {
  display: none;
}

#app-shell #tb-center,
#app-shell #tb-actions {
  display: flex !important;
  align-items: center;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

#app-shell #tb-center {
  flex: 0 0 auto;
}

#app-shell #tb-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
}

#app-shell #btn-command-palette,
#app-shell #btn-tree,
#app-shell #btn-export-step,
#app-shell #btn-export-more,
#app-shell #btn-shortcuts,
#app-shell #btn-self-test,
#app-shell #btn-gen-engine,
#app-shell #btn-social-panel,
#app-shell #btn-research-ops-panel {
  display: inline-flex !important;
}

#app-shell .tb-btn {
  min-height: 34px;
  flex: 0 0 auto;
  white-space: nowrap;
}

#app-shell #platform-tool-belt {
  display: none;
}

#mission-control-strip {
  min-height: 46px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 6px;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(157, 184, 212, 0.18);
}

.mission-action {
  min-width: 0;
  min-height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(157, 184, 212, 0.28);
  background: rgba(16, 27, 40, 0.92);
  color: #e9f2fc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.mission-action:hover {
  border-color: rgba(113, 216, 230, 0.55);
  background: rgba(27, 44, 64, 0.95);
  transform: translateY(-1px);
}

#app-shell #ecosystem-activity-rail {
  display: grid !important;
  min-height: 28px;
  padding: 3px 10px;
}

#app-shell #split {
  min-height: 0;
  height: 100%;
  padding: 0;
  gap: 8px;
  grid-template-columns: minmax(330px, 0.38fr) 6px minmax(460px, 1fr);
}

#chat-panel,
#viewport-panel {
  min-height: 0;
  overflow: hidden;
}

#chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}

#chat-head {
  min-height: 52px;
  padding: 8px 10px;
}

#chat-msgs {
  min-height: 0;
  overflow-y: auto;
}

#suggestions-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(170px, max-content);
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

#suggestions-row .sug-chip,
#suggestions-row .suggestion-chip {
  max-width: clamp(190px, 28vw, 320px);
  min-height: 30px;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.28;
  align-content: center;
}

#viewport-panel {
  display: grid;
  position: relative;
}

#cad-canvas {
  width: 100% !important;
  height: 100% !important;
}

#panel-tabs {
  display: none !important;
}

@media (max-width: 900px) {
  #app-shell {
    height: calc(100dvh - 16px);
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  #app-shell #topbar {
    height: 48px;
    min-height: 48px;
    padding: 0 6px;
  }

  #app-shell .brand-mark {
    width: 32px;
    height: 32px;
  }

  #app-shell .brand-word {
    font-size: 14px;
  }

  #mission-control-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
  }

  .mission-action {
    min-height: 30px;
    font-size: 10px;
  }

  #app-shell #split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(250px, 0.52fr) minmax(250px, 0.48fr);
    gap: 8px;
  }

  #split-drag {
    display: none;
  }

  #chat-panel,
  #viewport-panel,
  #chat-panel.vp-active,
  #viewport-panel.vp-active {
    display: grid !important;
    width: auto !important;
    height: auto !important;
  }

  #chat-panel.vp-active {
    visibility: visible;
  }

  #viewport-panel {
    min-height: 250px;
  }

  #vp-mobile-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #app-shell {
    padding: 0 6px 6px;
  }

  #app-shell #topbar {
    height: 46px;
    min-height: 46px;
  }

  #app-shell #ecosystem-activity-rail {
    display: grid !important;
  }

  #app-shell #btn-command-palette {
    display: inline-flex !important;
  }

  #mission-control-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-height: none;
    padding: 4px 0;
  }

  #app-shell #split {
    grid-template-rows: minmax(235px, 0.52fr) minmax(230px, 0.48fr);
  }

  #chat-input {
    min-height: 58px;
  }

  .hint-text {
    display: none;
  }
}
#app-shell #ecosystem-activity-rail {
  display: none !important;
}

#mission-control-strip {
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 6px;
  border-bottom: 1px solid rgba(157, 184, 212, 0.12);
}

#mission-control-strip.collapsed {
  display: none;
}

#mission-control-strip.collapsed .mission-action {
  display: none;
}

.mission-strip-toggle {
  min-height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(157, 184, 212, 0.22);
  background: rgba(11, 20, 32, 0.86);
  color: #b9c8d8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

#mission-control-strip:not(.collapsed) .mission-strip-toggle {
  color: #eef7ff;
  border-color: rgba(113, 216, 230, 0.42);
}

#mission-control-strip .mission-action {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 0 12px;
}

#suggestions-row {
  grid-auto-columns: minmax(158px, 1fr);
  padding: 7px 12px 4px;
}

#suggestions-row .sug-chip:nth-child(n+3),
#suggestions-row .suggestion-chip:nth-child(n+3) {
  display: none;
}

#suggestions-row .sug-chip,
#suggestions-row .suggestion-chip {
  min-height: 36px;
  max-width: none;
  justify-content: center;
  text-align: center;
  font-size: 10.5px;
}

#chat-input-area {
  border-top-color: rgba(157, 184, 212, 0.14);
  background: rgba(5, 10, 18, 0.98);
}

#chat-input {
  min-height: 96px;
  font-size: 13px;
  line-height: 1.45;
  border-color: rgba(113, 216, 230, 0.24);
  background: rgba(255, 255, 255, 0.045);
}

#chat-input::placeholder {
  color: rgba(225, 238, 250, 0.66);
}

#chat-head .endpoint-health-strip,
#chat-head #gate-truth-strip {
  display: none !important;
}

/* Viewer-first first-run mode: keep the CAD surface and its controls visible
   before any generated assembly exists. */
#viewport-panel:has(#viewport-empty:not(.hidden)) #vp-camera-controls,
#viewport-panel:has(#viewport-empty:not(.hidden)) #vp-render-controls {
  display: flex;
}

#viewport-panel:has(#viewport-empty:not(.hidden)) #vp-camera-gizmo {
  display: grid;
}

#viewport-panel:has(#viewport-empty:not(.hidden)) #btn-edge-rail-toggle,
#viewport-panel:has(#viewport-empty:not(.hidden)) #btn-explode {
  display: inline-flex;
}

#viewport-empty {
  gap: 14px;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 42% at 50% 42%, rgba(45, 161, 180, 0.08), transparent),
    linear-gradient(180deg, rgba(9, 14, 22, 0.36), rgba(13, 16, 22, 0.68));
}

#viewport-empty::before {
  opacity: 0.38;
}

#viewport-empty .empty-icon {
  display: none;
}

#viewport-empty h3 {
  margin: 0;
  max-width: 520px;
  color: rgba(238, 247, 255, 0.92);
  opacity: 1;
  font-size: 24px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: 0;
  text-align: center;
}

#viewport-empty p {
  max-width: 460px;
  color: rgba(207, 222, 235, 0.78);
  opacity: 1;
  font-size: 14px;
  line-height: 1.55;
}

#viewport-empty .empty-hint-chips {
  max-width: 520px;
}

#viewport-empty .empty-hint-chip {
  border-radius: 7px;
  padding: 7px 12px;
  color: rgba(223, 235, 246, 0.82);
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(157, 184, 212, 0.18);
  opacity: 1;
  font-size: 12px;
}

#viewport-empty .empty-demo-actions {
  margin-top: 8px !important;
  gap: 8px !important;
}

#viewport-empty .empty-demo-actions .sim-btn {
  min-height: 40px;
  min-width: 160px;
  justify-content: center;
  font-size: 12px;
}

#viewport-empty .empty-demo-actions .sim-btn:nth-child(n+3) {
  display: none;
}

#app-shell:has(#viewport-empty:not(.hidden)) #sim-bar {
  min-height: 48px;
}

#app-shell:has(#viewport-empty:not(.hidden)) #sim-left .sim-btn:not(#btn-gen-validate-sim),
#app-shell:has(#viewport-empty:not(.hidden)) #sim-left .sim-sep,
#app-shell:has(#viewport-empty:not(.hidden)) #sim-metrics {
  display: none;
}

#app-shell:has(#viewport-empty:not(.hidden)) #btn-gen-validate-sim {
  min-width: 220px;
}

/* First-run clarity mode: prioritize the viewer, then the prompt. */
#app-shell:has(#viewport-empty:not(.hidden)) {
  margin-top: 0 !important;
}

#app-shell:has(#viewport-empty:not(.hidden)) #topbar {
  height: 50px;
  min-height: 50px;
}

#app-shell:has(#viewport-empty:not(.hidden)) #hud-status-lights,
#app-shell:has(#viewport-empty:not(.hidden)) #panel-tabs {
  display: none !important;
}

#app-shell:has(#viewport-empty:not(.hidden)) #split {
  grid-template-columns: minmax(300px, 360px) 6px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  height: calc(100vh - 110px);
}

#app-shell:has(#viewport-empty:not(.hidden)) #split-drag {
  display: block !important;
}

#app-shell:has(#viewport-empty:not(.hidden)) #chat-panel {
  display: flex !important;
  grid-column: 1;
  grid-row: 1;
  flex-direction: column;
  justify-content: stretch;
  padding: 0;
  gap: 0;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-panel {
  grid-column: 3;
  grid-row: 1;
}

#app-shell:has(#viewport-empty:not(.hidden)) #chat-head,
#app-shell:has(#viewport-empty:not(.hidden)) #chat-msgs,
#app-shell:has(#viewport-empty:not(.hidden)) #suggestions-row,
#app-shell:has(#viewport-empty:not(.hidden)) #derived-spec-panel {
  display: none !important;
}

#app-shell.is-design-starting:has(#viewport-empty:not(.hidden)) #chat-panel {
  justify-content: stretch;
}

#app-shell.is-design-starting:has(#viewport-empty:not(.hidden)) #chat-head {
  display: flex !important;
}

#app-shell.is-design-starting:has(#viewport-empty:not(.hidden)) #chat-msgs {
  display: flex !important;
}

#app-shell.is-design-starting:has(#viewport-empty:not(.hidden)) #chat-input-area {
  margin-top: auto;
}

#app-shell:has(#viewport-empty:not(.hidden)) #chat-input-area {
  position: static;
  width: 100%;
  margin-top: 0;
  padding: 12px;
  border-top: 1px solid rgba(157, 184, 212, 0.14);
  background: rgba(5, 10, 18, 0.98);
}

#app-shell:has(#viewport-empty:not(.hidden)) #chat-input-area::before {
  content: "Vision Command";
  display: block;
  margin: 0 0 8px;
  color: rgba(238, 247, 255, 0.9);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
}

.reality-vision-command {
  display: none;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid rgba(113, 216, 230, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(13, 28, 38, 0.84), rgba(19, 26, 38, 0.72)),
    rgba(255, 255, 255, 0.045);
}

.reality-vision-command strong {
  display: block;
  margin-top: 4px;
  color: rgba(243, 250, 255, 0.96);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 18px;
  letter-spacing: 0;
}

.reality-vision-command p {
  margin: 8px 0 0;
  color: rgba(203, 219, 232, 0.82);
  font-size: 12px;
  line-height: 1.45;
}

.rf-kicker {
  color: rgba(113, 216, 230, 0.86);
  font: 700 10px/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.reality-chain-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.reality-chain-strip span {
  padding: 5px 7px;
  border: 1px solid rgba(244, 190, 87, 0.26);
  border-radius: 6px;
  color: rgba(255, 236, 199, 0.86);
  background: rgba(244, 190, 87, 0.08);
  font: 700 9px/1.2 var(--mono);
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-vision-command {
  display: block;
}

#app-shell:has(#viewport-empty:not(.hidden)) #reality-vision-command {
  margin: 12px;
}

.reality-foundry-surface {
  position: relative;
  z-index: 1;
  width: min(100%, 980px);
  max-height: min(88vh, 900px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(113, 216, 230, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(8, 18, 28, 0.92), rgba(18, 24, 34, 0.86)),
    rgba(255, 255, 255, 0.04);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  width: min(100%, 380px);
  max-height: min(40vh, 320px);
  margin: 28px 10px 0 0;
  padding: 10px;
  overflow: auto;
  pointer-events: auto;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-topline {
  margin-bottom: 8px;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-topline h4 {
  font-size: 15px;
  line-height: 1.22;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-score {
  font-size: 18px;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-gate-rail {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-map-grid {
  grid-template-columns: 1fr;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-map-foot,
#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-check-list li {
  min-width: 0;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-check-list li {
  flex-wrap: wrap;
  justify-content: flex-start;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-check-list .rf-pill {
  flex: 0 0 auto;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-panel {
  padding: 8px;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-panel p {
  -webkit-line-clamp: 2;
}

#app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface .rf-panel ul {
  max-height: 48px;
}

.rf-status {
  color: rgba(224, 239, 250, 0.86);
  font: 700 13px/1.4 var(--mono);
}

.rf-status.error {
  color: rgba(255, 171, 171, 0.95);
}

.rf-topline {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.rf-topline h4 {
  margin: 4px 0 0;
  color: rgba(245, 250, 255, 0.96);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
}

.rf-stage {
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 7px;
  color: rgba(186, 255, 226, 0.92);
  background: rgba(52, 211, 153, 0.08);
  font: 800 10px/1.2 var(--mono);
  text-transform: uppercase;
}

.rf-stage-stack {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 96px;
}

.rf-score {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  color: rgba(245, 250, 255, 0.98);
  font: 900 24px/1 var(--mono);
}

.rf-score span {
  color: rgba(190, 207, 221, 0.72);
  font-size: 11px;
}

.rf-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.rf-metric {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(159, 181, 206, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.rf-metric span:first-child {
  display: block;
  color: rgba(194, 212, 228, 0.78);
  font: 800 9px/1.2 var(--mono);
  text-transform: uppercase;
}

.rf-metric strong {
  display: block;
  margin: 4px 0 6px;
  color: rgba(245, 250, 255, 0.96);
  font: 900 15px/1.1 var(--mono);
  overflow-wrap: anywhere;
}

.rf-gate-rail {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.rf-gate {
  min-width: 0;
  min-height: 54px;
  padding: 7px;
  border: 1px solid rgba(159, 181, 206, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.rf-gate > span:first-child {
  display: block;
  min-height: 24px;
  color: rgba(228, 239, 248, 0.9);
  font: 800 8.5px/1.25 var(--mono);
  text-transform: uppercase;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rf-gate.passed {
  border-color: rgba(52, 211, 153, 0.22);
  background: rgba(52, 211, 153, 0.055);
}

.rf-gate.blocked {
  border-color: rgba(248, 113, 113, 0.26);
  background: rgba(248, 113, 113, 0.07);
}

.rf-gate.current {
  border-color: rgba(113, 216, 230, 0.28);
  background: rgba(113, 216, 230, 0.065);
}

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

.rf-panel {
  min-width: 0;
  min-height: 0;
  padding: 10px;
  border: 1px solid rgba(159, 181, 206, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.rf-panel.rf-span-2 {
  grid-column: span 2;
}

.rf-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 8px;
  color: rgba(236, 246, 255, 0.92);
  font: 800 11px/1.2 var(--mono);
  text-transform: uppercase;
}

.rf-panel strong {
  display: block;
  color: rgba(245, 250, 255, 0.94);
  font-size: 13px;
  line-height: 1.3;
}

.rf-panel p {
  margin: 6px 0 0;
  color: rgba(204, 220, 233, 0.8);
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rf-subhead {
  margin-top: 8px;
  color: rgba(113, 216, 230, 0.9);
  font: 900 9px/1.2 var(--mono);
  text-transform: uppercase;
}

.rf-panel ul {
  margin: 7px 0 0;
  padding-left: 14px;
  color: rgba(207, 223, 236, 0.84);
  font-size: 9.5px;
  line-height: 1.32;
  max-height: 88px;
  overflow: hidden;
}

.rf-check-list {
  list-style: none;
  padding-left: 0 !important;
}

.rf-check-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin: 5px 0;
}

.rf-evidence-list li {
  align-items: flex-start;
}

.rf-evidence-list li > span:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.rf-evidence-list strong {
  color: rgba(242, 248, 255, 0.94);
  font-size: 10px;
  line-height: 1.2;
}

.rf-evidence-list small {
  color: rgba(190, 209, 226, 0.75);
  font-size: 9px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rf-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  width: max-content;
  flex-shrink: 0;
  min-height: 20px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid rgba(159, 181, 206, 0.22);
  color: rgba(219, 232, 243, 0.9);
  background: rgba(255, 255, 255, 0.055);
  font: 800 9px/1.15 var(--mono);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
}

.rf-pill.verified,
.rf-pill.pass,
.rf-pill.cleared {
  border-color: rgba(52, 211, 153, 0.36);
  color: rgba(187, 255, 227, 0.96);
  background: rgba(52, 211, 153, 0.1);
}

.rf-pill.blocked,
.rf-pill.fail,
.rf-pill.hit,
.rf-pill.regulated {
  border-color: rgba(248, 113, 113, 0.42);
  color: rgba(255, 200, 200, 0.96);
  background: rgba(248, 113, 113, 0.12);
}

.rf-pill.simulated,
.rf-pill.warn,
.rf-pill.simulated_only {
  border-color: rgba(244, 190, 87, 0.34);
  color: rgba(255, 235, 197, 0.94);
  background: rgba(244, 190, 87, 0.1);
}

.rf-map-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.rf-map-card {
  min-height: 0;
  padding: 7px;
  border: 1px solid rgba(113, 216, 230, 0.16);
  border-radius: 8px;
  background: rgba(113, 216, 230, 0.055);
}

.rf-map-card.blocked {
  border-color: rgba(248, 113, 113, 0.24);
  background: rgba(248, 113, 113, 0.06);
}

.rf-map-title {
  color: rgba(245, 250, 255, 0.93);
  font-size: 10px;
  line-height: 1.3;
  font-weight: 800;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rf-map-meta {
  margin-top: 4px;
  color: rgba(193, 211, 225, 0.74);
  font: 700 9px/1.25 var(--mono);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rf-map-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

#app-shell:has(#viewport-empty:not(.hidden)) #chat-input {
  min-height: 112px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(113, 216, 230, 0.38);
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 0 0 1px rgba(113, 216, 230, 0.06);
  font-size: 13px;
  line-height: 1.45;
}

#app-shell:has(#viewport-empty:not(.hidden)) #chat-input::placeholder {
  color: rgba(238, 247, 255, 0.78);
}

#app-shell:has(#viewport-empty:not(.hidden)) #chat-footer {
  justify-content: flex-end;
  padding: 14px 0 0;
}

#app-shell:has(#viewport-empty:not(.hidden)) .hint-text,
#app-shell:has(#viewport-empty:not(.hidden)) #btn-voice {
  display: none !important;
}

#app-shell:has(#viewport-empty:not(.hidden)) #send-btn {
  width: auto;
  min-width: 132px;
  height: 48px;
  padding: 0 18px;
  gap: 9px;
  border-radius: 8px;
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
}

#send-btn .send-label {
  display: none;
}

#app-shell:has(#viewport-empty:not(.hidden)) #send-btn .send-label {
  display: inline;
}

#viewport-panel:has(#viewport-empty:not(.hidden)) #coord-hud {
  display: flex !important;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 380px);
  grid-template-rows: 1fr;
  align-items: start;
  justify-content: stretch;
  gap: 14px;
  padding: 72px 18px 68px;
  overflow: hidden;
  pointer-events: none;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-fold-demo {
  display: block;
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  width: min(520px, 72%);
  max-width: 100%;
  margin: 0;
  opacity: 0.92;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty h3 {
  margin-top: 2px;
  font-size: 22px;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty p {
  max-width: 720px;
  font-size: 13px;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty .empty-hint-chips {
  display: none;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty .empty-demo-actions {
  margin-top: 4px !important;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty .empty-demo-actions .sim-btn {
  min-width: 180px;
  min-height: 46px;
  font-size: 13px;
}

#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty > h3,
#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty > p,
#app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty .empty-demo-actions {
  display: none !important;
}

@media (max-width: 900px) {
  #app-shell:has(#viewport-empty:not(.hidden)) #split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 0.56fr) minmax(220px, 0.44fr);
  }

  #app-shell:has(#viewport-empty:not(.hidden)) #split-drag {
    display: none !important;
  }

  #app-shell:has(#viewport-empty:not(.hidden)) #chat-panel {
    grid-column: 1;
    grid-row: 2;
    order: 2;
    padding: 12px;
  }

  #app-shell:has(#viewport-empty:not(.hidden)) #viewport-panel {
    grid-column: 1;
    grid-row: 1;
  }

  #app-shell:has(#viewport-empty:not(.hidden)) #chat-input {
    min-height: 104px;
  }

  #app-shell:has(#viewport-empty:not(.hidden)) #viewport-empty {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(120px, 1fr) auto;
    padding: 58px 12px 54px;
    overflow: auto;
  }

  #app-shell:has(#viewport-empty:not(.hidden)) #viewport-fold-demo,
  #app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface {
    grid-column: 1;
  }

  #app-shell:has(#viewport-empty:not(.hidden)) #viewport-fold-demo {
    grid-row: 1;
    width: min(340px, 78vw);
  }

  #app-shell:has(#viewport-empty:not(.hidden)) .reality-foundry-surface {
    grid-row: 2;
    width: 100%;
    max-height: 190px;
    justify-self: stretch;
  }

  .rf-grid {
    grid-template-columns: 1fr;
  }

  .rf-metric-grid,
  .rf-gate-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rf-panel.rf-span-2 {
    grid-column: span 1;
  }

  .rf-map-grid {
    grid-template-columns: 1fr;
  }

  .rf-topline {
    flex-direction: column;
  }
}
