/* ============================================
   COLOR THEORY APP — DESIGN SYSTEM
   Monochrome · Frosted Glass · Minimal
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ── Tokens ────────────────────────────────── */
:root {
  --bg: #f8f7f4;
  --surface: rgba(255, 255, 255, 0.4);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.2);
  --surface-hover: rgba(255, 255, 255, 0.6);
  --border: rgba(0, 0, 0, 0.06);
  --border-focus: rgba(0, 0, 0, 0.12);
  --text: #1a1a1a;
  --text-muted: rgba(0, 0, 0, 0.5);
  --text-dim: rgba(0, 0, 0, 0.3);
  --frost-blur: 24px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --sidebar-w: 320px;
  --chat-h: 72px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
  --transition: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(0, 0, 0, 0.1);
  color: #000;
}

/* ── Splash Screen ─────────────────────────── */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 70% 60% at 50% 45%, #fdf8f2 0%, #f0ece4 60%, #e8e2d8 100%);
  cursor: pointer;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s ease;
  overflow: hidden;
}

/* Subtle noise-like texture overlay */
.splash-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(230, 57, 70, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(41, 116, 184, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 60% 20%, rgba(155, 93, 229, 0.05) 0%, transparent 40%);
  pointer-events: none;
  z-index: 1;
}

.splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  position: relative;
  z-index: 8;
}

/* Staggered entrance animations */
.splash-content > * {
  animation: splashItemIn 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.color-wheel-container { animation-delay: 0.05s !important; }
.splash-title { animation-delay: 0.2s !important; }
.splash-enter-btn { animation-delay: 0.38s !important; }

@keyframes splashItemIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ── Paint Tube Physics Container ─────────── */
.tube-container {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.paint-tube {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.25));
  pointer-events: auto;
  transition: filter 0.2s ease;
}

.paint-tube:hover {
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.35));
}

.tube-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Color Wheel (background glow) ────────── */
.color-wheel-container {
  position: relative;
  width: 180px;
  height: 180px;
  opacity: 1;
  z-index: 6;
}

.color-wheel {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
      #E63946 0deg,
      #E76F51 30deg,
      #F4A261 60deg,
      #E9C46A 90deg,
      #F2E85C 120deg,
      #A8D569 150deg,
      #2DC653 180deg,
      #2A9D8F 210deg,
      #2974B8 240deg,
      #5448C8 270deg,
      #9B5DE5 300deg,
      #D64089 330deg,
      #E63946 360deg);
  animation: wheelSpin 25s linear infinite, wheelPulse 4s ease-in-out infinite;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12), inset 0 0 0 3px rgba(255,255,255,0.2);
}

.color-wheel-glow {
  position: absolute;
  inset: -50px;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
      #E6394644, #F4A26144, #F2E85C44, #2DC65344,
      #2974B844, #9B5DE544, #D6408944, #E6394644);
  filter: blur(60px);
  animation: wheelSpin 20s linear infinite, glowPulse 4s ease-in-out infinite;
  z-index: -1;
}

@keyframes wheelSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes wheelPulse {
  0%, 100% { box-shadow: 0 8px 40px rgba(0,0,0,0.12), inset 0 0 0 3px rgba(255,255,255,0.2); }
  50%       { box-shadow: 0 12px 60px rgba(0,0,0,0.18), inset 0 0 0 3px rgba(255,255,255,0.35); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.7; transform: rotate(0deg) scale(1); }
  50%       { opacity: 1;   transform: rotate(180deg) scale(1.08); }
}

/* ── Splash Title (rainbow gradient) ──────── */
.splash-title {
  font-size: 52px;
  font-weight: 300;
  letter-spacing: -1px;
  background: linear-gradient(90deg,
      #E63946, #F4A261, #F2E85C, #2DC653,
      #2974B8, #9B5DE5, #D64089, #E63946);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShift 8s ease-in-out infinite;
  position: relative;
  z-index: 3;
}

@keyframes titleShift {

  0%,
  100% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }
}

/* ── Enter Button ─────────────────────────── */
.splash-enter-btn {
  position: relative;
  z-index: 10;
  padding: 14px 52px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #1a1a1a;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.09), 0 1px 4px rgba(0, 0, 0, 0.05), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* Shimmer sweep */
.splash-enter-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.6) 50%, transparent 60%);
  background-size: 200% 100%;
  background-position: 200% 0;
  animation: btnShimmer 3s ease-in-out 1s infinite;
  border-radius: inherit;
}

