/* CRM Sobria — palette « Nuit & Cuivre » (reprise du site) */
/* La palette vit désormais dans design-tokens.css, chargé AVANT ce fichier.
   Elle y est conforme à la charte de référence, aux valeurs exactes — les
   valeurs qui figuraient ici en différaient sur les quatre couleurs (voir
   docs/SOBRIA_EXPERIENCE_AUDIT.md). Les redéfinir ici les écraserait : le
   fichier de jetons n'aurait alors aucun effet, et personne ne s'en
   apercevrait. Ne pas réintroduire de :root de palette dans ce fichier. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--nuit);
  color: var(--creme);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; }
a { color: var(--cuivre-clair); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 15px;
  background: var(--nuit); color: var(--creme);
  border: 1px solid var(--nuit-3); border-radius: 6px;
  padding: 9px 11px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cuivre); border-color: transparent; }
label { display: block; font-size: 12.5px; color: var(--ardoise); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.loading { padding: 40px; text-align: center; color: var(--ardoise); }
.lookup-row { display: flex; gap: 6px; align-items: stretch; }
.lookup-row input { flex: 1; }
.lookup-btn { white-space: nowrap; }

/* ---- boutons */
.btn {
  display: inline-block; border: none; border-radius: 6px;
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  background: var(--nuit-3); color: var(--creme);
}
.btn:hover { filter: brightness(1.15); }
.btn-primary { background: var(--cuivre); color: #fff; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }

/* ---- login */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--nuit-2);
  border: 1px solid var(--nuit-3); border-radius: var(--radius); padding: 34px;
}
.login-card h1 { font-size: 26px; margin-bottom: 4px; }
.login-card .sub { color: var(--ardoise); font-size: 13.5px; margin-bottom: 18px; }
.login-card .btn { width: 100%; margin-top: 18px; padding: 12px; }
.error-msg { color: var(--danger); font-size: 13.5px; margin-top: 10px; }

/* ---- structure */
.shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: 218px; flex-shrink: 0; background: var(--nuit-2);
  border-right: 1px solid var(--nuit-3); padding: 22px 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh;
}
.brand { font-family: var(--font-head); font-size: 21px; padding: 0 22px 18px; }
.brand em { color: var(--cuivre); font-style: normal; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 22px; color: var(--creme); font-size: 14.5px; opacity: .75;
  border-left: 3px solid transparent;
}
.nav-link:hover { opacity: 1; }
.nav-link.active { opacity: 1; border-left-color: var(--cuivre); background: rgba(196,122,74,.08); }
.nav-spacer { flex: 1; }
.nav-user { padding: 12px 22px; font-size: 13px; color: var(--ardoise); border-top: 1px solid var(--nuit-3); }

/* ---- tags de documents (crm/static/app.js:viewDocuments) */
.doc-tag {
  display: inline-block; background: rgba(196,122,74,.12); border: 1px solid rgba(196,122,74,.4);
  color: var(--cuivre-clair); border-radius: 99px; padding: 0 8px; font-size: 11px;
  font-family: inherit; margin-left: 4px; cursor: pointer;
}
.doc-tag:hover { background: rgba(196,122,74,.25); }

/* ---- carte de France (crm/static/app.js:viewMap) */
.map-card { display: flex; flex-direction: column; align-items: center; }
.france-svg { width: 100%; max-width: 620px; height: auto; }
.france-shape { fill: var(--nuit-3); stroke: var(--cuivre); stroke-width: 1.2; stroke-opacity: .55; }
.map-dot { fill: var(--cuivre); opacity: .9; cursor: pointer; stroke: var(--nuit); stroke-width: 1.5; }
.map-dot.warn { fill: var(--warn); }
.map-dot.urgent { fill: var(--danger); }
.map-dot:hover { opacity: 1; stroke: var(--creme); }

/* ---- espace client (crm/static/client.js) : suivi « colis » */
.client-progress { height: 8px; background: var(--nuit-3); border-radius: 99px; overflow: hidden; }
.client-progress-bar { height: 100%; background: var(--cuivre); border-radius: 99px; transition: width .4s; }
.client-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; }
@media (max-width: 640px) { .client-steps { grid-template-columns: 1fr; } }
.client-step { font-size: 13px; color: var(--ardoise); padding: 3px 0; }
.client-step.done { color: var(--creme); }
.client-step .mark { color: var(--cuivre); display: inline-block; width: 16px; }
.client-step .when { color: var(--ardoise); font-size: 11.5px; margin-left: 6px; }

/* ---- historique des prix (crm/static/app.js:meterPricesModal) */
.price-chart { width: 100%; height: auto; background: var(--nuit); border: 1px solid var(--nuit-3); border-radius: 8px; margin: 8px 0; }
.price-axis { font-size: 10px; fill: var(--ardoise); font-family: Inter, sans-serif; }
.price-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ardoise); margin-bottom: 8px; }
.price-legend span { display: inline-flex; align-items: center; gap: 5px; }
.price-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }

