/* =====================================================================
   Preevi · charte graphique
   Concept : un poste de travail sobre. Fond gris chaud, encre aubergine,
   une seule couleur d'accent (prune) pour ce qui fait avancer, et
   les chiffres posés en chasse fixe comme des relevés d'instrument.
   Couleur d'alerte réservée aux relances : l'ambre des balises.
   ===================================================================== */
:root {
  /* Couleurs */
  --paper: #f3f0f1;        /* fond de page */
  --surface: #fcfbfb;      /* panneaux */
  --sunk: #e9e4e6;         /* zones en creux : colonnes, champs inactifs */
  --ink: #1f1520;          /* texte principal */
  --ink-2: #4a3d4a;        /* texte secondaire */
  --muted: #5f525e;        /* légendes */
  --rule: #ddd5d9;         /* filets */
  --rule-strong: #c0b4ba;  /* bordures de champs */
  --accent: #6b2a5e;       /* accent : prune */
  --accent-ink: #521f48;
  --accent-soft: #f0e1ec;
  --on-accent: #fbf5f9;
  --signal: #8a5500;       /* balise : relances, échéances */
  --signal-soft: #f8e8c6;
  --ok: #1d7341; --ok-soft: #dcefe2;
  --err: #b3261e; --err-soft: #f7e0dd;
  --info: #24609f; --info-soft: #dde9f5;
  /* Étapes du pipeline */
  --s-inbox: #a69ba1; --s-spotted: #75696f; --s-applied: #0f7c8c; --s-interview: #3f5bb5;
  --s-offer: #b77800; --s-won: #1d7341; --s-lost: #b3261e; --s-dismissed: #a69ba1;
  /* Panneau sombre des pages de connexion (identique dans les deux thèmes) */
  --night: #261428; --night-2: #3d2140; --night-ink: #f3eaf1; --night-muted: #c3afc0; --night-line: rgba(230, 190, 225, .13);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --lift: 0 1px 0 rgba(31, 21, 32, .04), 0 6px 18px -14px rgba(31, 21, 32, .35);
  /* Typographie */
  --f-display: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --t-xs: 12px; --t-sm: 13.5px; --t-md: 15px; --t-lg: 18px; --t-xl: 24px; --t-2xl: 32px; --t-hero: clamp(40px, 6.2vw, 72px);
  /* Formes */
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #120d12; --surface: #1a131a; --sunk: #221922;
    --ink: #eee6ec; --ink-2: #c0b2bd; --muted: #9a8b97; --rule: #2f242e; --rule-strong: #423340;
    --accent: #d59bc6; --accent-ink: #e6b9da; --accent-soft: #3a2236; --on-accent: #2a0f25;
    --signal: #eeb040; --signal-soft: #33270c;
    --ok: #55c487; --ok-soft: #0e2a1a; --err: #f08a80; --err-soft: #33150f; --info: #82b4ea; --info-soft: #0f2238;
    --s-inbox: #64575f; --s-spotted: #9c8f97; --s-applied: #4cc3d1; --s-interview: #8fa5ec;
    --s-offer: #eeb040; --s-won: #55c487; --s-lost: #f08a80; --s-dismissed: #64575f;
    --night: #1a0d1c; --night-2: #2e1830;
    --lift: 0 1px 0 rgba(0, 0, 0, .25), 0 8px 22px -14px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-body); font-size: var(--t-md); line-height: 1.55; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; font-weight: 600; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
h1, h2, h3, legend { font-family: var(--f-display); letter-spacing: -.015em; line-height: 1.15; margin: 0; text-wrap: balance; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 20px 0; }
code { font-family: var(--f-mono); font-size: .9em; padding: 1px 5px; border-radius: 4px; background: var(--sunk); }
.muted { color: var(--muted); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Marque ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 800; font-size: 17px; letter-spacing: -.02em; color: var(--ink); text-decoration: none !important; }
.logo { display: block; width: 30px; height: 30px; flex: none; color: var(--accent); }
.logo .needle { fill: currentColor; }
.logo .rose { fill: none; stroke: currentColor; }
.logo .hub { fill: var(--surface); }
.brand-light .logo .hub { fill: var(--night); }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r); border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 14.5px; cursor: pointer; text-decoration: none !important; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { color: var(--on-accent); background: var(--accent); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-secondary { color: var(--ink); background: var(--surface); border-color: var(--rule-strong); }
.btn-secondary:hover { border-color: var(--ink-2); }
.btn-ghost { color: var(--ink-2); background: transparent; }
.btn-ghost:hover { background: var(--sunk); color: var(--ink); }
.btn-danger-ghost { color: var(--err); background: transparent; border-color: var(--rule); }
.btn-danger-ghost:hover { background: var(--err-soft); border-color: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 16px; }
.btn-block { width: 100%; }
.tiny-btn { height: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--r-sm); }

/* ---------- Alertes ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 20px; border-radius: var(--r); font-size: 14px; border: 1px solid transparent; }
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.alert a { color: inherit; text-decoration: underline; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-error { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }

/* ---------- Barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.topbar-inner { max-width: 1040px; margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav form { margin: 0; }
.nav-user { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 600; padding: 3px 10px 3px 3px; border-radius: 99px; }
.nav-user:hover { background: var(--sunk); text-decoration: none; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--accent); font-family: var(--f-display); font-weight: 800; font-size: 13px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.page { max-width: 1040px; margin: 0 auto; padding: 36px 24px 80px; }
.topbar-inner.wide, .page.wide { max-width: 1280px; }
.mainnav { display: flex; align-self: stretch; gap: 4px; margin-left: 24px; margin-right: auto; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; white-space: nowrap; box-shadow: inset 0 -2px 0 transparent; }
.mainnav a:hover { color: var(--ink); text-decoration: none; box-shadow: inset 0 -2px 0 var(--rule-strong); }
.mainnav a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-sm); font-family: var(--f-mono); font-size: 12px; font-weight: 600; background: var(--sunk); color: var(--ink-2); }

/* ---------- Titres de page ---------- */
.eyebrow { display: inline-block; font-family: var(--f-mono); font-size: var(--t-xs); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.page-head, .dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.dash-head { justify-content: flex-start; align-items: center; }
.page-head h1, .dash-head h1 { font-size: var(--t-2xl); font-weight: 800; }
.page-head p, .dash-head p { margin: 6px 0 0; color: var(--muted); max-width: 64ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.crumbs { font-size: var(--t-sm); color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); font-weight: 600; }
.small-link { font-size: var(--t-sm); }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 24px; border-radius: var(--r-lg); background: var(--signal-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--signal) 30%, transparent); }
.banner strong { color: var(--signal); }
.banner p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.banner form { margin: 0; }

