/* Spamvor Quarantaine (qua4), direction C « Papier suisse ».
   Couleurs en jetons : thème clair par défaut, sombre et système selon
   <html data-theme>, posé côté serveur (aucun flash au chargement).
   Rouge suisse réservé au logo, aux liens actifs et au spam. */

/* ---- polices (scripts/vendor.sh) ------------------------------------- */
@font-face { font-family: Archivo; font-style: normal; font-display: swap; font-weight: 400; src: url(vendor/fonts/archivo-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Archivo; font-style: normal; font-display: swap; font-weight: 400; src: url(vendor/fonts/archivo-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Archivo; font-style: normal; font-display: swap; font-weight: 500; src: url(vendor/fonts/archivo-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Archivo; font-style: normal; font-display: swap; font-weight: 500; src: url(vendor/fonts/archivo-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Archivo; font-style: normal; font-display: swap; font-weight: 600; src: url(vendor/fonts/archivo-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Archivo; font-style: normal; font-display: swap; font-weight: 600; src: url(vendor/fonts/archivo-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Archivo; font-style: normal; font-display: swap; font-weight: 700; src: url(vendor/fonts/archivo-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Archivo; font-style: normal; font-display: swap; font-weight: 700; src: url(vendor/fonts/archivo-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 400; src: url(vendor/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 400; src: url(vendor/fonts/jetbrains-mono-latin-ext-400-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 500; src: url(vendor/fonts/jetbrains-mono-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 500; src: url(vendor/fonts/jetbrains-mono-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---- jetons ------------------------------------------------------------ */
:root {
  --bg: #f4f2ec;
  --surface: #fbfaf7;
  --raised: #efede6;
  --hover: #f0eee7;
  --border: #dcd8cd;
  --border-strong: #bdb8ab;
  --text: #161513;
  --text-2: #3a3833;
  --muted: #5f5b52;
  --accent: #161513;
  --accent-text: #b8221a;
  --accent-soft: #e9e6dc;
  --primary: #161513;
  --on-primary: #fbfaf7;
  --brand: #d52b1e;
  --danger: #a3190f;
  --danger-soft: #f7e1dc;
  --danger-solid: #d52b1e;
  --warn: #7a5200;
  --warn-soft: #f6ecd4;
  --ok: #2f6b2f;
  --ok-soft: #e5ece3;
  --sel: #efebe0;
  --shadow: 0 1px 2px rgba(22, 21, 19, 0.06), 0 8px 24px rgba(22, 21, 19, 0.08);
  --font: Archivo, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --row: 36px;
  --radius: 10px;
  --radius-sm: 7px;
  --topbar: 52px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121211;
  --surface: #1a1a18;
  --raised: #20201e;
  --hover: #242422;
  --border: #2e2d2a;
  --border-strong: #45433e;
  --text: #f1efe9;
  --text-2: #c9c6bd;
  --muted: #a29e95;
  --accent: #f1efe9;
  --accent-text: #ff7a69;
  --accent-soft: #2a2926;
  --primary: #f1efe9;
  --on-primary: #121211;
  --brand: #d52b1e;
  --danger: #ff8c7e;
  --danger-soft: #351a16;
  --danger-solid: #d52b1e;
  --warn: #e3b75e;
  --warn-soft: #2d2412;
  --ok: #93cf8f;
  --ok-soft: #1b2a1b;
  --sel: #24231f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #121211;
    --surface: #1a1a18;
    --raised: #20201e;
    --hover: #242422;
    --border: #2e2d2a;
    --border-strong: #45433e;
    --text: #f1efe9;
    --text-2: #c9c6bd;
    --muted: #a29e95;
    --accent: #f1efe9;
    --accent-text: #ff7a69;
    --accent-soft: #2a2926;
    --primary: #f1efe9;
    --on-primary: #121211;
    --brand: #d52b1e;
    --danger: #ff8c7e;
    --danger-soft: #351a16;
    --danger-solid: #d52b1e;
    --warn: #e3b75e;
    --warn-soft: #2d2412;
    --ok: #93cf8f;
    --ok-soft: #1b2a1b;
    --sel: #24231f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

/* ---- base -------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.45 var(--font);
  font-feature-settings: "tnum" 1;
}
a { color: var(--text); text-underline-offset: 2px; }
a:hover { color: var(--accent-text); }
h1 { margin: 0; font-size: 20px; font-weight: 650; line-height: 1.25; letter-spacing: -0.3px; }
h2 { margin: 0; font-size: 14.5px; font-weight: 650; }
h3 { margin: 0; font-size: 13px; font-weight: 600; }
hr { width: 100%; margin: 8px 0; border: 0; border-top: 1px solid var(--border); }
code, kbd, .mono { font-family: var(--mono); font-size: 12px; }
code { color: var(--muted); }
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 10.5px; line-height: 16px; text-align: center; color: var(--muted); background: var(--surface);
}
.muted { color: var(--muted); }
.small { margin: 0; font-size: 12.5px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.ellipsis, .trunc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- barre du haut ----------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  min-height: var(--topbar); padding: 6px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 0;
  background: var(--accent); opacity: 0; transition: width 0.6s ease-out, opacity 0.2s;
}
html.is-loading .topbar::after { width: 70%; opacity: 1; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-size: 14.5px; font-weight: 650; text-decoration: none; letter-spacing: -0.1px; }
.brand:hover { color: var(--text); }
.brand-sub { font-weight: 500; color: var(--muted); }
.brand-mark { width: 26px; height: 26px; flex: none; }
.brand-mark rect { fill: var(--brand); }
.brand-mark path { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linejoin: round; }
.brand-lg { font-size: 18px; margin-bottom: 28px; }
.brand-lg .brand-mark { width: 32px; height: 32px; }

.global-search {
  flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--muted);
}
.global-search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.global-search input, .global-search input[type=search], .global-search input[type=search]:focus { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 13px; }
.user { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.user form { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  height: 30px; padding: 0 9px; border: 0; background: transparent; color: var(--text-2);
  font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.plain { border-color: transparent; color: var(--muted); }
.divider { width: 1px; height: 22px; background: var(--border); }
.avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 700;
}
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.who-name { max-width: 240px; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 11.5px; color: var(--muted); }

/* ---- structure ----------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); align-items: start; }
.sidenav {
  position: sticky; top: var(--topbar); max-height: calc(100vh - var(--topbar)); overflow-y: auto;
  display: flex; flex-direction: column; gap: 1px; padding: 14px 10px 24px; border-right: 1px solid var(--border);
  min-height: calc(100vh - var(--topbar));
}
.nav-title { margin: 18px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); }
.nav-title:first-child { margin-top: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 9px; min-height: 32px; padding: 0 10px; border-radius: 6px;
  color: var(--text-2); text-decoration: none;
}
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link > span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.count { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.nav-link.is-active .count { color: inherit; }
.content { min-width: 0; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 14px; }
.content:focus { outline: none; }
.content > * { min-width: 0; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.page-head p { margin: 0; max-width: 760px; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.title-row { display: flex; align-items: center; gap: 10px; }
.badge-count {
  font-family: var(--mono); font-size: 12px; padding: 1px 7px; border-radius: 5px;
  background: var(--raised); border: 1px solid var(--border); color: var(--text-2);
}

/* ---- panneaux, piles ------------------------------------------------------ */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.panel.stack { padding: 18px 20px; }

/* ---- boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn kbd { border-color: currentColor; color: inherit; background: transparent; opacity: 0.55; line-height: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn-primary:hover { color: var(--on-primary); border-color: var(--primary); filter: brightness(1.15); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; height: 36px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.link-btn {
  max-width: 100%; padding: 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-btn:hover { color: var(--accent-text); text-decoration: underline; }

/* ---- formulaires ---------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.field.grow { flex: 1 1 260px; }
input[type=text], input[type=password], input[type=search], input[type=email], select {
  height: 34px; width: 100%; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
}
input[type=text]:focus, input[type=password]:focus, input[type=search]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[aria-invalid=true] { border-color: var(--danger); }
.field-error { flex-basis: 100%; margin: 0; color: var(--danger); font-weight: 500; }
input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 2px; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.field-hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.new-domain { max-width: 560px; }
.field-row .field { flex: 1 1 160px; }

.search {
  display: flex; align-items: center; gap: 7px; flex: 0 1 300px; min-width: 200px; height: 32px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted);
}
.search input { height: 100%; min-height: 0; padding: 0; border: 0; background: transparent; outline: none; font-size: 13px; }
.search input:focus { outline: none; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- messages ------------------------------------------------------------- */
.flash { padding: 9px 14px; border-radius: var(--radius-sm); font-weight: 500; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--accent-soft); color: var(--text); }
.flash-floating { max-width: 420px; margin: 24px auto 0; }
.viewing-as {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 14px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--warn); font-weight: 600;
}
.viewing-as .btn { margin-left: auto; }
.notice { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.warning { margin: 0; padding: 9px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-weight: 600; }

/* ---- onglets (administration) -------------------------------------------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); text-decoration: none; font-weight: 500;
}
.tab:hover { color: var(--text); background: var(--hover); }
.tab.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; }

/* ---- barre d'outils et tableaux ------------------------------------------- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 46px; padding: 7px 12px;
  border-bottom: 1px solid var(--border);
}
.toolbar.has-selection { background: var(--sel); }
.toolbar-info { color: var(--muted); font-size: 12.5px; }
.toolbar-hint { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.toolbar-selected { color: var(--text); font-weight: 600; font-size: 12.5px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.table-wrap { position: relative; overflow-x: auto; }
.mail-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.mail-table th {
  height: 34px; padding: 0 8px; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.mail-table th a { color: inherit; text-decoration: none; }
.mail-table th a:hover { color: var(--text); }
.mail-table th[aria-sort=ascending], .mail-table th[aria-sort=descending] { color: var(--text); }
.mail-table td { height: var(--row); padding: 0 8px; border-top: 1px solid var(--border); vertical-align: middle; }
.mail-table tbody tr:first-child td { border-top: 0; }
.mail-table th:first-child, .mail-table td:first-child { padding-left: 12px; }
.mail-table th:last-child, .mail-table td:last-child { padding-right: 12px; }
.mail-table tbody tr:hover { background: var(--hover); }
.mail-table tr.is-selected { background: var(--sel); }
form[data-select] tbody tr:has(input[name="ids[]"]) { cursor: pointer; }
.mail-table tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.mail-table tr.is-gone { display: none; }
.mail-table .col-main { position: relative; }
.row-open { position: absolute; top: 50%; right: 4px; width: 28px; height: 28px; transform: translateY(-50%); opacity: 0; background: var(--surface); }
.mail-table tr:hover .row-open, .row-open:focus-visible { opacity: 1; }
.col-check { width: 36px; }
.col-score { width: 150px; white-space: nowrap; }
.col-from { width: 26%; max-width: 0; }
.col-main { max-width: 0; }
.col-to { width: 18%; max-width: 0; }
.col-date { width: 92px; text-align: right; white-space: nowrap; }
.col-actions { text-align: right; white-space: nowrap; }
.cell-trunc { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.addr { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
td.col-date, .col-date time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.row-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
.row-link:hover { color: var(--text); text-decoration: underline; }
.js .row-link:hover { text-decoration: none; }
.row-link .from, .row-link .subject { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-link .from { font-weight: 600; }
.row-link .subject { color: var(--text-2); }
.mail-table tbody tr[data-row], .mail-table tr[data-row-form] { cursor: pointer; }
.m-only { display: none !important; }

/* Gravité : une seule teinte rouge, trois intensités */
.score {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; border: 1px solid transparent;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.score-high { background: var(--danger-solid); color: #fff; }
.score-mid { background: var(--danger-soft); color: var(--danger); }
.score-low { border-color: var(--danger); color: var(--danger); }
.score-none { border-color: var(--border-strong); color: var(--muted); }
.score-ok { background: var(--ok-soft); color: var(--ok); }
.score-num { margin-left: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.tag {
  display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;
  padding: 1px 7px; border-radius: 5px; font-family: var(--mono); font-size: 11.5px; background: var(--danger-soft); color: var(--danger);
}
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill-white { background: var(--ok-soft); color: var(--ok); }
.pill-black { background: var(--danger-soft); color: var(--danger); }
.pill-level { background: var(--raised); color: var(--text-2); border: 1px solid var(--border); }
.pill-level-S, .pill-level-A { background: var(--accent-soft); color: var(--text); }

.empty { padding: 48px 24px; text-align: center; }
.empty-title { margin: 0; font-weight: 600; color: var(--text-2); }
.empty-hint { margin: 6px 0 0; color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); font-size: 12.5px; }
.pager-links { display: flex; gap: 6px; }
.table-note { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.table-foot { display: flex; justify-content: flex-end; padding: 10px 12px; border-top: 1px solid var(--border); }

/* ---- message --------------------------------------------------------------- */
.back { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; color: var(--text-2); font-weight: 500; text-decoration: none; }
.back:hover { color: var(--accent-text); }
.message-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.message { min-width: 0; overflow: hidden; }
.message-side { display: flex; flex-direction: column; gap: 14px; }
.message-head { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.message-head h1 { font-size: 18px; overflow-wrap: anywhere; }
.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; margin: 0; font-size: 13px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); }
.view-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.view-tab { display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 6px; color: var(--text-2); text-decoration: none; font-size: 12.5px; }
.view-tab:hover { background: var(--hover); color: var(--text); }
.view-tab.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.message-body { padding: 16px 20px; }
.text-body, .raw { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.text-body { font: 14px/1.6 var(--font); }
.raw { max-height: 70vh; overflow: auto; padding: 12px; border-radius: var(--radius-sm); background: var(--bg); font: 12px/1.55 var(--mono); }
.html-body { width: 100%; height: 60vh; min-height: 320px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.attachments { list-style: none; margin: 0; padding: 10px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.attachments li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-2); }
.attachments li .muted { font-family: var(--mono); font-size: 11.5px; }
.actions { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.actions .btn, .actions .btn-block { justify-content: flex-start; }
.actions .btn kbd { margin-left: auto; }
.why { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.why-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.rules li { display: flex; justify-content: space-between; gap: 12px; }
.rules li > span:first-child { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.rules code { font-size: 11px; }
.rule-score { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--danger); white-space: nowrap; }
.rule-score.is-negative { color: var(--ok); }

/* ---- listes, paramètres --------------------------------------------------- */
.add-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 14px 16px; }
.add-form .field:not(.grow) { flex: 0 1 200px; }
.add-form.compact { padding: 0; }
form.inline { display: inline; margin: 0; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.plain { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.plain.mono li { font-family: var(--mono); font-size: 12.5px; }
.shortcuts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; align-items: center; font-size: 13px; }
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--text-2); }

/* ---- connexion -------------------------------------------------------------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 400px; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 20px; }
.login-card > p { margin: 6px 0 20px; }
.login-card .flash { margin-bottom: 14px; }
.login-card .stack { gap: 14px; }
.login-card .btn-block { margin-top: 4px; }
.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---- administration --------------------------------------------------------- */
.admin-tabs { margin-bottom: 2px; }
.domain-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 14px; align-items: start; }
.filter-table select { width: 100%; min-width: 170px; }
.admin-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.admin-list li:last-child { border-bottom: 0; }
.reports-table .cell-trunc { max-width: 220px; }
.reports-table .col-mail { width: 42%; max-width: 0; }
.reports-table .col-result { width: 30%; }
.reports-table td { height: auto; padding-top: 7px; padding-bottom: 7px; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.stat-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stat-card h3 { color: var(--text-2); }
.stat-total { margin: 0; font-family: var(--mono); font-size: 22px; font-weight: 500; }
.stat-total .muted { font-family: var(--font); font-size: 13px; }
.stat-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--raised); }
.stat-bar span { display: block; height: 100%; width: 0; }
.seg-good, .dot-good { background: var(--ok); }
.seg-spam, .dot-spam { background: var(--danger-solid); }
.seg-virus, .dot-virus { background: var(--warn); }
.stat-legend, .stat-rows { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.stat-legend li { display: flex; align-items: center; gap: 8px; }
.stat-legend strong, .stat-rows strong { font-family: var(--mono); font-weight: 500; font-size: 12.5px; }
.stat-legend .muted { margin-left: auto; font-family: var(--mono); font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.stat-rows li { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr auto; align-items: center; gap: 10px; }
.stat-row-bar { height: 6px; border-radius: 3px; overflow: hidden; background: var(--raised); }
.stat-row-bar span { display: block; height: 100%; width: 0; background: var(--text-2); }

/* ---- notifications et « Annuler » ------------------------------------------ */
.toasts { position: fixed; z-index: 50; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(480px, calc(100vw - 32px)); }
.toast {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 8px 8px 14px;
  border-radius: var(--radius); background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow); font-weight: 500;
}
.toast-text { flex: 1; min-width: 0; }
.toast-error { background: var(--danger-solid); color: #fff; }
.toast .btn { height: 28px; border-color: transparent; background: transparent; color: inherit; font-weight: 600; text-decoration: underline; }
.toast .btn:hover { background: rgba(127, 127, 127, 0.2); color: inherit; }
.toast-timer { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: 0.35; transform-origin: left; animation: countdown 10s linear forwards; }
@keyframes countdown { to { transform: scaleX(0); } }

/* ---- palette ⌘K --------------------------------------------------------------- */
.palette {
  width: min(560px, calc(100vw - 32px)); margin: 12vh auto auto; padding: 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.palette::backdrop { background: rgba(18, 18, 17, 0.35); }
.palette-input { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--muted); }
.palette-input input { height: 100%; border: 0; padding: 0; background: transparent; font-size: 15px; }
.palette-input input:focus { outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 6px; cursor: pointer; color: var(--text-2); }
.palette li .muted { margin-left: auto; font-size: 12px; }
.palette li[aria-selected=true] { background: var(--accent-soft); color: var(--text); }
.palette-foot { display: flex; flex-wrap: wrap; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* ---- transitions ------------------------------------------------------------------ */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 120ms; }
@media (prefers-reduced-motion: reduce) {
  *, ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; transition: none !important; }
}

/* ---- écrans moyens et petits ---------------------------------------------------- */
@media (max-width: 1100px) {
  .message-layout, .domain-grid { grid-template-columns: minmax(0, 1fr); }
  /* Page du message sur une colonne : les actions avant le contenu */
  .message-side { display: contents; }
  .message-side .actions { order: -1; }
}
@media (max-width: 860px) {
  .shell { display: block; }
  .sidenav {
    position: static; max-height: none; min-height: 0; flex-direction: row; overflow-x: auto; gap: 4px;
    padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .nav-title, .sidenav hr { display: none; }
  .nav-link { flex: none; }
  .content { padding: 16px 12px 32px; }
  .global-search { order: 3; flex-basis: 100%; max-width: none; }
  .who, .divider, .toolbar-hint { display: none; }
  .search { flex: 1 1 100%; }
  .toolbar-actions { margin-left: 0; width: 100%; }
  .toolbar-actions .btn { flex: 1 1 auto; }
  .btn kbd { display: none; }
  .col-to, .col-from { display: none; }
  .m-only { display: block !important; }
  .mail-table td { height: auto; padding-top: 6px; padding-bottom: 6px; }
  .mail-table .col-score { width: 96px; white-space: normal; }
  .score { white-space: nowrap; }
  .score-num { display: none; }
  .message-head, .message-body { padding: 14px; }
  .login-card { padding: 24px; }
}
