/* Relais — design system v2
   Barre latérale bleu nuit, surfaces blanches posées sur un fond froid, sarcelle « tampon » (comme le site) pour l'action.
   Les couleurs d'échéance (gris → ambre → orange → rouge) restent le seul code couleur métier. */

@font-face { font-family: "Schibsted Grotesk"; src: url("../fonts/schibsted-grotesk-latin-400-normal.5386d37a2778.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("../fonts/schibsted-grotesk-latin-400-italic.489768c4b1fb.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("../fonts/schibsted-grotesk-latin-500-normal.28e9c39982c3.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("../fonts/schibsted-grotesk-latin-600-normal.979c93d531b9.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk"; src: url("../fonts/schibsted-grotesk-latin-700-normal.70a47f952873.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  /* Surfaces */
  --paper: #f6f7fb;
  --sheet: #ffffff;
  --sheet-2: #f8f9fc;
  --night: #0f1729;
  --night-2: #18233a;
  --night-3: #24314d;
  --night-ink: #c5cddc;

  /* Encre */
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #667085;
  --rule: #e6e9f0;
  --rule-strong: #d0d5dd;

  /* Action */
  --stamp: #0f766e;
  --stamp-deep: #0d5f58;
  --stamp-bright: #14b8a6;
  --stamp-wash: #e6f5f3;
  --stamp-line: #99d6ce;

  /* États */
  --late: #c0261a;
  --late-wash: #fdeeec;
  --due: #a35c00;
  --due-wash: #fdf3e1;
  --paid: #11764a;
  --paid-wash: #e4f5ec;
  --info: #1d5f8f;
  --info-wash: #e6f1f9;

  /* Échéancier */
  --age-0: #94a3b8;
  --age-1: #e0a530;
  --age-2: #dd6b2a;
  --age-3: #c0261a;

  --font: "Schibsted Grotesk", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --t-xs: 0.8125rem;
  --t-sm: 0.875rem;
  --t-base: 0.9375rem;
  --t-md: 1.0625rem;
  --t-lg: 1.3125rem;
  --t-xl: 1.75rem;
  --t-xxl: clamp(1.625rem, 1.1rem + 1.6vw, 2.25rem);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  --r-chip: 8px;
  --r-control: 12px;
  --r-sheet: 20px;
  --r-xl: 28px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.07), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, 0.10), 0 2px 6px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, 0.22);

  --sidebar: 264px;
  --page: 1240px;
  --focus: 0 0 0 3px rgba(15, 118, 110, 0.25);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font);
  font-size: var(--t-base); line-height: 1.5; font-feature-settings: "ss01" on; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-control); }
.tnum { font-variant-numeric: tabular-nums; }
.num, td.num, .amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink-3); }
.strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================= Structure : barre latérale claire + contenu ================= */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--s4);
  padding: var(--s4) var(--s3) var(--s3); color: #c5cddc;
  /* Même rendu que la carte d'accueil du tableau de bord (.hero) : dégradé bleu nuit, reflet violet limité au coin
     haut (la barre est étroite et haute : un reflet proportionnel la colorerait presque entièrement), quadrillage en fondu. */
  background: radial-gradient(160% 30% at 100% 0%, rgba(20, 184, 166, 0.35), transparent 55%), linear-gradient(135deg, #18233a, #0f1729 60%);
  isolation: isolate;
  scrollbar-width: thin; scrollbar-color: var(--night-3) transparent;
}
.sidebar::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: linear-gradient(90deg, transparent, #000 70%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%);
}
.sidebar__top { display: flex; align-items: center; justify-content: space-between; padding: 2px var(--s2) 0; }
.sidebar .sidebar__close { display: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 700; font-size: 1.1875rem; letter-spacing: -0.02em; }
.brand svg { flex: none; }

/* Espace actif */
.orgcard {
  position: relative; display: flex; gap: 10px; align-items: center; padding: 8px 10px 8px 7px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1); transition: border-color 120ms, background-color 120ms;
}
.orgcard:hover { border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.09); }
.orgcard__mark { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #14b8a6, #0d5f58); box-shadow: 0 4px 10px -4px rgba(15, 118, 110,.6); }
.orgcard__body { min-width: 0; flex: 1; display: grid; line-height: 1.3; }
.orgcard__name { font-weight: 650; font-size: var(--t-sm); color: #fff; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.orgcard__meta { font-size: 12px; color: #9aa6bd; margin-top: 2px; }
.orgcard__select { appearance: none; width: 100%; border: 0; background: transparent; color: var(--ink); font-weight: 650; font-size: var(--t-sm); padding: 0; cursor: pointer; text-overflow: ellipsis; outline: none; }
.orgcard__select option { color: var(--ink); }
.orgcard form::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.orgcard__switch select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.orgcard:has(select:focus-visible) { box-shadow: var(--focus); }
.orgcard__chev { color: #9aa6bd; transform: rotate(90deg); display: grid; pointer-events: none; }

/* Navigation */
.sidenav { display: grid; gap: 1px; }
.sidenav__group { margin: 18px 0 4px; padding: 0 8px; font-size: 11px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: #7d89a3; }
.sidenav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 8px; border-radius: 10px;
  text-decoration: none; color: #c5cddc; font-size: var(--t-sm); font-weight: 550; transition: background-color 120ms, color 120ms;
}
.sidenav__icon { width: 18px; height: 18px; flex: none; display: grid; place-items: center; color: #8b97ad; transition: color 120ms; }
.sidenav__label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidenav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidenav a:hover .sidenav__icon { color: #c9d1e0; }
.sidenav a[aria-current="page"] { background: rgba(255, 255, 255, 0.09); color: #fff; font-weight: 650; }
.sidenav a[aria-current="page"] .sidenav__icon { color: #9ee6d6; }
.sidenav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #9ee6d6; }
.sidenav .count { min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; background: rgba(255, 255, 255, 0.12); color: #fff; }
.sidenav .count--warn { background: rgba(224, 165, 48, 0.2); color: #f5c66b; }
.sidenav .count--alert { background: var(--late); color: #fff; }
.sidenav a[aria-current="page"] .count:not(.count--alert) { background: var(--stamp); color: #fff; box-shadow: none; }

/* Carte « Posez une question » */
.askcard {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 8px; border-radius: 14px; text-decoration: none;
  color: #fff; background: radial-gradient(120% 140% at 100% 0%, rgba(158, 230, 214, .35), transparent 55%), linear-gradient(135deg, #14b8a6, #0d5f58);
  box-shadow: 0 10px 24px -12px rgba(15, 118, 110, .7); transition: transform 150ms, box-shadow 150ms;
}
.askcard:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -12px rgba(15, 118, 110, .8); }
.askcard__icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.16); }
.askcard__body { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.askcard__body strong { font-size: var(--t-sm); }
.askcard__body span { font-size: 12px; color: rgba(255,255,255,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Pied : personne connectée */
.sidebar__foot { margin-top: auto; display: flex; align-items: center; gap: 4px; padding-top: var(--s3); border-top: 1px solid rgba(255, 255, 255, 0.1); }
.usercard { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 6px 8px; border-radius: 10px; }
.usercard:hover, .usercard[aria-current="page"] { background: rgba(255, 255, 255, 0.06); }
.usercard__body { min-width: 0; display: grid; line-height: 1.3; }
.usercard__name { color: #fff; font-size: var(--t-sm); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usercard__role { font-size: 12px; color: #9aa6bd; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em; background: linear-gradient(135deg, #2f9e8f, #1d6a8f);
}
.avatar--sm { width: 30px; height: 30px; font-size: 11px; }
.avatar--lg { width: 56px; height: 56px; font-size: 18px; }
.iconbtn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-3); cursor: pointer; text-decoration: none; }
.iconbtn:hover { background: var(--sheet-2); color: var(--ink); }
.sidebar .iconbtn { color: #9aa6bd; }
.sidebar .iconbtn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* ================= Barre du haut ================= */
.main { min-width: 0; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3); height: 64px; padding: 0 var(--s6);
  background: rgba(246, 247, 251, .8); backdrop-filter: saturate(1.6) blur(12px); -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid rgba(208, 213, 221, .6);
}
.appbar__menu, .appbar__brand, .appbar__searchbtn { display: none; }
.appbar__brand { text-decoration: none; }
.appsearch { position: relative; flex: 1; max-width: 560px; }
.appsearch__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: grid; color: var(--stamp); }
.appsearch input {
  width: 100%; height: 42px; padding: 0 44px 0 38px; border-radius: 12px; border: 1px solid var(--rule);
  background: var(--sheet); font-size: var(--t-sm); box-shadow: var(--shadow-xs); transition: border-color 120ms, box-shadow 120ms;
}
.appsearch input::placeholder { color: var(--ink-3); }
.appsearch input:hover { border-color: var(--rule-strong); }
.appsearch input:focus { outline: none; border-color: var(--stamp); box-shadow: 0 0 0 4px var(--stamp-wash); }
.instant { position: absolute; left: 0; right: 0; text-align: left; top: calc(100% + 6px); z-index: 60; background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-lg, 0 12px 32px rgba(15, 23, 41, 0.14)); max-height: min(70vh, 520px); overflow-y: auto; }
.instant:empty, .instant[hidden] { display: none; }
.instant__body { padding: 6px; }
.instant__group { margin: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.instant__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: var(--t-sm); }
.instant__item:hover, .instant__item.is-active { background: var(--sheet-2); }
.instant__title { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.instant__sub { margin-left: auto; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.instant__none { margin: 8px 10px; color: var(--ink-3); font-size: var(--t-sm); }
.instant__ask { margin-top: 4px; border-top: 1px solid var(--rule); border-radius: 0 0 8px 8px; color: var(--stamp-deep); }
.instant__ask svg { flex: none; color: var(--stamp); }
.instant__ask kbd { margin-left: auto; font: 600 11px var(--font); color: var(--ink-3); border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; background: var(--sheet-2); }
.appsearch > kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 600 11px var(--font); color: var(--ink-3); border: 1px solid var(--rule-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; background: var(--sheet-2); }
.appbar__end { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.appbar__sep { width: 1px; height: 26px; background: var(--rule-strong); margin: 0 4px; }
.iconbtn--bar { position: relative; width: 40px; height: 40px; color: var(--ink-2); background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow-xs); transition: border-color 120ms, color 120ms; }
.iconbtn--bar:hover, details[open] > .iconbtn--bar { background: var(--sheet); border-color: var(--rule-strong); color: var(--ink); }
details[open] > .iconbtn--bar { box-shadow: 0 0 0 3px var(--stamp-wash); border-color: var(--stamp-line); color: var(--stamp); }
.appbar__upload { height: 40px; border-radius: 10px; }
.account__btn { height: 40px; }
.modepill { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 16px; font-size: var(--t-xs); font-weight: 600; text-decoration: none; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink-2); white-space: nowrap; }
.modepill i { width: 8px; height: 8px; border-radius: 50%; background: var(--age-0); flex: none; }
.modepill--suggest i { background: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-wash); }
.modepill--shadow i { background: var(--age-1); box-shadow: 0 0 0 3px var(--due-wash); }
.modepill--semi_auto i { background: var(--paid); box-shadow: 0 0 0 3px var(--paid-wash); }
.modepill--paused { color: var(--late); border-color: #f4c7c1; background: var(--late-wash); }
.modepill--paused i { background: var(--late); }
.modepill:hover { border-color: var(--rule-strong); }
.rot-90 { transform: rotate(90deg); }

/* Menu du compte */
.account { position: relative; }
.account summary { list-style: none; }
.account summary::-webkit-details-marker { display: none; }
.account__btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; color: var(--ink-2); border: 1px solid transparent; }
.account__btn:hover, .account[open] .account__btn { background: var(--sheet); border-color: var(--rule); box-shadow: var(--shadow-xs); }
.account__name { font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.account__panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 280px; padding: 6px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-lg); display: grid; }
.account__who { display: flex; gap: 10px; align-items: center; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--rule); }
.account__who > span:last-child { display: grid; gap: 2px; min-width: 0; font-size: 12px; color: var(--ink-3); }
.account__who strong { font-size: var(--t-sm); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account__who .rolebadge { justify-self: start; margin-top: 4px; }
.account__panel a, .account__panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; font-size: var(--t-sm); color: var(--ink); text-decoration: none; cursor: pointer; text-align: left; }
.account__panel a:hover, .account__panel button:hover { background: var(--sheet-2); }
.account__panel svg { color: var(--ink-3); }
.account__panel form { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--rule); }
.account__panel .is-danger, .account__panel .is-danger svg { color: var(--late); }
.account__panel form.langswitch { margin-top: 0; padding-top: 0; border-top: 0; }
.langswitch--inline { position: absolute; top: var(--s4); right: var(--s5); }
.langswitch--inline button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--sheet); color: var(--ink-2); font-size: var(--t-xs); cursor: pointer; }
.langswitch--inline button:hover { color: var(--ink); border-color: var(--rule-strong); }

.scrim { display: none; }

/* Bandeau d'urgence */
.modebar { background: var(--late-wash); color: var(--late); font-size: var(--t-sm); border-bottom: 1px solid #f4c7c1; }
.modebar__inner { max-width: var(--page); margin: 0 auto; padding: 10px var(--s6); display: flex; gap: var(--s2); align-items: center; }
.modebar strong { font-weight: 600; }

/* ================= Page ================= */
.page { width: 100%; max-width: var(--page); margin: 0 auto; padding: var(--s6) var(--s6) var(--s8); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-title { font-size: var(--t-xl); font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; }
.page-sub { color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stamp); }
.section { margin-top: var(--s6); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s3); }
.section-title { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.section-title svg { color: var(--ink-3); }
.section-link { font-size: var(--t-sm); color: var(--stamp); text-decoration: none; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.section-link:hover { color: var(--stamp-deep); text-decoration: underline; text-underline-offset: 3px; }

/* Cartes */
.card, .sheet, .panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-xs); }
.card { overflow: hidden; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--rule); }
.card__head h2 { font-size: var(--t-md); font-weight: 600; display: flex; align-items: center; gap: 10px; }
.card__head h2 svg { color: var(--ink-3); }
.card__body { padding: var(--s5); }
.card__body--flush { padding: 0 var(--s5); }
.card__foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--rule); background: var(--sheet-2); }
.panel { padding: var(--s5); }
.panel h2 { font-size: var(--t-md); font-weight: 600; margin-bottom: var(--s2); }
.panel p { color: var(--ink-2); font-size: var(--t-sm); }

