/* FINJOURNEE — feuille de style */
:root {
  --accent: #7a2e55;
  --accent-fonce: #5e2141;
  --accent-clair: #f3e6ec;
  --fond: #f5f4f2;
  --surface: #ffffff;
  --texte: #1f1d1e;
  --texte-2: #5b5659;
  --texte-3: #8a8487;
  --bord: #e3dfe1;
  --ok: #1d7a4a;
  --ok-fond: #e5f4ec;
  --alerte: #b3261e;
  --alerte-fond: #fbe9e8;
  --info-fond: #eaf1fb;
  --info: #1f4f8f;
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
h2 small, h1 small { font-weight: 400; color: var(--texte-3); font-size: .85em; }
h3 { font-size: 1rem; margin: 0; }
code { background: #f1eef0; padding: 1px 5px; border-radius: 4px; font-size: .92em; }
code.gros { font-size: 1.15em; letter-spacing: .05em; }
small { color: var(--texte-3); }

/* En-tête */
.entete { background: var(--accent); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.entete-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: 0 16px; min-height: 56px; }
.marque { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .04em; }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #fff; color: var(--accent); font-weight: 800; font-size: 14px; }
.logo-grand { width: 56px; height: 56px; font-size: 22px; border-radius: 14px; background: var(--accent); color: #fff; }
.nav { display: flex; align-items: center; gap: 1px; margin-left: auto; }
.nav a { color: #fff; text-decoration: none; padding: .45rem .55rem; border-radius: 7px; font-size: .88rem; opacity: .9; white-space: nowrap; }
.nav a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.nav a.actif { background: rgba(255,255,255,.2); opacity: 1; font-weight: 600; }
.nav-sep { width: 1px; height: 26px; background: rgba(255,255,255,.3); margin: 0 .4rem; }
.nav-user { display: flex; flex-direction: column; line-height: 1.15; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.nav-user small { color: rgba(255,255,255,.75); font-size: .75rem; }
.menu-btn { display: none; margin-left: auto; background: none; border: 0; padding: 10px; cursor: pointer; }
.menu-btn span { display: block; width: 22px; height: 2px; background: #fff; margin: 4px 0; border-radius: 2px; }

@media (max-width: 1320px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 56px; background: var(--accent-fonce); flex-direction: column; align-items: stretch; padding: 8px 12px 14px; gap: 0; }
  body.menu-ouvert .nav { display: flex; }
  .nav a { padding: .75rem .8rem; font-size: 1rem; }
  .nav-sep { width: auto; height: 1px; margin: .4rem 0; }
}

/* Page */
.page { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 20px 16px 40px; }
.page-etroite { max-width: 620px; margin-left: auto; margin-right: auto; }
.titre-page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1rem; }
.sous-titre { color: var(--texte-2); margin: 0; }
.pied { text-align: center; color: var(--texte-3); font-size: .8rem; padding: 16px; }

.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 18px; margin-bottom: 16px; box-shadow: var(--ombre); }
.carte > :last-child { margin-bottom: 0; }
.titre-carte { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.titre-carte h2 { margin: 0; }
.aide { color: var(--texte-2); font-size: .88rem; margin: .25rem 0 .75rem; }
.centre { text-align: center; }
.vide { color: var(--texte-3); font-style: italic; }
.vide.ok { color: var(--ok); font-style: normal; }
.nowrap { white-space: nowrap; }

/* Alertes */
.alerte { border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid transparent; }
.alerte ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alerte p { margin: .2rem 0; }
.alerte-succes { background: var(--ok-fond); color: #11502f; border-color: #bfe3cf; }
.alerte-erreur { background: var(--alerte-fond); color: #7d1a14; border-color: #f2c5c2; }
.alerte-info { background: var(--info-fond); color: var(--info); border-color: #c9daf2; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 12px; color: var(--texte); }
label small { font-weight: 400; }
input[type=text], input[type=password], input[type=number], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 400; color: var(--texte);
  padding: 10px 12px; border: 1px solid #cfc9cc; border-radius: 8px; background: #fff; min-height: 44px;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input[type=file] { display: block; margin-top: 6px; font-weight: 400; max-width: 100%; }
.champ-erreur input, .champ-erreur textarea { border-color: var(--alerte); background: #fff8f7; }
.req { color: var(--alerte); }
label.case { display: flex; align-items: center; gap: .45rem; font-weight: 400; margin-bottom: 8px; cursor: pointer; }
label.case input { width: 18px; height: 18px; margin: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.lien { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-weight: 400; padding: 0; text-decoration: underline; }
.compteur { display: block; text-align: right; font-weight: 400; margin-top: 3px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 40px;
  padding: 8px 16px; border-radius: 8px; border: 1px solid #cfc9cc; background: #fff; color: var(--texte);
  font: inherit; font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f7f4f5; }
.btn-primaire { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primaire:hover { background: var(--accent-fonce); }
.btn-danger { background: var(--alerte); border-color: var(--alerte); color: #fff; }
.btn-export { border-color: var(--accent); color: var(--accent); }
.btn-petit { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.btn-large { min-height: 48px; padding: 10px 22px; font-size: 1rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icone { width: 40px; height: 44px; border: 1px solid #cfc9cc; background: #fff; border-radius: 8px; font-size: 1.3rem; color: var(--texte-2); cursor: pointer; flex: none; }
.btn-icone:hover { color: var(--alerte); border-color: var(--alerte); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }

/* Connexion */
.connexion { max-width: 400px; margin: 6vh auto 0; }
.connexion-marque { text-align: center; margin-bottom: 20px; }
.connexion-marque h1 { margin-top: 10px; letter-spacing: .05em; }
.connexion-marque p { color: var(--texte-2); margin: 0; }
.connexion .btn { width: 100%; }

/* Fiche : saisie */
.grille-2 { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 12px; align-items: end; }
.raccourcis-date { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.grille-montants { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 16px; }
.montant-wrap { position: relative; display: flex; align-items: center; margin-top: 5px; }
.montant-wrap input { margin-top: 0; padding-right: 72px; text-align: right; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.montant-wrap .devise { position: absolute; right: 12px; color: var(--texte-3); font-weight: 400; font-size: .85rem; pointer-events: none; }
.montant-wrap .signe { position: absolute; right: 40px; width: 26px; height: 26px; border: 1px solid var(--bord); background: #faf8f9; border-radius: 6px; color: var(--texte-2); font-size: .8rem; cursor: pointer; padding: 0; }
.montant.negatif { color: var(--alerte); }
.depenses { display: flex; flex-direction: column; gap: 8px; }
.dep-ligne { display: grid; grid-template-columns: 1fr 190px auto; gap: 8px; align-items: center; }
.dep-ligne input { margin-top: 0; }
.dep-ligne .montant-wrap { margin-top: 0; }
.dep-pied { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.pj-liste { list-style: none; padding: 0; margin: 0 0 12px; }
.pj-liste li { display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--bord); }
.pj-liste label.case { margin: 0 0 0 auto; color: var(--alerte); }
.barre-actions {
  position: sticky; bottom: 0; z-index: 10; display: flex; justify-content: flex-end; gap: 10px;
  background: rgba(245,244,242,.95); backdrop-filter: blur(4px); padding: 12px 0; border-top: 1px solid var(--bord);
}
@media (max-width: 640px) {
  .grille-2 { grid-template-columns: 1fr; }
  .dep-ligne { grid-template-columns: 1fr auto; }
  .dep-ligne > input[type=text]:first-child { grid-column: 1 / -1; }
  .barre-actions .btn { flex: 1; }
  h1 { font-size: 1.3rem; }
  .carte { padding: 14px; }
}

/* Fiche : consultation */
.grille-fiche { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
@media (max-width: 860px) { .grille-fiche { grid-template-columns: 1fr; } }
.texte-divers { white-space: pre-line; margin: 0; }
.pj-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pj-vignette { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--texte-2); font-size: .8rem; word-break: break-all; }
.pj-vignette img, .pj-pdf { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--bord); background: #faf8f9; }
.pj-pdf { display: grid; place-items: center; font-weight: 700; color: var(--alerte); font-size: 1.2rem; }
.zone-danger { border-color: #f2c5c2; }

/* Étiquettes */
.etiquette { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: #eee; color: var(--texte-2); white-space: nowrap; }
.etiquette-ok { background: var(--ok-fond); color: var(--ok); }
.etiquette-gris { background: #efedee; color: var(--texte-2); }
.etiquette-alerte { background: var(--alerte-fond); color: var(--alerte); }
.etiquette-admin { background: var(--accent-clair); color: var(--accent); }
p.etiquette { margin: 0 0 12px; }

/* Tableaux */
.defil { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -2px; }
.tableau { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tableau th, .tableau td { padding: 8px 10px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: top; }
.tableau thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--texte-2); background: #faf8f9; border-bottom: 2px solid var(--bord); vertical-align: bottom; }
.tableau .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau tfoot th { background: var(--accent-clair); border-top: 2px solid var(--accent); font-weight: 700; }
.tableau tr.inactif td, .tableau tr.inactif th { color: var(--texte-3); }
.tableau tr.ligne-vide td { color: var(--texte-3); }
.tableau tr.sous-total th, .tableau tr.sous-total td { background: #f4f2f3; font-weight: 700; }
.tableau-fiche th { font-weight: 500; color: var(--texte-2); }
.tableau-fiche td { font-weight: 600; font-size: 1rem; }
.tableau-compact { font-size: .82rem; margin-top: 6px; }
.tableau-compact td, .tableau-compact th { padding: 4px 8px; }
.tableau-compact .avant { color: var(--alerte); text-decoration: line-through; text-decoration-color: rgba(179,38,30,.4); }
.tableau-compact .apres { color: var(--ok); }
.tableau-etat .col-fixe { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 130px; }
.tableau-etat thead .col-fixe { background: #faf8f9; }
.tableau-etat tfoot .col-fixe { background: var(--accent-clair); }
.tableau-etat tr.sous-total .col-fixe { background: #f4f2f3; }
.tableau-etat thead th.num { min-width: 96px; }
.divers-cell { min-width: 200px; font-size: .82rem; color: var(--texte-2); white-space: pre-line; }
.manque { color: var(--alerte); font-weight: 700; }
.pj-ico { font-size: .85em; }

/* Filtres */
.filtres-ligne { display: flex; flex-wrap: wrap; gap: 0 14px; align-items: flex-end; }
.filtres-ligne label { flex: 1 1 150px; max-width: 240px; }
.filtres-ligne > .btn { margin-bottom: 12px; }
.bascule { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.bascule legend { width: 100%; }
.bascule label { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; max-width: none; flex: none; }
.raccourcis { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.choix-pv { display: flex; flex-wrap: wrap; gap: 0 18px; }
.choix-pv legend { width: 100%; }
.filtre-inline { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.filtre-inline label { margin: 0; min-width: 220px; }
.filtre-inline select { margin-top: 0; }

/* Tableau de bord */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tuile { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 16px; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 4px; }
.tuile-lib { font-size: .82rem; color: var(--texte-2); }
.tuile-val { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tuile-val small { font-size: .55em; font-weight: 500; }
.tuile-alerte { border-color: #f2c5c2; }
.tuile-alerte .tuile-val { color: var(--alerte); }
.grille-tdb { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
@media (max-width: 960px) { .grille-tdb { grid-template-columns: 1fr; } }
.manquantes { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; }
.manquantes li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--bord); }
.manquantes li > span:nth-child(2) { flex: 1; }
.graphique { position: relative; }
.graphique svg { width: 100%; height: auto; display: block; }
.graphique .axe { stroke: #bdb6ba; stroke-width: 1; }
.graphique .grille { stroke: #ece8ea; stroke-width: 1; stroke-dasharray: 3 3; }
.graphique .lib-axe { font-size: 11px; fill: var(--texte-3); }
.graphique .barre-val { fill: var(--accent); }
.graphique .cible { fill: transparent; }
.graphique .barre:hover .barre-val { fill: var(--accent-fonce); }
.graphique .barre:hover .cible { fill: rgba(122,46,85,.06); }
.infobulle { position: absolute; pointer-events: none; background: #1f1d1e; color: #fff; font-size: .8rem; padding: 5px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); }

/* Opératrice : fiches récentes */
.carte-appel { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.carte-appel p { margin: 0; flex: 1 1 100%; }
.cartes-fiches { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.fiche-resume header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.mini-montants { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 0 0 12px; font-size: .88rem; }
.mini-montants dt { color: var(--texte-2); }
.mini-montants dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.infos { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.infos dt { color: var(--texte-2); }
.infos dd { margin: 0; font-weight: 600; }

/* Historique */
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { padding: 10px 0 10px 14px; border-left: 3px solid var(--bord); margin-bottom: 8px; }
.hist-creation { border-left-color: var(--ok) !important; }
.hist-modification { border-left-color: #c98a1a !important; }
.hist-suppression { border-left-color: var(--alerte) !important; }
.hist-qui { color: var(--texte-3); font-size: .85rem; margin-left: .3rem; }
.pagination { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.pagination a { padding: 4px 10px; border: 1px solid var(--bord); border-radius: 6px; text-decoration: none; }
.pagination a.actif { background: var(--accent); color: #fff; border-color: var(--accent); }

.mdp-provisoire p { margin: .3rem 0; }
.liste-verif { list-style: none; padding: 0; margin: 0; }
.liste-verif .ok { color: var(--ok); }
.liste-verif .ko { color: var(--alerte); font-weight: 600; }

@media print {
  .entete, .pied, .barre-actions, .filtres, .actions, .btn { display: none !important; }
  body { background: #fff; }
  .carte { box-shadow: none; border: 0; padding: 0; }
}
