/* ═══════════════════════════════════════════════════════════════════════════
   GoMySeo — Design system du produit (chat.php + chat-admin.php)
   Direction validée : fond blanc cassé, primaire orange (identité de marque,
   couleur du logo), Söhne → Inter, icônes Lucide, 3 couleurs sémantiques max,
   grille 4 px, rayon 6 px, ombres réservées aux menus/modales.
   Un seul système : toute nouvelle règle d'interface vit ici.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Tokens ───────────────────────────────────────────────────────────── */
:root {
  /* surfaces */
  --bg-primary:   #F7F7F5;
  --bg-secondary: #F1F1EE;
  --bg-card:      #FFFFFF;
  --bg-hover:     #F1F1EE;
  --bg-inset:     #ECECE8;
  --border:       #E5E7EB;
  --border-light: #EEEFF2;
  --border-strong:#D1D5DB;

  /* texte */
  --text-primary:   #111827;
  --text-secondary: #4B5563;
  --text-muted:     #6B7280;
  --text-faint:     #9CA3AF;   /* placeholders, séparateurs, jamais pour du texte lisible */
  --text-on-accent: #FFFFFF;

  /* primaire (orange GoMySeo — couleur du logo) */
  --accent:        #EA580C;
  --accent-rgb:    234,88,12;
  --accent-hover:  #C2410C;
  --accent-active: #9A3412;
  --accent-subtle: rgba(234,88,12,0.08);
  --accent-glow:   rgba(234,88,12,0.08);
  --ring:          rgba(234,88,12,0.30);

  /* sémantique : information uniquement, jamais décoratif */
  --success:        #15803D;
  --success-bg:     rgba(21,128,61,0.10);
  --warning:        #B45309;
  --warning-bg:     rgba(180,83,9,0.10);
  --danger:         #B91C1C;
  --danger-bg:      rgba(185,28,28,0.10);
  --neutral:        #6B7280;
  --neutral-bg:     rgba(107,114,128,0.12);
  --success-border: rgba(21,128,61,0.30);
  --warning-border: rgba(180,83,9,0.30);

  /* graphiques (canvas) : dégradé du primaire + neutres, jamais de sémantique ici */
  --chart-1: #EA580C; --chart-2: #F97316; --chart-3: #FB923C; --chart-4: #FDBA74; --chart-5: #6B7280; --chart-6: #B8BCC4;

  /* alias hérités (ancien chat) : conservés pour ne rien casser, mêmes valeurs */
  --good:   var(--success);
  --medium: var(--warning);
  --bad:    var(--danger);
  --none:   var(--danger);
  --danger-bg-hover: rgba(185,28,28,0.16);
  --danger-border:   rgba(185,28,28,0.30);
  --danger-text:     var(--danger);
  --card-edge:       var(--border);

  /* élévation : uniquement menus / modales / panneaux flottants */
  --shadow-sm: 0 1px 2px rgba(17,24,39,0.05);
  --shadow:    0 6px 20px rgba(17,24,39,0.08);
  --shadow-md: 0 16px 48px rgba(17,24,39,0.14);

  /* forme */
  --radius:    6px;
  --radius-sm: 4px;
  --radius-lg: 8px;

  /* typographie */
  /* Police : Söhne (celle de ChatGPT, licence Klim payante — utilisée si installée/auto-hébergée),
     sinon Inter, l'équivalent libre le plus proche, chargé depuis Google Fonts. */
  --font-ui:   'Söhne', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg-primary:   #000000;
  --bg-secondary: #141518;
  --bg-card:      #1C1D22;
  --bg-hover:     #26272D;
  --bg-inset:     #101114;
  --border:       rgba(255,255,255,0.10);
  --border-light: rgba(255,255,255,0.06);
  --border-strong:rgba(255,255,255,0.18);

  --text-primary:   #F4F4F5;
  --text-secondary: #A1A1AA;
  --text-muted:     #8B8B94;
  --text-faint:     #5F6069;
  --text-on-accent: #FFFFFF;

  --accent:        #F97316;
  --accent-rgb:    249,115,22;
  --accent-hover:  #FB923C;
  --accent-active: #EA580C;
  --accent-subtle: rgba(249,115,22,0.16);
  --accent-glow:   rgba(249,115,22,0.16);
  --ring:          rgba(249,115,22,0.40);

  --success:    #4ADE80; --success-bg: rgba(74,222,128,0.12);
  --warning:    #FBBF24; --warning-bg: rgba(251,191,36,0.12);
  --danger:     #F87171; --danger-bg:  rgba(248,113,113,0.12);
  --neutral:    #A1A1AA; --neutral-bg: rgba(161,161,170,0.14);
  --danger-bg-hover: rgba(248,113,113,0.18);
  --danger-border:   rgba(248,113,113,0.35);
  --success-border:  rgba(74,222,128,0.35);
  --warning-border:  rgba(251,191,36,0.35);
  --chart-1: #FB923C; --chart-2: #F97316; --chart-3: #EA580C; --chart-4: #C2410C; --chart-5: #A1A1AA; --chart-6: #5F6069;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow:    0 8px 24px rgba(0,0,0,0.5);
  --shadow-md: 0 20px 60px rgba(0,0,0,0.7);
}

