/* ============================================================
   BP Studio — design system maison (CSP stricte, deux thèmes)
   Fraunces (titres) + Source Sans 3 (texte), repli système.
   ============================================================ */

/* ---- Jetons ---- */
:root {
  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px; --r-full: 999px;
  --pas: 4px;
  --t: 160ms cubic-bezier(.4,0,.2,1);
  --police-titre: "Fraunces", Georgia, "Times New Roman", serif;
  --police-texte: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;

  --accent: #10b981;
  --accent-fort: #0e9f74;
  --accent-contraste: #04241a;
  --info: #5b9bff;
  --ambre: #f5a524;
}

/* Thème Nuit (défaut) — bleus profonds */
:root, [data-theme="nuit"] {
  --canvas: #0b1220;
  --canvas-2: #0e1626;
  --surface: #121d33;
  --surface-2: #17233c;
  --surface-3: #1d2c49;
  --bordure: rgba(148, 163, 184, .16);
  --bordure-forte: rgba(148, 163, 184, .28);
  --texte: #e9eef8;
  --texte-doux: #9db0cd;
  --texte-faible: #6f82a1;
  --ombre-s: 0 1px 2px rgba(0,0,0,.4);
  --ombre: 0 8px 24px -8px rgba(0,0,0,.5);
  --ombre-l: 0 20px 48px -16px rgba(0,0,0,.6);
  --voile: rgba(11, 18, 32, .72);
  --accent-voile: color-mix(in srgb, var(--accent) 14%, var(--surface));
}
/* Thème Jour */
[data-theme="jour"] {
  --canvas: #eef2f7;
  --canvas-2: #e7edf5;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef3f9;
  --bordure: #e3e9f1;
  --bordure-forte: #d2dbe8;
  --texte: #0f1b2d;
  --texte-doux: #51688a;
  --texte-faible: #8294ac;
  --ombre-s: 0 1px 2px rgba(16,35,63,.06);
  --ombre: 0 10px 30px -12px rgba(16,35,63,.16);
  --ombre-l: 0 24px 50px -18px rgba(16,35,63,.22);
  --voile: rgba(255, 255, 255, .78);
  --accent-voile: color-mix(in srgb, var(--accent) 12%, #ffffff);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--police-texte);
  font-size: 16px;
  line-height: 1.6;
  color: var(--texte);
  background:
    radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, color-mix(in srgb, var(--info) 8%, transparent), transparent 55%),
    var(--canvas);
  background-attachment: fixed;
}

h1, h2, h3, h4 { font-family: var(--police-titre); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.ico { width: 20px; height: 20px; fill: currentColor; flex: 0 0 auto; }
.masque-mobile { display: inline; }

.saut { position: absolute; left: -999px; }
.saut:focus { left: 12px; top: 12px; z-index: 100; background: var(--accent); color: var(--accent-contraste); padding: 10px 14px; border-radius: var(--r-sm); font-weight: 700; }

/* ---- Barre supérieure ---- */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--voile); backdrop-filter: saturate(140%) blur(14px); border-bottom: 1px solid var(--bordure); }
.topbar-inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; }
.marque { display: inline-flex; align-items: center; gap: 12px; color: var(--texte); font-weight: 700; }
.marque:hover { text-decoration: none; }
.logo { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; font-family: var(--police-titre); font-weight: 700; font-size: 1.05rem; color: var(--accent-contraste); background: linear-gradient(135deg, #34d8a6, var(--accent)); box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.marque-nom { font-size: 1.1rem; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.nav-public { display: flex; gap: 6px; margin-right: 4px; }
.nav-public a { color: var(--texte-doux); font-weight: 600; padding: 8px 12px; border-radius: var(--r-sm); }
.nav-public a:hover { color: var(--texte); background: var(--surface-2); text-decoration: none; }

.btn-ghost { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 600; color: var(--texte-doux); background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); padding: 8px 12px; cursor: pointer; }
.btn-ghost:hover { color: var(--texte); background: var(--surface-2); text-decoration: none; }
.enligne { display: inline; margin: 0; }
.lien-bouton { background: none; border: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 4px; }
.lien-bouton:hover { text-decoration: underline; }

/* ---- Bandeau messages ---- */
.bandeau-flashs { max-width: 1240px; margin: 16px auto 0; padding: 0 20px; display: grid; gap: 10px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--bordure); background: var(--surface); box-shadow: var(--ombre-s); font-weight: 500; }
.flash-succes { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-voile); }
.flash-erreur { border-color: color-mix(in srgb, var(--ambre) 55%, transparent); background: color-mix(in srgb, var(--ambre) 14%, var(--surface)); }
.flash-info { background: var(--surface-2); }
.flash-code { border: 1.5px dashed var(--accent); background: var(--accent-voile); gap: 14px; flex-wrap: wrap; }
.flash-code .ico { width: 26px; height: 26px; color: var(--accent); }
.flash-code strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-doux); }
.code-affiche { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; letter-spacing: .28em; }
.code-note { color: var(--texte-doux); font-size: .85rem; flex: 1 1 220px; }