/* ================= Aujourd'hui ================= */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: var(--s6); color: #fff;
  background: radial-gradient(90% 120% at 100% 0%, rgba(20, 184, 166, 0.35), transparent 55%), linear-gradient(135deg, #18233a, #0f1729 60%);
  box-shadow: var(--shadow-md);
}
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(90deg, transparent, #000 70%); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.today-date { color: #a8b3c7; font-size: var(--t-sm); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.today-sentence { margin-top: var(--s2); font-size: var(--t-xxl); line-height: 1.18; font-weight: 500; letter-spacing: -0.028em; max-width: 32ch; text-wrap: balance; }
.hero .page-sub { color: #b8c2d4; }
.ledger { margin-top: var(--s5); }
.ledger__bar { display: flex; height: 12px; gap: 4px; border-radius: 6px; overflow: hidden; }
.ledger__seg { min-width: 6px; border-radius: 3px; transform-origin: left center; }
.ledger__seg[data-age="not_due"] { background: var(--age-0); }
.ledger__seg[data-age="d1_7"] { background: var(--age-1); }
.ledger__seg[data-age="d8_30"] { background: var(--age-2); }
.ledger__seg[data-age="d30_plus"] { background: #ef4b3f; }
.ledger__legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.ledger__item { display: block; text-decoration: none; padding: var(--s3) var(--s4); border-radius: var(--r-sheet); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); transition: background-color 120ms; }
.ledger__item:hover { background: rgba(255,255,255,.1); }
.ledger__label { display: flex; align-items: center; gap: 8px; font-size: var(--t-xs); color: #b8c2d4; }
.ledger__label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.ledger__amount { display: block; font-size: var(--t-lg); font-weight: 600; letter-spacing: -0.015em; margin-top: 4px; font-variant-numeric: tabular-nums; color: #fff; }
.ledger__meta { display: block; font-size: var(--t-xs); color: #8b97ad; }

@media (prefers-reduced-motion: no-preference) {
  .ledger__seg { animation: ledger-in 800ms cubic-bezier(.2,.7,.2,1) both; }
  .ledger__seg:nth-child(2) { animation-delay: 70ms; }
  .ledger__seg:nth-child(3) { animation-delay: 140ms; }
  .ledger__seg:nth-child(4) { animation-delay: 210ms; }
  @keyframes ledger-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .page > * { animation: rise 420ms cubic-bezier(.2,.7,.2,1) both; }
  .page > *:nth-child(2) { animation-delay: 40ms; }
  .page > *:nth-child(3) { animation-delay: 80ms; }
  .page > *:nth-child(4) { animation-delay: 120ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* Indicateurs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s5); }
.kpi {
  display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s3); align-items: center; text-decoration: none;
  padding: var(--s4); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-xs);
  transition: box-shadow 150ms, transform 150ms, border-color 150ms;
}
a.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--rule-strong); }
.kpi--stack { grid-template-columns: 1fr; }
.kpi__icon { grid-row: span 2; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--stamp-wash); color: var(--stamp); }
.kpi__icon--amber { background: var(--due-wash); color: var(--due); }
.kpi__icon--green { background: var(--paid-wash); color: var(--paid); }
.kpi__icon--blue { background: var(--info-wash); color: var(--info); }
.kpi__value { display: block; font-size: var(--t-md); font-weight: 650; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; line-height: 1.25; }
.kpi__label { display: block; font-size: var(--t-xs); color: var(--ink-3); }

