/* Échéance de facture, styles de l'outil.
   DA reprise de la ToolBox : fond dégradé violet, conteneur blanc
   arrondi et ombré, cartes blanches, accents bleu profond pour un
   contraste d'au moins 4,5:1 avec le texte blanc des boutons. */

[hidden] { display: none !important; }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1080px;
    margin: 20px auto;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.lead {
    max-width: 900px;
    margin: 0 auto 10px;
    font-size: 1.05em;
    line-height: 1.6;
    color: #2c3e50;
    background: #f8f9fa;
    border-left: 4px solid #1b5a85;
    border-radius: 8px;
    padding: 15px 20px;
}

.tool-content {
    padding: 20px 0;
    display: grid;
    gap: 22px;
}

/* min-width: 0 sur tout item de grille contenant un tableau, un select
   ou un long texte : sinon l'item impose sa largeur minimale à la piste
   et fait déborder la page sur mobile au lieu de laisser .table-scroll
   défiler. */
.tool-content > *,
.champs-ligne > *,
.ef-lectures > *,
.contenu-editorial > .card {
    min-width: 0;
}

.card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3em;
    font-weight: 600;
}

.card h2 i { color: #1b5a85; }

.card h3 {
    color: #2c3e50;
    margin: 18px 0 10px;
    font-size: 1.08em;
    font-weight: 600;
}

.card h3:first-of-type { margin-top: 5px; }

.card p { line-height: 1.6; margin-bottom: 10px; }
.card p:last-child { margin-bottom: 0; }

/* Formulaires */
.form-group { margin-bottom: 16px; }

.form-group label,
.champ label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-size: 14px;
    color: #212529;
    background: #f8f9fa;
    font-family: inherit;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.form-control:focus {
    border-color: #1b5a85;
    background: white;
    outline: 3px solid rgba(27, 90, 133, 0.35);
    outline-offset: 1px;
}

.champs-ligne {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 560px) {
    .champs-ligne { grid-template-columns: 1fr; }
}

.champ-aide {
    margin-top: 8px;
    font-size: 13px;
    color: #595959;
}

/* Préréglages 30 / 45 / 60 jours */
.ef-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 18px;
}

