/* Oc'Digital+ : la charte d'Oc'Digital (site/src/styles/global.css, forms.css, app.css), plus ce qui est propre
   à l'appli (Oc'Digital+/CHARTE-MODULES.md, section 5). Depuis le 11/11/2026 c'est une suite d'administration :
   en-tête (logo, fil d'Ariane, compte), colonne de navigation, feuille de travail pleine largeur, tableaux.
   Les couleurs des modules sont dans couleurs-modules.css, chargé juste après. */

@font-face { font-family: 'Hanken Grotesk Variable'; src: url('/polices/hanken-grotesk.woff2') format('woff2-variations'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Fraunces Variable'; src: url('/polices/fraunces.woff2') format('woff2-variations'); font-weight: 100 900; font-display: swap; }

:root {
  --brun: #6b5238; --brun-fonce: #4e3b27; --ocre: #c8873a; --creme: #fdfdf5;
  --bg: var(--creme); --surface: #fffef9; --surface-2: #f2eee3; --text: #2a2017; --text-muted: #67594a; --border: #ddd5c4;
  --accent: var(--ocre); --accent-text: #8a5520; --brand: var(--brun); --brand-hover: var(--brun-fonce);
  --btn-bg: var(--brand); --btn-text: var(--creme); --cta-bg: var(--ocre); --cta-text: #24180c;
  --logo-ring: var(--brun); --error: #a3301c; --ok: #2f8f5b; --shadow: 42 32 23;
  --font-sans: 'Hanken Grotesk Variable', system-ui, sans-serif;
  --font-display: 'Fraunces Variable', Georgia, serif;
  --step--1: clamp(0.875rem, 0.85rem + 0.1vw, 0.94rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.4rem + 0.9vw, 2.1rem);
  --space-xs: 0.5rem; --space-s: 1rem; --space-m: 1.5rem; --space-l: 2.5rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1); --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --tete: 4rem;      /* hauteur de l'en-tête collant */
  --cote: 15.5rem;   /* largeur de la colonne de navigation, sur ordinateur */
  --barre: calc(4.1rem + env(safe-area-inset-bottom, 0px)); /* hauteur de la barre du bas sur téléphone */
  --teinte: color-mix(in srgb, var(--brand) 12%, transparent); /* survol et fonds discrets : le brun à 12 % */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #19140f; --surface: #211a14; --surface-2: #2a2119; --text: #f3eee2; --text-muted: #c3b6a4; --border: #3c3125;
    --accent-text: #e3ad6c; --brand: #7d6043; --brand-hover: #8d6e4f; --btn-bg: #7d6043; --logo-ring: #d9b58a;
    --error: #ff9b85; --shadow: 0 0 0; color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #19140f; --surface: #211a14; --surface-2: #2a2119; --text: #f3eee2; --text-muted: #c3b6a4; --border: #3c3125;
  --accent-text: #e3ad6c; --brand: #7d6043; --brand-hover: #8d6e4f; --btn-bg: #7d6043; --logo-ring: #d9b58a;
  --error: #ff9b85; --shadow: 0 0 0; color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: color-mix(in srgb, var(--brand) 55%, var(--bg)) var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: var(--step-0); line-height: 1.6; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 {
  font-family: var(--font-display); font-weight: 560; font-variation-settings: 'SOFT' 80, 'WONK' 0, 'opsz' 48;
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-s); text-wrap: balance;
}
p { margin: 0 0 var(--space-s); text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.2em; }
a:hover { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: #1a120a; }
input, button, select, textarea { font: inherit; }
input, textarea { caret-color: var(--accent); }
.doux { color: var(--text-muted); }
.petit { font-size: var(--step--1); color: var(--text-muted); }
.chargement { color: var(--text-muted); padding: var(--space-l) var(--gutter); }
.nowrap { white-space: nowrap; }
.visuel-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: var(--space-s); top: -4rem; background: var(--btn-bg); color: var(--btn-text); padding: 0.6em 1em; border-radius: 10px; z-index: 100; }
.skip-link:hover, .skip-link:focus { color: var(--btn-text); }
.skip-link:focus { top: var(--space-s); }

