﻿html,
body.prompt-lab-page,
body.prompt-record-page {
  height: 100%;
  overflow: hidden;
}

body.prompt-lab-page,
body.prompt-record-page {
  display: block;
  min-height: 100vh;
  background: var(--deck-bg);
  color: var(--deck-ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  padding: 24px 0;
}

.prompt-brand-link {
  color: inherit;
  text-decoration: none;
}

.prompt-lab-shell,
.record-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  min-height: 0;
  width: min(1440px, calc(100vw - 48px));
  margin: 0 auto;
}

.prompt-lab-shell .deck-topbar,
.record-shell .deck-topbar,
.prompt-status-bar,
.prompt-pipeline {
  flex: 0 0 auto;
}

.prompt-workspace,
.record-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--deck-line);
}

.prompt-view,
.record-view {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
  display: none;
}

.prompt-view.active,
.record-view.active {
  display: grid;
}

.compose-view,
.outputs-view {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 0;
}

.history-view,
.config-view {
  grid-template-columns: minmax(0, 1fr);
  padding: 8px;
}

.prompt-editor-panel,
.prompt-output-main {
  min-height: 0;
  margin: 8px 0 8px 8px;
  display: flex;
  flex-direction: column;
}

.prompt-card-head {
  flex: 0 0 auto;
}

.prompt-card-head h2 {
  margin: 5px 0 0;
  font-size: 24px;
  line-height: 1.18;
}

.prompt-side-panel,
.prompt-output-detail {
  min-height: 0;
  overflow: hidden;
}

.prompt-field-grid,
.prompt-config-grid {
  display: grid;
  grid-template-columns: minmax(170px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
}

.prompt-config-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px 20px 0;
}

.prompt-field-grid label,
.prompt-config-grid label,
.prompt-editor-pane {
  min-width: 0;
}

.prompt-field-grid textarea,
.prompt-editor-pane textarea {
  resize: none;
  min-height: 0;
  line-height: 1.55;
}

.request-field textarea {
  height: 80px;
}

.prompt-tool-row,
.prompt-editor-tabs,
.prompt-action-row,
.prompt-copy-row {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.prompt-tool-row {
  flex: 0 0 auto;
  margin: 12px 0;
}

.prompt-tool-row button,
.prompt-editor-tabs button,
.prompt-action-row button,
.prompt-copy-row button {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-tool-row button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.prompt-editor-tabs {
  flex: 0 0 auto;
  margin-bottom: 9px;
}

.prompt-editor-tabs button {
  min-height: 28px;
  border-radius: 7px;
  padding: 0 11px;
  font-size: 11px;
}

.prompt-editor-tabs button.active {
  border-color: rgba(118, 168, 138, 0.42);
  background: var(--deck-sage-soft);
  color: var(--deck-sage);
}

.prompt-editor-pane {
  display: none !important;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0 !important;
}

.prompt-editor-pane.active {
  display: flex !important;
  flex-direction: column;
}

.prompt-editor-pane textarea {
  flex: 1 1 auto;
}

.prompt-action-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
  margin-top: 12px;
}

.prompt-check-list {
  display: grid;
  gap: 7px;
}

.prompt-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-radius: 9px;
  padding: 9px 10px;
  background: rgba(234, 241, 235, 0.72);
}

.deck-dark .prompt-check {
  background: rgba(32, 46, 38, 0.36);
}

.prompt-check > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.prompt-check > span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--deck-amber);
}

.prompt-check.ready > span::before {
  background: var(--deck-sage);
}

.prompt-check strong,
.prompt-check small {
  display: block;
}

.prompt-check strong {
  font-size: 10.8px;
}

.prompt-check small {
  margin-top: 3px;
  color: var(--deck-muted);
  font-size: 9.5px;
  line-height: 1.35;
}

.prompt-budget-box {
  margin-top: 14px;
  border: 1px solid var(--deck-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.34);
  padding: 12px;
}

.budget-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(139, 153, 143, 0.18);
}

.budget-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--deck-sage);
  transition: width 0.18s ease, background 0.18s ease;
}

.budget-track.warn span {
  background: var(--deck-amber);
}

.budget-track.bad span {
  background: var(--deck-alert);
}

.prompt-output-box {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  border: 1px solid var(--deck-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--deck-ink);
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 14px;
  font-size: 12px;
  line-height: 1.65;
}

.deck-dark .prompt-output-box {
  background: rgba(255, 255, 255, 0.04);
}

.final-output {
  background: linear-gradient(180deg, rgba(231, 239, 233, 0.74), rgba(255, 255, 255, 0.36));
}