.ef-preset {
    padding: 7px 14px;
    border: 2px solid #1b5a85;
    border-radius: 20px;
    background: white;
    color: #1b5a85;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ef-preset:hover { background: #1b5a85; color: white; transform: translateY(-1px); }

/* Boutons */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(145deg, #1b5a85, #123f5e);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(27, 90, 133, 0.35); }
.btn:active { transform: translateY(0); }

.btn-secondaire {
    background: white;
    color: #1b5a85;
    border: 2px solid #1b5a85;
}

.btn-secondaire:hover { background: #eef5fb; box-shadow: none; }

.ef-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

/* Résultats */
.resultat {
    margin-top: 18px;
    background: #f0f6fb;
    border-left: 4px solid #1b5a85;
    border-radius: 8px;
    padding: 18px 20px;
    min-height: 60px;
}

.resultat-placeholder { color: #44515e; font-style: italic; margin: 0; }
.resultat-intro { color: #2c3e50; font-size: 14px; margin-bottom: 6px; }
.resultat-date { color: #123f5e; font-size: 1.6em; font-weight: 700; margin: 4px 0 10px; }
.resultat-note { color: #7a5c00; font-size: 13px; margin-top: 8px; }
.resultat-erreur { color: #a4261a; font-weight: 500; }
.resultat-details { color: #43594c; font-size: 13.5px; line-height: 1.6; }
.resultat-details p { margin: 6px 0; }
.resultat-details ul { margin: 6px 0 6px 20px; }

.ef-conforme { color: #1e7e34; font-weight: 600; }
.ef-non-conforme {
    color: #a4261a;
    font-weight: 700;
    background: #fdecea;
    border-radius: 6px;
    padding: 8px 12px;
    display: inline-block;
}

/* Les deux lectures d'un "X jours fin de mois", côte à côte */
.ef-lectures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

@media (max-width: 560px) {
    .ef-lectures { grid-template-columns: 1fr; }
}

.ef-lecture {
    background: white;
    border: 1px solid #dbe6ee;
    border-radius: 8px;
    padding: 12px 14px;
    position: relative;
}

.ef-lecture-titre { font-size: 12.5px; color: #4a5a68; margin-bottom: 6px; line-height: 1.4; }
.ef-lecture-date { font-size: 1.15em; font-weight: 700; color: #123f5e; }
.ef-lecture-badge {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: white;
    background: #1e7e34;
    border-radius: 12px;
    padding: 2px 10px;
}

/* Mode lot */
.ef-lot-zone {
    width: 100%;
    min-height: 130px;
    padding: 12px 15px;
    border: 2px solid #ced4da;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13.5px;
    color: #212529;
    background: #f8f9fa;
    resize: vertical;
}

.ef-lot-zone:focus {
    border-color: #1b5a85;
    background: white;
    outline: 3px solid rgba(27, 90, 133, 0.35);
    outline-offset: 1px;
}

.table-scroll { overflow-x: auto; margin: 14px 0; }

.table-scroll table,
#ef-lot-resultat table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    font-size: 13.5px;
}

#ef-lot-resultat { margin-top: 18px; overflow-x: auto; }

.table-scroll th, .table-scroll td,
#ef-lot-resultat th, #ef-lot-resultat td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.table-scroll thead th,
#ef-lot-resultat thead th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
    white-space: nowrap;
}

.ef-col-montant { text-align: right; }

.ef-statut-retard { color: #a4261a; font-weight: 700; }
.ef-statut-proche { color: #b35b09; font-weight: 700; }
.ef-statut-a-venir { color: #1e7e34; font-weight: 600; }
.ef-ligne-erreur td { color: #a4261a; font-style: italic; }

.ef-totaux {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.ef-totaux dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: #595959; }
.ef-totaux dd { font-size: 1.2em; font-weight: 700; color: #123f5e; margin-bottom: 8px; }

/* Fieldset (sens, taux) */
.fieldset-choix {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
}

.fieldset-choix legend { padding: 0 8px; font-weight: 500; color: #2c3e50; font-size: 14px; }

.choix-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2c3e50;
    cursor: pointer;
    padding: 5px 0;
}

.choix-inline input { width: 18px; height: 18px; accent-color: #1b5a85; cursor: pointer; flex-shrink: 0; }

/* Illustration SVG en frise */
.ef-frise {
    width: 100%;
    height: auto;
    margin: 10px 0 6px;
}

/* Tableau de référence des délais légaux */
.table-reference { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 14px; }
.table-reference th, .table-reference td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e9ecef; }
.table-reference thead th { background: #2c3e50; color: white; font-weight: 600; }
.table-reference tbody tr:nth-child(even) { background: #f8f9fa; }
.table-reference a { color: #1976d2; }

/* Avertissement */
.avertissement {
    background: #fff8e6;
    border-left: 4px solid #e67e22;
    border-radius: 8px;
    padding: 14px 16px;
    color: #5d4300;
    font-size: 14px;
    line-height: 1.55;
}

.avertissement i { color: #b35b09; margin-right: 6px; }

.date-relecture {
    font-size: 12.5px;
    color: #595959;
    margin-top: 4px;
}

/* FAQ */
.faq-item { padding: 12px 0; border-bottom: 1px solid #e9ecef; }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-item h3 { margin: 0 0 8px; }
.faq-item p { margin: 0; color: #333; }

/* Liens et focus visibles au clavier */
a { color: #1976d2; }

a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 3px solid #123f5e;
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container { margin: 10px; padding: 15px; border-radius: 10px; }
    .card { padding: 18px; }
    .resultat-date { font-size: 1.35em; }
}

/* Impression */
@media print {
    body { background: white; }
    .container { box-shadow: none; margin: 0; }
    .ef-actions, .ef-presets { display: none; }
}

/* Listes du contenu éditorial : le reset global retire le retrait, les
   puces sortaient de la carte. */
.card ul,
.card ol {
    padding-left: 1.4em;
    margin: 8px 0 12px;
}

.card li {
    margin: 4px 0;
    line-height: 1.6;
}