/* Listes de travail */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s5); }
.worklist { list-style: none; margin: 0; padding: 0; }
.worklist > li + li { border-top: 1px solid var(--rule); }
.workrow { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); text-decoration: none; transition: background-color 120ms; }
a.workrow:hover { background: var(--sheet-2); }
.workrow__main { min-width: 0; flex: 1; }
.workrow__title, .workrow__meta { display: block; }
.workrow__title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workrow__meta { font-size: var(--t-xs); color: var(--ink-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workrow__end { text-align: right; flex: none; }
.thumb { width: 40px; height: 48px; border-radius: 6px; border: 1px solid var(--rule); background: var(--sheet-2); object-fit: cover; flex: none; box-shadow: var(--shadow-xs); }
.thumb--file { display: grid; place-items: center; font-size: 10.5px; font-weight: 700; color: var(--late); background: var(--late-wash); border-color: #f4c7c1; }
.worklist__empty { padding: var(--s5); color: var(--ink-3); font-size: var(--t-sm); display: flex; gap: var(--s3); align-items: center; }
.worklist__empty svg { color: var(--paid); flex: none; }
.sheet .worklist, .card .worklist { border: 0; }
.split > section > .worklist, .section > .worklist { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-xs); overflow: hidden; }

/* Tampons de statut */
.stamp {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  line-height: 20px; white-space: nowrap; background: var(--wash, transparent); color: var(--fg, var(--ink-2)); border: 1px solid var(--line, var(--rule-strong));
}
.stamp::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.stamp--late { --fg: var(--late); --wash: var(--late-wash); --line: #f6cdc8; }
.stamp--due { --fg: var(--due); --wash: var(--due-wash); --line: #f3dcb0; }
.stamp--paid { --fg: var(--paid); --wash: var(--paid-wash); --line: #bfe5d0; }
.stamp--info { --fg: var(--stamp); --wash: var(--stamp-wash); --line: var(--stamp-line); }
.stamp--quiet { --fg: var(--ink-2); --wash: var(--sheet-2); --line: var(--rule); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: var(--r-control); border: 1px solid transparent; font-size: var(--t-sm); font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color 120ms, border-color 120ms, box-shadow 120ms, transform 80ms;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: linear-gradient(135deg, var(--stamp-bright), var(--stamp-deep)); color: #fff; box-shadow: 0 10px 22px -14px rgba(15, 118, 110, .75), inset 0 1px 0 rgba(255,255,255,.14); }
.btn--primary:hover { background: linear-gradient(135deg, var(--stamp), var(--stamp-deep)); }
.btn--secondary { background: var(--sheet); border-color: var(--rule-strong); color: var(--ink); box-shadow: var(--shadow-xs); }
.btn--secondary:hover { background: var(--sheet-2); border-color: var(--ink-3); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { color: var(--ink); background: rgba(16, 24, 40, 0.05); }
.btn--danger { background: var(--sheet); color: var(--late); border-color: #efc1bb; }
.btn--danger:hover { background: var(--late-wash); }
.btn--sm { height: 34px; padding: 0 12px; font-size: var(--t-xs); border-radius: 8px; }
.btn--block { width: 100%; }
.btn--lg { height: 46px; font-size: var(--t-base); padding: 0 22px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.linklike { background: none; border: 0; padding: 2px 4px; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
.linklike:hover { color: var(--ink); text-decoration-color: currentColor; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.table th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px; letter-spacing: 0.02em;
  padding: 11px var(--s4); border-bottom: 1px solid var(--rule); white-space: nowrap; background: var(--sheet-2);
}
.table th:first-child { padding-left: var(--s5); }
.table td:first-child { padding-left: var(--s5); }
.table th:last-child, .table td:last-child { padding-right: var(--s5); }
.table td { padding: 13px var(--s4); border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table tbody tr { transition: background-color 100ms; }
.table tbody tr:hover { background: #fafbfd; }
.table .strong { font-weight: 600; }
.table a.rowlink { text-decoration: none; font-weight: 600; }
.table a.rowlink:hover { color: var(--stamp); }
.table .nowrap { white-space: nowrap; }
.workrow__after { padding: 0 var(--s4) var(--s3); margin-top: calc(-1 * var(--s2)); font-size: var(--t-xs); }
.workrow__warn { display: block; margin-top: 2px; font-size: var(--t-xs); font-weight: 600; color: var(--due); }
.letter__warn { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 var(--s3); padding: 10px 12px; border-radius: 10px; background: var(--due-wash); color: var(--due); font-size: var(--t-sm); }
.letter__warn svg { flex: none; margin-top: 2px; }
.profit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.profit > div { padding: var(--s3) var(--s4); border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); }
.profit__label { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.profit__value { display: block; margin-top: 2px; font-weight: 650; font-variant-numeric: tabular-nums; }
.profit__value small { font-weight: 550; color: var(--ink-3); }
.profit__result { border-color: var(--paid-line, #bfe5cf) !important; background: var(--paid-wash) !important; }
.profit__result .profit__value { color: var(--paid); }
.profit__result.is-negative { border-color: #f4c7c3 !important; background: var(--late-wash, #fdecea) !important; }
.profit__result.is-negative .profit__value, .cell-sub.is-negative { color: var(--late); }
@media (max-width: 760px) { .profit { grid-template-columns: 1fr; } }
.clock { padding: var(--s3) var(--s4); border: 1px solid var(--rule); border-left: 3px solid var(--rule-strong); border-radius: 10px; background: var(--sheet); margin-bottom: var(--s2); }
.clock.is-soon { border-left-color: var(--due); }
.clock.is-over { border-left-color: var(--late); }
.clock.is-done { border-left-color: var(--paid); }
.clock__head { display: flex; justify-content: space-between; gap: var(--s2); align-items: center; margin-bottom: 2px; }
.clock p { margin: 0; }
.port-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s3); align-items: end; margin-top: var(--s3); }
.port-form .label { font-size: var(--t-xs); }
.port-form .btn { grid-column: 1 / -1; justify-self: start; }
.port-form .field { margin: 0; }
.port-form .input { height: 36px; font-size: var(--t-xs); }
.inv-lines { display: grid; gap: var(--s2); }
.inv-line { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: var(--s2); }
.inv-disb { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.inv-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); margin: var(--s4) 0; }
.inv-totals > div { padding: 10px 12px; border-radius: 10px; background: var(--sheet-2); }
.inv-totals dt { font-size: var(--t-xs); color: var(--ink-3); }
.inv-totals dd { margin: 2px 0 0; font-weight: 650; font-variant-numeric: tabular-nums; }
.inv-totals .is-grand { background: var(--stamp-wash); }
.inv-totals .is-grand dd { color: var(--stamp-deep); }
@media (max-width: 760px) { .inv-line { grid-template-columns: 1fr; } .inv-totals { grid-template-columns: 1fr 1fr; } }
.track-page { max-width: 760px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s8); display: grid; gap: var(--s4); }
.track-page__status, .track-page__card { padding: var(--s4) var(--s5); }
.track-page__card h2 { font-size: var(--t-md); margin: 0 0 var(--s3); }
.track-page__step { font-size: var(--t-lg); font-weight: 650; margin: 2px 0 4px; }
.track-page__foot { text-align: center; }
body.public { background: var(--paper, #f4f5f9); }
.fleet-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.fleet-summary__item { padding: 12px 16px; border: 1px solid var(--rule); border-left: 3px solid var(--rule-strong); border-radius: 10px; background: var(--sheet); color: var(--ink-2); text-decoration: none; font-size: var(--t-sm); }
.fleet-summary__item strong { display: block; color: var(--ink); font-size: var(--t-md); font-variant-numeric: tabular-nums; }
.fleet-summary__item:hover { border-color: var(--rule-strong); }
.fleet-summary__item.is-due { border-left-color: var(--due); }
.fleet-summary__item.is-late { border-left-color: var(--late); }
@media (max-width: 760px) { .fleet-summary { grid-template-columns: 1fr; } }
.pager { display: flex; justify-content: center; align-items: center; gap: var(--s3); margin-top: var(--s4); }
.oblig-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.oblig-form__name { flex: 1 1 100%; font-weight: 600; font-size: var(--t-sm); }
.oblig-form .select, .oblig-form .input { height: 32px; font-size: var(--t-xs); width: auto; }
.oblig-form__active { display: inline-flex; gap: 4px; align-items: center; font-size: var(--t-xs); color: var(--ink-2); }
.piece-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.piece-choices label { display: flex; gap: 8px; align-items: center; font-size: var(--t-sm); }
.fleet-summary--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .fleet-summary--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fleet-summary__item strong { margin-bottom: 2px; }
.cab-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--s4); }
.cab-actions__item { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); }
.cab-actions__item + .cab-actions__item { border-left: 1px solid var(--rule); }
.cab-actions__icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--stamp-wash); color: var(--stamp); }
.cab-actions__text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: var(--t-sm); }
.cab-filters { display: flex; gap: var(--s2); align-items: center; }
.cab-filters .select { height: 40px; width: auto; }
.cab-filters .search { position: relative; }
@media (max-width: 760px) { .cab-actions { grid-template-columns: 1fr; } .cab-actions__item + .cab-actions__item { border-left: 0; border-top: 1px solid var(--rule); } .cab-filters { width: 100%; flex-wrap: wrap; } }
.cell-clip { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Écrans moyens (portables) : on retire les colonnes secondaires plutôt que de faire défiler le tableau. */
@media (max-width: 1400px) { .table .hide-md { display: none; } }
@media (min-width: 761px) and (max-width: 1100px) { .cell-clip { max-width: 150px; } .track--mini { min-width: 110px; } .table .hide-tab { display: none; } }
/* Ligne entière cliquable : le lien du titre s'étend sur toute la ligne. */
.table--clickable tbody tr { position: relative; cursor: pointer; }
.table--clickable a.rowlink::after { content: ""; position: absolute; inset: 0; }
.table--clickable tbody tr:hover a.rowlink { color: var(--stamp); }
.cell-sub { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.sheet.table-wrap { overflow: hidden; overflow-x: auto; }

/* Onglets et recherche */
.toolbar { display: flex; gap: var(--s4); align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: var(--s4); }
.tabs { display: inline-flex; gap: 2px; flex-wrap: wrap; padding: 4px; background: #e8ebf2; border-radius: 11px; }
.tabs a { padding: 6px 12px; border-radius: 8px; text-decoration: none; font-size: var(--t-sm); color: var(--ink-2); font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="true"] { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.tabs .count { color: var(--ink-3); font-variant-numeric: tabular-nums; margin-left: 6px; font-size: 12px; }
.search { position: relative; }
.search input { padding-left: 36px; width: 280px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }

/* Formulaires */
.field { display: grid; gap: 6px; margin-bottom: var(--s4); align-content: start; }
.label { font-size: var(--t-sm); font-weight: 550; color: var(--ink); }
.hint { font-size: var(--t-xs); color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px; background: var(--sheet); border: 1px solid var(--rule-strong);
  border-radius: var(--r-control); font-size: var(--t-base); box-shadow: var(--shadow-xs); transition: border-color 120ms, box-shadow 120ms;
}
.select { appearance: none; padding-right: 36px; background-repeat: no-repeat; background-position: right 12px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23667085' stroke-width='1.5'/%3E%3C/svg%3E"); }
.select--sm { height: 34px; font-size: var(--t-xs); padding-left: 10px; width: auto; }
.textarea { height: auto; padding: 10px 12px; min-height: 120px; line-height: 1.5; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: #b3bac6; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-wash); }
.input[readonly] { background: var(--sheet-2); }
.errorlist { list-style: none; padding: 0; margin: 0; color: var(--late); font-size: var(--t-xs); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s4); }
.form-grid .field--full { grid-column: 1 / -1; }
.checkrow { display: flex; gap: 10px; align-items: flex-start; font-size: var(--t-sm); cursor: pointer; }
.checkrow input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--stamp); flex: none; }

/* Interrupteur */
.toggle { position: relative; display: inline-flex; flex: none; }
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.toggle span { width: 38px; height: 22px; border-radius: 11px; background: var(--rule-strong); transition: background-color 150ms; position: relative; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 150ms; }
.toggle input:checked + span { background: var(--stamp); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:focus-visible + span { box-shadow: var(--focus); }
.toggle input:disabled + span { opacity: .5; }

/* Messages */
.flash { width: 100%; max-width: var(--page); margin: var(--s4) auto 0; padding: 0 var(--s6); }
.flash__item { display: flex; gap: 10px; align-items: center; padding: 11px 14px; border-radius: var(--r-control); font-size: var(--t-sm); border: 1px solid; margin-bottom: var(--s2); box-shadow: var(--shadow-xs); font-weight: 500; }
.flash__item svg { flex: none; }
.flash__item--success { background: var(--paid-wash); color: var(--paid); border-color: #bfe5d0; }
.flash__item--error { background: var(--late-wash); color: var(--late); border-color: #f4c7c1; }
.flash__item--info, .flash__item--warning { background: var(--due-wash); color: var(--due); border-color: #f3dcb0; }

/* Écran de vérification */
.review { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr); gap: var(--s6); align-items: start; }
.viewer { background: #1b2436; border-radius: var(--r-sheet); padding: var(--s5); position: sticky; top: 80px; box-shadow: var(--shadow-md); }
.viewer img { margin: 0 auto; max-height: calc(100vh - 180px); width: auto; border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.viewer__bar { display: flex; justify-content: space-between; color: #a8b3c7; font-size: var(--t-xs); margin-bottom: var(--s3); }
.viewer__bar a { color: #e8ecef; }
.fieldlist { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; box-shadow: var(--shadow-xs); }
.xfield { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); border-left: 3px solid transparent; }
.xfield:last-child { border-bottom: 0; }
.xfield.is-flagged { border-left-color: var(--age-1); background: linear-gradient(90deg, var(--due-wash), transparent 70%); }
.xfield__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); margin-bottom: 6px; }
.xfield__name { font-size: var(--t-sm); font-weight: 550; }
.xfield__conf { font-size: var(--t-xs); color: var(--ink-3); }
.xfield.is-flagged .xfield__conf { color: var(--due); font-weight: 600; }
.xfield__row { display: flex; gap: var(--s2); }
.xfield__row .input { flex: 1; }
.xfield__note { font-size: var(--t-xs); color: var(--ink-3); margin-top: 6px; }
.xfield.is-confirmed .xfield__conf { color: var(--paid); }
.review-actions {
  position: sticky; bottom: 0; background: rgba(246, 247, 251, .92); backdrop-filter: blur(8px); padding: var(--s4) 0; margin-top: var(--s4);
  display: flex; gap: var(--s2); align-items: center; border-top: 1px solid var(--rule);
}
.review-actions .hint { margin-right: auto; }

/* Relances */
.letter { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: var(--s5); box-shadow: var(--shadow-xs); }
.letter + .letter { margin-top: var(--s4); }
.letter__head { display: flex; justify-content: space-between; gap: var(--s4); align-items: flex-start; flex-wrap: wrap; }
.letter__to { font-weight: 600; font-size: var(--t-md); }
.letter__facts { font-size: var(--t-sm); color: var(--ink-2); margin-top: 2px; }
.letter__body {
  margin: var(--s4) 0; padding: var(--s4) var(--s4) var(--s4) var(--s5); background: #f4fbf6; border-radius: 4px 14px 14px 14px;
  white-space: pre-line; font-size: var(--t-base); max-width: 68ch; border: 1px solid #d5ecdd; position: relative;
}
textarea.letter__body { width: 100%; field-sizing: content; min-height: 140px; font-family: inherit; display: block; }
.letter__foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; }

/* Vide, dépôt */
.empty { padding: var(--s7) var(--s5); text-align: center; max-width: 56ch; margin: 0 auto; }
.empty__icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto var(--s4); background: var(--stamp-wash); color: var(--stamp); }
.empty__title { font-size: var(--t-md); font-weight: 600; }
.empty p { color: var(--ink-2); margin-top: 6px; }
.empty .btn { margin-top: var(--s4); }
.dropzone {
  display: flex; align-items: center; gap: var(--s4); padding: var(--s5); cursor: pointer;
  border: 1.5px dashed #c3c9d6; border-radius: var(--r-sheet); background: var(--sheet); transition: border-color 150ms, background-color 150ms;
}
.dropzone > svg { width: 48px; height: 48px; padding: 12px; border-radius: 12px; background: var(--stamp-wash); color: var(--stamp) !important; flex: none; }
.dropzone:hover { border-color: var(--stamp); }
.dropzone.is-over { border-color: var(--stamp); background: var(--stamp-wash); }
.dropzone__text { flex: 1; color: var(--ink-2); font-size: var(--t-sm); }
.dropzone__text strong { color: var(--ink); font-weight: 600; display: block; font-size: var(--t-base); }
.dropzone__camera { display: none; margin-top: var(--s3); }
@media (pointer: coarse) { .dropzone__camera { display: flex; } }

/* ================= Authentification ================= */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--sheet); }
.auth__side {
  position: relative; overflow: hidden; color: #dfe5ea; padding: var(--s7); display: flex; flex-direction: column; justify-content: space-between; gap: var(--s6);
  background: radial-gradient(70% 60% at 100% 0%, rgba(20, 184, 166, 0.45), transparent 60%), radial-gradient(60% 50% at 0% 100%, rgba(47, 158, 143, 0.35), transparent 60%), var(--night);
}
.auth__side::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 32px 32px; mask-image: radial-gradient(80% 80% at 50% 40%, #000, transparent); pointer-events: none; }
.auth__side > * { position: relative; z-index: 1; }
.auth__side .brand { padding: 0; }
.auth__quote { font-size: clamp(1.6rem, 1rem + 1.6vw, 2.3rem); line-height: 1.15; font-weight: 600; letter-spacing: -0.03em; color: #fff; max-width: 18ch; }
.auth__quote em { font-style: normal; background: linear-gradient(90deg, #9ee6d6, #7fd9c9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth__lead { color: #b8c2d4; margin-top: var(--s3); max-width: 44ch; }
.auth__steps { list-style: none; padding: 0; margin: var(--s6) 0 0; display: grid; gap: var(--s3); max-width: 46ch; }
.auth__steps li { display: grid; grid-template-columns: 40px 1fr; gap: var(--s3); align-items: center; color: #c5cddc; padding: var(--s3); border-radius: var(--r-sheet); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); backdrop-filter: blur(4px); }
.auth__steps b { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: rgba(255,255,255,.08); color: #9ee6d6; }
.auth__stats { display: flex; gap: var(--s6); color: #8b97ad; font-size: var(--t-xs); }
.auth__stats strong { display: block; color: #fff; font-size: var(--t-lg); font-weight: 600; }
.auth__main { position: relative; display: grid; place-items: center; padding: var(--s6) var(--s5); }
.auth__form { width: 100%; max-width: 400px; }
.auth__form--wide { max-width: 560px; }
.auth__form h1 { font-size: var(--t-xl); font-weight: 650; letter-spacing: -0.025em; margin-bottom: var(--s2); }
.auth__form .page-sub { margin-bottom: var(--s5); }
.auth__alt { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--rule); font-size: var(--t-sm); color: var(--ink-2); text-align: center; }
.auth__alt a { color: var(--stamp); font-weight: 600; text-decoration: none; }
.auth__alt a:hover { text-decoration: underline; }
.demo-hint { margin-top: var(--s4); padding: var(--s3) var(--s4); border-radius: var(--r-control); background: var(--sheet-2); border: 1px dashed var(--rule-strong); font-size: var(--t-xs); color: var(--ink-2); }
.demo-hint code { font-size: 12px; color: var(--ink); }
/* Connexion : la page tient dans l'écran, sans défilement ; le panneau se resserre sur les écrans bas. */
.auth--fit { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.auth--fit .auth__side { padding: var(--s6) var(--s7); }
.auth--fit .auth__steps { margin-top: var(--s5); gap: var(--s2); }
.auth--fit .auth__steps li { padding: var(--s2) var(--s3); }
.auth--fit .auth__main { padding: var(--s4) var(--s5); overflow-y: auto; }
@media (max-height: 820px) { .auth--fit .auth__lead { display: none; } .auth--fit .auth__steps { margin-top: var(--s4); } }
@media (max-height: 680px) { .auth--fit .auth__steps { display: none; } }

/* Choix du secteur (cartes radio) */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice__box { display: grid; gap: 2px; align-content: start; height: 100%; padding: var(--s3); border: 1px solid var(--rule-strong); border-radius: var(--r-control); background: var(--sheet); transition: border-color 120ms, box-shadow 120ms, background-color 120ms; }
.choice__box strong { font-size: var(--t-sm); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.choice__box span { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.choice:hover .choice__box { border-color: #b3bac6; }
.choice input:checked + .choice__box { border-color: var(--stamp); background: var(--stamp-wash); box-shadow: 0 0 0 1px var(--stamp); }
.choice input:focus-visible + .choice__box { box-shadow: var(--focus); }
.stepper { display: flex; gap: var(--s2); align-items: center; margin-bottom: var(--s4); font-size: var(--t-xs); color: var(--ink-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.stepper::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* Logo, assistant d'inscription, téléphone, consentement */
.logo { flex: none; border-radius: 9px; box-shadow: 0 4px 14px -4px rgba(15, 118, 110, .55); }
.auth__side .brand { font-size: 1.5rem; gap: 12px; }
.auth__side .brand .logo { width: 42px; height: 42px; border-radius: 12px; }
.brand--ink { color: var(--ink); }
.rot-270 { transform: rotate(-90deg); }
.wizard fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.wizard.is-js .wizard__step[hidden] { display: none; }
.wizard:not(.is-js) .wizard__step + .wizard__step { margin-top: var(--s6); padding-top: var(--s6); border-top: 1px solid var(--rule); }
.wizard__progress { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: var(--s5); }
.wizard__progress span { height: 4px; border-radius: 2px; background: var(--rule); transition: background-color 250ms; }
.wizard__progress span.is-on { background: linear-gradient(90deg, #14b8a6, var(--stamp)); }
.wizard:not(.is-js) .wizard__progress { display: none; }
.wizard__count { font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; margin-bottom: var(--s2); display: flex; align-items: center; gap: 6px; }
.wizard__back { display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--stamp); text-decoration: none; padding: 0; }
.wizard__back:hover { color: var(--stamp-deep); }
.wizard h1 { font-size: var(--t-xl); font-weight: 650; letter-spacing: -0.025em; margin-bottom: var(--s2); }
.phone { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr); gap: var(--s2); }
.phone__code { font-variant-numeric: tabular-nums; }
.password { position: relative; }
.password .input { padding-right: 46px; }
.password__toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--ink-3); cursor: pointer; }
.password__toggle:hover { color: var(--ink); background: var(--sheet-2); }
.password__toggle:focus-visible { box-shadow: var(--focus); }
.password__hide, .password__toggle[aria-pressed="true"] .password__show { display: none; }
.password__toggle[aria-pressed="true"] .password__hide { display: grid; }
.password__show { display: grid; }
/* Sélecteur de pays (intl-tel-input) aux couleurs de l'application */
.iti { display: block; width: 100%; --iti-hover-color: var(--sheet-2); --iti-border-color: var(--rule); --iti-dialcode-color: var(--ink-2); --iti-dropdown-bg: var(--sheet); --iti-spacer-horizontal: 12px; }
.iti .input { width: 100%; }
.iti__country-container { border-right: 1px solid var(--rule); }
.iti__selected-country { border-radius: var(--r-control) 0 0 var(--r-control); }
.iti__selected-country-primary:hover, .iti__selected-country:hover .iti__selected-country-primary { background: var(--sheet-2); }
.iti__dropdown-content { border-radius: var(--r-control); box-shadow: var(--shadow-lg); border: 1px solid var(--rule); font-size: var(--t-sm); }
.iti__search-input { font: inherit; padding: 10px 12px; }
.iti__country.iti__highlight { background: var(--stamp-wash); }
.captcha { margin: var(--s2) 0 var(--s4); min-height: 65px; }
.consent { display: flex; gap: 12px; align-items: flex-start; margin: var(--s2) 0 var(--s3); padding: var(--s4); border: 1px solid var(--rule); border-radius: var(--r-control); background: var(--sheet-2); font-size: var(--t-sm); color: var(--ink-2); cursor: pointer; line-height: 1.45; }
.consent input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--stamp); flex: none; }
.consent a { color: var(--stamp); font-weight: 600; }
.consent:has(input:checked) { border-color: var(--stamp-line); background: var(--stamp-wash); }
.consent + .errorlist { margin: -6px 0 var(--s3); }
.legal-page { background: var(--sheet); }
.legal-head { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--rule); }
.legal { max-width: 720px; margin: 0 auto; padding: var(--s6) var(--s5) var(--s8); }
.legal h1 { font-size: var(--t-xl); font-weight: 650; letter-spacing: -0.025em; margin: 4px 0 var(--s4); }
.legal h2 { font-size: var(--t-md); font-weight: 600; margin: var(--s5) 0 var(--s2); }
.legal p, .legal li { color: var(--ink-2); }
.legal ul { padding-left: 1.2em; display: grid; gap: 6px; }
.legal__draft { padding: var(--s3) var(--s4); border-radius: var(--r-control); background: var(--due-wash); color: var(--due); font-size: var(--t-sm); border: 1px solid #f3dcb0; }
.legal__foot { margin-top: var(--s6); }

/* ================= Réglages ================= */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s6); align-items: start; }
.subnav { position: sticky; top: 88px; display: grid; gap: 2px; }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-control); text-decoration: none; color: var(--ink-2); font-size: var(--t-sm); font-weight: 500; }
.subnav a svg { color: var(--ink-3); }
.subnav a:hover { background: var(--sheet); color: var(--ink); }
.subnav a[aria-current="page"] { background: var(--sheet); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }
.subnav a[aria-current="page"] svg { color: var(--stamp); }
.stack { display: grid; gap: var(--s5); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s5); }
.switchrow { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: var(--s4) 0; }
.switchrow + .switchrow { border-top: 1px solid var(--rule); }
.switchrow__text { min-width: 0; }
.switchrow__title { font-weight: 600; font-size: var(--t-sm); }
.members .table td:last-child { text-align: right; }

.person { display: flex; gap: var(--s3); align-items: center; min-width: 0; }
.person .avatar { width: 36px; height: 36px; }
.person__body { min-width: 0; display: grid; }
.person__name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person__mail { font-size: var(--t-xs); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar--c1 { background: linear-gradient(135deg, #14b8a6, #0d5f58); }
.avatar--c2 { background: linear-gradient(135deg, #2f9e8f, #1d6a8f); }
.avatar--c3 { background: linear-gradient(135deg, #e0a530, #c2611f); }
.avatar--c4 { background: linear-gradient(135deg, #d0567a, #8e2f6b); }
.rolebadge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--sheet-2); border: 1px solid var(--rule); color: var(--ink-2); }
.rolebadge--owner { background: var(--stamp-wash); border-color: var(--stamp-line); color: var(--stamp-deep); }
.rolebadge--accountant { background: var(--info-wash); border-color: #c7dff0; color: var(--info); }
.rolebadge--operator { background: var(--paid-wash); border-color: #bfe5d0; color: var(--paid); }
.row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; align-items: center; }

.rolecards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.rolecard { padding: var(--s4); border: 1px solid var(--rule); border-radius: var(--r-sheet); background: var(--sheet); box-shadow: var(--shadow-xs); }
.rolecard__top { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s2); }
.rolecard__count { font-size: var(--t-lg); font-weight: 650; font-variant-numeric: tabular-nums; }
.rolecard p { font-size: var(--t-xs); color: var(--ink-3); }

.matrix { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.matrix th { font-size: 12px; font-weight: 600; color: var(--ink-3); padding: 10px var(--s3); text-align: center; background: var(--sheet-2); border-bottom: 1px solid var(--rule); }
.matrix th:first-child, .matrix td:first-child { text-align: left; padding-left: var(--s5); }
.matrix td { padding: 11px var(--s3); border-bottom: 1px solid var(--rule); text-align: center; }
.matrix tr:last-child td { border-bottom: 0; }
.yes { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--paid-wash); color: var(--paid); }
.no { display: inline-block; width: 10px; height: 2px; border-radius: 1px; background: var(--rule-strong); vertical-align: middle; }

.gauge { display: grid; gap: 6px; }
.gauge__top { display: flex; justify-content: space-between; font-size: var(--t-sm); }
.gauge__top strong { font-variant-numeric: tabular-nums; }
.gauge__bar { height: 8px; border-radius: 4px; background: #e8ebf2; overflow: hidden; }
.gauge__bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #14b8a6, var(--stamp)); }
.gauge.is-high .gauge__bar i { background: linear-gradient(90deg, var(--age-1), var(--age-2)); }

.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.plan { position: relative; padding: var(--s5) var(--s4); border: 1px solid var(--rule); border-radius: var(--r-sheet); background: var(--sheet); display: grid; gap: var(--s2); align-content: start; }
.plan.is-current { border-color: var(--stamp); box-shadow: 0 0 0 1px var(--stamp), var(--shadow-md); }
.plan__name { font-weight: 650; font-size: var(--t-md); }
.plan__price { font-size: var(--t-lg); font-weight: 650; letter-spacing: -0.02em; }
.plan ul { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--t-sm); color: var(--ink-2); }
.plan li { display: flex; gap: 8px; align-items: center; }
.plan li svg { color: var(--paid); flex: none; }
.plan__tag { position: absolute; top: -10px; left: var(--s4); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--stamp); color: #fff; }

.modules { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.module { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); border: 1px solid var(--rule); border-radius: var(--r-sheet); }
.module__body { flex: 1; min-width: 0; }
.module__body strong { display: block; font-size: var(--t-sm); }
.module__body span { font-size: var(--t-xs); color: var(--ink-3); }

.auditlist { list-style: none; margin: 0; padding: 0; }
.auditlist li { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--rule); font-size: var(--t-sm); }
.auditlist li:last-child { border-bottom: 0; }
.auditlist .avatar { width: 32px; height: 32px; font-size: 11px; }
.auditlist__who { font-size: var(--t-xs); color: var(--ink-3); }
.auditlist time { font-size: var(--t-xs); color: var(--ink-3); white-space: nowrap; }

/* Bienvenue */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.checkstep { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s4); align-items: center; padding: var(--s4) var(--s5); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-xs); }
.checkstep__mark { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed var(--rule-strong); color: var(--ink-3); font-weight: 700; }
.checkstep.is-done .checkstep__mark { border: 0; background: var(--paid); color: #fff; }
.checkstep.is-done .checkstep__title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--rule-strong); }
.checkstep__title { font-weight: 600; }
.checkstep__text { font-size: var(--t-sm); color: var(--ink-2); }
.progress { height: 8px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: var(--s4); max-width: 420px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #9ee6d6, #7fd9c9); border-radius: 4px; }

.profile-head { display: flex; gap: var(--s4); align-items: center; }

/* ================= Transport et transit ================= */
.track { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); counter-reset: step; }
.track li { position: relative; padding-top: 22px; font-size: var(--t-xs); color: var(--ink-3); padding-right: 8px; }
.track li::before { content: ""; position: absolute; top: 5px; left: 0; right: 0; height: 3px; background: var(--rule); border-radius: 2px; }
.track li::after { content: ""; position: absolute; top: 0; left: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--sheet); border: 2px solid var(--rule-strong); }
.track li.is-done { color: var(--ink-2); }
.track li.is-done::before { background: var(--stamp); }
.track li.is-done::after { background: var(--stamp); border-color: var(--stamp); }
/* Étape passée sans avoir été enregistrée (ex. facturé avant la livraison) : trait plein, point creux. */
.track li.is-skipped::before { background: var(--stamp); }
.track li.is-skipped::after { background: var(--sheet); border-color: var(--rule-strong); }
.track li.is-current { color: var(--ink); font-weight: 600; }
.track li.is-current::before { background: linear-gradient(90deg, var(--stamp) 0 8px, var(--rule) 8px); }
.track li.is-current::after { background: var(--sheet); border: 3px solid var(--stamp); box-shadow: 0 0 0 4px var(--stamp-wash); }
.track--mini { min-width: 150px; }
.track--mini li { padding-top: 0; font-size: 0; height: 12px; }
.track--mini li::after { width: 9px; height: 9px; top: 1px; }
.track--mini li::before { top: 4px; height: 2px; }
.step-label { display: block; font-size: var(--t-xs); color: var(--ink-2); margin-top: 4px; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s4) var(--s5); margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: var(--t-xs); color: var(--ink-3); }
.facts dd { margin: 2px 0 0; font-weight: 550; overflow-wrap: anywhere; }
.code { letter-spacing: 0.01em; }
.ok-mark { color: var(--paid); font-size: var(--t-xs); font-weight: 600; margin-left: 6px; }
.bad-mark { color: var(--late); font-size: var(--t-xs); font-weight: 600; margin-left: 6px; }
.kind { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 0 8px; border-radius: 999px; line-height: 20px; background: #eef0f4; color: var(--ink-2); }
.kind--transit { background: var(--info-wash); color: var(--info); }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: var(--s6); align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.timeline li { padding: 0 0 var(--s4) var(--s4); position: relative; font-size: var(--t-sm); }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--sheet); border: 3px solid var(--stamp); }
.timeline .when { color: var(--ink-3); font-size: var(--t-xs); }

/* Alertes */
.alertlist { list-style: none; margin: 0; padding: 0; }
.section > .alertlist, .card > .alertlist { background: var(--sheet); }
.section > .alertlist { border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-xs); overflow: hidden; }
.alertrow { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--rule); }
.alertrow:last-child { border-bottom: 0; }
.alertrow__dot { width: 32px; height: 32px; border-radius: 10px; background: var(--due-wash); position: relative; }
.alertrow__dot::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--due); }
.alertrow.is-high .alertrow__dot { background: var(--late-wash); }
.alertrow.is-high .alertrow__dot::after { color: var(--late); }
.alertrow__title { font-weight: 600; }
.alertrow__title a { text-decoration: none; }
.alertrow__title a:hover { color: var(--stamp); }
.alertrow__text { font-size: var(--t-sm); color: var(--ink-2); }
.alertrow__fb { display: flex; gap: 4px; }
.alertrow__fb button { border: 1px solid var(--rule); background: var(--sheet); color: var(--ink-2); font-size: var(--t-xs); padding: 4px 10px; border-radius: 7px; cursor: pointer; font-weight: 500; }
.alertrow__fb button:hover { border-color: var(--rule-strong); color: var(--ink); background: var(--sheet-2); }
.alertrow__done { font-size: var(--t-xs); color: var(--ink-3); }

/* Paiements et rapprochement */
.match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: var(--s4); align-items: center; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--rule); }
.match:last-child { border-bottom: 0; }
.match__amount { font-size: var(--t-md); font-weight: 650; font-variant-numeric: tabular-nums; }
.signals { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.signal { font-size: 11.5px; padding: 0 8px; line-height: 20px; border-radius: 999px; background: var(--paid-wash); color: var(--paid); font-weight: 600; }
.signal.is-off { background: transparent; color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--rule-strong); }
.score { font-size: var(--t-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.inline-form .select { height: 34px; font-size: var(--t-xs); width: auto; max-width: 260px; }
.inline-form .input { height: 34px; font-size: var(--t-xs); width: auto; }
.inline-form #dl { flex: 1 1 200px; min-width: 0; }
.inline-form #da { width: 150px; }
.skipped-form { margin-top: var(--s3); padding: 10px 14px; border: 1px dashed var(--rule-strong); border-radius: 10px; background: var(--sheet); }

.issues { list-style: none; padding: var(--s3) var(--s4); margin: 0 0 var(--s4); background: var(--due-wash); border: 1px solid #f3dcb0; border-radius: var(--r-control); color: var(--due); font-size: var(--t-sm); }
.issues li + li { margin-top: 4px; }
.meta-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3) var(--s4); margin-bottom: var(--s4); }
.meta-form .field { margin: 0; }
.lines { font-size: var(--t-sm); }
.lines td, .lines th { padding: 8px var(--s3); }

.results h2 { font-size: var(--t-md); font-weight: 600; margin: var(--s5) 0 var(--s2); }
.results ul { list-style: none; padding: 0; margin: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); overflow: hidden; }
.results li { border-bottom: 1px solid var(--rule); padding: 12px var(--s5); display: flex; justify-content: space-between; gap: var(--s4); }
.results li:last-child { border-bottom: 0; }
.results a { text-decoration: none; font-weight: 600; }
.results a:hover { color: var(--stamp); }

/* ================= Analyses ================= */
.filterbar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
.filterbar__label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.kpis--stats { margin: 0 0 var(--s5); }
.kpis--stats .kpi__value { font-size: clamp(var(--t-md), 1.45vw, var(--t-lg)); overflow-wrap: anywhere; }
.kpis--stats .kpi { min-width: 0; }
.kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 var(--s2); }
.chartgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); align-items: start; }
.chartcard { overflow: visible; }
.chartgrid__hint { display: flex; align-items: center; gap: 6px; margin: 0 0 var(--s3); }
.chartcard__grip { flex: none; width: 28px; height: 28px; margin: 0 -4px 0 -10px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--ink-3); cursor: grab; touch-action: none; }
.chartcard__grip:hover { background: var(--sheet-2); color: var(--ink); }
.chartcard__grip:active { cursor: grabbing; }
.chartcard.is-ghost { opacity: 0.35; outline: 2px dashed var(--stamp); outline-offset: -2px; }
.chartcard.is-dragging { box-shadow: var(--shadow-lg); transform: rotate(0.6deg); }
.chartcard.is-saving { opacity: 0.7; }
.chartcard--full { grid-column: 1 / -1; }
.chartcard__head { display: flex; justify-content: space-between; gap: var(--s3); align-items: flex-start; padding: var(--s4) var(--s5) 0; }
.chartcard__titles { min-width: 0; }
.chartcard__titles h2 { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; }
.chartcard__titles p { font-size: var(--t-xs); color: var(--ink-3); margin-top: 2px; }
.chartcard__tools { display: flex; gap: 2px; align-items: center; flex: none; }
.iconbtn--light { color: var(--ink-3); width: 32px; height: 32px; }
.iconbtn--light:hover, .iconbtn--light[aria-pressed="true"] { background: var(--sheet-2); color: var(--ink); }
.iconbtn--light[aria-pressed="true"] { color: var(--stamp); background: var(--stamp-wash); }

.chart { position: relative; margin: 0; padding: var(--s4) var(--s5) var(--s5); min-height: 120px; transition: opacity 150ms; }
.chart.is-loading { opacity: .55; }
.chart svg { display: block; overflow: visible; font-family: var(--font); }
.chart__mark { outline: none; cursor: default; }
.chart__mark:hover .chart__fill, .chart__mark:focus-visible .chart__fill { filter: brightness(1.12); }
.chart__mark:focus-visible .chart__fill { stroke: var(--ink); stroke-width: 2; }
.chart__hit { outline: none; cursor: crosshair; }
.chart__table { display: none; margin-top: var(--s3); border: 1px solid var(--rule); border-radius: var(--r-control); max-height: 360px; overflow: auto; }
.chart.show-table .chart__table, .chart.is-table .chart__table { display: block; }
.chart.show-table .chart__plot { display: none; }
.chart__table .table th { position: sticky; top: 0; }
.chart__table tr.is-total td { font-weight: 650; background: var(--sheet-2); }
.chart__empty { padding: var(--s6) var(--s5); color: var(--ink-3); font-size: var(--t-sm); text-align: center; }
.chart__tip {
  position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; opacity: 0; transition: opacity 90ms;
  background: var(--night); color: #fff; border-radius: 8px; padding: 7px 10px; box-shadow: var(--shadow-md); white-space: nowrap; display: grid; gap: 2px;
}
.chart__tip.is-on { opacity: 1; }
.chart__tip strong { font-size: var(--t-sm); font-weight: 650; }
.chart__tip-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #c5cddc; }
.chart__tip-row i { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.chart__figure { display: grid; gap: 4px; padding: var(--s5) 0 var(--s3); }
.chart__figure-value { font-size: clamp(2.2rem, 1.6rem + 2vw, 3.2rem); font-weight: 650; letter-spacing: -0.03em; line-height: 1.05; }
.chart__figure-label { color: var(--ink-3); font-size: var(--t-sm); }

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu__list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 180px; padding: 6px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-control); box-shadow: var(--shadow-lg); display: grid; }
.menu__list a, .menu__list button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font-size: var(--t-sm); text-decoration: none; color: var(--ink); cursor: pointer; text-align: left; }
.menu__list a:hover, .menu__list button:hover { background: var(--sheet-2); }
.menu__list svg { color: var(--ink-3); }
.menu__list .is-danger { color: var(--late); }
.menu__list .is-danger svg { color: var(--late); }

.builder { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.builder__preview { position: sticky; top: 84px; }
.builder__foot { display: flex; justify-content: flex-end; gap: var(--s2); }
.charttypes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 6px; }
.charttype > span { height: 100%; align-content: start; }
#b-type-hint { min-height: 1.4em; }
/* Aperçu : le titre garde sa place, les périodes passent dessous si la carte est étroite. */
.builder__preview .chartcard__head { flex-wrap: wrap; }
.builder__preview .chartcard__titles { flex: 1 1 260px; min-width: 0; }
.builder__preview .tabs { flex-wrap: nowrap; white-space: nowrap; }
.charttype { position: relative; cursor: pointer; }
.charttype input { position: absolute; opacity: 0; }
.charttype > span { display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; border: 1px solid var(--rule-strong); border-radius: var(--r-control); color: var(--ink-2); text-align: center; transition: border-color 120ms, background-color 120ms; }
.charttype small { font-size: 11px; line-height: 1.2; hyphens: auto; }
.charttype:hover > span { border-color: #b3bac6; }
.charttype input:checked + span { border-color: var(--stamp); background: var(--stamp-wash); color: var(--stamp-deep); box-shadow: 0 0 0 1px var(--stamp); }
.charttype input:focus-visible + span { box-shadow: var(--focus); }
.tabradio { position: relative; cursor: pointer; }
.tabradio input { position: absolute; opacity: 0; }
.tabradio span { display: block; padding: 6px 12px; border-radius: 8px; font-size: var(--t-sm); color: var(--ink-2); font-weight: 500; }
.tabradio input:checked + span { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.tabradio input:focus-visible + span { box-shadow: var(--focus); }
.tabs--sm a { padding: 4px 9px; font-size: 12px; }

.kind--number { background: var(--info-wash); color: var(--info); }
.kind--date { background: var(--due-wash); color: var(--due); }
.kind--text { background: #eef0f4; color: var(--ink-2); }
.colchips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.colchip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border: 1px solid var(--rule); border-radius: 999px; font-size: var(--t-sm); }

/* ================= Recherche en langage naturel ================= */
.ask { position: relative; z-index: 5; max-width: 820px; margin: var(--s4) auto var(--s5); text-align: center; display: grid; gap: var(--s3); justify-items: center; }
.ask .eyebrow { display: inline-flex; align-items: center; gap: 6px; }
.ask__form { position: relative; width: 100%; display: flex; gap: var(--s2); align-items: center; padding: 6px 6px 6px 16px; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: 14px; box-shadow: var(--shadow-md); margin-top: var(--s2); transition: border-color 120ms, box-shadow 120ms; }
.ask__form:focus-within { border-color: var(--stamp); box-shadow: 0 0 0 4px var(--stamp-wash), var(--shadow-md); }
.ask__form > svg { color: var(--stamp); flex: none; }
.ask__form input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: var(--t-md); height: 44px; }
.ask__form input:focus-visible { box-shadow: none; }
.ask__chips { display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; margin-top: var(--s2); }
.chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--sheet); border: 1px solid var(--rule); font-size: var(--t-sm); color: var(--ink-2); text-decoration: none; transition: border-color 120ms, color 120ms; }
.chip:hover { border-color: var(--stamp); color: var(--stamp-deep); }
.answer { max-width: 820px; margin: 0 auto; padding: var(--s5); border-color: var(--stamp-line); background: linear-gradient(180deg, var(--stamp-wash), var(--sheet) 70%); }
.answer__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--s3); }
.answer__head h2 { font-size: var(--t-md); font-weight: 650; }
.answer__icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #14b8a6, var(--stamp-deep)); }
.answer__mode { margin-left: auto; font-size: var(--t-xs); color: var(--ink-3); }
.answer__text { font-size: 1.125rem; line-height: 1.55; color: var(--ink); }
.answer__sources { margin-top: var(--s3); font-size: var(--t-xs); color: var(--ink-3); display: flex; gap: 4px; align-items: center; }
.cite { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin: 0 1px; border-radius: 6px; background: var(--stamp); color: #fff; font-size: 11px; font-weight: 700; text-decoration: none; vertical-align: 2px; }
.cite:hover { background: var(--stamp-deep); }
.hits { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); max-width: 820px; }
.section:has(> .hits) { max-width: 820px; margin-left: auto; margin-right: auto; }
.hit { display: grid; grid-template-columns: 28px minmax(0, 1fr) 64px; gap: var(--s3); align-items: start; padding: var(--s4); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-xs); scroll-margin-top: 90px; }
.hit:target { border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-wash); }
.hit__num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--sheet-2); color: var(--ink-3); border: 1px solid var(--rule); }
.hit__num.is-cited { background: var(--stamp); color: #fff; border-color: var(--stamp); }
.hit__meta { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; font-size: var(--t-xs); color: var(--ink-3); margin-bottom: 4px; }
.hit__exact { display: inline-flex; align-items: center; gap: 3px; color: var(--paid); font-weight: 600; }
.hit__title { font-weight: 650; text-decoration: none; color: var(--ink); }
.hit__title:hover { color: var(--stamp); }
.hit__text { font-size: var(--t-sm); color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.hit__score { height: 6px; border-radius: 3px; background: #e8ebf2; overflow: hidden; margin-top: 10px; }
.hit__score i { display: block; height: 100%; background: linear-gradient(90deg, #14b8a6, var(--stamp)); border-radius: 3px; }
.kind--summary { background: var(--stamp-wash); color: var(--stamp-deep); }
.kind--client { background: var(--paid-wash); color: var(--paid); }
.kind--invoice { background: var(--due-wash); color: var(--due); }
.kind--shipment { background: var(--info-wash); color: var(--info); }
.kind--payment { background: #e9f6f3; color: #136f63; }
.kind--document { background: #eef0f4; color: var(--ink-2); }
.calc { margin-bottom: var(--s4); border-color: #c7dff0; background: linear-gradient(180deg, var(--info-wash), var(--sheet) 60%); }
.calc .answer__icon { background: linear-gradient(135deg, #2a78d6, #1d5f8f); }
.calc .answer__text { font-weight: 550; }
.calc__chart { padding: var(--s4) 0 0; }
.calc__rows { margin-top: var(--s4); border: 1px solid var(--rule); border-radius: var(--r-control); overflow: hidden; background: var(--sheet); }
.calc__rows .table td:first-child { padding-left: var(--s4); }
.calc__rows .table td:last-child { padding-right: var(--s4); }
.calc__more { padding: var(--s2) var(--s4); border-top: 1px solid var(--rule); }
.calc__foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s4); }
.exact { max-width: 820px; margin-left: auto; margin-right: auto; }
.exact summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.exact summary::-webkit-details-marker { display: none; }

/* ================= Notifications ================= */
.bell { position: relative; }
.bell summary { list-style: none; }
.bell summary::-webkit-details-marker { display: none; }
.bell__btn { position: relative; }
.bell__count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--late); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--paper); }
.bell__count[hidden] { display: none; }
.bell__panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(380px, 92vw); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet); box-shadow: var(--shadow-lg); overflow: hidden; }
.bell__head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--rule); font-size: var(--t-sm); }
.bell__head .linklike { font-size: var(--t-xs); }
.bell__item { display: flex; gap: 10px; padding: 11px 14px; text-decoration: none; border-bottom: 1px solid var(--rule); }
.bell__item:hover { background: var(--sheet-2); }
.bell__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: transparent; }
.bell__item.is-unread .bell__dot { background: var(--stamp); }
.bell__item--urgent.is-unread .bell__dot { background: var(--late); }
.bell__item--warning.is-unread .bell__dot { background: var(--age-1); }
.bell__text { display: grid; min-width: 0; }
.bell__title { font-size: var(--t-sm); color: var(--ink-2); }
.bell__item.is-unread .bell__title { color: var(--ink); font-weight: 600; }
.bell__when { font-size: 12px; color: var(--ink-3); }
.bell__empty { display: flex; gap: 8px; align-items: center; padding: 18px 14px; color: var(--ink-3); font-size: var(--t-sm); margin: 0; }
.bell__empty svg { color: var(--paid); }
.bell__foot { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--sheet-2); font-size: var(--t-xs); }
.bell__foot a { color: var(--stamp); font-weight: 600; text-decoration: none; }
.notiflist { list-style: none; margin: 0; padding: 0; }
.notiflist li + li { border-top: 1px solid var(--rule); }
.notif { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: var(--s4) var(--s5); text-decoration: none; }
.notif:hover { background: var(--sheet-2); }
.notif__icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--stamp-wash); color: var(--stamp); }
.notif--warning .notif__icon { background: var(--due-wash); color: var(--due); }
.notif--urgent .notif__icon { background: var(--late-wash); color: var(--late); }
.notif__body { display: grid; gap: 2px; min-width: 0; }
.notif__title { color: var(--ink-2); }
.notif.is-unread .notif__title { color: var(--ink); font-weight: 650; }
.notif__text { font-size: var(--t-sm); color: var(--ink-2); }
.notif__meta { font-size: var(--t-xs); color: var(--ink-3); }
.notif__new { font-size: 11px; font-weight: 700; color: var(--stamp); background: var(--stamp-wash); padding: 2px 8px; border-radius: 999px; }
.notifprefs td:first-child { min-width: 260px; }
.notifprefs__label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.notifprefs__label svg { color: var(--ink-3); }