/* ---------- Boutons (charte mère, section 8) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em; padding: 0.8em 1.4em; border-radius: 999px;
  font-weight: 600; text-decoration: none; background: var(--btn-bg); color: var(--btn-text); border: 2px solid var(--btn-bg); cursor: pointer;
  transition: transform 160ms cubic-bezier(0.2, 0, 0, 1), background-color 160ms, border-color 160ms;
}
.btn:hover { color: var(--btn-text); background: var(--brand-hover); border-color: var(--brand-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.7; cursor: progress; transform: none; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { color: var(--text); background: transparent; border-color: var(--text); }
.btn--plein { display: flex; width: 100%; text-align: center; }
.btn--small { padding: 0.6em 1.15em; font-size: 0.95rem; }
/* Un seul bouton ocre par écran : l'action qui compte (« Envoyer la réponse », « Importer les fiches »). */
.btn--cta { background: var(--cta-bg); border-color: var(--cta-bg); color: var(--cta-text); }
.btn--cta:hover { background: #b57629; border-color: #b57629; color: var(--cta-text); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--text-muted); text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; cursor: pointer; }
.linkbtn:hover { color: var(--accent-text); }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 0.4rem; margin: 0; }
.field > label { font-weight: 600; }
.field input:not([type='checkbox'], [type='radio'], [type='file']), .field textarea, .field select {
  width: 100%; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 0.75rem 0.9rem; min-height: 3rem; font: inherit; font-size: 1rem; transition: border-color 160ms, box-shadow 160ms;
}
.field textarea { resize: vertical; min-height: 5.5rem; line-height: 1.5; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--text-muted); }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.field input:disabled, .field select:disabled { opacity: 0.65; cursor: not-allowed; }
.field [aria-invalid='true'] { border-color: var(--error); }
.field input[type='file'] { font: inherit; font-size: var(--step--1); padding: 0.6rem 0; color: var(--text-muted); max-width: 100%; }
/* Le bouton du sélecteur de fichiers : un bouton discret de l'appli, pas celui du navigateur. */
.field input[type='file']::file-selector-button {
  font: inherit; font-weight: 600; color: var(--text); background: transparent; border: 1px solid var(--border); border-radius: 999px;
  padding: 0.5em 1.1em; margin-right: 0.8rem; cursor: pointer; transition: border-color 160ms;
}
.field input[type='file']::file-selector-button:hover { border-color: var(--text); }
.field__err { margin: 0; color: var(--error); font-size: var(--step--1); }
.field__err:empty { display: none; }
.field .aide { font-weight: 400; color: var(--text-muted); }
.field .petit:empty { display: none; }
.field__titre { font-weight: 600; }
fieldset.field { border: 0; padding: 0; min-width: 0; }
fieldset.field legend { font-weight: 600; padding: 0; margin-bottom: 0.4rem; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choice { display: inline-flex; align-items: center; gap: 0.6rem; cursor: pointer; }
.choices .choice { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.9rem; min-height: 2.75rem; transition: border-color 160ms, background-color 160ms; }
.choices .choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.choice input { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); margin: 0; flex: none; }
.ligne { display: flex; flex-wrap: wrap; gap: var(--space-s); align-items: flex-start; }
.ligne > .field { flex: 1 1 12rem; }
.field input.code { font-size: 1.6rem; letter-spacing: 0.3em; font-variant-numeric: tabular-nums; max-width: 12rem; text-align: center; padding-inline: 0.5rem; }
.form-status { margin: 0; font-size: var(--step--1); }
.form-status:empty { display: none; }
.form-status[data-state] { padding: 0.75rem 0.9rem; border-radius: 8px; }
.form-status[data-state='pending'] { background: var(--bg); }
.form-status[data-state='error'] { background: color-mix(in srgb, var(--error) 12%, transparent); }
.form-status[data-state='ok'] { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.pile { display: grid; gap: var(--space-s); }
/* Un formulaire garde une largeur de lecture, même dans une feuille large. */
form.pile { max-width: 46rem; }

/* ---------- États, lignes ---------- */
.tag { display: inline-flex; align-items: center; gap: 0.45em; font-size: var(--step--1); font-weight: 600; white-space: nowrap; color: var(--text); }
.tag::before { content: ''; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--text-muted); flex: none; }
.tag--ok::before { background: var(--ok); }
.tag--warn::before { background: var(--accent); }
.tag--err::before { background: var(--error); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.rows > li:first-child { border-top: 1px solid var(--border); }
.rows .grow { flex: 1 1 14rem; min-width: 0; }
.rows .meta { display: block; color: var(--text-muted); font-size: var(--step--1); }
.rows .num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-muted); font-size: var(--step--1); }
.rows a { font-weight: 600; overflow-wrap: anywhere; }
.rows .fin { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; }
.vide { color: var(--text-muted); margin: 0; padding: 0.8rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.notice { margin: 0 0 var(--space-m); padding: 0.85rem 1rem; border-radius: 8px; background: color-mix(in srgb, var(--accent) 16%, transparent); }
/* Ce qui n'a pas marché et attend le gérant (réponse pas partie, boîte en panne) : la teinte des erreurs, texte à l'encre. */
.alerte { margin: 0 0 var(--space-s); padding: 0.85rem 1rem; border-radius: 8px; background: color-mix(in srgb, var(--error) 12%, transparent); max-width: 62ch; }
.lignes { white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- Le symbole et le nom ---------- */
.logo { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--logo-ring); text-decoration: none; }
.logo:hover { color: var(--logo-ring); }
.logo .nom { color: var(--text); font-size: 1.15rem; }
.nom { font-weight: 300; letter-spacing: -0.02em; white-space: nowrap; }
.nom b { font-weight: 750; }
.sym { flex: none; }
.sym__carre { fill: var(--ocre); stroke: var(--bg); }

/* ---------- En-tête : logo à gauche, puis le fil d'Ariane ; à droite le compte et le bouton jour/nuit ---------- */
.tete {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-s);
  min-height: var(--tete); padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.tete .logo { flex: none; }
.tete__fin { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex: none; }
/* Un écran se charge : un trait brun avance sous l'en-tête, une fois, tant que la réponse n'est pas là. */
.tete::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); transform-origin: left; transform: scaleX(0); opacity: 0; }
:root.charge .tete::after { opacity: 1; animation: charge 8s var(--ease-out) forwards; }
@keyframes charge { to { transform: scaleX(0.92); } }

/* Le fil d'Ariane : où l'on est dans le classeur. Sur ordinateur seulement ; sur téléphone, le lien de retour suffit. */
.fil { display: none; min-width: 0; }
.fil ol { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 0.6rem; font-size: var(--step--1); min-width: 0; }
.fil li { display: flex; align-items: center; gap: 0.6rem; min-width: 0; white-space: nowrap; }
.fil li + li::before { content: ''; flex: none; width: 0.4em; height: 0.4em; border: solid var(--text-muted); border-width: 2px 2px 0 0; transform: rotate(45deg); }
.fil a { color: var(--text-muted); font-weight: 600; text-decoration: none; }
.fil a:hover { color: var(--accent-text); }
.fil li:last-child { flex: 0 1 auto; overflow: hidden; }
.fil [aria-current] { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* Le compte : un rond aux initiales, qui ouvre un petit menu. */
.compte { position: relative; flex: none; }
.compte > summary {
  list-style: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  background: var(--teinte); color: var(--text); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.02em; cursor: pointer;
  transition: background-color 160ms, color 160ms;
}
.compte > summary::-webkit-details-marker { display: none; }
.compte > summary:hover, .compte[open] > summary { background: var(--brand); color: var(--creme); }
.menu {
  position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 30; width: min(19rem, calc(100vw - 2 * var(--gutter))); padding: 0.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 2px rgb(var(--shadow) / 0.12), 0 18px 30px -24px rgb(var(--shadow) / 0.5);
}
.compte[open] > .menu { animation: menu 180ms var(--ease-out); }
@keyframes menu { from { transform: translateY(-6px); opacity: 0; } }
.menu__qui { margin: 0; padding: 0.5rem 0.75rem 0.7rem; display: grid; line-height: 1.35; border-bottom: 1px solid var(--border); }
.menu__qui span { color: var(--text-muted); font-size: var(--step--1); overflow-wrap: anywhere; }
.menu ul { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; gap: 0.1rem; }
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 0.6rem 0.75rem; border-radius: 8px; border: 0; background: none;
  color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color 160ms;
}
.menu a:hover, .menu button:hover { background: var(--teinte); color: var(--text); }

.theme {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 50%; flex: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color 160ms, transform 300ms var(--ease-out);
}
.theme:hover { border-color: var(--brand); }
.theme:active { transform: rotate(-20deg) scale(0.94); }
.theme svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme__lune { display: none; }
:root[data-theme='dark'] .theme__soleil { display: none; }
:root[data-theme='dark'] .theme__lune { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme__soleil { display: none; }
  :root:not([data-theme='light']) .theme__lune { display: block; }
}

/* ---------- Structure : téléphone d'abord ---------- */
.corps { padding: var(--space-s) var(--gutter) calc(var(--barre) + var(--space-l)); }
.corps:focus { outline: none; }
.nav-cote { display: none; }

