/* ==========================================================================
   BlueprintCAD - Frontier AI Architectural Workspace (ChatGPT/Claude Aesthetic)
   ========================================================================== */

:root {
  /* Authentic Frontier AI Dark Mode Palette (ChatGPT / Claude o-series) */
  --bg-workspace: #212121;
  --bg-sidebar: #171717;
  --bg-surface: #262626;
  --bg-surface-elevated: #2f2f2f;
  --bg-surface-hover: #383838;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.25);
  --border-focus: rgba(255, 255, 255, 0.38);

  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-muted: #737373;

  --accent-ai: #10a37f;
  --accent-cyan: #0284c7;
  --accent-cyan-light: #38bdf8;
  --accent-cyan-subtle: rgba(56, 189, 248, 0.12);
  --accent-blue: #2563eb;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-capsule: 0 8px 30px rgba(0, 0, 0, 0.45);
  --shadow-sheet: 0 16px 48px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-workspace);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.cad-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   Header Navigation (Minimalist AI Bar)
   ========================================================================== */
.cad-header {
  height: 52px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.logo-mark svg {
  width: 17px;
  height: 17px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.logo-title span {
  color: var(--accent-cyan-light);
  font-weight: 400;
  margin-left: 3px;
}

.logo-subtitle {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.logo-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.paper-theme-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.selector-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.cad-select {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
}

.cad-select:focus {
  border-color: var(--border-focus);
}

.cad-select-sm {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  padding: 3px 6px;
  cursor: pointer;
  outline: none;
}

.btn-cad-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-cad-secondary:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 4px 9px;
  border-radius: var(--radius-xs);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10a37f;
  box-shadow: 0 0 6px rgba(16, 163, 127, 0.6);
}

/* ==========================================================================
   1. LANDING SCREEN (Minimalist ChatGPT / Claude Frontier AI Interface)
   ========================================================================== */
.cad-landing {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 60px;
  min-height: calc(100vh - 52px);
  background: var(--bg-workspace);
}

.landing-content {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
}

.bot-hero-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #2a2a2a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ececec;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.landing-headline {
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  margin: 0;
}

/* Signature AI Chatbot Floating Prompt Capsule (ChatGPT Style) */
.landing-input-box {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 26px;
  box-shadow: var(--shadow-capsule);
  padding: 14px 18px 10px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.landing-input-box:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), var(--shadow-capsule);
}

.landing-input-box textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.98rem;
  line-height: 1.5;
  padding: 2px 0 6px;
  resize: none;
  min-height: 58px;
  max-height: 220px;
}

.landing-input-box textarea::placeholder {
  color: #8e8e8e;
}

.input-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
}

.capsule-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.model-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 11px;
  border-radius: 20px;
}

.model-glow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10a37f;
  box-shadow: 0 0 8px #10a37f;
}

/* Signature Circular Send Button with Upward Arrow */
.btn-chat-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #383838;
  border: none;
  color: #6a6a6a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: not-allowed;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-chat-send.active,
.btn-chat-send:not(:disabled) {
  background: #ffffff;
  color: #000000;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.25);
}

.btn-chat-send.active:hover,
.btn-chat-send:not(:disabled):hover {
  background: #f4f4f4;
  transform: scale(1.05);
}

/* ==========================================================================
   2. STUDIO WORKSPACE (Split View: Specification Sheet & CAD Viewport)
   ========================================================================== */
.cad-workspace {
  display: none;
  flex: 1;
  height: calc(100vh - 56px);
  overflow: hidden;
}

/* Visibility Control */
body.landing-active .cad-landing {
  display: flex;
}
body.landing-active .cad-clarify {
  display: none;
}
body.landing-active .cad-workspace {
  display: none;
}

body.clarify-active .cad-landing {
  display: none;
}
body.clarify-active .cad-clarify {
  display: flex;
}
body.clarify-active .cad-workspace {
  display: none;
}

body.studio-active .cad-landing {
  display: none;
}
body.studio-active .cad-clarify {
  display: none;
}
body.studio-active .cad-workspace {
  display: flex;
}

/* ==========================================================================
   CLARIFYING QUESTIONS STAGE (Q/A Intake Questionnaire)
   ========================================================================== */
