:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e8eef4;
  --muted: #a8b9d1;
  --heading-muted: #c5d0e0;
  --accent: #3d9eff;
  --accent-dim: rgba(61, 158, 255, 0.22);
  --inclusive: #6ef0d8;
  --err: #ffb3b3;
  --radius: 12px;
  --tap-min: 2.75rem;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

html[data-theme="light"] {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --border: #d5dde8;
  --text: #0d1623;
  --muted: #44566f;
  --heading-muted: #223247;
  --accent: #1f7ae0;
  --accent-dim: rgba(31, 122, 224, 0.14);
  --inclusive: #0b8f78;
  --err: #b31818;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.55; }
.skip-link { position: absolute; left: -9999px; top: 0.65rem; z-index: 200; display: inline-flex; align-items: center; min-height: var(--tap-min); padding: 0.5rem 1.1rem; background: var(--text); color: var(--bg); font-weight: 600; border-radius: 8px; text-decoration: none; }
.skip-link:focus { left: 0.65rem; outline: 3px solid var(--inclusive); outline-offset: 3px; }
.layout { max-width: 960px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
header { margin-bottom: 1.4rem; }
header h1 { font-size: 1.45rem; margin: 0 0 0.5rem; }
header .lede { margin: 0; color: var(--muted); font-size: 0.92rem; }
header a { color: #7ec4ff; }
html[data-theme="light"] header a { color: var(--accent); }

.header-row { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.theme-toggle { white-space: nowrap; }

.field-error { margin: 0.35rem 0 0; color: var(--err); font-size: 0.84rem; }
.field-error[hidden] { display: none; }
.lock-note { margin: 0 0 0.75rem; font-size: 0.84rem; color: var(--muted); }
.panel.is-locked .lock-note { color: var(--text); font-weight: 600; }

.steps-bar { margin-bottom: 1.25rem; }
.steps-bar ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0 0 1rem; border-bottom: 1px solid var(--border); }
.step-pill { display: block; padding: 0.55rem 0.7rem; border-radius: 8px; border: 1px solid var(--border); font-size: 0.82rem; color: var(--muted); }
.step-pill.is-current { border-color: var(--accent); color: var(--text); background: var(--accent-dim); }

.purpose-callout { margin: 0 0 1.5rem; padding: 1rem 1.15rem; border-radius: var(--radius); border-left: 4px solid var(--inclusive); background: rgba(110, 240, 216, 0.12); }
.callout-heading { margin: 0 0 0.35rem; font-size: 1rem; }
.purpose-lede { margin: 0; }
.test-consigne {
  margin: -0.5rem 0 1.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: var(--surface);
}
.test-consigne summary { cursor: pointer; font-weight: 600; color: var(--heading-muted); }
.test-consigne p { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.88rem; }

.theory-box,
.lang-box,
.limits-box {
  margin: -0.5rem 0 1.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  background: var(--surface);
}
.theory-box summary,
.lang-box summary,
.limits-box summary { cursor: pointer; font-weight: 600; color: var(--heading-muted); }
.theory-content { margin-top: 0.55rem; }
.theory-list { margin: 0.55rem 0 0; color: var(--muted); font-size: 0.88rem; padding-left: 1.2rem; }
.theory-list li { margin: 0.35rem 0; }
.repere-line { margin: -0.25rem 0 0.45rem; font-size: 0.82rem; color: var(--muted); }
.schema-question {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--heading-muted);
}

.panels { display: grid; gap: 1.25rem; }
@media (min-width: 760px) { .panels { grid-template-columns: 1fr 1fr; } .panel--wide { grid-column: 1 / -1; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.35rem; }
.panel.is-locked { pointer-events: none; border-style: dashed; opacity: 0.78; }
.panel h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--heading-muted); margin: 0 0 0.85rem; }
.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-size: 0.9rem; margin-bottom: 0.4rem; color: var(--text); }
.hint { font-size: 0.82rem; color: var(--muted); margin: 0.3rem 0 0; line-height: 1.45; }
.hint-strong { color: var(--text); font-weight: 600; margin-top: 0.7rem; }
.req { color: var(--inclusive); }
select, input[type="text"], textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); padding: 0.5rem 0.65rem; font: inherit; }
select, input[type="text"] { min-height: var(--tap-min); }
textarea { resize: vertical; }
.textarea-compact { min-height: 4.5rem; }
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--inclusive); outline-offset: 2px; }
fieldset.fieldset-object { border: none; margin: 0 0 1rem; padding: 0; }
fieldset.fieldset-object legend { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.45rem; }

.chip-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { display: inline-flex; align-items: center; gap: 0.5rem; border: 1px solid var(--border); border-radius: 999px; padding: 0.4rem 0.8rem; cursor: pointer; min-height: var(--tap-min); font-size: 0.88rem; }
.chip:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.chip input { margin: 0; accent-color: var(--accent); }

