/* CRM V5.1 - FIX AFFICHAGE + IDENTITE CLUB SPORTIF */

/* Logo PNG : on garde la transparence, aucun fond imposé */
.ghcrm-title img,
.admin-pro-brand img,
.internal-pro-brand img,
.gh-login-logo img,
.login-gh-logo img,
.crm4-brand-title img {
    background: transparent !important;
    background-color: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
    object-fit: contain !important;
}

.ghcrm-title img {
    width: 48px !important;
    height: 48px !important;
    border-radius: 0 !important;
}

.admin-pro-brand img,
.internal-pro-brand img {
    width: 56px !important;
    height: 56px !important;
    border-radius: 0 !important;
}

.gh-login-logo img,
.login-gh-logo img {
    width: 118px !important;
    height: 118px !important;
    border-radius: 0 !important;
}

/* Page CRM : moins large visuellement, plus propre dans l'admin */
.ghcrm-page {
    max-width: none !important;
    width: 100% !important;
    margin: 0 auto 70px !important;
    padding: 0 10px !important;
    box-sizing: border-box !important;
}

/* En-tête plus club sportif, moins énorme */
.ghcrm-topbar,
.ghcrm-company-head {
    align-items: center !important;
    gap: 14px !important;
}

.ghcrm-title {
    align-items: center !important;
}

.ghcrm-title h1 {
    font-size: clamp(1.45rem, 2.2vw, 2.15rem) !important;
    line-height: .95 !important;
    letter-spacing: -.04em !important;
}

.ghcrm-title span {
    color: #d01120 !important;
}

.ghcrm-title p {
    max-width: 720px !important;
}

/* Actions en haut : pas de chevauchement */
.ghcrm-top-actions,
.ghcrm-action-cluster {
    flex: 0 1 auto !important;
    min-width: 280px !important;
}

.ghcrm-year-form {
    min-height: 42px !important;
    box-sizing: border-box !important;
}

/* KPI : évite les cartes trop grandes */
.ghcrm-kpis {
    grid-template-columns: repeat(6, minmax(135px, 1fr)) !important;
}

.ghcrm-kpis a,
.ghcrm-kpis div {
    min-height: 56px !important;
    padding: 10px 12px !important;
}

.ghcrm-kpis strong {
    font-size: clamp(1.05rem, 1.5vw, 1.35rem) !important;
}

.ghcrm-kpis span {
    font-size: .70rem !important;
}

/* Layout : corrige le chevauchement filtres / cartes de droite */
.ghcrm-layout {
    grid-template-columns: minmax(0, 1fr) minmax(270px, 320px) !important;
    gap: 12px !important;
}

.ghcrm-main {
    min-width: 0 !important;
    overflow: hidden !important;
}

.ghcrm-side {
    min-width: 0 !important;
}

/* Filtres : flex-wrap au lieu d'une grille rigide */
.ghcrm-search {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
}

.ghcrm-search input[type="search"] {
    flex: 1 1 240px !important;
    min-width: 220px !important;
}

.ghcrm-search select {
    flex: 1 1 118px !important;
    min-width: 112px !important;
    max-width: 165px !important;
}

.ghcrm-search .ghcrm-btn,
.ghcrm-search button,
.ghcrm-search a {
    flex: 0 0 auto !important;
}

/* Table plus compacte et moins large */
.ghcrm-table {
    min-width: 780px !important;
    font-size: .80rem !important;
}

.ghcrm-table th,
.ghcrm-table td {
    padding: 9px 8px !important;
}

.ghcrm-table th:nth-child(2),
.ghcrm-table td:nth-child(2) {
    width: 92px !important;
}

.ghcrm-table th:nth-child(3),
.ghcrm-table td:nth-child(3) {
    width: 128px !important;
}

.ghcrm-table th:nth-child(4),
.ghcrm-table td:nth-child(4),
.ghcrm-table th:nth-child(5),
.ghcrm-table td:nth-child(5) {
    width: 92px !important;
}

.ghcrm-table th:nth-child(6),
.ghcrm-table td:nth-child(6) {
    width: 96px !important;
}

.ghcrm-table th:nth-child(7),
.ghcrm-table td:nth-child(7) {
    width: 118px !important;
}

.ghcrm-badge {
    max-width: 128px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Boutons : contraste GH */
.ghcrm-btn {
    background: #d01120 !important;
    color: #ffffff !important;
}

.ghcrm-btn:hover {
    background: #a80e19 !important;
}

.ghcrm-btn-light,
.ghcrm-btn-muted {
    background: #ffffff !important;
    color: #010101 !important;
    border: 1px solid #e3e5eb !important;
}

.ghcrm-btn-muted {
    background: #eef0f5 !important;
}

/* Adaptation club sportif : petites touches visuelles rouges/noires */
.ghcrm-card {
    border-top: 3px solid transparent !important;
}

.ghcrm-page-actions {
    border-top-color: #d01120 !important;
}

.ghcrm-nav a.active,
.ghcrm-nav a:hover {
    background: #010101 !important;
    border-color: #010101 !important;
    color: #ffffff !important;
}

.ghcrm-company-head {
    border-left: 5px solid #d01120 !important;
}

/* Modales : toujours centrées et plus lisibles */
.crm-modal {
    align-items: flex-start !important;
    justify-content: center !important;
    padding-top: 42px !important;
}

.crm-modal-box {
    max-height: calc(100vh - 84px) !important;
    display: flex !important;
    flex-direction: column !important;
}

.crm-modal-body {
    overflow-y: auto !important;
}

/* Formulaires dans modales */
.ghcrm-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.ghcrm-field.full {
    grid-column: 1 / -1 !important;
}

/* Responsive */
@media (max-width: 1280px) {
    .ghcrm-layout {
        grid-template-columns: 1fr !important;
    }

    .ghcrm-side {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
    }

    .ghcrm-kpis {
        grid-template-columns: repeat(3, minmax(135px, 1fr)) !important;
    }
}

@media (max-width: 760px) {
    .ghcrm-page {
        padding: 0 6px !important;
    }

    .ghcrm-topbar,
    .ghcrm-company-head {
        display: grid !important;
    }

    .ghcrm-top-actions,
    .ghcrm-action-cluster {
        min-width: 0 !important;
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

    .ghcrm-year-form,
    .ghcrm-btn {
        width: 100% !important;
    }

    .ghcrm-kpis,
    .ghcrm-side,
    .ghcrm-form-grid {
        grid-template-columns: 1fr !important;
    }

    .ghcrm-search input[type="search"],
    .ghcrm-search select,
    .ghcrm-search .ghcrm-btn,
    .ghcrm-search button,
    .ghcrm-search a {
        flex: 1 1 100% !important;
        max-width: none !important;
        width: 100% !important;
    }

    .crm-modal {
        padding: 12px 8px !important;
    }

    .crm-modal-box {
        max-height: calc(100vh - 24px) !important;
    }
}
