/* ===== CSS Variables ===== */
:root {
  --color-bg: #F8FAFC;
  --color-surface: #FFFFFF;
  --color-border: #E2E8F0;
  --color-text: #1E293B;
  --color-text-secondary: #64748B;
  --color-text-tertiary: #94A3B8;
  --color-primary: #4F46E5;
  --color-primary-light: #EEF2FF;
  --color-primary-hover: #4338CA;
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --sidebar-width: 380px;
  --nav-width: 220px;
  --header-height: 56px;

  --stage-idea: #F59E0B;
  --stage-research: #3B82F6;
  --stage-inspiration: #8B5CF6;
  --stage-design: #EC4899;
  --stage-prototype: #F97316;
  --stage-iteration: #06B6D4;
  --stage-final: #10B981;

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  overflow: hidden;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

input, textarea {
  font: inherit;
  color: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
}

input:focus, textarea:focus { border-color: var(--color-primary); }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===== App Layout ===== */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* ===== Sidebar / Chatbox ===== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition), min-width var(--transition), width var(--transition);
  position: relative;
  z-index: 10;
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
  min-width: 0;
  width: 0;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header h2 .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition);
}

.sidebar-toggle:hover { background: var(--color-bg); color: var(--color-text); }

.api-config {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.api-config input {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.api-config button {
  padding: 6px 12px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition);
}

.api-config button:hover { background: var(--color-primary-hover); }

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

.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  text-align: center;
  padding: 24px;
  gap: 8px;
}

.chat-empty .icon { font-size: 36px; opacity: 0.5; }
.chat-empty p { font-size: 13px; line-height: 1.5; }
.chat-empty .hint { font-size: 12px; color: var(--color-text-tertiary); }

.message {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
  animation: fadeIn 0.2s ease;
}

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

.message.user {
  align-self: flex-end;
  background: var(--color-primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: var(--color-bg);
  color: var(--color-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--color-border);
}

.message.assistant .stage-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 6px;
  font-weight: 500;
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input-area textarea {
  flex: 1;
  resize: none;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: var(--radius-md);
  min-height: 40px;
  max-height: 120px;
  line-height: 1.5;
}

.chat-input-area button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
  transition: all var(--transition);
}

.chat-input-area button:hover { background: var(--color-primary-hover); }
.chat-input-area button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ===== Top Bar ===== */
.top-bar {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-toggle-sidebar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition);
  font-size: 18px;
}

.btn-toggle-sidebar:hover { background: var(--color-bg); color: var(--color-text); }

.project-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.project-title-input {
  font-size: 16px;
  font-weight: 700;
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  width: 220px;
}

.project-title-input:focus { background: var(--color-bg); }

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  width: 120px;
  height: 6px;
  background: var(--color-bg);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ===== Pipeline Area ===== */
.pipeline-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Stage Flow ===== */
.stage-flow {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  overflow-y: visible;
  padding: 8px 4px 16px 4px;
  flex-shrink: 0;
  min-height: 100px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.stage-flow::-webkit-scrollbar { height: 6px; }
.stage-flow::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.stage-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition);
  flex-shrink: 0;
}

.stage-node:hover { transform: translateY(-2px); }

.stage-node.active .stage-icon-wrap { transform: scale(1.1); }

.stage-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: all var(--transition);
  border: 3px solid transparent;
  position: relative;
}

.stage-node.completed .stage-icon-wrap { border-color: var(--color-success); }

.stage-node.active .stage-icon-wrap {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-light);
}

.stage-label {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 80px;
  line-height: 1.3;
}

.stage-node.active .stage-label { color: var(--color-primary); }

.stage-connector {
  width: 40px;
  height: 2px;
  margin: 0 4px;
  margin-bottom: 28px;
  border-radius: 1px;
}

.stage-connector.done { background: var(--color-success); }
.stage-connector.pending { background: var(--color-border); }

.stage-task-count {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-node.completed .stage-task-count { background: var(--color-success); }

/* ===== Stage Detail Panel ===== */
.stage-detail {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

.stage-detail-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
}

.stage-detail-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
}

.stage-detail-title .emoji { font-size: 22px; }

.stage-detail-actions {
  display: flex;
  gap: 8px;
}

.btn-stage-action {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-complete-stage {
  background: var(--color-success);
  color: white;
}

.btn-complete-stage:hover { filter: brightness(0.9); }

.btn-complete-stage.undo {
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.btn-complete-stage.undo:hover { background: var(--color-border); }

/* ===== Stage Tabs ===== */
.stage-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  padding: 0 20px;
}

.stage-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}

.stage-tab:hover { color: var(--color-text); }

