  :root {
    --bg: #FFFFFF; --surface: #FFFFFF; --surface2: #F7F8FA;
    --border: #E5E7EB; --border2: #D1D5DB;
    --accent: #2B7FFF; --accent2: #7C6FD6;
    --accent-hover: #1D6FE8;
    --accent-soft: #EBF3FF;
    --accent-bright: #2B7FFF;
    --text: #0F172A; --muted: #64748B; --muted2: #6B7280;
    --success: #059669; --error: #DC2626; --r: 10px;
    --purple: #7C6FD6;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    background: var(--bg); color: var(--text);
    font-family: 'Syne', sans-serif; font-size: 15px; line-height: 1.6;
    min-height: 100vh;
    background-image:
      radial-gradient(ellipse 80% 50% at 50% -10%, rgba(43,127,255,0.06) 0%, transparent 60%),
      radial-gradient(ellipse 40% 30% at 90% 80%, rgba(74,158,255,0.04) 0%, transparent 50%);
  }

  /* ── SIDEBAR OVERLAY ── */
  #sidebarOverlay {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,0.35); z-index: 199;
    backdrop-filter: blur(2px);
  }
  body.sidebar-open #sidebarOverlay { display: block; }

  /* ── SIDEBAR ── */
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 248px; z-index: 200;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
  }
  body.sidebar-open #sidebar { transform: translateX(0); }

  .sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .sidebar-logo {
    font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700;
  }
  .sidebar-logo span { color: var(--accent); }
  .sidebar-close {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 16px; padding: 4px 6px; border-radius: 6px; transition: all 0.15s;
    line-height: 1;
  }
  .sidebar-close:hover { background: var(--surface2); color: var(--text); }

  .sidebar-nav {
    flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto;
  }
  .sidebar-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 14px;
    border: none; border-radius: 8px;
    background: transparent; color: var(--muted2);
    font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 600;
    cursor: pointer; text-align: left;
    transition: all 0.15s;
  }
  .sidebar-item:hover { background: var(--surface2); color: var(--text); }
  .sidebar-item.active { background: rgba(43,127,255,0.1); color: var(--accent); }
  .sidebar-item-icon { font-size: 16px; flex-shrink: 0; }

  /* ── HEADER ── */
  header {
    display: flex; align-items: center;
    padding: 12px 20px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px); z-index: 100;
    min-height: 61px;
  }
  #companySelector { margin: 0 auto; }

  /* Hamburger toggle */
  .sidebar-toggle {
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    gap: 5px; width: 36px; height: 36px;
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: 8px; cursor: pointer; padding: 8px; flex-shrink: 0;
    transition: all 0.15s;
  }
  .sidebar-toggle:hover { border-color: var(--accent); }
  .sidebar-toggle span {
    display: block; width: 16px; height: 2px;
    background: var(--muted2); border-radius: 2px; transition: background 0.15s;
  }
  .sidebar-toggle:hover span { background: var(--accent); }

  /* ── PAGES ── */
  .page { display: none; }
  .page.active { display: block; }

  /* ── LAYOUT PRINCIPAL ── */
  .layout { display: grid; grid-template-columns: 390px 1fr; min-height: calc(100vh - 61px); }

  /* ── LEFT PANEL ── */
  .panel-left {
    border-right: 1px solid var(--border); padding: 28px 24px;
    overflow-y: auto; max-height: calc(100vh - 61px);
    position: sticky; top: 61px;
  }
  .section-label {
    font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
    color: var(--muted); margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
  }
  .section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }
  .panel-section { margin-bottom: 24px; }

  label { display: block; font-size: 12px; font-weight: 600; color: var(--muted2); margin-bottom: 5px; }
  input, textarea, select {
    width: 100%; background: var(--surface); border: 1px solid var(--border2);
    border-radius: var(--r); color: var(--text); font-family: 'Syne', sans-serif;
    font-size: 14px; padding: 9px 13px; transition: border-color 0.2s, box-shadow 0.2s;
    outline: none; margin-bottom: 12px;
  }
  input:focus, textarea:focus, select:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,127,255,0.08);
  }
  textarea { resize: vertical; min-height: 65px; }
  select { cursor: pointer; }
  select option { background: var(--surface2); }

  /* Company context block */
  .company-block {
    background: var(--surface); border: 1px solid var(--border2);
    border-radius: var(--r); overflow: hidden; margin-bottom: 12px;
  }
  .company-tabs { display: flex; border-bottom: 1px solid var(--border); }
  .company-tab {
    flex: 1; padding: 9px; font-size: 12px; font-weight: 600; cursor: pointer;
    background: transparent; border: none; color: var(--muted); transition: all 0.15s;
    font-family: 'Syne', sans-serif;
  }
  .company-tab.active { color: var(--accent); background: rgba(43,127,255,0.05); }
  .company-tab-content { padding: 12px; display: none; }
  .company-tab-content.active { display: block; }
  .img-tab {
    flex: 1; padding: 9px; font-size: 12px; font-weight: 600; cursor: pointer;
    background: transparent; border: none; color: var(--muted); transition: all 0.15s;
    font-family: 'Syne', sans-serif;
  }
  .img-tab.active { color: var(--accent); background: rgba(43,127,255,0.05); }

  .url-row { display: flex; gap: 6px; }
  .url-row input { margin-bottom: 0; flex: 1; }
  .btn-sm {
    background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px;
    color: var(--muted2); font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 600;
    padding: 9px 12px; cursor: pointer; transition: all 0.15s; white-space: nowrap;
  }
  .btn-sm:hover { border-color: var(--accent2); color: var(--accent2); }
  .btn-sm:disabled { opacity: 0.4; cursor: not-allowed; }

  .drop-zone {
    border: 2px dashed var(--border2); border-radius: var(--r); padding: 20px;
    text-align: center; cursor: pointer; transition: all 0.2s; position: relative;
  }
  .drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: rgba(43,127,255,0.03); }
  .drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
  .drop-zone-icon { font-size: 24px; margin-bottom: 6px; }
  .drop-zone-text { font-size: 12px; color: var(--muted2); }
  .drop-zone-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
  .drop-zone.has-file { border-color: var(--success); border-style: solid; }
  .drop-zone.has-file .drop-zone-text { color: var(--success); }

  .context-status {
    display: none; align-items: center; gap: 8px; padding: 8px 12px;
    background: rgba(61,214,140,0.06); border: 1px solid rgba(61,214,140,0.2);
    border-radius: 8px; font-size: 12px; color: var(--success); margin-top: 8px;
  }
  .context-status.visible { display: flex; }
  .btn-clear { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; margin-left: auto; }
  .btn-clear:hover { color: var(--error); }

  /* Insights */
  .insights-box { background: var(--surface); border: 1px solid var(--border2);
    border-radius: var(--r); padding: 12px 14px; margin-bottom: 12px; display: none; }
  .insights-box.visible { display: block; animation: fadeIn 0.3s ease; }
  .insight-item { font-size: 12px; color: var(--muted2); padding: 5px 0; border-bottom: 1px solid var(--border); }
  .insight-item:last-child { border-bottom: none; }
  .insight-item strong { color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: 1px; display: block; margin-bottom: 2px; }
  .tag { display: inline-block; background: rgba(74,158,255,0.1); border: 1px solid rgba(74,158,255,0.2);
    color: var(--accent2); font-size: 11px; padding: 2px 7px; border-radius: 20px; margin: 2px 2px 0 0; }

  /* Content type grid */
  .content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px; }
  .content-btn {
    background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r);
    color: var(--muted2); font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 600;
    padding: 10px 8px; cursor: pointer; transition: all 0.15s; text-align: center; line-height: 1.3;
  }
  .content-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(43,127,255,0.04); }
  .content-btn.active { background: rgba(43,127,255,0.1); border-color: var(--accent); color: var(--accent); }
  .content-btn .icon { font-size: 1.4rem; display: block; margin-bottom: 4px; line-height: 1; }
  .content-btn i.fa-instagram { color: #E1306C !important; }
  .content-btn i.fa-tiktok    { color: var(--text) !important; }
  .content-btn i.fa-facebook  { color: #1877F2 !important; }
  .content-btn i.fa-linkedin  { color: #0A66C2 !important; }
  .content-btn i.fa-envelope  { color: #f0c040 !important; }
  .content-btn i.fa-phone     { color: #4caf50 !important; }
  .content-btn i.fa-briefcase { color: #a78bfa !important; }

  /* Music mood pills */
  .mood-pill {
    padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border2);
    background: var(--surface2); color: var(--muted2); font-size: 12px;
    font-family: var(--sans); cursor: pointer; transition: all .15s;
  }
  .mood-pill:hover { border-color: var(--accent); color: var(--accent); }
  .mood-pill.active { background: rgba(43,127,255,0.12); border-color: var(--accent); color: var(--accent); font-weight: 600; }

  /* Image option */
  .img-option {
    background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r);
    padding: 12px; margin-bottom: 12px;
  }
  .toggle-row { display: flex; align-items: center; justify-content: space-between; }
  .toggle-label { font-size: 13px; color: var(--muted2); }
  .toggle {
    width: 36px; height: 20px; background: var(--border2); border-radius: 10px;
    cursor: pointer; transition: background 0.2s; position: relative; flex-shrink: 0;
  }
  .toggle.on { background: var(--accent); }
  .toggle::after {
    content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
    background: white; top: 3px; left: 3px; transition: transform 0.2s;
  }
  .toggle.on::after { transform: translateX(16px); }
  .img-styles { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 10px; }
  .img-style-btn {
    padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border2);
    background: var(--surface2); color: var(--muted); font-size: 11px; font-weight: 600;
    cursor: pointer; text-align: center; transition: all 0.15s; font-family: 'Syne', sans-serif;
  }
  .img-style-btn:hover { border-color: var(--border2); color: var(--muted2); }
  .img-style-btn.selected { border-color: var(--accent); color: var(--accent); background: rgba(43,127,255,0.06); }

  /* Buttons */
  .btn-generate {
    width: 100%; background: var(--accent); color: #FFFFFF; border: none;
    border-radius: var(--r); font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700;
    padding: 13px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center;
    justify-content: center; gap: 8px;
  }
  .btn-generate:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(43,127,255,0.2); }
  .btn-generate:disabled { background: var(--border2); color: var(--muted); cursor: not-allowed; transform: none; box-shadow: none; }
  .btn-generate--outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
  .btn-generate--outline:hover { background: rgba(43,127,255,0.1); }

  .btn-insights {
    width: 100%; background: transparent; border: 1px solid var(--border2);
    border-radius: var(--r); color: var(--muted2); font-family: 'Syne', sans-serif;
    font-size: 12px; font-weight: 600; padding: 8px; cursor: pointer;
    transition: all 0.15s; margin-bottom: 12px;
  }
  .btn-insights:hover { border-color: var(--accent2); color: var(--accent2); }

  /* ── RIGHT PANEL ── */
  .panel-right { padding: 40px; overflow-y: auto; display: flex; flex-direction: column; min-height: 100vh; }

  .empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 100%; height: 100%; min-height: 400px; text-align: center; gap: 14px;
  }
  .empty-icon { font-size: 52px; opacity: 0.25; }
  .empty-state h2 { font-family: 'Playfair Display', serif; font-size: 24px; color: var(--muted2); }
  .empty-state p { color: var(--muted); font-size: 14px; max-width: 340px; line-height: 1.7; }
  .steps { display: flex; gap: 20px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
  .step { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
  .step-num { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border2);
    display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted2); }

  .loading-state { display: none; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; min-height: 400px; gap: 18px; text-align: center; }
  .loading-state.visible { display: flex; }
  .spinner { width: 44px; height: 44px; border: 2px solid var(--border2); border-top-color: var(--accent);
    border-radius: 50%; animation: spin 0.8s linear infinite; }
  .loading-text { font-family: 'Playfair Display', serif; font-style: italic; font-size: 18px; color: var(--muted2); }
  .loading-sub { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }

  .result-state { display: none; }
  .result-state.visible { display: block; animation: slideUp 0.4s ease; }

  .result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
  .result-type { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 700; }
  .result-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
  .rbadge { font-family: 'JetBrains Mono', monospace; font-size: 10px; padding: 3px 9px;
    border-radius: 20px; border: 1px solid; }
  .rbadge-ok { color: var(--success); border-color: rgba(61,214,140,0.3); background: rgba(61,214,140,0.05); }
  .rbadge-web { color: var(--accent2); border-color: rgba(74,158,255,0.3); background: rgba(74,158,255,0.05); }
  .rbadge-company { color: var(--accent); border-color: rgba(43,127,255,0.3); background: rgba(43,127,255,0.05); }
  .rbadge-insta { color: var(--purple); border-color: rgba(167,139,250,0.3); background: rgba(167,139,250,0.05); }

  .result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .btn-action {
    background: var(--surface); border: 1px solid var(--border2); border-radius: 8px;
    color: var(--muted2); font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 600;
    padding: 7px 13px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 6px;
  }
  .btn-action:hover { border-color: var(--accent); color: var(--accent); }
  .btn-action.copied { border-color: var(--success); color: var(--success); }
  .btn-action-img { border-color: rgba(74,158,255,0.3); color: var(--accent2); }
  .btn-action-img:hover { border-color: var(--accent2); }
  .btn-action-img:disabled { opacity: 0.4; cursor: not-allowed; }

  .result-content {
    background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r);
    padding: 26px 30px; white-space: pre-wrap; line-height: 1.85; font-size: 15px; color: var(--text);
    position: relative; overflow: hidden; outline: none; cursor: text;
    transition: border-color 0.15s;
  }
  .result-content:focus {
    border-color: rgba(43,127,255,0.4);
    box-shadow: 0 0 0 3px rgba(43,127,255,0.06);
  }
  .result-content a[data-invisible-link] {
    color: inherit !important; text-decoration: none !important; cursor: pointer;
    border-bottom: 1px dashed rgba(43,127,255,0.4); /* indicateur visuel SEULEMENT dans l'éditeur */
  }
  .result-content::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent2)); }

  /* Image result */
  .result-image-area {
    margin-top: 16px; border-radius: var(--r); overflow: hidden;
    border: 1px solid var(--border2); background: var(--surface2);
  }
  .result-image-area img { width: 100%; display: block; }
  .result-image-loading {
    padding: 40px; text-align: center; color: var(--muted);
    font-family: 'JetBrains Mono', monospace; font-size: 11px; display: none;
  }
  .flux-prompt-box {
    margin-top: 8px; padding: 8px 12px; background: var(--surface2);
    border-radius: 6px; font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace;
    display: none;
  }
  .flux-prompt-box span { color: var(--muted2); }

  /* ── VISUAL EDITOR ── */
  .visual-editor {
    margin-top: 20px; border: 1px solid var(--border2); border-radius: 12px;
    background: var(--surface2); overflow: hidden; display: none;
  }
  .visual-editor-header {
    padding: 10px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--surface);
  }
  .visual-editor-title {
    font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--accent); display: flex; align-items: center; gap: 6px;
  }
  .visual-editor-actions { display: flex; gap: 6px; flex-wrap: wrap; }
  .ve-btn {
    padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 600;
    cursor: pointer; border: 1px solid var(--border2); background: var(--surface2);
    color: var(--muted2); font-family: 'Syne', sans-serif; transition: all 0.15s;
    display: flex; align-items: center; gap: 5px;
  }
  .ve-btn:hover { color: var(--text); border-color: var(--border2); }
  .ve-btn-primary { background: rgba(43,127,255,0.1); border-color: rgba(43,127,255,0.3); color: var(--accent); }
  .ve-btn-primary:hover { background: rgba(43,127,255,0.2); }
  .ve-btn-blue { background: rgba(74,158,255,0.08); border-color: rgba(74,158,255,0.25); color: var(--accent2); }
  /* Mode selector */
  .ve-mode-bar { display: flex; gap: 4px; padding: 10px 16px 0; }
  .ve-mode-btn {
    flex: 1; padding: 7px 6px; border-radius: 7px; font-size: 11px; font-weight: 600;
    cursor: pointer; border: 1px solid var(--border2); background: var(--surface);
    color: var(--muted); font-family: 'Syne', sans-serif; transition: all 0.15s;
    text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px;
  }
  .ve-mode-btn .ve-mode-icon { font-size: 16px; }
  .ve-mode-btn.active { background: rgba(43,127,255,0.1); border-color: rgba(43,127,255,0.35); color: var(--accent); }
  /* Layout */
  .visual-editor-body { display: block; min-height: 0; }
  /* STAGE — zone de preview draggable */
  .ve-stage-wrap {
    position: relative; background: #1a1a1a; display: flex; align-items: center;
    justify-content: center; min-height: 340px; overflow: hidden; padding: 20px;
  }
  .ve-stage {
    position: relative; overflow: hidden; flex-shrink: 0;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    /* taille affichée, indépendante de la résolution export */
    width: 400px; height: 400px;
    background: #111;
  }
  .ve-stage.portrait  { width: 320px; height: 400px; }
  .ve-stage.story     { width: 225px; height: 400px; }
  .ve-stage.landscape { width: 400px; height: 225px; }
  .ve-stage-bg {
    position: absolute; inset: 0;
    background-size: cover; background-position: center; background-repeat: no-repeat;
  }
  .ve-loading-overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 10px; background: rgba(10,11,13,0.92);
    color: var(--muted); font-size: 12px; font-family: 'JetBrains Mono', monospace;
    z-index: 10;
  }
  /* Blocs texte draggables */
  .ve-text-block {
    position: absolute; cursor: move; user-select: none;
    max-width: 90%; word-break: break-word; line-height: 1.3;
    padding: 6px 8px; border-radius: 4px;
    outline: 2px solid transparent; transition: outline-color 0.1s;
    min-width: 60px;
  }
  .ve-text-block:hover { outline-color: rgba(255,255,255,0.5); }
  .ve-text-block.selected { outline-color: var(--accent) !important; }
  .ve-text-block .ve-block-delete {
    position: absolute; top: -8px; right: -8px; width: 18px; height: 18px;
    background: var(--error); border-radius: 50%; display: none; align-items: center;
    justify-content: center; font-size: 10px; cursor: pointer; color: #fff; z-index: 5;
  }
  .ve-text-block.selected .ve-block-delete { display: flex; }
  .ve-text-block .ve-block-resize {
    position: absolute; bottom: -6px; right: -6px; width: 12px; height: 12px;
    background: var(--accent); border-radius: 2px; cursor: se-resize; display: none; z-index: 5;
  }
  .ve-text-block.selected .ve-block-resize { display: block; }
  /* Bouton + ajouter bloc */
  .ve-add-block-btn {
    position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
    background: rgba(43,127,255,0.15); border: 1px dashed rgba(43,127,255,0.4);
    color: var(--accent); border-radius: 20px; padding: 5px 14px; font-size: 11px;
    cursor: pointer; font-family: 'Syne', sans-serif; font-weight: 600; z-index: 5;
    white-space: nowrap; transition: background 0.15s;
  }
  .ve-add-block-btn:hover { background: rgba(43,127,255,0.25); }
  /* Upload zone dans le stage */
  .ve-stage-upload {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 8px; cursor: pointer; z-index: 3;
    border: 2px dashed rgba(255,255,255,0.15); border-radius: inherit;
    color: rgba(255,255,255,0.4); font-size: 12px; font-family: 'Syne', sans-serif;
    transition: all 0.2s;
  }
  .ve-stage-upload:hover { border-color: rgba(43,127,255,0.4); color: var(--accent); }
  .ve-stage-upload.hidden { display: none; }
  /* Controls panel */
  .ve-controls {
    border-left: 1px solid var(--border); padding: 14px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px; max-height: 520px;
  }
  .ve-section-title {
    font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--muted); margin-bottom: 5px;
  }
  .ve-control-group { display: flex; flex-direction: column; gap: 7px; }
  .ve-row { display: flex; align-items: center; gap: 6px; }
  .ve-row-between { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
  .ve-label { font-size: 11px; color: var(--muted2); flex-shrink: 0; min-width: 44px; }
  .ve-textarea {
    width: 100%; padding: 7px 9px; background: var(--surface); border: 1px solid var(--border2);
    border-radius: 6px; color: var(--text); font-size: 12px; font-family: 'Syne', sans-serif;
    resize: vertical; min-height: 52px; line-height: 1.5;
  }
  .ve-textarea:focus { outline: none; border-color: rgba(43,127,255,0.4); }
  .ve-input-sm {
    width: 52px; padding: 4px 6px; background: var(--surface); border: 1px solid var(--border2);
    border-radius: 5px; color: var(--text); font-size: 11px; font-family: 'JetBrains Mono', monospace;
    text-align: center; flex-shrink: 0;
  }
  .ve-select {
    flex: 1; padding: 5px 7px; background: var(--surface); border: 1px solid var(--border2);
    border-radius: 5px; color: var(--text); font-size: 11px; font-family: 'Syne', sans-serif;
  }
  .ve-select:focus { outline: none; border-color: rgba(43,127,255,0.4); }
  .ve-slider {
    -webkit-appearance: none; flex: 1; height: 3px; border-radius: 2px;
    background: var(--border2); outline: none;
  }
  .ve-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); cursor: pointer;
  }
  .ve-colors { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
  .ve-swatch {
    width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: border-color 0.15s; flex-shrink: 0;
  }
  .ve-swatch.active { border-color: var(--accent); }
  .ve-color-pick {
    width: 28px; height: 22px; padding: 0; border: 1px solid var(--border2);
    border-radius: 4px; cursor: pointer; background: none; flex-shrink: 0;
  }
  .ve-divider { border: none; border-top: 1px solid var(--border); margin: 2px 0; }
  .ve-fmt-row { display: flex; gap: 4px; }
  .ve-fmt-btn {
    flex: 1; padding: 5px 2px; border: 1px solid var(--border2); border-radius: 5px;
    background: var(--surface); color: var(--muted2); font-size: 10px; font-weight: 600;
    cursor: pointer; text-align: center; font-family: 'Syne', sans-serif; transition: all 0.15s;
  }
  .ve-fmt-btn.active { border-color: rgba(74,158,255,0.4); color: var(--accent2); background: rgba(74,158,255,0.06); }
  .ve-style-row { display: flex; gap: 4px; }
  .ve-style-btn {
    flex: 1; padding: 5px 4px; border: 1px solid var(--border2); border-radius: 5px;
    background: var(--surface); color: var(--muted2); font-size: 11px; font-weight: 600;
    cursor: pointer; text-align: center; font-family: serif; transition: all 0.15s;
  }
  .ve-style-btn.active { border-color: rgba(43,127,255,0.4); color: var(--accent); background: rgba(43,127,255,0.06); }
  .ve-align-row { display: flex; gap: 4px; }
  .ve-align-btn {
    flex: 1; padding: 5px 4px; border: 1px solid var(--border2); border-radius: 5px;
    background: var(--surface); color: var(--muted2); font-size: 14px;
    cursor: pointer; text-align: center; transition: all 0.15s;
  }
  .ve-align-btn.active { border-color: rgba(43,127,255,0.4); color: var(--accent); background: rgba(43,127,255,0.06); }
  .ve-bg-swatches { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
  .ve-bg-swatch {
    width: 24px; height: 24px; border-radius: 5px; cursor: pointer;
    border: 2px solid transparent; transition: border-color 0.15s; flex-shrink: 0;
  }
  .ve-bg-swatch.active { border-color: var(--accent); }
  .ve-toggle-mini {
    width: 32px; height: 17px; border-radius: 10px; background: var(--border2);
    cursor: pointer; position: relative; transition: background 0.2s; flex-shrink: 0;
  }
  .ve-toggle-mini.on { background: rgba(43,127,255,0.5); }
  .ve-toggle-mini::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
    border-radius: 50%; background: var(--muted2); transition: all 0.2s;
  }
  .ve-toggle-mini.on::after { left: 17px; background: var(--accent); }
  .ve-no-block-msg {
    font-size: 11px; color: var(--muted); text-align: center; padding: 16px 0; font-style: italic;
  }

  .result-footer { margin-top: 14px; display: flex; gap: 16px; flex-wrap: wrap; }
  .stat-item { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted);
    display: flex; align-items: center; gap: 5px; }
  .stat-item span { color: var(--muted2); }

  .history-section { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--border); }
  .history-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
  .history-items { display: flex; flex-direction: column; gap: 7px; }
  .history-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 11px 14px; cursor: pointer; transition: border-color 0.15s;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .history-item:hover { border-color: var(--border2); }
  .history-type { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 3px; }
  .history-preview { font-size: 12px; color: var(--muted2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .history-time { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted); white-space: nowrap; }

  /* ── PAGE INSTAGRAM ── */
  .insta-layout { display: grid; grid-template-columns: 360px 1fr; gap: 0; min-height: calc(100vh - 61px); }
  .insta-left { border-right: 1px solid var(--border); padding: 28px 24px; overflow-y: auto; }
  .insta-right { padding: 40px; overflow-y: auto; }

  .stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
  .stat-card {
    background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r); padding: 14px;
  }
  .stat-card-value { font-family: 'Playfair Display', serif; font-size: 26px; color: var(--accent); }
  .stat-card-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 4px; }

  .insight-callout {
    background: rgba(43,127,255,0.05); border: 1px solid rgba(43,127,255,0.15);
    border-radius: var(--r); padding: 14px; margin-bottom: 16px;
  }
  .insight-callout p { font-size: 13px; color: var(--text); line-height: 1.7; }

  .tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
  .tag-item { padding: 4px 10px; border-radius: 20px; background: var(--surface2); border: 1px solid var(--border2); font-size: 12px; color: var(--muted2); }

  .insta-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 400px; text-align: center; color: var(--muted); gap: 12px; }

  /* Animations */
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

  /* ── Modal édition texte canvas ── */
  #textEditModal {
    display: none; position: fixed; inset: 0; z-index: 9999;
    align-items: center; justify-content: center;
    background: rgba(15,23,42,0.35); backdrop-filter: blur(4px);
  }
  .text-edit-box {
    background: #13161e; border: 1px solid var(--border2);
    border-radius: 14px; padding: 28px 32px; width: 480px; max-width: 92vw;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.18s ease;
  }
  @keyframes modalIn {
    from { opacity:0; transform: scale(0.96) translateY(8px); }
    to   { opacity:1; transform: scale(1) translateY(0); }
  }
  .text-edit-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
  }
  .text-edit-title {
    font-size: 10px; font-weight: 700; letter-spacing: 2px;
    text-transform: uppercase; color: var(--accent);
  }
  .text-edit-close {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 18px; line-height: 1; padding: 0; transition: color 0.15s;
  }
  .text-edit-close:hover { color: var(--text); }
  #textEditInput {
    width: 100%; background: var(--surface2); border: 1px solid var(--border2);
    border-radius: 8px; color: var(--text); font-family: 'Syne', sans-serif;
    font-size: 15px; padding: 12px 16px; outline: none; margin-bottom: 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  #textEditInput:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(43,127,255,0.1);
  }
  .text-edit-actions { display: flex; gap: 10px; justify-content: flex-end; }
  .btn-edit-cancel {
    padding: 9px 20px; border-radius: 8px; border: 1px solid var(--border2);
    background: var(--surface2); color: var(--muted2); font-family: 'Syne', sans-serif;
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s;
  }
  .btn-edit-cancel:hover { color: var(--text); }
  .btn-edit-confirm {
    padding: 9px 24px; border-radius: 8px; border: none;
    background: var(--accent); color: #FFFFFF; font-family: 'Syne', sans-serif;
    font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.15s;
  }
  .btn-edit-confirm:hover { background: var(--accent-hover); }
  ::-webkit-scrollbar { width: 4px; }
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

  @media (max-width: 900px) {
    .layout, .insta-layout { grid-template-columns: 1fr; }
    .panel-left { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
    header { padding: 14px 18px; }
    .panel-right, .insta-right { padding: 22px 18px; }
  }

  /* ── Mobile : header + sidebar + pages ── */
  @media (max-width: 768px) {
    header { padding:10px 12px; min-height:52px; gap:8px; }
    .sidebar-toggle { width:40px; height:40px; }
    .sidebar-toggle span { width:18px; }
    #companySelector { min-width:120px; max-width:180px; padding:4px 8px; }
    #companySelector span:first-of-type { font-size:11px; }
    .sidebar-item { padding:12px 16px; font-size:14px; min-height:48px; }
    .sidebar-item-icon { font-size:18px; }
    .page { padding:16px 12px; }
  }
  @media (max-width: 480px) {
    header { padding:8px 10px; min-height:48px; }
    #companySelector { min-width:100px; max-width:150px; font-size:11px; }
    .sidebar-item { padding:14px 16px; font-size:15px; min-height:52px; gap:12px; }
    .sidebar-item-icon { font-size:20px; }
    #sidebar { width:280px; }
    .page { padding:12px 8px; }
  }

  /* ── Page Entreprises — tablette & mobile ── */
  @media (max-width: 768px) {
    #page-companies .panel-left { width:100% !important; padding:14px 12px; }
    #page-companies #companiesList { flex-direction:row; flex-wrap:wrap; gap:6px; }
    #page-companies .btn-generate { font-size:13px; padding:12px; min-height:48px; }
    #companyForm > div:first-child { flex-direction:column; gap:8px; }
    #companyForm > div:first-child > div:last-child { width:100%; }
    #companyForm > div:first-child .btn-action { flex:1; justify-content:center; min-height:44px; }
  }
  @media (max-width: 480px) {
    #companyForm { max-width:100% !important; }
    #companyForm > div[style*="grid-template-columns"] { grid-template-columns:1fr !important; }
    .empty-ic, .empty-icon { font-size:40px; }
    .empty h2 { font-size:18px; }
    .empty p { font-size:13px; }
  }

  /* ── Page Galerie — tablette & mobile ── */
  @media (max-width: 768px) {
    #galleryDropZone { padding:20px 12px !important; }
    #galleryDropZone button { padding:10px 20px; font-size:14px; min-height:44px; }
    #galleryGrid { grid-template-columns:repeat(auto-fill,minmax(120px,1fr)) !important; gap:8px !important; }
  }
  @media (max-width: 480px) {
    #page-gallery h2 { font-size:18px !important; }
    #galleryDropZone { padding:16px 10px !important; border-radius:8px !important; }
    #galleryDropZone button { width:100%; padding:12px; font-size:14px; min-height:48px; border-radius:10px; }
    #galleryGrid { grid-template-columns:repeat(auto-fill,minmax(100px,1fr)) !important; gap:6px !important; }
    #galleryEmpty { padding:24px 12px !important; font-size:12px !important; }
  }

  /* ── Page Compte — tablette & mobile ── */
  @media (max-width: 768px) {
    #page-account > div { padding:16px 12px !important; }
    #page-account .account-section { padding:16px 0; }
    #page-account .account-title { font-size:15px; }
    #page-account .account-toggle { min-height:44px; font-size:14px; }
    #page-account .account-toggle input[type=checkbox] { width:20px; height:20px; }
    #page-account .session-card { flex-wrap:wrap; gap:8px; padding:12px; }
    #page-account .session-revoke { min-height:40px; padding:8px 14px; font-size:12px; }
    #page-account .auth-btn-outline { min-height:44px; max-width:100% !important; width:100%; }
    #page-account .auth-btn { max-width:100% !important; width:100%; min-height:48px; }
    #page-account .btn-danger { width:100%; min-height:48px; }
    #page-account select.auth-input { width:100% !important; }
    .qr-container img { max-width:180px; }
  }
  @media (max-width: 480px) {
    #page-account > div { padding:12px 8px !important; max-width:100% !important; }
    #page-account .account-title { font-size:16px; }
    #page-account .session-card { font-size:12px; }
    #page-account .session-loc { font-size:11px; }
    .qr-container img { max-width:150px; }
    .pwd-strength { height:6px; }
    .pwd-bar { height:6px; }
  }

  /* ── Page Générer — tablette ── */
  @media (max-width: 900px) {
    .panel-left { padding:20px 16px; }
    .panel-right { padding:24px 16px; }
  }
  @media (max-width: 768px) {
    .panel-left { padding:16px 12px; }
    .panel-right { padding:16px 12px; }
    .panel-section { margin-bottom:18px; }
    .section-label { font-size:11px; margin-bottom:10px; }
    label { font-size:13px; margin-bottom:6px; }
    input, textarea, select { font-size:16px; padding:12px 14px; margin-bottom:10px; }
    textarea { min-height:60px; }
    .content-grid { gap:8px; }
    .content-btn { padding:12px 8px; font-size:12px; min-height:52px; }
    .content-btn .icon { font-size:1.6rem; }
    .company-tab { padding:12px; font-size:13px; min-height:44px; }
    .img-tab { padding:12px; font-size:13px; min-height:44px; }
    .company-tab-content { padding:14px; }
    .btn-sm { padding:10px 14px; font-size:13px; min-height:44px; }
    .btn-generate { padding:16px; font-size:15px; min-height:52px; }
    .btn-insights { padding:10px; font-size:13px; min-height:44px; }
    .drop-zone { padding:24px 16px; }
    .drop-zone-text { font-size:13px; }
    .drop-zone-icon { font-size:28px; }
    .img-option { padding:14px; }
    .img-styles { gap:6px; }
    .img-style-btn { padding:8px 10px; font-size:12px; min-height:40px; }
    .toggle { width:42px; height:24px; }
    .toggle::after { width:16px; height:16px; top:4px; left:4px; }
    .toggle.on::after { transform:translateX(18px); }
    .toggle-label { font-size:14px; }
    .mood-pill { padding:8px 14px; font-size:13px; min-height:40px; }
    .result-type { font-size:18px; }
    .result-actions { gap:6px; }
    .btn-action { padding:9px 12px; font-size:12px; min-height:44px; }
    .result-content { padding:18px 16px; font-size:14px; line-height:1.8; }
    .empty-state { min-height:300px; }
    .empty-state h2 { font-size:20px; }
    .empty-state p { font-size:13px; }
    .steps { gap:14px; }
    .step { font-size:12px; }
    .visual-editor-header { padding:8px 12px; }
  }

  /* ── Page Générer — mobile ── */
  @media (max-width: 480px) {
    .panel-left { padding:12px 8px; }
    .panel-right { padding:12px 8px; }
    .panel-section { margin-bottom:14px; }
    input, textarea, select { font-size:16px; padding:14px 12px; border-radius:10px; }
    .content-grid { grid-template-columns:1fr 1fr; gap:6px; }
    .content-btn { padding:10px 6px; font-size:11px; min-height:56px; }
    .content-btn .icon { font-size:1.5rem; margin-bottom:3px; }
    .btn-generate { padding:18px; font-size:16px; min-height:56px; border-radius:12px; }
    .url-row { flex-direction:column; gap:8px; }
    .url-row input { margin-bottom:0; }
    .url-row .btn-sm { width:100%; text-align:center; }
    .img-styles { grid-template-columns:1fr 1fr; gap:4px; }
    .img-style-btn { padding:10px 6px; font-size:11px; min-height:44px; }
    .result-header { flex-direction:column; align-items:flex-start; gap:8px; }
    .result-type { font-size:16px; }
    .result-badges { margin-top:4px; }
    .result-actions { width:100%; }
    .btn-action { flex:1; justify-content:center; padding:10px 8px; font-size:11px; min-height:44px; }
    .result-content { padding:14px 12px; font-size:14px; border-radius:10px; }
    .empty-state { min-height:250px; gap:10px; }
    .empty-state h2 { font-size:18px; }
    .steps { flex-direction:column; gap:8px; align-items:flex-start; }
    .loading-text { font-size:15px; }
    .visual-editor { margin-top:14px; border-radius:8px; }
  }

  /* ══ PAGE MEDIA ══ */
  .media-layout { display: grid; grid-template-columns: 360px 1fr; min-height: calc(100vh - 61px); }
  .media-left { border-right: 1px solid var(--border); padding: 28px 24px; overflow-y: auto; max-height: calc(100vh - 61px); position: sticky; top: 61px; }
  .media-right { padding: 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }

  .media-upload-zone {
    border: 2px dashed var(--border2); border-radius: var(--r); padding: 32px 20px;
    text-align: center; cursor: pointer; transition: all 0.2s; position: relative;
    background: var(--surface);
  }
  .media-upload-zone:hover, .media-upload-zone.dragover { border-color: #fb923c; background: rgba(251,146,60,0.04); }
  .media-upload-zone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
  .media-upload-zone.has-file { border-color: var(--success); border-style: solid; }
  .media-upload-zone .uz-icon { font-size: 36px; margin-bottom: 10px; display: block; }
  .media-upload-zone .uz-text { font-size: 13px; font-weight: 600; color: var(--muted2); }
  .media-upload-zone .uz-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

  .media-preview { border-radius: var(--r); overflow: hidden; background: #000; max-height: 320px; display: flex; align-items: center; justify-content: center; }
  .media-preview img, .media-preview video { max-width: 100%; max-height: 320px; display: block; }

  .analysis-block { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r); padding: 20px; }
  .analysis-block-title { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
  .analysis-text { font-size: 14px; line-height: 1.85; color: var(--text); white-space: pre-wrap; }
  .analysis-text::first-line { font-weight: 600; }

  /* ── CANVAS EDITOR ── */
  .editor-wrap { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--r); overflow: hidden; }
  .editor-toolbar {
    display: flex; align-items: center; gap: 8px; padding: 12px 16px;
    border-bottom: 1px solid var(--border); background: var(--surface2); flex-wrap: wrap;
  }
  .editor-toolbar-sep { width: 1px; height: 20px; background: var(--border2); flex-shrink: 0; }
  .tool-btn {
    padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border2);
    background: var(--surface); color: var(--muted2); font-family: 'Syne', sans-serif;
    font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s;
    display: flex; align-items: center; gap: 4px; white-space: nowrap;
  }
  .tool-btn:hover { border-color: var(--accent); color: var(--accent); }
  .tool-btn.active { background: rgba(43,127,255,0.1); border-color: var(--accent); color: var(--accent); }
  .tool-btn.danger:hover { border-color: var(--error); color: var(--error); }
  .tool-btn.export { background: var(--accent); color: #FFFFFF; border-color: var(--accent); }
  .tool-btn.export:hover { background: var(--accent-hover); }

  .canvas-layout { display: flex; flex-direction: column; }

  .canvas-container {
    position: relative; display: flex; align-items: center; justify-content: center;
    background: #0a0a0a; min-height: 300px; overflow: hidden;
    margin-left: auto; margin-right: auto;
  }
  #canvasContainer { overflow: hidden; background: #000; min-height: 400px; }
  canvas#editorCanvas { display: block; cursor: crosshair; max-width: 100%; margin: auto; }

  .overlay-panel { border-top: 1px solid var(--border); }
  .overlay-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; max-height: 200px; overflow-y: auto; }
  .overlay-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
    cursor: pointer; transition: border-color 0.15s;
  }
  .overlay-item:hover { border-color: var(--border2); }
  .overlay-item.selected { border-color: var(--accent); background: rgba(43,127,255,0.06); }
  .overlay-item-text { flex: 1; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .overlay-item-role { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
  .role-titre { color: var(--accent); }
  .role-sous_titre { color: var(--accent2); }
  .role-cta { color: var(--success); }
  .role-custom { color: var(--purple); }

  .prop-panel { padding: 12px 16px; background: var(--surface2); border-top: 1px solid var(--border); display: none; }
  .prop-panel.visible { display: block; }
  .prop-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
  .prop-label { font-size: 11px; font-weight: 600; color: var(--muted2); min-width: 60px; }
  .prop-input {
    background: var(--surface); border: 1px solid var(--border2); border-radius: 6px;
    color: var(--text); font-family: 'Syne', sans-serif; font-size: 13px;
    padding: 5px 8px; outline: none; transition: border-color 0.2s;
  }
  .prop-input:focus { border-color: var(--accent); }
  .prop-input-text { flex: 1; min-width: 160px; }
  .prop-color { width: 36px; height: 28px; padding: 2px; cursor: pointer; border-radius: 4px; }
  .prop-select { padding: 5px 8px; cursor: pointer; }
  .prop-range {
    -webkit-appearance: none; appearance: none;
    width: 80px; height: 6px; cursor: pointer;
    background: var(--border2); border-radius: 3px; outline: none;
    margin: 0; padding: 0;
  }
  .prop-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent); border: none; cursor: pointer;
    margin-top: -5px;
  }
  .prop-range::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent); border: none; cursor: pointer;
  }
  .prop-range::-webkit-slider-runnable-track {
    height: 6px; border-radius: 3px; background: var(--border2);
  }
  .prop-range::-moz-range-track {
    height: 6px; border-radius: 3px; background: var(--border2);
  }

  .suggestions-strip { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--border); }
  .sug-chip {
    padding: 4px 10px; border-radius: 20px; background: var(--surface2);
    border: 1px solid var(--border2); font-size: 11px; color: var(--muted2);
    cursor: pointer; transition: all 0.15s;
  }
  .sug-chip:hover { border-color: var(--accent); color: var(--accent); }

  .media-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 500px; gap: 14px; text-align: center; color: var(--muted); }
  .media-empty .ei { font-size: 52px; opacity: 0.2; }

