/* NORLIVA Marketing OS — feuille de style unique.
   Palette : encre bleu-vert profond pour la navigation, surfaces froides claires,
   un seul accent clinique (teal). Pas d'ombres décoratives : la structure passe
   par des filets 1px et la hiérarchie typographique. Pile de polices système (1.0.1 : aucun appel externe). */

:root {
  --ink: #10232e;
  --ink-2: #1b3440;
  --ink-soft: #2a4b5a;
  --surface: #f3f6f7;
  --paper: #ffffff;
  --line: #d9e0e4;
  --line-strong: #b9c5cc;
  --text: #1b2a33;
  --muted: #5b6b75;
  --faint: #8d9aa3;
  --accent: #0f6e7a;
  --accent-ink: #0b4f58;
  --accent-soft: #e3f0f1;
  --ok: #1f7a4d;
  --ok-soft: #e4f3ea;
  --warn: #9a6400;
  --warn-soft: #fbf1dc;
  --danger: #a3302d;
  --danger-soft: #fae7e6;
  --info-soft: #e8eef2;
  --radius: 4px;
  --radius-lg: 6px;
  --sidebar-w: 236px;
  --font: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--surface);
  line-height: 1.5; font-feature-settings: "tnum" 1, "ss02" 1;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--info-soft); padding: 0 4px; border-radius: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- Coque : sidebar + colonne principale ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 auto; background: var(--ink); color: #d6e1e6;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; justify-content: space-between; padding: 20px 18px 16px; }