/* ================= Responsive ================= */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder { grid-template-columns: minmax(0, 1fr); }
  .builder__preview { position: static; order: -1; }
  .rolecards, .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout { grid-template-columns: 1fr; }
  .subnav { position: static; display: flex; overflow-x: auto; gap: 4px; padding-bottom: 2px; scrollbar-width: none; }
  .subnav a { white-space: nowrap; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-100%); transition: transform 220ms cubic-bezier(.2,.7,.2,1); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 41, .4); backdrop-filter: blur(2px); }
  .sidebar .sidebar__close { display: grid; }
  .sidenav a[aria-current="page"]::before { display: none; }
  .appbar__menu, .appbar__brand { display: grid; }
  .appbar__menu { color: var(--ink-2); }
  .appbar__brand .logo { width: 28px; height: 28px; }
  .split, .review, .settings-grid, .detail-grid, .chartgrid { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .viewer { position: static; }
  .viewer img { max-height: 70vh; }
  .match { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .appbar { padding: 0 var(--s3); gap: 6px; height: 58px; }
  .appsearch, .appbar__sep, .account__name, .account__btn > svg, .appbar__upload span { display: none; }
  .appbar__searchbtn { display: grid; }
  .appbar__end { gap: 4px; }
  .modepill { width: 32px; padding: 0; justify-content: center; }
  .modepill span { display: none; }
  .appbar__upload { width: 38px; padding: 0; }
  .account__btn { padding: 2px; }
  .account__panel, .bell__panel { position: fixed; left: var(--s3); right: var(--s3); top: 62px; width: auto; }
  .ledger__amount { font-size: var(--t-md); }
  .ledger__item { padding: var(--s3); }
  .page { padding: var(--s5) var(--s4) var(--s7); }
  .flash, .modebar__inner { padding-left: var(--s4); padding-right: var(--s4); }
  .hero { padding: var(--s5); border-radius: var(--r-sheet); }
  .ledger__legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: 1fr; }
  .rolecards, .plans, .modules, .form-grid, .choices { grid-template-columns: 1fr; }
  .phone { grid-template-columns: minmax(0, 120px) minmax(0, 1fr); }
  .hit { grid-template-columns: 26px minmax(0, 1fr); }
  .hit__score { display: none; }
  .ask__form input { font-size: var(--t-base); }
  .answer__mode { margin-left: 0; flex-basis: 100%; }
  .chart { padding: var(--s3) var(--s4) var(--s4); }
  .chartcard__head { padding: var(--s3) var(--s4) 0; }
  .charttypes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workrow { padding: var(--s3) var(--s4); }
  .workrow__title { white-space: normal; }
  .table--stack thead { display: none; }
  .table--stack tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s3); row-gap: 6px; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); }
  .table--stack tbody tr:last-child { border-bottom: 0; }
  .table--stack td, .table--stack td:first-child, .table--stack td:last-child { padding: 0; border: 0; grid-column: 1; }
  .table--stack td.num { grid-column: 2; grid-row: 1; align-self: start; }
  .table--stack td.hide-sm { display: none; }
  .search input, .search { width: 100%; }
  .auth { grid-template-columns: 1fr; }
  .auth__side { padding: var(--s5) var(--s4); }
  .auth__steps, .auth__stats, .auth__lead { display: none; }
  .auth--fit { grid-template-rows: auto minmax(0, 1fr); }
  .auth--fit .auth__side { padding: var(--s4); }
  .hide-sm { display: none; }
  .table td, .table th { padding-left: var(--s3); padding-right: var(--s3); }
  .dropzone { flex-wrap: wrap; }
  .dropzone__text { flex-basis: calc(100% - 70px); }
  .review-actions { flex-wrap: wrap; }
  .review-actions .hint { flex-basis: 100%; }
  .review-actions form:last-child { flex: 1; }
  .review-actions form:last-child .btn { width: 100%; }
  .section-head .hint { display: none; }
  .alertrow { grid-template-columns: 32px minmax(0, 1fr); padding: var(--s3) var(--s4); }
  .alertrow__fb, .alertrow__done { grid-column: 2; }
  .meta-form { grid-template-columns: 1fr; }
  .track { grid-auto-flow: row; grid-auto-columns: auto; gap: 0; }
  .track li { padding: 0 0 10px 24px; }
  .track li::before { top: 0; bottom: 0; left: 5px; right: auto; width: 3px; height: auto; }
  .track li::after { top: 2px; }
  .track--mini { display: none; }
  .checkstep { grid-template-columns: 40px minmax(0, 1fr); }
  .checkstep .btn { grid-column: 2; justify-self: start; }
  .auditlist li { grid-template-columns: 32px minmax(0, 1fr); }
  .auditlist time { grid-column: 2; }
  .matrix th:first-child, .matrix td:first-child { padding-left: var(--s4); }
}

