/* ==========================================================================
   ElectOrchestrator — studio
   Builds on base.css. Two panes: the assistant on the left, the live board
   on the right, one workflow bar across the top.

   Hierarchy inside an answer is carried by weight, not decoration: the
   process (thinking, research, skill reads) is quiet disclosure rows; the
   artefacts (components, the circuit file) are bordered cards.
   ========================================================================== */

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

body.studio {
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── Top bar ───────────────────────────────────────────────────────────── */

.topbar {
  flex: 0 0 52px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 0 12px 0 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-self: start;
  color: var(--fg);
  text-decoration: none;
}

.brand__name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-self: end;
  min-width: 0;
}

/* Model picker */
.model {
  display: inline-flex;
  align-items: center;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.12s var(--ease);
}

.model:hover {
  border-color: var(--border-strong);
}

.model:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.model__label {
  padding: 0 8px 0 10px;
  color: var(--fg-3);
  font-size: 12px;
  border-right: 1px solid var(--border);
  line-height: 26px;
}

.select {
  appearance: none;
  height: 26px;
  max-width: 168px;
  padding: 0 26px 0 8px;
  border: 0;
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 8px center / 12px;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  cursor: pointer;
}

.select:focus {
  outline: none;
}

.select--narrow {
  max-width: 96px;
}

.select optgroup {
  color: var(--fg-3);
  font-weight: 600;
}

/* Thinking applies to Google models; for the rest the model decides. */
.model--thinking[data-disabled="true"] {
  opacity: 0.5;
}

.model--thinking[data-disabled="true"] .select {
  cursor: not-allowed;
}

.select option {
  background: var(--bg);
  color: var(--fg);
}

/* Theme toggle shows the mode you would switch to. */
html[data-theme="dark"] .theme-icon--moon,
html[data-theme="light"] .theme-icon--sun {
  display: none;
}

/* Export menu */
.menu {
  position: relative;
}

.menu__list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  z-index: 40;
}

.menu__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  font-size: 13px;
  text-align: left;
}

.menu__item:hover,
.menu__item:focus-visible {
  background: var(--bg-subtle);
  outline: none;
}

.menu__hint {
  color: var(--fg-4);
  font-size: 12px;
}

/* ── Workflow bar ──────────────────────────────────────────────────────── */

.flow {
  justify-self: center;
  min-width: 0;
}

.flow__list {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow__sep {
  width: 20px;
  height: 1px;
  background: var(--border-strong);
}

.flow__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 8px 0 5px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-4);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.flow__btn:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.flow__btn:disabled {
  cursor: default;
}

.flow__num {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.flow__check {
  display: none;
}

.flow__step[data-state="done"] .flow__btn {
  color: var(--fg-2);
}

.flow__step[data-state="done"] .flow__num {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--fg-inverse);
}

.flow__step[data-state="done"] .flow__n {
  display: none;
}

.flow__step[data-state="done"] .flow__check {
  display: block;
}

.flow__step[data-state="done"] + .flow__sep {
  background: var(--fg-3);
}

.flow__step[data-state="active"] .flow__btn {
  color: var(--fg);
}

.flow__step[data-state="active"] .flow__num {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
}

.flow__step[data-state="error"] .flow__btn {
  color: var(--danger-text);
}

.flow__step[data-state="error"] .flow__num {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

/* While the agent works, the active stage carries a quiet orbit. */
.flow[data-busy="true"] .flow__step[data-state="active"] .flow__num::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1.5px solid transparent;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* Mobile pane switcher */
.mobile-nav {
  display: none;
  padding: 2px;
  border-radius: var(--r);
  background: var(--bg-subtle);
}

.mobile-nav__btn {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg-3);
  font-size: 12.5px;
  font-weight: 500;
}

.mobile-nav__btn.is-active {
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

/* ── Workspace ─────────────────────────────────────────────────────────── */

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(380px, 44fr) 6px minmax(420px, 56fr);
  min-height: 0;
  overflow: hidden;
}

.column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.panel--agent {
  background: var(--bg);
}

/* The divider is a hairline; the 6px column around it is the grab area. */
.splitter {
  position: relative;
  cursor: col-resize;
  background: var(--bg);
  z-index: 5;
}

