/* ───────────────────────────────────────────────
   CHARTE — Mon Agence Marketing (orange / blanc)
─────────────────────────────────────────────── */
:root{
  --brand:#F15A22;
  --brand-dark:#d8480f;
  --brand-soft:#fff1ea;
  --ink:#1c2230;
  --muted:#6c7488;
  --bg:#f6f7fb;
  --panel:#ffffff;
  --panel2:#fbfcfe;
  --line:#e7eaf1;
  --red:#e63946; --amber:#f6a609; --green:#1faa6e; --grey:#aeb4c4;
}
*{box-sizing:border-box;}
body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg);color:var(--ink);}

/* Topbar */
.topbar{display:flex;align-items:center;justify-content:space-between;
  padding:14px 24px;border-bottom:1px solid var(--line);background:var(--panel);position:sticky;top:0;z-index:10;}
.logo{font-weight:800;font-size:1.25rem;letter-spacing:-.4px;display:flex;align-items:center;gap:10px;}
.logo .dot{padding:5px 8px;border-radius:8px;background:var(--brand);display:inline-flex;
  align-items:center;justify-content:center;color:#fff;font-size:.8rem;font-weight:800;letter-spacing:.5px;}
.logo .sub{font-weight:500;font-size:.92rem;color:var(--muted);margin-left:4px;}
.logo b{color:var(--brand);}
.topbar .right{display:flex;align-items:center;gap:14px;}
.account-pill{background:#fff;color:var(--ink);border:1px solid var(--line);
  border-radius:10px;padding:9px 14px;font-size:.92rem;display:flex;align-items:center;gap:8px;}
.account-pill .dot-status{width:8px;height:8px;border-radius:50%;background:var(--green);}
.account-pill.off .dot-status{background:var(--grey);}
.icon-btn{background:transparent;border:1px solid var(--line);border-radius:10px;
  width:38px;height:38px;cursor:pointer;font-size:1.05rem;display:flex;align-items:center;justify-content:center;}
.icon-btn:hover{background:var(--brand-soft);}

/* Bandeau permanent sur l'instance publique de démonstration */
.demo-banner{position:sticky;top:0;z-index:50;display:flex;align-items:center;gap:12px;
  flex-wrap:wrap;justify-content:center;text-align:center;
  background:linear-gradient(90deg,var(--brand),#ff8a5b);color:#fff;
  font-size:.9rem;font-weight:500;padding:9px 18px;box-shadow:0 2px 8px rgba(0,0,0,.12);}
.demo-banner b{font-weight:800;}
.demo-banner button{background:rgba(255,255,255,.22);border:1px solid rgba(255,255,255,.55);
  color:#fff;font-weight:700;font-size:.82rem;border-radius:8px;padding:5px 12px;cursor:pointer;}
.demo-banner button:hover{background:rgba(255,255,255,.34);}

/* Overlays d'authentification & console admin (portail multi-tenant) */
.panel.auth-panel{max-width:420px;}
.panel.admin-panel{max-width:760px;max-height:88vh;overflow:auto;}
#logoutBtn{color:var(--red);}
#acResult .note{margin-top:12px;}
#clientsList .pill{font-size:.68rem;background:var(--brand-soft);border:1px solid #ffd9c6;
  color:var(--brand);border-radius:999px;padding:1px 7px;margin-left:6px;}

/* Shell : barre latérale + contenu */
.shell{display:flex;align-items:flex-start;}
.sidebar{width:220px;flex-shrink:0;background:var(--panel);border-right:1px solid var(--line);
  padding:20px 12px;min-height:calc(100vh - 61px);position:sticky;top:61px;}
.sidebar button{display:block;width:100%;text-align:left;padding:10px 14px;border-radius:10px;
  border:none;background:transparent;cursor:pointer;font-size:.9rem;color:var(--ink);
  margin-bottom:3px;font-family:inherit;}
.sidebar button:hover{background:var(--bg);}
.sidebar button.active{background:var(--brand-soft);color:var(--brand);font-weight:700;}
.sidebar button.drop-hover{background:var(--brand);color:#fff;font-weight:700;
  box-shadow:0 0 0 2px var(--brand-soft);}

/* Sélecteur de compte — visible seulement à partir de 2 comptes connectés */
.account-switcher{margin-bottom:14px;padding-bottom:14px;border-bottom:1px solid var(--line);}
.account-switcher button{font-size:.8rem;}

.layout{flex:1;min-width:0;padding:28px 24px 60px;}

/* Hero stats */
.hero{display:flex;gap:16px;flex-wrap:wrap;margin-bottom:26px;}
.stat{flex:1;min-width:170px;background:var(--panel);
  border:1px solid var(--line);border-radius:16px;padding:18px 20px;box-shadow:0 1px 2px rgba(20,30,60,.04);}
.stat .k{font-size:1.9rem;font-weight:800;letter-spacing:-1px;color:var(--ink);}
.stat .l{color:var(--muted);font-size:.85rem;margin-top:2px;}
.stat.green .k{color:var(--green);}
.stat.red .k{color:var(--red);}
.stat.brand .k{color:var(--brand);}

/* Action bar */
.actionbar{display:flex;align-items:center;justify-content:space-between;gap:16px;
  background:var(--panel);border:1px solid var(--line);border-radius:16px;padding:18px 22px;margin-bottom:24px;flex-wrap:wrap;
  box-shadow:0 1px 2px rgba(20,30,60,.04);}
.actionbar .desc{color:var(--muted);font-size:.95rem;max-width:560px;}
.actionbar .desc b{color:var(--ink);}
.btn{background:var(--brand);color:#fff;border:none;border-radius:11px;padding:13px 24px;
  font-size:1rem;font-weight:700;cursor:pointer;transition:.18s;white-space:nowrap;
  box-shadow:0 6px 16px rgba(241,90,34,.28);}
.btn:hover{background:var(--brand-dark);transform:translateY(-1px);}
.btn:disabled{opacity:.5;cursor:not-allowed;transform:none;box-shadow:none;}
.btn.ghost{background:transparent;border:1px solid var(--line);color:var(--ink);box-shadow:none;}

/* Section titles */
h2{font-size:1.05rem;margin:30px 0 14px;display:flex;align-items:center;gap:10px;color:var(--ink);}
h2 .pill{font-size:.72rem;background:var(--brand-soft);border:1px solid #ffd9c6;color:var(--brand);
  padding:3px 9px;border-radius:999px;font-weight:700;}

/* Aperçu du mail original (iframe HTML) — commun à la vue détail */
.html-frame{width:100%;height:520px;border:none;display:block;background:#fff;}
.time{color:var(--grey);font-size:.8rem;}

.badge{font-size:.74rem;font-weight:700;padding:4px 10px;border-radius:999px;white-space:nowrap;}
.badge.cat{background:var(--brand-soft);color:var(--brand);border:1px solid #ffd9c6;}
.badge.followup{background:#fff4e0;color:#b45309;border:1px solid #f6d38a;}

/* ── Multi-comptes : sélecteur + formulaire IMAP ────────────────────── */
.acct-label{display:block;font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;
  color:var(--muted);margin-bottom:5px;}
.acct-select{width:100%;border:1px solid var(--line);border-radius:9px;padding:8px 10px;
  font-size:.88rem;font-family:inherit;background:#fff;color:var(--ink);cursor:pointer;}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:10px;}

/* ── Connexion assistée : cartes fournisseur + formulaire ───────────────── */
.provider-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;margin-bottom:16px;}
.provider-card{display:flex;align-items:center;gap:10px;padding:12px 14px;border:1px solid var(--line);
  border-radius:12px;background:var(--panel2);cursor:pointer;font-family:inherit;font-size:.9rem;
  font-weight:600;color:var(--ink);text-align:left;transition:border-color .12s,background .12s,box-shadow .12s;}
.provider-card:hover{border-color:#ffd0bb;background:#fffaf7;}
.provider-card.active{border-color:var(--brand);background:var(--brand-soft);color:var(--brand-dark);
  box-shadow:0 0 0 2px rgba(241,90,34,.16);}
.provider-ico{font-size:1.25rem;line-height:1;flex-shrink:0;}
.provider-name{min-width:0;overflow:hidden;text-overflow:ellipsis;}
.provider-card:disabled{opacity:.55;cursor:not-allowed;}
.provider-card:disabled:hover{border-color:var(--line);background:var(--panel2);}
.soon{font-size:.64rem;font-weight:700;color:var(--muted);background:var(--bg);
  border:1px solid var(--line);border-radius:999px;padding:1px 6px;margin-left:4px;white-space:nowrap;}

/* ── Calendrier : détection & ajout d'un rendez-vous (aperçu) ───────────── */
.rdv-block{margin-top:12px;display:flex;flex-direction:column;gap:10px;align-items:flex-start;}
.rdv-zone:empty{display:none;}
.rdv-loading{color:var(--muted);font-size:.85rem;display:flex;align-items:center;gap:8px;}
.rdv-none{font-size:.85rem;color:var(--muted);font-style:italic;}
.rdv-card{width:100%;background:var(--brand-soft);border:1px solid #ffd9c6;border-radius:11px;padding:13px 15px;}
.rdv-title{font-weight:800;font-size:.95rem;color:var(--brand-dark);margin-bottom:8px;}
.rdv-row{font-size:.85rem;color:var(--ink);margin-bottom:4px;}
.rdv-lbl{font-weight:700;color:var(--muted);margin-right:6px;}
.rdv-add{margin-top:10px;background:var(--brand);border-color:var(--brand);color:#fff;font-weight:700;}
.rdv-ok{margin-top:10px;font-size:.85rem;font-weight:700;color:var(--green);}

/* ── Intelligence : résumé du fil & fiche contact (aperçu) ─────────────── */
.intel-block{margin-top:10px;display:flex;flex-wrap:wrap;gap:8px;align-items:flex-start;}
.intel-zone{width:100%;}
.intel-zone:empty{display:none;}
.intel-card{margin-top:2px;}
.intel-text{font-size:.88rem;line-height:1.55;color:#5a3322;white-space:pre-line;}

.conn-form{border-top:1px dashed var(--line);padding-top:16px;margin-bottom:4px;}
.conn-help{background:var(--brand-soft);border:1px solid #ffd9c6;color:var(--brand-dark);
  border-radius:10px;padding:11px 14px;font-size:.8rem;line-height:1.6;margin-bottom:16px;}
.conn-help b{font-weight:800;}
.conn-servers{margin-bottom:6px;}
.conn-check{display:flex;align-items:center;gap:7px;font-size:.82rem;color:var(--muted);
  cursor:pointer;margin-bottom:16px;}

.prio{width:11px;height:11px;border-radius:50%;flex-shrink:0;}
.prio.haute{background:var(--red);box-shadow:0 0 0 4px rgba(230,57,70,.14);}
.prio.moyenne{background:var(--amber);box-shadow:0 0 0 4px rgba(246,166,9,.16);}
.prio.basse{background:var(--grey);}

.reason{margin-top:10px;font-size:.82rem;color:var(--muted);border-top:1px dashed var(--line);padding-top:9px;}
.reason b{color:var(--ink);}

/* Formulaire d'instruction avant rédaction */
.draft-form{margin-top:10px;display:flex;gap:8px;flex-wrap:wrap;align-items:center;}
.draft-form .draft-instruction{flex:1;min-width:220px;border:1px solid var(--line);border-radius:9px;
  padding:8px 11px;font-size:.86rem;font-family:inherit;}

/* Draft */
.draft{margin-top:12px;background:var(--brand-soft);border:1px solid #ffd9c6;border-radius:11px;padding:13px 15px;}
.draft .h{font-size:.78rem;color:var(--brand-dark);font-weight:800;margin-bottom:7px;display:flex;align-items:center;gap:6px;}
.ton-tabs{display:flex;gap:6px;margin-bottom:10px;flex-wrap:wrap;}
.ton-tab{font-size:.76rem;font-weight:700;padding:5px 13px;border-radius:999px;cursor:pointer;
  border:1px solid #ffd9c6;background:#fff;color:var(--brand-dark);transition:all .12s;}
.ton-tab:hover{background:#fff6f1;}
.ton-tab.active{background:var(--brand);border-color:var(--brand);color:#fff;}
.draft .txt{font-size:.9rem;line-height:1.55;white-space:pre-line;color:#5a3322;}
.draft textarea.txt{width:100%;border:1px solid #ffd9c6;border-radius:8px;padding:8px;
  font-family:inherit;background:#fff;resize:vertical;min-height:90px;}
.draft .acts{margin-top:11px;display:flex;gap:8px;}
.mini{font-size:.78rem;padding:6px 12px;border-radius:8px;border:1px solid var(--line);
  background:#fff;color:var(--ink);cursor:pointer;}
.mini.send{background:var(--green);border-color:var(--green);color:#fff;font-weight:700;}

/* processing */
.spin{display:inline-block;width:13px;height:13px;border:2px solid var(--line);
  border-top-color:var(--brand);border-radius:50%;animation:rot .7s linear infinite;}
@keyframes rot{to{transform:rotate(360deg);}}

.hidden{display:none;}
.fade-in{animation:fade .5s ease;}
@keyframes fade{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:none;}}

.footer{text-align:center;color:var(--grey);font-size:.82rem;margin-top:40px;}
.footer b{color:var(--brand);}
.note{background:var(--brand-soft);border:1px solid #ffd9c6;color:var(--brand-dark);
  border-radius:10px;padding:10px 14px;font-size:.82rem;margin-bottom:22px;}
.note.error{background:#fce8e6;border-color:#f5b5af;color:#c5221f;}

/* Settings overlay */
.overlay{position:fixed;inset:0;background:rgba(20,24,38,.45);display:flex;
  align-items:flex-start;justify-content:center;padding:40px 20px;overflow-y:auto;z-index:50;}
.overlay.hidden{display:none;}
.panel{background:#fff;border-radius:18px;max-width:560px;width:100%;padding:28px 30px;box-shadow:0 20px 60px rgba(0,0,0,.25);}
.panel h3{margin:0 0 4px;font-size:1.2rem;}
.panel .sub{color:var(--muted);font-size:.88rem;margin-bottom:20px;}
.field{margin-bottom:16px;}
.field label{display:block;font-size:.82rem;font-weight:700;color:var(--ink);margin-bottom:5px;}
.field input, .field textarea{width:100%;border:1px solid var(--line);border-radius:9px;
  padding:9px 11px;font-size:.92rem;font-family:inherit;}
.field textarea{min-height:70px;resize:vertical;}
.field .hint{font-size:.78rem;color:var(--muted);margin-top:4px;}
.section-title{font-size:.78rem;font-weight:800;color:var(--brand);text-transform:uppercase;
  letter-spacing:.06em;margin:22px 0 10px;}
.section-title:first-of-type{margin-top:0;}
.panel-acts{display:flex;justify-content:flex-end;gap:10px;margin-top:24px;}

/* ── Résumé du jour ─────────────────────────────────────────────────── */
.digest-panel{background:var(--panel);border:1px solid var(--line);border-radius:16px;
  padding:20px 22px;margin-bottom:24px;box-shadow:0 1px 2px rgba(20,30,60,.04);}
.digest-loading{color:var(--muted);font-size:.9rem;display:flex;align-items:center;gap:8px;}
.digest-err{color:var(--red);font-size:.9rem;}
.digest-head{font-size:1rem;font-weight:800;color:var(--ink);display:flex;align-items:center;gap:10px;}
.digest-count{font-size:.72rem;font-weight:700;background:var(--brand-soft);border:1px solid #ffd9c6;
  color:var(--brand);padding:3px 9px;border-radius:999px;}
.digest-synthese{margin:10px 0 16px;font-size:.92rem;line-height:1.55;color:var(--ink);}
.digest-items{display:flex;flex-direction:column;gap:10px;}
.digest-item{border:1px solid var(--line);border-left:3px solid var(--brand);border-radius:10px;
  padding:11px 14px;background:var(--panel2);}
.digest-item-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:3px;}
.digest-from{font-weight:700;font-size:.86rem;color:var(--ink);}
.digest-action{font-size:.72rem;font-weight:700;color:var(--brand-dark);background:var(--brand-soft);
  border-radius:999px;padding:2px 9px;white-space:nowrap;}
.digest-subject{font-size:.84rem;color:var(--muted);margin-bottom:4px;}
.digest-resume{font-size:.88rem;line-height:1.5;color:var(--ink);}
.digest-empty{color:var(--muted);font-size:.9rem;}
.digest-close{margin-top:14px;}

/* ── Vue 3 colonnes : liste (centre) + aperçu (droite) ──────────────── */
.mail-split{display:flex;gap:16px;align-items:stretch;}
#mailbox{width:380px;flex-shrink:0;display:flex;flex-direction:column;gap:8px;
  max-height:calc(100vh - 240px);overflow-y:auto;padding-right:4px;}
#mailDetail{flex:1;min-width:0;background:var(--panel);border:1px solid var(--line);
  border-radius:16px;padding:22px 24px;max-height:calc(100vh - 240px);overflow-y:auto;overflow-x:hidden;
  box-shadow:0 1px 2px rgba(20,30,60,.04);}

/* Item compact de la liste centrale */
.mail-item{position:relative;display:flex;gap:10px;background:var(--panel);
  border:1px solid var(--line);border-radius:12px;padding:12px 14px;cursor:pointer;
  transition:border-color .12s, background .12s;}
.mail-item:hover{border-color:#ffd0bb;background:#fffaf7;}
.mail-item.active{border-color:var(--brand);background:var(--brand-soft);}
.mail-item.scanning{border-color:var(--brand);}
.mail-item.dragging{opacity:.45;}
.mail-item[draggable="true"]{cursor:grab;}
.mail-item .mail-check{margin-top:2px;flex-shrink:0;cursor:pointer;width:16px;height:16px;}
.mail-item .mi-main{flex:1;min-width:0;}
.mail-item .mi-top{display:flex;justify-content:space-between;align-items:baseline;gap:8px;}
.mail-item .from{font-weight:600;font-size:.9rem;color:var(--ink);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.mail-item .subj{margin-top:2px;font-size:.92rem;color:var(--ink);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.mail-item .mi-snippet{margin-top:3px;font-size:.8rem;color:var(--muted);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.mail-item .meta-result{margin-top:7px;display:flex;align-items:center;gap:8px;}
.mail-item .meta-result:empty{display:none;}

/* Panneau d'aperçu à droite */
.detail-empty{color:var(--muted);font-size:.92rem;display:flex;align-items:center;
  justify-content:center;height:100%;min-height:220px;text-align:center;}
.detail-head{border-bottom:1px solid var(--line);padding-bottom:14px;margin-bottom:16px;}
.detail-subject{font-size:1.15rem;font-weight:800;color:var(--ink);line-height:1.35;}
.detail-meta{display:flex;align-items:center;gap:12px;margin-top:9px;}
.detail-meta .from{font-weight:600;font-size:.9rem;color:var(--ink);}
.detail-meta .time{margin-left:auto;}
.detail-meta .mail-delete{width:30px;height:30px;font-size:.9rem;border-radius:8px;}
.detail-badges{margin-top:11px;display:flex;align-items:center;gap:8px;}
.detail-badges:empty{display:none;}
.detail-body{font-size:.92rem;line-height:1.6;color:var(--ink);
  margin-top:16px;border-top:1px solid var(--line);padding-top:16px;}
.detail-body .body-text{white-space:pre-wrap;word-wrap:break-word;}
.mail-render{margin-top:2px;border:1px solid var(--line);border-radius:12px;background:#fff;overflow:hidden;}
.mail-loading{color:var(--muted);font-size:.9rem;display:flex;align-items:center;gap:8px;padding:18px 0;}
/* La hauteur est fixée dynamiquement en JS (= hauteur du mail) pour éviter la
   barre de défilement interne à l'iframe. */
.mail-render .html-frame{width:100%;min-height:300px;border:none;background:#fff;display:block;}
.mail-render .note{margin:10px 14px;}

/* ── Règles de rangement automatique (Réglages) ────────────────────── */
.hint{font-size:.78rem;color:var(--muted);margin:2px 0 10px;}
.rules-list{display:flex;flex-direction:column;gap:8px;margin-bottom:12px;}
.rules-empty{font-size:.85rem;color:var(--muted);font-style:italic;}
.rule-item{display:flex;align-items:center;justify-content:space-between;gap:10px;
  border:1px solid var(--line);border-radius:10px;padding:9px 12px;background:var(--panel2);}
.rule-desc{font-size:.85rem;color:var(--ink);}
.rule-tag{font-size:.68rem;font-weight:700;color:var(--brand-dark);background:var(--brand-soft);
  border:1px solid #ffd9c6;border-radius:999px;padding:1px 7px;margin-left:4px;}
.rule-form{display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
.rule-form #rulePattern{flex:1;min-width:200px;border:1px solid var(--line);border-radius:9px;
  padding:8px 11px;font-size:.86rem;font-family:inherit;}
.rule-form #ruleCategorie{border:1px solid var(--line);border-radius:9px;padding:8px 10px;
  font-size:.86rem;font-family:inherit;background:#fff;}
.rule-check{display:flex;align-items:center;gap:6px;font-size:.82rem;color:var(--muted);cursor:pointer;white-space:nowrap;}

/* ── Pièces jointes (aperçu) ────────────────────────────────────────── */
.attachments{margin-top:16px;border-top:1px solid var(--line);padding-top:14px;
  display:flex;flex-direction:column;gap:8px;}
.att-title{font-size:.82rem;font-weight:700;color:var(--ink);}
.att-item{display:flex;align-items:center;gap:10px;width:100%;text-align:left;cursor:pointer;
  border:1px solid var(--line);border-radius:10px;padding:9px 12px;background:var(--panel2);
  font-family:inherit;font-size:.86rem;color:var(--ink);transition:border-color .12s,background .12s;}
.att-item:hover{border-color:var(--brand);background:var(--brand-soft);}
.att-item:disabled{opacity:.7;cursor:default;}
.att-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600;}
.att-size{color:var(--muted);font-size:.78rem;white-space:nowrap;}
.att-dl{color:var(--brand-dark);font-size:.78rem;font-weight:700;white-space:nowrap;}

/* ── Auto-pilote : revue des réponses groupées ─────────────────────── */
.ap-hint{font-size:.82rem;color:var(--muted);margin:6px 0 14px;line-height:1.5;}
.ap-list{display:flex;flex-direction:column;gap:12px;}
.ap-item{border:1px solid var(--line);border-left:3px solid var(--brand);border-radius:10px;
  padding:12px 14px;background:var(--panel2);transition:opacity .18s;}
.ap-item.ap-sent{opacity:.55;border-left-color:var(--green);}
.ap-item-head{display:flex;align-items:center;gap:12px;margin-bottom:9px;}
.ap-check{display:flex;align-items:center;gap:6px;font-size:.8rem;font-weight:700;
  color:var(--brand-dark);cursor:pointer;white-space:nowrap;flex-shrink:0;}
.ap-check input{cursor:pointer;width:16px;height:16px;}
.ap-meta{display:flex;flex-direction:column;min-width:0;flex:1;}
.ap-from{font-weight:700;font-size:.86rem;color:var(--ink);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.ap-subject{font-size:.8rem;color:var(--muted);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.ap-status{font-size:.76rem;font-weight:700;white-space:nowrap;flex-shrink:0;}
.ap-status.ok{color:var(--green);}
.ap-status.err{color:var(--red);}
.ap-draft{width:100%;border:1px solid var(--line);border-radius:9px;padding:9px 11px;
  font-size:.88rem;font-family:inherit;line-height:1.55;background:#fff;color:var(--ink);
  resize:vertical;min-height:110px;}
.ap-draft:disabled{background:var(--panel2);color:var(--muted);cursor:not-allowed;}
.ap-acts{display:flex;gap:10px;margin-top:16px;align-items:center;flex-wrap:wrap;}
#apFootNote{margin-top:14px;}
#apFootNote .note{margin-bottom:0;}

.att-ico{font-size:1.05rem;line-height:1;}
.att-acts{display:flex;gap:6px;flex-shrink:0;}
.att-btn{border:1px solid var(--line);background:var(--panel);border-radius:8px;padding:4px 9px;
  font-family:inherit;font-size:.76rem;font-weight:700;color:var(--brand-dark);cursor:pointer;
  white-space:nowrap;transition:background .12s,border-color .12s;}
.att-btn:hover{background:var(--brand);border-color:var(--brand);color:#fff;}

/* ── Visionneuse de pièce jointe ────────────────────────────────────── */
.att-panel{max-width:1020px;width:min(1020px,94vw);display:flex;flex-direction:column;max-height:90vh;}
.att-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;
  padding-bottom:12px;border-bottom:1px solid var(--line);}
.att-head h3{margin:0 0 2px;overflow-wrap:anywhere;}
.att-head-acts{display:flex;gap:8px;flex-shrink:0;}
.att-body{flex:1;min-height:0;overflow:auto;padding-top:14px;}
.att-loading{color:var(--muted);font-size:.88rem;padding:28px;text-align:center;}
.att-none{color:var(--muted);font-size:.88rem;padding:26px;text-align:center;
  background:var(--panel2);border:1px dashed var(--line);border-radius:10px;}
.att-fallback{margin-top:10px;font-size:.78rem;color:var(--muted);}
.att-image{max-width:100%;height:auto;display:block;margin:0 auto;border-radius:8px;}
.att-pdf{width:100%;height:70vh;border:1px solid var(--line);border-radius:8px;background:#fff;}
.att-text{margin:0;padding:14px;background:var(--panel2);border:1px solid var(--line);border-radius:8px;
  font-size:.82rem;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;}
.att-doc{padding:4px 2px;line-height:1.6;}
.att-doc .att-h1{font-size:1.15rem;font-weight:800;margin:18px 0 8px;}
.att-doc .att-h2{font-size:1rem;font-weight:700;margin:16px 0 6px;}
.att-doc .att-h3{font-size:.92rem;font-weight:700;margin:14px 0 5px;color:var(--muted);}
.att-doc .att-p{margin:0 0 9px;font-size:.88rem;}
.att-doc .att-li{margin:0 0 6px 12px;font-size:.88rem;}
.att-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px;}
.att-tab{border:1px solid var(--line);background:var(--panel2);border-radius:8px;padding:5px 11px;
  font-family:inherit;font-size:.78rem;font-weight:600;color:var(--muted);cursor:pointer;}
.att-tab.on{background:var(--brand);border-color:var(--brand);color:#fff;}
.att-table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:8px;}
.att-table{border-collapse:collapse;width:100%;font-size:.8rem;}
.att-table th,.att-table td{border-bottom:1px solid var(--line);border-right:1px solid var(--line);
  padding:6px 10px;text-align:left;white-space:nowrap;max-width:320px;overflow:hidden;text-overflow:ellipsis;}
.att-table th{background:var(--brand-soft);font-weight:700;position:sticky;top:0;}
.att-table tr:nth-child(even) td{background:var(--panel2);}

/* ── Pièces jointes en rédaction ────────────────────────────────────── */
.dropzone{display:flex;align-items:center;gap:12px;flex-wrap:wrap;
  border:1px dashed var(--line);border-radius:10px;padding:12px 14px;background:var(--panel2);
  transition:border-color .12s,background .12s;}
.dropzone.over{border-color:var(--brand);background:var(--brand-soft);}
.dropzone-hint{font-size:.78rem;color:var(--muted);}
.att-picked{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px;}
.att-chip{display:inline-flex;align-items:center;gap:7px;background:var(--panel2);
  border:1px solid var(--line);border-radius:20px;padding:5px 8px 5px 11px;font-size:.79rem;max-width:100%;}
.att-chip-name{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:220px;}
.att-chip-size{color:var(--muted);font-size:.73rem;}
.att-chip-x{border:none;background:none;cursor:pointer;color:var(--muted);font-size:.85rem;
  padding:0 2px;line-height:1;}
.att-chip-x:hover{color:var(--red);}
.att-chip-total{width:100%;font-size:.74rem;color:var(--muted);}


/* Pièces jointes attachées à une réponse (individuelle ou auto-pilote) */
.draft-atts,.ap-atts{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;}
.ap-item-acts{margin-top:8px;}

/* ═══════════════════════ THÈME SOMBRE (bouton 🌙 dans l'en-tête) ═══════════════════════
   Activé par [data-theme="dark"] sur <html>. Reprend le « dark premium » de la préversion.
   NB : l'aperçu HTML d'un vrai email (.html-frame / .mail-render) reste volontairement sur
   fond BLANC (les emails sont conçus pour un fond clair) ; le texte des mails de la démo
   (.detail-body) utilise var(--ink) et bascule donc automatiquement, en restant lisible. */
:root[data-theme="dark"]{
  color-scheme:dark;
  --brand-dark:#ff8f5e;
  --brand-soft:rgba(241,90,34,.13);
  --brand-line:rgba(241,90,34,.34);
  --ink:#e6edf3;
  --muted:#8b949e;
  --bg:#0e1116;
  --panel:#171b22;
  --panel2:#1e232c;
  --line:#2a313c;
  --red:#ff6b74; --amber:#f2ac2f; --green:#2ecf8f; --grey:#6b7280;
  --sh-1:0 1px 2px rgba(0,0,0,.4);
  --sh-2:0 6px 18px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.35);
  --sh-3:0 24px 60px rgba(0,0,0,.6), 0 6px 18px rgba(0,0,0,.4);
  --sh-brand:0 8px 22px rgba(241,90,34,.38);
}
:root[data-theme="dark"] body{
  accent-color:var(--brand);
  background-image:
    radial-gradient(1200px 620px at 88% -8%, rgba(241,90,34,.10), transparent 60%),
    radial-gradient(1000px 560px at 4% 4%, rgba(90,140,255,.05), transparent 55%);
  background-attachment:fixed;
}
/* Champs de saisie : fond sombre lisible (remplace les #fff en dur) */
:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .ap-draft,
:root[data-theme="dark"] .draft textarea.txt{background:#12161d;color:var(--ink);border-color:var(--line);}
:root[data-theme="dark"] input::placeholder,:root[data-theme="dark"] textarea::placeholder{color:var(--muted);opacity:.85;}
:root[data-theme="dark"] input:focus,:root[data-theme="dark"] textarea:focus,:root[data-theme="dark"] select:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px rgba(241,90,34,.22);}
/* Scrollbars sombres */
:root[data-theme="dark"] *{scrollbar-width:thin;scrollbar-color:#39414e transparent;}
:root[data-theme="dark"] ::-webkit-scrollbar{width:11px;height:11px;}
:root[data-theme="dark"] ::-webkit-scrollbar-track{background:transparent;}
:root[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#333b47;border-radius:999px;border:2px solid transparent;background-clip:padding-box;}
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover{background:#414b5a;background-clip:padding-box;}
/* En-tête verre dépoli */
:root[data-theme="dark"] .topbar{background:rgba(18,21,28,.72);-webkit-backdrop-filter:blur(16px) saturate(150%);backdrop-filter:blur(16px) saturate(150%);}
:root[data-theme="dark"] .logo .dot{background:linear-gradient(135deg,#ff8a56,var(--brand));box-shadow:0 4px 12px rgba(241,90,34,.45), inset 0 1px 0 rgba(255,255,255,.25);}
:root[data-theme="dark"] .account-pill{background:rgba(255,255,255,.04);}
:root[data-theme="dark"] .account-pill .dot-status{box-shadow:0 0 0 3px rgba(46,207,143,.18);}
:root[data-theme="dark"] .icon-btn{background:rgba(255,255,255,.03);color:var(--ink);}
:root[data-theme="dark"] .icon-btn:hover{background:var(--brand-soft);border-color:var(--brand-line);color:var(--brand-dark);}
/* Barre latérale */
:root[data-theme="dark"] .sidebar{background:linear-gradient(180deg,#161a21,#12151b);}
:root[data-theme="dark"] .sidebar button{color:var(--muted);}
:root[data-theme="dark"] .sidebar button:hover{background:rgba(255,255,255,.04);color:var(--ink);}
:root[data-theme="dark"] .sidebar button.active{background:var(--brand-soft);color:var(--brand-dark);box-shadow:inset 3px 0 0 0 var(--brand);}
/* Cartes & panneaux (dégradé + profondeur) */
:root[data-theme="dark"] .stat{background:linear-gradient(180deg,var(--panel),#141821);box-shadow:var(--sh-2);}
:root[data-theme="dark"] .stat:hover{box-shadow:var(--sh-3);border-color:#333c49;}
:root[data-theme="dark"] .actionbar,
:root[data-theme="dark"] .digest-panel,
:root[data-theme="dark"] #mailDetail{background:linear-gradient(180deg,var(--panel),#141821);box-shadow:var(--sh-2);}
:root[data-theme="dark"] .panel{background:var(--panel);border:1px solid var(--line);box-shadow:var(--sh-3);color:var(--ink);}
:root[data-theme="dark"] .panel h3{color:var(--ink);}
:root[data-theme="dark"] .overlay{background:rgba(4,7,11,.66);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);}
/* Boutons */
:root[data-theme="dark"] .btn{background:linear-gradient(135deg,#ff7a45,var(--brand));box-shadow:var(--sh-brand), inset 0 1px 0 rgba(255,255,255,.18);}
:root[data-theme="dark"] .btn:hover{background:linear-gradient(135deg,#ff8a56,#f4501a);}
:root[data-theme="dark"] .btn.ghost{background:rgba(255,255,255,.03);}
:root[data-theme="dark"] .btn.ghost:hover{background:var(--brand-soft);border-color:var(--brand-line);color:var(--brand-dark);}
/* Pastilles / badges orange : bordure & texte adoucis pour le sombre */
:root[data-theme="dark"] #clientsList .pill,
:root[data-theme="dark"] h2 .pill,
:root[data-theme="dark"] .badge.cat,
:root[data-theme="dark"] .conn-help,
:root[data-theme="dark"] .rdv-card,
:root[data-theme="dark"] .draft,
:root[data-theme="dark"] .note,
:root[data-theme="dark"] .digest-count{border-color:var(--brand-line);}
:root[data-theme="dark"] #clientsList .pill,
:root[data-theme="dark"] h2 .pill,
:root[data-theme="dark"] .badge.cat,
:root[data-theme="dark"] .digest-count,
:root[data-theme="dark"] .section-title{color:var(--brand-dark);}
:root[data-theme="dark"] .badge.followup{background:rgba(242,172,47,.15);color:#f0b64c;border-color:rgba(242,172,47,.4);}
/* Onglets de ton & textes de brouillon / intelligence (lisibilité) */
:root[data-theme="dark"] .ton-tab{border-color:var(--brand-line);background:rgba(255,255,255,.03);color:var(--brand-dark);}
:root[data-theme="dark"] .ton-tab:hover{background:var(--brand-soft);}
:root[data-theme="dark"] .ton-tab.active{background:linear-gradient(135deg,#ff7a45,var(--brand));border-color:var(--brand);color:#fff;}
:root[data-theme="dark"] .draft .txt,
:root[data-theme="dark"] .intel-text{color:#eadccf;}
/* États / priorités / notes */
:root[data-theme="dark"] .note.error{background:rgba(255,107,116,.12);border-color:rgba(255,107,116,.42);color:#ff9ea3;}
:root[data-theme="dark"] .prio.haute{box-shadow:0 0 0 4px rgba(255,107,116,.18);}
:root[data-theme="dark"] .prio.moyenne{box-shadow:0 0 0 4px rgba(242,172,47,.2);}
:root[data-theme="dark"] .prio.basse{box-shadow:0 0 0 4px rgba(107,114,128,.16);}
/* Liste de mails & actions */
:root[data-theme="dark"] .mail-item:hover{border-color:#39414e;background:#1c212a;box-shadow:var(--sh-1);}
:root[data-theme="dark"] .mail-item.active{border-color:var(--brand-line);background:var(--brand-soft);box-shadow:inset 3px 0 0 0 var(--brand);}
:root[data-theme="dark"] .mini{background:rgba(255,255,255,.04);}
:root[data-theme="dark"] .mini:hover{background:rgba(255,255,255,.08);border-color:#3a4552;}
:root[data-theme="dark"] .provider-card:hover{border-color:var(--brand-line);background:#242a34;}
:root[data-theme="dark"] .att-item:hover{border-color:var(--brand-line);background:var(--brand-soft);}
/* Corps du mail : en démo c'est du texte injecté dans .mail-render → on passe le
   conteneur en sombre pour que le texte (var(--ink), clair) reste lisible.
   Un vrai email HTML garde son fond blanc via l'iframe .html-frame (non surchargée). */
:root[data-theme="dark"] .mail-render{background:#12161d;}
:root[data-theme="dark"] .mail-render .body-text{color:var(--ink);}