/* ---- calendrier métier (crm/static/app.js:viewCalendar) */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head div { text-align: center; font-size: 11px; color: var(--ardoise); text-transform: uppercase; letter-spacing: .05em; padding: 4px 0; }
.cal-day {
  min-height: 62px; background: var(--nuit); border: 1px solid var(--nuit-3);
  border-radius: 6px; padding: 5px 6px; position: relative;
}
.cal-day.empty { background: none; border: none; }
.cal-day.has-events { cursor: pointer; }
.cal-day.has-events:hover { border-color: var(--cuivre); }
.cal-day.today { border-color: var(--cuivre); background: rgba(196,122,74,.07); }
.cal-day.selected { outline: 2px solid var(--cuivre); }
.cal-day .num { font-size: 12px; color: var(--ardoise); }
.cal-day.today .num { color: var(--cuivre-clair); font-weight: 700; }
.cal-day .dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 5px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; }
.cal-dot.deal_end { background: var(--cuivre); }
.cal-dot.meter_renewal { background: #7da7d9; }
.cal-dot.todo { background: var(--ok); }
.cal-dot.urgente, .cal-dot.depassee { background: var(--danger); }
.cal-more { font-size: 10px; color: var(--ardoise); }
@media (max-width: 760px) {
  .cal-day { min-height: 46px; padding: 3px 4px; }
  .cal-dot { width: 6px; height: 6px; }
}

/* ---- scan du QR de courrier (crm/static/app.js:viewProspection) — signal
   chaud : un prospect qui vient de scanner mérite une relance immédiate. */
.scan-badge { color: var(--cuivre-clair); font-weight: 600; }

/* ---- objectifs commerciaux (crm/static/app.js:viewObjectifs) */
.obj-bar { height: 6px; background: var(--nuit); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; max-width: 320px; }
.obj-fill { height: 100%; background: var(--cuivre); border-radius: 99px; }
.obj-fill.done { background: var(--ok); }

/* ---- portefeuille énergie (crm/static/app.js:viewPortefeuille) — frise des
   renouvellements : 24 colonnes proportionnelles au volume du mois. */
.pf-chart { display: flex; align-items: flex-end; gap: 3px; height: 190px; overflow-x: auto; }
.pf-col { flex: 1; min-width: 26px; display: flex; flex-direction: column; cursor: pointer; height: 100%; }
.pf-bar-wrap { flex: 1; display: flex; align-items: flex-end; }
.pf-bar { width: 100%; background: var(--cuivre); border-radius: 3px 3px 0 0; }
.pf-col:hover .pf-bar { background: var(--cuivre-clair); }
.pf-col.empty .pf-bar-wrap { border-bottom: 1px dashed var(--nuit-3); }
.pf-label { font-size: 9.5px; color: var(--ardoise); text-align: center; margin-top: 5px; line-height: 1.25; }

/* ---- consultations fournisseurs (crm/static/app.js:viewConsultation) —
   l'offre retenue est soulignée d'un liseré cuivre dans le comparatif. */
.offer-retenue { border-left: 3px solid var(--cuivre); background: rgba(196,122,74,.07); }

/* ---- filtres de la timeline unifiée (crm/static/app.js:viewCompany) */
.tl-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tl-chip {
  background: none; border: 1px solid var(--nuit-3); color: var(--ardoise);
  border-radius: 99px; padding: 3px 11px; font-size: 12px; font-family: inherit;
}
.tl-chip:hover { color: var(--creme); }
.tl-chip.active { border-color: var(--cuivre); color: var(--cuivre-clair); background: rgba(196,122,74,.1); }

/* ---- recherche globale (crm/static/app.js:initGlobalSearch) — barre
   toujours visible en tête de sidebar, dropdown flottant plus large que
   la sidebar pour rester lisible malgré ses 218px. */
.global-search { position: relative; padding: 0 22px 14px; }
.global-search input { font-size: 13.5px; padding: 8px 10px; }
.global-search-results {
  position: absolute; left: 22px; top: calc(100% - 8px); width: 300px;
  background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0,0,0,.45); max-height: 60vh; overflow-y: auto; z-index: 60;
  padding: 6px 0;
}
.gsr-group-label { padding: 8px 14px 4px; font-size: 11px; color: var(--ardoise); text-transform: uppercase; letter-spacing: .05em; }
.gsr-item { display: flex; align-items: center; gap: 8px; padding: 8px 14px; color: var(--creme); font-size: 13.5px; }
.gsr-item:hover { background: rgba(255,255,255,.04); }
.gsr-sublabel { margin-left: auto; color: var(--ardoise); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.global-search-results .empty { padding: 14px; font-size: 13px; }
.main { flex: 1; padding: 28px 34px 80px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }

/* ---- mobile */
.tabbar { display: none; }
@media (max-width: 760px) {
  .sidebar { display: none; }
  .main { padding: 18px 14px 90px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--nuit-2); border-top: 1px solid var(--nuit-3);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1; text-align: center; padding: 9px 2px 7px;
    font-size: 10.5px; color: var(--creme); opacity: .65;
  }
  .tabbar a .ico { display: block; font-size: 19px; margin-bottom: 1px; }
  .tabbar a.active { opacity: 1; color: var(--cuivre-clair); }
  .btn-sm { padding: 8px 12px; }  /* cible tactile ~36 px */
}

