/* ============================================================
   VIZinSITU Clone — Feuille de style consolidée
   Thème : Dark Pro, couleur d'accentuation bleue
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:       #020617;
  --bg-900:        #0f172a;
  --bg-800:        #1e293b;
  --bg-700:        #334155;
  --bg-600:        #475569;
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --border:        #1e293b;
  --border-light:  #334155;
  --accent:        #3b82f6;
  --accent-hover:  #2563eb;
  --accent-dim:    rgba(59,130,246,0.15);
  --accent-glow:   rgba(59,130,246,0.3);
  --success:       #10b981;
  --warning:       #f59e0b;
  --error:         #ef4444;
  --radius-sm:     6px;
  --radius-md:     10px;
  --radius-lg:     14px;
  --radius-xl:     18px;
  --transition:    200ms ease;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 25px rgba(0,0,0,0.6);
  --font:          'Inter', system-ui, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Scrollbar custom ───────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-700); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-600); }

/* ── Layout principal ───────────────────────────────────────── */
#app {
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 300px 1fr 260px;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────── */
#header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(15,23,42,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(59,130,246,0.4);
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
}

.brand-title em { font-style: italic; font-size: 0.65em; opacity: 0.7; }
.brand-subtitle {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 2px;
}

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

#status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  color: #10b981;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#status-indicator .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse 2s infinite;
}

#status-indicator.offline { color: var(--error); border-color: rgba(239,68,68,0.2); background: rgba(239,68,68,0.1); }
#status-indicator.offline .dot { background: var(--error); }
#status-indicator.loading { color: var(--warning); border-color: rgba(245,158,11,0.2); background: rgba(245,158,11,0.1); }
#status-indicator.loading .dot { background: var(--warning); }

/* ── Sidebar gauche ─────────────────────────────────────────── */
#sidebar-left {
  background: var(--bg-900);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(15,23,42,0.5);
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  padding: 10px 2px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition);
  position: relative;
}

.sidebar-tab.active {
  color: var(--text-primary);
}

.sidebar-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.sidebar-panel { display: none; }
.sidebar-panel.active { display: block; }

/* Sections */
.section {
  margin-bottom: 24px;
}

.section-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Sélecteur de qualité ───────────────────────────────────── */
.quality-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.quality-btn {
  padding: 8px 4px;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 800;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.quality-btn:hover { background: var(--bg-800); color: var(--text-primary); }
.quality-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Slider générique ───────────────────────────────────────── */
.slider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slider-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.slider-value { font-size: 10px; font-weight: 700; color: var(--accent); font-family: monospace; }

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-700);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
  cursor: pointer;
  transition: transform var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

/* ── 4 axes de précision ────────────────────────────────────── */
.axis-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.axis-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.axis-val {
  font-size: 10px;
  font-weight: 700;
  font-family: monospace;
  color: var(--accent);
  min-width: 32px;
  text-align: right;
}

.axis-hints {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 3px;
  opacity: 0.7;
}

/* Couleur du track selon l'axe */
.axis-slider--arch::-webkit-slider-thumb { background: #60a5fa; box-shadow: 0 0 6px rgba(96,165,250,0.4); }
.axis-slider--mat::-webkit-slider-thumb  { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.4); }
.axis-slider--atmo::-webkit-slider-thumb { background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,0.4); }

/* Bouton verrou cadrage */
.lock-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-800);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}
.lock-btn.active {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.45);
  color: #93c5fd;
}
.lock-btn:hover { opacity: 0.85; }

/* ── Préréglages (grid de cartes) ───────────────────────────── */
.preset-section { margin-bottom: 20px; }