/* ---- App shell (projet ouvert) ---- */
.shell { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: 248px 1fr; gap: 22px; padding: 22px 20px 48px; align-items: start; }
.sidebar { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 6px; }
.sidebar-titre { font-family: var(--police-titre); font-weight: 600; font-size: 1.05rem; margin: 6px 8px 10px; padding-bottom: 12px; border-bottom: 1px solid var(--bordure); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar-pied { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--bordure); display: flex; flex-direction: column; gap: 3px; }
.sidebar-pied form { margin: 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r); color: var(--texte-doux); font-weight: 600; font-size: .96rem; border: 1px solid transparent; width: 100%; background: none; cursor: pointer; text-align: left; font-family: inherit; }
.nav-item:hover { background: var(--surface-2); color: var(--texte); text-decoration: none; }
.nav-item .ico { color: var(--texte-faible); }
.nav-item:hover .ico { color: var(--texte-doux); }
.nav-item[aria-current="page"] { background: var(--accent-voile); color: var(--texte); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.nav-item[aria-current="page"] .ico { color: var(--accent); }
.nav-item-bouton { color: var(--texte-doux); }

.contenu { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.contenu-public { max-width: 1100px; margin: 0 auto; width: 100%; padding: 28px 20px 64px; }
.pied { text-align: center; color: var(--texte-faible); font-size: .85rem; padding: 24px 20px 40px; }

/* ---- Barre d'onglets mobile ---- */
.tabbar { display: none; }

/* ---- Blocs / cartes ---- */
.bloc { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--ombre); }
.a-public .bloc { margin-bottom: 20px; }
.bloc.etroit { max-width: 560px; margin-inline: auto; }
.note { color: var(--texte-doux); font-size: .9rem; }
.conseil { color: var(--texte-doux); font-size: .92rem; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 10px 14px; margin-top: 12px; }

/* ---- Accueil ---- */
.hero { text-align: center; padding: 40px 12px 28px; }
.hero h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.1rem); }
.accroche { max-width: 680px; margin: 0 auto 28px; color: var(--texte-doux); font-size: 1.15rem; }
.cartes-choix { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 24px; text-align: left; }
.carte { display: block; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-lg); padding: 22px; color: var(--texte); box-shadow: var(--ombre-s); transition: transform var(--t), border-color var(--t), box-shadow var(--t); }
.carte:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: var(--ombre); text-decoration: none; }
.carte h2 { margin-bottom: .35em; font-size: 1.25rem; }
.carte p { margin: 0; color: var(--texte-doux); }
.carte-action { background: linear-gradient(160deg, var(--accent-voile), var(--surface)); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.etapes-liste { columns: 2; gap: 28px; color: var(--texte-doux); }
.etapes-liste strong { color: var(--texte); }
@media (max-width: 560px) { .etapes-liste { columns: 1; } }
.import-accueil { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--bordure); }
.import-label { flex: 1 1 260px; font-weight: 600; }

