/* ════════════════════════════════════════════════════════════════
   Kiravest — Tunnel d'inscription / onboarding
   Pont visuel : structure du dashboard + accent du site marketing
   Réf. notebook/ux-spec-onboarding.md §6.1
   ════════════════════════════════════════════════════════════════ */

:root {
  /* Neutres — repris de dashboard.html */
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface-alt:   #f8fafc;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --text:          #0f172a;
  --text-soft:     #334155;
  --muted:         #64748b;
  --muted-soft:    #94a3b8;
  --blue:          #3b82f6;
  --green:         #16a34a;
  --red:           #dc2626;
  --amber:         #d97706;

  /* Accent — repris du site marketing */
  --accent:   #4DA8FF;
  --accent-2: #7C7AE6;
  --grad:     linear-gradient(135deg, #4DA8FF 0%, #7C7AE6 100%);
  --grad-sub: linear-gradient(135deg, rgba(77,168,255,.09) 0%, rgba(124,122,230,.09) 100%);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
  --bg:            #0b1220;
  --surface:       #131a2a;
  --surface-alt:   #1a2236;
  --border:        #243049;
  --border-strong: #2e3a55;
  --text:          #e2e8f0;
  --text-soft:     #cbd5e1;
  --muted:         #94a3b8;
  --muted-soft:    #64748b;
  --blue:          #60a5fa;
  --green:         #4ade80;
  --red:           #f87171;
  --amber:         #fbbf24;
  --grad-sub:      linear-gradient(135deg, rgba(77,168,255,.14) 0%, rgba(124,122,230,.14) 100%);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Inter", "Segoe UI", system-ui, sans-serif;
  font-feature-settings: "tnum", "ss01", "cv11";
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color .2s, color .2s;
}

h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.2; font-weight: 650; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  font-feature-settings: "tnum";
  color: inherit;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ────────────────────────────────────────────────────── */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 64px;
}

.shell--wide .card { max-width: 760px; }
.shell--narrow .card { max-width: 440px; }

/* Le mot-symbole du tunnel. C'etait un emoji 🏛 suivi de « Kiravest » : un
   glyphe systeme, dessine differemment sur chaque plateforme et sans rapport
   avec la marque, en tete de la page ou l'on demande a quelqu'un de creer un
   compte. Meme symbole que le site public desormais.

   Le mot reste sur --text et non sur --logo-navy : le tunnel s'affiche sur
   surface sombre comme claire selon le theme, et --text est le seul jeton qui
   suit vraiment ce fond. */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text);
  margin-bottom: 26px;
}
.brand:hover { text-decoration: none; }
.brand img { height: 1.04em; width: auto; display: block; }
/* Le theme du tunnel se choisit au bouton, pas a la preference systeme : le
   symbole doit donc etre echange ici, sinon le bleu nuit reste bleu nuit sur
   le fond #0b1220 et le logo s'efface. */
[data-theme="dark"] .brand img { content: url("../img/logo-mark-dark.svg"); }

.card {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 34px 34px 30px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 28px rgba(15, 23, 42, .05);
}
[data-theme="dark"] .card { box-shadow: 0 8px 28px rgba(0, 0, 0, .3); }

@media (max-width: 560px) {
  .shell { padding: 20px 14px 48px; }
  .card { padding: 24px 20px 22px; border-radius: var(--r-md); }
}

.card__head { margin-bottom: 24px; }
.card__eyebrow {
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 9px;
}
.card__title { font-size: 1.45rem; margin-bottom: 7px; }
.card__sub { font-size: .92rem; color: var(--muted); line-height: 1.5; }

.card__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.card__foot--plain { border-top: none; padding-top: 0; }
.card__foot .spacer { flex: 1; }

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

.steps {
  width: 100%;
  max-width: 560px;
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.shell--wide .steps { max-width: 760px; }

.step { flex: 1; }
.step__bar {
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.step.done .step__bar,
.step.current .step__bar { background: var(--grad); }
.step.current .step__bar { opacity: .55; }
.step.done .step__bar { opacity: 1; }
.step__lbl {
  margin-top: 7px;
  font-size: .72rem;
  font-weight: 550;
  color: var(--muted-soft);
  letter-spacing: -0.005em;
}
.step.current .step__lbl { color: var(--text-soft); }
.step.done .step__lbl { color: var(--muted); }

/* ── Boutons ───────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 980px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease),
              background-color .15s, border-color .15s, opacity .15s;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn--primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 3px 12px rgba(77, 168, 255, .3);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(77, 168, 255, .42); }

.btn--ghost {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-alt); border-color: var(--muted-soft); }

.btn--quiet {
  background: transparent;
  color: var(--muted);
  padding: 11px 8px;
  font-weight: 550;
}
.btn--quiet:hover { color: var(--text); }

.btn--block { width: 100%; }
.btn--lg { padding: 13px 26px; font-size: .95rem; }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn--google {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  font-weight: 550;
}
.btn--google:hover { background: var(--surface-alt); }

/* ── Formulaires ───────────────────────────────────────────────── */

.field { margin-bottom: 17px; }
.field--last { margin-bottom: 0; }

.field > label,
.field__label {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.field__label .opt {
  font-weight: 450;
  color: var(--muted-soft);
  margin-left: 5px;
}

.field__hint {
  margin-top: 6px;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.45;
}
.field__hint strong { color: var(--text-soft); font-weight: 600; }

.field__err {
  margin-top: 6px;
  font-size: .78rem;
  color: var(--red);
  font-weight: 550;
  display: none;
}
.field.invalid .field__err { display: block; }
.field.invalid input,
.field.invalid select { border-color: var(--red); }

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: .93rem;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77, 168, 255, .15);
}
input::placeholder { color: var(--muted-soft); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}

.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }
@media (max-width: 520px) { .row { flex-direction: column; gap: 17px; } }