.preset-category {
  font-size: 10px;
  font-weight: 900;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 10px 0 6px;
  padding-left: 2px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.preset-card {
  position: relative;
  padding: 8px 10px;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  overflow: hidden;
}

.preset-card:hover {
  background: var(--bg-800);
  border-color: var(--bg-600);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.preset-card.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 10px var(--accent-glow);
}

.preset-card .check-icon {
  position: absolute;
  top: 4px; right: 4px;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  opacity: 0;
  transition: opacity var(--transition);
}
.preset-card.active .check-icon { opacity: 1; }

/* Styles 2x2 visuels */
/* ── Style Picker (liste groupée par famille) ─────────────────── */
#grid-styles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.style-family-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.style-family-header:first-child { padding-top: 2px; }

.style-family-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Style chips (pattern preset) ─────────────────────────── */
.style-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
}
.style-swatch-dot {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}
.style-chip-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  font-weight: 600;
  color: inherit;
}
.style-chip-hint {
  flex-shrink: 0;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 9px;
  color: var(--text-muted);
}
.style-chip.active .style-chip-hint { color: #93c5fd; }

/* ── Tooltip aperçu style ──────────────────────────────────── */
.style-tooltip {
  position: fixed;
  z-index: 9999;
  width: 160px;
  background: var(--bg-800);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transform: translateX(-4px) scale(0.96);
  transform-origin: left center;
  transition: opacity 0.14s, transform 0.14s;
}
.style-tooltip.visible { opacity: 1; transform: translateX(0) scale(1); }
.stt-swatch { width: 100%; height: 64px; }
.stt-name { padding: 8px 10px 2px; font-size: 11px; font-weight: 700; color: var(--text-primary); }
.stt-hint { padding: 0 10px 9px; font-size: 9px; color: var(--text-muted); line-height: 1.5; }

.style-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.style-item:hover {
  background: var(--bg-800);
  border-color: var(--border-light);
}
.style-item.active {
  background: var(--bg-800);
  border-color: var(--accent);
}

.style-swatch {
  width: 28px; height: 28px;
  border-radius: 5px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.06);
}

.style-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.style-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.style-hint {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.style-check {
  font-size: 9px;
  color: var(--accent);
  opacity: 0;
  flex-shrink: 0;
  transition: opacity var(--transition);
}
.style-item.active .style-check { opacity: 1; }

/* ── Widget Soleil ──────────────────────────────────────────── */
#sun-widget {
  width: 100%;
  height: 110px;
  position: relative;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: crosshair;
  margin-bottom: 8px;
}

.sun-horizon {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--bg-600), transparent);
}

.sun-axis-v {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--bg-600), transparent);
}

.sun-label {
  position: absolute;
  font-size: 9px;
  font-weight: 900;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  pointer-events: none;
}

#sun-cursor {
  position: absolute;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #fef08a, #facc15 60%, #eab308);
  box-shadow: 0 0 12px rgba(250,204,21,0.7), 0 0 24px rgba(250,204,21,0.3);
  border: 1px solid rgba(255,255,255,0.3);
  transform: translate(-50%, -50%);
  cursor: grab;
  transition: box-shadow var(--transition);
  z-index: 2;
}

#sun-cursor:hover { box-shadow: 0 0 18px rgba(250,204,21,0.9); }
#sun-cursor:active { cursor: grabbing; }

.sun-values {
  font-size: 10px;
  font-family: monospace;
  color: var(--accent);
  text-align: center;
}

/* ── Images de référence ────────────────────────────────────── */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.ref-item {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-light);
  position: relative;
  background: var(--bg-900);
}

.ref-item img { width: 100%; height: 100%; object-fit: cover; }

.ref-item .ref-delete {
  position: absolute;
  top: 3px; right: 3px;
  width: 18px; height: 18px;
  background: rgba(0,0,0,0.7);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
  cursor: pointer;
  font-size: 10px;
  color: white;
}

.ref-item:hover .ref-delete { opacity: 1; }

.ref-add {
  aspect-ratio: 1;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 18px;
}