/* ---- Formulaires ---- */
.formulaire label, .etape-corps label { display: block; margin-bottom: 16px; font-weight: 600; font-size: .95rem; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; color: var(--texte); background: var(--surface-2); border: 1px solid var(--bordure-forte); border-radius: var(--r-sm); padding: 11px 13px; margin-top: 6px; transition: border-color var(--t), box-shadow var(--t); }
input::placeholder { color: var(--texte-faible); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--texte-doux) 50%), linear-gradient(135deg, var(--texte-doux) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.interligne { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.interligne input { width: auto; margin: 0; }
.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grille-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 680px) { .grille-2, .grille-3 { grid-template-columns: 1fr; } }
.champ-code { text-transform: uppercase; letter-spacing: .3em; font-family: var(--mono); font-size: 1.2rem; text-align: center; }
.piege { position: absolute !important; left: -9999px; }

/* ---- Boutons ---- */
.bouton-primaire, .bouton-secondaire, .bouton-danger-doux { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; padding: 12px 22px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer; transition: transform var(--t), background var(--t), box-shadow var(--t); }
.bouton-primaire:hover, .bouton-secondaire:hover, .bouton-danger-doux:hover { text-decoration: none; transform: translateY(-1px); }
.bouton-primaire { background: linear-gradient(135deg, #2bd3a0, var(--accent)); color: var(--accent-contraste); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 65%, transparent); }
.bouton-primaire:hover { box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--accent) 75%, transparent); }
.bouton-secondaire { background: var(--surface-2); color: var(--texte); border-color: var(--bordure-forte); }
.bouton-secondaire:hover { background: var(--surface-3); }
.bouton-danger-doux { background: color-mix(in srgb, var(--ambre) 16%, var(--surface-2)); color: var(--texte); border-color: color-mix(in srgb, var(--ambre) 50%, transparent); }
.petit { padding: 7px 13px; font-size: .9rem; }

.secteurs { border: 1px solid var(--bordure); border-radius: var(--r); padding: 18px; margin: 18px 0; background: var(--surface-2); }
.secteurs legend { font-weight: 700; padding: 0 6px; }
.radios { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 8px; }
.radio-carte { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--bordure-forte); border-radius: var(--r-sm); padding: 12px; margin: 0 !important; font-weight: 600; cursor: pointer; transition: border-color var(--t); }
.radio-carte:hover { border-color: var(--accent); }
.radio-carte input { width: auto; margin: 0; }

/* ---- Saisie en étapes ---- */
.saisie { display: flex; flex-direction: column; gap: 16px; }
.saisie-entete { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--ombre); }
.progression { position: relative; background: var(--surface-3); border-radius: var(--r-full); height: 12px; overflow: hidden; margin: 14px 0; }
.progression-barre { height: 100%; width: 0; border-radius: var(--r-full); background: linear-gradient(90deg, #2bd3a0, var(--accent)); transition: width .5s cubic-bezier(.4,0,.2,1); }
.progression-texte { display: block; font-size: .85rem; font-weight: 700; color: var(--texte-doux); }
.etapes-puces { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 14px 0 0; }
.puce { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: var(--r-full); font-size: .85rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--bordure); color: var(--texte-doux); }
.puce span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); font-size: .72rem; color: var(--texte-faible); }
.puce-fait { border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--texte); }
.puce-fait span { background: var(--accent); color: var(--accent-contraste); }
.puce-incomplet { border-color: color-mix(in srgb, var(--ambre) 45%, transparent); }
.puce-incomplet span { background: var(--ambre); color: #3a2a00; }

.etape { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-lg); box-shadow: var(--ombre-s); overflow: hidden; transition: box-shadow var(--t); }
.etape[open] { box-shadow: var(--ombre); }
.etape > summary { cursor: pointer; padding: 18px 22px; font-weight: 700; font-size: 1.08rem; list-style: none; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.etape > summary::-webkit-details-marker { display: none; }
.etape > summary:hover { background: var(--surface-2); }
.etape .num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: .95rem; background: var(--accent-voile); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.pourquoi { color: var(--texte-doux); font-weight: 500; font-size: .92rem; }
.etape-corps { padding: 4px 22px 22px; }

.liste { display: grid; gap: 10px; }
.ligne-liste { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r); padding: 10px; }
.ligne-liste input, .ligne-liste select { width: auto; flex: 1 1 130px; margin: 0; background: var(--surface); }
.ligne-liste .interligne { flex: 0 0 auto; }
.supprimer { flex: 0 0 auto; width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid var(--bordure-forte); background: var(--surface); color: var(--ambre); cursor: pointer; font-size: 1rem; transition: background var(--t); }
.supprimer:hover { background: color-mix(in srgb, var(--ambre) 14%, var(--surface)); }
.ajouter { margin-top: 12px; display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent); color: var(--texte); padding: 10px 16px; border-radius: var(--r); cursor: pointer; font-weight: 600; transition: background var(--t); }
.ajouter:hover { background: var(--accent-voile); }

.table-ventes { width: 100%; border-collapse: collapse; }
.table-ventes th, .table-ventes td { padding: 5px; }
.table-ventes thead th { font-size: .82rem; color: var(--texte-doux); font-weight: 600; }
.table-ventes tbody th { text-align: left; font-weight: 600; color: var(--texte-doux); }
.table-ventes input { margin: 0; background: var(--surface-2); }