.deck-dark .final-output {
  background: linear-gradient(180deg, rgba(38, 62, 52, 0.44), rgba(255, 255, 255, 0.04));
}

.detail-output {
  display: none;
}

.detail-output.active {
  display: block;
}

.prompt-output-detail {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.prompt-history-panel,
.prompt-config-panel {
  width: min(100%, 980px);
  height: 100%;
  justify-self: center;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.prompt-history-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
}

.prompt-history-item {
  display: block;
  min-width: 0;
  border: 1px solid var(--deck-line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.38);
  color: inherit;
  text-decoration: none;
  padding: 12px;
}

.deck-dark .prompt-history-item {
  background: rgba(255, 255, 255, 0.04);
}

.prompt-history-item:hover {
  border-color: var(--deck-sage);
}

.prompt-history-item div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.prompt-history-item b,
.prompt-history-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-history-item b {
  font-size: 12px;
}

.prompt-history-item span {
  flex: 0 0 auto;
  color: var(--deck-sage);
  font-family: var(--mono);
  font-size: 9.5px;
}

.prompt-history-item p {
  margin: 8px 0 0;
  color: var(--deck-muted);
  font-size: 11px;
  line-height: 1.55;
}

.prompt-empty {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  color: var(--deck-muted);
  padding: 20px;
}

.prompt-console-link {
  align-self: center;
  border: 1px solid var(--deck-line);
  border-radius: 7px;
  color: var(--deck-sage);
  padding: 8px 10px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 900;
}

.prompt-console-link:hover {
  border-color: var(--deck-sage);
}

.prompt-config-hint {
  margin: 12px 20px 0;
  color: var(--deck-muted);
  font-size: 12px;
  line-height: 1.6;
}

.prompt-record-page .record-shell {
  display: flex;
}

.record-frame {
  border-top: 1px solid var(--deck-line);
}

.record-view.active {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
}

.record-view .wide-card {
  grid-column: 1 / -1;
}

.record-view .task-focus-panel,
.record-view .connection-panel {
  margin: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

@media (max-width: 1180px) {
  body.prompt-lab-page,
  body.prompt-record-page {
    padding: 12px 0;
  }

  .prompt-lab-shell,
  .record-shell {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }

  .compose-view,
  .outputs-view {
    grid-template-columns: minmax(0, 1fr) 270px;
  }

  .prompt-status-bar {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr) minmax(170px, 0.45fr);
  }
}

@media (max-width: 820px) {
  .prompt-lab-shell,
  .record-shell {
    height: calc(100vh - 24px);
  }

  .prompt-status-bar {
    grid-template-columns: 1fr;
    min-height: 70px;
  }

  .prompt-status-bar .autopilot-side,
  .prompt-status-bar .autopilot-return {
    display: none;
  }

  .prompt-pipeline {
    padding: 8px 12px;
  }

  .compact-pipeline {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .compact-pipeline::before {
    display: none;
  }

  .compact-pipeline .pipeline-step {
    min-height: 36px;
    grid-template-columns: 20px minmax(0, 1fr);
    padding: 5px;
  }

  .compact-pipeline .step-icon {
    width: 20px;
    height: 20px;
  }

  .compact-pipeline small {
    display: none;
  }

  .compose-view,
  .outputs-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .prompt-side-panel {
    display: none;
  }

  .prompt-editor-panel,
  .prompt-output-main {
    margin: 6px;
    padding: 12px;
  }

  .prompt-card-head h2 {
    font-size: 18px;
  }

  .prompt-field-grid,
  .prompt-config-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .compact-fields {
    grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  }

  .request-field textarea {
    height: 60px;
  }

  .prompt-tool-row,
  .prompt-action-row {
    gap: 5px;
  }

  .prompt-tool-row button,
  .prompt-action-row button {
    padding-left: 7px;
    padding-right: 7px;
    font-size: 11px;
  }

  .prompt-output-detail {
    margin: 0 6px 6px;
    border-left: 1px solid var(--deck-line);
    border-top: 1px solid var(--deck-line);
  }

  .outputs-view {
    grid-template-rows: minmax(0, 1.05fr) minmax(0, 0.95fr);
  }

  .prompt-copy-row {
    flex-direction: column;
  }

  .record-view.active {
    grid-template-columns: minmax(0, 1fr);
  }

  .record-view .connection-panel:nth-of-type(n+3) {
    display: none;
  }
}

@media (max-width: 420px) {
  .compact-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .prompt-tool-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    display: grid;
  }

  .prompt-action-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 0.8fr);
  }

  .prompt-status-bar .autopilot-title-row h1 {
    font-size: 17px;
  }
}
