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

:root {
  --bg: #0c1520;
  --bg-card: #141f2e;
  --bg-card-hover: #1a2a3d;
  --bg-panel: #111b27;
  --accent: #269EAB;
  --accent-light: #2fb8c7;
  --text: #e2e8f0;
  --text-muted: #8896a8;
  --text-dim: #556677;
  --border: #1e2d3d;
  --radius: 10px;

  /* Status colors */
  --completed-bg: #0d3320; --completed: #22c55e; --completed-text: #86efac;
  --progress-bg: #172554; --progress: #3b82f6; --progress-text: #93c5fd;
  --validation-bg: #422006; --validation: #f59e0b; --validation-text: #fcd34d;
  --manual-bg: #2e1065; --manual: #a855f7; --manual-text: #d8b4fe;
  --pending-bg: #1e293b; --pending: #64748b; --pending-text: #94a3b8;
  --blocked-bg: #450a0a; --blocked: #ef4444; --blocked-text: #fca5a5;
  --skipped-bg: #1e293b; --skipped: #475569; --skipped-text: #64748b;
}

/* ── Scrollbars (global) ───────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
*:hover {
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Pages ────────────────────────────────────────── */
.page { display: none; }
#page-empty { display: block; } /* visible by default */

/* ── Header ───────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 32px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}

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

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { color: var(--accent); font-size: 22px; }
.logo-text { font-size: 16px; font-weight: 700; letter-spacing: 2px; color: var(--text); }

.project-select {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  min-width: 240px;
}
.project-select:focus { outline: none; border-color: var(--accent); }

.progress-info { display: flex; align-items: center; gap: 12px; }
.progress-bar {
  width: 120px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--completed));
  border-radius: 3px;
  transition: width 0.5s ease;
  width: 0%;
}
#progress-text { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-light); }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-success { background: var(--completed); color: #fff; }
.btn-success:hover:not(:disabled) { opacity: 0.9; }
.btn-danger { background: var(--blocked); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-warning { background: var(--validation); color: #000; }
.btn-warning:hover:not(:disabled) { opacity: 0.9; }
.btn-accent { background: linear-gradient(135deg, #1B3A6B, var(--accent)); color: #fff; font-weight: 700; }
.btn-accent:hover:not(:disabled) { background: linear-gradient(135deg, #1B3A6B, var(--accent-light)); box-shadow: 0 2px 12px rgba(38,158,171,0.3); }

/* ── Empty State ──────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  color: var(--text-dim);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; color: var(--border); }
.empty-state h2 { font-size: 20px; margin-bottom: 8px; color: var(--text-muted); }
.empty-state p { font-size: 14px; }

/* ── Home — Project Cards ─────────────────────────── */
.home-container { padding: 32px 40px; max-width: 1200px; margin: 0 auto; }
.home-header { margin-bottom: 24px; }
.home-header h2 { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.home-header p { font-size: 14px; color: var(--text-muted); margin: 0; }
.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.home-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: all 0.2s;
  display: flex; flex-direction: column; gap: 12px;
}
.home-card:hover {
  border-color: var(--accent); transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.home-card-client {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--accent);
}
.home-card-name { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.home-card-progress { display: flex; align-items: center; gap: 10px; }
.home-card-progress-bar {
  flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden;
}
.home-card-progress-fill {
  height: 100%; border-radius: 2px; transition: width 0.3s;
}
.home-card-progress-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.home-card-step {
  font-size: 12px; color: var(--text-dim); display: flex; align-items: center; gap: 6px;
}
.home-card-step-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.home-card-date { font-size: 11px; color: var(--text-dim); text-align: right; }

/* ── Project Creation Page ────────────────────────── */
.create-container {
  max-width: 640px;
  margin: 60px auto;
  padding: 0 32px;
}
.create-container h2 { font-size: 24px; margin-bottom: 8px; }
.create-subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 32px; }
.create-form { display: flex; flex-direction: column; gap: 20px; }
.form-row label {
  display: block; font-size: 13px; color: var(--text-muted);
}
.form-row input {
  display: block; width: 100%; margin-top: 6px;
  padding: 10px 14px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
}
.form-row input:focus { outline: none; border-color: var(--accent); }

/* Drop zone */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 32px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--bg-card);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent); background: rgba(38,158,171,0.05);
}
.dropzone-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.dropzone-text p { margin: 4px 0; }
.dropzone-hint { font-size: 12px; color: var(--text-dim); }

/* File list preview */
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px;
}
.file-item-name { color: var(--text); flex: 1; }
.file-item-size { color: var(--text-dim); font-size: 11px; margin: 0 12px; }
.file-item-remove {
  background: none; border: none; color: var(--blocked); cursor: pointer;
  font-size: 18px; padding: 0 4px; line-height: 1;
}
.file-item-remove:hover { color: var(--blocked-text); }

.create-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; }

/* ── Project Layout (Main View) ───────────────────── */
#page-project {
  flex: 1;
  overflow: hidden;
}

.project-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: 1fr auto;
  gap: 16px 24px;
  max-width: calc(100vw - 64px);
  margin: 0 auto;
  padding: 16px 32px;
  height: 100%;
  transition: grid-template-columns 0.25s ease;
}
.project-layout.pipeline-collapsed {
  grid-template-columns: 1fr 42px;
}
.project-layout.mockup-expanded {
  max-width: 100%;
}

/* ── Content Area (Center, Tabs) ──────────────────── */
.content-area {
  display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  min-height: 0;
}

.tab-bar {
  display: flex; flex-direction: column;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.tab-bar-spacer { flex: 1; }

/* Ligne primaire : groupes */
.tab-groups-row {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--border);
}
.tab-group-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-group-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}
.tab-group-btn.active {
  color: var(--accent);
  background: rgba(38, 158, 171, 0.08);
  border-bottom: 2px solid var(--accent);
}

/* Ligne secondaire : sous-onglets */
.tab-subtabs-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  min-height: 36px;
  overflow-x: auto;
}
.tab-subtabs-row .tab-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
.tab-subtabs-row .tab-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.tab-subtabs-row .tab-btn.active {
  color: var(--accent);
  background: rgba(38, 158, 171, 0.1);
}
.tab-search-toggle {
  background: none; border: none; color: var(--text-dim); font-size: 15px;
  cursor: pointer; padding: 8px 14px; transition: color 0.15s;
}
.tab-search-toggle:hover { color: var(--accent); }

.tab-search-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 16px;
  background: var(--bg-card); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.tab-search-input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 5px 10px; border-radius: 6px; font-size: 13px; width: 240px;
}
.tab-search-input:focus { outline: none; border-color: var(--accent); }
.tab-search-count { font-size: 12px; color: var(--text-dim); min-width: 80px; }
.tab-search-nav {
  background: none; border: 1px solid var(--border); color: var(--text-dim);
  width: 26px; height: 26px; border-radius: 4px; cursor: pointer; font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}
