.cfw-layout {
    display: flex;
    gap: 20px;
}

.cfw-left {
    width: 35%;
}

.cfw-right {
    width: 65%;
}

.cfw-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.cfw-filters input,
.cfw-filters select {
    width: 100%;
}

.cfw-clients-list {
    border: 1px solid #ddd;
    max-height: 600px;
    overflow-y: auto;
    background: #fff;
}

.cfw-client-item {
    padding: 8px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.cfw-client-item:hover {
    background: #f5f5f5;
}

.cfw-client-name {
    font-weight: 600;
}

.cfw-client-meta {
    font-size: 11px;
    color: #666;
}

.cfw-client-credits {
    font-size: 12px;
    color: #333;
}

.cfw-new-client-btn {
    margin-top: 10px;
    width: 100%;
}

.cfw-client-detail {
    border: 1px solid #ddd;
    padding: 15px;
    background: #fff;
}

.cfw-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cfw-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
    margin-top: 10px;
}

.cfw-detail-grid label {
    display: block;
    font-size: 12px;
    margin-bottom: 2px;
}

.cfw-detail-grid input,
.cfw-detail-grid select {
    width: 100%;
}

.cfw-field-with-icon {
    display: flex;
    align-items: center;
}

.cfw-eye-icon {
    margin-left: 6px;
    cursor: pointer;
}

.cfw-hidden {
    display: none;
}

.cfw-editable {
    background: #fff8d1 !important;
}

.cfw-credits-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
}

.cfw-credit-box {
    border: 1px solid #ddd;
    padding: 10px;
    min-width: 120px;
    text-align: center;
    background: #fafafa;
}

.cfw-credit-value {
    font-size: 20px;
    font-weight: bold;
}

.cfw-credit-actions button {
    display: block;
    margin-bottom: 5px;
    width: 120px;
}

.button-danger {
    background: #d63638;
    border-color: #d63638;
    color: #fff;
}

.cfw-last-ops {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.cfw-last-ops button {
    margin-left: auto;
}

#cfw-remarks {
    width: 100%;
    min-height: 80px;
    margin-top: 10px;
}

.cfw-footer {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

/* Modals */
.cfw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.cfw-modal {
    background: #fff;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    border-radius: 4px;
}

.cfw-modal-actions {
    margin-top: 15px;
    text-align: right;
}

.cfw-history-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Dashboard */
.cfw-dashboard-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: center;
}

.cfw-dashboard-filters label {
    font-size: 13px;
}

.cfw-dashboard-filters select {
    min-width: 180px;
}

.cfw-dashboard-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.cfw-card {
    border: 1px solid #ddd;
    padding: 15px;
    background: #fff;
    min-width: 260px;
}
.cfw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.cfw-modal {
    background: #ffffff;
    padding: 2rem;
    border-radius: 1rem;
    width: 420px;
    max-width: 90%;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    animation: cfwModalIn .25s ease-out;
}

@keyframes cfwModalIn {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cfw-modal label {
    font-size: .85rem;
    color: #475569;
    margin-top: .75rem;
    display: block;
}

.cfw-modal input,
.cfw-modal select {
    width: 100%;
    padding: .55rem .75rem;
    border-radius: .5rem;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    margin-top: .25rem;
}

.cfw-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    margin-top: 1.5rem;
}
button.button-primary#cfw-credit-plus {
    background: #22c55e !important;
    border-color: #16a34a !important;
    color: white !important;
}

button.button-primary#cfw-credit-plus:hover {
    background: #16a34a !important;
}
.cfw-client-detail,
.cfw-card {
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.cfw-client-item {
    border-radius: .5rem;
    margin: .25rem;
    transition: background .2s;
}

.cfw-client-item:hover {
    background: #f1f5f9;
}

.cfw-editable {
    background: #fff7d6 !important;
}
/* Conteneur du modal */
.cfw-modal-new-client {
    width: 480px; /* largeur fixe et élégante */
    max-width: 90%;
    margin: 0 auto;
}

/* Tous les champs du modal */
.cfw-modal-new-client input,
.cfw-modal-new-client select {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #d0d7e2;
    background: #f8fafc;
    font-size: 15px;
    margin-top: 6px;
}

/* Labels */
.cfw-modal-new-client label {
    display: block;
    margin-top: 14px;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
}

/* Titre */
.cfw-modal-new-client h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
    color: #0f172a;
}
.cfw-modal {
    padding: 30px 32px;
}
/* Boutons généraux */
.cfw-modal-actions .button {
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .2s ease;
}

