/* ==========================================================================
   Application interne — layout, composants, états
   ========================================================================== */

/* --- Base ----------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, p, figure, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
/* Taille par défaut des icônes : évite tout SVG dilaté si un contexte n'est pas stylé. */
svg { width: 15px; height: 15px; flex: 0 0 auto; }
.with-ico { display: inline-flex; align-items: center; gap: 6px; }

:focus-visible {
  outline: 2px solid var(--secondary-600);
  outline-offset: 2px;
}

.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.95em; letter-spacing: -0.01em; }
.nowrap { white-space: nowrap; }
.tar { text-align: right; }
.tac { text-align: center; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.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;
}

/* --- Trame applicative ---------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* --- Barre latérale ------------------------------------------------------- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-nav);
  border-right: 1px solid #000;
  z-index: 60;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--header-h);
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border-nav);
  flex: 0 0 auto;
}

.brand__mark {
  flex: 0 0 auto;
  display: grid; place-items: center;
}
.brand__mark svg { width: 16px; height: 16px; }

.brand__text { min-width: 0; }
.brand__name {
  font-size: var(--fs-13);
  font-weight: 650;
  color: #fff;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__sub {
  font-size: var(--fs-11);
  color: var(--text-nav);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-3);
}
.nav__label {
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6f7681;
  padding: 0 var(--sp-3);
  margin: var(--sp-5) 0 var(--sp-2);
}
.nav__label:first-child { margin-top: 0; }

.nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  font-weight: 500;
  color: var(--text-nav);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}
.nav__link + .nav__link { margin-top: 2px; }
.nav__link svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: 0.9; }
.nav__link:hover { background: var(--bg-nav-hover); color: #e6e9ed; }
.nav__link.is-active {
  background: var(--bg-nav-active);
  color: var(--text-nav-active);
  font-weight: 600;
}
.nav__link.is-active::before {
  content: "";
  position: absolute;
  left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 2px 2px 0;
  background: var(--secondary-600);
}
.nav__count {
  margin-left: auto;
  font-size: var(--fs-11);
  font-weight: 650;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--primary-500);
  color: #cfd4da;
  display: grid; place-items: center;
}
.nav__link.is-active .nav__count { background: var(--primary-700); color: #fff; }
.nav__count--accent { background: var(--primary-700); color: #fff; }

.sidebar__foot {
  flex: 0 0 auto;
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border-nav);
}
.demo-hint {
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: #22262c;
  border: 1px solid #2f343b;
}
.demo-hint__title {
  font-size: var(--fs-11);
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary-400);
  margin-bottom: var(--sp-1);
}
.demo-hint__body { font-size: var(--fs-12); color: #9aa1ab; line-height: 1.45; }
.demo-hint__body b { color: #d7dbe0; font-weight: 600; }

/* --- En-tête -------------------------------------------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; }

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-7);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header__burger {
  display: none;
  width: 34px; height: 34px;
  align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
}
.header__burger svg { width: 17px; height: 17px; }

.header__titles { min-width: 0; flex: 0 1 auto; overflow: hidden; }
.hide-sm { display: inline; }
.header__title {
  font-size: var(--fs-15);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header__sub {
  font-size: var(--fs-12);
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.header__spacer { flex: 1 1 auto; }
.header__actions { display: flex; align-items: center; gap: var(--sp-2); }

.icon-btn {
  position: relative;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--ink-500);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--ink-800); border-color: var(--border); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn__dot {
  position: absolute; top: 1px; right: 1px;
  min-width: 13px; height: 13px;
  padding: 0 3px;
  border-radius: var(--r-pill);
  background: var(--danger-600);
  color: #fff;
  font-size: 9px; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--white);
  box-sizing: content-box;
}

.header__divider { width: 1px; height: 24px; background: var(--border); margin: 0 var(--sp-1); }

.userchip {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 4px 10px 4px 4px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: none;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.userchip:hover { background: var(--bg-sunken); border-color: var(--border); }
.userchip__meta { text-align: left; line-height: 1.25; }
.userchip__name { display: block; font-size: var(--fs-13); font-weight: 600; }
.userchip__role { display: block; font-size: var(--fs-11); color: var(--text-muted); }
.userchip svg { width: 14px; height: 14px; color: var(--ink-400); }

.avatar {
  width: 30px; height: 30px;
  flex: 0 0 auto;
  border-radius: var(--r-pill);
  display: grid; place-items: center;
  font-size: var(--fs-12);
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--ink-600);
}
.avatar--sm { width: 24px; height: 24px; font-size: var(--fs-11); }
.avatar--lg { width: 44px; height: 44px; font-size: var(--fs-15); }
.avatar--u1 { background: #3c5a7d; }
.avatar--u2 { background: #6a4a7d; }
.avatar--u3 { background: #2f6b56; }
.avatar--u4 { background: #7d5a3c; }
.avatar--u5 { background: #4a5a6a; }
.avatar--u6 { background: #7d3c4a; }
.avatar--u7 { background: #3c6b7d; }
.avatar--u8 { background: #5a6b2f; }
.avatar--client { background: var(--ink-400); }

/* --- Menus déroulants ----------------------------------------------------- */
.pop {
  position: absolute;
  top: calc(var(--header-h) - 8px);
  right: var(--sp-7);
  width: 300px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  z-index: 70;
  overflow: hidden;
  animation: pop-in 120ms ease-out;
}
.pop--wide { width: 380px; }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.pop__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.pop__title { font-size: var(--fs-12); font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }
.pop__body { max-height: 340px; overflow-y: auto; }
.pop__foot { padding: var(--sp-2); border-top: 1px solid var(--border); background: var(--bg-subtle); }

