:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", "Aptos", "Segoe UI Variable", "HarmonyOS Sans SC", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: var(--primary); color: #fff; }

/* === Shell === */
.shell { max-width: 1200px; margin: 0 auto; padding: 16px 20px 32px; }

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  padding: 12px 20px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 1000;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* === Topbar === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-right { display: flex; gap: 6px; }

/* === Badge === */
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-muted { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }

/* === Quick Status === */
.quick-status {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.status-card { display: flex; flex-direction: column; gap: 4px; }
.status-card:last-child { grid-column: span 1; }

.status-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-card > strong {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* === Accordion === */
.accordion { display: flex; flex-direction: column; gap: 8px; }

.acc-panel {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.2s ease, background 0.3s ease;
}
.acc-panel:hover { box-shadow: var(--shadow-md); }

.acc-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.acc-trigger:hover { background: var(--surface-2); }

.acc-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.acc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.acc-name { font-size: 15px; font-weight: 600; }

.acc-arrow {
  font-size: 10px;
  color: var(--text-3);
  transition: transform 0.2s ease;
}
.acc-panel-open .acc-arrow { transform: rotate(180deg); }

.acc-content { display: none; border-top: 1px solid var(--border); }
.acc-panel-open .acc-content { display: block; }

.acc-body { padding: 16px; }

/* === Forms === */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 140px; }
.form-group.form-grow { flex: 2; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

input, select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { min-height: 72px; resize: vertical; }

select { cursor: pointer; }
.select-sm { min-height: 32px; padding: 6px 10px; font-size: 13px; }

/* === Buttons === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: var(--surface); border-color: var(--border-strong); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--text-3);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-2); }

/* === Data Manager Dropdown === */
.data-manager { position: relative; }
.data-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 100;
  padding: 4px;
}
.data-dropdown.show { display: block; }
.data-dropdown button {
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.data-dropdown button:hover { background: var(--surface-2); }
.data-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
#bgColorPicker {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}

/* === Toolbar === */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.toolbar-input { flex: 1 1 200px; min-width: 0; }
.toolbar-spacer { flex: 1; }
.hint { color: var(--text-3); font-size: 12px; margin-top: 8px; }
.hint.success { color: var(--success); }
.hint.error { color: var(--danger); }

/* === Chips === */
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
}
.chip:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25); }

