/* VSend — Messagerie. Proposition de direction visuelle (non validée).
   Inspirations d’usage : messagerie en trois volets, sobriété monochrome, détails « produit développeur ».
   Police Geist (SIL OFL 1.1) embarquée localement dans assets/fonts : aucune ressource distante. */

@font-face { font-family: "Geist"; src: url("fonts/geist-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap;
  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: "Geist"; src: url("fonts/geist-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap;
  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 {
  color-scheme: light;
  --font: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --canvas: #f3f3f4;
  --canvas-hover: #e8e8ea;
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --surface-3: #ececee;
  --hover: #f4f4f5;
  --active: #f0f0f2;
  --sidebar: transparent;
  --line: #e9e9ec;
  --line-strong: #d9d9de;
  --scroll: color-mix(in srgb, var(--text) 18%, transparent);
  --scroll-hover: color-mix(in srgb, var(--text) 36%, transparent);
  --text: #09090b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;

  --primary: #18181b;
  --primary-hover: #2e2e33;
  --on-primary: #ffffff;
  --accent: #5b5bd6;
  --accent-hover: #4d4dc6;
  --accent-soft: #efeffd;
  --accent-softer: #f6f6fe;
  --accent-text: #4747b8;
  --on-accent: #ffffff;

  --danger: #c4281c;
  --danger-soft: #fdeceb;
  --warn: #9a5a00;
  --warn-soft: #fff5e0;
  --ok: #157a3d;
  --ok-soft: #e7f6ec;

  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  --r-xs: 5px;
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --card-ring: 0 0 0 1px var(--line), 0 1px 2px rgb(16 16 24 / .04), 0 8px 24px -12px rgb(16 16 24 / .08);

  --shadow-xs: 0 1px 2px rgb(16 16 24 / .05);
  --shadow-sm: 0 1px 3px rgb(16 16 24 / .06), 0 1px 2px rgb(16 16 24 / .04);
  --shadow: 0 10px 30px -8px rgb(16 16 24 / .16), 0 2px 6px rgb(16 16 24 / .05);
  --shadow-lg: 0 28px 70px -16px rgb(16 16 24 / .32), 0 0 0 1px rgb(16 16 24 / .06);

  --top-h: 56px;
  --side-w: 252px;
  --rail-w: 68px;
  --list-w: 400px;
  --ai-w: 368px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #09090b; --canvas-hover: #18181b; --bg: #0c0c0e; --surface: #111113; --surface-2: #17171a; --surface-3: #1f1f23; --hover: #19191c; --active: #1e1e22; --sidebar: transparent;
    --line: #222226; --line-strong: #303036; --text: #fafafa; --text-2: #d4d4d8; --muted: #a1a1aa; --faint: #71717a;
    --primary: #fafafa; --primary-hover: #e4e4e7; --on-primary: #09090b;
    --card-ring: 0 0 0 1px var(--line), 0 10px 30px -12px rgb(0 0 0 / .6);
    --accent: #5b5bd6; --accent-hover: #6a6ae2; --accent-soft: #1c1c38; --accent-softer: #15152a; --accent-text: #a9abff; --on-accent: #ffffff;
    --danger: #ff7a70; --danger-soft: #2b1312; --warn: #f2b14b; --warn-soft: #2a1e0c; --ok: #5bd28a; --ok-soft: #0e2416;
    --shadow-xs: 0 1px 2px rgb(0 0 0 / .4); --shadow-sm: 0 1px 3px rgb(0 0 0 / .5);
    --shadow: 0 14px 34px -10px rgb(0 0 0 / .7), 0 0 0 1px rgb(255 255 255 / .04);
    --shadow-lg: 0 30px 80px -18px rgb(0 0 0 / .85), 0 0 0 1px rgb(255 255 255 / .07);
  }
}
:root[data-theme="dark"] {
  --canvas: #09090b; --canvas-hover: #18181b; --bg: #0c0c0e; --surface: #111113; --surface-2: #17171a; --surface-3: #1f1f23; --hover: #19191c; --active: #1e1e22; --sidebar: transparent;
  --line: #222226; --line-strong: #303036; --text: #fafafa; --text-2: #d4d4d8; --muted: #a1a1aa; --faint: #71717a;
  --primary: #fafafa; --primary-hover: #e4e4e7; --on-primary: #09090b;
  --card-ring: 0 0 0 1px var(--line), 0 10px 30px -12px rgb(0 0 0 / .6);
  --accent: #5b5bd6; --accent-hover: #6a6ae2; --accent-soft: #1c1c38; --accent-softer: #15152a; --accent-text: #a9abff; --on-accent: #ffffff;
  --danger: #ff7a70; --danger-soft: #2b1312; --warn: #f2b14b; --warn-soft: #2a1e0c; --ok: #5bd28a; --ok-soft: #0e2416;
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .4); --shadow-sm: 0 1px 3px rgb(0 0 0 / .5);
  --shadow: 0 14px 34px -10px rgb(0 0 0 / .7), 0 0 0 1px rgb(255 255 255 / .04);
  --shadow-lg: 0 30px 80px -18px rgb(0 0 0 / .85), 0 0 0 1px rgb(255 255 255 / .07);
}

/* ─── Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; flex-direction: column; height: 100dvh; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); letter-spacing: -.008em; font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-underline-offset: .18em; }
h1, h2, h3 { margin: 0; letter-spacing: -.025em; }
p { margin: 0; }
code, kbd { font-family: var(--mono); font-size: .86em; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.65em; height: 1.65em; padding: 0 .4em;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: var(--r-xs); background: var(--surface); color: var(--text-2); font-size: 11px; line-height: 1;
}
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-xs { width: 13px; height: 13px; }
.hint { color: var(--muted); font-size: 12.5px; }
.hint code { padding: 1px 5px; border-radius: 4px; background: var(--surface-3); }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--r); background: var(--text); color: var(--bg); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 12px; }
.noscript { padding: 24px; }

/* ─── Boutons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font-weight: 550; font-size: 13.5px; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-xs);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .icon-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgb(40 40 140 / .25), inset 0 1px 0 rgb(255 255 255 / .14); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn.danger { color: #1b0505; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { color: #1b0505; } }
.btn.danger-text, .danger-text { color: var(--danger); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.ai-btn { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-softer); }
.ai-btn:hover { background: var(--accent-soft); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; flex: none;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); text-decoration: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn[aria-pressed="true"], .icon-btn[aria-expanded="true"] { background: var(--active); color: var(--text); }
.icon-btn-sm { width: 30px; height: 30px; }
.icon-btn-xs { width: 24px; height: 24px; border-radius: var(--r-xs); }
.link-btn { padding: 4px 6px; border: 0; border-radius: var(--r-xs); background: none; color: var(--muted); font-size: 12.5px; font-weight: 550; }
.link-btn:hover { color: var(--text); background: var(--hover); }
.link-btn[aria-expanded="true"] { color: var(--accent-text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 520; white-space: nowrap;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.badge-ai { background: var(--accent-soft); color: var(--accent-text); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ─── Formulaires ───────────────────────────────────── */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-width: 0; height: 36px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.5; }
input:not([type="checkbox"]):not([type="radio"]):focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="search"]::-webkit-search-cancel-button { display: none; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field-inline { max-width: 320px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.span-2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; font-size: 13.5px; }
.check-row { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 10px; }
.switch { appearance: none; -webkit-appearance: none; position: relative; width: 34px !important; height: 20px !important; flex: none; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .3); transition: transform .2s var(--ease); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }
.switch:disabled { opacity: .55; cursor: not-allowed; }

