/* Design tokens ported from the pilot Artifact (cabinet-notarial.html) —
   same palette, type system (Spectral / Public Sans / IBM Plex Mono), and
   component visual language, wired here to real server-rendered pages. */

:root {
  color-scheme: light;
  --bg-page:      #eef0ef;
  --bg-surface:   #ffffff;
  --bg-surface-2: #f6f7f5;
  --bg-hover:     #eceeec;
  --border:       rgba(19,26,40,0.12);
  --border-soft:  rgba(19,26,40,0.07);

  --text-primary:   #151d2c;
  --text-secondary: #545e6e;
  --text-muted:     #8891a0;
  --text-on-ink:    #eef1f6;
  --text-on-ink-muted: #aab4c8;

  --ink:        #1e2a4a;
  --ink-2:      #263457;
  --ink-hover:  #16213b;
  --accent:     #a9782e;
  --accent-ink: #6b4c1c;
  --accent-soft:#f2e6cc;

  --status-en-cours: #2a78d6;
  --status-valide:   #0ca30c;
  --status-rejete:   #d03b3b;
  --status-archive:  #6a4fb0;

  --shadow-pop: 0 10px 28px rgba(15,20,30,0.16);
  --focus-ring: 0 0 0 3px rgba(169,120,46,0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-page: #10131a; --bg-surface: #191d26; --bg-surface-2: #1f2430; --bg-hover: #262c3a;
    --border: rgba(230,235,245,0.14); --border-soft: rgba(230,235,245,0.08);
    --text-primary: #eef1f6; --text-secondary: #b6bdcc; --text-muted: #7c8496;
    --text-on-ink: #eef1f6; --text-on-ink-muted: #9aa4ba;
    --ink: #202b47; --ink-2: #2a3760; --ink-hover: #16213b;
    --accent: #d9ab5f; --accent-ink: #2c1f0c; --accent-soft: #3a2f1a;
    --status-en-cours: #5598e7; --status-valide: #0ca30c; --status-rejete: #d03b3b; --status-archive: #9482d6;
    --shadow-pop: 0 10px 28px rgba(0,0,0,0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-page: #10131a; --bg-surface: #191d26; --bg-surface-2: #1f2430; --bg-hover: #262c3a;
  --border: rgba(230,235,245,0.14); --border-soft: rgba(230,235,245,0.08);
  --text-primary: #eef1f6; --text-secondary: #b6bdcc; --text-muted: #7c8496;
  --text-on-ink: #eef1f6; --text-on-ink-muted: #9aa4ba;
  --ink: #202b47; --ink-2: #2a3760; --ink-hover: #16213b;
  --accent: #d9ab5f; --accent-ink: #2c1f0c; --accent-soft: #3a2f1a;
  --status-en-cours: #5598e7; --status-valide: #0ca30c; --status-rejete: #d03b3b; --status-archive: #9482d6;
  --shadow-pop: 0 10px 28px rgba(0,0,0,0.55);
}

/* Valeurs de secours : la vraie feuille de thème est générée par le serveur pour chaque
   cabinet (middleware/site.js + public/js/theme-core.js) et vient APRÈS ce fichier. */
:root {
  --fs: 1; --d: 1; --bw: 1px; --r-sm: 7px; --r-md: 9px; --r-lg: 12px; --btn-r: var(--r-md);
  --accent-text: #986c29; --on-accent: #111111; --on-primary: #ffffff;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg-page); color: var(--text-primary);
  font-family: var(--font-texte, "Public Sans", system-ui, sans-serif);
  font-size: calc(14.5px * var(--fs)); line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-titres, "Spectral", Georgia, serif); font-weight: 600; margin: 0; }
.mono { font-family: var(--font-mono, "IBM Plex Mono", ui-monospace, monospace); }
a { color: inherit; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

#app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 250px; flex: 0 0 auto; background: var(--ink); color: var(--text-on-ink);
  display: flex; flex-direction: column; padding: calc(22px * var(--d)) 16px; gap: calc(20px * var(--d));
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.brand { display: flex; gap: 11px; align-items: flex-start; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border-radius: var(--r-md); background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-titres, "Spectral", serif); font-weight: 700; font-size: calc(15px * var(--fs)); color: var(--accent-ink);
  border: 1px solid rgba(0,0,0,0.08);
}
.brand-text h1 { font-size: calc(15.5px * var(--fs)); color: var(--text-on-ink); line-height: 1.25; }
.brand-text p { margin: 3px 0 0; font-size: calc(11px * var(--fs)); color: var(--text-on-ink-muted); letter-spacing: 0.02em; }
.brand-role { margin-top: 8px; padding: 2px 8px; border-radius: 20px; display: inline-block;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14);
  font-size: calc(10.5px * var(--fs)); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-on-ink-muted); }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: calc(9px * var(--d)) 10px; border-radius: var(--r-md); cursor: pointer;
  color: var(--text-on-ink-muted); font-size: calc(13.5px * var(--fs)); font-weight: 500; border: 1px solid transparent;
  background: transparent; text-align: left; width: 100%; text-decoration: none;
}
.nav-item .ic { width: 17px; text-align: center; font-size: calc(14px * var(--fs)); display: inline-flex; align-items: center; justify-content: center; }
.nav-item .ic svg { display: block; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--text-on-ink); }
.nav-item.active { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.12); }
.nav-item.active .ic { color: var(--accent); }
.sidebar-spacer { flex: 1; }
.role-card { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: var(--r-md); padding: 12px; font-size: calc(12px * var(--fs)); }
.role-card b { color: #fff; }
.role-card form { margin-top: 8px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { padding: calc(20px * var(--d)) 30px 0; }
.topbar-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.topbar h2 { font-size: calc(22px * var(--fs)); }
.topbar .eyebrow { font-size: calc(11px * var(--fs)); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 0 0 4px; }
.topbar .sub { color: var(--text-secondary); font-size: calc(13px * var(--fs)); margin-top: 4px; max-width: 60ch; }
.view { padding: calc(20px * var(--d)) 30px 60px; max-width: 1180px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: var(--btn-r);
  border: var(--bw) solid transparent; cursor: pointer; font-weight: 600; font-size: calc(13px * var(--fs)); padding: calc(9px * var(--d)) 15px;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--on-primary); }
.btn-primary:hover { background: var(--ink-hover); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { background: transparent; color: var(--status-rejete); border-color: rgba(208,59,59,0.4); }
.btn-danger:hover { background: rgba(208,59,59,0.08); }
.btn-good { background: var(--status-valide); color: #fff; }
.btn-good:hover { filter: brightness(1.08); }
.btn-sm { padding: calc(6px * var(--d)) 11px; font-size: calc(12px * var(--fs)); border-radius: var(--btn-r); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }

.card { background: var(--bg-surface); border: var(--bw) solid var(--border); border-radius: var(--r-lg); }
.section-title { font-size: calc(11px * var(--fs)); text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin: 18px 0 20px; }
@media (max-width: 780px) { .stats { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.stat-tile { background: var(--bg-surface); border: var(--bw) solid var(--border); border-radius: var(--r-md); padding: 12px 13px; border-left: 3px solid var(--status-en-cours); text-decoration: none; display: block; color: inherit; }
.stat-tile .n { font-family: var(--font-titres, "Spectral", serif); font-size: calc(24px * var(--fs)); font-weight: 700; line-height: 1; }
.stat-tile .lbl { margin-top: 6px; font-size: calc(11.5px * var(--fs)); color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }
.stat-tile .lbl .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.search-input, .filter-select {
  background: var(--bg-surface); border: var(--bw) solid var(--border); border-radius: var(--r-md); padding: 8px 10px;
  font-size: calc(13px * var(--fs)); color: var(--text-primary);
}
.search-input { flex: 1 1 220px; min-width: 160px; }
.filter-select { min-width: 150px; }

table.register { width: 100%; border-collapse: collapse; font-size: calc(13px * var(--fs)); }
table.register thead th {
  text-align: left; font-size: calc(10.5px * var(--fs)); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted);
  font-weight: 600; padding: 9px 12px; border-bottom: var(--bw) solid var(--border); background: var(--bg-surface-2);
}
table.register tbody tr { border-bottom: var(--bw) solid var(--border-soft); }
table.register tbody tr:hover { background: var(--bg-hover); }
table.register td { padding: calc(11px * var(--d)) 12px; vertical-align: middle; }
table.register td a { text-decoration: none; color: inherit; display: block; }
table.register td.ref { font-family: var(--font-mono, "IBM Plex Mono", monospace); font-weight: 500; font-size: calc(12.5px * var(--fs)); }
table.register td .objet { font-weight: 500; }
table.register td .client { color: var(--text-secondary); font-size: calc(12px * var(--fs)); margin-top: 2px; }
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: var(--bw) solid var(--border); }
.table-wrap table { border: none; }
.empty-row td { padding: 34px 12px; text-align: center; color: var(--text-muted); font-size: calc(13px * var(--fs)); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 20px; font-size: calc(11.5px * var(--fs)); font-weight: 600; white-space: nowrap; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip-actif { background: rgba(12,163,12,0.12); color: #0a7d0a; }
.chip-inactif { background: rgba(136,145,160,0.16); color: var(--text-secondary); }

.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-open-date { font-size: calc(13px * var(--fs)); margin-bottom: 12px; padding: 10px 12px; background: var(--bg-surface-2); border: var(--bw) solid var(--border); border-radius: var(--r-md); }
.tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-rail { display: flex; flex-direction: column; align-items: center; }
.tl-dot { width: 20px; height: 20px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: calc(10px * var(--fs)); color: #fff; font-weight: 700; background: var(--status-en-cours); }
.tl-line { width: 2px; flex: 1; background: var(--border); margin-top: 2px; }
.tl-body { flex: 1; padding-top: 1px; }
.tl-title { font-weight: 600; font-size: calc(13px * var(--fs)); }
.tl-meta { font-size: calc(11.5px * var(--fs)); color: var(--text-muted); margin-top: 2px; }
.tl-details { margin-top: 6px; font-size: calc(12.5px * var(--fs)); color: var(--text-secondary); background: var(--bg-surface-2); border: var(--bw) solid var(--border-soft); border-radius: var(--r-md); padding: 8px 10px; }

.form-section { padding: calc(16px * var(--d)) 18px; border: var(--bw) solid var(--border); border-radius: var(--r-lg); background: var(--bg-surface); margin-bottom: 14px; }
.form-section h3 { font-size: calc(14px * var(--fs)); }
.form-section .hint { font-size: calc(12px * var(--fs)); color: var(--text-muted); margin-top: 3px; }
.field { margin-top: calc(12px * var(--d)); }
.field label { display: block; font-size: calc(12px * var(--fs)); font-weight: 600; margin-bottom: 5px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=file], .field textarea, .field select {
  width: 100%; border: var(--bw) solid var(--border); background: var(--bg-surface); color: var(--text-primary);
  border-radius: var(--r-md); padding: 9px 10px; font-size: calc(13.5px * var(--fs)); font-family: inherit;
}
.field textarea { min-height: 78px; resize: vertical; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 220px; }
.field-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: calc(13px * var(--fs)); }

.piece-add-row { border: 1.5px dashed var(--border); border-radius: var(--r-md); padding: 14px; background: var(--bg-surface-2); margin-top: 10px; }
.piece-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.piece-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; background: var(--bg-surface-2); border: var(--bw) solid var(--border); border-radius: var(--r-md); font-size: calc(12.5px * var(--fs)); }
.piece-ic { width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--bg-hover); display: flex; align-items: center; justify-content: center; font-size: calc(16px * var(--fs)); flex: none; }
.piece-row .meta { flex: 1; min-width: 0; }
.piece-row .meta .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.piece-row .meta .sub { color: var(--text-muted); font-size: calc(11.5px * var(--fs)); margin-top: 1px; }
.piece-row .row-actions { display: flex; gap: 6px; flex: none; }

.helper-note { font-size: calc(11.5px * var(--fs)); color: var(--text-muted); margin-top: 8px; line-height: 1.5; background: var(--bg-surface-2); border: var(--bw) solid var(--border-soft); border-radius: var(--r-md); padding: 8px 10px; }
.error-note { font-size: calc(12.5px * var(--fs)); color: var(--status-rejete); margin-top: 8px; background: rgba(208,59,59,0.08); border: 1px solid rgba(208,59,59,0.3); border-radius: var(--r-md); padding: 8px 10px; }

.dossier-header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.dossier-open-date { font-size: calc(12.5px * var(--fs)); color: var(--text-secondary); }
.dossier-open-date b { font-weight: 700; color: var(--text-primary); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 10px; font-size: calc(12.5px * var(--fs)); margin-bottom: 3px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; color: var(--text-primary); }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: var(--bw) solid var(--border); }

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg-page); }
.auth-card { width: min(440px, 100%); background: var(--bg-surface); border: var(--bw) solid var(--border); border-radius: var(--r-lg); padding: 28px 26px; box-shadow: var(--shadow-pop); }
.auth-card h1 { font-size: calc(20px * var(--fs)); margin-bottom: 4px; }
.auth-card .sub { color: var(--text-secondary); font-size: calc(13px * var(--fs)); margin-bottom: 18px; }
.auth-card .switch { margin-top: 16px; font-size: calc(12.5px * var(--fs)); color: var(--text-secondary); text-align: center; }
.auth-card .switch a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.auth-signup-card { width: min(560px, 100%); }