.tab-search-nav:hover { color: var(--accent); border-color: var(--accent); }
.tab-search-close {
  background: none; border: none; color: var(--text-dim); font-size: 18px;
  cursor: pointer; padding: 0 6px; line-height: 1;
}
.tab-search-close:hover { color: #ef4444; }

mark.search-highlight { background: rgba(250,204,21,0.3); color: inherit; border-radius: 2px; padding: 0 1px; }
mark.search-highlight.search-current { background: rgba(250,204,21,0.7); outline: 2px solid #facc15; }
.matrix-func-row.search-current { background: rgba(250,204,21,0.1); }

.tab-content {
  flex: 1; padding: 0; overflow-y: auto; position: relative;
  scrollbar-gutter: stable;
}
.tab-content.padded { padding: 24px; }

/* Markdown content rendering */
.md-content { font-size: 14px; line-height: 1.7; color: var(--text); }
.md-content h1, .md-content h2, .md-content h3 {
  color: var(--accent-light); margin: 20px 0 12px;
}
.md-content h1 { font-size: 22px; }
.md-content h2 { font-size: 18px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.md-content h3 { font-size: 15px; }
.md-content h4 { font-size: 14px; color: var(--text); margin: 16px 0 8px; }
.md-content p { margin: 8px 0; }
.md-content code {
  background: var(--bg-card); padding: 2px 6px; border-radius: 4px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace; font-size: 13px;
}
.md-content pre {
  background: var(--bg); padding: 16px; border-radius: 8px; overflow-x: auto;
  margin: 12px 0;
}
.md-content pre code { background: none; padding: 0; }
.md-content .table-wrapper { overflow-x: auto; margin: 12px 0; border-radius: var(--radius); }
.md-content table { border-collapse: collapse; width: 100%; }
.md-content th, .md-content td {
  padding: 8px 12px; border: 1px solid var(--border); font-size: 13px;
  text-align: left; vertical-align: top;
}
.md-content th { background: var(--bg-card); font-weight: 600; white-space: nowrap; }
.md-content td { min-width: 80px; }
.md-content ul, .md-content ol { padding-left: 24px; margin: 8px 0; }
.md-content li { margin: 4px 0; }
.md-content blockquote {
  border-left: 3px solid var(--accent); padding: 8px 16px;
  margin: 12px 0; color: var(--text-muted); background: var(--bg-card);
  border-radius: 0 8px 8px 0;
}
.md-content hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.md-content a { color: var(--accent-light); text-decoration: none; }
.md-content a:hover { text-decoration: underline; }
.md-content strong { color: var(--text); }

/* ── Chiffrage Interactif ────────────────────────────────── */
.chiffrage-toolbar {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; margin: 0 -24px;
  background: var(--bg-card); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}
.chiffrage-toolbar .chiffrage-status { flex: 1; }
/* Remove bottom padding from scroll container so sticky toolbar sits flush */
.md-toc-content:has(.chiffrage-toolbar) { padding-bottom: 0; }
.chiffrage-save-btn {
  padding: 6px 18px; border: none; border-radius: 6px;
  background: linear-gradient(135deg, #1B3A6B, var(--accent)); color: #fff; font-size: 13px;
  font-weight: 700; cursor: pointer; transition: all 0.2s;
}
.chiffrage-save-btn:hover:not(:disabled) { background: linear-gradient(135deg, #1B3A6B, var(--accent-light)); box-shadow: 0 2px 12px rgba(38,158,171,0.3); }
.chiffrage-save-btn:disabled { opacity: 0.5; cursor: wait; }
.chiffrage-cancel-btn {
  padding: 6px 18px; border: 1px solid var(--border); border-radius: 6px;
  background: transparent; color: var(--text-muted); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.chiffrage-cancel-btn:hover { border-color: var(--text-muted); color: var(--text); }
.chiffrage-status { font-size: 12px; color: var(--text-muted); }
.chiffrage-status-dirty { color: #f59e0b; }
.chiffrage-status-saved { color: #22c55e; }
.chiffrage-status-error { color: #ef4444; }

.chiffrage-delete-btn, .competitif-delete-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 16px; padding: 2px 6px; border-radius: 4px; transition: all 0.15s;
  line-height: 1; opacity: 0.4;
}
.chiffrage-delete-btn:hover, .competitif-delete-btn:hover { color: #ef4444; opacity: 1; background: rgba(239,68,68,0.1); }
.chiffrage-add-btn, .competitif-add-btn {
  background: none; border: 1px dashed var(--border); color: var(--text-muted);
  padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px;
  margin: 8px 0 4px; transition: all 0.15s;
}
.chiffrage-add-btn:hover, .competitif-add-btn:hover { border-color: var(--accent); color: var(--accent); }
td.chiffrage-actions { text-align: center; white-space: nowrap; }
.chiffrage-edit-btn, .chiffrage-save-row-btn, .competitif-edit-btn, .competitif-save-btn {
  background: none; border: none; outline: none; cursor: pointer;
  padding: 2px 6px; border-radius: 4px; transition: all 0.15s;
  line-height: 1; display: inline-flex; align-items: center;
}
.chiffrage-delete-btn:focus, .chiffrage-edit-btn:focus, .chiffrage-save-row-btn:focus,
.competitif-edit-btn:focus, .competitif-save-btn:focus, .competitif-delete-btn:focus { outline: none; }
.chiffrage-edit-btn, .competitif-edit-btn { color: var(--text-dim); opacity: 0.5; }
.chiffrage-edit-btn:hover, .competitif-edit-btn:hover { color: var(--accent); opacity: 1; }
.chiffrage-save-row-btn, .competitif-save-btn { color: #22c55e; opacity: 0.8; }
.chiffrage-save-row-btn:hover, .competitif-save-btn:hover { opacity: 1; }
.competitif-recap-table th:first-child, .competitif-recap-table td:first-child { min-width: 280px; width: 35%; }
.competitif-options-table th:first-child, .competitif-options-table td:first-child { min-width: 280px; width: 50%; }
.chiffrage-row-editing { background: rgba(38,158,171,0.05); }
.chiffrage-cell-tache { word-break: break-word; }
.chiffrage-tache-input {
  background: transparent; color: var(--text);
  border: 1px solid transparent; border-radius: 4px;
  padding: 4px 8px; font-size: 13px; width: 100%;
  transition: all 0.15s; resize: vertical;
  font-family: inherit; line-height: 1.4;
}
.chiffrage-tache-input:hover { border-color: var(--border); }
.chiffrage-tache-input:focus { outline: none; border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 2px rgba(38,158,171,0.2); }

.chiffrage-profil-select {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 8px; font-size: 13px; cursor: pointer;
  width: 100%; min-width: 90px;
}
.chiffrage-profil-select:hover { border-color: var(--accent); }
.chiffrage-profil-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(38,158,171,0.2); }

.chiffrage-jours-input {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 4px 4px; font-size: 13px; text-align: right;
  width: 100%; box-sizing: border-box;
  -moz-appearance: textfield;
}
.chiffrage-jours-input::-webkit-outer-spin-button,
.chiffrage-jours-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.chiffrage-jours-input:hover { border-color: var(--accent); }
.chiffrage-jours-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(38,158,171,0.2); }

/* Chiffrage table: fixed layout with explicit column widths */
.chiffrage-table { table-layout: fixed; }
.chiffrage-table th:nth-child(1),
.chiffrage-table td:nth-child(1) { width: 140px; }  /* # */
/* col 2 (Tâche) gets remaining space automatically */
.chiffrage-table th:nth-child(3),
.chiffrage-table td:nth-child(3) { width: 110px; }  /* Profil */
.chiffrage-table th:nth-child(4),
.chiffrage-table td:nth-child(4) { width: 60px; }   /* Jours */
.chiffrage-table th:nth-child(5),
.chiffrage-table td:nth-child(5) { width: 100px; }  /* Montant HT */
.chiffrage-table th:nth-child(6),
.chiffrage-table td:nth-child(6) { width: 64px; }   /* Actions (edit+delete) */
.chiffrage-montant { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.chiffrage-subtotal td { border-top: 2px solid var(--border); background: var(--bg-card); }
.chiffrage-subtotal td:nth-child(4),
.chiffrage-subtotal td:nth-child(5) { text-align: right; }

.chiffrage-content .table-wrapper table td:nth-child(5) { text-align: right; white-space: nowrap; }
.chiffrage-content .table-wrapper table td:nth-child(4) { text-align: right; }

/* ── Markdown TOC sidebar layout ─────────────────── */

.md-toc-layout {
  display: flex;
  height: 100%;
}

.md-toc-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 16px 0;
}
.md-toc-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 0 16px 12px;
}
.md-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.md-toc-item a {
  display: block;
  padding: 6px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.4;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
}
.md-toc-item a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}
.md-toc-item a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(38,158,171,0.08);
  font-weight: 600;
}
.md-toc-h1 a { padding-left: 16px; font-weight: 600; font-size: 13px; }
.md-toc-h2 a { padding-left: 16px; font-weight: 500; }
.md-toc-h3 a { padding-left: 28px; }
.md-toc-h4 a { padding-left: 40px; font-size: 11px; }

/* Nested collapsible TOC (architecture) */
.md-toc-nested { padding: 0; }
.md-toc-nested .md-toc-item { position: relative; }
.md-toc-nested .md-toc-item.has-children > a { padding-left: 28px; }
.md-toc-nested .md-toc-h1.has-children > a { padding-left: 28px; }
.md-toc-sub { list-style: none; padding: 0 0 0 12px; margin: 0; }
.toc-toggle {
  position: absolute; left: 4px; top: 6px; z-index: 1;
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 9px; padding: 2px 4px; line-height: 1;
  border-radius: 3px; transition: color 0.15s;
}
.toc-toggle:hover { color: var(--accent); }

/* ── Sidebar collapse toggle ───────────────────── */
.sidebar-toggle {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 4px 8px; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; border-radius: 4px;
  align-self: flex-end; margin: 0 8px 4px; flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.md-toc-sidebar, .slide-sidebar, .erd-sidebar, .matrix-sidebar, .mockup-sidebar { transition: width 0.2s ease; }
.md-toc-sidebar.collapsed,
.slide-sidebar.collapsed,
.erd-sidebar.collapsed,
.matrix-sidebar.collapsed,
.mockup-sidebar.collapsed {
  width: 36px !important; min-width: 36px; padding: 8px 2px; overflow: hidden;
}
.md-toc-sidebar.collapsed > :not(.sidebar-toggle),
.slide-sidebar.collapsed > :not(.sidebar-toggle),
.erd-sidebar.collapsed > :not(.sidebar-toggle),
.matrix-sidebar.collapsed > :not(.sidebar-toggle),
.mockup-sidebar.collapsed > :not(.mockup-sidebar-header) { display: none !important; }
.collapsed > .sidebar-toggle { align-self: center; margin: 4px auto; }
.mockup-sidebar.collapsed .mockup-sidebar-header > :not(.sidebar-toggle) { display: none !important; }
.mockup-sidebar.collapsed .mockup-sidebar-header { border-bottom: none; justify-content: center; padding: 4px 2px; }

.md-toc-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* Tab placeholders */
.tab-placeholder {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; height: 300px; color: var(--text-dim);
  text-align: center;
}
.tab-placeholder-icon { font-size: 48px; opacity: 0.3; margin-bottom: 16px; }
.tab-placeholder p { font-size: 14px; margin: 4px 0; }

/* Drop zone inside tabs (HTML, Captures) */
.tab-dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: var(--bg-card); margin-bottom: 16px;
}
.tab-dropzone:hover, .tab-dropzone.dragover {
  border-color: var(--accent); background: rgba(38,158,171,0.05);
}

/* File grid for uploaded files (screenshots, HTML) */
.file-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px; margin-top: 16px;
}
.file-grid-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px; text-align: center;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  transition: all 0.2s;
}
.file-grid-item:hover { border-color: var(--accent); }
.file-grid-icon { font-size: 32px; margin-bottom: 8px; }
.file-grid-name { font-size: 13px; color: var(--text); word-break: break-word; }
.file-grid-size { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.file-grid-preview {
  width: 100%; max-height: 200px; object-fit: contain;
  border-radius: 4px; margin-bottom: 8px;
  border: 1px solid var(--border); background: var(--bg);
  cursor: pointer;
}
.file-grid-preview:hover { opacity: 0.85; }

/* Image lightbox */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.85); display: flex;
  align-items: center; justify-content: center;
  cursor: zoom-out; animation: lightbox-fade-in 0.15s ease;
}
@keyframes lightbox-fade-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox-img {
  max-width: 90vw; max-height: 90vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute; top: 16px; right: 24px;
  background: none; border: none; color: #fff; font-size: 32px;
  cursor: pointer; opacity: 0.7; transition: opacity 0.15s;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-caption {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 13px; background: rgba(0,0,0,0.6);
  padding: 6px 16px; border-radius: 6px; white-space: nowrap;
}

/* File list (for Documents tab) */
.file-list-table { width: 100%; border-collapse: collapse; }
.file-list-table th {
  text-align: left; padding: 8px 12px; font-size: 11px;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}
.file-list-table td {
  padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--border);
}
.file-list-table tr:hover { background: var(--bg-card-hover); }
.file-delete-cell { width: 36px; text-align: center; }
.file-delete-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px;
  transition: all 0.2s; opacity: 0;
}
.file-list-table tr:hover .file-delete-btn { opacity: 1; }
.file-delete-btn:hover { color: var(--blocked); background: var(--blocked-bg); }

/* ── Pipeline Panel (Right) ───────────────────────── */
.pipeline-panel {
  display: flex; flex-direction: column;
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  min-height: 0;
  position: relative;
}

.pipeline-toggle {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 4px 8px; font-size: 18px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; border-radius: 4px; flex-shrink: 0;
}
.pipeline-toggle:hover { color: var(--text); background: rgba(255,255,255,0.05); }

.pipeline-panel.collapsed > :not(.pipeline-toggle) { display: none !important; }
.pipeline-panel.collapsed {
  align-items: center; justify-content: flex-start; padding-top: 8px;
}

.pipeline-toolbar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
}
.btn-cadrage {
  width: 100%;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.pipeline-steps {
  padding: 16px; flex: 1; overflow-y: auto;
}

.pipeline-steps .phase-section { margin-bottom: 8px; }
.pipeline-steps .phase-header { margin-bottom: 8px; }
.pipeline-steps .phase-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.phase-commercial { background: rgba(38,158,171,0.15); color: var(--accent); }
.phase-dev { background: rgba(59,130,246,0.15); color: var(--progress); }

.pipeline-steps .phase-separator {
  display: flex; align-items: center; gap: 12px; margin: 12px 0;
}
.separator-line { flex: 1; height: 1px; background: var(--border); }
.separator-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--text-dim);
}

