/* CRM Nerovya : 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; }