.splitter::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--border);
  transition: background-color 0.15s var(--ease), width 0.15s var(--ease);
}

.splitter:hover::before,
.splitter.is-dragging::before {
  width: 2px;
  background: var(--accent);
}

body.is-resizing {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing iframe {
  pointer-events: none;
}

.panel__head {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px 0 20px;
  border-bottom: 1px solid var(--border);
}

.panel__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

/* ── Thread ────────────────────────────────────────────────────────────── */

.stream {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.stream > * {
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Empty state ───────────────────────────────────────────────────────── */

.empty-state {
  margin-top: auto;
  margin-bottom: auto;
  padding: 8px 4px;
  max-width: 560px;
}

.empty-state__eyebrow {
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 500;
}

.empty-state h2 {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.empty-state__lede {
  margin-top: 8px;
  color: var(--fg-3);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 480px;
}

.empty-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.empty-steps li {
  padding: 12px 14px;
}

.empty-steps li + li {
  border-left: 1px solid var(--border);
}

.empty-steps__num {
  display: block;
  color: var(--fg-4);
  font-family: var(--mono);
  font-size: 11px;
}

.empty-steps__title {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}

.empty-steps__text {
  display: block;
  margin-top: 2px;
  color: var(--fg-3);
  font-size: 12px;
  line-height: 1.5;
}

.examples {
  margin-top: 24px;
}

.examples__label {
  color: var(--fg-3);
  font-size: 12px;
  font-weight: 500;
}

.examples__list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.example {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
  transition: background-color 0.12s var(--ease);
}

.example:hover {
  background: var(--bg-subtle);
}

.example__title {
  display: block;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
}

.example__desc {
  display: block;
  margin-top: 1px;
  color: var(--fg-3);
  font-size: 12px;
}

.example__arrow {
  color: var(--fg-4);
  transition: transform 0.15s var(--ease), color 0.15s var(--ease);
}

.example:hover .example__arrow {
  color: var(--fg);
  transform: translateX(2px);
}

/* ── Turns ─────────────────────────────────────────────────────────────── */

.turn--user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.turn--user .turn__who {
  color: var(--fg-4);
  font-size: 11px;
}

.turn--user .turn__text {
  max-width: 85%;
  padding: 9px 14px;
  border-radius: var(--r-lg);
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: 13.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.turn--user .turn__text p {
  margin: 0;
}

.turn--user .turn__text p + p {
  margin-top: 6px;
}

.turn--agent {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.turn__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
}

.turn__head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.turn__name {
  font-size: 13px;
  font-weight: 600;
}

.turn__badge--model {
  overflow: hidden;
  max-width: 180px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn__time {
  color: var(--fg-4);
  font-size: 11.5px;
}

.turn__head-right {
  min-width: 0;
}

.turn__stream-tag,
.turn__done-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--fg-3);
  font-size: 12px;
  white-space: nowrap;
}

.turn__stream-text {
  overflow: hidden;
  max-width: 280px;
  text-overflow: ellipsis;
}

.turn__stream-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.turn__done-tag {
  color: var(--fg-4);
  font-variant-numeric: tabular-nums;
}

.turn__done-tag svg {
  color: var(--success);
}

/* Placeholder until the first real output lands. */
.skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0;
}

.skeleton__line {
  display: block;
  height: 10px;
  width: 64%;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-subtle) 0%, var(--bg-muted) 50%, var(--bg-subtle) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
}

.skeleton__line--lg {
  width: 88%;
}

.skeleton__line--sm {
  width: 38%;
}

@keyframes skeleton {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ── Blocks ────────────────────────────────────────────────────────────── */

.block__head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.block__toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--fg-3);
  font-size: 13px;
  text-align: left;
}

.block__toggle:hover {
  color: var(--fg);
}

.block__icon {
  width: 14px;
  height: 14px;
  color: var(--fg-4);
}

.block__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block__label strong {
  color: var(--fg-2);
  font-weight: 600;
}

.block__label code {
  font-size: 12px;
}

.block__meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-4);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.block__chev {
  color: var(--fg-4);
  transition: transform 0.15s var(--ease);
}

.block[data-open="true"] .block__chev {
  transform: rotate(90deg);
}