.stage-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* ===== Task List ===== */
.stage-tab-content {
  padding: 16px 20px;
  display: none;
}

.stage-tab-content.active { display: block; }

.task-add-form {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.task-add-form input {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.task-add-form button {
  padding: 8px 16px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--transition);
}

.task-add-form button:hover { background: var(--color-primary-hover); }

.task-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.task-item:hover { border-color: var(--color-border); }

.task-item.done .task-text { text-decoration: line-through; color: var(--color-text-tertiary); }

.task-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 10px;
  color: transparent;
}

.task-item.done .task-checkbox {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.task-text {
  flex: 1;
  font-size: 13px;
}

.btn-task-delete {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  opacity: 0;
  transition: all var(--transition);
  font-size: 14px;
}

.task-item:hover .btn-task-delete { opacity: 1; }
.btn-task-delete:hover { color: var(--color-danger); background: #FEF2F2; }

/* ===== Notes ===== */
.note-editor {
  width: 100%;
  min-height: 160px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.7;
  border-radius: var(--radius-sm);
  resize: vertical;
  border: 1px solid var(--color-border);
}

.note-editor:focus { border-color: var(--color-primary); }

.note-save-hint {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 8px;
}

.note-save-hint.saved { color: var(--color-success); }

/* ===== GTM Strategy Module ===== */
.gtm-section {
  margin-bottom: 20px;
}

.gtm-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.gtm-section h4 .dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--color-primary);
}

.gtm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.gtm-card {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--color-border);
}

.gtm-card-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.gtm-card textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  font-size: 12px;
  line-height: 1.6;
  border-radius: var(--radius-sm);
  resize: vertical;
  background: var(--color-surface);
}

.gtm-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gtm-milestone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.gtm-milestone input {
  flex: 1;
  padding: 4px 8px;
  font-size: 12px;
  border: none;
  background: transparent;
}

.gtm-milestone input.date { width: 100px; flex: none; text-align: center; }

.btn-add-milestone {
  padding: 8px 16px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  align-self: flex-start;
  transition: background var(--transition);
}

.btn-add-milestone:hover { background: var(--color-primary-hover); }

.btn-delete-milestone {
  color: var(--color-text-tertiary);
  font-size: 16px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-delete-milestone:hover { color: var(--color-danger); background: #FEF2F2; }

/* ===== Files Section ===== */
.file-upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  color: var(--color-text-tertiary);
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 14px;
}

.file-upload-zone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.file-upload-zone .icon { font-size: 28px; margin-bottom: 8px; }
.file-upload-zone p { font-size: 13px; }

.file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.file-item-name { flex: 1; }
.file-item-size { color: var(--color-text-tertiary); font-size: 11px; }

.btn-file-delete {
  color: var(--color-text-tertiary);
  font-size: 16px;
  display: flex;
}

.btn-file-delete:hover { color: var(--color-danger); }

/* ===== Welcome / No Stage Selected ===== */
.no-stage-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--color-text-tertiary);
  text-align: center;
  gap: 12px;
}

.no-stage-selected .icon { font-size: 48px; opacity: 0.4; }
.no-stage-selected h3 { font-size: 18px; color: var(--color-text-secondary); }
.no-stage-selected p { font-size: 13px; line-height: 1.6; max-width: 320px; }

/* ===== Delete Project ===== */
.btn-delete-project {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--color-text-tertiary);
  transition: all var(--transition);
}

.btn-delete-project:hover { color: var(--color-danger); background: #FEF2F2; }

/* ===== Top Bar additions for view switching ===== */
.btn-back {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition);
  font-size: 16px;
  font-weight: 500;
  padding: 0 10px;
  width: auto;
  white-space: nowrap;
}
.btn-back:hover { background: var(--color-bg); color: var(--color-primary); }

.view-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}
.view-subtitle {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-top: 1px;
}

/* ===== Product List View ===== */
.list-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 900px;
}

.product-group {
  animation: fadeIn 0.3s ease;
}

.product-group-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-left: 4px;
}

.product-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.product-group-count {
  background: var(--color-bg);
  color: var(--color-text-tertiary);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
}

.product-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.product-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.product-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.product-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.product-status-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.product-card-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-card-progress {
  flex: 1;
  height: 4px;
  background: var(--color-bg);
  border-radius: 2px;
  overflow: hidden;
}

.product-card-progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.product-card-progress-text {
  font-size: 11px;
  color: var(--color-text-tertiary);
  font-weight: 500;
  min-width: 28px;
  text-align: right;
}

.product-card-meta {
  margin-top: 10px;
  font-size: 11px;
  color: var(--color-text-tertiary);
}

