/*
 * Le courrier (R24) : trois colonnes dans la vue. Le panneau des boîtes reprend
 * la densité du panneau des discussions ; la liste et l'e-mail ouvert forment
 * UNE carte en deux volets, avec le même vocabulaire de dessin que le fil.
 * Aucune couleur décorative : la pastille d'une boîte dit d'où vient l'e-mail,
 * l'ambre dit qu'il attend, le vert qu'il est parti.
 */
.vue-courriel { grid-template-columns: 250px 360px minmax(0, 1fr); }

/* ── Boîtes et dossiers ─────────────────────────────────────────────────── */
.cr-nav-corps { padding: var(--tb-sp-1) var(--tb-sp-2) var(--tb-sp-3); }
.cr-nav-titre { display: flex; align-items: center; justify-content: space-between; margin: 12px 10px 4px; font-size: var(--tb-t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--tb-texte-3); }
.cr-nav-titre:first-child { margin-top: 4px; }
.cr-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: var(--tb-rayon); text-align: left; font-size: var(--tb-t-m); color: var(--tb-texte-2); cursor: pointer; transition: background var(--tb-duree), color var(--tb-duree); }
.cr-nav-item + .cr-nav-item { margin-top: 1px; }
.cr-nav-item:hover { background: var(--tb-surface-3); }
/* L'entrée choisie se marque par un aplat seul, comme la rangée de discussion et la section d'un module. */
.cr-nav-item.est-actif { background: var(--tb-surface); color: var(--tb-texte); font-weight: 600; }
.cr-nav-ico { display: grid; place-items: center; width: 22px; flex: none; color: var(--tb-texte-3); }
.cr-nav-item.est-actif .cr-nav-ico { color: var(--tb-accent); }
.cr-nav-lib { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.cr-nav-lib > span, .cr-nav-lib { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-nav-boite { padding-top: 6px; padding-bottom: 6px; }
.cr-nav-adresse { font-size: var(--tb-t-xs); font-weight: 400; color: var(--tb-texte-3); }
.cr-nav-n { flex: none; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: color-mix(in srgb, var(--tb-accent) 12%, transparent); color: var(--tb-accent); font-size: var(--tb-t-xs); font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.cr-nav-pastille { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--tb-accent)); flex: none; }
.cr-nav-groupe { display: flex; align-items: center; gap: 6px; margin: 8px 10px 2px; font-size: var(--tb-t-s); font-weight: 500; color: var(--tb-texte-2); }
.cr-nav-branche { padding-left: calc(var(--niv, 0) * 14px); }
.cr-nav-pli { display: grid; place-items: center; width: 18px; height: 18px; margin-left: -6px; border-radius: 50%; color: var(--tb-texte-3); flex: none; transition: transform var(--tb-duree), background var(--tb-duree); }
.cr-nav-pli:hover { background: var(--tb-surface-2); color: var(--tb-texte); }
.cr-nav-pli.est-deplie { transform: rotate(90deg); }
.cr-nav-pli.est-vide { visibility: hidden; }
.cr-nav-outils { display: none; gap: 2px; flex: none; }
.cr-nav-item:hover .cr-nav-outils, .cr-nav-item:focus-within .cr-nav-outils { display: flex; }
.cr-nav-outils button, .cr-nav-mini { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--tb-texte-3); transition: background var(--tb-duree), color var(--tb-duree); }
.cr-nav-outils button:hover, .cr-nav-mini:hover { background: var(--tb-surface-3); color: var(--tb-texte); }
.cr-nav-indice, .cr-nav-vide { margin: 2px 10px 8px; font-size: var(--tb-t-xs); line-height: 1.5; color: var(--tb-texte-3); }
.cr-nav-vide { margin-top: 12px; font-size: var(--tb-t-s); }

