/* ==========================================================================
   Update Mailer v2 — direction « Navy & lime »
   Navy #1a2830 (fond, texte, barre latérale) · Lime #c8f04a (accent).
   ========================================================================== */

:root {
  --navy: #1a2830;
  --lime: #c8f04a;

  --ground: #f3f5f6;
  --surface: #ffffff;
  --surface-2: #f3f5f6;
  --line: #e1e6e9;
  --line-strong: #d0d7db;

  --text: #1a2830;
  --text-2: #44525a;
  --text-3: #5b6870;

  --ok: #4a6a0c;
  --ok-soft: #eef8d2;
  --warn: #7a5200;
  --warn-soft: #fbf0d9;
  --bad: #9c3628;
  --bad-soft: #fbe5e1;

  --side-bg: #1a2830;
  --side-text: #d5dde1;
  --side-muted: #93a3ab;
  --side-line: #2a3a43;
  --side-active: rgba(255, 255, 255, 0.08);

  --btn-bg: #1a2830;
  --btn-text: #ffffff;
  --focus: #4a6a0c;

  --font-display: 'Stack Sans Notch', 'DM Sans', sans-serif;
  --font-ui: 'DM Sans', 'Helvetica Neue', Helvetica, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, Menlo, monospace;

  --r: 14px;
  --r-sm: 10px;

  /* Répartition des versions de Joomla */
  --seg-new: #4a6a0c;
  --seg-mid: #c8f04a;
  --seg-old: #e07060;
  --seg-none: #d0d7db;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ground: #0f171c;
  --surface: #16222a;
  --surface-2: #1d2b34;
  --line: #26353f;
  --line-strong: #34454f;
  --text: #e8eef1;
  --text-2: #c0ccd2;
  --text-3: #97a7af;
  --ok: #c8f04a;
  --ok-soft: #26330f;
  --warn: #e8b860;
  --warn-soft: #33280f;
  --bad: #f0a093;
  --bad-soft: #3a1f1a;
  --side-bg: #0b1216;
  --side-line: #22313a;
  --btn-bg: #c8f04a;
  --btn-text: #1a2830;
  --focus: #c8f04a;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0f171c;
    --surface: #16222a;
    --surface-2: #1d2b34;
    --line: #26353f;
    --line-strong: #34454f;
    --text: #e8eef1;
    --text-2: #c0ccd2;
    --text-3: #97a7af;
    --ok: #c8f04a;
    --ok-soft: #26330f;
    --warn: #e8b860;
    --warn-soft: #33280f;
    --bad: #f0a093;
    --bad-soft: #3a1f1a;
    --side-bg: #0b1216;
    --side-line: #22313a;
    --btn-bg: #c8f04a;
    --btn-text: #1a2830;
    --focus: #c8f04a;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--ok); text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.mono { font-family: var(--font-mono); font-size: 0.92em; }

/* ---------- Coquille : barre latérale + contenu ---------- */

.shell {
  display: flex; min-height: 100vh;
  background: linear-gradient(to right, var(--side-bg) 248px, var(--ground) 248px);
}

.side {
  width: 248px; flex-shrink: 0;
  background: var(--side-bg); color: var(--side-text);
  padding: 28px 16px 20px;
  display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side :focus-visible { outline-color: var(--lime); }

.wordmark {
  font-family: var(--font-display);
  font-size: 21px; line-height: 1; letter-spacing: 0.02em;
  padding: 0 8px; white-space: nowrap;
}
.wordmark img { display: block; width: 190px; max-width: 100%; height: auto; }
.login .wordmark img { width: 260px; }
.wordmark small {
  display: block; margin-top: 8px;
  font-family: var(--font-ui); font-size: 12.5px; letter-spacing: 0;
  color: var(--side-muted);
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav .soon {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 0 12px; border-radius: var(--r-sm);
  color: var(--side-text); text-decoration: none; font-size: 14.5px;
}
.nav a:hover { background: var(--side-active); color: #ffffff; }
.nav a[aria-current="page"] { background: var(--side-active); color: #ffffff; font-weight: 600; }
.nav .soon { color: var(--side-muted); cursor: default; }
.nav-label { margin: 18px 12px 6px; font-size: 12.5px; color: var(--side-muted); }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }

.side-foot {
  margin-top: auto; padding: 14px 8px 0; border-top: 1px solid var(--side-line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.side-foot .who { flex: 1 1 100%; min-width: 0; font-size: 13px; color: var(--side-muted); }
.side-foot .who strong { display: block; color: #ffffff; font-size: 14px; font-weight: 600; }
.icon-btn {
  width: 44px; height: 44px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); border: 1px solid var(--side-line);
  background: transparent; color: var(--side-text); cursor: pointer;
}
.icon-btn:hover { background: var(--side-active); color: #ffffff; }
.icon-btn svg { width: 18px; height: 18px; }

.main {
  flex: 1; min-width: 0;
  padding: 40px 48px 72px;
  display: flex; flex-direction: column; gap: 28px;
}
.main > * { max-width: 1080px; }

@media (max-width: 880px) {
  .shell { flex-direction: column; background: var(--ground); }
  .nav-label { display: none; }
  .side {
    width: auto; height: auto; position: static;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 12px; padding: 14px 16px;
  }
  .wordmark { padding: 0; }
  .wordmark img { width: 132px; }
  .wordmark small { display: none; }
  .nav { order: 3; flex-direction: row; overflow-x: auto; width: 100%; gap: 4px; }
  .nav a, .nav .soon { white-space: nowrap; }
  .nav .soon { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .side-foot .who { display: none; }
  .main { padding: 24px 16px 56px; gap: 22px; }
}

/* ---------- En-tête de page ---------- */

.page-head { display: flex; flex-direction: column; gap: 8px; }
.page-head .kicker { font-size: 14px; color: var(--text-3); }
.page-head h1 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(30px, 4vw, 42px); line-height: 1.08;
  overflow-wrap: anywhere;
}
.page-head .lead { font-size: 16px; color: var(--text-2); max-width: 62ch; }

/* Étapes du chantier */
.steps {
  list-style: none; margin: 4px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.steps li {
  flex: 1 1 190px; display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14px; color: var(--text-2);
}
.steps li b { display: block; color: var(--text); font-weight: 600; }
.steps .n {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line-strong); font-weight: 700; font-size: 13px; color: var(--text-3);
}
.steps li[aria-current="step"] { background: var(--navy); border-color: var(--focus); color: #c3cdd2; }
.steps li[aria-current="step"] b { color: #ffffff; }
.steps li[aria-current="step"] .n { background: var(--lime); border-color: var(--lime); color: var(--navy); }

/* ---------- Cartes ---------- */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px 24px; display: flex; flex-direction: column; gap: 16px;
}
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.card-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.005em; }
.card-head p { font-size: 14px; color: var(--text-3); }
.card .hint { font-size: 13.5px; color: var(--text-3); }

.grid-2 { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.grid-2 > * { flex: 1 1 380px; min-width: 0; }

/* ---------- Liste de vérifications ---------- */

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.checks li {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.checks li:last-child { border-bottom: 0; }
.checks .label { font-weight: 600; }
.checks .detail { font-size: 13.5px; color: var(--text-3); }
.checks .value { margin-left: auto; font-size: 14px; color: var(--text-2); text-align: right; }

.state {
  width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.state svg { width: 14px; height: 14px; }
.state.ok { background: var(--ok-soft); color: var(--ok); }
.state.warn { background: var(--warn-soft); color: var(--warn); }
.state.bad { background: var(--bad-soft); color: var(--bad); }
.state.wait { background: var(--surface-2); color: var(--text-3); }

.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-sm); font-size: 14.5px;
}
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner strong { color: inherit; }
.banner[hidden] { display: none; }

/* ---------- Formulaires & boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-sm);
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14.5px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  background: var(--btn-bg); color: var(--btn-text);
}
.btn:hover { filter: brightness(1.15); color: var(--btn-text); }
.btn svg { width: 16px; height: 16px; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--surface-2); filter: none; color: var(--text); }
.btn.accent { background: var(--lime); color: var(--navy); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn.is-busy { cursor: progress; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label-text { font-size: 14px; font-weight: 600; color: var(--text-2); }
input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="date"], input[type="number"], input[type="tel"], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit;
}
textarea { min-height: 120px; resize: vertical; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }

.code {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden;
  background: var(--surface-2);
}
.code code {
  flex: 1; min-width: 0; padding: 12px 14px;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5;
  overflow-x: auto; white-space: pre; color: var(--text);
}
.code button {
  flex-shrink: 0; min-width: 88px; border: 0; border-left: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.code button:hover { background: var(--ground); }

details.alt summary {
  cursor: pointer; min-height: 44px; display: flex; align-items: center;
  font-weight: 600; color: var(--text-2);
}
details.alt[open] summary { margin-bottom: 8px; }
ol.howto { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; color: var(--text-2); }
ol.howto li::marker { font-weight: 700; color: var(--text); }

/* ---------- Données ---------- */

.figures { display: flex; flex-wrap: wrap; gap: 12px; }
.figure {
  flex: 1 1 150px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2);
}
.figure strong { display: block; font-family: var(--font-display); font-weight: 400; font-size: 32px; line-height: 1.1; }
.figure span { font-size: 13.5px; color: var(--text-3); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.data th {
  text-align: left; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.strong { font-weight: 600; }
.empty { padding: 22px; text-align: center; color: var(--text-3); font-size: 14.5px; }

details.log { font-size: 13px; color: var(--text-3); }
details.log summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; }
details.log pre {
  margin: 8px 0 0; padding: 12px; max-height: 260px; overflow: auto;
  background: var(--surface-2); border-radius: 8px; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap;
}

/* ---------- Notification ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  max-width: min(92vw, 520px); padding: 12px 18px; border-radius: 12px;
  background: var(--btn-bg); color: var(--btn-text); font-size: 14.5px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(26, 40, 48, 0.25);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* ---------- Page de connexion ---------- */

.login {
  min-height: 100vh; background: var(--navy); color: var(--side-text);
  display: flex; align-items: center; justify-content: center; padding: 32px 16px;
}
.login-box { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 28px; }
.login .wordmark { font-size: 30px; padding: 0; }
.login .wordmark small { font-size: 14px; margin-top: 10px; }
.login .card { padding: 28px; gap: 18px; color: var(--text); }
.login .card h1 { font-size: 22px; font-weight: 700; }
.login .card p { color: var(--text-2); font-size: 14.5px; }
.login .btn { width: 100%; }
.login .foot { font-size: 13px; color: var(--side-muted); text-align: center; }

/* ---------- Utilitaires (pas de style en ligne : la CSP les bloque) ---------- */
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }

/* Marqueur des blocs repliables (display:flex masque le triangle natif) */
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: ''; width: 7px; height: 7px; margin: 0 12px 0 2px; flex-shrink: 0;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s;
}
details[open] > summary::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { details summary::before { transition: none; } }


/* ==========================================================================
   Étape 2 — tableau de bord, clients & sites, catalogue
   ========================================================================== */

:root[data-theme="dark"] { --seg-new: #c8f04a; --seg-mid: #6f8a24; --seg-none: #34454f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --seg-new: #c8f04a; --seg-mid: #6f8a24; --seg-none: #34454f; }
}

.loading { color: var(--text-3); }
.nav .count { font-size: 12.5px; color: var(--side-muted); }
.nav a[aria-current="page"] .count { color: var(--side-text); }

.page-head.row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.page-head h1:focus, .panel h2:focus { outline: none; }
.steps li.done .n { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

.sub { display: block; font-size: 13px; color: var(--text-3); font-weight: 400; }
.flag-old { display: block; font-size: 12.5px; font-weight: 600; color: var(--bad); }
.empty-inline { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 14.5px; }
.empty-state { align-items: flex-start; }
.empty-state h2 { font-size: 20px; }

/* Indicateurs */
.kpis { display: flex; flex-wrap: wrap; gap: 16px; }
.kpi {
  flex: 1 1 200px; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 20px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none;
}
a.kpi:hover { border-color: var(--line-strong); color: var(--text); }
.kpi .k-label { font-size: 14px; font-weight: 500; color: var(--text-3); }
.kpi .k-value { font-family: var(--font-display); font-size: 40px; line-height: 1.1; }
.kpi .k-sub { font-size: 13.5px; color: var(--text-3); }
.kpi.alert { background: var(--bad-soft); border-color: transparent; }
.kpi.alert .k-label, .kpi.alert .k-value, .kpi.alert .k-sub { color: var(--bad); }
.kpi.warn { background: var(--warn-soft); border-color: transparent; }
.kpi.warn .k-label, .kpi.warn .k-value, .kpi.warn .k-sub { color: var(--warn); }

/* Colonnes adaptatives */
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cols > .wide { flex: 999 1 520px; min-width: 0; }
.cols > .narrow { flex: 1 1 300px; min-width: 0; }
.card h2 { font-size: 18px; font-weight: 700; }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card.flush > .hint { padding: 0 20px 14px; }
.card-head.padded { padding: 18px 20px 12px; }
.table-wrap.borderless { border: 0; border-radius: 0; }

/* Statuts */
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pill svg { width: 14px; height: 14px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.due { background: var(--warn-soft); color: var(--warn); }
.pill.late { background: var(--bad-soft); color: var(--bad); }
.pill.unknown, .pill.oneoff { background: var(--surface-2); color: var(--text-2); }

/* Versions de Joomla */
.stack { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.stack span { display: block; height: 100%; }
.seg-new { background: var(--seg-new); }
.seg-mid { background: var(--seg-mid); }
.seg-old { background: var(--seg-old); }
.seg-none { background: var(--seg-none); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend b { margin-left: auto; font-weight: 600; }

/* Extensions du parc */
.ext-stat { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; color: var(--text); text-decoration: none; }
.ext-stat:hover { color: var(--text); }
.ext-stat:hover .top span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.ext-stat .top { display: flex; justify-content: space-between; gap: 8px; }
.ext-stat .top span:last-child { color: var(--text-3); font-size: 14px; white-space: nowrap; }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 3px; background: var(--ok); }

/* Filtres */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.search {
  flex: 1 1 260px; max-width: 420px; display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line-strong); color: var(--text-3);
}
.search svg { width: 16px; height: 16px; flex-shrink: 0; }
.search input { flex: 1; min-width: 0; min-height: 0; padding: 8px 0; border: 0; background: transparent; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip[aria-current="true"] { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-text); }
.chip .n { font-size: 13px; opacity: 0.72; }
.chip svg { width: 14px; height: 14px; }

/* Tableau des clients */
table.data tr.row-link { cursor: pointer; }
table.data tr.row-link:hover td { background: var(--surface-2); }
table.data tr.is-selected td, table.data tr.is-selected:hover td { background: var(--ok-soft); }
table.data a.name { font-weight: 700; color: var(--text); text-decoration: none; }
table.data a.name:hover { text-decoration: underline; }
table.data td.actions { width: 56px; text-align: right; }

/* Fiche client */
.panel { position: sticky; top: 24px; gap: 14px; }
.cols > .panel { flex-basis: 360px; }
.panel .btn-row .btn { flex: 1 1 auto; white-space: normal; text-align: left; }
.panel-head { display: flex; align-items: flex-start; gap: 14px; }
.panel-head h2 { font-size: 20px; overflow-wrap: anywhere; }
.avatar {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--lime); color: var(--navy); font-family: var(--font-display); font-size: 18px;
}
.site-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.site-link svg { width: 13px; height: 13px; }
.status-line { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.panel section { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.panel h3 { font-size: 15px; font-weight: 700; }
.panel .card-head { align-items: baseline; }
.panel-foot { padding-top: 14px; border-top: 1px solid var(--line); }
dl.facts { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; font-size: 14.5px; }
dl.facts dt { color: var(--text-3); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.ext-list { list-style: none; margin: 0; padding: 0; }
.ext-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.ext-list li:last-child { border-bottom: 0; }
.ext-list small { margin-left: 8px; font-size: 12.5px; color: var(--text-3); }
.notes { white-space: pre-line; color: var(--text-2); font-size: 14.5px; }

.icon-btn.ghost { border-color: transparent; color: var(--text-3); }
.icon-btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--bad); color: var(--surface); }
.btn.ghost-danger { background: transparent; color: var(--bad); border-color: transparent; padding: 0 10px; }
.btn.ghost-danger:hover { background: var(--bad-soft); filter: none; color: var(--bad); }

/* Boîtes de dialogue */
dialog.dlg {
  width: min(780px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 24px 60px rgba(10, 20, 26, 0.35);
}
dialog.dlg::backdrop { background: rgba(10, 18, 23, 0.55); }
dialog.dlg > form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 14px 24px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 20px; }
.dlg-body { padding: 20px 24px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); }
dialog.dlg-small { width: min(480px, calc(100vw - 24px)); }
.dlg-small .dlg-body { gap: 10px; }
.dlg-small h2 { font-size: 19px; }
.dlg-small p { color: var(--text-2); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
legend { padding: 0; margin-bottom: 12px; font-size: 16px; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.req { font-size: 12.5px; font-weight: 500; color: var(--text-3); }
.field .hint { font-size: 13px; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
textarea.plain { font-family: var(--font-ui); font-size: 15px; line-height: 1.55; min-height: 88px; }
.mono-input { font-family: var(--font-mono); font-size: 14px; }

.ext-head, .ext-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 130px 44px; gap: 8px; align-items: center; }
.ext-head { font-size: 13px; font-weight: 600; color: var(--text-3); }
.ext-rows { display: flex; flex-direction: column; gap: 8px; }
.ext-rows:empty::before { content: "Aucune extension pour l’instant."; font-size: 14px; color: var(--text-3); }
.ext-rows:empty + .btn-row { margin-top: -4px; }
.quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.quick > span { margin-right: 4px; font-size: 13.5px; color: var(--text-3); }
.quick .chip { min-height: 34px; padding: 0 12px; font-size: 13.5px; gap: 6px; }

/* Catalogue */
.add-form { display: grid; grid-template-columns: 170px minmax(0, 1fr) 190px auto; gap: 12px; align-items: end; }
table.cat input, table.cat select { min-height: 40px; padding: 6px 10px; }
table.cat td { vertical-align: middle; }
table.cat td:nth-child(2) { width: 160px; }
table.cat td:nth-child(3) { width: 180px; }
table.cat td:nth-child(4) { width: 130px; white-space: nowrap; }

@media (max-width: 880px) {
  .panel { position: static; }
}
@media (max-width: 680px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .ext-head { display: none; }
  .ext-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
  .ext-row input[list] { grid-column: 1 / -1; order: -1; }
  .add-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .add-form .f-name { grid-column: 1 / -1; order: -1; }
  .add-form .btn { grid-column: 1 / -1; }
  .dlg-body { padding: 16px; }
  .dlg-foot { padding: 12px 16px; }
}


/* ==========================================================================
   Étape 3 — composer un rapport, aperçu, envoi, réglages
   ========================================================================== */

.side-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; border-radius: var(--r-sm);
  background: var(--lime); color: var(--navy); font-weight: 700; text-decoration: none;
}
.side-cta:hover { filter: brightness(1.06); color: var(--navy); }
.side-cta svg { width: 16px; height: 16px; }
@media (max-width: 880px) { .side-cta { order: 2; padding: 0 14px; margin-left: auto; } }

.btn.compact { min-height: 38px; padding: 0 12px; font-size: 13.5px; }
.btn.big { min-height: 50px; font-size: 16px; }
.btn-row .grow-btn { flex: 1 1 160px; }
.col-stack { display: flex; flex-direction: column; gap: 16px; }
.sticky-col { position: sticky; top: 24px; }
@media (max-width: 880px) { .sticky-col { position: static; } }
.card-title { font-size: 18px; font-weight: 700; color: var(--text); }
.count-inline { font-weight: 500; color: var(--text-3); }
.name-link { font-weight: 600; color: var(--text); text-decoration: none; }
.name-link:hover { text-decoration: underline; color: var(--text); }

/* Choix du site */
.pick-list { list-style: none; margin: 0; padding: 0; }
.pick-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pick-list li:last-child { border-bottom: 0; }
.pick-name { font-weight: 700; }
.avatar.sm { width: 38px; height: 38px; border-radius: 10px; font-size: 15px; }

/* Formulaire du rapport */
.site-line { font-size: 17px; font-weight: 700; }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14.5px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ok); flex-shrink: 0; }
.check input:disabled + * , .check:has(input:disabled) { color: var(--text-3); cursor: not-allowed; }
.check-list { display: flex; flex-direction: column; gap: 2px; }
.version-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: end; }
.version-pair .arrow { min-height: 44px; display: flex; align-items: center; color: var(--text-3); font-size: 18px; }
.search.wide-search { flex: none; max-width: none; }
.chip.strong { font-weight: 700; }

.rep-head, .rep-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 112px 112px 44px; gap: 8px; align-items: center; }
.rep-head { font-size: 13px; font-weight: 600; color: var(--text-3); }
.rep-rows { display: flex; flex-direction: column; gap: 8px; }
.rep-rows:empty::before { content: "Aucune extension dans ce rapport pour l’instant."; font-size: 14px; color: var(--text-3); }
.rep-rows:empty + .hint { margin-top: -6px; }
.rep-row .row-hint { grid-column: 2 / -1; margin: -2px 0 2px; font-size: 12.5px; font-weight: 600; color: var(--warn); }
.rep-head:has(+ .rep-rows:empty) { display: none; }

/* Aperçu réduit */
.preview-wrap {
  position: relative; overflow: hidden; height: 420px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #eaeef0;
}
.preview-wrap iframe { display: block; width: 680px; height: 1200px; border: 0; transform-origin: 0 0; pointer-events: none; }

/* Envoi */
.send-error:empty { display: none; }
.send-error { display: flex; flex-direction: column; gap: 8px; }
.sent-card .banner .state { background: transparent; }

/* Aperçu en grand */
dialog.dlg-preview { width: min(780px, calc(100vw - 24px)); height: calc(100vh - 32px); }
dialog.dlg-preview[open] { display: flex; flex-direction: column; }
.pv-stage { flex: 1; overflow: auto; background: #eaeef0; display: flex; justify-content: center; padding: 0; }
.pv-stage iframe { display: block; width: 680px; min-height: 400px; border: 0; background: #eaeef0; transition: width 0.2s; }
@media (prefers-reduced-motion: reduce) { .pv-stage iframe { transition: none; } }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--surface-2); margin-left: auto; }
.seg-btn {
  min-height: 36px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.seg-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(26, 40, 48, 0.12); }
.dlg-preview .dlg-head { gap: 16px; }

@media (max-width: 680px) {
  .rep-head { display: none; }
  .rep-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
  .rep-row input[data-f="name"] { grid-column: 1 / -1; order: -2; }
  .rep-row select { grid-column: 1 / -1; order: -1; }
  .rep-row .row-hint { grid-column: 1 / -1; }
  .version-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .version-pair .arrow { display: none; }
}
.cols.composer > .narrow { flex-basis: 380px; }

/* ==========================================================================
   Étape 4 — historique, envoi groupé
   ========================================================================== */

fieldset.bare { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.bare:disabled { opacity: 0.6; }
.sub-title { font-size: 15px; font-weight: 700; margin-top: 6px; }
.warn-text { color: var(--warn); font-weight: 600; }
.ok-text { color: var(--ok); font-weight: 600; }
.empty-inline.pad { padding: 16px; }
.toolbar .group-link { margin-left: auto; }
.toolbar select { width: auto; min-width: 180px; }

/* Historique */
.tag {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
table.data tr.group-row th {
  padding: 14px 14px 8px; text-align: left; background: var(--surface);
  font-size: 15px; font-weight: 700; color: var(--text); border-bottom: 1px solid var(--line);
}
table.data tr.group-row .n { font-weight: 500; color: var(--text-3); }
table.history td { vertical-align: top; }
.recipients { font-size: 13.5px; color: var(--text-2); overflow-wrap: anywhere; }
table.data td.wide-actions { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
table.history td:first-child { white-space: nowrap; }

/* Envoi groupé : sites */
.site-checks { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.site-check {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.site-check:last-child { border-bottom: 0; }
.site-check:hover { background: var(--surface-2); }
.site-check:has(input:checked) { background: var(--ok-soft); }
.site-check input { width: 18px; height: 18px; accent-color: var(--ok); flex-shrink: 0; }
.site-check .mono { font-size: 13px; color: var(--text-2); }
.site-check .pick-name { display: block; }

.core-families { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }

/* Envoi groupé : extensions */
.g-exts { display: flex; flex-direction: column; gap: 8px; }
.g-ext { display: grid; grid-template-columns: 130px minmax(0, 1fr) 150px 44px; gap: 8px; align-items: center; }
.g-ext-name { font-weight: 600; overflow-wrap: anywhere; }
.quick .chip .n { font-size: 12.5px; }

.matrix-wrap { max-height: 520px; overflow: auto; }
table.matrix { min-width: 0; width: auto; }
table.matrix th, table.matrix td { white-space: nowrap; }
table.matrix thead th { position: sticky; top: 0; z-index: 2; font-size: 13px; }
table.matrix tbody th { position: sticky; left: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.matrix thead th:first-child { left: 0; z-index: 3; }
table.matrix td { text-align: center; }
.cell { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; min-width: 70px; cursor: pointer; }
.cell input { width: 18px; height: 18px; accent-color: var(--ok); }
.cell .mono, .cell .sub { font-size: 12px; }

/* Récapitulatif et progression */
.recap-head { font-size: 14px; font-weight: 600; }
.recap-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.recap-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.recap-list li:last-child { border-bottom: 0; }
.recap-list .pick-name { display: block; font-size: 14.5px; }
.results li.is-ok .sub { color: var(--ok); }
.results li.is-fail .sub { color: var(--bad); }

@media (max-width: 680px) {
  .g-ext { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; }
  .g-ext-name { grid-column: 1 / -1; order: -1; }
  .toolbar .group-link { margin-left: 0; }
}
