/* BioStudio AI — Lab App Studio */

.las-root,
.las-runner-root {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--app-bg, #f4f7fb);
  color: var(--ink, #172033);
}

.las-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
}
.las-shell.is-open {
  grid-template-columns: 48px 240px minmax(0, 1fr);
}

.las-sidebar-toggle {
  border: 0;
  background: var(--accent, #2f6bff);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 16px 0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.las-sidebar-toggle:hover,
.las-sidebar-toggle:focus-visible {
  background: #1f54d4;
  color: #fff;
}
.las-shell.is-open .las-sidebar-toggle {
  background: #163ea8;
  color: #fff;
}

.las-sidebar {
  min-height: 0;
  overflow: auto;
  padding: 14px 12px;
  border-right: 1px solid var(--border, #d9e0ea);
  background: var(--panel, #fff);
  display: none;
  flex-direction: column;
  gap: 12px;
}
.las-shell.is-open .las-sidebar { display: flex; }

.las-brand {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.las-brand h2 {
  margin: 0;
  font-size: 16px;
}
.las-brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #3d4a5c;
}

.las-new,
.las-search { width: 100%; }
.las-search {
  border: 1px solid var(--border, #d9e0ea);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.las-tabs {
  display: flex;
  gap: 4px;
  padding: 2px;
  border-radius: 10px;
  background: #f3f6fb;
}
.las-tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 12.5px;
  cursor: pointer;
  color: inherit;
}
.las-tab.is-on {
  background: #fff;
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--border, #d9e0ea);
}

.las-tokens {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3fb;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink, #172033);
}

.las-main.is-market { grid-template-columns: minmax(0, 1fr); }
.las-chat-col[hidden] { display: none; }

.las-market {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.las-market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow: auto;
}
.las-market-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border, #d9e0ea);
  border-radius: 12px;
  padding: 14px;
}
.las-market-card h3 { margin: 0; font-size: 15px; }
.las-market-card p { margin: 0; font-size: 13px; }
.las-market-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

.las-app-list { display: flex; flex-direction: column; gap: 4px; }
.las-app-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: inherit;
}
.las-app-row:hover { background: color-mix(in srgb, var(--accent, #2f6bff) 8%, transparent); }
.las-app-row.is-active {
  border-color: color-mix(in srgb, var(--accent, #2f6bff) 40%, var(--border, #d9e0ea));
  background: color-mix(in srgb, var(--accent, #2f6bff) 10%, #fff);
}
.las-app-row-title { font-weight: 600; font-size: 13px; }
.las-app-row-meta { font-size: 11px; color: #3d4a5c; }

.las-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.las-preview-col,
.las-chat-col {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.las-chat-col {
  border-left: 1px solid var(--border, #d9e0ea);
  background: var(--panel, #fff);
}

.las-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #d9e0ea);
  background: var(--panel, #fff);
}
.las-toolbar-title { min-width: 0; }
.las-toolbar-title strong { display: block; font-size: 14px; }
.las-toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.las-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #e8eef6;
}

.las-preview-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.las-host-layer {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: calc(100% - 16px);
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--border, #d9e0ea);
  background: color-mix(in srgb, #fff 92%, transparent);
  box-shadow: 0 6px 18px rgba(23, 32, 51, 0.08);
}
.las-host-layer-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1f2a3d;
  padding: 0 4px;
}

.las-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.las-empty,
.las-busy {
  margin: auto;
  max-width: 520px;
  padding: 32px 20px;
  text-align: center;
}
.las-empty h3 { margin: 0 0 8px; }
.las-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.las-chip {
  border: 1px solid var(--border, #d9e0ea);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-size: 13px;
}
.las-chip:hover { border-color: var(--accent, #2f6bff); }

.las-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border: 3px solid #cdd8ea;
  border-top-color: var(--accent, #2f6bff);
  border-radius: 50%;
  animation: las-spin 0.8s linear infinite;
}
@keyframes las-spin { to { transform: rotate(360deg); } }

.las-error {
  padding: 8px 14px;
  background: #fde8e8;
  color: #9b1c1c;
  font-size: 12.5px;
}

.las-chat-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #d9e0ea);
}
.las-chat-head strong { display: block; }
.las-chat-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.las-msg {
  padding: 8px 10px;
  border-radius: 10px;
  background: #f3f6fb;
  font-size: 13px;
}
.las-msg[data-role="user"] { background: color-mix(in srgb, var(--accent, #2f6bff) 12%, #fff); }
.las-msg[data-role="assistant"] { background: #eefaf4; }
.las-msg strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.las-msg p { margin: 0; white-space: pre-wrap; }

.las-chat-form,
.las-runner-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #d9e0ea);
}
.las-chat-form textarea,
.las-runner-form input {
  flex: 1 1 100%;
  min-width: 0;
  border: 1px solid var(--border, #d9e0ea);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  resize: vertical;
}
.las-runner-form input { flex: 1 1 auto; }

.las-chat-form {
  flex-wrap: wrap;
}
.las-runner-form.is-drop,
.las-chat-form.is-drop {
  outline: 2px dashed var(--accent, #2f6bff);
  outline-offset: -4px;
  background: color-mix(in srgb, var(--accent, #2f6bff) 8%, #fff);
}
.las-chat-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 100%;
}
.las-chat-actions .las-btn-primary { margin-left: auto; }
.las-attach-btn { flex: 0 0 auto; }
.las-attach-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px;
}
.las-chip-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  border: 1px solid var(--border, #d9e0ea);
  background: #f3f6fb;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
}
.las-chip-file button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0 2px;
  color: inherit;
  font-size: 14px;
  line-height: 1;
}
.las-drop-hint { padding: 0 12px 4px; }
.las-msg-files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

.las-btn {
  border: 1px solid var(--border, #d9e0ea);
  background: #fff;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12.5px;
  cursor: pointer;
  color: inherit;
}
.las-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.las-btn-primary {
  background: var(--accent, #2f6bff);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.las-btn-danger { color: #9b1c1c; }
.las-muted { color: #3d4a5c; font-size: 12px; }

.las-runner {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 220px;
}
.las-runner-preview { min-height: 0; background: #e8eef6; }
.las-runner-chat {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border, #d9e0ea);
  background: var(--panel, #fff);
}
.las-runner-status {
  padding: 8px 12px;
  font-size: 12px;
  color: #3d4a5c;
  border-bottom: 1px solid var(--border, #d9e0ea);
}
.las-runner-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.las-focus {
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border, #d9e0ea);
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 1 220px;
  min-height: 0;
  overflow: auto;
}
.las-focus-title {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #1f2a3d;
}
.las-focus-files { display: flex; flex-wrap: wrap; gap: 6px; }
.las-focus-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border, #d9e0ea);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  color: #1f2a3d;
  background: #fff;
}
.las-focus-file.is-on {
  border-color: var(--accent, #2f6bff);
  background: #e8efff;
  font-weight: 600;
}
.las-source {
  max-height: 140px;
  overflow: auto;
  border: 1px solid var(--border, #d9e0ea);
  border-radius: 8px;
  background: #0f1724;
  color: #e8eef8;
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.las-src-line {
  display: flex;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 1px 8px;
  cursor: pointer;
  font: inherit;
}
.las-src-line:hover { background: rgba(47, 107, 255, 0.18); }
.las-src-line.is-on { background: #2f6bff; color: #fff; }
.las-src-n {
  flex: 0 0 28px;
  color: #9db0c9;
  text-align: right;
}
.las-src-line.is-on .las-src-n { color: #fff; }
.las-src-line code {
  white-space: pre;
  font: inherit;
}
.las-focus-note { display: flex; gap: 6px; }
.las-focus-note input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border, #d9e0ea);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
}

@media (max-width: 900px) {
  .las-shell,
  .las-shell.is-open { grid-template-columns: 48px 1fr; }
  .las-shell.is-open .las-sidebar { display: none; }
  .las-main { grid-template-columns: 1fr; }
  .las-chat-col { border-left: 0; border-top: 1px solid var(--border, #d9e0ea); max-height: 42vh; }
}

/* ── Build overlay: animated feature ads + fake step progress ─────────────── */
.las-stage-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 520px at 50% -10%, rgba(47, 107, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #f7f9fc 0%, #eef3fb 100%);
  opacity: 0;
  transition: opacity 0.32s ease;
}
.las-stage-overlay[hidden] { display: none !important; }
.las-stage-overlay.is-on { opacity: 1; }

.las-stage-card {
  width: min(560px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 28px 28px 24px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid #dde5f0;
  box-shadow: 0 24px 60px rgba(11, 28, 56, 0.16);
  text-align: center;
}

/* Bubbling flask */
.las-flask { position: relative; width: 96px; height: 96px; margin: 0 auto 18px; }
.las-flask-body {
  position: absolute; left: 18px; bottom: 6px; width: 60px; height: 58px;
  border: 3px solid #1d4ed8; border-radius: 0 0 30px 30px; border-top: 0;
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.12), rgba(47, 107, 255, 0.42));
  overflow: hidden;
}
.las-flask-neck {
  position: absolute; left: 40px; top: 12px; width: 16px; height: 28px;
  border-left: 3px solid #1d4ed8; border-right: 3px solid #1d4ed8;
}
/* Rim, so the neck reads as joined to the flask rather than floating above it. */
.las-flask-neck::before {
  content: "";
  position: absolute; left: -7px; top: -3px; width: 30px; height: 3px;
  border-radius: 2px; background: #1d4ed8;
}
.las-bubble {
  position: absolute; left: calc(28px + (var(--i) * 8px)); bottom: 10px;
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(29, 78, 216, 0.55);
  animation: las-bubble-rise 2.6s ease-in infinite;
  animation-delay: calc(var(--i) * 0.32s);
  opacity: 0;
}
@keyframes las-bubble-rise {
  0% { transform: translateY(0) scale(0.5); opacity: 0; }
  25% { opacity: 0.9; }
  100% { transform: translateY(-46px) scale(1.05); opacity: 0; }
}

/* Rotating feature ads */
.las-ad { min-height: 148px; }
.las-ad.is-in { animation: las-ad-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes las-ad-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.las-ad-kicker {
  margin: 0 0 6px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: #1d4ed8;
}
.las-ad-title { margin: 0 0 8px; font-size: 21px; line-height: 1.2; letter-spacing: -0.03em; color: #0b1c38; }
.las-ad-body { margin: 0 0 14px; font-size: 13.5px; line-height: 1.55; color: #334155; }
.las-ad-dots { display: flex; gap: 5px; justify-content: center; margin-bottom: 18px; }
.las-ad-dot { width: 6px; height: 6px; border-radius: 50%; background: #cdd8ea; transition: all 0.25s ease; }
.las-ad-dot.is-on { background: #1d4ed8; width: 16px; border-radius: 99px; }

/* Progress */
.las-progress { text-align: left; }
.las-progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.las-progress-now { font-size: 13px; color: #0b1c38; }
.las-progress-pct { font-size: 12px; color: #475569; font-variant-numeric: tabular-nums; }
.las-progress-detail { margin: 4px 0 10px; font-size: 12px; color: #475569; }
.las-progress-track { height: 8px; border-radius: 99px; background: #e8eef5; overflow: hidden; }
.las-progress-fill {
  height: 100%; width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #2f6bff, #7c3aed);
  background-size: 200% 100%;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  animation: las-fill-shimmer 2.2s linear infinite;
}
@keyframes las-fill-shimmer { to { background-position: 200% 0; } }
.las-progress-steps {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 5px;
  /* Tall enough for the 8-step build list; a clipped last step reads as broken. */
  max-height: 200px; overflow: auto;
}
.las-progress-step { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #94a3b8; }
.las-progress-step.is-done { color: #475569; }
.las-progress-step.is-on { color: #0b1c38; font-weight: 650; }
.las-progress-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #cdd8ea; flex: 0 0 auto;
}
.las-progress-step.is-done .las-progress-dot { background: #22c55e; }
.las-progress-step.is-on .las-progress-dot {
  background: #1d4ed8;
  animation: las-dot-pulse 1.2s ease-in-out infinite;
}
@keyframes las-dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(29, 78, 216, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(29, 78, 216, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .las-bubble, .las-progress-fill, .las-progress-step.is-on .las-progress-dot { animation: none; }
  .las-ad.is-in { animation-duration: 0.01s; }
}

/* ── Persistent preview hosts + visual section picking ────────────────────── */
.las-toolbar-host[hidden],
.las-stage[hidden],
.las-error-host[hidden],
.las-market-host[hidden] { display: none !important; }
.las-market-host { flex: 1; min-height: 0; overflow: auto; }

.las-preview-host,
.las-stage-empty { position: absolute; inset: 0; }
.las-preview-host[hidden],
.las-stage-empty[hidden] { display: none !important; }
.las-stage-empty { display: flex; overflow: auto; }

.las-preview-wrap.is-picking { outline: 2px solid var(--accent, #2f6bff); outline-offset: -2px; }
.las-preview-wrap.is-picking::after {
  content: "Click the part you want to change";
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 5;
  padding: 6px 12px;
  border-radius: 99px;
  background: #0b1c38;
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  pointer-events: none;
  box-shadow: 0 8px 22px rgba(11, 28, 56, 0.3);
}

.las-btn.las-pick-btn.is-on {
  background: var(--accent, #2f6bff);
  border-color: var(--accent, #2f6bff);
  color: #fff;
  animation: las-pick-pulse 1.4s ease-in-out infinite;
}
@keyframes las-pick-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 107, 255, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(47, 107, 255, 0); }
}

.las-focus-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.las-focus-hint {
  margin: 4px 0 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted, #5b6b80);
}
.las-btn.las-btn-mini { padding: 3px 8px; font-size: 11px; }
.las-note-chip {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  border-left: 3px solid var(--accent, #2f6bff);
  line-height: 1.45;
  text-align: left;
}

/* ── Scoped-edit progress: the preview stays visible, so progress is inline ── */
.las-edit-strip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 20;
  height: 4px;
  background: rgba(47, 107, 255, 0.16);
  pointer-events: none;
}
.las-edit-strip[hidden] { display: none !important; }
.las-edit-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2f6bff, #7c3aed);
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.las-btn.is-progress {
  position: relative;
  overflow: hidden;
  cursor: progress;
  opacity: 1;
  border-color: var(--accent, #2f6bff);
  color: #fff;
  background: #23407f;
}
.las-btn-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--accent, #2f6bff);
  transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.las-btn-label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
/* Tabular figures and a floor width, so the button does not twitch as the
   percentage counts up. */
.las-btn-pct {
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  min-width: 3ch;
  text-align: right;
}