@keyframes btnShimmer {
  0%    { background-position: 200% 0; }
  100%  { background-position: -200% 0; }
}

.splash-enter-btn:hover {
  background: #fff;
  color: #000;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255,255,255,1);
  transform: translateY(-3px) scale(1.03);
  border-color: rgba(255,255,255,1);
}

.splash-enter-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* Main App wrapper */
.main-app {
  display: none;
  width: 100%;
  height: 100%;
}

.main-app.visible {
  display: contents;
}

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.12);
}

/* ── App Shell ─────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
}

/* ── Sidebar ───────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border-right: 1px solid var(--border);
  transition: width var(--transition), opacity var(--transition);
  overflow: hidden;
  z-index: 10;
}

#sidebar.collapsed {
  width: 0;
  opacity: 0;
  pointer-events: none;
}

/* Sidebar header */
.sidebar-header {
  padding: 20px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.collapse-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.collapse-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Search */
.search-wrap {
  position: sticky;
  top: 0;
  padding: 0;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.search-input::placeholder {
  color: var(--text-dim);
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
}

/* Swatch Grid */
#swatch-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

/* Individual Swatch */
.swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  cursor: grab;
  transition: all var(--transition);
  user-select: none;
}

.swatch:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.swatch:active {
  cursor: grabbing;
  transform: scale(0.96);
}

.swatch-color {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.swatch-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.swatch-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.swatch-hex {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.swatch-pantone {
  font-size: 9px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: 0.4px;
}

/* ── Sidebar Toggle (visible when collapsed) ─ */
#sidebar-toggle {
  position: fixed;
  top: 20px;
  left: 16px;
  z-index: 20;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

#sidebar-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

#sidebar-toggle.visible {
  display: flex;
}

/* ── Center Stage ──────────────────────────── */
#center-stage {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8e4db;
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Drop Zone visual feedback */
#canvas-container.drag-over::after {
  content: '';
  position: absolute;
  inset: 20px;
  border: 2px dashed rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  pointer-events: none;
  animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {

  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.8;
  }
}

/* ── Chat Bar (AI Mentor) ──────────────────── */
#chat-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(600px, calc(100vw - var(--sidebar-w) - 80px));
  z-index: 1000;
  transition: width var(--transition);
}

#sidebar.collapsed~#center-stage~#chat-bar,
#sidebar.collapsed~#chat-bar {
  width: min(600px, calc(100vw - 80px));
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 8px 10px 8px 24px;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
}

.chat-input-wrap:focus-within {
  background: #ffffff;
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  padding: 10px 0;
}

#chat-input::placeholder {
  color: var(--text-dim);
  font-weight: 300;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text);
}

/* ── Chat Response Panel ───────────────────── */
.chat-response {
  display: none;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  padding: 24px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
  animation: chat-pop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 450px;
  overflow-y: auto;
}

.chat-response.visible {
  display: block;
}

@keyframes chat-pop {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-response-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.chat-response-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.chat-response-count {
  font-size: 10px;
  color: var(--text-dim);
}

.chat-response-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

.chat-response-text strong {
  color: var(--text);
}

.chat-response-text em {
  color: var(--accent-warm);
  font-style: normal;
}

.chat-swatch-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chat-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 8px;
  background: #f5f5f5;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  cursor: grab;
  transition: all var(--transition);
}

.chat-swatch:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: var(--border-focus);
}

.chat-swatch:active {
  cursor: grabbing;
}

.chat-swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dot-color, #888);
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.chat-swatch-name {
  font-size: 10px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

/* Chat Save Palette Button */
.chat-save-palette-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  margin-top: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.chat-save-palette-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.chat-save-palette-btn.saved {
  background: rgba(80, 200, 120, 0.12);
  border-color: rgba(80, 200, 120, 0.25);
  color: #50c878;
}

/* ── Folders Toggle Button ─────────────────── */
.folders-toggle-btn {
  position: fixed;
  bottom: 80px;
  left: 24px;
  z-index: 1002;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.folders-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* ── Folders Panel ─────────────────────────── */
.folders-panel {
  position: fixed;
  bottom: 80px;
  left: 70px;
  z-index: 100;
  width: 340px;
  max-height: 460px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-lg);
}

.folders-panel.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

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

.folders-panel-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  color: var(--text-muted);
}