.pop__item {
  width: 100%;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px var(--sp-4);
  background: none; border: 0;
  text-align: left;
  font-size: var(--fs-13);
  cursor: pointer;
  transition: background var(--transition);
}
.pop__item:hover { background: var(--bg-sunken); }
.pop__item svg { width: 15px; height: 15px; color: var(--ink-400); flex: 0 0 auto; }
.pop__item[disabled] { opacity: 0.45; cursor: not-allowed; }
.pop__item[disabled]:hover { background: transparent; }
.pop__item--danger { color: var(--danger-700); }
.pop__item--danger svg { color: var(--danger-600); }
.pop__sep { height: 1px; background: var(--border); margin: var(--sp-1) 0; }
.pop__section {
  font-size: var(--fs-11); font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  padding: var(--sp-3) var(--sp-4) var(--sp-1);
}
.pop__check { margin-left: auto; color: var(--secondary-600) !important; }

.notif {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--ink-50);
  cursor: pointer;
  transition: background var(--transition);
}
.notif:hover { background: var(--bg-subtle); }
.notif.is-unread { background: var(--secondary-50); }
.notif.is-unread:hover { background: #fbf1e0; }
.notif__icon {
  width: 26px; height: 26px; flex: 0 0 auto;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--bg-sunken);
  color: var(--ink-600);
}
.notif__icon svg { width: 14px; height: 14px; }
.notif__body { min-width: 0; }
.notif__title { font-size: var(--fs-13); font-weight: 600; line-height: 1.3; }
.notif__text { font-size: var(--fs-12); color: var(--text-secondary); line-height: 1.4; }
.notif__time { font-size: var(--fs-11); color: var(--text-muted); margin-top: 2px; }