/* Dashboard platform selector */
.dash-plat-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.dash-plat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 28px;
  border-radius: 12px;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--card);
  min-width: 120px;
}
.dash-plat-card:hover {
  border-color: var(--plat-color);
  background: rgba(255,255,255,0.04);
}
.dash-plat-card--active {
  border-color: var(--plat-color);
  background: rgba(255,255,255,0.06);
}
.dash-plat-label {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.dash-plat-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dash-plat-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.dash-plat-tab--active {
  border-color: var(--accent);
  background: rgba(43,127,255,0.08);
  color: var(--accent);
}
.dash-plat-tab--disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Avant/Après layout buttons */
.ba-layout-btn { flex:1;padding:6px;border-radius:6px;border:1px solid var(--border2);background:transparent;color:var(--muted);cursor:pointer;font-size:11px;font-family:inherit;transition:all .15s; }
.ba-layout-btn.active { border-color:var(--accent);background:rgba(43,127,255,0.08);color:var(--accent); }
.ba-layout-btn:hover { border-color:var(--accent); }
.ba-upload-mini { border:1.5px dashed var(--border2);border-radius:6px;padding:12px 8px;text-align:center;cursor:pointer;transition:border-color .15s; }
.ba-upload-mini:hover { border-color:var(--accent); }

/* Presets grid */
.presets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}

