:root {
  color-scheme: dark;
  --lab-bg: #020817;
  --lab-panel: rgba(4, 15, 40, 0.94);
  --lab-panel-light: rgba(8, 24, 56, 0.96);
  --lab-line: rgba(76, 195, 255, 0.23);
  --lab-line-strong: rgba(76, 195, 255, 0.52);
  --lab-cyan: #4cc3ff;
  --lab-purple: #d023e8;
  --lab-violet: #9e7bff;
  --lab-green: #46e6a8;
  --lab-gold: #ffd166;
  --lab-red: #fb7185;
  --lab-text: #f5f8ff;
  --lab-muted: #aab7d1;
  --lab-muted-light: #d0d8e8;
  --lab-radius: 18px;
  --lab-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--lab-bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--lab-text);
  background:
    linear-gradient(rgba(2, 8, 23, 0.58), rgba(2, 8, 23, 0.72)),
    url("/img/tool-background-1.png") center top / cover fixed,
    var(--lab-bg);
  font-family: Inter, Arial, Helvetica, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 8%, rgba(76, 195, 255, 0.1), transparent 30%),
    radial-gradient(circle at 88% 5%, rgba(208, 35, 232, 0.11), transparent 34%);
}

button,
input,
textarea,
select { font: inherit; }

button { color: inherit; }

:focus-visible {
  outline: 3px solid rgba(76, 195, 255, 0.68);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.app-shell {
  width: min(1580px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 0;
}

.lab-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid rgba(76, 195, 255, 0.25);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(5, 15, 39, 0.98), rgba(13, 7, 32, 0.95));
  box-shadow: var(--lab-shadow);
  isolation: isolate;
}

.lab-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(3, 12, 33, 0.98), rgba(5, 12, 31, 0.88) 58%, rgba(28, 7, 47, 0.8)),
    radial-gradient(circle at 88% 22%, rgba(208, 35, 232, 0.2), transparent 34%);
}

.lab-hero::after {
  content: "";
  position: absolute;
  right: -92px;
  bottom: -165px;
  z-index: -1;
  width: 370px;
  height: 370px;
  border: 1px solid rgba(76, 195, 255, 0.2);
  border-radius: 50%;
  box-shadow:
    0 0 0 48px rgba(76, 195, 255, 0.025),
    0 0 0 96px rgba(208, 35, 232, 0.018);
}

