/**********************************************************************************
 * PhxContacts - feuille de style modernisée
 * Reprend les bleus d'origine (#D9E3FF, #ECF4FF) avec un texte plus grand
 * et des boutons plus faciles à viser.
 *********************************************************************************/

:root {
    --papier: #f3f5f9;
    --blanc: #ffffff;
    --encre: #1e2633;
    --encre-douce: #5a6372;
    --bleu: #2d4f8e;
    --bleu-fonce: #1f3a6d;
    --bleu-pale: #dce4f7;
    --survol: #eef3fd;
    --trait: #c8d2e5;
    --rouge: #b42318;
    --rouge-pale: #fdecea;
    --vert: #23733a;
    --vert-pale: #e7f4ea;
    --jaune-pale: #fff6d6;
    --rayon: 6px;
    --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--police);
    line-height: 1.45;
    color: var(--encre);
    background: var(--papier);
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #7aa2ef; outline-offset: 2px; }

img { vertical-align: middle; }
mark { background: #ffe58a; color: inherit; padding: 0 .1em; border-radius: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.centre { text-align: center; }
.petit { font-size: .875rem; color: var(--encre-douce); }
.gras { font-weight: 700; }
.barre { text-decoration: line-through; color: var(--encre-douce); }

/* ---------------------------------------------------------------- En-tête */
.entete {
    padding: 1rem 0 .75rem;
    border-bottom: 1px solid var(--trait);
    margin-bottom: 1.25rem;
}
.entete-haut {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: .5rem 2rem;
}
.titre_top {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: #6b717c;
    line-height: 1.1;
}
a.titre_top:hover { text-decoration: none; color: var(--encre); }
.bonjour { margin: 0; font-size: .9rem; color: var(--encre-douce); text-align: right; }
.bonjour strong { color: var(--encre); }

.barre-icones {
    display: flex;
    gap: .25rem;
    margin-top: .75rem;
}
.barre-icones a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    min-width: 5.5rem;
    padding: .45rem .5rem .35rem;
    border-radius: var(--rayon);
    color: var(--encre);
    font-size: .85rem;
    border: 1px solid transparent;
}
.barre-icones a:hover { background: var(--blanc); border-color: var(--trait); text-decoration: none; }
.barre-icones a.actif { background: var(--blanc); border-color: var(--bleu); box-shadow: inset 0 -3px 0 var(--bleu); }

.liens-compte {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1.25rem;
    margin-top: .6rem;
    font-size: .9rem;
}

.entete-login { text-align: center; border: 0; padding-top: 2.5rem; }

/* ------------------------------------------------------------- Bandeaux */
.bandeau {
    padding: .7rem 1rem;
    border-radius: var(--rayon);
    margin: 0 0 1rem;
    font-weight: 600;
    border-left: 4px solid;
}
.bandeau-ok   { background: var(--vert-pale); color: var(--vert); border-color: var(--vert); }
.bandeau-info { background: var(--survol); color: var(--bleu-fonce); border-color: var(--bleu); }
.bandeau-erreur { background: var(--rouge-pale); color: var(--rouge); border-color: var(--rouge); font-weight: 400; }

/* ---------------------------------------------------------------- Cartes */
.carte {
    background: var(--blanc);
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    padding: 1.25rem 1.5rem 1.5rem;
    margin: 0 auto 1.25rem;
    max-width: 760px;
}
.carte-etroite { max-width: 560px; }
.Titre, .carte h1 {
    font-size: 1.3rem;
    margin: 0 0 1rem;
    color: var(--encre);
}
.erreur h1 { color: var(--rouge); }
.icone-carte { float: right; margin: 0 0 .5rem 1rem; }