.folders-badge {
  font-size: 10px;
  color: var(--text-dim);
}

.folders-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Empty state */
.folders-empty {
  text-align: center;
  padding: 24px 16px;
}

.folders-empty p {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 6px;
}

.folders-empty-hint {
  font-size: 10px !important;
  color: var(--text-dim) !important;
  opacity: 0.6;
}

/* Folder card */
.folder-card {
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.3s ease;
  animation: recipe-in 0.35s ease both;
}

.folder-card.deleting {
  opacity: 0;
  transform: translateX(20px) scale(0.95);
}

.folder-card:hover {
  border-color: var(--border-focus);
}

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

.folder-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.folder-meta {
  font-size: 9px;
  color: var(--text-dim);
}

/* Folder color strip */
.folder-swatches {
  display: flex;
  gap: 3px;
  border-radius: 6px;
  overflow: hidden;
}

.folder-swatch {
  flex: 1;
  height: 24px;
  min-width: 0;
  transition: flex 0.2s ease;
}

.folder-swatch:hover {
  flex: 2;
}

.folder-swatch:first-child {
  border-radius: 6px 0 0 6px;
}

.folder-swatch:last-child {
  border-radius: 0 6px 6px 0;
}

/* Folder action buttons */
.folder-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.folder-use-btn,
.folder-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.folder-use-btn:hover {
  background: rgba(80, 200, 120, 0.1);
  border-color: rgba(80, 200, 120, 0.2);
  color: #50c878;
}

.folder-delete-btn:hover {
  background: rgba(255, 80, 80, 0.1);
  border-color: rgba(255, 80, 80, 0.2);
  color: #ff8888;
}

/* ── Drag Ghost ────────────────────────────── */
.drag-ghost {
  display: none;
  /* Handled by Canvas in sidebar.js */
}

/* ── Mix Result Overlay ────────────────────── */
.mix-result-card {
  position: fixed;
  bottom: 100px;
  left: 24px;
  z-index: 20;
  width: 260px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-lg);
}

.mix-result-card.visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.mix-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mix-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mix-count {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
}

.mix-result-body {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.mix-swatch {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.4), inset 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(0, 0, 0, 0.06);
  transition: background 0.5s ease;
}

.mix-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.mix-hex {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.mix-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mix-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 2px 8px 2px 6px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

.mix-pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pill-color);
  flex-shrink: 0;
}

.clear-basin-btn {
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.clear-basin-btn:hover {
  background: rgba(255, 80, 80, 0.12);
  border-color: rgba(255, 80, 80, 0.2);
  color: #ff8888;
}

/* ── Recipe Panel (right side) ─────────────── */
.recipe-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 150;
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition);
  pointer-events: none;
}

.recipe-panel.visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.recipe-panel-header {
  padding: 20px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.recipe-panel-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.recipe-panel-badge {
  font-size: 10px;
  color: var(--text-dim);
}

/* Recipe list */
.recipe-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Recipe header (source colors) */
.recipe-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 4px;
}

.recipe-source-colors {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}

.src-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--src-color);
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.recipe-subtitle {
  font-size: 10px;
  color: var(--text-dim);
}

/* Individual recipe card */
.recipe-card {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: recipe-in 0.4s ease both;
  transition: border-color var(--transition);
}

.recipe-card:hover {
  border-color: var(--border-focus);
}

@keyframes recipe-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Card top row: pill + info */
.recipe-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.recipe-pill {
  width: 52px;
  height: 28px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35),
    inset 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: background 0.2s ease;
}

.recipe-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.recipe-codes {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.recipe-hex {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.recipe-rgb {
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.recipe-label {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  margin: 0;
}

/* Slider row */
.recipe-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-label-left,
.slider-label-right {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: center;
}

.recipe-slider-wrap {
  flex: 1;
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

/* Range slider */
.recipe-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.recipe-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.recipe-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.recipe-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.recipe-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

/* Custom gradient track fill */
.slider-track-fill {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  transform: translateY(-50%);
  background: linear-gradient(to right, var(--color1), var(--color2));
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}

/* Save button */
.save-recipe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  align-self: flex-end;
}

.save-recipe-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
  color: var(--text-muted);
}

.save-recipe-btn.saved {
  background: rgba(80, 200, 120, 0.12);
  border-color: rgba(80, 200, 120, 0.25);
  color: #50c878;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 260px;
  }

  #chat-bar {
    width: calc(100vw - 40px);
    bottom: 16px;
  }

  .mix-result-card {
    top: auto;
    bottom: 100px;
    right: 16px;
    width: 200px;
  }

  .recipe-panel {
    width: 280px;
  }
}