.ref-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ── Bouton générer ─────────────────────────────────────────── */
.generate-bar {
  padding: 10px 16px 12px;
  background: rgba(15,23,42,0.8);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Sélecteur modèle IA ──────────────────────────────────────── */
.model-selector {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 4px;
}

.model-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.model-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.06);
}

.model-btn[data-model="gemini"].active {
  background: rgba(66,133,244,0.22);
  border-color: rgba(66,133,244,0.5);
  color: #8ab4f8;
  box-shadow: 0 0 8px rgba(66,133,244,0.2);
}

.model-btn[data-model="openai"].active {
  background: rgba(16,163,127,0.22);
  border-color: rgba(16,163,127,0.5);
  color: #34d399;
  box-shadow: 0 0 8px rgba(16,163,127,0.2);
}

.model-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.variant-selector {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.variant-btn {
  flex: 1;
  padding: 5px 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition);
}

.variant-btn:hover {
  background: rgba(59,130,246,0.15);
  border-color: var(--accent-dim);
  color: var(--accent);
}

.variant-btn.active {
  background: rgba(59,130,246,0.2);
  border-color: var(--accent);
  color: var(--accent);
}

/* Multi-variant grid */
.variants-grid {
  display: grid;
  gap: 4px;
  width: 100%;
  height: 100%;
}
.variants-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.variants-grid.grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.variants-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  border-radius: 2px;
  transition: transform 0.15s;
}
.variants-grid img:hover { transform: scale(1.02); }

#btn-generate {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border: none;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 900;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 15px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

#btn-generate::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
}

#btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--accent-glow);
}

#btn-generate:active { transform: translateY(0); }

#btn-generate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#btn-generate .btn-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

#btn-generate.loading .btn-spinner { display: block; }
#btn-generate.loading .btn-label { display: none; }

/* ── Zone centrale (canvas) ─────────────────────────────────── */
#canvas-zone {
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
  position: relative;
}

/* Barre d'outils canvas */
#canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(15,23,42,0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  background: var(--bg-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.tool-btn {
  width: 30px; height: 30px;
  border: none;
  background: none;
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 11px;
}

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

.tool-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 8px var(--accent-glow);
}

.tool-btn.danger { color: var(--error); }
.tool-btn.danger:hover { background: rgba(239,68,68,0.1); }

.tool-sep { width: 1px; height: 20px; background: var(--border-light); margin: 0 4px; }

/* Prompt inline */
#inline-prompt {
  flex: 1;
  min-width: 200px;
}

#inline-prompt textarea {
  width: 100%;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 11px;
  color: var(--text-primary);
  outline: none;
  resize: none;
  font-family: var(--font);
  line-height: 1.4;
  transition: border-color var(--transition);
}

#inline-prompt textarea:focus { border-color: var(--accent); }
#inline-prompt textarea::placeholder { color: var(--text-muted); }

/* Tolérance baguette */
#tolerance-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

#tolerance-control input { width: 60px; }

/* Contrôle opération */
.op-toggle {
  display: flex;
  background: var(--bg-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.op-btn {
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.op-btn.active { background: var(--accent); color: white; }

/* ── Viewport / drop zone ───────────────────────────────────── */
#viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

/* Upload hint */
#upload-hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 30;
  transition: opacity var(--transition);
  background: radial-gradient(ellipse at center, rgba(59,130,246,0.05) 0%, transparent 70%);
}

#upload-hint.hidden { display: none; }

.upload-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(20px);
  transition: all var(--transition);
}

#viewport.dragover .upload-icon {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 0 30px var(--accent-glow);
}

.upload-title {
  font-size: 22px;
  font-weight: 200;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.upload-sub {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3em;
}

/* Canvas container — positioned absolutely for zoom/pan via CSS transform */
#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  box-shadow: 0 0 40px rgba(0,0,0,0.8);
  border-radius: 4px;
  overflow: visible;
  display: none;
}

