/* =========================================================================
   GAMEWAVE Dashboard v3 — Design system (CSS maison, sans framework)
   Thèmes clair + sombre via variables CSS. Bascule par [data-theme] sur <html>.
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  /* Couleurs de marque */
  --accent: #2674a2;
  --accent-hover: #2e86bd;
  --accent-contrast: #ffffff;

  /* Surfaces & texte (thème clair par défaut) */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --surface-hover: #eef2f7;
  --border: #e2e7ee;
  --border-strong: #cfd7e2;
  --text: #1f2733;
  --text-muted: #6b7686;
  --text-faint: #9aa4b2;

  /* États */
  --success: #2fa66b;
  --success-bg: #e7f6ee;
  --danger: #d6455d;
  --danger-bg: #fbe9ec;
  --warning: #d9922b;

  /* Divers */
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 29, 51, .06), 0 1px 3px rgba(16, 29, 51, .08);
  --shadow: 0 4px 16px rgba(16, 29, 51, .10);
  --shadow-lg: 0 18px 50px rgba(16, 29, 51, .18);
  --ring: 0 0 0 3px rgba(38, 116, 162, .25);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --sidebar-w: 256px;
  --topbar-h: 60px;
  --transition: .18s ease;

  /* Graphiques */
  --chart-grid: #eef2f7;
}

