/* =====================================================================
   Velora sur téléphone, 2e passe (10/11/2026) — chargé après mobile3.css, seulement sous 760 px.
   Le retour (iPhone) : la fenêtre « Ajouter une créatrice » avait une rangée d'étapes cassée (numéros sur les mots,
   mots coupés « Chiff », « Plate…me »), les boutons du bas sortaient de l'écran ; le menu (bouton en bas à droite)
   s'ouvrait à gauche ; les deux espaces (Mon espace / l'agence) prenaient une ligne chargée. Et des textes trop petits.
   - Fenêtres en étapes (.tg-wz : ajouter une créatrice OnlyFans ou Telegram, automatisation Telegram) : une feuille
     plein écran, « Étape 2 sur 6 · Identifiants » et une fine barre de progression, le contenu qui défile, les boutons
     en bas toujours visibles (le principal sur toute la largeur).
   - Menu : un panneau qui sort de la DROITE (le bouton Menu est en bas à droite), collé au bord, qui glisse à
     l'ouverture et à la fermeture ; le fond se fonce en fondu.
   - Espaces : un seul interrupteur net, deux moitiés égales (« Mon espace » doré, l'agence violet).
   - Textes : 12 px au minimum (les intitulés de chiffres, les dates, les détails), longues explications repliées
     (« Lire la suite », public/mobile4.js).
   Comportements : public/mobile4.js. Rien ne change sur ordinateur.
   ===================================================================== */