.barre-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; position: sticky; bottom: 0; background: linear-gradient(to top, var(--canvas) 55%, transparent); padding: 14px 0; z-index: 5; }
.bloc-enregistrer { background: linear-gradient(160deg, var(--accent-voile), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: var(--r-lg); padding: 22px; }

/* ---- En-têtes de section ---- */
.titre-ligne { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sous-titre { color: var(--texte-doux); margin-top: -6px; }
.badge { font-size: .78rem; padding: 4px 11px; border-radius: var(--r-full); font-weight: 700; letter-spacing: .02em; }
.badge-ok { background: var(--accent-voile); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.badge-brouillon { background: color-mix(in srgb, var(--ambre) 16%, var(--surface)); color: var(--ambre); border: 1px solid color-mix(in srgb, var(--ambre) 45%, transparent); }

/* ---- KPI ---- */
.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 18px; }
.kpi { position: relative; background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r); padding: 16px 18px; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .7; }
.kpi-label { display: block; color: var(--texte-doux); font-size: .82rem; font-weight: 600; }
.kpi-valeur { display: block; font-family: var(--police-titre); font-size: 1.5rem; font-weight: 600; margin-top: 6px; letter-spacing: -.01em; }
.ambre { color: var(--ambre); }

.controles { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.controle { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r); padding: 12px 16px; }
.controle-ok { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.controle-ambre { border-color: color-mix(in srgb, var(--ambre) 40%, transparent); }
.pastille { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 700; flex: 0 0 auto; }
.controle-ok .pastille { background: var(--accent); color: var(--accent-contraste); }
.controle-ambre .pastille { background: var(--ambre); color: #3a2a00; }
.detail { color: var(--texte-doux); }
.actions-ligne { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.actions-ligne form { margin: 0; }
.bloc-proposition { border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); background: linear-gradient(160deg, var(--accent-voile), var(--surface)); }

/* ---- Tables d'états ---- */
.table-defilante { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--bordure); }
.table-etat { width: 100%; border-collapse: collapse; min-width: 540px; font-variant-numeric: tabular-nums; }
.table-etat th, .table-etat td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--bordure); white-space: nowrap; }
.table-etat tbody tr:last-child td, .table-etat tbody tr:last-child th { border-bottom: none; }
.table-etat thead th { position: sticky; top: 0; background: var(--surface-3); color: var(--texte-doux); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.table-etat tbody th { text-align: left; font-weight: 600; color: var(--texte-doux); }
.table-etat tbody tr:hover td { background: var(--surface-2); }
.table-etat .ligne-forte th, .table-etat .ligne-forte td { font-weight: 800; color: var(--texte); background: var(--surface-2); }
.table-etat .section-titre th { background: var(--accent-voile); color: var(--texte); text-align: left; font-family: var(--police-titre); font-weight: 600; letter-spacing: 0; text-transform: none; font-size: .95rem; }

/* ---- Cartes de projet (Mes projets, corbeille) ---- */
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin-top: 16px; }
.carte-projet { background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r-lg); padding: 18px; transition: border-color var(--t), transform var(--t); }
.carte-projet:hover { border-color: var(--bordure-forte); transform: translateY(-2px); }
.carte-projet-tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.carte-projet h3 { margin: 0; font-size: 1.12rem; }
.carte-projet-meta { color: var(--texte-doux); font-size: .85rem; margin: 8px 0 14px; }
.carte-projet-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.carte-projet-actions form { margin: 0; }
.mini-badge { font-size: .74rem; font-weight: 700; padding: 3px 9px; border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--bordure-forte); color: var(--texte-doux); }
.mini-badge.partage { background: var(--accent-voile); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent); }
.danger { color: var(--ambre); }
.enligne-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.enligne-form input[type="text"], .enligne-form input[type="file"] { width: auto; flex: 1 1 200px; margin: 0; }
.zone-danger { border-color: color-mix(in srgb, var(--ambre) 45%, transparent); }
.zone-danger fieldset { border: 1px solid var(--bordure); border-radius: var(--r-sm); padding: 12px 16px; margin: 12px 0; }
.zone-danger legend { padding: 0 6px; color: var(--texte-doux); }