/* Segmented control */
.seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.seg--wrap { flex-wrap: wrap; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: .85rem;
  font-weight: 550;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s var(--ease);
  white-space: nowrap;
}
.seg label:hover { color: var(--text-soft); }
.seg input:checked + label {
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .1);
}
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}
.stepper button {
  width: 38px;
  height: 40px;
  border: none;
  background: var(--surface-alt);
  color: var(--text-soft);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s;
}
.stepper button:hover { background: var(--border); }
.stepper input {
  width: 58px;
  height: 40px;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  text-align: center;
  font-weight: 650;
  font-size: .95rem;
}
.stepper input:focus { box-shadow: none; }

/* Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.toggle-row__txt { flex: 1; }
.toggle-row__txt b { display: block; font-size: .89rem; font-weight: 600; }
.toggle-row__txt span { font-size: .78rem; color: var(--muted); }

.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: 980px;
  transition: background-color .2s var(--ease);
  pointer-events: none;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s var(--ease);
}
.switch input:checked ~ .track { background: var(--accent); }
.switch input:checked ~ .track::after { transform: translateX(18px); }
.switch input:focus-visible ~ .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Bloc révélé conditionnellement */
.reveal {
  display: none;
  margin-top: 15px;
  padding: 17px;
  background: var(--grad-sub);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.reveal.on { display: block; }
.reveal > :last-child { margin-bottom: 0; }

/* ── Cartes de profil (/start) ─────────────────────────────────── */

.profiles { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .profiles { grid-template-columns: 1fr; } }

.profile {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 24px 22px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), border-color .18s;
}
.profile:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(77, 168, 255, .16);
  text-decoration: none;
}
.profile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.profile__ico {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 1.35rem;
  background: var(--grad-sub);
  border-radius: var(--r-md);
  margin-bottom: 15px;
}
.profile__name { font-size: 1.1rem; font-weight: 680; margin-bottom: 5px; }
.profile__desc { font-size: .87rem; color: var(--muted); line-height: 1.45; margin-bottom: 16px; }
.profile__list { list-style: none; margin-bottom: 20px; }
.profile__list li {
  font-size: .83rem;
  color: var(--text-soft);
  padding: 4px 0 4px 18px;
  position: relative;
}
.profile__list li::before {
  content: "·";
  position: absolute;
  left: 5px;
  color: var(--accent);
  font-weight: 700;
}
.profile__foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .84rem;
  font-weight: 600;
  color: var(--text);
}
.profile__foot .arrow { color: var(--accent); transition: transform .18s var(--ease); }
.profile:hover .profile__foot .arrow { transform: translateX(4px); }

/* ── Lignes d'intégration (/connect) ──────────────────────────── */

.integrations {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.integ { padding: 16px; border-bottom: 1px solid var(--border); }
.integ:last-child { border-bottom: none; }
.integ__top { display: flex; align-items: center; gap: 11px; }
.integ__dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.integ__name { font-size: .9rem; font-weight: 600; flex: 1; }
.integ__badge {
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .04em;
  padding: 3px 9px;
  border-radius: 980px;
  background: var(--surface-alt);
  color: var(--muted);
  border: 1px solid var(--border);
}
.integ__badge--pro { background: var(--grad-sub); color: var(--accent-2); border-color: transparent; }
.integ__badge--ok { background: rgba(22, 163, 74, .12); color: var(--green); border-color: transparent; }
.integ__body { margin-top: 12px; }
.integ__status { margin-top: 9px; font-size: .8rem; font-weight: 550; display: none; }
.integ__status.on { display: flex; align-items: center; gap: 7px; }
.integ__status--ok { color: var(--green); }
.integ__status--err { color: var(--red); }
.integ__status--load { color: var(--muted); }

.help {
  margin-top: 10px;
  font-size: .8rem;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}
.help summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 550;
  list-style: none;
}
.help summary::-webkit-details-marker { display: none; }
.help summary::before { content: "▸ "; }
.help[open] summary::before { content: "▾ "; }
.help ol { margin: 10px 0 0 18px; color: var(--muted); line-height: 1.7; }

