/* ============================================================
   CRM PhotolikeByAlain : feuille de style de base (charte fine art).
   Couleurs, typographies et reperes communs a toutes les pages.
   ============================================================ */

/* Polices locales (a deposer dans assets/fonts/). Si les fichiers ne
   sont pas encore la, le navigateur utilise une police de repli propre. */
@font-face {
    font-family: "Cormorant Garamond";
    src: url("fonts/CormorantGaramond-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Cormorant Garamond";
    src: url("fonts/CormorantGaramond-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-display: swap;
}
@font-face {
    font-family: "DM Sans";
    src: url("fonts/DMSans-Regular.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "DM Sans";
    src: url("fonts/DMSans-Medium.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}

:root {
    --creme: #FDFAF7;
    --terracotta: #C4856A;
    --terracotta-fonce: #A96C52;
    --anthracite: #2E2823;
    --gris: #8A8078;
    --ligne: #E9E1D9;
    --blanc: #FFFFFF;

    --serif: "Cormorant Garamond", Cormorant, Garamond, Georgia, serif;
    --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--creme);
    color: var(--anthracite);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: .2px;
    margin: 0 0 .4em;
    line-height: 1.15;
}
h1 { font-size: 34px; }
h2 { font-size: 22px; color: var(--terracotta-fonce); }

a { color: var(--terracotta-fonce); }

.enveloppe {
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}
/* Variante large : pages de liste/synthese qui profitent de la largeur
   (tableaux, grilles), jamais les ecrans de saisie a texte long (garde 820px
   pour le confort de lecture, voir .champ ci-dessous qui plafonne quand meme
   les champs de texte meme sur une page en variante large). */
.enveloppe-large { max-width: 1160px; }
.enveloppe-large .champ input,
.enveloppe-large .champ select,
.enveloppe-large .champ textarea { max-width: 640px; }
.enveloppe-large .barre-filtres .champ-recherche { max-width: 420px; }

.marque {
    font-family: var(--serif);
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--terracotta);
    margin-bottom: 6px;
    text-decoration: none;
    display: inline-block;
}

.sous-titre {
    color: var(--gris);
    margin-top: -4px;
}

/* Trait fin de separation, pas d'ombre lourde ni de couleur criarde. */
.filet {
    height: 1px;
    background: var(--ligne);
    border: 0;
    margin: 28px 0;
}

.carte {
    background: var(--blanc);
    border: 1px solid var(--ligne);
    border-radius: 4px;
    padding: 26px 28px;
}

/* Empilement de 2 petites tuiles dans une seule case de .grille-cartes-info,
   pour un contenu trop court pour justifier une tuile pleine hauteur. */
.carte-empilee { display: flex; flex-direction: column; gap: 14px; }
.carte-mini { padding: 16px 18px; }
.carte-mini h2 { font-size: 16px; margin: 0 0 8px; }

.etat {
    display: inline-block;
    font-size: 13px;
    letter-spacing: .5px;
    padding: 4px 12px;
    border-radius: 3px;
    border: 1px solid var(--terracotta);
    color: var(--terracotta-fonce);
    background: #FBF4EF;
}
.etat.probleme {
    border-color: #B4544A;
    color: #B4544A;
    background: #FBEFED;
}

table.infos {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}
table.infos th,
table.infos td {
    text-align: left;
    padding: 9px 4px;
    border-bottom: 1px solid var(--ligne);
    font-size: 14px;
    vertical-align: top;
}
table.infos th {
    font-weight: 500;
    color: var(--gris);
    width: 42%;
    font-family: var(--sans);
}
table.infos td { font-variant-numeric: tabular-nums; }

.note {
    color: var(--gris);
    font-size: 13px;
    margin-top: 22px;
}

/* ---- En-tete et menu (pages connectees) ---- */
.entete-appli {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 32px;
    background: var(--blanc);
    border-bottom: 1px solid var(--ligne);
    flex-wrap: wrap;
}
.entete-marque .marque { margin: 0; }
.nav {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: 14px;
}
.nav a {
    color: var(--anthracite);
    text-decoration: none;
    padding-bottom: 3px;
    border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--terracotta-fonce); }
.nav a.actif {
    color: var(--terracotta-fonce);
    border-bottom-color: var(--terracotta);
}
.nav-deconnexion { color: var(--gris) !important; }

.pied-appli {
    text-align: center;
    color: var(--gris);
    font-size: 12px;
    letter-spacing: 1px;
    padding: 28px 0 40px;
}

/* ---- Formulaires ---- */
.champ {
    display: block;
    margin: 0 0 16px;
}
.champ > span {
    display: block;
    font-size: 13px;
    color: var(--gris);
    margin-bottom: 5px;
}
.champ input,
.champ select,
.champ textarea {
    width: 100%;
    font-family: var(--sans);
    font-size: 15px;
    color: var(--anthracite);
    background: var(--blanc);
    border: 1px solid var(--ligne);
    border-radius: 3px;
    padding: 10px 12px;
}
.champ input:focus,
.champ select:focus,
.champ textarea:focus {
    outline: none;
    border-color: var(--terracotta);
}

/* Barre de mise en forme (gras/italique/MAJ/terracotta) posee au-dessus
   d'un champ "corps" de mail : voir barre_mise_en_forme() dans fonctions.php. */
.barre-mise-en-forme { display: flex; gap: 4px; margin: 0 0 6px; }
.btn-mef {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--anthracite);
    background: var(--blanc);
    border: 1px solid var(--ligne);
    border-radius: 3px;
    padding: 4px 10px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(46, 40, 35, .10);
    transition: box-shadow .12s ease, border-color .12s ease, color .12s ease;
}
.btn-mef:hover { border-color: var(--terracotta); color: var(--terracotta); box-shadow: 0 2px 5px rgba(46, 40, 35, .14); }

.btn {
    font-family: var(--sans);
    font-size: 15px;
    cursor: pointer;
    border-radius: 3px;
    padding: 10px 22px;
    border: 1px solid var(--terracotta);
    background: var(--blanc);
    color: var(--terracotta-fonce);
    box-shadow: 0 1px 3px rgba(46, 40, 35, .12);
    transition: box-shadow .12s ease, background .12s ease;
}
.btn:hover { background: #FBF4EF; box-shadow: 0 3px 6px rgba(46, 40, 35, .16); }
.btn-primaire {
    background: var(--terracotta);
    color: var(--blanc);
}
.btn-primaire:hover { background: var(--terracotta-fonce); }

/* ---- Messages (sobres, pas de banniere criarde) ---- */
.message {
    font-size: 14px;
    padding: 10px 14px;
    border-radius: 3px;
    margin: 0 0 18px;
    border: 1px solid var(--ligne);
}
.message.erreur {
    border-color: #C89A90;
    color: #9B4A3D;
    background: #FBF1EF;
}
.message.succes {
    border-color: var(--terracotta);
    color: var(--terracotta-fonce);
    background: #FBF4EF;
}
.message.avertissement {
    border-color: #D9B48A;
    color: #8A6534;
    background: #FBF3E6;
}
.message.avertissement div { margin-top: 2px; }

/* ---- Ecran de connexion / creation de compte ---- */
.connexion-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    padding: 8vh 20px 40px;
}
.connexion-carte {
    width: 100%;
    max-width: 400px;
    background: var(--blanc);
    border: 1px solid var(--ligne);
    border-radius: 4px;
    padding: 34px 32px 30px;
}
.connexion-carte h1 { font-size: 28px; margin-top: 6px; }
.connexion-carte .btn { width: 100%; margin-top: 6px; }

/* ---- Titres avec actions a droite ---- */
.titre-ligne {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.titre-ligne h1 { margin: 0; }
.titre-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.formulaire-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }

.fil { color: var(--gris); font-size: 13px; margin: 0 0 6px; }
.fil a { color: var(--gris); }

/* ---- Barre de filtres / recherche ---- */
.barre-filtres {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    background: var(--blanc);
    border: 1px solid var(--ligne);
    border-radius: 4px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.barre-filtres .champ-recherche {
    flex: 1 1 260px;
    font-family: var(--sans);
    font-size: 15px;
    border: 1px solid var(--ligne);
    border-radius: 3px;
    padding: 9px 12px;
}
.barre-filtres select {
    font-family: var(--sans);
    font-size: 14px;
    border: 1px solid var(--ligne);
    border-radius: 3px;
    padding: 9px 10px;
    background: var(--blanc);
}
.barre-filtres .case {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--anthracite);
    white-space: nowrap;
}
.barre-filtres .case input { accent-color: var(--terracotta); }
.lien-discret { color: var(--gris); font-size: 13px; }
.compteur-resultats { color: var(--gris); font-size: 13px; margin: 0 0 12px; }

/* ---- Tableaux de donnees ---- */
.tableau {
    width: 100%;
    border-collapse: collapse;
    background: var(--blanc);
    border: 1px solid var(--ligne);
    border-radius: 4px;
    overflow: hidden;
}
.tableau th,
.tableau td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--ligne);
    font-size: 14px;
    vertical-align: middle;
}
.tableau thead th {
    font-family: var(--sans);
    font-weight: 500;
    font-size: 12px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--gris);
    background: #FBF7F3;
}
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tbody tr.cliquable { cursor: pointer; }
.tableau tbody tr.cliquable:hover { background: #FBF7F3; }
.tableau a { text-decoration: none; }
.tableau a:hover { text-decoration: underline; }
.tableau-defilant { overflow-x: auto; padding: 1px 4px 4px 1px; }

.discret { color: var(--gris); }
.date-action { color: var(--gris); font-size: 13px; white-space: nowrap; }
.date-action.en-retard { color: #9B4A3D; }
.notes-libres { white-space: pre-line; }

/* ---- Badges de statut (sobres) ---- */
.badge {
    display: inline-block;
    font-size: 11px;
    letter-spacing: .4px;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid var(--ligne);
    color: var(--gris);
    background: var(--creme);
    vertical-align: middle;
}
.badge-prospect     { border-color: #CBBBA6; color: #8A6E4B; background: color-mix(in srgb, #CBBBA6 16%, var(--creme)); }
.badge-devis_envoye { border-color: #B9A48C; color: #7D6E5E; background: color-mix(in srgb, #B9A48C 16%, var(--creme)); }
.badge-confirme     { border-color: var(--terracotta); color: var(--terracotta-fonce); background: color-mix(in srgb, var(--terracotta) 16%, var(--creme)); }
.badge-termine      { border-color: #A9B58F; color: #6B7A4B; background: color-mix(in srgb, #A9B58F 16%, var(--creme)); }
.badge-livre        { border-color: #9BB59A; color: #5B7A5B; background: color-mix(in srgb, #9BB59A 16%, var(--creme)); }
.badge-annule       { border-color: #C08476; color: #9B4A3D; background: color-mix(in srgb, #C08476 16%, var(--creme)); }
.badge-archive      { border-color: #CFCAC4; color: #9A938B; background: color-mix(in srgb, #CFCAC4 16%, var(--creme)); }
.badge-statut-fiche { font-size: 15px; padding: 4px 14px; letter-spacing: .6px; }
.etiquette {
    font-size: 10px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--gris);
    border: 1px solid var(--ligne);
    border-radius: 2px;
    padding: 1px 5px;
    margin-left: 6px;
}

/* ---- Badges de statut des devis ---- */
.badge-devis-brouillon { border-color: #CFCAC4; color: #9A938B; background: color-mix(in srgb, #CFCAC4 16%, var(--creme)); }
.badge-devis-envoye    { border-color: #B9A48C; color: #7D6E5E; background: color-mix(in srgb, #B9A48C 16%, var(--creme)); }
.badge-devis-accepte   { border-color: #9BB59A; color: #5B7A5B; background: color-mix(in srgb, #9BB59A 16%, var(--creme)); }
.badge-devis-refuse    { border-color: #C08476; color: #9B4A3D; background: color-mix(in srgb, #C08476 16%, var(--creme)); }
.badge-devis-expire    { border-color: #CBBBA6; color: #8A6E4B; background: color-mix(in srgb, #CBBBA6 16%, var(--creme)); }
.badge-devis-annule    { border-color: #CFCAC4; color: #9A938B; background: color-mix(in srgb, #CFCAC4 16%, var(--creme)); }

.badge-facture-brouillon { border-color: #CFCAC4; color: #9A938B; background: color-mix(in srgb, #CFCAC4 16%, var(--creme)); }
.badge-facture-envoyee   { border-color: #B9A48C; color: #7D6E5E; background: color-mix(in srgb, #B9A48C 16%, var(--creme)); }
.badge-facture-annulee   { border-color: #C08476; color: #9B4A3D; background: color-mix(in srgb, #C08476 16%, var(--creme)); }
.badge-paiement-impayee   { border-color: #C08476; color: #9B4A3D; background: color-mix(in srgb, #C08476 16%, var(--creme)); }
.badge-paiement-partielle { border-color: #CBBBA6; color: #8A6E4B; background: color-mix(in srgb, #CBBBA6 16%, var(--creme)); }
.badge-paiement-soldee    { border-color: #9BB59A; color: #5B7A5B; background: color-mix(in srgb, #9BB59A 16%, var(--creme)); }
.badge-paiement-avoir_solde { border-color: #B9A48C; color: #7D6E5E; background: color-mix(in srgb, #B9A48C 16%, var(--creme)); }
.badge-paiement-en_cours  { border-color: var(--ligne); color: var(--gris); }

/* ---- Pilule actif/desactive (liste clients) : fond plein, tres arrondie,
   pensee pour un clic direct (contrairement aux badges, purement informatifs). ---- */
.pilule {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .3px;
    padding: 4px 14px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    color: #fff;
    box-shadow: 0 1px 3px rgba(46, 40, 35, .15);
    transition: background .12s ease, box-shadow .12s ease;
}
.pilule-actif   { background: #7FA36F; }
.pilule-actif:hover   { background: #6C9060; box-shadow: 0 3px 6px rgba(46, 40, 35, .20); }
.pilule-inactif { background: var(--terracotta-fonce); }
.pilule-inactif:hover { background: #8F5A42; box-shadow: 0 3px 6px rgba(46, 40, 35, .20); }
.badge-paiement-en_cours .puce, .badge-paiement-impayee .puce,
.badge-paiement-partielle .puce, .badge-paiement-soldee .puce,
.badge-paiement-avoir_solde .puce { margin-right: 3px; font-size: 9px; vertical-align: 1px; }

/* ---- Colonnes numeriques ---- */
.col-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- Formulaire de devis : lignes ---- */
.ajout-ligne { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.ajout-ligne select { font-family: var(--sans); font-size: 14px; border: 1px solid var(--ligne); border-radius: 3px; padding: 8px 10px; background: var(--blanc); min-width: 260px; }
.tableau-lignes td { vertical-align: top; }
.tableau-lignes input[type="text"] {
    font-family: var(--sans);
    font-size: 14px;
    color: var(--anthracite);
    border: 1px solid var(--ligne);
    border-radius: 3px;
    padding: 7px 9px;
}
.tableau-lignes .l-libelle { width: 100%; }
.tableau-lignes .l-qte, .tableau-lignes .l-pu { width: 92px; text-align: right; }
.tableau-lignes .l-unite { color: var(--gris); font-size: 12px; margin-left: 4px; }
.tableau-lignes .total-libelle { text-align: right; font-weight: 500; }
.tableau-lignes .l-taux { width: 66px; text-align: right; }
/* Colonne et totaux de TVA masques tant que le devis est a 0 %. */
.tableau-lignes:not(.avec-tva) .colonne-tva { display: none; }
.tableau-lignes:not(.avec-tva) .colonne-tva-row { display: none; }
.tableau-lignes.avec-tva .total-simple { display: none; }
.tableau-lignes tfoot td { border-top: 2px solid var(--ligne); font-size: 15px; }
.radio-ligne { display: block; font-size: 14px; margin: 2px 0; }
.radio-ligne input { accent-color: var(--terracotta); margin-right: 4px; }
/* ---- Echeancier (formulaire) ---- */
.tableau-echeances td { vertical-align: middle; }
.tableau-echeances input[type="text"], .tableau-echeances input[type="date"] {
    font-family: var(--sans);
    font-size: 14px;
    color: var(--anthracite);
    border: 1px solid var(--ligne);
    border-radius: 3px;
    padding: 7px 9px;
    width: 100%;
}
.tableau-echeances .col-date { width: 42mm; }
.tableau-echeances .e-montant { text-align: right; width: 34mm; }
.echeance-pied { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 12px; }

.ligne-statut { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ligne-statut select { font-family: var(--sans); font-size: 14px; border: 1px solid var(--ligne); border-radius: 3px; padding: 8px 10px; background: var(--blanc); }

/* ---- Disposition en deux colonnes ---- */
.grille-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.grille-3 {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 18px;
}
@media (max-width: 680px) {
    .grille-2 { grid-template-columns: 1fr; }
    .grille-3 { grid-template-columns: 1fr; }
}
.grille-cartes-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}
.grille-cartes-info + .carte { margin-top: 18px; }
.barre-progression {
    width: 100%;
    height: 10px;
    background: var(--ligne, #E9E1D9);
    border-radius: 5px;
    overflow: hidden;
}
.barre-progression-remplie {
    height: 100%;
    background: var(--terracotta);
    border-radius: 5px;
}
.agenda-grille {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.agenda-grille th {
    text-align: left;
    font-size: 12px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--gris);
    font-weight: 500;
    padding: 6px 8px;
    border-bottom: 1px solid var(--ligne);
}
.agenda-case {
    vertical-align: top;
    width: 14.28%;
    height: 90px;
    padding: 6px 8px;
    border: 1px solid var(--ligne);
}
.agenda-case.hors-mois { background: #FBF8F5; color: var(--gris); }
.agenda-case.aujourdhui { background: #FBF2ED; border-color: var(--terracotta); }
.agenda-numero { font-size: 13px; color: var(--gris); margin-bottom: 4px; display: flex; align-items: center; }
.agenda-devis {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 7px;
    margin-bottom: 4px;
    border-radius: 5px;
    background: var(--creme);
    border: 1px solid var(--ligne);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: transform .12s ease, background .12s ease;
}
.agenda-devis-clos { color: var(--gris); font-style: italic; border-left: 6px solid var(--ligne); }
.agenda-legende { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--anthracite); margin: 10px 0 14px; }
.agenda-legende span { display: inline-flex; align-items: center; gap: 6px; }
.agenda-puce { display: inline-block; width: 14px; height: 14px; border-radius: 50%; }

/* ---- Agenda 3 colonnes : tuiles compactes a gauche/droite, calendrier au
   centre. Se reempile en une colonne sous 900px (telephone/tablette). ---- */
.agenda-3col { display: grid; grid-template-columns: 160px minmax(0, 1fr) 160px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .agenda-3col { grid-template-columns: 1fr; } }
.agenda-cote { display: flex; flex-direction: column; gap: 14px; }
.agenda-tuile { background: var(--blanc); border: 1px solid var(--ligne); border-radius: 10px; padding: 12px 13px; box-shadow: 0 1px 3px rgba(46, 40, 35, .07); }
.agenda-tuile-tete { display: flex; align-items: center; gap: 7px; font-family: var(--serif); font-weight: 600; font-size: 15px; margin-bottom: 9px; }
.agenda-tuile-tete .agenda-puce { width: 11px; height: 11px; flex: none; }
.agenda-tuile-compte { color: var(--gris); font-size: 12px; font-weight: 400; margin-left: auto; }
.agenda-tuile-liste { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.agenda-tuile-item { display: flex; flex-direction: column; padding: 5px 7px; border-radius: 6px; text-decoration: none; color: inherit; border-left: 3px solid var(--ligne); }
.agenda-tuile-item:hover { background: #FBF4EF; }
.agenda-tuile-item .d { font-size: 11px; color: var(--gris); font-variant-numeric: tabular-nums; }
.agenda-tuile-item .n { font-size: 13px; font-weight: 500; }
.agenda-tuile-vide { color: var(--gris); font-size: 12.5px; font-style: italic; margin: 2px 4px; }
.agenda-devis-clic { cursor: pointer; }
.agenda-devis-clic:hover { border-color: var(--terracotta); transform: translateY(-1px); }
.agenda-case-clic { cursor: pointer; }
.agenda-note-indicateur { margin-left: 6px; font-size: 20px; line-height: 1; }
#agenda-note-overlay .agenda-popup { max-width: 380px; }
.agenda-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(46, 40, 35, 0.35);
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.agenda-popup-overlay.visible { display: flex; }
.agenda-popup {
    position: relative;
    background: var(--creme);
    border: 1px solid var(--ligne);
    border-radius: 4px;
    padding: 24px 28px;
    max-width: 320px;
    width: 90%;
}
.agenda-popup h3 { margin: 0 0 10px; }
.agenda-popup-fermer {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: var(--anthracite);
    cursor: pointer;
}
.sous-section {
    font-size: 15px;
    color: var(--anthracite);
    margin: 22px 0 6px;
    padding-top: 14px;
    border-top: 1px solid var(--ligne);
}
code {
    font-family: "DM Mono", Consolas, monospace;
    font-size: 13px;
    background: #F4EEE8;
    padding: 1px 5px;
    border-radius: 2px;
    color: var(--terracotta-fonce);
}
.carte + .carte,
.grille-2 + .carte,
.carte + .grille-2 { margin-top: 18px; }

.formulaire { margin-top: 8px; }

/* ---- Bouton de suppression ---- */
.btn-danger { border-color: #C08476; color: #9B4A3D; }
.btn-danger:hover { background: #FBF1EF; }

/* ---- Onglets de filtre ---- */
.onglets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--ligne);
    margin-bottom: 16px;
}
.onglet {
    text-decoration: none;
    color: var(--gris);
    font-size: 14px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    margin-bottom: -1px;
}
.onglet:hover { color: var(--terracotta-fonce); }
.onglet.actif {
    color: var(--anthracite);
    background: var(--blanc);
    border-color: var(--ligne);
    border-bottom-color: var(--blanc);
}
.onglet-compte { color: var(--gris); font-size: 12px; }

/* ---- Liens de tri dans les en-tetes ---- */
.tableau thead .tri {
    color: var(--gris);
    text-decoration: none;
}
.tableau thead .tri:hover { color: var(--terracotta-fonce); }
.tableau thead .tri.actif { color: var(--terracotta-fonce); text-decoration: underline; }

/* ---- Texte enrichi (descriptions), identique a l'ecran et a l'impression ---- */
.texte-riche strong { font-weight: 600; }
.texte-riche p { margin: 0 0 .5em; }
.texte-riche p:last-child { margin-bottom: 0; }
.texte-riche ul {
    margin: .3em 0 .6em;
    padding-left: 1.3em;
    list-style: disc;
}
.texte-riche li { margin: .12em 0; }

/* ---- Petit editeur de texte enrichi ---- */
.editeur-riche {
    border: 1px solid #D3C7B8;
    border-radius: 3px;
    background: var(--blanc);
}
.editeur-riche:focus-within { border-color: var(--terracotta); }
.editeur-barre {
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--ligne);
    background: #FBF7F3;
}
.editeur-barre button {
    font-family: var(--sans);
    font-size: 13px;
    line-height: 1;
    padding: 5px 10px;
    border: 1px solid var(--ligne);
    border-radius: 3px;
    background: var(--blanc);
    color: var(--anthracite);
    cursor: pointer;
}
.editeur-barre button:hover { background: #F4EEE8; border-color: var(--terracotta); }
.editeur-zone {
    min-height: 130px;
    padding: 10px 12px;
    font-size: 15px;
    color: var(--anthracite);
    outline: none;
}

/* Dans le catalogue, prix / etat / actions restent alignes en haut,
   au niveau du nom, meme si la description est longue. */
.tableau.haut td { vertical-align: top; }

/* ---- Catalogue ---- */
.titre-categorie { margin: 28px 0 8px; }
/* Nom, prix, etat et actions sur une meme ligne ; description dessous. */
.ligne-principale.avec-details td { border-bottom: 0; padding-bottom: 4px; }
.ligne-details td { border-top: 0; padding-top: 0; padding-bottom: 16px; }
.ligne-details .texte-riche { max-width: 70ch; }
.col-prix { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-case { width: 32px; text-align: center; }
.col-actions { white-space: nowrap; }
.col-actions a, .col-actions form { display: inline; }
.col-actions > * { margin-right: 14px; }
.col-actions > *:last-child { margin-right: 0; }
.tableau tr.inactif td { color: var(--gris); }
.tableau tr.inactif strong { font-weight: 400; }
.petite { font-size: 12px; margin-top: 2px; }
.regle-vente { color: var(--terracotta-fonce); }
.en-ligne { display: inline; }
.liste-cases {
    display: flex;
    flex-direction: column;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--ligne);
    border-radius: 3px;
    padding: 8px 10px;
    background: var(--blanc);
}
.liste-cases .case {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    padding: 4px 0;
    font-size: 14px;
    text-align: left;
}
/* Les cases a cocher ne doivent pas heriter du style pleine largeur
   des champs texte (.champ input). */
.liste-cases .case input[type="checkbox"] {
    width: auto;
    flex: none;
    padding: 0;
    border: 0;
    margin: 3px 0 0;
    accent-color: var(--terracotta);
}
.lien-bouton {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: var(--terracotta-fonce);
    cursor: pointer;
    text-decoration: none;
}
.lien-bouton:hover { text-decoration: underline; }
.lien-danger { color: #9B4A3D; text-decoration: none; }
.lien-danger:hover { text-decoration: underline; }
.case-champ {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    align-self: end;
    padding-bottom: 10px;
}
.case-champ input { accent-color: var(--terracotta); }

/* Groupe de choix (case a cocher/bouton radio) d'un questionnaire, en
   "puces" cliquables plutot qu'une case + texte alignes un par ligne : se
   rangent naturellement plusieurs par ligne quand le texte est court, une
   option longue prend la place qu'il lui faut. Purement visuel, aucune
   incidence sur les valeurs envoyees/enregistrees (meme nom de champ, meme
   value). Meme principe deja utilise sur le storyboard (.sb-chip). */
.groupe-choix { display: flex; flex-wrap: wrap; gap: 8px; }
.choix-chip { position: relative; }
.choix-chip input { position: absolute; opacity: 0; pointer-events: none; }
.choix-chip label {
    display: inline-block;
    border: 1px solid var(--ligne);
    background: var(--creme);
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(46, 40, 35, .10);
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.choix-chip input:checked + label { background: var(--terracotta); border-color: var(--terracotta); color: #fff; box-shadow: 0 2px 5px rgba(46, 40, 35, .18); }
.choix-chip input:focus-visible + label { outline: 2px solid var(--terracotta-fonce); outline-offset: 2px; }

/* ---- Detail question/reponse d'un questionnaire (admin et client, lecture
   seule dans les deux cas) : un petit bloc par question plutot qu'un texte
   nu, question en accent terracotta, reponse mise en valeur. ---- */
/* Colonnes CSS : remplissent chaque colonne densement (contrairement a une
   grille ou un flux en ligne, qui laissent de grands vides des qu'un bloc
   est plus haut que ses voisins). Seule imperfection connue : un bloc isole
   peut parfois basculer seul en page suivante a l'impression meme s'il
   restait un peu de place -- accepte comme moindre mal face aux grands vides
   des autres approches testees. */
.qr-liste {
    column-width: 260px;
    column-gap: 18px;
}
.qr-bloc {
    background: var(--creme);
    border: 1px solid var(--ligne);
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 12px;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
}
@media print {
    .qr-liste { column-fill: auto; }
}
.qr-bloc .qr-question {
    font-family: var(--serif);
    font-weight: 600;
    color: var(--terracotta-fonce);
    font-size: 16px;
    margin: 0 0 8px;
}
.qr-bloc .qr-reponse { margin: 0; white-space: pre-line; }
.qr-bloc .qr-vide { color: var(--gris); font-style: italic; margin: 0; }

/* ---- Liste des questionnaires envoyes a un couple (fiche admin et espace
   client) : tuiles plutot qu'un tableau plat, titre/date a gauche, statut et
   action a droite. ---- */
.qe-liste { display: flex; flex-direction: column; gap: 10px; }
.qe-tuile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--blanc);
    border: 1px solid var(--ligne);
    border-radius: 6px;
    padding: 12px 16px;
}
.qe-tuile .qe-titre { font-weight: 500; }
.qe-tuile .qe-date { color: var(--gris); font-size: 12.5px; margin-top: 2px; }
.qe-tuile .qe-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* ---- Sequence de mails (fiche client) : tuiles plutot qu'un tableau plat,
   meme esprit que .qe-liste/.qe-tuile pour les questionnaires. ---- */
.mail-liste { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; align-items: start; }
.mail-tuile {
    background: var(--blanc);
    border: 1px solid var(--ligne);
    border-left: 4px solid var(--ligne);
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 1px 4px rgba(46, 40, 35, .10);
    transition: box-shadow .12s ease;
}
.mail-tuile:hover { box-shadow: 0 3px 8px rgba(46, 40, 35, .14); }
.mail-tuile.statut-en_attente { border-left-color: var(--terracotta); background: color-mix(in srgb, var(--terracotta) 4%, var(--blanc)); }
.mail-tuile.statut-en_cours   { border-left-color: #B9A48C; background: color-mix(in srgb, #B9A48C 5%, var(--blanc)); }
.mail-tuile.statut-envoye     { border-left-color: #9BB59A; background: color-mix(in srgb, #9BB59A 4%, var(--blanc)); }
.mail-tuile.statut-erreur     { border-left-color: #C08476; background: color-mix(in srgb, #C08476 5%, var(--blanc)); }
.mail-tuile.statut-annule     { border-left-color: var(--gris); background: color-mix(in srgb, var(--gris) 4%, var(--blanc)); }
.mail-tuile-haut { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.mail-tuile-objet { font-family: var(--serif); font-weight: 600; font-size: 16px; }
.mail-tuile-date { color: var(--gris); font-size: 12px; margin-top: 3px; }
.mail-tuile-bas { display: flex; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--ligne); flex-wrap: wrap; }
.mail-tuile-bas .lien-bouton {
    display: inline-block;
    padding: 4px 11px;
    border: 1px solid var(--ligne);
    border-radius: 20px;
    font-size: 12.5px;
    background: var(--blanc);
    box-shadow: 0 1px 2px rgba(46, 40, 35, .06);
    transition: box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.mail-tuile-bas .lien-bouton:hover { border-color: var(--terracotta); box-shadow: 0 2px 4px rgba(46, 40, 35, .10); text-decoration: none; }
.mail-tuile-bas .lien-bouton.principal {
    font-weight: 600;
    color: var(--terracotta-fonce);
    border-color: var(--terracotta);
    background: color-mix(in srgb, var(--terracotta) 10%, var(--blanc));
}
.mail-tuile.envoye { opacity: .72; }
.mail-tuile.envoye .mail-tuile-objet { text-decoration: line-through; }
.puce-perso {
    display: inline-block;
    font-size: 10px;
    padding: 1px 8px;
    border-radius: 20px;
    background: color-mix(in srgb, var(--terracotta) 16%, var(--creme));
    color: var(--terracotta-fonce);
    border: 1px solid var(--terracotta);
    margin-left: 8px;
    vertical-align: 1px;
}

/* ---- Etiquettes de tags ---- */
.tags-ligne { margin: 2px 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
    display: inline-block;
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 999px;
    background: #F4EEE8;
    border: 1px solid var(--ligne);
    color: var(--terracotta-fonce);
}

/* ---- Impression : jamais le menu, le pied de page ni les boutons d'action ---- */
@media print {
    .entete-appli, .pied-appli, .titre-actions, .fil, .formulaire-actions { display: none !important; }
}
