:root { --bg: #f4f3f0; --card: #fff; --text: #1d1d1b; --muted: #6b6a66; --line: #dddad4; --accent: #9e1b1b; --accent-text: #fff; --ok: #2e7d4f; --err: #b3261e; --info: #1f5fa8; }
@media (prefers-color-scheme: dark) { :root { --bg: #161615; --card: #22221f; --text: #ecebe7; --muted: #a09e98; --line: #3a3934; --accent: #e06a6a; --accent-text: #1a0d0d; --ok: #6cc28f; --err: #f2867d; --info: #6aa3e8; } }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
header strong { display: flex; align-items: center; gap: 10px; }
header img.logo { height: 28px; width: auto; }
nav { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
nav form { margin: 0; }
main { max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; }
main.wide { max-width: 1100px; }
h1 { font-size: 24px; margin: 8px 0 16px; } h2 { font-size: 18px; margin: 0 0 10px; } h3 { font-size: 16px; margin: 0; }
a { color: var(--info); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.narrow { max-width: 380px; margin: 40px auto; }
.stack { display: grid; gap: 12px; margin: 10px 0; }
label { display: grid; gap: 4px; font-size: 14px; }
label.check { display: flex; gap: 8px; align-items: center; }
input, textarea, select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
input[type=checkbox] { width: auto; }
textarea { resize: vertical; }
button, .button { display: inline-block; padding: 8px 15px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text); font: inherit; cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.link { background: none; border: none; padding: 0; color: var(--info); }
button.danger, .danger { color: var(--err); }
.small, button.small, .button.small { font-size: 13px; }
button.small, .button.small { padding: 4px 10px; }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; }
.row input { flex: 1; min-width: 200px; }
.row-between { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.inline { display: inline; }
details { margin: 6px 0; } summary { cursor: pointer; color: var(--info); font-size: 14px; }
details.inline { display: inline-block; margin-left: 10px; vertical-align: middle; }
.project { border-top: 1px solid var(--line); padding: 12px 0; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.acts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.acts form { margin: 0; }
.badge { font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.draft { color: var(--muted); }
.badge.new { color: var(--err); border-color: var(--err); }
.flash { padding: 10px 14px; border-radius: 8px; background: var(--card); border: 1px solid var(--ok); }
.flash.err { border-color: var(--err); color: var(--err); }
.flash.info { border-color: var(--info); }
.list { padding-left: 18px; } .list li { margin: 6px 0; }
.content img, figure img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); }
figure { margin: 14px 0; } figcaption { font-size: 13px; color: var(--muted); }
.files { padding-left: 18px; } .files li { margin: 6px 0; }
.comment { border-left: 3px solid var(--line); padding: 4px 12px; margin: 10px 0; }
.comment.from-admin { border-left-color: var(--accent); }
@media (max-width: 640px) { th:nth-child(4), td:nth-child(4) { display: none; } }
fieldset.modules-pick { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: grid; gap: 6px; }
input.secret { font-family: ui-monospace, monospace; font-size: 12px; }
code { font-size: 13px; }

/* Mot de passe fixé par l'administrateur pour un client : masqué sans être un champ de connexion (pas de gestionnaire de mots de passe). */
input.masked { -webkit-text-security: disc; text-security: disc; }

/* ===== Charte visuelle db-apps (celle du cockpit) : fond presque noir ou très clair, gris froids, un seul rouge, rare.
   La barre du haut et le menu de gauche restent sombres dans les deux thèmes. Ce bloc prime sur les règles plus haut. ===== */
:root {
  --bg: #d6dae0; --bg2: #c9cfd6; --card: #e6e9ed; --card2: #e6e9ed; --text: #1f252c; --muted: #4f5964; --line: #a9b2bc;
  --accent: #d3222a; --accent-text: #ffffff; --link: #c41d24; --ok: #17663a; --ok-bg: #c9e0d2; --hyp: #7a4b00; --hyp-bg: #ecdcb4;
  --err: #b91c22; --info: #2a78d6; --glow: rgba(239, 45, 52, .07); --shadow: none; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --bg: #07090c; --bg2: #0b0f13; --card: #10161c; --card2: #141b22; --text: #f4f6f8; --muted: #a8b1ba; --line: #27313b;
    --accent: #e3252b; --accent-text: #ffffff; --link: #ff6d72; --ok: #7ad9a2; --ok-bg: #10291c; --hyp: #ffc766; --hyp-bg: #2f2510;
    --err: #ff6d72; --info: #3987e5; --glow: rgba(239, 45, 52, .12); --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="sombre"] {
  --bg: #07090c; --bg2: #0b0f13; --card: #10161c; --card2: #141b22; --text: #f4f6f8; --muted: #a8b1ba; --line: #27313b;
  --accent: #e3252b; --accent-text: #ffffff; --link: #ff6d72; --ok: #7ad9a2; --ok-bg: #10291c; --hyp: #ffc766; --hyp-bg: #2f2510;
  --err: #ff6d72; --info: #3987e5; --glow: rgba(239, 45, 52, .12); --shadow: none; color-scheme: dark;
}
html { font-size: 16px; }
body {
  background: radial-gradient(900px 450px at 85% -120px, var(--glow), transparent 60%) no-repeat, var(--bg); color: var(--text);
  font: 1rem/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: inherit; text-decoration-color: var(--muted); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--link); text-decoration-color: currentColor; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.3; }
h3 { font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.muted { color: var(--muted); }

/* Barre du haut : sombre dans les deux thèmes, avec le mot-symbole. */
header {
  position: sticky; top: 0; z-index: 20; color-scheme: dark; min-height: 3.25rem; display: flex; flex-wrap: wrap; align-items: center; gap: .375rem .75rem;
  padding: .375rem 1rem; background: rgba(7, 9, 12, .94); backdrop-filter: blur(12px); border-bottom: 1px solid rgba(255, 255, 255, .08); color: #d7dce1;
}
header .muted, header .small { color: #a8b1ba; }
header a, header button.link, header a.link { color: #d7dce1; }
header a:hover, header button.link:hover { color: #ffffff; }
.marque { font-weight: 800; font-size: 1.1875rem; color: #f4f6f8; text-decoration: none; letter-spacing: .01em; white-space: nowrap; }
.marque:hover { color: #f4f6f8; }
.marque b { color: #ef2d34; }
.marque span { margin-left: .625rem; padding-left: .625rem; border-left: 1px solid rgba(255, 255, 255, .2); font-weight: 600; font-size: .9375rem; color: #a8b1ba; }
@media (max-width: 700px) { .marque span { display: none; } }

/* Boutons et champs : le rouge est réservé à l'action principale. */
button, .button, input, select, textarea {
  font: inherit; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: .5rem .75rem; min-height: 2.5rem;
}
button, .button { cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .375rem; font-weight: 700;
  background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button:hover, .button:hover { filter: brightness(1.1); color: var(--accent-text); }
button.secondary, .button.secondary { background: var(--card); border-color: var(--line); color: var(--text); font-weight: 600; filter: none; }
button.secondary:hover, .button.secondary:hover { border-color: var(--muted); color: var(--text); filter: none; }
button.link, a.link { background: none; border: 0; padding: 0; min-height: 0; color: inherit; font-weight: 500; text-decoration: underline; text-decoration-color: var(--muted); text-decoration-thickness: 1px; text-underline-offset: 3px; filter: none; }
button.link:hover, a.link:hover { color: var(--link); filter: none; }
button.danger, a.danger, .danger { color: var(--err); }
button:disabled { opacity: .5; cursor: default; filter: none; }
input[type="checkbox"], input[type="radio"], input[type="range"] { min-height: 0; padding: 0; }
input[type="file"] { padding: .375rem; max-width: 100%; }
textarea { resize: vertical; }
label { color: var(--muted); }
label input, label select, label textarea { color: var(--text); }

/* Cartes, tableaux, pastilles. */
.card { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: 14px; padding: 1.125rem; box-shadow: var(--shadow); }
table { border-collapse: collapse; }
th, td { padding: .5rem .625rem; border-bottom: 1px solid var(--line); }
th { font-size: .8125rem; font-weight: 700; color: var(--muted); white-space: nowrap; }  /* never in capitals: a column title may carry a unit (g, mm, g/cm³) */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .0625rem .5rem; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.hyp, .badge.todo { background: var(--hyp-bg); color: var(--hyp); border-color: transparent; }
.error { color: var(--err); }

/* --- Espace client : navigation à droite dans la barre, contenu centré. --- */
header nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: .375rem 1rem; align-items: center; }
header nav a { text-decoration: none; padding: .375rem .625rem; border-radius: 8px; color: #c3cad1; }
header nav a:hover { color: #ffffff; background: rgba(255, 255, 255, .08); }
main { max-width: 1120px; padding: 24px 16px 40px; }
main .marque, .login .marque { color: var(--text); } main .marque span, .login .marque span { color: var(--muted); border-left-color: var(--line); }
td input, td select { min-height: 2.125rem; }
summary { color: inherit; }

/* Bouton de thème dans la barre, et pages simples (connexion, message) à la même charte. */
header button.theme { margin-left: auto; min-height: 2.125rem; padding: .25rem .75rem; background: transparent; color: #d7dce1; border: 1px solid rgba(255, 255, 255, .18); border-radius: 10px; font-weight: 600; white-space: nowrap; filter: none; }
header button.theme:hover { color: #ffffff; border-color: rgba(255, 255, 255, .45); filter: none; }
header button.theme + * { margin-left: 0; }
.etroit { max-width: 30rem; margin: 3rem auto; padding: 0 16px; }
.etroit .card { display: grid; gap: 12px; }
.etroit h1 { margin: 0; }
.etroit label { display: grid; gap: 4px; font-size: .875rem; }

/* Atelier (sandbox): catalogue and presentation sheets */
.lede { font-size: 1.0625rem; max-width: 60rem; } .tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1.25rem 0; }
.tiles div { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .875rem 1rem; } .tiles strong { display: block; font-size: 1.75rem; line-height: 1.1; } .tiles span { color: var(--muted); font-size: .875rem; }
.pills { display: flex; flex-wrap: wrap; gap: .375rem; margin: .5rem 0; } .pill { font-size: .8125rem; font-weight: 600; padding: .3125rem .75rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; background: var(--card); } .pill:hover { color: var(--text); } .pill.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.sols { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.sol { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-decoration: none; color: var(--text); transition: transform .15s, border-color .15s; } .sol:hover { transform: translateY(-2px); border-color: var(--muted); }
.cover { display: block; width: 100%; height: 6.5rem; } .sol-body { padding: .875rem 1rem 1rem; display: flex; flex-direction: column; gap: .375rem; flex: 1; } .sol-body h3 { font-size: 1.0625rem; line-height: 1.25; margin: 0; } .sol-body p { margin: 0; font-size: .9063rem; color: var(--muted); }
.sol-meta { font-size: .75rem !important; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; } .sol-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto !important; padding-top: .625rem; }
.sheet { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin: 1rem 0 1.5rem; } .sheet .cover { height: 13rem; } .sheet-body { padding: 2rem 2.25rem 1.5rem; }
.sheet h1 { font-size: 2.25rem; line-height: 1.1; letter-spacing: -.02em; margin: .5rem 0 .75rem; } .promise { font-size: 1.25rem; line-height: 1.45; max-width: 44rem; margin: 0 0 1.5rem; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; } .sheet h2 { font-size: .8125rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .625rem; } .sheet ul, .sheet ol { margin: 0; padding-left: 1.125rem; display: grid; gap: .375rem; } .sheet section p { margin: 0; font-size: 1.0625rem; }
.how { margin-top: 1.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); } .sheet-foot { margin: 1.75rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); } .sheet-foot b { color: #e3252b; }
@media (max-width: 700px) { .tiles, .sheet-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .sheet-grid { grid-template-columns: minmax(0, 1fr); } .sheet-body { padding: 1.25rem; } .sheet h1 { font-size: 1.625rem; } }
@media print { header, .noprint, .flash { display: none !important; } body { background: #fff; } main, main.wide { max-width: none; padding: 0; } .sheet { border: 0; margin: 0; border-radius: 0; } .cover { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.sec-horlo { color: #c8962b; } .sec-med { color: #1f9e8f; } .sec-public { color: #3b6fd4; } .sec-pme { color: #d2452f; } .sec-services { color: #7a52c7; } .sec-batiment { color: #5d8a2f; } .sec-socle { color: #e3252b; }