/* ---------- Panneaux ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; min-width: 0; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 22px 24px; }
.card h2 { font-size: var(--t-lg); font-weight: 700; margin-bottom: 16px; }
.card form { margin: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); }
.empty-icon svg { width: 22px; height: 22px; }
.empty p { margin: 4px 0 14px; }
.kv { margin: 0; }
.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule); }
.kv > div:first-child { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; }
.pill-ok { color: var(--ok); background: var(--ok-soft); }
.pill-warn { color: var(--signal); background: var(--signal-soft); }

/* ---------- Instruments (chiffres clés) ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: 24px; overflow: hidden; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--rule); }
.stat { display: block; padding: 16px 20px 18px; background: var(--surface); color: var(--ink); text-decoration: none !important; }
a.stat:hover { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.stat-value { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 34px; font-weight: 500; letter-spacing: -.03em; line-height: 1.1; }
.stat-label { margin-top: 4px; color: var(--muted); font-size: var(--t-sm); }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--rule); }
.list > li:first-child { border-top: 0; padding-top: 0; }
.list > li:last-child { padding-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 700; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; }
.list .sub { color: var(--muted); font-size: var(--t-sm); overflow-wrap: anywhere; }
.list form { margin: 0; }

/* ---------- Étiquettes, score, étapes ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 700; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.tag svg { width: 12px; height: 12px; }
.tag-late { background: var(--err-soft); color: var(--err); }
.tag-today { background: var(--signal-soft); color: var(--signal); }
.tag-ok { background: var(--accent-soft); color: var(--accent-ink); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.score { --sc: var(--muted); position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; color: var(--sc); }
.score svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.score .track { fill: none; stroke: var(--rule); stroke-width: 3.2; }
.score .val { fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; }
.score b { position: relative; font-family: var(--f-mono); font-size: 11.5px; font-weight: 600; color: var(--ink); }
.score-high { --sc: var(--accent); }
.score-mid { --sc: var(--signal); }
.score-low { --sc: var(--s-spotted); }
.st { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--s, var(--muted)); }
.st-inbox { --s: var(--s-inbox); } .st-spotted { --s: var(--s-spotted); } .st-applied { --s: var(--s-applied); }
.st-interview { --s: var(--s-interview); } .st-offer { --s: var(--s-offer); } .st-won { --s: var(--s-won); }
.st-lost { --s: var(--s-lost); } .st-dismissed { --s: var(--s-dismissed); }

/* Route du pipeline : chaque étape est un point sur une même ligne */
.stages { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stage { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 22px 8px 4px 0; color: var(--ink); text-decoration: none !important; }
.stage::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--rule-strong); }
.stage:last-child::before { right: auto; width: 14px; }
.stage::after { content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--s, var(--muted)); }
.stage b { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 26px; font-weight: 500; line-height: 1.1; }
.stage span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stage:hover span { color: var(--ink); }

/* ---------- Tableau du pipeline ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x proximity; }
.lane { min-width: 0; display: flex; flex-direction: column; scroll-snap-align: start; }
.lane-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px; margin-bottom: 10px; border-bottom: 2px solid var(--s, var(--rule-strong)); }
.lane-head .st { color: var(--ink); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.lane-cards { display: grid; align-content: start; gap: 10px; flex: 1; min-height: 220px; padding: 8px; border-radius: var(--r-lg); background: var(--sunk); }
.opp { min-width: 0; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 12px 10px; box-shadow: var(--lift); }
.opp:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.opp-title { display: block; font-weight: 700; color: var(--ink); line-height: 1.35; margin-bottom: 4px; }
.opp-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; margin-bottom: 10px; }
.opp-meta .num { color: var(--ink-2); }
.opp-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.opp-foot form { flex: 1 1 110px; display: flex; justify-content: flex-end; margin: 0; }
.move { width: 100%; max-width: 150px; height: 30px; padding: 0 6px; border-radius: var(--r-sm); border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12.5px; }
.lane-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 6px; border: 1px dashed var(--rule-strong); border-radius: var(--r); }

/* ---------- Annonces à trier ---------- */
.feed-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.feed-item p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; max-width: 75ch; }
.feed-item .actions { justify-content: flex-end; }
.feed-list { display: grid; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); }
.feed-list .feed-item { padding: 18px 22px; border-top: 1px solid var(--rule); }
.feed-list .feed-item:first-child { border-top: 0; }

/* ---------- Formulaires ---------- */
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.fgrid .full { grid-column: 1 / -1; }
.f label, .field label, .label-row label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.f input[type=text], .f input[type=password], .f input[type=url], .f input[type=email], .f input[type=tel], .f input[type=date], .f input[type=number], .f select, .f textarea, .inline-input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--rule-strong); border-radius: var(--r); font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.f textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.f textarea.tall { min-height: 280px; }
.f input:hover, .f select:hover, .f textarea:hover { border-color: var(--ink-2); }
.f input:focus, .f select:focus, .f textarea:focus, .inline-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; font-size: var(--t-lg); margin-bottom: 14px; padding: 0; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form .inline-input { width: auto; flex: 1; min-width: 160px; min-height: 34px; padding: 5px 10px; font-size: 14px; }

