:root {
  --noir: #0b0b0b;
  --carte: #161513;
  --champ: #211f1b;
  --ligne: #3a352a;
  --or: #d4af37;
  --or-fonce: #a68523;
  --texte: #f5f1e6;
  --doux: #b5ae9d;
  --erreur: #ff8f7a;
  --ok: #8fd19e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--noir);
  color: var(--texte);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; line-height: 1.2; }
h1 { font-size: 1.9rem; margin: 0; }
h2 { font-size: 1.25rem; margin: 0 0 16px; color: var(--or); }

.top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: #fff; padding: 10px 24px;
}
.logo { height: 56px; width: auto; display: block; }
.top .btn.ghost { color: #1a1a1a; border-color: #1a1a1a; }

main { max-width: 980px; margin: 0 auto; padding: 28px 24px 64px; }
main.narrow { max-width: 480px; }
.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.muted { color: var(--doux); }
.small { font-size: .875rem; }

.btn {
  font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; padding: 8px 18px;
  border-radius: 6px; border: 1px solid var(--or); background: var(--or); color: #111;
}
.btn:hover { background: #e4c250; }
.btn.ghost { background: transparent; color: var(--or); }
.btn.ghost:hover { background: rgba(212, 175, 55, .12); }
.btn.danger { background: transparent; color: var(--erreur); border-color: var(--erreur); }
.btn.danger:hover { background: rgba(255, 143, 122, .12); }
.btn:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.banner { background: #3b1d16; color: #ffd6cc; padding: 12px 24px; border-bottom: 1px solid var(--erreur); }
.card { background: var(--carte); border: 1px solid var(--ligne); border-radius: 8px; padding: 22px; margin-bottom: 18px; }
.notice { border-left: 3px solid var(--or); padding: 8px 14px; margin: 14px 0; background: rgba(212, 175, 55, .08); }

label, legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.req { color: var(--or); margin-left: 3px; }
.field { margin-bottom: 18px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.hint { font-size: .875rem; color: var(--doux); margin: 0 0 8px; }
.err { color: var(--erreur); font-size: .875rem; margin: 6px 0 0; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=password], input[type=search], textarea {
  width: 100%; font: inherit; min-height: 44px; padding: 9px 12px; color: var(--texte);
  background: var(--champ); border: 1px solid var(--ligne); border-radius: 6px;
  color-scheme: dark;
}
input:focus, textarea:focus { border-color: var(--or); }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--erreur); }
textarea { min-height: 96px; resize: vertical; }
.with-unit { display: flex; align-items: center; gap: 8px; }
.with-unit input { max-width: 150px; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; padding: 8px 14px;
  font-weight: 500; cursor: pointer; background: var(--champ); border: 1px solid var(--ligne); border-radius: 6px;
}
.choice:has(input:checked) { border-color: var(--or); background: rgba(212, 175, 55, .16); }
.choice input { accent-color: var(--or); width: 18px; height: 18px; margin: 0; flex: none; }
.choices.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choices.cards .choice { align-items: flex-start; }
.choice small { display: block; font-weight: 400; color: var(--doux); }
.consent { align-items: flex-start; }

.measures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.measure-group { grid-column: span 2; }
.measure-group > .group-title { font-weight: 600; margin-bottom: 6px; }
.measure-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.measure-pair label { font-weight: 400; color: var(--doux); }
.measures .field { margin: 0; }
.measures .with-unit input { max-width: none; }

.search { margin-bottom: 16px; }
table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { text-align: left; padding: 12px; border-bottom: 1px solid var(--ligne); }
.list th { font-size: .875rem; color: var(--doux); font-weight: 600; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: rgba(212, 175, 55, .08); }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--or); cursor: pointer; text-align: left; text-decoration: underline; }
.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--or); color: var(--or); margin-left: 8px; }
.empty { text-align: center; padding: 36px 12px; color: var(--doux); }

dl { display: grid; grid-template-columns: minmax(150px, 280px) 1fr; gap: 8px 16px; margin: 0; }
dt { color: var(--doux); }
dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.saved { color: var(--ok); font-weight: 600; }
.sticky-save { position: sticky; bottom: 0; background: var(--noir); border-top: 1px solid var(--ligne); padding: 12px 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

@media (max-width: 720px) {
  main { padding: 20px 16px 48px; }
  .top { padding: 8px 16px; }
  .logo { height: 44px; }
  .grid2, .choices.cards { grid-template-columns: minmax(0, 1fr); }
  .measures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  dd { margin-bottom: 10px; }
  .list .hide-small { display: none; }
}

@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  .top { padding: 0 0 8px; }
  .no-print, .banner, #lock-btn { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { background: #fff; border: 0; border-top: 1px solid #999; border-radius: 0; padding: 8px 0; margin: 0; break-inside: avoid; }
  h1 { font-size: 18px; margin: 6px 0; }
  h2 { color: #000; font-size: 13px; margin-bottom: 6px; }
  dt, .muted { color: #444; }
  dl { grid-template-columns: 240px 1fr; gap: 2px 12px; }
  dd { margin: 0; }
}
h1:focus { outline: none; }
.key { font-family: Consolas, "Courier New", monospace; font-size: 1.05rem; letter-spacing: .04em; overflow-wrap: anywhere; margin: 8px 0; }
.steps { padding-left: 20px; margin: 0 0 18px; } .steps li { margin-bottom: 12px; }
.codes { list-style: none; padding: 0; margin: 12px 0 18px; }
a.link { display: inline-block; font-weight: 400; }