/* Zoom badge — cliquable pour recadrer */
#zoom-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15,23,42,0.85);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  pointer-events: auto;
  cursor: pointer;
  z-index: 50;
  backdrop-filter: blur(8px);
  display: none;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  user-select: none;
}
#zoom-badge.visible { display: block; }
#zoom-badge:hover {
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.25);
  background: rgba(30,41,59,0.9);
}

#base-image {
  display: block;
  position: relative;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

/* Calques canvas superposés */
#brush-canvas, #insertion-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

#brush-canvas { z-index: 20; pointer-events: none; }
#brush-canvas.tool-active { pointer-events: auto; }
#insertion-canvas { z-index: 15; pointer-events: none; }

/* Wrapper résultat */
#result-wrapper {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  overflow: hidden;
  z-index: 10;
}

#result-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Slider comparaison */
#comparison-slider {
  position: absolute;
  top: 0; bottom: 0;
  z-index: 50;
  width: 48px;
  transform: translateX(-50%);
  cursor: ew-resize;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#comparison-slider .slider-line {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  background: rgba(255,255,255,0.6);
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
}

#comparison-slider .slider-handle {
  width: 36px; height: 36px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e293b;
  font-size: 12px;
  z-index: 1;
}

/* Barre presets actifs */
#active-presets-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 8px 12px;
  background: rgba(2,6,23,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  z-index: 40;
}

#active-presets-bar.hidden { display: none; }

.preset-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(59,130,246,0.3);
  border-radius: 12px;
  font-size: 9px;
  font-weight: 700;
  color: #93c5fd;
  cursor: pointer;
}

.preset-chip .chip-x {
  color: rgba(255,255,255,0.4);
  font-size: 10px;
  transition: color var(--transition);
}

.preset-chip:hover .chip-x { color: white; }

/* ── Overlay chargement global ──────────────────────────────── */
#global-loader {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.75);
  backdrop-filter: blur(12px);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  display: none;
}

#global-loader.visible { display: flex; }

.loader-ring {
  width: 52px; height: 52px;
  border: 3px solid rgba(59,130,246,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loader-text {
  font-size: 10px;
  font-weight: 900;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-shadow: 0 0 20px var(--accent-glow);
}

.loader-sub {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  max-width: 280px;
  line-height: 1.6;
}

/* Barre de progression */
.loader-progress {
  width: 240px;
  height: 3px;
  background: var(--bg-800);
  border-radius: 3px;
  overflow: hidden;
}

.loader-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #6366f1);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
  animation: progress-pulse 2s ease-in-out infinite;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ── Sidebar droite (historique) ────────────────────────────── */
#sidebar-right {
  background: var(--bg-900);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.right-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(15,23,42,0.5);
  flex-shrink: 0;
}

.right-tab {
  flex: 1;
  padding: 10px 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.right-tab.active { color: var(--text-primary); }
.right-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* Panneau profil & projet */
.right-panel { display: none; flex-direction: column; }
.right-panel.active { display: flex; }

#profile-panel {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-900);
}

/* Historique */
#history-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: var(--bg-900);
  transition: all var(--transition);
  cursor: pointer;
}

.history-item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }

.history-item img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
}

.history-meta {
  padding: 6px 8px;
  background: rgba(2,6,23,0.7);
  position: absolute;
  bottom: 0; left: 0; right: 0;
  backdrop-filter: blur(4px);
}

.history-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.history-time {
  font-size: 9px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.history-seed {
  background: rgba(99,102,241,0.15);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 4px;
  padding: 1px 4px;
  font-size: 9px;
  color: #a5b4fc;
  letter-spacing: 0.02em;
}

.history-actions {
  position: absolute;
  top: 6px; right: 6px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.history-item:hover .history-actions { opacity: 1; }

.history-action-btn {
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.7);
  border: none;
  border-radius: 5px;
  color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  transition: background var(--transition);
}

.history-action-btn:hover { background: var(--accent); }
.history-action-btn.danger:hover { background: var(--error); }
.history-action-btn.set-source:hover { background: var(--success); }

.history-item.is-active-source {
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success), 0 0 12px rgba(16,185,129,0.2);
}
.history-item.is-active-source::before {
  content: 'SOURCE';
  position: absolute;
  top: 6px; left: 6px;
  background: var(--success);
  color: white;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 5px;
  border-radius: 4px;
  z-index: 2;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.8;
}

