/* Charte Chat Trap 92 : orange vif, encre sombre, titres condensés (Anton), fond papier beige */
:root {
  --orange: #FF6600;
  --orange-fonce: #D9560A;
  --orange-clair: #FFE6D5;
  --fond: #F2EDE4;
  --surface: #FFFFFF;
  --surface-2: #FAF6F0;
  --encre: #232323;
  --encre-douce: #6B635B;
  --ligne: #E3DACD;
  --vert: #2E7D4F;
  --vert-clair: #DCEFE3;
  --jaune: #9A5B00;
  --jaune-clair: #FFF0D2;
  --rouge: #C0392B;
  --rouge-clair: #F9DDD8;
  --rayon: 8px;
  --titre: "Anton", "Impact", "Arial Narrow", sans-serif;
  --texte: Arial, Helvetica, sans-serif;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .40 0 0 0 0 .30 0 0 0 0 .18 0 0 0 .09 0'/></filter><rect width='100%25' height='100%25' filter='url(%23g)'/></svg>");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --orange: #FF7A1F;
    --orange-fonce: #FF9140;
    --orange-clair: #4A2A14;
    --fond: #1B1815;
    --surface: #262220;
    --surface-2: #2E2926;
    --encre: #F1EBE2;
    --encre-douce: #B3A99D;
    --ligne: #3F3832;
    --vert: #7CC79A;
    --vert-clair: #1F3A2A;
    --jaune: #F0B64B;
    --jaune-clair: #3D2F14;
    --rouge: #F08A7C;
    --rouge-clair: #43231F;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond) var(--grain);
  color: var(--encre);
  font: 16px/1.5 var(--texte);
}
h1, h2, h3 { font-family: var(--titre); font-weight: 400; line-height: 1.05; margin: 0; text-transform: uppercase; letter-spacing: .02em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Motif de la charte : double ligne pointillée orange */
.pointilles { border-top: 2px dotted var(--orange); border-bottom: 2px dotted var(--orange); height: 7px; width: 100%; }

/* ---------- Boutons et champs ---------- */
.btn {
  font: inherit; font-weight: 700;
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  color: var(--encre);
  padding: .55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--orange); color: var(--orange-fonce); }
