.lab-page {
  --lab-bg: #0f1419;
  --lab-surface: #1a2332;
  --lab-surface-2: #243044;
  --lab-border: #2f3f56;
  --lab-text: #e8eef7;
  --lab-muted: #8fa3bf;
  --lab-accent: #3b82f6;
  --lab-accent-2: #22c55e;
  --lab-warn: #f59e0b;
  --lab-error: #ef4444;
  --lab-radius: 10px;
  color: var(--lab-text);
  margin: -1rem -0.75rem 0;
  padding: 1.25rem 0.75rem 2rem;
  background: linear-gradient(160deg, #0b1018 0%, #121a26 45%, #0f1419 100%);
  min-height: calc(100vh - 120px);
  border-radius: var(--lab-radius);
}

.lab-hero {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.lab-hero h1 {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.lab-hero p {
  margin: 0;
  color: var(--lab-muted);
  font-size: 0.95rem;
}

.lab-config {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius);
  padding: 0.85rem 1rem;
  min-width: min(100%, 420px);
}

.lab-config label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lab-muted);
  margin-bottom: 0.35rem;
}

.lab-config .form-control {
  background: var(--lab-surface-2);
  border-color: var(--lab-border);
  color: var(--lab-text);
}

.lab-config .form-control:focus {
  background: var(--lab-surface-2);
  border-color: var(--lab-accent);
  color: var(--lab-text);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.2);
}

.lab-config #btnOpenSwagger {
  white-space: nowrap;
  font-weight: 600;
}

.lab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 992px) {
  .lab-grid {
    grid-template-columns: 1fr;
  }
}

.lab-panel {
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius);
  overflow: hidden;
}

.lab-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--lab-border);
  background: rgba(255, 255, 255, 0.02);
}

.lab-panel-header h2 {
  font-size: 1rem;
  margin: 0;
  font-weight: 600;
}

.lab-panel-body {
  padding: 1rem;
}

.lab-session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.85rem;
  background: var(--lab-surface);
  border: 1px solid var(--lab-border);
  border-radius: var(--lab-radius);
}

.lab-session-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lab-muted);
}

.lab-session-id {
  font-size: 0.8rem;
  color: #93c5fd;
  background: #0a0e14;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.lab-session-meta {
  font-size: 0.8rem;
  color: var(--lab-muted);
}

.lab-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.lab-tab {
  border: 1px solid var(--lab-border);
  background: var(--lab-surface);
  color: var(--lab-muted);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lab-tab:hover {
  color: var(--lab-text);
  border-color: var(--lab-accent);
}

.lab-tab.active {
  background: var(--lab-accent);
  border-color: var(--lab-accent);
  color: #fff;
}

.lab-tab-panel {
  display: none;
}

.lab-tab-panel.active {
  display: block;
}

.lab-panel textarea,
.lab-panel input,
.lab-panel select {
  background: var(--lab-surface-2);
  border-color: var(--lab-border);
  color: var(--lab-text);
}

.lab-panel textarea:focus,
.lab-panel input:focus,
.lab-panel select:focus {
  background: var(--lab-surface-2);
  border-color: var(--lab-accent);
  color: var(--lab-text);
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.2);
}

.lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.lab-btn {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s;
}

.lab-btn:active {
  transform: scale(0.98);
}

.lab-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lab-btn-primary {
  background: var(--lab-accent);
  color: #fff;
}

.lab-btn-success {
  background: var(--lab-accent-2);
  color: #052e14;
}

.lab-btn-warn {
  background: var(--lab-warn);
  color: #1f1402;
}

.lab-btn-danger {
  background: var(--lab-error);
  color: #fff;
}

.lab-btn-ghost {
  background: transparent;
  border: 1px solid var(--lab-border);
  color: var(--lab-text);
}

.lab-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--lab-border);
  color: var(--lab-muted);
}

.lab-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lab-muted);
}

.lab-status.ok::before {
  background: var(--lab-accent-2);
}

.lab-status.warn::before {
  background: var(--lab-warn);
}

.lab-status.err::before {
  background: var(--lab-error);
}

.lab-output {
  margin-top: 0.75rem;
  background: #0a0e14;
  border: 1px solid var(--lab-border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  max-height: 280px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #c8d6ea;
}

.lab-log {
  margin-top: 1rem;
}

.lab-log-split {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
}

.lab-output-log {
  max-height: 180px;
  flex-shrink: 0;
}

.lab-stream-response-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.lab-stream-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--lab-muted);
  margin-bottom: 0.35rem;
}

.lab-stream-response {
  flex: 1;
  min-height: 200px;
  max-height: 420px;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  background: #0a0e14;
  border: 2px solid var(--lab-accent);
  border-radius: 8px;
  font-size: 1.05rem;
  line-height: 1.65;
  color: #e8eef7;
  white-space: pre-wrap;
  word-break: break-word;
}

.lab-stream-response.streaming {
  border-color: var(--lab-accent-2);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.15);
}

.lab-output-raw {
  max-height: 140px;
  font-size: 0.72rem;
  opacity: 0.85;
}

.lab-hint {
  font-size: 0.8rem;
  color: var(--lab-muted);
  margin-top: 0.35rem;
}

.lab-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.lab-form-check-label {
  color: var(--lab-muted);
  font-size: 0.875rem;
}

.transcript-live {
  min-height: 4rem;
  font-size: 1.05rem;
  line-height: 1.5;
  color: #dbeafe;
}

.transcript-partial {
  color: var(--lab-muted);
  font-style: italic;
}

.event-chip {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  margin-right: 0.35rem;
  background: var(--lab-surface-2);
  color: var(--lab-muted);
}

.event-chip.final {
  color: #86efac;
}

.event-chip.error {
  color: #fca5a5;
}