/* Modale de confirmation */
.modal { border: 0; padding: 0; background: transparent; max-width: calc(100vw - 32px); width: 440px; color: var(--ink); }
.modal::backdrop { background: rgba(15, 23, 41, 0.45); }
.modal[open] { animation: modal-in 140ms ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal__box { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-sheet, 14px); box-shadow: var(--shadow-lg); padding: var(--s5, 24px); display: grid; gap: var(--s3); }
.modal__title { font-size: var(--t-lg, 18px); font-weight: 650; line-height: 1.3; margin: 0; }
.modal__text { margin: 0; color: var(--ink-2); font-size: var(--t-sm); line-height: 1.5; }
.modal__actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
@media (max-width: 480px) { .modal__actions { flex-direction: column-reverse; } .modal__actions .btn { width: 100%; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }
.modal .btn--danger { background: var(--late); color: #fff; border-color: var(--late); }
.modal .btn--danger:hover { filter: brightness(0.92); background: var(--late); }

/* Filtres de liste : période + recherche dans le même formulaire */
.filters { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.filters .select, .filters .input { height: 40px; }
.filters .search input { width: 240px; }
.datefilter { display: inline-flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.datefilter .select { width: auto; }
.datefilter__custom { display: inline-flex; gap: 6px; align-items: center; }
.datefilter__custom[hidden] { display: none; }
.datefilter__custom .input { width: 150px; }
.filter-note { margin: calc(-1 * var(--s2)) 0 var(--s3); }
@media (max-width: 760px) { .filters { width: 100%; } .filters .search, .filters .search input, .datefilter, .datefilter .select { width: 100%; } }

/* Sélecteur de mois / d'année compact */
.monthpick { display: inline-flex; gap: var(--s2); align-items: center; margin: 0; }
.monthpick .select { height: 36px; width: auto; min-width: 150px; font-size: var(--t-sm); }
.pager .monthpick .select { min-width: 170px; }

/* Espace client public */
.space { max-width: 780px; margin: 0 auto; padding: var(--s6) var(--s4) var(--s8); display: grid; gap: var(--s4); }
.space__head { display: flex; gap: var(--s4); align-items: flex-start; }
.space__head .page-title { margin: 2px 0 4px; }
.space__badge { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 20px; color: #fff; background: var(--stamp, #4f46e5); }
.space__summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.space__stat { display: grid; gap: 2px; padding: var(--s3) var(--s4); background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--rule); border-radius: 12px; color: var(--ink-2); font-size: var(--t-sm); text-decoration: none; }
.space__stat strong { color: var(--ink); font-size: var(--t-md); }
.space__stat:hover { border-color: var(--ink-3); }
.space__stat.is-ok { border-left-color: var(--paid, #16a34a); }
.space__stat.is-due { border-left-color: var(--due, #d97706); }
.space__stat.is-late { border-left-color: var(--late); }
.space__tabs { overflow-x: auto; max-width: 100%; }
.space__card { padding: var(--s4) var(--s5); }
.space__card .section-head { flex-wrap: wrap; gap: var(--s2); }
@media (max-width: 600px) {
  .space { padding-top: var(--s4); }
  .space__summary { gap: var(--s2); }
  .space__stat { padding: var(--s2) var(--s3); font-size: var(--t-xs); }
  .space__stat strong { font-size: var(--t-sm); }
  .space__card { padding: var(--s3) var(--s4); }
  .space__head .space__badge { display: none; }
}

/* Page d'un document, cabinet : rangement de la pièce */
.piece-box { border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); padding: var(--s3) var(--s4); margin-bottom: var(--s4); display: grid; gap: var(--s2); }
.piece-box__head { display: flex; gap: var(--s3); align-items: center; }
.piece-box__head > span:last-child { display: grid; gap: 2px; min-width: 0; }
.piece-box__icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--stamp-wash); color: var(--stamp); }
.piece-box__edit summary { cursor: pointer; font-size: var(--t-sm); color: var(--stamp); font-weight: 600; }
.piece-box__edit .meta-form { margin-top: var(--s3); }

/* Cabinet : relevé bancaire */
.bank-import { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border: 1px dashed var(--rule); border-radius: 12px; background: var(--sheet); }
.bank-import__icon { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--stamp-wash); color: var(--stamp); }
.bank-import__text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: var(--t-sm); }
.bank-table td { vertical-align: middle; }
.bank-table tr.is-todo td:first-child { box-shadow: inset 3px 0 0 var(--due); }
.bank-select { height: 34px; font-size: var(--t-sm); max-width: 320px; }
.bank-select.is-todo { border-color: var(--due); color: var(--due); }
@media (max-width: 760px) { .bank-import { flex-wrap: wrap; } .bank-select { max-width: 100%; } }
.piece-box.is-todo { border-color: var(--due); box-shadow: inset 3px 0 0 var(--due); }

/* Écarter un document : motif */
.reject { position: relative; }
.reject > summary { list-style: none; }
.reject > summary::-webkit-details-marker { display: none; }
.reject__menu { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 40; width: 320px; padding: var(--s3) var(--s4); background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow-lg); display: grid; gap: var(--s2); }
.reject__title { margin: 0; font-weight: 650; font-size: var(--t-sm); }
.reject__choice { display: flex; gap: var(--s2); align-items: center; font-size: var(--t-sm); }
@media (max-width: 600px) { .reject__menu { width: min(320px, calc(100vw - 32px)); } }

/* Bandeau d'action (page Cabinet : pièces à ranger) */
.notice { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); margin-bottom: var(--s4); border-radius: 12px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink-2); font-size: var(--t-sm); text-decoration: none; }
.notice strong { color: var(--ink); }
.notice--due { border-color: #f0d6a8; background: var(--due-wash, #fdf6e9); }
.notice--due svg { color: var(--due); flex: none; }
.notice__go { margin-left: auto; font-weight: 600; color: var(--due); white-space: nowrap; }
.notice:hover { border-color: var(--due); }

/* Clients : plafond de crédit et verdict « livrer à crédit ? » */
.limitbar { display: block; width: 140px; height: 6px; border-radius: 99px; background: var(--rule); overflow: hidden; }
.limitbar i { display: block; height: 100%; background: var(--paid); border-radius: 99px; }
.limitbar.is-near i { background: var(--due); }
.limitbar.is-over i { background: var(--late); }
.limitbar + .cell-sub { margin-top: 4px; }
.credit-verdict { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); margin-bottom: var(--s4); border-radius: 12px; border: 1px solid var(--rule); font-size: var(--t-sm); background: var(--sheet); }
.credit-verdict.is-ok { border-color: #b7e2cb; background: var(--paid-wash, #eefaf3); }
.credit-verdict.is-no { border-color: #f1c4be; background: var(--late-wash, #fdf0ee); }
.credit-verdict__icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--sheet); }
.credit-verdict.is-ok .credit-verdict__icon { color: var(--paid); }
.credit-verdict.is-no .credit-verdict__icon { color: var(--late); }
.client-form { padding: var(--s4); }