/* L'onglet du module, posé sur la feuille (même construction que l'onglet du devis du site). */
.onglet {
  display: inline-flex; align-items: center; gap: 0.5rem; position: relative; z-index: 1; margin-bottom: -1px; align-self: flex-start;
  background: var(--module); color: var(--creme); padding: 0.45rem 1rem 0.4rem 0.7rem; border-radius: 14px 14px 0 0;
  max-width: 100%;
}
.onglet .sym { color: var(--creme); }
.onglet .sym__carre { stroke: var(--module); }
.onglet .nom { font-size: 1.08rem; }
.onglet__texte { font-weight: 600; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* La feuille : la surface de travail. Ses blocs se rangent selon sa largeur à elle (colonne de navigation ou cadre compris). */
.feuille { background: var(--surface-2); border-radius: 0 16px 16px 16px; padding: clamp(1.15rem, 0.8rem + 1.6vw, 2.25rem); container: feuille / inline-size; }
.feuille h1 { font-size: clamp(1.6rem, 1.3rem + 1.1vw, 2.15rem); margin-bottom: 0.3rem; }
.feuille h2 { font-size: var(--step-1); margin: 0 0 0.35rem; }

/* En-tête d'un écran : le titre et son état à gauche, les actions à droite. */
.page-tete { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-s) var(--space-m); margin-bottom: var(--space-m); }
.page-tete__titre { flex: 1 1 18rem; min-width: 0; }
.page-tete h1 { margin: 0; overflow-wrap: anywhere; }
.page-tete__etat { margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; color: var(--text-muted); max-width: 70ch; }
.page-tete__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.1rem; }
.retour { margin: 0 0 var(--space-s); font-size: var(--step--1); }
.retour a { color: var(--text-muted); font-weight: 600; text-decoration: none; }
.retour a::before { content: ''; display: inline-block; width: 0.45em; height: 0.45em; margin-right: 0.45em; border: solid currentColor; border-width: 0 0 2px 2px; transform: translateY(-0.1em) rotate(45deg); }
.retour a:hover { color: var(--accent-text); }

/* Blocs d'un écran : coiffés d'un trait de 2 px (charte mère, section 6). */
.partie { border-top: 2px solid var(--text); padding-top: var(--space-s); margin-top: var(--space-l); }
.partie--accent { border-top-color: var(--accent); }
.partie--premiere { margin-top: 0; }
.partie > .petit { margin-bottom: var(--space-s); max-width: 56ch; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-s) var(--space-m); margin-top: var(--space-m); }
.actions--fin { justify-content: flex-end; }

/* Deux colonnes dès que la feuille est assez large : le principal à gauche, ce qui l'accompagne à droite. */
.deux { display: grid; gap: var(--space-l) clamp(1.5rem, 4cqi, 3.5rem); align-items: start; }
.deux > * { min-width: 0; }
.deux > * > .partie:first-child { margin-top: 0; }
@container feuille (min-width: 58rem) {
  .deux { grid-template-columns: minmax(0, 1fr) minmax(17rem, 23rem); }
  .deux--large { grid-template-columns: minmax(0, 1fr) minmax(20rem, 30rem); }
}

