/* ============================================================
   SOPLANY : composants partagés (sp-ui.js) + finitions web
   Variables communes à site.css (public) et soplany.css (pro).
   ============================================================ */
:root { --sps-ease: cubic-bezier(.2, .8, .2, 1); --sps-spring: cubic-bezier(.3, 1.35, .5, 1); }

/* ---------- Select amélioré ---------- */
.sps { position: relative; display: inline-flex; min-width: 0; vertical-align: middle; }
.field .sps, .stack > .sps, form > .sps:only-child { display: flex; width: 100%; }
.sps-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0 !important; pointer-events: none !important; margin: 0 !important; }
.sps-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px;
  background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong); border-radius: var(--r-md, 10px);
  font: inherit; font-size: 16px; text-align: left; cursor: pointer; white-space: nowrap;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.sps-btn:hover { border-color: var(--fg-3); }
.sps-btn:focus-visible, .sps.open .sps-btn { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sps-btn:disabled { opacity: .55; cursor: not-allowed; }
.sps.invalid .sps-btn { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.sps-btn.btn-sm, .sps-btn.sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; }
.sps-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sps-val.ph { color: var(--fg-3); }
.sps svg.ic, .sps-layer svg.ic, .spp svg.ic { width: 1em; height: 1em; display: inline-block; flex: none; fill: none; stroke: currentColor; }
.sps-chev { color: var(--fg-3); font-size: .8rem; transition: transform .24s var(--sps-ease); }
.sps.open .sps-chev, .spp.open .sps-chev { transform: rotate(180deg); }
.sps-ic { color: var(--fg-3); width: 18px; text-align: center; flex: none; }
.sps-flag { width: 20px; height: 15px; border-radius: 3px; object-fit: cover; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }

/* ---------- Popover / feuille ---------- */
.sps-layer { position: fixed; inset: 0; z-index: 400; pointer-events: none; }
.sps-pop {
  position: fixed; pointer-events: auto; display: flex; flex-direction: column;
  background: var(--surface); color: var(--fg); border: 1px solid var(--border-strong); border-radius: var(--r-lg, 14px);
  box-shadow: 0 2px 6px rgba(20,18,12,.06), 0 22px 48px -16px rgba(20,18,12,.28);
  overflow: hidden; transform-origin: 50% 0;
  opacity: 0; transform: translateY(-6px) scale(.97);
  transition: opacity .16s var(--sps-ease), transform .22s var(--sps-ease);
}
.sps-pop.up { transform-origin: 50% 100%; transform: translateY(6px) scale(.97); }
.sps-layer.in .sps-pop { opacity: 1; transform: none; }
.sps-layer.out .sps-pop { opacity: 0; transition-duration: .14s; }
.sps-search { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--fg-3); }
.sps-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--fg); font: inherit; font-size: 16px; min-height: 34px; }
.sps-search input::placeholder { color: var(--fg-3); }
.sps-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; outline: none; scroll-behavior: auto; }
.sps-group { padding: 10px 10px 4px; font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; color: var(--fg-3); }
.sps-opt {
  display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 9px 10px; border-radius: 9px;
  cursor: pointer; font-size: .95rem; color: var(--fg); line-height: 1.3;
}
.sps-layer.in .sps-opt { animation: spsIn .26s var(--sps-ease) both; animation-delay: calc(var(--i, 0) * 14ms); }
.sps-opt.act { background: var(--surface-2); }
.sps-opt.sel { font-weight: 700; }
.sps-opt.dis { opacity: .45; cursor: not-allowed; }
.sps-opt .sps-lbl { flex: 1; min-width: 0; }
.sps-opt .sps-sub { color: var(--fg-3); font-size: .82rem; font-variant-numeric: tabular-nums; }
.sps-opt mark { background: none; color: var(--accent); font-weight: 700; }
.sps-check { color: var(--accent); visibility: hidden; font-size: .95rem; }
.sps-opt.sel .sps-check { visibility: visible; }
.sps-empty { padding: 18px 12px; text-align: center; color: var(--fg-3); font-size: .9rem; }
@keyframes spsIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* Mobile : feuille du bas */
.sps-layer.sheet { pointer-events: auto; }
.sps-backdrop { position: absolute; inset: 0; background: rgba(8,9,12,.45); opacity: 0; transition: opacity .22s; }
.sps-layer.sheet.in .sps-backdrop { opacity: 1; }
.sps-layer.sheet .sps-pop { left: 0; right: 0; bottom: 0; top: auto; max-height: min(78vh, 640px); border-radius: 20px 20px 0 0; border-bottom: 0; transform: translateY(100%); transition: transform .32s var(--sps-ease); opacity: 1; padding-bottom: env(safe-area-inset-bottom, 0px); }
.sps-layer.sheet.in .sps-pop { transform: none; }
.sps-layer.sheet.out .sps-pop { transform: translateY(100%); transition-duration: .2s; }
.sps-layer.sheet .sps-list { max-height: none; flex: 1; }
.sps-sheet-head { position: relative; display: flex; align-items: center; justify-content: center; padding: 18px 56px 10px; }
.sps-sheet-head strong { font-size: 1rem; }
.sps-grab { position: absolute; top: 7px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--border-strong); }
.sps-x { position: absolute; right: 10px; top: 8px; width: 40px; height: 40px; border-radius: 10px; display: grid; place-content: center; color: var(--fg-2); background: none; border: 0; cursor: pointer; }
.sps-x:hover { background: var(--surface-2); }
.sps-layer.sheet .sps-opt { min-height: 48px; }
body.sps-lock { overflow: hidden; }