/* === Case Layout === */
.case-layout { display: grid; grid-template-columns: 1fr 280px; gap: 20px; }
.case-main, .case-side { display: flex; flex-direction: column; gap: 12px; }
.case-side h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-2); }
.case-side .form-row { gap: 8px; }
.case-side .form-group { min-width: 0; }
.case-fields { padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* === Result Grid === */
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.result-card:hover { border-color: var(--border-strong); }
.result-card h4 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-main { grid-column: span 1; background: linear-gradient(135deg, var(--primary-light), var(--surface)); }
.result-wide { grid-column: span 2; }

.empty { color: var(--text-3); font-size: 13px; line-height: 1.5; }

/* === Flywheel === */
.flywheel { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.flow-step {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.flow-step::after { content: "→"; margin-left: 6px; opacity: 0.5; }
.flow-step:last-child::after { display: none; }

/* === Match Cards === */
.match-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
  background: var(--surface);
  transition: border-color 0.15s;
}
.match-card:hover { border-color: var(--primary); }
.match-card.match-top { border-color: var(--primary); background: var(--primary-light); }
.match-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.match-head h4 { margin: 0; font-size: 14px; font-weight: 600; }
.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  padding: 0 8px;
  background: linear-gradient(135deg, var(--primary-light), #dbeafe);
  color: var(--primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.match-card p { margin: 0 0 6px; font-size: 13px; color: var(--text-2); }
.meta-row { display: flex; gap: 8px; font-size: 11px; color: var(--text-3); }
.meta-row span { display: flex; align-items: center; gap: 2px; }

/* === Idea Deck === */
.idea-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
}
.idea-card:hover { border-color: var(--border-strong); }
.idea-card.idea-active { border-color: var(--primary); background: var(--primary-light); }
.idea-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.idea-head h4 { margin: 0; font-size: 14px; font-weight: 600; }
.idea-card p { margin: 0 0 8px; font-size: 13px; color: var(--text-2); }
.idea-meta { display: flex; gap: 8px; font-size: 11px; color: var(--text-3); }
.pick-idea-btn { width: 100%; margin-top: 8px; font-size: 12px; height: 30px; }

/* === Thesis Cards === */
.thesis-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 8px;
  background: var(--surface-2);
}
.thesis-card .section-kicker { display: block; font-size: 11px; font-weight: 700; color: var(--text-3); margin-bottom: 4px; }
.thesis-card p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }

/* === Claim Audit === */
.audit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.audit-card { padding: 10px; border-radius: var(--radius-sm); }
.audit-card.fact { background: var(--success-light); border: 1px solid rgba(16, 185, 129, 0.2); }
.audit-card.inference { background: var(--warning-light); border: 1px solid rgba(245, 158, 11, 0.2); }
.audit-card.assumption { background: var(--surface-2); border: 1px solid var(--border); }
.audit-card .section-kicker { display: block; font-size: 10px; font-weight: 700; color: var(--text-3); margin-bottom: 4px; text-transform: uppercase; }
.audit-card ul { margin: 0; padding-left: 14px; font-size: 12px; color: var(--text-2); line-height: 1.6; }
.audit-card li { margin-bottom: 2px; }

/* === Plan Board === */
.plan-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.phase-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}
.phase-card h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text); }
.phase-guard { background: var(--danger-light); border-color: rgba(239, 68, 68, 0.2); }
.phase-guard h4 { color: var(--danger); }
.phase-card ul { margin: 0; padding-left: 14px; font-size: 12px; color: var(--text-2); line-height: 1.6; }
.phase-card li { margin-bottom: 4px; }
.guardrail-item { margin-bottom: 6px; }
.guardrail-item span { font-size: 11px; color: var(--text-3); }
.guardrail-item strong { display: block; font-size: 12px; color: var(--text); margin-top: 2px; }

/* === Kanban === */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.kanban-col { display: flex; flex-direction: column; gap: 6px; }
.kanban-col h5 { margin: 0; font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }
.task {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px;
  font-size: 13px;
  transition: all 0.15s;
}
.task:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.task-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.task-head strong { font-size: 13px; font-weight: 500; }
.task-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.task-move-wrap { position: relative; }
.task-move-btn { position: relative; z-index: 1; }
.task-move-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 100;
  min-width: 60px;
}
.task-move-menu.show { display: block; }
.task-move-menu .mini-btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 0;
  text-align: left;
  padding: 6px 10px;
}
.task-move-menu .mini-btn:hover { background: var(--surface-2); }
.mini-btn {
  height: 22px;
  padding: 0 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s;
}
.mini-btn:hover { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.lane-empty { color: var(--text-3); font-size: 12px; text-align: center; padding: 12px 0; }

/* === Research & Order Results === */
.research-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.result-tile { display: flex; flex-direction: column; gap: 6px; }
.result-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; }

