/* Socle commun (site public + administration) : polices, couleurs, boutons, champs. */
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans.woff") format("woff"); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../fonts/ibm-plex-sans-italic.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Serif"; src: url("../fonts/ibm-plex-serif-medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Serif"; src: url("../fonts/ibm-plex-serif-semibold.woff") format("woff"); font-weight: 600; font-display: swap; }

/* Palette : encre bleu-gris, un seul bleu marine d'accent, gris neutres légèrement froids. */
:root {
  --paper: #ffffff;
  --surface: #ffffff;
  --sunk: #f4f6f8;
  --ink: #18202b;
  --text: #2c3542;
  --muted: #5d6877;
  --line: #e1e5ea;
  --head: #18202b;
  --accent: #1f3a5f;
  --accent-soft: #e8edf4;
  --on-accent: #ffffff;
  --link: #1f4f8a;
  --ok: #1d7a4c;
  --warn: #9a5b0b;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(24, 32, 43, .06), 0 6px 20px -12px rgba(24, 32, 43, .2);
  --f-display: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11151b; --surface: #171c23; --sunk: #1c222b; --ink: #edf1f5; --text: #d4dae2; --muted: #9aa5b3; --line: #2a313b;
    --head: #edf1f5; --accent: #a9c1e0; --accent-soft: #1f2935; --on-accent: #11151b; --link: #a9c1e0;
    --ok: #5cc28d; --warn: #e2a54f; --danger: #f08a82; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11151b; --surface: #171c23; --sunk: #1c222b; --ink: #edf1f5; --text: #d4dae2; --muted: #9aa5b3; --line: #2a313b;
  --head: #edf1f5; --accent: #a9c1e0; --accent-soft: #1f2935; --on-accent: #11151b; --link: #a9c1e0;
  --ok: #5cc28d; --warn: #e2a54f; --danger: #f08a82; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--text); font-family: var(--f-body); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; color: var(--ink); text-wrap: balance; }
p { margin: 0; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 4px; z-index: 99; }
.skip:focus { left: 16px; }

/* Marque (pages de connexion) */
.mono { font-family: var(--f-display); font-weight: 600; font-size: 17px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.mono b { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-family: var(--f-body); font-size: 12.5px; letter-spacing: .03em; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; border-radius: 4px; font-weight: 500; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--sunk); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.danger { color: var(--danger); }
.btn.danger.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg, .icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Champs */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.field .hint { font-size: 12.5px; font-weight: 400; }
.field input, .field select, .field textarea, .taginput input {
  width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--paper); border-radius: 4px; padding: 9px 11px; font-size: 15px;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .taginput input:focus { outline: 2px solid var(--link); outline-offset: -1px; border-color: transparent; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* Messages */
.note { font-size: 14.5px; color: var(--muted); background: var(--sunk); border-radius: 4px; padding: 10px 12px; margin: 0; }
.note.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.note.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.note.err { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.empty { color: var(--muted); font-size: 14.5px; padding: 18px; border: 1px dashed var(--line); border-radius: var(--r); text-align: center; }
.pdf-status { color: var(--muted); font-size: 14.5px; text-align: center; padding: 28px 0; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 4px; font-size: 14.5px; font-weight: 500; z-index: 100; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }
.toast.ok { background: var(--ok); color: #fff; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