@media (max-width: 760px) {
  /* ---------- fenêtres en étapes : une feuille plein écran ---------- */
  html body .tg-modal > .tg-win:has(> .tg-wb > .tg-wz) { height: calc(var(--vvh, 100dvh) - 8px) !important; max-height: none !important; }
  html body .tg-modal .tg-wh { padding: 12px 12px 12px 18px; }
  html body .tg-modal .tg-wh h2 { font-size: 18px; letter-spacing: -.01em; }
  html body .tg-modal .tg-wb:has(> .tg-wz) { display: flex !important; flex-direction: column; flex: 1; min-height: 0; }
  html body .tg-modal .tg-wb > .tg-wc { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 18px 18px 24px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
  html body .tg-modal .tg-wz { flex: none; display: block !important; overflow: visible !important; padding: 2px 18px 14px !important; border: 0 !important; border-bottom: 1px solid var(--line) !important; background: transparent !important; }
  html body .tg-modal .tg-wz > :is(button, .tg-sum) { display: none !important; }
  html body .tg-modal .tg-wz::before { content: attr(data-m4); display: block; font-size: 13px; font-weight: 600; color: var(--fg-2, var(--fg)); letter-spacing: .005em; margin-bottom: 9px; }
  html body .tg-modal .tg-wz::after { content: ""; display: block; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) 0 var(--m4p, 0%), var(--surface-3, rgba(255, 255, 255, .08)) var(--m4p, 0%) 100%); transition: background-position .3s; }
  /* le bas de la fenêtre : l'erreur sur sa ligne, les boutons secondaires côte à côte, le principal sur toute la largeur */
  html body .tg-modal .tg-wf { flex-wrap: wrap; gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)) !important; background: var(--surface); }
  html body .tg-modal .tg-wf > .grow { display: none; }
  html body .tg-modal .tg-wf > .err { order: -1; flex: 1 1 100%; }
  html body .tg-modal .tg-wf > .err:empty { display: none; }
  html body .tg-modal .tg-wf > button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 0 10px; white-space: normal; line-height: 1.2; font-size: 14px; }
  html body .tg-modal .tg-wf > button.btn-main { order: 10; flex: 1 1 100%; min-height: 48px; font-size: 15px; }
  html body .tg-modal .tg-wf > button[hidden] { display: none !important; }
  html body .tg-modal .tg-wc :is(h3:first-child) { font-size: 18px; margin-top: 0; }
  /* le choix de la plateforme : des lignes (logo à gauche, nom et site), pas trois grandes cartes */
  html body .tg-modal .ow-pfs { gap: 8px; }
  html body .tg-modal .ow-pfs button { grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; row-gap: 0; align-items: center; padding: 10px 14px; min-height: 60px; }
  html body .tg-modal .ow-pfs button > .tg-pf-ico { grid-row: 1 / 3; width: 36px; height: 36px; border-radius: 10px; font-size: 12px; }
  html body .tg-modal .ow-pfs button > b { align-self: end; font-size: 15px; }
  html body .tg-modal .ow-pfs button > small { align-self: start; font-size: 12.5px; }
  html body .tg-modal :is(.tg-pill, .ow-status .tg-pill) { font-size: 12px; }
  /* le mot de passe : le champ prend la largeur, « Afficher » à côté */
  html body .tg-modal .tg-range:has(> input[type="password"], > input#ow-pass) { display: flex; gap: 8px; align-items: stretch; }
  html body .tg-modal .tg-range > input:is([type="password"], #ow-pass) { flex: 1; min-width: 0; width: auto; }
  html body .tg-modal .tg-range > input:is([type="password"], #ow-pass) + button { flex: none; min-height: 44px; }
  html body .tg-modal .tg-wc p.tg-hint.lead { font-size: 14.5px; line-height: 1.5; }

  /* ---------- la barre du bas : autant de colonnes que de boutons visibles (« Menu » toujours collé à droite) ---------- */
  /* (ds.css posait 5 colonnes fixes : avec 4 boutons, Menu laissait un trou à droite) */
  html body .app .bottomnav { grid-template-columns: none !important; grid-auto-flow: column !important; grid-auto-columns: minmax(0, 1fr) !important; padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  html body .app .bottomnav > [hidden] { display: none !important; }

  /* ---------- le menu : un panneau qui sort de la droite ---------- */
  html body.side-open .app .side, html body.m4-closing .app .side { inset: 0 0 0 auto !important; left: auto !important; right: 0 !important; border-right: 0 !important; border-left: 1px solid var(--line) !important; border-radius: 22px 0 0 22px; box-shadow: -20px 0 50px rgba(0, 0, 0, .4) !important; }
  html body.side-open .app .side { animation: m4SideIn .28s cubic-bezier(.22, .9, .3, 1) !important; }
  html body.m4-closing:not(.side-open) .app .side { display: flex !important; position: fixed; top: 0; bottom: 0; z-index: 90; width: min(88vw, 340px) !important; height: 100dvh; overflow: hidden; pointer-events: none; animation: m4SideOut .22s cubic-bezier(.4, 0, .9, .6) forwards !important; }
  html body .side-backdrop:not([hidden]) { animation: m4Fade .22s ease-out; }
  html body.m4-closing .m4-back-ghost { position: fixed; inset: 0; z-index: 89; background: rgba(0, 0, 0, .5); pointer-events: none; animation: m4FadeOut .22s ease-in forwards; }

  /* ---------- les deux espaces : un interrupteur net ---------- */
  html body .app .space-bar:not([hidden]) { display: block !important; min-height: 0 !important; padding: 8px 16px 2px !important; background: transparent !important; border: 0 !important; box-shadow: none !important; }
  html body .app .space-bar::before, html body .app .space-bar::after { display: none !important; }
  html body .app .space-bar .sb-now { display: none !important; }
  html body .app .space-bar .sb-sw { display: grid !important; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
  html body .app .space-bar .sb-sw button { height: 38px; border-radius: 10px; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 7px; transition: background-color .18s, color .18s; }
  html body .app .space-bar .sb-sw button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: currentColor; opacity: .35; }
  html body .app .space-bar .sb-sw button[data-set-space="own"]::before { background: #e9b45f; opacity: 1; }
  html body .app .space-bar .sb-sw button[data-set-space="agency"]::before { background: #7b7b7a; opacity: 1; }
  html body .app .space-bar .sb-sw button.on { background: var(--surface) !important; color: var(--fg) !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .25), inset 0 0 0 1px color-mix(in srgb, var(--sb, #7b7b7a) 55%, transparent) !important; }
  html body .app .space-bar[data-space="own"] .sb-sw button.on { --sb: #e9b45f; }

  /* l'interrupteur des espaces, aussi en haut du menu */
  html body .app .side .m4-space { margin: 10px 4px 2px; display: grid; gap: 6px; }
  html body .app .side .m4-space > small { font-size: 12px !important; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding-left: 2px; }
  html body .app .side .m4-sp-sw { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
  html body .app .side .m4-sp-sw button { height: 40px; min-width: 0; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 7px; }
  html body .app .side .m4-sp-sw button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: #7b7b7a; }
  html body .app .side .m4-sp-sw button[data-m4-space="own"]::before { background: #e9b45f; }
  html body .app .side .m4-sp-sw button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }

  /* ---------- chiffres clés : un montant tient sur UNE ligne (31 214,24 $ ne laisse plus « $ » seul en dessous) ---------- */
  /* (sur une ligne, sans couper ; public/mobile4.js réduit la taille d'un montant trop long pour sa case, 15 px au plus petit) */
  html body .app .view :is(.dbx-k, .kpi, .fx4-k, .tm-k, .v-kpi, .crx-rev) :is(b, strong):not(.m4-nofit) { display: inline-block; vertical-align: bottom; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: clip; }
  html body .app .view :is(.dbx-k, .kpi) .s, html body .app .view .dbx-strip > .dbx-k .s { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
  /* la période (Aujourd'hui, 7 jours, 30 jours, Mois en cours) : les quatre tiennent dans la largeur */
  html body .app .view .fx3-seg { display: flex !important; width: 100%; gap: var(--m4gap, 4px) !important; }
  html body .app .view .fx3-seg > button { flex: 1 0 auto !important; padding: 0 var(--m4pad, 7px) !important; font-size: var(--m4fs, 14px) !important; }

  /* ---------- textes : 12 px au minimum ---------- */
  html body .app :is(#ctx-where, .vb-chip, .plan-chip, .cal-wd, .mi-h, .sm-h, .ls-h, .fx3-k, .ibp-new, .ibp-st) { font-size: 12px !important; }
  html body .app .view :is(.kpi, .dbx-k, .fx4-k, .tm-k, .v-kpi, .gr-kpi, .sm-k, .vai-tile) :is(small, .s, .k-l, .dbx-kl) { font-size: 12px !important; }
  html body .app .view :is(.dbx-bar > small, .ls-item small, .mi-stats small, .lb2-g small, .ls-fn small, .ct-row small, .fo-rt small, .fo-mt small, .set-pick small, dl dt, dl dd small, .iac-pf) { font-size: 12px !important; }
  /* (les intitulés des chiffres : mobile3.css les mettait à 11 px avec :first-child) */
  html body .app .view :is(.kpi, .dbx-k, .fx4-k, .tm-k) :is(small, .k-l, .dbx-kl):first-child { font-size: 12px !important; }
  html body .app .view :is(.dbx3-chart > header > small, .dbx3-chart > header > small b, .crx-card small, .crx-st, .crx-rev small, .rl2-h, .rl2-item small, .rl3-top small, .rl3-sec > small, .rl3-role small, .rl3-role em, .au-log small, .sup-worker small, .sup-st, .sup-cr-id small, .tm2-bar small, .aic-who small, .ui-badge, th, .ag-system time, .drp-chips small, label.field small, .dbx-card > header > small, td small) { font-size: 12px !important; }
  html body .app .view .stack > .m4-more, html body .app .view .card > .m4-more { margin-top: -8px; align-self: flex-start; justify-self: start; }
  /* les longues explications : 3 lignes, puis « Lire la suite » (public/mobile4.js) */
  html body .app .view .m4-clamp:not(.m4-open) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
  html body .app .view .m4-more { display: inline-flex; align-items: center; min-height: 32px; margin: 2px 0 6px; padding: 0; border: 0; background: none; color: var(--accent-2, var(--accent)); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
}
.m4-space, .m4-more { display: none; }
@media (max-width: 760px) { html body .app .side .m4-space { display: grid; } html body .app .view .m4-more { display: inline-flex; } }
@keyframes m4SideIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes m4SideOut { from { transform: none; } to { transform: translateX(100%); } }
@keyframes m4Fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes m4FadeOut { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html body.side-open .app .side, html body .side-backdrop:not([hidden]) { animation: none !important; }
  html body.m4-closing:not(.side-open) .app .side, html body.m4-closing .m4-back-ghost { display: none !important; }
}