.block__actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.block__actions:empty {
  display: none;
}

.block__body {
  display: none;
}

.block[data-open="true"] .block__body {
  display: block;
}

/* Process blocks: thinking, research, skill reads. Quiet rows whose body sits
   under a hairline, indented to the label. */
.block--think .block__body,
.block--search .block__body,
.block--skill .block__body {
  margin: 4px 0 2px 6px;
  padding: 4px 0 4px 15px;
  border-left: 1px solid var(--border);
}

/* A live process row: the label itself carries the motion. */
.block[data-live="true"] .block__label {
  background: linear-gradient(90deg, var(--fg-3) 0%, var(--fg-3) 40%, var(--fg) 50%, var(--fg-3) 60%, var(--fg-3) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: text-shimmer 2.2s linear infinite;
}

@keyframes text-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -150% 0;
  }
}

.block[data-state="error"] .block__label {
  color: var(--danger-text);
}

.think__text {
  max-height: 240px;
  overflow-y: auto;
  color: var(--fg-3);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}

/* Research + skill trail */
.search__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search__query {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-size: 12px;
}

.search__engine {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-family: var(--mono);
  font-size: 10.5px;
}

.search__subject {
  color: var(--fg-2);
  font-weight: 500;
}

.search__origin {
  color: var(--fg-4);
}

.search__steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.search__steps:empty {
  display: none;
}

.search__step {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.search__step-dot {
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--fg-4);
}

.search__step[data-state="live"] .search__step-dot {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.search__step[data-cached="true"] {
  opacity: 0.6;
}

.search__step-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.search__step-text {
  color: var(--fg-2);
  font-size: 12.5px;
  line-height: 1.5;
}

.search__step-detail {
  overflow: hidden;
  color: var(--fg-4);
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search__sources {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search__sources:empty {
  display: none;
}

.search__fail {
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--r);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 12.5px;
  line-height: 1.5;
}

/* Source card — expandable document preview */
.src {
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg);
  overflow: hidden;
}

.src__head {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
}

.src__head:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.src__head:disabled {
  cursor: default;
}

.src__glyph {
  display: inline-flex;
  color: var(--fg-4);
}

.src__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.src__title {
  overflow: hidden;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.src__sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  min-width: 0;
}

.src__host {
  color: var(--fg-3);
  font-size: 11.5px;
}

.src__tag {
  color: var(--fg-4);
  font-family: var(--mono);
  font-size: 10.5px;
}

.src__tag::before {
  content: "·";
  margin-right: 6px;
  color: var(--fg-4);
}

.src__tag--kind {
  color: var(--fg-2);
  font-weight: 500;
}

.src__tag--ok {
  color: var(--success-text);
}

.src .block__chev {
  transition: transform 0.15s var(--ease);
}

.src[data-open="true"] .block__chev {
  transform: rotate(90deg);
}

.src__preview {
  display: none;
  padding: 0 10px 10px;
}

.src[data-open="true"] .src__preview {
  display: block;
}

.src__doc {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
}

.src__doc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}