/* No products state */
.no-products {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  color: var(--color-text-tertiary);
  gap: 10px;
}

.no-products .icon {
  font-size: 56px;
  opacity: 0.4;
  margin-bottom: 8px;
}

.no-products h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.no-products p {
  font-size: 13px;
  line-height: 1.5;
}

/* ===== FAB (New Product Button) ===== */
.fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  transition: all var(--transition);
  z-index: 20;
  font-weight: 300;
  line-height: 1;
}

.fab:hover {
  background: var(--color-primary-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

/* ===== Overlay / Dialog ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.overlay-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 400px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

.overlay-dialog h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

.overlay-dialog input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn-primary {
  padding: 8px 20px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition);
}

.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary {
  padding: 8px 20px;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  transition: all var(--transition);
}

.btn-secondary:hover { background: var(--color-border); }

/* ===== Pipeline View (visible when in detail mode) ===== */
.pipeline-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pipeline-view .pipeline-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Pipeline tabs (流程 / 想法) */
.pipeline-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 24px 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.pipeline-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.pipeline-tab:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.pipeline-tab.active {
  color: var(--color-primary);
  background: var(--color-surface);
  border-color: var(--color-border);
  border-bottom-color: var(--color-surface);
}

.pipeline-tab-count {
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.pipeline-tab-count.has-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.pipeline-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pipeline-content-ideas {
  overflow-y: auto;
}

/* Product-scoped ideas panel (inside pipeline "想法" tab) */
.product-ideas-panel {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .sidebar { position: absolute; height: 100%; box-shadow: var(--shadow-lg); }
  .sidebar.collapsed { margin-left: calc(-1 * var(--sidebar-width)); }
  .stage-flow { gap: 8px; }
  .stage-connector { display: none; }
  .gtm-grid { grid-template-columns: 1fr; }
  .product-cards { grid-template-columns: 1fr; }
  .fab { bottom: 20px; right: 20px; width: 48px; height: 48px; font-size: 24px; }
  .proto-version-body { gap: 12px; }
  .proto-version-actions { flex-direction: column; }
}

/* ===== Prototype Version Management ===== */
.proto-version-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.proto-version-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.proto-version-badge:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.proto-version-badge.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.proto-version-badge.completed {
  background: var(--color-bg);
  color: var(--color-text-tertiary);
  border-color: var(--color-border);
  text-decoration: line-through;
  text-decoration-color: var(--color-text-tertiary);
}

.proto-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.proto-version-badge.active .proto-badge-dot {
  background: white;
}

.proto-version-connector {
  width: 20px;
  height: 1px;
  background: var(--color-border);
  flex-shrink: 0;
}

/* Proto content area */
.proto-content {
  padding: 20px;
}

.proto-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--color-text-secondary);
  gap: 8px;
}

.proto-empty-icon {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.proto-empty h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.proto-empty p {
  font-size: 13px;
  color: var(--color-text-tertiary);
  max-width: 320px;
  line-height: 1.5;
}

.btn-proto-create {
  margin-top: 12px;
  padding: 10px 24px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-proto-create:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

/* Proto version card */
.proto-version-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

.proto-version-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.proto-version-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  margin-right: 10px;
}

.proto-version-status {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 10px;
}

.proto-version-status.active {
  background: #FEF3C7;
  color: #92400E;
}

.proto-version-status.completed {
  background: #D1FAE5;
  color: #065F46;
}

.proto-version-date {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.proto-version-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Proto field */
.proto-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.proto-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.proto-field-icon {
  font-size: 14px;
}

.proto-field-hint {
  font-size: 11px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.proto-input {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  max-width: 220px;
}

.proto-input:focus {
  border-color: var(--color-primary);
}

/* Proto file zone */
.proto-file-zone {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--color-bg);
}

.proto-file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.proto-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--color-border);
}

.proto-file-item-icon {
  font-size: 14px;
}

.proto-file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proto-file-item-size {
  color: var(--color-text-tertiary);
  font-size: 11px;
}

.proto-file-delete {
  color: var(--color-text-tertiary);
  font-size: 14px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.proto-file-delete:hover {
  color: var(--color-danger);
  background: #FEF2F2;
}

.proto-upload-btn-wrap {
  display: flex;
}

.btn-proto-upload {
  padding: 6px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-block;
  user-select: none;
}

.btn-proto-upload:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

/* Proto photo grid */
.proto-photo-zone {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--color-bg);
  transition: border-color .15s, background .15s;
}

.proto-photo-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.proto-photo-hint {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-left: 8px;
  vertical-align: middle;
}

.proto-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.proto-photo-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
  aspect-ratio: 1;
}

