/* Courrier — style « vercel » (fond noir, filets fins, typographie sobre), polices système : la CSP
   n'autorise aucune ressource externe. Une seule feuille, aucun style en ligne, aucun script. */

:root {
  --fond: #000;
  --surface: #0a0a0a;
  --survol: #171717;
  --actif: #1f1f1f;
  --texte: #ededed;
  --texte-2: #a1a1a1;
  --texte-3: #8f8f8f;
  --filet: #262626;
  --filet-fort: #333;
  --bleu: #3291ff;
  --vert: #45dec4;
  --rouge: #ff5b6b;
  --ambre: #f5b74f;
  --rayon: 8px;
  --sans: Geist, Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--texte); text-decoration: underline; text-decoration-color: var(--filet-fort); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--texte-2); }

:focus-visible { outline: 2px solid var(--bleu); outline-offset: 2px; border-radius: 4px; }

h1 { font-size: 1.75rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1.2; margin: 0 0 0.75rem; text-wrap: balance; }
h2 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 0.75rem; }
p { margin: 0 0 0.75rem; }

.meta { color: var(--texte-2); font-size: 0.875rem; font-weight: 400; }
.intro { color: var(--texte-2); max-width: 65ch; }
.aide { color: var(--texte-3); font-size: 0.8125rem; margin: 0.5rem 0 0.75rem; }
.vide { color: var(--texte-2); padding: 2rem 1rem; text-align: center; list-style: none; }
code { font-family: var(--mono); font-size: 0.8125rem; color: var(--texte-2); word-break: break-all; }

.visuellement-cache {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.evitement { position: absolute; left: -9999px; top: 0; }
.evitement:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--texte); color: #000; padding: 0.5rem 1rem; border-radius: var(--rayon); }