/* ---------- Fiche mission ---------- */
.prose { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); font-size: 14.5px; line-height: 1.6; margin: 0; max-width: 75ch; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 4px 16px; padding: 0 0 16px; }
.timeline li::before { content: ""; position: absolute; left: 118px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 121px; top: 18px; bottom: 2px; width: 1px; background: var(--rule); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-family: var(--f-mono); font-size: 12px; color: var(--muted); padding-top: 2px; }
.timeline .what { white-space: pre-wrap; font-size: 14px; padding-left: 14px; overflow-wrap: anywhere; }
.timeline .k-status::before { background: var(--rule-strong); }
.draft { border-color: color-mix(in srgb, var(--accent) 40%, var(--rule)); }
.draft textarea { background: color-mix(in srgb, var(--accent-soft) 30%, var(--surface)); }
.ai { display: inline-flex; align-items: center; gap: 8px; }
.ai svg { width: 18px; height: 18px; color: var(--accent); }
.next-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--rule); }
.next-box strong { display: inline-flex; align-items: center; gap: 6px; }
.next-box svg { width: 16px; height: 16px; }
.next-box.late { background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.next-box.late strong { color: var(--err); }
.next-box.today { background: var(--signal-soft); border-color: color-mix(in srgb, var(--signal) 30%, transparent); }
.next-box.today strong { color: var(--signal); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: center; }
.checklist .dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--rule-strong); font-family: var(--f-mono); font-size: 12px; flex: none; }
.checklist .done .dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.checklist .done a { color: var(--muted); text-decoration: line-through; }
details > summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-family: var(--f-mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 0 10px 10px; }
.table td { padding: 12px 10px; border-top: 1px solid var(--rule); vertical-align: middle; }
.table-wrap { overflow-x: auto; }

/* ---------- Accueil ---------- */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: center; padding: 40px 0 56px; }
.home-hero h1 { font-size: clamp(40px, 4.4vw, 56px); font-weight: 800; letter-spacing: -.035em; line-height: .98; margin: 16px 0 22px; }
.home-hero h1 em { display: block; font-style: normal; color: var(--accent); }
.lead { font-size: var(--t-lg); color: var(--ink-2); margin: 0 0 30px; max-width: 34em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.bearing { position: relative; padding: 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--lift); }
.bearing-label { position: absolute; top: -11px; left: 20px; padding: 2px 8px; border-radius: var(--r-sm); background: var(--paper); border: 1px solid var(--rule); font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bearing .opp { box-shadow: none; }
.bearing .opp + .opp { margin-top: 10px; }
.bearing-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--rule-strong); font-size: 13px; color: var(--muted); }
.bearing-foot b { color: var(--signal); font-family: var(--f-mono); font-weight: 600; }
.bearing-pv { display: grid; gap: 14px; padding: 4px 2px 18px; margin-bottom: 16px; border-bottom: 1px dashed var(--rule-strong); }
.bearing-pv .pv-big { margin-bottom: 6px; }
.bearing-pv .pv-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bearing-pv .pv-legend dt { font-size: 12.5px; white-space: nowrap; }
.bearing-next { margin-bottom: 8px; }
.home-part { padding: 36px 0 20px; border-top: 1px solid var(--rule); }
.home-part-head h2 { font-size: var(--t-2xl); letter-spacing: -.025em; margin: 8px 0 6px; }
.home-part-head p { margin: 0; color: var(--ink-2); max-width: 46em; }
.home-part .route { border-top: 0; padding-top: 26px; }
.route { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 32px 0 8px; border-top: 1px solid var(--rule); }
.route-step { position: relative; padding: 30px 24px 0 0; }
.route-step::before { content: ""; position: absolute; top: 8px; left: 0; right: 0; height: 2px; background: var(--rule-strong); }
.route-step:last-child::before { right: auto; width: 18px; }
.route-step::after { content: ""; position: absolute; top: 1px; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 3px solid var(--accent); }
.route-step .eyebrow { margin-bottom: 8px; }
.route-step h3 { font-size: var(--t-lg); margin-bottom: 6px; }
.route-step p { margin: 0; color: var(--ink-2); font-size: 14.5px; max-width: 30ch; }

/* ---------- Pages d'authentification ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.showcase { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px 48px; color: var(--night-ink); background: var(--night); }
/* Cercles concentriques et quadrillage du panneau de connexion */
.showcase::before { content: ""; position: absolute; inset: -20%; background:
  repeating-radial-gradient(circle at 78% 72%, transparent 0 34px, var(--night-line) 34px 35px),
  radial-gradient(circle at 78% 72%, var(--night-2), transparent 60%); }