/* --- Zone de page --------------------------------------------------------- */
.page {
  flex: 1 1 auto;
  padding: var(--sp-7);
  max-width: 1480px;
  width: 100%;
  animation: page-in 180ms ease-out;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.page__head {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.page__head-text { min-width: 0; flex: 1 1 320px; }
.page__title {
  font-size: var(--fs-24);
  font-weight: 680;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page__desc { font-size: var(--fs-13); color: var(--text-secondary); margin-top: var(--sp-1); max-width: 62ch; }
.page__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.section { margin-top: var(--sp-7); }
.section__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-3);
}
.section__title { font-size: var(--fs-15); font-weight: 650; letter-spacing: -0.01em; }
.section__link {
  font-size: var(--fs-13); font-weight: 550; color: var(--primary-700);
  cursor: pointer; border: 0; background: none; padding: 0;
}
.section__link:hover { text-decoration: underline; }

.grid { display: grid; gap: var(--sp-5); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--split { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.grid--detail { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }

/* --- Cartes --------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: var(--fs-14); font-weight: 650; }
.card__sub { font-size: var(--fs-12); color: var(--text-muted); }
.card__body { padding: var(--sp-5); }
.card__body--flush { padding: 0; }
.card__foot {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-size: var(--fs-12);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}

/* --- Tuiles statistiques -------------------------------------------------- */
.stat {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--sh-xs);
  position: relative;
  overflow: hidden;
}
.stat__top { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.stat__icon {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--bg-sunken);
  color: var(--ink-600);
}
.stat__icon svg { width: 14px; height: 14px; }
.stat__icon--amber { background: var(--secondary-50); color: var(--secondary-700); }
.stat__icon--info { background: var(--info-50); color: var(--info-700); }
.stat__icon--success { background: var(--success-50); color: var(--success-700); }
.stat__label {
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.stat__value {
  font-size: var(--fs-28);
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat__foot {
  margin-top: var(--sp-2);
  font-size: var(--fs-12);
  color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.trend { font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.trend--up { color: var(--success-600); }
.trend--down { color: var(--danger-600); }
.trend svg { width: 12px; height: 12px; }

/* --- Boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--white);
  color: var(--ink-800);
  font-size: var(--fs-13);
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition);
}
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.btn:hover { background: var(--bg-sunken); border-color: var(--ink-300); }
.btn:active { background: var(--ink-100); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}

.btn--primary {
  background: var(--secondary-600);
  border-color: var(--secondary-700);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn--primary:hover { background: var(--secondary-700); border-color: #cc2223; }
.btn--primary:active { background: #cc2223; }

.btn--dark {
  background: var(--ink-800);
  border-color: var(--ink-900);
  color: #fff;
}
.btn--dark:hover { background: var(--ink-700); }

.btn--danger { color: var(--danger-700); border-color: #e4c4c1; background: var(--white); }
.btn--danger:hover { background: var(--danger-50); border-color: #d9aaa6; }

.btn--ghost { border-color: transparent; background: none; color: var(--ink-600); }
.btn--ghost:hover { background: var(--bg-sunken); border-color: var(--border); color: var(--ink-800); }

.btn--sm { height: 28px; padding: 0 10px; font-size: var(--fs-12); }
.btn--sm svg { width: 13px; height: 13px; }
.btn--lg { height: 40px; padding: 0 18px; font-size: var(--fs-14); }
.btn--block { width: 100%; }
.btn--icon { width: 34px; padding: 0; }
.btn--sm.btn--icon { width: 28px; }

.btn.is-loading { pointer-events: none; position: relative; color: transparent !important; }
.btn.is-loading::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: #fff;
  animation: spin 600ms linear infinite;
}
.btn:not(.btn--primary):not(.btn--dark).is-loading::after { color: var(--ink-600); }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Badges de statut ----------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 21px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.badge--neutral { background: var(--ink-50); color: var(--ink-600); border-color: var(--ink-150); }
.badge--info { background: var(--info-50); color: var(--info-700); border-color: #cfe0ee; }
.badge--amber { background: var(--secondary-50); color: var(--secondary-700); border-color: var(--secondary-100); }
.badge--violet { background: var(--violet-50); color: var(--violet-700); border-color: #ddd6ef; }
.badge--success { background: var(--success-50); color: var(--success-700); border-color: #cfe3d7; }
.badge--danger { background: var(--danger-50); color: var(--danger-700); border-color: #f0cfcc; }
.badge--nodot::before { display: none; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap; flex: 0 0 auto;
  height: 22px; padding: 0 8px;
  border-radius: var(--r-sm);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  font-size: var(--fs-11);
  font-weight: 550;
  color: var(--text-secondary);
}
.tag svg { width: 12px; height: 12px; }
.tag--danger {
  background: var(--danger-50);
  border-color: #f0cfcc;
  color: var(--danger-700);
}
.tag--danger svg { color: var(--danger-600); }

/* --- Droits d'accès ------------------------------------------------------- */
.perm-preview {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  overflow: hidden;
}
.perm-preview__head {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: var(--fs-12);
  line-height: var(--lh-snug);
  color: var(--text-secondary);
}
.perm-preview__head svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--secondary-600); }
.perm-preview__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 2px 16px;
  padding: 12px 14px;
}
.perm {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
  font-size: var(--fs-12);
  color: var(--text-muted);
}
.perm.is-on { color: var(--text-primary); font-weight: 500; }
.perm__mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; flex: 0 0 auto;
  border-radius: var(--r-pill);
  background: var(--ink-100);
  color: var(--ink-400);
}
.perm__mark svg { width: 11px; height: 11px; stroke-width: 2.4; }
.perm.is-on .perm__mark { background: var(--success-50); color: var(--success-600); }

/* Matrice rôles × permissions */
table.matrix th.tac,
table.matrix td.tac { width: 108px; }
table.matrix th.is-current,
table.matrix td.is-current { background: var(--primary-50); }
.matrix__group td {
  background: var(--bg-sunken);
  font-size: var(--fs-11);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 8px; padding-bottom: 8px;
}
.matrix__mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: var(--r-pill);
  background: var(--ink-50);
  color: var(--ink-300);
}
.matrix__mark svg { width: 12px; height: 12px; stroke-width: 2.2; }
.matrix__mark.is-on { background: var(--success-50); color: var(--success-600); }

.integration.is-clickable { cursor: pointer; }
.integration.is-clickable:hover { background: var(--bg-subtle); }

/* --- Catalogue de produits ------------------------------------------------ */

/* Interrupteur « proposé au client » des lignes du catalogue. */
.switch {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--text-muted);
}
.switch__track {
  position: relative;
  width: 32px; height: 18px; flex: 0 0 auto;
  border-radius: var(--r-pill);
  background: var(--ink-200);
  transition: background var(--transition);
}
.switch__knob {
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: var(--r-pill);
  background: var(--white);
  box-shadow: var(--sh-xs);
  transition: transform var(--transition);
}
.switch__text { font-size: var(--fs-12); font-weight: 550; white-space: nowrap; }
.switch.is-on { color: var(--success-700); }
.switch.is-on .switch__track { background: var(--success-600); }
.switch.is-on .switch__knob { transform: translateX(14px); }
.switch:hover .switch__track { background: var(--ink-300); }
.switch.is-on:hover .switch__track { background: var(--success-700); }
.switch:focus-visible { outline: 0; }
.switch:focus-visible .switch__track { box-shadow: var(--ring); }

