: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-cyan: #4cc3ff;
  --lab-purple: #d023e8;
  --lab-violet: #9e7bff;
  --lab-green: #46e6a8;
  --lab-gold: #ffd166;
  --lab-red: #fb7185;
  --lab-text: #f5f8ff;
  --lab-muted: #aab7d1;
  --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; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(76, 195, 255, 0.68); outline-offset: 3px; }

.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, .studio-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: 850px; 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(690px, 72vh, 860px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 330px) minmax(440px, 1fr) minmax(440px, 500px);
  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.studio-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; }
.navigator-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; }

.guardrail-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)); }
.guardrail-card > span { color: var(--lab-green); }
.guardrail-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; }

.step-list { margin: 0; padding: 0; display: grid; gap: 7px; list-style: none; }
.step-button { width: 100%; min-height: 52px; padding: 9px; display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: start; gap: 9px; border: 1px solid rgba(96, 115, 151, 0.15); border-radius: 10px; color: #9eacc1; background: rgba(8, 21, 45, 0.55); cursor: pointer; text-align: left; }
.step-button:hover { color: #fff; border-color: rgba(76, 195, 255, 0.38); }
.step-button.selected { color: #edf9ff; border-color: rgba(76, 195, 255, 0.55); background: linear-gradient(120deg, rgba(11, 58, 91, 0.62), rgba(43, 18, 68, 0.48)); box-shadow: inset 3px 0 0 var(--lab-cyan); }
.step-number { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(76, 195, 255, 0.38); border-radius: 7px; color: #86ddff; font-size: 8px; font-weight: 900; }
.step-copy { min-width: 0; }
.step-copy strong { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.step-copy small { display: block; margin-top: 3px; overflow: hidden; color: #7786a0; font-size: 8px; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.step-copy em { display: inline-block; margin-top: 5px; padding: 3px 6px; border-radius: 999px; color: #cab0e5; background: rgba(123, 70, 164, 0.18); font-size: 7px; font-style: normal; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }

.mode-section { margin-top: 4px; }
.mode-recommendation { margin-bottom: 8px; padding: 9px 10px; border: 1px solid rgba(255, 209, 102, 0.25); border-radius: 9px; color: #f0d99c; background: rgba(68, 47, 12, 0.18); font-size: 9px; line-height: 1.45; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.mode-card { min-height: 78px; padding: 9px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; border: 1px solid rgba(76, 195, 255, 0.17); border-radius: 10px; color: #b9c5d7; background: rgba(3, 14, 34, 0.72); cursor: pointer; text-align: left; }
.mode-card:hover { border-color: rgba(76, 195, 255, 0.46); }
.mode-card.selected { color: #fff; border-color: rgba(208, 35, 232, 0.5); background: linear-gradient(135deg, rgba(75, 24, 97, 0.5), rgba(11, 48, 76, 0.48)); box-shadow: inset 0 0 0 1px rgba(76, 195, 255, 0.12); }
.mode-card span { font-size: 9px; font-weight: 900; }
.mode-card small { color: #8190a8; font-size: 8px; line-height: 1.35; }

.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); }
.navigator-panel .panel-footer .lab-button { width: 100%; }

.selection-banner { min-height: 56px; padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(76, 195, 255, 0.14); background: linear-gradient(90deg, rgba(9, 42, 70, 0.45), rgba(50, 16, 69, 0.35)); }
.selection-banner > div { min-width: 0; }
.selection-banner span:first-child { display: block; color: #75d8ff; font-size: 8px; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.selection-banner strong { display: block; margin-top: 2px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.selection-mode { flex: 0 0 auto; padding: 5px 8px; border: 1px solid rgba(208, 35, 232, 0.34); border-radius: 999px; color: #e1c5f1 !important; background: rgba(87, 33, 105, 0.26); font-size: 8px !important; font-weight: 900; text-transform: uppercase; }

.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,.03); scrollbar-width: thin; }
.chat-empty { min-height: 320px; 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,.4); border-radius: 16px; color: #e69cff; background: rgba(78,25,100,.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,.38); border-radius: 9px; color: #9fe8ff; background: rgba(10,48,76,.5); font-size: 9px; font-weight: 900; }
.message-row.user .message-avatar { color: #efc5ff; border-color: rgba(208,35,232,.4); background: rgba(74,24,94,.46); }
.message-bubble { max-width: min(86%,680px); padding: 12px 14px; border: 1px solid rgba(76,195,255,.2); border-radius: 12px; color: #dce5f5; background: rgba(7,25,57,.86); font-size: 11px; line-height: 1.58; white-space: pre-wrap; }
.message-row.user .message-bubble { border-color: rgba(208,35,232,.24); background: rgba(43,16,65,.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,.2); border-radius: 999px; color: #b9c6d9; background: rgba(9,25,54,.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: .4; }
.quick-chip.primary-chip { color: #f0c9ff; border-color: rgba(208,35,232,.34); }

.composer { margin-top: auto; padding: 13px; border-top: 1px solid rgba(76,195,255,.16); background: rgba(3,12,29,.88); }
.composer textarea { width: 100%; min-height: 86px; max-height: 190px; padding: 12px 13px; resize: vertical; border: 1px solid rgba(76,195,255,.3); border-radius: 11px; outline: 0; color: #f3f7ff; background: rgba(2,10,25,.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,.07); }
.composer textarea:disabled { opacity: .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,.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); } }

.studio-tabs { min-height: 42px; padding: 7px 9px 0; display: flex; gap: 5px; border-bottom: 1px solid rgba(76,195,255,.15); background: rgba(3,12,29,.72); }
.studio-tab { min-height: 34px; padding: 7px 12px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; color: #8492a8; background: transparent; cursor: pointer; font-size: 9px; font-weight: 900; }
.studio-tab:hover { color: #fff; }
.studio-tab.active { color: #dff7ff; border-color: rgba(76,195,255,.22); background: rgba(8,27,58,.9); }
.studio-body { min-height: 0; flex: 1 1 auto; position: relative; background: rgba(1,7,19,.72); }
.studio-pane { position: absolute; inset: 0; display: none; overflow: auto; }
.studio-pane.active { display: block; }
#previewPane { background: #101625; }
.studio-empty { min-height: 100%; padding: 35px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #8e9cb4; text-align: center; }
.empty-icon { width: 62px; height: 62px; margin-bottom: 13px; display: grid; place-items: center; border: 1px solid rgba(208,35,232,.35); border-radius: 18px; color: #dca3f0; background: rgba(65,22,82,.34); font-size: 22px; font-weight: 900; }
.studio-empty h3 { margin: 0; color: #dce5f4; font-size: 14px; }
.studio-empty p { max-width: 360px; margin: 8px 0 0; font-size: 10px; line-height: 1.6; }
#pagePreview { width: 100%; height: 100%; min-height: 0; border: 0; background: #fff; }
.guide-output { height: 100%; min-height: 0; margin: 0; padding: 17px; overflow: auto; color: #c6d2e4; background: #020817; font: 10px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.code-pane { padding: 11px; background: #020817; }
.code-editor { width: 100%; height: calc(100% - 48px); min-height: 0; padding: 14px; resize: none; border: 1px solid rgba(76,195,255,.2); border-radius: 9px; outline: 0; color: #c9e5f3; background: #010611; font: 10px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 2; }
.code-editor:focus { border-color: var(--lab-cyan); }
.apply-code { width: 100%; margin-top: 9px; }
.studio-footer { flex-wrap: wrap; }
.studio-footer .lab-button { flex: 1 1 auto; }
.studio-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,.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: .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,.34); border-radius: 17px; color: var(--lab-text); background: #071126; box-shadow: 0 30px 90px rgba(0,0,0,.72); }
.lab-dialog.wide { width: min(920px,calc(100vw - 28px)); }
.lab-dialog::backdrop { background: rgba(1,5,15,.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,.18); background: rgba(5,18,42,.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; }
.dialog-preview-actions { display: flex; align-items: center; gap: 8px; }
.dialog-preview-actions .lab-button { min-height: 34px; padding: 7px 12px; }
.icon-button { width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; color: #c9d3e4; background: rgba(255,255,255,.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,.15); border-radius: 12px; background: rgba(2,11,28,.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; }
.preview-dialog { width: min(1400px,calc(100vw - 30px)); height: min(900px,calc(100vh - 30px)); max-height: calc(100vh - 30px); }
.preview-dialog iframe { width: 100%; height: calc(100% - 79px); border: 0; background: #fff; }
.preview-dialog:fullscreen,
.preview-dialog.is-maximized { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border: 0; border-radius: 0; }
.preview-dialog:fullscreen iframe,
.preview-dialog.is-maximized iframe { height: calc(100% - 79px); }
.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,.42); border-radius: 11px; color: #dcfff2; background: rgba(5,43,39,.96); box-shadow: 0 18px 50px rgba(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,.42); background: rgba(69,17,33,.96); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }

@media (max-width: 1300px) {
  .workspace-grid { height: auto; grid-template-columns: minmax(290px,330px) minmax(480px,1fr); }
  .navigator-panel,
  .chat-panel { height: 680px; }
  .studio-panel { height: 720px; min-height: 0; grid-column: 1 / -1; }
  .studio-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; }
  .navigator-panel, .chat-panel, .studio-panel { height: 680px; 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; }
  .navigator-panel, .chat-panel, .studio-panel { height: 650px; min-height: 0; }
  .panel-header { align-items: flex-start; }
  .panel-title p { display: none; }
  .mode-grid { grid-template-columns: 1fr; }
  .message-bubble { max-width: calc(100% - 39px); }
  .studio-footer .lab-button { flex-basis: 100%; }
  .course-footer { padding-inline: 12px; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .lab-button { width: 100%; }
}