/* Barre d'outils d'une liste : la recherche et les filtres d'un côté, le compte des lignes de l'autre. */
.outils { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem var(--space-s); margin: 0 0 var(--space-s); }
.outils__n { margin: 0 0 0 auto; font-size: var(--step--1); color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.recherche { position: relative; flex: 1 1 15rem; max-width: 26rem; margin: 0; }
.recherche svg { position: absolute; left: 0.85rem; top: 50%; translate: 0 -50%; color: var(--text-muted); pointer-events: none; }
.recherche input {
  width: 100%; min-height: 2.75rem; padding: 0.5rem 0.9rem 0.5rem 2.6rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 1rem; transition: border-color 160ms, box-shadow 160ms;
}
.recherche input::placeholder { color: var(--text-muted); opacity: 1; }
.recherche input:hover { border-color: var(--text-muted); }
.recherche input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
/* Filtres : pilules teintées de brun, brunes sur la page en cours (charte mère, section 7). */
.filtres { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 var(--space-s); }
.outils .filtres { margin: 0; }
.filtres a {
  padding: 0.45rem 0.95rem; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.95rem;
  background: var(--teinte); color: var(--text); transition: background-color 160ms, color 160ms;
}
.filtres a:hover, .filtres a[aria-current='page'] { background: var(--brand); color: var(--creme); }
.filtres .compte-n { font-variant-numeric: tabular-nums; opacity: 0.8; }
.pages { justify-content: space-between; margin-top: var(--space-s); }
.pages .petit { margin: 0; }
.pages__liens { display: flex; gap: var(--space-m); }

/* Tableaux de gestion : en-têtes discrets sous un trait de 2 px, lignes séparées d'un filet, toute la ligne s'ouvre.
   (Mêmes principes que les tableaux de l'administration d'ocdigital.cloud.) */
.tableau { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.table thead th { text-align: left; font-weight: 600; font-size: var(--step--1); color: var(--text-muted); padding: 0 1.25rem 0.55rem 0; border-bottom: 2px solid var(--text); white-space: nowrap; }
.table tbody th, .table td { text-align: left; font-weight: 400; padding: 0.7rem 1.25rem 0.7rem 0; border-bottom: 1px solid var(--border); vertical-align: top; transition: background-color 160ms; }
.table tr > :last-child { padding-right: 0; }
.table tbody th a { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.table tbody th a:hover { text-decoration: underline; }
.table .meta { display: block; color: var(--text-muted); font-size: var(--step--1); overflow-wrap: anywhere; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .date { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.table .fort { font-weight: 600; }
.table .etats { display: flex; flex-wrap: wrap; gap: 0.15rem 0.9rem; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover > * { background: color-mix(in srgb, var(--text) 4%, transparent); }
.table .non-lu th a, .table .non-lu .objet { font-weight: 750; }
.table .inactif th a, .table .inactif td { color: var(--text-muted); }
.table .barre a, .table .barre .heure { text-decoration: line-through; color: var(--text-muted); }
.tableau + .petit { margin-top: var(--space-s); }
/* Feuille étroite (téléphone, cadre) : chaque ligne devient une petite fiche. Le nom en tête, l'état à droite,
   le reste dessous en texte doux ; les colonnes secondaires (.large) attendent un écran plus grand. */
@container feuille (max-width: 44rem) {
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table, .table tbody { display: block; }
  .table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.1rem 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
  .table tbody tr:first-child { border-top: 1px solid var(--border); }
  .table tbody th, .table td { display: block; padding: 0; border: 0; grid-column: 1 / -1; }
  .table tbody th { grid-column: 1; }
  .table td { font-size: var(--step--1); color: var(--text-muted); text-align: left; }
  .table td.num { text-align: left; }
  .table td:empty, .table .large { display: none; }
  .table td.cote { grid-column: 2; grid-row: 1; justify-self: end; text-align: right; color: var(--text); }
  .table td.cote.num { text-align: right; font-weight: 600; }
  .table td[data-libelle]::before { content: attr(data-libelle) ' : '; }
}

/* Le relevé : des chiffres alignés comme sur un relevé de compte, pas des cartes (accueil, Oc'Factures). */
.releve { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 var(--space-m); border-top: 2px solid var(--text); border-bottom: 1px solid var(--border); }
.releve[data-n='3'] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.releve[data-n='2'] { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 44rem; }
.releve[data-n='1'] { grid-template-columns: minmax(0, 1fr); max-width: 22rem; }
.releve__chiffre { padding: 0.8rem 1rem 0.9rem 0; min-width: 0; }
.releve__chiffre + .releve__chiffre { padding-left: 1rem; border-left: 1px solid var(--border); }
.releve dt { font-size: var(--step--1); color: var(--text-muted); font-weight: 600; }
.releve dt a { color: inherit; }
.releve dt a:hover { color: var(--accent-text); }
.releve dd { margin: 0.15rem 0 0; display: grid; gap: 0.05rem; }
.releve__valeur { font-family: var(--font-display); font-variation-settings: 'SOFT' 60, 'opsz' 48; font-weight: 560; font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.7rem); line-height: 1.15; letter-spacing: -0.01em; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.releve__detail { font-size: var(--step--1); color: var(--text-muted); }
.releve__chiffre--retard .releve__valeur { color: var(--error); }
@container feuille (max-width: 40rem) {
  .releve, .releve[data-n='3'] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .releve__chiffre:nth-child(3) { padding-left: 0; border-left: 0; }
  .releve__chiffre:nth-child(n + 3) { border-top: 1px solid var(--border); }
}

/* Clé et valeur : coordonnées d'une fiche, montants d'un document. */
.kv { margin: 0 0 var(--space-m); display: grid; }
.kv > div { display: grid; grid-template-columns: minmax(6rem, 0.6fr) minmax(0, 1.4fr); gap: 0.25rem 1rem; padding: 0.65rem 0; border-bottom: 1px solid var(--border); }
.kv > div:first-child { border-top: 1px solid var(--border); }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.kv dd a { font-weight: 600; }
blockquote.message {
  margin: 0 0 var(--space-m); padding: var(--space-s) var(--space-m); background: var(--surface); border-radius: 12px;
  border: 1px solid var(--border); white-space: pre-line; overflow-wrap: anywhere; font-size: 1.05rem; max-width: 46rem;
}
/* Réponses envoyées : séparées par un filet de 1 px, comme les lignes du reste de l'appli. */
.reponse { margin: 0 0 var(--space-s); padding-top: var(--space-xs); border-top: 1px solid var(--border); max-width: 46rem; }
.reponse .meta { margin: 0 0 0.2rem; color: var(--text-muted); font-size: var(--step--1); }
.reponse .lignes { margin: 0; }
/* Historique d'une fiche : le dessin du module en texte doux, puis le mot. Pas de couleur de module. */
.histo .histo__mot { display: inline-flex; align-items: center; gap: 0.45rem; flex: 0 0 7.5rem; color: var(--text-muted); }
.histo .histo__mot strong { color: var(--text); font-weight: 600; }
.histo .grow a { font-weight: 400; }
details.plus { margin-top: var(--space-m); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
details.plus > summary { list-style: none; cursor: pointer; padding: 0.9rem 0; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
details.plus > summary::-webkit-details-marker { display: none; }
details.plus > summary::after { content: ''; width: 0.5rem; height: 0.5rem; margin-right: 0.3rem; border: solid var(--text-muted); border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); transition: transform 200ms cubic-bezier(0.2, 0, 0, 1); }
details.plus[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.plus > summary:hover { color: var(--accent-text); }
details.plus > form { padding-bottom: var(--space-m); }
details.plus + details.plus { margin-top: 0; border-top: 0; }
details.plus--danger > summary { color: var(--text-muted); font-weight: 500; }
details.plus--ligne { margin: 0; border: 0; flex-basis: 100%; }
details.plus--ligne > summary { padding: 0.2rem 0; font-size: var(--step--1); color: var(--text-muted); justify-content: flex-start; gap: 0.6rem; }
/* Une liste suivie de « Ajouter… » : un seul filet entre les deux. */
.rows + details.plus, .tableau + details.plus { margin-top: 0; border-top: 0; }

/* Accueil : la liste des modules, sans grille de cartes. */
.liste-modules a { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.liste-modules a:hover { text-decoration: underline; }
.liste-modules svg { color: var(--text-muted); flex: none; }
.liste-modules__off a { font-weight: 500; color: var(--text-muted); }
.liste-modules__off svg { opacity: 0.5; }

/* Module non activé : le logo du module en grand, une phrase, une action. */
.inactif-ecran { padding-block: var(--space-s) var(--space-xs); }
.inactif-ecran .sym { color: var(--module-trait); margin-bottom: var(--space-m); }
.inactif-ecran .sym__carre { stroke: var(--surface-2); }
.inactif-ecran .doux { max-width: 48ch; margin-bottom: 0; }

/* Navigation au trait : la pilule du module ouvert prend sa couleur, les autres restent en texte doux. */
.pilule {
  display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--text-muted);
  border-radius: 999px; border: 0; background: none; cursor: pointer; font: inherit; font-weight: 600;
  transition: background-color 160ms, color 160ms, transform 200ms var(--ease-out);
}
.pilule:hover { color: var(--text); background: var(--teinte); }
.pilule:active { transform: scale(0.97); }
.pilule[aria-current='page'], .pilule.actif { background: var(--module); color: var(--creme); }
/* Module non activé : toujours là, en retrait (dessin estompé, mot plus léger). Le texte garde le contraste AA. */
.pilule--off { color: color-mix(in srgb, var(--text-muted) 85%, var(--bg)); font-weight: 500; }
.pilule--off svg { opacity: 0.5; }
.pilule--off[aria-current='page'] { color: var(--creme); }
.pilule--off[aria-current='page'] svg { opacity: 1; }
/* Ce qui attend dans un module : un compte discret au bout de la pilule, teinté de brun. */
.pilule__n { margin-left: auto; min-width: 1.6rem; padding: 0.05rem 0.45rem; border-radius: 999px; text-align: center; font-size: 0.8rem; line-height: 1.5; font-variant-numeric: tabular-nums; background: var(--teinte); color: var(--text); }
.pilule__n:empty { display: none; }
.pilule[aria-current='page'] .pilule__n { background: color-mix(in srgb, var(--creme) 22%, transparent); color: var(--creme); }

/* Téléphone : barre en bas, cinq entrées au plus. */
.nav-bas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; gap: 2px;
  padding: 0.4rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--border);
}
.nav-bas > .pilule { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; padding: 0.35rem 0 0.3rem; font-size: 0.75rem; line-height: 1.2; min-height: 3.2rem; justify-content: center; }
.nav-bas > .pilule > span:first-of-type { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 2px; }
.nav-bas > .pilule .pilule__n { display: none; }

/* Liste complète des modules, ouverte par la dernière entrée de la barre. */
.tiroir {
  margin: auto 0 0; width: 100%; max-width: none; border: 0; border-radius: 16px 16px 0 0; padding: var(--space-m) var(--gutter) calc(var(--space-m) + env(safe-area-inset-bottom, 0px));
  background: var(--bg); color: var(--text); box-shadow: 0 -18px 30px -24px rgb(var(--shadow) / 0.5);
}
.tiroir::backdrop, .question::backdrop { background: rgb(25 20 15 / 0.45); }
.tiroir[open], .question[open] { animation: tiroir 260ms var(--ease-out); }
@keyframes tiroir { from { transform: translateY(24px); opacity: 0; } }
.tiroir h2 { font-size: var(--step-1); margin: 0 0 var(--space-s); }
.tiroir ul { list-style: none; margin: 0 0 var(--space-s); padding: 0; display: grid; gap: 0.25rem; }
.tiroir .pilule { padding: 0.7rem 1rem; }
.tiroir__fermer { width: 100%; }

/* Une question avant un geste qui ne se défait pas : posée dans l'appli, pas par la fenêtre du navigateur. */
.question {
  width: min(31rem, calc(100vw - 2rem)); border: 0; border-radius: 14px; padding: var(--space-m);
  background: var(--bg); color: var(--text); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5);
}
.question h2 { font-size: var(--step-1); margin: 0 0 0.5rem; }
.question p { margin: 0; color: var(--text-muted); }
.question .actions { margin-top: var(--space-m); gap: 0.6rem; }

/* Ce qui se passe en arrière-plan (un fichier qui se télécharge) : une ligne discrète au bas de l'écran. */
.annonce {
  position: fixed; left: 50%; bottom: calc(var(--barre) + 0.75rem); translate: -50% 0; z-index: 40; max-width: calc(100vw - 2rem); margin: 0;
  padding: 0.7rem 1.15rem; border-radius: 999px; background: var(--text); color: var(--bg); font-size: var(--step--1); font-weight: 600;
  box-shadow: 0 1px 2px rgb(var(--shadow) / 0.12), 0 14px 30px -18px rgb(var(--shadow) / 0.45);
}
.annonce:empty { display: none; }

/* Ordinateur : la colonne de navigation à gauche, la feuille de travail sur toute la place qui reste. */
@media (min-width: 900px) {
  .appli { display: grid; grid-template-columns: var(--cote) minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100dvh; }
  .tete { grid-column: 1 / -1; }
  /* Le logo occupe la largeur de la colonne : le fil d'Ariane commence à l'aplomb de la feuille. */
  .appli:not(.appli--seule, .appli--entree) .tete .logo { width: calc(var(--cote) + var(--space-m) - var(--gutter) - var(--space-s)); }
  .fil { display: block; }
  .nav-bas { display: none; }
  .nav-cote {
    display: flex; flex-direction: column; position: sticky; top: var(--tete); height: calc(100dvh - var(--tete)); overflow-y: auto;
    padding: var(--space-m) var(--space-s) var(--space-m) calc(var(--gutter) - 0.75rem); scrollbar-width: thin;
  }
  .nav-cote ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
  .nav-cote .pilule { padding: 0.55rem 0.7rem 0.55rem 0.75rem; }
  .nav-cote__entreprise { margin: 0 0 var(--space-s); padding: 0 0.75rem var(--space-s); border-bottom: 1px solid var(--border); display: grid; gap: 0.1rem; }
  .nav-cote__entreprise strong { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
  .nav-cote__entreprise span { font-size: var(--step--1); color: var(--text-muted); }
  .nav-cote__titre { margin: var(--space-m) 0 0.3rem 0.75rem; font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
  .nav-cote__bas { margin-top: auto; padding-top: var(--space-s); }
  .nav-cote__bas ul { padding-top: var(--space-s); border-top: 1px solid var(--border); }
  .corps { padding: var(--space-m) var(--gutter) var(--space-l) var(--space-m); width: 100%; max-width: 96rem; }
  /* La feuille descend jusqu'en bas de l'écran, même presque vide : c'est la page ouverte du classeur. */
  .dossier { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tete) - var(--space-m) - var(--space-l)); }
  .feuille { flex: 1; }
  .appli--seule .corps { grid-column: 1 / -1; margin-inline: auto; max-width: 60rem; padding-left: var(--gutter); }
  .appli--seule .dossier { min-height: 0; }
  .annonce { bottom: 1.25rem; }
}

/* ---------- Connexion et code d'appareil : un seul écran, brun et crème ---------- */
.appli--entree { display: flex; flex-direction: column; min-height: 100dvh; }
.entree { flex: 1; display: flex; align-items: center; padding: var(--space-l) var(--gutter) calc(var(--space-l) + env(safe-area-inset-bottom, 0px)); }
.entree__corps { width: 100%; max-width: 30rem; margin-inline: auto; }
.entree h1 { font-size: clamp(2.1rem, 1.6rem + 2.4vw, 3.2rem); line-height: 1.06; margin-bottom: var(--space-s); }
.entree h1 span { display: block; color: var(--accent-text); }
.entree .doux { max-width: 34ch; }
.entree .btn--plein { margin-block: var(--space-m) var(--space-s); }
.entree form { margin-top: var(--space-m); }

/* ---------- Changement de thème : dégradé en deux passages (repris de global.css) ---------- */
@property --tint { syntax: '<number>'; inherits: false; initial-value: 0; }
@property --sweep { syntax: '<percentage>'; inherits: false; initial-value: -40%; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root[data-curtain='day']::view-transition-new(root) {
  animation: theme-tint 900ms var(--ease-in-out) both, theme-sweep 760ms var(--ease-in-out) 750ms both;
  mask-image:
    linear-gradient(to bottom left, #000 calc(var(--sweep) - 40%), transparent calc(var(--sweep) + 40%)),
    linear-gradient(to top right, rgb(0 0 0 / 0) 0%, rgb(0 0 0 / calc(var(--tint) * 0.12)) 25%, rgb(0 0 0 / calc(var(--tint) * 0.34)) 50%, rgb(0 0 0 / calc(var(--tint) * 0.64)) 75%, rgb(0 0 0 / var(--tint)) 100%);
}
:root[data-curtain='night']::view-transition-group(root) { background: var(--bg); }
:root[data-curtain='night']::view-transition-old(root) {
  animation: theme-tint 900ms var(--ease-in-out) both;
  mask-image: linear-gradient(to top right, rgb(0 0 0 / 1) 0%, rgb(0 0 0 / calc(1 - calc(var(--tint) * 0.12))) 25%, rgb(0 0 0 / calc(1 - calc(var(--tint) * 0.34))) 50%, rgb(0 0 0 / calc(1 - calc(var(--tint) * 0.64))) 75%, rgb(0 0 0 / calc(1 - var(--tint))) 100%);
}
:root[data-curtain='night']::view-transition-new(root) {
  animation: theme-sweep 760ms var(--ease-in-out) 750ms both;
  mask-image: linear-gradient(to bottom left, #000 calc(var(--sweep) - 40%), transparent calc(var(--sweep) + 40%));
}
@keyframes theme-tint { from { --tint: 0; } to { --tint: 0.92; } }
@keyframes theme-sweep { from { --sweep: -40%; } to { --sweep: 140%; } }
:root[data-curtain='fade']::view-transition-old(root) { animation: theme-fade-out 220ms ease-out both; }
:root[data-curtain='fade']::view-transition-new(root) { animation: theme-fade-in 220ms ease-out both; }
@keyframes theme-fade-out { to { opacity: 0; } }
@keyframes theme-fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  :root.charge .tete::after { transform: scaleX(0.92); } /* sans mouvement : le trait est simplement là */
}

/* ---------- Version intégrée : le module seul, sans en-tête ni navigation, fond de la page qui l'accueille ---------- */
:root.integre { --tete: 0rem; }
:root.integre body { min-height: 0; }
.appli--integre { display: block; min-height: 0; }
.appli--integre .corps { padding: 0; max-width: none; }
.entree-cadre { padding: var(--space-m) 0; }

/* ---------- Oc'Catalogue ---------- */
.vignette { width: 48px; height: 48px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface); border: 1px solid var(--border); }
.vignette--vide { display: grid; place-items: center; color: var(--text-muted); }
.produit-nom { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.produit-nom > span { min-width: 0; }
.table tr:has(.produit-nom) > * { vertical-align: middle; }
.galerie { list-style: none; margin: 0 0 var(--space-xs); padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-s); }
.galerie:empty { display: none; }
.galerie li { display: grid; gap: 0.3rem; justify-items: start; }
.galerie img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
table.variantes { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
table.variantes th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 0.4rem 0.4rem 0.4rem 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.variantes td { padding: 0.35rem 0.4rem 0.35rem 0; vertical-align: middle; }
table.variantes input { width: 100%; min-width: 5rem; min-height: 2.6rem; padding: 0.5rem 0.6rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
table.variantes input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
/* Feuille étroite : chaque variante devient une petite fiche, libellés au-dessus des champs. */
@container feuille (max-width: 40rem) {
  table.variantes thead { display: none; }
  table.variantes, table.variantes tbody, table.variantes tr, table.variantes td { display: block; width: 100%; }
  table.variantes tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.6rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
  table.variantes td { padding: 0; }
  table.variantes td[data-libelle]::before { content: attr(data-libelle); display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.15rem; }
  table.variantes td:first-child { grid-column: 1 / -1; }
}
/* Le total d'une commande, sous ses lignes. */
.table tfoot th, .table tfoot td { padding: 0.8rem 1.25rem 0 0; font-weight: 700; text-align: left; border: 0; }
.table tfoot td { text-align: right; padding-right: 0; font-variant-numeric: tabular-nums; }

/* ---------- Oc'Agenda ---------- */
.semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.25rem; margin: 0 0 var(--space-xs); max-width: 46rem; }
.semaine__jour {
  display: grid; justify-items: center; gap: 0.05rem; padding: 0.4rem 0 0.35rem; border-radius: 12px; text-decoration: none; min-width: 0;
  background: color-mix(in srgb, var(--brand) 7%, transparent); color: var(--text); transition: background-color 160ms, color 160ms;
}
.semaine__nom { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.01em; }
.semaine__date { font-family: var(--font-display); font-variation-settings: 'SOFT' 60, 'opsz' 48; font-size: 1.15rem; line-height: 1.2; font-variant-numeric: lining-nums; }
.semaine__n { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); font-variant-numeric: tabular-nums; min-height: 1.1em; }
.semaine__jour:hover { background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--text); }
.semaine__jour[aria-current='page'] { background: var(--btn-bg); color: var(--btn-text); }
.semaine__jour[aria-current='page'] :is(.semaine__nom, .semaine__n) { color: inherit; opacity: 0.85; }
.nav-jours { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0 0 var(--space-m); font-size: var(--step--1); }
.table .heure { font-family: var(--font-display); font-variation-settings: 'SOFT' 60, 'opsz' 48; font-weight: 600; font-size: 1.1rem; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; text-decoration: none; }
/* Horaires de la semaine : le jour à gauche, ses plages à droite, comme un tableau d'horaires. */
.horaires { display: grid; gap: var(--space-xs); max-width: 36rem; }
.horaires > .field { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); align-items: center; column-gap: var(--space-s); }
.horaires > .field > label { margin: 0; }
.horaires > .field > .field__err { grid-column: 2; }
.horaires > .field > .field__err:empty { display: none; }
@media (max-width: 23rem) { .horaires > .field { grid-template-columns: 5.5rem minmax(0, 1fr); } }
/* Repère de couleur d'un motif, devant son nom (dans l'agenda et l'espace des motifs). Teintes moyennes, éclaircies en sombre. */
.pastille { display: inline-block; width: 0.62em; height: 0.62em; border-radius: 50%; background: var(--pastille, var(--text-muted)); margin-right: 0.45em; vertical-align: 0.04em; flex: none; }
.pastille--ocre { --pastille: #c8873a; } .pastille--olive { --pastille: #7b8a36; } .pastille--ardoise { --pastille: #4f6d86; }
.pastille--prune { --pastille: #8b4f78; } .pastille--rouille { --pastille: #b4532a; } .pastille--sauge { --pastille: #5c8c72; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .pastille--olive { --pastille: #a3b35a; } :root:not([data-theme='light']) .pastille--ardoise { --pastille: #86a5bf; }
  :root:not([data-theme='light']) .pastille--prune { --pastille: #c088ae; } :root:not([data-theme='light']) .pastille--rouille { --pastille: #de7d52; }
  :root:not([data-theme='light']) .pastille--sauge { --pastille: #8bbba0; }
}
:root[data-theme='dark'] .pastille--olive { --pastille: #a3b35a; } :root[data-theme='dark'] .pastille--ardoise { --pastille: #86a5bf; }
:root[data-theme='dark'] .pastille--prune { --pastille: #c088ae; } :root[data-theme='dark'] .pastille--rouille { --pastille: #de7d52; }
:root[data-theme='dark'] .pastille--sauge { --pastille: #8bbba0; }
.choice .pastille { margin-right: -0.2em; width: 0.8em; height: 0.8em; }
.rows.motifs .fin .linkbtn { font-size: var(--step--1); }
.rows.motifs details.plus--ligne form { padding-top: var(--space-xs); }
details.plus--reglages > summary { color: var(--text); font-weight: 600; }
details.plus--reglages > .pile { padding: var(--space-xs) 0 var(--space-xs); }
.retirer { margin: var(--space-xs) 0 var(--space-s); }
/* Motif tapé dans « Nouveau rendez-vous » quand aucun ne correspond. */
fieldset.a-la-volee { display: grid; gap: var(--space-xs); margin: 0; min-width: 0; padding: var(--space-s) var(--space-s) var(--space-xs); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
fieldset.a-la-volee > legend { font-weight: 600; padding: 0 0.4rem; }
fieldset.a-la-volee .petit { margin: 0; }

/* ---------- Oc'Factures ---------- */
/* Deux vues : côte à côte quand la place le permet, sinon deux onglets « Saisie » et « Aperçu ». */
.deux-vues { container-type: inline-size; }
.deux-vues__onglets { display: flex; gap: 0.25rem; width: fit-content; margin: 0 0 var(--space-m); padding: 0.25rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }
.deux-vues__onglets button { font: inherit; font-weight: 600; font-size: var(--step--1); border: 0; border-radius: 999px; padding: 0.5rem 1.1rem; min-height: 2.5rem; background: none; color: var(--text-muted); cursor: pointer; }
.deux-vues__onglets button[aria-selected='true'] { background: var(--btn-bg); color: var(--btn-text); }
.deux-vues[data-vue='saisie'] .deux-vues__apercu, .deux-vues[data-vue='apercu'] .deux-vues__saisie { display: none; }
@container (min-width: 60rem) {
  .deux-vues__onglets { display: none; }
  .deux-vues__corps { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: clamp(1.5rem, 3cqi, 3rem); align-items: start; }
  .deux-vues[data-vue] .deux-vues__saisie, .deux-vues[data-vue] .deux-vues__apercu { display: block; }
  /* La feuille reste à l'écran pendant la saisie, sous l'en-tête collant de l'appli (absent dans un cadre). */
  .deux-vues__apercu { position: sticky; top: calc(var(--tete) + var(--space-s)); max-height: calc(100dvh - var(--tete) - 2 * var(--space-s)); overflow: auto; overscroll-behavior: contain; border-radius: 12px; }
}
.enregistrement { margin: 0; font-size: var(--step--1); color: var(--text-muted); }

/* La feuille : blanche et à l'encre, en clair comme en sombre, aux couleurs du gérant (filets et total seulement).
   Police standard, comme le PDF : rien d'Oc'Digital. */
.apercu { background: color-mix(in srgb, var(--text) 7%, var(--surface-2)); border-radius: 12px; padding: clamp(0.6rem, 2cqi, 1.5rem); }
.papier {
  --papier-accent: #1a1a1a; --papier-doux: #5c5c5c; --papier-filet: #d6d6d6;
  color-scheme: light; background: #fff; color: #1a1a1a; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 0.8125rem; line-height: 1.45;
  padding: clamp(1.1rem, 4cqi, 2.6rem) clamp(1rem, 4cqi, 2.4rem); border-radius: 3px; max-width: 48rem; margin-inline: auto;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 14px 34px -14px rgb(var(--shadow) / 0.4);
}
.papier ::selection { background: #f0d6b4; color: #1a1a1a; }
.papier p { margin: 0; }
.papier__tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; padding-bottom: 1rem; margin-bottom: 1.2rem; border-bottom: 1.5px solid var(--papier-accent); }
.papier__logo { max-height: 3.4rem; max-width: 11rem; width: auto; height: auto; object-fit: contain; }
.papier__nom { font-weight: 700; font-size: 1.05rem; }
.papier__ident { text-align: right; }
.papier__titre { font-weight: 700; font-size: 1.6rem; line-height: 1.1; letter-spacing: -0.01em; }
.papier__numero { font-weight: 700; margin-top: 0.15rem !important; font-variant-numeric: tabular-nums; }
.papier--brouillon .papier__numero { font-weight: 400; color: var(--papier-doux); }
.papier__dates { margin: 0.55rem 0 0; display: grid; gap: 0.05rem; font-size: 0.75rem; }
.papier__dates div { display: flex; justify-content: flex-end; gap: 0.75rem; }
.papier__dates dt { color: var(--papier-doux); }
.papier__dates dd { margin: 0; min-width: 5.4rem; font-variant-numeric: tabular-nums; }
.papier__parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1rem; }
.papier__parties section { min-width: 0; overflow-wrap: anywhere; }
.papier__etiquette { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--papier-doux); margin-bottom: 0.3rem !important; }
.papier__qui { font-weight: 700; font-size: 0.875rem; }
.papier__doux { color: var(--papier-doux); }
.papier__objet { font-weight: 700; margin: 0.2rem 0 0.9rem !important; }
.papier__lignes { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.papier__lignes thead th { font-size: 0.66rem; color: var(--papier-doux); font-weight: 700; text-align: left; padding: 0 0 0.35rem; border-bottom: 1px solid var(--papier-accent); }
.papier__lignes td { padding: 0.5rem 0; border-bottom: 1px solid var(--papier-filet); vertical-align: top; overflow-wrap: anywhere; }
.papier__lignes .n { text-align: right; padding-left: 0.75rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.papier__ht { font-weight: 700; }
.papier__detail { display: block; color: var(--papier-doux); font-size: 0.72rem; margin-top: 0.1rem; white-space: pre-line; }
.papier__titre-ligne th { text-align: left; font-weight: 700; padding: 0.8rem 0 0.3rem; border-bottom: 1px solid var(--papier-filet); }
.papier__texte td { font-style: italic; color: var(--papier-doux); white-space: pre-line; }
.papier__vide { color: #6b6b6b; text-align: center; padding: 1.5rem 0 !important; }
.papier__bas { display: grid; justify-items: end; margin: 0.9rem 0 1.1rem; }
.papier__totaux { margin: 0; width: min(100%, 17.5rem); display: grid; gap: 0.15rem; }
.papier__totaux div { display: flex; justify-content: space-between; gap: 1rem; }
.papier__totaux dt { color: var(--papier-doux); }
.papier__totaux dd { margin: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.papier__total { border-top: 1.5px solid var(--papier-accent); margin-top: 0.3rem; padding-top: 0.4rem; }
.papier__total dt { color: #1a1a1a; font-weight: 700; font-size: 0.9rem; }
.papier__total dd { color: var(--papier-accent); font-weight: 700; font-size: 1.05rem; }
.papier__exo { font-weight: 700; font-size: 0.72rem; margin-top: 0.45rem !important; text-align: right; max-width: 20rem; }
.papier__bloc { margin-bottom: 0.9rem; }
.papier__fort { font-weight: 700; }
.papier__signature { border: 1px solid var(--papier-filet); min-height: 5rem; width: min(100%, 16rem); padding: 0.5rem 0.6rem; color: var(--papier-doux); font-size: 0.72rem; }
.papier__mentions { list-style: none; margin: 1rem 0 0; padding: 0.7rem 0 0; border-top: 1px solid var(--papier-filet); color: var(--papier-doux); font-size: 0.68rem; display: grid; gap: 0.15rem; }
.papier__pied { margin-top: 1.2rem; padding-top: 0.6rem; border-top: 1px solid var(--papier-filet); display: flex; justify-content: space-between; gap: 0.3rem 1rem; flex-wrap: wrap; color: var(--papier-doux); font-size: 0.66rem; }
.papier--brouillon { background-image: repeating-linear-gradient(-45deg, transparent 0 22px, rgb(0 0 0 / 0.016) 22px 44px); }
@container (max-width: 30rem) {
  .papier__parties { grid-template-columns: 1fr; gap: 0.9rem; }
  .papier__tete { flex-direction: column; gap: 0.8rem; }
  .papier__ident { text-align: left; }
  .papier__dates div { justify-content: flex-start; }
}

/* L'éditeur. */
.editeur .partie > :is(.field, .ligne, fieldset, details) { margin-top: var(--space-s); }
.editeur .partie > h2 + :is(.field, .ligne, fieldset) { margin-top: var(--space-xs); }
.choix-client { list-style: none; margin: 0.4rem 0 0; padding: 0.3rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); display: grid; gap: 0.1rem; }
.choix-client button { font: inherit; color: inherit; text-align: left; border: 0; background: none; display: grid; width: 100%; padding: 0.55rem 0.7rem; border-radius: 6px; cursor: pointer; }
.choix-client button:hover { background: var(--teinte); }
.choix-client .meta { color: var(--text-muted); font-size: var(--step--1); }
.choix-client li.petit { padding: 0.55rem 0.7rem; margin: 0; }
.raccourcis { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; margin: -0.35rem 0 var(--space-s); font-size: var(--step--1); }
.lignes-edit { list-style: none; margin: 0 0 var(--space-s); padding: 0; }
.ligne-edit { display: grid; gap: 0.45rem; padding: 0.85rem 0; border-bottom: 1px solid var(--border); }
.ligne-edit:first-child { border-top: 1px solid var(--border); }
.ligne-edit .field { margin: 0; gap: 0.25rem; }
.ligne-edit label { font-size: var(--step--1); }
.ligne-edit .field__err:empty { display: none; }
.ligne-edit__haut { display: flex; gap: 0.4rem; align-items: flex-end; }
.ligne-edit__haut > .field { flex: 1; min-width: 0; }
.ligne-edit--titre, .ligne-edit--texte { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.ligne-edit input.fort { font-weight: 600; }
.ligne-edit__chiffres { display: grid; grid-template-columns: 5.2rem 6rem 7.5rem 5.6rem 5.4rem minmax(5rem, 1fr); gap: 0.5rem; align-items: end; }
.ligne-edit__quantite input, .ligne-edit__prix input, .ligne-edit__remise input { text-align: right; font-variant-numeric: tabular-nums; }
.ligne-edit__chiffres input, .ligne-edit__chiffres select { padding-inline: 0.6rem; }
.ligne-edit__total { margin: 0; align-self: center; padding-top: 1.35rem; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ligne-edit__outils { display: flex; gap: 0.1rem; }
.icone { display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 8px; border: 0; background: none; color: var(--text-muted); cursor: pointer; transition: background-color 160ms, color 160ms; }
.icone:hover { background: var(--teinte); color: var(--text); }
.icone:disabled { opacity: 0.35; cursor: default; background: none; }
@media (max-width: 44rem) {
  .ligne-edit__chiffres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ligne-edit__total { grid-column: 1 / -1; padding-top: 0; }
}
.ajouts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.1rem; }
.ajouts select { width: auto; max-width: 100%; font: inherit; font-size: var(--step--1); color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.8rem; min-height: 2.6rem; }
.ligne-edit__detail textarea { min-height: 2.6rem; }
.totaux-edit { margin: var(--space-m) 0 0 auto; width: min(100%, 20rem); display: grid; gap: 0.2rem; }
.totaux-edit div { display: flex; justify-content: space-between; gap: 1rem; }
.totaux-edit dt { color: var(--text-muted); }
.totaux-edit dd { margin: 0; font-variant-numeric: tabular-nums; }
.totaux-edit__total { border-top: 2px solid var(--text); padding-top: 0.45rem; margin-top: 0.25rem; align-items: baseline; }
.totaux-edit__total dt { color: var(--text); font-weight: 600; }
.totaux-edit__total dd { font-family: var(--font-display); font-variation-settings: 'SOFT' 60, 'opsz' 48; font-size: var(--step-1); font-weight: 560; font-variant-numeric: lining-nums tabular-nums; }
.manques { margin-bottom: var(--space-s); }
.manques__titre { font-weight: 600; margin: 0 0 0.35rem; }
.manques ul { margin: 0; padding-left: 1.15rem; display: grid; gap: 0.2rem; }
.manques__conseil { color: var(--text-muted); }
/* Un document émis : son suivi. */
.suivi .kv { margin-bottom: var(--space-m); }
.montant { font-family: var(--font-display); font-variation-settings: 'SOFT' 60, 'opsz' 48; font-size: var(--step-1); font-weight: 560; font-variant-numeric: lining-nums tabular-nums; }
.montant--retard { color: var(--error); }
.liens-doc { list-style: none; margin: 0 0 var(--space-s); padding: 0; display: grid; gap: 0.55rem; }
.liens-doc a { font-weight: 600; }
/* Facture électronique : le statut du dépôt, puis ce que la plateforme a refusé (règles en toutes lettres). */
.pa-etat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; margin-bottom: var(--space-xs); }
.pa-erreurs { margin: var(--space-xs) 0 0; padding-left: 1.1rem; font-size: var(--step--1); color: var(--text-muted); overflow-wrap: anywhere; }
.pa-erreurs:empty { display: none; }
.suivi code { font-size: 0.85em; overflow-wrap: anywhere; }

/* ---------- Compléments des tableaux et des blocs ---------- */
/* Une liste sous son formulaire (la note d'une fiche, puis son historique). */
.partie > form + .rows { margin-top: var(--space-m); }
@container feuille (max-width: 44rem) {
  /* Sur une feuille étroite, le nom d'une personne reste à l'encre même s'il n'est pas en tête de ligne. */
  .table td.fort, .table td .fort { color: var(--text); font-size: var(--step-0); }
  .table tfoot { display: block; }
  .table tfoot tr { display: flex; justify-content: space-between; gap: 1rem; padding-top: 0.75rem; }
  .table tfoot th, .table tfoot td { padding: 0; }
}
@container feuille (max-width: 40rem) {
  /* Trois chiffres sur deux colonnes : le troisième prend toute la largeur, son filet aussi. */
  .releve[data-n='3'] .releve__chiffre:nth-child(3) { grid-column: 1 / -1; }
}
@container feuille (max-width: 44rem) {
  /* Sur une feuille étroite, les boutons de l'en-tête tiennent côte à côte. */
  .page-tete__actions .btn { padding: 0.6em 1.15em; font-size: 0.95rem; }
}
/* Fiche d'une personne : ses coordonnées viennent d'abord (à la lecture, et sur téléphone) ; sur une feuille large,
   elles se rangent à droite de ce qui s'est passé avec elle. */
@container feuille (min-width: 58rem) {
  .deux--fiche > :first-child { grid-column: 2; grid-row: 1; }
  .deux--fiche > :last-child { grid-column: 1; grid-row: 1; }
}
