/* ==========================================================================
   NEXORA 360° — Design system SaaS (console NEXORA MG + portail client)
   Reprend À L'IDENTIQUE les variables et composants de l'interface client
   Angular (frontend/src/styles.css, app.component.css). Ne pas diverger :
   toute nouvelle couleur doit d'abord exister côté client.
   ========================================================================== */
:root {
  --font-sans: 'Inter Variable', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-display: 'Plus Jakarta Sans Variable', 'Inter Variable', 'Segoe UI Variable Display', system-ui, sans-serif;
  --fs-2xs: 11px; --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 26px; --fs-3xl: 32px;
  --ink-900: #231c18; --ink-800: #33291f; --ink-700: #4b3f37; --ink-600: #64574e; --ink-500: #7d7067; --ink-400: #a0948b; --ink-300: #c9bfb7;
  --line: #ebe5df; --line-strong: #ddd4cc;
  --canvas: #f6f4f1; --surface: #ffffff; --surface-2: #faf8f6; --surface-3: #f3efeb;
  --brand: #b85c3c; --brand-600: #9f4a2d; --brand-700: #833b22; --brand-50: #fcf4f0; --brand-100: #f7e4da; --brand-200: #ecc6b3;
  --success: #2c7a53; --success-bg: #e8f4ed; --danger: #b0372a; --danger-bg: #fcece9;
  --warning: #a8620f; --warning-bg: #fdf3e3; --info: #3b6a8f; --info-bg: #eaf1f7;
  --side-bg: #1d1815; --side-bg-2: #26201c; --side-ink: #d8cec7; --side-muted: #8f8279; --side-line: #ffffff14;
  --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px;
  --shadow-xs: 0 1px 2px #2a1d1408;
  --shadow-sm: 0 1px 2px #2a1d140a, 0 2px 8px #2a1d1406;
  --shadow-md: 0 4px 12px #2a1d140d, 0 12px 32px #2a1d140a;
  --shadow-lg: 0 24px 64px #1d151033, 0 4px 16px #1d15101a;
  --ring: 0 0 0 3px #b85c3c26;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: var(--font-sans); font-size: var(--fs-md); line-height: 1.5;
  color: var(--ink-900); background: var(--canvas); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { overflow-x: hidden; }
body.is-locked { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink-900); letter-spacing: -.012em; text-wrap: balance; }
button, input, select, textarea { font: inherit; letter-spacing: normal; color: inherit; }
button { cursor: pointer; transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--brand-600); text-underline-offset: 2px; }
[hidden] { display: none !important; }
:where(button, input, select, textarea, a, summary, [tabindex]):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Défilement discret, cohérent sur toute la console (aucune double barre). */
* { scrollbar-width: thin; scrollbar-color: var(--ink-300) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-300); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-400); }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; display: inline-block; vertical-align: middle; }
.spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ------------------------------------------------------------------ Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600; line-height: 1.2;
  white-space: nowrap; text-decoration: none; background: transparent; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-xs), inset 0 1px 0 #ffffff1f; }
.btn-primary:hover:not(:disabled) { background: var(--brand-600); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }
.btn-secondary { background: var(--surface); color: var(--ink-800); border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-300); }
.btn-ghost { color: var(--brand-600); padding-inline: 10px; }
.btn-ghost:hover:not(:disabled) { background: var(--brand-50); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #f2cbc4; }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: #962c21; }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: var(--fs-xs); }
.btn-lg { min-height: 46px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid #ffffff55; border-top-color: #fff; animation: spin .7s linear infinite; }
.btn-secondary .spinner, .btn-ghost .spinner { border-color: var(--line-strong); border-top-color: var(--brand); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink-600); box-shadow: var(--shadow-xs); }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink-900); border-color: var(--ink-300); }
.icon-btn-sm { width: 30px; height: 30px; box-shadow: none; border-color: transparent; background: transparent; }
.icon-btn-sm .icon { width: 16px; height: 16px; }
.icon-btn-sm:hover:not(:disabled) { border-color: var(--line); }

/* ----------------------------------------------------- Champs de formulaire */
:where(input:not([type=checkbox]):not([type=radio]), select, textarea) { width: 100%; color: var(--ink-900); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); min-height: 40px; padding: 8px 12px; font-size: var(--fs-md);
  transition: border-color .15s ease, box-shadow .15s ease; }
