:root {
  --teal: #00B3B3;
  --deep-teal: #007F83;
  --navy: #102A35;
  --aqua: #35D6D2;
  --ice: #F2FBFB;
  --white: #FFFFFF;
  --nav: var(--navy);
  --nav-2: #0c222b;
  --cta: var(--teal);
  --cta-hover: var(--deep-teal);
  --cta-text: var(--white);
  --price: var(--deep-teal);
  --link: var(--deep-teal);
  --link-hover: var(--teal);
  --bg: var(--ice);
  --card: var(--white);
  --text: var(--navy);
  --muted: #4a6570;
  --border: #c5e4e4;
  --soft: #e8f8f8;
  --warn-bg: #fff4e5;
  --warn: #8a5a00;
  --danger: #b12704;
  --danger-bg: #fef0e6;
  --font: "Source Sans 3", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-serif: "Libre Baskerville", Georgia, serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r1: 4px; --r2: 8px; --r3: 12px;
  --shadow-1: 0 1px 2px rgba(16, 42, 53, 0.06), 0 1px 1px rgba(16, 42, 53, 0.04);
  --shadow-2: 0 4px 16px rgba(0, 127, 131, 0.14);
  --shadow-3: 0 12px 40px rgba(16, 42, 53, 0.25);
  --tap: 44px;
  --hdr-h: 72px;
  --tv-teal: var(--teal);
  --tv-teal-dark: var(--deep-teal);
  --tv-aqua: var(--aqua);
  --tv-navy: var(--navy);
  --tv-ice: var(--ice);
  --tv-white: var(--white);
  --tv-teal-soft: var(--soft);
  --tv-black: var(--navy);
  --tv-ink: var(--navy);
  --tv-muted: var(--muted);
  --tv-line: var(--border);
  --tv-grad-a: var(--teal);
  --tv-grad-b: var(--aqua);
  --sans: var(--font);
  --mono: var(--font-mono);
  --serif: var(--font-serif);
  --green: var(--teal);
  --purple: var(--deep-teal);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
body.no-scroll { overflow: hidden; }
:focus-visible { outline: 3px solid var(--aqua); outline-offset: 2px; border-radius: 2px; }
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 200;
  background: var(--aqua); color: var(--navy); padding: 10px 14px;
  border-radius: var(--r1); font-weight: 700;
}
.skip-link:focus { top: 8px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 40px; padding: 0.5rem 1rem;
  border-radius: var(--r2); border: 1px solid transparent;
  font-family: var(--font);
  font-weight: 600; font-size: 0.92rem; line-height: 1.1;
  text-decoration: none !important; white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary,
.btn-teal,
.btn-green { background: var(--cta); color: var(--cta-text); border-color: var(--deep-teal); }
.btn-primary:hover:not(:disabled),
.btn-teal:hover:not(:disabled),
.btn-green:hover:not(:disabled) { background: var(--cta-hover); color: var(--white); }
.btn-sm { min-height: 32px; padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn-block { width: 100%; min-height: 48px; font-size: 1rem; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--deep-teal);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--teal); background: var(--white); color: var(--deep-teal); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: var(--white);
  animation: spin 0.8s linear infinite;
}
#signInBtn.is-signed-in,
#wsSignIn.is-signed-in {
  border-color: rgba(53, 214, 210, 0.45);
  color: var(--aqua);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.logo:hover { text-decoration: none; }
