/* JARVIS — mêmes jetons que l'app Cap Horn (frontend/src/styles.css).
   Charte : pas de dégradé, l'emphase vient de la taille et de l'espace,
   jamais de la graisse. Primaire = encre quasi-noire, bleu réservé aux liens. */

@font-face {
  font-family: 'Cal Sans';
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  src: url('/fonts/CalSansVF.woff2') format('woff2');
}

:root {
  --bg: #eef1f6; --surface: #fff; --surface-2: #f1f4f8;
  --nav-bg: #181d26; --nav-bg2: #232936; --nav-tx: #9aa3b2;
  --ink: #181d26; --ink-2: #333840; --muted: #5f6875;
  --line: #e6e9ef; --line-2: #d6dce4;
  --accent: #181d26; --accent-d: #2c3340; --accent-soft: #e7eef7;
  --link: #15639f;
  --green: #0a7d52; --green-soft: #e6f4ec;
  --red: #c0392b;   --red-soft: #fbeceb;
  --amber: #b07410; --amber-soft: #f9f0df;
  --r: 12px; --r-sm: 8px;
  --sh: 0 1px 3px rgba(24,29,38,.07);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'Cal Sans', 'Inter', system-ui, sans-serif;
  font-size: 14px; line-height: 1.5; letter-spacing: -.05px;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }

/* ---------- Structure ---------- */
.layout { display: flex; height: 100vh; }

