/* Teksat Antispam — charte de la plateforme TEKSAT, comme Mission SN AUXISUD / NAVSAT :
   barre bleue, menu latéral blanc avec profil, en-tête de page léger, cartes à ombre douce, tuiles colorées. */
:root {
  --brand: #2b65ee;
  --bg: #f2f3f7; --surface: #ffffff; --sunk: #eef0f4; --fg: #343a40; --muted: #6c757d; --line: #e3e6ea;
  --accent: var(--brand); --accent-fg: #ffffff; --accent-soft: color-mix(in srgb, var(--accent) 12%, #ffffff);
  --danger: #b42318; --warn: #b54708; --ok: #15803d;
  --ok-bg: #e7f6ec; --err-bg: #fdecea; --warn-bg: #fff4e0;
  /* Statuts du panier : orange en attente, bleu « ce mail », vert autorisé, rouge banni */
  --s-pending: #ef8a00;  --s-pending-bg: #fff6e8;
  --s-released: #1e88e5; --s-released-bg: #eaf3fd;
  --s-allowed: #16a34a;  --s-allowed-bg: #e9f7ee;
  --s-banned: #dc2626;   --s-banned-bg: #fdeeee;
  --font: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
  --shadow: 0 1px 4px rgba(15,23,42,.08), 0 0 0 1px rgba(15,23,42,.03);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1614; --surface: #18211f; --sunk: #121a18; --fg: #e5ece9; --muted: #93a29e; --line: #2a3734;
  --accent: color-mix(in srgb, var(--brand) 55%, #ffffff); --accent-fg: #0b1512; --accent-soft: color-mix(in srgb, var(--brand) 28%, #18211f);
  --danger: #f97066; --warn: #f79009; --ok: #47cd89;
  --ok-bg: #16301f; --err-bg: #3b1a17; --warn-bg: #3a2a14;
  --s-pending: #f0a040;  --s-pending-bg: #33270f;
  --s-released: #6aa6f5; --s-released-bg: #172a43;
  --s-allowed: #4ade80;  --s-allowed-bg: #14301f;
  --s-banned: #f87171;   --s-banned-bg: #3b1a18;
  --shadow: 0 1px 4px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.04);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
h2 { font-size: 17px; font-weight: 500; margin: 0 0 12px; }
h2 small { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--sunk); padding: 1px 5px; border-radius: 4px; }

/* ---------- Boutons et champs */
input, select, button, textarea { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=file], select, textarea {
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 7px 11px; min-height: 38px; max-width: 100%; color: var(--fg); }
textarea { resize: vertical; vertical-align: top; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; padding: 7px 13px; min-height: 38px; font-weight: 500; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
button.primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); border-color: color-mix(in srgb, var(--accent) 85%, #000); }
button.danger { color: var(--danger); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--sunk); }
button.small, .small button { font-size: 13.5px; padding: 4px 10px; min-height: 31px; }
button.danger-soft { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
button.danger-soft:hover { background: var(--err-bg); }
button.link { border: 0; background: none; color: var(--muted); padding: 0; min-height: 0; font-weight: 400; }
button.link:hover { color: var(--fg); text-decoration: underline; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--muted); font-size: 13.5px; margin: 8px 0 0; }
form.inline { display: inline-flex; gap: 6px; align-items: center; }
form.inline.wrap { flex-wrap: wrap; margin-top: 6px; }

/* ---------- Structure : barre, menu latéral, en-tête de page */
.app { min-height: 100%; display: flex; flex-direction: column; }
header.top { display: flex; align-items: center; gap: 6px; height: 60px; padding: 0 12px; background: var(--brand); color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.18); position: sticky; top: 0; z-index: 1000; flex: none; }
header.top .brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-size: 19px; font-weight: 500; white-space: nowrap; min-width: 0; }
header.top .brand img { height: 36px; width: auto; display: block; }
.top-fill { flex: 1; }
.top-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: #fff; min-height: 40px; padding: 6px 12px;
  border-radius: 4px; font-weight: 500; white-space: nowrap; text-decoration: none; box-shadow: none; }