/* Fichier importé reconnu (liste de factures ou de clients) */
.ingest { border-color: var(--stamp); }
.ingest .card__body { display: grid; gap: var(--s3); font-size: var(--t-sm); }
.ingest__map { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; }
.ingest__map div { padding: 4px 10px; border: 1px solid var(--rule); border-radius: 99px; background: var(--paper, #f6f7f9); }
.ingest__map dt { display: inline; font-weight: 600; }
.ingest__map dt::after { content: " ← "; color: var(--ink-3); font-weight: 400; }
.ingest__map dd { display: inline; margin: 0; color: var(--ink-2); }
.ingest__done { display: flex; gap: var(--s2); align-items: flex-start; margin: 0; }
.ingest__done svg { color: var(--paid); flex: none; margin-top: 2px; }
/* Choix de l'offre à payer : la carte entière est le bouton radio. */
.plans { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.plan--pick { cursor: pointer; padding-top: calc(var(--s5) + 4px); }
.plan--pick:hover { border-color: var(--stamp-line); }
.plan__radio { position: absolute; top: var(--s4); right: var(--s4); width: 18px; height: 18px; margin: 0; accent-color: var(--stamp); }
.plan--pick:has(.plan__radio:checked) { border-color: var(--stamp); box-shadow: 0 0 0 3px var(--stamp-wash); }
.modebar.is-expired { background: var(--due-wash); color: var(--due); border-bottom-color: #f3dcb0; }
.modebar__link { margin-left: auto; font-weight: 650; color: inherit; }

/* Automatisations : règles en phrase, éditeur « quand / si / alors ». */
.rulerow { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); }
.rulerow.is-off { opacity: .55; }
.rulerow__main { flex: 1; min-width: 0; display: grid; gap: 2px; text-decoration: none; color: inherit; }
a.rulerow__main:hover .workrow__title { color: var(--stamp); }
.rule-sentence { font-size: var(--t-sm); color: var(--ink-2); }
.rule-sentence b { color: var(--stamp-deep); font-weight: 650; }
.secret { font-size: var(--t-xs); color: var(--ink-3); }
.secret summary { cursor: pointer; width: max-content; }
.secret code { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: var(--r-chip); background: var(--sheet-2); border: 1px solid var(--rule); color: var(--ink); user-select: all; word-break: break-all; }
.rule-step { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--s3); align-items: center; }
.rule-step--top { align-items: start; }
.rule-step--top .rule-step__word { padding-top: 10px; }
.rule-step__word { font-weight: 700; color: var(--stamp-deep); text-transform: lowercase; }
.rule-step__word::first-letter { text-transform: uppercase; }
.rule-cond { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, 1fr) auto; gap: var(--s2); align-items: center; }
.rule-cond [hidden] { display: none !important; }
.rule-add { justify-self: start; margin-left: calc(64px + var(--s3)); }
.rule-stack { display: grid; gap: var(--s2); }
@media (max-width: 760px) {
  .rule-step { grid-template-columns: 1fr; }
  .rule-cond { grid-template-columns: 1fr 1fr; }
  .rule-cond [data-field] { grid-column: 1 / -1; }
  .rule-add { margin-left: 0; }
}
.codeline { display: block; padding: 8px 10px; border-radius: var(--r-chip); background: var(--sheet-2); border: 1px solid var(--rule); font-size: var(--t-xs); word-break: break-all; user-select: all; }
.codeblock { margin: 6px 0 0; padding: 10px 12px; border-radius: var(--r-chip); background: var(--night); color: var(--night-ink); font-size: 12px; overflow-x: auto; white-space: pre; }
.proof { display: block; margin-top: 4px; font-size: var(--t-xs); color: var(--ink-2); }
.proof a { color: var(--stamp); }
.proof__sig { display: block; margin-top: 6px; max-width: 220px; max-height: 90px; border: 1px solid var(--rule); border-radius: var(--r-chip); background: #fff; }