/* Bouton Annuler */
#cfw-new-cancel {
    background: #e2e8f0;
    color: #475569;
}

#cfw-new-cancel:hover {
    background: #cbd5e1;
}

/* Bouton Créer */
#cfw-new-confirm {
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

#cfw-new-confirm:hover {
    background: #1d4ed8;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.cfw-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.cfw-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    animation: cfwModalIn .25s ease-out;
}

@keyframes cfwModalIn {
    from { opacity: 0; transform: translateY(10px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
button,
.button {
    border-radius: 10px !important;
    padding: 10px 18px !important;
    font-weight: 600 !important;
    transition: all .2s ease !important;
}

/* Bouton primaire */
.button-primary {
    background: #2563eb !important;
    border-color: #1d4ed8 !important;
    color: white !important;
}

.button-primary:hover {
    background: #1d4ed8 !important;
}

/* Bouton danger */
.button-danger {
    background: #dc2626 !important;
    border-color: #b91c1c !important;
    color: white !important;
}

.button-danger:hover {
    background: #b91c1c !important;
}
/* --- RESPONSIVE GLOBAL --- */
@media (max-width: 900px) {

    .cfw-layout {
        flex-direction: column;
        gap: 20px;
    }

    .cfw-left,
    .cfw-right {
        width: 100%;
    }

    .cfw-clients-list {
        max-height: 300px;
    }
}

/* --- RESPONSIVE POUR PETITS ÉCRANS --- */
@media (max-width: 600px) {

    .cfw-detail-grid {
        grid-template-columns: 1fr !important;
    }

    .cfw-credits-row {
        flex-direction: column;
        align-items: stretch;
    }

    .cfw-credit-actions button {
        width: 100% !important;
    }

    .cfw-last-ops {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
/* --- MODAL RESPONSIVE --- */
@media (max-width: 600px) {

    .cfw-modal {
        width: 95% !important;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 12px;
        padding: 20px !important;
    }

    .cfw-modal-new-client {
        width: 100% !important;
    }

    .cfw-modal-actions {
        flex-direction: column;
    }

    .cfw-modal-actions .button {
        width: 100%;
        text-align: center;
    }
}
.cfw-modal-new-client input,
.cfw-modal-new-client select {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}
@media (max-width: 600px) {
    button,
    .button {
        padding: 14px 20px !important;
        font-size: 16px !important;
        border-radius: 12px !important;
    }
}
@media (max-width: 600px) {
    .cfw-client-item {
        padding: 12px;
        border-radius: 8px;
        margin-bottom: 6px;
    }

    .cfw-client-name {
        font-size: 16px;
    }

    .cfw-client-meta {
        font-size: 12px;
    }
}
/* Champs modernes */
.cfw-client-detail input,
.cfw-client-detail select,
.cfw-client-detail textarea,
.cfw-filters input,
.cfw-filters select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #d0d7e2;
    background: #f8fafc;
    font-size: 15px;
    transition: all .25s ease;
}

/* Focus moderne */
.cfw-client-detail input:focus,
.cfw-client-detail select:focus,
.cfw-client-detail textarea:focus,
.cfw-filters input:focus,
.cfw-filters select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
    background: #ffffff;
}

/* Icône œil */
.cfw-eye-icon {
    cursor: pointer;
    font-size: 18px;
    opacity: .6;
    transition: .2s;
}

.cfw-eye-icon:hover {
    opacity: 1;
}

/* Bouton icône (Modifier / Enregistrer) */
#cfw-edit-client {
    background: none !important;
    border: none !important;
    padding: 8px;
    font-size: 22px;
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s ease, transform .2s ease;
}

#cfw-edit-client:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* Icône Modifier */
#cfw-edit-client:not(.edit-mode)::before {
    content: "✏️";
}

/* Icône Enregistrer */
#cfw-edit-client.edit-mode::before {
    content: "💾";
}

/* Animation passage en mode édition */
.cfw-editable {
    animation: cfwEditPulse .4s ease;
}