/* ---------- Téléphone avec drapeau ---------- */
.spp { display: flex; align-items: stretch; gap: 0; padding: 0 !important; overflow: visible; }
.spp-cc {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 10px 0 13px; margin: 0; border: 0;
  border-right: 1px solid var(--border); background: transparent; color: var(--fg); font: inherit; font-weight: 600; font-size: .95rem;
  cursor: pointer; border-radius: var(--r-md, 10px) 0 0 var(--r-md, 10px); flex: none; transition: background .14s;
}
.spp-cc:hover, .spp.open .spp-cc { background: var(--surface-2); }
.spp-cc:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.spp-dial { font-variant-numeric: tabular-nums; }
.spp .spp-num, .spp input.input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 0 14px !important; min-height: 46px; outline: none; }
.spp:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.invalid .spp { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

/* ---------- Onglets : indicateur glissant ---------- */
.tabs.has-ink { position: relative; }
.tabs.has-ink > button::after, .tabs.has-ink > a::after { display: none !important; }
.tabs-ink { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--fg); border-radius: 2px; pointer-events: none; transition: transform .32s var(--sps-ease), width .32s var(--sps-ease), opacity .2s; }
.tabs > button, .tabs > a { transition: color .2s; }
.tab-panel.active { animation: spTab .32s var(--sps-ease) both; }
@keyframes spTab { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Listes de suggestions et date picker : ouverture fluide ---------- */
.sselect .sselect-menu { transform-origin: 50% 0; transform: translateY(-6px) scale(.98); transition: opacity .16s var(--sps-ease), transform .24s var(--sps-ease); }
.sselect.open .sselect-menu { transform: none; }
.sselect.open .sselect-item { animation: spsIn .24s var(--sps-ease) both; }
.sselect.open .sselect-item:nth-child(2) { animation-delay: 14ms; } .sselect.open .sselect-item:nth-child(3) { animation-delay: 28ms; }
.sselect.open .sselect-item:nth-child(4) { animation-delay: 42ms; } .sselect.open .sselect-item:nth-child(5) { animation-delay: 56ms; }
.sselect.open .sselect-item:nth-child(6) { animation-delay: 70ms; } .sselect.open .sselect-item:nth-child(n+7) { animation-delay: 84ms; }
.datepick .dp-pop { transform-origin: 50% 0; transform: translate(-50%, -6px) scale(.97); transition: opacity .16s var(--sps-ease), transform .24s var(--sps-ease); }
.datepick.open .dp-pop { transform: translateX(-50%) scale(1); }
.cal-grid { animation: spFade .22s var(--sps-ease); }
.cal-day { transition: background .14s, color .14s, transform .14s var(--sps-ease); }
.cal-day.sel { animation: spPop .26s var(--sps-spring); }
.lang-select .lang-panel { transition: opacity .16s var(--sps-ease), transform .22s var(--sps-ease); }
@keyframes spFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spPop { from { transform: scale(.86); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .sps-pop, .sps-backdrop, .tabs-ink, .sselect .sselect-menu, .datepick .dp-pop { transition: none !important; }
  .sps-layer.in .sps-opt, .sselect.open .sselect-item, .tab-panel.active, .cal-grid, .cal-day.sel { animation: none !important; }
}

/* Écran « votre numéro » (connexion Apple/Google) : sélecteur d'indicatif */
.phone-row .sps { flex: 0 0 136px; }
.phone-row .sps-btn { padding-inline: 12px; }

/* Satoshi en petite taille : l'alignement sur la grille de pixels (hinting) crée des
   espaces parasites après le « t » (« Mer tens », « Réservat ion »). */
body { text-rendering: geometricPrecision; }

/* Date picker de la barre de recherche : aligné sur les autres champs */
.datepick .dp-value { padding: 0; border: 0; background: none; }

/* ---------- Sélecteur de plage de dates ---------- */
.srp { width: auto; min-width: 0; }
.srp-body { display: flex; }
.srp-presets { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border-right: 1px solid var(--border); min-width: 168px; }
.srp-presets button { text-align: left; padding: 9px 12px; border-radius: 9px; border: 0; background: none; font: inherit; font-size: .9rem; color: var(--fg-2); cursor: pointer; transition: background .14s, color .14s; }
.srp-presets button:hover { background: var(--surface-2); color: var(--fg); }
.srp-presets button.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.srp-cal { position: relative; padding: 14px 16px 6px; overflow: hidden; }
.srp-nav { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; justify-content: space-between; pointer-events: none; z-index: 1; }
.srp-arrow { pointer-events: auto; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--fg-2); display: grid; place-content: center; cursor: pointer; transition: background .14s, border-color .14s; }
.srp-arrow:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--fg); }
.srp-months { display: flex; gap: 26px; }
.srp-months.slide-l { animation: srpL .3s var(--sps-ease); }
.srp-months.slide-r { animation: srpR .3s var(--sps-ease); }
@keyframes srpL { from { opacity: .2; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes srpR { from { opacity: .2; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.srp-month { width: 266px; }
.srp-title { text-align: center; font-weight: 700; font-size: .95rem; text-transform: capitalize; height: 34px; line-height: 34px; margin-bottom: 6px; }
.srp-grid { display: grid; grid-template-columns: repeat(7, 38px); row-gap: 3px; }
.srp-dow { text-align: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--fg-3); padding: 4px 0 6px; }
.srp-day { position: relative; height: 38px; border: 0; background: none; font: inherit; font-size: .9rem; font-weight: 600; color: var(--fg); cursor: pointer; font-variant-numeric: tabular-nums; z-index: 0; outline: none; }
.srp-day::before { content: ""; position: absolute; inset: 1px 0; z-index: -2; transition: background .12s; }
.srp-day::after { content: ""; position: absolute; inset: 1px 2px; border-radius: 10px; z-index: -1; transition: background .14s, transform .18s var(--sps-spring); }
.srp-day:hover:not(.off):not(.s):not(.e)::after { background: var(--surface-2); }
.srp-day.in::before { background: var(--accent-soft); }
.srp-day.s::before { left: 50%; } .srp-day.e::before { right: 50%; } .srp-day.s.e::before { display: none; }
.srp-grid > .srp-day.in:nth-child(7n+1)::before { border-radius: 10px 0 0 10px; }
.srp-grid > .srp-day.in:nth-child(7n)::before { border-radius: 0 10px 10px 0; }
.srp-day.s::after, .srp-day.e::after { background: var(--btn-bg, #17191F); transform: scale(1); }
.srp-day.s, .srp-day.e { color: var(--btn-fg, #fff); }
.srp-day.today:not(.s):not(.e) { color: var(--accent); }
.srp-day.today::after { box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.srp-day:focus-visible::after { box-shadow: 0 0 0 2px var(--accent); }
.srp-day.off { color: var(--fg-3); opacity: .35; cursor: default; }
.srp-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--border); }
.srp-sum { font-size: .88rem; color: var(--fg-2); display: flex; gap: 10px; align-items: baseline; min-height: 22px; }
.srp-sum b { color: var(--fg); }
.srp-sum span { color: var(--fg-3); font-size: .8rem; }
.srp-btns { display: flex; gap: 8px; }
.srp-btns button { min-height: 38px; padding: 0 16px; border-radius: 9px; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); transition: background .14s, opacity .14s; }
.srp-btns .srp-apply { background: var(--btn-bg, #17191F); color: var(--btn-fg, #fff); border-color: transparent; }
.srp-btns button:disabled { opacity: .45; cursor: not-allowed; }
.sps-layer.sheet .srp-body { flex-direction: column; }
.sps-layer.sheet .srp-presets { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 8px 12px; min-width: 0; scrollbar-width: none; }
.sps-layer.sheet .srp-presets button { white-space: nowrap; border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; }
.sps-layer.sheet .srp-cal { display: flex; justify-content: center; }
.sps-layer.sheet .srp-month { width: min(100%, 322px); }
.sps-layer.sheet .srp-grid { grid-template-columns: repeat(7, 1fr); }
.sps-layer.sheet .srp-day { height: 42px; }
.sps-layer.sheet .srp-foot { flex-wrap: wrap; }
.sps-layer.sheet .srp-btns { flex: 1 1 100%; } .sps-layer.sheet .srp-btns button { flex: 1; min-height: 46px; }
@media (prefers-reduced-motion: reduce) { .srp-months.slide-l, .srp-months.slide-r { animation: none !important; } }

/* ---------- Espace pro : finitions ---------- */
/* Horaires : un jour décoché grise ses heures (réglages, équipe) */
.row:has(> .check input[name$="[enabled]"]:not(:checked)) input[type="time"] { opacity: .38; filter: grayscale(1); }
.row:has(> .check input[name$="[enabled]"]) input[type="time"] { transition: opacity .2s; }
/* Champs longs dans une grille 2 colonnes étroite : pleine largeur (téléphone à drapeau, email) */
.card .grid-2 > .field:has(.spp), .card .grid-2 > .field:has(input[type="email"]) { grid-column: 1 / -1; }
/* Descriptions : 4 lignes visibles */
.view textarea.textarea[name^="description"] { min-height: 118px; }
/* Bouton fichier natif (« Choose File ») : habillé comme un bouton du site */
input[type="file"].input, input[type="file"] { font: inherit; font-size: .9rem; color: var(--fg-2); }
input[type="file"]::file-selector-button { font: inherit; font-weight: 700; font-size: .86rem; margin-right: 12px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); cursor: pointer; transition: background .14s; }
input[type="file"]::file-selector-button:hover { background: var(--surface-2); }

/* ---------- États vides ---------- */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 24px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r-lg, 14px); }
.empty-state .es-ic { width: 56px; height: 56px; border-radius: 50%; display: grid; place-content: center; background: var(--accent-soft); color: var(--accent); font-size: 1.4rem; margin-bottom: 6px; }
.empty-state .es-title { font-size: 1.05rem; }
.empty-state .es-text { color: var(--fg-2); font-size: .92rem; max-width: 420px; }
.empty-state .es-cta { margin-top: 10px; }
.empty-state.compact { flex-direction: row; justify-content: center; padding: 18px 20px; gap: 12px; }
.empty-state.compact .es-ic { width: 36px; height: 36px; font-size: 1rem; margin: 0; }
td .empty-state { border: 0; border-radius: 0; }

/* ---------- Site public : retouches mobiles ---------- */
@media (max-width: 560px) {
  /* Fiche : les 4 onglets tiennent sur la largeur (icônes masquées, libellés complets) */
  #tabsRoot .tabs > button { padding: 12px 10px; font-size: .9rem; }
  #tabsRoot .tabs > button > .ic:first-child { display: none; }
  /* Liens « Tout voir » / « Voir les tarifs » alignés sur la marge du texte */
  .sec-head > .btn-ghost { padding-left: 0; }
}
/* Carrousel « Que cherchez-vous ? » : la 1re tuile s'aligne sur la marge (accrochage compris) */
@media (max-width: 860px) { .cat-tiles { scroll-padding-inline: 20px; } }
/* Barre latérale pro : sélecteur de langue + « Site public » sur une ligne */
.sidebar .sb-bottom > a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sidebar .sb-bottom .lang-select { flex: none; }
body.sb-collapsed .sidebar .sb-bottom .lang-select { display: none; }
/* Onglets : texte, icône et badge alignés sur la même ligne */
.tabs > button { display: inline-flex; align-items: center; }

/* ---------- Préférences de notifications (compte) ---------- */
.prefs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prefs-saved { font-size: .8rem; color: var(--fg-3); transition: opacity .2s; }
.prefs-saved.ok { color: var(--good); } .prefs-saved.bad { color: var(--bad); }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); cursor: pointer; min-height: 48px; }
.pref-row:last-child { border-bottom: 0; }
.pref-l { display: flex; align-items: center; gap: 12px; font-size: .94rem; }
.pref-l .ic { color: var(--fg-3); width: 18px; }
.pref-sub { padding-left: 30px; border-bottom: 1px solid var(--border); }
.pref-sub .pref-row { min-height: 42px; padding: 8px 0; }
.pref-sub .pref-l { font-size: .88rem; color: var(--fg-2); }
.pref-sw { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; cursor: pointer; margin: 0; transition: background .2s, border-color .2s; }
.pref-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .24s cubic-bezier(.3,1.35,.5,1); }
.pref-sw:checked { background: var(--btn-bg); border-color: var(--btn-bg); }
.pref-sw:checked::after { transform: translateX(18px); }
.pref-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .pref-sw, .pref-sw::after { transition: none; } }