.src__doc-name {
  overflow: hidden;
  color: var(--fg-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.src__doc-pages {
  flex-shrink: 0;
  color: var(--fg-4);
  font-family: var(--mono);
}

.src__doc-text {
  max-height: 240px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  color: var(--fg-2);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scrollbar-width: thin;
}

.src__doc-fade {
  display: none;
}

.src__open {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.src__open:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Components (bill of materials) ────────────────────────────────────── */

.bom {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  overflow: hidden;
}

.bom__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}

.bom__title {
  font-size: 12.5px;
  font-weight: 600;
}

.bom__spacer {
  flex: 1;
}

.bom__count {
  color: var(--fg-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.bom__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.bom__row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
}

.bom__row + .bom__row {
  border-top: 1px solid var(--border);
}

.bom__lamp,
.lamp {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-4);
}

.bom__row[data-status="verified"] .bom__lamp,
.lamp--ok {
  background: var(--success);
}

.bom__row[data-status="partial"] .bom__lamp,
.lamp--warn {
  background: var(--warning);
}

.bom__row[data-status="unverified"] .bom__lamp,
.lamp--bad {
  background: var(--danger);
}

.bom__row[data-status="searching"] .bom__lamp {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.bom__main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 0;
}

.bom__mpn {
  color: var(--fg);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.bom__row[data-status="searching"] .bom__mpn {
  animation: pulse 1.6s ease-in-out infinite;
}

.bom__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.bom__fact {
  padding: 1px 6px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--fg-3);
  font-size: 11px;
  white-space: nowrap;
}

.bom__fact--role {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--fg-2);
}

.bom__fact--ghost {
  width: 52px;
  height: 17px;
  background: linear-gradient(90deg, var(--bg-subtle) 0%, var(--bg-muted) 50%, var(--bg-subtle) 100%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease-in-out infinite;
}

.bom__doc {
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.bom__doc:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bom__doc[data-empty="true"] {
  color: var(--fg-4);
  font-weight: 400;
  pointer-events: none;
}

/* ── Circuit file (code) ───────────────────────────────────────────────── */

.block--work {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  overflow: hidden;
}

.block--work .block__head {
  padding: 4px 6px 4px 12px;
}

.block--work .block__toggle {
  color: var(--fg-2);
  height: 30px;
}

.block--work .block__label code {
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--fg);
}

.block__progress {
  height: 2px;
  background: transparent;
  overflow: hidden;
}

.block__progress i {
  display: block;
  width: 30%;
  height: 100%;
  background: var(--accent);
  animation: indeterminate 1.3s var(--ease) infinite;
}

.block--work[data-state="done"] .block__progress {
  display: none;
}

@keyframes indeterminate {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(340%);
  }
}

.badge-pill {
  color: var(--fg-4);
  font-size: 11.5px;
}

.badge-live-stream,
.badge-ready {
  padding: 0 5px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 16px;
}

.badge-live-stream {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.badge-ready {
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--fg-3);
}

.btn--code-action {
  color: var(--fg-3);
}

.btn--code-action.is-copied {
  color: var(--success-text);
}

.code {
  max-height: 380px;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--fg-2);
  font-size: 12px;
  line-height: 1.65;
  tab-size: 2;
  scrollbar-width: thin;
}

.tok-tag {
  color: var(--tok-tag);
}

.tok-attr {
  color: var(--tok-attr);
}

.tok-str {
  color: var(--tok-str);
}

.tok-num {
  color: var(--tok-num);
}

.tok-kw {
  color: var(--tok-kw);
}

.tok-com {
  color: var(--tok-com);
  font-style: italic;
}

.tok-punc {
  color: var(--tok-punc);
}

.code-stream-cursor,
.streaming-cursor {
  display: inline-block;
  width: 6px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--fg-3);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

/* ── Prose ─────────────────────────────────────────────────────────────── */

.prose {
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose p {
  margin: 0 0 10px;
}

.prose h3,
.prose h4 {
  margin: 18px 0 6px;
  color: var(--fg);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.prose ul,
.prose ol {
  margin: 0 0 10px;
  padding-left: 20px;
}

.prose li {
  margin: 3px 0;
  padding-left: 2px;
}

.prose li::marker {
  color: var(--fg-4);
}

.prose strong {
  color: var(--fg);
  font-weight: 600;
}

.prose code {
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: 12px;
}

.prose blockquote {
  margin: 0 0 10px;
  padding-left: 12px;
  border-left: 2px solid var(--border-strong);
  color: var(--fg-3);
}

/* Callouts. Warning, caution and danger all read red — in hardware they mean
   the same thing: exceed this and something is destroyed. */
.callout {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-subtle);
}

.callout__head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.callout__body {
  margin-top: 4px;
  color: var(--fg-2);
  font-size: 13px;
  line-height: 1.6;
}

.callout__body p {
  margin: 0 0 4px;
}

.callout__body p:last-child {
  margin-bottom: 0;
}

.callout[data-kind="warning"],
.callout[data-kind="caution"],
.callout[data-kind="danger"] {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background: var(--danger-soft);
}

.callout[data-kind="warning"] .callout__head,
.callout[data-kind="caution"] .callout__head,
.callout[data-kind="danger"] .callout__head {
  color: var(--danger-text);
}

.callout[data-kind="important"] {
  border-color: color-mix(in srgb, var(--warning) 32%, transparent);
  background: var(--warning-soft);
}

.callout[data-kind="important"] .callout__head {
  color: var(--warning-text);
}

.callout[data-kind="note"] .callout__head svg,
.callout[data-kind="tip"] .callout__head svg {
  color: var(--fg-3);
}

/* Warning summary above an answer */
.warnbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.warnchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.warnchip--warn {
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.warnchip--note {
  border-color: color-mix(in srgb, var(--warning) 28%, transparent);
  background: var(--warning-soft);
  color: var(--warning-text);
}

/* Citation strip */
.sourcebar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sourcebar__head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-2);
  font-size: 12px;
}

