/* Mobile compact — rendu « application » sur téléphone (demande du 03/11/2026).
   Principe : les pages s'affichent à 95 % (balise viewport initial-scale=0.95 dans chaque <head>), et ce fichier
   réduit en plus les boutons, champs, barres et titres pour qu'on sente une application mobile, pas un site de bureau.
   Chargé en dernier dans toutes les pages publiques, connectées et d'administration. Ne touche pas aux écrans > 899 px.
   Le pincement (zoom) reste permis : le viewport n'est jamais bloqué. */

@media (max-width: 899px) {
  /* Jetons : toutes les feuilles v2 lisent ces variables, donc l'effet est global. */
  :root {
    --size-tap: 38px;
    --size-control: 34px;
    --size-icon: 15px;
    --size-icon-lg: 17px;
    --size-header: 48px;
    --font-size-base: 0.9375rem;
    --font-size-control: 0.8125rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.0625rem;
    --font-size-2xl: 1.1875rem;
    --font-size-3xl: 1.375rem;
    --radius-lg: 6px;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
  }
  /* Hiérarchie : nav = premier plan, contenus = second plan.
     Aucun titre ni bouton de page ne doit dépasser la hauteur ou la taille de police de la barre de navigation.
     Règle valable sur toutes les pages (accueil, tableau de bord, admin). */
  html h1 { font-size: var(--font-size-2xl) !important; line-height: 1.25; }
  html h2 { font-size: var(--font-size-xl) !important; }
  html h3 { font-size: var(--font-size-lg) !important; }

  /* Harmonisation mobile : les règles spécifiques du dashboard ne doivent pas réagrandir les boutons. */
  html body.v2-dash-body .v2-btn { min-height: 38px; padding: 6px 12px; font-size: 0.8125rem; border-radius: 8px; }
  html body.v2-dash-body .v2-btn--sm { min-height: 34px; padding: 5px 10px; font-size: 0.75rem; }
  html .v2-header__cta-mobile { min-height: 34px; height: 34px; padding: 0 10px; font-size: 0.75rem; border-radius: 8px; }
  html .v2-header__bar { gap: 8px; }
  html .v2-header__brand { min-height: 38px; }
  html .v2-header__menu { max-height: calc(100dvh - 58px); padding-block: 6px; }
  html .v2-header__menu a { min-height: 40px; padding: 8px 10px; font-size: 0.875rem; }

  /* Authentification dans le menu public : deux actions compactes côte à côte. */
  html .v2-header__menu .v2-header__account {
    display: flex; flex-direction: row; align-items: stretch; gap: 8px;
    padding-top: 10px; padding-bottom: 8px; padding-inline: 0;
  }
  html .v2-header__menu .v2-header__account > .v2-header__cta {
    display: inline-flex; flex: 1 1 0; min-width: 0; min-height: 42px; height: 42px;
    justify-content: center; gap: 7px; padding: 6px 8px;
    border-width: 1px; border-radius: 9px; font-size: 0.875rem; line-height: 1.2;
    white-space: normal; text-align: center;
  }
  html .v2-header__menu .v2-header__account > .v2-header__cta svg {
    width: 17px; height: 17px;
  }
  /* CTA d'inscription dans la barre supérieure : compact, sans hauteur imposée par .v2-btn. */
  html .v2-header__bar > .v2-header__cta-mobile {
    display: inline-flex; flex: 0 0 auto; min-width: 0; min-height: 34px; height: 34px;
    padding: 0 10px; font-size: 0.75rem; line-height: 1.2; border-radius: 8px;
  }

  /* Boutons et champs : plus bas, plus fins (comme les lignes de l'appli Notes). */
  html .v2-btn { min-height: var(--size-tap); padding: 6px 14px; font-size: 0.8125rem; border-radius: 6px; }
  html .v2-btn--sm { min-height: 32px; padding: 4px 10px; font-size: 0.75rem; }
  html .v2-btn svg { width: 15px; height: 15px; }
  html main :where(button, .btn, input[type="submit"], input[type="button"]) { min-height: 38px; }
  html main :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { min-height: 38px; }
  html .v2-check input { width: 20px; height: 20px; }
  html .udc-theme-toggle:not(.udc-theme-toggle--floating) { width: 36px; flex: 0 0 36px; min-height: 34px; }

  /* Cartes et sections plus serrées. */
  html .v2-card { padding: 14px; border-radius: 8px; }
  html .v2-section { padding-block: var(--space-5); }
  html .v2-dash-body .v2-card { padding: 12px; border-radius: 10px; }

  /* Tableau de bord : bouton « Envoyer des fichiers » subordonné visuellement à la nav. */
  html .v2-dash-send { padding: 9px 12px; gap: 10px; border-radius: 12px; }
  html .v2-dash-send__plus { width: 34px; height: 34px; }
  html .v2-dash-send__plus svg { width: 17px; height: 17px; }
  html .v2-dash-send__title { font-size: 0.875rem; font-weight: 600; }
  html .v2-dash-send__hint { font-size: 0.75rem; }
  /* Salutation dashboard : compact, ne dépasse pas la nav */
  html .v2-dash-hello__avatar, html .v2-dash-body .v2-avatar--lg { width: 34px !important; height: 34px !important; font-size: 0.875rem !important; }
  html .v2-dash-body .v2-dash-hello h1 { font-size: 0.9375rem !important; font-weight: 700; }
  /* Page d'accueil publique : héro compact */
  html .v2-home .v2-hero h1 { font-size: 1.1875rem !important; }
  html .v2-home .v2-hero h1 br { display: none; }
  /* Admin : même hiérarchie */
  html .v2-admin-head h1, html .v2-admin-head h2 { font-size: var(--font-size-xl) !important; }
  html .v2-progress__track { height: 8px; }

  /* Barre du bas : ses dimensions viennent de public/css/app-nav.css (pastille flottante). Seule la barre v2 historique est compactée ici. */
  html .v2-bottom-nav a { min-height: 44px; }

  /* Bulle de discussion. */
  html #chat-widget-toggle { width: 44px; height: 44px; }

  /* Pied de page : neutraliser la règle globale html h2 !important qui agrandit ses rubriques. */
  html .v2-footer h2 { font-size: 12px !important; line-height: 1.3 !important; letter-spacing: 0.07em; }
  html .v2-footer { padding-block: var(--space-5); font-size: 0.75rem; }
  html .v2-footer li a { min-height: 30px; }
  html .v2-footer__newsletter input, html .v2-footer__newsletter button { height: 38px; min-height: 38px; font-size: 14px; }
  html .v2-cookie__btn { min-height: 34px; }
  html .v2-cookie__icon { width: 30px; height: 30px; }

  /* En-tête : plus bas. */
  html .v2-header__more > summary, html .v2-navlist a, html .v2-navlist button { min-height: 38px; }
  html .v2-header .udc-logo-mark, html .v2-appbar .udc-logo-mark { width: 22px; height: 20px; }
  html .v2-tabs__tab { padding-inline: 12px; }
}