/* Steps */
.steps-container { display: flex; flex-direction: column; gap: 3px; }

.step-card {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.step-card:hover { background: var(--bg-card-hover); border-color: var(--accent); }
.step-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 2px 8px rgba(38,158,171,0.15); }

.step-number {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 12px; font-weight: 700;
}

.step-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.step-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-skill { font-size: 10px; color: var(--text-dim); }

.step-status {
  padding: 2px 8px; border-radius: 12px; font-size: 10px; font-weight: 600; white-space: nowrap;
}

/* Status-specific styles */
.status-completed .step-number { background: var(--completed-bg); color: var(--completed); }
.status-completed .step-status { background: var(--completed-bg); color: var(--completed-text); }
.status-in_progress .step-number { background: var(--progress-bg); color: var(--progress); }
.status-in_progress .step-status { background: var(--progress-bg); color: var(--progress-text); }
.status-waiting_validation .step-number { background: var(--validation-bg); color: var(--validation); }
.status-waiting_validation .step-status { background: var(--validation-bg); color: var(--validation-text); }
.status-waiting_manual .step-number { background: var(--manual-bg); color: var(--manual); }
.status-waiting_manual .step-status { background: var(--manual-bg); color: var(--manual-text); }
.status-pending .step-number { background: var(--pending-bg); color: var(--pending); }
.status-pending .step-status { background: var(--pending-bg); color: var(--pending-text); }
.status-blocked .step-number { background: var(--blocked-bg); color: var(--blocked); }
.status-blocked .step-status { background: var(--blocked-bg); color: var(--blocked-text); }
.status-skipped .step-number { background: var(--skipped-bg); color: var(--skipped); }
.status-skipped .step-status { background: var(--skipped-bg); color: var(--skipped-text); }

/* Auto-launch checkbox */
.pipeline-auto {
  padding: 8px 16px; border-top: 1px solid var(--border);
}
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted); cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent); width: 16px; height: 16px;
}

