/* MBBS Sàrl — gestion. Charte reprise du site vitrine (site-mbbs) : papier, encre, rouge signal. */
:root {
  --paper: #fbfbf8;
  --panel: #f1efe9;
  --carte: #ffffff;
  --ink: #14171a;
  --ink-soft: #454b52;
  --ink-faint: #616870;
  --red: #e8412c;
  --red-dim: #c8351f;
  --line: #d9d6cc;
  --ok: #2f8a4c;
  --warn: #b37a00;
  --font-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121416; --panel: #1b1e21; --carte: #181b1e; --ink: #f1efe9; --ink-soft: #c2c6cb;
    --ink-faint: #9aa0a6; --line: #2d3236; --ok: #5fbf7a; --warn: #e0a020;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .6em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
h1 small, h2 small { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-faint); font-weight: 400; margin-left: .4em; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--red); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
code, .mono { font-family: var(--font-mono); font-size: .88em; }
.petit { font-size: .78em; word-break: break-all; }
.discret { color: var(--ink-faint); font-size: .9em; }
.vide { color: var(--ink-faint); font-style: italic; margin: .3em 0; }

/* barre */
.barre { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: .9rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 10; }
.marque { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; text-decoration: none; display: inline-flex; align-items: center; gap: .5em; }
.marque-point, .sourcil-point { width: 8px; height: 8px; background: var(--red); display: inline-block; }
.marque-sous { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-faint); font-weight: 400; }
.public .barre { justify-content: space-between; }
.nav { display: flex; flex-wrap: wrap; gap: .2rem; flex: 1; }
.nav a { text-decoration: none; padding: .35em .7em; font-size: .9rem; color: var(--ink-soft); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--red); }
.sortie { display: flex; align-items: center; gap: .6rem; margin: 0; }
.qui { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-faint); }

/* boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: .82rem; padding: .6em 1.1em; border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--red); color: var(--red); }
.btn-plein { background: var(--red); border-color: var(--red); color: #fff; }
.btn-plein:hover { background: var(--red-dim); color: #fff; }
.btn-fin { border-color: var(--line); }

/* mise en page admin */
.contenu { max-width: 1240px; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 3rem; }
.carte { background: var(--carte); border: 1px solid var(--line); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; min-width: 0; }
.carte-etroite { max-width: 460px; margin-left: auto; margin-right: auto; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1.25rem; }
.grille-2 > .carte { margin-bottom: 0; }
.grille-asym { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.entete-page { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 1rem; }
.pagination { display: flex; gap: .5rem; flex-wrap: wrap; }
.sourcil { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .14em; color: var(--ink-faint); display: flex; align-items: center; gap: .5em; margin: 0 0 .7rem; }

.alerte { padding: .7em 1em; border-left: 3px solid; background: var(--panel); margin: 0 0 1.2rem; }
.alerte-ok { border-color: var(--ok); }
.alerte-err { border-color: var(--red); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi { border: 1px solid var(--line); background: var(--carte); padding: 1rem 1.2rem; text-decoration: none; display: flex; flex-direction: column; gap: .2rem; }
.kpi-val { font-family: var(--font-display); font-size: 2.2rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-lib { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-faint); }
.kpi-alerte { border-color: var(--red); }
.kpi-alerte .kpi-val { color: var(--red); }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .45em .5em; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-family: var(--font-mono); font-size: .72rem; font-weight: 500; color: var(--ink-faint); letter-spacing: .05em; }
.carte .table { display: block; overflow-x: auto; }
.carte .table tbody, .carte .table thead { display: table; width: 100%; }
.table-liste { display: block; overflow-x: auto; }

.pastille { font-family: var(--font-mono); font-size: .72rem; padding: .15em .55em; border: 1px solid var(--line); white-space: nowrap; }
.pastille-ok, .pastille-faite, .pastille-deploye, .pastille-valide { border-color: var(--ok); color: var(--ok); }
.pastille-err { border-color: var(--red); color: var(--red); }
.pastille-nouvelle, .pastille-en_cours, .pastille-complet { border-color: var(--warn); color: var(--warn); }
.pastille-transmise { border-color: var(--ink-soft); color: var(--ink-soft); }

/* formulaires */
.formulaire { display: grid; gap: .9rem; }
.formulaire label, .filtres label { display: grid; gap: .3rem; font-size: .85rem; color: var(--ink-soft); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); padding: .55em .7em; width: 100%; border-radius: 0; }
textarea { resize: vertical; }
.filtres { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.filtres label { min-width: 140px; flex: 1; }
.filtres .btn { flex: none; }

/* agents */
.liste-agents { display: grid; gap: 1.25rem; }
.agent-tete { display: flex; justify-content: space-between; align-items: start; gap: 1rem; flex-wrap: wrap; }
.agent-tete h2 { margin-bottom: .1em; }

/* agenda */
.semaine { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; margin: 1rem 0 1.5rem; }
@media (max-width: 1000px) { .semaine { grid-template-columns: 1fr; } }
.jour { border: 1px solid var(--line); background: var(--carte); padding: .7rem; min-height: 120px; min-width: 0; }
.jour h2 { font-size: .9rem; text-transform: capitalize; display: flex; justify-content: space-between; }
.jour-courant { border-color: var(--red); }
.evt { border-left: 2px solid var(--red); padding: .25em .5em; margin-bottom: .45rem; font-size: .82rem; overflow-wrap: anywhere; }

/* métadonnées, markdown */
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 1.2rem; }
.meta dt { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-faint); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.consigne { white-space: pre-wrap; font-family: var(--font-body); background: var(--panel); padding: .8rem 1rem; margin: 0 0 1.2rem; overflow-wrap: anywhere; }
.markdown { overflow-wrap: anywhere; line-height: 1.6; }
.markdown pre { background: var(--panel); padding: .8rem; overflow-x: auto; }
.markdown table { border-collapse: collapse; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: .3em .6em; }
.markdown blockquote { border-left: 3px solid var(--line); margin: 0; padding-left: 1rem; color: var(--ink-soft); }
.markdown img { max-width: 100%; }

/* page publique */
.public main { max-width: 1180px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.5rem); }
.hero { padding: clamp(3rem, 9vw, 6rem) 0 3rem; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.08; max-width: 20ch; }
.chapeau { font-size: 1.1rem; color: var(--ink-soft); max-width: 60ch; margin: 1rem 0 1.8rem; }
.bloc { padding: 3rem 0; }
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 1.2rem; }
.services article { background: var(--paper); padding: 1.3rem; }
.services .mono { color: var(--red); font-size: .75rem; }
.services h3 { margin: .5rem 0; }
.services p { margin: 0; color: var(--ink-soft); }
.bloc-sombre { background: var(--ink); color: var(--paper); padding: 3rem clamp(1rem, 4vw, 2.5rem); margin: 0 calc(-1 * clamp(1rem, 4vw, 2.5rem)) ; }
.bloc-sombre .sourcil { color: #a8adb3; }
.lien-fort { font-family: var(--font-display); font-size: 1.5rem; color: var(--red); }
.pied { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: 1.5rem clamp(1rem, 4vw, 2.5rem); font-family: var(--font-mono); font-size: .75rem; color: var(--ink-faint); border-top: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .bloc-sombre { background: var(--panel); color: var(--ink); } }