/* Bibliothèque de masques */
#mask-library-panel {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  max-height: 200px;
  overflow-y: auto;
}

.mask-lib-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mask-lib-list { display: flex; flex-direction: column; gap: 4px; }

.mask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-800);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.mask-item:hover { border-color: var(--accent); background: var(--bg-700); }

.mask-preview {
  width: 32px; height: 24px;
  border-radius: 3px;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  overflow: hidden;
  flex-shrink: 0;
}

.mask-preview img { width: 100%; height: 100%; object-fit: cover; }
.mask-name { flex: 1; font-size: 10px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Zone workflow (panneau de zone) ────────────────────────── */
#zone-panel {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 280px;
  background: var(--bg-900);
  border-right: 1px solid var(--border);
  z-index: 80;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#zone-panel.open { transform: translateX(0); }

.zone-panel-header {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-800);
}

.zone-steps {
  display: flex;
  align-items: center;
  padding: 14px;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}

.zone-step {
  flex: 1;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition);
  position: relative;
}

.zone-step.active { color: var(--accent); }
.zone-step.done { color: var(--success); }

.zone-step-sep {
  width: 16px; height: 1px;
  background: var(--border-light);
  flex-shrink: 0;
}

.zone-panel-content { flex: 1; overflow-y: auto; padding: 14px; }

.zone-step-content { display: none; }
.zone-step-content.active { display: block; }

/* ── Annotations ────────────────────────────────────────────── */
#annotation-overlay {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 210;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

#annotation-overlay > * { pointer-events: auto; }
#annotation-overlay.hidden { display: none; }

.ann-palette {
  background: rgba(15,23,42,0.92);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-lg);
}

.ann-color-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
}

.ann-color-btn.active, .ann-color-btn:hover {
  transform: scale(1.3);
  border-color: white;
}

/* ── Format selector Street View ───────────────────────────── */
.sv-fmt-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Modales ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-overlay.open .modal-box { transform: translateY(0); }

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

.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Toasts ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  align-items: flex-end;
}

.toast {
  max-width: 320px;
  padding: 12px 16px;
  background: rgba(15,23,42,0.96);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-primary);
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }

/* ── Boutons génériques ─────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.btn-secondary { background: var(--bg-800); color: var(--text-secondary); border-color: var(--border-light); }
.btn-secondary:hover { background: var(--bg-700); color: var(--text-primary); }

.btn-danger { background: rgba(239,68,68,0.1); color: var(--error); border-color: rgba(239,68,68,0.3); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-800); color: var(--text-primary); }

.btn-success { background: rgba(16,185,129,0.1); color: var(--success); border-color: rgba(16,185,129,0.3); }
.btn-success:hover { background: rgba(16,185,129,0.2); }

.btn-icon {
  padding: 6px;
  width: 30px; height: 30px;
  justify-content: center;
}

/* ── Inputs et formulaires ──────────────────────────────────── */
.input, .text-input, textarea.input {
  width: 100%;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition);
}

.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-muted); }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 28px;
  cursor: pointer;
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Responsive (réduit pour tablette) ──────────────────────── */
@media (max-width: 1200px) {
  #app {
    grid-template-columns: 260px 1fr 220px;
  }
  #sidebar-left { width: 260px; }
}

