:root {
    --pb-dark: #0a0a14;
    --pb-lime: #d4ff1f;
    --pb-bg: #f7f7f9;
    --pb-white: #ffffff;
    --pb-border: #e4e4ea;
    --pb-text: #16161f;
    --pb-text-muted: #6b6b78;
    --pb-danger: #c0392b;
    --pb-success: #1f8a4c;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--pb-bg);
    color: var(--pb-text);
}

a { color: var(--pb-text); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--pb-dark);
    padding: 14px 28px;
}
.topbar img { height: 28px; }
.topbar nav { display: flex; align-items: center; }
.topbar nav a {
    color: #d8d8e2;
    text-decoration: none;
    margin-left: 24px;
    font-size: 17px;
    font-weight: 500;
}
.topbar nav a:hover, .topbar nav a.actif { color: var(--pb-lime); }
.topbar .compte { color: #9c9caa; font-size: 15px; font-weight: 600; margin-left: 0; }
.selecteur-langue { margin-left: 20px; padding-left: 20px; border-left: 1px solid #33333f; }
.selecteur-langue a {
    margin-left: 8px;
    display: inline-block;
    line-height: 0;
    opacity: 0.45;
    filter: grayscale(60%);
    transition: opacity 0.15s, filter 0.15s;
}
.selecteur-langue a:first-child { margin-left: 0; }
.selecteur-langue a:hover { opacity: 0.8; }
.selecteur-langue a.actif { opacity: 1; filter: none; }
.selecteur-langue .drapeau {
    width: 22px;
    height: auto;
    border-radius: 2px;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.selecteur-langue-login {
    margin: 0 0 16px;
    padding: 0;
    border-left: none;
    text-align: center;
}
.selecteur-langue-login a { margin: 0 6px; }
.selecteur-langue-login a:first-child { margin-left: 0; }
.selecteur-langue-login .drapeau { width: 28px; box-shadow: 0 0 0 1px var(--pb-border); }

.conteneur {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}

.carte {
    background: var(--pb-white);
    border: 1px solid var(--pb-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.page-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pb-dark);
}
.page-login .carte { width: 360px; }
.page-login .logo { display: block; margin: 0 auto 24px; height: 32px; }

h1, h2, h3 { font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }

label { display: block; font-size: 13px; margin: 12px 0 4px; color: var(--pb-text-muted); }
input:not([type="radio"]):not([type="checkbox"]), select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--pb-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}
input[type="radio"], input[type="checkbox"] {
    width: auto;
    accent-color: var(--pb-dark);
}

.btn {
    display: inline-block;
    background: var(--pb-dark);
    color: var(--pb-white);
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    margin-top: 16px;
    margin-bottom: 16px;
}
.btn:hover { opacity: 0.9; }
.btn.secondaire { background: transparent; color: var(--pb-text); border: 1px solid var(--pb-border); }
.btn.danger { background: var(--pb-danger); }
.btn.lime { background: var(--pb-lime); color: var(--pb-dark); }
/* Etat "selectionne" d'un bouton secondaire (ex. filtre de statut actif) —
   rempli en fonce plutot que le lime des CTA, pour ne pas melanger les deux
   sens ("action a faire" vs "filtre actuellement applique"). */
.btn.secondaire.actif { background: var(--pb-dark); color: var(--pb-white); border-color: var(--pb-dark); }

.actions-rapides, .filtres-statut { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.actions-rapides .btn, .filtres-statut .btn { margin: 0; }

.site-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    padding: 10px 20px;
    color: var(--pb-text-muted);
    font-size: 13px;
    background: var(--pb-white);
    border-top: 1px solid var(--pb-border);
    z-index: 10;
}
/* Marge basse pour que le contenu ne passe jamais sous le footer fixe. */
.conteneur { padding-bottom: 60px; }
.page-login { padding-bottom: 60px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--pb-text-muted); font-weight: 600; padding: 8px; border-bottom: 2px solid var(--pb-border); }
td { padding: 8px; border-bottom: 1px solid var(--pb-border); vertical-align: middle; }
tr:hover td { background: #fafafb; }
td .btn, td form { margin-top: 0; margin-bottom: 0; }

/* Lignes du devis (detail) : alternance de fond pour mieux separer chaque
   ligne dans un tableau qui peut compter beaucoup de composants. */
.table-lignes-devis tr:nth-child(even) td { background: #fafafb; }
.table-lignes-devis tr:hover td { background: #f0f0f3; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.brouillon { background: #eee; color: #666; }
.badge.emis { background: #fff3cd; color: #8a6d00; }
.badge.commande { background: #d9f2e1; color: var(--pb-success); }
.badge.annule { background: #fbe1de; color: var(--pb-danger); }
.badge.expire { background: #eee; color: #999; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.flash.erreur { background: #fbe1de; color: var(--pb-danger); }
.flash.succes { background: #d9f2e1; color: var(--pb-success); }
.flash.info { background: #eef2ff; color: #364fc7; }

.mailto-aide { font-size: 13px; color: var(--pb-text-muted); text-align: center; margin-top: 14px; }
.mailto-aide a { color: var(--pb-text-muted); }

.grille-cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.grille-cartes .carte { text-align: center; }
.grille-cartes .chiffre { font-size: 28px; font-weight: 700; }
.grille-cartes .libelle { color: var(--pb-text-muted); font-size: 13px; }

/* Calculateur : composants a gauche, recapitulatif des prix flottant a
   droite (toujours visible, comme un panier de reservation), plutot qu'un
   bloc de totaux perdu tout en bas d'une longue page. */
.calculateur-layout { display: flex; align-items: flex-start; gap: 18px; }
.calculateur-principal { flex: 1; min-width: 0; }
.recap-flottant { width: 260px; flex-shrink: 0; position: sticky; top: 20px; }
.recap-flottant .carte { margin-bottom: 0; }
.recap-ligne {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--pb-border);
}
.recap-ligne:last-of-type { border-bottom: none; }
.recap-ligne .libelle { color: var(--pb-text-muted); font-size: 13px; }
.recap-ligne .valeur { font-weight: 700; font-size: 15px; white-space: nowrap; }
.recap-ligne.principal {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 14px 0;
}
.recap-ligne.principal .libelle { color: var(--pb-text); font-weight: 600; width: 100%; }
.recap-ligne.principal .ligne-montant { display: flex; align-items: baseline; gap: 6px; flex-wrap: nowrap; }
.recap-ligne.principal .valeur { font-size: 18px; color: var(--pb-dark); white-space: nowrap; }
.recap-ligne.principal .pourcentage-remise { font-size: 18px; font-weight: 700; white-space: nowrap; }

@media (max-width: 860px) {
    .calculateur-layout { flex-direction: column; }
    .recap-flottant { width: 100%; position: static; }
}

/* Liste des composants du calculateur : deux lignes par composant plutot
   qu'une seule ligne de tableau a 8 colonnes etroites (qui forcait un
   scroll horizontal) — une ligne d'identification/reference (prix
   catalogue), une ligne d'action (quantite/remise/prix retenu). */
.liste-composants { border: 1px solid var(--pb-border); border-radius: 8px; overflow: hidden; }
.entete-composants, .ligne-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
}
.entete-composants {
    padding: 10px 14px;
    background: #fafafb;
    border-bottom: 2px solid var(--pb-border);
    font-size: 12px;
    font-weight: 600;
    color: var(--pb-text-muted);
}
.col-ref { flex: 0 0 120px; }
.col-designation { flex: 1; min-width: 0; }
.col-prix { flex: 0 0 100px; text-align: right; white-space: nowrap; }
.ligne-composant { padding: 10px 14px; border-bottom: 1px solid var(--pb-border); }
.ligne-composant:last-child { border-bottom: none; }
/* Alternance de fond pour separer chaque bloc de 2 lignes (info + action)
   d'un composant a l'autre — sans ca les lignes fusionnaient visuellement
   dans une longue liste. */
.ligne-composant:nth-of-type(even) { background: #fafafb; }
.ligne-composant:nth-of-type(odd) { background: var(--pb-white); }
.ligne-info { font-size: 13px; }
.ligne-info .col-ref { color: var(--pb-text-muted); }
/* Grille a colonnes fixes (identiques sur toutes les lignes) pour que Qte /
   Remise / Prix retenu tombent exactement a la meme position d'une ligne de
   composant a l'autre. La bordure du haut ne dessine ainsi une separation
   qu'a l'endroit de cette grille (de Qte a Prix retenu), pas sur toute la
   largeur de la carte. */
.ligne-action {
    display: grid;
    grid-template-columns: 34px 60px 68px 82px 76px 100px 46px;
    column-gap: 8px;
    align-items: center;
    width: fit-content;
    margin-left: auto;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--pb-border);
}
.ligne-action .champ { display: contents; }
.ligne-action label { margin: 0; font-size: 12px; color: var(--pb-text-muted); white-space: nowrap; text-align: center; }
.ligne-action input[type="number"] { width: 100%; text-align: center; padding: 6px 4px; }
.ligne-action .qte-fixe {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}
.ligne-action .sous-total-ligne { font-weight: 700; white-space: nowrap; text-align: center; }
.ligne-action .pourcentage-remise { font-size: 12px; color: var(--pb-danger); text-align: left; white-space: nowrap; }

@media (max-width: 640px) {
    .entete-composants { display: none; }
    .ligne-info { flex-wrap: wrap; }
    .ligne-action {
        grid-template-columns: 30px 1fr 60px 1fr 70px 1fr 46px;
        width: 100%;
        margin-left: 0;
    }
}
