/*
 * ExpoBéton RDC — Club BTP | Feuille de style
 *
 * Fichier propre à l'application : btpfin est un sous-domaine séparé, il ne
 * peut pas charger les feuilles de style d'adminfin, et n'a rien à emprunter
 * d'une plateforme qu'il n'administre pas.
 *
 * Palette : variables corporatives de la 12e édition (bleu foncé, rouge,
 * jaune ExpoBéton). Aucune police web n'est appelée — la charte du site
 * public utilise Archivo, dont le fichier n'existe que sur l'autre docroot ;
 * une pile système rend le tableau de bord lisible sans requête externe.
 */

:root {
    --rouge: #c22439;
    --jaune: #fdbd1b;
    --bleu: #112bb5;
    --bleu-fonce: #0d1b3e;
    --sombre: #1a1a2e;
    --clair: #f8f9fa;
    --bord: #e3e7ef;
    --succes: #1c7c4a;
    --attente: #9a6b00;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--clair);
    color: var(--sombre);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--bleu); }

/* ------------------------------ Bandeau ------------------------------ */
.topbar {
    background: var(--bleu-fonce);
    color: #fff;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.marque { display: flex; align-items: center; gap: 12px; min-width: 0; }
.marque-sceau {
    width: 38px; height: 38px; flex-shrink: 0;
    background: var(--rouge);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .5px;
    display: flex; align-items: center; justify-content: center;
}
.marque-txt { min-width: 0; }
.marque-txt strong { display: block; font-size: 15px; font-weight: 600; }
.marque-txt span { display: block; font-size: 12px; color: #a9b6d4; }

.compte { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.compte-nom { color: #dbe3f5; }
.compte-nom b { color: #fff; font-weight: 600; }
.compte a { color: var(--jaune); text-decoration: none; white-space: nowrap; }
.compte a:hover { text-decoration: underline; }

/* -------------------------------- Nav -------------------------------- */
.nav {
    background: #fff;
    border-bottom: 1px solid var(--bord);
    padding: 0 20px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.nav a {
    display: block;
    padding: 13px 16px;
    font-size: 14px;
    color: #4a5568;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.nav a:hover { color: var(--bleu); background: #f5f7ff; }
.nav a.actif { color: var(--bleu); font-weight: 600; border-bottom-color: var(--bleu); }

/* ------------------------------ Contenu ------------------------------ */
.corps { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 26px 20px 46px; }
.entete-page { margin-bottom: 22px; }
.entete-page h1 { font-size: 22px; font-weight: 600; }
.entete-page p { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* -------------------------------- Cartes ----------------------------- */
.cartes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}
.carte {
    background: #fff;
    border: 1px solid var(--bord);
    border-left: 4px solid var(--bleu);
    padding: 16px 18px;
}
.carte.attente { border-left-color: var(--jaune); }
.carte.succes  { border-left-color: var(--succes); }
.carte.neutre  { border-left-color: #94a3b8; }
.carte-lbl {
    font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
    color: #6b7280; font-weight: 600;
}
.carte-valeur { font-size: 25px; font-weight: 700; margin-top: 6px; word-break: break-word; }
.carte-note { font-size: 12px; color: #8a94a6; margin-top: 4px; }

.bloc {
    background: #fff;
    border: 1px solid var(--bord);
    padding: 18px 20px;
    margin-bottom: 22px;
}
.bloc-titre {
    font-size: 15px; font-weight: 600; margin-bottom: 14px;
    padding-bottom: 10px; border-bottom: 1px solid var(--bord);
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* -------------------------------- Table ------------------------------ */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left; padding: 9px 10px; background: #f1f3f7;
    font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
    color: #55607a; border-bottom: 1px solid var(--bord); white-space: nowrap;
}
td { padding: 11px 10px; border-bottom: 1px solid #eef0f5; vertical-align: middle; }
tbody tr:hover { background: #fafbfe; }
td.montant { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
td.ref { font-family: Consolas, monospace; font-size: 12px; color: #55607a; white-space: nowrap; }
.vide { padding: 26px 10px; text-align: center; color: #8a94a6; font-size: 14px; }

/* Statuts */
.pastille {
    display: inline-block; padding: 3px 10px; border-radius: 11px;
    font-size: 11px; font-weight: 600; white-space: nowrap;
}
.pastille.paye       { background: #e3f5ea; color: var(--succes); }
.pastille.en_attente { background: #fdf3d8; color: var(--attente); }
.pastille.annule     { background: #f6e3e6; color: var(--rouge); }
.pastille.rembourse  { background: #e8eaf0; color: #55607a; }
.pastille.brouillon  { background: #eef1f6; color: #6b7280; }

/* -------------------------------- Boutons ---------------------------- */
.btn {
    display: inline-block; padding: 10px 18px; border: 1px solid transparent;
    background: var(--bleu); color: #fff; font-size: 14px; font-family: inherit;
    cursor: pointer; text-decoration: none; border-radius: 2px;
}
.btn:hover { background: #0d2190; }
.btn.secondaire { background: #fff; color: var(--bleu); border-color: var(--bleu); }
.btn.secondaire:hover { background: #f2f5ff; }
.btn.discret { background: #fff; color: #4a5568; border-color: var(--bord); font-size: 13px; padding: 7px 12px; }
.btn.discret:hover { background: #f4f6fa; color: var(--sombre); }
.btn.danger { background: #fff; color: var(--rouge); border-color: #e9b9c1; }
.btn.danger:hover { background: #fdf1f3; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* -------------------------------- Form ----------------------------- */
.form-ligne { margin-bottom: 16px; }
.form-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #374151; }
label .facultatif { font-weight: 400; color: #8a94a6; }
.obligatoire::after { content: " *"; color: var(--rouge); }
input[type=text], input[type=email], input[type=tel], input[type=search], textarea, select {
    width: 100%; max-width: 430px; padding: 10px 12px; font-size: 14px;
    font-family: inherit; border: 1px solid #cfd6e4; border-radius: 2px; background: #fff;
}
textarea { max-width: 620px; min-height: 68px; resize: vertical; }
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--bleu); box-shadow: 0 0 0 3px rgba(17,43,181,.1);
}
.aide { font-size: 12px; color: #6b7280; margin-top: 4px; max-width: 620px; }

/* Zone du lien généré */
.lien-boite { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.lien-boite input {
    flex: 1; min-width: 200px; max-width: none;
    font-family: Consolas, monospace; font-size: 12px; background: #f7f8fb;
}
.pile { position: relative; }
.devise-suffixe {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    font-size: 12px; font-weight: 700; color: #8a94a6; pointer-events: none;
}
.pile input { padding-right: 52px; }

/* -------------------------------- Alertes -------------------------- */
.alerte { padding: 12px 15px; margin-bottom: 18px; font-size: 14px; border-left: 4px solid; }
.alerte ul { margin-left: 18px; }
.alerte.ok { background: #e9f7ee; border-color: var(--succes); color: #14532d; }
.alerte.err { background: #fdecee; border-color: var(--rouge); color: #7f1d24; }
.alerte.info { background: #eef3ff; border-color: var(--bleu); color: #1e3a8a; }

/* ------------------------------- Pagination ------------------------ */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; flex-wrap: wrap; font-size: 13px; }
.pagination a, .pagination span {
    padding: 6px 11px; border: 1px solid var(--bord); background: #fff;
    text-decoration: none; color: #4a5568;
}
.pagination .ici { background: var(--bleu); color: #fff; border-color: var(--bleu); font-weight: 600; }
.pagination a:hover { background: #f2f5ff; }
.filtres { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filtres input, .filtres select { max-width: 240px; }
.filtres .form-ligne { margin-bottom: 0; }

/* Actions d'une ligne de la liste : chaque écriture est son propre
   formulaire POST, donc empilés côte à côte sous le lien à copier. */
.forme-action { display: inline-block; margin: 8px 8px 0 0; }

/* --------------------------------- Pied ---------------------------- */
.pied {
    border-top: 1px solid var(--bord); background: #fff;
    padding: 16px 20px; font-size: 12px; color: #8a94a6; text-align: center;
}

/* ------------------------------ Connexion -------------------------- */
body.connexion { justify-content: center; align-items: center; padding: 24px 14px; }
.boite-connexion {
    width: 100%; max-width: 400px; background: #fff;
    border: 1px solid var(--bord); border-top: 4px solid var(--rouge);
    padding: 26px 24px 22px;
}
.boite-marque { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.boite-marque strong { display: block; font-size: 15px; color: var(--sombre); }
.boite-marque small { display: block; font-size: 12px; color: #6b7280; }
.boite-connexion input[type=text], .boite-connexion input[type=password] { max-width: none; }
.btn-bloc { width: 100%; }
.boite-pied { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--bord); font-size: 12px; color: #8a94a6; }

/* Les styles en ligne sont exclus par la Content-Security-Policy du .htaccess :
   ces deux utilitaires remplacent les rares attributs style= qu'imposerait une
   mise en page sinon impossible. */
.sans-marge-haut { margin-top: 0; }
.marge-haut { margin-top: 16px; }

/* ------------------------------ Mobile ----------------------------- */
@media (max-width: 700px) {
    .cartes { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
    .carte-valeur { font-size: 21px; }
    .corps { padding: 20px 14px 36px; }
    .bloc { padding: 15px; }
    input[type=text], input[type=email], input[type=tel], input[type=search],
    textarea, select, .filtres input, .filtres select { max-width: none; }
    .topbar { padding: 12px 14px; }
    .compte { width: 100%; justify-content: space-between; }

    /* Onglets : à trois entrées, le fil ne tient jamais dans 390 px et un
       défilement horizontal sans ascenseur y coupe l'onglet actif — celui
       qui indique où l'on est. Ils passent donc en lignes empilées, chacune
       pleine largeur : rien à faire défiler, le libellé courant toujours
       lisible. */
    .nav { padding: 4px 10px 8px; flex-wrap: wrap; gap: 0; overflow: visible; }
    .nav a { padding: 11px 12px; text-align: center; border-bottom: 0; border-left: 3px solid transparent; }
    .nav a:hover { background: none; }
    .nav a.actif { border-left-color: var(--bleu); background: #f5f7ff; }

    /* Le tableau passe en fiches : plus de scroll horizontal, qui est
       inutilisable à cette largeur sur six colonnes. La mise en fiches ne
       suffit pourtant pas à le supprimer — deux choses le maintenaient :
       les libellés de colonne, non rétrécissables, et la largeur
       intrinsèque du tableau, héritée des colonnes desktop. */
    .table-scroll { overflow-x: hidden; }
    table, thead, tbody, tr, td, th { display: block; }
    table { width: 100%; min-width: 0; }
    thead { display: none; }
    tbody tr { border: 1px solid var(--bord); margin-bottom: 10px; background: #fff; }
    td { border-bottom: 1px solid #f2f4f8; padding: 8px 10px; display: flex; justify-content: space-between; gap: 10px; }
    td:last-child { border-bottom: 0; }
    td::before {
        content: attr(data-col);
        font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
        color: #8a94a6; font-weight: 600;
        flex: 0 0 38%;
    }
    /* La valeur prend le reste et cède : une adresse longue ou une date
       s'échange contre une ligne de plus, pas contre un défilement. */
    td > * { min-width: 0; overflow-wrap: anywhere; }
    td.ref, td.montant { white-space: normal; }
    td.actions-libre { display: block; }
    td.actions-libre::before { display: block; margin-bottom: 6px; flex: initial; }

    /* Le champ du lien gardait une largeur minimale de 200 px, plus un
       flex-basis automatique : la boîte débordait la fiche de plusieurs
       dizaines de pixels. Il prend désormais la largeur utile, en entier. */
    .lien-boite { display: block; }
    .lien-boite input { flex: none; min-width: 0; width: 100%; }
    .lien-boite .btn, .lien-boite a { margin-top: 8px; }
    .forme-action { margin: 8px 8px 0 0; }
}