/* ── 2. Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01' 0;
}
::selection { background: var(--accent-subtle); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* Icônes (Lucide inline). Une taille par contexte : 16 menu/bouton, 14 badge/chip, 20 état vide. */
.ic { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
.ic-sm { width: 14px; height: 14px; vertical-align: -2px; }
.ic-lg { width: 20px; height: 20px; vertical-align: -4px; }
.ic-xl { width: 28px; height: 28px; }
.ic-spin { animation: ds-spin 0.9s linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

/* ── 3. Typographie ──────────────────────────────────────────────────────── */
.t-label   { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.t-body    { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; }
.t-small   { font-size: 12.5px; color: var(--text-secondary); }
.t-section { font-size: 15px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.t-page    { font-size: 20px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.015em; }
.num, .tbl td.num, .kpi-value, .score-ring-value, .bar-val { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: 12px; }

/* ── 4. Boutons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; line-height: 1;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:disabled { cursor: not-allowed; color: var(--text-faint); background: var(--bg-hover); border-color: var(--border); }
.btn-primary { background: var(--accent); color: var(--text-on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:active:not(:disabled) { background: var(--accent-active); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg-hover); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; gap: 6px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn-block { width: 100%; }

/* ── 5. Champs ───────────────────────────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 12px;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13.5px; outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.input.is-invalid { border-color: var(--danger); }
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.field-hint { font-size: 12px; color: var(--text-muted); }
.field-error { font-size: 12px; color: var(--danger); }
.input-search { position: relative; }
.input-search .ic, .input-search > .fi { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; font-size: 15px; }
.input-search .input { padding-left: 32px; }
/* Icônes CSS (<i class="fi" data-ic>) dans les composants : mêmes tailles que les SVG inline */
.btn .fi { font-size: 15px; } .btn-sm .fi { font-size: 14px; }
.tab .fi { font-size: 14px; }
.issue-ic .fi { font-size: 16px; } .issue.is-row .issue-ic .fi { font-size: 14px; }
.issue-main { min-width: 0; }
.acc-head .fi:first-child { font-size: 16px; color: var(--text-muted); }
.acc-head .acc-chev.fi { font-size: 14px; }
.state .fi { font-size: 22px; color: var(--text-faint); }
.alert .fi { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.menu-item .fi { font-size: 15px; color: var(--text-muted); }
.kv .fi { font-size: 14px; }

/* Interrupteur */
.switch { position: relative; width: 34px; height: 20px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 20px; transition: background 0.15s ease; cursor: pointer; }
.switch-track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform 0.15s ease; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }

/* ── 6. Cartes / sections ────────────────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.card-body { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); }
.card-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 20px 0 10px; }
.section-head:first-child { margin-top: 0; }
.divider { height: 1px; background: var(--border-light); margin: 16px 0; }
.stack > * + * { margin-top: 12px; }

/* ── 7. Métriques ────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.kpi-grid.is-joined { gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-card); }
.kpi-grid.is-joined .kpi { border: 0; border-right: 1px solid var(--border-light); border-radius: 0; }
.kpi-grid.is-joined .kpi:last-child { border-right: 0; }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.kpi-value { font-size: 24px; font-weight: 600; line-height: 1.15; color: var(--text-primary); margin-top: 6px; letter-spacing: -0.01em; }
.kpi-value.is-lg { font-size: 28px; }
.kpi-unit { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-left: 3px; }
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; margin-top: 6px; color: var(--text-muted); }
.kpi-delta.up { color: var(--success); }
.kpi-delta.down { color: var(--danger); }
.kpi.is-good .kpi-value { color: var(--success); }
.kpi.is-warn .kpi-value { color: var(--warning); }
.kpi.is-bad  .kpi-value { color: var(--danger); }

/* Score circulaire : anneau SVG fin (exportable en PDF, contrairement à un conic-gradient),
   une seule couleur selon le seuil. Markup généré par rptRing() dans chat-reports.js.
   Nommé "score-ring" (pas ".ring") : Tailwind possède une utilitaire native ".ring" qui
   pose un box-shadow bleu de focus — collision de nom sinon (halo bleu autour du cercle). */
.score-ring { --ring-color: var(--neutral); --size: 112px; position: relative; width: var(--size); height: var(--size); flex-shrink: 0; }
.score-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.score-ring-track { fill: none; stroke: var(--bg-inset); stroke-width: 2.2; }
.score-ring-fill  { fill: none; stroke: var(--ring-color); stroke-width: 2.2; stroke-linecap: round; }
.score-ring-inner { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); line-height: 1; }
.score-ring-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 6px; color: var(--ring-color); }
.score-ring.is-sm { --size: 72px; --stroke: 5px; } .score-ring.is-sm .score-ring-value { font-size: 20px; } .score-ring.is-sm .score-ring-label { display: none; }
.score-ring.is-good { --ring-color: var(--success); }
.score-ring.is-warn { --ring-color: var(--warning); }
.score-ring.is-bad  { --ring-color: var(--danger); }

/* Barres par catégorie : piste, barre colorée par seuil, valeur à droite, échelle lisible. */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-label { color: var(--text-secondary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--bg-inset); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width 0.3s ease; }
.bar-fill.is-good { background: var(--success); } .bar-fill.is-warn { background: var(--warning); } .bar-fill.is-bad { background: var(--danger); }
.bar-val { text-align: right; font-weight: 600; color: var(--text-primary); }
.bar-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-faint); padding-left: 106px; padding-right: 50px; margin-top: -2px; }