.btn.principal { background: var(--orange); border-color: var(--orange); color: #fff; text-transform: uppercase; letter-spacing: .03em; }
.btn.principal:hover { background: var(--orange-fonce); border-color: var(--orange-fonce); color: #fff; }
.btn.danger { color: var(--rouge); border-color: var(--rouge); background: transparent; }
.btn.discret, .btn.lien { border-color: transparent; background: transparent; color: var(--encre-douce); }
.btn.lien { text-decoration: underline; padding: .3rem; color: var(--orange-fonce); }
.btn:disabled { opacity: .5; cursor: wait; }

input, select, textarea {
  font: inherit; color: var(--encre);
  background: var(--surface);
  border: 1.5px solid var(--ligne);
  border-radius: 6px;
  padding: .5rem .6rem;
  width: 100%;
  min-width: 0;
  font-weight: 400;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 3px var(--orange-clair); }
label { display: grid; gap: .25rem; font-size: .8125rem; color: var(--encre-douce); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
label > input, label > select, label > textarea { text-transform: none; letter-spacing: 0; }

.compteur { font-size: .75rem; font-family: var(--texte); background: rgba(255, 255, 255, .25); color: inherit; border-radius: 999px; padding: 0 .45rem; margin-left: .2rem; }
.compteur:empty { display: none; }
.compteur.alerte { background: #fff; color: var(--orange-fonce); }
.onglet.actif .compteur { background: var(--orange); color: #fff; }

/* ---------- Connexion ---------- */
.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.carte-connexion {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem 1.75rem;
  display: grid; gap: 1rem;
  border: 1px solid var(--ligne);
  box-shadow: 0 10px 40px rgba(35, 35, 35, .08);
  justify-items: stretch;
}
.carte-connexion img { justify-self: center; width: 84px; height: auto; }
.sur-titre { margin: 0; color: var(--orange-fonce); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: .8125rem; text-align: center; }
.carte-connexion h1 { font-size: 2.4rem; text-align: center; margin-top: -.6rem; }
.message { margin: 0; color: var(--rouge); min-height: 1.5em; }

/* ---------- En-tête ---------- */
.entete {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .5rem 16px;
  background: var(--surface);
  border-bottom: 3px solid var(--orange);
}
.marque { display: flex; align-items: center; gap: .7rem; font-family: var(--titre); font-size: 1.3rem; text-transform: uppercase; letter-spacing: .03em; }
.marque img { height: 46px; width: auto; }
.marque span { color: var(--encre); }
.onglets { display: flex; gap: 0; margin-right: auto; overflow-x: auto; background: var(--orange); border-radius: 6px; padding: 3px; }
.onglet {
  font: inherit; font-weight: 700; color: #fff;
  background: none; border: 0; padding: .5rem 1rem; border-radius: 4px; cursor: pointer; white-space: nowrap;
}
.onglet:hover { background: var(--orange-fonce); }
.onglet.actif { color: var(--orange-fonce); background: var(--fond); }
@media (min-width: 761px) { #recherche { flex-basis: 280px; } }
@media (max-width: 640px) {
  .entete { gap: .4rem; }
  .marque span { display: none; }
  .marque img { height: 38px; }
  .onglets { order: 3; width: 100%; margin: 0; }
  .onglet { flex: 1; padding-inline: .4rem; }
  #btn-deconnexion { margin-left: auto; }
}

/* ---------- Vues ---------- */
.vue { padding: 1rem 16px 3rem; max-width: 1400px; margin: 0 auto; }
.intro { color: var(--encre-douce); max-width: 70ch; margin: 0 0 1rem; }

.barre-outils { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
#recherche { flex: 1 1 100%; border-radius: 999px; padding-left: 1rem; }
.panneau-filtres {
  margin-top: .75rem; padding: 1rem;
  background: var(--surface); border: 1px solid var(--ligne); border-top: 3px solid var(--orange); border-radius: var(--rayon);
}
.grille-filtres { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.filtre-dates { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; }
.filtre-actif input, .filtre-actif select { border-color: var(--orange); background: var(--orange-clair); }
.aide { font-size: .875rem; color: var(--encre-douce); }
.resume { color: var(--encre-douce); margin: .9rem 0 .5rem; font-weight: 700; }

/* ---------- Tableau / cartes ---------- */
.table-cadre { overflow-x: auto; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.liste { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.liste th {
  position: sticky; top: 0;
  text-align: left; font-size: .75rem; color: var(--encre-douce); text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2); border-bottom: 2px solid var(--ligne);
  padding: 0;
}
.liste th button { font: inherit; font-weight: 700; color: inherit; background: none; border: 0; padding: .65rem .7rem; cursor: pointer; width: 100%; text-align: left; white-space: nowrap; }
.liste th[aria-sort] button { color: var(--orange-fonce); }
.liste td { padding: .55rem .7rem; border-bottom: 1px solid var(--ligne); vertical-align: top; }
.liste tbody tr { cursor: pointer; }
.liste tbody tr:hover { background: var(--orange-clair); }
.liste td.vide::after { content: "—"; color: var(--ligne); }
.liste td[data-k="nom"] { font-weight: 700; }

.puce {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: .85em; letter-spacing: .02em;
  background: var(--surface-2); border: 1px dashed var(--ligne);
  border-radius: 4px; padding: .05rem .35rem; white-space: nowrap;
}
.statut { display: inline-block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .1rem .55rem; border-radius: 4px; white-space: nowrap; background: var(--surface-2); color: var(--encre-douce); }
.statut-adopte { background: var(--vert-clair); color: var(--vert); }
.statut-relache { background: var(--orange-clair); color: var(--orange-fonce); }
.statut-a_l_adoption, .statut-reserve, .statut-fa_adoption, .statut-en_famille_accueil, .statut-aide_sterilisation { background: var(--jaune-clair); color: var(--jaune); }
.statut-decede { background: var(--surface-2); color: var(--encre-douce); }

@media (max-width: 760px) {
  .table-cadre { background: none; border: 0; overflow: visible; }
  .liste thead { display: none; }
  .liste, .liste tbody, .liste tr, .liste td { display: block; }
  .liste tr {
    background: var(--surface); border: 1px solid var(--ligne); border-left: 4px solid var(--orange); border-radius: var(--rayon);
    margin-bottom: .6rem; padding: .7rem .9rem;
    display: grid; grid-template-columns: 1fr 1fr; gap: .15rem .8rem;
  }
  .liste td { border: 0; padding: 0; }
  .liste td.vide, .liste td.hors-mobile { display: none; }
  .liste td::before { content: attr(data-label); display: block; font-size: .7rem; color: var(--encre-douce); text-transform: uppercase; letter-spacing: .04em; }
  .liste td[data-k="nom"] { grid-column: 1 / -1; font-family: var(--titre); font-weight: 400; font-size: 1.35rem; text-transform: uppercase; letter-spacing: .02em; }
  .liste td[data-k="nom"]::before { display: none; }
}
.plus { display: block; margin: 1rem auto; }

/* ---------- Propositions ---------- */
.proposition {
  background: var(--surface); border: 1px solid var(--ligne); border-left: 5px solid var(--orange);
  border-radius: var(--rayon); padding: 1rem; margin-bottom: 1rem;
}
.proposition header { display: flex; gap: .75rem; flex-wrap: wrap; align-items: baseline; justify-content: space-between; margin-bottom: .5rem; }
.proposition h2 { font-size: 1.5rem; }
.meta { color: var(--encre-douce); font-size: .875rem; }
.remarque { background: var(--surface-2); border-left: 3px dotted var(--orange); border-radius: 0 6px 6px 0; padding: .5rem .75rem; font-size: .9375rem; }
.bandeau { border-radius: 6px; padding: .6rem .8rem; margin: .6rem 0; }
.bandeau.info { background: var(--orange-clair); }
.bandeau.alerte { background: var(--rouge-clair); }
.bandeau label { display: flex; gap: .5rem; align-items: center; color: var(--encre); margin-top: .4rem; text-transform: none; letter-spacing: 0; font-size: .9375rem; }
.bandeau input[type=checkbox] { width: 1.25rem; height: 1.25rem; flex: none; accent-color: var(--orange); }
fieldset { border: 0; padding: 0; margin: 1rem 0 0; }
legend { font-family: var(--titre); font-size: 1.1rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .5rem; padding-bottom: .2rem; border-bottom: 2px dotted var(--orange); width: 100%; }
.grille-champs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .7rem; }
.ecart input, .ecart select { border-color: var(--rouge); }
.cases { display: flex; flex-wrap: wrap; gap: .4rem 1rem; padding: .4rem 0; }
.case { display: flex; align-items: center; gap: .4rem; text-transform: none; letter-spacing: 0; font-size: .9375rem; color: var(--encre); font-weight: 400; }
.case input { width: 1.15rem; height: 1.15rem; accent-color: var(--orange); }
.case-bloc { align-self: end; }

/* ---------- Essais d'adoption ---------- */
.essai { background: var(--surface); border: 1px solid var(--ligne); border-left: 5px solid var(--orange); border-radius: var(--rayon); padding: .9rem 1rem; margin-bottom: .8rem; }
.essai.depasse { border-left-color: var(--rouge); }
.essai header { display: flex; gap: .6rem 1rem; flex-wrap: wrap; align-items: baseline; }
.essai h2 { font-size: 1.4rem; }
.essai .delai { font-weight: 700; color: var(--vert); }
.essai.depasse .delai, .essai .delai.bientot { color: var(--rouge); }
.essai .infos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .3rem 1rem; margin: .5rem 0; font-size: .9375rem; }
.suivis { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .3rem; }
.suivis li { background: var(--surface-2); border-radius: 6px; padding: .4rem .7rem; font-size: .9375rem; }
.suivis .quand { color: var(--encre-douce); font-size: .8125rem; margin-right: .5rem; }
.essai .actions { justify-content: flex-start; margin-top: .6rem; }
.essai .mini-form { grid-template-columns: 1fr auto; align-items: end; }
.bandeau label input { text-transform: none; }
.en-base { font-size: .8125rem; font-weight: 400; color: var(--rouge); text-transform: none; letter-spacing: 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; margin-top: 1rem; }

/* ---------- Anomalies ---------- */
.groupe-anomalies { margin-bottom: 1.5rem; }
.groupe-anomalies h2 { font-size: 1.3rem; margin-bottom: .5rem; padding-bottom: .25rem; border-bottom: 2px dotted var(--orange); display: flex; align-items: center; gap: .5rem; }
.groupe-anomalies .compteur { background: var(--orange); color: #fff; font-size: .8rem; }
.anomalie {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--ligne); border-radius: 6px;
  padding: .6rem .8rem; margin-bottom: .4rem;
}
.anomalie .quoi { flex: 1 1 240px; }
.anomalie .detail { color: var(--encre-douce); font-size: .9375rem; }
.vide-message { background: var(--surface); border: 2px dotted var(--orange); border-radius: var(--rayon); padding: 2rem; text-align: center; color: var(--encre-douce); }

/* ---------- Fiche (boîte de dialogue) ---------- */
.fiche {
  width: min(880px, calc(100% - 16px)); max-height: calc(100dvh - 32px);
  border: 0; border-radius: 12px; padding: 0;
  background: var(--fond) var(--grain); color: var(--encre);
}
.fiche::backdrop { background: rgba(35, 35, 35, .6); }
.fiche-entete {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  padding: .9rem 1.2rem; background: var(--surface); border-bottom: 3px solid var(--orange);
}
.fiche-entete h2 { font-size: 2rem; margin-right: auto; }
.fiche-corps { padding: 1rem 1.2rem 1.5rem; }
.bloc { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 1rem; margin-bottom: 1rem; }
.bloc h3 { font-size: 1.2rem; margin-bottom: .7rem; padding-bottom: .25rem; border-bottom: 2px dotted var(--orange); }
.ligne-adoption { border-top: 1px solid var(--ligne); padding: .7rem 0; display: grid; gap: .4rem; }
.ligne-adoption:first-of-type { border-top: 0; padding-top: 0; }
.ligne-adoption .qui { font-weight: 700; }
.mini-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; align-items: end; margin-top: .4rem; }
.docs { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.docs a { color: var(--orange-fonce); font-weight: 700; }
@media (max-width: 640px) {
  .fiche { width: 100%; max-width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
  .fiche-corps { padding: 1rem 12px 2rem; }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--encre); color: var(--fond);
  padding: .7rem 1.1rem; border-radius: 6px; z-index: 100; max-width: calc(100% - 32px);
  border-left: 4px solid var(--orange);
}
.toast.erreur { background: var(--rouge); color: #fff; border-left-color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: monte .2s ease-out; }
  @keyframes monte { from { opacity: 0; transform: translate(-50%, 8px); } }
}
