/* Charte de la gamme Genius, reprise de crmgenius.ch : Inter, fond crème, cadre arrondi, menu latéral blanc.
   BizGenius = pétrole ; neutres communs aux produits de la gamme. */
@font-face { font-family: "Inter"; src: url("/media/inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/media/inter-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/media/inter-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/media/inter-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --brand: #17505e;
  --brand-dark: #0c3742;
  --brand-pale: #e2f0f2;
  --ink: #111412;
  --anthracite: #474d4a;
  --bg-page: #efece5;
  --bg: #f7f5f0;
  --surface: #ffffff;
  --field: #faf8f4;
  --line: #dedbd2;
  --line-strong: #d4d1c8;
  --muted: #4f5850;
  --light: #737a72;
  --ok: #059669; --ok-bg: #d1fae5; --ok-text: #065f46;
  --warn: #d97706; --warn-bg: #fef3c7; --warn-text: #92400e;
  --danger: #dc2626; --danger-bg: #fee2e2; --danger-text: #991b1b;
  --sh: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --sh-md: 0 4px 16px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --sh-lg: 0 8px 32px rgba(0,0,0,.12);
  --focus: 0 0 0 3px rgba(23,80,94,.14);
  --r: 10px; --r-lg: 14px; --r-sm: 6px;
  --sidebar-w: 248px;
  --topbar-h: 56px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-title: var(--font-body);
  --font-mono: var(--font-body);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  /* Alias des anciens noms, utilisés par les styles des pages */
  --accent: var(--brand);
  --accent-ink: #ffffff;
  --accent-soft: var(--brand-pale);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg-page); color: var(--ink); font: 400 13.5px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; transition: color .12s var(--ease); }
a:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: .15em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-title); color: var(--ink); line-height: 1.2; margin: 0 0 .6em; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; max-width: 40em; overflow-wrap: break-word; }
h2 { font-size: 15px; font-weight: 600; margin-top: 2rem; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 1em; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100; border-radius: var(--r-sm); }
.skip:focus { left: 16px; top: 16px; }