@media (max-width: 900px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: 50px 1fr 56px;
  }

  #sidebar-left, #sidebar-right {
    position: fixed;
    top: 50px;
    bottom: 56px;
    width: 280px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  #sidebar-left.open, #sidebar-right.open {
    transform: translateX(0);
  }

  #sidebar-right { left: auto; right: 0; transform: translateX(100%); }
  #sidebar-right.open { transform: translateX(0); }
}

/* ── Divers ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-blue { background: var(--accent-dim); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.badge-green { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.badge-red { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-amber { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }

.divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

.label-muted {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ── Mode Insertion ─────────────────────────────────────────── */
#insertion-panel {
  padding: 8px 12px;
  background: rgba(99,102,241,0.1);
  border-bottom: 1px solid rgba(99,102,241,0.2);
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 10px;
}

#insertion-panel.active { display: flex; }
.insertion-label { color: #a5b4fc; font-weight: 700; text-transform: uppercase; font-size: 10px; }

/* ── Perspective Grid ────────────────────────────────────────── */
#perspective-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 25;
  pointer-events: none;
}

#perspective-canvas.active { pointer-events: auto; }

/* ══════════════════════════════════════════════════════════════
   ONGLET ADN — 4 tabs (ajustement padding)
══════════════════════════════════════════════════════════════ */
/* Override du padding défini plus haut pour tenir 4 tabs */

/* ══════════════════════════════════════════════════════════════
   RÉFÉRENCES ENRICHIES
══════════════════════════════════════════════════════════════ */
.ref-item .ref-intent-badge {
  position: absolute;
  bottom: 3px; left: 3px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  background: rgba(0,0,0,0.65);
  border-radius: 4px;
  padding: 2px 3px;
  transition: transform 0.1s;
  user-select: none;
}
.ref-item .ref-intent-badge:hover { transform: scale(1.2); }

.ref-item .ref-weight-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 0 2px 0 0;
  opacity: 0.8;
  transition: width 0.2s;
}

.ref-item .ref-tooltip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 4px;
  font-size: 9px;
  font-weight: 700;
  color: white;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
  letter-spacing: 0.02em;
  line-height: 1.2;
}
.ref-item:hover .ref-tooltip { opacity: 1; }

/* ══════════════════════════════════════════════════════════════
   BIBLIOTHÈQUE MATÉRIAUX
══════════════════════════════════════════════════════════════ */
.mat-cat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.mat-cat-btn {
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.mat-cat-btn:hover {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: var(--accent-dim);
}
.mat-cat-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(59,130,246,0.15);
}

.mat-library-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}
.mat-library-grid::-webkit-scrollbar { width: 3px; }
.mat-library-grid::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.mat-card {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-900);
  transition: border-color var(--transition);
  cursor: default;
}
.mat-card:hover { border-color: var(--border); }

.mat-swatch {
  height: 36px;
  position: relative;
}
/* Texture overlay simulée */
.mat-swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.03) 0px,
    rgba(255,255,255,0.03) 1px,
    transparent 1px,
    transparent 6px
  );
}

.mat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  padding: 4px 6px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mat-actions {
  display: flex;
  gap: 2px;
  padding: 2px 4px 4px;
}

.mat-btn-ref,
.mat-btn-dna {
  flex: 1;
  font-size: 11px;
  padding: 3px 2px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  transition: all 0.12s;
  text-align: center;
  line-height: 1;
}
.mat-btn-ref:hover { background: rgba(59,130,246,0.15); border-color: var(--accent-dim); }
.mat-btn-dna:hover { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.4); }
.mat-btn-ref.active { background: rgba(59,130,246,0.25); border-color: var(--accent); }
.mat-btn-dna.active { background: rgba(99,102,241,0.25); border-color: #6366f1; }

/* ══════════════════════════════════════════════════════════════
   ADN ARCHITECTE — profils
══════════════════════════════════════════════════════════════ */
.dna-active-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: all var(--transition);
}
.dna-active-bar.hidden { display: none; }