.journal-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: var(--bw) solid var(--border-soft); font-size: calc(12.5px * var(--fs)); }
.journal-row:last-child { border-bottom: none; }
.journal-row .jt { color: var(--text-muted); white-space: nowrap; font-family: var(--font-mono, "IBM Plex Mono", monospace); font-size: calc(11px * var(--fs)); flex: none; width: 150px; }
.journal-row .jb b { font-weight: 600; }

/* ============ PRINT SHEETS ============ */
body.print-body { background: #fff; }
.p-sheet { max-width: 190mm; margin: 24px auto; padding: 16px; font-family: "Public Sans", system-ui, sans-serif; color: #111; }
.p-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 16px; }
.p-head .p-org { font-family: "Spectral", Georgia, serif; font-weight: 700; font-size: 17px; }
.p-head .p-contact { font-size: 11px; color: #444; margin-top: 3px; line-height: 1.5; }
.p-doc-title { font-family: "Spectral", Georgia, serif; font-size: 15px; font-weight: 600; margin: 14px 0 10px; }
.p-kv { display: grid; grid-template-columns: 150px 1fr; gap: 3px 10px; font-size: 12.5px; margin-bottom: 3px; }
.p-kv dt { color: #555; } .p-kv dd { margin: 0; }
.p-bold-line { font-weight: 700; font-size: 13.5px; margin: 10px 0; }
.p-numero-big { font-family: "IBM Plex Mono", monospace; font-size: 20px; font-weight: 700; border: 1.5px solid #111; display: inline-block; padding: 8px 16px; margin: 12px 0; border-radius: 4px; }
.p-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #555; font-weight: 700; margin: 18px 0 8px; border-bottom: 1px solid #ccc; padding-bottom: 4px; }
.p-hist-row { font-size: 11.5px; padding: 6px 0; border-bottom: 1px solid #ddd; }
.p-hist-row .p-hd { color: #555; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; }
.p-piece-row { font-size: 11.5px; padding: 4px 0; border-bottom: 1px solid #eee; }
.p-foot { margin-top: 24px; font-size: 10px; color: #777; border-top: 1px solid #ccc; padding-top: 8px; }
.p-print-btn { max-width: 190mm; margin: 0 auto 12px; }
@media print {
  .p-print-btn { display: none; }
  @page { margin: 16mm 14mm; }
}

/* Bandeau de licence (essai, expiration, lecture seule) */
.licence-banner { background: rgba(250,178,25,0.16); border-bottom: 1px solid rgba(250,178,25,0.5); color: var(--text-primary); font-size: 12.5px; padding: 8px 30px; }
.licence-banner a { margin-left: 8px; font-weight: 600; }
.licence-banner-alert { background: rgba(208,59,59,0.10); border-bottom-color: rgba(208,59,59,0.45); }


/* ======================================================================
   v5 — compléments : accessibilité, menu, adaptation aux appareils
   ====================================================================== */
img, svg, video { max-width: 100%; }
.main > .view { flex: 1 1 auto; width: 100%; min-width: 0; }
.kv dd, .piece-row .meta .nm, .tl-details, .objet, .client, .journal-row .jb { overflow-wrap: anywhere; }

.skip-link { position: absolute; left: 8px; top: -60px; z-index: 200; background: var(--ink); color: var(--on-primary);
  padding: 9px 14px; border-radius: var(--r-md); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: calc(8px + var(--safe-t)); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
  background: transparent; border: 0; color: inherit; cursor: pointer; border-radius: var(--r-md); font-size: calc(18px * var(--fs)); }
.icon-btn:hover { background: rgba(255,255,255,0.1); }

.mobile-bar { display: none; }
.nav-backdrop { display: none; }
.brand-logo { max-height: 40px; max-width: 150px; width: auto; height: auto; object-fit: contain; flex: none; border-radius: var(--r-sm); }
.nav-sep { margin: 12px 6px 2px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.12); font-size: calc(10.5px * var(--fs));
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-on-ink-muted); }
.nav-item .lbl { min-width: 0; overflow-wrap: anywhere; }
.nav-item:focus-visible, .btn:focus-visible { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.role-link { display: inline-block; margin-top: 4px; color: #fff; font-size: calc(12px * var(--fs)); text-decoration: underline; }
.role-card .btn { color: #fff; border-color: rgba(255,255,255,0.25); margin-top: 8px; }
.role-email { overflow-wrap: anywhere; color: var(--text-on-ink-muted); }
.theme-btn { margin-top: 10px; }

/* Largeur du contenu (Administration > Interface) */
body.largeur-large .view { max-width: 1500px; }
body.largeur-pleine .view { max-width: none; }

/* Menu compact (ordinateur et tablette large) : icônes seules */
@media (min-width: 901px) {
  body.menu-compact .sidebar { width: 76px; padding-left: 10px; padding-right: 10px; align-items: stretch; }
  body.menu-compact .brand { justify-content: center; padding: 0; }
  body.menu-compact .brand-text, body.menu-compact .sidebar .lbl, body.menu-compact .nav-sep span,
  body.menu-compact .role-email, body.menu-compact .role-card b { display: none; }
  body.menu-compact .nav-item { justify-content: center; padding-left: 0; padding-right: 0; }
  body.menu-compact .nav-item .ic { display: inline-flex !important; width: 22px; font-size: calc(17px * var(--fs)); }
  body.menu-compact .nav-sep { margin-left: 0; margin-right: 0; }
  body.menu-compact .role-card { padding: 8px; text-align: center; }
  body.menu-compact .role-link { font-size: 0; }
  body.menu-compact .role-link::before { content: "👤"; font-size: 16px; }
  body.menu-compact .brand-logo { max-width: 48px; }
}

/* Annonce de l'administrateur, pied de page */
.announce { padding: 9px 30px; font-size: calc(13px * var(--fs)); border-bottom: 1px solid var(--border); }
.announce-info { background: color-mix(in srgb, var(--status-en-cours) 14%, var(--bg-surface)); }
.announce-attention { background: rgba(250,178,25,0.18); }
.announce-alerte { background: color-mix(in srgb, var(--status-rejete) 15%, var(--bg-surface)); }
.site-footer { padding: 18px 30px calc(22px + var(--safe-b)); border-top: 1px solid var(--border-soft); color: var(--text-secondary);
  font-size: calc(12px * var(--fs)); }
.site-footer p { margin: 3px 0; overflow-wrap: anywhere; }
.site-footer a { color: var(--accent-text); }
.site-footer:empty, .site-footer:not(:has(p)) { display: none; }

/* Boîte de confirmation (window.cnConfirm, public/js/app.js) */
dialog.cn-dialog { border: var(--bw) solid var(--border); border-radius: var(--r-lg); padding: 22px; width: min(440px, calc(100vw - 32px));
  background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-pop); }
dialog.cn-dialog::backdrop { background: rgba(10, 14, 22, 0.55); }
dialog.cn-dialog h3 { font-size: calc(17px * var(--fs)); margin-bottom: 8px; }
dialog.cn-dialog p { margin: 0 0 18px; color: var(--text-secondary); white-space: pre-line; overflow-wrap: anywhere; }
.cn-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.btn-danger-solid { background: var(--status-rejete); color: #fff; }
.btn-danger-solid:hover { filter: brightness(1.08); }

/* Tableaux du registre : la ligne du dossier devient une carte sur petit écran */
table.register td a.reg-link { display: grid; grid-template-columns: 160px minmax(0, 1fr) 180px 140px 130px; gap: 0 10px; padding: calc(11px * var(--d)) 12px;
  text-decoration: none; color: inherit; align-items: center; }
.reg-link .reg-date { font-family: var(--font-mono); font-size: calc(12px * var(--fs)); color: var(--text-secondary); }
table.register td.reg-cell { padding: 0; }
.permission-table th:first-child, .permission-table td:first-child { position: sticky; left: 0; background: var(--bg-surface); z-index: 1; min-width: 160px; }

/* ---- Tablettes et petits ordinateurs ---- */
@media (max-width: 1100px) {
  .reg-link { grid-template-columns: 150px minmax(0, 1fr) 150px 130px; }
  .reg-link .reg-date { display: none; }
  .topbar, .view, .announce, .site-footer { padding-left: 22px; padding-right: 22px; }
}

/* ---- Téléphones et tablettes en portrait : menu en tiroir ---- */
@media (max-width: 900px) {
  html.js #app { display: block; }
  html.js .mobile-bar { display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 60; background: var(--ink);
    color: var(--text-on-ink); padding: calc(6px + var(--safe-t)) calc(10px + var(--safe-r)) 6px calc(10px + var(--safe-l)); }
  html.js .mobile-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  html.js .mobile-name { font-family: var(--font-titres); font-weight: 600; font-size: calc(16px * var(--fs)); overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
  html.js .mobile-bar .brand-mark { width: 30px; height: 30px; }
  html.js .mobile-bar .brand-logo { max-height: 30px; max-width: 120px; }
  html.js .sidebar { position: fixed; z-index: 90; top: 0; bottom: 0; left: 0; height: auto; width: min(310px, 86vw);
    padding-top: calc(22px + var(--safe-t)); padding-bottom: calc(18px + var(--safe-b)); padding-left: calc(16px + var(--safe-l));
    transform: translateX(-105%); transition: transform 0.22s ease; box-shadow: var(--shadow-pop); visibility: hidden; }
  html.js body.nav-open .sidebar { transform: none; visibility: visible; }
  html.js .nav-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(10, 14, 22, 0.55); }
  html.js .nav-backdrop[hidden] { display: none; }
  html.js .nav-backdrop:not([hidden]) { display: block; }
  html.js body.nav-open { overflow: hidden; }
  /* Sans JavaScript : l'ancien comportement (menu en haut) reste utilisable. */
  html:not(.js) #app { flex-direction: column; }
  html:not(.js) .sidebar { position: relative; width: 100%; height: auto; }
  .nav-item { padding-top: 12px; padding-bottom: 12px; }
  .topbar, .view, .announce, .site-footer { padding-left: calc(16px + var(--safe-l)); padding-right: calc(16px + var(--safe-r)); }
  .view { padding-bottom: 48px; }
  .licence-banner { padding-left: 16px; padding-right: 16px; }
  .topbar h2 { font-size: calc(20px * var(--fs)); }
  /* 16 px minimum dans les champs : empêche le zoom automatique d'iOS Safari */
  input, select, textarea { font-size: 16px !important; }
  .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=url],
  .field input[type=number], .field select, .search-input, .filter-select { min-height: 44px; }
}

/* ---- Registre : cartes ---- */
@media (max-width: 760px) {
  table.register.cards thead { display: none; }
  table.register.cards, table.register.cards tbody, table.register.cards tr, table.register.cards td { display: block; width: 100%; }
  table.register.cards tr { border-bottom: 1px solid var(--border); }
  .reg-link { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ref statut" "objet objet" "type date"; gap: 4px 10px; padding: 14px 14px; }
  .reg-link .ref { grid-area: ref; }
  .reg-link .reg-statut { grid-area: statut; justify-self: end; }
  .reg-link .reg-objet { grid-area: objet; }
  .reg-link .reg-type { grid-area: type; color: var(--text-secondary); font-size: calc(12.5px * var(--fs)); }
  .reg-link .reg-date { grid-area: date; display: block; justify-self: end; }
  /* Tableaux génériques (membres...) : une carte par ligne, libellé devant chaque valeur */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  table.stack td { padding: 4px 0; border: 0; display: flex; gap: 10px; align-items: baseline; }
  table.stack td::before { content: attr(data-label); flex: 0 0 92px; color: var(--text-muted); font-size: calc(11.5px * var(--fs)); text-transform: uppercase; letter-spacing: 0.04em; }
  table.stack td.actions { flex-wrap: wrap; }
  table.stack td.actions::before { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journal-row { flex-direction: column; gap: 3px; }
  .journal-row .jt { width: auto; }
}

/* ---- Petits téléphones ---- */
@media (max-width: 560px) {
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: 8px; }
  .field-row .field { flex: 1 1 100%; }
  .topbar-row { align-items: stretch; }
  .topbar-row > .btn, .topbar-row > div > .btn { width: 100%; }
  .drawer-actions .btn { flex: 1 1 100%; }
  .piece-row { flex-wrap: wrap; }
  .piece-row .row-actions { flex: 1 1 100%; flex-wrap: wrap; }
  .piece-row .row-actions .btn { flex: 1 1 auto; }
  .btn { white-space: normal; }
  .auth-card { padding: 22px 18px; }
  .cn-dialog-actions .btn { flex: 1 1 100%; }
  .toolbar > * { flex: 1 1 100%; }
}

/* ---- Écrans tactiles : cibles d'au moins 44 px ---- */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding-left: 14px; padding-right: 14px; }
  .nav-item { min-height: 46px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .field input, .field select, .field textarea, .search-input, .filter-select { min-height: 44px; }
  .remove-row, .row-actions .btn { min-height: 40px; }
}

/* Mouvement réduit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Page de connexion personnalisable (logo, illustration) */
.auth-logo { display: block; max-height: 56px; max-width: 70%; margin: 0 auto 14px; object-fit: contain; }
.auth-wrap { min-height: 100vh; min-height: 100dvh; padding-top: calc(20px + var(--safe-t)); padding-bottom: calc(20px + var(--safe-b)); }
.auth-wrap.has-illustration { gap: 28px; justify-content: center; }
.auth-illustration { flex: 1 1 360px; max-width: 520px; display: flex; align-items: center; justify-content: center; }
.auth-illustration img { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--r-lg); }
.auth-wrap.has-illustration .auth-card { flex: 0 1 440px; }
@media (max-width: 860px) {
  .auth-wrap.has-illustration { flex-direction: column; justify-content: flex-start; }
  .auth-illustration { max-width: 360px; flex: 0 0 auto; }
  .auth-illustration img { max-height: 160px; }
}

/* ======================================================================
   Administration du site (v5)
   ====================================================================== */
fieldset.form-section { min-width: 0; margin-left: 0; margin-right: 0; }
/* Titre d'un cadre blanc : à l'intérieur du cadre, aligné avec le contenu (un <legend> brut se
   place par défaut À CHEVAL sur la bordure, ce qui coupait le cadre). */
fieldset.form-section { display: flow-root; }
fieldset.form-section > legend { float: left; width: 100%; padding: 0; margin: 0 0 10px; }
fieldset.form-section > legend + * { clear: both; }
fieldset.form-section > legend h3, .form-section > h3 { margin: 0 0 2px; font-size: calc(14px * var(--fs)); line-height: 1.3; }
.admin-tabs { display: flex; gap: 4px; margin-top: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; border-bottom: 1px solid var(--border);
  scrollbar-width: thin; }
.admin-tabs a { flex: none; padding: 10px 14px; text-decoration: none; color: var(--text-secondary); font-weight: 600; font-size: calc(13px * var(--fs));
  border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.admin-tabs a:hover { color: var(--text-primary); background: var(--bg-hover); }
.admin-tabs a.active { color: var(--accent-text); border-bottom-color: var(--accent); }

.admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 4px 0 18px; }
.admin-card { display: block; background: var(--bg-surface); border: var(--bw) solid var(--border); border-radius: var(--r-lg);
  padding: calc(16px * var(--d)) 18px; text-decoration: none; color: inherit; }
a.admin-card:hover { border-color: var(--accent); box-shadow: var(--shadow-pop); }
.admin-card h3 { font-size: calc(15px * var(--fs)); margin-bottom: 6px; }
.admin-card p { margin: 0; color: var(--text-secondary); font-size: calc(12.5px * var(--fs)); }
.admin-card.static { cursor: default; }
.admin-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .admin-two { grid-template-columns: 1fr; } }

.ap-status { margin-bottom: 14px; }
.ap-status ul { margin: 6px 0 0; padding-left: 20px; }
.ap-warnings { list-style: none; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r-md); background: rgba(250,178,25,0.16);
  border: 1px solid rgba(250,178,25,0.5); font-size: calc(12.5px * var(--fs)); }
.ap-warnings li + li { margin-top: 4px; }
.ap-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 18px; align-items: start; }
.ap-preview { position: sticky; top: 12px; }
.ap-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ap-preview-head h3 { font-size: calc(14px * var(--fs)); }
@media (max-width: 1100px) {
  .ap-layout { grid-template-columns: minmax(0, 1fr); }
  .ap-preview { position: static; order: -1; }
}
.ap-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 0; }
.ap-controls .ap-actions { position: sticky; bottom: 0; z-index: 5; background: var(--bg-page); border-top: 1px solid var(--border);
  padding-bottom: calc(12px + var(--safe-b)); margin-top: 6px; }
.ap-dirty { font-size: calc(12px * var(--fs)); color: var(--status-rejete); font-weight: 600; }
.ap-dirty::before { content: "● "; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg-item { position: relative; }
.seg-item input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-item span { display: inline-block; padding: 8px 14px; border: var(--bw) solid var(--border); border-radius: var(--btn-r); background: var(--bg-surface);
  font-size: calc(13px * var(--fs)); font-weight: 600; }
.seg-item input:checked + span { background: var(--ink); color: var(--on-primary); border-color: var(--ink); }
.seg-item input:focus-visible + span { box-shadow: var(--focus-ring); }
.seg-sm span { padding: 5px 11px; font-size: calc(12px * var(--fs)); }

.color-row { margin-top: 12px; }
.color-row > label { display: block; font-size: calc(12px * var(--fs)); font-weight: 600; margin-bottom: 5px; }
.color-inputs { display: flex; align-items: center; gap: 8px; }
.color-inputs input[type=color] { width: 52px; height: 40px; flex: none; padding: 2px; border: var(--bw) solid var(--border); border-radius: var(--r-md); background: var(--bg-surface); cursor: pointer; }
.color-inputs input[type=text] { flex: 1 1 auto; min-width: 0; border: var(--bw) solid var(--border); background: var(--bg-surface); color: var(--text-primary);
  border-radius: var(--r-md); padding: 9px 10px; font-family: var(--font-mono); }
.color-inputs input[aria-invalid=true] { border-color: var(--status-rejete); }
.swatch { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 2px solid var(--border); }
.field-error { color: var(--status-rejete); font-size: calc(12px * var(--fs)); margin: 4px 0 0; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preset { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border: var(--bw) solid var(--border); border-radius: var(--btn-r);
  background: var(--bg-surface); color: var(--text-primary); cursor: pointer; font-size: calc(12.5px * var(--fs)); font-weight: 600; }
.preset:hover { background: var(--bg-hover); }
.preset-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.2); display: inline-block; }

/* Aperçu : le même vocabulaire visuel que le vrai site, dans un cadre isolé */
.pv { background: var(--bg-page); color: var(--text-primary); font-family: var(--font-texte); font-size: calc(13px * var(--fs));
  border: var(--bw) solid var(--border); border-radius: var(--r-lg); overflow: hidden; display: flex; pointer-events: none; user-select: none; }
.pv .pv-side { width: 38%; max-width: 150px; flex: none; background: var(--ink); color: var(--text-on-ink); padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; }
.pv .pv-brand { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-family: var(--font-titres); font-size: calc(11px * var(--fs)); }
.pv .pv-brand .brand-mark { width: 24px; height: 24px; font-size: calc(10px * var(--fs)); }
.pv .nav-item { padding: 6px 7px; font-size: calc(11px * var(--fs)); gap: 6px; }
.pv .pv-main { flex: 1; min-width: 0; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.pv .pv-title { margin: 0; font-family: var(--font-titres); font-size: calc(18px * var(--fs)); }
.pv .pv-sub { margin: -6px 0 0; color: var(--text-secondary); font-size: calc(12px * var(--fs)); }
.pv .pv-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv .stat-tile { padding: 8px 10px; }
.pv .stat-tile .n { font-size: calc(18px * var(--fs)); }
.pv .pv-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.pv .btn { padding: calc(6px * var(--d)) 11px; font-size: calc(11.5px * var(--fs)); }
.pv .field { margin-top: 0; }
.pv .field label { font-size: calc(11px * var(--fs)); }
.pv .pv-input { border: var(--bw) solid var(--border); background: var(--bg-surface); border-radius: var(--r-md); padding: 7px 9px; box-shadow: var(--focus-ring); }
.pv .pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pv .pv-card { padding: 10px 12px; font-size: calc(12px * var(--fs)); }
.pv .pv-link { color: var(--accent-text); font-weight: 600; text-decoration: underline; }

.module-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.module-row:last-child { border-bottom: 0; }
.module-row input { margin-top: 4px; flex: none; }
.link-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.link-row { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) auto auto auto; gap: 8px; align-items: center; }
.link-row input[type=text] { border: var(--bw) solid var(--border); background: var(--bg-surface); color: var(--text-primary); border-radius: var(--r-md); padding: 9px 10px; min-width: 0; }
.link-row .chk { white-space: nowrap; font-size: calc(12.5px * var(--fs)); display: flex; align-items: center; gap: 5px; }
@media (max-width: 760px) { .link-row { grid-template-columns: 1fr 1fr; } .link-row input[type=text]:nth-child(2) { grid-column: 1 / -1; } }
.admin-form input[type=text], .admin-form input[type=url], .admin-form input[type=number], .admin-form select, .admin-form textarea {
  width: 100%; border: var(--bw) solid var(--border); background: var(--bg-surface); color: var(--text-primary);
  border-radius: var(--r-md); padding: 9px 10px; font-size: calc(13.5px * var(--fs)); font-family: inherit; }
.admin-form table input[type=text] { min-width: 0; }
.admin-form .field { margin-top: calc(12px * var(--d)); }
.admin-form .field label { display: block; font-size: calc(12px * var(--fs)); font-weight: 600; margin-bottom: 5px; }
.img-preview { min-height: 90px; display: flex; align-items: center; justify-content: center; background: var(--bg-surface-2); border: 1px dashed var(--border);
  border-radius: var(--r-md); padding: 10px; margin: 8px 0; }
.img-preview img { max-width: 100%; max-height: 120px; object-fit: contain; }
.page-body { line-height: 1.65; overflow-wrap: anywhere; }
.page-body h3 { margin: 18px 0 8px; font-size: calc(17px * var(--fs)); }
.page-body p { margin: 0 0 12px; }
.page-body ul { margin: 0 0 12px; padding-left: 22px; }
.page-body a { color: var(--accent-text); }
code { font-family: var(--font-mono); font-size: 0.92em; background: var(--bg-surface-2); padding: 1px 5px; border-radius: var(--r-sm); }

/* Cibles tactiles : sur écran tactile ou étroit, les liens isolés (hors phrases) font au moins 44 px de haut */
@media (pointer: coarse), (max-width: 900px) {
  .licence-banner a, .admin-card .more, .admin-card a, .role-link, .reg-link-open, td a, .hint a.block-link, summary,
  .topbar .sub a, .helper-note a, .page-actions a, dd a, p > a:only-child, .page-body > p > a:only-child { display: inline-flex; align-items: center; min-height: 44px; }
  .licence-banner a { display: inline-block; min-height: 0; padding: 12px 6px; margin: -12px 0; }
  summary { cursor: pointer; }
  .icon-btn [data-theme-icon] { display: inline-flex; }
}

.journal-link { color: var(--accent-text); font-weight: 600; text-decoration: underline; }
@media (pointer: coarse), (max-width: 900px) { .journal-link { display: inline-flex; align-items: center; min-height: 44px; } }

/* L'attribut hidden doit toujours l'emporter (ex. bouton « Installer l'application » tant que le navigateur ne le propose pas) */
.btn[hidden], [data-install]
/* ===================================================================== NOTARIS ID */
.nb { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: calc(11.5px * var(--fs)); font-weight: 650; line-height: 1.35; border: 1px solid transparent; }
.nb::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.nb-ok   { background: rgba(12,163,12,0.12);  color: #0a7d0a; border-color: rgba(12,163,12,0.25); }
.nb-warn { background: rgba(214,140,20,0.14); color: #8a5a00; border-color: rgba(214,140,20,0.32); }
.nb-err  { background: rgba(208,59,59,0.12);  color: #b02a2a; border-color: rgba(208,59,59,0.3); }
.nb-info { background: rgba(42,120,214,0.12); color: #1d5fae; border-color: rgba(42,120,214,0.28); }
.nb-mute { background: rgba(136,145,160,0.16); color: var(--text-secondary); border-color: rgba(136,145,160,0.28); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nb-ok { color: #55d155; } :root:not([data-theme="light"]) .nb-warn { color: #f0b84a; } :root:not([data-theme="light"]) .nb-err { color: #ff8585; } :root:not([data-theme="light"]) .nb-info { color: #7db4f5; } }
:root[data-theme="dark"] .nb-ok { color: #55d155; } :root[data-theme="dark"] .nb-warn { color: #f0b84a; } :root[data-theme="dark"] .nb-err { color: #ff8585; } :root[data-theme="dark"] .nb-info { color: #7db4f5; }

.n-tabs { margin-top: 16px; }
.n-flash { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r-md); font-size: calc(13px * var(--fs)); border: 1px solid var(--border); background: var(--bg-surface-2); }
.n-flash.ok { border-color: rgba(12,163,12,0.4); background: rgba(12,163,12,0.08); }
.n-flash.err { border-color: rgba(208,59,59,0.4); background: rgba(208,59,59,0.08); }
.n-alert { padding: 11px 14px; border-radius: var(--r-md); border: 1px solid rgba(214,140,20,0.4); background: rgba(214,140,20,0.1); font-size: calc(12.8px * var(--fs)); margin: 0 0 14px; line-height: 1.55; }
.n-alert.err { border-color: rgba(208,59,59,0.4); background: rgba(208,59,59,0.08); }
.n-alert.ok { border-color: rgba(12,163,12,0.4); background: rgba(12,163,12,0.08); }
.n-alert.info { border-color: rgba(42,120,214,0.35); background: rgba(42,120,214,0.08); }
.n-alert b:first-child { display: inline; }
.n-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.n-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .n-grid, .n-grid-3 { grid-template-columns: 1fr; } }
.n-card { background: var(--bg-surface); border: var(--bw) solid var(--border); border-radius: var(--r-lg); padding: calc(16px * var(--d)) 18px; margin-bottom: 14px; }
.n-card h3 { margin: 0 0 10px; font-size: calc(15px * var(--fs)); }
.n-card h4 { margin: 14px 0 6px; font-size: calc(13px * var(--fs)); color: var(--text-secondary); }
.n-card p { margin: 0 0 10px; }
.n-card .hint, .n-muted { color: var(--text-muted); font-size: calc(12px * var(--fs)); }
.n-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.n-row.between { justify-content: space-between; }
.n-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.n-actions form { margin: 0; }
.n-mono { font-family: var(--font-mono, "IBM Plex Mono", monospace); font-size: 0.9em; overflow-wrap: anywhere; word-break: break-all; }
.n-id { font-family: var(--font-mono, "IBM Plex Mono", monospace); font-size: calc(17px * var(--fs)); font-weight: 600; letter-spacing: .02em; overflow-wrap: anywhere; }
.n-qr { background: #fff; padding: 10px; border-radius: var(--r-md); border: 1px solid var(--border); display: inline-block; line-height: 0; }
.n-qr svg { width: 200px; height: 200px; display: block; }
.n-qr.sm svg { width: 150px; height: 150px; }
.n-steps { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; counter-reset: st; }
.n-steps li { counter-increment: st; padding: 9px 11px 9px 36px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-surface); font-size: calc(12.5px * var(--fs)); position: relative; min-height: 44px; display: flex; align-items: center; }
.n-steps li::before { content: counter(st); position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 50%; background: var(--bg-hover); color: var(--text-secondary); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.n-steps li.done { border-color: rgba(12,163,12,0.4); } .n-steps li.done::before { content: "✓"; background: rgba(12,163,12,0.18); color: #0a7d0a; }
.n-steps li.now { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 650; } .n-steps li.now::before { background: var(--accent); color: var(--on-accent); }
.n-steps li.off { opacity: .55; }
.n-pdf { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-surface-2); }
@media (max-width: 700px) { .n-pdf { height: 380px; } }
.n-place { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; width: 150px; height: 195px; padding: 6px; border: 1px solid var(--border); background: #fff; border-radius: 4px; }
.n-place label { position: relative; border: 1px dashed #c3c8d2; border-radius: 3px; cursor: pointer; display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.n-place input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.n-place label:has(input:checked) { background: var(--accent); border-color: var(--accent); }
.n-place label:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.n-place span { font-size: 10px; color: #7b8494; pointer-events: none; } .n-place label:has(input:checked) span { color: var(--on-accent); }
.n-table th { white-space: nowrap; } .n-table td { vertical-align: top; }
.n-hash { font-family: var(--font-mono, "IBM Plex Mono", monospace); font-size: calc(11.5px * var(--fs)); overflow-wrap: anywhere; word-break: break-all; background: var(--bg-surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-sm); padding: 6px 8px; display: block; }
.n-list { margin: 0; padding-left: 18px; } .n-list li { margin: 3px 0; }
.n-inline-form { display: inline; margin: 0; }
.n-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; font-family: var(--font-mono, monospace); font-size: 14px; background: var(--bg-surface-2); border: 1px dashed var(--border); padding: 12px; border-radius: var(--r-md); max-width: 340px; }
.n-search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; } .n-search input { flex: 1 1 200px; }
.n-card input[type=text], .n-card input[type=password], .n-card input[type=url], .n-card input[type=number], .n-card input[type=file], .n-card select, .n-card textarea, .n-search input, .n-search select {
  width: 100%; border: var(--bw) solid var(--border); background: var(--bg-surface); color: var(--text-primary); border-radius: var(--r-md); padding: 9px 10px; font-size: calc(13.5px * var(--fs)); font-family: inherit; min-height: 40px; }
.n-card textarea { min-height: 220px; line-height: 1.5; }
.n-card .field { margin-top: calc(12px * var(--d)); } .n-card .field label { display: block; font-size: calc(12px * var(--fs)); font-weight: 600; margin-bottom: 5px; }
.n-card .field-check { align-items: flex-start; } .n-card .field-check input { margin-top: 3px; flex: none; width: 18px; height: 18px; }
.n-danger { border-color: rgba(208,59,59,.35); }
@media (max-width: 700px) { .n-card { padding: 14px; } .n-qr svg { width: 180px; height: 180px; } }

/* Pages publiques de vérification (ouvertes depuis un QR code, sans connexion) */
.pub-wrap { max-width: 720px; margin: 0 auto; padding: calc(18px + var(--safe-t)) calc(16px + var(--safe-r)) calc(40px + var(--safe-b)) calc(16px + var(--safe-l)); }
.pub-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--text-secondary); font-size: calc(12.5px * var(--fs)); }
.pub-head img { height: 34px; width: auto; max-width: 140px; object-fit: contain; }
.pub-head b { color: var(--text-primary); }
.pub-verdict { border-radius: var(--r-lg); padding: 20px 20px 18px; border: 2px solid var(--border); background: var(--bg-surface); margin-bottom: 14px; }
.pub-verdict .big { font-family: var(--font-titres, "Spectral", serif); font-size: calc(24px * var(--fs)); font-weight: 700; line-height: 1.2; margin: 6px 0 8px; }
.pub-verdict .ic { font-size: 30px; line-height: 1; }
.pub-verdict.ok { border-color: #0ca30c; background: rgba(12,163,12,0.07); }
.pub-verdict.warn { border-color: #d68c14; background: rgba(214,140,20,0.09); }
.pub-verdict.err { border-color: #d03b3b; background: rgba(208,59,59,0.08); }
.pub-verdict.mute { border-color: var(--border); }
.pub-verdict p { margin: 4px 0; font-size: calc(13.5px * var(--fs)); }
.pub-foot { font-size: calc(11.5px * var(--fs)); color: var(--text-muted); margin-top: 18px; line-height: 1.55; }
.pub-scan video { width: 100%; max-height: 340px; background: #000; border-radius: var(--r-md); object-fit: cover; }
.pub-result { margin-top: 10px; }

/* MODE URGENCE */
.u-bar { height: 10px; border-radius: 6px; background: var(--bg-surface-2); border: 1px solid var(--border-soft); overflow: hidden; margin-top: 8px; }
.u-bar > i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; min-width: 3%; }
.u-list { max-height: 280px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 10px; background: var(--bg-surface); }
.u-list label { display: block; padding: 5px 0; font-weight: 400; border-bottom: 1px solid var(--border-soft); }
.u-list label[hidden], [data-selection][hidden], [data-copie][hidden] { display: none; }

/* Mode urgence : tableau d'informations d'un document (jamais de débordement horizontal, même avec une empreinte ou un type MIME longs) */
.u-info { width: 100%; table-layout: fixed; }
.u-info th { width: 36%; text-align: left; vertical-align: top; }
.u-info td { overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 640px) { .u-det { display: none; } }

/* ---- Aperçu intégré des pièces (v7.1) ---- */
.ap-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ap-card { padding: 14px 16px; }
.ap-frame { width: 100%; height: min(78vh, 900px); min-height: 420px; border: 1px solid var(--border); border-radius: var(--r-md, 10px); background: var(--bg-surface-2); display: block; }
.ap-img-wrap { text-align: center; overflow: auto; }
.ap-img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--r-md, 10px); background: var(--bg-surface-2); }
.ap-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; max-height: 78vh; overflow: auto; }
.ap-doc { max-width: 820px; margin: 0 auto; padding: 8px 6px; line-height: 1.6; overflow-wrap: anywhere; }
.ap-doc p { margin: 0 0 .7em; } .ap-doc h2, .ap-doc h3, .ap-doc h4 { margin: 1.1em 0 .5em; }
.ap-doc .ap-li { padding-left: 1.2em; text-indent: -1em; }
.ap-doc .ap-slide { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin: 0 0 12px; background: var(--bg-surface-2); }
.ap-doc .ap-slide h3 { margin-top: 0; }
.ap-scroll { overflow: auto; max-width: 100%; }
.ap-table { border-collapse: collapse; margin: .6em 0 1em; font-size: 13px; }
.ap-table td { border: 1px solid var(--border); padding: 4px 8px; vertical-align: top; min-width: 40px; }
.ap-sheet { margin: 1em 0 .4em; }
.ap-none { text-align: center; padding: 36px 12px; }
@media (max-width: 700px) { .ap-frame { height: 62vh; } }

/* ======================================================================
   v7.3 — Comptabilité
   ====================================================================== */
.cp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cp-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-top: 16px; }
.cp-card { padding: 16px 18px; }
.cp-card h3 { font-size: calc(14px * var(--fs)); margin: 0 0 10px; }
.cp-kpi .n { font-variant-numeric: tabular-nums; }
.cp-kpi .u { font-size: 0.55em; font-weight: 600; color: var(--text-secondary); margin-left: 3px; }
.cp-kpi .sub { margin-top: 4px; font-size: calc(11.5px * var(--fs)); color: var(--text-muted); }
.cp-pos { color: var(--status-valide); } .cp-neg { color: var(--status-rejete); }
.cp-etat { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: calc(11.5px * var(--fs)); font-weight: 600; white-space: nowrap; }
.cp-etat-payee { background: rgba(12,163,12,0.12); color: #0a7d0a; }
.cp-etat-impayee { background: rgba(250,178,25,0.18); color: #8a5a00; }
.cp-etat-partielle { background: rgba(59,130,246,0.14); color: #1d4ed8; }
.cp-etat-retard { background: rgba(208,59,59,0.12); color: var(--status-rejete); }
.cp-etat-brouillon, .cp-etat-annulee { background: rgba(136,145,160,0.16); color: var(--text-secondary); }
.cp-etat-avoir { background: rgba(124,58,237,0.12); color: #6d28d9; }
.cp-annulee td { text-decoration: line-through; color: var(--text-muted); }
.cp-annulee td:last-child, .cp-annulee td .cp-keep { text-decoration: none; }
.cp-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 14px 0; }
.cp-filters .field { margin: 0; flex: 1 1 140px; }
.cp-lines { width: 100%; border-collapse: collapse; }
.cp-lines th { text-align: left; font-size: calc(11px * var(--fs)); text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 4px 6px; }
.cp-lines td { padding: 4px 4px; vertical-align: top; }
.cp-lines input, .cp-lines select { width: 100%; min-width: 0; }
.cp-lines .c-des { min-width: 200px; } .cp-lines .c-nat { min-width: 120px; } .cp-lines .c-q { width: 70px; } .cp-lines .c-pu { width: 120px; } .cp-lines .c-r { width: 70px; } .cp-lines .c-t { width: 110px; text-align: right; padding-top: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-totaux { margin-left: auto; width: min(360px, 100%); margin-top: 12px; }
.cp-totaux div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.cp-totaux .ttc { border-top: 2px solid var(--text-primary); margin-top: 4px; padding-top: 8px; font-weight: 700; font-size: calc(15px * var(--fs)); }
.cp-bars { width: 100%; height: auto; display: block; }
.cp-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: calc(12px * var(--fs)); color: var(--text-secondary); margin-top: 6px; }
.cp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.cp-bar-row { display: flex; align-items: center; gap: 10px; font-size: calc(12.5px * var(--fs)); margin: 6px 0; }
.cp-bar-row .l { flex: 0 0 38%; overflow-wrap: anywhere; } .cp-bar-row .b { flex: 1; background: var(--bg-hover); border-radius: 4px; height: 12px; overflow: hidden; } .cp-bar-row .b span { display: block; height: 100%; background: var(--accent); }
.cp-bar-row .v { flex: 0 0 auto; min-width: 90px; text-align: right; font-variant-numeric: tabular-nums; }
.cp-note { font-size: calc(11.5px * var(--fs)); color: var(--text-muted); margin-top: 14px; line-height: 1.5; }
details.cp-box { border: var(--bw) solid var(--border); border-radius: var(--r-md); padding: 10px 14px; margin-top: 12px; background: var(--bg-surface); }
details.cp-box > summary { cursor: pointer; font-weight: 600; font-size: calc(13px * var(--fs)); }
@media (max-width: 720px) {
  .cp-lines thead { display: none; }
  .cp-lines tr { display: block; border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px; margin-bottom: 10px; }
  .cp-lines td { display: block; width: 100% !important; padding: 3px 0; }
  .cp-lines .c-t { text-align: left; padding-top: 3px; }
  .cp-lines .c-t::before { content: 'Total : '; color: var(--text-muted); }
}
/* impressions comptables */
.p-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.p-table th { text-align: left; border-bottom: 2px solid #111; padding: 5px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; }
.p-table td { border-bottom: 1px solid #ddd; padding: 5px 6px; vertical-align: top; }
.p-table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-tot { margin-left: auto; width: 270px; font-size: 12.5px; margin-top: 10px; } .p-tot div { display: flex; justify-content: space-between; padding: 3px 0; } .p-tot .big { border-top: 2px solid #111; font-weight: 700; font-size: 14px; margin-top: 4px; padding-top: 6px; }
.p-box { border: 1px solid #bbb; padding: 8px 10px; font-size: 12px; margin-top: 10px; line-height: 1.5; }
.p-watermark { text-align: center; color: #b00; border: 2px dashed #b00; padding: 6px; margin: 8px 0; font-weight: 700; letter-spacing: .08em; }
.p-sign { display: flex; justify-content: space-between; gap: 30px; margin-top: 36px; font-size: 11.5px; } .p-sign div { flex: 1; border-top: 1px solid #555; padding-top: 4px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* v7.4 — Bibliothèque d'archivages (réutilise les composants .cp-*) */
.register td a b { overflow-wrap: anywhere; }
.field input[type=date], .field input[type=search], .field input[type=number] {
  width: 100%; border: var(--bw) solid var(--border); background: var(--bg-surface); color: var(--text-primary);
  border-radius: var(--r-md); padding: 9px 10px; font-size: calc(13.5px * var(--fs)); font-family: inherit;
}
@media (max-width: 760px) { .field input[type=date], .field input[type=search], .field input[type=number] { min-height: 44px; } }
.bib-wrap > table.register { min-width: 720px; }
.bib-wrap > table.register td:first-child { min-width: 200px; }