/* ─── Barres de défilement : fines, discrètes, visibles au survol ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: transparent; background-clip: padding-box; }
:hover::-webkit-scrollbar-thumb, :focus-within::-webkit-scrollbar-thumb { background-color: var(--scroll); }
::-webkit-scrollbar-thumb:hover { background-color: var(--scroll-hover); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  :hover, :focus-within { scrollbar-color: var(--scroll) transparent; }
}

/* ─── Barre supérieure ─────────────────────────────── */
.topbar {
  flex: none; display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 14px 0 10px;
  border-bottom: 1px solid var(--line); background: var(--surface); position: relative; z-index: 30;
}
.brand { display: inline-flex; align-items: center; gap: 9px; padding: 4px 6px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.03em; }
.topbar-start { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 6px; width: calc(var(--side-w) - 10px); padding-right: 2px; }
body.rail .topbar-start { width: auto; }
.nav-toggle { width: 32px; height: 32px; color: var(--faint); }
.nav-toggle[aria-expanded] { background: none; }
.nav-toggle:hover, .nav-toggle:focus-visible { background: var(--hover); color: var(--text); }
.search { position: relative; flex: 1 1 auto; max-width: 600px; margin: 0; display: flex; align-items: center; }
.search input {
  height: 40px !important; padding: 0 76px 0 38px !important; border-radius: var(--r) !important;
  background: var(--surface-2) !important; border-color: transparent !important;
}
.search input:hover { border-color: var(--line) !important; }
.search input:focus-visible { background: var(--surface) !important; border-color: var(--accent) !important; }
.search-icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search-kbd { position: absolute; right: 46px; pointer-events: none; }
.search-filters { position: absolute; right: 3px; width: 34px; height: 34px; }
.search-panel { position: absolute; top: calc(100% + 8px); left: 0; right: 0; padding: 18px; }
.popover { z-index: 60; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.popover-title { font-size: 14px; margin-bottom: 14px; }
.popover-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.topbar-actions:empty { display: none; }
.search-open { display: none; }
.avatar {
  --h: 250; display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%;
  background: hsl(var(--h) 62% 92%); color: hsl(var(--h) 45% 32%); font-size: 12.5px; font-weight: 650; letter-spacing: .01em; user-select: none;
}
:root[data-theme="dark"] .avatar { background: hsl(var(--h) 34% 22%); color: hsl(var(--h) 70% 82%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar { background: hsl(var(--h) 34% 22%); color: hsl(var(--h) 70% 82%); } }
.avatar-sm { width: 32px; height: 32px; font-size: 11.5px; }
.avatar-lg { width: 64px; height: 64px; font-size: 20px; }

.status-banner { flex: none; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 16px; font-size: 13px; font-weight: 520; border-bottom: 1px solid var(--line); }
.status-banner.warn { background: var(--warn-soft); color: var(--warn); }
.status-banner.danger { background: var(--danger-soft); color: var(--danger); }
.status-banner.info { background: var(--accent-soft); color: var(--accent-text); }
.status-banner .btn { min-height: 28px; }

/* ─── Disposition principale ───────────────────────── */
.app { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
body.rail .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
.main { min-width: 0; min-height: 0; display: grid; grid-template-columns: var(--list-w) minmax(0, 1fr); background: var(--surface); }
body.ai-open .main { grid-template-columns: var(--list-w) minmax(0, 1fr) var(--ai-w); }
body:not([data-view="mail"]) .main { grid-template-columns: minmax(0, 1fr); }
.main:focus { outline: none; }

/* ─── Sidebar ──────────────────────────────────────── */
.sidebar { min-height: 0; display: flex; flex-direction: column; gap: 4px; padding: 14px 10px 0; border-right: 1px solid var(--line); background: var(--sidebar); overflow: hidden; }
.sidebar-nav { flex: 1 1 auto; min-height: 0; width: calc(100% + 20px); margin: 0 -10px; padding: 0 2px 12px 10px; overflow-y: auto; scrollbar-gutter: stable; overflow-x: hidden; overscroll-behavior: contain; }
.compose-btn { width: 100%; min-height: 42px; margin-bottom: 10px; border-radius: var(--r); font-size: 14px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; height: 34px; padding: 0 10px; border-radius: var(--r-sm);
  color: var(--text-2); text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item[aria-current="page"] { background: var(--active); color: var(--text); font-weight: 620; }
.nav-item[aria-current="page"] .i { color: var(--accent-text); }
.nav-item .i { color: var(--muted); }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-count { font-size: 12px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-count.strong { color: var(--accent-text); }
.nav-dot { width: 10px; height: 10px; margin: 0 4px; flex: none; border-radius: 3px; background: var(--c); }
.nav-section { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 2px; padding: 0 4px 0 10px; }
.nav-heading { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); }
.nav-list-bottom { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav-item.drop-target { background: var(--accent-soft); }
.sidebar-foot { flex: none; display: grid; gap: 6px; width: calc(100% + 20px); margin: 0 -10px; padding: 10px 10px 10px; border-top: 1px solid var(--line); }
.storage { display: block; padding: 8px 10px 10px; border-radius: var(--r-sm); color: inherit; text-decoration: none; }
.storage:hover { background: var(--hover); }
.storage .meter { display: block; }
.account { display: flex; align-items: center; gap: 2px; }
.account-btn { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 6px; border: 0; border-radius: var(--r); background: none; color: var(--text); text-align: left; }
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--hover); }
.account-text { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.account-name, .account-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name { font-size: 13px; font-weight: 620; }
.account-mail { font-size: 11.5px; color: var(--muted); }
.account-chev { flex: none; color: var(--faint); }
.account-settings { flex: none; width: 36px; height: 36px; }
.account-settings[aria-current="page"] { background: var(--active); color: var(--accent-text); }
.storage-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.storage-head span:first-child { font-weight: 600; color: var(--text-2); }
.meter { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .5s var(--ease); }
.storage.full .meter span { background: var(--warn); }
.storage.full .storage-head span:last-child { color: var(--warn); font-weight: 600; }

/* Rail (sidebar réduite) */
body.rail .sidebar { padding-inline: 10px; align-items: center; }
body.rail .nav-text, body.rail .nav-count, body.rail .nav-heading, body.rail .storage, body.rail .nav-add { display: none; }
body.rail .nav-section { margin: 10px 0 4px; padding: 0; width: 24px; border-top: 1px solid var(--line); }
body.rail .compose-btn { width: 44px; height: 44px; padding: 0; }
body.rail .nav-item { width: 44px; height: 40px; justify-content: center; padding: 0; }
body.rail .nav-list { width: 100%; justify-items: center; }
body.rail .nav-item[data-unread]::after { content: ""; position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
body.rail .nav-dot { margin: 0; }
body.rail .sidebar-foot { justify-items: center; }
body.rail .account { flex-direction: column; gap: 4px; }
body.rail .account-text, body.rail .account-chev { display: none; }
body.rail .account-btn { flex: none; width: 44px; height: 44px; padding: 0; justify-content: center; }

/* ─── Liste ────────────────────────────────────────── */
.list-pane { container: list / inline-size; min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); }
.list-head { flex: none; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.list-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; padding-left: 2px; }
.list-title h1 { font-size: 19px; font-weight: 680; letter-spacing: -.025em; }
.list-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.list-tools { display: flex; align-items: center; gap: 6px; min-height: 36px; }
.check-all { width: 32px; justify-content: center; min-height: 36px; }
.list-tools-default, .list-tools-bulk { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.list-tools-default .chips { flex: 1; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.list-tools-default .chips::-webkit-scrollbar { display: none; }
.bulk-count { font-size: 12.5px; font-weight: 650; white-space: nowrap; padding: 0 2px; }
.bulk-actions { flex: 1; display: flex; gap: 1px; overflow-x: auto; scrollbar-width: none; }
.folder-note { flex: none; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 10px; margin: 10px 12px 0; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; }
.folder-note .i { margin-top: 1px; color: var(--muted); }
.folder-note p { flex: 1 1 200px; }
.folder-note.warn { background: var(--warn-soft); color: var(--warn); }
.folder-note.warn .i { color: var(--warn); }
.folder-note .btn { margin-left: auto; }
.search-chips { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 14px 0; }
.filter-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 560; }
.filter-chip button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; color: inherit; }
.filter-chip button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.list-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 6px 0 90px; }
.mail-list { display: flex; flex-direction: column; }

.row {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: start; gap: 0 10px;
  margin: 0 8px; padding: 12px 10px 12px 8px; border-radius: var(--r); cursor: pointer;
  transition: background .12s;
}
.row + .row::before { content: ""; position: absolute; top: 0; left: 62px; right: 10px; border-top: 1px solid var(--line); }
.row:hover { background: var(--hover); }
.row:hover::before, .row:hover + .row::before, .row.is-active::before, .row.is-active + .row::before, .row.is-selected::before, .row.is-selected + .row::before { border-color: transparent; }
.row.is-active { background: var(--accent-soft); }
.row.is-selected { background: var(--accent-softer); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.row.is-focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.row.is-unread::after { content: ""; position: absolute; left: -4px; top: 50%; width: 3px; height: 22px; margin-top: -11px; border-radius: 0 3px 3px 0; background: var(--accent); }
.row-select { position: relative; display: grid; place-items: center; width: 40px; height: 40px; margin-top: 1px; }
.row-select input { position: absolute; inset: 0; width: 100% !important; height: 100% !important; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.row-select .avatar { width: 38px; height: 38px; transition: opacity .12s; }
.row-select .fake-check { position: absolute; inset: 9px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface); opacity: 0; transition: opacity .12s; }
.row-select .fake-check .i { width: 14px; height: 14px; stroke-width: 2.6; color: var(--on-accent); opacity: 0; }
.row:hover .row-select .avatar, body.has-selection .row-select .avatar, .row-select:focus-within .avatar { opacity: 0; }
.row:hover .fake-check, body.has-selection .fake-check, .row-select:focus-within .fake-check { opacity: 1; }
.row-select input:checked ~ .fake-check { background: var(--accent); border-color: var(--accent); opacity: 1; }
.row-select input:checked ~ .fake-check .i { opacity: 1; }
.row-select input:checked ~ .avatar { opacity: 0; }
.row-select input:focus-visible ~ .fake-check { box-shadow: var(--focus); }
.row-open { all: unset; display: grid; gap: 1px; min-width: 0; cursor: pointer; border-radius: var(--r-xs); }
.row-open:focus-visible { box-shadow: var(--focus); }
.row-from { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-2); font-size: 13.5px; font-weight: 520; }
.row-from .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-from .n { flex: none; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.row-from .draft-tag { flex: none; color: var(--danger); font-weight: 650; font-size: 12px; }
.row-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 13.5px; }
.row-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.row.is-unread .row-from, .row.is-unread .row-subject { color: var(--text); font-weight: 680; }
.row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.row-tags:empty { display: none; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 6px; background: color-mix(in srgb, var(--c, var(--muted)) 13%, transparent); color: var(--text-2); font-size: 11.5px; font-weight: 560; white-space: nowrap; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c, var(--muted)); }
.tag.plain::before { display: none; }
.tag .i { width: 12px; height: 12px; }
.tag-x { display: grid; place-items: center; width: 16px; height: 16px; margin-right: -4px; border: 0; border-radius: 4px; background: none; color: var(--muted); padding: 0; }
.tag-x:hover { background: color-mix(in srgb, var(--c, var(--muted)) 25%, transparent); color: var(--text); }
.tag.snooze { --c: var(--warn); color: var(--warn); }
.tag.sched { --c: var(--accent); color: var(--accent-text); }
.row-side { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 52px; padding-top: 1px; }
.row-time { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row.is-unread .row-time { color: var(--text); font-weight: 650; }
.row-icons { display: flex; align-items: center; gap: 2px; color: var(--muted); }
.row-star { display: grid; place-items: center; width: 26px; height: 26px; margin-right: -5px; border: 0; border-radius: 6px; background: none; color: var(--faint); }
.row-star:hover { color: var(--text); background: var(--surface-3); }
.row-star[aria-pressed="true"] { color: #e5a000; }
.row-star[aria-pressed="true"] .i, .star-on .i { fill: currentColor; }
.row-actions { position: absolute; top: 50%; right: 4px; display: flex; gap: 1px; padding: 3px; transform: translateY(-50%); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); box-shadow: var(--shadow-sm); opacity: 0; pointer-events: none; transition: opacity .12s; }
.row-actions .icon-btn { width: 30px; height: 30px; }
.row:hover .row-actions, .row:focus-within .row-actions { opacity: 1; pointer-events: auto; }
body[data-density="compact"] .row { padding-block: 7px; grid-template-columns: 30px minmax(0, 1fr) auto; }
body[data-density="compact"] .row-select { width: 28px; height: 28px; }
body[data-density="compact"] .row-select .avatar { width: 26px; height: 26px; font-size: 10px; }
body[data-density="compact"] .row-select .fake-check { inset: 5px; }
body[data-density="compact"] .row-snippet { display: none; }
body[data-density="compact"] .row-tags { margin-top: 3px; }
body[data-density="compact"] .row + .row::before { left: 48px; }

/* États de liste */
.list-state, .reader-state { display: grid; justify-items: center; align-content: center; gap: 8px; padding: 48px 24px; text-align: center; color: var(--muted); }
.list-state h2, .reader-state h2, .reader-empty h2 { font-size: 15px; color: var(--text); font-weight: 650; }
.list-state p, .reader-state p { max-width: 300px; font-size: 13px; }
.list-state .btn, .reader-state .btn { margin-top: 8px; }
.empty-illu { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 8px; border-radius: 18px; background: linear-gradient(160deg, var(--surface-2), var(--surface-3)); border: 1px solid var(--line); color: var(--muted); box-shadow: var(--shadow-xs); }
.empty-illu .i { width: 26px; height: 26px; stroke-width: 1.5; }
.empty-illu.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.empty-illu.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.skeleton { display: grid; grid-template-columns: 38px 1fr 40px; gap: 6px 12px; margin: 0 8px; padding: 14px 10px; }
.sk { height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk.circle { width: 38px; height: 38px; border-radius: 50%; grid-row: span 3; }
.sk.w-40 { width: 40%; } .sk.w-60 { width: 60%; } .sk.w-80 { width: 80%; } .sk.w-90 { width: 90%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ─── Lecture ──────────────────────────────────────── */
.reader-pane { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.reader-pane:focus { outline: none; }
.reader-empty { flex: 1; display: grid; justify-items: center; align-content: center; gap: 6px; padding: 32px; text-align: center; color: var(--muted); }
.reader-empty .hint { margin-top: 14px; }
.reader-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.reader-toolbar { flex: none; display: flex; align-items: center; gap: 2px; height: 56px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--surface); overflow-x: auto; scrollbar-width: none; }
.reader-toolbar::-webkit-scrollbar { display: none; }
.tool-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line); flex: none; }
.tool-spacer { flex: 1; }
.back-btn { display: none; }
.reader-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 26px clamp(16px, 4vw, 48px) 120px; }
.thread-head { max-width: 860px; margin: 0 auto 18px; }
.thread-head h2 { font-size: clamp(19px, 2vw, 23px); font-weight: 680; line-height: 1.3; letter-spacing: -.028em; }
.thread-head h2:focus { outline: none; }
.thread-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.thread-tags .meta { font-size: 12.5px; color: var(--muted); }
#thread-banners { max-width: 860px; margin: 0 auto; }
.callout { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 13px; color: var(--text-2); }
.callout > .i { margin-top: 1px; }
.callout p { flex: 1; }
.callout strong { color: var(--text); }
.callout .callout-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.callout-warn > .i { color: var(--warn); }
.callout-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.callout-danger > .i { color: var(--danger); }
.callout-info > .i { color: var(--accent-text); }
.thread-messages { max-width: 860px; margin: 0 auto; display: grid; gap: 10px; }
.msg { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.msg.collapsed { background: var(--surface); }
.msg-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px 16px; }
.msg-toggle { all: unset; display: contents; cursor: pointer; }
.msg-who { min-width: 0; cursor: pointer; }
.msg-who > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 4px; min-width: 0; }
.msg-who .name { font-weight: 650; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.msg-who .email { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.msg-who .ext { margin-left: 6px; vertical-align: 1px; }
.msg-line { display: flex; align-items: center; gap: 4px; min-width: 0; color: var(--muted); font-size: 12.5px; }
.msg-line .snip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details-btn { display: inline-flex; align-items: center; gap: 2px; padding: 1px 4px; margin-left: -4px; border: 0; border-radius: var(--r-xs); background: none; color: var(--muted); font-size: 12.5px; max-width: 100%; }
.details-btn:hover { background: var(--hover); color: var(--text); }
.details-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-meta { display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.msg-meta time { margin-right: 6px; font-variant-numeric: tabular-nums; }
.msg-details { margin: -4px 16px 12px 64px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 12.5px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.msg-details dt { color: var(--muted); }
.msg-details dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.msg-body { padding: 4px 22px 20px 64px; font-size: 14.5px; line-height: 1.68; color: var(--text); max-width: 76ch; }
.msg-body p { margin: 0 0 14px; white-space: pre-line; overflow-wrap: anywhere; }
.msg-body p:last-child { margin-bottom: 0; }
.msg.collapsed .msg-body, .msg.collapsed .msg-files, .msg.collapsed .msg-details { display: none; }
.msg-link { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px dashed var(--danger); color: var(--danger); font-weight: 600; background: var(--danger-soft); cursor: not-allowed; }
.remote-block { display: grid; place-items: center; gap: 4px; height: 120px; margin: 0 0 14px; border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--muted); font-size: 12.5px; text-align: center; background: repeating-linear-gradient(45deg, transparent 0 8px, var(--surface-2) 8px 16px); }
.msg-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 22px 20px 64px; }
.files-head { width: 100%; font-size: 12px; font-weight: 600; color: var(--muted); }
.file {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 2px 10px; width: 228px; max-width: 100%; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.file:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.file-ico { grid-row: span 2; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--c, var(--surface-3)); color: #fff; font-size: 9.5px; font-weight: 750; letter-spacing: .03em; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 560; color: var(--text); }
.file-meta { font-size: 11.5px; color: var(--muted); }
.file.unavailable { border-style: dashed; }
.file.unavailable .file-ico { background: var(--surface-3); color: var(--muted); }
.file.unavailable .file-meta { color: var(--danger); }
.reply-bar { max-width: 860px; margin: 16px auto 0; display: flex; flex-wrap: wrap; gap: 8px; }
.reply-bar .ai-btn { margin-left: auto; }

/* ─── Assistant IA ─────────────────────────────────── */
.ai-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--surface); }
.ai-head { flex: none; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--line); }
.ai-title-row { display: flex; align-items: center; gap: 9px; }
.ai-title-row h2 { font-size: 15px; font-weight: 680; }
.ai-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #5b5bd6, #9b6cf2); color: #fff; }
.ai-mark .i { width: 16px; height: 16px; }
.ai-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ai-context { font-size: 12.5px; color: var(--muted); }
.ai-context strong { color: var(--text-2); font-weight: 600; }
.ai-actions { display: grid; gap: 6px; }
.ai-action {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); text-align: left; transition: border-color .15s, background .15s;
}
.ai-action .i { color: var(--accent-text); }
.ai-action span { display: grid; }
.ai-action strong { font-size: 13.5px; font-weight: 600; }
.ai-action small { font-size: 12px; color: var(--muted); }
.ai-action:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-softer); }
.ai-action[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.ai-action:disabled { opacity: .5; cursor: not-allowed; }
.ai-intents { display: grid; gap: 8px; }
.ai-intents-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.ai-result:empty { display: none; }
.ai-card { border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: var(--r-lg); background: linear-gradient(180deg, var(--accent-softer), var(--surface) 70%); padding: 14px; font-size: 13.5px; }
.ai-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; font-weight: 650; color: var(--accent-text); }
.ai-card h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 6px; }
.ai-card ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.ai-card .draft-text { white-space: pre-line; padding: 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); line-height: 1.6; }
.ai-checks { list-style: none; padding: 0 !important; }
.ai-checks li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.ai-checks li:first-child { border-top: 0; }
.ai-checks small { grid-column: 2; color: var(--muted); font-size: 12px; }
.ai-checks input { margin-top: 3px; }
.ai-card.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.ai-card.error .ai-card-head { color: var(--danger); }
.ai-card.muted { background: var(--surface-2); border-color: var(--line); }
.ai-card.muted .ai-card-head { color: var(--muted); }
.ai-loading { display: grid; gap: 8px; }
.ai-loading .sk { height: 11px; }
.ai-result-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-foot { flex: none; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }

