/* ============================================================
   Nexalys — Préparation du diagnostic (design v3)
   Scopé sous .nxo-root. Briques partagées (.nxk-hero…) : lib/coach-kit.ts
   Tokens : theme.css
   ============================================================ */

#tab-onboarding { background: var(--nx-page); }

.nxo-root {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
  box-sizing: border-box;
  padding: 16px 14px 0;
  color: var(--nx-text-strong);
  font-family: var(--font-ui, "Geist", system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
}
.nxo-root *, .nxo-root *::before, .nxo-root *::after { box-sizing: border-box; }
.nxo-root button { font-family: inherit; }
.nxo-root :where(button, [tabindex]):focus-visible { outline: 2px solid var(--nx-green-700); outline-offset: 2px; }

/* ───────── Progression ───────── */

.nxo-header { display: block; }
.nxo-root.is-welcome .nxo-header { display: none; }

.nxo-progress { display: flex; align-items: center; gap: 10px; }
.nxo-progress-track {
  flex: 1 1 auto; height: 6px; overflow: hidden;
  border-radius: 999px; background: #d6e0da;
}
.nxo-progress-fill {
  width: 0; height: 100%;
  border-radius: inherit; background: var(--nx-green-600);
  transition: width .38s cubic-bezier(.4, 0, .2, 1);
}
.nxo-progress-label {
  flex: 0 0 auto;
  padding: 3px 9px; border-radius: 999px;
  background: #fff; border: 1px solid var(--nx-line);
  font-size: 11.5px; font-weight: 700; color: var(--nx-text-soft);
  font-variant-numeric: tabular-nums;
}

/* ───────── Étapes ───────── */

.nxo-steps { flex: 1 1 auto; min-height: 0; }

.nxo-step { display: none; flex-direction: column; gap: 14px; animation: nxo-in .3s cubic-bezier(.22, 1, .36, 1); }
.nxo-step.is-active { display: flex; }
@keyframes nxo-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.nxo-step-head { display: flex; flex-direction: column; gap: 6px; padding: 2px 2px 0; }
.nxo-step-kicker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--nx-green-800);
}
.nxo-step-kicker::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--nx-green-500); box-shadow: 0 0 0 3px var(--nx-green-100);
}
.nxo-step-title { margin: 0; font-size: 22px; font-weight: 750; letter-spacing: -.03em; line-height: 1.2; color: var(--nx-ink); }
.nxo-step-sub { margin: 0; font-size: 13px; line-height: 1.55; color: var(--nx-text-soft); }

/* ───────── Cartes ───────── */

.nxo-form-card,
.nxo-context-card,
.nxo-card {
  background: var(--nx-surface);
  border: 1px solid var(--nx-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(11, 31, 59, .05);
}
.nxo-form-card { overflow: hidden; }
.nxo-card, .nxo-context-card { padding: 16px 14px; }
.nxo-card-title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.015em; color: var(--nx-ink); }

.nxo-form-section { padding: 16px 14px; }
.nxo-section-divider { height: 1px; margin: 0 14px; background: var(--nx-divider); }
.nxo-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.nxo-section-head > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nxo-section-number {
  flex: 0 0 auto; width: 26px; height: 26px;
  display: grid; place-items: center; border-radius: 8px;
  background: var(--nx-green-100); color: var(--nx-green-800);
  font-size: 12px; font-weight: 800;
}
.nxo-section-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; color: var(--nx-ink); }
.nxo-required {
  display: inline-flex; align-items: center; margin-left: 5px; padding: 1px 7px;
  border-radius: 999px; background: #eef3f0; color: var(--nx-text-soft);
  font-size: 10.5px; font-weight: 650; vertical-align: 1px;
}
.nxo-required-help { margin: 0; text-align: center; font-size: 12px; color: var(--nx-muted); }