/* Modale « Plus » mobile : navigation complète en tuiles + recherche. */
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.more-tile {
  display: flex; align-items: center; gap: 10px; padding: 13px 12px;
  background: var(--nuit); border: 1px solid var(--nuit-3); border-radius: 8px;
  color: var(--creme); font-size: 14px;
}
.more-tile .ico { font-size: 18px; }
.more-tile.active { border-color: var(--cuivre); color: var(--cuivre-clair); }
.more-search-results { position: static; width: 100%; box-shadow: none; margin-top: 4px; }

/* ---- cartes / stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .num { font-size: 30px; font-weight: 700; font-family: var(--font-head); }
.stat-card .lbl { font-size: 12.5px; color: var(--ardoise); text-transform: uppercase; letter-spacing: .05em; }
.stat-card.accent .num { color: var(--cuivre-clair); }
.stat-card.danger .num { color: var(--danger); }
.stat-card.warn .num { color: var(--warn); }
.card { background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 18px; margin-bottom: 14px; }

/* ---- tableaux / listes */
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--nuit-3);
  color: var(--creme); cursor: pointer;
}
.list-row:hover { background: rgba(255,255,255,.03); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; }
.list-row .meta { font-size: 12.5px; color: var(--ardoise); }

/* Mobile : titre pleine largeur, boutons en seconde ligne — sinon une ligne
   à cinq boutons (Presse, Prospection) écrase le titre à ~45 px de large et
   il se coupe mot par mot. Ce bloc DOIT rester après `.list-row .grow` :
   `flex: 1` y remet flex-basis à 0 et l'emporterait à spécificité égale. */
