/* YOUBO — design des maquettes V1 : fond gris-bleu, encre marine, accent bleu,
   bandeaux en dégradé bleu nuit, cartes blanches arrondies, barre du bas flottante. */
:root {
  --acc: #2f6fe8;        /* accent de l'interface, fixe : la couleur de l'entreprise ne sert qu'à ses documents */
  --acc-h: #2a5fc9;
  --on-acc: #ffffff;     /* texte posé sur l'accent */
  --navy: #0b1a3a;       /* onglet actif, filtres choisis */
  --hero: linear-gradient(180deg, #0b1a3a 0%, #2e5bd6 100%);
  --bg: #f3f5f9;
  --bg-d: linear-gradient(180deg, #dce6f5 0, #f5f8fc 520px) no-repeat, #f5f8fc; /* fond sur ordinateur */
  --surf: #ffffff;
  --surf2: #f5f8fc;
  --line: #d7e3f5;       /* champs, tableaux */
  --line2: #eef1f6;      /* cartes, séparateurs */
  --line-b: #c3d4ec;     /* boutons secondaires */
  --ink: #19365b;
  --ink2: #3a5070;
  --mut: #64718a;
  --ok: #157a3a;   --ok-bg: #e3f6ea;
  --warn: #a14b08; --warn-bg: #fef3c7;
  --bad: #c81e1e;  --bad-bg: #fee2e2;
  --info-bg: #eaf2ff;
  --slate: #66749a;      /* fond de l'assistant */
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 24px 64px -16px rgba(11, 20, 48, .32);
  --shadow-nav: 0 8px 24px rgba(16, 24, 40, .14);
  --r: 18px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --acc: #5b93ff; --acc-h: #7aa8ff; --on-acc: #0b1220; --navy: #2b4fae;
    --hero: linear-gradient(180deg, #0a1430 0%, #1f3f9e 100%);
    --bg: #111a2e; --bg-d: #111a2e; --surf: #18233b; --surf2: #1e2a45; --line: #2e3e60; --line2: #26344f; --line-b: #34476b;
    --ink: #e6edf7; --ink2: #b8c4d8; --mut: #8a98b3;
    --ok: #4ade80; --ok-bg: #10281b; --warn: #fbbf24; --warn-bg: #2a2110; --bad: #f87171; --bad-bg: #2e1517; --info-bg: #172a4d;
    --slate: #26325a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7); --shadow-nav: 0 8px 24px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --acc: #5b93ff; --acc-h: #7aa8ff; --on-acc: #0b1220; --navy: #2b4fae;
  --hero: linear-gradient(180deg, #0a1430 0%, #1f3f9e 100%);
  --bg: #111a2e; --bg-d: #111a2e; --surf: #18233b; --surf2: #1e2a45; --line: #2e3e60; --line2: #26344f; --line-b: #34476b;
  --ink: #e6edf7; --ink2: #b8c4d8; --mut: #8a98b3;
  --ok: #4ade80; --ok-bg: #10281b; --warn: #fbbf24; --warn-bg: #2a2110; --bad: #f87171; --bad-bg: #2e1517; --info-bg: #172a4d;
  --slate: #26325a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 24px 64px -12px rgba(0, 0, 0, .7); --shadow-nav: 0 8px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01" }

/* ---------- Identité YOUBO : l'atelier et le plan ----------
   Titres et montants en Bricolage Grotesque (licence OFL, fonts/OFL-bricolage-grotesque.txt), texte courant en police système.
   Bandeaux tramés comme un papier millimétré, numéros de documents en étiquette, statuts à pastille, boutons en relief. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(../fonts/bricolage-grotesque.woff2) format("woff2-variations"), url(../fonts/bricolage-grotesque.woff2) format("woff2") }
:root {
  --display: "Bricolage Grotesque", var(--font);
  /* trame « plan » : quadrillage fin tous les 16 px, renforcé tous les 64 px */
  --grid: linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px) 0 0 / 16px 16px, linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px) 0 0 / 64px 64px, linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px) 0 0 / 64px 64px;
}
h1, h2, h3, .brand, .kpi b, .ph-k b, .tots .big, .ai-cf-tot b, .ai-t b { font-family: var(--display); font-optical-sizing: auto }
h1, h2 { letter-spacing: -.035em !important; font-weight: 750 !important }
h3 { letter-spacing: -.015em }
.kpi b, .ph-k b, .tots .big span:last-child, .ai-cf-tot b { font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums lining-nums }
.brand b { font-size: 21px; font-weight: 800; letter-spacing: -.04em }
/* Titres de section : repère carré comme une légende de plan */
.ch h3 { display: flex; align-items: center; gap: 8px }
.ch h3::before { content: ""; flex: none; width: 7px; height: 7px; border: 2px solid var(--acc); border-radius: 2px }
/* Numéros de documents : une étiquette, pas un simple texte gras */
.dt td:first-child > b { font-family: var(--display); font-weight: 700; letter-spacing: .01em; font-variant-numeric: tabular-nums }
.dt td.r { font-family: var(--display); font-weight: 600; letter-spacing: -.01em }
/* Statuts : pastille de couleur devant le mot */
.pill.ok::before, .pill.warn::before, .pill.bad::before, .pill.acc::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none }
/* Boutons : un léger relief, ils s'enfoncent au clic */
.btn:not(.ghost) { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .16), 0 1px 2px rgba(16, 24, 40, .14) }
.btn.ghost { box-shadow: inset 0 -2px 0 var(--line2) }
.btn:active:not(:disabled), .act.pri:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .12) }
.act.pri { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .16) }
@media (max-width: 720px) { .ph-a .btn.ghost { box-shadow: inset 0 -2px 0 rgba(255, 255, 255, .1) } .ph h1 { font-size: 24px } }
/* États vides : l'icône dans un cercle tramé */
.empty > .ic { box-sizing: content-box; padding: 14px; border-radius: 50%; color: var(--acc); background: radial-gradient(circle, color-mix(in srgb, var(--acc) 22%, transparent) 1px, transparent 1.5px) 0 0 / 6px 6px, var(--info-bg) }
button, input, select, textarea { font: inherit; color: inherit }
button { cursor: pointer }
[hidden] { display: none !important }
.ic { flex: none; display: block }
.num, td.r, .kpi b, .tots span:last-child { font-variant-numeric: tabular-nums }
.mut { color: var(--mut) }
.sm { font-size: 13px }
.r { text-align: right }
.pre { white-space: pre-wrap; margin: 0 }
.tbad { color: var(--bad) } .tok { color: var(--ok) }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px }