.logo-img,
.brand-logo {
  height: 60px;
  width: auto;
  max-width: 140px;
  display: block;
  object-fit: contain;
  background: #FFFFFF;
  border-radius: 6px;
  padding: 2px;
}
.logo-mark {
  font-weight: 700;
  font-size: 14px;
  color: var(--white);
  letter-spacing: 0.01em;
}
.logo-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  line-height: 1.15;
}
.logo-lockup .logo-mark {
  font-size: 16px;
  letter-spacing: -0.02em;
}
.logo-by {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aqua);
}
.logo-pill {
  font-size: 11px;
  font-weight: 700;
  color: var(--navy);
  background: var(--aqua);
  border-radius: 999px;
  padding: 2px 8px;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  min-height: var(--hdr-h);
  background: var(--nav);
  color: var(--white);
  border-bottom: 1px solid var(--nav-2);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.topnav .btn-ghost,
.ws-header .btn-ghost {
  border-color: rgba(53, 214, 210, 0.4);
  color: var(--white);
}
.topnav .btn-ghost:hover:not(:disabled),
.ws-header .btn-ghost:hover:not(:disabled) {
  background: rgba(53, 214, 210, 0.12);
  border-color: var(--aqua);
  color: var(--white);
}
.nav-menu-btn {
  display: none;
  background: none;
  border: 1px solid transparent;
  color: var(--white);
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r1);
  font-size: 1.2rem;
  cursor: pointer;
}
.nav-menu-btn:hover { border-color: var(--aqua); }
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nav-links a {
  color: var(--white);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 0.35rem 0.6rem;
  border-radius: var(--r1);
  border: 1px solid transparent;
}
.nav-links a:hover { border-color: var(--aqua); color: var(--white); }
.nav-links a.nav-current {
  color: var(--aqua);
  font-weight: 700;
  border-bottom: 2px solid var(--aqua);
  border-radius: 0;
  padding-bottom: 2px;
}
.nav-right { display: flex; gap: 10px; align-items: center; }

.landing { min-height: 100vh; background: var(--navy); display: flex; flex-direction: column; }
.hero-studio {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--hdr-h));
  overflow: hidden;
}
.hero-media {
  position: absolute;
  inset: 0;
  background: url("technoventor-lab-v2.jpg") center / cover no-repeat;
  opacity: 0.22;
  filter: saturate(0.7);
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(0, 179, 179, 0.22), transparent 55%),
    linear-gradient(180deg, rgba(16, 42, 53, 0.55) 0%, rgba(16, 42, 53, 0.92) 100%);
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 56px;
  text-align: center;
  color: var(--white);
}
.hero-content h1 {
  font-family: var(--sans);
  font-size: clamp(2.1rem, 5.5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--white);
}
.hero-kicker {
  margin: 0 0 22px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aqua);
  font-weight: 700;
}
.subtitle {
  margin: 0 auto 28px;
  max-width: 34em;
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(242, 251, 251, 0.88);
}
.prompt-box.composer {
  background: var(--white);
  border-radius: 16px;
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow-3);
  color: var(--navy);
  border: 1px solid rgba(53, 214, 210, 0.4);
}
.prompt-box textarea {
  width: 100%;
  border: none;
  resize: none;
  font-family: var(--sans);
  font-size: 16px;
  outline: none;
  background: transparent;
  color: var(--navy);
  min-height: 96px;
}
.prompt-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.prompt-chip {
  font-family: var(--font);
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--deep-teal);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  min-height: 32px;
}
.prompt-chip:hover { border-color: var(--teal); color: var(--teal); }
.how-strip {
  margin: 22px 0 0;
  color: rgba(242, 251, 251, 0.72);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.landing-foot {
  padding: 8px 16px 12px;
  text-align: center;
  background: var(--navy);
}
.landing-foot a { color: rgba(242, 251, 251, 0.35); font-size: 11px; }

/* Workspace */
.workspace { height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.ws-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  min-height: var(--hdr-h);
  border-bottom: 1px solid var(--nav-2);
  background: var(--nav);
  color: var(--white);
}
.ws-project { min-width: 0; text-align: center; }
.ws-project #projectTitle {
  display: block;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-idea {
  display: block;
  font-size: 12px;
  color: rgba(242, 251, 251, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }

.progress-rail {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px 8px;
}
.rail-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.rail-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 0;
}
.rail-step span:last-child { white-space: nowrap; }
.rail-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--white);
  flex-shrink: 0;
}
.rail-step.active { color: var(--navy); }
.rail-step.active .rail-dot {
  border-color: var(--teal);
  background: var(--aqua);
  box-shadow: 0 0 0 4px rgba(0, 179, 179, 0.18);
}
.rail-step.done { color: var(--deep-teal); }
.rail-step.done .rail-dot { background: var(--teal); border-color: var(--deep-teal); }
.rail-detail {
  margin: 6px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--deep-teal);
  min-height: 1.2em;
}

.ws-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  min-height: 0;
}

