/* Courrier From Bassin Minier : charte du média (bordeaux, crème, ciel ; Gasoek One + Inter) */
:root {
  --profond: #1A1A1A;
  --fond: #300A14;
  --brique: #4A1624;
  --creme: #F5F0EB;
  --creme-2: #EDE5DC;
  --ciel: #A6D9FA;
  --gris: #616160;
  --encre: #1A1A1A;
  --display: "Gasoek One", "Arial Black", Impact, sans-serif;
  --texte: "Inter", "Segoe UI", Arial, sans-serif;
  --rayon: 14px;
  --trait: rgba(48, 10, 20, .12);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--texte); color: var(--encre); background: var(--creme); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ciel); outline-offset: 2px; }
h1 { font-family: var(--display); font-weight: 400; font-synthesis: none; font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1; margin: 0; color: var(--fond); text-wrap: balance; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 2px solid transparent; font: 700 15px/1 var(--texte); text-decoration: none; cursor: pointer; background: none; color: inherit; white-space: nowrap; }
.btn.ciel { background: var(--ciel); color: var(--fond); }
.btn.ciel:hover { background: #c3e6fc; }
.btn.plein { background: var(--fond); color: var(--creme); }
.btn.plein:hover { background: var(--brique); }
.btn.contour { border-color: rgba(48, 10, 20, .35); color: var(--fond); }
.btn.contour:hover { border-color: var(--fond); }
.btn.danger { border-color: rgba(48, 10, 20, .35); color: #8a1c2c; }
.btn.danger:hover { background: #8a1c2c; border-color: #8a1c2c; color: var(--creme); }
.btn.lien { padding: 0 6px; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.btn.large { width: 100%; min-height: 52px; font-size: 17px; }
form { margin: 0; }

/* Barre du haut */
.barre { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 10px max(20px, env(safe-area-inset-left));
  background: var(--fond); color: var(--creme); }
.barre .logo img { display: block; height: 40px; width: auto; }
.barre .moi { margin-left: auto; font-size: 14px; color: rgba(245, 240, 235, .72); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre .btn.lien { color: var(--creme); }

/* Cadre : dossiers à gauche, contenu à droite */
.cadre { display: grid; grid-template-columns: 250px minmax(0, 1fr); max-width: 1440px; margin: 0 auto; min-height: calc(100vh - 60px); }
.dossiers { padding: 24px 16px; border-right: 1px solid var(--trait); }
.recherche input { width: 100%; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(48, 10, 20, .25); background: #fff; font: inherit; }
.liste-dossiers { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; }
.dossier { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 10px; text-decoration: none; font-weight: 600; color: var(--fond); }
.dossier:hover { background: var(--creme-2); }
.dossier.actif { background: var(--fond); color: var(--creme); }
.compte { min-width: 24px; padding: 2px 8px; border-radius: 999px; background: var(--ciel); color: var(--fond); font-size: 13px; text-align: center; }
main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; }

.tete { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.total { font-size: 14px; color: var(--gris); white-space: nowrap; }
.flash { margin: 0 0 18px; padding: 12px 16px; border-radius: 10px; background: var(--ciel); color: var(--fond); font-weight: 600; }
.erreur { margin: 0 0 18px; padding: 12px 16px; border-radius: 10px; background: #f6d5d9; color: #6d1220; font-weight: 600; }
.note { font-size: 14px; color: var(--gris); }
.vide { color: var(--gris); padding: 40px 0; }

/* Liste des messages */
.messages { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--trait); }
.ligne { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) auto; gap: 18px; align-items: baseline; padding: 14px 10px;
  border-bottom: 1px solid var(--trait); text-decoration: none; color: var(--gris); }
.ligne:hover { background: var(--creme-2); }
.ligne .de, .ligne .objet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne .de { color: var(--encre); }
.ligne .date { font-size: 14px; font-variant-numeric: tabular-nums; }
.ligne.non-lu .de, .ligne.non-lu .objet { color: var(--fond); font-weight: 800; }
.ligne.non-lu { box-shadow: inset 4px 0 0 var(--fond); }
.pages { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Lecture */
.lettre { max-width: 900px; }
.outils { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 24px; }
.sujet { font-size: clamp(1.6rem, 3vw, 2.3rem); margin-bottom: 18px; overflow-wrap: anywhere; }
.entetes { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; margin: 0 0 24px; padding: 16px 18px; border-radius: var(--rayon); background: var(--creme-2); font-size: 15px; }
.entetes dt { font-weight: 700; color: var(--fond); }
.entetes dd { margin: 0; overflow-wrap: anywhere; }
.corps { display: block; width: 100%; height: 70vh; border: 0; border-radius: var(--rayon); background: #fff; padding: 18px; }
.texte { white-space: pre-wrap; overflow-wrap: anywhere; padding: 20px; border-radius: var(--rayon); background: #fff; }
.pj-titre { font: 700 12px/1 var(--texte); letter-spacing: .16em; text-transform: uppercase; color: var(--fond); margin: 28px 0 10px; }
.pj { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pj li { padding: 10px 14px; border-radius: 10px; background: var(--creme-2); }
.pj a { font-weight: 700; color: var(--fond); }
.pj span { font-size: 13px; color: var(--gris); }

/* Écrire */
.carte { display: flex; flex-direction: column; gap: 14px; }
.ecrire { max-width: 900px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; color: var(--fond); }
.aide { font-weight: 400; color: var(--gris); }
input[type=text], input[type=email], input[type=password], textarea { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(48, 10, 20, .25);
  background: #fff; font: 400 16px/1.5 var(--texte); color: var(--encre); }
textarea { resize: vertical; min-height: 260px; }
input[type=file] { font: 400 15px var(--texte); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.envoi { display: flex; gap: 12px; align-items: center; }
.envoi .btn.large { width: auto; padding: 0 40px; }

/* Porte d'entrée (connexion) */
body.accueil { background: var(--fond); color: var(--creme); min-height: 100vh; display: grid; place-items: center; }
.porte { width: min(440px, 100% - 40px); padding: 40px 0; text-align: center; }
.porte-logo { width: 220px; height: auto; }
.porte h1 { color: var(--creme); font-size: clamp(2.6rem, 9vw, 4rem); margin-top: 24px; }
.porte h1::after { content: ""; display: block; width: 64px; height: 4px; margin: 18px auto 0; border-radius: 4px; background: var(--ciel); }
.porte .sous { color: rgba(245, 240, 235, .72); margin: 14px 0 28px; }
.porte .carte { text-align: left; padding: 26px; border-radius: 22px; background: var(--creme); color: var(--encre); }
.porte .flash { text-align: left; }

/* Téléphone : les dossiers passent au-dessus, en pastilles */
@media (max-width: 760px) {
  .barre { gap: 10px; }
  .barre .logo img { height: 32px; }
  .barre .moi { display: none; }
  .barre .btn.lien { margin-left: auto; font-size: 14px; }
  .cadre { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .dossiers { min-width: 0; border-right: 0; border-bottom: 1px solid var(--trait); padding: 14px 16px; }
  .liste-dossiers { flex-direction: row; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; }
  .dossier { flex: none; padding: 8px 14px; border: 1px solid var(--trait); border-radius: 999px; }
  .ligne { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
  .ligne .objet { grid-column: 1 / -1; grid-row: 2; }
  .deux { grid-template-columns: 1fr; }
  .corps { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