.presets-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted2);
  cursor: pointer;
  line-height: 1.3;
  padding: 6px 8px;
  background: var(--surface2);
  border-radius: 6px;
  border: 1px solid var(--border2);
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.presets-grid label:hover {
  border-color: var(--accent);
  color: var(--text);
}

.presets-grid input[type="checkbox"] {
  width: 13px !important;
  height: 13px !important;
  min-width: 13px !important;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.presets-scroll {
  max-height: 320px;
  overflow-y: auto;
  width: 100%;
}

.presets-group-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 10px 0 6px 0;
}

.presets-toggles { display:flex; flex-direction:column; gap:6px; }
.preset-toggle-row {
  display:flex; align-items:center; justify-content:space-between;
  padding:7px 12px; background:var(--surface2); border:1px solid var(--border2);
  border-radius:8px; gap:10px;
}
.preset-toggle-label { font-size:12px; color:var(--muted2); flex:1; }

/* ── Canvas layout side-by-side sur grand écran ── */
@media (min-width: 1200px) {
  .canvas-layout {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
  }
  .canvas-layout > .canvas-container {
    flex: 0 1 auto;
    margin-left: 0; margin-right: 0;
  }
  .canvas-layout > .prop-panel {
    flex: 0 0 260px;
    width: 260px;
    border-top: none;
    border-left: 1px solid var(--border);
    max-height: 80vh;
    overflow-y: auto;
    padding: 12px 14px;
    background: var(--surface2);
  }
  .canvas-layout > .prop-panel.visible {
    display: block;
  }
}