@keyframes cfwEditPulse {
    from { background: #fff3c4; }
    to   { background: #ffffff; }
}

/* Toast */
#cfw-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #16a34a;
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,.25);
    opacity: 0;
    transform: translateY(20px);
    transition: all .4s ease;
    z-index: 99999;
}

#cfw-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Effet lumière Créditer / Débiter */
#cfw-credit-plus {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    color: white !important;
}

#cfw-credit-plus::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(34,197,94,.4), transparent);
    transform: skewX(-20deg);
    animation: greenShine 2s infinite;
}

@keyframes greenShine {
    0% { left: -100%; }
    60% { left: 120%; }
    100% { left: 120%; }
}

#cfw-credit-minus {
    position: relative;
    overflow: hidden;
}

#cfw-credit-minus::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(239,68,68,.4), transparent);
    transform: skewX(-20deg);
    animation: redShine 2s infinite;
}

@keyframes redShine {
    0% { left: -100%; }
    60% { left: 120%; }
    100% { left: 120%; }
}
/* Bloc crédits modernisé */
.cfw-credits-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
    width: 100%;
}

.cfw-credit-box {
    background: #ffffff;
    border: 1px solid #d0d7e2;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    font-size: 15px;
}

.cfw-credit-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cfw-last-ops {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 20px;
    align-items: center;
}

.cfw-last-ops button {
    width: 100%;
}
.cfw-remarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    margin-bottom: 10px;
}
/* Conteneur principal */
.cfw-client-detail {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
}
.cfw-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cfw-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    width: 100%;
}
.cfw-last-ops {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    align-items: center;
    width: 100%;
}

.cfw-last-ops button {
    width: 100%;
}
.cfw-remarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
}

#cfw-remarks {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #d0d7e2;
    background: #f8fafc;
    font-size: 15px;
}
#cfw-last-save-fixed {
    position: fixed;
    bottom: 12px;
    left: 20px;
    font-size: 14px;
    color: #475569;
    opacity: .85;
    z-index: 9999;
    background: rgba(255,255,255,0.85);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    backdrop-filter: blur(6px);
}
@media (max-width: 700px) {
    .cfw-detail-grid,
    .cfw-credits-row,
    .cfw-last-ops {
        grid-template-columns: 1fr;
    }

    .cfw-remarks-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #cfw-save-remarks {
        width: 100%;
    }
}
@media (max-width: 700px) {
    .cfw-client-detail {
        padding: 24px !important;
    }

    .cfw-left,
    .cfw-right,
    #cfw-app {
        padding: 24px !important;
    }
}
/* Champ entreprise pleine largeur */
.cfw-company-full {
    grid-column: 1 / -1; /* occupe toute la largeur */
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cfw-client-name {
    font-weight: 600;
    font-size: 15px;
}
.cfw-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    align-items: start;
}
@media (max-width: 700px) {

    /* Marges globales */
    .cfw-client-detail,
    #cfw-app,
    .cfw-left,
    .cfw-right {
        padding: 24px !important;
    }

    /* Grilles en colonne */
    .cfw-detail-grid,
    .cfw-credits-row,
    .cfw-last-ops {
        grid-template-columns: 1fr !important;
    }

    /* Remarque : bouton supprimé → champ seul */
    .cfw-remarks-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    #cfw-remarks {
        width: 100%;
    }
}
.cfw-company-full {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
/* Réduction de l’espace autour des titres */
.cfw-client-detail h2,
.cfw-client-detail h3 {
    margin-top: 0px !important;
    margin-bottom: 0px !important;
    padding: 0;
}

/* Réduction de l’espace entre les blocs */
.cfw-detail-grid,
.cfw-credits-row,
.cfw-last-ops,
#cfw-remarks {
    margin-top: 0px !important;
}

/* Réduction de l’espace entre les sections */
.cfw-client-detail > * {
    margin-bottom: 6px !important;
}
@media (max-width: 700px) {

    .cfw-client-detail h2,
    .cfw-client-detail h3 {
        margin-top: 10px !important;
        margin-bottom: 4px !important;
    }

    .cfw-client-detail > * {
        margin-bottom: 12px !important;
    }
    .cfw-detail-header {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 6px;
    }
}
.cfw-detail-header > div {
    display: flex;
    gap: 8px;
    align-items: center;
}