:where(input, select, textarea):hover:not(:disabled):not(:focus) { border-color: var(--ink-300); }
:where(input, select, textarea):focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
:where(input, select, textarea):disabled { background: var(--surface-3); color: var(--ink-500); }
:where(input, textarea)::placeholder { color: var(--ink-400); }
:where(input[aria-invalid=true]) { border-color: var(--danger); }
textarea { min-height: 84px; resize: vertical; }
:where(select) { appearance: none; padding-right: 34px; background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d7067' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
:where(input[type=checkbox], input[type=radio]) { accent-color: var(--brand); width: 16px; height: 16px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-700); }
.field small { color: var(--ink-400); font-size: var(--fs-2xs); line-height: 1.45; }
.field .req { color: var(--brand); }
.input-affix { position: relative; display: block; }
.input-affix input { padding-right: 46px; }
.affix-btn { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-500); }
.affix-btn:hover { background: var(--surface-3); color: var(--ink-900); }
.affix-btn .icon { width: 17px; height: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: var(--fs-sm); color: var(--ink-700); cursor: pointer; line-height: 1.45; }
.check input { margin-top: 2px; }
.check small { display: block; color: var(--ink-500); font-size: var(--fs-xs); }
.otp-input { font-variant-numeric: tabular-nums; letter-spacing: .4em; font-size: var(--fs-lg) !important; text-align: center; font-weight: 600; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line-strong);
  border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .15s, box-shadow .15s, background-color .15s; }
.choice:hover { border-color: var(--ink-300); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-50); box-shadow: var(--ring); }
.choice b { display: block; font-size: var(--fs-sm); }
.choice small { display: block; color: var(--ink-500); font-size: var(--fs-xs); margin-top: 2px; }
.choice input { margin-top: 3px; }