/* ── Sorties de secours ───────────────────────────────────────── */

.escapes { margin-top: 18px; display: flex; flex-direction: column; gap: 9px; }
.escape {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 13px 15px;
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  text-align: left;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.escape:hover { background: var(--surface-alt); border-color: var(--muted-soft); text-decoration: none; }
.escape__txt { flex: 1; }
.escape__txt b { display: block; font-size: .86rem; font-weight: 600; color: var(--text); }
.escape__txt span { font-size: .78rem; color: var(--muted); }
.escape__arrow { color: var(--muted-soft); }

/* ── Divers ───────────────────────────────────────────────────── */

.sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  font-size: .78rem;
  color: var(--muted-soft);
  font-weight: 550;
}
.sep::before, .sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.note {
  display: flex;
  gap: 10px;
  padding: 13px 15px;
  background: var(--grad-sub);
  border-radius: var(--r-md);
  font-size: .82rem;
  color: var(--text-soft);
  line-height: 1.5;
}
.note__ico { flex-shrink: 0; }

.reassure {
  margin-top: 16px;
  text-align: center;
  font-size: .79rem;
  color: var(--muted);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .84rem;
  color: var(--text-soft);
  line-height: 1.45;
}
.check input { width: 17px; height: 17px; margin-top: 2px; flex-shrink: 0; accent-color: var(--accent); }

.alt-link { margin-top: 20px; text-align: center; font-size: .85rem; color: var(--muted); }

.tiny {
  margin-top: 22px;
  text-align: center;
  font-size: .76rem;
  color: var(--muted-soft);
  line-height: 1.6;
}

.otp {
  display: flex;
  gap: 9px;
  justify-content: center;
}
.otp input {
  width: 46px;
  height: 56px;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 650;
  padding: 0;
}
@media (max-width: 420px) { .otp input { width: 40px; height: 50px; font-size: 1.1rem; } }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 130%);
  max-width: 440px;
  padding: 13px 20px;
  background: var(--text);
  color: var(--bg);
  border-radius: 980px;
  font-size: .86rem;
  font-weight: 550;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .25);
  transition: transform .3s var(--ease);
  z-index: 50;
}
.toast.on { transform: translate(-50%, 0); }

/* Theme toggle flottant */
.theme-fab {
  position: fixed;
  top: 18px; right: 18px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: .95rem;
  transition: transform .15s var(--ease), border-color .15s;
  z-index: 40;
}
.theme-fab:hover { transform: scale(1.08); border-color: var(--border-strong); }

/* Liste de biens (portfolio agence) */
.plist { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.plist:empty { display: none; }
.pitem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.pitem__ico { font-size: 1.05rem; }
.pitem__txt { flex: 1; min-width: 0; }
.pitem__txt b { display: block; font-size: .88rem; font-weight: 600; }
.pitem__txt span { font-size: .77rem; color: var(--muted); }
.pitem__del {
  background: none;
  border: none;
  color: var(--muted-soft);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 6px;
}
.pitem__del:hover { color: var(--red); background: var(--surface); }

.dropzone {
  padding: 28px 20px;
  text-align: center;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface-alt);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--grad-sub); }
.dropzone__ico { font-size: 1.6rem; margin-bottom: 8px; }
.dropzone__txt { font-size: .88rem; font-weight: 600; margin-bottom: 4px; }
.dropzone__sub { font-size: .78rem; color: var(--muted); }

/* Aperçu marque */
.brand-preview {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-alt);
}
.brand-preview__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background: var(--bp-color, var(--accent));
  color: #fff;
}
.brand-preview__logo {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .25);
  display: grid; place-items: center;
  font-size: .72rem;
  font-weight: 700;
  overflow: hidden;
}
.brand-preview__logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-preview__name { font-size: .88rem; font-weight: 650; }
.brand-preview__body { padding: 16px 15px; }
.brand-preview__kpi { font-size: 1.5rem; font-weight: 700; }
.brand-preview__lbl { font-size: .76rem; color: var(--muted); }

/* ── Bandeau prototype ─────────────────────────────────────────────
   Le tunnel est publiquement accessible mais n'a aucun backend d'auth.
   Ce bandeau evite de laisser croire qu'un compte est reellement cree. */

.proto {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  flex-wrap: wrap;
  width: 100%;
  padding: 9px 16px;
  background: rgba(217, 119, 6, .12);
  border-bottom: 1px solid rgba(217, 119, 6, .3);
  font-size: .78rem;
  font-weight: 550;
  color: var(--amber);
  text-align: center;
  line-height: 1.45;
}
.proto strong { font-weight: 700; }
.proto__ico { flex-shrink: 0; }

/* Le bouton de thème est fixed : le décaler sous le bandeau. */
.proto ~ .theme-fab { top: 52px; }
@media (max-width: 560px) { .proto ~ .theme-fab { top: 72px; } }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