/* ─── Composeur ───────────────────────────────────── */
.composer {
  position: fixed; right: 24px; bottom: 0; z-index: 50; width: 580px; max-width: calc(100vw - 32px); height: min(640px, calc(100dvh - 120px));
  display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--surface); box-shadow: var(--shadow-lg); animation: rise .22s var(--ease);
}
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.composer[data-mode="min"] { height: auto; width: 340px; }
.composer[data-mode="min"] .composer-body { display: none; }
.composer[data-mode="max"] { right: 50%; bottom: 50%; transform: translate(50%, 50%); width: min(1000px, calc(100vw - 48px)); height: calc(100dvh - 96px); border-radius: var(--r-xl); border-bottom: 1px solid var(--line-strong); animation: none; }
body.composer-max::after { content: ""; position: fixed; inset: 0; z-index: 45; background: rgb(8 8 14 / .45); }
.composer-head { flex: none; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--surface-2); cursor: default; }
.composer[data-mode="min"] .composer-head { cursor: pointer; border-bottom: 0; }
.composer-head h2 { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-saved { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.composer-win { margin-left: auto; display: flex; gap: 1px; }
.composer-body { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.c-field { position: relative; display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.c-field > label { flex: none; width: 34px; font-size: 13px; color: var(--muted); }
.c-field > input, .c-field > select { border: 0 !important; height: 40px !important; padding: 0 !important; background: transparent !important; box-shadow: none !important; }
.c-field > select { width: auto; max-width: 100%; color: var(--text-2); }
.c-field-tools { display: flex; gap: 2px; }
.recip-box { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 0; }
.recip-box input { flex: 1 1 120px; min-width: 120px; border: 0 !important; height: 28px !important; padding: 0 !important; background: transparent !important; box-shadow: none !important; }
.recip-chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; max-width: 100%; padding: 0 3px 0 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 12.5px; }
.recip-chip .avatar { width: 18px; height: 18px; font-size: 8.5px; }
.recip-chip .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recip-chip button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); }
.recip-chip button:hover { background: var(--surface-3); color: var(--text); }
.recip-chip.invalid { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.suggest { position: absolute; z-index: 5; left: 56px; right: 14px; margin: 0; padding: 4px; list-style: none; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; }
.suggest li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--hover); }
.suggest li small { color: var(--muted); }
.suggest .avatar { width: 28px; height: 28px; font-size: 10.5px; }
.editor-wrap { flex: 1 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; cursor: text; }
.editor { flex: 1 0 auto; min-height: 96px; padding: 14px 16px; font-size: 14.5px; line-height: 1.65; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.editor:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.editor:focus-visible { box-shadow: none; }
.editor a { color: var(--accent-text); }
.editor ul { padding-left: 22px; margin: 4px 0; }
.sig-block { display: flex; align-items: flex-start; gap: 8px; margin: 0 12px 10px; padding: 8px 6px 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: 13px; cursor: default; }
.sig-text { flex: 1; white-space: pre-line; }
.quote-block { padding: 0 16px 12px; cursor: default; }
.quote-block blockquote { margin: 8px 0 0; padding-left: 12px; border-left: 3px solid var(--line-strong); color: var(--muted); white-space: pre-line; font-size: 13.5px; }
.c-ai-preview { flex: none; margin: 0 12px 10px; padding: 12px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: var(--r); background: var(--accent-softer); font-size: 13px; max-height: 40%; overflow-y: auto; }
.c-ai-preview .draft-text { white-space: pre-line; margin: 8px 0 10px; line-height: 1.55; }
.c-ai-preview .row-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.c-attachments { flex: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0 12px; list-style: none; }
.c-attachments:empty { display: none; }
.c-attachments li { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); font-size: 12.5px; }
.c-attachments li small { color: var(--muted); }
.c-attachments li.too-big { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.c-error { flex: none; padding: 0 16px; color: var(--danger); font-size: 12.5px; font-weight: 560; }
.c-error:empty { display: none; }
.c-error:not(:empty) { padding-block: 6px; }
.editor-tools { flex: none; display: flex; align-items: center; gap: 2px; padding: 6px 10px; border-top: 1px solid var(--line); }
.editor-tools .ai-btn { margin-left: auto; }
.composer-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.send-split { display: inline-flex; }
.send-split .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.split-caret { padding: 0 8px !important; border-radius: 0 var(--r-sm) var(--r-sm) 0 !important; border-left: 1px solid rgb(255 255 255 / .28) !important; }
.foot-note { font-size: 11.5px; color: var(--muted); }
#save-draft { margin-left: auto; }

/* ─── Menus, dialogues, notifications ─────────────── */
.menu { position: fixed; z-index: 80; min-width: 210px; max-width: min(320px, calc(100vw - 16px)); max-height: min(420px, calc(100dvh - 24px)); overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); animation: pop .12s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); text-align: left; font-size: 13.5px; text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); box-shadow: none; }
.menu-item .i { color: var(--muted); }
.menu-item .hint { margin-left: auto; padding-left: 12px; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger .i { color: var(--danger); }
.menu-item .check-mark { width: 16px; height: 16px; margin-left: auto; color: var(--accent-text); }
.menu-item .nav-dot { margin: 0 2px; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.menu-head { padding: 8px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.menu-profile { display: flex; gap: 10px; align-items: center; padding: 8px 10px 10px; }
.menu-profile strong { display: block; font-size: 13.5px; }
.menu-profile small { color: var(--muted); }

dialog.modal { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 22px; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow-y: auto; }
dialog.modal[open] { animation: pop .16s var(--ease); }
dialog.modal-wide { width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(8 8 14 / .5); backdrop-filter: blur(2px); }
dialog.modal h2 { font-size: 17px; font-weight: 680; margin-bottom: 8px; }
dialog.modal > form > p, dialog.modal > p { color: var(--text-2); font-size: 13.5px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
#prompt-fields { margin-top: 14px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row label { position: relative; }
.color-row input { position: absolute; opacity: 0; inset: 0; }
.color-row span { display: block; width: 26px; height: 26px; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .1); cursor: pointer; }
.color-row input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.color-row input:focus-visible + span { box-shadow: var(--focus); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.preview-head h2 { margin: 0 !important; overflow-wrap: anywhere; }
.preview-body { display: grid; place-items: center; gap: 10px; min-height: 280px; padding: 24px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2); text-align: center; color: var(--muted); }
.preview-body .file-ico { width: 56px; height: 56px; font-size: 13px; border-radius: 14px; }
.shortcut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.shortcut-grid h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.shortcut-grid dl { margin: 0; display: grid; gap: 7px; }
.shortcut-grid dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.shortcut-grid dt { white-space: nowrap; }
.shortcut-grid dd { margin: 0; color: var(--text-2); text-align: right; }
.session-illu { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); }

.toast-region { position: fixed; left: 50%; bottom: 24px; z-index: 90; display: grid; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 8px 8px 16px; border-radius: var(--r); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 13.5px; pointer-events: auto; animation: rise .2s var(--ease); }
.toast p { flex: 1; }
.toast .btn { min-height: 30px; background: transparent; border-color: rgb(127 127 127 / .4); color: inherit; box-shadow: none; }
.toast .btn:hover { background: rgb(127 127 127 / .2); }
.toast .icon-btn { color: inherit; opacity: .7; width: 30px; height: 30px; }

.fab { display: none; }
@media (min-width: 901px) {
  body.composer-open:not(.composer-max) .toast-region { left: 24px; transform: none; }
}
@media (min-width: 1241px) {
  body.ai-open[data-view="mail"] .composer:not([data-mode="max"]) { right: calc(var(--ai-w) + 16px); }
}
.scrim { display: none; }

/* ─── Pages contacts / réglages ───────────────────── */
.page-view { grid-column: 1 / -1; min-height: 0; overflow-y: auto; padding: 28px clamp(16px, 4vw, 48px) 80px; background: var(--bg); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: 1100px; margin: 0 auto 22px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.page-sub { margin-top: 4px; color: var(--muted); font-size: 13.5px; }
.contacts-layout { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.contacts-list-pane { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 11px; top: 9px; color: var(--muted); }
.input-icon input { padding-left: 36px !important; }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; max-height: 60dvh; overflow-y: auto; }
.contact-list button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px; border: 0; border-radius: var(--r); background: none; text-align: left; }
.contact-list button:hover { background: var(--hover); }
.contact-list button[aria-current="true"] { background: var(--accent-soft); }
.contact-list span { display: grid; min-width: 0; }
.contact-list strong { font-size: 13.5px; font-weight: 600; }
.contact-list small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); min-height: 320px; }
.contact-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.contact-hero h2 { font-size: 20px; font-weight: 700; }
.contact-hero p { color: var(--muted); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.settings-layout { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-tabs { position: sticky; top: 0; display: grid; gap: 2px; }
.settings-tabs [role="tab"] { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2); text-align: left; font-size: 13.5px; font-weight: 520; }
.settings-tabs [role="tab"] .i { color: var(--muted); }
.settings-tabs [role="tab"]:hover { background: var(--hover); }
.settings-tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 620; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.settings-tabs [role="tab"][aria-selected="true"] .i { color: var(--accent-text); }
.settings-panel { display: grid; gap: 16px; }
.settings-panel:focus-visible { box-shadow: none; }
.set-group { padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.set-group > h2, .set-head h2 { font-size: 14.5px; font-weight: 660; margin-bottom: 14px; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.set-head h2 { margin: 0; }
.set-group > .hint { margin: -6px 0 14px; }
.set-head + .hint { margin: 6px 0 14px; }
.switch-row, .set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.set-row { cursor: default; }
.set-group > h2 + .switch-row, .set-group > .hint + .switch-row, .plain-list > .set-row:first-child, .set-group > h2 + .set-row { border-top: 0; padding-top: 0; }
.switch-row > span, .set-row > span:first-child { display: grid; gap: 2px; }
.switch-row strong, .set-row strong { font-size: 13.5px; font-weight: 580; }
.switch-row small, .set-row small { font-size: 12.5px; color: var(--muted); }
.choice-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 150px)); gap: 12px; }
.choice-card { position: relative; display: grid; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; font-size: 13px; font-weight: 560; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.choice-card:has(input:focus-visible) { box-shadow: var(--focus); }
.choice-preview { height: 64px; border-radius: 7px; border: 1px solid var(--line); }
.cp-light { background: linear-gradient(90deg, #f3f3f5 0 28%, #fff 28%); }
.cp-dark { background: linear-gradient(90deg, #0c0c0e 0 28%, #17171b 28%); }
.cp-system { background: linear-gradient(135deg, #fff 0 50%, #17171b 50%); }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 7px; font-size: 13px; font-weight: 560; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.plain-list { list-style: none; margin: 0 0 10px; padding: 0; }
.identity-item { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 13.5px; }
.rule-list, .manage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rule-list li, .manage-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); font-size: 13.5px; }
.rule-list li > span, .manage-list li > span.grow { flex: 1; min-width: 0; }
.rule-list code { padding: 1px 6px; border-radius: 5px; background: var(--surface-3); }
.manage-list .count { color: var(--muted); font-size: 12.5px; }
.storage-big { font-size: 14px; margin-bottom: 12px; }
.storage-big strong { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.stack-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); margin-bottom: 14px; }
.stack-bar span { width: var(--w); background: var(--c); }
.legend { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 13px; color: var(--text-2); }
.legend .dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 3px; background: var(--c); }

/* ─── Lecture seule ───────────────────────────────── */
body[data-scenario="readonly"] [data-write] { opacity: .45; pointer-events: none; }

/* ─── Finitions : canevas, carte flottante, monochrome ─────────────
   Le haut et la navigation reposent sur un canevas ; boîte et lecture
   vivent dans une carte arrondie. Boutons principaux monochromes,
   violet réservé aux signaux (non-lus, focus, sélection, marque). */
body { background: var(--canvas); }
.topbar { background: transparent; border-bottom: 0; padding: 0 12px 0 10px; }
.app { padding: 0 8px 8px 0; }
.main { border-radius: 14px; box-shadow: var(--card-ring); overflow: hidden; }
.status-banner { margin: 0 8px 8px; border: 0; border-radius: var(--r); }
.sidebar { border-right: 0; background: transparent; padding-top: 6px; }

/* Boutons */
.btn { min-height: 34px; padding: 0 13px; border-color: var(--line-strong); font-weight: 540; box-shadow: 0 1px 1px rgb(16 16 24 / .04); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); box-shadow: 0 1px 2px rgb(0 0 0 / .14), inset 0 1px 0 rgb(255 255 255 / .1); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { min-height: 30px; }
.ai-btn, .ai-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface); }
.ai-btn:hover { background: var(--hover); }
.ai-btn[aria-expanded="true"] { background: var(--active); }
.split-caret { border-left-color: color-mix(in srgb, var(--on-primary) 22%, transparent) !important; }
.icon-btn { width: 34px; height: 34px; color: var(--muted); }
.icon-btn:hover { color: var(--text); }
.chip { height: 28px; padding: 0 11px; border-color: transparent; background: transparent; color: var(--muted); font-weight: 520; }
.chip:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.chip[aria-pressed="true"] { background: var(--surface-3); border-color: transparent; color: var(--text); }
kbd { border-bottom-width: 1px; border-color: var(--line); background: var(--surface-2); color: var(--muted); font-family: var(--font); font-weight: 520; }

/* Barre supérieure */
.brand-name { font-weight: 650; font-size: 15.5px; letter-spacing: -.035em; }
.brand-mark { width: 24px; height: 24px; }
.topbar .icon-btn:hover, .nav-toggle:hover { background: var(--canvas-hover); }
.search { max-width: 560px; }
.search input { height: 36px !important; background: var(--surface) !important; border-color: var(--line) !important; box-shadow: 0 1px 1px rgb(16 16 24 / .03); }
.search input:hover { border-color: var(--line-strong) !important; }
.search-filters { width: 30px; height: 30px; right: 3px; }
.search-kbd { right: 40px; }

/* Navigation */
.compose-btn { min-height: 38px; margin-bottom: 12px; border-radius: var(--r); font-size: 13.5px; font-weight: 580; }
.nav-item { height: 32px; gap: 10px; padding: 0 9px; border-radius: var(--r-sm); color: var(--text-2); font-size: 13.5px; font-weight: 480; }
.nav-item .i { width: 17px; height: 17px; color: var(--muted); }
.nav-item:hover { background: var(--canvas-hover); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 580; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(16 16 24 / .05); }
.nav-item[aria-current="page"] .i { color: var(--text); }
.nav-count { font-size: 12px; font-weight: 520; color: var(--faint); }
.nav-count.strong { color: var(--text); font-weight: 620; }
.nav-section { margin: 18px 0 4px; padding: 0 4px 0 9px; }
.nav-heading { font-size: 12px; font-weight: 540; text-transform: none; letter-spacing: 0; color: var(--faint); }
.nav-dot { width: 8px; height: 8px; margin: 0 4.5px; border-radius: 50%; }
.nav-item.drop-target { background: var(--accent-soft); }
.sidebar-foot { border-top-color: transparent; gap: 4px; }
.storage:hover, .account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--canvas-hover); }
.account-settings:hover { background: var(--canvas-hover); }
.account-settings[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.meter { height: 4px; background: var(--canvas-hover); }
.meter span { background: var(--text-2); }

/* Liste */
.list-head { padding: 16px 14px 8px; border-bottom: 0; }
.list-title { margin-bottom: 8px; padding-left: 4px; }
.list-title h1 { font-size: 17px; font-weight: 620; letter-spacing: -.03em; }
.list-count { font-size: 12.5px; color: var(--faint); }
.list-scroll { padding-top: 2px; }
.row { grid-template-columns: 40px minmax(0, 1fr) auto; margin: 0 6px; padding: 11px 10px 11px 8px; border-radius: 12px; gap: 0 10px; }
.row + .row::before { left: 58px; right: 12px; border-top-color: color-mix(in srgb, var(--line) 70%, transparent); }
.row:hover { background: var(--hover); }
.row.is-active { background: var(--active); box-shadow: inset 0 0 0 1px var(--line); }
.row.is-selected { background: var(--accent-softer); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.row.is-unread::after { display: none; }
.row-select { width: 36px; height: 36px; }
.row-select .avatar { width: 34px; height: 34px; font-size: 11.5px; }
.row-select .fake-check { inset: 8px; border-radius: 5px; }
.row-from { font-size: 13.5px; font-weight: 480; color: var(--text-2); }
.row-subject { font-size: 13.5px; color: var(--text-2); }
.row-snippet { font-size: 13px; color: var(--faint); }
.row.is-unread .row-from, .row.is-unread .row-subject { color: var(--text); font-weight: 600; }
.row-time { font-size: 12px; color: var(--faint); }
.row.is-unread .row-time { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 560; }
.row.is-unread .row-time::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.row-tags { margin-top: 7px; }
.tag { height: 20px; padding: 0 7px; border-radius: 6px; background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--text-2); font-size: 11.5px; font-weight: 500; }
.tag::before { width: 6px; height: 6px; border-radius: 50%; }
.row-actions { padding: 2px; border-radius: 10px; box-shadow: 0 4px 14px -4px rgb(16 16 24 / .14); }
.row-actions .icon-btn { width: 30px; height: 30px; }
body[data-density="compact"] .row + .row::before { left: 44px; }

/* Lecture */
.reader-pane { border-left: 0; }
.list-pane { border-right-color: var(--line); }
.reader-toolbar { height: 52px; padding: 0 10px; }
.reader-toolbar .icon-btn { width: 32px; height: 32px; }
.tool-sep { height: 16px; margin: 0 5px; }
.reader-scroll { padding-top: 30px; }
.thread-head h2 { font-size: clamp(20px, 2vw, 24px); font-weight: 620; letter-spacing: -.035em; }
.msg { border-radius: 14px; box-shadow: none; }
.msg-head { padding: 14px 18px; }
.msg-who .name { font-weight: 600; }
.msg-body { font-size: 14.5px; line-height: 1.7; color: var(--text-2); }
.msg-meta time { color: var(--faint); }
.file { border-radius: 12px; }
.file-ico { border-radius: 9px; }
.callout { border-radius: 12px; }
.reply-bar .btn { min-height: 34px; }

/* Assistant : sobre, sans effet « magique » */
.ai-panel { background: var(--surface); }
.ai-head { height: 52px; }
.ai-title-row h2 { font-size: 14.5px; font-weight: 620; }
.badge-ai { background: var(--surface-3); color: var(--muted); }
.ai-action { padding: 10px 12px; border-radius: 12px; }
.ai-action .i { color: var(--muted); }
.ai-action:hover { border-color: var(--line-strong); background: var(--hover); }
.ai-action[aria-pressed="true"] { border-color: var(--line-strong); background: var(--surface-2); }
.ai-action[aria-pressed="true"] strong { color: var(--text); }
.ai-card h3 { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ai-card { border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.ai-card-head { color: var(--muted); font-weight: 560; }
.c-ai-preview { border-color: var(--line); background: var(--surface-2); }

/* Composeur, menus, fenêtres */
.composer { border-color: var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -2px 0 0 transparent, 0 24px 64px -16px rgb(16 16 24 / .3), 0 0 0 1px var(--line); }
.composer-head { height: 44px; background: var(--surface); border-radius: 16px 16px 0 0; }
.composer-head h2 { font-weight: 600; }
.c-field > label { color: var(--faint); }
.menu { padding: 6px; border-radius: 12px; }
.menu-item { min-height: 32px; border-radius: 7px; font-size: 13.5px; }
.menu-head { font-size: 11.5px; font-weight: 540; text-transform: none; letter-spacing: 0; }
dialog.modal { border-radius: 18px; }
.toast { border-radius: 12px; }
.fab { background: var(--primary) !important; color: var(--on-primary) !important; box-shadow: 0 10px 28px -8px rgb(0 0 0 / .45) !important; }

/* Pages */
.page-view { background: var(--bg); }
.page-head h1 { font-weight: 640; letter-spacing: -.035em; }
.set-group, .contact-card, .contacts-list-pane { border-radius: 16px; }
.settings-tabs [role="tab"] { height: 34px; }
.settings-tabs [role="tab"][aria-selected="true"] .i { color: var(--text); }
.shortcut-grid h3 { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); }

/* ─── Responsive ──────────────────────────────────── */
@media (min-width: 701px) {
  /* Recherche centrée sur la largeur de l'écran, pas sur l'espace restant. */
  .topbar { display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 560px) minmax(max-content, 1fr); padding-inline: 10px; }
  .search { width: 100%; max-width: none; margin: 0; }
  .topbar-actions { justify-self: end; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  /* Réserve à droite la largeur du logo pour garder la recherche au centre. */
  .topbar-actions { min-width: 133px; }
}
@container list (max-width: 370px) {
  .list-tools-default .chip { padding: 0 9px; }
  .list-tools-default .chip .i { display: none; }
}
.demo-field { max-width: 380px; margin-top: 4px; }
@media (max-width: 1500px) {
  body.ai-open .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  body.ai-open .sidebar { padding-inline: 10px; align-items: center; }
  body.ai-open .nav-text, body.ai-open .nav-count, body.ai-open .nav-heading, body.ai-open .storage, body.ai-open .nav-add { display: none; }
  body.ai-open .nav-section { margin: 10px 0 4px; padding: 0; width: 24px; border-top: 1px solid var(--line); }
  body.ai-open .compose-btn { width: 44px; height: 44px; padding: 0; }
  body.ai-open .nav-item { width: 44px; height: 40px; justify-content: center; padding: 0; }
  body.ai-open .nav-list { width: 100%; justify-items: center; }
  body.ai-open .nav-dot { margin: 0; }
  body.ai-open .topbar-start { width: auto; }
  body.ai-open .sidebar-foot { justify-items: center; }
  body.ai-open .account { flex-direction: column; gap: 4px; }
  body.ai-open .account-text, body.ai-open .account-chev { display: none; }
  body.ai-open .account-btn { flex: none; width: 44px; height: 44px; padding: 0; justify-content: center; }
  :root { --list-w: 360px; }
}
@media (max-width: 1240px) {
  :root { --list-w: 340px; --ai-w: 380px; }
  body.ai-open .main { grid-template-columns: var(--list-w) minmax(0, 1fr); }
  .ai-panel { position: fixed; top: var(--top-h); right: 0; bottom: 0; z-index: 40; width: min(var(--ai-w), 100vw); box-shadow: var(--shadow-lg); animation: slide-in .22s var(--ease); }
  @keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
  body.ai-open .app { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  body.ai-open.rail .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
}
@media (min-width: 901px) and (max-width: 1380px) {
  /* Assistant ouvert sur écran moyen : il prend la place de la liste (fil ouvert) ou du lecteur (aucun fil), sans recouvrir le contenu. */
  .ai-panel { position: static; width: auto; box-shadow: none; animation: none; }
  body.ai-open[data-view="mail"] .main { grid-template-columns: var(--list-w) minmax(0, 1fr); }
  body.ai-open[data-view="mail"]:not(.reading) .reader-pane { display: none; }
  body.ai-open.reading[data-view="mail"] .main { grid-template-columns: minmax(0, 1fr) var(--ai-w); }
  body.ai-open.reading[data-view="mail"] .list-pane { display: none; }
  body.ai-open[data-view="mail"] .composer:not([data-mode="max"]) { right: calc(var(--ai-w) + 16px); }
}
@media (max-width: 1100px) {
  .app { padding-left: 8px; }
  .sidebar { background: var(--canvas) !important; padding-top: 16px !important; }
  .app, body.rail .app, body.ai-open .app, body.ai-open.rail .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; width: 280px; padding-top: 16px; box-shadow: var(--shadow-lg); transform: translateX(-105%); transition: transform .25s var(--ease); visibility: hidden; }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgb(8 8 14 / .45); }
  body.rail .sidebar, body.ai-open .sidebar { align-items: stretch; }
  body.rail .sidebar .nav-text, body.rail .sidebar .nav-count, body.rail .sidebar .nav-heading, body.rail .sidebar .storage, body.rail .sidebar .nav-add,
  body.ai-open .sidebar .nav-text, body.ai-open .sidebar .nav-count, body.ai-open .sidebar .nav-heading, body.ai-open .sidebar .storage, body.ai-open .sidebar .nav-add { display: revert; }
  body.rail .sidebar .nav-item, body.ai-open .sidebar .nav-item { width: auto; height: 38px; justify-content: flex-start; padding: 0 10px; }
  body.rail .sidebar .compose-btn, body.ai-open .sidebar .compose-btn { width: 100%; height: auto; padding: 0 14px; }
  body.rail .sidebar .nav-section, body.ai-open .sidebar .nav-section { width: auto; border: 0; margin: 16px 0 2px; padding: 0 4px 0 10px; display: flex; }
  body.rail .sidebar .nav-list, body.ai-open .sidebar .nav-list { justify-items: stretch; }
  body.rail .sidebar .nav-dot, body.ai-open .sidebar .nav-dot { margin: 0 4px; }
  body.rail .sidebar-foot, body.ai-open .sidebar-foot { justify-items: stretch; }
  body.rail .account, body.ai-open .account { flex-direction: row; gap: 2px; }
  body.rail .account-text, body.ai-open .account-text { display: grid; }
  body.rail .account-chev, body.ai-open .account-chev { display: revert; }
  body.rail .account-btn, body.ai-open .account-btn { flex: 1 1 auto; width: auto; height: 48px; padding: 0 8px 0 6px; justify-content: flex-start; }
  .topbar-start, body.rail .topbar-start, body.ai-open .topbar-start { width: auto; }
  .nav-toggle { order: -1; color: var(--text-2); }
  .nav-item { height: 40px; }
    }
@media (max-width: 900px) {
  .main, body.ai-open .main { grid-template-columns: minmax(0, 1fr); }
  .list-pane { border-right: 0; }
  body:not(.reading) .reader-pane { display: none; }
  body.reading .list-pane { display: none; }
  .back-btn { display: inline-grid; }
  .fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 35; display: grid; place-items: center; width: 56px; height: 56px; border: 0; border-radius: 18px; background: var(--accent); color: #fff; box-shadow: 0 10px 28px -6px rgb(60 60 180 / .55); }
  .fab .i { width: 22px; height: 22px; }
  body.reading .fab, body:not([data-view="mail"]) .fab, body.composer-open .fab { display: none; }
  .composer, .composer[data-mode="max"] { inset: 0; transform: none; width: 100%; max-width: none; height: 100dvh; border-radius: 0; border: 0; }
  .composer[data-mode="min"] { inset: auto 0 0 0; height: auto; width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  #composer-max { display: none; }
  body.composer-max::after { display: none; }
  .contacts-layout, .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-tabs { position: static; display: flex; overflow-x: auto; scrollbar-width: none; gap: 4px; padding-bottom: 2px; }
  .settings-tabs [role="tab"] { flex: none; white-space: nowrap; }
  .settings-tabs { margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 28px), transparent); }
}
@media (max-width: 700px) {
  :root { --top-h: 56px; }
  .app { padding: 0; }
  .main { border-radius: 0; box-shadow: 0 -1px 0 var(--line); }
  .topbar { gap: 4px; padding: 0 8px 0 4px; }
  .hide-sm { display: none !important; }
  .search { display: none; }
  .search-open { display: inline-grid; }
  body.search-active .search { display: flex; position: absolute; inset: 8px 8px auto 8px; max-width: none; z-index: 5; }
  body.search-active .search input { background: var(--surface) !important; border-color: var(--accent) !important; box-shadow: var(--shadow); }
  .search-kbd { display: none; }
  .search-panel { position: fixed; top: calc(var(--top-h) + 4px); left: 8px; right: 8px; max-height: calc(100dvh - 140px); overflow-y: auto; }
  .field-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
    .list-head { padding: 12px 10px 8px; }
  .row { margin: 0 4px; padding-inline: 6px; }
  .row-actions { display: none; }
  .reader-scroll { padding: 18px 12px 110px; }
  .msg-head { padding: 12px; gap: 10px; }
  .msg-body, .msg-files { padding-left: 14px; padding-right: 14px; }
  .msg-details { margin-left: 12px; margin-right: 12px; }
  .msg-who .email { display: none; }
  .msg-meta time { font-size: 11.5px; margin-right: 0; }
  .msg-meta .msg-reply { display: none; }
  .reply-bar .btn { flex: 1 1 auto; }
  .reply-bar .ai-btn { margin-left: 0; }
  .ai-panel { top: 0; z-index: 75; width: 100vw; }
  .composer-foot { flex-wrap: wrap; }
  .foot-note { display: none; }
  .toast-region { bottom: 88px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .choice-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shortcut-grid { grid-template-columns: 1fr; }
  .page-view { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .row.is-active, .row.is-selected, .nav-item[aria-current="page"] { outline: 2px solid CanvasText; }
}