/* Cadre de l'application */
body.app { padding: 16px; height: 100vh; overflow: hidden; }
.frame { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: calc(100vh - 32px); background: var(--surface); border-radius: 18px; box-shadow: var(--sh-lg); overflow: hidden; }
.sidebar { display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); min-height: 0; overflow-y: auto; scrollbar-width: none; }
.sidebar::-webkit-scrollbar { display: none; }
.brand { display: block; padding: 20px 18px 16px; border-bottom: 1px solid var(--line); }
.brand:hover { text-decoration: none; }
.brand img { display: block; height: 32px; width: auto; }
.nav-toggle { flex: 1; }
.nav-toggle > summary { display: none; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: var(--r-sm); color: var(--muted); font-size: 13.5px; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--brand-pale); color: var(--brand); font-weight: 600; }
.ni { flex-shrink: 0; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { margin-left: auto; font-size: 10.5px; font-weight: 600; color: #fff; background: var(--brand); padding: 1px 7px; border-radius: 10px; }
.nav-group { margin: 14px 12px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--light); }
.sidebar-bottom { display: flex; align-items: center; gap: 6px; padding: 12px 10px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--r-sm); color: var(--ink); flex: 1; min-width: 0; }
.user-chip:hover, .user-chip[aria-current="page"] { background: var(--bg); text-decoration: none; color: var(--ink); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-pale); color: var(--brand); font-weight: 700; font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1.5px solid var(--line); }
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }
.logout-btn { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: var(--r-sm); background: none; color: var(--muted); cursor: pointer; transition: background .12s, color .12s; }
.logout-btn:hover { background: var(--danger-bg); color: var(--danger); }
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: var(--topbar-h); padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.project-switch { display: flex; align-items: center; gap: 10px; }
.project-switch label, .label-xs { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.project-switch select { width: auto; min-width: 14rem; min-height: 2.1rem; padding: .3rem .6rem; }
.project-name { margin: 0; font-weight: 600; }
.main { flex: 1; overflow-y: auto; padding: 28px 28px 56px; }
.main > * { max-width: 92rem; }
body.bare .main { padding: 0; }

.split { display: grid; grid-template-columns: minmax(0, 65fr) minmax(0, 35fr); gap: 24px; align-items: start; }
.split-70 { grid-template-columns: minmax(0, 70fr) minmax(0, 30fr); }
.split > aside, .col-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); padding: 18px 20px; }
.split > aside > h2:first-child, .col-side > section:first-child > h2, .col-main > section:first-child > h2 { margin-top: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: .3em; }
.lead { color: var(--muted); font-size: 13.5px; max-width: 60em; margin-bottom: 1.4em; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.crumbs a { color: var(--brand); }

/* Texte utilitaire */
.meta { font-size: 12px; color: var(--light); font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.is-late { color: var(--danger); }
.hint { font-size: 12px; color: var(--light); margin: .3rem 0 0; }
.empty { color: var(--light); max-width: 46em; padding: 1rem 0; }
.tag { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--bg-page); padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.status-client { color: var(--brand); font-weight: 600; }
.excluded { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--danger); }
.due { font-size: 12.5px; font-weight: 600; }

/* Messages */
.flash { display: block; padding: 10px 14px; margin: 0 0 18px; max-width: 60em; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-weight: 500; }
.flash-ok { background: var(--ok-bg); border-color: #a7f3d0; color: var(--ok-text); }
.flash-error { background: var(--danger-bg); border-color: #fecaca; color: var(--danger-text); }
.flash-info { background: var(--bg); color: var(--muted); }
.field-error { color: var(--danger); font-size: 12.5px; margin: .3rem 0 0; }
.note-box { font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 12px 14px; }
.note-box p:last-child { margin: 0; }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
label, .label, legend { font-size: 13px; font-weight: 600; }
.field > label:not(.check), .field > legend, .field > .label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="tel"], input[type="url"], select, textarea {
  font: inherit; color: var(--ink); background: var(--field); border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; width: 100%; min-height: 2.4rem;
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); background: var(--surface); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--light); }
select { cursor: pointer; }
textarea { resize: vertical; }
.mono-area { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; }
input[type="file"] { font: inherit; padding: .4rem 0; }
input[type="file"]::file-selector-button { font: 500 13px var(--font-body); margin-right: 10px; padding: 6px 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--r-sm); cursor: pointer; }
input[type="file"]::file-selector-button:hover { border-color: var(--brand); color: var(--brand); }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; cursor: pointer; text-transform: none; letter-spacing: 0; color: var(--ink); }
.check input { width: 15px; height: 15px; accent-color: var(--brand); margin: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.stack > .btn, .stack > button { align-self: flex-start; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 10rem; }
.row > .field-grow { flex: 3 1 14rem; }
.row > .field-narrow, .field-narrow { flex: 0 1 7rem; }
.form-narrow { max-width: 34rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.inline { display: inline; }
.inline-edit { display: flex; gap: .5rem; align-items: center; }
.inline-edit input { min-height: 2rem; padding: .3rem .5rem; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 13.5px/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: var(--r-sm); padding: 8px 16px; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; text-decoration: none; }
.btn-accent { background: var(--brand); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); font-weight: 500; }
.btn-ghost:hover { background: var(--bg); border-color: var(--brand); color: var(--brand); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-small { padding: 6px 12px; font-size: 12.5px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); cursor: pointer; }
.link:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: .15em; }
.link-danger { color: var(--danger); }
.link-danger:hover { color: var(--danger-text); }
.danger-zone { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* Tableaux */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 11px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { padding-top: 10px; padding-bottom: 10px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--bg); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-check { width: 2.25rem; }
.is-excluded td { color: var(--muted); }
.is-excluded a.strong { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.is-muted td { color: var(--muted); }
.is-done td, .todo-list .is-done label { color: var(--muted); text-decoration: line-through; }
.cell-example { font-size: .8125rem; color: var(--muted); max-width: 22rem; overflow-wrap: anywhere; }
.actions-cell { white-space: nowrap; }
.actions-cell form + form { margin-left: .75rem; }
.figures { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.figures th, .figures td { padding: .45rem 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
.figures td { text-align: right; font-family: var(--font-mono); font-size: .875rem; }
.figures .total th, .figures .total td { font-weight: 600; border-bottom: 2px solid var(--ink); }
.figures a { color: var(--ink); }

/* Recherche et filtres */
.search-bar { margin-bottom: 1.25rem; }
.search-row { display: flex; gap: .75rem; align-items: center; max-width: 46rem; }
.search-row input[type="search"] { font-size: 1rem; min-height: 2.8rem; }
.filters-panel { margin-bottom: 1rem; }
.filters-panel > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; padding: .6rem .9rem; background: var(--surface); border: 1px solid var(--line); list-style: none;  border-radius: var(--r);}
.filters-panel > summary::-webkit-details-marker { display: none; }
.filters-panel > summary:hover { border-color: var(--line-strong); }
.filters-panel[open] > summary { border-bottom-color: transparent; }
.filters-panel[open] > .filters { margin-top: 0; border-top: 0;  border-radius: var(--r);}
.filters-title { font-weight: 600; font-size: .875rem; }
.filters-count { font-family: var(--font-mono); font-size: .75rem; color: var(--accent); font-weight: 600; }
.filters-desc { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.filters-panel.is-active > summary { border-left: 3px solid var(--accent); }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem 1.25rem; padding: 1.25rem; margin-top: .75rem; background: var(--surface); border: 1px solid var(--line); }
.filters .field-wide { grid-column: 1 / -1; }
.filters .field-narrow { flex: none; }
.field-tags { grid-column: span 2; }
.tag-picks { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: .4rem 0; }
.inline-options { display: flex; gap: 1rem; }
.segment-form .filters { margin-top: 1.25rem; }
.result-line { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: baseline; margin-bottom: .9rem; }
.result-line .sort { margin-left: auto; font-size: .8125rem; color: var(--muted); }
.sort a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: none; }
.tabs { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 2rem; margin-bottom: 20px; font-size: 13px; }
.tabs > :is(div, span):has(> a) { display: flex; gap: 4px; padding: 4px; background: var(--bg-page); border: 1px solid var(--line); border-radius: var(--r); max-width: 100%; overflow-x: auto; }
.tabs > * > a { padding: 6px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tabs > * > a:hover { color: var(--ink); background: rgba(0,0,0,.04); text-decoration: none; }
.tabs > * > a[aria-current] { background: var(--surface); color: var(--brand); font-weight: 600; box-shadow: var(--sh); }
.bulk { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-top: 18px; padding: 16px 20px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh); }
.bulk legend { float: left; width: 100%; margin-bottom: .25rem; font-size: 14px; }
.bulk .field { flex: 0 1 15rem; }
.pager { display: flex; gap: 1.25rem; align-items: center; margin-top: 1.25rem; font-size: .875rem; }

/* Fiche contact */
.contact-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.contact-head h1 { margin-bottom: .2em; }
.status-form { display: flex; flex-direction: column; gap: .7rem; min-width: 15rem; padding: 1rem 1.1rem; border: 1px solid var(--line); background: var(--surface);  border-radius: var(--r);}
.check-blacklist { font-weight: 600; }
.note-form { padding: 1.25rem; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.75rem;  border-radius: var(--r);}
.note { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.note header { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.note h3 { margin: 0 0 .3rem; }
.note-body { max-width: 44em; margin: .4rem 0 .6rem; }
.note footer { display: flex; gap: 1.25rem; flex-wrap: wrap; align-items: baseline; }
.todo-list { list-style: none; margin: 0 0 1.25rem; padding: 0; border-top: 1px solid var(--line); }
.todo-list li { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.todo-list li > :first-child { flex: 1; }
.todo-form { margin-top: .5rem; }
.facts { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .5rem 1rem; margin: 0 0 1rem; font-size: .875rem; }
.facts dt { color: var(--muted); font-size: .8125rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts-about { grid-template-columns: 1fr; gap: .1rem; }
.facts-about dd { margin-bottom: .6rem; color: var(--muted); }
.facts-about dt { color: var(--ink); font-weight: 600; }
.score-table { border-collapse: collapse; width: 100%; max-width: 16rem; }
.score-table th { font-family: var(--font-mono); font-size: .75rem; font-weight: 400; width: 1.25rem; text-align: left; color: var(--muted); }
.score-table td { padding: .12rem 0; }
.score-table td.num { white-space: nowrap; min-width: 3rem; }
.score-table td:nth-child(2) { width: 100%; padding-right: .6rem; }
.bar { display: block; height: .45rem; background: var(--accent); min-width: 1px; }
.hours { border-collapse: collapse; font-size: .875rem; width: 100%; }
.hours th { text-align: left; font-weight: 400; padding: .2rem 1rem .2rem 0; white-space: nowrap; }
.hours td { padding: .2rem 0; }
.tag-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.tag-list li { display: flex; gap: .4rem; align-items: baseline; }
.edit-box { margin-top: .5rem; }
.edit-box > summary, .raw > summary { cursor: pointer; font-weight: 600; font-size: .875rem; padding: .4rem 0; }
.edit-box[open] > summary { margin-bottom: 1rem; }
.raw { margin-top: 2rem; }
.raw[open] > summary { margin-bottom: .75rem; }
.table-raw { font-size: .8125rem; background: var(--surface); border: 1px solid var(--line); }
.table-raw th { width: 40%; font-weight: 400; }
.table-raw td { overflow-wrap: anywhere; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: .55rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; }
.plain-list li:first-child { border-top: 1px solid var(--line); }

/* Campagne */
.email-preview { background: var(--surface); border: 1px solid var(--line); padding: 1.5rem; max-width: 46rem;  border-radius: var(--r);}
.email-footer { margin-top: 2rem; padding-top: .75rem; border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); }
.send-box { margin-top: 2rem; }
.send-progress { font-size: 1rem; }
progress { width: 100%; max-width: 46rem; height: .6rem; appearance: none; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 0; }
progress::-webkit-progress-bar { background: var(--surface); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

/* Connexion */
body.bare { min-height: 100vh; background: var(--bg); }
.auth { max-width: 400px; margin: 12vh auto 4rem; background: var(--surface); border-radius: 16px; box-shadow: 0 4px 24px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.auth-top { padding: 36px 36px 26px; text-align: center; border-bottom: 1px solid var(--line); }
.auth-top img { display: inline-block; height: 36px; width: auto; margin-bottom: 18px; }
.auth h1 { font-size: 20px; margin-bottom: 4px; }
.auth-top p { margin: 0; color: var(--muted); font-size: 13px; }
.auth-body { padding: 28px 36px 30px; }
.auth-body .btn { width: 100%; padding: 11px 16px; }
.auth .meta { margin-top: 18px; display: block; text-align: center; }

@media (max-width: 1100px) {
  .split, .split-70 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  body.app { padding: 0; height: auto; overflow: visible; }
  .frame { grid-template-columns: minmax(0, 1fr); height: auto; border-radius: 0; box-shadow: none; overflow: visible; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .brand { display: inline-block; border-bottom: 0; padding: 14px 16px 6px; }
  .nav-toggle > summary { display: inline-block; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--brand); padding: 4px 16px 10px; }
  .nav-toggle:not([open]) + .sidebar-bottom { display: none; }
  .topbar { padding: 0 16px; }
  .project-switch select { min-width: 0; }
  .status-form { min-width: 0; width: 100%; }
  .main { padding: 20px 16px 48px; overflow: visible; }
  .search-row { flex-wrap: wrap; }
  .field-tags { grid-column: 1 / -1; }
  .facts { grid-template-columns: 1fr; gap: 0 1rem; }
  .facts dd { margin-bottom: .5rem; }
  .table-contacts th:nth-child(3), .table-contacts td:nth-child(3), .table-contacts th:nth-child(6), .table-contacts td:nth-child(6), .table-contacts th:nth-child(9), .table-contacts td:nth-child(9) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Activités et filtres d'activité */
.field-categories { grid-column: 1 / -1; }
.cat-tools { display: flex; gap: 1rem; align-items: center; margin: .4rem 0 .6rem; flex-wrap: wrap; }
.cat-tools input[type="search"] { max-width: 16rem; min-height: 2rem; padding: .3rem .55rem; }
.cat-picks { max-width: 44rem; border: 1px solid var(--line); background: var(--surface);  border-radius: var(--r);}
.cat-head, .cat-picks .check { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr) 4.5rem; gap: .75rem; align-items: center; padding: .4rem .75rem; }
.cat-picks.has-file .cat-head, .cat-picks.has-file .check { grid-template-columns: 1.25rem minmax(0, 1fr) 4.5rem 4.5rem; }
.cat-head { border-bottom: 1px solid var(--line-strong); background: var(--bg); }
.cat-head .link { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-decoration: none; padding: .2rem 0; }
.cat-head .link.num { text-align: right; }
.cat-head .link[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: .3em; }
.cat-picks .check { border-bottom: 1px solid var(--line); }
.cat-picks .check:last-child { border-bottom: 0; }
.cat-picks .check:hover { background: var(--bg); }
.cat-picks .check[hidden] { display: none; }
.cat-picks .num { text-align: right; }
.table-activities .col-bar { width: 22%; min-width: 6rem; }
.table-activities td.col-bar { vertical-align: middle; }

/* Import : template et aperçu */
.template-pick { margin-bottom: 1.5rem; max-width: 34rem; }
.preview-section { margin: 1rem 0 3rem; }
.preview-controls { margin-bottom: 1rem; }
.pager-inline { display: flex; gap: 1rem; align-items: center; padding-bottom: .6rem; }
.table-preview td { vertical-align: top; }
.table-preview details > summary { cursor: pointer; white-space: nowrap; color: var(--accent); }
.facts-preview { grid-template-columns: 9rem minmax(14rem, 1fr); margin-top: .5rem; }
.preview-create { color: var(--ink); }
.preview-update a { font-weight: 600; }

/* Import : filtre */
.import-filter { margin: 0 0 1.75rem; padding: 1rem 1.25rem 1.25rem; border: 1px solid var(--line); background: var(--surface);  border-radius: var(--r);}
.import-filter > legend { font-family: var(--font-title); font-weight: 600; font-size: 1.125rem; padding: 0 .4rem; }
.import-filter .filters { padding: 0; margin: .5rem 0 1rem; border: 0; }
.import-filter .hint a { color: var(--accent); }
.file-cats { margin-top: 1.25rem; }
.file-cats > summary { cursor: pointer; font-weight: 600; font-size: .875rem; }
.file-cats .table-wrap { max-height: 24rem; overflow-y: auto; margin-top: .6rem; }
.table-compact th, .table-compact td { padding-top: .3rem; padding-bottom: .3rem; font-size: .875rem; }

/* Groupes d'activités */
.group-pick { margin-bottom: 1.25rem; max-width: 40rem; }
.cat-picks .cat-state { margin-left: .4rem; color: var(--accent); }
.cat-picks .cat-state:empty { display: none; }

/* Carte des segments */
.map-section { margin: 2.5rem 0; }
.ch-map { margin: 0; }
.ch-map svg { display: block; width: 100%; height: auto; aspect-ratio: 311.5 / 200; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-lg); }
.ch-map circle { fill: var(--accent); fill-opacity: .5; stroke: #fff; stroke-width: 1px; vector-effect: non-scaling-stroke; transition: fill-opacity .15s var(--ease); }
.ch-map a:hover circle, .ch-map a:focus-visible circle { fill-opacity: .9; }
.ch-map a:focus-visible { outline: none; }
.ch-map a:focus-visible circle { stroke: var(--ink); stroke-width: 2px; }
.ch-map figcaption { margin-top: .5rem; }
.map-tools { display: flex; justify-content: flex-end; gap: 1.25rem; margin-bottom: .4rem; }
.map-tools [aria-pressed="true"] { color: var(--ink); font-weight: 600; text-decoration: none; }
.figures-places th a { color: var(--ink); }
.group-form .field + .field, .group-form .field + .field-categories { margin-top: 1.25rem; }
.cat-head .link { justify-self: start; text-align: left; }
.cat-head .link.num { justify-self: end; }

/* Prospection : séquences, réception, échanges */
.code-block { margin: .4rem 0 1rem; padding: .6rem .8rem; background: var(--surface); border: 1px solid var(--line); font-family: var(--font-mono); font-size: .75rem; white-space: pre-wrap; overflow-wrap: anywhere;  border-radius: var(--r);}
.mail-body { margin: .5rem 0 0; padding: .75rem .9rem; background: var(--surface); border: 1px solid var(--line); font-family: var(--font-body); font-size: .875rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32rem; overflow-y: auto;  border-radius: var(--r);}
.seq-step { margin: 0 0 1.25rem; padding: 1rem 1.25rem; border: 1px solid var(--line); background: var(--surface);  border-radius: var(--r);}
.seq-step > legend { font-family: var(--font-title); font-weight: 600; padding: 0 .4rem; }
.seq-step .field + .field, .seq-step .row + .field { margin-top: .75rem; }
.seq-step .inline-options { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; }
.facts-vars { grid-template-columns: auto minmax(0, 1fr); font-size: .8125rem; }
.facts-vars code { font-size: .75rem; }
.seq-preview { margin: 2.5rem 0; }
.mail-preview { margin-bottom: 1.25rem; max-width: 46rem; }
.mail-preview .strong { margin: .2rem 0 0; }
.launch-section { margin: 2.5rem 0; padding-top: 1.5rem; border-top: 1px solid var(--line-strong); }
.stack-tight { display: grid; gap: .5rem; }
.slot-row { margin-left: 1.5rem; max-width: 22rem; }
.inline-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.inbox { display: grid; gap: .75rem; }
.inbox-item { padding: .9rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);  border-radius: var(--r);}
.inbox-item.is-handled { border-left-color: var(--line); }
.inbox-head p { margin: 0 0 .15rem; }
.inbox-item details { margin-top: .4rem; }
.inbox-item summary { cursor: pointer; color: var(--muted); }
.inbox-actions { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; margin-top: .6rem; }
.link-form { display: inline-flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.link-form input[type="text"] { min-height: 2rem; padding: .25rem .5rem; width: 16rem; max-width: 100%; }
.reply-form { margin-top: .75rem; }
.mail-thread { list-style: none; margin: 0 0 1rem; padding: 0; }
.mail-item { padding: .55rem 0 .55rem .9rem; border-left: 2px solid var(--line-strong); margin-bottom: .4rem; }
.mail-item.is-in { border-left-color: var(--accent); }
.mail-item p { margin: 0 0 .15rem; }
.mail-item summary { cursor: pointer; }
.enrollments p { margin: 0 0 .35rem; }
.rules { display: grid; gap: .5rem; }
.rule-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; padding: .6rem .75rem; background: var(--surface); border: 1px solid var(--line);  border-radius: var(--r);}
.rule-row select, .rule-row input[type="text"] { width: auto; max-width: 100%; min-height: 2.2rem; padding: .3rem .5rem; }
.rule-row input[type="text"] { width: 12rem; }
.rule-label { font-size: .8125rem; color: var(--muted); font-weight: 400; }
.rule-row [hidden] { display: none; }

/* Base de connaissance */
.page-head .actions { margin: 0; }
.form-add { margin-top: 1rem; }
.md { font-size: .875rem; overflow-wrap: anywhere; }
.md h2 { font-size: 1.1rem; margin-top: 1.4rem; }
.md h3, .md h4, .md h5 { font-size: .95rem; margin: 1.2rem 0 .4rem; font-family: var(--font-body); font-weight: 600; }
.md ul, .md ol { padding-left: 1.2rem; }
.md blockquote, .finding blockquote { margin: .4rem 0 .8rem; padding: .5rem .8rem; border-left: 3px solid var(--line-strong); background: var(--surface); color: var(--muted); }
.md .table-wrap { margin: .6rem 0 1rem; }
.finding { border-top: 1px solid var(--line); padding: 1.1rem 0 .9rem; max-width: 60rem; }
.finding-title { font-size: 1.05rem; margin: 0 0 .4rem; }
.finding-item p { margin: .2rem 0; }
.brand-big { font-weight: 700; font-size: 14px; color: var(--brand); margin-bottom: 14px; }

/* Connexion et sécurité du compte */
.or { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--light); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.passkey-login .btn { width: 100%; }
.totp-qr { width: 180px; height: 180px; margin: 6px 0 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); }
.totp-qr svg { display: block; width: 100%; height: 100%; }
.code-list { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; color: var(--ink); word-spacing: .6em; line-height: 1.9; }
.steps { padding-left: 1.2rem; margin: 0 0 8px; }
aside section + section { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 4px; }
.services-edit > summary { cursor: pointer; color: var(--brand); }
.services-edit[open] > summary { margin-bottom: 8px; }
.services-edit .stack-tight { min-width: 15rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); color: var(--ink); transition: box-shadow .15s, border-color .15s; }
.kpi-card:hover { border-color: var(--brand); box-shadow: var(--sh-md); text-decoration: none; color: var(--ink); }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.token-box { max-width: 60em; margin-bottom: 20px; }
.token { font-size: 13px; color: var(--ink); background: var(--bg); padding: 4px 8px; border-radius: 4px; overflow-wrap: anywhere; }
.facts code { overflow-wrap: anywhere; }

/* Conversations du support */
.thread { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.thread-msg { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); max-width: 52rem; }
.thread-msg.is-customer { border-left: 3px solid var(--brand); }
.thread-msg.is-bot { background: var(--brand-pale); border-color: transparent; }
.thread-msg.is-note { background: var(--warn-bg); border-color: transparent; }
.thread-msg.is-system { background: transparent; border-style: dashed; color: var(--muted); font-size: 12.5px; }
.thread-head { margin: 0 0 4px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.thread-body { overflow-wrap: anywhere; }
.thread-msg form { margin-top: 6px; }
.reply-box { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh); margin-bottom: 20px; }
.reply-box h2 { margin-top: 0; }
.reply-box h3 { margin-top: 18px; }
.nowrap { white-space: nowrap; }