/* ── Scope d'activité (radio group) ── */
.radio-group { display:flex; flex-direction:column; gap:8px; margin-top:6px; }
.radio-option {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: .2s;
}
.radio-option input[type="radio"] {
  flex-shrink: 0 !important;
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  accent-color: var(--accent);
}
.radio-option span {
  flex: 1;
  text-align: left;
}
.radio-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft, rgba(100,100,200,.08));
}
.help-text { display:block; margin-top:6px; color:var(--muted); font-size:.85em; }

.credits-badge {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.credits-badge.visible {
  display: flex;
}
.credits-badge:hover {
  background: var(--surface);
  filter: brightness(1.15);
  border-color: var(--accent);
}
.credits-badge:active {
  transform: scale(0.97);
}
.credits-badge:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.credits-badge .credits-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: currentColor;
}
.credits-badge .credits-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}
@media (max-width: 600px) {
  .credits-badge .credits-label { display: none; }
}

.global-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  z-index: 9999;
  max-width: 90vw;
  padding: 12px 20px;
  background: rgba(240, 82, 82, 0.95);
  border: 1px solid rgba(240, 82, 82, 0.4);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.global-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.global-toast.success {
  background: rgba(61, 214, 140, 0.95);
  border-color: rgba(61, 214, 140, 0.4);
}
@media (max-width: 600px) {
  .global-toast {
    top: 10px;
    font-size: 12px;
    padding: 10px 14px;
  }
}