/* --- Barre du haut ------------------------------------------------------------------------------------------ */
.barre { border-bottom: 1px solid var(--filet); background: var(--fond); }
.barre-haut { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem 1rem 0.25rem; max-width: 960px; margin: 0 auto; }
.marque { font-weight: 600; letter-spacing: -0.02em; text-decoration: none; font-size: 1rem; }
.mode { font-size: 0.75rem; color: var(--texte-2); border: 1px solid var(--filet); border-radius: 999px; padding: 0.15rem 0.6rem; white-space: nowrap; }
.mode-smtp { color: var(--ambre); border-color: #4a3a1a; }
.mode-brouillon_gmail { color: var(--bleu); border-color: #1a2f4a; }
.barre-droite { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.deconnexion { margin: 0; }
.lien-discret {
  min-height: 44px; padding: 0 0.25rem; border: 0; background: none; color: var(--texte-2); cursor: pointer;
  font: 400 0.8125rem/1 var(--sans); text-decoration: underline; text-decoration-color: var(--filet-fort);
  text-underline-offset: 3px; white-space: nowrap; touch-action: manipulation;
}
.lien-discret:hover { color: var(--texte); text-decoration-color: var(--texte-2); }

.onglets {
  display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none;
  padding: 0.25rem 0.75rem 0; max-width: 960px; margin: 0 auto;
}
.onglets::-webkit-scrollbar { display: none; }
.onglets a {
  flex: none; display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 44px; padding: 0 0.6rem; color: var(--texte-2); text-decoration: none; font-size: 0.875rem;
  border-bottom: 2px solid transparent; transition: color 150ms, border-color 150ms;
}
.onglets a:hover { color: var(--texte); }
.onglets a[aria-current="page"] { color: var(--texte); border-bottom-color: var(--texte); }
.compte { font-variant-numeric: tabular-nums; color: var(--texte-3); font-size: 0.75rem; }

/* --- Page --------------------------------------------------------------------------------------------------- */
.page { max-width: 960px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.entete-page { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.entete-page h1 { margin: 0; }
.retour { margin-bottom: 1rem; font-size: 0.875rem; }
.retour a { color: var(--texte-2); text-decoration: none; }
.retour a:hover { color: var(--texte); }

.bandeau {
  border: 1px solid var(--filet); border-radius: var(--rayon); background: var(--surface);
  padding: 0.75rem 1rem; font-size: 0.875rem; color: var(--texte); margin-bottom: 1rem;
}
.bandeau-ok { border-color: #1d4a43; }
.bandeau-ok::before { content: "● "; color: var(--vert); }
.bandeau-info { border-color: #1a2f4a; }
.bandeau-info::before { content: "● "; color: var(--bleu); }
.bandeau-attention { border-color: #4a3a1a; }
.bandeau-attention::before { content: "● "; color: var(--ambre); }
.bandeau-erreur { border-color: #5a1d24; }
.bandeau-erreur::before { content: "● "; color: var(--rouge); }

/* --- Boutons et champs -------------------------------------------------------------------------------------- */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 44px; padding: 0 1rem; border-radius: var(--rayon);
  border: 1px solid var(--filet-fort); background: var(--fond); color: var(--texte);
  font: 500 0.875rem/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color 150ms, border-color 150ms, color 150ms;
  touch-action: manipulation;
}
.bouton:hover { background: var(--survol); }
.bouton-primaire { background: var(--texte); border-color: var(--texte); color: #000; }
.bouton-primaire:hover { background: #fff; }
.bouton-danger { border-color: #5a1d24; color: var(--rouge); }
.bouton-danger:hover { background: #1a0a0c; }
.bouton:disabled, .bouton[disabled] { opacity: 0.45; cursor: not-allowed; }
.bouton:disabled:hover { background: inherit; }
.bouton-primaire:disabled:hover { background: var(--texte); }

input[type="search"], input[type="text"], input[type="password"], textarea, select {
  width: 100%; min-height: 44px; padding: 0.6rem 0.75rem;
  border: 1px solid var(--filet); border-radius: var(--rayon); background: var(--fond); color: var(--texte);
  font: 16px/1.5 var(--sans); transition: border-color 150ms;
}
input::placeholder, textarea::placeholder { color: var(--texte-3); }
input:hover, textarea:hover, select:hover { border-color: var(--filet-fort); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--bleu); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
select { width: auto; max-width: 100%; }
label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.4rem; }
.case { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; margin: 0.25rem 0 1rem; cursor: pointer; }
.case input { width: 20px; height: 20px; margin: 0.1rem 0 0; flex: none; accent-color: var(--texte); }

.formulaire { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--filet); }
.rangee { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0 0 0.75rem; }
.rangee label { margin: 0; }
.rangee form { margin: 0; }

.connexion { max-width: 360px; margin: 2rem auto 0; }
.connexion form { display: flex; flex-direction: column; }
.connexion input { margin-bottom: 1rem; }
.connexion .bouton { width: 100%; margin-top: 0.25rem; }

.recherche { display: flex; gap: 0.5rem; flex: 1 1 280px; max-width: 420px; }
.recherche input { flex: 1; }

/* --- Filtres de la liste ------------------------------------------------------------------------------------ */
.filtres { margin-bottom: 1rem; }
.puces, .segments { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 0.25rem; }
.puces::-webkit-scrollbar, .segments::-webkit-scrollbar { display: none; }
.puces a, .segments a {
  flex: none; display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0 0.85rem;
  border: 1px solid var(--filet); border-radius: 999px; color: var(--texte-2); text-decoration: none;
  font-size: 0.8125rem; transition: background-color 150ms, color 150ms, border-color 150ms;
}
.puces a:hover, .segments a:hover { color: var(--texte); border-color: var(--filet-fort); }
.puces a[aria-current="true"], .segments a[aria-current="true"] { background: var(--actif); color: var(--texte); border-color: var(--filet-fort); }
.reglages-liste { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-top: 0.5rem; }
.segments a { border-radius: var(--rayon); }

/* --- Liste des mails : une liste continue à filets, pas des cartes flottantes ------------------------------ */
.liste { list-style: none; margin: 0; padding: 0; border: 1px solid var(--filet); border-radius: var(--rayon); overflow: hidden; }
.liste > li + li { border-top: 1px solid var(--filet); }
.liste .vide { border: 0; }
.ligne { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.2rem; padding: 0.85rem 1rem; text-decoration: none; color: var(--texte); transition: background-color 150ms; }
.ligne:hover { background: var(--surface); }
.ligne-haut { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.de { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ligne time { color: var(--texte-2); font-size: 0.8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.objet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.resume { color: var(--texte-2); font-size: 0.875rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.etiquettes { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.3rem; }

.pastille {
  display: inline-flex; align-items: center; padding: 0.05rem 0.55rem; border: 1px solid var(--filet);
  border-radius: 999px; font-size: 0.75rem; color: var(--texte-2); white-space: nowrap;
}
.pastille-haute { color: var(--ambre); border-color: #4a3a1a; }
.pastille-critique, .pastille-erreur { color: var(--rouge); border-color: #5a1d24; }

.etat { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; color: var(--texte-2); }
.etat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--texte-3); flex: none; }
.etat-ok::before { background: var(--vert); }
.etat-info::before { background: var(--bleu); }
.etat-attention::before { background: var(--ambre); }
.etat-erreur::before { background: var(--rouge); }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 1rem; }

/* --- Fiche -------------------------------------------------------------------------------------------------- */
.fiche-entete { margin-bottom: 1rem; }
.fiche-entete h1 { overflow-wrap: anywhere; }
.expediteur { margin-bottom: 0.35rem; overflow-wrap: anywhere; }
.adresse { color: var(--texte-2); font-family: var(--mono); font-size: 0.8125rem; }
.resume-fiche { color: var(--texte); max-width: 70ch; }

.carte { border: 1px solid var(--filet); border-radius: var(--rayon); background: var(--surface); padding: 1rem; margin-bottom: 1rem; }
.carte > h2 .meta { margin-left: 0.25rem; }

.texte {
  margin: 0 0 0.75rem; padding: 0.85rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 15px/1.6 var(--sans); color: var(--texte); background: var(--fond);
  border: 1px solid var(--filet); border-radius: var(--rayon);
}
.texte-recu { max-height: 28rem; overflow: auto; color: #d4d4d4; }
.texte-brouillon { border-color: var(--filet-fort); }
mark { background: #3d2e0a; color: var(--ambre); border-radius: 3px; padding: 0 0.15rem; }
ins { background: #0d2e28; color: #7ff0dc; text-decoration: underline; text-underline-offset: 3px; border-radius: 3px; }
del { background: #3a1016; color: #ff99a4; text-decoration: line-through; border-radius: 3px; }

.entetes { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0 0 1rem; font-size: 0.875rem; }
.entetes dt { color: var(--texte-2); }
.entetes dd { margin: 0; overflow-wrap: anywhere; }
.entetes-compacts { margin-bottom: 0.75rem; }

.remarques { margin: 0 0 0.75rem; padding: 0; padding-inline-start: 1.1rem; color: var(--texte-2); font-size: 0.875rem; }
.remarques li + li { margin-top: 0.2rem; }

.actions-principales { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 1rem; }
.actions-principales p, .actions-principales form { margin: 0; }
.actions-confirmation { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }

.envoi { border: 1px solid var(--filet); border-radius: var(--rayon); padding: 0.75rem 1rem; margin: 0.75rem 0; background: var(--fond); }
.envoi p:last-child, .envoi form { margin-bottom: 0; }
.envoi-envoye { border-color: #1d4a43; }
.envoi-demande, .envoi-en_cours { border-color: #1a2f4a; }
.envoi-incertain, .envoi-echoue { border-color: #5a1d24; }

details { margin: 0 0 0.75rem; }
summary { cursor: pointer; color: var(--texte-2); font-size: 0.875rem; display: list-item; padding: 0.6rem 0; }
summary:hover { color: var(--texte); }
details[open] > summary { margin-bottom: 0.5rem; }
.depliant { margin-top: 1rem; }
.depliant > summary { color: var(--texte); font-weight: 500; }

.versions { list-style: none; margin: 0; padding: 0; }
.versions > li { padding: 0.75rem 0; border-top: 1px solid var(--filet); }
.versions > li:first-child { border-top: 0; padding-top: 0; }
.versions p { margin-bottom: 0.4rem; font-size: 0.875rem; }
.demande { color: var(--texte-2); }

/* --- Tableaux (activité) ------------------------------------------------------------------------------------ */
.tableau-defile { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
th { text-align: left; font-weight: 500; color: var(--texte-2); padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--filet); white-space: nowrap; }
td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--filet); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.nombre { font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (min-width: 720px) {
  .page { padding: 2rem 1.5rem 4rem; }
  h1 { font-size: 2.25rem; }
  .barre-haut { padding: 0.75rem 1.5rem 0.25rem; }
  .onglets { padding: 0.25rem 1.25rem 0; }
  .carte { padding: 1.25rem 1.5rem; }
  .barre { position: sticky; top: 0; z-index: 5; }
}

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

@media (hover: none) {
  .bouton:hover, .ligne:hover, .puces a:hover, .segments a:hover { background: inherit; }
  .bouton-primaire:hover { background: var(--texte); }
}

@media (forced-colors: active) {
  .etat::before, .bandeau::before { forced-color-adjust: none; }
  mark, ins, del { forced-color-adjust: none; }
}