/* ───────── Questionnaire v3 : précisions, champs facultatifs, profondeur ───────── */
.nxo-form-section[hidden], .nxo-section-divider[hidden] { display: none; }
.nxo-section-note { margin: -6px 0 10px; font-size: 12px; color: var(--nx-muted); }
/* Les libellés d'objectif sont longs : ils passent sur deux lignes au lieu d'être coupés. */
.nxo-select[data-single-field="goal"] .nxo-dropdown-summary { white-space: normal; line-height: 1.35; }
.nxo-optional { font-size: 11.5px; font-weight: 600; color: var(--nx-muted); white-space: nowrap; }
.nxo-hint { margin: 10px 0 0; font-size: 12px; line-height: 1.5; color: var(--nx-muted); }
.nxo-text-field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.nxo-text-field[hidden] { display: none; }
.nxo-text-field label { font-size: 12.5px; font-weight: 650; color: var(--nx-text-strong); }
.nxo-field-label--spaced { margin-top: 14px; }
.nxo-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.nxo-tag {
  display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--nx-green-100); color: var(--nx-green-800);
  font-size: 12px; font-weight: 650;
}
/* Les deux durées restent toujours l'une sous l'autre, même dans un volet large. */
#nxo-depth { margin-top: 12px; grid-template-columns: 1fr; }
.nxo-required-help[hidden] { display: none; }
.nxo-choice-meta { margin-left: 4px; font-size: 12px; font-weight: 600; color: var(--nx-green-800); white-space: nowrap; }
.nxo-choice-families { margin-top: 4px; font-size: 12px; line-height: 1.45; color: var(--nx-text-soft); }
.nxo-choice-meta:empty, .nxo-choice-families:empty { display: none; }

.nxo-context-head { margin-bottom: 14px; }
.nxo-context-eyebrow { display: block; margin-bottom: 2px; font-size: 12px; font-weight: 650; color: var(--nx-muted); }
.nxo-context-title { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.015em; color: var(--nx-ink); }
.nxo-field { margin-bottom: 16px; }
.nxo-field--last { margin-bottom: 0; }
.nxo-field-label { display: block; margin-bottom: 7px; font-size: 12.5px; font-weight: 650; color: var(--nx-text-strong); }

/* ───────── Chips (échéance) ───────── */

.nxo-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nxo-chip {
  min-height: 38px; padding: 0 13px;
  border: 1px solid var(--nx-border-strong); border-radius: 999px;
  background: #fff; color: var(--nx-text-strong);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.nxo-chip:hover { border-color: var(--nx-green-300); background: var(--nx-green-25); }
.nxo-chip.is-selected { background: var(--nx-green-900); border-color: var(--nx-green-900); color: #fff; }

/* ───────── Listes déroulantes ───────── */

.nxo-select { position: relative; }

.nxo-dropdown-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--nx-border-strong); border-radius: 12px;
  background: #fff; color: var(--nx-muted);
  font-size: 13px; text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.nxo-dropdown-trigger:hover { border-color: var(--nx-green-300); }
.nxo-dropdown-trigger:focus-visible,
.nxo-select.is-open .nxo-dropdown-trigger {
  outline: none; border-color: var(--nx-green-700); box-shadow: var(--nx-focus); color: var(--nx-ink);
}
.nxo-select.has-value .nxo-dropdown-trigger { color: var(--nx-ink); font-weight: 650; }
.nxo-dropdown-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nxo-dropdown-chevron { flex: 0 0 auto; color: var(--nx-muted); transition: transform .15s; }
.nxo-select.is-open .nxo-dropdown-chevron { transform: rotate(180deg); }

.nxo-dropdown-menu {
  position: fixed; z-index: 100020;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--nx-line); border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(11, 31, 59, .07), 0 18px 42px rgba(11, 31, 59, .14);
  animation: nxo-dd-in .14s ease-out;
}
.nxo-dropdown-menu[hidden] { display: none; }
@keyframes nxo-dd-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.nxo-select-option {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 42px; padding: 7px 9px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--nx-text-strong); font-size: 13px; line-height: 1.35; text-align: left;
  cursor: pointer; transition: background-color .12s;
}
.nxo-select-option:hover,
.nxo-select-option:focus-visible { outline: none; background: var(--nx-green-25); }
.nxo-select-option.is-selected { background: var(--nx-green-50); color: var(--nx-green-900); font-weight: 650; }
.nxo-select-option-ico {
  flex: 0 0 auto; width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 9px;
  background: #eef3f0; color: var(--nx-text-soft);
}
.nxo-select-option.is-selected .nxo-select-option-ico { background: var(--nx-green-100); color: var(--nx-green-800); }
.nxo-select-option > span:not(.nxo-select-option-ico):not(.nxo-select-option-check) { flex: 1 1 auto; min-width: 0; }
.nxo-select-option-check { flex: 0 0 auto; color: var(--nx-green-700); font-weight: 800; opacity: 0; }
.nxo-select-option.is-selected .nxo-select-option-check { opacity: 1; }