.showcase::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--night-line) 1px, transparent 1px), linear-gradient(90deg, var(--night-line) 1px, transparent 1px); background-size: 120px 120px; opacity: .5; }
.showcase > * { position: relative; z-index: 1; }
.brand-light { color: var(--night-ink); }
.brand-light .logo { color: #e2a8d3; }
.showcase-copy { max-width: 440px; }
.showcase h2 { font-size: clamp(30px, 3.4vw, 44px); font-weight: 800; letter-spacing: -.03em; margin-bottom: 16px; }
.showcase-copy > p { font-size: 16.5px; color: var(--night-muted); margin: 0 0 28px; }
.perks { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.perks li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.perk-icon { display: block; width: 10px; height: 10px; flex: none; border-radius: 50%; border: 2px solid #e2a8d3; }
.showcase-foot { margin: 0; font-family: var(--f-mono); font-size: 12px; letter-spacing: .04em; color: var(--night-muted); }
.panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; background: var(--surface); }
.panel-inner { width: 100%; max-width: 400px; }
.brand-mobile { display: none; }
.form-head { margin-bottom: 28px; }
.form-head h1, .state h1 { font-size: 30px; font-weight: 800; margin-bottom: 8px; }
.form-head p, .state p { margin: 0; color: var(--muted); }
.form { display: grid; gap: 18px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.input-wrap { position: relative; }
.input-icon { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-wrap input { width: 100%; height: 46px; padding: 0 44px 0 40px; border: 1px solid var(--rule-strong); border-radius: var(--r); font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.input-wrap input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input-wrap input:hover { border-color: var(--ink-2); }
.input-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input-wrap:focus-within .input-icon { color: var(--accent); }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer; }
.eye:hover, .eye.on { color: var(--ink); background: var(--sunk); }
.eye svg { width: 18px; height: 18px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.switch { margin: 24px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.state { text-align: center; }
.state-icon { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 20px; border-radius: 50%; font-size: 26px; color: var(--accent); background: var(--accent-soft); }
.state p { margin-bottom: 24px; }
.state .switch { margin-top: 18px; margin-bottom: 0; }

/* ---------- Écrans moyens et petits ---------- */
@media (max-width: 980px) {
  .cols { grid-template-columns: 1fr; }
  .home-hero { grid-template-columns: 1fr; gap: 40px; padding-top: 16px; }
  .route { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 28px; }
  .route-step:nth-child(2)::before { right: auto; width: 18px; }
}
@media (max-width: 880px) {
  .split { grid-template-columns: 1fr; }
  .showcase { display: none; }
  .panel { justify-content: flex-start; padding-top: 28px; }
  .brand-mobile { display: inline-flex; align-self: flex-start; margin-bottom: 40px; }
}
@media (max-width: 760px) {
  .topbar-inner.wide { height: auto; flex-wrap: wrap; padding-top: 10px; row-gap: 4px; }
  .mainnav { order: 3; width: 100%; margin: 0 -12px; height: 42px; }
  .fgrid { grid-template-columns: 1fr; }
  .feed-item { grid-template-columns: auto minmax(0, 1fr); }
  .feed-item .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .board { grid-auto-columns: 82%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; }
  .stage:nth-child(3)::before { right: auto; width: 14px; }
  .timeline li { grid-template-columns: 1fr; }
  .timeline li::before { left: 0; top: 24px; }
  .timeline li::after { left: 3px; top: 34px; }
}
@media (max-width: 560px) {
  .topbar-inner { padding: 0 16px; }
  .topbar-inner.wide { padding-top: 10px; }
  .nav .btn-ghost { display: none; }
  .nav-user span:not(.avatar) { display: none; }
  .page { padding: 24px 16px 60px; }
  .page-head h1, .dash-head h1 { font-size: 26px; }
  .card { padding: 18px; }
  .route { grid-template-columns: 1fr; }
  .route-step::before { display: none; }
  .home-hero h1 { font-size: 42px; }
}

/* Icônes réutilisées hors des champs */
.empty-icon .input-icon, .state-icon .input-icon { position: static; transform: none; color: inherit; }
.state-icon svg { width: 26px; height: 26px; }

/* ---------- Connecteur Claude ---------- */
.consent { max-width: 560px; margin: 24px auto 0; }
.consent h1 { font-size: 26px; margin: 10px 0 12px; }
.consent h2 { font-size: 16px; margin: 22px 0 8px; }
.consent-list { margin: 0 0 18px; padding-left: 20px; }
.consent-list li { margin: 4px 0; }
.copy-field { margin: 14px 0 20px; }
.copy-field input { width: 100%; padding: 10px 12px; font-family: var(--f-mono); font-size: 14px; color: var(--ink); background: var(--sunk); border: 1px solid var(--rule-strong); border-radius: var(--r); }
#claude h3 { margin: 0 0 4px; font-size: 16px; }
.connections { list-style: none; margin: 8px 0 0; padding: 0; }
.connections li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--rule); }
.connections form { margin: 0; }
.notice { padding: 12px 16px; margin-bottom: 18px; border-radius: var(--r-lg); background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }

/* ---------- Barre d'onglets (téléphone) ---------- */
.tabbar { display: none; }
@media (max-width: 760px) { .topbar-inner:not(.wide) .mainnav { display: none; } }
@media (max-width: 760px) {
  body.app:has(.tabbar) .mainnav { display: none; }
  body.app:has(.tabbar) .topbar-inner.wide { height: 56px; flex-wrap: nowrap; padding-top: 0; }
  body.app:has(.tabbar) .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .topbar { padding-top: env(safe-area-inset-top); }
  .tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--rule); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px; min-height: 48px; color: var(--muted); font-size: 11.5px; font-weight: 600; border-radius: var(--r); -webkit-tap-highlight-color: transparent; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a.on { color: var(--accent); }
  .tabbar a.on svg { stroke-width: 2.2; }
  .tabbar .tab-add svg { width: 40px; height: 32px; padding: 4px 8px; margin-bottom: -2px; border-radius: 99px; background: var(--accent); stroke: var(--on-accent); stroke-width: 2.4; }
  .tabbar .tab-add { color: var(--ink); }
}
@media (display-mode: standalone) {
  .topbar .nav form { display: none; }
}

/* Évaluation d'une mission (note sur 5, inspirée de Career-Ops) */
.grade { --g: var(--s-spotted); --g-soft: var(--sunk); display: inline-flex; align-items: baseline; gap: 6px; padding: 2px 8px; border-radius: var(--r-sm); background: var(--g-soft); color: var(--g); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.grade b { font-family: var(--f-mono); font-weight: 600; }
.grade-apply { --g: var(--ok); --g-soft: var(--ok-soft); }
.grade-maybe { --g: var(--signal); --g-soft: var(--signal-soft); }
.grade-lg { padding: 6px 12px; font-size: var(--t-md); }
.grade-lg b { font-size: var(--t-xl); }
.eval-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.eval-head p { margin: 0; }
.eval h3 { font-size: var(--t-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-family: var(--f-mono); font-weight: 600; margin: 18px 0 8px; }
.reqs { list-style: none; margin: 0; padding: 0; }
.reqs li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--rule); }
.reqs li:first-child { border-top: 0; }
.reqs .cov { grid-row: span 2; align-self: start; }
.reqs .req-what { font-weight: 600; }
.reqs .req-what small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.reqs .req-proof { color: var(--ink-2); font-size: var(--t-sm); }
.cov-couvert { background: var(--ok-soft); color: var(--ok); }
.cov-partiel { background: var(--signal-soft); color: var(--signal); }
.cov-manquant { background: var(--err-soft); color: var(--err); }
.eval ul.plain { margin: 0; padding-left: 18px; }
.eval ul.plain li { margin: 4px 0; }
.reqs li { grid-template-columns: 84px 1fr; }
.reqs .cov { justify-self: start; }
.eval .kv dd { font-weight: 400; text-align: left; flex: 1 1 60%; }
.eval .kv dt { flex: 0 0 auto; min-width: 96px; }
.eval > .actions { margin-top: 16px; }
@media (max-width: 600px) {
  .reqs li { grid-template-columns: 1fr; }
  .reqs .cov { grid-row: auto; }
  .eval .kv > div { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ---------- Espaces : prospection et prévisionnel ---------- */
.apps { display: inline-flex; flex: none; gap: 2px; padding: 3px; margin-left: 18px; border-radius: 99px; background: var(--sunk); }
.apps a { padding: 4px 12px; border-radius: 99px; font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.apps a:hover { color: var(--ink); text-decoration: none; }
.apps a.on { color: var(--accent-ink); background: var(--surface); box-shadow: 0 1px 2px rgba(31, 21, 32, .14); }
.apps + .mainnav { margin-left: 10px; }
@media (max-width: 760px) {
  .apps { margin-left: auto; }
  body.app:has(.tabbar) .nav { margin-left: 4px; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
  .apps { margin-left: 0; }
}

/* ---------- Prévisionnel ----------
   Le prévisionnel répond d'abord à « combien me reste-t-il ? » : un grand
   chiffre, puis une barre qui découpe le chiffre d'affaires HT en ce qui
   reste, l'impôt et les charges. Chaque facture montre son état sur trois
   étapes (prévu, facturé, payé) ; l'année se lit sur un graphique en colonnes.
   Couleurs du découpage vérifiées pour les daltonismes (légende chiffrée
   toujours affichée à côté). */
:root {
  --pv-kept: #6b2a5e;
  --pv-tax: #d4a6c8;
  --pv-charges: #7a6e76;
  --pv-hatch: color-mix(in srgb, var(--surface) 55%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root { --pv-kept: #e0a9d2; --pv-tax: #7c3f6f; --pv-charges: #8d8189; --pv-hatch: color-mix(in srgb, var(--surface) 50%, transparent); }
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* En-tête : le titre est encadré par ses flèches, comme un agenda */
.pv-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.pv-head-main { min-width: 0; }
.pv-head h1 { font-size: var(--t-2xl); font-weight: 800; }
.pv-lede { margin: 8px 0 0; color: var(--muted); max-width: 64ch; }
.pv-stepper { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pv-stepper h1 { min-width: 0; padding: 0 4px; }
.pv-step-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-2); border: 1px solid var(--rule-strong); background: var(--surface); text-decoration: none !important; }
.pv-step-btn:hover { color: var(--accent); border-color: var(--accent); }
.pv-step-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pv-today { margin-left: 8px; font-size: var(--t-sm); }
.pv-eq { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.pv-eq b { color: var(--ink); font-weight: 600; }
.pv-eq i { font-style: normal; color: var(--rule-strong); font-weight: 700; }
.pv-eq .is-result { padding: 1px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.pv-eq .is-result b { color: inherit; }
.pv-section-title { display: flex; align-items: center; gap: 8px; font-size: var(--t-lg); margin: 4px 0 14px; }
.pv-section-title:not(:first-of-type) { margin-top: 32px; }

/* Résumé : ce qui reste, comment le HT se découpe, ce qui est encaissé */
.pv-summary { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr) minmax(0, .7fr); gap: 0; margin-bottom: 24px; border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--surface); }
.pv-summary > * { min-width: 0; padding: 22px 24px; }
.pv-summary > * + * { border-left: 1px solid var(--rule); }
.pv-k { display: block; font-size: var(--t-sm); font-weight: 600; color: var(--muted); }
.pv-big { display: block; margin: 6px 0 8px; font-family: var(--f-display); font-size: clamp(34px, 4vw, 46px); font-weight: 800; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent-ink); white-space: nowrap; }
.pv-hero-sub { display: block; color: var(--ink-2); font-size: 14px; }
.pv-hero-sub b { font-weight: 600; color: var(--ink); }
.pv-split { display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.pv-bar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--sunk); }
.pv-bar > span { flex: 0 0 auto; width: calc(var(--w) * .1%); min-width: 3px; }
.pv-bar.is-empty { background: repeating-linear-gradient(135deg, var(--sunk) 0 6px, transparent 6px 10px); border: 1px dashed var(--rule-strong); }
.pv-split-empty { margin: 0; color: var(--muted); font-size: 14px; }
.seg-kept { background: var(--pv-kept); }
.seg-tax { background: var(--pv-tax); }
.seg-charges { background: var(--pv-charges); }
.sw { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 3px; }
.sw.is-projected { background: repeating-linear-gradient(135deg, var(--pv-kept) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--pv-kept); }
.pv-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px 18px; margin: 0; }
.pv-legend dt { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.pv-legend dd { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 0 17px; font-weight: 700; }
.pv-legend small { font-size: 12px; font-weight: 600; color: var(--muted); }
.pv-side { display: grid; align-content: center; gap: 16px; }
.pv-side strong { display: block; margin-top: 2px; font-family: var(--f-display); font-size: var(--t-xl); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pv-side .tag { margin-top: 6px; }

/* Facturation : une ligne par contrat, son état en trois étapes */
@media (min-width: 981px) { .pv-cols { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); } }
.pv-lines { display: grid; }
.pv-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main figs" "state state"; gap: 12px 20px; padding: 16px 0; border-top: 1px solid var(--rule); }
.pv-line:first-child { border-top: 0; padding-top: 2px; }
.pv-line-main { grid-area: main; min-width: 0; }
.pv-line h3 { font-size: 15.5px; font-weight: 700; overflow-wrap: anywhere; }
.pv-line-main p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.pv-line-main .tag { vertical-align: 1px; }
.pv-figs { grid-area: figs; display: flex; gap: 22px; margin: 0; text-align: right; }
.pv-figs dt { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pv-figs dd { margin: 2px 0 0; font-weight: 600; white-space: nowrap; }
.pv-figs div:nth-child(2) dd { font-weight: 800; }
.pv-line-state { grid-area: state; display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r); background: var(--sunk); }
.pv-line.is-due .pv-line-state { background: var(--signal-soft); }
.pv-line.is-late .pv-line-state { background: var(--err-soft); }
.pv-track { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pv-track li { --dot: var(--rule-strong); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pv-track li::before { content: ""; width: 10px; height: 10px; flex: none; border-radius: 50%; border: 2px solid var(--dot); background: var(--surface); }
.pv-track li + li { margin-left: 8px; padding-left: 28px; background: linear-gradient(var(--dot), var(--dot)) left center / 20px 2px no-repeat; }
.pv-track .is-done { --dot: var(--accent); color: var(--ink-2); }
.pv-track .is-done::before { background: var(--accent); }
.pv-track .is-now { --dot: var(--accent); color: var(--accent-ink); }
.pv-line.is-due .pv-track .is-now { --dot: var(--signal); color: var(--signal); }
.pv-track .is-now.is-late { --dot: var(--err); color: var(--err); }
.pv-track .is-done.is-last { color: var(--ok); --dot: var(--ok); }
.pv-track .is-done.is-last::before { background: var(--ok); }
.pv-line-act { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; justify-content: flex-end; }
.pv-line-act form { margin: 0; }
.pv-note { font-size: 12.5px; color: var(--ink-2); }
.pv-total { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 2px; border-top: 2px solid var(--rule-strong); font-weight: 800; }
.pv-total .pv-figs dd { font-weight: 800; }
.pv-head-total { font-weight: 800; }
.pv-cash .pv-amount { min-width: 84px; text-align: right; font-weight: 700; }
.bill { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-end; margin: 0; }
.bill input { min-height: 30px; padding: 3px 8px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--surface); }
.bill input[type=date] { width: 140px; }
.bill input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.bill-days { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.bill-days input { width: 56px; text-align: right; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--err); }
.tag-projected { background: var(--sunk); color: var(--ink-2); }
.tag-invoiced { background: var(--info-soft); color: var(--info); }
.tag-paid { background: var(--ok-soft); color: var(--ok); }
.tag-portage { background: var(--accent-soft); color: var(--accent-ink); }

/* Calendrier du mois */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { padding-bottom: 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-align: center; }
.cal-d { display: grid; place-items: center; aspect-ratio: 1 / .8; border-radius: var(--r-sm); font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent-ink); background: var(--accent-soft); text-decoration: none !important; }
.cal-weekend { color: var(--muted); font-weight: 400; background: transparent; }
.cal-holiday { color: var(--signal); background: var(--signal-soft); }
.cal-absent { color: var(--muted); font-weight: 400; background: repeating-linear-gradient(135deg, var(--sunk) 0 3px, transparent 3px 7px); text-decoration: line-through !important; }
.cal-half { color: var(--accent-ink); background: linear-gradient(135deg, var(--accent-soft) 50%, transparent 50%), repeating-linear-gradient(135deg, var(--sunk) 0 3px, transparent 3px 7px); }
.cal-out { visibility: hidden; }
.cal-today { box-shadow: inset 0 0 0 2px var(--accent); }
a.cal-d:hover { box-shadow: inset 0 0 0 1px var(--accent); }
a.cal-d.cal-today:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.legend .l-open { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.legend .l-holiday { background: var(--signal-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--signal) 30%, transparent); }
.legend .l-absent { background: repeating-linear-gradient(135deg, var(--rule-strong) 0 2px, transparent 2px 4px); }
.pv-abs-list { margin-top: 16px; }
.card-head + .pv-abs-list { margin-top: 0; }
.pv-status-fields { margin-top: 18px; }
.pv-current { padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--r-md, 10px); background: var(--paper); }
.pv-current .title { margin: 4px 0 2px; font-size: var(--t-lg); font-weight: 700; }
.pv-current .sub { margin: 0; color: var(--muted); font-size: 14px; }
.pv-change { margin-top: 16px; }
.pv-change > summary { margin-bottom: 14px; }
.pv-change:not([open]) > summary { margin-bottom: 0; }
.pv-history { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--rule); }
.pv-history h3 { margin: 0 0 8px; font-size: 1rem; }
.pv-date { display: grid; place-items: center; width: 44px; height: 46px; flex: none; border-radius: var(--r); border: 1px solid var(--rule); background: var(--surface); line-height: 1; }
.pv-date b { font-family: var(--f-display); font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pv-date small { margin-top: -6px; font-size: 11px; font-weight: 600; color: var(--muted); }
.pv-past .pv-date b { color: var(--muted); }

/* Détail du calcul */
.kv .total dt, .kv .total dd { font-weight: 800; color: var(--ink); }
.kv dd.minus { color: var(--ink-2); font-weight: 500; }
.pv-calc .total { border-top-color: var(--rule-strong); }
.pv-calc .aside { margin-top: 6px; border-top-style: dashed; }

/* Graphique de l'année : colonnes CA HT, part nette en plein */
.pv-chart-head { flex-wrap: wrap; }
.pv-key { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); }
.pv-key span { display: inline-flex; align-items: center; gap: 6px; }
.pv-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; margin: 6px 0 0; }
.pv-axis { position: relative; height: 220px; min-width: 64px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pv-axis span { position: absolute; right: 0; bottom: calc(var(--p) * .1%); transform: translateY(50%); white-space: nowrap; }
.pv-plot { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); height: 220px; margin-bottom: 28px; }
.pv-grid { position: absolute; left: 0; right: 0; bottom: calc(var(--p) * .1%); height: 1px; background: var(--rule); }
.pv-grid[style*="--p: 0"] { background: var(--rule-strong); }
.pv-col { position: relative; display: block; height: 100%; color: var(--ink); text-decoration: none !important; border-radius: var(--r-sm); }
.pv-col:hover, .pv-col:focus-visible { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.pv-col-ht, .pv-col-net { position: absolute; left: 50%; bottom: 0; width: min(62%, 34px); transform: translateX(-50%); height: calc(var(--h) * .1%); border-radius: 4px 4px 0 0; }
.pv-col-ht { background: var(--pv-charges); }
.pv-col-net { background: var(--pv-kept); box-shadow: 0 -2px 0 var(--surface); }
.pv-col.is-projected .pv-col-ht, .pv-col.is-projected .pv-col-net { background-image: repeating-linear-gradient(135deg, var(--pv-hatch) 0 3px, transparent 3px 6px); }
.pv-col-label { position: absolute; left: 0; right: 0; top: calc(100% + 8px); text-align: center; font-size: 12px; color: var(--muted); }
.pv-col.is-current .pv-col-label { color: var(--accent-ink); font-weight: 700; }
.pv-col.is-current::after { content: ""; position: absolute; left: 50%; top: calc(100% + 26px); width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.pv-tip { position: absolute; z-index: 3; bottom: calc(var(--top, 0) * .1% + 10px); left: 50%; display: none; min-width: 170px; padding: 10px 12px; transform: translateX(-50%); border-radius: var(--r); background: var(--ink); color: var(--paper); font-size: 12.5px; line-height: 1.5; box-shadow: var(--lift); pointer-events: none; }
.pv-col:hover .pv-tip, .pv-col:focus-visible .pv-tip { display: grid; }
.pv-col:nth-of-type(-n+2) .pv-tip { left: 0; transform: none; }
.pv-col:nth-last-of-type(-n+2) .pv-tip { left: auto; right: 0; transform: none; }
.pv-tip b { font-size: 13px; margin-bottom: 2px; }
.pv-tip span { display: flex; justify-content: space-between; gap: 14px; }
.pv-tip em { font-style: normal; font-weight: 700; }
.pv-tip small { opacity: .75; }
.pv-year-table { margin-top: 20px; }
.table th.r, .table td.r { text-align: right; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--rule-strong); }
.table td .sub { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
.table tr.is-current td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.table tr.is-past td:first-child a { color: var(--ink-2); }
.table tr.is-zero td { color: var(--muted); }
/* Dans le prévisionnel, les montants gardent la police du texte (chiffres
   tabulaires) : plus lisibles que la chasse fixe pour des euros. */
:is([class^="pv-"], [class*=" pv-"]) .num { font-family: var(--f-body); font-variant-numeric: tabular-nums; }
.pv-tile-body b.num, .pv-rate b.num, .pv-date b { font-family: var(--f-display); }

/* Contrats en fiches */
.pv-contracts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pv-contract { display: flex; flex-direction: column; gap: 14px; }
.pv-contract header { display: flex; align-items: flex-start; gap: 12px; }
.pv-contract h3 { font-size: var(--t-lg); font-weight: 700; overflow-wrap: anywhere; }
.pv-contract header p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.pv-contract .grow { flex: 1; min-width: 0; }
.pv-rate { margin: 0; display: flex; align-items: baseline; gap: 8px; }
.pv-rate b { font-family: var(--f-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.pv-rate span { color: var(--muted); font-size: 14px; }
.pv-facts { margin: 0; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.pv-facts > div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; font-size: 14px; }
.pv-facts dt { color: var(--muted); }
.pv-facts dd { margin: 0; font-weight: 600; }
.pv-contract footer { margin-top: auto; display: flex; justify-content: flex-end; }
.pv-ended .title { font-weight: 600; color: var(--ink-2); }

/* Formulaires du prévisionnel : intitulé à gauche, champs à droite */
.pv-settings { padding: 0; }
.pv-set { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 16px 40px; padding: 26px 28px; border-top: 1px solid var(--rule); }
.pv-set:first-child { border-top: 0; }
.pv-set-intro h2 { font-size: var(--t-lg); font-weight: 700; margin: 0; }
.pv-set-intro p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.pv-settings .form-actions { margin: 0; padding: 18px 28px; border-top: 1px solid var(--rule); background: var(--paper); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.pv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.pv-tile { position: relative; display: block; cursor: pointer; }
.pv-tile input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.pv-tile-body { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px 14px 12px 40px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--surface); font-size: 14px; font-weight: 600; line-height: 1.35; transition: border-color .15s, background .15s; }
.pv-tile-body::before { content: ""; position: absolute; left: 14px; top: 14px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rule-strong); background: var(--surface); }
.pv-tile-body b { font-family: var(--f-display); font-size: 18px; font-weight: 800; color: var(--accent-ink); }
.pv-tile-body small { font-size: 13px; font-weight: 400; color: var(--muted); }
.pv-tile:hover .pv-tile-body { border-color: var(--ink-2); }
.pv-tile input:checked + .pv-tile-body { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); box-shadow: inset 0 0 0 1px var(--accent); }
.pv-tile input:checked + .pv-tile-body::before { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 4px, var(--surface) 4.5px); }
.pv-tile input:focus-visible + .pv-tile-body { box-shadow: var(--ring); }
.pv-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.pv-pills label { position: relative; cursor: pointer; }
.pv-pills input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.pv-pills span { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 1px solid var(--rule-strong); border-radius: 99px; background: var(--surface); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.pv-pills label:hover span { border-color: var(--ink-2); }
.pv-pills input:checked + span { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.pv-pills input:focus-visible + span { box-shadow: var(--ring); }
.label-like { display: block; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.pv-when { margin-top: 16px; max-width: 360px; }
.pv-when-weekdays { max-width: none; }
.pv-settings:has(input[name=schedule][value=full]:checked) .pv-when-days,
.pv-settings:has(input[name=schedule][value=weekdays]:checked) .pv-when-days,
.pv-settings:has(input[name=schedule][value=full]:checked) .pv-when-weekdays,
.pv-settings:has(input[name=schedule][value=days]:checked) .pv-when-weekdays,
.pv-settings:has(input[name=kind][value=freelance]:checked) .pv-when-portage { display: none; }
.pv-check-cell { display: flex; align-items: center; }
.pv-formula { margin: 16px 0 0; padding: 10px 14px; border-radius: var(--r); background: var(--sunk); font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.pv-danger { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.pv-danger h2 { font-size: var(--t-md); margin: 0 0 4px; }
.pv-danger p { margin: 0; }
.pv-form-card h2 { margin-bottom: 18px; }
.pv-empty { max-width: 640px; }

/* Dépenses, YNAB, import Excel */
.pv-exp-stats .stat-value { font-size: 26px; }
.pv-exp-table td { vertical-align: top; }
.pv-exp-date { white-space: nowrap; color: var(--ink-2); }
.pv-exp-table td strong { overflow-wrap: anywhere; }
.pv-credit { color: var(--ok); }
.pv-exp-amount, .pv-exp-vat > span:first-child { white-space: nowrap; }
.pv-exp-name { color: inherit; text-decoration: none; }
.pv-exp-name:hover { text-decoration: underline; }
.pv-danger + .pv-section-title { margin-top: 32px; }
.pv-ynab-card { margin-top: 20px; }
.pv-vat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pv-settings input[type=file] { width: 100%; padding: 10px; border: 1px dashed var(--rule-strong); border-radius: var(--r); background: var(--sunk); font: inherit; color: var(--ink); }
.pv-check-top { margin-top: 16px; }
.pv-logs { padding: 0; }
.pv-log + .pv-log { border-top: 1px solid var(--rule); }
.pv-log summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; cursor: pointer; list-style: none; }
.pv-log summary::-webkit-details-marker { display: none; }
.pv-log summary:focus-visible { outline: none; box-shadow: var(--ring); }
.pv-log summary .grow { flex: 1; min-width: 160px; }
.pv-log summary .sub { display: block; color: var(--muted); font-size: 13px; }
.pv-log-counts { color: var(--ink-2); font-size: 14px; }
.pv-log-body { margin: 0; padding: 0 20px 16px; }
p.pv-log-body { color: var(--ink-2); }
.pv-report { margin-bottom: 20px; }
.pv-report-title { margin: 18px 0 8px; font-size: var(--t-md); }
.pv-problems { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; }
.pv-problems li + li { margin-top: 4px; }
.pv-layout > div { grid-template-columns: 84px minmax(0, 1fr); }
.pv-layout dd { font-weight: 600; }
.pv-layout dd .muted { font-weight: 400; }
.pv-import-note { max-width: 70ch; margin-top: 16px; }

@media (max-width: 1100px) {
  .pv-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pv-side { grid-column: 1 / -1; grid-auto-flow: column; justify-content: start; gap: 40px; border-left: 0 !important; border-top: 1px solid var(--rule); }
}
@media (max-width: 980px) {
  .pv-set { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 760px) {
  .table .hide-sm, .pv-head .hide-sm { display: none; }
  .pv-exp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-exp-stats .stat-value { font-size: 21px; }
  .pv-exp-table td .sub { max-width: 46vw; }
  .pv-exp-table th, .pv-exp-table td { padding-left: 6px; padding-right: 6px; }
  .pv-exp-table td.pv-exp-vat .sub { display: none; }
  /* À 390 px, quatre colonnes dont deux montants insécables débordaient : la date
     passe sur deux lignes et les cellules du bord perdent leur marge extérieure. */
  .pv-exp-date { white-space: normal; width: 1%; }
  .pv-exp-table th:first-child, .pv-exp-table td:first-child { padding-left: 0; }
  .pv-exp-table th:last-child, .pv-exp-table td:last-child { padding-right: 0; }
  .pv-exp-table td .sub { overflow-wrap: anywhere; }
  .pv-exp-vat, .pv-exp-amount { font-size: 13px; }
  .pv-exp-stepper h1 { order: -1; flex-basis: 100%; padding: 0 0 6px; }
  .pv-head h1 { font-size: 26px; }
  .pv-summary { grid-template-columns: 1fr; }
  .pv-summary > * { padding: 18px; }
  .pv-summary > * + * { border-left: 0; border-top: 1px solid var(--rule); }
  .pv-side { gap: 24px; }
  .pv-line { grid-template-columns: 1fr; grid-template-areas: "main" "figs" "state"; }
  .pv-figs { text-align: left; }
  .pv-line-act { justify-content: flex-start; }
  .pv-total { flex-direction: column; align-items: flex-start; }
  .pv-total .pv-figs { text-align: left; }
  .pv-axis { min-width: 0; width: 0; overflow: visible; }
  .pv-axis span { right: auto; left: 0; transform: translateY(-2px); font-size: 10.5px; background: var(--surface); padding-right: 4px; }
  .pv-chart { gap: 0; }
  .pv-col-label { font-size: 10.5px; }
  .pv-cash li { flex-wrap: wrap; }
  .pv-cash .grow { flex-basis: 100%; }
  .pv-cash .pv-amount { margin-left: auto; }
  .pv-set { padding: 20px 18px; }
  .pv-settings .form-actions { padding: 16px 18px; }
  .bill input[type=date] { width: 130px; }
}
.f label.check { display: flex; margin-bottom: 0; font-size: 14.5px; font-weight: 600; }
.pv-telework { margin-top: 20px; }