.proto-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform var(--transition);
}

.proto-photo-item img:hover {
  transform: scale(1.05);
}

.proto-photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.proto-photo-item:hover .proto-photo-delete {
  opacity: 1;
}

.proto-photo-delete:hover {
  background: var(--color-danger);
}

/* Proto version actions */
.proto-version-actions {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.btn-proto-next {
  flex: 1;
  padding: 10px 20px;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-proto-next:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.btn-proto-done {
  flex: 1;
  padding: 10px 20px;
  background: var(--color-success);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-proto-done:hover {
  filter: brightness(0.9);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-proto-save {
  padding: 10px 16px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-proto-save:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.btn-proto-delete {
  padding: 10px 16px;
  background: #FEF2F2;
  color: var(--color-danger);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-proto-delete:hover {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}

/* ===== Markdown Editor (Idea Stage) ===== */
.md-editor-wrap {
  padding: 0 !important;
}

.md-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  flex-wrap: wrap;
}

.md-toolbar-group {
  display: flex;
  gap: 2px;
}

.md-toolbar-group::after {
  content: '';
  width: 1px;
  height: 18px;
  background: var(--color-border);
  margin: 0 4px;
  align-self: center;
}

.md-toolbar-group:last-of-type::after {
  display: none;
}

.md-toolbar-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--color-text-secondary);
  transition: all var(--transition);
  font-weight: 500;
}

.md-toolbar-btn:hover {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.md-toolbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.md-preview-toggle {
  width: auto;
  padding: 0 10px;
  font-size: 12px;
}

.md-preview-toggle.active {
  background: var(--color-primary);
  color: white;
}

.md-save-status {
  font-size: 11px;
  color: var(--color-text-tertiary);
  white-space: nowrap;
}

.md-save-status.saved {
  color: var(--color-success);
}

.md-editor-body {
  display: flex;
  min-height: 400px;
  max-height: calc(100vh - 300px);
}

.md-editor-pane {
  flex: 1;
  overflow: hidden;
  display: flex;
}

.md-input {
  width: 100%;
  height: 100%;
  min-height: 400px;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.8;
  font-family: "SF Mono", "Fira Code", "Consolas", "Menlo", monospace;
  border: none;
  border-radius: 0;
  resize: none;
  background: var(--color-surface);
}

.md-input:focus {
  outline: none;
}

.md-preview-pane {
  flex: 1;
  overflow-y: auto;
  border-left: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
}

.md-preview-content {
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--color-text);
  width: 100%;
}

.md-preview-content h1 { font-size: 1.6em; font-weight: 700; margin: 0.5em 0 0.3em; padding-bottom: 0.2em; border-bottom: 1px solid var(--color-border); }
.md-preview-content h2 { font-size: 1.35em; font-weight: 700; margin: 0.6em 0 0.3em; }
.md-preview-content h3 { font-size: 1.15em; font-weight: 600; margin: 0.5em 0 0.2em; }
.md-preview-content p { margin: 0.4em 0; }
.md-preview-content ul, .md-preview-content ol { padding-left: 1.5em; margin: 0.4em 0; }
.md-preview-content li { margin: 0.15em 0; }
.md-preview-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 4px 12px;
  margin: 0.5em 0;
  color: var(--color-text-secondary);
  background: var(--color-primary-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.md-preview-content code {
  background: var(--color-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}
.md-preview-content pre {
  background: #1E293B;
  color: #E2E8F0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 0.5em 0;
  font-size: 13px;
}
.md-preview-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.md-preview-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 0.4em 0;
}
.md-preview-content a {
  color: var(--color-primary);
  text-decoration: underline;
}
.md-preview-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0.8em 0;
}
.md-preview-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.5em 0;
}
.md-preview-content th, .md-preview-content td {
  border: 1px solid var(--color-border);
  padding: 6px 10px;
  text-align: left;
  font-size: 13px;
}
.md-preview-content th {
  background: var(--color-bg);
  font-weight: 600;
}

/* ===== Project Navigation (Left Sidebar) ===== */
.project-nav {
  width: var(--nav-width);
  min-width: var(--nav-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition), min-width var(--transition), width var(--transition);
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.project-nav-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.project-nav-header h2 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-nav-count {
  background: var(--color-bg);
  color: var(--color-text-tertiary);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
}

.project-nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.project-nav-group {
  margin-bottom: 12px;
}

.project-nav-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.project-nav-group-label .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.project-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  color: var(--color-text-secondary);
  font-weight: 500;
  border: 1px solid transparent;
}

.project-nav-item:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.project-nav-item.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.project-nav-item .nav-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.project-nav-item .nav-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-nav-item .nav-progress {
  font-size: 11px;
  color: var(--color-text-tertiary);
  font-weight: 400;
  flex-shrink: 0;
  white-space: nowrap;
}

.project-nav-footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  align-items: center;
}

.project-nav-add {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  transition: all var(--transition);
  font-weight: 300;
  line-height: 1;
}

.project-nav-add:hover {
  background: var(--color-primary-hover);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.project-nav-quickidea {
  flex: 1;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
  transition: all var(--transition);
  white-space: nowrap;
}

.project-nav-quickidea:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
}

/* ===== Quick idea / move idea dialogs ===== */
.quick-idea-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.quick-idea-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 20px;
  width: min(520px, calc(100vw - 40px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-idea-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-idea-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.quick-idea-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.quick-idea-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.quick-idea-dialog textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
}

.quick-idea-dialog textarea:focus {
  border-color: var(--color-primary);
}

/* ===== Ideas Nav Entry ===== */
.project-nav-ideas-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 2px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
  border: 1px solid transparent;
  transition: all var(--transition);
  background: var(--color-bg);
  flex-shrink: 0;
}

.project-nav-ideas-btn:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.project-nav-ideas-btn.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.nav-ideas-icon { font-size: 15px; line-height: 1; }
.nav-ideas-label { flex: 1; }

.nav-ideas-count {
  background: var(--color-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  align-items: center;
  justify-content: center;
}

/* ===== Chat Floating Button ===== */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  transition: all var(--transition);
  z-index: 50;
  cursor: pointer;
  user-select: none;
}

.chat-fab:hover {
  background: var(--color-primary-hover);
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.chat-fab:active {
  transform: scale(0.95);
}

/* ===== Chat Overlay ===== */
.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.chat-window {
  width: 520px;
  max-width: 90vw;
  height: 620px;
  max-height: 85vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}

.chat-window-header {
  height: var(--header-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-surface);
}

.chat-window-header h2 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-window-header h2 .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
}

.chat-window-action {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition);
  font-size: 14px;
}

