/* ============================================================
   Bilan Factures — feuille de style unique.

   Parti pris : le classeur. Ces documents vivaient dans un classeur à
   intercalaires ; on ouvre à l'onglet, on prend la feuille. L'écran reprend ce
   geste plutôt que d'en imposer un nouveau.

   La maison n'est pas signalée par un liseré : elle TEINTE l'écran. Un bandeau
   plein en tête, des onglets qui portent la couleur, un fond légèrement coloré.
   On sait où on est avant d'avoir lu quoi que ce soit — et pour quelqu'un qui
   n'a accès qu'à une maison, c'est simplement une identité calme.
   ============================================================ */

:root {
  /* Papier légèrement chaud, encre bleu-noir : la matière des documents
     administratifs français, pas le gris d'un tableau de bord. */
  --papier: #f4f2ee;
  --feuille: #fffefb;
  --encre: #1b2430;
  --gris: #5f6b7a;
  --gris-clair: #949fad;
  --lisere: #e2ded6;

  --alerte: #9e2b1f;
  --alerte-fond: #fbeae7;
  --succes: #1a5637;
  --succes-fond: #e9f2ec;

  /* Chaque maison a une gamme complète, pas une seule teinte : un fond profond
     pour le bandeau, un ton moyen pour les aplats, un lavis pour les surfaces.
     Biarritz : bleu de Prusse, l'Atlantique un jour de vent. Couiza : safran
     brûlé, la pierre de l'Aude en fin d'après-midi. */
  --maison-fond: #2c3947;
  --maison: #46586b;
  --maison-lavis: #edeff2;
  --maison-clair: #8fa0b4;

  --rayon: 12px;
  --ombre-basse: 0 1px 2px rgba(27, 36, 48, .06);
  --ombre-carte: 0 1px 2px rgba(27, 36, 48, .05), 0 10px 24px -12px rgba(27, 36, 48, .22);
}