/* ---------- Structure ---------- */
#shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: var(--bg-d) }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surf); overflow-y: auto }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 22px; font-weight: 800; font-size: 18px; letter-spacing: -.02em }
.brand b { text-transform: capitalize }
#nav { display: flex; flex-direction: column; gap: 4px }
.nv { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; background: none; border-radius: 10px; color: var(--mut); text-align: left; font-weight: 700; font-size: 14px }
.nv:hover { background: var(--surf2); color: var(--ink) }
.nv.on { background: var(--info-bg); color: var(--acc) }
.side-ai { margin: 12px 0 8px; background: var(--info-bg); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px }
.side-ai b { font-size: 13px; font-weight: 700 }
.side-ai small { font-size: 12px; color: var(--mut) }
.side-ai .btn { height: 36px; margin-top: 2px }
.nv em, .tabbar em, .menu em { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 600; background: var(--bad); color: #fff; border-radius: 99px; padding: 0 7px; line-height: 19px }
.side .sp { flex: 1 }
#sync { display: flex; gap: 7px; align-items: center; font-size: 12.5px; color: var(--warn); padding: 0 10px 8px }
#sync:empty { display: none }
#who { display: flex; gap: 10px; align-items: center; padding: 12px 8px 0; border-top: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100% }
#who img { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--line) }
#who b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px }
#who small { color: var(--mut); font-size: 12px }
.logo-ph { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 12px; background: var(--info-bg); color: var(--acc); font-weight: 650; font-size: 22px }
.logo-ph.sm { width: 34px; height: 34px; font-size: 15px; border-radius: 9px }
.main { min-width: 0; padding: 28px 32px 96px; max-width: 1240px; width: 100% }
.tabbar, .mic-fab { display: none }

/* ---------- En-têtes de page ---------- */
.ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px }
.ph h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2 }
.ph p { margin: 4px 0 0; font-weight: 600; font-size: 13px }
.ph-a { display: flex; gap: 8px; flex-wrap: wrap }
/* Montant clé du bandeau (total à encaisser, total dû…) */
.ph-k { display: flex; flex-direction: column; gap: 2px; margin: 14px 0 0 }
.ph-k small { font-size: 12px; font-weight: 600; color: var(--mut) }
.ph-k b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums }
.ph-k em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--bad) }
.back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--mut); padding: 0; margin-bottom: 12px; font-size: 13.5px; font-weight: 600 }
.back:hover { color: var(--ink) }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent; background: var(--acc); color: var(--on-acc); font-weight: 700; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s }
.btn:hover { background: var(--acc-h) }
.btn:disabled { opacity: .5; cursor: default }
.btn.ghost { background: var(--surf); color: var(--ink); border-color: var(--line-b) }
.btn.ghost:hover { background: var(--surf2) }
.btn.ghost.bad { color: var(--bad) }
.btn.bad:not(.ghost) { background: var(--bad); border-color: var(--bad); color: #fff }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 999px; gap: 5px }
.btn.wide { width: 100% }
.ib { display: grid; place-items: center; width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; color: var(--mut); flex: none }
.ib:hover { background: var(--surf2); color: var(--ink) }
.lnk { border: 0; background: none; padding: 0; color: var(--acc); font-weight: 700; text-align: left }
.lnk:hover { text-decoration: underline }
.lnk.bad { color: var(--bad); font-weight: 400; font-size: 12px }
.row { display: flex; gap: 8px; align-items: center; margin-top: 14px }
.row.wrap { flex-wrap: wrap }

/* ---------- Cartes ---------- */
.card { background: var(--surf); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: none }
.card.flush { padding: 0; overflow: hidden }
.sec { margin-top: 16px }
.ch { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px }
.ch.pad { padding: 16px 20px 0; margin-bottom: 8px }
.ch h3, h3 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: -.01em }
.pad { padding: 16px 20px }
.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px }
.grid2.r { grid-template-columns: 1fr 1.6fr; margin-top: 18px }
.grid2.notes2 { grid-template-columns: 1fr 1.4fr; margin-top: 18px; align-items: start }
.note { display: flex; gap: 9px; align-items: flex-start; background: var(--surf2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 13px; color: var(--ink2); margin: 12px 0 0 }
.note .ic { margin-top: 2px; color: var(--mut) }

/* ---------- Indicateurs ---------- */
/* Ordinateur : bandeau en dégradé, une colonne par chiffre (maquettes D1/D2). Téléphone : tuiles blanches. */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 16px; background: var(--grid), var(--hero); border-radius: 16px; padding: 14px 18px; box-shadow: 0 6px 18px rgba(11, 20, 48, .16) }
.kpi { padding: 0 0 0 16px; border-left: 1px solid rgba(255, 255, 255, .18); color: #fff }
.kpi:first-child { border-left: 0; padding-left: 0 }
.kpi span { font-size: 11.5px; font-weight: 700; color: rgba(255, 255, 255, .72) }
.kpi b { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 1px; line-height: 1.25 }
.kpi small { color: rgba(255, 255, 255, .72); font-size: 11.5px; font-weight: 600 }
.kpi.bad small { color: #fca5a5; font-weight: 700 }

/* ---------- Graphique ---------- */
.chart { position: relative }
.chart svg { width: 100%; height: auto; display: block; overflow: visible }
.chart .gl { stroke: var(--line2); stroke-width: 1 }
.chart .ax { fill: var(--mut); font-size: 11px; font-family: var(--font) }
.chart .bar path { fill: color-mix(in srgb, var(--acc) 70%, var(--surf)) }
.chart .bar.cur path, .chart .bar:hover path { fill: var(--acc) }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-variant-numeric: tabular-nums }
.tbl { margin-top: 6px; font-size: 13px }
.tbl summary { color: var(--mut); cursor: pointer; font-size: 12.5px }
.tbl table { width: 100%; border-collapse: collapse; margin-top: 6px }
.tbl td { padding: 4px 0; border-top: 1px solid var(--line2) }

/* ---------- Listes ---------- */
.todo, .feed, .rl, .mini, .checks { list-style: none; margin: 0; padding: 0 }
.todo li + li, .feed li + li { border-top: 1px solid var(--line2) }
.todo button, .feed button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 7px 4px; text-align: left; border-radius: 8px }
.todo button:hover, .feed button:hover { background: var(--surf2) }
.todo b { display: block; font-weight: 700; font-size: 13px; line-height: 1.3 }
.todo small { color: var(--mut); font-size: 11.5px }
.todo span:nth-child(2) { flex: 1; min-width: 0 }
.todo .ic:last-child { color: var(--mut) }
.dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; flex: none }
.dot.bad { background: var(--bad-bg); color: var(--bad) } .dot.ok { background: var(--ok-bg); color: var(--ok) }
.dot.warn { background: var(--warn-bg); color: var(--warn) } .dot.mut { background: var(--surf2); color: var(--mut) }
.feed button { justify-content: space-between; font-size: 13px }
.feed small { color: var(--mut); white-space: nowrap; font-size: 12px }
.feed button > span { min-width: 0 }
.feed small.mut { white-space: normal; overflow-wrap: anywhere }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 20px; color: var(--mut) }
.empty b { color: var(--ink); margin-top: 10px; font-weight: 600 }
.empty p { margin: 4px 0 14px; max-width: 360px; font-size: 13.5px }

/* ---------- Statuts ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 19px; white-space: nowrap; background: var(--surf2); color: var(--ink2); border: 1px solid var(--line2) }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent }
.pill.acc { background: var(--info-bg); color: var(--acc); border-color: transparent }
.pill.mut { color: var(--mut) }

/* ---------- Tableaux ---------- */
.tw { overflow-x: auto }
.dt { width: 100%; border-collapse: collapse; font-size: 13px }
.dt th { text-align: left; font-weight: 700; color: var(--mut); font-size: 11.5px; padding: 10px 16px 8px; border-bottom: 1px solid var(--line); white-space: nowrap }
.dt td { padding: 8px 16px; border-top: 1px solid var(--line2); vertical-align: middle; line-height: 1.35 }
.dt tbody tr:first-child td { border-top: 0 }
.dt tbody tr { cursor: pointer }
.dt tbody tr:hover td { background: var(--surf2) }
.dt td b { font-weight: 700 }
.dt td small { display: block; color: var(--mut); font-size: 11px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.dt th.r, .dt td.r { text-align: right }
.av { float: left; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--info-bg); margin-right: 10px; font-weight: 800; font-size: 12.5px; color: var(--acc) }

/* ---------- Filtres : pastilles (choisie = marine pleine) ---------- */
.bar-f { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px }
.seg { display: inline-flex; gap: 6px; margin-bottom: 14px; max-width: 100% }
.bar-f .seg { margin: 0 }
.seg.scroll { overflow-x: auto; scrollbar-width: none }
.seg button, .seg label span { display: block; border: 1px solid var(--line); background: var(--surf); padding: 6px 14px; border-radius: 999px; color: var(--mut); font-weight: 700; white-space: nowrap; font-size: 13px; cursor: pointer }
.seg button:hover, .seg label span:hover { color: var(--ink) }
.seg button.on, .seg input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff }
.seg label input { position: absolute; opacity: 0; pointer-events: none }
.fld .seg { flex-wrap: wrap; margin: 0 }
.seg input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: 2px }
.search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; max-width: 380px; background: var(--surf); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; color: var(--mut) }
.search input[type=search] { border: 0 !important; box-shadow: none !important; min-height: 0 !important; padding: 0 !important; background: none; height: 42px; flex: 1; outline: none; min-width: 0; color: var(--ink) }
.bar-f select { height: 42px; border: 1px solid var(--line); background: var(--surf); border-radius: 999px; padding: 0 14px }

/* ---------- Projets ---------- */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px }
.pcard { display: block; text-align: left; background: var(--surf); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s }
.pcard:hover { border-color: color-mix(in srgb, var(--acc) 50%, var(--line)); transform: translateY(-1px) }
.pc-top { display: flex; justify-content: space-between; gap: 10px }
.pc-top b { display: block; font-weight: 600; font-size: 15px; letter-spacing: -.01em }
.pc-top small { color: var(--mut); font-size: 12.5px }
.pc-n { display: flex; justify-content: space-between; margin-top: 14px; font-weight: 560; font-variant-numeric: tabular-nums }
.pc-n small { display: block; color: var(--mut); font-weight: 400; font-size: 12px }
.pc-n span:last-child { text-align: right }
.ring { flex: none }
.ring .rt { fill: none; stroke: var(--line2); stroke-width: 5 }
.ring .rv { fill: none; stroke: var(--acc); stroke-width: 5; stroke-linecap: round; transition: stroke-dasharray .4s }
.ring.late .rv { stroke: var(--bad) }
.ring text { font-size: 12px; font-weight: 620; fill: var(--ink); font-family: var(--font) }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; list-style: none; padding: 0; margin: 14px 0 0 }
.steps li { font-size: 11.5px; color: var(--mut); padding-top: 8px; border-top: 3px solid var(--line2); font-weight: 520 }
.steps li.on { border-top-color: var(--acc); color: var(--ink) }
.pd { display: flex; gap: 32px; align-items: center; margin-bottom: 18px; flex-wrap: wrap }
.pd .steps { flex: 1; min-width: 280px; margin: 0 }
.pd-ring { display: flex; gap: 14px; align-items: center }
.pd-ring b { display: block; font-weight: 620 }

/* ---------- Relances ---------- */
.auto { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap }
.auto b { display: flex; align-items: center; gap: 8px; font-weight: 600 }
.auto p { margin: 4px 0 0; max-width: 620px }
.rl li { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; flex-wrap: wrap }
.rl li + li { border-top: 1px solid var(--line2) }
.rl-i { display: flex; flex-direction: column; gap: 1px }
.rl-i b { font-weight: 600 }
.rl-a { display: flex; gap: 6px; align-items: center; flex-wrap: wrap }
.lvl { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px }
.lvl.l1 { background: var(--warn-bg); color: var(--warn) } .lvl.l2, .lvl.l3 { background: var(--bad-bg); color: var(--bad) }