/* ── La liste : le volet gauche de la carte ─────────────────────────────── */
.cr-liste { display: flex; flex-direction: column; min-width: 0; min-height: 0; margin: 10px 0; background: var(--tb-surface); border: 1px solid var(--tb-bordure); border-right: 0; border-radius: 16px 0 0 16px; box-shadow: var(--tb-ombre-carte); overflow: hidden; }
.vue-courriel .cr-lecture { border-radius: 0 16px 16px 0; }
.cr-liste-tete { display: flex; align-items: center; gap: var(--tb-sp-2); height: var(--tb-tete); flex: none; padding: 0 12px 0 16px; border-bottom: 1px solid var(--tb-bordure); }
.cr-liste-titres { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cr-liste-titre { font-size: var(--tb-t-l); font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-liste-sous { font-size: var(--tb-t-xs); color: var(--tb-texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-q-boite { display: flex; align-items: center; gap: 6px; width: 132px; height: 30px; padding: 0 9px; border: 1px solid var(--tb-bordure-2); border-radius: 999px; background: var(--tb-surface-2); color: var(--tb-texte-3); flex: none; transition: width var(--tb-duree), border-color var(--tb-duree), background var(--tb-duree); }
.cr-q-boite:focus-within { width: 190px; border-color: var(--tb-accent); background: var(--tb-surface); box-shadow: var(--tb-focus); }
.cr-q { width: 100%; min-width: 0; border: 0; background: transparent; font: inherit; font-size: var(--tb-t-s); color: var(--tb-texte); outline: none; -webkit-appearance: none; }
.cr-q::-webkit-search-cancel-button { -webkit-appearance: none; }
.cr-nav-btn { display: none; }
.cr-liste-corps { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.cr-item { display: flex; gap: 8px; width: 100%; padding: 10px 10px 10px 8px; border-radius: var(--tb-rayon); text-align: left; transition: background var(--tb-duree); }
.cr-item + .cr-item { margin-top: 1px; }
.cr-item:hover { background: var(--tb-surface-2); }
.cr-item.est-actif { background: color-mix(in srgb, var(--tb-accent) 9%, transparent); }
.cr-item-point { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; flex: none; }
.cr-item.est-non-lu .cr-item-point { background: var(--tb-accent); }
.cr-item-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cr-item-ligne { display: flex; align-items: center; gap: 6px; }
.cr-item-qui { flex: 1; min-width: 0; font-size: var(--tb-t-m); font-weight: 500; color: var(--tb-texte-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-item.est-non-lu .cr-item-qui { font-weight: 700; color: var(--tb-texte); }
.cr-item-boite { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--tb-accent)); flex: none; }
.cr-item-quand { font-size: var(--tb-t-xs); color: var(--tb-texte-3); flex: none; font-variant-numeric: tabular-nums; }
.cr-item-sujet { display: flex; align-items: center; gap: 6px; font-size: var(--tb-t-m); color: var(--tb-texte); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-item.est-non-lu .cr-item-sujet { font-weight: 600; }
.cr-item-sujet em { font-style: normal; color: var(--tb-alerte); }
.cr-item-piece { display: inline-grid; color: var(--tb-texte-3); flex: none; }
.cr-item-extrait { font-size: var(--tb-t-s); color: var(--tb-texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-liste-vide, .cr-attente { padding: 44px 16px; text-align: center; font-size: var(--tb-t-m); color: var(--tb-texte-3); }
.cr-liste-pied { display: flex; align-items: center; gap: var(--tb-sp-2); padding: 10px 14px; border-top: 1px solid var(--tb-bordure); font-size: var(--tb-t-s); color: var(--tb-texte-3); }

/* ── L'e-mail ouvert : le volet droit ───────────────────────────────────── */
.cr-message { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cr-tete { display: flex; align-items: center; gap: var(--tb-sp-3); min-height: var(--tb-tete); flex: none; padding: 10px 16px 10px 18px; border-bottom: 1px solid var(--tb-bordure); }
.cr-tete-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cr-sujet { font-size: var(--tb-t-l); font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-etiquette { align-self: flex-start; padding: 2px 8px; border-radius: 999px; background: var(--tb-surface-3); font-size: var(--tb-t-xs); font-weight: 500; color: var(--tb-texte-2); }
.cr-etiquette.est-attente { background: color-mix(in srgb, var(--tb-alerte) 13%, transparent); color: var(--tb-alerte); }
.cr-etiquette.est-ok { background: color-mix(in srgb, var(--tb-ok) 12%, transparent); color: var(--tb-ok); }
.cr-gestes { display: flex; align-items: center; gap: 6px; flex: none; }
.cr-corps { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 26px 30px; }
.cr-entete { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--tb-bordure); }
.cr-entete-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cr-entete-ligne { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.cr-entete-qui { font-size: var(--tb-t-m); font-weight: 600; }
.cr-entete-adresse { font-size: var(--tb-t-s); color: var(--tb-texte-3); }
.cr-entete-detail { font-size: var(--tb-t-s); color: var(--tb-texte-2); overflow-wrap: anywhere; }
.cr-entete-boite { display: flex; align-items: center; gap: 6px; margin-top: 2px; color: var(--tb-texte-3); }
.cr-entete-date { flex: none; font-size: var(--tb-t-s); color: var(--tb-texte-3); white-space: nowrap; }
.cr-texte { max-width: 78ch; font-size: var(--tb-t-m); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.cr-texte a { color: var(--tb-accent); text-decoration: underline; }
.cr-texte-vide { font-style: italic; color: var(--tb-texte-3); }
.cr-pieces { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--tb-bordure); }
.cr-pieces-titre { width: 100%; font-size: var(--tb-t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--tb-texte-3); }
.cr-piece { max-width: 300px; }

/* ── Écrire ─────────────────────────────────────────────────────────────── */
.mx-large { width: min(720px, calc(100vw - 32px)); }
.mx-large .mx-corps { gap: 10px; }
.champ select { height: 38px; padding: 0 11px; border: 1px solid var(--tb-bordure-2); border-radius: var(--tb-rayon-s); background: var(--tb-surface); font: inherit; font-size: var(--tb-t-m); color: var(--tb-texte); }
.champ select:focus { outline: none; border-color: var(--tb-accent); box-shadow: var(--tb-focus); }
.champ-texte textarea { height: auto; min-height: 220px; padding: 10px 11px; resize: vertical; line-height: 1.5; font: inherit; font-size: var(--tb-t-m); }
.champ textarea:focus { outline: none; border-color: var(--tb-accent); box-shadow: var(--tb-focus); }
#cr-deplacer-cibles .case { padding-left: calc(8px + var(--niv, 0) * 16px); }
#cr-deplacer-cibles .cr-nav-ico { color: var(--tb-texte-3); }

/* ── Étroit ─────────────────────────────────────────────────────────────── */
@media (max-width: 1240px) { .vue-courriel { grid-template-columns: 224px 320px minmax(0, 1fr); } }
@media (max-width: 900px) {
  .vue-courriel { grid-template-columns: minmax(0, 1fr); }
  .cr-nav { display: none; }
  .vue-courriel.est-nav .cr-nav { display: flex; }
  .vue-courriel.est-nav .cr-liste, .vue-courriel.est-nav .cr-lecture { display: none; }
  .cr-liste { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .cr-lecture { display: none; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .vue-courriel.est-lecture .cr-liste { display: none; }
  .vue-courriel.est-lecture .cr-lecture { display: flex; }
  .cr-nav-btn { display: inline-flex; }
  .cr-corps { padding: 16px 16px 24px; }
}