/* Étapes numérotées : pastille plus petite, texte toujours décalé à droite de la pastille. */
@media (max-width: 899px) {
  html .v2-steps__item { padding-left: calc(1.875rem + 12px); min-height: 1.875rem; }
  html .v2-steps__item::before { width: 1.875rem; height: 1.875rem; font-size: 0.8125rem; }
  html .v2-steps__item h3 { font-size: 0.9375rem; }
}


/* Parcours visiteurs : lisibilité et actions principales sur les petits écrans. */
@media (max-width: 640px) {
  html body:not(.v2-dash-body) main { min-width: 0; }
  html body:not(.v2-dash-body) .v2-container { min-width: 0; }
  html body:not(.v2-dash-body) .v2-pay-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    margin-block: 14px;
  }
  html body:not(.v2-dash-body) .v2-pay-actions > .v2-btn,
  html body:not(.v2-dash-body) .v2-pay-actions > a {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    justify-content: center;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  html .v2-header__menu .v2-header__menu-contact {
    padding-block: 8px;
  }
  html .v2-header__menu .v2-header__menu-contact a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 8px 10px;
    overflow-wrap: anywhere;
  }
  html .v2-header__menu .v2-header__menu-contact a svg {
    flex: 0 0 17px;
    width: 17px;
    height: 17px;
  }
  html .v2-home-contact__copy h2 {
    font-size: 1rem;
    line-height: 1.3;
  }
  html .v2-home-contact__copy p {
    font-size: .8125rem;
    line-height: 1.45;
  }
}

/* Très petits écrans : préserver les libellés des boutons et éviter les débordements. */
@media (max-width: 360px) {
  html .v2-home-contact__actions { grid-template-columns: minmax(0, 1fr); }
  html .v2-home-contact__actions > * { min-height: 38px; }
  html .v2-header__menu .v2-header__account > .v2-header__cta { font-size: .8125rem; gap: 5px; }
}