/* ---------- Formulaires ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 14px }
.form.one { grid-template-columns: 1fr }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0 }
.fld.wide { grid-column: 1 / -1 }
.fld label { font-size: 12px; color: var(--mut); font-weight: 700 }
.fld small { color: var(--mut); font-size: 12px }
input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  width: 100%; background: var(--surf); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; min-height: 42px; outline: none; color: var(--ink); transition: border-color .15s, box-shadow .15s
}
textarea { resize: vertical; line-height: 1.5 }
input:focus, select:focus, textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 16%, transparent) }
input[type=color] { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: var(--surf) }
input[type=checkbox], input[type=radio] { accent-color: var(--acc); width: 16px; height: 16px; margin: 0; flex: none }
.chk { display: flex !important; gap: 9px; align-items: center; font-size: 13.5px !important; color: var(--ink) !important; font-weight: 450 !important; cursor: pointer; padding: 3px 0 }
.inl { display: flex; gap: 6px; align-items: center }
.inl input { width: 90px !important }
.inl select { flex: 1 }
.err { color: var(--bad); min-height: 20px; font-size: 13px; margin: 8px 0 }
.logo-row { display: flex; gap: 16px; align-items: center; margin-bottom: 16px }
.logo-row img { max-height: 56px; max-width: 160px; border-radius: 10px; background: #fff; padding: 5px; border: 1px solid var(--line) }
.logo-row small { display: block; margin-top: 6px }
.logo-row label.btn { cursor: pointer }
.checks li { display: flex; gap: 9px; padding: 6px 0; font-size: 13.5px; color: var(--ink2) }
.checks .ic { color: var(--ok); margin-top: 2px }
details.prev { border-top: 1px solid var(--line2); padding: 10px 0 }
details.prev summary { cursor: pointer; font-weight: 520 }
details.prev pre { white-space: pre-wrap; font: 13px/1.55 var(--font); color: var(--ink2); background: var(--surf2); padding: 12px 14px; border-radius: 10px; margin: 10px 0 0 }
details.more summary { cursor: pointer; color: var(--acc); font-size: 13px; font-weight: 520; margin: 4px 0 10px }
.danger { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)) }

/* ---------- Fenêtres ---------- */
dialog { border: 0; padding: 0; border-radius: 20px; background: var(--surf); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg); overflow: auto }
dialog.lg { width: min(760px, calc(100vw - 32px)) }
dialog.xl { width: min(1080px, calc(100vw - 32px)) }
dialog::backdrop { background: rgba(25, 54, 91, .45); backdrop-filter: blur(3px) }
#dlgc { padding: 22px 24px 20px }
.dh { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px }
.dh h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em }
.dh p { margin: 4px 0 0; font-size: 13px }
.df { display: flex; gap: 8px; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line2); flex-wrap: wrap }
.df .sp { flex: 1 }
dialog.sheet { width: min(420px, calc(100vw - 24px)) }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 13px 6px; border-bottom: 1px solid var(--line2); text-align: left; font-weight: 520 }
.menu button > .ic:last-child { margin-left: auto; color: var(--mut) }
.menu em { margin-left: auto }

/* Éditeur */
.ed .form { margin-bottom: 18px }
.lines-h, .ln { display: grid; grid-template-columns: minmax(0, 1fr) 76px 92px 104px 84px 104px 68px; gap: 6px; align-items: center }
.nofr .ln, .nofr .lines-h { grid-template-columns: minmax(0, 1fr) 76px 92px 104px 104px 68px }
.lines-h { font-size: 12px; color: var(--mut); padding: 0 0 6px; border-bottom: 1px solid var(--line2); margin-bottom: 6px }
.ln { padding: 3px 0 }
.ln input, .ln select { min-height: 36px !important; padding: 6px 9px !important }
.ln .lh { text-align: right; font-weight: 550; padding-right: 4px }
.ln .la { display: flex; justify-content: flex-end }
.ln .la .ib, .ln.title .ib { width: 30px; height: 30px }
.ln.title { grid-template-columns: 1fr 30px 30px }
.ln.title input { font-weight: 620; background: var(--surf2) }
.ed .row { margin: 10px 0 0 }
.ed-b { display: grid; grid-template-columns: 1fr 300px; gap: 24px; margin-top: 20px; align-items: start }
.ed-b .form { margin: 0 }
/* Totaux de l'éditeur : carte en dégradé (maquette M3) */
.tots { background: var(--grid), var(--hero); color: #fff; border-radius: 18px; padding: 16px; font-size: 13px; font-weight: 600 }
.tots div, .pp-t div { display: flex; justify-content: space-between; padding: 3px 0 }
.tots div:not(.big) { color: rgba(255, 255, 255, .78) }
.pp-t .big { font-weight: 650; font-size: 17px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 9px }
.tots .big { align-items: baseline; font-weight: 800; font-size: 24px; letter-spacing: -.02em; margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .2) }
.tots .big span:first-child { font-size: 13px; font-weight: 700; letter-spacing: 0 }