.chat-pane {
  border-right: 1px solid var(--border);
  background: var(--white);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-log {
  flex: 1;
  overflow: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.bubble p { margin: 0; }
.bubble p + p,
.bubble p + .chat-steps,
.bubble .chat-steps + p,
.bubble .chat-file-hint { margin-top: 0.65em; }
.chat-file-hint {
  font-size: 13px;
  font-weight: 600;
  color: var(--deep-teal);
}
.chat-file-hint button {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--deep-teal);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.bubble strong { font-weight: 700; }
.bubble code {
  font-family: var(--mono);
  font-size: 0.92em;
  padding: 0.05em 0.3em;
  border-radius: 4px;
  background: rgba(16, 42, 53, 0.08);
}
.chat-steps {
  margin: 0.5em 0 0.2em;
  padding-left: 1.3em;
}
.chat-steps li { margin: 0.32em 0; }
.chat-steps li::marker { color: var(--deep-teal); font-weight: 700; }
.file-card { cursor: pointer; }
.product-card .img-wrap.file-icon {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(53, 214, 210, 0.22), transparent 62%),
    var(--ice);
  border-color: var(--border);
  color: var(--navy);
}
.file-glyph {
  width: 78%;
  height: 78%;
  display: block;
  overflow: visible;
  pointer-events: none;
}
.file-glyph .file-sheet {
  fill: var(--white);
  stroke: var(--navy);
  stroke-width: 2.25;
  stroke-linejoin: round;
}
.file-glyph .file-fold {
  fill: var(--soft);
  stroke: var(--navy);
  stroke-width: 2.25;
  stroke-linejoin: round;
}
.file-glyph .file-line-a { fill: var(--teal); }
.file-glyph .file-line-b { fill: var(--aqua); }
.file-glyph .file-line-c { fill: var(--deep-teal); }
.file-glyph .file-badge { fill: var(--navy); }
.file-glyph .file-ext {
  fill: var(--white);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.product-card:hover .file-glyph { transform: scale(1.04); transition: transform 0.2s; }
.bubble.user { align-self: flex-end; background: var(--navy); color: var(--white); }
.bubble.assistant { align-self: flex-start; background: var(--ice); color: var(--navy); border: 1px solid var(--border); }
.status-card {
  align-self: flex-start;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--soft);
  border-radius: 12px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
}
.status-card .spin {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(0, 127, 131, 0.25); border-top-color: var(--teal);
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.suggestions { padding: 8px 12px; border-top: 1px solid var(--border); }
.sug-list { display: flex; flex-wrap: wrap; gap: 6px; }
.sug-chip {
  font-family: var(--font);
  font-size: 12px;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--ice);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--navy);
}
.sug-chip:hover { border-color: var(--teal); color: var(--deep-teal); }

.chat-input-wrap { padding: 10px 12px 12px; border-top: 1px solid var(--border); }
.chat-input-wrap textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-family: var(--sans);
  font-size: 14px;
  resize: none;
  outline: none;
}
.chat-input-wrap textarea:focus { border-color: var(--teal); }
.chat-input-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}
.chat-hint { font-size: 12px; color: var(--muted); }

.card-stage {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}
.stage-filters {
  display: flex;
  gap: 8px;
  padding: 12px 18px 0;
}
.filter-chip {
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.filter-chip.active { background: var(--navy); color: var(--white); border-color: var(--navy); }
.stage-body { flex: 1; overflow: auto; padding: 16px 18px 24px; min-height: 0; }
.stage-body.is-steps {
  overflow: auto;
  padding: 12px 14px 16px;
  display: block;
}
.stage-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 32px;
}

.q-stage-head { margin: 0 0 8px; font-size: 22px; max-width: 40rem; }
.q-stage-sub { margin: 0 0 18px; color: var(--muted); max-width: 40rem; }
.q-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}
.q-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0;
  box-shadow: var(--shadow-1);
  max-width: none;
  min-width: 0;
}
@media (max-width: 860px) {
  .q-grid { grid-template-columns: 1fr; }
}
.q-prompt { font-size: 15px; line-height: 1.5; margin: 0 0 12px; font-weight: 600; }
.q-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.q-opt {
  font-family: var(--sans);
  font-size: 13px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  text-align: left;
  min-height: 40px;
  width: auto;
  max-width: 100%;
}
.q-opt.selected {
  border-color: var(--teal);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--teal);
  font-weight: 700;
}
.q-other {
  margin-top: 10px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--sans);
  font-size: 13px;
  display: none;
}
.q-other.visible { display: block; }
.q-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 0 4px;
  max-width: 40rem;
  background: linear-gradient(180deg, transparent, var(--bg) 24%);
}
.q-actions .btn { flex: 0 1 auto; min-width: 140px; }