.chat-window-action:hover { background: var(--color-bg); color: var(--color-text); }

/* Chat messages inside window */
.chat-window .chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-window .chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chat-window .api-config {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .project-nav { position: absolute; height: 100%; box-shadow: var(--shadow-lg); }
  .project-nav.collapsed { margin-left: calc(-1 * var(--nav-width)); }
  .stage-flow { gap: 8px; }
  .stage-connector { display: none; }
  .gtm-grid { grid-template-columns: 1fr; }
  .proto-version-body { gap: 12px; }
  .proto-version-actions { flex-direction: column; }
  .chat-window { width: 95vw; height: 80vh; }
  .chat-fab { bottom: 16px; right: 16px; width: 48px; height: 48px; font-size: 20px; }
}

/* ===== Ideas View (Global Task List) ===== */
.ideas-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.ideas-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ideas-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Composer */
.ideas-composer {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.idea-product-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color var(--transition);
}

.idea-product-select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.idea-product-select:invalid,
.idea-product-select option[value=""] {
  color: var(--color-text-tertiary);
}

#idea-input,
#product-idea-input,
#mobile-idea-input,
#nextgen-input,
#feedback-input {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  border: none;
  background: var(--color-bg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.5;
}

#idea-input:focus,
#product-idea-input:focus,
#mobile-idea-input:focus,
#nextgen-input:focus,
#feedback-input:focus {
  border: 1px solid var(--color-primary);
  background: var(--color-surface);
}

.idea-composer-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.idea-preview-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.idea-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.idea-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
}

.ideas-composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.btn-idea-attach {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-idea-attach:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.btn-idea-submit {
  padding: 8px 22px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.btn-idea-submit:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

/* List */
.ideas-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Global view: one block per product */
.product-ideas-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.product-ideas-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  transition: all var(--transition);
}

.product-ideas-header:hover {
  background: var(--color-primary-light);
}

/* 未分类分组：无点击跳转，提示可归类 */
.uncategorized-group .product-ideas-header {
  cursor: default;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.06), var(--color-bg));
}

.uncategorized-group .product-ideas-header:hover {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), var(--color-bg));
}

.product-ideas-hint {
  font-size: 11px;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  margin-right: 4px;
}

.product-ideas-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-ideas-status {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.product-ideas-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  flex-shrink: 0;
}

.product-ideas-open {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  transition: color var(--transition);
}

.product-ideas-header:hover .product-ideas-open {
  color: var(--color-primary);
}

.product-ideas-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ideas-empty-sm {
  padding: 14px;
  font-size: 12px;
}