.sourcebar__head svg {
  color: var(--success);
}

.sourcebar__head strong {
  font-weight: 500;
}

.sourcebar__sub {
  color: var(--fg-4);
}

.sourcebar__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sourcechip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px 0 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-3);
  font-size: 11.5px;
  text-decoration: none;
  transition: border-color 0.12s var(--ease), color 0.12s var(--ease);
}

a.sourcechip:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}

.sourcechip__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-subtle);
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 9.5px;
}

.sourcechip--more {
  padding: 0 8px;
}

/* Results */
.block--result {
  padding: 8px 12px;
  border-radius: var(--r);
  background: var(--bg-subtle);
  color: var(--fg-3);
  font-size: 12.5px;
}

.block--error {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--r);
  background: var(--danger-soft);
  color: var(--danger-text);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ── Targeted edits ────────────────────────────────────────────────────── */

/* The change as planned, then as applied: an artefact, so a bordered card. */
.block--edits {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  overflow: hidden;
}

.block--edits .block__head {
  padding: 4px 6px 4px 12px;
}

.block--edits .block__toggle {
  color: var(--fg-2);
  height: 30px;
}

.block--edits[data-state="rejected"] .block__label {
  color: var(--danger-text);
}

.edits__list {
  margin: 0;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  list-style: none;
  counter-reset: edit;
}

.edit {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: baseline;
  gap: 2px 8px;
  padding: 3px 12px;
  counter-increment: edit;
}

.edit::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--fg-4);
  justify-self: center;
  align-self: start;
}

.edit[data-state="pending"]:last-child::before {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.edit[data-state="ok"]::before {
  background: var(--success);
}

.edit[data-state="failed"]::before {
  background: var(--danger);
}

.edit__line {
  overflow-wrap: anywhere;
  color: var(--fg-2);
  font-size: 11.5px;
  line-height: 1.55;
}

.edit[data-state="failed"] .edit__line {
  color: var(--fg-3);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--danger) 50%, transparent);
}

.edit__msg {
  grid-column: 2;
  color: var(--danger-text);
  font-size: 12px;
  line-height: 1.5;
}

/* The server's own check: a quiet process row, like research. */
.block--check .block__body {
  margin: 4px 0 2px 6px;
  padding: 4px 0 4px 15px;
  border-left: 1px solid var(--border);
}

.block--check[data-state="done"] .block__icon {
  color: var(--success);
}

.block--check[data-state="warn"] .block__icon,
.block--check[data-state="warn"] .block__label {
  color: var(--warning-text);
}

.check__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  line-height: 1.5;
}

.check__list li[data-kind="problem"] {
  color: var(--fg-2);
}

.check__list li[data-kind="fix"] {
  color: var(--fg-3);
}

/* What actually changed, computed from the files. */
.changes {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 8px 12px;
  border-radius: var(--r);
  background: var(--bg-subtle);
  font-size: 12.5px;
}

.changes__label {
  color: var(--fg-3);
  font-weight: 500;
}

