/*
 * Finance Copro — back-office admin.
 *
 * Charte reprise du site finance-copro.fr : vert de marque pour les actions,
 * bleu nuit pour les surfaces sombres et les titres, boutons en pilule,
 * intitulés de section en capitales espacées. Feuille unique, sans dépendance.
 */

:root {
    /* Marque */
    --vert: #2aa23e;
    --vert-fonce: #1f8531;
    --vert-profond: #0d3b2a;
    --vert-clair: #8ee24e;
    --vert-pale: #eaf6ec;
    --nuit: #16243d;
    --nuit-clair: #24334e;

    /* Texte et surfaces */
    --texte: #16243d;
    --texte-doux: #5f6d80;
    --bordure: #e0e6e2;
    --fond: #f4f7f5;
    --blanc: #fff;

    /* États */
    --bleu: #2f5c9e;
    --bleu-pale: #eaf0f9;
    --orange: #9a5b0b;
    --orange-pale: #fdf1de;
    --rouge: #b3261e;
    --rouge-pale: #fdeceb;
    --gris-pale: #eceff0;

    --radius: 8px;
    --pilule: 999px;
    --ombre: 0 1px 2px rgba(22, 36, 61, .05), 0 1px 3px rgba(22, 36, 61, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--texte);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.55;
}

a { color: var(--vert-fonce); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 23px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-doux); margin: 0 0 10px; }