/* Estimation mode dropdown (step 5) */
.estimation-mode-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.estimation-mode-label {
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.estimation-mode-select {
  flex: 1; padding: 4px 8px; font-size: 12px;
  border: 1px solid var(--border); border-radius: 4px;
  background: var(--bg); color: var(--text);
  font-family: inherit; cursor: pointer;
}
.estimation-mode-select:focus { outline: none; border-color: var(--accent); }

/* Action zone */
.pipeline-actions {
  padding: 12px 16px; border-top: 2px solid var(--accent);
  background: rgba(38,158,171,0.05);
}
.action-step-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text);
}
.action-step-header .step-status { margin-left: auto; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Execution Dock (fixed, only for execution banner) ── */
.bottom-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

/* ── Prompt Bar (inline in project layout) ────────── */
/* ── Prompt Panel (multi-tab) ────────────────────── */
.prompt-panel {
  grid-column: 1 / -1;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 80px;
  max-height: 70vh;
  overflow: hidden;
}
.prompt-panel-drag {
  height: 5px; cursor: ns-resize; flex-shrink: 0;
  background: transparent; position: relative;
}
.prompt-panel-drag::after {
  content: ''; position: absolute; left: 50%; top: 1px;
  transform: translateX(-50%); width: 40px; height: 3px;
  border-radius: 2px; background: var(--border); transition: background 0.15s;
}
.prompt-panel-drag:hover::after { background: var(--accent); }

.prompt-panel-header {
  display: flex; align-items: center; border-bottom: 1px solid var(--border);
  flex-shrink: 0; overflow-x: auto; gap: 0;
}
.prompt-panel-tabs { display: flex; flex: 1; overflow-x: auto; gap: 0; }
.prompt-tab {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px; font-size: 12px; color: var(--text-muted);
  cursor: pointer; border-right: 1px solid var(--border);
  white-space: nowrap; transition: background 0.15s, color 0.15s;
  max-width: 180px;
}
.prompt-tab:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.prompt-tab.active { background: rgba(38,158,171,0.1); color: var(--accent); font-weight: 600; }
.prompt-tab.running .prompt-tab-label { color: var(--progress-text); }
.prompt-tab-label { overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.prompt-tab-spinner {
  display: inline-block; width: 10px; height: 10px; border: 2px solid var(--progress);
  border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.prompt-tab-close {
  background: none; border: none; color: var(--text-dim); font-size: 14px;
  cursor: pointer; padding: 0 2px; line-height: 1; flex-shrink: 0;
}
.prompt-tab-close:hover { color: #ef4444; }
.prompt-panel-add {
  background: none; border: none; color: var(--text-dim); font-size: 16px;
  cursor: pointer; padding: 6px 12px; flex-shrink: 0; font-weight: 600;
}
.prompt-panel-add:hover { color: var(--accent); }
.prompt-panel-history {
  background: none; border: none; color: var(--text-dim); font-size: 14px;
  cursor: pointer; padding: 6px 10px; flex-shrink: 0;
}
.prompt-panel-history:hover { color: var(--accent); }

.prompt-panel-content {
  display: flex; flex: 1; overflow: hidden;
}
.prompt-panel-body {
  display: flex; flex-direction: column; flex: 1; padding: 8px 16px; gap: 4px;
  overflow: hidden; min-width: 0;
}

/* ── Todo Panel (right of prompt) ────────────────── */
.prompt-todo-panel {
  width: 260px; min-width: 220px; flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-card);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.prompt-todo-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.prompt-todo-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  letter-spacing: 0.3px;
}
.prompt-todo-progress {
  font-size: 10px; color: var(--text-dim);
  background: var(--bg); border-radius: 10px;
  padding: 2px 8px;
}
.prompt-todo-list {
  list-style: none; margin: 0; padding: 6px 0;
  overflow-y: auto; flex: 1;
}
.prompt-todo-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 12px; font-size: 12px; color: var(--text-muted);
  line-height: 1.4; transition: background 0.15s;
}
.prompt-todo-item:hover { background: var(--bg-hover); }
.prompt-todo-check {
  flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px;
  border: 2px solid var(--border); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; transition: all 0.2s;
}
.prompt-todo-item.completed .prompt-todo-check {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.prompt-todo-item.completed .prompt-todo-label {
  text-decoration: line-through; color: var(--text-dim); opacity: 0.7;
}
.prompt-todo-item.in-progress .prompt-todo-check {
  border-color: var(--accent); background: transparent;
}
.prompt-todo-item.in-progress .prompt-todo-check::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.prompt-todo-item.in-progress .prompt-todo-label {
  color: var(--text); font-weight: 500;
}
.prompt-todo-label { flex: 1; min-width: 0; word-break: break-word; }
.prompt-panel-output {
  flex: 1; overflow-y: auto; font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px; color: var(--text-muted); white-space: pre-wrap;
  line-height: 1.5; background: var(--bg); border-radius: 6px;
  padding: 8px 10px; display: none; min-height: 0;
}
.prompt-bar-top {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.prompt-bar-context {
  font-size: 11px; color: var(--text-dim); letter-spacing: 0.3px; white-space: nowrap;
}
.prompt-bar-context .project-label { color: var(--accent); font-weight: 600; }
.prompt-bar-inner { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
#prompt-input {
  flex: 1; resize: none; overflow-y: hidden;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 13px; padding: 6px 10px;
  font-family: inherit; line-height: 1.4; min-height: 32px; max-height: 80px;
}
#prompt-input:focus { outline: none; border-color: var(--accent); }
#prompt-input:disabled { opacity: 0.5; cursor: not-allowed; }
.prompt-char-count { font-size: 9px; color: var(--text-dim); pointer-events: none; white-space: nowrap; }
.prompt-char-count.near-limit { color: var(--validation); }
.prompt-char-count.at-limit { color: var(--blocked); }
.btn-prompt-reset, .btn-prompt-stop { flex-shrink: 0; height: 32px; font-size: 14px; padding: 0 8px; }
.btn-prompt-send { flex-shrink: 0; height: 32px; padding: 0 14px; font-size: 12px; }

/* ── Queue Toggle Button ─────────────────────────── */
.prompt-panel-queue-toggle {
  background: none; border: none; color: var(--text-dim); font-size: 14px;
  cursor: pointer; padding: 6px 10px; flex-shrink: 0; position: relative;
}
.prompt-panel-queue-toggle:hover { color: var(--accent); }
.queue-badge {
  position: absolute; top: 2px; right: 2px;
  background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  border-radius: 8px; padding: 0 4px;
}

/* ── Queue Panel ─────────────────────────────────── */
.queue-panel {
  background: var(--bg-panel); border-top: 1px solid var(--border);
  max-height: 280px; display: flex; flex-direction: column;
  overflow: hidden;
}
.queue-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.queue-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.queue-actions { display: flex; gap: 6px; align-items: center; }
.queue-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 16px; }
.queue-close:hover { color: var(--text); }

.queue-list {
  flex: 1; overflow-y: auto; padding: 6px 10px;
}
.queue-empty { color: var(--text-dim); font-size: 12px; text-align: center; padding: 16px 0; }

.queue-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; margin-bottom: 4px;
  background: var(--bg-card); border-radius: 6px;
  border-left: 3px solid var(--pending);
  transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.15s;
}
.queue-item.queue-status-waiting { border-left-color: var(--pending); }
.queue-item.queue-status-running { border-left-color: var(--progress); background: var(--progress-bg); }
.queue-item.queue-status-done { border-left-color: var(--completed); opacity: 0.6; }
.queue-item.queue-status-error { border-left-color: var(--blocked); opacity: 0.6; }

.queue-item-handle {
  cursor: grab; color: var(--text-dim); font-size: 14px; padding: 2px 0;
  user-select: none; min-width: 16px; text-align: center;
}
.queue-item-handle:active { cursor: grabbing; }

.queue-item-content { flex: 1; min-width: 0; }
.queue-item-status { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; }
.queue-item-label { font-weight: 500; }
.queue-item-prompt {
  font-size: 12px; color: var(--text); line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.queue-item-file {
  display: inline-block; font-size: 10px; color: var(--accent);
  background: rgba(38,158,171,0.1); padding: 1px 6px; border-radius: 4px;
  margin-top: 3px;
}

.queue-item-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.queue-item-edit, .queue-item-delete {
  background: none; border: none; cursor: pointer; font-size: 14px;
  padding: 2px 4px; opacity: 0.5; transition: opacity 0.2s;
}
.queue-item-edit:hover, .queue-item-delete:hover { opacity: 1; }

/* Drag & drop states */
.queue-item.queue-dragging { opacity: 0.4; transform: scale(0.97); }
.queue-item.queue-drag-over {
  border-top: 2px solid var(--accent);
  padding-top: 6px;
}

/* Edit inline */
.queue-edit-textarea {
  width: 100%; resize: none; background: var(--bg); border: 1px solid var(--accent);
  border-radius: 4px; color: var(--text); font-size: 12px; padding: 4px 8px;
  font-family: inherit; line-height: 1.4; min-height: 28px; max-height: 100px;
}
.queue-edit-textarea:focus { outline: none; }
.queue-edit-actions { display: flex; gap: 6px; margin-top: 4px; }

/* Queue add bar */
.queue-add-bar {
  display: flex; gap: 8px; padding: 8px 10px; flex-shrink: 0;
  border-top: 1px solid var(--border); align-items: center;
}
#queue-input {
  flex: 1; resize: none; overflow-y: hidden;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 12px; padding: 5px 8px;
  font-family: inherit; line-height: 1.4; min-height: 28px; max-height: 80px;
}
#queue-input:focus { outline: none; border-color: var(--accent); }
#queue-add-btn { flex-shrink: 0; height: 28px; padding: 0 12px; font-size: 11px; }

/* ── Execution Banner ─────────────────────────────── */
.execution-banner {
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0d1a28, #0a1018);
  border-top: 2px solid var(--accent);
  max-height: 40vh;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
  transition: max-height 0.3s ease;
}
.execution-banner.collapsed { max-height: 48px; }
.execution-banner.collapsed .execution-output { display: none; }
.execution-banner.done { border-top-color: var(--completed); }

.execution-banner-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--bg-panel);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.execution-banner-info {
  display: flex; align-items: center; gap: 12px;
}
.execution-step-name { font-size: 13px; font-weight: 600; color: var(--text); }
.execution-skill-badge {
  font-size: 11px; padding: 3px 10px; border-radius: 12px;
  background: rgba(38,158,171,0.15); color: var(--accent);
}
.execution-controls { display: flex; gap: 8px; }

.execution-spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.execution-banner.done .execution-spinner { display: none; }

.execution-output {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 12px; line-height: 1.6; color: var(--text-muted);
  white-space: pre-wrap; word-break: break-word; margin: 0;
}

/* ── PPTX Gallery (Devis tab) ────────────────────── */
.pptx-gallery {
  display: flex; flex-direction: column; gap: 16px;
}
.pptx-card {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s;
}
.pptx-card:hover { border-color: var(--accent); background: var(--bg-card-hover); }
.pptx-icon { font-size: 48px; flex-shrink: 0; }
.pptx-info { flex: 1; min-width: 0; }
.pptx-name { font-size: 16px; font-weight: 600; color: var(--text); word-break: break-word; }
.pptx-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.pptx-path { font-size: 11px; color: var(--text-dim); margin-top: 2px; font-family: 'Cascadia Code', 'Fira Code', monospace; }
.pptx-actions { display: flex; gap: 8px; flex-shrink: 0; }
.pptx-actions a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ── Slide Viewer (Devis tab) ────────────────────── */
.slide-viewer-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 16px; color: var(--text-muted);
}
.slide-viewer {
  display: flex; height: 100%; overflow: hidden;
}
.slide-sidebar {
  width: 200px; flex-shrink: 0; overflow-y: auto;
  background: var(--bg-card); border-right: 1px solid var(--border);
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.slide-thumb {
  cursor: pointer; border-radius: 6px; padding: 6px;
  border: 2px solid transparent; transition: all 0.15s;
  display: flex; flex-direction: column; gap: 4px;
}
.slide-thumb:hover { background: var(--bg-card-hover); }
.slide-thumb.active { border-color: var(--accent); background: var(--bg-card-hover); }
.slide-thumb-num {
  font-size: 10px; color: var(--text-dim); font-weight: 600;
}
.slide-thumb-canvas {
  width: 100%; border-radius: 3px; overflow: hidden;
  background: #0c1520; border: 1px solid var(--border);
}
.slide-thumb-title {
  font-size: 10px; color: var(--text-muted); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.slide-main {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.slide-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.slide-filename { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.slide-counter { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.slide-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow: auto; background: #080e18;
}
.slide-canvas-wrapper {
  width: 100%; max-width: 960px;
}

/* Slide canvas (shared between thumbnail and main view) */
.slide-canvas {
  position: relative; overflow: hidden;
  container-type: inline-size; /* Enable cqw units for proportional font sizing */
  background: #fff; /* Default white — overridden by inline bg from extraction */
}
.slide-canvas-main {
  width: 100%; border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.slide-canvas-thumb {
  width: 100%;
}

/* Slide elements */
.s-rect {
  position: absolute; pointer-events: none;
}
.s-text {
  position: absolute; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.s-para {
  font-family: 'Segoe UI', system-ui, sans-serif;
  line-height: 1.3; color: #333;
  white-space: pre-wrap; word-wrap: break-word;
  font-size: 0.9cqw; /* Fallback ~11pt on 1280-unit slides */
}

.s-img {
  position: absolute; overflow: hidden;
}
.s-img img {
  width: 100%; height: 100%; object-fit: cover;
}
.s-tbl {
  position: absolute; overflow: hidden;
}
.s-table {
  width: 100%; border-collapse: collapse; font-size: 9px; color: var(--text);
}
.s-table th, .s-table td {
  padding: 3px 6px; border: 1px solid var(--border);
  text-align: left; vertical-align: top;
}
.s-table th { background: var(--accent); color: #fff; font-weight: 600; font-size: 8px; }
.s-table td { background: var(--bg-card); font-size: 8px; }

/* (Screens sidebar removed — mockup viewer loads directly) */

/* Spinner overlay */
.doc-spinner-overlay {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; z-index: 50;
  border-radius: var(--radius);
}
.doc-spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.doc-spinner-text {
  color: #fff; font-size: 14px; font-weight: 500;
}

/* ── Data Model / ERD Tab ─────────────────────────── */
.erd-layout { display: flex; height: 100%; }
.erd-sidebar {
  width: 240px; flex-shrink: 0; background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; padding: 16px 0;
}
.erd-sidebar-title {
  font-size: 11px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 1.5px; padding: 0 16px 12px;
}
.erd-entity-list { display: flex; flex-direction: column; }
.erd-entity-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; cursor: pointer;
  border-left: 3px solid transparent; transition: all 0.15s;
}
.erd-entity-item:hover { background: rgba(255,255,255,0.03); }
.erd-entity-item.active {
  background: rgba(38,158,171,0.08); border-left-color: var(--accent);
}
.erd-entity-item-id {
  background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 8px; white-space: nowrap;
}
.erd-entity-item-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.erd-entity-item-meta { font-size: 10px; color: var(--text-dim); }

.erd-canvas-container {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}
.erd-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0;
}
.erd-toolbar-info { flex: 1; font-size: 12px; color: var(--text-muted); }
.erd-zoom-btn {
  min-width: 32px; text-align: center; padding: 4px 8px;
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); cursor: pointer; font-size: 13px;
}
.erd-zoom-btn:hover { color: var(--text); border-color: var(--accent); }

.erd-canvas-scroll {
  flex: 1; overflow: auto; position: relative;
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0) 0 0 / 20px 20px;
}
.erd-canvas { transform-origin: 0 0; transition: transform 0.15s ease; }

/* SVG entity styles */
.erd-svg { font-family: 'Segoe UI', system-ui, sans-serif; }
.erd-entity-bg { fill: var(--bg-card); stroke: var(--border); stroke-width: 1; }
.erd-entity-header { fill: var(--accent); stroke: none; }
.erd-drag-handle { cursor: grab; }
.erd-entity:active .erd-drag-handle { cursor: grabbing; }
.erd-entity-id-text { fill: rgba(255,255,255,0.7); font-size: 9px; font-weight: 700; }
.erd-entity-name-text { fill: #fff; font-size: 12px; font-weight: 700; }
.erd-col-row-even { fill: rgba(255,255,255,0.02); }
.erd-col-name { fill: var(--text); font-size: 11px; }
.erd-col-lookup { fill: var(--accent-light); font-weight: 600; }
.erd-col-type { fill: var(--text-dim); font-size: 10px; }
.erd-col-pk-icon { fill: #f59e0b; font-size: 8px; font-weight: 700; }
.erd-col-fk-icon { fill: var(--accent); font-size: 8px; font-weight: 700; }
.erd-col-more { fill: var(--text-dim); font-size: 10px; font-style: italic; }
.erd-col-toggle { cursor: pointer; }
.erd-col-toggle:hover { fill: var(--accent-light); text-decoration: underline; }

.erd-rel-line {
  fill: none; stroke: var(--text-dim); stroke-width: 1.5;
  stroke-dasharray: 6 3; opacity: 0.5; transition: all 0.2s;
}
.erd-rel-line.erd-rel-highlighted {
  stroke: var(--accent); stroke-width: 2; opacity: 1; stroke-dasharray: none;
}
.erd-rel-label { fill: var(--text-dim); font-size: 9px; opacity: 0.6; }

.erd-entity:hover .erd-entity-bg { stroke: var(--accent); stroke-width: 2; }
.erd-entity.erd-entity-selected .erd-entity-bg {
  stroke: var(--accent); stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(38,158,171,0.4));
}

/* ── Matrix Tab ───────────────────────────────────── */
.matrix-layout { display: flex; height: 100%; }
.matrix-sidebar {
  width: 240px; min-width: 240px; border-right: 1px solid var(--border);
  padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px;
}
.matrix-sidebar h3 { font-size: 13px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 8px 0; }
.matrix-cat-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.matrix-cat-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text);
  transition: background 0.15s;
}
.matrix-cat-item:hover { background: rgba(255,255,255,0.05); }
.matrix-cat-item.active { background: rgba(38,158,171,0.15); color: var(--accent); font-weight: 600; }
.matrix-cat-name { flex: 1; line-height: 1.3; }
.matrix-cat-count {
  background: rgba(255,255,255,0.08); padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; margin-left: 8px; flex-shrink: 0;
}
.matrix-cat-item.active .matrix-cat-count { background: rgba(38,158,171,0.25); }

/* ── Matrix app groups (sidebar) ───────────────────────── */
.matrix-app-group { margin-bottom: 4px; }
.matrix-app-title {
  font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 6px 8px; margin-bottom: 2px;
  cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none;
  border-radius: 4px; transition: background 0.15s; list-style: none;
}
.matrix-app-title:hover { background: rgba(255,255,255,0.04); }
.matrix-app-chevron { font-size: 10px; width: 12px; flex-shrink: 0; }
.matrix-app-count {
  margin-left: auto; font-size: 10px; opacity: 0.5;
  background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 8px;
}
.matrix-app-group-items { display: flex; flex-direction: column; gap: 0; }
.matrix-app-group.collapsed .matrix-app-group-items { display: none; }

/* ── Matrix app header (table) ─────────────────────────── */
.matrix-app-header td {
  background: rgba(38,158,171,0.10); padding: 10px 12px !important;
  border-bottom: 2px solid var(--accent); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent);
}
.matrix-app-header .matrix-app-header-device {
  font-weight: 400; font-style: italic; opacity: 0.7; margin-left: 8px; font-size: 11px;
  text-transform: none;
}

.matrix-summary { border-top: 1px solid var(--border); padding-top: 12px; }
.matrix-prio-filter { cursor: pointer; border-radius: 4px; padding: 4px 6px !important; transition: background 0.15s; }
.matrix-prio-filter:hover { background: rgba(255,255,255,0.04); }
.matrix-prio-filter.active { background: rgba(38,158,171,0.12); }
.matrix-prio-filter.active .matrix-priority-badge { opacity: 1; }
.matrix-prio-filter:not(.active) .matrix-priority-badge { opacity: 0.7; }
.matrix-stat { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
.matrix-stat span { color: var(--text-dim); }
.matrix-stat strong { color: var(--text); }

.matrix-sidebar-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.matrix-sidebar-header h3 { margin: 0; }
.matrix-sidebar-header .btn { font-size: 11px; padding: 3px 10px; }
.matrix-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.matrix-content { flex: 1; overflow: auto; padding: 0 16px 16px; }
.matrix-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.matrix-table thead { position: sticky; top: 0; z-index: 2; }
.matrix-table th {
  background: var(--bg-panel); padding: 10px 12px; text-align: left; font-weight: 600;
  border-bottom: 2px solid var(--accent); color: var(--text); white-space: nowrap;
}
.matrix-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.matrix-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.matrix-cat-header td {
  background: rgba(38,158,171,0.08); padding: 10px 12px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.matrix-cat-header strong { color: var(--accent); }
.matrix-cat-desc { color: var(--text-dim); font-size: 12px; font-style: italic; margin-left: 12px; }

.matrix-col-id { width: 70px; color: var(--text-dim); font-family: monospace; font-size: 12px; }
.matrix-col-name { min-width: 160px; white-space: normal; word-break: break-word; line-height: 1.3; }
.matrix-col-priority { width: 100px; text-align: center; }
.matrix-col-role { width: 52px; text-align: center; font-size: 11px; }

.matrix-priority-badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 600; text-transform: capitalize;
}
.matrix-priority-badge.indispensable { background: rgba(22,163,74,0.15); color: #4ade80; }
.matrix-priority-badge.important { background: rgba(217,119,6,0.15); color: #fbbf24; }
.matrix-priority-badge.optionnel { background: rgba(107,114,128,0.15); color: #9ca3af; }

/* Priority filter bar */
.matrix-priority-filter {
  display: flex; gap: 8px; padding: 10px 16px; margin-bottom: 8px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.matrix-prio-filter-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 16px; border: 1.5px solid var(--border);
  background: transparent; color: var(--text-dim); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; text-transform: capitalize;
}
.matrix-prio-filter-btn:hover { border-color: var(--text-dim); }
.matrix-prio-filter-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(99,102,241,0.08); }
.matrix-prio-filter-btn.indispensable.active { border-color: #4ade80; color: #4ade80; background: rgba(22,163,74,0.12); }
.matrix-prio-filter-btn.important.active { border-color: #fbbf24; color: #fbbf24; background: rgba(217,119,6,0.12); }
.matrix-prio-filter-btn.optionnel.active { border-color: #9ca3af; color: #9ca3af; background: rgba(107,114,128,0.12); }
.matrix-prio-filter-count {
  background: rgba(255,255,255,0.08); padding: 1px 7px; border-radius: 8px;
  font-size: 11px; font-weight: 700; min-width: 18px; text-align: center;
}

.access-yes { color: #4ade80; }
.access-no { color: #6b7280; opacity: 0.5; }
.matrix-col-role.clickable { cursor: pointer; user-select: none; }
.matrix-col-role.clickable:hover { background: rgba(255,255,255,0.06); }

.matrix-col-action { width: 36px; text-align: center; padding: 0 !important; }
.matrix-delete-btn {
  background: none; border: none; color: var(--text-dim); font-size: 16px;
  cursor: pointer; padding: 4px 8px; border-radius: 4px; opacity: 0.4;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.matrix-delete-btn:hover { opacity: 1; color: #ef4444; background: rgba(239,68,68,0.1); }

.matrix-add-row td { padding: 4px 12px !important; border-bottom: none !important; }
.matrix-add-btn {
  background: none; border: 1px dashed var(--border); color: var(--text-dim);
  font-size: 12px; cursor: pointer; padding: 4px 12px; border-radius: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.matrix-add-btn:hover { color: var(--accent); border-color: var(--accent); }

.matrix-add-form-row td { padding: 6px 12px !important; background: rgba(38,158,171,0.04); }
.matrix-add-input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 5px 10px; border-radius: 6px; font-size: 13px; width: 100%;
}
.matrix-add-input:focus { outline: none; border-color: var(--accent); }
.matrix-add-priority {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 5px 8px; border-radius: 6px; font-size: 12px;
}

/* ── Roles & Personas ─────────────────────────────── */
.roles-layout { display: flex; height: 100%; }
.roles-sidebar {
  width: 260px; min-width: 260px; border-right: 1px solid var(--border);
  padding: 12px; overflow-y: auto; display: flex; flex-direction: column;
}
.roles-sidebar h3 { font-size: 13px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 12px 0; }
.roles-sidebar.collapsed { width: 40px; min-width: 40px; }
.roles-sidebar.collapsed > :not(.sidebar-toggle) { display: none; }

.roles-sidebar-list { display: flex; flex-direction: column; gap: 4px; }
.roles-sidebar-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.roles-sidebar-item:hover { background: rgba(255,255,255,0.04); }
.roles-sidebar-item.active { background: rgba(38,158,171,0.12); }

.roles-sidebar-icon {
  width: 36px; height: 36px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.roles-sidebar-info { display: flex; flex-direction: column; min-width: 0; }
.roles-sidebar-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roles-sidebar-count { font-size: 11px; color: var(--text-dim); }

.roles-main { flex: 1; overflow-y: auto; min-width: 0; }
.roles-main-content { padding: 24px; max-width: 960px; }

/* Hero card */
.roles-hero {
  display: flex; align-items: flex-start; gap: 24px; padding: 28px;
  background: linear-gradient(135deg, var(--bg-card), rgba(38,158,171,0.06));
  border: 1px solid var(--border); border-radius: 16px; margin-bottom: 24px;
}
.roles-hero-avatar {
  width: 72px; height: 72px; border-radius: 18px; display: flex;
  align-items: center; justify-content: center; font-size: 36px;
  border: 2px solid; flex-shrink: 0;
}
.roles-hero-info { flex: 1; }
.roles-hero-id { font-size: 11px; font-family: monospace; color: var(--text-dim); margin-bottom: 4px; }
.roles-hero-name { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 8px 0; }
.roles-hero-desc { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin: 0 0 14px 0; }
.roles-hero-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.roles-badge {
  font-size: 11px; font-weight: 600; padding: 4px 12px; border-radius: 20px;
  letter-spacing: 0.3px;
}

/* Stats row */
.roles-stats-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 24px;
}
.roles-stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-align: center;
}
.roles-stat-value { font-size: 28px; font-weight: 800; margin-bottom: 4px; }
.roles-stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.roles-stat-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.roles-stat-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.roles-stat-pct { font-size: 11px; color: var(--text-dim); margin-top: 6px; }

/* Persona section */
.roles-persona-section { margin-bottom: 24px; }
.roles-persona-section h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 12px 0; }
.roles-persona-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px; border-left: 3px solid var(--role-color, var(--accent));
}
.roles-persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.roles-persona-field { display: flex; gap: 12px; align-items: flex-start; }
.roles-persona-field-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.roles-persona-field-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.roles-persona-field-value { font-size: 13px; color: var(--text); line-height: 1.5; }

/* Actions & Besoins section */
.roles-actions-section { margin-bottom: 24px; }
.roles-actions-section h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 12px 0; }
.roles-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.roles-action-card {
  display: flex; gap: 12px; padding: 14px 16px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  transition: border-color 0.15s, transform 0.15s;
}
.roles-action-card:hover { border-color: rgba(255,255,255,0.1); transform: translateY(-1px); }
.roles-action-card.action { border-left: 3px solid #3b82f6; }
.roles-action-card.need { border-left: 3px solid #f59e0b; }
.roles-action-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.roles-action-content { flex: 1; min-width: 0; }
.roles-action-type {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 4px;
}
.roles-action-card.action .roles-action-type { color: #3b82f6; }
.roles-action-card.need .roles-action-type { color: #f59e0b; }
.roles-action-quote {
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
  font-style: italic;
}

/* Modules section */
.roles-modules-section { margin-bottom: 24px; }
.roles-modules-section h3 { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 12px 0; display: flex; align-items: center; gap: 10px; }
.roles-module-count { font-size: 11px; color: var(--text-dim); font-weight: 400; background: var(--bg-card); padding: 2px 10px; border-radius: 12px; border: 1px solid var(--border); }

.roles-modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.roles-module-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; transition: border-color 0.15s;
}
.roles-module-card:hover { border-color: var(--accent); }
.roles-module-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.roles-module-name { font-size: 13px; font-weight: 600; color: var(--text); }
.roles-module-badge { font-size: 10px; color: var(--accent); background: rgba(38,158,171,0.12); padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.roles-module-funcs { display: flex; flex-direction: column; gap: 6px; }
.roles-module-func { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.roles-module-more { font-size: 11px; color: var(--text-dim); font-style: italic; padding-top: 4px; }

@media (max-width: 900px) {
  .roles-stats-row { grid-template-columns: 1fr 1fr; }
  .roles-persona-grid { grid-template-columns: 1fr; }
  .roles-sidebar { width: 200px; min-width: 200px; }
}

/* ── Persona Review ───────────────────────────────── */
.pr-layout { display: flex; height: 100%; }
.pr-sidebar {
  width: 280px; min-width: 280px; border-right: 1px solid var(--border);
  padding: 12px; overflow-y: auto; display: flex; flex-direction: column;
}
.pr-sidebar h3 { font-size: 13px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 12px 0; }
.pr-sidebar.collapsed { width: 40px; min-width: 40px; }
.pr-sidebar.collapsed > :not(.sidebar-toggle) { display: none; }

.pr-step-list { display: flex; flex-direction: column; gap: 4px; }
.pr-step-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.pr-step-item:hover:not(.disabled) { background: rgba(255,255,255,0.04); }
.pr-step-item.active { background: rgba(38,158,171,0.12); }
.pr-step-item.disabled { opacity: 0.35; cursor: not-allowed; }
.pr-step-icon { font-size: 18px; flex-shrink: 0; }
.pr-step-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pr-step-name { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-step-score { font-size: 13px; font-weight: 700; }
.pr-step-pending { font-size: 10px; color: var(--text-dim); font-style: italic; }
.pr-step-na { font-size: 10px; color: var(--text-dim); }

.pr-main { flex: 1; overflow-y: auto; min-width: 0; }
.pr-main-content { padding: 24px; max-width: 960px; }

/* Empty / Launch states */
.pr-empty-state, .pr-launch-state { text-align: center; padding: 60px 40px; }
.pr-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.pr-empty-state h3 { color: var(--text); margin: 0 0 8px; }
.pr-empty-state p { color: var(--text-dim); font-size: 14px; }

.pr-launch-state { text-align: left; }
.pr-launch-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.pr-launch-icon { font-size: 36px; flex-shrink: 0; }
.pr-launch-header h3 { color: var(--text); margin: 0 0 6px; font-size: 20px; }
.pr-launch-desc { color: var(--text-muted); font-size: 14px; margin: 0; line-height: 1.5; }

.pr-launch-question {
  background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 14px 18px; margin-bottom: 20px;
}
.pr-launch-question span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.pr-launch-question em { font-size: 14px; color: var(--text); font-style: italic; }

.pr-launch-roles { margin-bottom: 24px; }
.pr-launch-roles > span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 8px; }
.pr-launch-role-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pr-role-chip {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 16px;
  border: 1px solid; background: rgba(255,255,255,0.02);
}

.pr-launch-btn {
  background: var(--accent); color: #fff; border: none; padding: 12px 28px;
  border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.pr-launch-btn:hover { background: var(--accent-light); transform: translateY(-1px); }
.pr-launch-btn.secondary {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  padding: 8px 20px; font-size: 12px;
}
.pr-launch-btn.secondary:hover { border-color: var(--accent); color: var(--accent); background: rgba(38,158,171,0.06); }

/* Results */
.pr-result-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.pr-result-title { display: flex; align-items: center; gap: 14px; }
.pr-result-icon { font-size: 32px; }
.pr-result-title h3 { color: var(--text); margin: 0 0 4px; font-size: 18px; }
.pr-result-date { font-size: 11px; color: var(--text-dim); }

.pr-result-overall { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pr-score-circle { position: relative; width: 64px; height: 64px; }
.pr-score-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pr-score-value {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-size: 18px; font-weight: 800;
}
.pr-score-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

.pr-summary-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 28px; }
.pr-summary-card {
  text-align: center; padding: 16px; border-radius: 10px;
  background: var(--bg-card); border: 1px solid var(--border);
}
.pr-summary-card.pass { border-left: 3px solid #22c55e; }
.pr-summary-card.warning { border-left: 3px solid #f59e0b; }
.pr-summary-card.fail { border-left: 3px solid #ef4444; }
.pr-summary-num { display: block; font-size: 28px; font-weight: 800; color: var(--text); }
.pr-summary-card.pass .pr-summary-num { color: #22c55e; }
.pr-summary-card.warning .pr-summary-num { color: #f59e0b; }
.pr-summary-card.fail .pr-summary-num { color: #ef4444; }
.pr-summary-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

.pr-section-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 16px; }

.pr-persona-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.pr-persona-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; transition: border-color 0.15s;
}
.pr-persona-card.pass { border-left: 3px solid #22c55e; }
.pr-persona-card.warning { border-left: 3px solid #f59e0b; }
.pr-persona-card.fail { border-left: 3px solid #ef4444; }

.pr-persona-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pr-persona-icon {
  width: 36px; height: 36px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.pr-persona-info { flex: 1; display: flex; flex-direction: column; }
.pr-persona-name { font-size: 14px; font-weight: 600; color: var(--text); }
.pr-persona-verdict { font-size: 11px; margin-top: 2px; }
.pr-persona-verdict.pass { color: #22c55e; }
.pr-persona-verdict.warning { color: #f59e0b; }
.pr-persona-verdict.fail { color: #ef4444; }
.pr-persona-score { font-size: 22px; font-weight: 800; }

.pr-persona-feedback { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 0 0 10px; font-style: italic; }

.pr-persona-issues { display: flex; flex-direction: column; gap: 6px; }
.pr-issue {
  display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text-muted);
  padding: 8px 10px; border-radius: 6px; background: rgba(255,255,255,0.02);
}
.pr-issue.critical { background: rgba(239,68,68,0.06); }
.pr-issue.warning { background: rgba(245,158,11,0.06); }
.pr-issue-badge { font-size: 10px; font-weight: 700; white-space: nowrap; }

.pr-relaunch { text-align: center; padding-top: 12px; border-top: 1px solid var(--border); }

/* Global layout (no sidebar) */
.pr-global-layout { height: 100%; overflow-y: auto; }
.pr-global-content { padding: 28px 32px; max-width: 1000px; margin: 0 auto; }
.pr-global-header { margin-bottom: 28px; }
.pr-global-title { display: flex; align-items: flex-start; gap: 16px; }
.pr-global-title h2 { color: var(--text); margin: 0 0 6px; font-size: 22px; }
.pr-global-title p { color: var(--text-muted); font-size: 14px; margin: 0; line-height: 1.5; }

.pr-deliverables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-bottom: 28px; }
.pr-deliverable-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px;
}
.pr-deliverable-card.ready { border-left: 3px solid #22c55e; }
.pr-deliverable-card.pending { border-left: 3px solid var(--text-dim); opacity: 0.5; }
.pr-deliverable-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pr-deliverable-icon { font-size: 16px; }
.pr-deliverable-name { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.pr-deliverable-status { font-size: 14px; }
.pr-deliverable-checks { font-size: 11px; color: var(--text-dim); line-height: 1.4; margin: 0; }

.pr-evaluators-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-bottom: 32px; }
.pr-evaluator-card {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
}
.pr-evaluator-icon {
  width: 34px; height: 34px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.pr-evaluator-name { font-size: 13px; font-weight: 600; color: var(--text); display: block; }
.pr-evaluator-desc { font-size: 11px; color: var(--text-dim); display: block; line-height: 1.3; }

.pr-global-launch { text-align: center; padding: 24px 0; }
.pr-launch-hint { font-size: 12px; color: var(--text-dim); margin-top: 10px; }
.pr-launch-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Matrix table */
.pr-matrix-wrap { overflow-x: auto; margin-bottom: 28px; }
.pr-matrix-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pr-matrix-table th {
  padding: 10px 12px; text-align: center; font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.3px; border-bottom: 2px solid var(--border);
  background: var(--bg-panel);
}
.pr-matrix-table th:first-child { text-align: left; }
.pr-matrix-table td { padding: 10px 12px; text-align: center; border-bottom: 1px solid var(--border); }
.pr-matrix-persona { text-align: left !important; font-weight: 600; color: var(--text); white-space: nowrap; }
.pr-matrix-score { font-size: 14px; }
.pr-matrix-avg { font-size: 15px; font-weight: 800; }
.pr-matrix-table tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ── Charte Graphique ─────────────────────────────── */
.charte-layout { display: flex; height: 100%; }
.charte-sidebar {
  width: 240px; min-width: 240px; border-right: 1px solid var(--border);
  padding: 12px; overflow-y: auto; display: flex; flex-direction: column;
}
.charte-sidebar h3 { font-size: 13px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 12px 0; }
.charte-sidebar.collapsed { width: 40px; min-width: 40px; }
.charte-sidebar.collapsed > :not(.sidebar-toggle) { display: none; }
.charte-sidebar-info { display: flex; flex-direction: column; gap: 4px; }

.charte-main { flex: 1; overflow-y: auto; min-width: 0; }
.charte-main-content { padding: 24px; max-width: 900px; }
.charte-content { height: 100%; overflow-y: auto; }

.charte-empty { text-align: center; padding: 80px 40px; }
.charte-empty h2 { color: var(--text); margin: 16px 0 8px; }
.charte-empty p { color: var(--text-muted); margin: 0 0 24px; font-size: 14px; }
.charte-search-actions { display: flex; gap: 10px; justify-content: center; }

/* Colors grid */
.charte-colors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.charte-color-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; text-align: center; transition: border-color 0.15s;
}
.charte-color-card:hover { border-color: rgba(255,255,255,0.1); }
.charte-add-color {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0.5; font-size: 24px; color: var(--text-dim);
}
.charte-add-color:hover { opacity: 1; border-color: var(--accent); }

.charte-color-swatch-wrap { position: relative; margin-bottom: 8px; }
.charte-color-swatch {
  width: 100%; height: 56px; border-radius: 8px; cursor: pointer;
}
.charte-color-picker {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.charte-color-info { display: flex; flex-direction: column; gap: 2px; }
.charte-color-role {
  background: transparent; border: none; color: var(--text); font-size: 12px;
  font-weight: 600; text-align: center; padding: 2px; width: 100%;
}
.charte-color-role:focus { outline: 1px solid var(--accent); border-radius: 4px; }
.charte-color-card { position: relative; }
.charte-color-delete {
  position: absolute; top: 4px; right: 4px; background: none; border: none;
  color: var(--text-dim); font-size: 16px; cursor: pointer; opacity: 0;
  width: 22px; height: 22px; border-radius: 4px; display: flex;
  align-items: center; justify-content: center; transition: all 0.15s;
}
.charte-color-card:hover .charte-color-delete { opacity: 0.6; }
.charte-color-delete:hover { opacity: 1 !important; color: #ef4444; background: rgba(239,68,68,0.1); }
.charte-color-hex-input {
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  font-size: 11px; font-family: monospace; text-align: center; padding: 2px 4px;
  width: 100%; border-radius: 4px; transition: border-color 0.15s;
}
.charte-color-hex-input:hover { border-color: var(--border); }
.charte-color-hex-input:focus { outline: none; border-color: var(--accent); color: var(--text); }
.charte-color-name {
  background: transparent; border: none; color: var(--text-dim); font-size: 10px;
  text-align: center; padding: 2px; width: 100%;
}
.charte-color-name:focus { outline: 1px solid var(--accent); border-radius: 4px; }

/* Preview band */
.charte-preview-band { display: flex; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }

/* Typography */
.charte-typo-section { display: flex; flex-direction: column; gap: 12px; }
.charte-typo-field { display: flex; align-items: center; gap: 12px; }
.charte-typo-field label { font-size: 12px; color: var(--text-dim); min-width: 130px; }
.charte-typo-input {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 6px; font-size: 13px; flex: 1; cursor: pointer;
}
.charte-typo-input:focus { outline: none; border-color: var(--accent); }
.charte-typo-preview {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px; margin-top: 8px;
}

/* Logos */
.charte-logos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
.charte-logo-block { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.charte-logo-label { font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }
.charte-logo-preview {
  width: 100%; height: 100px; border: 1px solid var(--border);
  border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.charte-logo-preview.light {
  background: #ffffff;
  background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%), linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 12px 12px; background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.charte-logo-preview.dark {
  background: #1a1a2e;
  background-image: linear-gradient(45deg, #222244 25%, transparent 25%), linear-gradient(-45deg, #222244 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #222244 75%), linear-gradient(-45deg, transparent 75%, #222244 75%);
  background-size: 12px 12px; background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.charte-logo-preview.square { height: 120px; }
.charte-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 12px; }
.charte-logo-placeholder { font-size: 11px; color: var(--text-dim); }
.charte-logo-preview.dark .charte-logo-placeholder { color: #555; }
.charte-upload-btn { font-size: 11px !important; padding: 5px 14px !important; }

/* Full preview */
.charte-full-preview {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin-bottom: 20px;
}

/* ── Mockup Viewer ────────────────────────────────── */
.mockup-layout { display: flex; height: 100%; }
.mockup-sidebar {
  width: 220px; min-width: 220px; border-right: 1px solid var(--border);
  padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.mockup-app-group { margin-bottom: 8px; }
.mockup-app-title {
  font-size: 11px; font-weight: 600; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.5px; padding: 6px 8px; margin-bottom: 2px;
}
.mockup-app-title[data-toggle-group] {
  cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none;
  border-radius: 4px; transition: background 0.15s;
}
.mockup-app-title[data-toggle-group]:hover { background: rgba(255,255,255,0.04); }
.mockup-group-chevron { font-size: 10px; width: 12px; flex-shrink: 0; }
.mockup-group-count {
  margin-left: auto; font-size: 10px; opacity: 0.5;
  background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 8px;
}
.mockup-group-items { display: flex; flex-direction: column; gap: 2px; }
.mockup-app-group.collapsed .mockup-group-items { display: none; }
.mockup-screen-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: none; background: none; border-radius: 6px;
  cursor: pointer; text-align: left; font-family: inherit; transition: background 0.15s;
}
.mockup-screen-item:hover { background: rgba(255,255,255,0.05); }
.mockup-screen-item.active { background: rgba(38,158,171,0.15); }
.mockup-screen-id {
  font-family: monospace; font-size: 10px; color: var(--text-dim);
  background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.mockup-screen-item.active .mockup-screen-id { color: var(--accent); background: rgba(38,158,171,0.2); }
.mockup-screen-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mockup-screen-item.active .mockup-screen-name { color: var(--accent); font-weight: 600; }

.mockup-stage { flex: 1; display: flex; flex-direction: column; background: #1a1a2e; overflow: hidden; }
.mockup-toolbar {
  display: flex; align-items: center; position: relative;
  padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mockup-toolbar-nav {
  display: flex; align-items: center; gap: 8px;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.mockup-nav-btn {
  font-size: 12px; padding: 4px 10px; line-height: 1;
}
.mockup-nav-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }
.mockup-current-screen { font-size: 13px; font-weight: 600; color: var(--text); }
.mockup-fullscreen-btn { font-size: 18px; line-height: 1; padding: 4px 8px; }
.mockup-fullscreen-btn.active { background: var(--accent); color: var(--bg); }
.mockup-iframe-wrapper {
  flex: 1; overflow: auto;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12px;
}
.mockup-iframe {
  border: none; background: #F9FAFB;
  border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  flex-shrink: 0;
}

/* ── Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease-out;
}
.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%; max-width: 640px; max-height: 80vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0; font-size: 15px; font-weight: 700; color: var(--text);
}
.modal-close {
  background: none; border: none; color: var(--text-dim);
  font-size: 22px; cursor: pointer; padding: 0 4px;
  line-height: 1; transition: color 0.2s;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  padding: 16px 20px; overflow-y: auto; flex: 1;
}
.modal-body .tab-dropzone {
  margin-bottom: 12px;
}
.modal-body .file-list-table {
  font-size: 13px;
}
.modal-box-wide { max-width: 900px; }
.modify-screen-modal-box { max-width: 1100px; max-height: 85vh; }

/* ── Modify Screen Modal ─────────────────────────── */
.modify-screen-layout {
  display: flex; gap: 16px; height: 60vh;
}
.modify-screen-preview {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: #1a1a2e; border-radius: 8px; overflow: hidden; min-width: 0;
}
.modify-screen-preview iframe {
  border: none; border-radius: 6px; background: #F9FAFB;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3); flex-shrink: 0;
}
.modify-screen-form {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
}
.modify-screen-info {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.modify-screen-label { font-weight: 600; color: var(--text); font-size: 15px; }
.modify-screen-file {
  font-family: monospace; font-size: 12px; color: var(--text-dim);
  background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 4px;
}
.modify-screen-textarea {
  width: 100%; flex: 1; min-height: 120px; padding: 12px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-panel); color: var(--text);
  font-family: inherit; font-size: 14px; resize: vertical;
}
.modify-screen-textarea:focus { outline: none; border-color: var(--accent); }
.modify-screen-actions { display: flex; justify-content: flex-end; margin-top: 12px; flex-shrink: 0; }
.modify-screen-log {
  margin-top: 12px; padding: 10px; background: #0d1117; color: #8b949e;
  border-radius: 8px; font-family: monospace; font-size: 12px; line-height: 1.5;
  max-height: 200px; overflow-y: auto; white-space: pre-wrap; flex-shrink: 0;
}

/* ── Charte Graphique Modal ──────────────────────── */
.charte-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.charte-confidence { font-size: 13px; font-weight: 600; }
.charte-source { font-size: 12px; color: var(--text-dim); max-width: 60%; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.charte-section { margin-bottom: 20px; }
.charte-section h4 {
  font-size: 12px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.charte-colors { display: flex; flex-direction: column; gap: 8px; }
.charte-color-row { display: flex; align-items: center; gap: 10px; }
.charte-color-label {
  width: 90px; font-size: 13px; font-weight: 600; color: var(--text); flex-shrink: 0;
}
.charte-color-picker-wrap { display: flex; align-items: center; gap: 6px; }
.charte-color-input {
  width: 36px; height: 36px; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; padding: 2px; background: var(--bg-card);
}
.charte-color-input::-webkit-color-swatch-wrapper { padding: 0; }
.charte-color-input::-webkit-color-swatch { border: none; border-radius: 4px; }
.charte-color-hex {
  width: 82px; font-family: monospace; font-size: 13px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; color: var(--text);
}
.charte-color-swatch {
  width: 36px; height: 36px; border-radius: 6px;
  border: 1px solid var(--border); flex-shrink: 0;
}
.charte-color-name {
  flex: 1; font-size: 13px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; color: var(--text-muted);
}
.charte-preview { margin: 12px 0 20px; }
.charte-preview-bar {
  display: flex; height: 36px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
}
.charte-preview-block { flex: 1; transition: background 0.2s; }

.charte-font-row { display: flex; align-items: center; gap: 12px; }
.charte-font-row label {
  font-size: 13px; font-weight: 600; color: var(--text); width: 120px; flex-shrink: 0;
}
.charte-font-input {
  flex: 1; font-size: 13px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px; color: var(--text);
}

.charte-logo-area { display: flex; gap: 16px; align-items: flex-start; }
.charte-logo-preview {
  width: 120px; height: 120px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.charte-logo-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.charte-logo-placeholder { font-size: 12px; color: var(--text-dim); }
.charte-logo-actions { flex: 1; }
.charte-logo-dropzone { padding: 16px !important; min-height: 80px; }

.charte-actions {
  display: flex; justify-content: flex-end; padding-top: 16px;
  border-top: 1px solid var(--border); margin-top: 8px;
}
.mockup-toolbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.mockup-charte-btn { font-size: 16px; line-height: 1; padding: 4px 8px; }

/* History table */
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th {
  text-align: left; padding: 8px 10px; font-weight: 600;
  border-bottom: 2px solid var(--border); color: var(--text-dim); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.history-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.history-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.history-date { white-space: nowrap; color: var(--text-dim); font-size: 12px; width: 120px; }
.history-prompt {
  max-width: 500px; white-space: pre-wrap; word-break: break-word;
  line-height: 1.4; cursor: default;
}
.history-file code {
  font-size: 11px; background: rgba(255,255,255,0.05); padding: 2px 6px;
  border-radius: 4px; color: var(--text-dim);
}
.history-running { color: var(--progress-text); font-weight: 600; }
.history-ok { color: var(--completed); font-weight: 600; }
.history-err { color: var(--blocked); font-weight: 600; }
.history-actions { white-space: nowrap; }
.history-actions .btn { margin-left: 4px; }
.history-actions .btn:first-child { margin-left: 0; }
.history-resume { background: var(--accent); color: #fff; border: none; }
.history-resume:hover { opacity: 0.85; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 1440px) {
  .project-layout { max-width: 100%; }
}
@media (max-width: 1024px) {
  .project-layout { grid-template-columns: 1fr; padding: 16px; }
  .pipeline-panel { position: static; max-height: none; }
  .erd-sidebar { width: 160px; }
  .erd-entity-item { padding: 6px 12px; }
  .matrix-sidebar { width: 180px; min-width: 180px; }
  .mockup-sidebar { width: 180px; min-width: 180px; }
}

/* ── Animations ───────────────────────────────────── */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.status-in_progress .step-number { animation: pulse 2s infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── UX Pilot Modal ──────────────────────────────── */
.ux-modal .modal-box { max-width: 1100px; max-height: 85vh; width: 90vw; }
.ux-modal-content { display: flex; gap: 0; min-height: 400px; }
.ux-prompts-col { flex: 1; overflow-y: auto; max-height: calc(85vh - 80px); padding: 20px; }
.ux-html-col { width: 320px; min-width: 280px; border-left: 1px solid var(--border); padding: 20px; overflow-y: auto; max-height: calc(85vh - 80px); }
.ux-section-title { font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; color: var(--text-dim); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin: 0 0 16px; }
.ux-prompt-block { margin-bottom: 20px; }
.ux-prompt-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ux-prompt-label { font-size: 13px; font-weight: 600; color: var(--text); }
.ux-prompt-text { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 14px; font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; color: var(--text); max-height: 200px; overflow-y: auto; font-family: 'Consolas', 'Monaco', monospace; margin: 0; }
.ux-prompt-chars { font-size: 11px; color: var(--text-dim); text-align: right; margin-top: 4px; }
.ux-dropzone { border: 2px dashed var(--border); border-radius: 10px; padding: 32px 16px; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.ux-dropzone:hover, .ux-dropzone.dragover { border-color: var(--accent); background: rgba(38,158,171,0.05); }
.ux-dropzone p { margin: 4px 0; color: var(--text); }
.ux-html-list { margin-top: 8px; }
.ux-html-file { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); padding: 4px 0; border-bottom: 1px solid var(--border); }
.mockup-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.mockup-sidebar-header .sidebar-toggle { align-self: center; margin: 0; }
.ux-spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: ux-spin 0.8s linear infinite; margin: 0 auto; }
@keyframes ux-spin { to { transform: rotate(360deg); } }

/* ── Tech Stack Tab ─────────────────────────────────────── */
.techstack-form {
  max-width: 900px;
  margin: 0 auto;
}

.ts-section {
  margin-bottom: 32px;
}

.ts-section h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.ts-templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.ts-template-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.ts-template-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(38, 158, 171, 0.15);
}

.ts-template-card.selected {
  border-color: var(--accent);
  background: rgba(38, 158, 171, 0.08);
  box-shadow: 0 0 0 3px rgba(38, 158, 171, 0.2);
}

.ts-template-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ts-template-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.ts-badge-recommended {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ts-template-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.ts-template-pros-cons {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
}

.ts-template-pros-cons li {
  padding: 2px 0;
}

.ts-pro { color: #4ade80; }
.ts-con { color: #f87171; }

/* Stack detail */
.ts-stack-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ts-stack-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ts-stack-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ts-stack-select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}

.ts-stack-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(38, 158, 171, 0.2);
}

/* Questions */
.ts-questions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.ts-question {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.ts-question-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.ts-question-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ts-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
}

.ts-option:hover {
  background: rgba(38, 158, 171, 0.08);
}

.ts-option input[type="radio"],
.ts-option input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--accent);
}

.ts-option-label {
  color: var(--text);
  flex: 1;
}

.ts-option-advice {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

/* Notes */
.ts-notes {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  background: var(--bg-card);
  color: var(--text);
}

.ts-notes:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(38, 158, 171, 0.2);
}

/* Advice panel */
.ts-advice-panel {
  background: linear-gradient(135deg, rgba(38, 158, 171, 0.08), rgba(27, 58, 107, 0.08));
  border: 1px solid rgba(38, 158, 171, 0.2);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.ts-advice-panel h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
}

.ts-advice-item {
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 0;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ts-advice-item:last-child {
  border-bottom: none;
}

.ts-advice-item strong {
  color: var(--text);
}

/* Save bar */
.ts-save-bar {
  display: flex;
  justify-content: flex-end;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* Saved view */
.techstack-saved {
  max-width: 800px;
  margin: 0 auto;
}

.ts-saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.ts-saved-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.ts-saved-template {
  background: linear-gradient(135deg, rgba(38, 158, 171, 0.10), rgba(27, 58, 107, 0.10));
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.ts-saved-template-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.ts-saved-template-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.ts-saved-section {
  margin-bottom: 20px;
}

.ts-saved-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.ts-saved-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.ts-saved-row:nth-child(odd) {
  background: rgba(255,255,255,0.02);
}

.ts-saved-label {
  color: var(--text-muted);
  font-weight: 500;
}

.ts-saved-value {
  color: var(--text);
  font-weight: 600;
}

/* Action zone extras */
.techstack-action {
  margin-bottom: 12px;
}

.placeholder-step-msg {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.placeholder-icon {
  font-size: 20px;
}

/* Step card for placeholder/interactive types */
.step-card.status-pending .step-skill {
  font-size: 11px;
}

/* ── Design Sub-steps ─────────────────────────────── */
.design-substeps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.design-substep {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}

.design-substep.completed {
  border-color: var(--completed);
  background: rgba(34, 197, 94, 0.05);
}

.design-substep.in_progress {
  border-color: var(--accent);
  background: rgba(38, 158, 171, 0.05);
}

.design-substep-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.design-substep-label {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

.design-handoff-input {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.design-url-field {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  background: var(--bg-card);
  color: var(--text);
  font-family: monospace;
}

.design-url-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(38, 158, 171, 0.2);
}

.design-url-field::placeholder {
  color: var(--text-muted);
  font-family: inherit;
}

.design-handoff-help {
  width: 100%;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.design-substep-done {
  font-size: 12px;
  color: var(--completed);
}

.design-dropzone {
  width: 100%;
  margin-top: 8px;
  padding: 20px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.design-dropzone:hover,
.design-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(38, 158, 171, 0.05);
  color: var(--text);
}

.design-dropzone a {
  color: var(--accent);
  text-decoration: underline;
}

/* ── Preview Toggle ───────────────────────────────── */
.preview-toggle-bar {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex-shrink: 0;
}

.preview-toggle-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}

.preview-toggle-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.preview-toggle-btn.active {
  color: var(--accent);
  background: rgba(38, 158, 171, 0.1);
  border-color: var(--accent);
}

/* Quand le tab-content contient un apercu, activer le layout flex vertical */
.tab-content:has(.preview-iframe-container) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-iframe-container {
  flex: 1;
  overflow: hidden;
  background: #ffffff;
  min-height: 0;
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

/* ── PDF Export Buttons ───────────────────────────── */
.preview-export-group {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.preview-export-btn {
  font-size: 11px !important;
  padding: 4px 10px !important;
  white-space: nowrap;
}

.preview-export-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

/* Responsive */
@media (max-width: 768px) {
  .ts-templates-grid { grid-template-columns: 1fr; }
  .ts-questions { grid-template-columns: 1fr; }
  .ts-stack-detail { grid-template-columns: 1fr; }
}

/* ── Maquette Tab (Claude Design iframe) ──────────── */
.maquette-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex-shrink: 0;
}

.maquette-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.maquette-actions {
  display: flex;
  gap: 6px;
}

.maquette-iframe-container {
  flex: 1;
  overflow: hidden;
  background: #F7F6F2;
}

.maquette-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Ensure tab-content uses flex column for maquette */
#tab-content:has(.maquette-iframe-container) {
  display: flex;
  flex-direction: column;
}
