/* ==========================================================================
   Sanelio V9 — design system
   Palette issue du logo : pétrole profond, bleu lagon, vert feuille, ciel.
   Sections : 1 jetons · 2 base · 3 structure · 4 composants · 5 modules
              6 documents imprimables · 7 pages publiques · 8 responsive
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* 1. Jetons ---------------------------------------------------------------- */
:root {
  --brand-950: #06263a;
  --brand-900: #0a3450;
  --brand-800: #0c4566;
  --brand-700: #0e5b80;
  --brand-600: #10749f;
  --brand-500: #1690b8;
  --brand-400: #45aed0;
  --brand-200: #b6e1f2;
  --brand-100: #dff1f8;
  --brand-50:  #f0f8fb;
  --leaf-700: #23784a;
  --leaf-600: #2e9660;
  --leaf-500: #45b077;
  --leaf-100: #dcf3e6;
  --sky: #a6dcf3;

  --bg: #f3f6f8;
  --bg-tint: #eef3f6;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef2f5;
  --border: #e1e7ec;
  --border-strong: #cdd6de;
  --text: #102330;
  --text-2: #445663;
  --text-3: #74858f;
  --focus: #1690b8;

  --success: #25865a; --success-bg: #e3f5ec; --success-border: #bfe6d1;
  --warning: #a8650b; --warning-bg: #fdf1dc; --warning-border: #f4d9a6;
  --danger:  #c23a32; --danger-bg:  #fce9e7; --danger-border:  #f4c6c1;
  --info:    #1467a0; --info-bg:    #e3f0fa; --info-border:    #bcd9ef;
  --neutral: #52626e; --neutral-bg: #edf1f4; --neutral-border: #d9e1e7;

  --accent: var(--brand-600);
  --accent-hover: var(--brand-700);
  --accent-soft: var(--brand-100);
  --accent-text: #ffffff;

  --sidebar-bg: linear-gradient(180deg, #0a3450 0%, #082b43 100%);
  --sidebar-text: #cfe2ec;
  --sidebar-muted: #7fa3b6;
  --sidebar-active: rgba(255, 255, 255, .11);
  --sidebar-hover: rgba(255, 255, 255, .07);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-xs: 0 1px 2px rgba(16, 35, 48, .05);
  --shadow-sm: 0 1px 3px rgba(16, 35, 48, .06), 0 1px 2px rgba(16, 35, 48, .04);
  --shadow: 0 6px 20px -8px rgba(16, 35, 48, .18), 0 2px 6px rgba(16, 35, 48, .05);
  --shadow-lg: 0 24px 60px -20px rgba(6, 38, 58, .35), 0 8px 24px rgba(6, 38, 58, .10);

  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sidebar-w: 256px;
  --topbar-h: 60px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand-100: #123447;
  --brand-50: #0f2a38;
  --bg: #0b141a;
  --bg-tint: #0e1a21;
  --surface: #121e26;
  --surface-2: #15232c;
  --surface-3: #1b2b35;
  --border: #22333e;
  --border-strong: #2f4452;
  --text: #e5eef3;
  --text-2: #a9bcc8;
  --text-3: #7a909d;
  --focus: #45aed0;
  --success: #5cc98f; --success-bg: #11301f; --success-border: #1d4d33;
  --warning: #f0b54f; --warning-bg: #33260e; --warning-border: #57431b;
  --danger:  #f07c73; --danger-bg:  #3a1715; --danger-border:  #5e2622;
  --info:    #6cb8ea; --info-bg:    #10283a; --info-border:    #1c4260;
  --neutral: #a3b4bf; --neutral-bg: #1b2a33; --neutral-border: #2b3d49;
  --accent: #2f9fc7;
  --accent-hover: #45aed0;
  --accent-soft: #123447;
  --sidebar-bg: linear-gradient(180deg, #081a24 0%, #07161f 100%);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
  --shadow: 0 8px 24px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .75);
  color-scheme: dark;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.012em; color: var(--text); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
h4 { font-size: 13.5px; font-weight: 650; }
p { margin: 0 0 .75em; }
small { font-size: 12.5px; }
b, strong { font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
code, kbd { font-family: var(--mono); font-size: .9em; }
kbd {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-3); font-size: 11px; line-height: 18px;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--brand-200); color: var(--brand-950); }
[hidden], .hidden { display: none !important; }

.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--mono); }
.strong { font-weight: 650; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.warning-text { color: var(--warning); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.top { align-items: flex-start; }
.stack { display: grid; gap: 12px; }
.stack.tight { gap: 6px; }
.stack.loose { gap: 20px; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }

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

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  padding: 18px 12px 12px;
  z-index: 40;
}
/* Logo de l'outil (comme Sanelio Avocats) : le mot « sanelio » puis un encart plein de la couleur du métier. */
.sidebar-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; padding: 4px 10px 18px; color: #fff; text-decoration: none; }
.sidebar-brand .marque { display: flex; align-items: center; gap: 8px; }
.sidebar-brand .marque img { height: 24px; width: auto; display: block; }
.sidebar-brand .produit { font-weight: 600; font-size: 13px; line-height: 1; padding: 5px 8px; border-radius: 7px; color: #fff; background: var(--produit, #3DC0B4); white-space: nowrap; }
body.prof-medical { --produit: #1A8FA8; }
body.prof-veterinary { --produit: #6CC48A; }
.sidebar-brand .brand-center { display: block; font-size: 11.5px; font-weight: 500; color: var(--sidebar-muted); max-width: 200px; padding-left: 1px; }
.sidebar-scroll { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-section { margin: 14px 10px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--sidebar-muted); }
.nav-section:first-child { margin-top: 0; }
.nav { display: grid; gap: 1px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--sidebar-text); font-weight: 520; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .82; }
.nav a > span:not(.nav-count) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { background: var(--sidebar-hover); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--leaf-500); }
.nav a.active svg { opacity: 1; color: #8fe0b4; }
.nav .nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; height: 19px; border-radius: 10px; background: rgba(255,255,255,.14); color: #fff; font-size: 11px; font-weight: 650; display: inline-grid; place-items: center; }
.nav .nav-count.alert { background: #e5574e; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .09); margin-top: 10px; padding-top: 10px; }
.sidebar-foot .version { display: block; padding: 4px 10px; font-size: 11px; color: var(--sidebar-muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.menu-toggle { display: none; }
.search-trigger {
  display: flex; align-items: center; gap: 10px;
  width: min(440px, 44vw); height: 38px; padding: 0 10px 0 12px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text-3); font: inherit; font-size: 13.5px; cursor: pointer;
  box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.search-trigger svg { width: 17px; height: 17px; }
.search-trigger kbd { margin-left: auto; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: #e5574e; color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 12px; border: 1px solid transparent; background: transparent; cursor: pointer; font: inherit; color: var(--text); }
.user-chip:hover { background: var(--surface); border-color: var(--border); }
.user-chip .who { display: grid; text-align: left; line-height: 1.2; }
.user-chip .who b { font-size: 13px; }
.user-chip .who small { font-size: 11.5px; color: var(--text-3); }

.content { padding: 24px 28px 64px; max-width: 1480px; width: 100%; margin: 0 auto; }
.content.wide { max-width: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.page-head .crumbs a { color: var(--text-3); }
.page-head .crumbs a:hover { color: var(--accent); }
.page-head p.sub { margin: 4px 0 0; color: var(--text-3); font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Onglets de l'espace de travail */
.worktabs { display: flex; align-items: center; gap: 4px; padding: 0 28px; height: 40px; border-bottom: 1px solid var(--border); background: var(--bg-tint); overflow-x: auto; scrollbar-width: none; }
.worktabs::-webkit-scrollbar { display: none; }
.worktab { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; height: 30px; padding: 0 6px 0 10px; border-radius: 8px; font-size: 12.5px; color: var(--text-2); border: 1px solid transparent; flex: none; }
.worktab a { color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worktab:hover { background: var(--surface); border-color: var(--border); }
.worktab.active { background: var(--surface); border-color: var(--border); color: var(--text); font-weight: 600; box-shadow: var(--shadow-xs); }
.worktab button { border: 0; background: transparent; color: var(--text-3); width: 20px; height: 20px; border-radius: 5px; cursor: pointer; font-size: 15px; line-height: 1; }
.worktab button:hover { background: var(--surface-3); color: var(--text); }
.worktabs .tabs-clear { margin-left: auto; flex: none; border: 0; background: transparent; color: var(--text-3); font: inherit; font-size: 12px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.worktabs .tabs-clear:hover { color: var(--text); background: var(--surface); }

/* 4. Composants ------------------------------------------------------------ */

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--accent); color: var(--accent-text);
  font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 2px rgba(10, 52, 80, .18), inset 0 1px 0 rgba(255, 255, 255, .12);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s, color .15s;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-text); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.ghost, .btn.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn.ghost:hover, .btn.secondary:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn.soft { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.btn.soft:hover { background: var(--brand-200); color: var(--brand-800); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #a92f28; }
.btn.ghost.danger, .btn.danger-ghost { background: var(--surface); color: var(--danger); border-color: var(--danger-border); }
.btn.ghost.danger:hover, .btn.danger-ghost:hover { background: var(--danger-bg); }
.btn.success { background: var(--leaf-600); color: #fff; }
.btn.success:hover { background: var(--leaf-700); }
.btn.plain { background: transparent; color: var(--text-2); box-shadow: none; border-color: transparent; }
.btn.plain:hover { background: var(--surface-3); color: var(--text); }
.btn.sm, .btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; flex: none; }
.btn.sm.icon { width: 30px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.linkbtn, .link-danger, button.link {
  border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; font-weight: 550;
}
.link-danger { color: var(--danger); }
.linkbtn:hover, button.link:hover { text-decoration: underline; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* Cartes */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 18px;
  min-width: 0;
}
.card.flush { padding: 0; }
.card.flat { box-shadow: none; }
.card.tinted { background: var(--surface-2); }
.card > h2:first-child, .card > h3:first-child { margin-bottom: 14px; }
.card-head, .cardhead {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.card.flush .card-head, .card.flush .cardhead { padding: 16px 20px 0; }
.card-head h2, .cardhead h2 { font-size: 16px; }
.card-head p, .cardhead p { margin: 3px 0 0; color: var(--text-3); font-size: 13px; }
.card-foot { border-top: 1px solid var(--border); margin: 16px -20px -20px; padding: 12px 20px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.eyebrow, .clinical-eyebrow {
  display: block; margin-bottom: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent);
}
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin: 24px 0 10px; }

/* Grilles */
.grid { display: grid; gap: 18px; align-items: start; }
.grid.stretch { align-items: stretch; }
.grid > .card { margin-bottom: 0; }
.grid.two, .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three, .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four, .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.sidebar-right { grid-template-columns: minmax(0, 1fr) 360px; }
.grid.sidebar-left { grid-template-columns: 320px minmax(0, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid + .grid, .grid + .card, .card + .grid { margin-top: 18px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

/* Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi {
  position: relative; display: grid; gap: 2px; align-content: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-xs); color: var(--text); min-width: 0;
}
a.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); color: var(--text); }
.kpi > span:first-child, .kpi .kpi-label { font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.kpi strong, .kpi .kpi-value { font-size: 26px; font-weight: 720; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.kpi small, .kpi .kpi-note { color: var(--text-3); font-size: 12px; }
.kpi .kpi-icon { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi .kpi-icon svg { width: 18px; height: 18px; }
.kpi.warn .kpi-icon { background: var(--warning-bg); color: var(--warning); }
.kpi.danger .kpi-icon { background: var(--danger-bg); color: var(--danger); }
.kpi.success .kpi-icon, .kpi.ok .kpi-icon { background: var(--success-bg); color: var(--success); }
.kpi.warn strong { color: var(--warning); }
.kpi.danger strong { color: var(--danger); }
.kpi.success strong { color: var(--success); }
.kpi.plain strong { color: var(--text); }

/* Badges et pastilles */
.badge, .pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 620; white-space: nowrap; line-height: 1;
  background: var(--neutral-bg); color: var(--neutral); border: 1px solid var(--neutral-border);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before, .pill::before { display: none; }
.tone-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.tone-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.tone-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border); }
.tone-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info-border); }
.tone-neutral { background: var(--neutral-bg); color: var(--neutral); border-color: var(--neutral-border); }
.tone-brand   { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); font-size: 12.5px; font-weight: 550; }
.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--text-3); }

/* Alertes / messages */
.flash, .alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; margin-bottom: 18px;
  border-radius: var(--radius); border: 1px solid var(--success-border);
  background: var(--success-bg); color: var(--success); font-weight: 520;
}
.flash svg, .alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.flash .flash-body, .alert .alert-body { flex: 1; color: var(--text); font-weight: 500; }
.flash .flash-close { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; opacity: .6; }
.flash.warning, .alert.warning, .flash.warn { border-color: var(--warning-border); background: var(--warning-bg); color: var(--warning); }
.flash.danger, .alert.danger, .flash.error { border-color: var(--danger-border); background: var(--danger-bg); color: var(--danger); }
.flash.info, .alert.info { border-color: var(--info-border); background: var(--info-bg); color: var(--info); }
.alert.neutral { border-color: var(--border); background: var(--surface-2); color: var(--text-2); }
.alert p:last-child { margin-bottom: 0; }

/* Formulaires */
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); min-width: 0; }
input, select, textarea {
  width: 100%; min-width: 0;
  font: inherit; font-size: 14px; font-weight: 450; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 8px 11px; min-height: 38px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2374858f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
input:hover, select:hover, textarea:hover { border-color: #b5c2cc; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .85; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--accent); flex: none; margin: 0; }
input[type="color"] { padding: 3px; height: 38px; cursor: pointer; }
input[type="file"] { padding: 6px; font-size: 13px; }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
label.check, .check { display: flex; align-items: center; gap: 9px; font-weight: 520; color: var(--text); cursor: pointer; }
.field-hint, label small.hint { font-size: 12px; font-weight: 450; color: var(--text-3); }
.required::after { content: " *"; color: var(--danger); }

.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 16px; align-items: start; }
.form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form.one { grid-template-columns: 1fr; }
.form .wide, .form > h2, .form > h3, .form > p, .form > .form-actions, .form > button.btn, .form > .alert { grid-column: 1 / -1; }
.form > h2, .form > h3 { margin-top: 6px; }
.form > h2.section-divider, .form > h3.section-divider { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 10px; }
.form > button.btn { justify-self: start; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-actions.end { justify-content: flex-end; }
.form-section { border-top: 1px solid var(--border); padding-top: 18px; margin-top: 4px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 0; }
legend { padding: 0 6px; font-weight: 650; font-size: 13px; color: var(--text-2); }
.input-group { display: flex; align-items: stretch; }
.input-group > input { border-radius: 9px 0 0 9px; }
.input-group > .btn { border-radius: 0 9px 9px 0; height: auto; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 140px; }
.inline-form label { display: flex; align-items: center; gap: 6px; }

/* Barre d'outils */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search, .search-form { display: flex; gap: 8px; flex: 1; max-width: 520px; }
.toolbar .search input, .search-form input { flex: 1; }
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.filters label { min-width: 150px; }
.search-input { position: relative; flex: 1; }
.search-input svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.search-input input { padding-left: 36px; }

/* Onglets / segments */
.tabs, .finance-tabs, .segmented {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 18px;
  background: var(--surface-3); border-radius: 11px; flex-wrap: wrap;
}
.tabs a, .tabs button, .finance-tabs a, .segmented a, .segmented button {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 14px; border-radius: 8px; border: 0; background: transparent;
  color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 580; cursor: pointer; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover, .finance-tabs a:hover, .segmented a:hover, .segmented button:hover { color: var(--text); }
.tabs a.active, .tabs button.active, .finance-tabs a.active, .segmented a.active, .segmented button.active {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.tabs .count, .finance-tabs .count { font-size: 11px; font-weight: 650; color: var(--text-3); background: var(--surface-2); border-radius: 8px; padding: 1px 6px; }
.underline-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.underline-tabs a, .underline-tabs button { position: relative; padding: 10px 0; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 580; color: var(--text-3); cursor: pointer; white-space: nowrap; }
.underline-tabs a.active, .underline-tabs button.active { color: var(--text); }
.underline-tabs a.active::after, .underline-tabs button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

/* Tableaux */
.tablewrap, .table-wrap { overflow-x: auto; padding: 0; }
.card.tablewrap { padding: 0; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr, table tr { transition: background .1s; }
.tablewrap tr:hover td, .table-wrap tr:hover td, table.hover tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.card.tablewrap table th:first-child, .card.tablewrap table td:first-child { padding-left: 20px; }
.card.tablewrap table th:last-child, .card.tablewrap table td:last-child { padding-right: 20px; }
.card.tablewrap > table tr:first-child th:first-child { border-top-left-radius: var(--radius-lg); }
.card.tablewrap > table tr:first-child th:last-child { border-top-right-radius: var(--radius-lg); }
td .table-sub, .table-sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 450; margin-top: 1px; }
td.actions, th.actions { text-align: right; white-space: nowrap; }
table.compact td, table.compact th { padding: 7px 10px; }
.row-link { color: var(--text); font-weight: 600; }
.row-link:hover { color: var(--accent); }
tr.muted-row td { color: var(--text-3); }
tr.danger-row td { background: color-mix(in srgb, var(--danger-bg) 55%, transparent); }
tfoot td { font-weight: 650; background: var(--surface-2); }

/* Listes */
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; color: var(--text); display: block; }
.list-item .meta { font-size: 12.5px; color: var(--text-3); display: block; }
a.list-item:hover .title { color: var(--accent); }
.info-list { display: grid; gap: 0; margin: 0; }
.info-list > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt, .info-list > div > span:first-child { color: var(--text-3); font-size: 13px; }
.info-list dd { margin: 0; font-weight: 550; }

/* État vide */
.empty-state, .empty {
  display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: 36px 20px; color: var(--text-3);
}
.empty-state .empty-icon, .empty .empty-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 22px; margin-bottom: 6px; }
.empty-state .empty-icon svg, .empty .empty-icon svg { width: 24px; height: 24px; }
.empty-state h2, .empty-state h3, .empty h3 { color: var(--text); }
.empty-state p, .empty p { max-width: 460px; margin: 0 0 8px; }

/* Avatars */
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, var(--brand-500), var(--leaf-500)); color: #fff;
  font-size: 13.5px; font-weight: 700; letter-spacing: .02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.xl { width: 72px; height: 72px; font-size: 24px; }
.avatar.square { border-radius: 14px; }

/* Menus déroulants / popovers */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60;
  min-width: 240px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  display: none;
}
.menu.open, .dropdown.open > .menu { display: block; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); }
.menu svg { width: 16px; height: 16px; color: var(--text-3); }
.menu hr { margin: 6px 0; }
.menu .menu-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.menu select { font-size: 13px; min-height: 34px; }
.menu form { margin: 0; }
.menu .menu-field { padding: 4px 10px 8px; }

/* Fenêtres modales */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(6, 25, 38, .42); backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px;
}
.modal-backdrop.open { display: flex; animation: fade .15s ease-out; }
.modal { width: min(560px, 100%); max-height: 80vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); animation: rise .18s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }

/* Palette de recherche (⌘K) */
.palette { width: min(640px, 100%); padding: 0; overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input svg { width: 20px; height: 20px; color: var(--text-3); flex: none; }
.palette-input input { border: 0; box-shadow: none !important; height: 56px; font-size: 16px; padding: 0; background: transparent; }
.palette-results { max-height: 56vh; overflow-y: auto; padding: 6px; }
.palette-results a { display: grid; grid-template-columns: 96px 1fr; gap: 2px 12px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--text); }
.palette-results a span { grid-row: span 2; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.palette-results a b { font-weight: 600; }
.palette-results a small { color: var(--text-3); }
.palette-results a:hover, .palette-results a.active { background: var(--accent-soft); }
.palette-results .muted { padding: 16px 12px; margin: 0; }
.palette-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--text-3); }

/* Tiroir latéral */
.drawer-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(6, 25, 38, .35); display: none; }
.drawer-backdrop.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 85;
  width: min(460px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translateX(105%); transition: transform .22s ease; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 8px; justify-content: flex-end; }