/* Aperçu */
.vw { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 22px; align-items: start }
.vw-p { background: var(--surf2); border-radius: 12px; padding: 18px; border: 1px solid var(--line2) }
.paper { background: #fff; color: #1c1c1e; border-radius: 4px; --pp: 32px; padding: 30px var(--pp); box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 8px 24px -12px rgba(0, 0, 0, .18); font-size: 12.5px; color-scheme: light }
.paper small { color: #6b6965 }
.pp-h { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 2px solid var(--doc) }
/* Logo à l'échelle du PDF : sa hauteur (--lh, en mm) rapportée aux 210 mm de la page (largeur du papier = contenu + marges --pp) */
.paper { container-type: inline-size }
.pp-h img { height: calc(var(--lh, 30) * (100cqw + 2 * var(--pp)) / 210); width: auto; max-width: calc(110 * (100cqw + 2 * var(--pp)) / 210); object-fit: contain; object-position: left; display: block; margin-bottom: 8px }
.pp-h b { display: block; font-size: 14px }
.pp-h h3 { margin: 0 0 4px; font-size: 20px; color: var(--doc); letter-spacing: .02em; text-transform: uppercase }
.pp-c { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 18px 0 }
.pp-c small { display: block; font-size: 11.5px }
.pp-c small:first-child { text-transform: uppercase; letter-spacing: .06em; font-size: 10px }
.pp-c b { display: block; font-size: 13px; margin: 2px 0 }
.pp-cl { background: #f6f5f2; border-radius: 6px; padding: 10px 12px }
.paper table { width: 100%; border-collapse: collapse }
.paper th { background: var(--doc); color: #fff; font-weight: 600; font-size: 11px; padding: 6px 8px; text-align: left }
.paper th.r { text-align: right }
.paper td { padding: 7px 8px; border-bottom: 1px solid #ecebe8; vertical-align: top }
.paper tr.tt td { font-weight: 650; padding-top: 12px; border-bottom: 0 }
.pp-t { margin: 14px 0 0 auto; width: min(280px, 100%) }
.pp-t .big { color: var(--doc); border-color: #e6e3de }
.pp-t .mut { color: #6b6965 }
.pp-m { margin-top: 18px; color: #6b6965; font-size: 11px }
.pp-m p { margin: 0 0 3px }
.pp-s { margin-top: 16px; border: 1px solid #ddd; border-radius: 6px; padding: 10px 12px; width: 260px; min-height: 80px }
.pp-s img { max-width: 180px; max-height: 60px; display: block }
.vw-s { position: sticky; top: 0 }
.vi { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 16px; background: var(--surf2); border: 1px solid var(--line2); border-radius: 14px; margin-bottom: 14px }
.vi small { display: block; color: var(--mut); font-size: 12px }
.vi b { font-weight: 600; font-variant-numeric: tabular-nums }
.acts { display: flex; flex-direction: column; gap: 2px }
.act { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 12px; text-align: left; color: var(--ink2); font-weight: 700 }
.act:hover { background: var(--surf2); color: var(--ink) }
.act.pri { background: var(--acc); color: var(--on-acc); margin-bottom: 6px; justify-content: center; height: 48px; font-size: 15px; font-weight: 800 }
.act.pri:hover { background: var(--acc-h); color: var(--on-acc) }
.act.bad { color: var(--bad) }
.vw-s h4 { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); font-weight: 600 }
.mini li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--line2) }
.mini small { color: var(--mut); white-space: nowrap; font-size: 12px }

/* Choix */
.choice { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px }
.ch-o { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; cursor: pointer }
.ch-o:has(input:checked) { border-color: var(--acc); background: var(--info-bg) }
.ch-o input { margin-top: 3px }
.ch-o b { display: block; font-weight: 600 }
.ch-o small { display: block; color: var(--mut); font-size: 12.5px }
.ch-o .inl { margin-top: 8px; font-size: 13px }
.pick { max-height: 52vh; overflow: auto; margin-top: 12px }
.pick h4 { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut) }
.pk { display: grid; grid-template-columns: 18px 1fr auto 76px; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line2); cursor: pointer; font-size: 13.5px }
.pk small { color: var(--mut); white-space: nowrap }
.pk .pkq { min-height: 32px !important; padding: 4px 8px !important }
#dlgc .pick:has(.pk:not(:has(.pkq))) .pk { grid-template-columns: 18px 1fr auto }
.sectors { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-top: 16px }
.sector { text-align: left; border: 1px solid var(--line); background: var(--surf); border-radius: 12px; padding: 13px 14px; transition: border-color .15s, background .15s }
.sector:hover, .sector.on { border-color: var(--acc); background: var(--info-bg) }
.sector b { display: block; font-weight: 600; font-size: 14px }
.sector small { color: var(--mut); font-size: 12.5px; line-height: 1.4; display: block; margin-top: 2px }
.ob .brand { padding: 0 0 12px }
.ob h2 { margin: 0; font-size: 22px; letter-spacing: -.02em }
.ob > p { margin: 6px 0 0 }
.ob .form { margin-top: 18px }

/* Réglages → Identité : taille du logo, avec le haut d'une page A4 à l'échelle (--k = taille d'un millimètre) */
.logo-size { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: center; margin: 0 0 16px }
.logo-size label b { color: var(--acc); margin-left: 6px; font-variant-numeric: tabular-nums }
.logo-size input[type=range] { width: 100%; min-height: 0; padding: 0; border: 0; box-shadow: none; background: none; accent-color: var(--acc) }
.logo-page { --k: 1.3px; position: relative; width: calc(210 * var(--k)); height: calc(92 * var(--k)); background: #fff; border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); overflow: hidden; color-scheme: light }
.logo-page img { position: absolute; left: calc(16 * var(--k)); top: calc(16 * var(--k)); height: calc(var(--lh, 30) * var(--k)); max-width: calc(110 * var(--k)); object-fit: contain; object-position: left top }
.logo-page b { position: absolute; right: calc(16 * var(--k)); top: calc(15 * var(--k)); color: var(--doc); font: 700 calc(7 * var(--k)) / 1 Helvetica, Arial, sans-serif }
.logo-page i { position: absolute; right: calc(16 * var(--k)); width: calc(38 * var(--k)); height: calc(2 * var(--k)); border-radius: 2px; background: #e4e4e4 }
.logo-page i:nth-of-type(1) { top: calc(27 * var(--k)) } .logo-page i:nth-of-type(2) { top: calc(32 * var(--k)) } .logo-page i:nth-of-type(3) { top: calc(37 * var(--k)) }
@media (max-width: 720px) { .logo-size { grid-template-columns: 1fr } .logo-page { --k: 1.45px } }

/* Zone de signature (faire signer sur place) : toujours une feuille blanche, quel que soit le thème,
   pour que le trait foncé reste visible en mode sombre. */
#spad { display: block; width: 100%; height: 180px; background: #fff; border: 1.5px dashed var(--line-b); border-radius: 12px; touch-action: none; color-scheme: light; forced-color-adjust: none; cursor: crosshair }

/* Dictée */
.dict { display: flex; flex-direction: column; align-items: center; gap: 10px }
.dict textarea { margin-top: 6px }
.dict > p.mut { text-align: center; margin: 0 }
.dict > p.mut:last-child { text-align: left; align-self: stretch; font-size: 12.5px }
.mic { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; border: 5px solid var(--info-bg); background: #19365b; color: #fff; box-shadow: 0 10px 24px rgba(5, 10, 24, .3); transition: transform .15s }
.mic.on { background: #dc2626 }
.mic:hover { transform: scale(1.04) }
.mic.on { animation: pulse 1.6s infinite }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--acc) 45%, transparent) } 100% { box-shadow: 0 0 0 22px transparent } }

/* Connexion */
#login { min-height: 100vh; display: grid; place-items: center; padding: 20px }
#login .lg { width: min(400px, 100%); padding: 28px }
#login h2 { margin: 6px 0 4px; font-size: 21px; letter-spacing: -.02em }
#login .brand { padding: 0 0 14px }

/* Notifications */
#toasts { position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%); bottom: 24px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(460px, calc(100vw - 32px)) }
/* Avertissement avant la déconnexion pour inactivité (une minute avant) */
#idlewarn { position: fixed; z-index: 1001; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(520px, calc(100vw - 24px)); display: flex; align-items: center; gap: 12px; justify-content: space-between; background: #0b1a3a; color: #fff; padding: 10px 10px 10px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 13.5px }
#idlewarn .btn { flex: none; background: #fff; color: #0b1a3a }
.toast { display: flex; gap: 9px; align-items: center; background: #0b1a3a; color: #fff; padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: tin .2s ease-out; transition: opacity .3s, transform .3s }
.toast.ok .ic { color: #7fd1a4 } .toast.bad .ic { color: #f19393 }
.toast.out { opacity: 0; transform: translateY(6px) }
@keyframes tin { from { opacity: 0; transform: translateY(8px) } }

/* ---------- Tablettes ---------- */
@media (max-width: 1080px) {
  #shell { grid-template-columns: 76px 1fr }
  .side { padding: 18px 10px }
  .side .brand b, .nv span, #who span, #sync, .side-ai { display: none }
  .side .brand { justify-content: center; padding: 0 0 18px }
  .nv { justify-content: center; position: relative; padding: 11px }
  .nv em { position: absolute; top: 3px; right: 6px; line-height: 16px; padding: 0 5px; font-size: 10.5px }
  #who { justify-content: center; padding: 12px 0 0 }
  .main { padding: 28px 28px 80px }
  .grid2, .grid2.r, .grid2.notes2 { grid-template-columns: 1fr }
  .vw { grid-template-columns: 1fr }
  .vw-s { position: static }
  .ed-b { grid-template-columns: 1fr }
}

/* ---------- Téléphones ---------- */
@media (max-width: 720px) {
  body { font-size: 14.5px }
  #shell { display: block; background: var(--bg); padding-bottom: calc(160px + env(safe-area-inset-bottom)) }
  .side { display: none }
  .main { padding: 0 16px 24px }
  html.is-offline .main::before { margin-top: 12px }
  /* En-tête de chaque page : bandeau dégradé arrondi en bas (maquettes M1, M2, M3) */
  .ph { align-items: flex-start; flex-direction: column; gap: 14px; margin: 0 -16px 16px; padding: calc(18px + env(safe-area-inset-top)) 20px 22px; background: var(--grid), var(--hero); color: #fff; border-radius: 0 0 28px 28px }
  .ph h1 { font-size: 22px; color: #fff }
  .ph p.mut, .ph .mut { color: rgba(255, 255, 255, .72) }
  .ph-k small { color: rgba(255, 255, 255, .72) }
  .ph-k em { color: #fca5a5 }
  .ph-a { width: 100%; gap: 8px }
  .ph-a .btn { flex: 1; height: 46px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .4); background: rgba(255, 255, 255, .1); color: #fff; padding: 0 12px }
  .ph-a .btn:not(.ghost) { background: #fff; color: #0b1a3a; border-color: #fff }
  .ph-a .btn.bell { flex: none; width: 46px; padding: 0 }
  .ph .miss { box-shadow: 0 0 0 2px #fff }
  .back { position: relative; z-index: 1; margin: calc(14px + env(safe-area-inset-top)) 0 -6px; color: rgba(255, 255, 255, .8) }
  .back + .ph { margin-top: calc(-30px - env(safe-area-inset-top)); padding-top: calc(48px + env(safe-area-inset-top)) }
  .back:hover { color: #fff }
  .main > .back:first-child { float: left; margin-left: 4px }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; background: none; padding: 0; box-shadow: none; border-radius: 0 }
  .kpi { padding: 10px 12px; background: var(--surf); border: 1px solid var(--line2); border-radius: 14px; box-shadow: var(--shadow); color: var(--ink) }
  .kpi:first-child { padding-left: 12px; border-left: 1px solid var(--line2) }
  .kpi span, .kpi small { color: var(--mut) }
  .kpi b { font-size: 18px }
  .kpi.bad small { color: var(--bad) }
  .card { padding: 14px; border-color: var(--line2); border-radius: 16px; box-shadow: var(--shadow) }
  .ch.pad { padding: 14px 16px 0 }
  /* Barre du bas : pilule blanche flottante, l'onglet actif devient une pastille marine avec son nom */
  .tabbar { display: flex; position: fixed; z-index: 50; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); height: 60px; padding: 6px; gap: 4px; align-items: center; background: var(--surf); border-radius: 30px; box-shadow: var(--shadow-nav); border: 1px solid var(--line2) }
  .tabbar > button { position: relative; flex: 1; min-width: 0; height: 48px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; background: none; color: #8a93a6; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; padding: 0 8px }
  .tabbar > button span { display: none }
  .tabbar > button.on { flex: 2.3; background: var(--navy); color: #fff }
  .tabbar > button.on span { display: inline; overflow: hidden; text-overflow: ellipsis }
  .tabbar em { position: absolute; top: 4px; left: calc(50% + 3px); right: auto; line-height: 16px; padding: 0 5px; font-size: 10px }
  .tabbar > button.on em { left: 22px; top: 3px }
  /* Micro de l'assistant : gros bouton rond au-dessus de la barre, sur chaque écran */
  .mic-fab { display: grid; place-items: center; position: fixed; z-index: 51; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); width: 62px; height: 62px; border-radius: 50%; border: 5px solid var(--bg); background: #19365b; color: #fff; box-shadow: 0 10px 24px rgba(5, 10, 24, .35); padding: 0 }
  html.ai-open .mic-fab, html.ai-open .tabbar { display: none }
  .card.flush:has(> .tw > .dt) { background: none; border: 0; box-shadow: none; overflow: visible }
  .dt thead { display: none }
  .dt, .dt tbody, .dt tr, .dt td { display: block; width: 100% }
  /* Listes du téléphone : une carte par ligne (maquette M1) */
  .dt tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: dense; padding: 12px 16px; border-top: 1px solid var(--line2); gap: 2px 12px }
  .dt tbody tr:first-child { border-top: 0 }
  .dt tbody tr:hover td { background: none }
  .card.flush:has(> .tw > .dt) .ch.pad { padding: 0 2px; margin-bottom: 10px }
  .card.flush:has(> .tw > .dt) .dt tr, .card.flush:has(> .tw > .dt) .dt tbody tr:first-child { padding: 9px 14px; background: var(--surf); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 8px; gap: 0 12px; font-size: 13px }
  .card.flush:has(> .tw > .dt) > .pad { background: var(--surf); border-radius: 18px }
  /* Documents : numéro, objet sur une ligne, puis « client · date » ; montant et statut à droite */
  .dt tr[data-act="view"], .card.flush:has(> .tw > .dt) .dt tr[data-act="view"] { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 4px }
  .dt tr[data-act="view"] td.r, .dt tr[data-act="view"] td:last-child { padding-left: 8px !important }
  .dt tr[data-act="view"] td:first-child { grid-column: 1 / 3 }
  .dt tr[data-act="view"] td small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
  .dt tr[data-act="view"] td:nth-child(2):not(.r) { grid-column: 1; grid-row: 2 / 3; align-self: end; padding-right: 4px !important }
  .dt tr[data-act="view"] td:nth-child(3):not(.r) { grid-column: 2; grid-row: 2 / 3; align-self: end; white-space: nowrap }
  .dt tr[data-act="view"]:has(> td:nth-child(5)) td:nth-child(2)::after { content: " ·" }
  .dt tr[data-act="view"] td.r { grid-column: 3; grid-row: 1 }
  .dt tr[data-act="view"] td:last-child { grid-column: 3; grid-row: 2; align-self: end }
  .dt td { padding: 0; border: 0 !important; width: auto }
  .dt td { grid-column: 1 }
  .dt td.r, .dt td:last-child { grid-column: 2; text-align: right }
  .dt td small { max-width: none; white-space: normal }
  .dt td:nth-child(2):not(.r), .dt td:nth-child(3):not(.r) { font-size: 13px; color: var(--mut) }
  .pgrid { grid-template-columns: 1fr }
  dialog, dialog.lg, dialog.xl { width: 100vw; max-width: 100vw; max-height: 94vh; margin: auto 0 0; border-radius: 20px 20px 0 0 }
  #dlgc { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)) }
  .lines-h { display: none }
  .ln, .nofr .ln { grid-template-columns: 1fr 1fr 1fr; grid-template-areas: "d d d" "q u p" "t h a"; background: var(--surf); border-radius: 18px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line2); box-shadow: var(--shadow) }
  .ln .lh { font-weight: 800 }
  .nofr .ln { grid-template-areas: "d d d" "q u p" "h h a" }
  .ln .ld { grid-area: d } .ln .lq { grid-area: q } .ln .lu { grid-area: u } .ln .lp { grid-area: p } .ln .lt { grid-area: t } .ln .lh { grid-area: h } .ln .la { grid-area: a }
  .ln.title { grid-template-areas: none; grid-template-columns: 1fr 30px 30px }
  .vw-p { padding: 8px; margin: 0 -8px }
  .paper { --pp: 16px; padding: 18px var(--pp); font-size: 11.5px }
  .pp-h, .pp-c { grid-template-columns: 1fr; flex-direction: column }
  .pp-h .r { text-align: left }
  .pd { gap: 16px }
  .search { max-width: none; height: 46px }
  .btn { height: 46px }
  .btn.sm { height: 36px }
  /* Barre d'actions des fenêtres : fixée en bas (maquette M3 « Brouillon / Vérifier et envoyer ») */
  #dlgc > .df, #dlgc > * > .df { position: sticky; bottom: 0; margin: 20px -16px calc(-18px - env(safe-area-inset-bottom)); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--surf); border-top: 1px solid var(--line2); z-index: 2 }
  .df .btn { flex: 1; border-radius: 999px }
  .df .sp { display: none }
  .rl-a .btn { flex: 1 }
  .chart .ax { font-size: 13px }
}

html.is-offline .main::before { content: "Hors ligne — vos modifications sont gardées et seront synchronisées au retour du réseau."; display: block; background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 9px 13px; font-size: 13px; margin-bottom: 16px }
@media print { .side, .tabbar, #toasts { display: none } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important } }

/* ---------- Assistant ---------- */
/* Maquettes A1/A2 : fond ardoise, bulles blanches, carte de confirmation encadrée de marine, gros micro rond. */
.ai-fab { position: fixed; z-index: 40; right: 24px; bottom: 24px; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px 0 6px; border: 0; border-radius: 99px; background: #19365b; color: #fff; font-weight: 800; box-shadow: 0 10px 24px rgba(5, 10, 24, .35); transition: transform .15s }
.ai-fab:hover { transform: translateY(-1px) }
.ai-fab svg { box-sizing: content-box; padding: 11px; border-radius: 50%; background: rgba(255, 255, 255, .14) }
#shell[hidden] ~ .ai-fab, #shell[hidden] ~ .mic-fab, html.ai-open .ai-fab { display: none }
.aipanel { position: fixed; z-index: 70; top: 12px; right: 12px; bottom: 12px; width: 400px; display: flex; flex-direction: column; background: var(--slate); color: #fff; border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden }
html.ai-open .main { width: auto; margin-right: 412px }
html.ai-open dialog:not(:modal) { position: fixed; z-index: 65; inset: 0; right: 424px; margin: auto; box-shadow: var(--shadow-lg); border: 1px solid var(--line) }
.ai-h { display: flex; justify-content: space-between; align-items: center; padding: 16px 12px 12px 18px }
.ai-t { display: flex; gap: 10px; align-items: center }
.ai-t b { display: block; font-weight: 800; font-size: 18px }
.ai-t small { color: rgba(255, 255, 255, .75); font-size: 12px; font-weight: 600 }
.ai-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff }
html.ai-busy .ai-dot { animation: pulse 1.6s infinite }
.ai-hb { display: flex; gap: 2px }
.ai-hb .ib { color: rgba(255, 255, 255, .8) }
.ai-hb .ib:hover { background: rgba(255, 255, 255, .14); color: #fff }
.ai-hb .ib.on { color: #fff; background: rgba(255, 255, 255, .16) }
.ai-log { flex: 1; overflow-y: auto; padding: 8px 18px 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth }
.ai-b { max-width: 92%; font-size: 14px; line-height: 1.5; word-wrap: break-word }
.ai-b.bot { align-self: flex-start; background: var(--surf); color: var(--ink); padding: 10px 14px; border-radius: 18px 18px 18px 4px; box-shadow: 0 2px 6px rgba(10, 16, 32, .1) }
.ai-b.me { align-self: flex-end; background: rgba(255, 255, 255, .16); color: #fff; padding: 10px 14px; border-radius: 18px 18px 4px 18px }
.ai-b.step { align-self: flex-start; color: rgba(255, 255, 255, .8); font-size: 12.5px; font-weight: 600; display: flex; gap: 6px; align-items: flex-start; padding: 0 4px }
.ai-b.step .ic { margin-top: 3px; color: #fff }
.ai-b.done { align-self: flex-start; font-size: 12.5px; font-weight: 700; color: #c9ff66; display: flex; gap: 6px; align-items: center; padding: 0 4px }
.ai-b.err { color: var(--bad) }
.ai-b.card { align-self: stretch; max-width: none; background: var(--surf); color: var(--ink); border: 2px solid var(--card-b, #19365b); border-radius: 16px; padding: 16px }
:root[data-theme="dark"] .ai-b.card { --card-b: #4a67a8 }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ai-b.card { --card-b: #4a67a8 } }
.ai-in textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.ai-b.card .mut { color: var(--mut) }
.ai-b.card p { margin: 6px 0 10px }
.ai-b .li { display: block; padding-left: 4px }
.ai-b code { font-size: 12px; background: var(--surf2); padding: 1px 5px; border-radius: 5px }
.ai-mail-h { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 15px }
.ai-mail-h b { font-weight: 800 }
.ai-mail label { display: block; font-size: 12px; font-weight: 600; color: var(--mut); margin: 8px 0 3px }
.ai-mail input, .ai-mail textarea { font-size: 13.5px }
.ai-mail .row { justify-content: flex-end; margin-top: 10px }
.ai-cf .mini { border-top: 1px solid var(--info-bg); padding-top: 4px }
.ai-cf .mini li { border-color: var(--info-bg); font-size: 13px }
.ai-cf .mini li b { white-space: nowrap; font-weight: 700 }
.ai-cf-tot, .ai-cf-rest { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 !important }
.ai-cf-tot { font-size: 18px; font-weight: 800; border-top: 1px solid var(--line); padding-top: 10px }
.ai-cf-tot span, .ai-cf-rest span { font-size: 13px; color: var(--mut); font-weight: 600 }
.ai-cf-to { background: var(--surf2); border-radius: 12px; padding: 4px 12px 2px; margin: 10px 0 }
.ai-cf-to p { font-weight: 700; margin: 0 0 6px !important; overflow-wrap: anywhere }
.ai-cf .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px }
.ai-cf .row .btn { height: 52px; border-radius: 14px; font-size: 15px; white-space: normal; line-height: 1.2 }
.ai-cf-st { margin-top: 12px !important }
/* Carte d'un document dans la conversation (maquette A1 « Devis prêt à envoyer ») */
.ai-doc .ai-mail-h { flex-wrap: wrap }
.ai-doc .mini { border-top: 1px solid var(--info-bg); padding-top: 4px }
.ai-doc .mini li { border-color: var(--info-bg); font-size: 13px }
.ai-doc .mini li b { white-space: nowrap; font-weight: 700 }
.ai-doc-cl { display: flex; flex-direction: column; gap: 1px; background: var(--surf2); border-radius: 12px; padding: 8px 12px; margin: 4px 0 10px !important }
.ai-doc-cl span { font-size: 12.5px; color: var(--mut); overflow-wrap: anywhere }
.ai-doc .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px }
.ai-doc .row .btn { height: 46px; border-radius: 14px; font-size: 14px }
.ai-doc .row .btn:only-child { grid-column: 1 / -1 }
.ai-st { margin: 0; padding: 0 18px 8px; font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, .8); display: flex; align-items: center; gap: 6px }
.ai-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite }
.ai-send { display: flex; align-items: center; gap: 8px; margin: 0 14px 8px; font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, .85) }
.ai-send i { flex: 1; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .25); overflow: hidden }
.ai-send i b { display: block; height: 100%; background: #fff; transform-origin: left; animation: ai-send linear forwards }
@keyframes ai-send { from { transform: scaleX(1) } to { transform: scaleX(0) } }
.ai-sug { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px }
.ai-sug button { border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .1); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: #fff }
.ai-sug button:hover { background: rgba(255, 255, 255, .2) }
.ai-in { display: flex; gap: 8px; align-items: flex-end; margin: 0 14px; padding: 6px; border-radius: 30px; background: var(--surf); box-shadow: 0 8px 18px rgba(10, 16, 32, .22) }
.ai-in:focus-within { box-shadow: 0 0 0 3px rgba(255, 255, 255, .5) }
.ai-in textarea { border: 0 !important; box-shadow: none !important; resize: none; min-height: 44px !important; max-height: 140px; padding: 11px 4px !important; background: none; color: var(--ink) }
.ai-mic, .ai-go { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0 }
.ai-mic { width: 52px; height: 52px; margin: -10px 0 -2px -2px; background: #19365b; color: #fff; border: 4px solid var(--slate); box-shadow: 0 6px 16px rgba(5, 10, 24, .35) }
.ai-mic.on { background: #dc2626; animation: pulse 1.4s infinite }
.ai-mic.invite { animation: pulse 1.4s infinite; box-shadow: 0 0 0 4px rgba(255, 255, 255, .6) }
.ai-go { background: var(--acc); color: var(--on-acc) }
.ai-conv { margin: 10px 18px 14px; font-size: 12.5px !important; color: rgba(255, 255, 255, .85) !important }
@media (max-width: 1080px) { html.ai-open .main { margin-right: 0 } html.ai-open dialog:not(:modal) { right: 0 } .aipanel { z-index: 80 } }
@media (max-width: 720px) {
  .ai-fab { display: none }
  .aipanel { inset: 0; width: auto; border-radius: 0; border: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom) }
  html.ai-open dialog:not(:modal) { z-index: 90 }
}
html.no-assistant .ai-fab, html.no-assistant .aipanel, html.no-assistant .side-ai { display: none !important }
a.btn { text-decoration: none }
.bar-f select { width: auto; min-width: 190px; flex: none }
@media (max-width: 720px) { .bar-f select { width: 100%; flex: 1 } }
.checklist { margin: 0 0 18px }
.cl-bar { height: 4px; background: var(--line2); border-radius: 4px; overflow: hidden; margin: -4px 0 10px }
.cl-bar span { display: block; height: 100%; background: var(--acc); border-radius: 4px }
.cl { list-style: none; padding: 0; margin: 0 0 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 14px }
.cl button { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; background: none; padding: 7px 4px; text-align: left; color: var(--ink2); border-radius: 8px; font-size: 13.5px }
.cl button:hover:not(:disabled) { background: var(--surf2); color: var(--ink) }
.cl li.on button { color: var(--mut); text-decoration: line-through; cursor: default }
.cl li.on .ic { color: var(--ok) }
.menu-a { display: block; padding: 13px 6px; color: var(--acc); font-weight: 520; text-decoration: none }
.side a.nv { text-decoration: none }

/* ---------- Planning de chantier ---------- */
.pl-bar { align-items: center }
.pl-bar .seg { margin: 0 }
.pl-nav { display: flex; align-items: center; gap: 6px; margin-right: auto }
.pl-nav b { font-weight: 600; margin-left: 6px; text-transform: none }
.pl-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px }
.pl-day { background: var(--surf); border: 1px solid var(--line); border-radius: var(--r); min-height: 210px; display: flex; flex-direction: column; box-shadow: var(--shadow) }
.pl-day.we { background: var(--surf2) }
.pl-day.today { border-color: color-mix(in srgb, var(--acc) 55%, var(--line)) }
.pl-day.today .pl-dh b { background: var(--acc); color: #fff; border-radius: 99px; padding: 0 7px }
.pl-dh { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 4px 11px; font-size: 12.5px; color: var(--mut) }
.pl-dh b { color: var(--ink); font-size: 14px; font-weight: 620 }
.pl-dh .ib { width: 26px; height: 26px; opacity: 0; transition: opacity .15s }
.pl-day:hover .pl-dh .ib, .pl-dh .ib:focus-visible { opacity: 1 }
.pl-ev { display: flex; flex-direction: column; gap: 6px; padding: 4px 6px 8px }
.pl-ev.row-ev { flex-direction: row; flex-wrap: wrap; padding: 0 }
.pl-ev.row-ev .pev { flex: 1 1 220px }
.pl-empty { color: var(--line); text-align: center; padding: 8px 0 }
.pev { display: flex; flex-direction: column; gap: 2px; text-align: left; width: 100%; border: 1px solid var(--line); border-left: 3px solid var(--mut); background: var(--surf); border-radius: 9px; padding: 6px 8px; font-size: 12.5px; line-height: 1.35; color: var(--ink) }
.pev:hover { border-color: color-mix(in srgb, var(--acc) 40%, var(--line)); border-left-color: inherit }
.pev.acc { border-left-color: var(--acc) }
.pev.ok { border-left-color: var(--ok); color: var(--mut) }
.pev.ok .pev-t { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--mut) 50%, transparent) }
.pev.me { background: var(--info-bg) }
.pev-t { font-weight: 560; overflow-wrap: break-word; hyphens: auto }
.pev-t b { font-weight: 650; margin-right: 1px; font-variant-numeric: tabular-nums; color: var(--ink2) }
.pev small { color: var(--mut); font-size: 11.5px }
.pev-w { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px }
.pev-w i { font-style: normal; font-size: 11px; background: var(--surf2); border: 1px solid var(--line2); border-radius: 99px; padding: 0 6px; color: var(--ink2) }
.pl-month { background: var(--surf); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow) }
.pl-mh, .pl-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) }
.pl-mh span { padding: 8px 10px; font-size: 12px; color: var(--mut); border-bottom: 1px solid var(--line) }
.pl-cell { min-height: 104px; border-right: 1px solid var(--line2); border-bottom: 1px solid var(--line2); padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer }
.pl-cell:nth-child(7n) { border-right: 0 }
.pl-cell:hover { background: var(--surf2) }
.pl-cell.out { background: var(--surf2); color: var(--mut) }
.pl-cell.out .pev { opacity: .65 }
.pl-n { font-size: 12px; padding: 2px 4px; color: var(--ink2) }
.pl-cell.today .pl-n { color: #fff; background: var(--acc); border-radius: 99px; align-self: flex-start; padding: 0 7px; font-weight: 600 }
.pl-cell .pev { padding: 3px 6px; font-size: 11.5px }
.pl-cell .lnk { align-self: flex-start; font-size: 11.5px; padding: 0 4px }
.pl-list .card .pl-ev { padding: 0 }
.pl-mini li small { white-space: normal; text-align: right }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 26px; align-items: center }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surf2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 4px 2px 10px; font-size: 13px }
.chip button { border: 0; background: none; color: var(--mut); width: 20px; height: 20px; border-radius: 99px; line-height: 1 }
.chip button:hover { background: var(--line); color: var(--ink) }
fieldset.plf { border: 0; margin: 0; padding: 0; min-width: 0 }
@media (max-width: 1080px) { .pl-week { grid-template-columns: repeat(4, minmax(0, 1fr)) } }
@media (max-width: 720px) {
  .pl-week { grid-template-columns: 1fr; gap: 6px }
  .pl-day { min-height: 0 }
  .pl-day.none { flex-direction: row; align-items: center; justify-content: space-between }
  .pl-day.none .pl-ev { display: none }
  .pl-dh .ib { opacity: 1 }
  .pl-cell { min-height: 64px }
  .pl-cell .pev { font-size: 0; padding: 0; height: 6px; border-width: 0 0 0 0; border-radius: 3px; background: var(--acc) }
  .pl-cell .pev.ok { background: var(--ok) }
  .pl-cell .pev.mut { background: var(--mut) }
  .pl-nav b { width: 100%; margin: 4px 0 0 }
  .pl-nav { flex-wrap: wrap }
}

/* ---------- Équipe, journal, aide ---------- */
.dt.team td { vertical-align: middle }
.dt.team tr.off td { opacity: .55 }
.dt.team select { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--surf); padding: 0 8px; max-width: 190px }
.acts-row { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; align-items: center }
.acts-row .btn { height: 28px; padding: 0 9px; font-size: 12.5px }
.code { font: 600 18px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; background: var(--surf2); border: 1px dashed var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0; user-select: all }
.roles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px }
.roles li { border: 1px solid var(--line2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px }
.jd { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); font-weight: 600 }
.jl { list-style: none; margin: 0; padding: 0 }
.jl li { display: grid; grid-template-columns: 48px minmax(90px, 160px) 1fr auto; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line2); font-size: 13px; align-items: baseline }
.jl time { color: var(--mut); font-variant-numeric: tabular-nums }
.jn { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.help-l { list-style: none; margin: 0; padding: 0 }
.help-l li { border-bottom: 1px solid var(--line2); padding: 10px 0 }
.hl-h { display: flex; justify-content: space-between; gap: 10px; align-items: center }
.help-l details summary { cursor: pointer; font-size: 12.5px; color: var(--mut); margin-top: 4px }
.hl-r { margin-top: 8px; background: var(--info-bg); border-radius: 10px; padding: 9px 12px }
.hl-r small { color: var(--acc); font-weight: 600 }
.lg-who { display: flex; width: 100%; margin: 4px 0 14px }
.lg-who button { flex: 1 }
@media (max-width: 720px) {
  .jl li { grid-template-columns: 44px 1fr; gap: 2px 10px }
  .jl li > span:last-of-type, .jl li small { grid-column: 2 }
  .dt.team thead { display: none }
}

/* ---------- Assistant : flux et historique ---------- */
.ai-b.live::after { content: ""; display: inline-block; width: 7px; height: 14px; margin-left: 3px; vertical-align: -2px; background: var(--acc); border-radius: 2px; animation: aiblink 1s steps(2) infinite }
@keyframes aiblink { 50% { opacity: 0 } }
.ai-b.sep { align-self: center; max-width: none; font-size: 11.5px; color: var(--mut); text-transform: uppercase; letter-spacing: .05em; padding: 4px 0 }
.ai-arch { display: flex; flex-direction: column; gap: 8px }
.ai-arch-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 0 6px }
.ai-arch-i { text-align: left; border: 1px solid var(--line); background: var(--surf); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px }
.ai-arch-i:hover { border-color: color-mix(in srgb, var(--acc) 45%, var(--line)) }
.ai-arch-i small { color: var(--mut); font-size: 12px }
.form.plform { grid-template-columns: repeat(4, minmax(0, 1fr)) }
.inl.plw input { width: auto !important; flex: 1 }
@media (max-width: 720px) { .form.plform { grid-template-columns: 1fr 1fr } }

/* ---------- Planning des salariés et espace salarié ---------- */
.sp-grid { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px }
.sp-grid th, .sp-grid td { border-bottom: 1px solid var(--line2); padding: 6px; vertical-align: top; text-align: left }
.sp-grid thead th { font-weight: 520; color: var(--mut); font-size: 12px; background: var(--surf2) }
.sp-grid thead th b { color: var(--ink) }
.sp-grid thead th.today b { background: var(--acc); color: #fff; border-radius: 99px; padding: 0 6px }
.sp-grid tbody th { font-weight: 560; white-space: nowrap; width: 170px }
.sp-grid tbody th .av { margin-right: 8px }
.sp-grid td { width: 12%; border-left: 1px solid var(--line2) }
.sp-grid td.today { background: color-mix(in srgb, var(--acc) 5%, transparent) }
.sp-grid td.we { background: var(--surf2) }
.sp-grid tfoot th, .sp-grid tfoot td { color: var(--mut); font-size: 12px; border-bottom: 0 }
.sp-grid.hours td { width: auto }
.sp-abs, .sp-ev { display: block; width: 100%; text-align: left; border-radius: 7px; padding: 3px 7px; margin: 0 0 4px; font-size: 12px; line-height: 1.35; border: 1px solid var(--line); background: var(--surf); color: var(--ink2) }
.sp-abs { font-weight: 560 }
.sp-abs.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent }
.sp-abs.warn { background: var(--warn-bg); color: var(--warn); border: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent) }
.sp-abs.bad { text-decoration: line-through; color: var(--mut) }
.sp-ev { border-left: 3px solid var(--acc) }
.sp-ev b { font-variant-numeric: tabular-nums }
.sp-add { width: 100%; border: 1px dashed transparent; background: none; color: transparent; border-radius: 7px; height: 26px }
.sp-grid td:hover .sp-add { border-color: var(--line); color: var(--mut) }
.sp-leg { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px }
.sp-leg .sp-abs, .sp-leg .sp-ev { display: inline-block; width: auto; margin: 0 }
.seg em.cnt { font-style: normal; background: var(--acc); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; margin-left: 4px }
.md-week { list-style: none; margin: 10px 0 0; padding: 0 }
.md-week li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line2); align-items: start }
.md-week li.today .md-d b { background: var(--acc); color: #fff; border-radius: 99px; padding: 0 6px }
.md-d { color: var(--mut); font-size: 12.5px }
.md-d b { color: var(--ink) }
.md-c .sp-abs, .md-c .sp-ev { margin-bottom: 3px }
.md-h { font-size: 12.5px; color: var(--ink2); white-space: nowrap }
@media (max-width: 720px) { .sp-grid tbody th { width: 110px; white-space: normal } }
/* Fenêtre de confirmation (Y.confirm), au-dessus de la fenêtre principale */
#ask .ask-c { padding: 20px 22px 16px }
#ask .ask-m { margin: 0; font-size: 15px; line-height: 1.5; white-space: pre-line }
#ask .df { margin-top: 18px }
@media (max-width: 640px) { #ask { width: calc(100vw - 24px); max-width: calc(100vw - 24px); margin: auto; border-radius: 18px } }
/* Pastille « fiche incomplète » (clients, console du créateur) */
.miss { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 7px; border-radius: 50%; background: var(--bad); color: #fff; font: 700 11.5px/1 system-ui, sans-serif; vertical-align: 2px; flex: none; cursor: help }
h1 .miss { width: 21px; height: 21px; font-size: 14px; vertical-align: 4px }
.note.miss-n { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px }
.note.miss-n .miss { margin: 1px 0 0 }
/* Chantier : travaux à faire et notes datées de l'équipe */
.todo-l { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px }
.todo-l li { padding: 6px 0 6px 18px; border-top: 1px solid var(--line2); position: relative; font-size: 14px }
.todo-l li:first-child { border-top: 0 }
.todo-l li::before { content: ''; position: absolute; left: 2px; top: 13px; width: 7px; height: 7px; border-radius: 2px; border: 1.5px solid var(--mut) }
.todo-l li.h { padding-left: 0; font-weight: 620; margin-top: 6px }
.todo-l li.h::before { display: none }
.fil-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; margin-bottom: 12px }
.fil-add textarea { width: 100%; min-height: 56px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surf); color: var(--ink); font: inherit; resize: vertical }
.fil { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px }
.fil li { border-left: 3px solid color-mix(in srgb, var(--acc) 55%, var(--line)); padding: 2px 0 2px 12px }
.fil li.resp { border-left-color: var(--ink2, var(--mut)) }
.fil-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px }
.fil-h time { color: var(--mut); font-size: 12px }
.fil p { margin: 3px 0 0; font-size: 14px }
@media (max-width: 640px) { .fil-add { grid-template-columns: minmax(0, 1fr) } }
/* Planning : équipe différente selon les jours */
.pl-team { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; max-height: 300px; overflow: auto }
.pl-team table { border-collapse: collapse; width: 100%; font-size: 13px }
.pl-team th, .pl-team td { padding: 6px 10px; border-top: 1px solid var(--line2); text-align: center; white-space: nowrap }
.pl-team thead th { position: sticky; top: 0; background: var(--surf2); border-top: 0; font-weight: 600 }
.pl-team th:first-child, .pl-team td:first-child { text-align: left; position: sticky; left: 0; background: var(--surf) }
.pl-team thead th:first-child { background: var(--surf2); z-index: 1 }
.pl-team tr.we td { color: var(--mut) }
.pl-team input { width: 18px; height: 18px; accent-color: var(--acc) }
/* Planning : couleur automatique de chaque personne (--pc), légende cliquable */
.pev-w i { border-color: color-mix(in srgb, var(--pc, var(--mut)) 45%, var(--line2)); background: color-mix(in srgb, var(--pc, var(--mut)) 13%, var(--surf)); color: var(--ink) }
.pev-w i::before, .chip.pc::before, .pl-leg button::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pc, var(--mut)); margin-right: 4px; vertical-align: 1px }
.pl-leg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px }
.pl-leg button { border: 1px solid var(--line); background: var(--surf); color: var(--ink2); border-radius: 99px; padding: 3px 10px; font-size: 12.5px }
.pl-leg button.on { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 15%, var(--surf)); color: var(--ink); font-weight: 600 }
/* Accueil : « Mon planning » */
.myplan .mp-day + .mp-day { margin-top: 10px }
.myplan h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); font-weight: 600 }
.myplan ul { list-style: none; margin: 0; padding: 0 }
.myplan li button { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line2); padding: 9px 2px; color: var(--ink) }
.myplan li:first-child button { border-top: 0 }
.myplan li button:hover { background: var(--surf2) }
.mp-h { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 14px }
.mp-h small, .mp-i small { display: block; color: var(--mut); font-weight: 400; font-size: 12px }
.mp-i { min-width: 0 }
.mp-i b { font-weight: 600 }
.mp-i small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
/* Planning mensuel : pastilles (initiales) de la couleur de chaque personne programmée */
.pev-d { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 1px }
.pev-d i { font-style: normal; display: inline-grid; place-items: center; min-width: 18px; height: 16px; padding: 0 3px; border-radius: 99px; background: var(--pc, var(--mut)); color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .02em; line-height: 1 }
/* Centre de notifications */
.btn.bell { position: relative; padding: 0 11px }
.btn.bell em, .adm-bell em { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff; font: 700 11px/18px system-ui, sans-serif; font-style: normal; text-align: center }
.nlist { list-style: none; margin: 0; padding: 0 }
.nlist li button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line2); padding: 12px 18px; color: var(--ink) }
.nlist li:first-child button { border-top: 0 }
.nlist li button:hover { background: var(--surf2) }
.nlist li.unread button { background: color-mix(in srgb, var(--acc) 6%, var(--surf)) }
.nlist .nl-t b { font-weight: 560; display: block }
.nlist li.unread .nl-t b { font-weight: 680 }
.nlist .nl-t small { display: block; color: var(--mut); font-size: 13px; white-space: pre-line; margin-top: 2px }
.nlist time { color: var(--mut); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px }
.nlist .dot.acc { background: color-mix(in srgb, var(--acc) 16%, var(--surf)); color: var(--acc) }