.nxo-other-field { margin: 4px 4px 2px; padding: 10px 6px 4px; border-top: 1px solid var(--nx-divider); }
.nxo-other-field[hidden] { display: none; }
.nxo-other-field label { display: block; margin-bottom: 6px; font-size: 11.5px; font-weight: 650; color: var(--nx-muted); }
.nxo-other-input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--nx-border-strong); border-radius: 10px;
  background: var(--nx-surface-2); color: var(--nx-ink); font: inherit; font-size: 12.5px;
}
.nxo-other-input:focus { outline: none; border-color: var(--nx-green-700); box-shadow: var(--nx-focus); background: #fff; }

/* ───────── Étape « Identifions où tu en es » ───────── */

/* Intro diagnostic : carte claire et compacte, sans grand aplat vert */
.nxo-diag-intro {
  position: relative;
  overflow: hidden;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--nx-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(11, 31, 59, .05);
}
.nxo-diag-intro-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nxo-diag-icon {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--nx-green-100);
  color: var(--nx-green-800);
}
.nxo-diag-intro-heading { flex: 1 1 auto; min-width: 0; }
.nxo-diag-eyebrow {
  display: block;
  margin-bottom: 1px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--nx-green-800);
}
.nxo-diag-title {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.22;
  letter-spacing: -.025em;
  color: var(--nx-ink);
}
.nxo-diag-time {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--nx-line);
  border-radius: 999px;
  background: var(--nx-surface-2);
  color: var(--nx-text-soft);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.nxo-diag-copy {
  margin: 11px 0 12px;
  padding-left: 48px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--nx-text-soft);
}
.nxo-diag-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.nxo-diag-facts span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e3ebe6;
  border-radius: 10px;
  background: #f6f9f7;
  color: var(--nx-muted);
  font-size: 11px;
  line-height: 1.3;
}
.nxo-diag-facts b {
  font-size: 12.5px;
  font-weight: 750;
  color: var(--nx-ink);
}

.nxo-flow { list-style: none; margin: 8px 0 0; padding: 0; }
.nxo-flow li { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-top: 1px solid var(--nx-divider); }
.nxo-flow li:first-child { border-top: 0; }
.nxo-flow li:last-child { padding-bottom: 2px; }
.nxo-flow-num {
  flex: 0 0 auto; width: 28px; height: 28px;
  display: grid; place-items: center; border-radius: 8px;
  background: var(--nx-green-100); color: var(--nx-green-800);
  font-size: 12px; font-weight: 800;
}
.nxo-flow li > span:last-child { display: block; font-size: 12.5px; line-height: 1.45; color: var(--nx-muted); }
.nxo-flow b { display: block; margin-bottom: 1px; font-size: 13.5px; font-weight: 700; color: var(--nx-ink); }

.nxo-safe {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; border-radius: 14px;
  background: #f6f9f7; border: 1px solid #e3ebe6;
}
.nxo-safe-ico {
  flex: 0 0 auto; width: 30px; height: 30px;
  display: grid; place-items: center; border-radius: 9px;
  background: var(--nx-green-100); color: var(--nx-green-800);
}
.nxo-safe p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--nx-text-soft); }
.nxo-safe strong { color: var(--nx-ink); font-weight: 700; }

