/* Registre de sécurité — feuille de style (étape 1) */
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #0f172a;
  --ok-bg: #dcfce7; --ok-bd: #86efac; --ok-tx: #14532d;
  --err-bg: #fee2e2; --err-bd: #fca5a5; --err-tx: #7f1d1d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.wrap { max-width: 60rem; margin: 0 auto; padding: 0 1rem; }
header { background: var(--card); border-bottom: 1px solid var(--border); }
.bar { display: flex; align-items: center; gap: 1rem; padding: 0.75rem 1rem; flex-wrap: wrap; }
.bar nav { margin-left: auto; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.bar a { color: var(--muted); text-decoration: none; font-weight: 500; }
.bar a:hover { color: var(--text); }
.who { color: var(--muted); font-size: 0.85rem; }
main.wrap { padding: 1.5rem 1rem 3rem; }
footer { border-top: 1px solid var(--border); padding: 1rem 0; color: var(--muted); }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
a { color: #1d4ed8; }
.small { font-size: 0.85rem; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.narrow { max-width: 28rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }

label { display: block; margin-bottom: 0.75rem; font-weight: 500; font-size: 0.9rem; }
input, select {
  display: block; width: 100%; margin-top: 0.25rem;
  padding: 0.5rem 0.6rem; font: inherit;
  border: 1px solid var(--border); border-radius: 0.5rem; background: #fff;
}
button {
  font: inherit; font-weight: 600;
  background: var(--accent); color: #fff; border: none;
  border-radius: 0.5rem; padding: 0.5rem 1rem; cursor: pointer;
}
button:hover { background: #334155; }
button.small, .small-input { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.small-input { display: inline-block; width: auto; margin: 0 0.25rem 0 0.5rem; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 0.75rem; overflow: hidden; margin-bottom: 1rem; }
th, td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { background: #f8fafc; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
tr.inactive td { color: var(--muted); }
.actions { white-space: nowrap; }
.inline { display: inline; }

.flash { border: 1px solid var(--ok-bd); background: var(--ok-bg); color: var(--ok-tx); border-radius: 0.5rem; padding: 0.6rem 0.9rem; margin-bottom: 1rem; }
.flash-err { border-color: var(--err-bd); background: var(--err-bg); color: var(--err-tx); }

@media print { header, footer, .actions { display: none; } }

/* ----- Étape 2 : chapitres, badges, tableau de bord ----- */
.mt { margin-top: 1.25rem; }
.nowrap { white-space: nowrap; }
.push { margin-left: auto; }
.grow { flex: 1 1 12rem; }
.stats .big { font-size: 1.8rem; font-weight: 700; }
.stat.red { border-color: #fca5a5; } .stat.red .big { color: #dc2626; }
.stat.orange { border-color: #fdba74; } .stat.orange .big { color: #ea580c; }
.stat.blue { border-color: #7dd3fc; } .stat.blue .big { color: #0284c7; }
.ok { color: #15803d; }

.badge {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 500; border: 1px solid transparent; white-space: nowrap;
}
.b-red    { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.b-orange { background: #ffedd5; color: #9a3412; border-color: #fdba74; }
.b-green  { background: #dcfce7; color: #166534; border-color: #86efac; }
.b-gray   { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

.row { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.row .num {
  background: #e2e8f0; border-radius: 0.35rem; padding: 0.1rem 0.45rem;
  font-family: ui-monospace, monospace; font-size: 0.8rem; font-weight: 600;
}
.row .titre { font-weight: 500; text-decoration: none; }
.card.off { opacity: 0.55; }
.chapter .small { margin-left: auto; }
.chapter .push { margin-left: 0.5rem; }
tr.row-open td { background: #fff7ed; }

.inline-form { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; }
.inline-form button { margin-bottom: 0.1rem; }
.add-ctrl, .levee { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 0.5rem; padding: 0.6rem; }
.add-ctrl label, .levee label { font-size: 0.8rem; color: var(--muted); }
.levee { background: #fff7ed; border-color: #fdba74; }

/* ----- Retouche esthétique (retour client) ----- */
a { color: inherit; }
h2 a, p a, td a { color: #1d4ed8; }
.chapter-card {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 0.75rem;
  padding: 0.75rem 1rem; margin-bottom: 0.6rem; text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.chapter-card:hover { border-color: #94a3b8; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08); }
.chapter-card .titre { font-weight: 500; flex: 1; }
.chapter-card .chevron { color: var(--muted); font-size: 1.1rem; margin-left: auto; }
.chapter-card.off { opacity: 0.5; }
.chapter-card.off .titre { font-weight: 400; }
.grid.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 0.6rem; }
.nb { margin-left: auto; }

button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
button.ghost:hover { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

.mt0 { margin-top: 0; }
.mt-s { margin-top: 0.75rem; }
details.add-ctrl { border: 1px dashed #cbd5e1; border-radius: 0.5rem; padding: 0.5rem 0.75rem; background: #f8fafc; }
details.add-ctrl summary {
  cursor: pointer; font-weight: 600; color: var(--muted);
  list-style: none; user-select: none;
}
details.add-ctrl summary:hover { color: var(--text); }
details.add-ctrl summary::before { content: "▸ "; }
details.add-ctrl[open] summary::before { content: "▾ "; }
.form-grid {
  display: grid; gap: 0.6rem 0.9rem; margin-top: 0.75rem;
  grid-template-columns: repeat(2, minmax(10rem, 1fr));
}
.form-grid .span2 { grid-column: span 2; }
.form-grid button { justify-self: start; }
.form-grid label { font-size: 0.8rem; color: var(--muted); margin-bottom: 0; }
