/* V5 — chat setup inside v4 wizard layout (full width) */

.v5-setup-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 !important;
  overflow: hidden;
}

.v5-setup-chat-inner {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 16px 18px 14px;
}

.v5-chat {
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(32vh, 260px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 12px;
}

.v5-setup-chat:has(.v5-chat-step-wide) .v5-chat {
  flex: 1 1 auto;
  max-height: none;
}

.v5-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--radius-card);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.v5-bubble.user {
  align-self: flex-end;
  background: var(--pd);
  color: #fff;
}

.v5-bubble.assistant {
  align-self: flex-start;
  background: var(--sf);
  border: 1px solid var(--bd);
  box-shadow: var(--shadow-sm);
}

.v5-bubble.system {
  align-self: center;
  background: var(--wal);
  border: 1px solid #fde68a;
  color: var(--wad);
  font-size: 12px;
  max-width: 92%;
}

.v5-bubble-card {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bd-light);
  font-size: 12px;
}

.v5-bubble-card-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.v5-bubble-card-row span:first-child {
  color: var(--mu);
  min-width: 72px;
}

.v5-upload-card {
  margin-top: 10px;
  padding-top: 0;
  border-top: none;
}

.v5-upload-card .v3-upload-artifact {
  margin-top: 4px;
}

.v5-bubble .v3-upload-artifact-btn {
  width: 100%;
}

.v5-chat-step {
  max-width: 92%;
  align-self: flex-start;
}

.v5-chat-step-wide {
  max-width: 100%;
  width: 100%;
  align-self: stretch;
}

.v5-step-prompt {
  margin-bottom: 12px;
  font-weight: 500;
}

.v5-step-controls {
  margin-top: 4px;
}

.v5-profile-summary {
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--bd-light);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--tx);
}

.v5-profile-loading {
  margin-bottom: 12px;
}

.v5-question-panel {
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  background: var(--bg);
}

.v5-question-panel h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--tx);
}

.v5-q-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.v5-launch-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.v5-progress {
  margin-bottom: 12px;
  background: var(--pl);
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--pd);
}

.v5-composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: var(--radius-card);
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  margin-top: auto;
}

.v5-composer-attach {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 16px;
  line-height: 1;
}

.v5-chat-only-hint {
  margin: 0;
  font-style: italic;
}

.v5-composer-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font: inherit;
  font-size: 13px;
  max-height: 120px;
  background: transparent;
  color: var(--tx);
}

.v5-composer-hint {
  text-align: center;
  margin-top: 8px;
}

.v5-clean-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.v5-clean-stat {
  background: var(--sf);
  border: 1px solid var(--bd-light);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
}

.v5-clean-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--tx);
}

.v5-clean-stat-label {
  font-size: 11px;
  color: var(--mu);
}

.v5-setup-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .v5-chat {
    max-height: 40vh;
  }
}