[data-lieu="biarritz"] {
  --maison-fond: #14384f;
  --maison: #1d5875;
  --maison-lavis: #e8eff3;
  --maison-clair: #7fa8bf;
}
[data-lieu="couiza"] {
  --maison-fond: #4a3113;
  --maison: #8a5a1c;
  --maison-lavis: #f5eee2;
  --maison-clair: #c39a5c;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

/* Georgia pour tout ce qui nomme : c'est la lettre administrative française,
   le registre exact de ces documents. Elle porte les titres sans avoir besoin
   de les grossir. */
h1, h2, .maison-nom, .feuille-quand, .marque {
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: -.012em;
  margin: 0;
}

/* ---------- bandeau ---------- */

/* Le bandeau porte la photo du lieu. Le dégradé n'est pas décoratif : sans lui,
   le texte blanc deviendrait illisible dès qu'une zone claire du ciel passe
   dessous. Il est plus dense à gauche, où se trouvent les mots. */
.bandeau {
  background: var(--maison-fond);
  background-size: cover;
  background-position: center 62%;
  color: #fff;
  border-bottom: 3px solid var(--maison);
}
[data-lieu="biarritz"] .bandeau {
  background-image:
    linear-gradient(100deg, rgba(9,32,46,.94) 0%, rgba(9,32,46,.78) 45%, rgba(9,32,46,.55) 100%),
    url("../img/biarritz.jpg");
}
[data-lieu="couiza"] .bandeau {
  background-image:
    linear-gradient(100deg, rgba(38,25,10,.94) 0%, rgba(38,25,10,.78) 45%, rgba(38,25,10,.55) 100%),
    url("../img/couiza.jpg");
}
.bandeau-inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 15px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.marque {
  font-size: 18px;
  color: #fff;
  text-decoration: none;
  letter-spacing: .01em;
}
.marque span { color: var(--maison-clair); }
.bandeau-actions { display: flex; align-items: center; gap: 14px; }
.qui { color: rgba(255,255,255,.72); font-size: 14px; text-decoration: none; }
a.qui:hover { color: #fff; text-decoration: underline; }

/* ---------- contenu ---------- */

main { max-width: 820px; margin: 0 auto; padding: 30px 22px 72px; }

.fil { font-size: 14px; color: var(--gris); margin: 0 0 8px; }
.fil a { color: var(--gris); text-decoration: none; }
.fil a:hover { color: var(--maison); text-decoration: underline; }

.titre-page { font-size: 30px; line-height: 1.15; margin-bottom: 6px; }
.sous-titre { color: var(--gris); margin: 0 0 28px; }

/* ---------- choix de la maison ---------- */

.maisons { display: grid; gap: 16px; }
@media (min-width: 640px) { .maisons { grid-template-columns: 1fr 1fr; } }

/* Chaque maison est une carte pleine dans sa propre couleur : le choix se fait
   à la teinte, pas à la lecture. */
.maison {
  display: block;
  position: relative;
  background: var(--maison-fond);
  background-size: cover;
  background-position: center 60%;
  color: #fff;
  border-radius: var(--rayon);
  padding: 30px 26px 26px;
  text-decoration: none;
  box-shadow: var(--ombre-carte);
  overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease;
}
/* Onglet d'intercalaire, en haut à droite. */
.maison::after {
  content: "";
  position: absolute;
  top: 0; right: 26px;
  width: 46px; height: 14px;
  background: var(--maison-clair);
  border-radius: 0 0 4px 4px;
}
/* Sur la carte, le dégradé descend : le nom de la maison est en bas, la photo
   respire en haut. */
.maison[data-lieu="biarritz"] {
  background-image:
    linear-gradient(180deg, rgba(9,32,46,.45) 0%, rgba(9,32,46,.88) 68%, rgba(9,32,46,.96) 100%),
    url("../img/biarritz.jpg");
}
.maison[data-lieu="couiza"] {
  background-image:
    linear-gradient(180deg, rgba(38,25,10,.45) 0%, rgba(38,25,10,.88) 68%, rgba(38,25,10,.96) 100%),
    url("../img/couiza.jpg");
}
/* La carte devient une vraie photo : plus haute, le texte posé en bas. */
.maison {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.maison:hover { transform: translateY(-3px); box-shadow: 0 14px 32px -14px rgba(27,36,48,.4); }
.maison-nom { font-size: 27px; margin-bottom: 6px; }
.maison-info { color: rgba(255,255,255,.75); font-size: 15px; }

/* ---------- rubriques : les intercalaires ---------- */

.groupe { margin-bottom: 32px; }
.groupe-titre {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--maison);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--lisere);
}

.onglets { display: grid; gap: 10px; }

.onglet {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--feuille);
  border: 1px solid var(--lisere);
  border-radius: var(--rayon);
  padding: 0 20px 0 0;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--ombre-basse);
  overflow: hidden;
  transition: box-shadow .14s ease, transform .14s ease;
}
/* La languette colorée de l'intercalaire, pleine et non un simple filet. */
.onglet-languette {
  align-self: stretch;
  width: 12px;
  background: var(--maison);
  flex: none;
}
.onglet-corps { flex: 1; padding: 17px 0 17px 18px; }
.onglet:hover {
  transform: translateX(2px);
  box-shadow: 0 6px 18px -8px rgba(27,36,48,.32);
}
.onglet-nom { font-size: 18px; font-weight: 600; display: block; }
.onglet-info { color: var(--gris); font-size: 14px; white-space: nowrap; }

/* ---------- feuilles ---------- */

/* La pile de documents : une feuille par ligne, la couleur de la maison en
   tranche à gauche. */
.feuilles {
  background: var(--feuille);
  border: 1px solid var(--lisere);
  border-left: 12px solid var(--maison);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-carte);
  overflow: hidden;
}
.feuille-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-top: 1px solid var(--lisere);
  flex-wrap: wrap;
}
.feuille-ligne:first-child { border-top: 0; }
.feuille-ligne:hover { background: var(--maison-lavis); }
.feuille-quand { font-size: 19px; min-width: 9.5em; }
.feuille-quoi { color: var(--gris); flex: 1; min-width: 45%; }
.feuille-poids { color: var(--gris-clair); font-size: 13px; }
.feuille-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- boutons ---------- */