.top-btn:hover, .top-btn:focus-visible { background: rgba(255,255,255,.14); border-color: transparent; }
.top-btn .ico { width: 20px; height: 20px; }
.top-btn.account { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
header.top :focus-visible { outline-color: #fff; }
/* Groupes de boutons de la barre bleue : affichage du panier, thème clair / sombre */
.top-seg { display: inline-flex; border: 1px solid rgba(255,255,255,.45); border-radius: 4px; overflow: hidden; margin: 0 4px; flex: none; }
.top-seg a, .top-seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 0; background: transparent; color: #fff;
  padding: 5px 11px; min-height: 34px; font-size: 14px; font-weight: 500; text-decoration: none; box-shadow: none; white-space: nowrap; }
.top-seg > * + * { border-left: 1px solid rgba(255,255,255,.45); }
.top-seg a:hover, .top-seg button:hover { background: rgba(255,255,255,.14); }
.top-seg .ico { width: 17px; height: 17px; }
.top-seg a.on, .theme-seg .t-light, :root[data-theme="dark"] .theme-seg .t-dark { background: #fff; color: var(--brand); }
:root[data-theme="dark"] .theme-seg .t-light { background: transparent; color: #fff; }
:root[data-theme="dark"] .top-seg a.on, :root[data-theme="dark"] .theme-seg .t-dark { color: #1d3f94; }
.theme .to-light, :root[data-theme="dark"] .theme .to-dark { display: none; }
:root[data-theme="dark"] .theme .to-light { display: inline-flex; }
.burger { display: none; }

.shell { flex: 1; display: flex; min-height: 0; }
.side { width: 244px; flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; z-index: 900; }
.side-profile { display: grid; justify-items: center; gap: 3px; padding: 20px 15px 16px; text-align: center;
  background: linear-gradient(155deg, color-mix(in srgb, var(--fg) 7%, var(--surface)) 0 46%, color-mix(in srgb, var(--fg) 3%, var(--surface)) 46% 62%, var(--surface) 62%);
  border-bottom: 1px solid var(--line); }
.side-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 25px; font-weight: 500;
  border: 4px solid var(--surface); box-shadow: 0 2px 10px rgba(0,0,0,.25); margin-bottom: 4px; position: relative; text-transform: uppercase; }
.side-avatar::after { content: ""; position: absolute; right: 2px; bottom: 2px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid var(--surface); }
.side-profile strong { font-size: 15px; font-weight: 500; }
.side-profile small { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.side-nav { display: grid; padding: 6px 0; }
.side-nav a { display: flex; align-items: center; gap: 14px; border-left: 3px solid transparent; color: var(--fg); padding: 11px 21px; font-size: 15px; text-decoration: none; }
.side-nav a:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.side-nav a.on { color: var(--accent); border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); font-weight: 500; }
.side-nav .count { margin-left: auto; }
.side-nav .sep { height: 1px; background: var(--line); margin: 6px 18px; }
.ico { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.count { background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 6px; min-width: 18px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; padding: 12px 18px 16px; display: grid; justify-items: start; gap: 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.side-foot form { margin: 0; }
.side-foot button.link { font-size: 12.5px; color: var(--accent); text-decoration: underline; }
.side-shade { display: none; }

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 26px 13px;
  background: color-mix(in srgb, var(--surface) 55%, var(--bg)); border-bottom: 1px solid var(--line); }
.pagehead h1 { margin: 0; font-size: 24px; font-weight: 300; color: color-mix(in srgb, var(--fg) 80%, var(--bg)); line-height: 1.2; }
.pagehead h1 small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 400; }
.crumb { display: flex; gap: 8px; align-items: center; font-size: 14px; background: var(--surface); padding: 5px 13px; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.crumb span:first-child { color: var(--accent); }
.crumb .sep { color: var(--muted); }
.view { padding: 20px 25px 60px; flex: 1; }
.view > .wrap { max-width: 1240px; margin: 0 auto; display: grid; gap: 16px; align-content: start; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 20px; }

/* ---------- Panneaux, messages, tableaux */
.card { background: var(--surface); border-radius: 4px; box-shadow: var(--shadow); padding: 18px; overflow-x: auto; }
.card.narrow { max-width: 520px; }
.card.add .hint { margin-bottom: 0; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); padding: 11px 13px; border-radius: 4px; box-shadow: var(--shadow); }
.flash { padding: 11px 15px; border-radius: 4px; background: var(--ok-bg); color: var(--ok); box-shadow: inset 4px 0 0 var(--ok); }
.flash.err { background: var(--err-bg); color: var(--danger); box-shadow: inset 4px 0 0 var(--danger); }
.info { background: var(--surface); border-radius: 4px; box-shadow: var(--shadow), inset 4px 0 0 var(--accent); padding: 10px 15px; font-size: 14px; }
.info p { margin: 0; }
.info p + p { margin-top: 6px; color: var(--muted); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; border-bottom: 2px solid var(--line); padding: 11px; white-space: nowrap; }
td { border-bottom: 1px solid var(--line); padding: 9px 11px; vertical-align: top; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--fg) 2.5%, transparent); }
tr:last-child td { border-bottom: 0; }
td.val { font-weight: 600; overflow-wrap: anywhere; }
tr.off td { opacity: .55; }
.err-text { color: var(--danger); font-size: 12.5px; margin-top: 4px; max-width: 320px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--sunk); border-radius: 4px; padding: 1px 8px; font-size: 12.5px; font-weight: 500; color: var(--fg); white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.okc, .tag.d-pass { background: var(--ok-bg); color: var(--ok); }
.tag.d-ban, .tag.d-deleted { background: var(--err-bg); color: var(--danger); }
.tag.d-quarantine { background: var(--warn-bg); color: var(--warn); }
.allow-txt { color: var(--s-allowed); }
.ban-txt { color: var(--s-banned); }

/* ---------- Tuiles (comme le tableau de bord NAVSAT) */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.tile { display: grid; grid-template-columns: 60px 1fr; border-radius: 4px; overflow: hidden; color: #fff; text-decoration: none; min-height: 68px;
  background: var(--tc); box-shadow: 0 1px 4px rgba(0,0,0,.12); transition: transform .12s, box-shadow .12s; position: relative; }
.tile:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,.18); }
.tile.on { outline: 2px solid color-mix(in srgb, var(--tc) 45%, #fff); outline-offset: 2px; }
.tile-ico { display: grid; place-items: center; background: rgba(0,0,0,.16); }
.tile-ico .ico { width: 29px; height: 29px; stroke-width: 1.7; }
.tile-body { display: grid; grid-template-columns: auto 1fr; align-items: baseline; align-content: center; column-gap: 11px; padding: 8px 14px; min-width: 0; }
.tile-body strong { grid-row: span 2; align-self: center; font-size: 28px; font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-body span { font-size: 13px; text-transform: uppercase; letter-spacing: .3px; line-height: 1.3; }
.tile-body small { font-size: 12.5px; opacity: .88; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-pending { --tc: #ef8a00; } .t-released { --tc: #1e88e5; } .t-allowed { --tc: #15803d; } .t-banned { --tc: #c62828; } .t-all { --tc: #3f51b5; }

/* ---------- Panier */
.s-pending { --s: var(--s-pending); --s-bg: var(--s-pending-bg); }
.s-released { --s: var(--s-released); --s-bg: var(--s-released-bg); }
.s-allowed { --s: var(--s-allowed); --s-bg: var(--s-allowed-bg); }
.s-banned { --s: var(--s-banned); --s-bg: var(--s-banned-bg); }
.bulk { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: var(--surface); padding: 9px 12px; border-radius: 4px; box-shadow: var(--shadow); }
.check { display: flex; gap: 6px; align-items: center; margin-right: 8px; color: var(--muted); font-size: 14px; }
/* Une ligne par mail, comme une messagerie ; un clic la déplie (aperçu et décisions). */
.mails { background: var(--surface); border-radius: 4px; box-shadow: var(--shadow); overflow: hidden; }
.mails .empty { border: 0; border-radius: 0; }
.mail { display: grid; grid-template-columns: 40px minmax(0, 1fr); border-left: 4px solid var(--s); border-bottom: 1px solid var(--line); transition: background .4s; }
.mail:last-child { border-bottom: 0; }
.mail > input[type=checkbox] { justify-self: center; align-self: start; margin: 18px 0 0; }
.mail-row { display: grid; grid-template-columns: 136px minmax(130px, 240px) minmax(0, 1fr) auto auto 124px; gap: 14px; align-items: center;
  padding: 12px 14px 12px 0; cursor: pointer; list-style: none; min-height: 52px; font-size: 15px; }
.mail-row::-webkit-details-marker { display: none; }
.mail-row:hover { background: color-mix(in srgb, var(--fg) 3%, transparent); }
.mail-row .from, .mail-row .subject { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-row .from { color: var(--fg); }
.mail-row .subject { color: var(--muted); }
.mail-row time, .mail-row .gone { font-size: 13.5px; color: var(--muted); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.mail-row .box { font-size: 12.5px; color: var(--muted); background: var(--sunk); border-radius: 4px; padding: 0 6px; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.mail-row .flags { display: flex; gap: 4px; }
.mail-row .flags .tag { padding: 1px 6px; font-size: 12.5px; gap: 3px; }
.mail-row .flags .ico { width: 14px; height: 14px; }
.pill { justify-self: start; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--s); background: var(--s-bg);
  border-radius: 99px; padding: 2px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Jamais vu par l'utilisateur : fond bleuté et gras ; vu (ouvert ou survolé) : discret. */
.mail.new { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.mail.new .from { font-weight: 700; }
.mail.new .subject { color: var(--fg); font-weight: 600; }
.mail.new .from::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin: 0 8px 1px 0; }
.new-key { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-radius: 3px; padding: 0 5px; font-weight: 600; }
.new-count { color: var(--accent); font-weight: 600; }
.mail details[open] > .mail-row { border-bottom: 1px dashed var(--line); }
.mail-open { padding: 12px 16px 16px 0; display: grid; gap: 10px; }
.meta { color: var(--muted); font-size: 13.5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.meta b { color: var(--fg); font-weight: 500; }
.decision { font-size: 13.5px; color: var(--muted); margin: 0; }
.decision b { color: var(--s); }
.preview { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: 14.5px; background: var(--sunk); border-radius: 4px;
  padding: 12px 14px; max-height: 300px; overflow-y: auto; margin: 0; }
.atts { font-size: 13.5px; color: var(--muted); margin: 0; }
.actions { display: grid; gap: 8px; }
.actions button { font-size: 14px; padding: 5px 12px; min-height: 35px; }
.actions .sep { width: 8px; }
.actions .small { color: var(--muted); font-size: 13.5px; }
.actions .small label { display: flex; gap: 6px; align-items: center; }
.actions input, .actions select { min-height: 35px; padding: 5px 9px; font-size: 14px; }
/* Vues du panier : choix synthétique / intermédiaire / détaillé */
/* Intermédiaire et détaillé : bloc par mail, boutons toujours visibles */
.mail-main { min-width: 0; padding: 11px 16px 12px 0; display: grid; gap: 4px; }
.mail-line { display: flex; gap: 10px; align-items: center; min-width: 0; }
.mail-line .from { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-line .from b { font-weight: 500; }
.mail-line .addr { color: var(--muted); font-size: 13.5px; }
.mail-line .box { font-size: 12.5px; color: var(--muted); background: var(--sunk); border-radius: 4px; padding: 0 7px; white-space: nowrap; }
.mail-line time { margin-left: auto; font-size: 13.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-line .subject { min-width: 0; font-size: 15.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-line .flags { display: flex; gap: 4px; }
.mail-line .flags .tag { padding: 1px 6px; font-size: 12.5px; gap: 3px; }
.mail-line .flags .ico, .meta .ico { width: 14px; height: 14px; }
.mail.new .mail-line .from b { font-weight: 700; }
.mail.new .mail-line .subject { font-weight: 700; }
.mail.new .mail-line .from::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin: 0 8px 1px 0; }
.mail:not(.new) .mail-line .subject { color: color-mix(in srgb, var(--fg) 82%, var(--bg)); }
.v-intermediaire .mail > input[type=checkbox], .v-detaille .mail > input[type=checkbox] { margin-top: 15px; }
.mail-main .actions { margin-top: 5px; }
.actions.court .row { gap: 5px; }
.actions.court button { font-size: 13.5px; padding: 3px 10px; min-height: 31px; }
.actions .grp { font-size: 13px; color: var(--muted); margin-left: 4px; }
.actions .apercu-btn { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); margin-right: 6px; }
.actions button.del { color: var(--muted); border-color: transparent; background: transparent; }
.actions button.del:hover { color: var(--danger); background: var(--err-bg); }
.actions button.del .ico { width: 16px; height: 16px; }
.apercu, .apercu-ouvert { display: grid; gap: 8px; margin-top: 6px; }
.v-detaille .mail-main { gap: 6px; padding: 14px 18px 16px 0; }
.v-detaille .mail-line .subject { font-size: 16.5px; white-space: normal; }
.v-detaille .preview { max-height: 140px; }
.mails.v-intermediaire .mail + .mail, .mails.v-detaille .mail + .mail { border-top: 0; }
.mails.v-detaille .mail { border-bottom-width: 6px; border-bottom-color: var(--bg); }
.mails.trash .mail-row { grid-template-columns: 136px minmax(120px, 230px) minmax(0, 1fr) auto auto; }
.b-released { color: var(--s-released); border-color: var(--s-released); }
.b-allowed { color: var(--s-allowed); border-color: var(--s-allowed); }
.b-banned { color: var(--s-banned); border-color: var(--s-banned); }
.b-released:hover, .b-allowed:hover, .b-banned:hover { background: var(--sunk); }

/* ---------- Listes, import, pagination */
details.card.add > summary { cursor: pointer; font-weight: 500; }
details.card.add[open] > summary { margin-bottom: 14px; }
.add-form + .add-form { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.import p { margin: 0 0 10px; }
.import-list { width: 100%; font-family: var(--mono); font-size: 13px; margin-top: 6px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; }
.pager nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pager nav a, .pager nav .current { padding: 4px 10px; border-radius: 4px; border: 1px solid var(--line); text-decoration: none; color: var(--fg); background: var(--surface); }
.pager nav a:hover { border-color: var(--accent); color: var(--accent); }
.pager nav .current { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }

/* ---------- Connexion et comptes */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(circle at 85% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 55%), var(--bg); }
.card.login { width: min(400px, 100%); display: grid; gap: 14px; padding: 30px 26px; border-radius: 8px; }
.card.login label, .pw-form label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.card.login h2 { margin: 6px 0 0; }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-logo .logo img { height: 42px; }
.logo .logo-sombre, :root[data-theme="dark"] .logo .logo-clair { display: none; }
:root[data-theme="dark"] .logo .logo-sombre { display: block; }
.app-name { color: var(--muted); font-weight: 500; font-size: 15px; border-left: 1px solid var(--line); padding-left: 12px; }
.theme.floating { position: fixed; top: 14px; right: 14px; color: var(--fg); border: 1px solid var(--line); background: var(--surface); border-radius: 50%; width: 40px; padding: 0; }
.pw-form { display: grid; gap: 12px; }
.rules { margin: 0; padding-left: 18px; }
.card.lien { box-shadow: var(--shadow), inset 4px 0 0 var(--s-allowed); }
.card.lien input { flex: 1; font-family: var(--mono); font-size: 13px; }
.qr { display: block; background: #fff; border-radius: 6px; margin: 4px 0 8px; }
.secret { font-family: var(--mono); background: var(--sunk); padding: 2px 6px; border-radius: 4px; user-select: all; }
.code-input { font-size: 22px; letter-spacing: .3em; text-align: center; font-family: var(--mono); }
.steps { margin: 0 0 4px; padding-left: 18px; }

/* ---------- Guide pas à pas */
.guide-panel { position: fixed; right: 20px; bottom: 20px; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 110px); overflow-y: auto;
  background: var(--surface); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 2100; }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; background: var(--brand); color: #fff; border-radius: 8px 8px 0 0; position: sticky; top: 0; }
.guide-head b { font-weight: 500; font-size: 16px; }
.guide-head button { color: #fff; border: 0; background: transparent; min-height: 32px; padding: 4px 8px; }
.guide-head button:hover { background: rgba(255,255,255,.15); }
.guide-list { display: grid; padding: 8px 0; }
.guide-list button { justify-content: flex-start; text-align: left; border: 0; border-radius: 0; background: none; padding: 11px 16px; font-weight: 400; min-height: 0; gap: 12px; }
.guide-list button:hover { background: var(--sunk); color: var(--accent); }
.guide-list button small { display: block; color: var(--muted); font-size: 12.5px; }
.guide-list h3 { margin: 10px 16px 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.guide-step { padding: 16px; display: grid; gap: 10px; }
.guide-step p { margin: 0; }
.guide-step .progress { font-size: 12.5px; color: var(--muted); }
.guide-step .row { justify-content: space-between; }
.guide-fab { position: fixed; right: 20px; bottom: 20px; z-index: 2000; border-radius: 99px; background: var(--brand); color: #fff; border: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); padding: 9px 17px; min-height: 43px; }
.guide-fab:hover { background: color-mix(in srgb, var(--brand) 85%, #000); }
.guide-ring { position: fixed; z-index: 2050; border: 3px solid #f59e0b; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(8,12,20,.35); pointer-events: none;
  transition: all .2s; }
.guide-hide { display: none !important; }

/* ---------- Téléphone et tablette */
@media (max-width: 1200px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1280px) { .top-seg.vues span { display: none; } }
@media (max-width: 1100px) { .mail-row { grid-template-columns: 128px minmax(110px, 200px) minmax(0, 1fr) auto 112px; } .mail-row .box { display: none; } }
@media (max-width: 900px) {
  .burger { display: inline-flex; }
  .side { position: fixed; top: 60px; bottom: 0; left: 0; height: auto; transform: translateX(-105%); transition: transform .2s; box-shadow: 4px 0 18px rgba(0,0,0,.2); }
  body.side-open .side { transform: none; }
  body.side-open .side-shade { display: block; position: fixed; inset: 60px 0 0 0; background: rgba(8,12,20,.45); z-index: 890; }
  .pagehead { padding: 12px 15px; }
  .pagehead h1 { font-size: 21px; }
  .crumb { display: none; }
  .view { padding: 14px 11px 80px; }
  .top-btn.account span { display: none; }
  header.top .brand .app-name { display: none; }
}
@media (max-width: 600px) {
  .tiles { gap: 8px; }
  .tile { grid-template-columns: 40px 1fr; min-height: 52px; }
  .tile-ico .ico { width: 21px; height: 21px; }
  .tile-body { padding: 4px 8px; column-gap: 6px; } .tile-body strong { font-size: 22px; grid-row: auto; } .tile-body span { font-size: 11.5px; } .tile-body small { display: none; }
  header.top .brand img { height: 30px; }
  .guide-fab span { display: none; }
  /* Barre bleue sur téléphone : icônes seules ; le thème devient un seul bouton (vers l'autre thème) */
  .top-seg { margin: 0 2px; }
  .top-seg span, #guide-open span { display: none; }
  .top-seg a, .top-seg button { padding: 5px 8px; }
  .theme-seg .t-light, :root[data-theme="dark"] .theme-seg .t-dark { display: none; }
  :root[data-theme="dark"] .theme-seg .t-light { display: inline-flex; }
  .theme-seg .t-dark, :root[data-theme="dark"] .theme-seg .t-light { border-left: 0; }
  header.top { gap: 2px; padding: 0 6px; }
  .mail-row, /* Vues du panier : choix synthétique / intermédiaire / détaillé */
/* Intermédiaire et détaillé : bloc par mail, boutons toujours visibles */
.mail-main { min-width: 0; padding: 11px 16px 12px 0; display: grid; gap: 4px; }
.mail-line { display: flex; gap: 10px; align-items: center; min-width: 0; }
.mail-line .from { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-line .from b { font-weight: 500; }
.mail-line .addr { color: var(--muted); font-size: 13.5px; }
.mail-line .box { font-size: 12.5px; color: var(--muted); background: var(--sunk); border-radius: 4px; padding: 0 7px; white-space: nowrap; }
.mail-line time { margin-left: auto; font-size: 13.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mail-line .subject { min-width: 0; font-size: 15.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-line .flags { display: flex; gap: 4px; }
.mail-line .flags .tag { padding: 1px 6px; font-size: 12.5px; gap: 3px; }
.mail-line .flags .ico, .meta .ico { width: 14px; height: 14px; }
.mail.new .mail-line .from b { font-weight: 700; }
.mail.new .mail-line .subject { font-weight: 700; }
.mail.new .mail-line .from::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin: 0 8px 1px 0; }
.mail:not(.new) .mail-line .subject { color: color-mix(in srgb, var(--fg) 82%, var(--bg)); }
.v-intermediaire .mail > input[type=checkbox], .v-detaille .mail > input[type=checkbox] { margin-top: 15px; }
.mail-main .actions { margin-top: 5px; }
.actions.court .row { gap: 5px; }
.actions.court button { font-size: 13.5px; padding: 3px 10px; min-height: 31px; }
.actions .grp { font-size: 13px; color: var(--muted); margin-left: 4px; }
.actions .apercu-btn { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); margin-right: 6px; }
.actions button.del { color: var(--muted); border-color: transparent; background: transparent; }
.actions button.del:hover { color: var(--danger); background: var(--err-bg); }
.actions button.del .ico { width: 16px; height: 16px; }
.apercu, .apercu-ouvert { display: grid; gap: 8px; margin-top: 6px; }
.v-detaille .mail-main { gap: 6px; padding: 14px 18px 16px 0; }
.v-detaille .mail-line .subject { font-size: 16.5px; white-space: normal; }
.v-detaille .preview { max-height: 140px; }
.mails.v-intermediaire .mail + .mail, .mails.v-detaille .mail + .mail { border-top: 0; }
.mails.v-detaille .mail { border-bottom-width: 6px; border-bottom-color: var(--bg); }
.mails.trash .mail-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 8px; }
  .mail-row .subject { grid-column: 1 / -1; grid-row: 2; }
  .mail-row .flags, .mail-row .box { display: none; }
  .vues a span { display: none; }
  .mail-line .addr, .mail-line .box { display: none; }
  .actions button.del span, .mail-line .pill { display: none; }
  .actions .grp { flex-basis: 100%; margin: 2px 0 -2px; }
}
header.top .top-app { color: #fff; font-size: 18px; font-weight: 500; border-left: 1px solid rgba(255,255,255,.35); padding-left: 12px; }
.login-col { display: grid; gap: 12px; width: min(400px, 100%); }
.login-col .card.login { width: 100%; }
@media (max-width: 900px) { header.top .top-app { display: none; } }