/* ── En-tête ─────────────────────────────────────────────── */
.entete {
    background: var(--nuit);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 26px;
    /* Rappel du filet vert qui souligne la baseline du site. */
    border-bottom: 3px solid var(--vert);
}
.entete .marque {
    display: flex; align-items: center; gap: 9px;
    padding: 12px 0; white-space: nowrap;
    color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .02em;
}
.entete .marque img { width: 30px; height: 30px; display: block; }
.entete nav { display: flex; gap: 2px; flex: 1; }
.entete nav a {
    color: rgba(255, 255, 255, .72);
    padding: 17px 14px;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    text-decoration: none;
    font-size: 13.5px;
    letter-spacing: .01em;
}
.entete nav a:hover { color: #fff; }
.entete nav a.actif { color: #fff; font-weight: 600; border-bottom-color: var(--vert-clair); }
.entete .compte { color: rgba(255, 255, 255, .72); font-size: 13px; display: flex; align-items: center; gap: 14px; }
.entete .compte a { color: #fff; }

.conteneur { max-width: 1180px; margin: 0 auto; padding: 24px; }

/* ── Titre de page ───────────────────────────────────────── */
.titre-page { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.titre-page .sous-titre { color: var(--texte-doux); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Onglets ─────────────────────────────────────────────── */
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bordure); margin-bottom: 20px; }
.onglets a {
    padding: 9px 16px; color: var(--texte-doux); text-decoration: none;
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.onglets a:hover { color: var(--texte); text-decoration: none; }
.onglets a.actif { color: var(--vert-profond); border-bottom-color: var(--vert); font-weight: 700; }
.onglets .compteur {
    display: inline-block; margin-left: 5px; padding: 0 7px; border-radius: var(--pilule);
    background: var(--gris-pale); color: var(--texte-doux); font-size: 12px; font-weight: 600;
}
.onglets a.actif .compteur { background: var(--vert-pale); color: var(--vert-fonce); }

/* ── Cartes ──────────────────────────────────────────────── */
.carte { background: var(--blanc); border: 1px solid var(--bordure); border-radius: var(--radius); box-shadow: var(--ombre); margin-bottom: 20px; }
.carte > header { padding: 13px 16px; border-bottom: 1px solid var(--bordure); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.carte > header h2 { margin: 0; }
.carte .corps { padding: 16px; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }

/* ── Tableaux ────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 16px; text-align: left; border-bottom: 1px solid var(--bordure); vertical-align: middle; }
th {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--texte-doux); background: #fafbfa; font-weight: 700;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--vert-pale); }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
td.actions-ligne { text-align: right; white-space: nowrap; }
tfoot th { background: #fafbfa; }
.tableau-vide { padding: 32px 16px; text-align: center; color: var(--texte-doux); }

/* ── Fiches (couples libellé / valeur) ───────────────────── */
/* Colonne de libellés proportionnelle : les cartes de la fiche dossier sont
   étroites, une largeur fixe y tasserait les valeurs. */
.fiche { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 8px 14px; margin: 0; }
.fiche dt { color: var(--texte-doux); }
.fiche dd { margin: 0; }
.vide { color: #a4aeb4; font-style: italic; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: var(--pilule);
    font-size: 12px; font-weight: 600; white-space: nowrap;
    background: var(--gris-pale); color: var(--texte-doux);
}
.badge.vert { background: var(--vert-pale); color: var(--vert-fonce); }
.badge.bleu { background: var(--bleu-pale); color: var(--bleu); }
.badge.orange { background: var(--orange-pale); color: var(--orange); }
.badge.rouge { background: var(--rouge-pale); color: var(--rouge); }

/* ── Boutons ─────────────────────────────────────────────── */
.btn {
    display: inline-block; padding: 8px 18px; border-radius: var(--pilule);
    border: 1px solid var(--bordure); background: var(--blanc); color: var(--texte);
    font-size: 13px; font-family: inherit; font-weight: 600; cursor: pointer;
    text-decoration: none; line-height: 1.4;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: #f6f8f6; border-color: #cfd8d2; text-decoration: none; }
/* Bouton plein vert du site (« Contact », « Envoyer »). */
.btn.principal { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn.principal:hover { background: var(--vert-fonce); border-color: var(--vert-fonce); color: #fff; }
/* Variante contour verte, également présente sur le site. */
.btn.contour { border-color: var(--vert); color: var(--vert-fonce); background: var(--blanc); }
.btn.contour:hover { background: var(--vert-pale); }
.btn.danger { color: var(--rouge); border-color: #f0c9c6; }
.btn.danger:hover { background: var(--rouge-pale); border-color: #e5b2ae; }
.btn.petit { padding: 4px 12px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Formulaires ─────────────────────────────────────────── */
.champ { margin-bottom: 14px; }
.champ label { display: block; margin-bottom: 4px; color: var(--texte-doux); font-size: 13px; }
.champ input[type=text], .champ input[type=email], .champ input[type=password], .champ input[type=date],
.champ input[type=number], .champ input[type=file], .champ select, .champ textarea {
    width: 100%; padding: 8px 11px; border: 1px solid var(--bordure); border-radius: var(--radius);
    font-family: inherit; font-size: 14px; background: var(--blanc); color: var(--texte);
}
.champ input:focus, .champ select:focus, .champ textarea:focus {
    outline: 2px solid var(--vert); outline-offset: -1px; border-color: var(--vert);
}
.champ textarea { min-height: 72px; resize: vertical; }
.champ .aide { color: var(--texte-doux); font-size: 12px; margin-top: 3px; }
.champ .erreur, .erreur-formulaire { color: var(--rouge); font-size: 12px; margin-top: 3px; }
.champ-inline { display: flex; align-items: center; gap: 8px; }
.champ-inline label { margin: 0; }
.champ input[type=checkbox] { accent-color: var(--vert); width: 15px; height: 15px; }
.grille-champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
fieldset > legend { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-doux); font-weight: 700; padding: 0 0 8px; }
.cases { display: flex; gap: 16px; flex-wrap: wrap; }
.cases label { display: flex; align-items: center; gap: 6px; color: var(--texte); }
.cases input[type=checkbox], .cases input[type=radio] { accent-color: var(--vert); }
.barre-formulaire { display: flex; gap: 8px; align-items: center; padding-top: 4px; }

/* ── Champ référentiel (sélection + création à la volée) ─── */
.champ-avec-action { display: flex; gap: 6px; align-items: stretch; }
.champ-avec-action select { flex: 1; }
.champ-avec-action .btn {
    flex: 0 0 auto; padding: 0 13px; font-size: 17px; font-weight: 400; line-height: 1;
    border-color: var(--vert); color: var(--vert-fonce);
}
.champ-avec-action .btn:hover:not(:disabled) { background: var(--vert-pale); }
.champ-avec-action select:disabled { background: var(--gris-pale); color: var(--texte-doux); cursor: not-allowed; }
.champ-referentiel .aide:empty { display: none; }

/* ── Modale ──────────────────────────────────────────────── */
.modale {
    border: 0; border-top: 3px solid var(--vert); border-radius: 12px; padding: 24px;
    width: min(440px, calc(100vw - 32px)); box-shadow: 0 18px 44px rgba(22, 36, 61, .28);
    color: var(--texte); background: var(--blanc);
}
.modale::backdrop { background: rgba(13, 59, 42, .45); }
.modale h2 { margin-bottom: 16px; }
.modale .barre-formulaire { margin-top: 20px; }
.modale .erreur:empty, .erreur-formulaire:empty { display: none; }
.erreur-formulaire {
    background: var(--rouge-pale); border: 1px solid #f2c7c4; color: var(--rouge);
    padding: 8px 12px; border-radius: var(--radius); margin-bottom: 12px; font-size: 13px;
}

/* ── Génération de documents ─────────────────────────────── */
/* Saisie à gauche, aperçu du rendu à droite. */
.grille-document { display: grid; grid-template-columns: minmax(320px, 4fr) 5fr; gap: 20px; align-items: start; }
.apercu-document { width: 100%; height: 78vh; border: 1px solid var(--bordure); border-radius: var(--radius); background: #9e9e9e; }
@media (max-width: 900px) { .grille-document { grid-template-columns: 1fr; } }

/* Catalogue des documents d'un dossier. */
.liste-documents { list-style: none; }
.liste-documents li {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 0; border-bottom: 1px solid var(--bordure);
}
.liste-documents li:last-child { border-bottom: 0; }
.liste-documents .badge { margin-left: 8px; }

/* Champ verrouillé (forçage réservé à l'administrateur technique). */
.champ input:disabled {
    background: var(--gris-pale); color: var(--texte-doux); cursor: not-allowed;
}

/* ── Filtres ─────────────────────────────────────────────── */
.filtres { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.filtres .champ { margin-bottom: 0; }
.filtres input, .filtres select { min-width: 180px; }

/* ── Messages ────────────────────────────────────────────── */
.message { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.message.succes { background: var(--vert-pale); border-color: #b9e2c2; color: var(--vert-fonce); }
.message.erreur { background: var(--rouge-pale); border-color: #f2c7c4; color: var(--rouge); }
.message.info { background: var(--bleu-pale); border-color: #cbdcf0; color: var(--bleu); }
.message.alerte { background: var(--orange-pale); border-color: #f0dab5; color: var(--orange); }
.message ul { margin: 6px 0 0; padding-left: 20px; }

/* ── Journal ─────────────────────────────────────────────── */
.journal { list-style: none; margin: 0; padding: 0; }
.journal li { padding: 10px 0 10px 14px; border-bottom: 1px solid var(--bordure); border-left: 2px solid var(--vert-pale); }
.journal li:last-child { border-bottom: 0; }
.journal .quand { color: var(--texte-doux); font-size: 12px; }
.journal .detail { color: var(--texte-doux); font-size: 12px; font-variant-numeric: tabular-nums; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: flex-end; padding: 12px 16px; color: var(--texte-doux); }
.pagination a, .pagination span.page {
    padding: 4px 11px; border: 1px solid var(--bordure); border-radius: var(--pilule);
    background: var(--blanc); text-decoration: none;
}
.pagination a:hover { background: var(--vert-pale); border-color: var(--vert); text-decoration: none; }
.pagination span.page.courante { background: var(--vert); border-color: var(--vert); color: #fff; font-weight: 600; }
.pagination .compteur { margin-right: auto; }

/* ── Chiffres clés ───────────────────────────────────────── */
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.chiffre {
    background: var(--blanc); border: 1px solid var(--bordure); border-radius: var(--radius);
    padding: 13px 16px; border-top: 3px solid var(--vert);
}
.chiffre .valeur { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--vert-profond); }
.chiffre .libelle { color: var(--texte-doux); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }

/* ── Connexion ───────────────────────────────────────────── */
/* Reprend le bandeau sombre du site, veiné de vert. */
.page-login {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 420px at 15% -10%, rgba(42, 162, 62, .30), transparent 60%),
        radial-gradient(900px 380px at 100% 110%, rgba(142, 226, 78, .18), transparent 60%),
        var(--nuit);
}
.page-login .boite {
    background: var(--blanc); border-radius: 14px; padding: 34px; width: 100%; max-width: 384px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .3); border-top: 4px solid var(--vert);
}
.page-login .logo { display: block; width: 58px; height: 58px; margin: 0 auto 12px; }
.page-login .marque {
    font-size: 19px; font-weight: 700; color: var(--nuit); margin-bottom: 6px;
    text-align: center; letter-spacing: .02em; text-transform: uppercase;
}
.page-login .accroche {
    color: var(--texte-doux); margin: 0 0 24px; text-align: center; font-size: 13px;
    /* Filet vert sous la baseline, comme sur la page d'accueil du site. */
    padding-bottom: 16px; position: relative;
}
.page-login .accroche::after {
    content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
    width: 56px; height: 3px; background: var(--vert); border-radius: 2px;
}
.page-login .btn { width: 100%; text-align: center; padding: 10px; }