.ideas-group-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ideas-group-count {
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
}

.ideas-group-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ideas-empty {
  padding: 24px;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: 13px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
}

/* Idea card */
.idea-card {
  display: flex;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.idea-card:hover {
  box-shadow: var(--shadow-md);
}

.idea-card.done {
  background: var(--color-bg);
}

.idea-card.cancelled {
  background: var(--color-bg);
  opacity: 0.72;
}

.idea-card-main {
  flex: 1;
  min-width: 0;
}

.idea-text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text);
  white-space: pre-wrap;
  word-break: break-word;
}

.idea-card.done .idea-text {
  color: var(--color-text-secondary);
  text-decoration: line-through;
  text-decoration-color: #CBD5E1;
}

.idea-card.cancelled .idea-text {
  color: var(--color-text-tertiary);
  text-decoration: line-through;
  text-decoration-color: #CBD5E1;
}

.idea-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.idea-thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  cursor: zoom-in;
  transition: transform var(--transition);
}

.idea-thumb:hover {
  transform: scale(1.03);
}

.idea-time {
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-text-tertiary);
}

/* Idea actions */
.idea-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.idea-btn-done, .idea-btn-cancel {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: all var(--transition);
}

.idea-btn-done {
  color: var(--color-success);
}

.idea-btn-done:hover {
  background: var(--color-success);
  color: #fff;
  border-color: var(--color-success);
  transform: scale(1.1);
}

.idea-btn-cancel {
  color: var(--color-danger);
}

.idea-btn-cancel:hover {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
  transform: scale(1.1);
}

.idea-btn-edit,
.idea-btn-save,
.idea-btn-edit-cancel {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: all var(--transition);
}

.idea-btn-edit {
  color: var(--color-primary);
}

.idea-btn-edit:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  transform: scale(1.1);
}

.idea-btn-move {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: all var(--transition);
  color: #f59e0b;
}

.idea-btn-move:hover {
  background: #f59e0b;
  color: #fff;
  border-color: #f59e0b;
  transform: scale(1.1);
}

.idea-btn-save {
  color: var(--color-success);
}

.idea-btn-save:hover {
  background: var(--color-success);
  color: #fff;
  border-color: var(--color-success);
  transform: scale(1.1);
}

.idea-btn-edit-cancel {
  color: var(--color-text-secondary);
}

.idea-btn-edit-cancel:hover {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-text-secondary);
  transform: scale(1.1);
}

.idea-card.editing {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.idea-edit-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.55;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-height: 64px;
  background: var(--color-surface);
}

.idea-edit-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.idea-status-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
}

.idea-status-tag.done {
  background: #ECFDF5;
  color: #059669;
}

.idea-status-tag.cancelled {
  background: var(--color-bg);
  color: var(--color-text-tertiary);
  border: 1px solid var(--color-border);
}

.idea-btn-restore {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 13px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.idea-btn-restore:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* Star button */
.idea-btn-star {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-tertiary);
  transition: all var(--transition);
}

.idea-btn-star:hover {
  background: #FEF3C7;
  color: #F59E0B;
  border-color: #FCD34D;
  transform: scale(1.1);
}

.idea-btn-star.starred {
  color: #F59E0B;
  border-color: #FCD34D;
  background: #FFFBEB;
}

.idea-btn-star.starred:hover {
  color: var(--color-text-tertiary);
  background: var(--color-surface);
  border-color: var(--color-border);
}

.idea-card.starred {
  border-color: #FCD34D;
  background: #FFFBEB;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15), var(--shadow-sm);
}

.idea-card.starred:hover {
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2), var(--shadow-md);
}

/* ===== Mobile: Nav Drawer ===== */
.btn-hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--color-text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-hamburger:active { background: var(--color-bg); }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
}

/* ===== Mobile: Bottom Dock ===== */
.mobile-dock {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dock-btn {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  transition: all var(--transition);
  flex-shrink: 0;
}

.dock-btn:active { transform: scale(0.92); }

.dock-btn-main {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
  transition: all var(--transition);
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0 6px;
}

.dock-btn-main:active { transform: scale(0.94); }

.dock-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--color-danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--color-surface);
}

/* ===== Mobile: Quick Idea Sheet ===== */
.idea-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 110;
  animation: fadeIn 0.2s ease;
}

.idea-sheet {
  width: 100%;
  max-width: 560px;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.25s ease;
}

.idea-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.idea-sheet-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.idea-sheet-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.idea-sheet-close:active { background: var(--color-border); }

/* ===== Final Stage (最终产品) ===== */

.final-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.final-section:last-child { margin-bottom: 0; }