@media (max-width: 480px) {
  .recipe-panel {
    width: 100vw;
    top: 50vh;
    height: 50vh;
    right: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

/* ═══════════════════════════════════════════ */
/* ── TAB BAR ───────────────────────────────── */
/* ═══════════════════════════════════════════ */
#tab-bar {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  box-shadow: var(--shadow-lg);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.3px;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  color: var(--text);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab-btn svg {
  opacity: 0.6;
  transition: opacity var(--transition);
}

.tab-btn.active svg,
.tab-btn:hover svg {
  opacity: 1;
}

/* ── View Sections ─────────────────────────── */
.view-section {
  display: none;
  width: 100%;
  height: 100vh;
  padding-top: 52px;
  /* tab bar height */
}

.view-section.active {
  display: flex;
}

/* Mixer view keeps its existing flex layout */
#mixer-view {
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

#mixer-view #app {
  flex: 1;
  display: flex;
  height: calc(100vh - 52px);
}

/* Fix sidebar height for new layout */
#mixer-view #sidebar {
  height: calc(100vh - 52px);
}

/* ═══════════════════════════════════════════ */
/* ── DESIGN BOARD ──────────────────────────── */
/* ═══════════════════════════════════════════ */
#board-view {
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* ── Board Toolbar ─────────────────────────── */
#board-toolbar {
  width: 64px;
  height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0 24px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(0, 0, 0, 0.07);
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 0 10px;
}

.toolbar-label {
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-align: center;
  text-transform: uppercase;
}

.toolbar-divider {
  width: 28px;
  height: 1px;
  background: rgba(0, 0, 0, 0.08);
  margin: 10px 0;
  border-radius: 1px;
}

.tool-btn {
  width: 42px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.tool-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.75);
  border-color: rgba(0, 0, 0, 0.07);
}

.tool-btn.active {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.85);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Upload label acts as button */
#board-upload {
  cursor: pointer;
}

/* ── Brush Settings Panel ──────────────────── */
.brush-settings {
  width: 100%;
  padding: 10px 8px;
  display: none;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.015);
  border-radius: 0;
}

.brush-settings.visible {
  display: flex;
}

.brush-setting-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.brush-setting-label {
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.brush-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 3px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.brush-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.brush-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.brush-setting-value {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.brush-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  width: 100%;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-sm);
}

.brush-preview-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
  transition: width 0.15s ease, height 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

/* ── Board Workspace ───────────────────────── */
#board-workspace {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #f5f3ef;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.18) 1px, transparent 1px);
  background-size: 24px 24px;
  height: calc(100vh - 52px - 72px);
  /* minus tab bar minus palette strip */
}

/* Make the fabric canvas transparent so the dot grid shows through */
#board-workspace canvas {
  background: transparent !important;
}

#board-drop-zone {
  width: 100%;
  height: 100%;
  position: relative;
}

#board-drop-zone canvas {
  display: block;
}

/* ── Drop Overlay ──────────────────────────── */
.board-drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.board-drop-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--text-muted);
  animation: pulse-drop 2s ease-in-out infinite;
}

.drop-overlay-content svg {
  opacity: 0.5;
}

.drop-overlay-content p {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

@keyframes pulse-drop {

  0%,
  100% {
    opacity: 0.6;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* ── Palette Strip ─────────────────────────── */
#palette-strip {
  position: fixed;
  bottom: 0;
  left: 60px;
  /* toolbar width */
  right: 0;
  z-index: 10;
  height: 72px;
  display: none;
  /* shown only when board is active */
  align-items: center;
  padding: 0 20px;
  background: var(--surface);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border-top: 1px solid var(--border);
  gap: 16px;
}

#board-view.active #palette-strip {
  display: flex;
}

.palette-strip-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  min-width: 120px;
}

.palette-strip-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}

.palette-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

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

.palette-select option {
  background: #1a1a1a;
  color: var(--text);
}

/* Color strip scroll */
.palette-strip-colors {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 0;
  -webkit-overflow-scrolling: touch;
}