.dimension-grid { display: grid; gap: 0.75rem; }
@media (min-width: 800px) { .dimension-grid { grid-template-columns: repeat(2, 1fr); } }
.dim-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.85rem 0.95rem; background: var(--bg); }
.dim-card h3 { margin: 0 0 0.45rem; font-size: 0.93rem; color: var(--heading-muted); }
.dim-btn { width: 100%; text-align: left; border: 1px solid var(--border); background: transparent; color: var(--text); border-radius: 8px; padding: 0.55rem 0.7rem; margin-top: 0.35rem; cursor: pointer; min-height: var(--tap-min); }
.dim-btn.is-selected { border-color: var(--accent); background: var(--accent-dim); }
.dim-btn:focus-visible { outline: 2px solid var(--inclusive); outline-offset: 2px; }
.schema-toolbar { display: flex; gap: 0.75rem; align-items: center; justify-content: space-between; margin: 0.2rem 0 0.8rem; flex-wrap: wrap; }
.btn-small { min-height: 2.1rem; padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.schema-consigne {
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #8fb8e8;
  border-radius: 8px;
  background: rgba(143, 184, 232, 0.1);
  font-size: 0.86rem;
}

.objective-recall {
  margin: 0.25rem 0 0.9rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: rgba(61, 158, 255, 0.08);
  padding: 0.65rem 0.8rem;
}
.objective-recall-title {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--heading-muted);
  text-transform: uppercase;
}
.objective-recall-text { margin: 0; }

.schema-layout { display: grid; gap: 0.85rem; }
.schema-zone {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 0.85rem;
}
.schema-zone h3 { margin: 0 0 0.35rem; font-size: 0.96rem; color: var(--heading-muted); }
.schema-zone--wide { grid-column: 1 / -1; }
#zone-cadre,
#zone-processus-group,
#zone-info {
  border: 2px solid #8fb8e8;
}

.yn-toggle {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.55rem;
}
.btn-yn {
  min-height: 2.1rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}
.btn-yn.is-selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.schema-zone-group {
  padding: 0.75rem;
}
.schema-zone-inner {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.7rem;
}

.option-list { display: grid; gap: 0.5rem; margin-top: 0.55rem; }
.option-list--inline { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.option-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  background: transparent;
}
.option-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  cursor: pointer;
  font-size: 0.88rem;
}
.option-label input { margin: 0; accent-color: var(--accent); }
.option-followup { margin-top: 0.45rem; display: grid; gap: 0.45rem; }
.option-followup[hidden] { display: none; }

.schema-middle { display: grid; gap: 0.7rem; grid-template-columns: 1fr 140px 1fr; align-items: stretch; }
.schema-flow {
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(61, 158, 255, 0.03);
  padding: 0.4rem;
}
.flow-node { font-weight: 600; font-size: 0.86rem; text-align: center; color: var(--heading-muted); line-height: 1.15; }
.flow-node span { display: block; }
.flow-arrow { line-height: 1; }
.flow-arrow-1, .flow-arrow-2 { color: var(--text); font-size: 1.25rem; }
.flow-arrow-3 { color: var(--muted); font-size: 1rem; opacity: 0.7; }
@media (max-width: 900px) {
  .schema-middle { grid-template-columns: 1fr; }
  .schema-flow { min-height: 70px; }
}

.dimension-details { display: grid; gap: 1rem; }
.detail-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.95rem; background: var(--bg); }
.detail-card h3 { margin: 0 0 0.7rem; font-size: 0.95rem; }
.contrib-grid { display: grid; gap: 0.45rem; }
.panel-with-feedback {
  display: grid;
  gap: 0.9rem;
}
.feedback-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(61, 158, 255, 0.04);
  padding: 0.8rem;
}
.feedback-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--heading-muted);
}
.feedback-card textarea {
  min-height: 7.5rem;
}
.feedback-note { margin-top: 0.45rem; font-size: 0.78rem; }
.feedback-card--in-live { margin-top: 1rem; }

.live { margin-top: 2rem; padding: 1.35rem 1.5rem; border-radius: var(--radius); border: 1px solid var(--accent); background: linear-gradient(145deg, rgba(61,158,255,0.08), var(--surface)); }
.live > h2 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--heading-muted); margin: 0 0 0.75rem; }
html[data-theme="dark"] .live > h2 { color: #9ed2ff; }
.synth-disclaimer-top { font-size: 0.86rem; color: var(--muted); margin: 0 0 1rem; }
.synth-block { margin-bottom: 1rem; }
.synth-block h3 { font-size: 0.88rem; margin: 0 0 0.35rem; color: var(--heading-muted); }
.synth-text { margin: 0; white-space: pre-wrap; }
.live-meta { margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--muted); }
.badge { display: inline-block; padding: 0.2rem 0.55rem; border-radius: 6px; background: var(--accent-dim); color: var(--text); border: 1px solid rgba(61,158,255,0.45); font-size: 0.75rem; }

.actions { margin-top: 1.75rem; padding: 1.25rem 1.35rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.actions h2 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--heading-muted); margin: 0 0 0.75rem; }
.actions-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.actions-row--secondary {
  margin-top: 0.55rem;
  opacity: 0.78;
}
.btn { font: inherit; font-weight: 600; min-height: var(--tap-min); padding: 0.5rem 1.15rem; border-radius: 8px; border: none; cursor: pointer; background: var(--accent); color: #0a0e14; }
.btn-primary-strong {
  box-shadow: 0 0 0 2px rgba(61, 158, 255, 0.35), 0 4px 14px rgba(61, 158, 255, 0.2);
}
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn:not(:disabled):hover { opacity: 0.92; }
.btn:focus-visible { outline: 2px solid var(--inclusive); outline-offset: 2px; }
.btn:disabled { background: #3d4d66; color: #b8c5d8; cursor: not-allowed; }
.save-status { margin: 0.85rem 0 0; min-height: 1.3em; }
.save-status.ok { color: var(--accent); }
.save-status.err { color: var(--err); }
.save-hint { margin: 0; color: var(--muted); font-size: 0.82rem; }
.actions .save-hint + .save-hint { margin-top: 0.35rem; }
.admin-block { margin-top: 0.95rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.admin-block h3 { font-size: 0.82rem; margin: 0 0 0.55rem; color: var(--heading-muted); }