.table tbody tr.is-muted td { opacity: 0.62; }

/* Aperçu du bon de commande client, regroupé par catégorie. */
.catgroup { border-bottom: 1px solid var(--border); }
.catgroup:last-child { border-bottom: 0; }
.catgroup__head {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px var(--sp-5);
  background: var(--bg-sunken);
  font-size: var(--fs-11);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.catgroup__head .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.catgroup__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.catgroup__item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px var(--sp-5);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-13);
}
.catgroup__items .catgroup__item:last-child { border-bottom: 0; }
.catgroup__name { min-width: 0; }
.catgroup__price { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.catgroup__price small { color: var(--text-muted); font-weight: 400; }

/* --- Tableaux ------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-13);
}
.table th {
  text-align: left;
  font-size: var(--fs-11);
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px var(--sp-4);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0;
}
.table th:first-child, .table td:first-child { padding-left: var(--sp-5); }
.table th:last-child, .table td:last-child { padding-right: var(--sp-5); }
.table td {
  padding: 11px var(--sp-4);
  border-bottom: 1px solid var(--ink-50);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover { background: var(--bg-subtle); }
.table tbody tr.is-new { animation: row-in 900ms ease-out; }
@keyframes row-in {
  0% { background: var(--secondary-50); }
  100% { background: transparent; }
}
.table .cell-id { font-weight: 600; color: var(--ink-900); }
.table .cell-amount {
  font-weight: 600; font-variant-numeric: tabular-nums;
  text-align: right; white-space: nowrap;
}
.table .cell-actions { text-align: right; white-space: nowrap; }
.table--compact td { padding: 8px var(--sp-4); }

.cell-party { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.cell-party__name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-party__sub { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Barre de filtres ----------------------------------------------------- */
.filters {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filters__spacer { flex: 1 1 auto; }
.filters select { width: auto; min-width: 150px; flex: 0 0 auto; }
.filters .btn { flex: 0 0 auto; }
.filters__count { font-size: var(--fs-12); color: var(--text-muted); white-space: nowrap; }

.search {
  position: relative;
  flex: 1 1 240px;
  max-width: 340px;
  min-width: 180px;
}
.search svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--ink-400); pointer-events: none;
}
.search input { padding-left: 32px; }

/* --- Formulaires ---------------------------------------------------------- */
.field { display: block; }
.field + .field { margin-top: var(--sp-4); }
.field__label {
  display: block;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
}
.field__hint { font-size: var(--fs-12); color: var(--text-muted); margin-top: 5px; }
.field__error { font-size: var(--fs-12); color: var(--danger-700); margin-top: 5px; font-weight: 550; display: none; }
.field.has-error .field__error { display: block; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger-600); }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="tel"], select, textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  font-family: inherit;
  font-size: var(--fs-13);
  color: var(--text-primary);
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
textarea { height: auto; padding: 9px 10px; line-height: 1.55; resize: vertical; min-height: 90px; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-300); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-600);
  box-shadow: var(--ring);
}
input::placeholder, textarea::placeholder { color: var(--ink-400); }
input:disabled, select:disabled, textarea:disabled {
  background: var(--bg-sunken); color: var(--text-muted); cursor: not-allowed;
}

select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235c636d' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6.5 8 10.5l4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 15px;
  cursor: pointer;
}
select.select--sm, input.input--sm { height: 30px; font-size: var(--fs-12); }

.form-row { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-row + .field, .field + .form-row, .form-row + .form-row { margin-top: var(--sp-4); }

/* --- Listes descriptives -------------------------------------------------- */
.dl { display: grid; gap: var(--sp-3); }
.dl__row { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: var(--sp-3); align-items: baseline; }
.dl__k { font-size: var(--fs-12); color: var(--text-muted); font-weight: 550; }
.dl__v { font-size: var(--fs-13); font-weight: 500; word-break: break-word; }
.dl--stack .dl__row { grid-template-columns: 1fr; gap: 2px; }

/* --- Totaux --------------------------------------------------------------- */
.totals { display: grid; gap: 9px; margin-left: auto; max-width: 320px; }
.totals__row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-6);
  font-size: var(--fs-13);
}
.totals__row span:first-child { color: var(--text-secondary); }
.totals__row span:last-child {
  font-variant-numeric: tabular-nums; font-weight: 550; white-space: nowrap;
}
.totals__row--grand {
  padding-top: 10px;
  margin-top: 2px;
  border-top: 1px solid var(--border-strong);
  font-size: var(--fs-16);
  font-weight: 680;
}
.totals__row--grand span:first-child { color: var(--text-primary); font-weight: 650; }
.totals__row--grand span:last-child { font-weight: 680; letter-spacing: -0.01em; }