/* ---------- Thème sombre ---------- */
:root[data-theme="dark"] {
  --bg: #0e141f;
  --surface: #172030;
  --surface-2: #1e2838;
  --surface-hover: #232f43;
  --border: #283449;
  --border-strong: #37465f;
  --text: #e6ebf2;
  --text-muted: #9aa7ba;
  --text-faint: #68768c;
  --success-bg: rgba(47, 166, 107, .18);
  --danger-bg: rgba(214, 69, 93, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .35);
  --shadow: 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
  --chart-grid: #26324a;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 650; line-height: 1.25; }
img { max-width: 100%; }

/* ---------- Boutons ---------- */
.gw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 13.5px/1 var(--font);
  padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), filter var(--transition);
}
.gw-btn:hover { background: var(--surface-hover); }
.gw-btn--primary { background: var(--accent); color: var(--accent-contrast); }
.gw-btn--primary:hover { background: var(--accent-hover); color: var(--accent-contrast); }
.gw-btn--ghost { background: transparent; border-color: var(--border-strong); }
.gw-btn--danger { background: var(--danger); color: #fff; }
.gw-btn--danger:hover { background: var(--danger); color: #fff; filter: brightness(1.08); }
.gw-btn--success { background: var(--success); color: #fff; }
.gw-btn--success:hover { background: var(--success); color: #fff; filter: brightness(1.08); }
.gw-btn--warning { background: var(--warning); color: #fff; }
.gw-btn--warning:hover { background: var(--warning); color: #fff; filter: brightness(1.08); }
.gw-btn--info { background: #2b8fb8; color: #fff; }
.gw-btn--info:hover { background: #2b8fb8; color: #fff; filter: brightness(1.08); }
.gw-btn--block { width: 100%; }
.gw-btn--lg { padding: 13px 20px; font-size: 15px; }
.gw-btn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- Champs ---------- */
.gw-field { margin-bottom: 16px; }
.gw-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.gw-input, .gw-textarea, .gw-select {
  width: 100%; padding: 11px 13px; font: 400 14px/1.4 var(--font);
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); transition: border-color var(--transition), box-shadow var(--transition);
}
.gw-input::placeholder, .gw-textarea::placeholder { color: var(--text-faint); }
.gw-input:focus, .gw-textarea:focus, .gw-select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.gw-input-icon { position: relative; }
.gw-input-icon .gw-input { padding-left: 40px; }
.gw-input-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-faint); pointer-events: none; }

/* ---------- Carte ---------- */
.gw-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.gw-card__body { padding: 20px; }

/* ---------- Alertes ---------- */
.gw-alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; }
.gw-alert--error { background: var(--danger-bg); color: var(--danger); }
.gw-alert--ok { background: var(--success-bg); color: var(--success); }

/* =========================================================================
   Page de connexion
   ========================================================================= */
.gw-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative;
  background:
    radial-gradient(1200px 600px at 70% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--bg);
}
.gw-login__card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.gw-login__head { padding: 30px 32px 10px; text-align: center; }
.gw-login__logo { height: 34px; width: auto; margin-bottom: 14px; }
.gw-login__title { font-size: 19px; font-weight: 700; margin: 0 0 4px; }
.gw-login__sub { font-size: 13px; color: var(--text-muted); margin: 0; }
.gw-login__body { padding: 22px 32px 32px; }

@media (max-width: 440px) {
  .gw-login__head, .gw-login__body { padding-left: 22px; padding-right: 22px; }
}

/* =========================================================================
   Coquille (topbar + sidebar + contenu)
   ========================================================================= */
body.gw-dash { background: var(--bg); }

/* ---- Topbar ---- */
.gw-topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 60;
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.gw-topbar__brand { display: flex; align-items: center; gap: 10px; width: calc(var(--sidebar-w) - 18px); }
.gw-topbar__brand img { height: 30px; width: auto; }

/* Logo GAMEWAVE (SVG inline, recoloré via CSS) */
.gw-logo { display: block; }
.gw-logo .st0 { fill: var(--text); }
.gw-logo .cls-1 { fill: color-mix(in srgb, var(--accent) 60%, #ffffff); }
.gw-logo .cls-2 { fill: var(--accent); }
.gw-topbar__brand .gw-logo { height: 24px; width: auto; }
.gw-login__head .gw-logo { height: 30px; width: auto; margin: 0 auto 14px; }
.gw-topbar__spacer { flex: 1; }
.gw-topbar__right { display: flex; align-items: center; gap: 14px; }
.gw-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); }
.gw-status__dot { width: 10px; height: 10px; border-radius: 50%; }
.gw-status__dot.ok { background: var(--success); }
.gw-status__dot.ko { background: var(--danger); animation: gw-blink 1s step-start infinite; }
@keyframes gw-blink { 50% { opacity: 0; } }

/* ---- Menu utilisateur ---- */
.gw-usermenu { position: relative; }
.gw-usermenu__btn { display: flex; align-items: center; gap: 9px; background: none; border: 0; cursor: pointer; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text); }
.gw-usermenu__btn:hover { background: var(--surface-hover); }
.gw-usermenu__btn img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.gw-usermenu__name { font-weight: 600; font-size: 13.5px; }
.gw-usermenu__list {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: var(--transition);
}
.gw-usermenu.open .gw-usermenu__list { opacity: 1; visibility: visible; transform: none; }
.gw-usermenu__list a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px; }
.gw-usermenu__list a:hover { background: var(--surface-hover); }
.gw-usermenu__sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ---- Sidebar ---- */
.gw-sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w); z-index: 55;
  background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding-bottom: 24px;
}
.gw-profile { display: flex; align-items: center; gap: 12px; padding: 18px; border-bottom: 1px solid var(--border); }
.gw-profile img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.gw-profile a { font-weight: 650; color: var(--text); font-size: 14px; }
.gw-profile span { display: block; font-size: 12px; color: var(--text-faint); }