/* Barre de répartition (ex. pages par sévérité) : segments proportionnels + légende avec effectifs. */
.segbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--bg-inset); }
.segbar > span { display: block; height: 100%; min-width: 0; }
.segbar .is-critical, .segbar-legend .is-critical::before { background: var(--danger); }
.segbar .is-major,    .segbar-legend .is-major::before    { background: var(--warning); }
.segbar .is-watch,    .segbar-legend .is-watch::before    { background: var(--neutral); }
.segbar .is-ok,       .segbar-legend .is-ok::before       { background: var(--success); }
.segbar-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; color: var(--text-secondary); }
.segbar-legend > span { display: inline-flex; align-items: center; }
.segbar-legend > span::before { content: ''; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; flex-shrink: 0; }
.segbar-legend strong { color: var(--text-primary); font-weight: 600; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Paires clé / valeur (indexabilité, totaux…) */
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 12.5px; color: var(--text-secondary); }
.kv:last-child { border-bottom: 0; }
.kv strong { color: var(--text-primary); font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }

/* Frise chronologique (plan 30 jours) */
.timeline { border-left: 2px solid var(--border); margin-left: 6px; padding-left: 18px; }
.tl-item { position: relative; padding: 2px 0 16px; }
.tl-item:last-child { padding-bottom: 2px; }
.tl-item::before { content: ''; position: absolute; left: -25px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg-card); border: 2px solid var(--accent); }
.tl-when { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.tl-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-top: 2px; }
.tl-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }

/* Aperçu de résultat Google (on-page) : la seule couleur non-système autorisée est le bleu du lien Google. */
.serp { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.serp.is-new { border-color: var(--success-border); }
.serp-lbl { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; }
.serp.is-new .serp-lbl { color: var(--success); }
.serp-url { font-size: 12px; color: var(--text-secondary); word-break: break-all; }
.serp-title { font-size: 16px; line-height: 1.3; color: #1A0DAB; margin: 2px 0; }
:root[data-theme="dark"] .serp-title { color: #8AB4F8; }
.serp-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }

/* Grille d'images (audit images) */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.img-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg-card); }
.img-card img { width: 100%; height: 72px; object-fit: cover; display: block; background: var(--bg-inset); }
.img-meta { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-muted); padding: 5px 7px; }