/* --- Document facture ----------------------------------------------------- */
.doc { background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-sm); overflow: hidden; }
.doc__head {
  display: flex; justify-content: space-between; gap: var(--sp-6);
  padding: var(--sp-6) var(--sp-7);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-subtle), var(--white));
  flex-wrap: wrap;
}
.doc__brand { display: flex; gap: var(--sp-3); align-items: flex-start; }
.doc__brand-mark {
  display: grid; place-items: center;
}
.doc__brand-mark svg { width: 18px; height: 18px; }
.doc__company { font-size: var(--fs-15); font-weight: 680; letter-spacing: -0.01em; }
.doc__company-meta { font-size: var(--fs-12); color: var(--text-secondary); line-height: 1.5; margin-top: 2px; }
.doc__meta { text-align: right; }
.doc__kind { font-size: var(--fs-11); font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.doc__no { font-size: var(--fs-20); font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.doc__body { padding: var(--sp-6) var(--sp-7); }
.doc__parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--sp-6); margin-bottom: var(--sp-6); }
.doc__party-label {
  font-size: var(--fs-11); font-weight: 650; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.doc__party-name { font-size: var(--fs-14); font-weight: 650; }
.doc__party-meta { font-size: var(--fs-12); color: var(--text-secondary); line-height: 1.55; }
.doc__table-wrap { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-bottom: var(--sp-5); }
.doc__foot {
  padding: var(--sp-4) var(--sp-7);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: var(--fs-12);
  color: var(--text-secondary);
  display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap;
}

/* --- Bandeaux ------------------------------------------------------------- */
.banner {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: var(--fs-13);
}
.banner__icon { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; }
.banner__icon svg { width: 18px; height: 18px; }
.banner__title { font-weight: 650; margin-bottom: 2px; }
.banner__text { color: var(--text-secondary); line-height: 1.5; }
.banner__actions { margin-top: var(--sp-3); display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.banner--info { background: var(--info-50); border-color: #cfe0ee; }
.banner--info .banner__icon { color: var(--info-600); }
.banner--amber { background: var(--secondary-50); border-color: var(--secondary-100); }
.banner--amber .banner__icon { color: var(--secondary-700); }
.banner--success { background: var(--success-50); border-color: #cfe3d7; }
.banner--success .banner__icon { color: var(--success-600); }
.banner--danger { background: var(--danger-50); border-color: #f0cfcc; }
.banner--danger .banner__icon { color: var(--danger-600); }

/* --- États vides ---------------------------------------------------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--sp-10) var(--sp-6);
}
.empty__icon {
  width: 46px; height: 46px;
  border-radius: var(--r-lg);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--ink-400);
  margin-bottom: var(--sp-4);
}
.empty__icon svg { width: 21px; height: 21px; }
.empty__title { font-size: var(--fs-15); font-weight: 650; }
.empty__text { font-size: var(--fs-13); color: var(--text-secondary); margin-top: 5px; max-width: 44ch; line-height: 1.55; }
.empty__actions { margin-top: var(--sp-5); display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: center; }

/* --- Modales -------------------------------------------------------------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15, 17, 20, 0.44);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--sp-8) var(--sp-4);
  overflow-y: auto;
  animation: fade-in 120ms ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 520px;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  animation: modal-in 160ms cubic-bezier(0.2, 0.8, 0.3, 1);
  overflow: hidden;
  margin: auto 0;
}
.modal--sm { max-width: 420px; }
.modal--lg { max-width: 720px; }
.modal--xl { max-width: 900px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.modal__head {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.modal__head-text { flex: 1 1 auto; min-width: 0; }
.modal__title { font-size: var(--fs-16); font-weight: 680; letter-spacing: -0.01em; }
.modal__desc { font-size: var(--fs-13); color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
.modal__close {
  width: 28px; height: 28px; flex: 0 0 auto;
  display: grid; place-items: center;
  border: 0; background: none; border-radius: var(--r-sm);
  color: var(--ink-400); cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.modal__close:hover { background: var(--bg-sunken); color: var(--ink-800); }
.modal__close svg { width: 16px; height: 16px; }
.modal__body { padding: var(--sp-5); }
.modal__body--flush { padding: 0; }
.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  flex-wrap: wrap;
}
.modal__foot-left { margin-right: auto; font-size: var(--fs-12); color: var(--text-muted); }
.modal__icon {
  width: 34px; height: 34px; flex: 0 0 auto;
  border-radius: var(--r-md);
  display: grid; place-items: center;
}
.modal__icon svg { width: 18px; height: 18px; }
.modal__icon--amber { background: var(--secondary-50); color: var(--secondary-700); }
.modal__icon--danger { background: var(--danger-50); color: var(--danger-600); }
.modal__icon--info { background: var(--info-50); color: var(--info-600); }
.modal__icon--success { background: var(--success-50); color: var(--success-600); }

/* --- Panneau de progression simulée -------------------------------------- */
.process { display: grid; gap: 2px; }
.process__step {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px 0;
  font-size: var(--fs-13);
  color: var(--text-muted);
  transition: color var(--transition);
}
.process__step + .process__step { border-top: 1px solid var(--ink-50); }
.process__dot {
  width: 18px; height: 18px; flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  background: var(--white);
}
.process__dot svg { width: 11px; height: 11px; opacity: 0; transition: opacity var(--transition); }
.process__step.is-running { color: var(--text-primary); font-weight: 550; }
.process__step.is-running .process__dot {
  border-color: var(--primary-600);
  border-top-color: transparent;
  animation: spin 620ms linear infinite;
}
.process__step.is-done { color: var(--text-secondary); }
.process__step.is-done .process__dot {
  background: var(--success-600);
  border-color: var(--success-600);
  color: #fff;
}
.process__step.is-done .process__dot svg { opacity: 1; }
.process__step.is-error .process__dot { background: var(--danger-600); border-color: var(--danger-600); color: #fff; }
.process__step.is-error { color: var(--danger-700); font-weight: 550; }
.process__step.is-error .process__dot svg { opacity: 1; }
.process__meta { margin-left: auto; font-size: var(--fs-11); color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* --- Notifications toast -------------------------------------------------- */
.toasts {
  position: fixed;
  right: var(--sp-6); bottom: var(--sp-6);
  z-index: 200;
  display: flex; flex-direction: column; gap: var(--sp-2);
  width: 340px; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink-900);
  color: #f2f4f6;
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  animation: toast-in 200ms cubic-bezier(0.2, 0.9, 0.3, 1);
  border-left: 3px solid var(--ink-500);
}
.toast.is-leaving { animation: toast-out 160ms ease-in forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}
.toast__icon { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; }
.toast__icon svg { width: 17px; height: 17px; }
.toast__body { flex: 1 1 auto; min-width: 0; }
.toast__title { font-size: var(--fs-13); font-weight: 600; line-height: 1.35; }
.toast__text { font-size: var(--fs-12); color: #aeb4bd; line-height: 1.4; margin-top: 1px; }
.toast__close {
  flex: 0 0 auto; width: 20px; height: 20px;
  border: 0; background: none; color: #7d848e;
  cursor: pointer; display: grid; place-items: center; border-radius: var(--r-xs);
}
.toast__close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.toast__close svg { width: 13px; height: 13px; }
.toast--success { border-left-color: #4ea87a; }
.toast--success .toast__icon { color: #4ea87a; }
.toast--danger { border-left-color: #d9615a; }
.toast--danger .toast__icon { color: #d9615a; }
.toast--info { border-left-color: #5c9bd1; }
.toast--info .toast__icon { color: #5c9bd1; }
.toast--neutral .toast__icon { color: #9aa1ab; }

/* --- Assistant IA --------------------------------------------------------- */
.assistant {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--sp-5);
  align-items: start;
}
.chat {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--header-h) - var(--sp-7) * 2 - 92px);
  min-height: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  overflow: hidden;
}
.chat__head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.chat__avatar {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--ink-800); color: var(--secondary-600);
  display: grid; place-items: center;
}
.chat__avatar svg { width: 16px; height: 16px; }
.chat__id { flex: 1 1 auto; min-width: 0; }
.chat__name { font-size: var(--fs-13); font-weight: 650; }
.chat__status { font-size: var(--fs-11); color: var(--success-600); display: flex; align-items: center; gap: 5px; }
.chat__status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success-600); }

.chat__log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-5);
  scroll-behavior: smooth;
}
.msg { display: flex; gap: var(--sp-3); max-width: 100%; animation: msg-in 200ms ease-out; }
.msg--user { flex-direction: row-reverse; }
.msg--user .msg__col { display: flex; flex-direction: column; align-items: flex-end; }
.msg--user .msg__who, .msg--user .msg__time { text-align: right; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.msg__avatar {
  width: 26px; height: 26px; flex: 0 0 auto;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  font-size: var(--fs-11); font-weight: 650; color: #fff;
}
.msg__avatar--ai { background: var(--ink-800); color: var(--secondary-600); }
.msg__avatar--ai svg { width: 14px; height: 14px; }
.msg__col { min-width: 0; flex: 1 1 auto; }
.msg__who { font-size: var(--fs-11); font-weight: 650; color: var(--text-muted); margin-bottom: 4px; letter-spacing: 0.02em; }
.msg__bubble {
  display: inline-block;
  max-width: min(560px, 100%);
  padding: 10px var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-13);
  line-height: 1.55;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}
.msg--user .msg__bubble { background: var(--ink-800); border-color: var(--ink-900); color: #eef0f3; }
.msg__bubble p + p { margin-top: 9px; }
.msg__bubble b { font-weight: 650; }
.msg__time { font-size: var(--fs-11); color: var(--text-muted); margin-top: 5px; }

.result-card {
  margin-top: var(--sp-3);
  max-width: 460px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--white);
  box-shadow: var(--sh-xs);
  overflow: hidden;
}
.result-card__head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 9px var(--sp-4);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-11); font-weight: 650;
  letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-secondary);
}
.result-card__head svg { width: 13px; height: 13px; color: var(--ink-400); }
.result-card__body { padding: var(--sp-4); }
.result-card__foot {
  display: flex; gap: var(--sp-2); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}
.result-card__foot.is-resolved { opacity: 0.55; pointer-events: none; }

.mini-table { width: 100%; border-collapse: collapse; font-size: var(--fs-12); }
.mini-table th {
  text-align: left; font-weight: 600; color: var(--text-muted);
  padding: 0 var(--sp-3) 5px 0; font-size: var(--fs-11);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.mini-table td { padding: 4px var(--sp-3) 4px 0; border-top: 1px solid var(--ink-50); }
.mini-table td:last-child, .mini-table th:last-child { padding-right: 0; text-align: right; font-variant-numeric: tabular-nums; }

.typing { display: inline-flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ink-300);
  animation: typing 1.1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.16s; }
.typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat__composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  background: var(--white);
}
.composer {
  display: flex; align-items: flex-end; gap: var(--sp-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 6px 6px 6px var(--sp-3);
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--white);
}
.composer:focus-within { border-color: var(--secondary-600); box-shadow: var(--ring); }
.composer textarea {
  flex: 1 1 auto; border: 0; padding: 6px 0; min-height: 22px; max-height: 120px;
  resize: none; font-size: var(--fs-13); line-height: 1.5; background: none;
}
.composer textarea:focus { outline: none; box-shadow: none; border: 0; }
.composer__tools { display: flex; gap: 4px; flex: 0 0 auto; }
.composer__hint {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 7px; font-size: var(--fs-11); color: var(--text-muted); gap: var(--sp-3);
}
kbd {
  font-family: var(--font-sans); font-size: var(--fs-11); font-weight: 550;
  padding: 1px 5px; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: var(--r-xs);
  background: var(--bg-subtle); color: var(--text-secondary);
}

.mic-btn.is-listening {
  background: var(--danger-50) !important;
  border-color: #eab8b4 !important;
  color: var(--danger-600) !important;
  animation: mic-pulse 1.3s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(177, 54, 46, 0.28); }
  50% { box-shadow: 0 0 0 6px rgba(177, 54, 46, 0); }
}

.suggestions { display: grid; gap: var(--sp-2); }
.suggestion {
  width: 100%; text-align: left;
  padding: 10px var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--white);
  font-size: var(--fs-12);
  line-height: 1.45;
  color: var(--ink-700);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  display: flex; gap: var(--sp-2); align-items: flex-start;
}
.suggestion svg { width: 13px; height: 13px; flex: 0 0 auto; margin-top: 2px; color: var(--secondary-600); }
.suggestion:hover { border-color: var(--secondary-400); background: var(--secondary-50); }