.final-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.final-empty-hint {
  color: #9CA3AF;
  font-size: 13px;
  padding: 8px 0;
}

/* File list */
.final-file-list { margin-bottom: 10px; }
.final-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.final-file-name {
  flex: 1;
  font-size: 13px;
  color: var(--color-primary);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.final-file-name:hover { text-decoration: underline; }
.final-file-size { font-size: 11px; color: #9CA3AF; white-space: nowrap; }

.btn-final-upload {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  font-size: 13px;
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: all 0.15s;
}
.btn-final-upload:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* 通用文件上传区：支持点击、拖拽、粘贴 */
.final-upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  color: var(--color-text-tertiary);
  transition: all 0.15s;
  cursor: pointer;
  margin-top: 10px;
  outline: none;
}
.final-upload-zone:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.final-upload-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: var(--color-primary);
}
.final-upload-zone.uploading {
  opacity: 0.7;
  cursor: wait;
}
.final-upload-zone:focus {
  border-color: var(--color-primary);
}
.final-upload-zone-icon { font-size: 24px; margin-bottom: 6px; }
.final-upload-zone-hint { font-size: 12px; line-height: 1.5; }

.btn-final-add {
  display: inline-flex;
  align-items: center;
  padding: 8px 18px;
  font-size: 13px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.15s;
}
.btn-final-add:hover { background: var(--color-primary); color: #fff; }

.btn-final-delete {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #9CA3AF;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-final-delete:hover { background: #FEF2F2; color: #EF4444; border-color: #FECACA; }

.btn-final-pdf {
  margin-left: auto;
  padding: 5px 14px;
  font-size: 12px;
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-final-pdf:hover { background: #DBEAFE; }

/* SKU Cards Grid */
.final-sku-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.final-sku-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px;
}
.final-sku-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}
.final-sku-name {
  flex: 1;
  border: none;
  background: var(--color-surface);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--color-text);
}
.final-sku-name:focus { outline: 2px solid var(--color-primary); outline-offset: -2px; }

.final-sku-image-area {
  width: 100%;
  height: 140px;
  border: 1px dashed var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-surface);
  transition: border-color 0.15s;
}
.final-sku-image-area:hover { border-color: var(--color-primary); }
.final-sku-image-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.final-upload-placeholder {
  color: #9CA3AF;
  font-size: 13px;
}

/* Materials Table */
.final-table-wrap {
  overflow-x: auto;
  margin-bottom: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.final-materials-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 900px;
}
.final-materials-table th {
  background: var(--color-bg);
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
.final-materials-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
}
.final-materials-table td input,
.final-materials-table td select {
  width: 100%;
  min-width: 70px;
  border: none;
  background: transparent;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--color-text);
  border-radius: 3px;
}
.final-materials-table td input:focus,
.final-materials-table td select:focus {
  background: var(--color-surface);
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}
.final-materials-table td select { cursor: pointer; }