/* Chronologie */
.timeline { position: relative; display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding-bottom: 16px; }
.timeline-item::before { content: ""; position: absolute; left: 12px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); z-index: 1; }
.timeline-dot svg { width: 14px; height: 14px; }
.timeline-body b { display: block; }
.timeline-body small { color: var(--text-3); }

/* Barre de progression */
.progress { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--brand-500), var(--leaf-500)); }

/* Graphiques en barres (sans bibliothèque) */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 190px; padding-top: 10px; }
.bars > div { flex: 1; display: grid; justify-items: center; align-content: end; gap: 4px; height: 100%; min-width: 0; }
.bars > div > span { width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--brand-400), var(--brand-600)); min-height: 4px; }
.bars > div.today > span { background: linear-gradient(180deg, var(--leaf-500), var(--leaf-700)); }
.bars b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.bars small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.hbar { display: grid; grid-template-columns: minmax(110px, 30%) 1fr auto; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.hbar .track { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.hbar .track span { display: block; height: 100%; border-radius: 6px; background: var(--brand-500); }

/* Messagerie flottante */
.chat-pop {
  position: fixed; right: 22px; bottom: 22px; z-index: 70;
  width: min(380px, calc(100vw - 32px)); height: min(560px, calc(100vh - 110px));
  display: none; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chat-pop.open { display: flex; animation: rise .18s ease-out; }
.chat-pop-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.chat-pop-head small { display: block; color: var(--text-3); }
.chat-people { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.chat-person { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 30px; padding: 0 10px 0 4px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.chat-person:first-child { padding-left: 10px; }
.chat-person img, .chat-person > span { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--brand-500); color: #fff; font-size: 10px; font-weight: 700; }
.chat-person.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chat-person .unread { width: 8px; height: 8px; border-radius: 50%; background: #e5574e; }
.chat-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.bubble-row { display: flex; gap: 8px; align-items: flex-end; }
.bubble-row.mine { justify-content: flex-end; }
.bubble-row img, .bubble-row > span { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--brand-500); color: #fff; font-size: 10px; font-weight: 700; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--surface); border: 1px solid var(--border); }
.bubble-row.mine .bubble { border-radius: 14px 14px 4px 14px; background: var(--accent); border-color: var(--accent); color: #fff; }
.bubble small { display: block; font-size: 11px; opacity: .7; margin-bottom: 2px; }
.bubble p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.chat-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-compose textarea { min-height: 38px; max-height: 120px; resize: none; }
.chat-compose button { flex: none; }
.chat-loading { text-align: center; color: var(--text-3); padding: 20px; }

/* Assistant (AI Flow) */
.ai-card {
  display: grid; grid-template-columns: 44px 1fr; gap: 14px;
  padding: 18px 20px; margin-bottom: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-100) 80%, var(--surface)), color-mix(in srgb, var(--leaf-100) 55%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--brand-200) 70%, var(--border));
}
.ai-card .ai-mark { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand-600), var(--leaf-600)); color: #fff; box-shadow: 0 6px 16px -6px rgba(14, 91, 128, .6); }
.ai-card .ai-mark svg { width: 22px; height: 22px; }
.ai-card h3 { margin-bottom: 2px; }
.ai-card p { color: var(--text-2); font-size: 13px; margin-bottom: 10px; }
.ai-flow-form, .ai-form { display: flex; gap: 8px; }
.ai-flow-form input, .ai-form input { flex: 1; background: var(--surface); }
.ai-flow-result:empty { display: none; }
.ai-flow-result { margin-top: 12px; }
.ai-flow-preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.ai-flow-preview small { font-size: 11px; font-weight: 700; letter-spacing: .07em; color: var(--text-3); }
.ai-flow-preview ol { margin: 10px 0; padding-left: 20px; display: grid; gap: 8px; }
.ai-flow-preview li span { display: grid; }
.ai-flow-preview li { display: list-item; }
.ai-flow-preview li > span { display: inline-grid; }
.ai-flow-preview li strong { float: right; }
.ai-flow-preview li small { font-weight: 450; letter-spacing: 0; }
.ai-flow-thinking { color: var(--text-3); font-style: italic; }
.ai-flow-error { padding: 10px 12px; border-radius: 10px; background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.ai-flow-warning { padding: 10px 12px; border-radius: 10px; background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); margin: 8px 0; }
.ai-flow-success { padding: 10px 12px; border-radius: 10px; background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.examples { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.examples button { border: 1px dashed var(--border-strong); background: var(--surface); color: var(--text-2); border-radius: 8px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.examples button:hover { border-style: solid; color: var(--accent); border-color: var(--accent); }

/* Recherche d'actes (autocomplétion) */
.act-search { position: relative; }
.act-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; display: none; max-height: 280px; overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.act-results.show { display: grid; }
.act-results button { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.act-results button:hover { background: var(--accent-soft); }

/* Signature manuscrite */
.signature-pad-wrap { border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); padding: 8px; }
.signature-pad { display: block; width: 100%; height: 180px; background: #fff; border-radius: 8px; touch-action: none; cursor: crosshair; }
.signed-proof { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius); background: var(--success-bg); border: 1px solid var(--success-border); }
.signed-proof img { max-height: 70px; background: #fff; border-radius: 6px; padding: 4px; }

/* Étapes (workflow) */
.steps { display: flex; gap: 0; align-items: center; flex-wrap: wrap; margin: 4px 0 16px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.step .step-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-3); border: 1px solid var(--border); }
.step.done .step-dot { background: var(--success); color: #fff; border-color: var(--success); }
.step.current { color: var(--text); }
.step.current .step-dot { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step + .step::before { content: ""; width: 26px; height: 2px; background: var(--border); margin: 0 8px; border-radius: 2px; }
.step.done + .step::before { background: var(--success); }

/* Toasts */
.toast-zone { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--brand-950); color: #fff; font-size: 13.5px; font-weight: 550; box-shadow: var(--shadow-lg); animation: rise .2s ease-out; }
.toast.error { background: var(--danger); }

/* Zone sensible */
.danger-zone { border-color: var(--danger-border); }
.danger-zone h2 { color: var(--danger); }

/* Icônes thème */
:root[data-theme="dark"] .when-light { display: none; }
:root:not([data-theme="dark"]) .when-dark { display: none; }
.ico { flex: none; width: 18px; height: 18px; }
.list-item > .ico { width: 16px; height: 16px; }
.user-chip > .ico { width: 15px; height: 15px; color: var(--text-3); }
.crumbs .ico { width: 13px; height: 13px; }
button.recording, .recording { color: var(--danger) !important; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
form.inline { display: inline; margin: 0; }
.sidebar-scrim { display: none; }

/* 7. Pages publiques (connexion, installation, portail, liens partagés) --- */
.public-page { background: var(--bg); min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.public-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: 32px; text-align: center; }
.public-card img { margin-bottom: 14px; }
.public-card h1 { font-size: 22px; margin-bottom: 8px; }
.public-card p { color: var(--text-2); }

.login-page { background: var(--bg); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.login-shell.single { grid-template-columns: 1fr; }
.login-brand {
  position: relative; overflow: hidden;
  background: radial-gradient(1200px 500px at -10% -10%, #17739b 0%, transparent 60%), radial-gradient(900px 600px at 110% 110%, #2e9660 0%, transparent 55%), linear-gradient(160deg, #0a3450, #06263a);
  color: #e3f1f7; display: flex; align-items: center; padding: 56px;
}
.login-brand-inner { position: relative; z-index: 1; max-width: 480px; }
.login-logo { display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 750; letter-spacing: -.02em; color: #fff; margin-bottom: 56px; }
.login-brand h1 { color: #fff; font-size: 40px; line-height: 1.12; letter-spacing: -.03em; margin-bottom: 18px; font-weight: 750; }
.login-brand p { color: #b9d6e3; font-size: 16px; max-width: 420px; }
.login-points { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; }
.login-points li { display: flex; align-items: center; gap: 12px; color: #e3f1f7; font-weight: 520; }
.login-points svg { width: 20px; height: 20px; color: #8fe0b4; }
.login-waves { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 220px; }
.login-form-side { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; gap: 18px; }
.login-card { width: min(400px, 100%); display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 32px; box-shadow: var(--shadow); }
.login-card.wide-card { width: min(520px, 100%); }
.login-card h2 { font-size: 24px; letter-spacing: -.02em; }
.login-card > p.muted { margin: -10px 0 0; }
.login-card .flash { margin: 0; }
.login-mobile-logo { display: none; }
.login-mobile-logo.show { display: block; }
.login-foot { margin: 0; text-align: center; }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 42px; }
.password-field .reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 30px; border: 0; background: none; color: var(--text-3); cursor: pointer; border-radius: 6px; }
.password-field .reveal svg { width: 18px; height: 18px; }
.otp-input { font-size: 24px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }

/* 8. Adaptation écrans ----------------------------------------------------- */
@media (max-width: 1280px) {
  .kpis, .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.sidebar-right { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1080px) {
  .grid.two, .grid.cols-2, .grid.three, .grid.cols-3, .grid.sidebar-right, .grid.sidebar-left { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-mobile-logo { display: block; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 56px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(6,25,38,.4); }
  .menu-toggle { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 8px; }
  .search-trigger { width: auto; flex: 1; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .hide-sm { display: none !important; }
  .content { padding: 18px 14px 80px; }
  .worktabs { padding: 0 12px; }
  .page-head h1 { font-size: 21px; }
  .form.two, .form.three { grid-template-columns: 1fr; }
  .kpis, .kpis.three, .kpis.five { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi strong { font-size: 22px; }
  .info-list > div { grid-template-columns: 1fr; gap: 2px; }
  .card { padding: 16px; border-radius: var(--radius); }
  .card-foot { margin: 14px -16px -16px; }
  .chat-pop { right: 8px; bottom: 8px; }
  .modal-backdrop { padding-top: 6vh; }
  .palette-results a { grid-template-columns: 1fr; }
  .palette-results a span { grid-row: auto; }
}
@media (max-width: 520px) {
  .kpis, .kpis.three, .kpis.five { grid-template-columns: 1fr 1fr; }
  .grid.four { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .login-card { padding: 24px 20px; }
}

/* Œil des champs de mot de passe (demande du 03/10/2026) */
.mdp-boite { position: relative; display: block; }
.mdp-boite.mdp-ajuste { display: inline-block; max-width: 100%; }
.mdp-boite > input { padding-right: 42px !important; }
.mdp-boite > input::-ms-reveal { display: none; }
.mdp-oeil { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); width: 32px; height: 32px; padding: 0; margin: 0; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: inherit; opacity: .6; cursor: pointer; }
.mdp-oeil:hover { opacity: 1; }
.mdp-oeil:focus-visible { opacity: 1; outline: 2px solid currentColor; outline-offset: 1px; }