/* ----------------------------------------------------------- Formulaires */
.formulaire .champ { margin-bottom: .9rem; }
.ligne-champs { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.ligne-champs .champ { flex: 1 1 14rem; }
.ligne-champs .champ-court { flex: 0 0 auto; }
.champ-large { flex-basis: 100%; }

label {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    margin-bottom: .25rem;
}
label.obligatoire, span.obligatoire { color: var(--rouge); }
label.obligatoire::after, span.obligatoire::before { content: " *"; }
span.obligatoire::before { content: "*"; }

input[type=text], input[type=email], input[type=password], input[type=search], input[type=number],
select, textarea {
    font: inherit;
    font-size: 1rem;
    color: var(--encre);
    background: var(--blanc);
    border: 1px solid #9aa6bd;
    border-radius: 4px;
    padding: .45rem .6rem;
    width: 100%;
    max-width: 28rem;
}
input.court { width: 7rem; }
textarea { max-width: 100%; resize: vertical; min-height: 6rem; }
input:focus, select:focus, textarea:focus { border-color: var(--bleu); outline: 2px solid #b9cbf1; outline-offset: 0; }
input[type=file] { font: inherit; margin: .25rem 0 .5rem; }
.valeur-fixe { margin: 0; padding: .45rem 0; }

fieldset {
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    padding: .75rem 1rem .25rem;
    margin: 1rem 0;
}
legend { font-weight: 700; padding: 0 .4rem; }

/* -------------------------------------------------------------- Boutons */
.actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
    margin-top: 1rem;
}
.actions form { margin: 0; }
.actions.centre { justify-content: center; }

.bouton, button {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font: inherit;
    font-size: .95rem;
    font-weight: 600;
    padding: .5rem 1rem;
    min-height: 2.5rem;
    border-radius: var(--rayon);
    border: 1px solid #9aa6bd;
    background: var(--blanc);
    color: var(--encre);
    cursor: pointer;
    text-decoration: none;
}
.bouton:hover, button:hover { background: var(--survol); text-decoration: none; }
.bouton-principal { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.bouton-principal:hover { background: var(--bleu-fonce); }
.bouton-danger { color: var(--rouge); border-color: #e3a19b; }
.bouton-danger:hover { background: var(--rouge-pale); }
.bouton-autre-carnet { background: var(--rouge); border-color: var(--rouge); color: #fff; margin-top: .5rem; }
.bouton-autre-carnet:hover { background: #8f1c13; }

/* ------------------------------------------------- Liste : recherche */
.barre-recherche {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .75rem 1.5rem;
    background: var(--blanc);
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
    padding: .75rem 1rem;
    margin-bottom: 1rem;
}
.barre-recherche .groupe { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.barre-recherche label { display: inline; margin: 0; }
.barre-recherche input[type=search] { width: 16rem; }
.barre-recherche select { width: auto; }
.barre-recherche input.court { width: 4.5rem; }

/* ---------------------------------------------------- Liste : tableau */
.tableau-conteneur {
    overflow-x: auto;
    background: var(--blanc);
    border: 1px solid var(--trait);
    border-radius: var(--rayon);
}
table.liste { width: 100%; border-collapse: collapse; font-size: 1rem; }
table.liste th {
    background: var(--bleu-pale);
    text-align: left;
    font-size: .9rem;
    padding: .55rem .75rem;
    position: sticky;
    top: 0;
    white-space: nowrap;
}
table.liste th.trie { box-shadow: inset 0 -3px 0 var(--bleu); }
.aTableMenu { color: var(--encre); font-weight: 700; }
table.liste td { padding: .55rem .75rem; border-top: 1px solid #e6ebf4; }
table.liste tbody tr:nth-child(even) { background: #f8faff; }
table.liste tbody tr[data-href] { cursor: pointer; }
table.liste tbody tr:hover { background: var(--survol); }
table.liste td a { font-weight: 600; }
td.numero { font-variant-numeric: tabular-nums; white-space: nowrap; }
.icone-col { width: 2rem; text-align: center; }
.liste-admin input, .liste-admin select { max-width: 14rem; }

.sous-liste { text-align: center; margin-top: 1rem; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem; margin: .5rem 0; }
.pagination a, .pagination strong, .pagination span {
    min-width: 2.4rem;
    padding: .35rem .6rem;
    border-radius: 4px;
    border: 1px solid var(--trait);
    background: var(--blanc);
    font-variant-numeric: tabular-nums;
}
.pagination strong { background: var(--bleu); border-color: var(--bleu); color: #fff; }
.pagination .inactif { color: #b0b7c3; }
.pagination .ellipse { border: 0; background: none; }

.vide { text-align: center; padding: 2rem 1rem; }
.vide h1 { font-size: 1.3rem; margin-bottom: .5rem; }

/* -------------------------------------------------------------- Fiche */
.fiche-titre { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; border-bottom: 1px solid var(--trait); margin-bottom: 1rem; }
.fiche-titre h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.categorie { margin: 0 0 .5rem; color: var(--encre-douce); }
.fiche-corps { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.fiche-infos { flex: 1 1 20rem; }
.fiche-photo { margin: 0; flex: 0 0 auto; }
.fiche-photo img { border: 1px solid var(--trait); padding: 4px; background: #fff; max-width: 160px; }

/* L'information recherchée : où se trouve la photo */
.emplacement { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.etiquette {
    display: flex;
    flex-direction: column;
    min-width: 9rem;
    padding: .6rem 1rem .7rem;
    border: 2px solid var(--bleu);
    border-radius: var(--rayon);
    background: var(--survol);
}
.etiquette-libelle { font-size: .85rem; font-weight: 700; color: var(--bleu); }
.etiquette-valeur { font-size: 2.4rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--encre); word-break: break-word; }
.vide-valeur { color: #b0b7c3; }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
dl.details dt { font-weight: 600; color: var(--encre-douce); }
dl.details dd { margin: 0; overflow-wrap: anywhere; }

.actions-fiche { justify-content: center; }

.confirmation h1 { color: var(--rouge); font-size: 1.25rem; }
.nom-confirmation { font-size: 1.4rem; font-weight: 700; margin: 0 0 1rem; }

.minuterie { margin-top: 1rem; }
.minuterie.alerte { background: var(--jaune-pale); padding: .5rem .75rem; border-radius: 4px; color: #7a4b00; font-weight: 600; }

/* ---------------------------------------------------------- Catégories */
.liste-categories { list-style: none; padding: 0; margin: 0 0 1rem; }
.liste-categories li { border-bottom: 1px solid #e6ebf4; padding: .5rem 0; }
.ligne-categorie { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ligne-categorie input[type=text] { width: auto; flex: 1 1 12rem; }

/* --------------------------------------------------------------- Pied */
.pied { margin-top: 2rem; padding-top: .75rem; border-top: 1px solid var(--trait); font-size: .8rem; color: var(--encre-douce); text-align: center; }
.pied img { margin-right: .4rem; }

/* ------------------------------------------------------- Petits écrans */
@media (max-width: 640px) {
    .titre_top { font-size: 1.6rem; }
    .bonjour { text-align: left; }
    .barre-icones a { min-width: 0; flex: 1; }
    .carte { padding: 1rem; }
    .barre-recherche input[type=search] { width: 100%; }
    dl.details { grid-template-columns: 1fr; gap: 0; }
    dl.details dd { margin-bottom: .5rem; }
    .etiquette-valeur { font-size: 2rem; }
}

/* ----------------------------------------------------------- Impression */
@media print {
    body { background: #fff; }
    .entete, .actions, .actions-fiche, .pied, .barre-recherche { display: none !important; }
    .carte { border: 0; max-width: none; padding: 0; }
    .etiquette { background: none; }
}
body.impression .page { max-width: 700px; padding-top: 1rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ------------------------------------------------ Ajouts : numérotation */
.dernier {
    margin: -.25rem 0 1.25rem;
    padding: .6rem .8rem;
    background: var(--survol);
    border-radius: var(--rayon);
}
.dernier strong { margin-right: .75rem; font-variant-numeric: tabular-nums; }
input.propose { background: var(--jaune-pale); border-color: #d9b44a; }
.pastille-propose {
    display: inline-block; width: .9rem; height: .9rem; vertical-align: -2px;
    background: var(--jaune-pale); border: 1px solid #d9b44a; border-radius: 3px;
}

/* ------------------------------------- Ajouts : autres enregistrements */
.autres-fiches { margin-top: 1.5rem; border-top: 1px solid var(--trait); padding-top: 1rem; }
.autres-fiches h2, .autre-carnet h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
table.liste-compacte { width: auto; min-width: 50%; }
table.liste-compacte th, table.liste-compacte td { padding: .35rem .9rem; }

/* ---------------------------------------- Ajouts : autre carnet */
.autre-carnet { margin-top: 1.75rem; }
.autre-carnet h2 { color: var(--rouge); }
.autre-carnet .tableau-conteneur { border-color: #e3a19b; }
.autre-carnet table.liste th { background: var(--rouge-pale); }

.barre-recherche input[type=month] { width: auto; max-width: 11rem; }

/* ------------------------------------------------ Mise à jour */
.maj-plan code { font-size: .85rem; }
.maj-plan .etat-nouveau td:last-child { color: var(--vert); font-weight: 600; }
.maj-plan .etat-modifie td:last-child { color: var(--bleu); font-weight: 600; }
.maj-plan .etat-protege td { color: var(--encre-douce); }
details { margin: 1rem 0; }
summary { cursor: pointer; font-weight: 600; color: var(--bleu); }
.journal { list-style: none; padding: 0; margin: 0; font-size: .875rem; color: var(--encre-douce); }
.journal li { padding: .25rem 0; border-bottom: 1px solid #e6ebf4; }
input.mdp-court { width: 10rem; }
