/* ===== Tom Select ===== */
.ts-control {
  background: #E6E8EB;
  color: #2B2E31;
  border-radius: 0.65rem;
  padding: 0.65rem 1rem;
  border: none !important;
  box-shadow: none !important;
}
.ts-control input::placeholder { color: #7A828B; }
.ts-dropdown {
  background: #fff;
  color: #2B2E31;
  border-radius: 0.65rem;
  margin-top: 0.4rem;
  box-shadow: 0 8px 24px rgba(16,24,40,.12);
  border: 1px solid #E7E9EC !important;
}
.ts-dropdown .option { padding: 0.5rem 1rem; cursor: pointer; }
.ts-dropdown .option:hover,
.ts-dropdown .option.active { background: #EEF1FF; }

/* ===== Design tokens ===== */
:root {
  --wz-navy: #0E3B63;
  --wz-blue: #2B45D8;
  --wz-blue-soft: #E9EFFF;
  --wz-bg: #F4F6F9;
  --wz-input-bg: #E6E8EB;
  --wz-text: #2B2E31;
  --wz-border: #E2E5EA;
  --wz-green: #1A9A57;
  --wz-green-soft: #E7F8EF;
  --wz-red: #CF193E;
  --wz-red-soft: #FCE9E9;
}

body.wizard-body { background: var(--wz-bg); margin: 0; }

/*
 * IMPORTANT : le style.css global de l'app (public/input.css) définit des règles
 * bas niveau sur les éléments nus (span{color:#C3C7CB}, etc.) chargées avant ce fichier.
 * Une règle directe sur un élément (même simple `span{}`) gagne toujours sur une
 * couleur seulement HÉRITÉE d'un parent, quelle que soit la spécificité — d'où les
 * `color: inherit` explicites ci-dessous pour les <span> "nus" de ce thème.
 */
.pf-option > span,
.chip-option > span,
.step-pill > span:not(.pill-circle),
.gps-box > span:not(.wizard-hint) { color: inherit; font-size: inherit; }

/* ===== Header ===== */
.wizard-header { background: var(--wz-navy); color: #fff; padding: 1rem 1.25rem; }
.wizard-header-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.wizard-logo { height: 3.5rem; background: #fff; border-radius: 0.6rem; padding: 0.3rem 0.6rem; display: block; object-fit: contain; }
.wizard-header-right { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.wizard-header-item { text-align: left; }
.wizard-header-label { display: block; font-size: 0.7rem; color: #B7C3D6; }
.wizard-header-value { display: block; font-weight: 700; font-size: 0.95rem; color: #fff; }
.wizard-avatar { width: 2.6rem; height: 2.6rem; border-radius: 9999px; background: var(--wz-blue-soft); color: var(--wz-blue); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.wizard-back-btn { width: 2.4rem; height: 2.4rem; border-radius: 9999px; background: var(--wz-red-soft); color: var(--wz-red); display: flex; align-items: center; justify-content: center; flex-shrink: 0; text-decoration: none; }
.wizard-menu-btn { display: none; width: 2.4rem; height: 2.4rem; border-radius: 0.6rem; background: #fff; color: var(--wz-navy); border: none; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

/* ===== Barre de progression compacte (mobile uniquement, cf. media query plus bas) ===== */
.wizard-mobile-progress { display: none; margin-bottom: 1.5rem; }
.wizard-mobile-progress-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; font-weight: 700; color: var(--wz-text); font-size: 0.95rem; }

/* ===== Steps bar ===== */
.wizard-container { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 4rem; }
.wizard-steps-bar { display: flex; gap: 0.5rem; overflow-x: auto; margin-bottom: 1.5rem; }
.step-pill { flex: 1; min-width: 128px; display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.9rem; border-radius: 0.75rem; background: #EEF0F3; color: #9098A1; font-weight: 600; font-size: 0.8rem; white-space: nowrap; }
.step-pill .pill-circle { width: 1.6rem; height: 1.6rem; border-radius: 9999px; background: #D9DEE3; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; flex-shrink: 0; }
.step-pill.is-current { background: var(--wz-blue-soft); color: var(--wz-blue); }
.step-pill.is-current .pill-circle { background: var(--wz-blue); }
.step-pill.is-done { background: var(--wz-green-soft); color: var(--wz-green); cursor: pointer; }
.step-pill.is-done .pill-circle { background: var(--wz-green); }

/* ===== Step head ===== */
.wizard-step-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
/* Le h1,h2{font-family:'VisbyCF-DemiBold'} global de l'app utilise une police DEMO
   dont le glyphe "&" est volontairement cassé (watermark anti-piratage) : on force
   ici une police système normale pour ces titres. */
.wizard-step-head h2, .wizard-card > h2 { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--wz-text); margin: 0; }
.wizard-step-head p { color: #6B7280; margin: 0.25rem 0 0; font-size: 0.875rem; }
.wizard-progress-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; min-width: 150px; }
.wizard-progress-pct { color: var(--wz-blue); font-weight: 700; font-size: 0.875rem; }
.wizard-progress-track { 
  /* width: 150px; */
  height: 0.4rem; background: #E4E7EB; border-radius: 9999px; overflow: hidden; }
.wizard-progress-fill { height: 100%; background: var(--wz-blue); transition: width .25s ease; }

/* ===== Card ===== */
.wizard-card { background: #fff; border: 1px solid #E7E9EC; border-radius: 1rem; padding: 1.75rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.wizard-section-title { font-weight: 700; color: var(--wz-text); font-size: 1.05rem; margin: 0 0 0.25rem; }
.wizard-field { margin-bottom: 1.25rem; }
.wizard-field-label { display: block; font-weight: 600; color: var(--wz-text); margin-bottom: 0.5rem; font-size: 0.9rem; }
.wizard-hint { font-size: 0.8rem; font-weight: 400; color: #8A929B; }
.req-star { color: var(--wz-red); }
.wizard-input {
  width: 100%; background: #fff; color: var(--wz-text);
  padding: 0.85rem 1rem; border-radius: 0.65rem; border: 1.5px solid var(--wz-border);
  font-size: 0.95rem; line-height: 1.4; margin-top: 0; font-weight: 400;
}
.wizard-input::placeholder { color: #9098A1; }
.wizard-input:focus { outline: none; border-color: var(--wz-blue); box-shadow: 0 0 0 3px rgba(43, 69, 216, .12); }
select.wizard-input {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: none; padding-right: 2.5rem; cursor: pointer;
}
select.wizard-input::-ms-expand { display: none; }
.wizard-select-wrap { position: relative; }
.wizard-select-wrap .chevron { position: absolute; top: 0; right: 0; bottom: 0; display: flex; align-items: center; padding: 0 0.9rem; color: #6B7280; pointer-events: none; }
#results { position: relative; z-index: 20; }
.autocomplete-item { padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.875rem; color: var(--wz-text); }
.autocomplete-item:hover { background: #F1F3F6; }
.wizard-grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .wizard-grid-2 { grid-template-columns: 1fr 1fr; } }
.wizard-grid-3 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 768px) { .wizard-grid-3 { grid-template-columns: 1fr 1fr 1fr; } }
.wizard-actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; }
.btn-secondary, .btn-primary { padding: 0.9rem 1.6rem; border-radius: 9999px; font-weight: 600; cursor: pointer; font-size: 0.95rem; }
.btn-secondary { background: #F3F4F6; color: #9098A1; border: 1.5px solid var(--wz-border); }
.btn-secondary:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--wz-blue); color: #fff; border: none; display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-primary:disabled { opacity: .7; cursor: not-allowed; }
.btn-primary.btn-success { background: var(--wz-green); }
.btn-block { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-label-short { display: none; }

/* ===== Chips (Type de PDV / raison Non) : pas de pastille radio, juste bordure + texte ===== */
.chip-check { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-option {
  position: relative; display: inline-flex; align-items: center; padding: 0.65rem 1.2rem;
  border: 1.5px solid var(--wz-border); border-radius: 9999px; font-size: 0.875rem; font-weight: 600; color: var(--wz-text);
  background: #fff; cursor: pointer; user-select: none; transition: border-color .15s, color .15s, background .15s;
}
.chip-option:hover { border-color: var(--wz-blue); }
.chip-option:has(.chip-check:checked) { border-color: var(--wz-blue); color: var(--wz-blue); background: var(--wz-blue-soft); }
.chip-group { display: flex; flex-wrap: wrap; gap: 0.65rem; }

/* ===== Option rows (checkbox / radio blocks avec pastille visible) ===== */
.pf-option {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; font-weight: 600;
  border: 1.5px solid var(--wz-border); border-radius: 0.65rem; background: #fff; color: var(--wz-text);
  cursor: pointer; user-select: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.pf-option:hover { border-color: var(--wz-blue); }
.pf-option:has(.pf-check:checked) { border-color: var(--wz-blue); box-shadow: 0 0 0 1px var(--wz-blue) inset; background: var(--wz-blue-soft); }
.pf-option--inline { display: inline-flex; width: auto; }
.pf-option--inline:has(.pf-check:checked) { color: var(--wz-blue); }
.pf-option--yesno:has(.pf-check:checked) { border-color: var(--wz-green); box-shadow: 0 0 0 1px var(--wz-green) inset; background: var(--wz-green-soft); }
.pf-option-sub { display: block; font-size: 0.75rem; font-weight: 400; color: #8A929B; margin-top: 0.15rem; }

.pf-check {
  appearance: none; -webkit-appearance: none; width: 1.25rem; height: 1.25rem; margin: 0;
  border: 2px solid #9CA3AF; border-radius: 0.375rem; background: #fff; cursor: pointer;
  position: relative; flex-shrink: 0; transition: background .15s, border-color .15s;
}
.pf-check[type="radio"] { border-radius: 9999px; }
.pf-check:checked { background: var(--wz-blue); border-color: var(--wz-blue); }
.pf-option--yesno .pf-check:checked { background: var(--wz-green); border-color: var(--wz-green); }
.pf-check[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.pf-check[type="radio"]:checked::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px;
  border-radius: 9999px; background: #fff; transform: translate(-50%, -50%);
}
.pf-check:focus-visible { outline: 2px solid var(--wz-blue); outline-offset: 2px; }

/* ===== Photo capture ===== */
.photo-box { border: 2px dashed var(--wz-border); border-radius: 1rem; padding: 1.5rem; text-align: center; background: #FAFBFC; }
.photo-box video { width: 100%; border-radius: 0.65rem; background: #000; margin-bottom: 0.75rem; }
.photo-camera-actions { display: flex; gap: 0.6rem; }
.photo-camera-actions .btn-primary, .photo-camera-actions .btn-secondary { flex: 1; }
.photo-box .photo-preview { position: relative; }
.photo-box .photo-preview img { width: 100%; height: 11rem; object-fit: cover; border-radius: 0.65rem; display: block; }
.photo-icon { width: 2.75rem; height: 2.75rem; border-radius: 0.75rem; background: var(--wz-blue-soft); color: var(--wz-blue); display: flex; align-items: center; justify-content: center; margin: 0 auto 0.75rem; }
.photo-remove-btn {
  position: absolute; top: 0.5rem; right: 0.5rem; width: 1.75rem; height: 1.75rem;
  border-radius: 9999px; background: #fff; color: var(--wz-red); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .25); line-height: 0;
}
.photo-remove-btn:hover { background: var(--wz-red-soft); }

/* ===== GPS ===== */
.gps-btn { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--wz-blue-soft); color: var(--wz-blue); padding: 0.6rem 1.1rem; border-radius: 9999px; font-weight: 600; cursor: pointer; border: 1px solid #C7D2FE; }
.gps-box { background: #EEF0F3; border-radius: 0.85rem; padding: 1.75rem 1rem; text-align: center; color: var(--wz-text); margin-top: 1rem; min-height: 3rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem; }

/* ===== Tables ===== */
.wizard-table { width: 100%; border-collapse: collapse; }
.wizard-table th, .wizard-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid #E7E9EC; font-size: 0.875rem; color: var(--wz-text); text-align: left; }
.wizard-table thead th { background: #F4F6F9; color: #6B7280; font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .03em; }
.icon-btn { border: none; background: transparent; cursor: pointer; padding: 0.3rem; border-radius: 0.4rem; line-height: 0; }
.icon-btn.edit { color: var(--wz-blue); }
.icon-btn.delete { color: var(--wz-red); }

/* ===== Pages simples (accueil / enregistrement agent) ===== */
.wizard-simple-container { max-width: 460px; margin: 0 auto; padding: 3rem 1rem; }
.wizard-simple-card { background: #fff; border: 1px solid #E7E9EC; border-radius: 1rem; padding: 2rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); text-align: center; }
.wizard-simple-card h2 { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 1.25rem; font-weight: 700; color: var(--wz-text); margin: 0 0 0.5rem; }
.wizard-simple-card .wizard-hint { margin-bottom: 1.5rem; }
.wizard-simple-card form { text-align: left; }

/* ===== Vue mobile ===== */
@media (max-width: 640px) {
  .wizard-header-inner { position: relative; }

  /* Le bandeau Date/Agent/Avatar/Retour passe dans un menu déroulant sous le hamburger */
  .wizard-menu-btn { display: flex; }
  .wizard-header-right {
    display: none;
    position: absolute; top: calc(100% + 0.6rem); right: 0; z-index: 40;
    background: #fff; border-radius: 0.85rem; padding: 1rem 1.25rem;
    box-shadow: 0 8px 24px rgba(16,24,40,.18);
    flex-direction: column; align-items: stretch; gap: 0.85rem; min-width: 220px;
  }
  .wizard-header-right.is-open { display: flex; }
  .wizard-header-right .wizard-header-item { text-align: left; }
  .wizard-header-right .wizard-header-label { color: #9098A1; }
  .wizard-header-right .wizard-header-value { color: var(--wz-text); }
  .wizard-header-right .wizard-avatar { align-self: flex-start; }
  .wizard-header-right .wizard-back-btn { align-self: flex-start; }

  /* La barre de pastilles d'étapes cède la place à un indicateur compact */
  .wizard-steps-bar { display: none; }
  .wizard-mobile-progress { display: block; }
  .wizard-step-head .wizard-progress-wrap { display: none; }

  /* Champs empilés sur une seule colonne (déjà le comportement par défaut de .wizard-grid-2/3) */
  .wizard-actions { gap: 0.6rem; }
  .btn-secondary, .btn-primary { padding: 0.9rem 1.1rem; }
  .btn-label-full { display: none; }
  .btn-label-short { display: inline; }
}