.order-results { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.order-card { padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.order-card h5 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.order-card .empty { font-size: 13px; line-height: 1.5; }

.goal-results { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.goal-card { padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.goal-card h5 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }

/* === Mini Section === */
.mini-section { margin-bottom: 10px; }
.mini-section:last-child { margin-bottom: 0; }
.mini-section h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.mini-section ul { margin: 0; padding-left: 14px; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.mini-section li { margin-bottom: 2px; }

/* === Footer === */
.footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 8px; }
.footer-text { font-size: 12px; color: var(--text-3); }

/* === Responsive === */
@media (max-width: 1024px) {
  .quick-status { grid-template-columns: repeat(2, 1fr); }
  .case-layout { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .result-wide { grid-column: span 2; }
  .audit-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .shell { padding: 12px 14px 24px; }
  .form-row { flex-direction: column; }
  .form-group { min-width: 100%; }
  .quick-status { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .result-wide { grid-column: auto; }
  .plan-board, .kanban { grid-template-columns: repeat(2, 1fr); }
  .research-results { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar-left h1 { font-size: 16px; }
  .topbar-right .btn-ghost { display: none; }
  .plan-board, .kanban { grid-template-columns: 1fr; }
  .acc-trigger { padding: 12px; }
  .acc-name { font-size: 14px; }
}

/* === AI Assistant === */
.ai-assistant {
  position: fixed;
  top: 70px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.ai-assistant.collapsed .ai-panel { display: none; }

.ai-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-assistant.collapsed {
  top: auto;
  bottom: 24px;
}
.ai-toggle:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35); }
.ai-toggle-icon { font-size: 18px; }
.ai-toggle-text { font-size: 14px; font-weight: 600; }

.ai-panel {
  width: 340px;
  height: calc(100vh - 140px);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}
.ai-header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.ai-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-close:hover { background: rgba(255,255,255,0.3); }

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

.ai-message { display: flex; gap: 8px; align-items: flex-start; }
.ai-message-user { flex-direction: row-reverse; }
.ai-message { position: relative; }
.ai-message-bot .ai-avatar { background: var(--primary-light); }
.ai-message-user .ai-avatar { background: var(--surface-2); }

.ai-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}
.ai-delete:hover { opacity: 1; }
.ai-message:hover .ai-delete { display: flex; }

.ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ai-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.ai-message-bot .ai-bubble { background: var(--surface-2); color: var(--text); }
.ai-message-user .ai-bubble { background: var(--primary); color: #fff; }

.ai-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-input-area input {
  flex: 1;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
.ai-input-area input:focus { border-color: var(--primary); outline: none; }
.ai-input-area button {
  height: 36px;
  padding: 0 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ai-input-area button:hover { background: var(--primary-dark); }
.ai-input-area button:disabled { opacity: 0.6; cursor: not-allowed; }

/* === Skills Section === */
.skills-section {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.skills-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.skill-toggle:hover { border-color: var(--primary); }
.skill-toggle input { display: none; }
.skill-toggle input:checked + span { color: var(--primary); }
.skill-toggle:has(input:checked) {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* === Dev Console === */
.dev-console {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.dev-console.collapsed .dev-panel { display: none; }

.dev-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.dev-toggle:hover { background: var(--surface-2); transform: translateY(-1px); }

.dev-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  width: 340px;
  height: calc(100vh - 140px);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dev-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
}
.dev-header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.dev-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.dev-close:hover { background: rgba(255,255,255,0.3); }

.dev-content {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

.dev-section {
  margin-bottom: 16px;
}
.dev-section h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
}

.module-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.module-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.module-item span { color: var(--text-2); }
.module-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.module-badge.active { background: var(--success-light); color: var(--success); }
.module-badge.inactive { background: var(--surface); color: var(--text-3); }

.dev-editor {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 12px;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.dev-editor:focus { border-color: var(--primary); outline: none; }

.dev-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.dev-actions button { flex: 1; }

.dev-log {
  max-height: 120px;
  overflow-y: auto;
  font-family: "SF Mono", "Monaco", "Consolas", monospace;
  font-size: 11px;
  background: #1a1a2e;
  color: #0f0;
  padding: 10px;
  border-radius: var(--radius-sm);
}
.dev-log .log-entry { margin-bottom: 4px; }
.dev-log .log-time { color: #888; margin-right: 8px; }

/* === Dev Console Tabs === */
.dev-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.dev-tab {
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-3);
  transition: all 0.2s;
}
.dev-tab:hover { color: var(--text); }
.dev-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.dev-tab-content { display: block; }
.dev-tab-content[style*="display:none"] { display: none; }

.dev-section-select {
  width: 100%;
  padding: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--surface);
}

.dev-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.dev-actions-grid button { font-size: 12px; }