@media (max-width: 700px) {
  .list-row { flex-wrap: wrap; row-gap: 8px; }
  .list-row .grow { flex-basis: 100%; }
}
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; border-radius: 99px;
  padding: 2px 9px; text-transform: uppercase; letter-spacing: .04em;
}
.badge-prospect { background: rgba(91,107,130,.25); color: #a8b6c9; }
.badge-client { background: rgba(76,175,125,.18); color: var(--ok); }
.badge-urgente, .badge-depassee { background: rgba(217,95,74,.18); color: var(--danger); }
.badge-active { background: rgba(224,160,60,.16); color: var(--warn); }
.badge-veille { background: rgba(91,107,130,.2); color: #a8b6c9; }
.badge-brouillon { background: rgba(91,107,130,.25); color: #a8b6c9; }
.badge-envoye { background: rgba(224,160,60,.16); color: var(--warn); }
.badge-signe { background: rgba(76,175,125,.18); color: var(--ok); }
/* Classes génériques par intention. Account Studio s'en sert pour distinguer
   fait vérifié / lecture Sobria / hypothèse à confirmer : sans elles, les
   trois s'affichaient à l'identique et le garde-fou devenait invisible —
   constaté dans le navigateur, jamais par les tests (04/08/2026). */
.badge-ok { background: rgba(76,175,125,.18); color: var(--ok); }
.badge-warn { background: rgba(224,160,60,.16); color: var(--warn); }
.badge-info { background: rgba(91,107,130,.25); color: #a8b6c9; }
.badge-danger { background: rgba(217,95,74,.18); color: var(--danger); }

/* Sites & Compteurs (crm/static/app.js:viewCompany) — un site-block par
   site, ses compteurs indentés en dessous pour marquer la hiérarchie. */
.site-block:not(:last-child) { border-bottom: 2px solid var(--nuit-3); }
.site-block .meter-row { padding-left: 32px; }
.site-block .meter-row .kind { font-size: 14px; }

/* Statuts de prospection (crm/static/app.js:viewProspection) — select
   éditable directement teinté selon le statut courant, pas juste un badge
   statique, pour rester scannable même en liste dense. */
.statut-select.statut-a_contacter { border-color: rgba(91,107,130,.5); color: #a8b6c9; }
.statut-select.statut-contacte { border-color: rgba(196,122,74,.6); color: var(--cuivre-clair); }
.statut-select.statut-relance { border-color: rgba(224,160,60,.6); color: var(--warn); }
.statut-select.statut-repondu { border-color: rgba(76,175,125,.4); color: var(--ok); }
.statut-select.statut-converti { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.statut-select.statut-sans_suite { border-color: rgba(217,95,74,.5); color: var(--danger); }

.list-table { width: 100%; border-collapse: collapse; background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--radius); overflow: hidden; }
.list-table th, .list-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--nuit-3); font-size: 14px; }
.list-table th { color: var(--ardoise); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.list-table tr:last-child td { border-bottom: none; }

.subnav { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--nuit-3); flex-wrap: wrap; }
.subnav a { padding: 9px 4px; margin-right: 18px; font-size: 14px; color: var(--ardoise); border-bottom: 2px solid transparent; }
.subnav a.active { color: var(--creme); border-bottom-color: var(--cuivre); }

/* ---- formulaire devis / facture */
fieldset.fs { border: 1px solid var(--nuit-3); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
fieldset.fs legend { padding: 0 6px; font-size: 12.5px; color: var(--cuivre-clair); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
table.lignes { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.lignes th { text-align: left; padding: 6px 5px; color: var(--ardoise); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
table.lignes td { padding: 4px 5px; vertical-align: top; }
table.lignes input, table.lignes select, table.lignes textarea { font-size: 13.5px; padding: 6px 8px; }
table.lignes textarea { resize: vertical; min-height: 48px; font-family: inherit; }
.picker-row { padding: 9px 12px; border: 1px solid var(--nuit-3); border-top: none; cursor: pointer; font-size: 14px; }
.picker-row:first-child { border-top: 1px solid var(--nuit-3); border-radius: 6px 6px 0 0; }
.picker-row:last-child { border-radius: 0 0 6px 6px; }
.picker-row:hover { background: rgba(255,255,255,.04); }
.picker-row .meta { color: var(--ardoise); font-size: 12.5px; margin-left: 6px; }

/* ---- timeline « suivi de colis » d'un dossier */
.timeline-list { border-left: 2px solid var(--nuit-3); margin: 8px 0 14px 8px; padding-left: 16px; }
.timeline-step { padding: 7px 0; }
.timeline-step .step-label { font-size: 14.5px; }
.timeline-step.done .step-label { color: var(--ok); }
.timeline-step .step-meta, .step-meta { font-size: 12px; color: var(--ardoise); margin-left: 28px; }

/* ---- marque blanche */
.brand-logo { max-height: 30px; max-width: 150px; object-fit: contain; }
.org-logo-thumb { max-height: 40px; max-width: 120px; object-fit: contain; border-radius: 4px; }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-left: 6px; vertical-align: middle; border: 1px solid rgba(255,255,255,.25); }

/* ---- assistant IA de dossier */
.ai-summary { max-height: 420px; overflow-y: auto; font-size: 14px; }
.ai-summary p { margin: 0 0 10px; }
.ai-summary ul { margin: 0 0 10px 20px; }
.ai-summary strong { color: var(--cuivre-clair); }

/* ---- statistiques */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px; }
.stat-value { font-family: var(--font-head); font-size: 24px; color: var(--cuivre-clair); }
.stat-label { font-size: 12px; color: var(--ardoise); text-transform: uppercase; letter-spacing: .03em; margin-top: 2px; }

/* ---- cloche de notifications */
.brand { display: flex; align-items: center; justify-content: space-between; }
.bell { position: relative; background: none; border: none; font-size: 18px; padding: 4px 6px; }
.bell-dot { position: absolute; top: 2px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.notif-list { max-height: 360px; overflow-y: auto; margin: 10px 0; }
.notif-row { display: block; padding: 10px 12px; border-radius: 6px; margin-bottom: 4px; color: var(--creme); }
.notif-row:hover { background: rgba(255,255,255,.04); }
.notif-row.unread { background: rgba(196,122,74,.1); border-left: 3px solid var(--cuivre); }
.notif-row .content { font-size: 14px; }
.notif-row .meta { font-size: 11.5px; color: var(--ardoise); margin-top: 2px; }

/* ---- fil de discussion */
.chat-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.chat-tabs button { flex: 1; }
.chat-tabs button.active { background: var(--cuivre); color: #fff; }
.chat-log { max-height: 320px; overflow-y: auto; border: 1px solid var(--nuit-3); border-radius: var(--radius); padding: 10px; margin-bottom: 10px; }
.chat-msg { padding: 8px 10px; border-radius: 8px; margin-bottom: 8px; background: var(--nuit-3); }
.chat-msg.mine { background: rgba(196,122,74,.14); }
.chat-msg .who { font-size: 11.5px; color: var(--ardoise); margin-bottom: 3px; }
.chat-msg .body { font-size: 14px; white-space: pre-wrap; }
.chat-form { display: flex; gap: 8px; }
.chat-form textarea { flex: 1; min-height: 44px; resize: vertical; }
@media (max-width: 760px) {
  table.lignes thead { display: none; }
  table.lignes, table.lignes tbody, table.lignes tr, table.lignes td { display: block; width: 100%; }
  table.lignes tr { border-bottom: 2px solid var(--nuit-3); margin-bottom: 12px; padding-bottom: 8px; }
  table.lignes td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--ardoise); text-transform: uppercase; margin-bottom: 2px; }
}

/* ---- pipeline kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.kcol { flex: 0 0 240px; background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--radius); padding: 10px; }
.kcol h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ardoise); font-family: var(--font-body); padding: 4px 6px 10px; display:flex; justify-content: space-between; }
.kcard {
  background: var(--nuit); border: 1px solid var(--nuit-3); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px; cursor: grab; font-size: 13.5px;
}
.kcard .company { font-weight: 600; }
.kcard .meta { color: var(--ardoise); font-size: 12px; margin-top: 2px; }
.kcard.dragging { opacity: .4; }
.kcol.dragover { outline: 2px dashed var(--cuivre); }
/* Lot 4 : urgence visuelle dans le pipeline */
.kcard.kcard-bloquee { border-color: var(--danger); background: rgba(217, 95, 74, 0.1); }
.kcard.kcard-urgent { border-color: var(--warn); background: rgba(224, 160, 60, 0.1); }
.kcard.kcard-bloquee .meta { color: var(--danger); }
.kcard.kcard-urgent .meta { color: var(--warn); }

/* ---- fiche entreprise */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.timeline-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--nuit-3); font-size: 13.5px; }
.timeline-item:last-child { border: none; }
/* Sans cette règle, les filtres de la chronologie ne masquaient RIEN : le JS
   posait bien l'attribut `hidden`, mais `display: flex` ci-dessus l'emporte sur
   la règle `[hidden] { display: none }` du navigateur. Défaut invisible aux
   tests (pytest n'a pas de moteur de rendu) et à l'œil quand une fiche ne
   contient qu'un seul type d'élément — le filtre semble alors marcher. */
.timeline-item[hidden] { display: none; }
.timeline-item .kind { flex-shrink: 0; font-size: 17px; }
.timeline-item .who { color: var(--ardoise); font-size: 12px; }
.timeline-item.done .content { text-decoration: line-through; opacity: .55; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- modale */
.modal-back {
  position: fixed; inset: 0; background: rgba(10,14,22,.72); z-index: 100;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 14px; overflow-y: auto;
}
.modal {
  background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--radius);
  width: 100%; max-width: 560px; padding: 24px;
}
.modal h2 { font-size: 19px; margin-bottom: 6px; }
.searchbar { max-width: 320px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.empty { color: var(--ardoise); padding: 24px; text-align: center; font-size: 14px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--cuivre); color: #fff; padding: 10px 22px; border-radius: 99px;
  font-size: 14px; font-weight: 600; z-index: 200; box-shadow: 0 6px 24px rgba(0,0,0,.4);
}

/* ---- dépenses de l'entreprise (crm/static/app.js:viewDepenses) */
.dep-montant { flex-shrink: 0; text-align: right; font-weight: 600; font-size: 14px;
  color: var(--creme); min-width: 96px; }
.dep-montant span { display: block; font-size: 10.5px; font-weight: 400; color: var(--ardoise); }
.dep-statut { font-weight: 600; }
.dep-a_payer { color: var(--cuivre-clair); }
.dep-paye { color: #6fcf97; }
.dep-cat { margin-bottom: 12px; }
.dep-cat-head { display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--ardoise); margin-bottom: 4px; }
.dep-cat-head b { color: var(--creme); }
.dep-qui { color: var(--cuivre-clair); }
.depot-scan { background: var(--nuit); border: 1px solid var(--nuit-3); border-radius: 8px;
  padding: 12px; margin: 10px 0 4px; font-size: 13px; line-height: 1.5; }
.depot-scan.warn { border-color: var(--cuivre); }
.depot-scan .meta { font-size: 12.5px; color: var(--ardoise); margin-top: 4px; }
.depot-scan .warn-txt { color: #e2857a; }
.cal-prive { font-size: 11px; color: var(--ardoise); font-weight: 400; }
.cal-dot.perso { background: var(--cuivre-clair); }
.dep-personnes { display: flex; gap: 14px; flex-wrap: wrap; }
.dep-personne { flex: 1 1 200px; padding: 14px; background: var(--nuit); border-radius: 8px;
  border: 1px solid var(--nuit-3); }
.dep-personne-nom { font-size: 12.5px; color: var(--ardoise); text-transform: uppercase;
  letter-spacing: .04em; }
.dep-personne-total { font-family: "PT Serif", Georgia, serif; font-size: 24px;
  color: var(--creme); margin: 2px 0; }
.dep-personne .btn { margin-top: 10px; }
.dep-treso { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 8px; }
.dep-treso .lbl { display: block; font-size: 12px; color: var(--ardoise);
  text-transform: uppercase; letter-spacing: .04em; }
.dep-treso b { font-size: 20px; font-family: "PT Serif", Georgia, serif; }
.dep-plus { color: #6fcf97; }
.dep-moins { color: #e2857a; }

/* ---- relations presse (crm/static/app.js:viewPresse) */
.press-badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px;
  font-weight: 600; border: 1px solid var(--nuit-3); }
.press-brouillon { color: var(--ardoise); }
.press-pret { color: var(--cuivre-clair); border-color: var(--cuivre); }
.press-envoye { color: #6fcf97; border-color: #2f6f4f; }
.press-echec { color: #e2857a; }
.press-ton { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.press-ton-positive { color: #6fcf97; background: rgba(111,207,151,.12); }
.press-ton-neutre { color: var(--ardoise); background: rgba(255,255,255,.06); }
.press-ton-negative { color: #e2857a; background: rgba(226,133,122,.12); }
.press-picklist { max-height: 300px; overflow-y: auto; border: 1px solid var(--nuit-3);
  border-radius: 8px; padding: 6px; margin-top: 6px; }
/* text-transform explicite : le style global des <label> est en capitales,
   ce qui ferait crier le nom des journalistes. */
.press-pick { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px;
  border-radius: 6px; cursor: pointer; font-size: 13px; margin: 0;
  text-transform: none; letter-spacing: 0; color: var(--creme); }
.press-pick:hover { background: var(--nuit-2); }
.press-pick input { width: auto; margin: 3px 0 0; flex-shrink: 0; }
.press-pick .meta { display: block; }
.marronnier-tease { display: flex; align-items: center; gap: 14px; }
@media (max-width: 700px) {
  /* Empilé sur mobile : à côté du bouton, la colonne de texte tombait à
     ~180 px et l'angle se lisait sur huit lignes. */
  .marronnier-tease { flex-direction: column; align-items: stretch; }
}
.marronnier-now { background: rgba(184,115,51,.07); }
.marronnier-mois { width: 84px; flex-shrink: 0; font-weight: 600; color: var(--cuivre-clair);
  font-size: 13px; text-transform: capitalize; line-height: 1.3; }
.marronnier-mois span { color: var(--ardoise); font-weight: 400; font-size: 11.5px; }

/* ---- QR d'accès à l'espace client (crm/static/app.js:clientAccountsModal) */
.qr-access { display: flex; align-items: center; gap: 14px; margin: 12px 0;
  padding: 12px; background: var(--nuit); border: 1px solid var(--nuit-3); border-radius: 8px; }
.qr-access img { background: #fff; padding: 5px; border-radius: 5px; flex-shrink: 0; }
.qr-access .meta { font-size: 12.5px; color: var(--ardoise); line-height: 1.5; }

/* ---- file de validation des contenus du site (crm/static/app.js:viewSiteContent) */
/* Les règles globales `input { width: 100% }` et `label { text-transform:
   uppercase; color: ardoise }` (haut de ce fichier) visent les formulaires de
   saisie ; appliquées ici, elles étiraient le bouton radio sur toute la
   largeur et repoussaient la réponse hors de sa boîte, en capitales grises.
   D'où les remises à zéro explicites ci-dessous. */
.proposal-variant { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  margin: 0 0 6px; background: var(--nuit); border: 1px solid var(--nuit-3);
  border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1.55;
  text-transform: none; letter-spacing: normal; color: var(--creme); }
.proposal-variant:hover { border-color: var(--cuivre); }
.proposal-variant input[type="radio"] { width: auto; margin: 3px 0 0; padding: 0;
  flex-shrink: 0; accent-color: var(--cuivre); }
.proposal-variant span { flex: 1; min-width: 0; }
/* Même exception que ci-dessus : sans elle, la règle globale « input { width:
   100% } » étire la case à cocher sur toute la largeur et fait passer la barre
   de sélection à la ligne. */
.lot-case, #lot-tout { width: auto; margin: 0; padding: 0; flex-shrink: 0;
  accent-color: var(--cuivre); cursor: pointer; }
/* Les curseurs d'avancement de la check-list : sans accent-color, le
   navigateur les rend en bleu système, seule tache froide de la charte. */
input[type="range"] { accent-color: var(--cuivre); padding: 0; cursor: pointer; }
.proposal-libre { text-transform: none; letter-spacing: normal; color: var(--creme);
  font-size: 14px; margin-top: 12px; }
.proposal-variant:has(input:checked) { border-color: var(--cuivre);
  background: rgba(184,115,51,.08); }
.proposal-retenue { padding: 12px; background: var(--nuit); border-left: 3px solid var(--cuivre);
  border-radius: 0 8px 8px 0; font-size: 14px; line-height: 1.6; }
/* Prospects sur la carte : losange, pas cercle. La forme distingue mieux que
   la couleur — un daltonien lit la différence, pas seulement la teinte. */
.map-prospect { fill: var(--cuivre-clair, #d9a273); fill-opacity: .55;
  stroke: var(--cuivre); stroke-width: 1.2; cursor: pointer; }
.map-prospect:hover { fill-opacity: .9; }

/* ---- « Contenus du site » : deux natures, deux groupes (app.js:viewSiteContent)
   Les propositions d'article partent en ligne dès validation, les corrections
   attendent une passe sur le code. Les mélanger, c'est valider l'une en croyant
   faire l'autre — d'où la séparation visuelle, avec un liseré de couleur
   différente par groupe. */
.contenus-groupe { margin-bottom: 28px; padding-left: 14px;
  border-left: 3px solid var(--nuit-3); }
.contenus-groupe--publication { border-left-color: var(--ok); }
.contenus-groupe--correction { border-left-color: var(--cuivre); }
.contenus-groupe > h2 { font-size: 16px; margin-bottom: 2px;
  display: flex; align-items: center; gap: 9px; }
.contenus-compte { background: var(--nuit-3); color: var(--creme);
  border-radius: 99px; padding: 1px 9px; font-size: 12px;
  font-family: var(--font-body); font-weight: 600; }
.contenus-groupe--publication .contenus-compte { background: var(--ok); color: #06241a; }
.contenus-groupe--correction .contenus-compte { background: var(--cuivre); color: #fff; }
.contenus-aide { font-size: 12.5px; color: var(--ardoise); margin-bottom: 12px; }

/* ---- Lot 3 Prospection : table de sources traçables et niveaux de fiabilité */
.data-table { width: 100%; border-collapse: collapse; background: var(--nuit-2); border: 1px solid var(--nuit-3); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--nuit-3); font-size: 14px; }
.data-table th { color: var(--ardoise); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }
.data-table a { color: var(--cuivre-clair); }
.fiabilite-trouvé { background: var(--ok); color: #06241a; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.fiabilite-probable { background: var(--warn); color: #06241a; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.fiabilite-à_confirmer { background: var(--danger); color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }

/* Smart Forms — constructeur, analyse IA, fil d'échanges */
.fb-list { display: grid; gap: 6px; }
.fb-row { display: flex; gap: 8px; align-items: flex-start; background: var(--nuit-2);
          border: 1px solid var(--nuit-3); border-radius: 8px; padding: 8px 10px; }
.fb-row.fb-over { border-color: var(--cuivre); }
.fb-grip { cursor: grab; opacity: .5; font-size: 18px; line-height: 1.4; user-select: none; }
.fb-row .fb-label { width: 100%; }
.fb-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; font-size: 12px; }
.fb-meta .fb-options { flex: 1; min-width: 160px; }
.sf-crm-progress { height: 8px; border-radius: 4px; background: var(--nuit-3); overflow: hidden; }
.sf-crm-progress > div { height: 100%; background: var(--cuivre); }
.ia-box { background: var(--nuit-2); border-left: 3px solid var(--cuivre); border-radius: 6px;
          padding: 12px 14px; font-size: 14px; line-height: 1.55; }
.comm-row { border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; font-size: 14px; }
.comm-row.sobria { background: var(--nuit-2); border-left: 3px solid var(--cuivre); }
.comm-row.client { background: rgba(76,175,125,.10); border-left: 3px solid var(--ok); }

/* Prochaine action (Lot C) — sur les cartes du pipeline.
   Trois états seulement, calculés par le serveur : absente, en retard, à venir. */
.pa { margin-top: 6px; font-size: 12px; color: var(--ardoise); line-height: 1.35; }
.pa-quand { color: var(--cuivre-clair); font-weight: 600; }
.pa-absente { color: var(--warn); }
.pa-retard { color: var(--danger); font-weight: 600; }

/* Journal d'audit (Lot D) — le niveau saute aux yeux en revue de sécurité. */
.audit-code { font-size: 11px; color: var(--ardoise); font-family: ui-monospace, monospace;
              margin-left: 8px; opacity: .8; }
.list-row.audit-alerte { border-left: 3px solid var(--danger); }
.list-row.audit-sensible { border-left: 3px solid var(--warn); }

/* Statistiques d'appels (lot G) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--nuit-2); border: 1px solid var(--nuit-3);
       border-radius: var(--radius); padding: 14px; cursor: help; }
.kpi-val { font-family: var(--font-head); font-size: 24px; color: var(--cuivre-clair); }
.kpi-lbl { color: var(--ardoise); font-size: 12px; margin-top: 2px; }

/* ==========================================================================
   Accessibilité — lot V7-P0 (04/08/2026)
   ==========================================================================
   L'audit (docs/SOBRIA_EXPERIENCE_AUDIT.md) a mesuré : 14 effets de survol,
   ZÉRO état de focus clavier. Un utilisateur au clavier ne voyait pas où il
   se trouvait dans le CRM. C'est un défaut bloquant, pas une finition.

   `:focus-visible` et non `:focus` : le second dessinerait un contour après
   chaque clic souris, ce qui pousse les développeurs à le retirer — et on
   revient au point de départ. `:focus-visible` ne se déclenche qu'à la
   navigation clavier, là où le repère est nécessaire.
   ========================================================================== */

:root {
  --focus-anneau: 3px;
  --focus-couleur: var(--cuivre);
  --duree-courte: 150ms;
  --duree-moyenne: 200ms;
  --courbe: cubic-bezier(.2, 0, .2, 1);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.nav-link:focus-visible,
.list-row:focus-visible,
.subnav a:focus-visible {
  outline: var(--focus-anneau) solid var(--focus-couleur);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Le contour ne doit jamais être masqué par un parent qui coupe le débordement. */
.card:focus-within,
.list-row:focus-within { overflow: visible; }

/* Lien d'évitement : un utilisateur au clavier ne doit pas traverser
   vingt entrées de menu avant d'atteindre le contenu. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--cuivre);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* Texte réservé aux lecteurs d'écran : visible pour eux, invisible à l'écran.
   Sert à nommer une action dont l'intitulé visible est une icône. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Mouvement réduit
   ==========================================================================
   Certaines personnes ressentent nausées ou vertiges devant une animation.
   Le réglage système existe ; il n'était pas honoré. On coupe le mouvement,
   PAS le retour visuel : les changements de couleur et de bordure restent,
   ce sont eux qui portent l'information.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  /* Aucun déplacement : c'est le mouvement qui gêne, pas le contraste. */
  .btn:hover,
  .card:hover,
  .list-row:hover { transform: none !important; }
}

/* ==========================================================================
   Système d'interactions — survol, focus, actif
   ==========================================================================
   Une seule transition existait dans toute la feuille. Les durées et la
   courbe sont désormais des jetons : changer le rythme de l'interface est
   une modification d'une ligne, pas d'une centaine.

   Règle tenue : tout effet de survol a son équivalent focus clavier, et
   aucune fonction n'est accessible au seul survol.
   ========================================================================== */

.btn,
.nav-link,
.list-row,
.card {
  transition: background-color var(--duree-courte) var(--courbe),
              border-color var(--duree-courte) var(--courbe),
              box-shadow var(--duree-moyenne) var(--courbe),
              transform var(--duree-courte) var(--courbe);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* Sur écran tactile, aucun survol n'existe : les effets ne doivent pas
   « rester collés » après un appui. */
@media (hover: none) {
  .btn:hover,
  .card:hover,
  .list-row:hover { transform: none; box-shadow: none; }
}

/* Un élément désactivé doit se voir ET s'expliquer : le titre porte la
   raison, jamais la seule couleur grise. */
.btn:disabled,
button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}

/* ---------------------------------------------- lettres croquis */
/* La modale est large : les paramètres à gauche, la page A4 à droite. Sur un
   écran étroit, les deux passent l'un sous l'autre — un aperçu A4 comprimé
   sur 300 px ne renseigne sur rien. */
.lc-corps { display: flex; gap: 18px; align-items: flex-start; }
.lc-params { flex: 0 0 300px; }
.lc-apercu { flex: 1; min-width: 0; }
.lc-page { background: var(--nuit-2); padding: 14px; border-radius: 6px;
  max-height: 62vh; overflow: auto; }
/* Proportion A4 (210 × 297) et marges de 25 mm ramenées à l'échelle. */
.lc-a4 { background: #fff; color: #14213B; aspect-ratio: 210 / 297;
  padding: 8.4% 11.9%; font-family: Inter, Arial, sans-serif;
  font-size: 9px; line-height: 1.5; }
.lc-a4 p { margin: 0 0 7px; text-align: justify; }
.lc-entete { font-family: Georgia, serif; font-size: 13px; letter-spacing: .04em;
  border-bottom: 1px solid #C3793A; padding-bottom: 4px; margin-bottom: 10px; }
.lc-entete span { display: block; font-family: Inter, Arial, sans-serif;
  font-size: 7px; letter-spacing: .12em; text-transform: uppercase; color: #373946; }
.lc-dest { text-align: right; font-size: 8.5px; margin-bottom: 12px; color: #373946; }
.lc-appel { font-weight: 600; }
.lc-fin { margin-top: 10px; font-style: italic; color: #373946; }
.lc-croquis { margin: 8px 0; text-align: center; }
.lc-croquis svg { width: 42%; height: auto; }
.lc-croquis figcaption { font-size: 8px; color: #373946; font-style: italic; margin-top: 2px; }
@media (max-width: 900px) { .lc-corps { flex-direction: column; }
  .lc-params { flex: 1 1 auto; width: 100%; } }

/* Le bouton Croquis : fond bleu nuit un peu plus clair, texte crème, accent
   cuivre au survol — l'aspect demandé par le cahier des charges. */
.btn-croquis { background: var(--nuit-3); color: var(--creme); }
.btn-croquis:hover { border-color: var(--cuivre); color: var(--cuivre); }

/* La modale des lettres croquis est plus large que les autres : l'aperçu A4
   doit rester lisible. Sans cette règle, la page se comprimait à 180 px et
   ne renseignait sur rien — constaté au navigateur (04/08/2026). */
.modal:has(.lc-large) { max-width: 1100px; width: 92vw; }
.lc-large { display: none; }