.cad-clarify {
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px 20px 50px;
  min-height: calc(100vh - 56px);
  background: 
    radial-gradient(circle at 50% 15%, rgba(2, 132, 199, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-workspace) 0%, #060910 100%);
}

.clarify-container {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn 0.25s ease-out;
}

.clarify-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
}

.btn-clarify-back {
  background: transparent;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clarify-back:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-clarify-back:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.clarify-progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 160px;
}

.clarify-progress-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.clarify-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--bg-surface-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.clarify-progress-fill {
  height: 100%;
  background: var(--accent-cyan-light);
  width: 25%;
  transition: width 0.3s ease;
}

.btn-clarify-skip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  color: #ececec;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  transition: all 0.15s ease;
}

.btn-clarify-skip:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

/* Card */
.clarify-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.clarify-question-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.clarify-category {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-cyan-light);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.clarify-question-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
}

.clarify-question-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Options */
.clarify-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-align: left;
}

.option-chip:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
}

.option-chip.selected {
  background: rgba(2, 132, 199, 0.15);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.option-chip.special-you-decide {
  border-style: dashed;
  color: var(--accent-cyan-light);
}

.option-chip.special-other {
  border-style: dashed;
  color: var(--text-secondary);
}

.option-chip.special-skip-all {
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(56, 189, 248, 0.45);
  color: var(--accent-cyan-light);
  font-weight: 600;
}

.option-chip.special-skip-all:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--accent-cyan-light);
}

.option-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.option-chip.selected .option-indicator {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

.option-indicator svg {
  display: none;
  color: #fff;
}

.option-chip.selected .option-indicator svg {
  display: block;
}

/* Other Custom Input Box */
.clarify-other-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: -6px;
}

.clarify-other-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 6px 4px;
}

.btn-clarify-confirm {
  background: var(--accent-cyan);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
}

.clarify-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}

.btn-clarify-next {
  background: var(--accent-cyan);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 9px 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-clarify-next:hover {
  background: var(--accent-blue);
}

/* Review Screen */
.clarify-review {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.clarify-review-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.clarify-review-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
}

.clarify-review-subtext {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.clarify-review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.review-item:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
}

.review-item-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.review-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.review-value {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.review-edit-btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-cyan-light);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.clarify-review-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 10px;
}

.btn-clarify-build {
  background: var(--accent-cyan);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 12px 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-clarify-build:hover {
  background: var(--accent-blue);
}

/* --------------------------------------------------------------------------
   Left Column: Technical Specification & Analysis Panel
   -------------------------------------------------------------------------- */
.chat-column {
  width: 440px;
  min-width: 380px;
  max-width: 500px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.8px;
}

.panel-title svg {
  color: var(--accent-cyan-light);
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Engineering Chat Cards */
.chat-message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   AI Thinking & Reasoning Block (OpenAI o1 / Claude 3.7 Style)
   ========================================================================== */
.thinking-widget {
  background: #1e1e1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.15s ease;
}

.thinking-header:hover {
  background: rgba(255, 255, 255, 0.06);
}

.thinking-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #b4b4b4;
}

.thinking-sparkle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10a37f;
  animation: thinkingGlow 1.4s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(16, 163, 127, 0.7);
}

.thinking-sparkle-dot.done {
  background: #38bdf8;
  animation: none;
  box-shadow: none;
}

@keyframes thinkingGlow {
  0% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.5; }
}

.thinking-status {
  font-weight: 500;
  color: #e5e5e5;
  font-size: 0.8rem;
}

.thinking-timer {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #888888;
}

.thinking-chevron {
  color: #888888;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
}

.thinking-widget.collapsed .thinking-chevron {
  transform: rotate(-90deg);
}

.thinking-body {
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  line-height: 1.6;
  color: #9e9e9e;
  max-height: 280px;
  overflow-y: auto;
  transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
}

.thinking-widget.collapsed .thinking-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  overflow: hidden;
  border-top-color: transparent;
}

.thinking-stream {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.thinking-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: stepFade 0.25s ease-out forwards;
}

