.init-container {
    max-width: 1400px;
    margin: 0 auto;
}

.init-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.init-header h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
}

.init-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.bilan-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.bilan-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.bilan-section-header {
    padding: 20px;
    font-weight: 600;
    font-size: 18px;
    border-bottom: 3px solid #e5e7eb;
}

.bilan-section-header.actif {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-color: #5a67d8;
}

.bilan-section-header.passif {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-bottom-color: #ec4899;
}

.bilan-section-content {
    padding: 20px;
}

.ligne-item {
    display: grid;
    grid-template-columns: 200px 1fr 150px 40px;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.ligne-item input[type="text"],
.ligne-item input[type="number"],
.ligne-item select {
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.ligne-item input[type="text"]:focus,
.ligne-item input[type="number"]:focus,
.ligne-item select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-remove {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fee2e2;
    color: #dc2626;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: #dc2626;
    color: white;
}

.btn-add {
    padding: 10px 20px;
    background: #f3f4f6;
    border: 2px dashed #9ca3af;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-add:hover {
    background: #e5e7eb;
    border-color: #6b7280;
    color: #374151;
}

.totaux-container {
    background: #f9fafb;
    border-radius: 12px;
    padding: 25px;
    margin: 30px 0;
    border: 2px solid #e5e7eb;
}

.totaux-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.total-box {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.total-box.actif {
    border-left: 4px solid #667eea;
}

.total-box.passif {
    border-left: 4px solid #ec4899;
}

.total-box.equilibre {
    border-left: 4px solid #10b981;
}

.total-box.equilibre.desequilibre {
    border-left-color: #ef4444;
}

.total-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.total-montant {
    font-size: 28px;
    font-weight: bold;
    color: #1f2937;
}

.total-box.equilibre .total-montant {
    color: #10b981;
}

.total-box.equilibre.desequilibre .total-montant {
    color: #ef4444;
}

.btn-save-init {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-save-init:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.date-init-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.date-init-container label {
    font-weight: 600;
    color: #374151;
    margin-right: 15px;
}

.date-init-container input {
    padding: 10px 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.warning-box {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.warning-box h3 {
    color: #92400e;
    margin: 0 0 10px 0;
    font-size: 18px;
}

.warning-box p {
    color: #78350f;
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.warning-box ul {
    color: #78350f;
    margin: 10px 0;
    padding-left: 25px;
}

.confirmation-checkbox {
    background: white;
    padding: 15px;
    border-radius: 6px;
    margin-top: 15px;
    border: 2px solid #f59e0b;
}

.confirmation-checkbox label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
    color: #92400e;
}

.confirmation-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.locked-message {
    background: #fee2e2;
    border-left: 4px solid #dc2626;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
}

.locked-message h3 {
    color: #991b1b;
    margin: 0 0 10px 0;
    font-size: 24px;
}

.locked-message p {
    color: #7f1d1d;
    margin: 0;
    font-size: 16px;
}

.locked-message i {
    font-size: 48px;
    color: #dc2626;
    margin-bottom: 15px;
}

@media (max-width: 1024px) {
    .bilan-grid {
        grid-template-columns: 1fr;
    }
    .totaux-grid {
        grid-template-columns: 1fr;
    }
}

/* Surcharge des styles WordPress widefat */
.wrap table.wp-list-table.widefat {
    border: none;
}

.wrap table.wp-list-table.widefat thead tr {
    background: #f9fafb;
}

.wrap table.wp-list-table.widefat thead th {
    background: transparent;
    color: #374151;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding: 12px 10px;
}

.wrap table.wp-list-table.widefat tbody tr {
    background: white;
}

.wrap table.wp-list-table.widefat tbody tr:hover {
    background: #f9fafb;
}

.wrap table.wp-list-table.widefat tbody td {
    padding: 12px 10px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
}

/* Surcharge pour les lignes alternées */
.wrap table.wp-list-table.widefat.striped > tbody > tr:nth-child(odd) {
    background: white;
}

.wrap table.wp-list-table.widefat.striped > tbody > tr:nth-child(even) {
    background: #fafafa;
}

/* Styles pour les en-têtes de groupe dans les journaux */
.wrap table.wp-list-table.widefat tbody tr[style*="gradient"] td {
    border: none !important;
}

/* Styles pour les lignes de sous-total */
.wrap table.wp-list-table.widefat tbody tr[style*="#e5e7eb"] td {
    border-top: 2px solid #d1d5db;
    border-bottom: 2px solid #d1d5db;
}

/* Styles pour la ligne de total général */
.wrap table.wp-list-table.widefat tbody tr[style*="background: #667eea"],
.wrap table.wp-list-table.widefat tbody tr[style*="background: #f093fb"] {
    border-top: 3px solid #374151;
}

.wrap table.wp-list-table.widefat tbody tr[style*="background: #667eea"] td,
.wrap table.wp-list-table.widefat tbody tr[style*="background: #f093fb"] td {
    color: white;
    border: none !important;
}

/* CSS UNIFIÉ POUR LES ONGLETS - Frontend et Admin */
/* ================================================= */

/* Palette de couleurs thématique */
:root {
    --primary-color: #065f46;
    --primary-dark: #064e3b;
    --primary-light: #047857;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --white: #ffffff;
    --border-color: #e5e7eb;
}

/* ONGLETS - Styles génériques applicables à tous les onglets */
.tabs {
    display: flex;
    background: var(--primary-color);
    border: none;
    overflow-x: auto;
}

.tab {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 15px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    background: none;
    font-weight: 600;
    cursor: pointer;
    min-width: fit-content;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tab.active {
    background: var(--white);
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab i {
    font-size: 1.2em;
}

/* CONTENU DES ONGLETS */
.tab-content {
    display: none !important;
    background: white;
    padding: 30px;
    min-height: 400px;
}

.compta-tab-content {
    background: white;
    padding: 0;
}

.tab-content.active {
    display: block !important;
}

.tab-content h3 {
    color: var(--primary-color);
    margin: 0 0 25px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: 1.5em;
    font-weight: 600;
}

/* Configuration - onglets arrondis comme Ecritures */
.configuration .tabs {
    margin: 20px 0 0 0;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    position: relative;
    z-index: 1;
    background: transparent;
    overflow: visible;
}

.configuration .tab {
    padding: 12px 24px;
    background: var(--gray-100);
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.configuration .tab:hover {
    background: var(--gray-200);
    color: var(--gray-700);
    text-decoration: none;
}

.configuration .tab.active {
    background: var(--white);
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    margin-bottom: -2px;
    position: relative;
    z-index: 2;
}

.configuration .tab.tab-disabled {
    opacity: 0.5;
    cursor: help;
    font-style: italic;
    font-size: 13px;
}

.configuration .tab-content {
    border-radius: 0 8px 8px 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* FIN CSS UNIFIÉ POUR LES ONGLETS */
/* ================================================= */

/* Ajouter les styles manquants pour les nouveaux templates */
.config-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.config-section h3 {
    margin: 0 0 20px 0;
    color: #374151;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-section h4 {
    margin: 30px 0 15px 0;
    color: #4b5563;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(5, 150, 105, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-success {
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-warning {
    background: #f59e0b;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.info-box {
    background: #dbeafe;
    border-left: 4px solid #047857;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.info-box p {
    margin: 0;
    color: #065f46;
}

.actions-bar {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.badge-type {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-type.charge {
    background: #fee2e2;
    color: #991b1b;
}

.badge-type.produit {
    background: #dcfce7;
    color: #166534;
}

.badge-type.autre {
    background: #e0e7ff;
    color: #3730a3;
}

.category-selector {
    margin-bottom: 20px;
}

.category-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.details-items {
    margin-top: 15px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #047857;
}

.detail-text {
    flex: 1;
    color: #374151;
}

.detail-actions {
    display: flex;
    gap: 5px;
}

.btn-edit-detail, .btn-delete-detail {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-edit-detail {
    color: #f59e0b;
}

.btn-edit-detail:hover {
    background: #fef3c7;
}

.btn-delete-detail {
    color: #ef4444;
}

.btn-delete-detail:hover {
    background: #fee2e2;
}

.bulk-add-details {
    padding: 15px;
    background: #f0f9ff;
    border-radius: 6px;
    border: 1px solid #bfdbfe;
}

.bulk-add-details h5 {
    margin: 0 0 10px 0;
    color: #065f46;
}

.bulk-add-details textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
}

.no-details, .error {
    text-align: center;
    padding: 20px;
    color: #6b7280;
    font-style: italic;
}

.error {
    color: #dc2626;
}

/* Styles pour les modales centrées */
.configuration .modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.configuration .modal.active {
    display: flex;
}

.configuration .modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    width: 600px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
}

.configuration .modal-content h4 {
    margin: 0 0 20px 0;
    color: #374151;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: black;
}

/* ===== Grand Livre ===== */

.grand-livre-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.filters-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.grand-livre-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.grand-livre-table th,
.grand-livre-table td {
    display: table-cell;
    padding: 0.6rem;
    vertical-align: top;
}

.grand-livre-table thead th {
    text-align: left;
}

.grand-livre-table tbody tr:nth-child(odd) {
    background: #f7f7f7;
}

.grand-livre-table th.text-right,
.grand-livre-table td.text-right {
    text-align: right;
}

.grand-livre-table thead tr {
    border-bottom: 2px solid #e5e7eb;
}

.grand-livre-table .gl-row {
    border-bottom: 1px solid #e5e7eb;
}

.grand-livre-table .gl-row:hover {
    background: #f9fafb;
}

.grand-livre-table .montant-debit {
    color: #ef4444;
    font-weight: 600;
}

.grand-livre-table .montant-credit {
    color: #10b981;
    font-weight: 600;
}

.grand-livre-table .solde-debiteur {
    color: #ef4444;
    font-weight: bold;
}

.grand-livre-table .solde-crediteur {
    color: #10b981;
    font-weight: bold;
}

.compte-section {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.compte-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    font-size: 16px;
}

.compte-totaux {
    background: #f3f4f6;
    padding: 12px 20px;
    font-weight: bold;
    border-top: 2px solid #e5e7eb;
}

.compte-totaux-grid {
    display: grid;
    grid-template-columns: 90px 80px 110px 1fr 110px 110px 110px;
    gap: 0;
    align-items: center;
}

.compte-totaux-grid .text-right {
    text-align: right;
}