/* Styles globaux du CRM (chargés via importmap sur toutes les pages,
   ce qui les rend persistants lors des navigations Turbo). */

* { -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    font-family: 'Figtree', system-ui, sans-serif;
    color: #1d2433;
}

/* Fond de l'espace applicatif (la connexion définit son propre fond). */
.app-shell { background: #eef1f6; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c7cedd; border-radius: 9px; }

.navlink { transition: all .18s; text-decoration: none; color: inherit; }
.navlink:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.sb-active {
    background: linear-gradient(120deg, rgba(99, 102, 241, .9), rgba(79, 70, 229, .95)) !important;
    color: #fff !important;
    box-shadow: 0 6px 20px -6px rgba(99, 102, 241, .7) !important;
}

.rowhover { transition: background .12s; }
.rowhover:hover { background: #f5f8ff; }

.liftcard { transition: transform .15s, box-shadow .15s; }
.liftcard:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -12px rgba(20, 30, 60, .25) !important; }

input[type=date] { color-scheme: light; }

/* --- Composants réutilisables (remplacent peu à peu les styles inline) --- */

/* Pagination */
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.pagination-info { font-size: 12.5px; color: #8a93a6; font-weight: 600; }
.pagination-pages { display: flex; gap: 6px; flex-wrap: wrap; }
.page-link-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border-radius: 10px; border: 1px solid #e6e9f0; background: #fff;
    font-size: 13px; font-weight: 700; color: #46506a; text-decoration: none;
    transition: background .12s, border-color .12s;
}
.page-link-pill:hover { background: #f5f8ff; border-color: #c7d2fe; color: #4f46e5; }
.page-link-pill.is-active { background: linear-gradient(120deg, #6366f1, #4f46e5); border-color: transparent; color: #fff; }
.page-link-pill.is-disabled { opacity: .45; pointer-events: none; }

/* Primitives de mise en page (cartes, titres, pastilles) */
.crm-card { border: 0; border-radius: 16px; box-shadow: 0 1px 3px rgba(20, 30, 60, .06); background: #fff; overflow: hidden; }
.crm-section-title { font-weight: 800; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.pill { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 20px; display: inline-block; }

/* ═════════════════════ Mobile (< 992 px) — le bureau est STRICTEMENT inchangé ═════════════════════ */

/* Bouton menu : inexistant sur bureau, affiché par la media query. */
.menu-toggle { display: none !important; }
.sidebar-overlay { display: none; }

@media (max-width: 991.98px) {
    body { overflow-x: hidden; }

    /* ── Menu latéral repliable : tiroir hors écran, ouvert via le bouton ── */
    .app-sidebar {
        position: fixed !important;
        top: 0; left: 0; bottom: 0;
        height: 100dvh !important;
        z-index: 1100;
        transform: translateX(-105%);
        transition: transform .22s ease;
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); }
    body.sidebar-open { overflow: hidden; }

    .sidebar-overlay {
        position: fixed; inset: 0;
        background: rgba(15, 23, 42, .55);
        z-index: 1090;
    }
    body.sidebar-open .sidebar-overlay { display: block; }

    .menu-toggle {
        all: unset;
        display: flex !important;
        align-items: center; justify-content: center;
        width: 40px; height: 40px; flex: none;
        border-radius: 10px; background: #f1f4f9; cursor: pointer;
    }

    /* ── Barre du haut : compacte, la recherche prend la place restante ── */
    .app-topbar { padding: 0 12px !important; gap: 10px !important; }
    .app-search { width: auto !important; flex: 1; min-width: 0; }

    /* ── Contenu : les grilles définies en ligne s'empilent en une colonne ── */
    [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

    /* Cartes et blocs : marges intérieures réduites. */
    .card-body { padding: 16px 14px !important; }

    /* Tableaux : défilement DANS leur conteneur (déjà en overflow:auto),
       jamais de débordement de la page entière. */
    table { min-width: 560px; }

    /* Onglets des fiches : défilement horizontal plutôt que retour à la ligne. */
    .nav-tabs { flex-wrap: nowrap; overflow-x: auto; }
    .nav-tabs .nav-link { white-space: nowrap; }
}