.changes__text {
  color: var(--fg);
  font-family: var(--mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.changes__note {
  flex-basis: 100%;
  color: var(--warning-text);
  font-size: 12px;
}

.changes[data-status="rejected"] .changes__note {
  color: var(--danger-text);
}

/* An automatic repair is the studio talking, not the user. */
.turn--auto {
  align-self: center;
  width: auto;
  max-width: none;
  padding: 4px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  color: var(--fg-3);
  font-size: 12px;
  text-align: center;
}

/* ── Composer ──────────────────────────────────────────────────────────── */

.composer {
  flex-shrink: 0;
  padding: 12px 20px 14px;
}

.composer__box {
  max-width: 760px;
  margin: 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.composer__box:focus-within {
  border-color: var(--fg-4);
  box-shadow: 0 0 0 3px var(--bg-subtle);
}

.composer__input {
  display: block;
  width: 100%;
  min-height: 48px;
  max-height: 160px;
  padding: 12px 14px 4px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--fg);
  font-size: 13.5px;
  line-height: 1.55;
}

.composer__input::placeholder {
  color: var(--fg-4);
}

.composer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 8px 8px;
}

.composer__options,
.composer__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.composer__hint {
  max-width: 760px;
  margin: 8px auto 0;
  color: var(--fg-4);
  font-size: 11.5px;
  text-align: center;
}

.composer__hint kbd {
  height: 17px;
  min-width: 17px;
  padding: 0 4px;
  font-size: 10.5px;
  color: var(--fg-3);
}

/* Datasheet research switch */
.websearch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 8px 0 6px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  font-size: 12.5px;
  white-space: nowrap;
}

.websearch:hover:not(:disabled) {
  background: var(--bg-subtle);
}

.websearch__track {
  position: relative;
  width: 26px;
  height: 16px;
  border-radius: 999px;
  background: var(--bg-muted);
  transition: background-color 0.18s var(--ease);
}

.websearch__track i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s var(--ease);
}

.websearch[data-on="true"] .websearch__track {
  background: var(--accent);
}

.websearch[data-on="true"] .websearch__track i {
  transform: translateX(10px);
}

.websearch__label {
  color: var(--fg-2);
  font-weight: 500;
}

.websearch__meta {
  color: var(--fg-4);
}

.websearch[data-disabled="true"] {
  opacity: 0.55;
}

.linkbtn {
  height: 28px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--fg-3);
  font-size: 12.5px;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  white-space: nowrap;
}

.linkbtn:hover {
  color: var(--fg);
  text-decoration-color: currentColor;
}

/* ── Preview ───────────────────────────────────────────────────────────── */

.panel--preview {
  position: relative;
  background: var(--bg-app);
}

.preview-head {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  min-width: 0;
}

.viewtabs {
  display: inline-flex;
  flex-shrink: 0;
  padding: 2px;
  border-radius: var(--r);
  background: var(--bg-subtle);
}

.viewtab {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg-3);
  font-size: 12.5px;
  font-weight: 500;
  transition: color 0.12s var(--ease), background-color 0.12s var(--ease);
}

.viewtab:hover {
  color: var(--fg);
}

.viewtab[aria-selected="true"] {
  background: var(--bg);
  color: var(--fg);
  box-shadow: var(--shadow-sm), 0 0 0 1px var(--border);
}

.viewtab[data-unavailable="true"] {
  opacity: 0.45;
}

.preview-head__checks {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
  overflow: hidden;
}

.preview-head__tools {
  display: flex;
  align-items: center;
  gap: 2px;
}

.preview-head__sep {
  width: 1px;
  height: 16px;
  margin: 0 4px;
  background: var(--border);
}

.zoom {
  display: inline-flex;
  align-items: center;
}

.zoom__value {
  min-width: 46px;
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--fg-2);
}

.btn--ghost.btn--xs {
  color: var(--fg-3);
}

.btn--ghost.btn--xs:hover:not(:disabled) {
  color: var(--fg);
}

/* Connection check + build status chips */
.drc-chip,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}

.drc-chip__text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.drc-chip:hover {
  border-color: var(--border-strong);
}

.drc-chip__dot,
.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.drc-chip[data-level="warn"] {
  color: var(--warning-text);
}

.drc-chip[data-level="warn"] .drc-chip__dot {
  background: var(--warning);
}

.drc-chip[data-level="error"],
.chip--error {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background: var(--danger-soft);
  color: var(--danger-text);
}

.drc-chip[data-level="error"] .drc-chip__dot,
.chip--error .chip__dot {
  background: var(--danger);
}

/* Canvas */
.preview-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.preview-canvas__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg-app);
}

.preview-viewport {
  position: absolute;
  inset: 0;
  transform-origin: center;
  transition: transform 0.18s var(--ease);
}

