/* JASS Budget V2 — Lot 2A : première passe mobile portrait.
   Chargée après style.css et theme.css, sans altérer le thème clair. */

/* Le mode portrait devient utilisable : plus d'écran bloquant. */
.overlay-rotation {
  display: none !important;
}

@media (max-width: 960px) {
  /* Éviter les débordements involontaires hors des tableaux. */
  html, body { max-width: 100%; }
  main.container { min-width: 0; }

  /* Les tableaux conservent leur structure et se parcourent au doigt. */
  .table-scroll-x {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  /* Le menu mobile reste accessible sur les écrans étroits. */
  .topbar nav { min-width: 0; }
  .nav-links.is-open { max-height: 75dvh; overflow-y: auto; }
  .nav-links .nav-theme-select { max-width: 100%; }

  /* Les boutons restent utilisables au toucher. */
  .btn-menu-mobile { min-width: 44px; min-height: 44px; }
}

@media (max-width: 600px) {
  :root { --pico-font-size: 94%; }
  main.container { padding-inline: 0.75rem; }
  .topbar .container { padding-inline: 0.75rem; }

  /* Tableaux de bord et chiffres clés sur une colonne lisible. */
  .dashboard-entete { align-items: stretch; }
  .dashboard-filtre-compte, .dashboard-filtre-compte select { width: 100%; min-width: 0; }
  .dashboard-soldes { flex-direction: column; gap: 0.7rem; }
  .dashboard-solde-item + .dashboard-solde-item {
    margin-left: 0;
    padding-left: 0;
    padding-top: 0.7rem;
    border-left: 0;
    border-top: 1px solid var(--pico-muted-border-color);
  }
  .stats-kpis { grid-template-columns: minmax(0, 1fr); }
  .stats-columns, .dashboard-columns { grid-template-columns: minmax(0, 1fr); }

  /* Sur opérations, les filtres passent sur plusieurs lignes. */
  .operations-toolbar { flex-wrap: wrap; gap: 0.65rem; }
  .operations-toolbar > * { min-width: 0; max-width: 100%; }
  .operations-soldes {
    width: 100%; height: auto; margin-left: 0;
    gap: 0.75rem; justify-content: space-between;
    flex-wrap: wrap;
  }
  .operations-soldes div { white-space: normal; }

  /* Champs et sélecteurs exploitables sur téléphone. */
  input, select, textarea { max-width: 100%; }
  .note-carte-ajout-champs { grid-template-columns: minmax(0, 1fr); }
  .note-carte-ajout-pied { flex-wrap: wrap; }
  .notes-grille { columns: 1; }

  /* Défilement horizontal réservé aux tableaux, pas à la page entière. */
  .table-scroll-x table { min-width: 1050px; }
}

@media (max-width: 380px) {
  main.container { padding-inline: 0.5rem; }
  .dashboard article { padding-inline: 0.7rem; }
}
