/* ============================================================
   Module Contrats — styles (complètent le socle)
   ============================================================ */

/* --- Texte explicatif en en-tête de module --- */
.module-intro {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 18px;
}
.module-intro p { margin: 0; font-size: 0.9rem; color: #1e3a5f; line-height: 1.6; }

/* --- Statut rejeté --- */
.badge-rejete { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; font-weight:700; }
tr.facture-rejete { background:#fef2f2 !important; }
tr.facture-rejete:hover { background:#fee2e2 !important; }
.stat-retards .stat-value { color:#dc2626; }
.stat-retards { border-left:3px solid #dc2626; }

/* --- Réajustement --- */
.reajust-box {
    background:#f0f9ff; border:1px solid #bfdbfe; border-radius:12px;
    padding:18px; margin-top:16px;
}
.reajust-box h4 { margin:0 0 12px; color:#1e40af; font-size:0.95rem; }

/* ============================================================
   TABLEAU D'ÉCHÉANCIER — design refait, lisible et aéré
   ============================================================ */
.echeancier-table { width:100%; border-collapse:collapse; }
.echeancier-table thead th {
    font-size:0.8rem;
    font-weight:600;
    color:#6b7280;
    text-transform:uppercase;
    letter-spacing:0.03em;
    padding:10px 14px;
    border-bottom:2px solid #eef2f7;
    text-align:left;
}
.echeancier-table tbody td {
    padding:14px;
    border-bottom:1px solid #f1f5f9;
    font-size:0.95rem;
    color:#1f2937;
    vertical-align:middle;
}
.echeancier-table tbody tr:hover { background:#f9fafb; }

/* Champs de saisie : nets, arrondis, lisibles (fini les carrés) */
.echeancier-table input[type="number"],
.echeancier-table select {
    font-size:0.95rem;
    padding:9px 12px;
    border:1.5px solid #d1d5db;
    border-radius:9px;
    background:#fff;
    color:#111827;
    transition:border-color .15s, box-shadow .15s;
    box-sizing:border-box;
}
.echeancier-table input[type="number"] { width:120px; }
.echeancier-table select { width:auto; min-width:130px; }
.echeancier-table input[type="number"]:focus,
.echeancier-table select:focus {
    outline:none;
    border-color:#3b82f6;
    box-shadow:0 0 0 3px rgba(59,130,246,0.12);
}

/* Bouton disquette (enregistrer une ligne) — discret, propre */
.btn-disquette {
    background:#f8fafc;
    border:1.5px solid #e2e8f0;
    border-radius:9px;
    font-size:1.05rem;
    padding:7px 11px;
    cursor:pointer;
    transition:background .15s, transform .1s, border-color .15s;
}
.btn-disquette:hover { background:#eff6ff; border-color:#bfdbfe; }
.btn-disquette:active { transform:scale(0.94); }

/* Mention "passé" plus discrète */
.echeancier-table .muted { color:#9ca3af; font-weight:400; }

/* ============================================================
   GRAPHIQUE EN COURBES — onglets, légende, dimensions maîtrisées
   ============================================================ */
.graph-tabs { display:flex; gap:6px; }
.graph-tab {
    background:#f1f5f9;
    border:1.5px solid transparent;
    border-radius:8px;
    padding:7px 14px;
    font-size:0.85rem;
    font-weight:500;
    color:#64748b;
    cursor:pointer;
    transition:all .15s;
}
.graph-tab:hover { background:#e2e8f0; }
.graph-tab.active {
    background:#eff6ff;
    border-color:#3b82f6;
    color:#1e40af;
    font-weight:600;
}

#graph-wrap { max-width:100%; }
#graph-wrap svg { display:block; max-height:280px; }

.graph-legend {
    display:flex;
    flex-wrap:wrap;
    gap:16px;
    margin-top:12px;
    justify-content:center;
}
.legend-item { display:inline-flex; align-items:center; gap:6px; font-size:0.85rem; color:#374151; }
.legend-dot { width:12px; height:12px; border-radius:50%; display:inline-block; }

/* ============================================================
   TEXTE COMPARATIF INTUITIF
   ============================================================ */
.compare-box {
    display:flex;
    gap:12px;
    align-items:flex-start;
    background:#f0fdf4;
    border:1px solid #bbf7d0;
    border-radius:12px;
    padding:16px 18px;
    margin-bottom:18px;
}
.compare-icon { font-size:1.3rem; line-height:1.4; }
.compare-box p { margin:0; font-size:0.92rem; color:#14532d; line-height:1.6; }

/* --- Titres généraux plus lisibles --- */
.page-header h1 { font-weight:700; }
.card h3 { font-weight:600; color:#1f2937; }

/* ============================================================
   ÉCHÉANCIER V2 — design soigné inspiré des échéanciers fournisseurs
   ============================================================ */
.echeancier-wrap {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    background: #fff;
    border: 1px solid #eef2f7;
}

/* En-tête coloré (bandeau dégradé) */
.echeancier-head {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    color: #fff;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.echeancier-head-title { display: flex; flex-direction: column; gap: 2px; }
.echeancier-head-title span { font-size: 1.15rem; font-weight: 700; }
.echeancier-head-title small { font-size: 0.82rem; opacity: 0.9; font-weight: 400; }

.btn-save-head {
    background: rgba(255,255,255,0.18);
    border: 1.5px solid rgba(255,255,255,0.4);
    color: #fff;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.btn-save-head:hover { background: rgba(255,255,255,0.28); }

/* Table */
.echeancier-v2 { width: 100%; border-collapse: collapse; }
.echeancier-v2 thead th {
    background: #f8fafc;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 18px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.echeancier-v2 tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    color: #1f2937;
    vertical-align: middle;
}
/* Lignes alternées (zébrures douces) */
.echeancier-v2 tbody tr:nth-child(even) { background: #fafbfc; }
.echeancier-v2 tbody tr:hover { background: #eff6ff; }

/* Ligne passée : légèrement grisée */
.echeancier-v2 tbody tr.row-passee { opacity: 0.85; }
/* Ligne rejetée : fond rouge */
.echeancier-v2 tbody tr.row-rejete { background: #fef2f2 !important; }

/* Cellule mois */
.cell-mois .mois-nom { font-weight: 700; color: #1e293b; }
.cell-mois .mois-tag {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.68rem;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 2px 7px;
    border-radius: 20px;
    vertical-align: middle;
}
.cell-libelle { color: #64748b; font-size: 0.88rem; }

/* Champs de saisie intégrés (plus de flottement) */
.inp-montant, .inp-conso {
    width: 100px;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    font-size: 0.95rem;
    color: #111827;
    background: #fff;
    text-align: right;
    transition: border-color .15s, box-shadow .15s;
}
.inp-montant:focus, .inp-conso:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* Sélecteur de statut coloré selon l'état */
.sel-statut {
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
}
.sel-statut.statut-payee { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.sel-statut.statut-en_attente { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.sel-statut.statut-rejete { color: #991b1b; border-color: #fca5a5; background: #fef2f2; }

/* Ligne de total (pied de tableau, bien visible) */
.echeancier-total td {
    background: #f1f5f9;
    font-weight: 700;
    color: #1e293b;
    padding: 16px 18px;
    font-size: 1rem;
    border-top: 2px solid #e2e8f0;
}
.echeancier-total .total-montant { color: #2563eb; font-size: 1.1rem; }
.echeancier-total .total-conso { color: #0891b2; }

/* Bouton disquette (aligné à droite, discret) */
.cell-action { text-align: center; }

@media (max-width: 640px) {
    .echeancier-v2 thead { display: none; }
    .inp-montant, .inp-conso { width: 80px; }
}