.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.shop-toolbar h2 { margin: 0; font-size: 20px; }
.shop-meta { font-size: 13px; color: var(--muted); }
.source-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.source-filters button {
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--navy);
}
.source-filters button.active { background: var(--soft); border-color: var(--teal); color: var(--deep-teal); font-weight: 700; }

.part-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.product-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.product-card:hover { box-shadow: var(--shadow-2); border-color: var(--aqua); }
.product-card.is-flash { animation: partIn 0.6s ease-out; }
.product-card.unresolved { opacity: 0.72; }
.product-card .img-wrap {
  aspect-ratio: 1;
  background: var(--white);
  display: grid;
  place-items: center;
  margin-bottom: 0.6rem;
  border-radius: var(--r1);
  overflow: hidden;
  border: 1px solid var(--soft);
}
.product-card .img-wrap img { width: 100%; height: 100%; object-fit: contain; }
.product-card:hover .img-wrap img { transform: scale(1.04); transition: transform 0.2s; }
.ptype {
  font-size: 0.72rem;
  color: var(--deep-teal);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}
.product-card .ptype { margin-bottom: 0.2rem; }
.product-card .title {
  font-size: 0.92rem;
  line-height: 1.3;
  margin: 0 0 0.25rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card .role { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.product-card .qty-line { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.product-card .price { font-size: 1.15rem; font-weight: 700; color: var(--price); }
.product-card .sub { font-size: 12px; color: var(--muted); }
.sold-chip {
  display: inline-block;
  margin: 8px 0;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
}
.sold-chip.store { background: var(--soft); color: var(--deep-teal); }
.sold-chip.amazon { background: var(--danger-bg); color: var(--danger); }
.sold-chip.none { background: var(--soft); color: var(--muted); }
.card-actions { margin-top: auto; }
.card-actions a {
  font-size: 13px;
  font-weight: 600;
  color: var(--link);
  text-decoration: none;
}
.unavail-note { font-size: 12px; color: var(--muted); margin: 0; }
.product-card.is-pending { cursor: default; opacity: 0.92; }
.product-card.is-pending:hover { box-shadow: none; border-color: var(--border); }
.finding-line { margin: 8px 0 0; font-size: 12px; font-weight: 600; color: var(--deep-teal); }

.skel-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.skel {
  display: block;
  height: 12px;
  border-radius: var(--r1);
  background: linear-gradient(90deg, var(--soft) 25%, #d6f5f4 50%, var(--soft) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
.skel.thumb { width: 100%; aspect-ratio: 1; height: auto; margin-bottom: 10px; }
.skel.w60 { width: 60%; } .skel.w40 { width: 40%; } .skel.w80 { width: 80%; margin-bottom: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes partIn {
  from { opacity: 0.35; box-shadow: 0 0 0 4px rgba(0, 179, 179, 0.25); }
  to { opacity: 1; box-shadow: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.build-graph { position: relative; width: 100%; }
.graph-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.graph-edges path {
  fill: none;
  stroke: var(--teal);
  stroke-width: 1.6;
}
.graph-cols {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px 28px;
  align-items: start;
}
.graph-col { min-width: 0; }
.graph-col h3 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--deep-teal);
}
.graph-nodes {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.graph-node {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow-1);
}
.graph-node:hover { border-color: var(--teal); }
.graph-node.is-done { opacity: 0.55; }
.flow-num {
  flex: 0 0 22px;
  width: 22px; height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
}
.graph-node.is-done .flow-num { background: var(--teal); }
.flow-copy { min-width: 0; flex: 1; }
.flow-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.flow-blurb {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted);
}
.flow-thumbs { display: flex; gap: 4px; margin-top: 6px; }
.flow-thumbs img {
  width: 22px; height: 22px; object-fit: contain;
  border: 1px solid var(--border); border-radius: 5px; background: var(--white);
}
.step-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}
.step-modal.hidden { display: none; }
.step-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 42, 53, 0.45);
}
.step-modal-card {
  position: relative;
  z-index: 1;
  width: min(28rem, 100%);
  background: var(--white);
  border-radius: 16px;
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-3);
}
.flow-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--deep-teal);
}
.step-modal-card h2 { margin: 0 0 8px; font-size: 22px; line-height: 1.25; }
.flow-how { margin: 0 0 12px; font-size: 15px; line-height: 1.45; color: var(--navy); }
.flow-parts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; }
.flow-part {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  background: var(--ice);
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.flow-part img { width: 40px; height: 40px; object-fit: contain; background: var(--white); border-radius: 6px; }
.flow-part span { font-size: 13px; font-weight: 600; }

.brief-page { max-width: 52rem; }
.brief-hero, .brief-panel, .guide-card, .step-card, .sec-head {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-1);
}
.brief-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--deep-teal);
}
.brief-hero h2 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.25;
  font-family: var(--serif);
}
.brief-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.brief-stat {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.brief-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.diff-chip, .tag {
  display: inline-block;
  border: 1px solid var(--teal);
  color: var(--deep-teal);
  background: var(--soft);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  margin: 0;
}
.diff-chip.is-easy { background: var(--soft); }
.diff-chip.is-medium {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: #e8c48a;
}
.diff-chip.is-hard {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #e8b4a0;
}
.brief-summary {
  margin: 0 0 16px;
  line-height: 1.65;
  color: var(--text);
  max-width: 42rem;
}
.brief-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.brief-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.brief-panel { margin: 0; }
.brief-panel h3, .guide-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--navy);
}
.brief-assumptions {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brief-assumptions li {
  position: relative;
  padding-left: 14px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}
.brief-assumptions li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}
.guide-text { white-space: pre-wrap; }
.guide-cursor {
  display: inline-block;
  width: 2px; height: 1em;
  vertical-align: -0.15em;
  margin-left: 2px;
  background: var(--teal);
  animation: guideBlink 0.9s steps(1) infinite;
}
@keyframes guideBlink { 50% { opacity: 0; } }
.guide-steps { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 9px; }
.sec-head {
  background: var(--soft);
  font-weight: 700;
  color: var(--deep-teal);
  padding: 10px 16px;
}
.step-card h4 { margin: 0 0 8px; font-size: 15px; }
.tool-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tool-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r1);
  background: var(--soft);
  color: var(--deep-teal);
}
.tool-tag.soldering { background: var(--warn-bg); color: var(--warn); }
.comp-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.comp-card {
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  min-width: 160px;
  background: var(--ice);
}
.comp-card img { width: 36px; height: 36px; object-fit: contain; }
.comp-card .cn { font-size: 12px; font-weight: 600; }
.comp-card .cr { font-size: 10px; color: var(--muted); }