/* ----------------------------------------------------------------- Connexion */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.login-brand { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: 44px clamp(32px, 5vw, 72px); color: #f3ebe5;
  background: radial-gradient(900px 500px at 110% -10%, #b85c3c66, transparent 60%), radial-gradient(600px 400px at -10% 110%, #b85c3c33, transparent 60%), linear-gradient(160deg, #26201c, #171310); }
.login-brand::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); }
.login-brand > * { position: relative; z-index: 1; }
.login-brand-top { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; }
.login-brand-top b { color: #eaa98c; }
.login-brand-top .tagline { margin-left: 6px; padding: 3px 9px; border: 1px solid #ffffff22; border-radius: 999px; font-family: var(--font-sans);
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .08em; color: #d8c4b8; }
.logo { width: 38px; height: 38px; object-fit: contain; }
.login-brand-copy { max-width: 620px; }
.login-brand-copy h2 { color: #fff; font-size: clamp(30px, 3.4vw, 44px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 18px; }
.login-brand-copy p { color: #c9bab0; font-size: var(--fs-lg); line-height: 1.6; margin: 0 0 26px; max-width: 520px; }
.login-brand-copy ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; }
.login-brand-copy li { display: flex; align-items: flex-start; gap: 12px; color: #e7ddd6; font-size: var(--fs-md); }
.login-brand-copy li b { display: block; color: #fff; font-weight: 600; }
.login-brand-copy li small { display: block; margin-top: 2px; color: #b9aaa0; font-size: var(--fs-xs); line-height: 1.45; }
.login-brand-copy li .icon { flex: none; width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: #ffffff10; border: 1px solid #ffffff14; color: #eaa98c; }
.login-brand > small { color: #8f8279; font-size: var(--fs-xs); }
.login-main { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.login-panel { width: 100%; max-width: 390px; animation: fade-up .3s ease; }
.login-logo { display: none; width: 48px; height: 48px; object-fit: contain; margin-bottom: 18px; }
.login-panel h1 { font-size: var(--fs-3xl); line-height: 1.15; margin: 0 0 8px; letter-spacing: -.025em; }
.login-sub { margin: 0 0 28px; color: var(--ink-500); }
.login-panel form { display: grid; gap: 18px; }
.login-panel .field input { min-height: 46px; }
.login-panel .banner { margin: 18px 0 0; }
.device-note { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--r-md); background: var(--success-bg);
  color: var(--success); font-size: var(--fs-sm); }
.device-note .icon { width: 17px; height: 17px; }
.device-note button { margin-left: auto; border: 0; background: transparent; color: var(--success); font-weight: 600; font-size: var(--fs-xs); text-decoration: underline; padding: 2px; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 28px 0 0; color: var(--ink-400); font-size: var(--fs-xs); }
.login-foot .icon { width: 14px; height: 14px; }

/* --------------------------------------------------------------------- Coque */
.shell { display: flex; min-height: 100vh; background: var(--canvas); }
.sidebar { position: sticky; top: 0; z-index: 40; width: 264px; flex: 0 0 264px; height: 100vh; display: flex; flex-direction: column;
  padding: 16px 12px 12px; background: var(--side-bg); color: var(--side-ink); border-right: 1px solid #000; }
.sidebrand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 18px; border-bottom: 1px solid var(--side-line); }
.sidebrand .logo { width: 34px; height: 34px; }
.brand-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; }
.brand-copy strong { font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: .05em; color: #fff; }
.brand-copy strong span { color: #eaa98c; }
.brand-copy > span { font-size: var(--fs-2xs); color: var(--side-muted); letter-spacing: .06em; text-transform: uppercase; }
.sidebar nav { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; overflow-x: hidden; padding: 4px 2px 8px 0; scrollbar-color: #ffffff22 transparent; }
.side-label { padding: 18px 10px 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--side-muted); }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; width: 100%; min-height: 38px; padding: 8px 10px; border: 0;
  border-radius: var(--r-sm); background: transparent; color: var(--side-ink); font-size: var(--fs-sm); font-weight: 500; text-align: left; line-height: 1.3; }
.nav-item .icon { width: 18px; height: 18px; color: var(--side-muted); transition: color .15s ease; }
.nav-item:hover { background: #ffffff0d; color: #fff; }
.nav-item:hover .icon { color: #e9dfd8; }
.nav-item.selected { background: #ffffff12; color: #fff; }
.nav-item.selected .icon { color: #eaa98c; }
.nav-item.selected::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--brand); color: #fff; font-size: var(--fs-2xs); font-weight: 700; text-align: center; }
.nav-count.is-danger { background: var(--danger); }
.profile { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 12px 6px 4px; border-top: 1px solid var(--side-line); }
.profile-avatar { display: grid; place-items: center; width: 34px; height: 34px; min-width: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #c96d4c, #8f4529); color: #fff; font-family: var(--font-display); font-size: 12.5px; font-weight: 700; }
.profile-details { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 1px; }
.profile-details strong { font-size: var(--fs-sm); font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-details span { font-size: var(--fs-2xs); color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--side-muted); }
.logout-button:hover { color: #fff; background: #ffffff12; }
.logout-button .icon { width: 17px; height: 17px; }
.workspace { flex: 1; min-width: 0; max-width: 1480px; margin: 0 auto; padding: 24px clamp(18px, 3vw, 44px) 56px; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.topbar-page { flex: 1; min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; font-size: var(--fs-xs); color: var(--ink-400); }
.breadcrumb .icon { width: 13px; height: 13px; }
.breadcrumb span { color: var(--ink-600); font-weight: 500; }
.topbar h1 { margin: 0; font-size: var(--fs-2xl); line-height: 1.2; letter-spacing: -.02em; }
.topbar p { margin: 4px 0 0; color: var(--ink-500); font-size: var(--fs-sm); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.account-pill { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: var(--surface); font-size: var(--fs-xs); font-weight: 600; color: var(--ink-700); white-space: nowrap; }
.account-pill .icon { width: 15px; height: 15px; color: var(--brand); }
.account-pill.is-ok .icon { color: var(--success); }
.mobile-menu-button, .mobile-backdrop { display: none; }
.view { animation: fade-up .22s ease; }

/* ----------------------------------------------------------------- Surfaces */
.panel { min-width: 0; margin-bottom: 18px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.panel-head > div:first-child { min-width: 0; flex: 1 1 260px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: var(--fs-lg); font-weight: 650; line-height: 1.35; }
.panel-head p { margin: 4px 0 0; font-size: var(--fs-sm); color: var(--ink-500); line-height: 1.5; max-width: 72ch; }
.columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.columns > .panel { margin-bottom: 0; }
.stack { display: grid; gap: 18px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { position: relative; flex: 1 1 260px; max-width: 360px; }
.toolbar .search input { padding-left: 36px; }
.toolbar .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-400); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface-2); }
.segmented button { border: 0; background: transparent; padding: 6px 11px; border-radius: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-600); white-space: nowrap; }
.segmented button:hover { color: var(--ink-900); }
.segmented button.active { background: var(--surface); color: var(--ink-900); box-shadow: var(--shadow-xs); }
.segmented button span { margin-left: 5px; color: var(--ink-400); font-weight: 500; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--surface-3); color: var(--ink-600);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 6px; background: var(--surface-3); color: var(--ink-700);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.6; white-space: nowrap; }
.tag[data-tone=success] { background: var(--success-bg); color: var(--success); }
.tag[data-tone=warning] { background: var(--warning-bg); color: var(--warning); }
.tag[data-tone=danger] { background: var(--danger-bg); color: var(--danger); }
.tag[data-tone=info] { background: var(--info-bg); color: var(--info); }
.tag[data-tone=brand] { background: var(--brand-50); color: var(--brand-600); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag .icon { width: 13px; height: 13px; }

.banner { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 18px; padding: 11px 12px 11px 14px; border: 1px solid; border-radius: var(--r-md);
  font-size: var(--fs-sm); line-height: 1.45; animation: slide-in .2s ease; }
.banner > span { flex: 1; padding-top: 1px; }
.banner .icon { width: 17px; height: 17px; margin-top: 1px; }
.banner-success { background: var(--success-bg); border-color: #c9e4d4; color: var(--success); }
.banner-danger { background: var(--danger-bg); border-color: #f2cbc4; color: var(--danger); }
.banner-warning { background: var(--warning-bg); border-color: #f3dcb8; color: var(--warning); }
.banner-info { background: var(--info-bg); border-color: #cfdeea; color: var(--info); }
.note { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; color: var(--ink-500); font-size: var(--fs-xs); line-height: 1.55; }
.note .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--ink-400); }
.muted { color: var(--ink-500); }
.mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 12px; }

/* ----------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { position: relative; padding: 18px 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink-500); font-size: var(--fs-xs); font-weight: 600; }
.kpi-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--ink-600); }
.kpi-icon .icon { width: 16px; height: 16px; }
.kpi[data-tone=brand] .kpi-icon { background: var(--brand-50); color: var(--brand); }
.kpi[data-tone=success] .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi[data-tone=warning] .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.kpi[data-tone=danger] .kpi-icon { background: var(--danger-bg); color: var(--danger); }
.kpi-value { margin: 10px 0 2px; font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--ink-500); font-size: var(--fs-xs); }
.hero { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px;
  padding: 26px 30px; border-radius: var(--r-xl); color: #fff;
  background: radial-gradient(700px 300px at 100% 0%, #b85c3c88, transparent 60%), linear-gradient(135deg, #2a221d, #1a1512); }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(#ffffff07 1px, transparent 1px), linear-gradient(90deg, #ffffff07 1px, transparent 1px);
  background-size: 36px 36px; mask-image: radial-gradient(ellipse at 80% 20%, #000 10%, transparent 70%); }
.hero > * { position: relative; z-index: 1; }
.hero h2 { margin: 0 0 6px; color: #fff; font-size: var(--fs-xl); }
.hero p { margin: 0; color: #d6c8bf; font-size: var(--fs-sm); max-width: 62ch; }
.hero .btn-secondary { background: #ffffff12; color: #fff; border-color: #ffffff26; box-shadow: none; }
.hero .btn-secondary:hover:not(:disabled) { background: #ffffff1f; border-color: #ffffff40; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.checklist li:last-child { border-bottom: 0; }
.checklist li > span:not(.state-dot):not(.step-num) { flex: 1; min-width: 0; }
.checklist li small { display: block; color: var(--ink-500); font-size: var(--fs-xs); }
.state-dot { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--ink-500); }
.state-dot .icon { width: 14px; height: 14px; }
.state-dot[data-tone=success] { background: var(--success-bg); color: var(--success); }
.state-dot[data-tone=warning] { background: var(--warning-bg); color: var(--warning); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.timeline li:last-child { border-bottom: 0; }
.timeline b { font-weight: 600; }
.timeline small { display: block; color: var(--ink-500); font-size: var(--fs-xs); overflow-wrap: anywhere; }
.timeline time { color: var(--ink-400); font-size: var(--fs-xs); white-space: nowrap; }

/* ----------------------------------------------------------------- Tableaux */
.table-scroll { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.table-scroll table { width: 100%; border-collapse: collapse; white-space: nowrap; text-align: left; font-size: var(--fs-sm); }
.table-scroll th { position: sticky; top: 0; z-index: 1; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-500); }
.table-scroll td { padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--ink-700); vertical-align: middle; }
.table-scroll tbody tr:last-child td { border-bottom: 0; }
.table-scroll tbody tr:hover { background: var(--surface-2); }
.table-scroll b { color: var(--ink-900); font-weight: 600; }
.table-scroll td small { display: block; color: var(--ink-400); font-size: var(--fs-2xs); margin-top: 1px; }
.table-scroll .num { text-align: right; font-variant-numeric: tabular-nums; }
.company-cell { display: inline-flex; align-items: center; gap: 11px; }
.avatar-sm { display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-100);
  color: var(--brand-700); font-family: var(--font-display); font-weight: 700; font-size: 12px; }
.actions-col { text-align: right; width: 1%; }
.row-actions { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.empty-state { display: grid; justify-items: center; text-align: center; padding: 52px 24px; }
.empty-state h3 { margin: 16px 0 6px; font-size: var(--fs-lg); }
.empty-state p { margin: 0 0 18px; color: var(--ink-500); max-width: 440px; font-size: var(--fs-sm); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--surface-3); color: var(--ink-500); }
.empty-icon .icon { width: 22px; height: 22px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* -------------------------------------------------------- Menu contextuel */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: fixed; z-index: 80; min-width: 230px; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-md); animation: slide-in .14s ease; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent;
  font-size: var(--fs-sm); color: var(--ink-800); text-align: left; white-space: nowrap; }
.menu button:hover:not(:disabled) { background: var(--surface-3); }
.menu button .icon { width: 16px; height: 16px; color: var(--ink-500); }
.menu button.is-danger { color: var(--danger); }
.menu button.is-danger .icon { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }

/* ----------------------------------------------------------------- Étapes */
.steps { display: grid; gap: 0; }
.step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding: 22px 0; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; padding-top: 4px; }
.step-num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-100); color: var(--brand-700);
  font-family: var(--font-display); font-weight: 700; font-size: var(--fs-sm); }
.step h3 { margin: 4px 0 4px; font-size: var(--fs-md); font-weight: 650; }
.step > div > p { margin: 0 0 16px; color: var(--ink-500); font-size: var(--fs-sm); }
.form-footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.summary-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: var(--fs-sm); }
.summary-list li { display: flex; justify-content: space-between; gap: 14px; }
.summary-list li span { color: var(--ink-500); }
.summary-list li b { text-align: right; overflow-wrap: anywhere; }

/* ----------------------------------------------------------------- Modales */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: #1d1510a6;
  backdrop-filter: blur(3px); animation: fade-in .15s ease; }
@keyframes fade-in { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: modal-in .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 22px 0; }
.modal-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--brand-50); color: var(--brand); }
.modal-icon[data-tone=danger] { background: var(--danger-bg); color: var(--danger); }
.modal-icon[data-tone=success] { background: var(--success-bg); color: var(--success); }
.modal-head h2 { margin: 0; font-size: var(--fs-lg); }
.modal-head p { margin: 4px 0 0; color: var(--ink-500); font-size: var(--fs-sm); }
.modal-body { padding: 18px 22px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
.modal .banner { margin: 0; }

/* ----------------------------------------------------------------- Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: var(--r-md); background: var(--ink-900); color: #fff;
  box-shadow: var(--shadow-lg); font-size: var(--fs-sm); line-height: 1.45; animation: fade-up .2s ease; }
.toast .icon { width: 17px; height: 17px; margin-top: 1px; color: #8fd3ad; }
.toast.is-error .icon { color: #f5a597; }
.toast span { flex: 1; }
.toast button { border: 0; background: transparent; color: #ffffffa0; padding: 0 2px; }
.toast button:hover { color: #fff; }

/* ----------------------------------------------------------------- Boot */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 22px; background: var(--canvas); }
.boot .logo { width: 56px; height: 56px; }
.boot-bar { width: 120px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; background: var(--brand); border-radius: inherit; animation: boot 1.1s ease-in-out infinite; }
@keyframes boot { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }

/* ----------------------------------------------------------------- Responsive */
@media (max-width: 1180px) {
  .login-brand-copy ul { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-logo { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .shell.menu-open .sidebar { transform: none; }
  .mobile-menu-button { display: inline-grid; }
  .shell.menu-open .mobile-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: #1d151066; }
  .workspace { padding-top: 16px; }
}
@media (max-width: 720px) {
  .form-grid, .choice-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1; }
  .account-pill { display: none; }
  .hero { flex-direction: column; align-items: stretch; padding: 22px; }
  .hero .topbar-actions { flex-wrap: wrap; }
  .hero .topbar-actions .btn { flex: 1 1 180px; min-width: 0; }
  .step { grid-template-columns: 1fr; gap: 10px; }
  .panel { padding: 18px; }
  .toolbar .search { max-width: none; }
  .segmented { width: 100%; overflow-x: auto; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { max-width: none; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; }
  .modal-foot .btn { flex: 1; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 24px; }
}

/* Pastilles numérotées dans les listes (ne jamais s'étirer). */
.checklist .step-num { flex: none; width: 26px; height: 26px; font-size: var(--fs-xs); }
.domain-cell { display: block; min-width: 26ch; max-width: 38ch; white-space: normal; overflow-wrap: break-word; line-height: 1.4; }
.table-scroll td .tag { margin-top: 4px; }