/* ───────── Étape « Ce test mesure ton niveau » ───────── */

.nxo-rules { padding: 4px 14px; }
.nxo-rule { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-top: 1px solid var(--nx-divider); }
.nxo-rule:first-child { border-top: 0; }
.nxo-rule-ico {
  flex: 0 0 auto; width: 36px; height: 36px;
  display: grid; place-items: center; border-radius: 10px;
}
.nxo-rule-ico--green { background: var(--nx-green-100); color: var(--nx-green-800); }
.nxo-rule-ico--navy { background: var(--nx-navy-50); color: var(--nx-navy-700); }
.nxo-rule-ico--amber { background: var(--nx-amber-soft); color: #a15c07; }
.nxo-rule > div { min-width: 0; }
.nxo-rule b { display: block; font-size: 14px; font-weight: 700; letter-spacing: -.01em; color: var(--nx-ink); }
.nxo-rule p { margin: 2px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--nx-text-soft); }

.nxo-idk-demo {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 9px; padding: 6px 12px;
  border: 1px solid var(--nx-border-strong); border-radius: 10px;
  background: #fff; color: var(--nx-text-strong);
  font-size: 12px; font-weight: 700;
  box-shadow: 0 1px 2px rgba(11, 31, 59, .05);
}
.nxo-idk-demo svg { color: var(--nx-navy-700); }

.nxo-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nxo-compare-col { display: flex; flex-direction: column; gap: 5px; padding: 12px; border-radius: 14px; border: 1px solid; }
.nxo-compare-col p { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--nx-text-strong); }
.nxo-compare-k { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 750; }
.nxo-compare-col--bad { background: var(--nx-bad-soft); border-color: var(--nx-bad-border); }
.nxo-compare-col--bad .nxo-compare-k { color: var(--nx-bad-ink); }
.nxo-compare-col--good { background: var(--nx-green-50); border-color: var(--nx-green-200); }
.nxo-compare-col--good .nxo-compare-k { color: var(--nx-green-800); }