.final-mat-img-cell {
  cursor: pointer;
  width: 56px;
  height: 44px;
  text-align: center;
  vertical-align: middle;
  border-radius: 4px;
  transition: background 0.15s;
}
.final-mat-img-cell:hover { background: #F9FAFB; }
.final-mat-thumb {
  max-width: 48px;
  max-height: 40px;
  border-radius: 3px;
  object-fit: cover;
}

.final-upload-link { color: var(--color-primary); font-size: 12px; cursor: pointer; }

/* ===== Feedback Stage (用户反馈) ===== */

.fb-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.fb-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.fb-field label {
  font-size: 11px;
  color: var(--color-text-secondary);
  font-weight: 500;
}
.fb-field select {
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  width: 110px;
  flex-shrink: 0;
}
.fb-field.fb-actions {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.fb-field.fb-actions button {
  white-space: nowrap;
  flex-shrink: 0;
}
.fb-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.fb-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.fb-tag.importance-高 { background: #FEE2E2; color: #DC2626; }
.fb-tag.importance-中 { background: #FEF3C7; color: #D97706; }
.fb-tag.importance-低 { background: #E5E7EB; color: #6B7280; }
.fb-tag.prevalence-高 { background: #DBEAFE; color: #2563EB; }
.fb-tag.prevalence-中 { background: #EDE9FE; color: #7C3AED; }
.fb-tag.prevalence-低 { background: #E5E7EB; color: #6B7280; }

/* ===== Mobile Responsive (≤768px) ===== */
@media (max-width: 768px) {
  body { font-size: 15px; }

  /* Prevent iOS zoom-on-focus: inputs need >=16px */
  input, textarea, select {
    font-size: 16px;
  }

  /* Nav becomes a slide-in drawer */
  .project-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--nav-width);
    min-width: var(--nav-width);
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 95;
    box-shadow: var(--shadow-lg);
  }

  .project-nav.mobile-open { transform: translateX(0); }

  /* Top bar */
  .btn-hamburger { display: flex; }
  .top-bar { padding: 0 12px; }
  .top-bar-left { gap: 6px; flex: 1; min-width: 0; }
  .project-title-input { width: auto; flex: 1; min-width: 0; font-size: 15px; }
  .progress-bar { width: 70px; }
  .progress-text { font-size: 11px; }
  .btn-delete-project { padding: 4px 8px; }

  /* Content areas: tighter padding + space for dock */
  .pipeline-area { padding: 14px 12px; }
  .ideas-panel { padding: 14px 12px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .product-ideas-panel { padding: 14px 12px calc(96px + env(safe-area-inset-bottom, 0px)); }

  /* Stage flow: horizontal scroll instead of wrap */
  .stage-flow {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .stage-flow::-webkit-scrollbar { display: none; }
  .stage-node { flex-shrink: 0; }
  .stage-connector { display: none; }

  /* Pipeline tabs */
  .pipeline-tabs { padding: 0 12px; }
  .pipeline-tab { font-size: 13px; padding: 8px 12px; }

  /* Chat: full screen on mobile */
  .chat-window {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
  .chat-fab { display: none; }  /* AI moves into the dock */

  /* Dock shows on mobile */
  .mobile-dock { display: flex; }

  /* Bottom sheet full-width feel */
  .idea-sheet { max-width: 100%; }

  /* Bigger touch targets for idea actions */
  .idea-btn-done, .idea-btn-cancel,
  .idea-btn-edit, .idea-btn-save, .idea-btn-edit-cancel {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .idea-btn-restore {
    width: 34px;
    height: 34px;
  }
  .btn-idea-attach, .btn-idea-submit { padding: 10px 18px; font-size: 14px; }
  .idea-product-select { font-size: 15px; padding: 11px 12px; }

  /* Product cards in nav: easier tap */
  .project-nav-item { padding: 10px 10px; }

  /* Overlay dialog fits mobile */
  .overlay-dialog { width: calc(100vw - 48px); max-width: 360px; }
}

/* ===== Inspiration Photo Wall ===== */
.inspiration-view {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.inspiration-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Big upload zone */
.insp-upload-zone {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.insp-upload-zone:hover, .insp-upload-zone.dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}
.insp-upload-icon { font-size: 40px; line-height: 1; }
.insp-upload-hint {
  margin-top: 8px;
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
}

/* Pending uploads */
.insp-pending {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
}
.insp-pending-thumb {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.insp-pending-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.insp-pending-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 13px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  border: none;
}

.insp-pending-bar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
  justify-content: center;
}
.insp-pending-bar input {
  flex: 1;
  max-width: 420px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 13px;
  color: var(--color-text);
}
.insp-pending-bar input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Filter bar */
.insp-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.insp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.insp-tag-chip {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.insp-tag-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.insp-tag-chip.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.insp-fav-filter {
  padding: 6px 14px;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.insp-fav-filter:hover { border-color: var(--color-primary); color: var(--color-primary); }
.insp-fav-filter.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Photo wall grid */
.insp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.insp-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition);
}
.insp-card:hover { box-shadow: var(--shadow-sm); }

.insp-card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--color-bg);
}
.insp-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.insp-card-fav {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: none;
  font-size: 16px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.insp-card-fav.on { background: #FFF7ED; }
.insp-card-del {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  font-size: 13px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
}
.insp-card-del:hover { background: rgba(220,38,38,0.85); }

.insp-card-body {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.insp-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  overflow: hidden;
}
.insp-card-tag {
  font-size: 11px;
  color: var(--color-primary);
  background: var(--color-primary-light);
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
.insp-card-untagged { font-size: 11px; color: var(--color-text-tertiary); }
.insp-card-edit {
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.insp-card-edit:hover { border-color: var(--color-primary); color: var(--color-primary); }

.insp-empty {
  text-align: center;
  color: var(--color-text-tertiary);
  padding: 60px 0;
}
.insp-empty .icon { font-size: 48px; }
.insp-empty p { margin-top: 10px; font-size: 13px; line-height: 1.7; }

/* Mobile responsive: 2 columns */
@media (max-width: 640px) {
  .inspiration-panel { padding: 14px; gap: 14px; }
  .insp-upload-zone { padding: 20px 12px; }
  .insp-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .insp-pending-bar { flex-direction: column; }
  .insp-pending-bar input { max-width: 100%; }
}