/* ---- Responsive : barre latérale -> onglets en bas ---- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 88px; }
  .sidebar { display: none; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--voile); backdrop-filter: blur(14px); border-top: 1px solid var(--bordure); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar .nav-item { flex-direction: column; gap: 3px; font-size: .72rem; padding: 6px 10px; border: none; color: var(--texte-faible); }
  .tabbar .nav-item[aria-current="page"] { background: none; color: var(--accent); }
  .tabbar .nav-item[aria-current="page"] .ico { color: var(--accent); }
}
@media (max-width: 560px) {
  .masque-mobile { display: none; }
  .marque-nom { display: none; }
  .topbar-inner { padding: 10px 16px; }
  .bloc { padding: 18px; }
  .code-affiche { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto; }
}

/* ============================================================
   Accueil enrichi (ARC Express)
   ============================================================ */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--texte-doux); background: var(--surface-2); border: 1px solid var(--bordure); padding: 6px 14px; border-radius: var(--r-full); margin: 0 0 20px; }
.eyebrow .ico { width: 16px; height: 16px; color: var(--accent); }
.eyebrow strong { color: var(--texte); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.hero-actions .ico { width: 18px; height: 18px; }
.trust { list-style: none; display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; padding: 0; margin: 26px 0 0; color: var(--texte-doux); font-size: .9rem; font-weight: 600; }
.trust li { display: inline-flex; align-items: center; gap: 7px; }
.trust .ico { width: 16px; height: 16px; color: var(--accent); }

.accueil-section { margin-top: 20px; }
.accueil-section > h2 { text-align: center; margin-bottom: 20px; }

.fonctions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.fonction { background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r-lg); padding: 22px; transition: border-color var(--t), transform var(--t); }
.fonction:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); transform: translateY(-2px); }
.fonction-ico { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--accent-voile); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); margin-bottom: 14px; }
.fonction-ico .ico { width: 24px; height: 24px; }
.fonction h3 { margin: 0 0 .4em; }
.fonction p { margin: 0; color: var(--texte-doux); font-size: .95rem; }

.carte-lien { display: inline-block; margin-top: 12px; color: var(--accent); font-weight: 700; font-size: .95rem; }
.carte:hover .carte-lien { text-decoration: underline; }

.pour-qui { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.profil { display: flex; gap: 14px; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r); padding: 16px 18px; }
.profil .ico { width: 26px; height: 26px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.profil strong { display: block; }
.profil span { color: var(--texte-doux); font-size: .9rem; }

.etapes-grille { list-style: none; counter-reset: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.etapes-grille li { display: flex; gap: 14px; align-items: center; background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r); padding: 14px 16px; }
.etapes-grille li span { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-voile); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-family: var(--police-titre); font-weight: 600; flex: 0 0 auto; }
.etapes-grille li div { display: flex; flex-direction: column; }
.etapes-grille li strong { font-size: .98rem; }
.etapes-grille li div { color: var(--texte-doux); font-size: .88rem; }
.etapes-grille li strong { color: var(--texte); }

/* Pied enrichi */
.pied-marque { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--texte); margin-bottom: 6px; }
.logo-mini { width: 28px; height: 28px; border-radius: 8px; font-size: .8rem; }
.pied-arc { margin-top: 10px; }
.pied-arc strong { color: var(--accent); }

/* ============================================================
   Graphiques SVG
   ============================================================ */