.bouton {
  display: inline-block;
  background: var(--maison);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 11px 20px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .14s ease;
}
.bouton:hover { filter: brightness(1.15); }
.bouton.discret {
  background: transparent;
  color: var(--gris);
  border: 1px solid var(--lisere);
  font-weight: 500;
  padding: 8px 14px;
}
.bouton.discret:hover { background: var(--papier); filter: none; color: var(--encre); }
.bandeau .bouton.discret {
  color: rgba(255,255,255,.82);
  border-color: rgba(255,255,255,.28);
}
.bandeau .bouton.discret:hover { background: rgba(255,255,255,.12); color: #fff; }

a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--maison-clair);
  outline-offset: 2px;
}

/* ---------- connexion ---------- */

/* L'écran d'entrée n'appartient à aucune maison : il prend le bleu de nuit
   commun, et la carte y est posée comme une feuille sur un bureau. */
.ecran-connexion {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #232f3c;
}
.carte-connexion {
  background: var(--feuille);
  border-radius: 16px;
  box-shadow: 0 24px 60px -24px rgba(0,0,0,.6);
  padding: 38px 32px 32px;
  width: 100%;
  max-width: 410px;
}
.carte-connexion h1 { font-size: 27px; margin-bottom: 6px; }
.carte-connexion .sous-titre { margin-bottom: 26px; }

label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--lisere);
  border-radius: 8px;
  font: inherit;
  background: #faf8f4;
  margin-bottom: 18px;
}
select, input[type="date"], input[type="file"] {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--lisere);
  border-radius: 8px;
  font: inherit;
  background: #faf8f4;
  margin-bottom: 16px;
}
input:focus, select:focus { border-color: var(--maison); background: var(--feuille); outline-offset: 0; }

/* ---------- messages ---------- */

.message { border-radius: 8px; padding: 12px 15px; margin-bottom: 20px; font-size: 15px; }
.message.erreur { background: var(--alerte-fond); color: var(--alerte); }
.message.succes { background: var(--succes-fond); color: var(--succes); }

.vide {
  background: var(--feuille);
  border: 1px dashed var(--lisere);
  border-radius: var(--rayon);
  padding: 36px 24px;
  text-align: center;
  color: var(--gris);
}

/* ---------- administration ---------- */

.bloc-admin {
  background: var(--feuille);
  border: 1px solid var(--lisere);
  border-radius: var(--rayon);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--ombre-basse);
}
.bloc-admin h2 { font-size: 20px; margin-bottom: 12px; }
.bloc-admin p { margin-top: 0; }
.ligne-compte { border-top: 1px solid var(--lisere); padding: 18px 0; }
.ligne-compte:first-of-type { border-top: 0; }
.nom-compte { font-weight: 600; }
.perimetres { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; }
.perimetres label { font-weight: 400; margin: 0; display: flex; align-items: center; gap: 7px; }
.actions-compte { display: flex; flex-wrap: wrap; gap: 8px; }
.champ-en-ligne { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.champ-en-ligne input { margin-bottom: 0; width: auto; flex: 1; min-width: 180px; }

@media (max-width: 520px) {
  .titre-page { font-size: 25px; }
  .feuille-quand { min-width: 100%; }
  .feuille-actions { width: 100%; }
  .feuille-actions .bouton { flex: 1; text-align: center; }
}

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


/* ---------- dépôt de documents (administrateur) ---------- */

.depot { margin-top: 22px; }

/* Visible seulement quand le script l'active : sans JavaScript, on garde le
   champ de fichier ordinaire, qui marche partout. */
.depot-zone {
  border: 2px dashed var(--maison-clair);
  border-radius: var(--rayon);
  background: var(--maison-lavis);
  padding: 26px 20px;
  text-align: center;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.depot-zone strong { display: block; font-size: 17px; margin-bottom: 4px; }
.depot-zone span { color: var(--gris); font-size: 14px; }
.depot-zone.survol {
  background: var(--feuille);
  border-color: var(--maison);
  border-style: solid;
}
.depot-zone.depot-en-cours { opacity: .6; cursor: progress; }

/* Repli sans JavaScript : masqué dès que la zone est active. */
.depot-simple { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.depot-zone:not([hidden]) ~ .depot-simple { display: none; }


/* Crédit photo : obligatoire pour les licences Creative Commons, discret parce
   que ce n'est pas l'information que l'on vient chercher. */
.credit-photo {
  margin-top: 34px;
  font-size: 12px;
  color: var(--gris-clair);
  text-align: right;
}
.credit-photo a { color: var(--gris-clair); }
