/* Mailroom : feuille de style unique, sans bibliothèque ni police externe. */
:root {
    --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --bg: #f4f6fb; --card: #ffffff;
    --brand: #5b5bf6; --brand-2: #9b5cf6; --brand-3: #e04fd0; --brand-soft: #eef0ff;
    --grad: linear-gradient(120deg, var(--brand) 0%, var(--brand-2) 55%, var(--brand-3) 100%);
    --good: #0e9f6e; --good-soft: #e7f8f1; --bad: #e0384b; --bad-soft: #fdecee; --warn: #c2410c; --warn-soft: #fff1e6;
    --radius: 16px; --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --shadow-up: 0 2px 4px rgba(15, 23, 42, .05), 0 18px 40px -16px rgba(91, 91, 246, .35);
    --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
    margin: 0; min-height: 100vh; color: var(--ink);
    font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(1200px 500px at 100% -10%, rgba(155, 92, 246, .10), transparent 60%),
        radial-gradient(900px 400px at -10% 10%, rgba(91, 91, 246, .08), transparent 60%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }

/* ------------------------------------------------------------------ Barre du haut */
.top {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
    padding: .75rem 2rem; background: rgba(255, 255, 255, .78); backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid rgba(226, 232, 240, .8);
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.05rem; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--grad); color: #fff;
    font-weight: 800; box-shadow: 0 6px 16px -6px rgba(124, 58, 237, .7);
}
.badge-env { background: var(--warn-soft); color: var(--warn); border-radius: 999px; padding: .2rem .7rem; font-size: .75rem; font-weight: 600; }
.nav-link { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border-radius: 10px; color: var(--ink-2); font-weight: 500; transition: background .2s, color .2s; }
.nav-link:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.langs { display: inline-flex; background: #eef1f6; border-radius: 10px; padding: 3px; margin: 0 .4rem; }
.langs a { padding: .25rem .6rem; border-radius: 8px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.langs a:hover { text-decoration: none; color: var(--ink); }
.langs a[aria-current] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 700; font-size: .85rem; text-transform: uppercase; }

/* ------------------------------------------------------------------ Page */
main { max-width: 1240px; margin: 0 auto; padding: 2rem; animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
h1 { font-size: 1.9rem; line-height: 1.2; letter-spacing: -.025em; margin: .2rem 0 0; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; margin: 0 0 1rem; display: flex; align-items: center; gap: .6rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .6rem; }
.lead { color: var(--muted); margin: .4rem 0 0; }
.muted { color: var(--muted); font-size: .88rem; }
.card { background: var(--card); border: 1px solid rgba(226, 232, 240, .9); border-radius: var(--radius); padding: 1.4rem 1.5rem; margin-bottom: 1.2rem; box-shadow: var(--shadow); }
.narrow { max-width: 420px; margin: 3rem auto; }
.step { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--brand-soft); color: var(--brand); font-size: .85rem; font-weight: 700; }

/* ------------------------------------------------------------------ Messages */
.alert, .ok, .note { display: flex; gap: .65rem; align-items: flex-start; border-radius: 12px; padding: .8rem 1rem; margin: 0 0 1rem; font-size: .92rem; animation: rise .35s var(--ease) both; }
.alert { background: var(--bad-soft); color: #9f1c2d; border: 1px solid #f9cdd3; }
.ok { background: var(--good-soft); color: #046c4e; border: 1px solid #bdeedb; font-weight: 500; }
.note { background: var(--brand-soft); color: #3730a3; border: 1px solid #dfe2ff; }
.alert::before, .ok::before { flex: none; font-weight: 800; }
.alert::before { content: "!"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--bad); color: #fff; font-size: .75rem; }
.ok::before { content: "✓"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--good); color: #fff; font-size: .7rem; }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: #eef1f6; color: var(--ink-2); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good .dot { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(14, 159, 110, .5); } 70% { box-shadow: 0 0 0 7px rgba(14, 159, 110, 0); } 100% { box-shadow: 0 0 0 0 rgba(14, 159, 110, 0); } }

/* ------------------------------------------------------------------ Formulaires */
label { display: block; margin: .8rem 0; font-size: .85rem; font-weight: 500; color: var(--ink-2); }
input, select, textarea {
    display: block; width: 100%; margin-top: .35rem; padding: .65rem .8rem; border: 1px solid #d5dbe5; border-radius: 10px;
    font: inherit; color: var(--ink); background: #fbfcfe; transition: border-color .2s, box-shadow .2s, background .2s;
}
input:hover, select:hover, textarea:hover { border-color: #b8c1d1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: 0 0 0 4px rgba(91, 91, 246, .15); }
input[readonly] { background: repeating-linear-gradient(135deg, #f6f7fb, #f6f7fb 8px, #f1f3f9 8px, #f1f3f9 16px); color: var(--muted); font-style: italic; }
.tag { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; color: var(--brand); background: var(--brand-soft); padding: .1rem .45rem; border-radius: 6px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: .8rem 0; padding: .6rem 1rem .9rem; position: relative; }
legend { font-size: .8rem; font-weight: 600; color: var(--muted); padding: 0 .4rem; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.row label { margin: .5rem 0; }

/* Choix sous forme de tuiles */
.choices { border: 0; padding: 0; margin: .8rem 0; }
.choices legend { padding: 0; margin-bottom: .45rem; font-size: .85rem; font-weight: 500; color: var(--ink-2); }
.tiles { display: flex; flex-wrap: wrap; gap: .5rem; }
.tile { margin: 0; position: relative; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile span { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem .9rem; border: 1px solid #d5dbe5; border-radius: 10px; background: #fff; cursor: pointer; transition: all .2s var(--ease); font-weight: 500; }
.tile span:hover { border-color: var(--brand); color: var(--brand); }
.tile input:checked + span { border-color: transparent; background: var(--grad); color: #fff; box-shadow: 0 8px 18px -10px rgba(124, 58, 237, .9); }
.tile input:focus-visible + span { box-shadow: 0 0 0 4px rgba(91, 91, 246, .25); }

/* Boutons */
button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 0; border-radius: 11px; padding: .7rem 1.2rem;
    font: inherit; font-weight: 600; cursor: pointer; color: #fff; background: var(--grad); background-size: 160% 100%; background-position: 0 0;
    box-shadow: 0 8px 20px -10px rgba(124, 58, 237, .8); transition: transform .2s var(--ease), box-shadow .2s, background-position .4s;
}
button:hover, .button:hover { transform: translateY(-1px); background-position: 100% 0; box-shadow: 0 14px 26px -12px rgba(124, 58, 237, .9); text-decoration: none; }
button:active, .button:active { transform: translateY(0) scale(.98); }
button.secondary { background: #fff; color: var(--brand); border: 1px solid #d7d9ff; box-shadow: none; }
button.secondary:hover { background: var(--brand-soft); }
button.ghost { background: none; color: var(--muted); box-shadow: none; padding: .35rem .55rem; font-weight: 500; }
button.ghost:hover { color: var(--bad); background: var(--bad-soft); transform: none; }
button.link { background: none; box-shadow: none; color: var(--ink-2); padding: .45rem .7rem; font-weight: 500; border-radius: 10px; }
button.link:hover { background: #eef1f6; transform: none; }
button[disabled], .button[disabled] { opacity: .45; cursor: not-allowed; transform: none; filter: grayscale(.6); box-shadow: none; }
button.wide { width: 100%; padding: .85rem; margin-top: .6rem; }
form.inline { display: inline; }

/* ------------------------------------------------------------------ Tableaux et listes de valeurs */
dl { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.5rem; margin: 0; }
dt { color: var(--muted); font-size: .88rem; } dd { margin: 0; font-weight: 500; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .6rem; border-bottom: 1px solid var(--line); }
td { padding: .8rem .6rem; border-bottom: 1px solid #f1f4f8; }
tr:last-child td { border-bottom: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; background: #f1f3f9; padding: .15rem .45rem; border-radius: 6px; }

/* ------------------------------------------------------------------ Modèles et process */
.category { margin-bottom: 2rem; animation: rise .5s var(--ease) both; }
.category:nth-child(2) { animation-delay: .05s; } .category:nth-child(3) { animation-delay: .1s; } .category:nth-child(4) { animation-delay: .15s; }
.category-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.category-head h2 { margin: 0; }
.category-path { color: var(--muted); font-size: .85rem; }
.category.depth-1, .category.depth-2, .category.depth-3, .category.depth-4 { padding-left: 1.2rem; border-left: 2px solid #e4e7ff; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.item {
    position: relative; display: flex; flex-direction: column; gap: .5rem; padding: 1.2rem; background: #fff; border: 1px solid rgba(226, 232, 240, .9);
    border-radius: var(--radius); box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s, border-color .25s; overflow: hidden;
}
.item::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); opacity: 0; transition: opacity .25s; }
.item:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); border-color: #d9dcff; }
.item:hover::before { opacity: 1; }
.item-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.item.process .item-icon { background: #fbeefd; color: #b832a8; }
.item-name { font-weight: 650; font-size: 1rem; letter-spacing: -.01em; }
.item-meta { display: flex; gap: .4rem; flex-wrap: wrap; }
.item .button, .item button { margin-top: auto; align-self: flex-start; padding: .55rem 1rem; }
.empty { text-align: center; padding: 3rem 1rem; }
.empty .item-icon { margin: 0 auto 1rem; width: 56px; height: 56px; }

/* ------------------------------------------------------------------ Nouvel envoi */
.send-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 1.4rem; align-items: start; }
@media (max-width: 960px) { .send-grid { grid-template-columns: 1fr; } .row { grid-template-columns: 1fr; } }
iframe.pdf { width: 100%; height: 68vh; border: 1px solid var(--line); border-radius: 12px; background: #f1f3f9; }
.signer { animation: rise .3s var(--ease) both; }
.remove-signer { position: absolute; top: .2rem; right: .5rem; font-size: .8rem; }
.suggestions { list-style: none; margin: .4rem 0 0; padding: .3rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow-up); }
.suggestions li { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 9px; cursor: pointer; font-size: .9rem; }
.suggestions li:hover { background: var(--brand-soft); }
.suggestions .avatar { width: 26px; height: 26px; font-size: .7rem; }
.actionbar {
    position: sticky; bottom: 1rem; z-index: 10; display: flex; align-items: center; gap: .8rem; justify-content: flex-end;
    padding: .8rem 1rem; margin-top: 1rem; background: rgba(255, 255, 255, .85); backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, .9); border-radius: var(--radius); box-shadow: var(--shadow-up);
}
.actionbar .muted { margin-right: auto; }

/* ------------------------------------------------------------------ Connexion */
.login { min-height: calc(100vh - 140px); display: grid; place-items: center; }
.login-card { max-width: 420px; width: 100%; padding: 2rem; }

/* ------------------------------------------------------------------ Envoi créé */
.success { text-align: center; padding: 2.4rem 1.5rem 1.6rem; }
.success-mark { width: 76px; height: 76px; margin: 0 auto 1rem; border-radius: 50%; display: grid; place-items: center; background: var(--good-soft); animation: pop .6s var(--ease) both; }
.success-mark svg { width: 38px; height: 38px; stroke: var(--good); stroke-width: 3; fill: none; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .6s .3s var(--ease) forwards; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ------------------------------------------------------------------ « Ça réfléchit » : surimpression, page floutée */
.busy-overlay {
    position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
    background: rgba(244, 246, 251, .35); backdrop-filter: blur(7px) saturate(120%); -webkit-backdrop-filter: blur(7px) saturate(120%);
    opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
}
body.is-busy .busy-overlay { opacity: 1; pointer-events: all; }
body.is-busy main, body.is-busy .top { filter: blur(2px); transition: filter .25s; }
.busy-card { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; padding: 2rem 2.6rem; background: rgba(255, 255, 255, .9); border-radius: 24px; box-shadow: 0 30px 60px -20px rgba(15, 23, 42, .35); transform: translateY(8px) scale(.96); transition: transform .35s var(--ease); }
body.is-busy .busy-card { transform: none; }
.orb { position: relative; width: 74px; height: 74px; }
.orb span { position: absolute; inset: 0; border-radius: 50%; border: 4px solid transparent; }
.orb span:nth-child(1) { border-top-color: var(--brand); border-right-color: var(--brand); animation: spin 1.1s linear infinite; }
.orb span:nth-child(2) { inset: 10px; border-bottom-color: var(--brand-2); border-left-color: var(--brand-2); animation: spin 1.5s linear infinite reverse; }
.orb span:nth-child(3) { inset: 25px; border: 0; background: var(--grad); animation: breathe 1.4s ease-in-out infinite; box-shadow: 0 0 22px rgba(155, 92, 246, .8); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(.65); opacity: .7; } }
.busy-text { font-weight: 600; color: var(--ink-2); }
.busy-text::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; } }

/* ------------------------------------------------------------------ Statuts (spécification, section 4) */
.status { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.big { font-size: .85rem; padding: .3rem .85rem; vertical-align: middle; margin-left: .4rem; }
.tone-grey { --tone: #64748b; --tone-soft: #eef1f6; }
.tone-blue { --tone: #2563eb; --tone-soft: #e8f0ff; }
.tone-green { --tone: #0e9f6e; --tone-soft: #e7f8f1; }
.tone-red { --tone: #e0384b; --tone-soft: #fdecee; }
.tone-orange { --tone: #d9730d; --tone-soft: #fff1e6; }
.tone-struck { --tone: #94a3b8; --tone-soft: #f1f3f7; }
.tone-brand { --tone: var(--brand); --tone-soft: var(--brand-soft); }
.status { color: var(--tone); background: var(--tone-soft); }
.status.tone-struck { text-decoration: line-through; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--tone, var(--muted)); flex: none; }
.dot.bad { background: var(--bad); }

/* Boutons supplémentaires */
.button.secondary-btn { background: #fff; color: var(--brand); border: 1px solid #d7d9ff; box-shadow: none; }
.button.secondary-btn:hover { background: var(--brand-soft); }
button.small, .button.small { padding: .4rem .75rem; font-size: .85rem; border-radius: 9px; }
button.danger { background: linear-gradient(120deg, #e0384b, #f0603a); box-shadow: 0 8px 20px -10px rgba(224, 56, 75, .8); }
.inline-form { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.inline-form select { width: auto; margin: 0; padding: .45rem .6rem; }
.spacer { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.back { font-size: .85rem; color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Interrupteur « Mes envois / Toute l'équipe » */
.segmented { display: inline-flex; background: #eef1f6; border-radius: 12px; padding: 4px; gap: 2px; }
.segmented a, .segmented label { margin: 0; padding: .45rem .9rem; border-radius: 9px; font-weight: 600; font-size: .88rem; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; }
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented .on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.segmented .disabled { opacity: .45; pointer-events: none; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }

/* ------------------------------------------------------------------ Tableau de bord */
.stat-cards { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
@media (max-width: 1100px) { .stat-cards { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; gap: .3rem; padding: 1rem; border-radius: 14px; background: #fff; border: 1px solid rgba(226, 232, 240, .9); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; color: var(--ink); }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); text-decoration: none; }
.stat-label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.stat-value { font-size: 1.7rem; font-weight: 750; letter-spacing: -.03em; color: var(--tone); }
.stat.tone-brand { background: var(--grad); }
.stat.tone-brand::after { display: none; }
.stat.tone-brand .stat-label, .stat.tone-brand .stat-value { color: #fff; }
.stat.tone-struck .stat-value { text-decoration: none; }
.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; }
.dash-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 960px) { .dash-grid, .dash-grid.two { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.kpis div, .rate div { display: flex; flex-direction: column; }
.kpi { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; }
.rate { display: flex; align-items: center; gap: 1rem; }
.ring { width: 84px; height: 84px; transform: rotate(-90deg); flex: none; }
.ring circle { fill: none; stroke-width: 3.6; }
.ring-bg { stroke: #eef0ff; }
.ring-fg { stroke: var(--brand-2); stroke-linecap: round; animation: ring 1s var(--ease) both; }
@keyframes ring { from { stroke-dasharray: 0 100; } }
.meter-label { margin: .4rem 0 .35rem; font-size: .9rem; font-weight: 500; }
.meter { height: 9px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--grad); border-radius: 99px; animation: grow .9s var(--ease) both; }
@keyframes grow { from { width: 0; } }
.legend { margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 500; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: .5rem; }
.legend i.created, .chart .bar.created { background: var(--brand); fill: var(--brand); }
.legend i.signed, .chart .bar.signed { background: var(--good); fill: var(--good); }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #eef1f6; }
.chart .axis { font-size: 10px; fill: var(--muted); }
.chart .hit { fill: transparent; }
.chart .day:hover .hit { fill: rgba(91, 91, 246, .06); }
.chart .bar { transform-origin: bottom; transform-box: fill-box; animation: barup .7s var(--ease) both; }
@keyframes barup { from { transform: scaleY(0); } }
.step.warn { background: var(--warn-soft); color: var(--warn); }
.step.bad { background: var(--bad-soft); color: var(--bad); }
.watch-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid #f1f4f8; flex-wrap: wrap; }
.watch-row:last-child { border-bottom: 0; }
.watch-main { display: flex; flex-direction: column; gap: .1rem; flex: 1; min-width: 200px; color: var(--ink); }
.watch-main:hover { text-decoration: none; }
.watch-main .pill { align-self: flex-start; margin-top: .2rem; }
.watch-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid #f1f4f8; }
.feed li:last-child { border-bottom: 0; }
.feed .dot { margin-top: .45rem; }
.feed-link { display: flex; gap: .7rem; color: var(--ink); width: 100%; border-radius: 10px; padding: .1rem .3rem; margin: -.1rem -.3rem; }
.feed-link:hover { background: #f7f8fc; text-decoration: none; }

/* ------------------------------------------------------------------ Envois */
.filters { padding: 1rem 1.2rem; }
.filter-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.filter-row + .filter-row { margin-top: .6rem; }
.filter-row label { margin: 0; }
.filter-row .grow { flex: 1; min-width: 240px; }
.filter-row input[type=date] { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { margin: 0; position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; padding: .3rem .7rem; border-radius: 999px; border: 1px solid #d5dbe5; font-size: .82rem; font-weight: 600; color: var(--ink-2); cursor: pointer; background: #fff; transition: all .2s; }
.chip input:checked + span { background: var(--tone-soft); border-color: var(--tone); color: var(--tone); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(91, 91, 246, .25); }
.table-card { padding: 0; overflow: hidden; }
.table-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
table.sends th:first-child, table.sends td:first-child { padding-left: 1.3rem; }
table.sends td { vertical-align: top; }
tr.clickable { cursor: pointer; transition: background .15s; }
tr.clickable:hover { background: #f7f8ff; }
.doc-link { font-weight: 650; color: var(--ink); }
.tags { display: flex; gap: .3rem; margin-top: .3rem; }
.tags .pill { font-size: .7rem; padding: .1rem .5rem; }
.signer-line { display: flex; align-items: center; gap: .45rem; white-space: nowrap; }
.pager { display: flex; padding: .8rem 1.3rem; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------------ Fiche d'un envoi */
.progress-wrap { margin-bottom: 1.2rem; }
.progress-text { margin-bottom: .4rem; }
.progress { height: 12px; background: #eef1f6; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--good), #34d399); border-radius: 99px; animation: grow 1s var(--ease) both; }
dl.cols { grid-template-columns: max-content 1fr max-content 1fr; }
@media (max-width: 860px) { dl.cols { grid-template-columns: max-content 1fr; } }
.action-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.section-title { margin: 1.6rem 0 .8rem; }
.signer-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.signer-card { margin: 0; display: flex; flex-direction: column; }
.signer-card header { display: flex; gap: .7rem; align-items: center; margin-bottom: .9rem; }
.signer-card header > div { flex: 1; min-width: 0; }
.signer-card header .muted { overflow-wrap: anywhere; }
.signer-card .avatar { width: 40px; height: 40px; font-size: 1rem; }
.track { list-style: none; margin: 0; padding: 0 0 0 .3rem; position: relative; }
.track::before { content: ""; position: absolute; left: 13px; top: 10px; bottom: 10px; width: 2px; background: #eef1f6; }
.track li { display: flex; gap: .7rem; align-items: center; padding: .35rem 0; color: var(--muted); font-size: .9rem; position: relative; }
.track li .icon { width: 1.05em; height: 1.05em; padding: 5px; box-sizing: content-box; border-radius: 50%; background: #f1f3f9; position: relative; }
.track li.done { color: var(--ink); }
.track li.done .icon { background: var(--good-soft); color: var(--good); }
.track li.indicative.done .icon { background: #e8f0ff; color: #2563eb; }
.card-actions { margin-top: auto; padding-top: 1rem; display: flex; flex-wrap: wrap; gap: .4rem; border-top: 1px solid #f1f4f8; }
.note-inline { margin: .6rem 0 1.4rem; }
.doc-block { padding: .8rem 0; border-bottom: 1px solid #f1f4f8; }
.doc-block:last-of-type { border-bottom: 0; }
.doc-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.doc-actions { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
details { margin-top: .5rem; }
summary { cursor: pointer; font-size: .85rem; color: var(--brand); font-weight: 600; }
dl.values { grid-template-columns: max-content 1fr; margin-top: .5rem; font-size: .9rem; }
.proof { display: flex; gap: .8rem; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.small-link { margin-left: auto; font-size: .82rem; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--brand-2), #eef1f6); }
.timeline li { position: relative; padding: .45rem 0 .45rem 1.8rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: baseline; }
.timeline li::before { content: ""; position: absolute; left: 2px; top: .8rem; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); }
.timeline li.technical { opacity: .6; }
.timeline li.technical::before { border-color: #cbd5e1; }
.timeline time { font-size: .82rem; color: var(--muted); min-width: 9.5rem; font-variant-numeric: tabular-nums; }
.ev-label { font-weight: 600; }

/* Fenêtres (annulation, correction des coordonnées) */
dialog.modal { border: 0; border-radius: 20px; padding: 1.6rem; width: min(480px, 92vw); box-shadow: 0 40px 80px -20px rgba(15, 23, 42, .45); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .35); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: pop .3s var(--ease); }
form.stack { display: flex; flex-direction: column; align-items: stretch; }
form.stack h2 { margin-bottom: .4rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }
label.check { display: flex; gap: .5rem; align-items: center; }
label.check input { width: auto; margin: 0; }
.flash { position: sticky; top: 70px; z-index: 15; box-shadow: var(--shadow-up); }
/* Cases et boutons radio masqués (interrupteurs, puces, tuiles) : sans largeur, pour ne rien faire déborder. */
.segmented input, .chip input, .tile input { width: 0; height: 0; margin: 0; padding: 0; border: 0; }
.segmented label, .chip, .tile { position: relative; }
/* ------------------------------------------------------------------ Administration, Read by sid */
.link-box { background: #f6f7fb; border: 1px dashed #c9cff0; border-radius: 12px; padding: .8rem 1rem; overflow-wrap: anywhere; }
.link-box code { background: none; padding: 0; font-size: .82rem; }
.pick-list { display: flex; flex-direction: column; gap: .5rem; }
.pick { margin: 0; position: relative; }
.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick span { display: flex; flex-direction: column; padding: .7rem 1rem; border: 1px solid #d5dbe5; border-radius: 12px; cursor: pointer; transition: all .2s var(--ease); }
.pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px rgba(91, 91, 246, .15); }
pre.json { margin: 0; max-height: 70vh; overflow: auto; background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 1rem 1.2rem; font: .82rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ------------------------------------------------------------------ Espaces : barre latérale, recherche, onglets */
.side {
    position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 30; display: flex; flex-direction: column; gap: .3rem;
    padding: 1rem .8rem; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(160%) blur(14px);
    border-right: 1px solid rgba(226, 232, 240, .9); overflow-y: auto; transition: width .25s var(--ease), transform .25s var(--ease);
}
.side .brand { padding: .2rem .45rem 1rem; }
.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.side-link {
    display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 12px; color: var(--ink-2);
    font-weight: 500; white-space: nowrap; transition: background .2s, color .2s;
}
.side-link .icon { width: 1.25em; height: 1.25em; }
.side-link:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.side-link[aria-current="page"] { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -10px rgba(124, 58, 237, .8); }
.side-bottom { margin-top: auto; }
body.with-side .shell { margin-left: 232px; transition: margin-left .25s var(--ease); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.menu-toggle { display: none; }
.global-search {
    flex: 1; max-width: 560px; display: flex; align-items: center; gap: .55rem; padding: 0 .9rem; height: 42px;
    background: #fff; border: 1px solid #d5dbe5; border-radius: 12px; transition: border-color .2s, box-shadow .2s;
}
.global-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(91, 91, 246, .15); }
.global-search .icon { color: var(--muted); }
.global-search input { border: 0; outline: 0; box-shadow: none; padding: 0; height: 100%; background: transparent; width: 100%; }
.space-tabs {
    display: flex; align-items: center; gap: .3rem; padding: .55rem 2rem; overflow-x: auto; scrollbar-width: none;
    border-bottom: 1px solid rgba(226, 232, 240, .8); background: rgba(255, 255, 255, .55);
}
.space-tabs::-webkit-scrollbar { display: none; }
.space-name { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; margin-right: .9rem; white-space: nowrap; }
.space-tabs .tab {
    display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .8rem; border-radius: 10px; color: var(--ink-2);
    font-weight: 500; white-space: nowrap;
}
.space-tabs .tab:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.space-tabs .tab[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
/* Écran moyen : barre latérale réduite aux icônes. */
@media (max-width: 1180px) {
    .side { width: 72px; align-items: center; }
    .side .side-label { display: none; }
    .side .brand { padding: .2rem 0 1rem; }
    body.with-side .shell { margin-left: 72px; }
}
/* Mobile : la barre latérale s'ouvre par le bouton menu. */
@media (max-width: 760px) {
    .side { width: 240px; align-items: stretch; transform: translateX(-100%); box-shadow: 0 0 40px rgba(15, 23, 42, .25); }
    .side .side-label { display: inline; }
    body.side-open .side { transform: none; }
    body.with-side .shell { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .top { padding: .6rem .8rem; gap: .5rem; }
    .top .langs, .top .badge-env { display: none; }
    .space-tabs { padding: .5rem .8rem; }
    .space-name { display: none; }
    main { padding: 1.2rem .9rem; }
}

/* ------------------------------------------------------------------ Clients */
.search-hero { text-align: center; padding: 2.6rem 1.5rem 2rem; }
.search-hero form { display: flex; gap: .6rem; max-width: 620px; margin: 1.4rem auto 0; }
.search-hero input { height: 50px; font-size: 1.05rem; }
.space-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.space-tile { display: flex; flex-direction: column; gap: .4rem; padding: 1.2rem; border-radius: var(--radius); background: #fff; border: 1px solid rgba(226, 232, 240, .9); color: var(--ink); box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s; }
.space-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); text-decoration: none; }
.space-tile .item-icon { margin-bottom: .3rem; }
.client-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.client-avatar { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 800; font-size: 1.3rem; box-shadow: var(--shadow-up); }
.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; align-items: start; }
.panel-grid > .card { margin: 0; }
@media (max-width: 960px) { .panel-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Documents */
.docs-layout { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 1100px) { .docs-layout { grid-template-columns: 1fr; } }
.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; max-height: 70vh; overflow-y: auto; }
.doc-list a { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .75rem; border-radius: 12px; color: var(--ink); border: 1px solid transparent; }
.doc-list a:hover { background: #f6f7fb; text-decoration: none; }
.doc-list a[aria-current] { background: var(--brand-soft); border-color: rgba(91, 91, 246, .35); }
.doc-list small { display: block; color: var(--muted); font-size: .78rem; }
.viewer { min-height: 70vh; display: flex; flex-direction: column; }
.viewer iframe, .viewer img { width: 100%; flex: 1; min-height: 66vh; border: 0; border-radius: 12px; background: #f1f3f8; object-fit: contain; }
.drop { border: 2px dashed #c9cff0; border-radius: 16px; padding: 1.4rem; text-align: center; background: #fafbff; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.field-error { display: block; color: var(--bad); font-size: .84rem; margin-top: .3rem; }
.drop { display: flex; flex-direction: column; align-items: center; gap: .3rem; cursor: pointer; }
.drop .icon { width: 2rem; height: 2rem; color: var(--brand); }

.badge-version { font: 600 .72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); background: #eef1f6; border-radius: 999px; padding: .32rem .6rem; white-space: nowrap; }

/* ---------------------------------------------------------------- Outils repris de l'ancien CRM (0.8) */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .2rem 1rem; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .form-grid, .form-grid.three { grid-template-columns: 1fr; } }
.link-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; border: 1px solid #d5dbe5; font-size: .82rem; font-weight: 600; color: var(--ink-2); background: #fff; text-decoration: none; }
.link-chip:hover { border-color: var(--brand); color: var(--brand); }
.link-chip svg { width: 14px; height: 14px; }
a.tag { text-decoration: none; display: inline-flex; align-items: center; gap: .2rem; margin: .1rem 0; }
a.tag svg { width: 12px; height: 12px; }
.note-card summary { cursor: pointer; }
.note-card ol { padding-left: 1.2rem; }
/* Simulateur (0.9) */
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.changed input, .changed select { border-color: var(--brand); background: var(--brand-soft); }
.was { display: block; font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.sim-table input { margin: 0; max-width: 220px; }
.sends tfoot th { text-align: left; border-top: 1px solid #e6e9f0; padding: .8rem 1rem; }
/* Analyse IA des documents (0.10) */
.ai-panel { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e6e9f0; }
.ai-panel h3 { display: flex; align-items: center; gap: .5rem; font-size: 1rem; margin: 0 0 .6rem; }
.ai-panel h4 { font-size: .85rem; margin: 1rem 0 .4rem; color: var(--ink-2); }
.ai-warnings { margin: 0; padding-left: 1.1rem; color: var(--ink-2); font-size: .88rem; }
.doc-list .status { margin-top: .25rem; display: inline-flex; width: max-content; }
/* Substitution (0.12) */
.pick-list { list-style: none; padding: 0; margin: 0; }
.pick-list li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .5rem .2rem; border-bottom: 1px solid #eef1f6; }
.pick-list li span { display: flex; flex-direction: column; }
/* Tarification (0.13) */
.segmented.wrap { flex-wrap: wrap; }
.segmented label { cursor: pointer; }
.card.has-error { box-shadow: 0 0 0 2px var(--bad, #e0384b) inset; }
.result-card .kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: .6rem; }
.result-card .kpi { background: #f6f7fb; border-radius: 12px; padding: .8rem 1rem; display: flex; flex-direction: column; }
@media (max-width: 760px) { .result-card .kpis { grid-template-columns: 1fr; } }

/* Petite étiquette (ex. « lu par l'IA ») */
.badge { display: inline-block; background: var(--accent-soft, #eef0ff); color: var(--accent, #5b5bd6); border-radius: 999px; padding: .05rem .5rem; font-size: .7rem; font-weight: 600; vertical-align: middle; }

/* Questions libres sur un dossier (0.18) */
.ask-presets { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .8rem; }
.ask-presets button { white-space: normal; text-align: left; }
.ask-item { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: .8rem; }
.ask-answer { background: var(--bg); border-radius: 10px; padding: .7rem .9rem; line-height: 1.5; }
.pkg-list { list-style: none; padding: 0; margin: .4rem 0; }
.pkg-list li { display: flex; gap: .6rem; align-items: baseline; padding: .35rem 0; border-bottom: 1px dashed var(--line); }
.pkg-list li:last-child { border-bottom: 0; }
#aic-fields { min-width: 1150px; }
#aic-fields input:not([type=checkbox]) { width: 100%; min-width: 9rem; }
#aic-fields textarea { width: 100%; min-width: 14rem; }
#aic-fields select { min-width: 7rem; }
#aic-fields select[multiple] { min-width: 13rem; }
.aic-inline { display: flex !important; align-items: center; gap: .5rem; }
.aic-inline input { width: 6rem; }
.panel-grid > .panel-wide { grid-column: 1 / -1; }
.ask-scope { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin: .4rem 0 .6rem; }
.ask-answer p { margin: 0 0 .55rem; }
.ask-answer p:last-child, .ask-answer ul:last-child, .ask-answer ol:last-child { margin-bottom: 0; }
.ask-answer ul, .ask-answer ol { margin: 0 0 .55rem; padding-left: 1.3rem; }
.ask-answer li { margin: .15rem 0; }
.ask-answer .md-h { font-weight: 700; margin-top: .4rem; }
.ask-answer code { background: var(--card); padding: 0 .25rem; border-radius: 4px; }
.spinner { display: inline-block; width: .9em; height: .9em; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -.1em; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.pend-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
@media (max-width: 960px) { .pend-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pend-card { display: flex; flex-direction: column; gap: .25rem; margin: 0; color: var(--ink); text-decoration: none; border: 1px solid var(--line); }
.pend-card strong { font-size: 2rem; line-height: 1.1; }
.pend-card.has-items strong { color: var(--warn); }
.pend-card.is-on { border-color: var(--brand); box-shadow: var(--shadow-up); }
.pend-days input { width: 4.5rem; }
.mail-cards { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 1100px) { .mail-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.mail-layout > .card { margin: 0; }
.mail-layout .viewer iframe { width: 100%; height: 78vh; border: 0; border-radius: 10px; background: var(--bg); }
@media (max-width: 960px) { .mail-layout { grid-template-columns: 1fr; } }
.mail-cands li { display: block; }
.mail-cands .inline-form { margin-top: .5rem; }
.mtag { display: inline-block; font-size: .78rem; padding: .05rem .45rem; border-radius: 999px; margin: .15rem .15rem 0 0; }
.mtag:not(.ok):not(.no) { background: var(--brand-soft, #eef0ff); color: var(--brand, #4f46e5); }
.mtag.ok { background: var(--good-soft); color: var(--good); }
.mtag.no { background: var(--bg); color: var(--muted); }

/* Boîte de gestion : texte du message, thèmes */
.mail-body { white-space: normal; max-height: 32rem; overflow: auto; padding: .8rem 1rem; background: var(--bg, #f6f7fb); border-radius: 10px; font-size: .92rem; line-height: 1.5; overflow-wrap: anywhere; }
.mail-topics .count { display: inline-block; min-width: 1.4em; margin-left: .35em; padding: 0 .4em; border-radius: 999px; background: #fde7d9; color: #b54708; font-size: .78em; text-align: center; }

/* ================================================================== Mailroom */
/* Couleur de la société : la marque redéfinit le dégradé et les teintes douces. */
[style*="--brand"] {
    --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
    --grad: linear-gradient(120deg, var(--brand) 0%, color-mix(in srgb, var(--brand) 72%, #9b5cf6) 55%, color-mix(in srgb, var(--brand) 55%, #e04fd0) 100%);
}
.tone-amber { --tone: #b45309; --tone-soft: #fff6e0; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 750; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--grad); color: #fff;
    font-weight: 800; box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--brand) 80%, transparent);
}
.brand-logo { height: 36px; max-width: 140px; object-fit: contain; border-radius: 8px; }
.login-logo { display: block; max-height: 64px; max-width: 220px; margin: 0 auto 1rem; object-fit: contain; }

/* Apparitions et mouvements doux (désactivés si l'utilisateur préfère moins d'animations). */
.fade-in { animation: rise .45s var(--ease) both; }
.fade-in > * { animation: rise .5s var(--ease) both; }
.fade-in > *:nth-child(2) { animation-delay: .06s; } .fade-in > *:nth-child(3) { animation-delay: .12s; } .fade-in > *:nth-child(4) { animation-delay: .18s; }
.float { animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .fade-in, .fade-in > *, .float, .orb span { animation: none !important; } }

.hero-card { text-align: center; padding: 2.4rem 2rem; position: relative; overflow: hidden; }
.hero-card::before { content: ""; position: absolute; inset: -40% -20% auto; height: 220px; background: var(--grad); opacity: .08; filter: blur(30px); }
.hero-mark {
    display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 1rem; border-radius: 20px; background: var(--grad); color: #fff;
    font-size: 1.6rem; font-weight: 800; box-shadow: var(--shadow-up);
}
.hero-mark .icon { width: 30px; height: 30px; }

.admin-banner {
    display: flex; align-items: center; gap: .7rem; padding: .6rem 2rem; font-size: .88rem; font-weight: 500;
    background: linear-gradient(90deg, #fff6e0, #fff1e6); color: #92400e; border-bottom: 1px solid #fde4b8;
}
.admin-banner a { margin-left: auto; font-weight: 600; color: #92400e; }

.address-pill {
    display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .4rem .35rem .8rem; margin: .2rem 0; border-radius: 999px;
    background: #fff; border: 1px solid #d7d9ff; box-shadow: var(--shadow); font-size: .85rem;
}
.address-pill code { font-weight: 600; color: var(--ink); }
.address-pill button { padding: .3rem .5rem; }

/* Cartes de compteurs */
.stat-card { display: flex; flex-direction: column; gap: .15rem; margin: 0; padding: 1rem 1.1rem; color: var(--ink); position: relative; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); text-decoration: none; }
.stat-card strong { font-size: 1.8rem; font-weight: 750; letter-spacing: -.03em; color: var(--tone, var(--brand)); }
.stat-card span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-card .stat-icon { position: absolute; right: .9rem; top: .9rem; color: var(--tone, var(--brand)); opacity: .35; }
.stat-card.is-on { box-shadow: 0 0 0 2px var(--brand) inset, var(--shadow-up); }
.stat-card.has-items strong::after { content: ""; display: inline-block; width: 8px; height: 8px; margin-left: .4rem; vertical-align: .5em; border-radius: 50%; background: var(--bad); animation: pulse 2s infinite; }
.stat-cards:has(> .stat-card:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
div.stat-card { background: #fff; border: 1px solid rgba(226, 232, 240, .9); border-radius: 14px; box-shadow: var(--shadow); }

/* Onglets dans la page (thèmes, réglages) */
.topic-tabs { width: fit-content; max-width: 100%; padding: .35rem; margin-bottom: 1.2rem; border: 1px solid rgba(226, 232, 240, .9); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.topic-tabs .count { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: #eef1f6; font-size: .72rem; font-weight: 700; }
.topic-tabs .tab[aria-current="page"] { background: var(--grad); color: #fff; }
.topic-tabs .tab[aria-current="page"] .count { background: rgba(255, 255, 255, .25); color: #fff; }

/* Boîte */
table.mail-table tr[data-href] { cursor: pointer; transition: background .15s; }
table.mail-table tr[data-href]:hover { background: #f7f8fc; }
table.mail-table tr.urgent td:first-child { box-shadow: 3px 0 0 var(--bad) inset; }
.mtag { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: 999px; background: #eef1f6; color: var(--ink-2); font-size: .74rem; font-weight: 600; }
.mtag.ok { background: var(--good-soft); color: #046c4e; border: 0; padding: .1rem .5rem; margin: 0; }
.mtag.ok::before { display: none; }

/* Message */
.mail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.2rem; align-items: start; }
@media (max-width: 1100px) { .mail-layout { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 84px; }
.mail-body { white-space: normal; line-height: 1.65; color: var(--ink-2); max-height: 520px; overflow: auto; padding-right: .5rem; }
.summary { font-size: 1rem; line-height: 1.6; }
.thinking { display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 1.5rem 0; }
.small-orb { width: 54px; height: 54px; }
.cands { list-style: none; padding: 0; margin: 0 0 .8rem; }
.cands li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem .7rem; border-radius: 12px; border: 1px solid var(--line); margin-bottom: .4rem; transition: border-color .2s, box-shadow .2s; }
.cands li:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.dossier-pick { position: relative; display: flex; width: 100%; margin-top: .4rem; }
.dossier-pick input[name="dossier"] { flex: 1; margin: 0; }
.dossier-pick .suggestions { position: absolute; z-index: 10; top: 100%; left: 0; right: 0; list-style: none; margin: .3rem 0 0; padding: .3rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-up); }
.dossier-pick .suggestions li { padding: .45rem .6rem; border-radius: 8px; cursor: pointer; }
.dossier-pick .suggestions li:hover, .dossier-pick .suggestions li.on { background: var(--brand-soft); }
.part-card h2 { display: flex; align-items: center; gap: .6rem; }
.part-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid #f1f4f8; }
.viewer-toggle summary { cursor: pointer; font-weight: 600; color: var(--brand); margin: .5rem 0; }
iframe.pdf { width: 100%; height: 620px; border: 1px solid var(--line); border-radius: 12px; background: #f7f8fc; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }
.row-actions form { margin: 0; }
h3 { display: flex; align-items: center; gap: .4rem; font-size: .9rem; margin: 1.3rem 0 .6rem; color: var(--ink-2); }

/* Grilles et formulaires */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; align-items: start; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1rem; }
@media (max-width: 900px) { .grid-2, .grid-2.wide-left, .grid-3 { grid-template-columns: 1fr; } }
.stack > label:first-of-type { margin-top: 0; }
.dropzone {
    display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.6rem; margin: .8rem 0; border: 2px dashed #d5dbe5; border-radius: 14px;
    color: var(--muted); text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dropzone .icon { width: 28px; height: 28px; }
.dropzone input[type="file"] { max-width: 100%; font-size: .82rem; }
.color-row { display: flex; gap: .5rem; align-items: center; margin-top: .35rem; }
.color-row input[type="color"] { width: 46px; height: 42px; padding: 3px; flex: none; cursor: pointer; }
.choice-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice-cards { display: grid; gap: .6rem; }
.choice-card { display: flex; gap: .7rem; align-items: flex-start; margin: 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .2s, box-shadow .2s; }
.choice-card input { width: auto; margin: .2rem 0 0; }
.choice-card span { display: flex; flex-direction: column; gap: .15rem; }
.choice-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
ul.checks { list-style: none; padding: 0; margin: .6rem 0 1rem; }
ul.checks li { position: relative; padding: .3rem 0 .3rem 1.6rem; color: var(--ink-2); }
ul.checks li::before { content: "✓"; position: absolute; left: 0; top: .3rem; display: grid; place-items: center; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--good-soft); color: var(--good); font-size: .7rem; font-weight: 800; }
pre.code, textarea.code { font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 1rem; overflow: auto; white-space: pre; }
textarea.code { width: 100%; border: 0; }
tr.row-admin td { background: #fffaf0; }

/* Marque : aperçu */
.login-mini { display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 1.6rem; border-radius: 14px; background: linear-gradient(180deg, var(--brand-soft), #fff); }
.btn-like { display: inline-block; padding: .55rem 1.2rem; border-radius: 12px; background: var(--grad); color: #fff; font-weight: 600; }

/* Administration */
.tenant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.tenant-card {
    display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; padding: 1.1rem 1.2rem; border-radius: var(--radius); background: #fff; color: var(--ink);
    border: 1px solid rgba(226, 232, 240, .9); box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s;
}
.tenant-card::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad); }
.tenant-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); text-decoration: none; }
.tenant-name { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tenant-tags { display: flex; flex-wrap: wrap; gap: .35rem; width: 100%; }
.config-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
@media (max-width: 900px) { .config-layout { grid-template-columns: 1fr; } }
.config-nav { display: flex; flex-direction: column; gap: .15rem; padding: .6rem; position: sticky; top: 84px; }
.config-nav a { display: flex; align-items: center; gap: .55rem; padding: .5rem .7rem; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
.config-nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.config-nav a[aria-current="page"] { background: var(--grad); color: #fff; }
table.rows-table td { vertical-align: top; padding: .35rem .3rem; }
table.rows-table input, table.rows-table select, table.rows-table textarea { margin: 0; font-size: .85rem; }
table.rows-table tbody tr { animation: rise .3s var(--ease) both; }
table.rows-table td:has(textarea[name*="[subtypes]"]), table.rows-table td:has(textarea[name*="[fields]"]) { width: 36%; }
table.rows-table td:has(input[name$="[key]"]) { width: 15%; }
.inline-form button, .row-actions button { white-space: nowrap; }

/* ================================================================== Contacts, conversations, questions à l'IA */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.contact-card { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: #fff; color: var(--ink);
    border: 1px solid rgba(226, 232, 240, .9); box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s; }
.contact-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); text-decoration: none; }
.contact-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.contact-stats { display: flex; gap: .8rem; width: 100%; font-size: .82rem; color: var(--ink-2); padding-top: .5rem; border-top: 1px solid #f1f4f8; }
.contact-stats span { display: inline-flex; align-items: center; gap: .25rem; }
.contact-stats span:last-child { margin-left: auto; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.big-avatar { width: 44px; height: 44px; font-size: 1.05rem; border-radius: 14px; }
.avatar.huge-avatar { width: 64px; height: 64px; font-size: 1.6rem; border-radius: 20px; box-shadow: var(--shadow-up); }
.avatar.small-avatar { width: 28px; height: 28px; font-size: .78rem; flex: none; }
.avatar { display: inline-grid; place-items: center; background: var(--grad); color: #fff; font-weight: 750; border-radius: 50%; flex: none; }
.contact-head { display: flex; align-items: center; gap: 1rem; }
.contact-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem; border-radius: 999px; background: var(--brand-soft); }
.contact-chip:hover { text-decoration: none; filter: brightness(.97); }
.sender-link { color: var(--ink); }
.date-stat { font-size: 1.25rem !important; }
.search-inline input { min-width: 260px; margin: 0; }
details.conv { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .9rem; margin-bottom: .6rem; transition: box-shadow .2s; }
details.conv[open] { box-shadow: var(--shadow); }
details.conv summary { cursor: pointer; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
details.conv summary small { margin-left: auto; }
ol.thread { list-style: none; margin: 0; padding: 0; position: relative; }
ol.thread::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
ol.thread li { display: flex; gap: .8rem; padding: .5rem 0; position: relative; }
ol.thread li .dot { margin-top: .45rem; z-index: 1; }
ol.thread li.is-current strong { color: var(--brand); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; }
.file-card { display: flex; gap: .7rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); min-width: 0; transition: border-color .2s, transform .2s var(--ease); }
.file-card > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.file-card:hover { border-color: var(--brand); transform: translateY(-2px); text-decoration: none; }
.file-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }

.ask-card { position: relative; overflow: hidden; }
.ask-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--grad); }
.ai-step { background: var(--grad); color: #fff; }
.ask-form textarea { resize: vertical; min-height: 64px; }
.ask-row { display: flex; gap: .6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: .5rem; }
.chip-btn { background: #fff; color: var(--ink-2); border: 1px solid #d5dbe5; box-shadow: none; padding: .3rem .7rem; font-size: .8rem; font-weight: 500; border-radius: 999px; }
.chip-btn:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); transform: none; }
.qa-list { margin-top: 1rem; display: flex; flex-direction: column; gap: .9rem; }
.qa { border-top: 1px solid #f1f4f8; padding-top: .9rem; animation: rise .4s var(--ease) both; }
.qa-q { display: flex; gap: .6rem; align-items: flex-start; }
.qa-q p { margin: 0; font-weight: 600; }
.qa-a { display: flex; gap: .6rem; align-items: flex-start; margin: .6rem 0 0 1.2rem; padding: .8rem 1rem; border-radius: 14px; background: linear-gradient(135deg, var(--brand-soft), #fff); }
.qa-a .answer { flex: 1; min-width: 0; line-height: 1.6; }
.qa-a .answer p { margin: 0 0 .5rem; }
.qa-a .answer ul { margin: .2rem 0 .5rem; padding-left: 1.1rem; }
.ai-mark { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 8px; background: var(--grad); color: #fff; }
.ai-mark .icon { width: 15px; height: 15px; }
.typing { display: inline-flex; gap: 4px; align-items: center; padding: .45rem .2rem; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-hero { display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; border-radius: 14px; background: linear-gradient(120deg, var(--brand-soft), #fff); margin-bottom: .6rem; }
.ai-hero p { margin: 0; color: var(--ink-2); }
.hero-mark.small-hero { width: 48px; height: 48px; margin: 0; font-size: 1.1rem; border-radius: 14px; }
.hero-mark.small-hero .icon { width: 22px; height: 22px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: .6rem 1rem .8rem; margin: .8rem 0; }
fieldset legend { padding: 0 .4rem; font-weight: 600; font-size: .85rem; color: var(--ink-2); display: inline-flex; align-items: center; gap: .3rem; }
fieldset.sensitive { border-color: #fde4b8; background: #fffdf7; }
.config-single { max-width: 980px; }
.field-static { display: flex; flex-direction: column; gap: .35rem; margin: .8rem 0; font-size: .85rem; font-weight: 500; color: var(--ink-2); }
.field-static .address-pill { width: fit-content; }
@media (prefers-reduced-motion: reduce) { .typing span, .qa { animation: none !important; } }

/* ================================================================== Automatisations et actions */
.act-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.act { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; flex-wrap: wrap; animation: rise .35s var(--ease) both; }
.act-proposed { border-color: #fbd3a5; background: linear-gradient(90deg, #fff8f0, #fff); }
.act-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--brand-soft); color: var(--brand); }
.act-main { display: flex; flex-direction: column; flex: 1; min-width: 200px; }
.act-result { color: var(--ink-2); font-family: ui-monospace, Menlo, monospace; font-size: .74rem; margin-top: .15rem; word-break: break-all; }
.act-btns { display: flex; gap: .3rem; }
.act-btns form { margin: 0; }
.qa-actions { margin-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.proposed-banner { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; margin-bottom: 1rem; border-radius: 14px; color: var(--ink);
    background: linear-gradient(120deg, #fff4e6, #fff); border: 1px solid #fbd3a5; box-shadow: var(--shadow); transition: transform .2s var(--ease); }
.proposed-banner:hover { transform: translateY(-2px); text-decoration: none; }
.proposed-banner .banner-go { margin-left: auto; color: var(--warn); }
.rule-card { border: 1px solid var(--line); border-radius: 14px; margin-bottom: .9rem; background: #fff; box-shadow: var(--shadow); overflow: hidden; animation: rise .3s var(--ease) both; }
.rule-head { display: flex; align-items: center; gap: .7rem; padding: .6rem .9rem; background: linear-gradient(90deg, var(--brand-soft), #fff); border-bottom: 1px solid var(--line); }
.rule-head label.check { margin: 0; white-space: nowrap; }
.rule-head .rule-name { flex: 1; margin: 0; font-weight: 600; }
.rule-head .rule-key { width: 140px; margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; }
.rule-body { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .rule-body { grid-template-columns: 1fr; } }
.rule-col { padding: .6rem .9rem .8rem; position: relative; }
.rule-col + .rule-col { border-left: 1px dashed var(--line); }
.rule-col label { margin: .5rem 0; }
.rule-tag { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: #eef1f6; color: var(--ink-2); }
.rule-tag.then { background: var(--grad); color: #fff; }
.keys-card { max-width: 980px; margin-left: auto; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: 1.5rem; }

/* v0.4 : actions préparées depuis un mail, réponses à relire */
.new-action { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
.new-action select { flex: 1 1 18rem; }
.new-action input { flex: 1 1 14rem; }
.act-reply { flex: 1 0 100%; display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.act-reply .act-edit { flex: 1 1 100%; display: grid; gap: .5rem; }
.act-reply .act-edit button { justify-self: start; }
.act-reply textarea { font-family: inherit; min-height: 9rem; }
.act { flex-wrap: wrap; }
.act-draft { display: block; margin-top: .25rem; color: var(--muted, #64748b); }
.act-draft pre { white-space: pre-wrap; font-family: inherit; margin: .35rem 0 0; }
.inline-num { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.inline-num input { width: 5.5rem; }