.brand-link { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand-link:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 7px; background: var(--paper); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.15rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 600; letter-spacing: 0.08em; font-size: 0.85rem; color: #fff; }
.brand-sub { font-size: 0.8rem; color: #9fb3bd; }
.nav { display: flex; flex-direction: column; padding: 6px 10px; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius);
  color: #c4d2d9; font-weight: 500; font-size: 0.95rem;
}
.nav-item:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--paper); color: var(--ink); }
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-icon { width: 19px; height: 19px; flex: 0 0 auto; }
.sidebar-foot { margin-top: auto; padding: 16px 18px 20px; }
.market-chip { font-size: 0.8rem; color: #9fb3bd; border-top: 1px solid var(--ink-soft); padding-top: 12px; }
/* Croix de fermeture : uniquement quand la sidebar est en surcouche (mobile). Sélecteur plus précis que .icon-btn, défini plus bas. */
.sidebar .icon-btn.sidebar-close { display: none; color: #c4d2d9; }
.scrim { position: fixed; inset: 0; background: rgba(16, 35, 46, 0.45); z-index: 30; }

.main-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 0 28px; height: 60px;
  background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.menu-btn { display: none; }
.page-title { font-size: 1.1rem; font-weight: 600; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user { display: flex; align-items: center; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: inherit; padding: 4px 8px 4px 4px; border-radius: var(--radius); }
.user-chip:hover { background: var(--surface); text-decoration: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.9rem;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-name { font-weight: 500; font-size: 0.9rem; }
.user-role { font-size: 0.78rem; color: var(--muted); }
.inline-form { display: inline; margin: 0; }
.icon-btn {
  background: transparent; border: 0; color: var(--muted); padding: 6px; border-radius: var(--radius);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.content { padding: 28px; max-width: 1240px; width: 100%; }

/* ---------- Flash ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.flash {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius-lg);
  border: 1px solid var(--line); background: var(--paper); font-size: 0.93rem;
}
.flash-icon { flex: 0 0 auto; margin-top: 2px; }
.flash-text { flex: 1 1 auto; word-break: break-word; }
.flash-close { margin: -4px -6px -4px 0; }
.flash-success { border-color: #9fcfb1; background: var(--ok-soft); color: var(--ok); }
.flash-error { border-color: #e2a4a4; background: var(--danger-soft); color: var(--danger); }
.flash-warning { border-color: #e4c98a; background: var(--warn-soft); color: var(--warn); }
.flash-info { border-color: #b7cad3; background: var(--info-soft); color: var(--ink-2); }

/* ---------- Panneaux et grilles ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1rem; }
.panel-body { padding: 18px; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--muted); }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.hint { font-size: 0.85rem; color: var(--muted); margin: 4px 0 0; }
.lede { font-size: 1.02rem; color: var(--muted); max-width: 64ch; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.section-title h2 { font-size: 1.05rem; }
.section-title .muted { font-size: 0.88rem; }

/* ---------- Tableau de bord ---------- */
.dash-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.dash-intro h2 { font-size: 1.5rem; letter-spacing: -0.02em; }
.dash-intro .countdown { text-align: right; }
.countdown strong { font-size: 1.6rem; font-weight: 600; display: block; line-height: 1; }
.countdown span { font-size: 0.85rem; color: var(--muted); }

.pipeline { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 18px 14px; overflow-x: auto; }
.pipeline-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.pipeline-track { display: flex; align-items: stretch; min-width: 760px; }
.stage { flex: 1 1 0; position: relative; padding: 0 6px 0 0; }
.stage + .stage::before { content: ""; position: absolute; left: -2px; top: 24px; width: 1px; height: 14px; background: var(--line-strong); }
.stage-bar { height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 10px; }
.stage.has-items .stage-bar { background: var(--accent); }
.stage.is-final .stage-bar { background: var(--ok); opacity: 0.35; }
.stage.is-final.has-items .stage-bar { opacity: 1; }
.stage-count { font-size: 1.35rem; font-weight: 600; line-height: 1; }
.stage-label { font-size: 0.76rem; color: var(--muted); line-height: 1.2; margin-top: 4px; }
.stage-refused { flex: 0 0 auto; border-left: 1px dashed var(--line-strong); margin-left: 10px; padding-left: 14px; }
.stage-refused .stage-bar { background: var(--danger-soft); }
.stage-refused.has-items .stage-bar { background: var(--danger); }

.kpi-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); }
.kpi { padding: 16px 18px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi-value { font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.kpi-value small { font-size: 0.9rem; font-weight: 400; color: var(--muted); margin-left: 4px; }
.kpi-label { font-size: 0.86rem; color: var(--muted); }
.kpi-sub { font-size: 0.8rem; color: var(--faint); margin-top: 4px; }
.kpi.is-warn .kpi-value { color: var(--warn); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: baseline; }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .date { flex: 0 0 92px; color: var(--muted); font-size: 0.88rem; }
.list .grow { flex: 1 1 auto; min-width: 0; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.todo li:first-child { border-top: 0; padding-top: 0; }
.todo .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; margin-top: 8px; }
.todo .dot.warn { background: var(--warn); }
.todo .dot.ok { background: var(--ok); }
.empty { color: var(--muted); font-size: 0.93rem; padding: 6px 0; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.76rem; font-weight: 500; line-height: 1.5; vertical-align: middle; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--ink-2); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge-muted { background: var(--surface); color: var(--muted); border: 1px solid var(--line); }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field > span.label { font-weight: 500; font-size: 0.9rem; }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="url"],
.field input[type="number"], .field input[type="date"], .field select, .field textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--text);
}
.field textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.field textarea.code { font-family: var(--font-mono); font-size: 0.86rem; min-height: 460px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.93rem; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 500; font-size: 0.93rem;
  padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--paper);
  color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-danger { color: var(--danger); border-color: #e2a4a4; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 4px 10px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.6; cursor: wait; }
.btn svg { width: 16px; height: 16px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; font-size: 0.85rem; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table .actions-cell { white-space: nowrap; text-align: right; }
.table tr.is-inactive td { color: var(--faint); }
.group-row td { background: var(--surface); font-weight: 600; color: var(--ink-2); font-size: 0.88rem; padding: 8px 12px; }

/* ---------- Onglets réglages ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tab { padding: 9px 14px; color: var(--muted); font-weight: 500; font-size: 0.93rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--accent-ink); border-bottom-color: var(--accent); }

/* ---------- Secret ---------- */
.secret-hint { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 0.9rem; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

/* ---------- Prompt : versions ---------- */
.versions { list-style: none; margin: 0; padding: 0; }
.versions li { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.9rem; flex-wrap: wrap; }
.versions li:first-child { border-top: 0; padding-top: 0; }
.versions .v { font-weight: 600; min-width: 3ch; }
.versions .meta { color: var(--muted); font-size: 0.84rem; }
.versions .note { flex-basis: 100%; color: var(--text); }
.prompt-preview { white-space: pre-wrap; font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.5; max-height: 520px; overflow: auto; background: var(--surface); border: 1px solid var(--line); padding: 14px; border-radius: var(--radius); }

/* ---------- Module à venir ---------- */
.placeholder { max-width: 720px; }
.placeholder .phase { display: inline-block; font-size: 0.85rem; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 10px; border-radius: 10px; margin-bottom: 12px; }
.placeholder ul { padding-left: 20px; margin: 8px 0 0; }
.placeholder li { margin-bottom: 5px; }

/* ---------- Pages hors session ---------- */
body.bare { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--ink); padding: 24px 16px; }
.bare-main { width: 100%; max-width: 420px; }
.bare-brand { display: flex; align-items: center; gap: 12px; color: #fff; margin-bottom: 24px; justify-content: center; }
.bare .panel { padding: 28px; }
.bare .panel h2 { margin-bottom: 4px; }
.bare .lede { font-size: 0.93rem; margin-bottom: 18px; }
.bare-foot { text-align: center; color: #7f94a0; font-size: 0.82rem; margin-top: 20px; }
.bare .flashes { margin-bottom: 14px; }

.error-page { max-width: 560px; }
.error-page .code { font-size: 3rem; font-weight: 600; color: var(--line-strong); line-height: 1; margin-bottom: 8px; }


/* ---------- Phase 2 : composants des modules ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar > div:first-child { flex: 1 1 320px; min-width: 0; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.detail-title { font-size: 1.35rem; letter-spacing: -0.02em; }
.detail-meta { font-size: 0.9rem; color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.break { word-break: break-all; }
.nowrap { white-space: nowrap; }
.row-title { font-weight: 500; color: var(--text); }
.pipeline a.stage, .pipeline a.stage:hover { color: inherit; text-decoration: none; }
.kpi-value a { color: inherit; }

.counter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.counter { display: inline-flex; align-items: baseline; gap: 7px; padding: 7px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--text); font-size: 0.88rem; }
.counter strong { font-size: 1.05rem; font-weight: 600; }
.counter span { color: var(--muted); }
.counter:hover { text-decoration: none; border-color: var(--line-strong); }
.counter.is-active { border-color: var(--accent); background: var(--accent-soft); }
.counter.is-active span { color: var(--accent-ink); }
.counter.is-danger strong { color: var(--danger); }
.counter.is-warn strong { color: var(--warn); }

.status-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.status-chip { font-size: 0.8rem; padding: 3px 10px; border-radius: 10px; background: var(--info-soft); color: var(--ink-2); }
.status-chip strong { font-weight: 600; margin-left: 2px; }
.status-chip:hover { text-decoration: none; background: var(--line); }
.status-chip.is-active { background: var(--ink); color: #fff; }
.status-chip.is-refused { background: var(--danger-soft); color: var(--danger); }

.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); align-items: flex-end; }
.filters .field { min-width: 120px; flex: 0 1 auto; }
.filters .field.grow { flex: 1 1 200px; }
.filters .field label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.filters .field input, .filters .field select { padding: 6px 8px; font-size: 0.9rem; }
.filters .field input[type="search"] { width: 100%; font: inherit; font-size: 0.9rem; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.sort-link { color: inherit; }
.sort-link.is-active { color: var(--accent-ink); font-weight: 600; }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; }
.page-link { padding: 4px 9px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 0.85rem; color: var(--text); background: var(--paper); }
.page-link:hover { text-decoration: none; background: var(--surface); }
.page-link.is-current { background: var(--ink); color: #fff; border-color: var(--ink); }
.page-gap { padding: 4px 4px; color: var(--muted); }
.row-error td { background: #fff8f8; }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); overflow: hidden; }
.seg-item { padding: 7px 14px; font-size: 0.9rem; color: var(--muted); border-right: 1px solid var(--line); font-weight: 500; }
.seg-item:last-child { border-right: 0; }
.seg-item:hover { text-decoration: none; background: var(--surface); color: var(--text); }
.seg-item.is-active { background: var(--ink); color: #fff; }
.seg-item.is-active .muted { color: #b7c7cf; }

.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: inline-block; }
.dots i.on { background: var(--accent); }

.kv-list { margin: 0; display: grid; grid-template-columns: 1fr; gap: 0; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.93rem; }
.kv:first-child { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv-stack .kv { grid-template-columns: 1fr; gap: 3px; }
.preview-figure { margin: 0 0 14px; }
.preview-figure img { max-width: 100%; max-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); display: block; }
.checks-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* Workflow : chaîne des statuts (règle 13) */
.chain { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; overflow-x: auto; padding-bottom: 4px; }
.chain-step { position: relative; flex: 1 1 0; min-width: 96px; padding: 0 8px 0 0; font-size: 0.78rem; color: var(--muted); line-height: 1.2; }
.chain-step::before { content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px; background: var(--line); }
.chain-dot { position: relative; z-index: 1; display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line-strong); margin-bottom: 8px; box-sizing: border-box; }
.chain-step.is-done::before { background: var(--accent); }
.chain-step.is-done .chain-dot { background: var(--accent); border-color: var(--accent); }
.chain-step.is-current::before { background: linear-gradient(90deg, var(--accent) 50%, var(--line) 50%); }
.chain-step.is-current .chain-dot { border-color: var(--accent); border-width: 4px; }
.chain-step.is-current .chain-label { color: var(--accent-ink); font-weight: 600; }
.chain-step.is-skip .chain-dot { border-style: dashed; }
.chain-step.is-skip .chain-label { color: var(--faint); font-style: italic; }
.chain-step.is-off { opacity: 0.55; }
.chain-refused { flex: 0 0 auto; margin-left: 12px; padding-left: 14px; border-left: 1px dashed var(--line-strong); }
.chain-refused::before { display: none; }
.chain-refused.is-current .chain-dot { background: var(--danger); border-color: var(--danger); }
.chain-refused.is-current .chain-label { color: var(--danger); font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.timeline li:first-child { border-top: 0; padding-top: 0; }
.tl-date { font-size: 0.78rem; color: var(--faint); }

/* Dialogues (refus, DO NOT USE) */
.dialog { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 24px; max-width: 480px; width: calc(100% - 32px); background: var(--paper); color: var(--text); }
.dialog::backdrop { background: rgba(16, 35, 46, 0.5); }
.dialog h2 { margin-bottom: 4px; }

/* Vue mois des événements */
.month-grid-wrap { overflow-x: auto; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); min-width: 840px; }
.mg-head { padding: 8px 10px; font-size: 0.8rem; font-weight: 500; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.mg-cell { min-height: 96px; padding: 6px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.mg-cell.is-empty { background: var(--surface); }
.mg-cell.is-today { background: var(--accent-soft); }
.mg-day { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.mg-cell.is-today .mg-day { color: var(--accent-ink); font-weight: 600; }
.mg-event { display: block; font-size: 0.78rem; line-height: 1.25; padding: 3px 6px; border-radius: 3px; background: var(--info-soft); color: var(--ink-2); border-left: 3px solid var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-event:hover { text-decoration: none; background: var(--line); }
.mg-event.is-high { border-left-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.mg-event.is-tbc { border-left-style: dashed; border-left-color: var(--warn); background: var(--warn-soft); color: var(--warn); }


/* ---------- Phase 3 : blueprint, calendrier, revue, copy library ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Piliers : une couleur par pilier (pastille + libellé) */
.pdot-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; }
.pdot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); flex: 0 0 auto; display: inline-block; }
.pdot-CLINICAL { background: #0f6e7a; }
.pdot-EDUCATION { background: #2d6fb5; }
.pdot-PRODUCT { background: #7a4fb0; }
.pdot-TECHNOLOGY { background: #4b5fcf; }
.pdot-KOL { background: #c0592a; }
.pdot-PATIENT { background: #d4a017; }
.pdot-MOROCCO { background: #1f7a4d; }
.pdot-EVENTS { background: #b03a6b; }
.pdot-CORPORATE { background: #5b6b75; }
.pdot-none { background: transparent; border: 1px dashed var(--line-strong); }

/* Effort (règle 14) : pastille colorée + texte */
.effort { display: inline-flex; align-items: center; gap: 5px; font-size: 0.82rem; color: var(--muted); }
.effort i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.effort-1 i { background: #1f7a4d; }
.effort-2 i { background: #d4a017; }
.effort-3 i { background: #e07a1f; }
.effort-4 i { background: #a3302d; }

/* Plateformes */
.pf-icons { display: inline-flex; gap: 3px; vertical-align: middle; }
.pf { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.04em; padding: 1px 5px; border-radius: 3px; background: var(--info-soft); color: var(--ink-2); line-height: 1.5; }
.pf-instagram { background: #f6e4ec; color: #9b2d5b; }
.pf-facebook { background: #e2eaf7; color: #1d4e9a; }
.pf-linkedin { background: #dfeaf2; color: #0b5a85; }

/* Calendrier : grille mois */
.cal-grid .mg-cell { min-height: 132px; }
.cal-cell.is-off { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 6px, #eef2f4 6px, #eef2f4 12px); }
.cal-cell.is-past .cal-entry { opacity: 0.8; }
.cal-day-head { display: flex; justify-content: space-between; align-items: center; }
.cal-add { font-size: 1rem; line-height: 1; color: var(--faint); padding: 0 4px; border-radius: 3px; }
.cal-add:hover { background: var(--accent-soft); color: var(--accent-ink); text-decoration: none; }
.cal-entry { display: flex; flex-direction: column; gap: 3px; padding: 6px 7px; border-radius: 4px; background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--accent); color: var(--text); font-size: 0.78rem; line-height: 1.25; }
.cal-entry:hover { text-decoration: none; border-color: var(--line-strong); border-left-color: var(--accent); background: var(--surface); }
.cal-entry.is-generated { border-style: dashed; border-left-style: dashed; }
.cal-entry.st-REFUSED { border-left-color: var(--danger); opacity: 0.7; }
.cal-entry.st-FINAL_APPROVED, .cal-entry.st-READY_TO_SCHEDULE, .cal-entry.st-SCHEDULED, .cal-entry.st-PUBLISHED { border-left-color: var(--ok); }
.cal-entry.st-SOURCE_IDENTIFIED { border-left-color: var(--line-strong); }
.cal-entry-top { display: flex; align-items: flex-start; gap: 5px; }
.cal-entry-top .pdot-wrap { margin-top: 3px; }
.cal-topic { font-weight: 500; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-entry-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cal-entry-meta .badge { font-size: 0.66rem; padding: 0 6px; }
.mix-table td.is-gap { color: var(--warn); font-weight: 600; }
.guardrails .todo li { padding: 6px 0; }
.rolling-banner .badge { margin: 0 2px; }

/* Fiche jour / copies */
.copy-block { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px; margin-bottom: 12px; }
.copy-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 6px; }
.copy-text { white-space: pre-wrap; font-family: inherit; font-size: 0.93rem; margin: 0; line-height: 1.5; word-break: break-word; }
.hashtags { font-size: 0.85rem; color: var(--accent-ink); margin-top: 6px; word-break: break-word; }
.copy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.copy-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px; background: var(--paper); }
.pf-row { display: grid; grid-template-columns: 1fr 100px 1fr; gap: 8px; align-items: center; }
.pf-row input[type="time"], .pf-row select { font: inherit; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); min-width: 0; width: 100%; }
.bp-bar { display: inline-block; width: 120px; height: 8px; background: var(--warn-soft); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.bp-bar-b2b { display: block; height: 100%; background: var(--accent); }
.week-edit .checks-row { gap: 6px 10px; }
.week-edit .check { font-size: 0.85rem; }
.week-edit select { font: inherit; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 4px; max-width: 180px; }
.char-count.is-over { color: var(--danger); font-weight: 600; }

/* Revue visuelle (Livrable 6) : mobile d'abord, boutons fixés en bas */
.review-wrap { max-width: 720px; margin: 0 auto; padding-bottom: 96px; }
.review-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.review-counter { font-size: 1.3rem; font-weight: 600; color: var(--accent-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.review-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.review-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.review-head h2 { font-size: 1.25rem; margin: 4px 0 8px; }
.review-date { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.review-step { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.review-step:last-child { border-bottom: 0; }
.review-step h3 { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; margin-bottom: 8px; color: var(--ink-2); }
.step-no { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 600; }
.review-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); align-items: stretch; }
.review-actions .grow { flex: 1 1 auto; display: flex; }
.review-actions .grow .btn { width: 100%; justify-content: center; }
.btn-big { min-height: 48px; padding: 10px 16px; font-size: 1rem; justify-content: center; }
.review-nav { min-width: 48px; min-height: 48px; justify-content: center; font-size: 1.3rem; padding: 0; }
.review-nav.is-disabled { opacity: 0.35; pointer-events: none; }
@media (min-width: 821px) {
  .review-actions { left: var(--sidebar-w); }
}
@media (max-width: 560px) {
  .review-actions .btn-big:not(.btn-primary) { padding-left: 10px; padding-right: 10px; font-size: 0.9rem; }
  .pf-row { grid-template-columns: 1fr 1fr; }
  .pf-row select { grid-column: 1 / -1; }
}

/* Tables → cartes sur mobile */
@media (max-width: 720px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; box-sizing: border-box; }
  /* 1.0.1 (I6) : width:auto + marges incluses dans la largeur du parent, sinon la carte (100 % + 24 px de marges) est coupée à droite */
  .table-cards tr { width: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px; margin: 10px 12px; background: var(--paper); }
  .table-cards tr.group-row { border: 0; background: transparent; padding: 6px 0 0; margin: 10px 12px 0; }
  .table-cards td { border: 0; padding: 4px 0; text-align: left; display: flex; gap: 10px; }
  .table-cards td.num { text-align: left; }
  .table-cards td[data-label]::before { content: attr(data-label); flex: 0 0 110px; color: var(--muted); font-size: 0.8rem; font-weight: 500; padding-top: 2px; }
  .table-cards td.actions-cell { justify-content: flex-start; flex-wrap: wrap; white-space: normal; padding-top: 8px; }
  .table-cards td > div { display: inline; }
  .kv { grid-template-columns: 1fr; gap: 3px; }
  .chain-step { min-width: 84px; }
  .toolbar .actions { width: 100%; }
}

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform 0.2s ease; width: min(84vw, 300px); }
  .sidebar.is-open { transform: none; }
  .sidebar .icon-btn.sidebar-close { display: inline-flex; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; height: 56px; }
  .content { padding: 18px 16px 32px; }
  .user-meta { display: none; }
  .dash-intro .countdown { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}


/* ---------- Phase 4 : assistant IA ---------- */
.ai-panel { border-left: 3px solid var(--accent); }
.ai-panel .panel-head h2 { display: flex; align-items: center; gap: 6px; }
.ai-icon { width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 1.8; }
.ai-form .actions { align-items: center; flex-wrap: wrap; }
.ai-status { display: inline-block; max-width: 100%; }
.ai-status.is-busy::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 6px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; vertical-align: -2px; animation: ai-spin 0.8s linear infinite; }
.ai-status.flash { display: block; margin-top: 8px; }
.btn.is-loading { cursor: wait; opacity: 0.7; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-result { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.ai-diff td, .ai-diff th { vertical-align: top; }
.ai-diff .ai-new { background: var(--accent-soft); }
.ai-diff tr.is-same .ai-new { background: transparent; }
.ai-diff tr.is-same td { color: var(--muted); }
.ai-diff .ai-cur { color: var(--muted); }
.ai-diff input[type="checkbox"] { width: 16px; height: 16px; }
.ai-explain { margin: 10px 0 0; padding-left: 18px; }
.ai-flags { margin-top: 10px; padding: 8px 12px; border-radius: var(--radius); font-size: 0.88rem; border: 1px solid var(--line); }
.ai-flags.is-warn { background: var(--warn-soft); border-color: #e4c98a; color: var(--warn); }
.ai-flags ul { margin: 4px 0 0; padding-left: 18px; }
.ai-apply-actions { margin-top: 12px; flex-wrap: wrap; align-items: center; }
.ai-notes { border-left: 3px solid var(--warn); }
.todo .dot.danger { background: var(--danger); }
.ai-functions li { align-items: flex-start; }
.ai-progress { margin: 14px 0; }
.ai-progress-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.ai-progress-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; }
.ai-fill-log { max-height: 240px; overflow: auto; margin-top: 8px; }
.ai-fill-log li.is-ok::before { content: "✓ "; color: var(--ok); }
.ai-fill-log li.is-warn::before { content: "! "; color: var(--warn); }
.ai-fill-log li.is-error::before { content: "✕ "; color: var(--danger); }
.dialog-wide { width: min(640px, 94vw); }
.candidates { display: flex; flex-direction: column; gap: 10px; }
.candidate { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); cursor: pointer; }
.candidate:hover { background: var(--surface); }
.candidate.is-done { opacity: 0.7; cursor: default; }
.candidate-check { flex: 0 0 auto; padding-top: 2px; }
.candidate-check input { width: 18px; height: 18px; }
.candidate-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.candidate-title { line-height: 1.5; }
.candidate-flags { color: var(--warn); }
.review-ai { border-left: 3px solid var(--warn); }
.table tr.is-active td { background: var(--accent-soft); }

/* ---------- Phase 5 : media plan et validation des dépenses ---------- */
.kpi-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.scenario-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.scenario-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); cursor: pointer; position: relative; min-width: 0; }
.scenario-card:hover { border-color: var(--line-strong); }
.scenario-card.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.scenario-card input[type="radio"] { position: absolute; top: 12px; right: 12px; width: 16px; height: 16px; margin: 0; }
.scenario-name { font-weight: 600; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent-ink); }
.scenario-amount { font-size: 0.86rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.scenario-total { font-size: 1.35rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.scenario-desc { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
.scenario-card .btn { align-self: flex-start; margin-top: 4px; }
form.scenario-card { cursor: default; }
@media (max-width: 960px) {
  .kpi-row-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row-5 .kpi:nth-child(odd) { border-right: 1px solid var(--line); }
  .kpi-row-5 .kpi:nth-child(even) { border-right: 0; }
  .kpi-row-5 .kpi:nth-child(-n+4) { border-bottom: 1px solid var(--line); }
  .kpi-row-5 .kpi:last-child { grid-column: 1 / -1; border-right: 0; }
}
@media (max-width: 720px) {
  .scenario-cards { grid-template-columns: 1fr; }
}
.ai-reco { display: flex; flex-direction: column; gap: 10px; }
.ai-reco .scenario-card.is-reco { border-color: var(--accent); }

/* ---------- Phase 6 : graphiques SVG serveur, performance, benchmarks, rapports ---------- */
:root {
  /* Palette de données validée (dataviz) : 3 séries catégorielles + rôles. Texte jamais en couleur de série. */
  --viz-1: #0a8fa3; --viz-2: #d9731f; --viz-3: #6250d6;
  --viz-grid: #e3e8eb; --viz-axis: #b9c5cc; --viz-text: #5b6b75; --viz-text-strong: #1b2a33; --viz-surface: #ffffff; --viz-muted: #b9c5cc;
}
.viz { display: block; width: 100%; height: auto; max-width: 100%; stroke: none; fill: none; font-family: var(--font); }
.viz.viz-spark { width: 140px; height: 36px; }
.viz text { font-family: var(--font); }
.viz-figure { margin: 0; }
.viz-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.viz-empty p { margin: 0; }
.viz-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.82rem; color: var(--muted); }
.viz-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.viz-table { margin-top: 6px; }
.viz-table summary { font-size: 0.8rem; color: var(--muted); cursor: pointer; }
.viz-table table { margin-top: 6px; }
.viz-spark { display: inline-block; vertical-align: middle; }
.table th.is-active a { color: var(--accent-ink); }
.kpi-table td.num { font-variant-numeric: tabular-nums; }
.kpi-grid .field label { font-size: 0.82rem; font-weight: 400; color: var(--muted); }
.top-posts { list-style: none; margin: 0; padding: 0; counter-reset: top; }
.top-posts li { display: flex; gap: 12px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--line); }
.top-posts li:first-child { border-top: 0; padding-top: 0; }
.top-posts .rank { flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; font-size: 0.85rem; display: inline-flex; align-items: center; justify-content: center; }
.top-posts .grow { flex: 1 1 auto; min-width: 0; }
.top-posts .stats { flex: 0 1 auto; min-width: 0; color: var(--muted); text-align: right; }
@media (max-width: 720px) {
  /* 1.0.1 (I6) : sur mobile, les statistiques passent sous le titre au lieu de déborder à droite */
  .top-posts li { flex-wrap: wrap; }
  .top-posts .stats { flex: 1 0 100%; text-align: left; padding-left: 38px; }
}

/* Rapports */
.rp-toolbar { align-items: flex-start; }
.rp-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.rp-nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; font-size: 0.86rem; }
.rp-nav a { padding: 5px 10px; border-left: 2px solid var(--line); color: var(--muted); }
.rp-nav a:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.rp-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.rp-section { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; }
.rp-section h2 { font-size: 1.05rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-section h3 { font-size: 0.92rem; margin: 14px 0 6px; }
.rp-summary { font-size: 1.02rem; line-height: 1.6; max-width: 70ch; }
.rp-kpis { margin-bottom: 14px; }
.rp-kpis .kpi-value { font-size: 1.35rem; }
.rp-table tr.is-total td { font-weight: 600; background: var(--surface); }
.rp-table td.num, .kpi-table td.num, .table td.num { white-space: nowrap; }
.rp-chart { margin: 12px 0; }
.rp-charts-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rp-facts { margin: 0; padding: 0; list-style: none; }
.rp-facts li { padding: 7px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-start; }
.rp-facts li:first-child { border-top: 0; padding-top: 0; }
.rp-facts .fid { flex: 0 0 34px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-ink); padding-top: 2px; }
.rp-interp { margin: 0; padding: 0; list-style: none; }
.rp-interp li { padding: 9px 0; border-top: 1px solid var(--line); }
.rp-interp li:first-child { border-top: 0; padding-top: 0; }
.rp-actions { margin: 0; padding-left: 22px; }
.rp-actions li { padding: 6px 0; }
.rp-section.ai-panel { border-left: 3px solid var(--accent); }
.rp-section.ai-panel h2 svg { width: 16px; height: 16px; stroke: var(--accent); fill: none; }

/* Version fournisseur (premium, pleine page) */
body.bare-wide { display: block; background: #eef2f4; padding: 0; }
body.bare-wide .bare-main { max-width: 1040px; margin: 0 auto; padding: 32px 20px 48px; }
.supplier-report { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 36px 40px; }
.supplier-report.is-preview { padding: 28px; }
.sr-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-bottom: 20px; border-bottom: 2px solid var(--ink); margin-bottom: 14px; flex-wrap: wrap; }
.sr-brand { display: flex; align-items: center; gap: 12px; }
.sr-mark { width: 44px; height: 44px; border-radius: 10px; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1.3rem; }
.sr-brand-name { font-weight: 600; letter-spacing: 0.04em; }
.sr-brand-sub { font-size: 0.82rem; color: var(--muted); }
.sr-title { text-align: right; }
.sr-kicker { font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-ink); font-weight: 600; }
.sr-title h1 { font-size: 1.9rem; letter-spacing: -0.02em; margin: 2px 0; text-transform: capitalize; }
.sr-meta { font-size: 0.85rem; color: var(--muted); }
.sr-legend { color: var(--muted); margin-bottom: 20px; }
.sr-body .rp-section { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 22px 0 6px; }
.sr-body .rp-section:first-child { border-top: 0; padding-top: 0; }
.sr-body .rp-section h2 { font-size: 1.15rem; }
.sr-foot { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; }

@media (max-width: 960px) {
  .rp-layout { grid-template-columns: 1fr; }
  .rp-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .rp-nav a { border: 1px solid var(--line); border-radius: 10px; padding: 3px 10px; }
  .rp-charts-2 { grid-template-columns: 1fr; }
  .supplier-report { padding: 22px 18px; }
  .sr-title { text-align: left; }
}

/* Impression : rapports propres, sans navigation */
@media print {
  .sidebar, .topbar, .scrim, .rp-nav, .toolbar .actions, .no-print, .flashes, form, .viz-table, .panel-foot { display: none !important; }
  .content, body.bare-wide .bare-main { padding: 0; max-width: none; }
  body, body.bare-wide { background: #fff; }
  .rp-layout { display: block; }
  .rp-section, .supplier-report, .panel { border: 0; break-inside: avoid; padding: 8px 0; }
  .rp-section h2 { break-after: avoid; }
  .viz { max-width: 640px; }
  a { color: inherit; text-decoration: none; }
  .table-cards td[data-label]::before { display: none; }
}

/* ---------- Phase 7 : Academy (parcours, module, quiz, réglages) ---------- */
.ac-hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 20px; }
.ac-hero-main { display: flex; align-items: center; gap: 18px; flex: 1 1 320px; min-width: 0; }
.ac-hero-resume { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; border-left: 1px solid var(--line); padding-left: 20px; }
.ac-progress-ring { --size: 72px; width: var(--size); height: var(--size); border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--line) 0); position: relative; }
.ac-progress-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--paper); }
.ac-progress-ring span { position: relative; font-weight: 600; font-size: 1.15rem; color: var(--ink); }
.ac-progress-ring small { font-size: 0.7rem; font-weight: 400; color: var(--muted); margin-left: 1px; }
.ac-level { margin-bottom: 20px; }
.ac-level-num { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; margin-right: 6px; vertical-align: middle; }
.ac-level.is-complete .ac-level-num { background: var(--ok); }
.ac-badge-level { margin-left: 8px; }
.ac-badge-level svg { stroke: currentColor; vertical-align: -1px; }
.ac-level-bar { height: 4px; background: var(--surface); position: relative; }
.ac-level-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.3s ease; }
.ac-level.is-complete .ac-level-bar span { background: var(--ok); }
.ac-level-bar-inline { display: block; width: 120px; height: 5px; border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.ac-modules { list-style: none; margin: 0; padding: 0; counter-reset: ac; }
.ac-module { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.ac-module:first-child { border-top: 0; padding-top: 0; }
.ac-module-state { counter-increment: ac; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-top: 2px; }
.ac-module-state::before { content: counter(ac); }
.ac-module.is-in_progress .ac-module-state { border-color: var(--accent); color: var(--accent-ink); }
.ac-module.is-done .ac-module-state { background: var(--ok); border-color: var(--ok); color: #fff; }
.ac-module.is-done .ac-module-state::before { content: none; }
.ac-module-state svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 2.4; }
.ac-module-body { flex: 1 1 auto; min-width: 0; }
.ac-module-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; color: var(--muted); align-items: center; }
.ac-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.ac-side { display: flex; flex-direction: column; gap: 20px; }
.ac-layout > .ac-side { position: sticky; top: 76px; }
.ac-content { max-width: 72ch; font-size: 1rem; line-height: 1.65; }
.ac-content h2 { font-size: 1.15rem; margin: 26px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.ac-content h2:first-child, .ac-content .ac-summary + h2 { border-top: 0; padding-top: 0; margin-top: 8px; }
.ac-content h3 { font-size: 1rem; margin: 18px 0 6px; }
.ac-content p { margin: 0 0 12px; }
.ac-content ul, .ac-content ol { margin: 0 0 12px; padding-left: 22px; }
.ac-content li { margin-bottom: 5px; }
.ac-content blockquote { margin: 0 0 12px; padding: 6px 14px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.ac-content hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.ac-content .ac-table { font-size: 0.93rem; margin-bottom: 12px; }
.ac-summary { font-size: 1.02rem; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 8px; }
.ac-box { border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); padding: 12px 16px 6px; margin: 18px 0; background: var(--surface); }
.ac-box h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; color: var(--muted); }
.ac-box-retenir { border-left-color: var(--accent); background: var(--accent-soft); }
.ac-box-retenir h4 { color: var(--accent-ink); }
.ac-box-os { border-left-color: var(--ink); background: var(--info-soft); }
.ac-box-os h4 { color: var(--ink); }
.ac-box-os h4::before { content: "N"; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 4px; background: var(--ink); color: #fff; font-size: 0.68rem; margin-right: 6px; vertical-align: -3px; }
.ac-box-attention { border-left-color: var(--warn); background: var(--warn-soft); }
.ac-box-attention h4 { color: var(--warn); }
.ac-box p:last-child, .ac-box ul:last-child { margin-bottom: 6px; }
.ac-quiz fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.ac-quiz legend { font-weight: 500; margin-bottom: 8px; line-height: 1.4; }
.ac-q-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 0.75rem; font-weight: 600; margin-right: 6px; vertical-align: -3px; }
.ac-q.is-ok .ac-q-num { background: var(--ok); }
.ac-q.is-ko .ac-q-num { background: var(--danger); }
.ac-opt { display: flex; gap: 10px; align-items: flex-start; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; font-size: 0.93rem; background: var(--paper); }
.ac-opt:hover { background: var(--surface); }
.ac-opt input { margin-top: 3px; accent-color: var(--accent); flex: 0 0 auto; }
.ac-opt.is-correct { border-color: #9fcfb1; background: var(--ok-soft); }
.ac-opt.is-wrong { border-color: #e2a4a4; background: var(--danger-soft); }
.ac-explain { margin: 6px 0 0; padding: 8px 10px; border-radius: var(--radius); background: var(--surface); }
.ac-explain.is-ok { background: var(--ok-soft); color: var(--ok); }
.ac-explain.is-ko { background: var(--warn-soft); color: var(--warn); }
.ac-diff { font-family: var(--font-mono); font-size: 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); max-height: 420px; overflow: auto; background: var(--paper); margin-bottom: 10px; }
.ac-diff-line { display: flex; gap: 8px; padding: 1px 8px; white-space: pre-wrap; word-break: break-word; }
.ac-diff-sign { flex: 0 0 10px; color: var(--faint); user-select: none; }
.ac-diff-line.is-add { background: var(--ok-soft); color: var(--ok); }
.ac-diff-line.is-del { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; text-decoration-color: rgba(163, 48, 45, 0.4); }
.ac-diff-line.is-same { color: var(--muted); }
@media (max-width: 960px) {
  .ac-layout { grid-template-columns: 1fr; }
  .ac-layout > .ac-side { position: static; }
  .ac-hero-resume { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; width: 100%; }
}

/* ---------- Phase 7 : assistant « Explique-moi cet écran » (bouton flottant + panneau latéral) ---------- */
.help-fab { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--accent-ink); background: var(--accent); color: #fff; font-size: 1.25rem; font-weight: 600; font-family: var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(16, 35, 46, 0.18); }
.help-fab:hover { background: var(--accent-ink); }
.help-fab[aria-expanded="true"] { display: none; }
.help-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 45; background: var(--paper); border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -4px 0 18px rgba(16, 35, 46, 0.12); }
.help-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.help-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.help-msg { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px; font-size: 0.93rem; line-height: 1.5; background: var(--surface); }
.help-msg.is-note { background: var(--info-soft); }
.help-msg.is-user { background: var(--accent-soft); border-color: #bcd9dc; align-self: flex-end; max-width: 92%; }
.help-msg.is-ai { background: var(--paper); border-left: 3px solid var(--accent); }
.help-msg.is-error { background: var(--danger-soft); border-color: #e2a4a4; color: var(--danger); }
.help-msg h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 10px 0 4px; }
.help-msg h4:first-child { margin-top: 0; }
.help-msg ul { margin: 0 0 4px; padding-left: 18px; }
.help-msg li { margin-bottom: 3px; }
.help-msg .help-reminder { margin-top: 8px; padding: 8px 10px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 0.88rem; }
.help-msg .help-time { display: block; font-size: 0.76rem; color: var(--faint); margin-top: 6px; }
.help-modules { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.help-module { border: 1px solid var(--line); border-radius: 10px; padding: 2px 10px; font-size: 0.85rem; background: var(--paper); }
.help-form { border-top: 1px solid var(--line); padding: 12px 18px 14px; display: flex; flex-direction: column; gap: 8px; }
.help-form .btn-primary { width: 100%; justify-content: center; }
.help-ask { display: flex; gap: 6px; }
.help-ask input { flex: 1 1 auto; min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px; font: inherit; font-size: 0.93rem; }
.help-ask input:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.help-foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-ink); font: inherit; font-size: 0.85rem; cursor: pointer; text-decoration: underline; }
@media (max-width: 560px) { .help-fab { right: 12px; bottom: 12px; } }
@media print { .help-fab, .help-panel { display: none !important; } }

/* ---------- Phase 8 : export, publication, tâches planifiées ---------- */
.code-block { font-family: var(--font-mono); font-size: 0.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; white-space: pre-wrap; word-break: break-all; margin: 6px 0 4px; }
.pub-card .panel-head { align-items: flex-start; }
.pub-card .panel-head h2 { font-size: 1rem; }
.pub-table .actions-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* 1.0.1 (I6) — chaîne de statuts : défilement horizontal INTERNE au panneau (jamais de défilement de page).
   .panel-body est display:block → un enfant flex avec min-width sur ses items ne le contraint pas : on force la largeur
   de la liste à celle du panneau (width: 100% + max-width) et on laisse les étapes garder leur min-width (défilement). */
.chain { width: 100%; max-width: 100%; box-sizing: border-box; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.panel .chain { margin-left: 0; margin-right: 0; }
.workflow .panel-body { overflow: hidden; }
@media (max-width: 720px) {
  .chain { padding-bottom: 8px; }
  .chain-step { flex: 0 0 auto; min-width: 84px; max-width: 110px; }
  .tabs { scrollbar-width: thin; padding-bottom: 2px; }
  .tabs a { flex: 0 0 auto; white-space: nowrap; }
}
/* 1.0.1 (I6) — bouton flottant « ? » : quand une barre d'actions fixée en bas (.review-actions / .action-bar) est
   présente, le bouton remonte au-dessus de la barre pour ne plus recouvrir la flèche « Suivant ». */
body:has(.review-actions) .help-fab, body:has(.action-bar) .help-fab { bottom: calc(18px + 74px + env(safe-area-inset-bottom)); }
@media (max-width: 560px) { body:has(.review-actions) .help-fab, body:has(.action-bar) .help-fab { bottom: calc(12px + 74px + env(safe-area-inset-bottom)); } }
.help-fab.is-raised { bottom: calc(18px + var(--fab-raise, 74px) + env(safe-area-inset-bottom)); }
@media (max-width: 560px) { .help-fab.is-raised { bottom: calc(12px + var(--fab-raise, 74px) + env(safe-area-inset-bottom)); } }

/* Revue mobile (phase 8) : aucun débordement horizontal à 390 px.
   - les enfants de grille / pile peuvent rétrécir (min-width: 0), sinon un tableau ou une chaîne élargit toute la page ;
   - les conteneurs à défilement horizontal deviennent le bloc contenant des .sr-only (position: absolute) qu'ils abritent,
     sinon ces libellés invisibles sont positionnés par rapport à la page et créent une barre de défilement fantôme. */
.stack > *, .grid > *, .main-col, .content, .panel, .panel-body { min-width: 0; }
.chain { max-width: 100%; }
.list li { flex-wrap: wrap; }
.list li .grow { overflow-wrap: anywhere; }
.checks-row { max-width: 100%; }
.month-grid-wrap, .table-wrap, .chain, .tabs { position: relative; }
@media (max-width: 720px) {
  .review-nav { min-width: 44px; }
}
@media (min-width: 961px) {
  .tabs { flex-wrap: wrap; overflow-x: visible; }
}