.preview-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.preview-empty,
.preview-boot,
.preview-3d {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-empty {
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  background: var(--bg-app);
  text-align: center;
  z-index: 3;
}

.preview-empty__title {
  font-size: 14px;
  font-weight: 600;
}

.preview-empty__text {
  max-width: 320px;
  color: var(--fg-3);
  font-size: 13px;
  line-height: 1.55;
}

.preview-boot {
  background: var(--bg-app);
  z-index: 6;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.preview-boot.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preview-boot__card,
.preview-3d__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.preview-boot__card .spinner,
.preview-3d__card .spinner {
  width: 18px;
  height: 18px;
  margin-bottom: 10px;
}

.preview-boot__card strong,
.preview-3d__title {
  font-size: 13px;
  font-weight: 600;
}

.preview-boot__card span:not(.spinner),
.preview-3d__text {
  color: var(--fg-3);
  font-size: 12px;
}

.preview-3d {
  background: color-mix(in srgb, var(--bg-app) 82%, transparent);
  backdrop-filter: blur(2px);
  z-index: 5;
}

.preview-3d__card {
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  max-width: 280px;
}

/* Build progress — docked, never blocks the board */
.build-overlay {
  position: absolute;
  left: 50%;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  padding: 9px 16px 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  transform: translateX(-50%);
  overflow: hidden;
  z-index: 7;
  animation: rise 0.2s var(--ease);
}

.build-overlay__content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.build-overlay__title {
  font-size: 12.5px;
  font-weight: 600;
}

.build-overlay__sub {
  color: var(--fg-3);
  font-size: 12px;
}

.build-overlay__sub.is-swap {
  animation: fade-in 0.25s var(--ease);
}

.build-overlay__meter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--bg-subtle);
}

.build-overlay__meter i {
  display: block;
  width: 6%;
  height: 100%;
  background: var(--accent);
  transition: width 0.8s var(--ease);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* Connection check dock */
.drc-dock {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: min(440px, calc(100% - 24px));
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 8;
}

.drc-dock__head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px 8px 12px;
  border-bottom: 1px solid var(--border);
}

.drc-dock__head strong {
  font-size: 12.5px;
  font-weight: 600;
}

.drc-dock__spacer {
  flex: 1;
}

.drc-dock__list {
  max-height: 180px;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  list-style: none;
}

.drc-issue {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12.5px;
  line-height: 1.5;
}

.drc-issue__subject {
  flex-shrink: 0;
  padding: 0 5px;
  border-radius: var(--r-sm);
  background: var(--bg-subtle);
  font-size: 11px;
}

.drc-issue[data-severity="error"] .drc-issue__subject {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.drc-issue[data-severity="warn"] .drc-issue__subject {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.drc-issue__text {
  color: var(--fg-2);
}

/* Error dock */
.preview-error-dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 9;
}

.preview-error-dock__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 12px;
}

.preview-error-dock__head strong {
  font-size: 12.5px;
  font-weight: 600;
}

.preview-error-dock__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
}

.preview-error-dock__spacer {
  flex: 1;
}

.preview-error-dock__body {
  max-height: 160px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--fg-2);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Footer: one status line, one measurement */
.preview-foot {
  flex: 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg-3);
  font-size: 12px;
  white-space: nowrap;
}

.preview-foot__status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-foot__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-4);
}

.panel--preview[data-sim-state="ready"] .preview-foot__dot {
  background: var(--success);
}

.panel--preview[data-sim-state="building"] .preview-foot__dot,
.panel--preview[data-sim-state="booting"] .preview-foot__dot {
  background: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.panel--preview[data-sim-state="error"] .preview-foot__dot {
  background: var(--danger);
}

.preview-foot__meta {
  color: var(--fg-4);
  font-family: var(--mono);
  font-size: 11px;
}

/* Fullscreen */
.panel--preview.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 60;
}

/* ── Banner ────────────────────────────────────────────────────────────── */

.banner {
  position: fixed;
  top: 60px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(680px, calc(100vw - 32px));
  padding: 7px 6px 7px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 35%, var(--border));
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  color: var(--fg-2);
  font-size: 12.5px;
  transform: translateX(-50%);
  z-index: 50;
}

.banner__dot {
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--warning);
}

.banner__text {
  line-height: 1.45;
}