/* Structure d'un rapport dans le panneau de résultats (voir chat-reports.js) */
.rpt { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.rpt-tabs-wrap { padding: 0 8px; flex-shrink: 0; }
.rpt-panes { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 28px; }
.rpt-pane { display: none; }
.rpt-pane.active { display: block; }
.rpt-pane-title { display: none; }
.rpt-hero { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.rpt-hero-side { min-width: 0; }
.rpt-hero-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.rpt-hero-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; margin-bottom: 12px; }
.pane-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rpt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.rpt-toolbar .input-search { flex: 1; min-width: 200px; }
@media (max-width: 640px) {
  .rpt-hero, .pane-grid-2 { grid-template-columns: 1fr; }
  .rpt-panes { padding: 12px 14px 24px; }
}

/* ── 8. Tableaux ─────────────────────────────────────────────────────────── */
.tbl { border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: var(--bg-card); }
.tbl table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--bg-secondary); text-align: left; padding: 9px 12px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th[data-sort] { cursor: pointer; user-select: none; }
.tbl th[data-sort]:hover { color: var(--text-primary); }
.tbl th .sort-ic { display: inline-block; width: 12px; height: 12px; margin-left: 4px; vertical-align: -2px; opacity: 0.45; }
.tbl th.sorted .sort-ic { opacity: 1; color: var(--accent); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--bg-hover); }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl td.strong { color: var(--text-primary); font-weight: 500; }
.tbl .tbl-url { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); text-decoration: none; }
.tbl .tbl-url:hover { text-decoration: underline; }
.tbl-more { display: block; width: 100%; padding: 10px; text-align: center; font-size: 12.5px; font-weight: 500; color: var(--accent); background: none; border: 0; border-top: 1px solid var(--border-light); cursor: pointer; }
.tbl-more:hover { background: var(--bg-hover); }
.tbl-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

/* ── 9. Onglets ──────────────────────────────────────────────────────────── */
/* Barre scrollable avec flèches de défilement (voir tabsScrollWrap() dans chat-reports.js) :
   le fondu seul se lisait comme un bug ("coupé") plutôt que comme une invite à faire défiler. */
.tabs-scroll { position: relative; display: flex; align-items: stretch; border-bottom: 1px solid var(--border); }
.tabs-scroll-btn { flex-shrink: 0; width: 26px; display: flex; align-items: center; justify-content: center; background: none; border: 0;
  color: var(--text-secondary); cursor: pointer; margin-bottom: -1px; }
.tabs-scroll-btn:hover { color: var(--text-primary); }
.tabs-scroll-btn[hidden] { display: none; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
.tabs::-webkit-scrollbar { display: none; }
.tabs.is-start { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent); }
.tabs.is-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 16px); mask-image: linear-gradient(to right, transparent, #000 16px); }
.tabs.is-start.is-end { -webkit-mask-image: none; mask-image: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; height: 38px; padding: 0 12px; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-muted); font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: color 0.12s ease; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-inset); border-radius: 10px; padding: 1px 6px; }
.tab.active .tab-count { color: var(--accent); background: var(--accent-subtle); }

/* ── 10. Badges & chips ──────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-critical { background: var(--danger-bg);  color: var(--danger); }
.badge-major    { background: var(--warning-bg); color: var(--warning); }
.badge-watch    { background: var(--neutral-bg); color: var(--neutral); }
.badge-ok       { background: var(--success-bg); color: var(--success); }
.badge-info     { background: var(--accent-subtle); color: var(--accent); }
.badge.no-dot::before { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-secondary); font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease; }
.chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.chip.active { background: var(--accent-subtle); border-color: transparent; color: var(--accent); }
.chip-static { cursor: default; }
.chip-static:hover { border-color: var(--border); color: var(--text-secondary); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── 11. Listes de constats (problèmes, recommandations, quick wins) ─────── */
.issue { display: grid; grid-template-columns: 20px 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.issue + .issue { margin-top: 6px; }
.issue-ic { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; color: var(--neutral); }
.issue.is-critical .issue-ic { color: var(--danger); } .issue.is-major .issue-ic { color: var(--warning); } .issue.is-ok .issue-ic { color: var(--success); }
.issue-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.issue-desc { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.55; }
.issue-meta { display: flex; gap: 6px; align-items: center; }
.issue-list { display: flex; flex-direction: column; }
.issue.is-row { border: 0; border-bottom: 1px solid var(--border-light); border-radius: 0; background: transparent; padding: 10px 4px; }
.issue.is-row + .issue.is-row { margin-top: 0; }
.issue.is-row:last-child { border-bottom: 0; }

/* Accordéon de catégorie */
.acc { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; }
.acc + .acc { margin-top: 8px; }
.acc-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background: none; border: 0; text-align: left; cursor: pointer; color: var(--text-primary); font-size: 13px; font-weight: 600; }
.acc-head:hover { background: var(--bg-hover); }
.acc-head .acc-chev { margin-left: auto; color: var(--text-muted); transition: transform 0.15s ease; }
.acc.open .acc-chev { transform: rotate(180deg); }
.acc-body { display: none; padding: 4px 12px 10px; border-top: 1px solid var(--border-light); }
.acc.open .acc-body { display: block; }