.nav {
  width: 210px; flex-shrink: 0; background: var(--nav-bg);
  display: flex; flex-direction: column; color: var(--nav-tx);
}
.nav .brand { padding: 20px 20px 16px; color: #fff; font-size: 16px; letter-spacing: -.3px; font-weight: 600; }
.nav .brand small { display: block; font-size: 10.5px; color: #6f89a6; letter-spacing: 1.2px; text-transform: uppercase; margin-top: 5px; font-weight: 500; }
.nav .items { flex: 1; padding: 4px 10px; }
.nav .items button {
  width: 100%; background: none; border: 0; color: var(--nav-tx); text-align: left;
  padding: 8px 12px; border-radius: 7px; margin-bottom: 2px; font-size: 13.5px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.nav .items button:hover { background: var(--nav-bg2); color: #fff; }
.nav .items button.on { background: #fff; color: var(--ink); font-weight: 600; }
.nav .items .n { font-size: 11.5px; opacity: .7; font-variant-numeric: tabular-nums; }
.nav .foot { padding: 12px 20px; font-size: 11px; color: #6f89a6; border-top: 1px solid #232936; }
.nav .foot b { color: #b9c6d6; font-weight: 500; }

.colonnes { flex: 1; display: flex; min-width: 0; }

.liste {
  width: 380px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line-2); overflow-y: auto;
}
.liste .entete {
  position: sticky; top: 0; background: var(--surface); z-index: 2;
  padding: 14px 18px 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 10px;
}
.liste .entete h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.liste .entete .reste { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.item { padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.item:hover { background: var(--surface-2); }
.item.on { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--ink); }
.item.fait { opacity: .45; }
.item.fait .sujet { text-decoration: line-through; }
.item .haut { display: flex; align-items: baseline; gap: 8px; }
.item .qui { font-weight: 600; font-size: 13.5px; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .quand { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.item .sujet { font-size: 13px; color: var(--ink-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .pourquoi { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }

.puce { font-size: 11px; padding: 1.5px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.puce.rouge { background: var(--red-soft); border-color: #f3cdcc; color: var(--red); }
.puce.ambre { background: var(--amber-soft); border-color: #ecd9b4; color: var(--amber); }
.puce.vert  { background: var(--green-soft); border-color: #bfe3cf; color: var(--green); }

.fil { flex: 1; overflow-y: auto; min-width: 0; }
.fil .dedans { max-width: 780px; margin: 0 auto; padding: 26px 30px 90px; }

.carte { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--sh); padding: 20px 22px; margin-bottom: 16px; }
.carte h3 { margin: 0 0 12px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

.titre { font-size: 22px; line-height: 1.25; margin: 0 0 6px; font-weight: 600; letter-spacing: -.5px; }
.sousTitre { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.sousTitre b { color: var(--ink-2); font-weight: 600; }

table.faits { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.faits td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.faits td:first-child { color: var(--muted); width: 42%; padding-right: 14px; }
table.faits tr:last-child td { border-bottom: 0; }

.attention { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.attention:first-of-type { border-top: 0; padding-top: 0; }
.attention .pastille { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 7px; background: var(--muted); }
.attention.alerte .pastille { background: var(--red); }
.attention.vigilance .pastille { background: var(--amber); }
.attention p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.attention .src { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: inline-block; }

.question { margin-bottom: 16px; }
.question p { margin: 0 0 7px; font-size: 14.5px; color: var(--ink); }
.options { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { background: #fff; border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--ink-2); }
.opt:hover { border-color: #b9c2ce; }
.opt.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.dictee { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 999px; padding: 5px 6px 5px 14px; background: #fff; }
.dictee input { flex: 1; border: 0; outline: 0; font-size: 13.5px; background: none; color: var(--ink); min-width: 0; }
.micro { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.micro.actif { background: var(--red-soft); border-color: #f3cdcc; }

.msg { padding: 12px 0; border-top: 1px solid var(--line); }
.msg:first-child { border-top: 0; padding-top: 0; }
.msg .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; }
.msg .meta b { color: var(--ink-2); font-weight: 600; }
.msg[data-sens="out"] .meta b { color: var(--green); }
.msg pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; color: var(--ink-2); max-height: 15em; overflow: auto; }

.barre { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { background: var(--ink); color: #fff; border: 1px solid transparent; border-radius: 9px; padding: 9px 16px; font-size: 13px; font-weight: 600; letter-spacing: -.1px; }
.btn:hover { background: var(--accent-d); }
.btn:disabled { opacity: .45; }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line-2); font-weight: 500; }
.btn.ghost:hover { background: var(--surface-2); }
.btn .k { opacity: .5; margin-left: 7px; font-size: 11px; }

textarea.corps { width: 100%; min-height: 190px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; line-height: 1.6; color: var(--ink-2); resize: vertical; outline: 0; background: #fff; }
textarea.corps:focus { border-color: #b9c2ce; }

.vide { color: var(--muted); font-size: 14px; padding: 40px 30px; text-align: center; }
.bandeau { background: var(--red-soft); border-bottom: 1px solid #f3cdcc; color: var(--red); padding: 9px 18px; font-size: 13px; }
.retour { display: none; }
.chargement { color: var(--muted); font-size: 13px; padding: 10px 0; }

/* ---------- Tableau de bord ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--sh); }
.kpi .v { font-size: 30px; line-height: 1; letter-spacing: -1px; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
table.tab { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tab th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 0 12px 8px 0; border-bottom: 1px solid var(--line-2); }
table.tab td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tab td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; height: 100dvh; }
  .nav { width: 100%; flex-direction: row; align-items: center; padding: 0 12px; }
  .nav .brand { padding: 12px 10px; font-size: 14px; }
  .nav .brand small { display: none; }
  .nav .items { display: flex; gap: 4px; padding: 0; flex: 1; }
  .nav .items button { width: auto; padding: 6px 10px; font-size: 12.5px; }
  .nav .foot { display: none; }
  .colonnes { flex-direction: column; overflow: hidden; }
  .liste { width: 100%; border-right: 0; }
  body[data-vue="fil"] .liste { display: none; }
  body:not([data-vue="fil"]) .fil { display: none; }
  .fil .dedans { padding: 16px 14px 40px; }
  .retour { display: inline-flex; }
  .titre { font-size: 19px; }
  .barre .btn { flex: 1 1 auto; justify-content: center; padding: 12px 14px; }
}

.aide { margin: 0; padding: 10px 18px; font-size: 12px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }

.annonce {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: 0 4px 14px rgba(24,29,38,.22); z-index: 50;
  max-width: 90vw; text-align: center;
}

/* Les liens d'un message HTML : chez INTRUM le bouton de paiement est une
   image sans texte — sans cette rangée, il disparaît purement et simplement. */
.liens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lien {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--link); background: #fff;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lien:hover { border-color: var(--link); }

.rendu {
  width: 100%; height: 460px; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); background: #fff; margin-top: 6px;
}

/* À qui répondre. Un courrier de recouvrement arrive d'un no-reply et donne la
   vraie adresse dans son pied de page : sans ce choix, on écrit dans le vide. */
.destinataire { margin-bottom: 14px; }
.destinataire .alerte {
  margin: 0 0 8px; font-size: 13px; color: var(--amber);
  background: var(--amber-soft); border: 1px solid #ecd9b4;
  border-radius: var(--r-sm); padding: 8px 12px;
}
.destinataire .opt { font-size: 12.5px; }

/* ---------- Bandeau contact ---------- */
.contact {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--sh);
}
.contact .ident { flex: 1; min-width: 0; }
.contact .nom { font-size: 15px; font-weight: 600; color: var(--ink); }
.contact .detail { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.contact .detail b { color: var(--ink-2); font-weight: 500; }
.contact .gestes { display: flex; gap: 6px; }
.mini {
  background: #fff; border: 1px solid var(--line-2); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; color: var(--ink-2); text-decoration: none;
}
.mini:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Fiche à compléter ---------- */
.fiche {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--sh);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 14px;
}
.fiche label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fiche input, .fiche select {
  border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 10px;
  font-size: 13.5px; color: var(--ink); background: #fff; outline: 0;
}
.fiche input:focus, .fiche select:focus { border-color: #b9c2ce; }
.fiche .astuce, .fiche .barre { grid-column: 1 / -1; }
.fiche .astuce { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- Le dossier ---------- */
.resume { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--ink); }
.resume.discret { color: var(--muted); font-size: 14px; }
.faits { margin-top: 14px; }
.attentions { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 4px; }
.etiquette { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.ligne { margin: 0 0 6px; }
.pourquoi.grand { gap: 6px; margin-bottom: 18px; }

/* ---------- La barre d'action, toujours visible ---------- */
.actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px 30px; background: rgba(238,241,246,.94);
  backdrop-filter: blur(6px); border-top: 1px solid var(--line-2);
}
.fil { display: flex; flex-direction: column; }
.fil .dedans { flex: 1; padding-bottom: 24px; }

@media (max-width: 900px) {
  .actions { padding: 10px 14px; }
  .actions .btn { flex: 1 1 40%; justify-content: center; padding: 11px 10px; }
  .contact { padding: 10px 12px; }
}

/* ---------- Mes listes ---------- */
.onglets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tache {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.tache:last-child { border-bottom: 0; }
.tache input { width: 17px; height: 17px; accent-color: var(--ink); flex-shrink: 0; }
.tache .quoi { flex: 1; min-width: 0; font-size: 14px; color: var(--ink); }
.tache .mini { padding: 3px 9px; font-size: 11.5px; }
