/* ============================================================
   JARVIS APP — charte Webmarketing Oisans
   Identité reprise du site webmarketing-oisans.fr :
   fond bleu-nuit, accent violet électrique #7A3CFF, surfaces vitrées.
   ============================================================ */

:root {
  --bg:        #070B14;            /* fond le plus profond (≈ footer site rgb(6,10,20)) */
  --bg-2:      #0E1322;            /* fond secondaire (≈ verre site rgb(15,18,30)) */
  --surface:   #141A2B;            /* cartes / panneaux */
  --surface-2: #1E2640;            /* survol / état actif */
  --line:      rgba(255,255,255,.12); /* bordures discrètes (site --glass-border) */
  --accent:    #7A3CFF;            /* accent PRINCIPAL — violet électrique WMO */
  --accent-2:  #9A6BFF;            /* variante plus claire (≈ site --accent-hover) */
  --blue:      #6BA8FF;            /* accent secondaire */
  --yellow:    #F5C451;            /* accent secondaire (repère « patron ») */
  --text:      #E9F0FF;            /* texte principal (site --text) */
  --muted:     #B9C2D0;            /* texte atténué (site --muted) */
  --danger:    #FF5D7A;            /* erreurs / suppression */
  --radius:    14px;
  --rail-w:    62px;
  /* Police unique du site : Inter (corps ET titres, via le poids). */
  --ff: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fd: var(--ff);                 /* display = Inter 700/800 */
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--ff);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124,92,203,.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(107,168,255,.10), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Boutons ---------- */
.btn {
  font: 600 14px/1 var(--ff);
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent-2); }
.btn--primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border: none; color: #fff;
  box-shadow: 0 8px 24px rgba(122,60,255,.28);
}
.btn--primary:hover { filter: brightness(1.08); box-shadow: 0 10px 28px rgba(122,60,255,.38); }
.btn--accent { border-color: var(--accent); color: var(--accent); }
.btn--accent:hover { background: rgba(122,60,255,.14); }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: rgba(255,93,122,.14); border-color: var(--danger); }

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 20px;
}
.login__card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login__logo, .rail__logo {
  display: block;
  width: 42px; height: 42px;
  object-fit: contain; padding: 5px;
  background: var(--bg-2); border-radius: 11px; border: 1px solid var(--line);
}
.login__brand strong { font: 700 18px var(--fd); display: block; }
.login__brand small { color: var(--muted); font-size: 12px; }
.login__err { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ---------- Champs ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .search, .stripe-form input {
  width: 100%; font: 400 14px var(--ff); color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px;
}
.field input:focus, .field textarea:focus, .search:focus, .stripe-form input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,60,255,.22);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.rail {
  width: var(--rail-w); flex-shrink: 0;
  background: var(--bg-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 0; gap: 8px;
  position: sticky; top: 0; height: 100vh;
}
.rail__brand { margin-bottom: 12px; }
.rail__nav { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.rail__btn {
  width: 44px; height: 44px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent;
  color: var(--muted); font-size: 18px; cursor: pointer; transition: .15s;
}
.rail__btn:hover { background: var(--surface); }
.rail__btn.is-active {
  background: rgba(52,194,254,.10); border-color: rgba(52,194,254,.45);
}
.rail__ic { line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

/* ---- Icônes de navigation : néon futuriste #34C2FE ---- */
/* Toutes les icônes de la barre ont la MÊME taille (SVG 24×24) — l'icône
   Mails ne peut plus être plus petite (ancien glyphe ✉ remplacé par un SVG). */
.nav-icon {
  width: 24px; height: 24px; display: block;
  color: #34C2FE; stroke: #34C2FE; fill: none;
  /* Néon volontairement discret : 2 couches, rayons + opacités réduits */
  filter:
    drop-shadow(0 0 3px rgba(52,194,254,.55))
    drop-shadow(0 0 7px rgba(52,194,254,.22));
  transition: filter .25s ease;
}
/* Item actif : un peu plus marqué que les inactifs, mais adouci */
.rail__btn.is-active .nav-icon {
  filter:
    drop-shadow(0 0 4px rgba(52,194,254,.7))
    drop-shadow(0 0 9px rgba(52,194,254,.35));
}
.rail__label { display: none; color: #34C2FE; text-shadow: 0 0 4px rgba(52,194,254,.3); } /* desktop : rail à icônes seules */
.rail__btn--more { display: flex; }             /* « + » visible sur desktop ET mobile */
.rail__btn--logout { color: var(--muted); }
.rail__btn--logout:hover { color: var(--danger); }

.main { flex: 1; padding: 28px clamp(18px, 4vw, 44px); max-width: 1200px; }

/* ---------- Vues ---------- */
.view { display: none; animation: fade .25s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.view__head h1 { font: 700 26px var(--fd); letter-spacing: -.01em; }
.view__sub { color: var(--muted); font-size: 13px; }

/* ---------- Cartes KPI ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.card--accent {
  background: linear-gradient(135deg, rgba(122,60,255,.32), rgba(154,107,255,.10));
  border-color: var(--accent-2);
}
.card__k { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.card__v { font: 700 30px var(--fd); }

/* ---------- Panneaux & listes ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px;
}
.panel__title { font: 600 14px var(--ff); color: var(--muted); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .04em; }
.list { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; transition: .12s;
}
.row:hover { background: var(--bg-2); }
.row__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.row__main { flex: 1; min-width: 0; }
.row__title { font-size: 14px; font-weight: 500; }
.row__meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__time { font: 600 13px var(--fd); color: var(--accent); white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; padding: 14px 12px; }

/* ---------- Table prospects ---------- */
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
/* L'attribut [hidden] doit l'emporter sur le display:flex ci-dessus (sinon le
   bouton « ← Retour » reste visible sur la liste). */
.head-actions[hidden] { display: none; }
.search { max-width: 260px; }
.table { display: flex; flex-direction: column; gap: 2px; }
.trow {
  display: grid; grid-template-columns: 1.4fr 1.4fr 1fr auto;
  gap: 12px; align-items: center;
  padding: 13px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: .12s;
}
.trow:hover { border-color: var(--accent-2); background: var(--surface-2); }
.trow__name { font-weight: 600; font-size: 14px; }
.trow__sub { font-size: 12px; color: var(--muted); }
.badge {
  font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 20px;
  background: rgba(122,60,255,.16); color: var(--accent); justify-self: start;
}
.badge--client { background: rgba(107,168,255,.14); color: var(--blue); }
.badge--perdu  { background: rgba(255,93,122,.14); color: var(--danger); }
.badge--relance { background: rgba(245,196,81,.16); color: var(--yellow); }

/* ---------- Rapprochement Qonto (Finances · Module B) ---------- */
.rappro {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rappro__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rappro__amount { font: 800 18px var(--fd); color: var(--accent-2); }
.rappro__label { font-size: 14px; color: var(--text); }
.rappro__fac { font-size: 13px; color: var(--muted); }
.rappro__fac strong { color: var(--text); }
.rappro__fac .rappro-fac { margin-top: 6px; width: 100%; }
.rappro__check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.rappro__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.rappro__actions .btn { padding: 8px 14px; }
.rappro .btn:disabled { opacity: .5; cursor: default; }

/* ---------- Partager mon RIB (carte Comptes Qonto) ---------- */
.rib-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.rib-actions .btn { flex: 1; min-width: 140px; }

/* Message de la modale de confirmation */
.confirm-msg { font-size: 14px; line-height: 1.55; color: var(--text); margin: 6px 0 4px; }

/* ---------- Vue vCard (carte de visite) ---------- */
.vcard-panel { display: flex; flex-direction: column; align-items: stretch; text-align: center; gap: 14px; }
/* QR pleine largeur du cadre : ratio carré conservé + zone blanche (quiet zone) généreuse pour rester scannable. */
.vcard-qr {
  width: 100%; height: auto; aspect-ratio: 1 / 1; display: block;
  object-fit: contain; border-radius: 16px; background: #fff; padding: 18px;
  box-shadow: 0 14px 34px -10px rgba(0,0,0,.55); border: 1px solid var(--line);
}
.vcard-link { font-weight: 600; font-size: 14px; color: var(--accent); text-decoration: none; word-break: break-all; }
.vcard-link:hover { text-decoration: underline; }
.vcard-hint { font-size: 13px; color: var(--muted); max-width: 42ch; line-height: 1.5; margin-inline: auto; }
/* Boutons empilés verticalement, chacun pleine largeur (Envoyer en premier). */
.vcard-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.vcard-actions .btn { width: 100%; }

/* ---------- Conversations : fil de discussion (bulles de chat) ---------- */
.conv-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.conv-toolbar__title {
  flex: 1; min-width: 120px; text-align: center;
  font: 700 16px var(--fd);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-chat { display: flex; flex-direction: column; gap: 8px; }
.conv-day {
  align-self: center; margin: 10px 0 4px;
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.conv-bubble {
  max-width: 78%; padding: 9px 13px;
  border-radius: 14px; border: 1px solid var(--line);
}
.conv-bubble__txt { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.conv-bubble__time { font-size: 10px; color: var(--muted); margin-top: 4px; text-align: right; }
/* Entrant (client) à gauche · sortant (Jarvis) à droite, en accent WMO */
.conv-bubble--in  { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 4px; }
.conv-bubble--out {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(122,60,255,.30), rgba(154,107,255,.14));
  border-color: var(--accent-2); border-bottom-right-radius: 4px;
}

/* ---------- Finances ---------- */
.stripe-form { display: flex; gap: 12px; flex-wrap: wrap; }
.stripe-form input { flex: 1; min-width: 140px; }
.stripe-result {
  margin-top: 14px; padding: 14px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid var(--accent-2);
  font-size: 14px; word-break: break-all;
}
.stripe-result a { color: var(--accent); }

/* ---------- Modales ---------- */
.modal {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  padding: 0; width: min(460px, 92vw);
}
.modal::backdrop { background: rgba(8,4,14,.66); backdrop-filter: blur(3px); }
.modal__form { padding: 24px; }
.modal__form h3 { font: 700 19px var(--fd); margin-bottom: 18px; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.btn--wa { border-color: #25D366; color: #25D366; text-decoration: none; }
.btn--wa:hover { background: rgba(37,211,102,.14); border-color: #25D366; }
.row--click { cursor: pointer; }
.fiche { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; margin-bottom: 6px; }
.fiche dt { color: var(--muted); }
.feedback { margin-top: 12px; font-size: 13px; color: var(--accent); }

/* ---------- Tiroir d'applications (accès secondaires) ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer[hidden] { display: none; }
.drawer__overlay { position: absolute; inset: 0; background: rgba(8,4,14,.6); backdrop-filter: blur(2px); }
.drawer__sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -20px 50px rgba(0,0,0,.5);
  animation: drawerUp .22s ease;
}
@keyframes drawerUp { from { transform: translateY(100%); } to { transform: none; } }
.drawer__handle { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 2px auto 14px; }
.drawer__title { font: 600 12px var(--ff); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 12px; }
.drawer__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 18px 8px; min-height: 92px;
  border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; transition: .12s; font: inherit;
}
.tile:hover { border-color: var(--accent-2); background: var(--surface-2); }
.tile:active { transform: scale(.96); }
.tile__ic { font-size: 26px; line-height: 1; }
.tile__lbl { font-size: 12px; font-weight: 600; }
.tile__badge {
  position: absolute; top: 6px; right: 6px;
  font: 700 9px var(--ff); padding: 2px 6px; border-radius: 20px;
  background: rgba(245,196,81,.18); color: var(--yellow);
}
.tile--soon { opacity: .9; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--accent-2);
  color: var(--text); padding: 12px 20px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 16px 40px rgba(0,0,0,.5); z-index: 50;
}

/* ---------- FullCalendar (thème sombre) ---------- */
#calendar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.fc { --fc-border-color: var(--line); --fc-page-bg-color: transparent; --fc-neutral-bg-color: var(--bg-2);
      --fc-today-bg-color: rgba(122,60,255,.10); color: var(--text); }
.fc .fc-button-primary { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.fc .fc-button-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--accent-2); border-color: var(--accent); }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--muted); text-decoration: none; }
.fc .fc-toolbar-title { font: 700 18px var(--fd); }
.fc-event { border: none; background: var(--accent-2); padding: 1px 4px; font-size: 12px; cursor: pointer; }

/* ---------- Mobile ---------- */
@media (max-width: 767.98px) {
  /* Navigation : barre horizontale fixée en BAS de l'écran */
  .rail { flex-direction: row; width: 100%; height: auto;
          position: fixed; left: 0; right: 0; bottom: 0; top: auto;
          z-index: 30; padding: 6px 4px;
          padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
          border-right: none; border-top: 1px solid var(--line);
          background: var(--bg-2); }
  .rail__brand { display: none; }                  /* le logo libère la place pour les icônes */
  .rail__nav { flex-direction: row; flex: 1; justify-content: space-around; gap: 6px; }
  /* 6 items au lieu de 8 + glow : on aère davantage chaque entrée */
  .rail__btn { flex: 1; width: auto; height: auto; flex-direction: column; gap: 4px;
               padding: 7px 4px; border-radius: 12px; }
  .rail__label { display: block; font-size: 10px; font-weight: 600; line-height: 1; }
  .rail__btn--more { display: flex; }              /* bouton « + » visible en mobile */
  #logoutBtn { display: none; }                    /* déconnexion déplacée dans le tiroir */
  .app { flex-direction: column; }
  /* padding-bottom : éviter que la barre du bas ne masque le contenu */
  .main { padding: 18px; padding-bottom: 92px; }
  .trow { grid-template-columns: 1fr auto; }
  .trow__col--hide { display: none; }

  /* ---- Calendrier : toolbar empilée (3a) ---- */
  #calendar { padding: 10px; }
  .fc .fc-toolbar.fc-header-toolbar {
    flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 12px;
  }
  .fc .fc-toolbar-chunk { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
  .fc .fc-toolbar-title { font-size: 16px; text-align: center; }
  .fc .fc-button { padding: 5px 9px; font-size: 13px; }

  /* ---- Vue semaine lisible (3b) ---- */
  .fc .fc-col-header-cell-cushion { font-size: 11px; padding: 2px 1px; white-space: nowrap; }
  .fc .fc-timegrid-axis-cushion,
  .fc .fc-timegrid-slot-label-cushion { font-size: 10px; }
  .fc-event { font-size: 11px; }
}

/* ---------- Bilan URSSAF ---------- */
.bilan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bilan-head .panel__title { margin: 0; }
.bilan-note { color: var(--muted); font-size: 12px; margin-top: 10px; font-style: italic; }

/* ---------- Bouton notifications push ---------- */
.push-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.btn.is-on { border-color: var(--accent); color: var(--accent); background: rgba(122,60,255,.12); }

/* ---------- Badge mails (barre latérale) ---------- */
.rail__btn--mails { position: relative; }
.rail__badge {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff;
  font: 700 10px/16px var(--ff); text-align: center;
}

/* ---------- Mails : barre d'outils ---------- */
.mail-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.mail-tb-actions { display: flex; gap: 8px; }

/* ---------- Mails : liste ---------- */
/* Conteneur de swipe : révèle un fond d'action coloré derrière la ligne. */
.mail-swipe { position: relative; overflow: hidden; border-radius: 10px; margin-bottom: 6px; }
.mail-swipe .mail-item { margin-bottom: 0; position: relative; z-index: 1; will-change: transform; touch-action: pan-y; }
.mail-swipe__act {
  position: absolute; inset: 0; display: flex; align-items: center;
  padding: 0 24px; opacity: 0; pointer-events: none; transition: opacity .12s ease;
}
.mail-swipe__act .swipe-ic { width: 26px; height: 26px; transition: transform .14s ease; }
/* GAUCHE (glisser vers la gauche → bord droit révélé) = LU, vert */
.mail-swipe__act--read   { justify-content: flex-end;   background: #2ecc71; color: #fff; }
/* DROITE (glisser vers la droite → bord gauche révélé) = NON LU, bleu néon */
.mail-swipe__act--unread { justify-content: flex-start; background: #34C2FE; color: #fff; }
.mail-swipe__act--unread .swipe-ic { filter: drop-shadow(0 0 5px rgba(52,194,254,.45)); }
/* Passage du seuil 40 % : l'icône « pulse » pour signaler le déclenchement */
.mail-swipe.is-armed .mail-swipe__act .swipe-ic { transform: scale(1.28); }
/* Retour élastique / snap après relâchement (transform animé seulement à ce moment) */
.mail-swipe .mail-item.is-snapping { transition: transform .22s cubic-bezier(.22,.61,.36,1); }

.mail-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  margin-bottom: 6px; cursor: pointer; transition: background-color .12s, border-color .12s;
}
.mail-item:hover { border-color: var(--accent-2); background: var(--surface-2); }
.mail-dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; flex-shrink: 0; }
.mail-unread .mail-dot { background: var(--accent); }
.mail-unread .mail-from, .mail-unread .mail-subject { font-weight: 700; }
.mail-main { flex: 1; min-width: 0; }
.mail-row1 { display: flex; justify-content: space-between; gap: 10px; }
.mail-from { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mail-subject { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-flag { color: var(--accent); font-size: 14px; }

/* ---------- Mails : lecture ---------- */
.mail-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.mail-h-subj { font: 700 18px var(--fd); margin-bottom: 8px; }
.mail-h-line { font-size: 13px; color: var(--muted); }
.mail-h-lbl { color: var(--muted); }
.mail-h-date { font-size: 12px; color: var(--muted); margin-top: 6px; }
.mail-body { font-size: 14px; line-height: 1.6; word-wrap: break-word; overflow-wrap: anywhere; }
.mail-body--html {
  background: #fff; color: #111; border-radius: 10px; padding: 14px;
  max-width: 100%; overflow-x: hidden;            /* le mail lui-même ne scrolle jamais latéralement */
  overflow-wrap: anywhere; word-break: break-word;
}
/* Neutralise les largeurs fixes (width des tables/divs) → tout casse sur la largeur de l'écran */
.mail-body--html * { max-width: 100% !important; box-sizing: border-box; }
.mail-body--html img, .mail-body--html video { height: auto !important; }
.mail-body--html td, .mail-body--html th { overflow-wrap: anywhere; word-break: break-word; }
.mail-body--html pre { white-space: pre-wrap; word-break: break-word; }
/* Table vraiment trop large : seule elle devient scrollable, dans son propre conteneur */
.mail-tablewrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mail-tablewrap > table { max-width: none !important; }
.mail-attachs { margin-top: 16px; }
.mail-attach {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; margin-bottom: 6px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; text-align: left; transition: .12s;
}
.mail-attach:hover { border-color: var(--accent); }
.mail-attach-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-attach-sz { color: var(--muted); font-size: 12px; }
.mail-attach-dl { color: var(--accent); }

/* ---------- Mails : composeur (pièces jointes) ---------- */
.mc-att { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.mc-att-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.mc-att-sz { color: var(--muted); font-size: 12px; }
.mc-att-rm { background: transparent; border: 1px solid var(--line); color: var(--danger);
  border-radius: 50%; width: 26px; height: 26px; cursor: pointer; flex-shrink: 0; }
.mc-att-total { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- Cahier des charges ---------- */
/* Groupe de prestations par gamme */
.cdc-gamme { margin-bottom: 18px; }
.cdc-gamme__title {
  display: inline-block; font: 700 12px var(--ff); color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  padding: 4px 11px; border-radius: 6px; margin-bottom: 10px;
}
/* Ligne de prestation cochable */
.cdc-presta { border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  padding: 11px 13px; margin-bottom: 7px; transition: .12s; }
.cdc-presta:hover { border-color: var(--accent-2); }
.cdc-presta__head { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.cdc-presta__head input[type="checkbox"] { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.cdc-presta__txt { display: flex; flex-direction: column; gap: 2px; }
.cdc-presta__lbl { font-weight: 600; font-size: 14px; }
.cdc-presta__desc { font-size: 12px; color: var(--muted); }
/* Détail révélé au cochage : note + quantité */
.cdc-detail { display: flex; gap: 10px; margin-top: 10px; padding-left: 29px; }
.cdc-detail[hidden] { display: none; }
.cdc-note { flex: 1; }
.cdc-qte { width: 88px; flex-shrink: 0; }
/* Ligne libre */
.cdc-freeadd { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cdc-freeadd input { flex: 1; min-width: 180px; }
.cdc-free .cdc-presta__head { justify-content: space-between; align-items: center; cursor: default; }
.cdc-free-rm { background: transparent; border: 1px solid var(--line); color: var(--danger);
  border-radius: 50%; width: 26px; height: 26px; cursor: pointer; flex-shrink: 0; }
.cdc-free-rm:hover { border-color: var(--danger); }
/* Barre d'actions */
.cdc-actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Synthèse à l'écran */
.cdc-synth-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.cdc-synth-head strong { font: 700 16px var(--fd); }
.cdc-synth-gamme { margin-bottom: 14px; }
.cdc-synth-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cdc-synth-list li { padding: 9px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 9px; }
.cdc-synth-lbl { font-weight: 600; font-size: 14px; }
.cdc-synth-qte { color: var(--accent); font-weight: 700; font-size: 12px; }
.cdc-synth-note { color: var(--muted); font-size: 12.5px; margin-top: 3px; white-space: pre-wrap; }
.cdc-synth-notes { margin-top: 14px; padding: 12px 14px; background: var(--bg-2);
  border-left: 3px solid var(--accent-2); border-radius: 8px; white-space: pre-wrap; font-size: 13px; }

/* ---------- Lignes Devis / Factures (saisie manuelle) ---------- */
.lignes__row { display: grid; grid-template-columns: 1fr 64px 110px 32px; gap: 8px; align-items: center; margin-bottom: 8px; }
.lignes__row input {
  width: 100%; font: 400 14px var(--ff); color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px;
}
.lignes__row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(122,60,255,.22); }
.lignes__rm { background: none; border: 0; color: var(--danger); cursor: pointer; font-size: 18px; line-height: 1; }
.lignes__total { margin-top: 12px; font-size: 15px; }
.lignes__hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

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