.nxo-ack {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px; border-radius: 16px;
  border: 1.5px dashed #b3c6ba; background: #fff;
  cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.nxo-ack:hover { border-color: var(--nx-green-400); }
.nxo-ack.is-checked {
  border-style: solid; border-color: var(--nx-green-700);
  background: var(--nx-green-25); box-shadow: 0 0 0 1px var(--nx-green-700);
}
.nxo-ack-input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.nxo-ack-box {
  flex: 0 0 auto; width: 24px; height: 24px;
  display: grid; place-items: center; border-radius: 7px;
  border: 1.5px solid var(--nx-border-strong); background: #fff; color: transparent;
  transition: background-color .15s, border-color .15s, color .15s;
}
.nxo-ack-input:checked + .nxo-ack-box { background: var(--nx-green-800); border-color: var(--nx-green-800); color: #fff; }
.nxo-ack-input:focus-visible + .nxo-ack-box { box-shadow: var(--nx-focus); }
.nxo-ack-text { font-size: 12.5px; line-height: 1.45; color: var(--nx-text-soft); }
.nxo-ack-text b { display: block; margin-bottom: 1px; font-size: 14px; font-weight: 700; color: var(--nx-ink); }

/* ───────── Changement d'objectif : refaire le test ? ───────── */

.nxo-goals { display: grid; grid-template-columns: 1fr; gap: 8px; }
.nxo-goal {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; min-width: 0; padding: 14px;
  border: 1px solid var(--nx-line); border-radius: 16px;
  background: #fff; color: inherit; text-align: left; cursor: pointer;
  box-shadow: 0 1px 2px rgba(11, 31, 59, .05);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.nxo-goal:hover { border-color: var(--nx-green-300); }
.nxo-goal-ico {
  flex: 0 0 auto; width: 36px; height: 36px;
  display: grid; place-items: center; border-radius: 10px;
  background: #eef3f0; color: var(--nx-text-soft);
}
.nxo-choice-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nxo-goal-label { font-size: 14px; font-weight: 700; color: var(--nx-ink); }
.nxo-choice-sub { font-size: 12.5px; line-height: 1.45; color: var(--nx-muted); }
.nxo-goal-check {
  flex: 0 0 auto; width: 20px; height: 20px; margin-top: 8px;
  display: grid; place-items: center; border-radius: 50%;
  border: 1.5px solid var(--nx-border-strong); background: #fff;
}
.nxo-goal-check::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.nxo-goal.is-selected { border-color: var(--nx-green-700); background: var(--nx-green-25); box-shadow: 0 0 0 1px var(--nx-green-700); }
.nxo-goal.is-selected .nxo-goal-ico { background: var(--nx-green-100); color: var(--nx-green-800); }
.nxo-goal.is-selected .nxo-goal-check { border-color: var(--nx-green-800); background: var(--nx-green-800); }
.nxo-goal.is-selected .nxo-goal-check::after { background: #fff; }

.nxo-retake-error {
  margin: 0; padding: 10px 12px;
  border: 1px solid var(--nx-bad-border); border-radius: 12px;
  background: var(--nx-bad-soft); color: var(--nx-bad-ink);
  font-size: 12.5px; line-height: 1.45;
}
.nxo-retake-error[hidden] { display: none; }

/* ───────── Pied : collé en bas du volet ───────── */

.nxo-footer {
  position: sticky; bottom: 0; z-index: 3;
  display: flex; gap: 8px;
  margin: auto -14px 0;
  padding: 18px 14px 14px;
  background: linear-gradient(180deg, rgba(233, 239, 235, 0) 0, var(--nx-page) 16px);
}
.nxo-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 14px; font-weight: 700; letter-spacing: -.005em; cursor: pointer;
  transition: background-color .15s, border-color .15s, box-shadow .15s, color .15s;
}
.nxo-btn:active:not(:disabled) { transform: translateY(1px); }
.nxo-btn-primary {
  flex: 1 1 auto;
  background: var(--nx-green-800); border-color: var(--nx-green-900); color: #fff;
  box-shadow: 0 6px 16px rgba(15, 81, 50, .22);
}
.nxo-btn-primary:hover:not(:disabled) { background: var(--nx-green-900); }
.nxo-btn-primary:disabled {
  cursor: not-allowed; background: #dfe7e2; border-color: #d3ddd6; color: #7d8b83; box-shadow: none;
}
.nxo-btn-ghost { flex: 0 0 auto; min-width: 92px; background: #fff; border-color: var(--nx-line); color: var(--nx-text-strong); }
.nxo-btn-ghost:hover { border-color: var(--nx-border-strong); color: var(--nx-ink); }
.nxo-btn-ghost[hidden] { display: none; }

/* ───────── Adaptation au volet ───────── */

@media (min-width: 440px) {
  .nxo-goals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 340px) {
  .nxo-step-title { font-size: 20px; }
  .nxo-diag-facts, .nxo-compare { grid-template-columns: 1fr; }
  .nxo-footer { flex-direction: column-reverse; }
  .nxo-btn-ghost { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .nxo-step, .nxo-dropdown-menu { animation: none; }
  .nxo-progress-fill, .nxo-chip, .nxo-goal, .nxo-btn, .nxo-ack, .nxo-ack-box, .nxo-dropdown-chevron { transition: none; }
}


@media (max-width: 390px) {
  .nxo-diag-intro-top { align-items: flex-start; flex-wrap: wrap; }
  .nxo-diag-time { margin-left: 48px; }
  .nxo-diag-copy { padding-left: 0; }
  .nxo-diag-facts { grid-template-columns: 1fr; }
  .nxo-diag-facts span { flex-direction: row; align-items: baseline; gap: 5px; }
}