.grace-banner {
  position: sticky;
  top: 0;
  z-index: 9998;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(240, 82, 82, 0.95);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid rgba(240, 82, 82, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.grace-banner button {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.grace-banner button:hover {
  background: rgba(255, 255, 255, 0.3);
}
@media (max-width: 600px) {
  .grace-banner { font-size: 12px; padding: 8px 12px; }
}

/* ── Modale re-acceptation consentement RGPD (Batch consent-5) ─────────── */
.consent-renewal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.consent-renewal-modal {
  width: 100%; max-width: 600px;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  padding: 32px;
}
.consent-renewal-title {
  font-size: 20px; font-weight: 700; color: var(--text);
  margin-bottom: 12px;
}
.consent-renewal-body {
  font-size: 14px; color: var(--muted2); line-height: 1.5;
  margin-bottom: 20px;
}
.consent-renewal-body a, .consent-renewal-check a {
  color: var(--accent); text-decoration: underline;
}
.consent-renewal-check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; color: var(--text); line-height: 1.5;
  margin-bottom: 20px; cursor: pointer;
}
.consent-renewal-check input[type="checkbox"] {
  margin-top: 3px; flex-shrink: 0;
  /* width:auto override la règle globale ligne ~121 (input, textarea,
     select width 100%) qui faisait remplir tout le label flex à la
     checkbox, ne laissant aucune place au span. */
  width: auto;
}
/* Le <span> contenant le label + liens doit prendre le reste de l'espace
   ET pouvoir shrink. Subtilité flex :
   - flex: 1 1 auto + min-width:0 → la basis est calculée depuis le contenu
     intrinsèque, mais min-width:0 permet au shrink de la ramener à 0 →
     observed width: 0px (diagnostic DevTools).
   - flex: 1 1 0 → basis fixée à 0, puis grow distribue tout l'espace
     dispo restant après checkbox (16px) + gap (10px) → ~508px alloués.
   On veut le 2e comportement. min-width:0 reste utile pour autoriser le
   shrink en dessous du contenu intrinsèque sur petits écrans. */
.consent-renewal-check span {
  flex: 1 1 0; min-width: 0;
}
.consent-renewal-error {
  font-size: 13px; color: var(--error);
  margin-bottom: 12px; display: none;
}
.consent-renewal-error.visible { display: block; }
.consent-renewal-btn {
  width: 100%;
  padding: 12px 20px;
  background: var(--accent);
  border: none; border-radius: var(--r);
  color: #fff; font-size: 14px; font-weight: 600;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  transition: background 0.15s;
}
.consent-renewal-btn:hover:not(:disabled) { background: var(--accent-hover); }
.consent-renewal-btn:disabled {
  opacity: 0.5; cursor: not-allowed;
}
@media (max-width: 600px) {
  .consent-renewal-modal { padding: 20px; }
  .consent-renewal-title { font-size: 18px; }
}
