:root {
  --bg: #f6f6f2; --card: #ffffff; --fg: #1d1d1b; --muted: #6b6b66; --line: #e2e1da;
  --accent: #2f6f5e; --accent-fg: #ffffff; --accent-soft: #e4f0eb;
  --accent2: #5b6b8c; --accent2-fg: #ffffff; --accent2-soft: #eef0f5; --brand: #2f6f5e; --brand-fg: #ffffff;
  --ok: #1f7a4d; --ok-bg: #e5f4ec; --warn: #8a5a00; --warn-bg: #fdf3dc; --err: #b3261e; --err-bg: #fbe6e4;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514; --card: #1e1e1c; --fg: #ecebe6; --muted: #a3a29b; --line: #34342f;
    --accent: #7cc4ae; --accent-fg: #102a22; --accent-soft: #20332d;
    --accent2: #a9b6d3; --accent2-fg: #151514; --accent2-soft: #262a33;
    --ok: #8fd6b0; --ok-bg: #18301f; --warn: #f0c46a; --warn-bg: #352a12; --err: #f2a39c; --err-bg: #3a1c19;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg);
       font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
main { max-width: 980px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 1.5rem; margin: 4px 0 14px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 14px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

/* En-tête */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { max-width: 980px; margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.top { border-top: 4px solid var(--brand, var(--accent)); }
.brand { font-weight: 700; text-decoration: none; color: var(--fg); display: flex; align-items: center; gap: 8px; }
.brand img.logo { height: 34px; width: auto; max-width: 90px; object-fit: contain; border-radius: 6px; }
.brand-shop { color: var(--accent); font-weight: 600; }
h1 { color: var(--fg); }
h2 { color: var(--accent); }
.nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
.nav a { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--fg); }
.nav a.on, .nav a:hover { background: var(--accent-soft); color: var(--accent); }
.badge { background: var(--accent2, var(--accent)); color: var(--accent2-fg, var(--accent-fg)); border-radius: 999px; padding: 0 7px; font-size: .8rem; }
.shop-switch select { padding: 4px 6px; }

/* Cartes et grilles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.grid .card { margin: 0; }
.stat { font-size: 1.6rem; font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.spacer { flex: 1; }

/* Messages */
.msg { padding: 10px 14px; border-radius: 8px; margin: 0 0 10px; border: 1px solid transparent; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.warn { background: var(--warn-bg); color: var(--warn); }
.msg.error { background: var(--err-bg); color: var(--err); }

/* États */
.state { font-weight: 600; white-space: nowrap; }
.state.configure, .state.ok { color: var(--ok); }
.state.a-tester, .state.warn { color: var(--warn); }
.state.manquant, .state.error { color: var(--err); }
.state.non-active, .state.desactive { color: var(--muted); }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* Formulaires */
label { display: block; font-weight: 600; margin: 10px 0 4px; }
.help { color: var(--muted); font-size: .88rem; margin: 2px 0 6px; font-weight: 400; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; max-width: 520px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); font: inherit;
}
textarea { min-height: 60px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; margin: 6px 0; }
.check input { margin-top: 4px; }
.field-error { color: var(--err); font-size: .9rem; margin: 4px 0; }
.setting { border-top: 1px solid var(--line); padding: 10px 0; }
.setting:first-of-type { border-top: 0; }
.setting.sub { border-top: 0; margin: 0 0 8px 28px; padding: 2px 0 6px; }
.setting.sub input[type=text] { width: 100%; max-width: 480px; }
[hidden] { display: none !important; }
.setting .modified { color: var(--accent); font-size: .8rem; font-weight: 600; margin-left: 6px; }
button, .button {
  display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-fg); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.danger, .button.danger { background: transparent; color: var(--err); border-color: var(--err); }
button.small, .button.small { padding: 4px 10px; font-size: .88rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }
details summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
ol.steps li { margin: 4px 0; }

/* Propositions : cartes compactes */
.toolbar { display: flex; flex-direction: column; gap: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--fg); font-size: .9rem; }
.chip.on { border-color: var(--fg); font-weight: 700; }
.chip.tone-high { color: var(--ok); } .chip.tone-medium { color: var(--warn); } .chip.tone-low { color: var(--err); }
/* Progression d'une session */
.log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
       font: .92rem/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; min-height: 120px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent);
           border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Rapport */
.report-frame { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 10px 16px 24px; }
@media (max-width: 600px) {
  main { padding: 14px 12px 32px; }
  .nav a { padding: 5px 8px; }
  h1 { font-size: 1.3rem; }
}

/* Validations : filtres par type et par confiance, carte ouverte depuis le rapport */
.filters .filter-label { color: var(--muted); font-size: .85rem; margin-right: 4px; min-width: 80px; }
.filters + .filters { margin-top: 6px; }
.chip.empty { opacity: .5; }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* Réglages : apparence (couleurs de la boutique) */
.brand-preview { display: flex; gap: 14px; align-items: flex-start; padding: 6px 0 12px; border-bottom: 1px solid var(--line); }
.brand-preview img.logo { height: 64px; width: auto; max-width: 120px; object-fit: contain; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; padding: 4px; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.swatch { display: inline-block; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); vertical-align: middle; }
input[type=color] { width: 56px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
code { background: var(--accent-soft); padding: 0 4px; border-radius: 4px; }

/* Version en ligne (étape 10) : compte, pied de page, formulaires publics, espace éditeur */
.account-nav { margin-left:auto; }
button.linkish { background:none; border:0; color:inherit; font:inherit; padding:6px 10px; cursor:pointer; text-decoration:underline; }
.foot a { color:inherit; }
.foot details.feedback { margin-top:8px; text-align:left; max-width:520px; margin-left:auto; margin-right:auto; }
.foot details.feedback summary { cursor:pointer; font-weight:600; }
.foot details.feedback textarea { width:100%; min-height:80px; }
.auth-card { max-width:440px; margin:24px auto; }
.auth-card label { display:block; margin:10px 0 4px; font-weight:600; }
.auth-card input[type=email], .auth-card input[type=password], .auth-card input[type=text] { width:100%; }
.legal { max-width:820px; line-height:1.6; }
.legal h2 { margin-top:1.4em; }
.legal .draft { border:1px dashed var(--warn, #8a5a00); padding:8px 12px; border-radius:8px; }
table.data td.num, table.data th.num { text-align:right; white-space:nowrap; }
.danger-zone { border:1px solid var(--err, #b3261e); border-radius:10px; padding:12px 16px; }