.dna-active-name {
  font-size: 10px;
  font-weight: 700;
  color: #a5b4fc;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dna-active-swatches {
  display: flex;
  gap: 3px;
  align-items: center;
}

.dna-active-bar > button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color var(--transition);
}
.dna-active-bar > button:hover { color: #ef4444; }

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

.dna-profile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: rgba(255,255,255,0.02);
  transition: all var(--transition);
}
.dna-profile-row:hover { border-color: var(--border); background: rgba(255,255,255,0.04); }
.dna-profile-row.active {
  border-color: rgba(99,102,241,0.5);
  background: rgba(99,102,241,0.08);
}

.dna-profile-swatches {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.dna-swatch-mini {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.dna-profile-name {
  flex: 1;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dna-profile-row.active .dna-profile-name { color: #a5b4fc; }

.dna-profile-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.dna-act-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--border-light);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.dna-act-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.dna-act-btn.active { background: rgba(99,102,241,0.2); border-color: #6366f1; color: #a5b4fc; }
.dna-act-btn.danger:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: #ef4444; }

/* Éditeur DNA inline */
.dna-editor {
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: rgba(99,102,241,0.05);
  margin-top: 4px;
}
.dna-editor.hidden { display: none; }

.dna-mat-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 28px;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.dna-mat-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-dna-action {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-dna-action:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.btn-dna-action.primary {
  background: rgba(99,102,241,0.2);
  border-color: #6366f1;
  color: #a5b4fc;
}
.btn-dna-action.primary:hover { background: rgba(99,102,241,0.35); color: white; }

/* ══════════════════════════════════════════════════════════════
   BOUTON PORTAIL CLIENT
══════════════════════════════════════════════════════════════ */
.btn-portal {
  width: 100%;
  padding: 9px 14px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.35);
  border-radius: var(--radius-sm);
  color: #a5b4fc;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all var(--transition);
}
.btn-portal:hover {
  background: rgba(99,102,241,0.22);
  border-color: #6366f1;
  color: white;
  box-shadow: 0 0 16px rgba(99,102,241,0.25);
}

/* ══════════════════════════════════════════════════════════════
   BOUTON DESIGN LIBRE
══════════════════════════════════════════════════════════════ */
.btn-inspire {
  width: 100%;
  padding: 9px 14px;
  background: linear-gradient(135deg, rgba(124,58,237,0.14), rgba(139,92,246,0.1));
  border: 1px solid rgba(139,92,246,0.35);
  border-radius: 10px;
  color: #c4b5fd;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.04em;
  transition: all var(--transition);
}
.btn-inspire:hover {
  background: linear-gradient(135deg, rgba(124,58,237,0.28), rgba(139,92,246,0.22));
  border-color: rgba(167,139,250,0.6);
  color: #ede9fe;
  box-shadow: 0 0 16px rgba(139,92,246,0.2);
}
.btn-inspire:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ══════════════════════════════════════════════════════════════
   BOUTON REHAUSSEMENT PHOTORÉALISTE
══════════════════════════════════════════════════════════════ */
.enhancement-toggle {
  width: 100%;
  padding: 9px 14px;
  background: linear-gradient(135deg, rgba(217,119,6,0.1), rgba(245,158,11,0.07));
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 10px;
  color: #fcd34d;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.04em;
  transition: all var(--transition);
}
.enhancement-toggle:hover {
  background: linear-gradient(135deg, rgba(217,119,6,0.22), rgba(245,158,11,0.16));
  border-color: rgba(251,191,36,0.55);
  color: #fef3c7;
  box-shadow: 0 0 16px rgba(245,158,11,0.15);
}
.enhancement-toggle.active {
  background: linear-gradient(135deg, rgba(217,119,6,0.3), rgba(245,158,11,0.22));
  border-color: rgba(251,191,36,0.7);
  color: #fef9c3;
  box-shadow: 0 0 20px rgba(245,158,11,0.25);
}

/* ── Tabs directive masque ────────────────────────────────────── */
.mdt-tab {
  flex: 1;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 700;
  background: var(--bg-800);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  letter-spacing: 0.03em;
}
.mdt-tab.active {
  background: rgba(59,130,246,0.14);
  border-color: rgba(59,130,246,0.4);
  color: #93c5fd;
}

/* ══════════════════════════════════════════════════════════════
   MODAL PORTAIL — picker de rendus
══════════════════════════════════════════════════════════════ */
.portal-thumb {
  border-radius: 5px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.12s;
  opacity: 0.45;
  overflow: hidden;
}
.portal-thumb:hover { opacity: 0.75; }
.portal-thumb.selected {
  border-color: var(--accent);
  opacity: 1;
  box-shadow: 0 0 8px rgba(59,130,246,0.4);
}

/* ═══════════════════════════════════════════════════════════
   PRESET PICKER — Système compact de sélection
   ═══════════════════════════════════════════════════════════ */

.preset-picker { display: flex; flex-direction: column; gap: 5px; }

/* ── Filtre catégorie ─────────────────────────────────────── */
.pcat-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.pcat-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}
.pcat-btn:hover { border-color: rgba(255,255,255,0.22); color: var(--text-secondary); }
.pcat-btn.active { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.28); color: #fff; }

.pcat-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ── Zone de chips ────────────────────────────────────────── */
.pchips-area {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 132px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.pchips-area--wrap {
  flex-direction: row;
  flex-wrap: wrap;
  max-height: 112px;
}

.pchip {
  flex-shrink: 0;
  width: 100%;
  padding: 5px 9px;
  text-align: left;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  border-radius: 5px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pchips-area--wrap .pchip { width: auto; }
.pchip:hover { background: var(--bg-800); color: var(--text-primary); border-color: rgba(255,255,255,0.18); }
.pchip.active { background: var(--accent-dim); border-color: var(--accent); color: #fff; font-weight: 700; }

/* ── Accordéon saisons ────────────────────────────────────── */
.season-group + .season-group { margin-top: 3px; }

.season-tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-900);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.season-tab:hover { background: var(--bg-800); color: var(--text-secondary); }
.season-tab.has-active { color: white; }
.season-group.open .season-tab {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.15);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.season-emoji { font-size: 13px; line-height: 1; }
.season-name { flex: 1; }
.season-arrow { font-size: 13px; color: var(--text-muted); transition: transform 0.18s; }
.season-group.open .season-arrow { transform: rotate(90deg); }

.season-body {
  display: none;
  flex-direction: column;
  border: 1px solid rgba(255,255,255,0.1);
  border-top: none;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  overflow: hidden;
}
.season-group.open .season-body { display: flex; }

.season-chip {
  width: 100%;
  padding: 6px 14px;
  text-align: left;
  background: var(--bg-900);
  border: none;
  border-top: 1px solid var(--border-light);
  border-radius: 0;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.1s;
}
.season-chip:first-child { border-top: none; }
.season-chip:hover { background: var(--bg-800); color: var(--text-primary); }
.season-chip.active { background: var(--accent-dim); color: white; font-weight: 700; }

/* ── Timeline heure du jour ───────────────────────────────── */
.time-timeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  background: linear-gradient(90deg,
    #0f172a 0%, #1e3a5f 8%, #f97316 28%,
    #fbbf24 46%, #fb923c 60%, #dc2626 72%,
    #7c3aed 84%, #0f172a 100%);
  border-radius: 8px;
}

.time-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--dot-color, #64748b);
  border: 2px solid rgba(255,255,255,0.22);
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
  flex-shrink: 0;
}
.time-dot:hover { transform: scale(1.35); border-color: rgba(255,255,255,0.65); z-index: 2; }
.time-dot.active {
  transform: scale(1.5);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
  z-index: 3;
}

.time-label {
  min-height: 14px;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