@keyframes stepFade {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.thinking-step-icon {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: #10a37f;
  margin-top: 1px;
}

.thinking-step.done .thinking-step-icon {
  color: #38bdf8;
}

.thinking-step-text {
  flex: 1;
  color: #b0b0b0;
}

.thinking-step.active .thinking-step-text {
  color: #ffffff;
  font-weight: 500;
}

/* Chat Message Bubbles */
.chat-message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-message {
  align-self: flex-end;
  max-width: 90%;
}

.user-bubble {
  background: #2f2f2f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px 18px 4px 18px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: #ececec;
  line-height: 1.45;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: right;
  padding-right: 4px;
}

.ai-message {
  align-self: flex-start;
  width: 100%;
}

.ai-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.ai-badge {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: #ececec;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
}

.ai-timestamp {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.spec-summary {
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.55;
}

/* Metric Pills Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.metric-item {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-cyan-light);
  margin-top: 2px;
}

/* Section Box */
.spec-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spec-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spec-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.spec-bullets li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
  padding-left: 14px;
  position: relative;
}

.spec-bullets li::before {
  content: '▪';
  position: absolute;
  left: 0;
  color: var(--accent-cyan-light);
  font-size: 0.75rem;
}

/* Room Schedule Table */
.room-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  margin-top: 6px;
}

.room-schedule-table th,
.room-schedule-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.room-schedule-table th {
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.room-schedule-table td {
  color: var(--text-secondary);
}

.room-schedule-table tr:hover td {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  cursor: pointer;
}

/* Chat Input Bar (Signature ChatGPT Floating Pill Style) */
.chat-input-container {
  padding: 12px 16px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
}

.chat-input-wrapper {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 6px 8px 6px 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
  border-color: var(--border-strong);
}

.chat-input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.45;
  resize: none;
  max-height: 90px;
}

.btn-send-mini {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #383838;
  border: none;
  color: #6a6a6a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: not-allowed;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-send-mini.active,
.btn-send-mini:not(:disabled) {
  background: #ffffff;
  color: #000000;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255, 255, 255, 0.2);
}

.btn-send-mini.active:hover,
.btn-send-mini:not(:disabled):hover {
  background: #f4f4f4;
  transform: scale(1.05);
}

.chat-input-hint {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: right;
}

/* --------------------------------------------------------------------------
   Right Column: Live CAD Drawing Board Viewport
   -------------------------------------------------------------------------- */
.blueprint-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-workspace);
  overflow: hidden;
  position: relative;
}

/* Studio Toolbar */
.studio-toolbar {
  height: 48px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.view-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn svg {
  color: var(--text-muted);
}

.tab-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.tab-btn.active svg {
  color: var(--accent-cyan-light);
}

.toolbar-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.floor-selector-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.floor-pill-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.floor-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.floor-pill:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.floor-pill.active {
  background: var(--accent-cyan-subtle);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan-light);
  font-weight: 700;
}

.paper-quick-selector {
  display: flex;
  align-items: center;
  gap: 6px;
}

.export-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-action {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-medium);
  color: var(--text-primary);
}

/* CAD Drawing Viewport */
.blueprint-viewport {
  flex: 1;
  position: relative;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    var(--bg-workspace);
  background-size: 30px 30px;
}

.svg-container {
  width: 100%;
  height: 100%;
  max-width: 1380px;
  max-height: 880px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.blueprint-svg {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-sheet);
  transition: filter 0.2s ease;
}

/* Floating Room Inspector */
.floating-inspector {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 280px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 20;
  display: none;
}

.floating-inspector.active {
  display: block;
}

.inspector-header {
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.inspector-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-cyan-light);
  letter-spacing: 0.8px;
}

.inspector-close {
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
}

.inspector-close:hover {
  color: var(--text-primary);
}

.inspector-content {
  padding: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.inspector-empty {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* Bottom Status Bar */
.studio-statusbar {
  height: 32px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}

.status-label strong {
  color: var(--text-primary);
}

.status-sep {
  color: var(--border-medium);
}

.status-scale, .status-grid {
  color: var(--accent-cyan-light);
}

.status-right {
  display: flex;
  align-items: center;
}

.legend-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  cursor: pointer;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .cad-workspace {
    flex-direction: column;
    height: auto;
  }
  .chat-column {
    width: 100%;
    max-width: 100%;
    height: 400px;
  }
  .blueprint-column {
    height: 600px;
  }
}