.voice-viz { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 42px; margin: var(--sp-4) 0; }
.voice-viz span {
  width: 4px; border-radius: 2px; background: var(--primary-500);
  animation: viz 900ms ease-in-out infinite;
}
.voice-viz span:nth-child(1) { height: 30%; animation-delay: 0ms; }
.voice-viz span:nth-child(2) { height: 62%; animation-delay: 90ms; }
.voice-viz span:nth-child(3) { height: 90%; animation-delay: 180ms; }
.voice-viz span:nth-child(4) { height: 50%; animation-delay: 270ms; }
.voice-viz span:nth-child(5) { height: 78%; animation-delay: 360ms; }
.voice-viz span:nth-child(6) { height: 40%; animation-delay: 450ms; }
.voice-viz span:nth-child(7) { height: 66%; animation-delay: 540ms; }
@keyframes viz {
  0%, 100% { transform: scaleY(0.35); opacity: 0.65; }
  50% { transform: scaleY(1); opacity: 1; }
}

/* --- Fil d'activité ------------------------------------------------------- */
.feed { display: grid; }
.feed__item {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--ink-50);
}
.feed__item:last-child { border-bottom: 0; }
.feed__icon {
  width: 26px; height: 26px; flex: 0 0 auto;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--ink-600);
}
.feed__icon svg { width: 13px; height: 13px; }
.feed__body { min-width: 0; flex: 1 1 auto; }
.feed__text { font-size: var(--fs-13); line-height: 1.45; }
.feed__text b { font-weight: 600; }
.feed__link { color: var(--secondary-700); font-weight: 600; cursor: pointer; }
.feed__link:hover { text-decoration: underline; }
.feed__time { font-size: var(--fs-11); color: var(--text-muted); margin-top: 1px; }