/* ---------- Éditeur = le document lui-même (2.11), disposé comme Pennylane et comme le PDF ----------
   Page plein écran : titre en haut, feuille blanche au centre (toujours claire), barre d'actions en bas.
   Les champs (.fx) sont des cases claires posées sur la feuille, à la place de la valeur imprimée. */
dialog.docpage { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; border-radius: 0; background: var(--bg); box-shadow: none; overflow: auto }
dialog.docpage::backdrop { background: var(--bg) }
html.ai-open dialog.docpage:not(:modal) { width: auto; height: auto; border: 0; border-radius: 0 }
dialog.docpage #dlgc { padding: 0; min-height: 100%; display: flex; flex-direction: column }
.dp-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: 12px 22px; background: var(--surf); border-bottom: 1px solid var(--line2) }
.dp-bar b { font-family: var(--display); font-size: 17px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.dp-bar .sp { flex: 1 }
.dp-desk { flex: 1; padding: 26px 16px 30px }
.dp-desk .ed { max-width: 940px; margin: 0 auto }
.dp-foot { position: sticky; bottom: 0; z-index: 3; display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; padding: 12px 22px calc(12px + env(safe-area-inset-bottom)); background: var(--surf); border-top: 1px solid var(--line2) }
.dp-foot .btn { justify-content: center }
.paper.edp { --pp: 44px; padding: 40px var(--pp) 26px; font-size: 12.5px; color: #1c1c1e }
.edp h4 { margin: 0 0 8px; font-family: var(--display); font-size: 15px; font-weight: 650; color: #1c1c1e }
.edp small { color: #6b6965 }
/* Cases de saisie posées sur la feuille */
.paper.edp .fx.fx.fx { border: 1px solid #e1dfda; background: #fff; color: #1c1c1e; font: inherit; font-size: 13px; padding: 5px 8px; margin: 0; min-height: 32px; height: auto; border-radius: 6px; box-shadow: none; outline: 0; width: 100%; transition: border-color .12s, box-shadow .12s }
.paper.edp .fx.fx.fx::placeholder { color: #a8a49c }
.paper.edp .fx.fx.fx:hover { border-color: #c9c6bf }
.paper.edp .fx.fx.fx:focus { border-color: var(--doc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--doc) 18%, transparent) }
.paper.edp .fx.bad.fx.fx { border-color: #d92d20 }
.paper.edp .fx.w5.fx.fx { width: 76px; text-align: right; display: inline-block }
.paper.edp textarea.fx.fx.fx { resize: vertical; line-height: 1.45 }
.paper.edp .ldi::-webkit-calendar-picker-indicator { display: none !important }
.edp .lnk { color: var(--doc); font-weight: 600; font-size: 13px; display: inline-flex; gap: 5px; align-items: center; padding: 4px 0 }
.edp .kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 10px; margin: 0 0 5px; font-size: 12.5px }
.edp .kv > span { font-weight: 600; color: #3c3a36 }
.edp .kv > div { min-width: 0 }
.edp .kv .fx.fx.fx[type=date] { max-width: 180px }
.edp .nowrap { white-space: nowrap }
/* En-tête : logo à gauche, entreprise émettrice à droite */
.pl-h { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start }
.pl-logo img { height: calc(var(--lh, 30) * (100cqw + 2 * var(--pp)) / 210); width: auto; max-width: calc(110 * (100cqw + 2 * var(--pp)) / 210); object-fit: contain; object-position: left; display: block }
.pl-name { font-family: var(--display); font-size: 22px; color: var(--doc) }
.pl-from { display: grid; gap: 1px; min-width: 0; width: min(330px, 46%); font-size: 12px; color: #3c3a36 }
.pl-from b { font-size: 13.5px; color: #1c1c1e; text-transform: uppercase; letter-spacing: .01em }
/* Type, numéro, dates | destinataire */
.pl-mid { display: grid; grid-template-columns: minmax(0, 1fr) min(330px, 46%); gap: 24px; margin-top: 26px }
.pl-t { margin: 0 0 10px; font-family: var(--display); font-size: 21px; color: var(--doc) }
.pl-to { display: grid; gap: 6px; align-content: start }
.pl-cli { display: grid; gap: 1px; font-size: 12px; color: #3c3a36; padding: 2px 2px 0 }
.edp .req { display: flex; align-items: center; gap: 5px; margin: 0; color: #d92d20; font-weight: 600; font-size: 12px }
.edp .req .ic { background: #d92d20; color: #fff; border-radius: 50%; padding: 1px }
.pl-links { margin: 16px 0 4px }
.pl-obj { margin: 18px 0 4px; display: grid; gap: 4px }
.paper.edp .pl-obj .fx.fx.fx { font-size: 15px; font-weight: 650 }
/* Tableau des lignes */
.paper.edp table.elines { margin-top: 14px; table-layout: fixed }
.paper.edp .elines th { font-size: 11.5px; padding: 7px 6px }
.elines th:nth-child(2) { width: 150px } .elines th:nth-child(3) { width: 104px }
.edp:not(.nofr) .elines th:nth-child(4) { width: 82px }
.elines th.r { width: 96px } .paper.edp .elines th.lx { width: 62px; background: var(--doc) }
.paper.edp .elines td { padding: 5px 4px; vertical-align: middle }
.paper.edp .elines td.r { font-weight: 600; white-space: nowrap; padding-right: 8px }
.paper.edp .elines tr.tt td { padding-top: 10px }
.paper.edp .elines tr.tt .fx.fx.fx { font-weight: 650; background: #f6f5f2 }
.ldw { display: flex; gap: 4px; align-items: center }
.qu { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 4px }
.paper.edp .lq.fx.fx, .paper.edp .lp.fx.fx { text-align: right }
.elines .la { display: flex; gap: 0; justify-content: flex-end }
.elines .la .ib { width: 28px; height: 28px; color: #8a8780; background: none; border: 0; box-shadow: none }
.lcatw { position: relative; flex: none; width: 30px; height: 32px; display: inline-grid; place-items: center; color: var(--doc); border: 1px solid #e1dfda; border-radius: 6px; cursor: pointer; background: #fff }
.lcatw:hover { border-color: var(--doc) }
.lcatw select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100% }
.edp .dp-add { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 20px; padding: 10px 0 4px; border-bottom: 1px solid #e6e3de }
/* Détails TVA | récapitulatif */
.pl-sum { display: grid; grid-template-columns: minmax(0, 1fr) min(330px, 46%); gap: 24px; margin-top: 22px }
.paper.edp #evat th { background: none; color: #3c3a36; padding: 4px 6px 4px 0; font-size: 12px }
.paper.edp #evat td { border: 0; padding: 2px 6px 2px 0; color: #6b6965 }
.pl-adj { display: grid; justify-items: end; gap: 4px; margin-bottom: 6px }
.pl-adj .kv { grid-template-columns: auto 76px; margin: 0 }
.pl-rec div { display: flex; justify-content: space-between; padding: 3px 8px; font-weight: 600 }
.pl-rec div span:last-child { font-variant-numeric: tabular-nums }
.pl-rec .big { background: #eeedea; border-radius: 4px; margin-top: 4px; padding: 7px 8px; font-size: 14px; color: var(--doc) }
/* Paiement ou conditions | mention spéciale */
.pl-pay { display: grid; grid-template-columns: minmax(0, 1fr) min(330px, 46%); gap: 24px; margin-top: 26px; align-items: start }
.pl-box { background: #f1f0ed; border-radius: 6px; padding: 14px 16px }
.pl-box .kv { grid-template-columns: 150px minmax(0, 1fr); margin-bottom: 3px }
.pl-box .chk { margin-top: 8px; font-size: 12px !important; color: #3c3a36 !important }
.pl-note { display: grid; gap: 4px; align-content: start }
/* Mentions, signature, pied de page */
.edp-m { margin-top: 26px }
.edp-m p { margin: 0 0 3px }
.edp .pp-s { margin-top: 14px }
.edp-f { margin-top: 22px; padding-top: 10px; border-top: 1px solid #1c1c1e; font-size: 11px; color: #3c3a36 }
.edp-f:empty { display: none }
@media (max-width: 720px) {
  dialog.docpage, dialog.docpage.docpage { width: 100vw; max-width: 100vw; height: 100dvh; max-height: none; margin: 0; border-radius: 0 }
  .dp-bar { padding: 10px 12px }
  .dp-desk { padding: 10px 8px 16px }
  .dp-foot { grid-template-columns: 1fr 1fr; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) }
  .dp-foot .btn:last-child { grid-column: 1 / -1 }
  .paper.edp { --pp: 16px; padding: 20px var(--pp) 18px }
  .pl-h { flex-direction: column; gap: 14px }
  .pl-from, .pl-mid, .pl-sum, .pl-pay { width: auto }
  .pl-mid, .pl-sum, .pl-pay { grid-template-columns: 1fr; gap: 18px }
  .edp .kv { grid-template-columns: 120px minmax(0, 1fr) }
  .elines thead { display: none }
  .elines, .elines tbody { display: block }
  .elines tr.el { display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "d d" "q q" "p t" "h c" "x x"; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid #ecebe8 }
  .nofr .elines tr.el { grid-template-areas: "d d" "q p" "h x" }
  .paper.edp .elines tr.el td { display: block; border: 0; padding: 0; text-align: left }
  .elines .cd { grid-area: d } .elines .cq { grid-area: q } .elines .cp { grid-area: p } .elines .ct { grid-area: t } .elines .cht { grid-area: h } .elines .cc { grid-area: c } .elines .lx { grid-area: x }
  .elines tr.tt { display: grid; grid-template-columns: 1fr auto }
  .elines .cq::before, .elines .cp::before, .elines .ct::before, .elines .cht::before, .elines .cc::before { display: block; font-size: 10px; font-weight: 500; color: #8c8a85; text-transform: uppercase; letter-spacing: .04em; margin: 2px 0 2px }
  .elines .cq::before { content: "Quantité et unité" } .elines .cp::before { content: "Prix unitaire HT" } .elines .ct::before { content: "TVA" } .elines .cht::before { content: "Total HT" } .elines .cc::before { content: "Total TTC" }
  .edp .dp-add { justify-content: flex-start }
}

/* ---------- Recherche dans le répertoire Sirene (fiche client, fiche entreprise) ---------- */
.sir { background: var(--surf2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px }
.sir-row { display: flex; gap: 8px; min-width: 0 }
.sir-row input { flex: 1; min-width: 0 }
.sir-row .btn { flex: none }
.sir small.sir-ok { color: var(--ok) }
.sir small.sir-warn { color: var(--warn) }
.sir small.sir-bad { color: var(--bad) }
.sir-n { margin: 6px 0 4px; font-size: 13px; color: var(--ink2) }
.sir-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow: auto }
.sir-list button { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surf, #fff); color: inherit; font: inherit; cursor: pointer }
.sir-list button:hover, .sir-list button:focus-visible { border-color: var(--acc) }
.sir-list b { font-size: 14px } .sir-list b i { font-weight: 500; color: var(--mut) }
.sir-list small { color: var(--mut); font-size: 12px } .sir-list em { color: var(--bad); font-style: normal; font-weight: 600 }
@media (max-width: 520px) { .sir-row { flex-direction: column } .sir-row .btn { justify-content: center } }