.palette-strip-colors::-webkit-scrollbar {
  height: 3px;
}

.palette-strip-colors::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
}

.palette-empty-hint {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  padding: 0 8px;
}

/* Individual color button */
.strip-color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.strip-color-btn:hover {
  transform: scale(1.2);
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.strip-color-btn.active {
  border-color: #fff;
  transform: scale(1.25);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1),
    0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Active color indicator */
.active-color-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.active-color-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}

.active-color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: background 0.3s ease;
}

.active-color-hex {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

/* ── Board Responsive ──────────────────────── */
@media (max-width: 768px) {
  #board-toolbar {
    width: 48px;
  }

  .tool-btn {
    width: 34px;
    height: 34px;
  }

  #palette-strip {
    left: 48px;
    height: 64px;
    padding: 0 12px;
    gap: 10px;
  }

  #board-workspace {
    height: calc(100vh - 52px - 64px);
  }

  .palette-strip-header {
    min-width: 90px;
  }
}

/* ═══════════════════════════════════════════ */
/* ── 3D MODEL VIEWER MODAL ─────────────────── */
/* ═══════════════════════════════════════════ */
.model-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  opacity: 0;
  pointer-events: none;
  transform: scale(0.97);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.model-viewer-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

/* ── Header Bar ────────────────────────────── */
.model-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.model-viewer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.model-viewer-title svg {
  opacity: 0.7;
}

.model-mesh-info {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  transition: color 0.2s ease;
}

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

.model-action-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.model-action-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
  border-color: var(--border-focus);
}

/* ── Canvas Container ──────────────────────── */
.model-viewer-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.model-viewer-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
}

.model-viewer-container canvas:active {
  cursor: grabbing;
}

/* ── Palette Bar inside viewer ─────────────── */
.model-palette-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(12, 12, 12, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.model-palette-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.5);
  margin-right: 4px;
}

.model-palette-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 600px;
}

.model-palette-swatches .swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.model-palette-swatches .swatch:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.model-palette-swatches .swatch.active {
  border-color: #fff;
  transform: scale(1.2);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
}

.model-active-color {
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.model-active-swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ── 3D Painting Toolbar ───────────────────── */
.model-toolbar {
  position: absolute;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  z-index: 10;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.model-toolbar-label {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
}

.model-tool-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: all 0.15s ease;
}

.model-tool-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.model-tool-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.08);
}

.model-toolbar-divider {
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

/* Brush Settings */
.model-brush-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 0 2px;
}

.model-setting-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.5);
  cursor: default;
}

.model-setting-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
}

.model-setting-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

.model-setting-val {
  font-size: 9px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
}

/* ── Saved Palettes Panel (right side) ──────── */
.model-palettes-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(20, 20, 20, 0.85);
  backdrop-filter: blur(var(--frost-blur));
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  z-index: 12;
  transition: all 0.15s ease;
}