.gw-nav { list-style: none; margin: 0; padding: 10px; }
.gw-nav__header { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 700; padding: 14px 10px 6px; }
.gw-nav li { list-style: none; }
.gw-nav a, .gw-nav__toggle {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 13.5px; font-weight: 500; background: none; border: 0; cursor: pointer; transition: var(--transition);
}
.gw-nav a:hover, .gw-nav__toggle:hover { background: var(--surface-hover); color: var(--text); }
.gw-nav .gw-nav__icon { width: 18px; text-align: center; font-size: 15px; flex: 0 0 auto; color: var(--text-faint); }
.gw-nav li.active > a, .gw-nav li.active > .gw-nav__toggle { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.gw-nav li.active > a .gw-nav__icon, .gw-nav li.active > .gw-nav__toggle .gw-nav__icon { color: var(--accent); }
.gw-nav__label { flex: 1; }
.gw-nav__caret { font-size: 11px; color: var(--text-faint); transition: transform var(--transition); }
.gw-nav li.open > .gw-nav__toggle .gw-nav__caret { transform: rotate(90deg); }
.gw-nav__badge { background: var(--accent); color: var(--accent-contrast); font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.gw-nav__sub { list-style: none; margin: 2px 0 4px; padding: 0; max-height: 0; overflow: hidden; transition: max-height .22s ease; }
.gw-nav li.open > .gw-nav__sub { max-height: 640px; }
.gw-nav__sub a { padding: 8px 12px 8px 41px; font-size: 13px; }
.gw-nav__sub li.active > a { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---- Contenu ---- */
.gw-content { margin-left: var(--sidebar-w); margin-top: var(--topbar-h); padding: 26px 30px 60px; min-height: calc(100vh - var(--topbar-h)); }
.gw-breadcrumb { float: right; font-size: 12.5px; color: var(--text-faint); }
.gw-breadcrumb a { color: var(--text-muted); }
.gw-breadcrumb span { margin: 0 6px; }
.gw-page-title { font-size: 22px; font-weight: 700; margin: 0 0 22px; }
.gw-page-title small { font-size: 14px; font-weight: 400; color: var(--text-muted); margin-left: 8px; }

/* ---- KPIs (accueil) ---- */
.gw-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 22px; }
.gw-kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px 20px; }
.gw-kpi__label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.gw-kpi__num { font-size: 28px; font-weight: 700; line-height: 1.1; margin: 6px 0 4px; }
.gw-kpi__trend { font-size: 12px; font-weight: 600; color: var(--text-faint); }
.gw-kpi__trend.up { color: var(--success); }
.gw-kpi__trend.down { color: var(--danger); }
.gw-kpi__icon { position: absolute; right: 16px; top: 16px; font-size: 22px; color: var(--accent); opacity: .22; }
a.gw-kpi { color: inherit; display: block; transition: border-color var(--transition), box-shadow var(--transition); }
a.gw-kpi:hover { color: inherit; border-color: var(--accent); box-shadow: var(--shadow); }
a.gw-kpi:hover .gw-kpi__trend { color: var(--accent); }

/* ---- Graphiques (accueil) ---- */
.gw-charts { display: grid; gap: 18px; margin-bottom: 22px; }
.gw-charts--main { grid-template-columns: 2fr 1fr; }
.gw-charts--half { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .gw-charts--main, .gw-charts--half { grid-template-columns: 1fr; } }
.gw-chart-box { position: relative; height: 300px; padding: 8px 14px 14px; }
.gw-chart-box--sm { height: 270px; }

/* Filtres de période (3j/7j/30j) */
.gw-periods { display: inline-flex; gap: 4px; }
.gw-period { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font: 600 12px var(--font); padding: 4px 10px; border-radius: 999px; cursor: pointer; transition: var(--transition); }
.gw-period:hover { background: var(--surface-hover); color: var(--text); }
.gw-period.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Bouton bascule clair/sombre */
.gw-themebtn { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 17px; padding: 7px 9px; border-radius: var(--radius-sm); line-height: 1; }
.gw-themebtn:hover { background: var(--surface-hover); color: var(--text); }

/* ---- Grille / stat ---- */
.gw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-bottom: 22px; }
.gw-stat { position: relative; overflow: hidden; background: var(--accent); color: #fff; border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.gw-stat__icon { position: absolute; right: 16px; top: 14px; font-size: 42px; opacity: .22; }
.gw-stat__title { font-size: 13px; opacity: .9; }
.gw-stat__num { font-size: 32px; font-weight: 700; line-height: 1.1; margin: 4px 0 10px; }
.gw-stat__bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.3); overflow: hidden; margin-bottom: 8px; }
.gw-stat__bar > span { display: block; height: 100%; background: #fff; }
.gw-stat__desc { font-size: 12px; opacity: .9; }

/* ---- Table ---- */
.gw-table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow-sm); }
.gw-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.gw-table th { text-align: left; font-weight: 650; color: var(--text-muted); padding: 13px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.gw-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.gw-table tr:last-child td { border-bottom: 0; }
/* Lignes alternées gris/blanc pour la lisibilité */
.gw-table tbody tr:nth-child(even) { background: var(--surface-2); }
/* Lignes "à faire" (suivi des MàJ) mises en évidence */
.gw-table tbody tr.gw-row-todo { background: rgba(0, 200, 83, .10); }
.gw-table tbody tr.gw-row-todo td:first-child { box-shadow: inset 3px 0 0 #00c853; }
.gw-table tbody tr:hover { background: var(--surface-hover); }
.gw-table img.flag { width: 18px; height: auto; vertical-align: -2px; margin-right: 4px; }

/* Pastille d'état des mises à jour */
.gw-updot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--border-strong); vertical-align: middle; }
.gw-updot--todo { background: #00c853; box-shadow: 0 0 0 3px rgba(0, 200, 83, .22); }

/* Diff côte à côte (suivi des MàJ) — structure jfcherng/php-diff, thème-aware */
.diff { width: 100%; border-collapse: collapse; font: 13px/1.5 Consolas, 'Courier New', monospace; }
.diff thead th { background: var(--surface-2); color: var(--text-muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 650; }
.diff th.n-old, .diff th.n-new { width: 3em; text-align: right; color: var(--text-faint); background: var(--surface-2); padding: 2px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); user-select: none; font-weight: 500; }
.diff td { padding: 2px 10px; vertical-align: top; white-space: pre-wrap; word-break: break-word; border-bottom: 1px solid var(--border); color: var(--text); }
.diff tbody.change-ins td.new { background: rgba(47, 166, 107, .16); }
.diff tbody.change-del td.old { background: rgba(214, 69, 93, .16); }
.diff tbody.change-rep td.old, .diff tbody.change-rep td.new { background: rgba(217, 146, 43, .16); }
.diff ins { background: rgba(47, 166, 107, .42); text-decoration: none; border-radius: 2px; }
.diff del { background: rgba(214, 69, 93, .42); text-decoration: none; border-radius: 2px; }

/* Analyse SEO (éditeur d'article) */
.seo-head { display: flex; align-items: center; justify-content: space-between; }
.seo-score { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.seo-score--ok { background: var(--success-bg); color: var(--success); }
.seo-score--warn { background: #fdf0dc; color: var(--warning); }
.seo-score--bad { background: var(--danger-bg); color: var(--danger); }
.seo-checks { list-style: none; margin: 0; padding: 0; }
.seo-check { font-size: 12.5px; padding: 5px 0; display: flex; align-items: center; gap: 7px; color: var(--text-muted); }
.seo-check i { font-size: 13px; flex: 0 0 auto; }
.seo-check--ok { color: var(--text); }
.seo-check--ok i { color: var(--success); }
.seo-check--bad i { color: var(--danger); }
.seo-check--warn i { color: var(--warning); }

/* Cadre « outils d'insertion » (liens internes + jeu + sondage) : fond distinct */
.gw-insert-tools {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

/* Ligne « balises + jeu + sondage » : tout sur une ligne */
.gw-insert-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.gw-insert-row > div { min-width: 0; }
.gw-insert-row #tag-inserter-panel { flex: 1 1 260px; }
/* Inséreur universel de balises (recherche) */
.gw-tag-search { position: relative; }
.gw-tag-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px; overflow-y: auto; display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.gw-tag-result { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; background: transparent; border: 0; border-bottom: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 13px; }
.gw-tag-result:last-child { border-bottom: 0; }
.gw-tag-result:hover { background: var(--surface-hover); }
.gw-tag-type { flex: 0 0 auto; min-width: 58px; text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 7px; border-radius: 999px; background: var(--accent); color: #fff; }
.gw-tag-type--jeu { background: #3b82f6; }      /* bleu */
.gw-tag-type--article { background: #22c55e; }  /* vert */
.gw-tag-type--sondage { background: #a855f7; }  /* violet */
.gw-tag-type--prix { background: #f59e0b; color: #1b1b1b; } /* orange */
.gw-tag-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-tag-result code { flex: 0 0 auto; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.gw-tag-empty { padding: 10px; color: var(--text-muted); font-size: 13px; }
/* Mon espace (tableau de bord perso rédacteur) */
.gw-space-list { list-style: none; margin: 0; padding: 0; }
.gw-space-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.gw-space-item:last-child { border-bottom: 0; }
.gw-space-link { color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-space-link:hover { color: var(--accent); }
.gw-space-meta { flex: 0 0 auto; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.gw-space-empty { color: var(--text-muted); font-size: 14px; margin: 4px 0; }
.gw-insert-tags { flex: 0 0 auto; }
.gw-tags-codes { display: flex; flex-wrap: wrap; gap: 6px; }
.gw-tags-codes code.gw-copy {
  cursor: pointer; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 8px 10px; border-radius: 6px; font-size: 12.5px; color: var(--text);
  transition: border-color .15s ease, color .15s ease;
}
.gw-tags-codes code.gw-copy:hover { border-color: var(--accent); color: var(--accent); }
/* Balise déjà présente dans le contenu : bouton de copie en vert (comme les suggestions de liens) */
.gw-tags-codes code.gw-copy.is-present { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.gw-tags-codes code.gw-copy.is-present:hover { border-color: var(--success); color: var(--success); }

/* Checklist de publication (avant le bouton publier) */
.gw-checklist { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.gw-checklist__toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between; cursor: pointer;
  background: var(--surface-2); border: 0; padding: 10px 12px; font: 700 12.5px var(--font); color: var(--text);
}
.gw-checklist__score { font-weight: 800; color: var(--text-muted); }
.gw-checklist__score.is-bad { color: #e05260; }
.gw-checklist__score.is-full { color: #2ECC71; }
/* Jauge : un segment par critère — vert si validé, rouge sinon */
.gw-checklist__gauge { display: flex; gap: 3px; padding: 10px 12px; }
.gw-checklist__seg { flex: 1; height: 6px; border-radius: 3px; background: #e05260; transition: background .25s ease; }
.gw-checklist__seg.is-on { background: #2ECC71; }
.gw-checklist__list { list-style: none; margin: 0; padding: 8px 12px; }
.gw-checklist__item { font-size: 12.5px; padding: 4px 0; display: flex; align-items: center; gap: 8px; }
.gw-checklist__item.is-ok { color: var(--text); }
.gw-checklist__item.is-ok i { color: #2ECC71; }
.gw-checklist__item.is-ko { color: var(--text-muted); }
.gw-checklist__item.is-ko i { color: #e05260; }

/* Temps de lecture live (au-dessus de l'éditeur de contenu) */
.gw-editor-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.gw-reading-stats { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
/* Assistant IA sur la sélection (au-dessus de l'éditeur) */
.gw-ai-assist { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.gw-ai-assist__label { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }
.gw-ai-btn { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.gw-ai-btn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.gw-ai-btn:disabled { opacity: .6; cursor: default; }
.gw-ai-assist__msg { font-size: 12px; margin-left: 2px; }
.gw-ai-assist__msg.is-ok { color: #39d98a; }
.gw-ai-assist__msg.is-err { color: #ff6b6b; }

/* Masque le compteur de mots natif de TinyMCE (on a notre propre temps de lecture) */
.tox-statusbar__wordcount { display: none !important; }

/* Suggestions de titres IA (sous le champ titre) — en overlay, n'agrandit pas la rangée */
.gw-ai-titles {
  position: absolute; left: 0; right: 0; z-index: 20; margin-top: 6px;
  padding: 10px 12px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  box-shadow: var(--shadow);
}
.gw-ai-titles__head { font-size: 11.5px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.gw-ai-titles__msg { font-size: 12.5px; color: var(--text-muted); }
.gw-ai-title {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 11px; margin-bottom: 6px; font: 500 13.5px var(--font); color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.gw-ai-title:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.gw-ai-titles__regen {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; margin-top: 4px;
  background: transparent; border: 0; padding: 4px 2px; font: 600 11.5px var(--font); color: var(--text-muted);
}
.gw-ai-titles__regen:hover { color: var(--accent); }

/* Suggestions de maillage interne (barre de chips au-dessus de l'éditeur) */
.gw-links-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.gw-links-bar__empty { font-size: 12.5px; color: var(--text-faint); }
.gw-link-item { display: inline-flex; align-items: stretch; }
.gw-link-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 300px; padding: 6px 11px; border: 1px solid var(--border-strong); border-right: 0; background: var(--surface); color: var(--text); border-radius: 999px 0 0 999px; font: 500 12.5px var(--font); cursor: pointer; transition: var(--transition); }
.gw-link-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-link-chip i { color: var(--accent); }
.gw-link-chip:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.gw-link-chip.is-added { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.gw-link-chip.is-added i { color: var(--success); }
.gw-link-open { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); border-radius: 0 999px 999px 0; font-size: 12px; transition: var(--transition); }
.gw-link-open:hover { background: var(--surface-hover); color: var(--accent); }
.gw-link-more { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px dashed var(--border-strong); background: transparent; color: var(--accent); border-radius: 999px; font: 600 12.5px var(--font); cursor: pointer; transition: var(--transition); }
.gw-link-more:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: var(--accent); }

/* Clic-pour-copier (balises fiche/galerie/sondage/vidéo…) */
.gw-copy { cursor: pointer; position: relative; transition: background var(--transition), color var(--transition); }
.gw-copy:hover { outline: 1px dashed var(--border-strong); outline-offset: 1px; }
.gw-copy.is-copied { background: var(--success-bg) !important; color: var(--success) !important; }
.gw-copy.is-copied::after { content: 'Copié ✓'; position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); margin-bottom: 5px; background: var(--success); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px; white-space: nowrap; z-index: 5; pointer-events: none; }

/* Uniformise la graisse/taille des liens de navigation (top + sous-menus) */
.gw-nav a, .gw-nav__toggle, .gw-nav__sub a { font-weight: 500; }
.gw-nav__sub a { font-size: 13.5px; }

/* Combobox recherchable (remplace les longues listes déroulantes) */
.gw-combo { position: relative; }
.gw-combo__field {
  display: block; width: 100%; text-align: left; padding: 11px 34px 11px 13px;
  font: 400 14px/1.4 var(--font); color: var(--text); cursor: pointer;
  background: var(--surface) url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7686' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gw-combo.open .gw-combo__field { border-color: var(--accent); box-shadow: var(--ring); }
.gw-combo__panel {
  position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); display: none; overflow: hidden;
}
.gw-combo.open .gw-combo__panel { display: block; }
.gw-combo__search { width: 100%; border: 0; border-bottom: 1px solid var(--border); padding: 10px 12px; font: 400 13.5px var(--font); outline: none; }
.gw-combo__list { max-height: 260px; overflow-y: auto; }
.gw-combo__item { padding: 9px 12px; font-size: 13.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gw-combo__item:hover { background: var(--surface-hover); }
.gw-combo__item.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.gw-combo__empty { padding: 10px 12px; font-size: 13px; color: var(--text-faint); }

.gw-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 0; color: #fff; margin-right: 4px; transition: filter var(--transition); }
.gw-iconbtn:hover { filter: brightness(1.1); color: #fff; }
.gw-iconbtn--edit { background: var(--accent); }
.gw-iconbtn--view { background: var(--surface-hover); color: var(--text-muted); }
.gw-iconbtn--view:hover { color: var(--text); }

/* ---- Burger (mobile) ---- */
.gw-burger { display: none; background: none; border: 0; color: var(--text); font-size: 20px; cursor: pointer; padding: 4px 8px; }

@media (max-width: 1024px) {
  .gw-burger { display: inline-block; }
  .gw-topbar__brand { width: auto; }
  .gw-sidebar { transform: translateX(-100%); transition: transform var(--transition); box-shadow: var(--shadow-lg); }
  body.gw-sidebar-open .gw-sidebar { transform: none; }
  .gw-content { margin-left: 0; padding: 20px 16px 50px; }
  .gw-usermenu__name { display: none; }
}

/* =========================================================================
   Édition d'article (news-edit) — grille éditeur, selects natifs, modales
   ========================================================================= */

/* Select natif avec chevron */
.gw-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7686' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
.gw-select:disabled { background-color: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }

/* Grille éditeur : colonne principale + panneau latéral */
.gw-editor { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 22px; align-items: start; }
@media (max-width: 1200px) { .gw-editor { grid-template-columns: 1fr; } }

/* Barre de titre + boutons d'action */
.gw-title-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 18px; }
.gw-title-input-wrap { flex: 1; position: relative; }
.gw-title-input-wrap .gw-input { font-size: 18px; font-weight: 600; height: 100%; }
.gw-title-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.gw-icon-action {
  display: inline-flex; align-items: center; justify-content: center; min-width: 48px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); cursor: pointer; font-size: 16px; transition: var(--transition);
}
.gw-icon-action:hover { background: var(--surface-hover); color: var(--text); }
.gw-icon-action img { height: 18px; width: auto; display: block; }
.gw-icon-action--on { background: var(--success); border-color: var(--success); color: #fff; }
.gw-icon-action--on:hover { background: var(--success); color: #fff; filter: brightness(1.05); }
/* État du smiley #viewers (classes basculées par viewers() dans dashboard.js) */
#viewers.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
#viewers.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
#viewers.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Suggestions de titres */
.gw-suggest { position: absolute; left: 0; right: 0; z-index: 10; margin-top: 6px; list-style: none; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.gw-suggest li { padding: 9px 13px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.gw-suggest li:last-child { border-bottom: 0; }
.gw-suggest li:hover { background: var(--surface-hover); }

/* Rangée d'actions d'en-tête (vidéo / mises à jour) */
.gw-head-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.gw-head-actions > * { flex: 1; min-width: 160px; }

/* Aperçu image d'en-tête + input fichier habillé */
.gw-img-preview { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; margin-bottom: 12px; }
.gw-file { position: relative; overflow: hidden; display: block; }
/* Bouton d'upload : conserve le centrage flex de .gw-btn (sinon .gw-file le passe en block) */
.gw-btn.gw-file { display: inline-flex; }
.gw-file input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* Sous-grille 2 colonnes pour le panneau latéral */
.gw-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* Empêche un <select>/<input> au contenu long (ex. nom de jeu) d'élargir sa cellule
   et de pousser le voisin hors cadre : les pistes 1fr peuvent alors rétrécir. */
.gw-row2 > * { min-width: 0; }
.gw-select { max-width: 100%; }
.gw-side-label { font-weight: 700; font-size: 12.5px; margin-bottom: 6px; display: block; color: var(--text); }
/* Calendrier/heure natifs : adapte le popup et l'icône au thème sombre */
:root[data-theme="dark"] input[type="date"],
:root[data-theme="dark"] input[type="time"] { color-scheme: dark; }

/* En-tête de section du panneau latéral (regroupement logique) */
.gw-side-section {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); margin: 4px 0 12px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.gw-tags-list { font-size: 12.5px; color: var(--text-muted); }
.gw-tags-list code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* Modale maison */
.gw-modal { position: fixed; inset: 0; z-index: 100; display: none; }
.gw-modal.open { display: block; }
.gw-modal__overlay { position: absolute; inset: 0; background: rgba(16, 29, 51, .5); }
.gw-modal__dialog { position: relative; z-index: 1; width: calc(100% - 32px); max-width: 760px; margin: 46px auto;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 92px); display: flex; flex-direction: column; }
.gw-modal__dialog--sm { max-width: 540px; }
.gw-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.gw-modal__head h4 { margin: 0; font-size: 17px; }
.gw-modal__close { background: none; border: 0; font-size: 24px; line-height: 1; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.gw-modal__close:hover { color: var(--text); }
.gw-modal__body { padding: 22px; overflow-y: auto; }
.gw-modal__foot { padding: 14px 22px; border-top: 1px solid var(--border); text-align: right; }

/* =========================================================================
   Utilitaires partagés listings + formulaires (pages v3)
   ========================================================================= */

/* Disposition liste + panneau d'ajout (2/1) */
.gw-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1100px) { .gw-split { grid-template-columns: 1fr; } }

/* Barre d'outils au-dessus d'un tableau */
.gw-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.gw-toolbar__spacer { flex: 1; }

/* Cases à cocher de sélection multiple (tables) */
.gw-bulk-check, [data-bulk-all] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }

/* Recherche inline */
.gw-search { display: flex; gap: 8px; align-items: center; }
.gw-search .gw-input { max-width: 280px; }

/* Boutons taille réduite */
.gw-btn--sm { padding: 7px 12px; font-size: 12.5px; }
.gw-btn--xs { padding: 5px 9px; font-size: 12px; }

/* Variantes d'icon-bouton (ronds d'action dans les tableaux) */
.gw-iconbtn--success { background: var(--success); }
.gw-iconbtn--danger { background: var(--danger); }
.gw-iconbtn--info { background: #2b8fb8; }
.gw-iconbtn--primary { background: var(--accent); }
.gw-iconbtn--warning { background: var(--warning); }

/* Pastilles / badges d'état */
.gw-badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.gw-badge--ok { background: var(--success-bg); color: var(--success); }
.gw-badge--warn { background: #fdf0dc; color: var(--warning); }
.gw-badge--danger { background: var(--danger-bg); color: var(--danger); }

/* Pastille de couleur (catégories, jeux) */
.gw-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; border: 1px solid rgba(0,0,0,.12); margin-right: 5px; }

/* Entrée de type couleur */
input[type=color].gw-input { padding: 4px; height: 42px; cursor: pointer; }

/* En-tête de carte avec titre */
.gw-card__head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.gw-card__head h3 { margin: 0; font-size: 15px; }

/* Onglets */
.gw-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.gw-tab { padding: 10px 16px; border: 0; background: none; cursor: pointer; font: 600 13.5px var(--font); color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.gw-tab:hover { color: var(--text); }
.gw-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.gw-tabpane { display: none; }
.gw-tabpane.active { display: block; }

/* Message d'état vide */
.gw-empty { padding: 40px 20px; text-align: center; color: var(--text-faint); font-size: 14px; }

/* Listes de cases à cocher (modales game-edit, etc.) */
.gw-check-list { display: flex; flex-direction: column; gap: 10px; }
.gw-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.gw-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

/* Ligne de tableau marquée supprimée (suppression AJAX via actions()) */
.gw-table tr.gw-row-deleted td { opacity: .45; text-decoration: line-through; }

/* Rangée label (à droite) + champ dans les modales */
.gw-mrow { display: grid; grid-template-columns: 190px 1fr; gap: 16px; align-items: center; margin-bottom: 16px; }
.gw-mrow > label { font-weight: 600; font-size: 13px; text-align: right; color: var(--text-muted); line-height: 1.3; }
.gw-mrow--top { align-items: start; }
.gw-mcols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
/* Modale « Type de modification » : boutons alignés en bas malgré des textes de hauteurs différentes */
#modal-publish .gw-mcols > div { display: flex; flex-direction: column; }
#modal-publish .gw-mcols > div > p { flex: 1 0 auto; }
.gw-mlist { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 640px) {
  .gw-mrow { grid-template-columns: 1fr; gap: 6px; }
  .gw-mrow > label { text-align: left; }
  .gw-mcols { grid-template-columns: 1fr; }
}