/* ── Toasts ────────────────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
  z-index: 70;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 360px;
  padding: 9px 14px 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: var(--shadow-md);
  color: var(--fg);
  font-size: 12.5px;
  pointer-events: auto;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  animation: toast-in 0.2s var(--ease);
}

.toast svg {
  color: var(--fg-3);
}

.toast--success svg {
  color: var(--success);
}

.toast--error svg {
  color: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ── Modals ────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 9, 11, 0.45);
  z-index: 80;
  animation: fade-in 0.15s var(--ease);
}

.modal {
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: calc(100vh - 48px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal--wide {
  width: min(580px, 100%);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px 14px 20px;
  border-bottom: 1px solid var(--border);
}

.modal__title {
  font-size: 14px;
  font-weight: 600;
}

.modal__body {
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.shortcuts {
  margin: 0;
}

.shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  font-size: 13px;
}

.shortcut + .shortcut {
  border-top: 1px solid var(--border);
}

.shortcut dt {
  color: var(--fg-2);
}

.shortcut dd {
  display: flex;
  gap: 4px;
  margin: 0;
}

.raghelp__lede {
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.65;
}

.raghelp__steps {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: rag;
}

.raghelp__steps li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 0 16px 32px;
  counter-increment: rag;
}

.raghelp__steps li::before {
  content: counter(rag);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--fg-3);
  font-size: 11px;
  font-weight: 600;
}

.raghelp__steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 24px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}

.raghelp__step-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 20px;
}

.raghelp__note {
  color: var(--fg-3);
  font-size: 12.5px;
  line-height: 1.55;
}

.raghelp__code {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-subtle);
  color: var(--fg-2);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

.raghelp__footnote {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--fg-3);
  font-size: 12.5px;
  line-height: 1.7;
}

.raghelp__footnote strong {
  color: var(--fg-2);
  font-weight: 600;
}

.raghelp__footnote .lamp {
  margin: 0 2px 0 4px;
  vertical-align: 1px;
}

/* ── Scrollbars (WebKit) ───────────────────────────────────────────────── */

.stream::-webkit-scrollbar,
.code::-webkit-scrollbar,
.think__text::-webkit-scrollbar,
.src__doc-text::-webkit-scrollbar,
.drc-dock__list::-webkit-scrollbar,
.modal__body::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.stream::-webkit-scrollbar-thumb,
.code::-webkit-scrollbar-thumb,
.think__text::-webkit-scrollbar-thumb,
.src__doc-text::-webkit-scrollbar-thumb,
.drc-dock__list::-webkit-scrollbar-thumb,
.modal__body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--border-strong) padding-box;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

/* Labels go before the stages do: the numbered dots still read as a sequence. */
@media (max-width: 1280px) {
  .flow__step:not([data-state="active"]):not([data-state="error"]) .flow__label {
    display: none;
  }

  .flow__step .flow__btn {
    padding-right: 5px;
  }

  .flow__step[data-state="active"] .flow__btn,
  .flow__step[data-state="error"] .flow__btn {
    padding-right: 9px;
  }

}

/* The error dock and "Fix with AI" already say the build failed. */
@media (max-width: 1360px) {
  #error-chip,
  .preview-head__sep,
  #btn-zoom-fit {
    display: none;
  }
}

@media (max-width: 1100px) {
  .model__label {
    display: none;
  }

  .select {
    max-width: 140px;
  }
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 10px;
  }

  .flow,
  .brand__name,
  #btn-shortcuts,
  .composer__hint {
    display: none;
  }

  .mobile-nav {
    display: inline-flex;
    justify-self: center;
  }

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

  .splitter {
    display: none;
  }

  .workspace[data-mobile-view="left"] .column--right,
  .workspace[data-mobile-view="right"] .column--left {
    display: none;
  }

  .stream {
    padding: 20px 14px 12px;
  }

  .composer {
    padding: 10px 12px 12px;
  }

  .empty-steps {
    grid-template-columns: 1fr;
  }

  .empty-steps li + li {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .websearch__meta {
    display: none;
  }
}

@media (max-width: 560px) {
  .model,
  .zoom {
    display: none;
  }

  .websearch__label {
    display: none;
  }
}