.model-palettes-toggle:hover {
  background: rgba(30, 30, 30, 0.9);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.model-palettes-toggle.active {
  background: rgba(40, 40, 40, 0.95);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.model-palettes-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 240px;
  height: 100%;
  background: var(--surface);
  backdrop-filter: blur(var(--frost-blur));
  -webkit-backdrop-filter: blur(var(--frost-blur));
  border-left: 1px solid var(--border);
  z-index: 11;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.model-palettes-panel.open {
  transform: translateX(0);
}

.model-palettes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.model-palettes-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.model-palettes-count {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 8px;
  border-radius: 10px;
}

.model-palettes-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.model-palettes-list::-webkit-scrollbar {
  width: 4px;
}

.model-palettes-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

/* Palette folder card */
.model-folder-card {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.model-folder-card:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

.model-folder-card.selected {
  border-color: rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.06);
}

.model-folder-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.model-folder-meta {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
}

.model-folder-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.model-folder-swatches .swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Empty state */
.model-palettes-empty {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

/* ── Service Design: Product Ecosystem & Context ── */
.tab-btns {
  display: flex;
  gap: 8px;
}

.context-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.context-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.archetype-select {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  cursor: pointer;
  padding-right: 4px;
}



.service-tool-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.service-tool-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  white-space: nowrap;
}

.service-select {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 11px;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
}

.service-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.service-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.service-btn:hover {
  background: #333;
  transform: translateY(-1px);
}

.service-btn svg {
  opacity: 0.8;
}

/* ── Service Design: 3D Model Surface Finish ── */
.model-finish-section {
  padding: 12px 0;
}

.model-finish-select {
  width: 100%;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 8px;
  font-family: inherit;
  font-size: 12px;
  color: #eee;
  outline: none;
  cursor: pointer;
}

.model-finish-select option {
  background: #222;
  color: #fff;
}

/* ── Product Brief Header Button ── */
.brief-top-icon {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
  z-index: 1001;
}

.brief-top-icon:hover {
  background: #333;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── Service Design: Chat Context & Tips ── */
.chat-context-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.chat-mentor-tip {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(244, 162, 97, 0.1);
  border-left: 2px solid #F4A261;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

.chat-mentor-tip strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Folder Picker Modal ── */
.folder-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.folder-picker-modal {
  width: min(420px, 90vw);
  max-height: 80vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: picker-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes picker-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.folder-picker-header {
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
}

.folder-picker-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #888;
}

.folder-picker-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.folder-picker-close:hover {
  color: #333;
}

.folder-picker-section {
  padding: 16px 20px;
}

.folder-picker-new {
  display: flex;
  gap: 8px;
}

.folder-picker-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.folder-picker-input:focus {
  border-color: #333;
}

.folder-picker-create-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
}

.folder-picker-create-btn:hover {
  background: #333;
  transform: translateY(-1px);
}

.folder-picker-divider {
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}

.folder-picker-divider::before,
.folder-picker-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #eee;
}

.folder-picker-divider span {
  font-size: 10px;
  color: #aaa;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.folder-picker-list {
  padding: 12px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.folder-picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
}

.folder-picker-option:hover {
  background: #f0f0f0;
  border-color: #ccc;
  transform: translateX(2px);
}

.folder-picker-option-swatches {
  display: flex;
  gap: 3px;
}

.folder-picker-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.folder-picker-option-name {
  font-size: 12px;
  font-weight: 600;
  color: #333;
  flex: 1;
}

.folder-picker-option-count {
  font-size: 10px;
  color: #999;
  background: #eee;
  padding: 2px 7px;
  border-radius: 6px;
}

/* ── Product Brief View (Premium Showcase) ── */
.brief-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(248, 247, 244, 0.85);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.brief-overlay.open {
  opacity: 1;
  visibility: visible;
}

.brief-container {
  width: min(1100px, 95vw);
  height: min(750px, 90vh);
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.15);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transform: translateY(30px) scale(0.98);
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.brief-overlay.open .brief-container {
  transform: translateY(0) scale(1);
}

.brief-close-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: white;
  color: #000;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.25s ease;
}

.brief-close-btn:hover {
  background: #f0f0f0;
  transform: rotate(90deg);
}

.brief-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  padding: 40px;
  gap: 40px;
}

.brief-cell {
  position: relative;
  display: flex;
  flex-direction: column;
}

/* 3D Showcase (Top Left) */
.brief-showcase {
  background: #f5f5f5;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

#brief-canvas-container {
  width: 100%;
  height: 100%;
  cursor: grab;
}

.brief-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Project Info (Top Right) */
.brief-project-info {
  justify-content: center;
  padding-left: 20px;
}

.brief-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.brief-value.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 16px;
  font-weight: 500;
  color: #000;
}

.brief-title {
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -1px;
  margin: 16px 0 24px;
  line-height: 1.1;
}

.brief-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 440px;
}

/* Specs (Bottom Left) */
.brief-specs {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
  padding-bottom: 12px;
}

.spec-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.spec-value.mono {
  font-size: 13px;
  color: #000;
}

/* BOM (Bottom Right) */
.brief-bom {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  padding-top: 40px;
}

.bom-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bom-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.bom-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}

.brief-divider {
  height: 1px;
  background: rgba(0, 0, 0, 0.05);
  margin: 20px 0;
}

.cost-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.cost-label {
  font-size: 10px;
  font-weight: 700;
  color: #000;
}

.cost-value {
  font-size: 24px;
  font-weight: 500;
  color: #000;
  letter-spacing: -0.5px;
}

/* Footer */
.brief-footer {
  padding: 24px 40px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  background: #fbfbfb;
}

.brief-action-btn {
  padding: 10px 24px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.brief-action-btn:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
}

.brief-action-btn.primary {
  background: #000;
  color: #fff;
  border: none;
}

.brief-action-btn.primary:hover {
  background: #222;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}