/* --- Étapes / progression parcours --------------------------------------- */
.steps { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.step-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--white);
  font-size: var(--fs-11); font-weight: 600; color: var(--text-muted);
}
.step-chip__n {
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--ink-100); color: var(--ink-500);
  display: grid; place-items: center; font-size: 9px;
}
.step-chip.is-done { color: var(--success-700); border-color: #cfe3d7; background: var(--success-50); }
.step-chip.is-done .step-chip__n { background: var(--success-600); color: #fff; }
.step-chip.is-current { color: var(--secondary-700); border-color: var(--secondary-400); background: var(--secondary-50); }
.step-chip.is-current .step-chip__n { background: var(--secondary-600); color: #fff; }
.steps__arrow { color: var(--ink-300); }
.steps__arrow svg { width: 13px; height: 13px; }

/* --- Divers --------------------------------------------------------------- */
.copyfield {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
}
.copyfield__url {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  color: var(--ink-800);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.integration {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
}
.integration:last-child { border-bottom: 0; }
.integration__logo {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  display: grid; place-items: center;
  font-weight: 700; font-size: var(--fs-13);
  color: var(--ink-600);
}
.integration__body { flex: 1 1 auto; min-width: 0; }
.integration__name { font-size: var(--fs-14); font-weight: 650; }
.integration__desc { font-size: var(--fs-12); color: var(--text-secondary); line-height: 1.45; }

.divider { height: 1px; background: var(--border); margin: var(--sp-5) 0; border: 0; }

.progress-bar { height: 4px; background: var(--ink-100); border-radius: var(--r-pill); overflow: hidden; }
.progress-bar__fill { height: 100%; background: var(--secondary-600); border-radius: var(--r-pill); transition: width 320ms ease-out; }

.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(15,17,20,0.4); display: none; }
.scrim.is-visible { display: block; }

/* --- Réactivité ----------------------------------------------------------- */
@media (max-width: 1180px) {
  .grid--split, .grid--detail { grid-template-columns: minmax(0, 1fr); }
  .assistant { grid-template-columns: minmax(0, 1fr); }
  .chat { height: auto; min-height: 560px; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 264px;
    transform: translateX(-100%);
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--sh-lg);
  }
  .sidebar.is-open { transform: none; }
  .header { padding: 0 var(--sp-4); gap: var(--sp-2); }
  .header__burger { display: inline-flex; }
  .hide-sm { display: none; }
  .header__actions .btn { width: 34px; padding: 0; }
  .header__actions .btn svg { margin: 0; }
  .header__sub { display: none; }
  .header__divider { display: none; }
  .page { padding: var(--sp-5) var(--sp-4); }
  .pop { right: var(--sp-4); left: var(--sp-4); width: auto; }
  .userchip__meta { display: none; }
  .doc__head, .doc__body, .doc__foot { padding-left: var(--sp-5); padding-right: var(--sp-5); }
  .toasts { right: var(--sp-4); left: var(--sp-4); bottom: var(--sp-4); width: auto; }
}

@media (max-width: 620px) {
  .page__title { font-size: var(--fs-20); }
  .stat__value { font-size: var(--fs-24); }
  .filters { padding: var(--sp-3) var(--sp-4); }
  .search { max-width: none; flex: 1 1 100%; }
  .table th:first-child, .table td:first-child { padding-left: var(--sp-4); }
  .table th:last-child, .table td:last-child { padding-right: var(--sp-4); }
  .card__body, .card__head { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .overlay { padding: var(--sp-4) var(--sp-3); }
  .modal__foot { flex-direction: column-reverse; align-items: stretch; }
  .modal__foot .btn { width: 100%; }
  .modal__foot-left { margin: 0 0 var(--sp-2); text-align: center; }
  .dl__row { grid-template-columns: 1fr; gap: 1px; }
}

@media print {
  .sidebar, .header, .toasts, .page__actions, .card__foot { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; }
  .doc { border: 0; box-shadow: none; }
}