.course-topbar {
  min-height: 76px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(76, 195, 255, 0.18);
  background: rgba(2, 8, 23, 0.9);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.course-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.course-logo {
  width: 200px;
  height: auto;
  display: block;
  object-fit: contain;
}

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

.course-brand-text span {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.course-brand-text small {
  color: var(--lab-cyan);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  line-height: 1.35;
  text-transform: uppercase;
}

.lab-header-actions,
.session-actions,
.composer-actions,
.blueprint-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

.return-lab-button,
.model-badge {
  min-height: 38px;
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(76, 195, 255, 0.38);
  border-radius: 10px;
  color: #e7f7ff;
  background: rgba(5, 19, 43, 0.78);
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.return-lab-button:hover { border-color: var(--lab-cyan); }
.return-lab-icon { color: var(--lab-cyan); font-size: 14px; }

.model-badge {
  border-color: rgba(70, 230, 168, 0.5);
  color: #eafff7;
}

.model-badge-dot,
.save-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--lab-gold);
  box-shadow: 0 0 11px rgba(255, 209, 102, 0.78);
}

.model-badge.connected .model-badge-dot,
.save-dot {
  background: var(--lab-green);
  box-shadow: 0 0 11px rgba(70, 230, 168, 0.78);
}

.model-badge.failed {
  border-color: rgba(251, 113, 133, 0.48);
  color: #ffe7eb;
}

.model-badge.failed .model-badge-dot {
  background: var(--lab-red);
  box-shadow: 0 0 11px rgba(251, 113, 133, 0.7);
}

.model-name { font-weight: 900; }

.hero-main {
  min-height: 170px;
  padding: 30px clamp(28px, 3vw, 46px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 350px);
  align-items: center;
  gap: 38px;
}

.hero-copy-block h1 {
  margin: 0;
  color: #fff;
  font-family: Montserrat, Inter, sans-serif;
  font-size: clamp(34px, 4.1vw, 55px);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1.02;
}

.gradient-word {
  color: transparent;
  background: linear-gradient(100deg, #59d9ff 0%, #4b91ff 48%, #e057e5 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-copy-block p {
  max-width: 830px;
  margin: 15px 0 0;
  color: #c4cee2;
  font-size: 16px;
  line-height: 1.68;
}

.hero-workflow {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  list-style: none;
}

.hero-workflow li {
  min-height: 48px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(142, 102, 197, 0.28);
  border-radius: 11px;
  color: #dbe2f2;
  background: rgba(6, 10, 29, 0.74);
  font-size: 12px;
  font-weight: 800;
}

.hero-workflow li span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(76, 195, 255, 0.48);
  border-radius: 8px;
  color: #8ee1ff;
  background: rgba(13, 42, 70, 0.72);
  font-size: 10px;
}

.session-bar {
  min-height: 64px;
  margin-bottom: 14px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--lab-line);
  border-radius: 15px;
  background: rgba(3, 14, 34, 0.94);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.session-meta {
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-meta > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.session-meta strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta span:not(.save-dot) {
  color: var(--lab-muted);
  font-size: 10px;
  line-height: 1.45;
}

.handoff-select,
.lab-button {
  min-height: 38px;
  border: 1px solid rgba(76, 195, 255, 0.32);
  border-radius: 9px;
  color: #dce9f8;
  background: rgba(5, 20, 46, 0.9);
  font-size: 10px;
  font-weight: 800;
}

.handoff-select {
  width: 190px;
  padding: 8px 30px 8px 11px;
}

.lab-button {
  padding: 8px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.lab-button:hover:not(:disabled) {
  border-color: var(--lab-cyan);
  transform: translateY(-1px);
}

.lab-button:disabled,
.handoff-select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.lab-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lab-button.subtle { background: rgba(255, 255, 255, 0.025); }

.lab-button.green {
  border-color: rgba(70, 230, 168, 0.42);
  background: rgba(7, 48, 45, 0.35);
}

.lab-button.primary {
  border-color: rgba(132, 106, 255, 0.56);
  color: #fff;
  background: linear-gradient(105deg, rgba(185, 37, 213, 0.95), rgba(63, 174, 232, 0.94) 130%);
  box-shadow: 0 8px 24px rgba(158, 54, 218, 0.16);
}

.lab-button.danger {
  border-color: rgba(251, 113, 133, 0.45);
  background: rgba(105, 23, 42, 0.48);
}

.workspace-grid {
  height: clamp(650px, 72vh, 820px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(285px, 315px) minmax(470px, 1fr) minmax(390px, 455px);
  align-items: stretch;
  gap: 14px;
}

.lab-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--lab-line);
  border-radius: var(--lab-radius);
  background: var(--lab-panel);
  box-shadow: var(--lab-shadow);
}

.panel-header {
  min-height: 68px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(76, 195, 255, 0.19);
  background: rgba(8, 22, 51, 0.88);
}

.panel-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.panel-title > div { min-width: 0; }

.panel-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(76, 195, 255, 0.38);
  border-radius: 10px;
  color: #8de1ff;
  background: rgba(11, 52, 82, 0.46);
  font-size: 15px;
  font-weight: 900;
}

.panel-icon.sparkle { color: #bbf8ff; }
.panel-icon.blueprint-icon { color: #dcb9ff; border-color: rgba(208, 35, 232, 0.45); background: rgba(68, 22, 86, 0.42); }

.panel-title h2 {
  margin: 0;
  font: 800 14px/1.2 Montserrat, Inter, sans-serif;
}

.panel-title p {
  margin: 3px 0 0;
  color: var(--lab-muted);
  font-size: 10px;
  line-height: 1.35;
}

.stage-badge {
  max-width: 130px;
  padding: 6px 9px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid rgba(160, 107, 255, 0.36);
  border-radius: 999px;
  color: #dfceff;
  background: rgba(101, 52, 153, 0.22);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stage-badge.purple { border-color: rgba(208, 35, 232, 0.4); }

.panel-scroll {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  scrollbar-color: var(--lab-cyan) rgba(255, 255, 255, 0.03);
  scrollbar-width: thin;
}

.source-body,
.blueprint-body { padding: 15px; }

.readiness-card {
  padding: 13px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(76, 195, 255, 0.22);
  border-radius: 13px;
  background: rgba(2, 11, 28, 0.7);
}

.readiness-ring {
  --readiness: 0;
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--lab-purple) calc(var(--readiness) * 1%), rgba(102, 118, 153, 0.14) 0);
}

.readiness-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: inherit;
  background: #07132c;
}

.readiness-ring strong {
  position: relative;
  font-size: 14px;
}

.readiness-card > div:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.readiness-card > div:last-child strong { font-size: 11px; }
.readiness-card > div:last-child span { color: var(--lab-muted); font-size: 10px; line-height: 1.45; }

.invariant-card {
  margin-top: 10px;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(70, 230, 168, 0.3);
  border-radius: 12px;
  color: #cffced;
  background: linear-gradient(130deg, rgba(6, 62, 56, 0.35), rgba(4, 27, 47, 0.45));
}

.invariant-card > span { color: var(--lab-green); }
.invariant-card p { margin: 0; font-size: 10px; line-height: 1.55; }

.section-label {
  margin: 16px 0 8px;
  color: #8492ac;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.phase-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  list-style: none;
}

.phase-list li {
  min-height: 38px;
  padding: 8px 9px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(96, 115, 151, 0.12);
  border-radius: 9px;
  color: #8290aa;
  background: rgba(8, 21, 45, 0.55);
  font-size: 10px;
  font-weight: 700;
}

.phase-list li > span {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(116, 133, 167, 0.2);
  border-radius: 7px;
  font-size: 8px;
}

.phase-list li.active,
.phase-list li.complete {
  color: #e9f8ff;
  border-color: rgba(76, 195, 255, 0.36);
  background: rgba(13, 54, 87, 0.42);
}

.phase-list li.active > span,
.phase-list li.complete > span { color: #8ce3ff; border-color: rgba(76, 195, 255, 0.48); }
.phase-list li.complete::after { content: "✓"; margin-left: auto; color: var(--lab-green); }

.source-summary { display: grid; gap: 8px; }

.source-item {
  padding: 10px;
  border: 1px solid rgba(76, 195, 255, 0.14);
  border-radius: 10px;
  background: rgba(2, 11, 28, 0.56);
}

.source-item span {
  display: block;
  margin-bottom: 4px;
  color: #72d6ff;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.source-item p {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  color: #d4dced;
  font-size: 10px;
  line-height: 1.48;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.panel-footer {
  min-height: 58px;
  margin-top: auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid rgba(76, 195, 255, 0.15);
  background: rgba(3, 12, 29, 0.84);
}

.source-panel .panel-footer .lab-button { width: 100%; }

.chat-log {
  min-height: 0;
  max-height: none;
  padding: 17px;
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-color: var(--lab-cyan) rgba(255, 255, 255, 0.03);
  scrollbar-width: thin;
}

.chat-empty {
  min-height: 330px;
  display: grid;
  place-items: center;
  text-align: center;
}

.chat-empty > div { max-width: 430px; }

.chat-empty-mark {
  width: 54px;
  height: 54px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(208, 35, 232, 0.4);
  border-radius: 16px;
  color: #e69cff;
  background: rgba(78, 25, 100, 0.34);
  font-size: 22px;
}

.chat-empty h3 { margin: 0; font-size: 15px; }
.chat-empty p { margin: 8px 0 0; color: var(--lab-muted); font-size: 11px; line-height: 1.6; }

.message-row { display: flex; align-items: flex-start; gap: 9px; }
.message-row.user { flex-direction: row-reverse; }

.message-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(76, 195, 255, 0.38);
  border-radius: 9px;
  color: #9fe8ff;
  background: rgba(10, 48, 76, 0.5);
  font-size: 9px;
  font-weight: 900;
}

.message-row.user .message-avatar {
  color: #efc5ff;
  border-color: rgba(208, 35, 232, 0.4);
  background: rgba(74, 24, 94, 0.46);
}

.message-bubble {
  max-width: min(86%, 680px);
  padding: 12px 14px;
  border: 1px solid rgba(76, 195, 255, 0.2);
  border-radius: 12px;
  color: #dce5f5;
  background: rgba(7, 25, 57, 0.86);
  font-size: 11px;
  line-height: 1.58;
  white-space: pre-wrap;
}

.message-row.user .message-bubble {
  border-color: rgba(208, 35, 232, 0.24);
  background: rgba(43, 16, 65, 0.68);
}

.message-bubble time {
  display: block;
  margin-top: 7px;
  color: #75849e;
  font-size: 8px;
}

.quick-actions {
  padding: 0 15px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.quick-chip {
  min-height: 31px;
  padding: 7px 10px;
  border: 1px solid rgba(76, 195, 255, 0.2);
  border-radius: 999px;
  color: #b9c6d9;
  background: rgba(9, 25, 54, 0.68);
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
}

.quick-chip:hover:not(:disabled) { color: #fff; border-color: var(--lab-cyan); }
.quick-chip:disabled { cursor: not-allowed; opacity: 0.4; }
.quick-chip.primary-chip { color: #f0c9ff; border-color: rgba(208, 35, 232, 0.34); }

.composer {
  margin-top: auto;
  padding: 13px;
  border-top: 1px solid rgba(76, 195, 255, 0.16);
  background: rgba(3, 12, 29, 0.88);
}

.composer textarea {
  width: 100%;
  min-height: 86px;
  max-height: 190px;
  padding: 12px 13px;
  resize: vertical;
  border: 1px solid rgba(76, 195, 255, 0.3);
  border-radius: 11px;
  outline: 0;
  color: #f3f7ff;
  background: rgba(2, 10, 25, 0.9);
  font-size: 11px;
  line-height: 1.5;
}

.composer textarea:focus { border-color: var(--lab-cyan); box-shadow: 0 0 0 3px rgba(76, 195, 255, 0.07); }
.composer textarea:disabled { opacity: 0.56; }

.composer-footer {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-footer > span { color: #7f8da5; font-size: 9px; line-height: 1.4; }

.button-spinner {
  width: 12px;
  height: 12px;
  display: none;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.lab-button.is-busy .button-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.blueprint-state {
  padding: 12px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: 11px;
  color: #f5dda0;
  background: rgba(66, 46, 12, 0.18);
  font-size: 10px;
  line-height: 1.55;
}

.blueprint-state.ready {
  color: #c9ffeb;
  border-color: rgba(70, 230, 168, 0.32);
  background: rgba(11, 70, 56, 0.23);
}

.blueprint-meta {
  margin: 12px 0;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  border: 1px solid rgba(208, 35, 232, 0.22);
  border-radius: 12px;
  background: rgba(39, 14, 57, 0.42);
}

.blueprint-meta div { min-width: 0; }
.blueprint-meta span { display: block; color: #a990bb; font-size: 8px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.blueprint-meta strong { display: block; margin-top: 3px; overflow: hidden; color: #f0e6f7; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.blueprint-steps {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  list-style: none;
  counter-reset: funnel-step;
}

.blueprint-step {
  position: relative;
  padding: 11px 11px 11px 44px;
  border: 1px solid rgba(76, 195, 255, 0.18);
  border-radius: 11px;
  background: rgba(3, 14, 34, 0.78);
  counter-increment: funnel-step;
}

.blueprint-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 21px;
  bottom: -10px;
  width: 1px;
  height: 10px;
  background: linear-gradient(var(--lab-cyan), var(--lab-purple));
}

.step-number {
  position: absolute;
  top: 11px;
  left: 10px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(76, 195, 255, 0.42);
  border-radius: 8px;
  color: #91e3ff;
  background: rgba(12, 49, 79, 0.56);
  font-size: 8px;
  font-weight: 900;
}

.step-topline { display: flex; justify-content: space-between; gap: 8px; }
.step-topline strong { color: #eef4ff; font-size: 11px; }
.step-type { color: #caa4ff; font-size: 8px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }
.blueprint-step p { margin: 5px 0 0; color: #aebbd0; font-size: 9px; line-height: 1.48; }
.step-cta { color: #92e8ca !important; }

.blueprint-details { margin-top: 14px; display: grid; gap: 10px; }

.detail-group {
  padding: 11px;
  border: 1px solid rgba(99, 117, 151, 0.16);
  border-radius: 11px;
  background: rgba(2, 11, 28, 0.55);
}

.detail-group h3 {
  margin: 0 0 7px;
  color: #82ddff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-group ul { margin: 0; padding-left: 16px; color: #b8c4d8; font-size: 9px; line-height: 1.55; }
.detail-group li + li { margin-top: 4px; }

.blueprint-footer { flex-wrap: wrap; }
.blueprint-footer .lab-button { flex: 1 1 auto; }
.blueprint-footer .primary { flex-basis: 100%; }

.course-footer {
  margin-top: 30px;
  padding: 35px 20px 45px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(76, 195, 255, 0.14);
  color: var(--lab-muted);
  background: transparent;
  text-align: center;
}

.course-footer img { width: 170px; height: auto; object-fit: contain; }

.course-footer p {
  margin: 3px 0 0;
  color: var(--lab-text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.course-footer span { font-size: 11px; line-height: 1.5; }

.course-footer .footer-copyright {
  color: var(--lab-muted);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.lab-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(76, 195, 255, 0.34);
  border-radius: 17px;
  color: var(--lab-text);
  background: #071126;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.72);
}

.lab-dialog.wide { width: min(920px, calc(100vw - 28px)); }
.lab-dialog::backdrop { background: rgba(1, 5, 15, 0.84); backdrop-filter: blur(7px); }

.dialog-header {
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(76, 195, 255, 0.18);
  background: rgba(5, 18, 42, 0.96);
}

.dialog-header h2 { margin: 0; font: 800 17px/1.25 Montserrat, Inter, sans-serif; }
.dialog-header p { margin: 6px 0 0; color: var(--lab-muted); font-size: 10px; line-height: 1.5; }

.icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  color: #c9d3e4;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-size: 21px;
}

.dialog-body { max-height: calc(100vh - 155px); padding: 20px; overflow: auto; }
.source-detail { display: grid; gap: 14px; }

.source-detail-section {
  padding: 14px;
  border: 1px solid rgba(76, 195, 255, 0.15);
  border-radius: 12px;
  background: rgba(2, 11, 28, 0.58);
}

.source-detail-section h3 { margin: 0 0 8px; color: #7edcff; font-size: 11px; }
.source-detail-section p { margin: 0; color: #c4cede; font-size: 10px; line-height: 1.6; white-space: pre-wrap; }
.source-detail-section ul { margin: 0; padding-left: 18px; color: #c4cede; font-size: 10px; line-height: 1.6; }

.dialog-actions { padding: 16px 20px 20px; display: flex; justify-content: flex-end; gap: 9px; }

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(70, 230, 168, 0.42);
  border-radius: 11px;
  color: #dcfff2;
  background: rgba(5, 43, 39, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  font-size: 10px;
  font-weight: 700;
  transition: opacity 200ms ease, transform 200ms ease;
}

.toast.is-error { color: #ffe3e8; border-color: rgba(251, 113, 133, 0.42); background: rgba(69, 17, 33, 0.96); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }

@media (max-width: 1280px) {
  .workspace-grid { height: auto; grid-template-columns: minmax(275px, 330px) minmax(480px, 1fr); }
  .source-panel,
  .chat-panel { height: 680px; }
  .blueprint-panel { height: 680px; min-height: 0; grid-column: 1 / -1; }
  .blueprint-body { max-height: none; }
  .blueprint-footer .primary { flex-basis: auto; }
}

@media (max-width: 1020px) {
  .course-topbar { align-items: flex-start; }
  .lab-header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .session-bar { align-items: flex-start; flex-direction: column; }
  .session-actions { width: 100%; flex-wrap: wrap; }
  .session-meta { width: 100%; }
  .workspace-grid { grid-template-columns: 1fr; }
  .source-panel,
  .chat-panel,
  .blueprint-panel { height: 650px; min-height: 0; grid-column: auto; }
}

@media (max-width: 900px) {
  .app-shell { width: min(100% - 22px, 1580px); padding-top: 11px; }
  .course-topbar { flex-direction: column; align-items: stretch; }
  .lab-header-actions { justify-content: flex-start; }
  .hero-main { grid-template-columns: 1fr; gap: 22px; padding: 27px 25px; }
  .hero-workflow { max-width: 520px; }
}

@media (max-width: 720px) {
  .course-brand { align-items: flex-start; }
  .course-logo { width: 170px; }
  .course-brand-text span { font-size: 14px; }
  .model-name { display: none; }
  .session-actions > * { flex: 1 1 180px; }
  .handoff-select { width: auto; }
  .composer-footer { align-items: stretch; flex-direction: column; }
  .composer-actions { width: 100%; }
  .composer-actions .lab-button { flex: 1 1 0; }
}

@media (max-width: 560px) {
  .app-shell { width: min(100% - 14px, 1580px); padding-top: 7px; }
  .course-topbar { padding: 11px 13px; }
  .course-brand { gap: 10px; }
  .course-logo { width: 148px; }
  .course-brand-text small { font-size: 8px; }
  .lab-header-actions > * { flex: 1 1 auto; }
  .hero-main { padding: 25px 18px; }
  .hero-copy-block h1 { font-size: 36px; }
  .hero-copy-block p { font-size: 13px; }
  .hero-workflow { grid-template-columns: 1fr; }
  .workspace-grid { gap: 11px; }
  .source-panel,
  .chat-panel,
  .blueprint-panel { min-height: 620px; }
  .panel-header { align-items: flex-start; }
  .panel-title p { display: none; }
  .chat-log { padding: 13px; }
  .message-bubble { max-width: calc(100% - 39px); }
  .blueprint-meta { grid-template-columns: 1fr; }
  .blueprint-footer .lab-button { flex-basis: 100%; }
  .course-footer { padding-inline: 12px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .lab-button { width: 100%; }
}