/* ── 12. États ───────────────────────────────────────────────────────────── */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 36px 20px; color: var(--text-muted); }
.state .ic { width: 22px; height: 22px; color: var(--text-faint); }
.state-title { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.state-text { font-size: 12.5px; max-width: 320px; line-height: 1.55; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); font-size: 12.5px; color: var(--text-secondary); }
.alert .ic { margin-top: 1px; }
.alert-danger { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger); }
.alert-warning { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning); }
.alert-success { border-color: var(--success-border); background: var(--success-bg); color: var(--success); }
.alert-info { border-color: var(--accent-subtle); background: var(--accent-subtle); color: var(--accent); }
.skeleton { position: relative; overflow: hidden; background: var(--bg-inset); border-radius: var(--radius-sm); color: transparent !important; }
.skeleton::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent); animation: ds-shimmer 1.4s infinite; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent); }
@keyframes ds-shimmer { to { transform: translateX(100%); } }
.sk-line { height: 12px; margin: 6px 0; } .sk-line.w-60 { width: 60%; } .sk-line.w-40 { width: 40%; } .sk-line.w-80 { width: 80%; }
.sk-block { height: 72px; }

/* ── 13. Menus & dialogues (élévation autorisée) ─────────────────────────── */
.menu { position: absolute; z-index: 200; min-width: 200px; padding: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius); background: none; text-align: left; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.menu-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.menu-item.is-danger:hover { background: var(--danger-bg); color: var(--danger); }
.menu-sep { height: 1px; background: var(--border-light); margin: 4px 0; }
.menu-label { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.dialog-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,0.45); z-index: 450; display: none; }
.dialog-backdrop.open { display: block; }
.dialog { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0.98); width: 440px; max-width: 92vw; max-height: 86vh; display: none; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); z-index: 500; opacity: 0; transition: opacity 0.14s ease, transform 0.14s ease; }
.dialog.open { display: flex; opacity: 1; transform: translate(-50%,-50%) scale(1); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-light); }
.dialog-title { font-size: 14px; font-weight: 600; }
.dialog-body { padding: 18px; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border-light); }

/* ── 14. Utilitaires de mise en page ─────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
/* ── Mobile (≤ 640 px) : échelle compacte de tous les composants ─────────── */
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .btn { height: 32px; padding: 0 11px; font-size: 12.5px; }
  .btn-sm { height: 28px; padding: 0 9px; font-size: 11.5px; }
  .btn-icon { width: 32px; } .btn-icon.btn-sm { width: 28px; }
  .input, .select { height: 34px; font-size: 13px; }
  .badge { height: 20px; padding: 0 6px; font-size: 10.5px; }
  .chip { height: 24px; padding: 0 8px; font-size: 11.5px; }
  .card-body { padding: 12px; } .card-head { padding: 10px 12px; }
  .kpi { padding: 10px 12px; } .kpi-label { font-size: 10px; } .kpi-value { font-size: 20px; margin-top: 4px; }
  .score-ring { --size: 96px; } .score-ring-value { font-size: 26px; } .score-ring-label { font-size: 10px; }
  .bar-row { grid-template-columns: 80px 1fr 36px; font-size: 12px; gap: 8px; }
  .bar-scale { padding-left: 88px; padding-right: 44px; }
  .bars { gap: 8px; }
  .tbl table { font-size: 12px; } .tbl th, .tbl td { padding: 7px 8px; } .tbl th { font-size: 10px; } .tbl .tbl-url { max-width: 150px; }
  .tab { height: 34px; padding: 0 9px; font-size: 12px; }
  .issue { padding: 8px 10px; gap: 8px; grid-template-columns: 18px 1fr auto; }
  .issue-title { font-size: 12.5px; } .issue-desc { font-size: 12px; }
  .issue-meta { flex-wrap: wrap; justify-content: flex-end; max-width: 42%; }
  .section-head { margin: 14px 0 8px; }
  .t-page { font-size: 18px; } .t-section { font-size: 14px; }
  .rpt-hero { padding: 12px; gap: 12px; justify-items: center; } .rpt-hero-side { width: 100%; }
  .acc-head { padding: 9px 10px; } .acc-body { padding: 4px 10px 8px; }
  .alert { padding: 8px 10px; font-size: 12px; }
  .state { padding: 24px 12px; }
  .dialog { width: calc(100vw - 16px); max-height: 90vh; }
  .menu { min-width: 180px; }
  .timeline { padding-left: 14px; } .tl-item::before { left: -21px; }
  .serp-title { font-size: 15px; }
  .img-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .segbar-legend { gap: 4px 12px; font-size: 11.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