.parts-sticky-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: var(--white);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(16, 42, 53, 0.08);
}
.parts-sticky-summary { font-weight: 700; color: var(--navy); }

.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(16, 42, 53, 0.45); }
.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--white);
  box-shadow: var(--shadow-3);
  overflow: auto;
  padding: 20px;
}
.drawer-close {
  position: absolute;
  top: 10px; right: 10px;
}
.drawer-panel .img-wrap {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin: 28px 0 16px;
}
.drawer-panel .img-wrap img { width: 100%; height: 100%; object-fit: contain; }
.drawer-panel h2 { margin: 0 0 8px; font-size: 20px; }
.drawer-ids { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.drawer-panel .price { font-size: 1.4rem; font-weight: 700; color: var(--price); margin: 8px 0; }
.drawer-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: var(--white);
  padding: 10px 16px;
  border-radius: var(--r2);
  font-size: 13px;
  z-index: 60;
  border-left: 3px solid var(--teal);
  box-shadow: var(--shadow-2);
}
.toast.is-error { border-left-color: var(--danger); background: #3a1610; }

@media (max-width: 1100px) {
  .graph-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brief-grid { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .ws-body { grid-template-columns: 1fr; }
  .chat-pane {
    min-height: 36vh;
    max-height: 42vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .ws-header { grid-template-columns: 1fr auto; padding: 10px 12px; min-height: auto; }
  .ws-project { grid-column: 1 / -1; text-align: left; order: 3; }
  .logo-mark { display: none; }
  .nav-menu-btn { display: grid; place-items: center; }
  .nav-links {
    display: none;
    position: absolute;
    top: var(--hdr-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 12px 12px;
    background: var(--nav-2);
    box-shadow: var(--shadow-2);
    z-index: 25;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { min-height: var(--tap); }
  .topnav { flex-wrap: wrap; padding: 0 12px; }
  .q-opts { display: flex; }
  .rail-step span:last-child { font-size: 11px; }
  .part-grid { grid-template-columns: 1fr; }
}