.graphes-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-top: 16px; }
.graphe-boite { margin: 0; background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r); padding: 14px; }
.graphe { width: 100%; height: auto; display: block; font-family: var(--police-texte); }
.g-axe { stroke: var(--bordure-forte); stroke-width: 1; }
.g-titre { fill: var(--texte); font-size: 14px; font-weight: 700; font-family: var(--police-titre); }
.g-lab { fill: var(--texte-doux); font-size: 11px; }
.g-val { fill: var(--texte-doux); font-size: 10.5px; font-weight: 600; }
.g-barre { transition: opacity var(--t); }
.g-a { fill: var(--accent); }
.g-b { fill: var(--info); }
.g-neg.g-barre, .g-neg { fill: var(--ambre); }
.g-ligne { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.g-aire { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: none; }
.g-point { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.g-point.g-neg { fill: var(--ambre); }
.g-legende { display: flex; gap: 18px; justify-content: center; margin-top: 4px; flex-wrap: wrap; }
.g-leg-item { display: inline-flex; align-items: center; gap: 7px; font-size: .85rem; color: var(--texte-doux); font-weight: 600; }
.g-puce { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.g-puce.g-a { background: var(--accent); }
.g-puce.g-b { background: var(--info); }
.g-c-total { fill: var(--info); }
.g-c-plus { fill: var(--accent); }
.g-c-moins { fill: var(--ambre); }

/* Page de téléchargement */
.hero-compact { padding: 32px 12px 16px; }
.info-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 18px 0; }
.info-item { display: flex; gap: 14px; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r); padding: 16px; }
.info-item .ico { width: 24px; height: 24px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.info-item strong { display: block; }
.info-item span { color: var(--texte-doux); font-size: .9rem; }
/* Bandeau d'appel au téléchargement (accueil) */
.bloc-telecharger { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; background: linear-gradient(135deg, var(--surface-3), var(--surface)); border: 1px solid var(--bordure-forte); }
.bloc-telecharger .bt-texte { flex: 1 1 320px; }
.bloc-telecharger h2 { margin-bottom: .3em; }
.bloc-telecharger p { margin: 0; color: var(--texte-doux); }

/* ============================================================
   Analyse : diagnostic, solveur, « Et si ? », suivi
   ============================================================ */
.diag-compteur { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.diag-pastille { font-size: .82rem; font-weight: 700; padding: 5px 12px; border-radius: var(--r-full); border: 1px solid var(--bordure); background: var(--surface-2); }
.diag-priorite { border-color: color-mix(in srgb, var(--ambre) 55%, transparent); color: var(--ambre); }
.diag-renforcer { border-color: color-mix(in srgb, var(--info) 45%, transparent); color: var(--info); }
.diag-liste { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.diag-item { display: flex; gap: 14px; align-items: flex-start; background: var(--surface-2); border: 1px solid var(--bordure); border-left-width: 3px; border-radius: var(--r); padding: 14px 16px; }
.diag-b-priorite { border-left-color: var(--ambre); }
.diag-b-renforcer { border-left-color: var(--info); }
.diag-b-suivre { border-left-color: var(--accent); }
.diag-b-savoir { border-left-color: var(--bordure-forte); }
.diag-niveau { flex: 0 0 auto; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); min-width: 90px; padding-top: 2px; }
.diag-constat { margin: 0 0 4px; font-weight: 600; }
.diag-conseil { margin: 0; color: var(--texte-doux); font-size: .92rem; }

.sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.slider-l { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.slider-l span { display: flex; justify-content: space-between; align-items: center; }
.slider-val { color: var(--accent); font-variant-numeric: tabular-nums; }
.slider-l input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; padding: 0; background: transparent; border: none; }
.etsi-resultats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.etsi-kpi { background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--r); padding: 14px 16px; }
.etsi-kpi .kpi-valeur { font-size: 1.25rem; }
.etsi-delta { display: inline-block; margin-top: 4px; font-size: .85rem; font-weight: 700; }
.etsi-delta.pos { color: var(--accent); }
.etsi-delta.neg { color: var(--ambre); }

.table-saisie-reel input { width: 92px; margin: 0; padding: 7px 8px; font-size: .9rem; background: var(--surface-2); }
.table-saisie-reel th { white-space: nowrap; }

/* ============================================================
   Copilote (bouton flottant)
   ============================================================ */
.copilote { position: fixed; right: 18px; bottom: 18px; z-index: 45; }
@media (max-width: 860px) { .copilote { bottom: 76px; } }
.copilote-bulle { display: inline-flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #2bd3a0, var(--accent)); color: var(--accent-contraste); border: none; border-radius: var(--r-full); padding: 12px 18px; font: inherit; font-weight: 700; cursor: pointer; box-shadow: var(--ombre-l); }
.copilote-bulle .ico { width: 20px; height: 20px; }
.copilote-panneau { position: absolute; right: 0; bottom: 60px; width: min(320px, 86vw); background: var(--surface); border: 1px solid var(--bordure-forte); border-radius: var(--r-lg); box-shadow: var(--ombre-l); padding: 18px; display: none; }
.copilote.ouvert .copilote-panneau { display: block; animation: diapo-entre .2s ease; }
.copilote-panneau h3 { margin: 0 0 10px; }
.copilote-prog { height: 8px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; margin-bottom: 6px; }
.copilote-prog span { display: block; height: 100%; background: var(--accent); }
.copilote-conseil { color: var(--texte-doux); font-size: .92rem; margin: 10px 0; border-left: 3px solid var(--accent); padding-left: 10px; }
.copilote-liens { display: grid; gap: 6px; }
.copilote-liens a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--texte); background: var(--surface-2); font-weight: 600; font-size: .92rem; }
.copilote-liens a:hover { background: var(--surface-3); text-decoration: none; }
