/* ==========================================================================
   Patounes — design system
   Moderne, professionnel, responsive. Vert dominant.

   Le vert n'est pas un accent posé sur du gris : il tient les grandes surfaces
   (barre laterale, banniere, aplats) et se decline en une echelle complete.
   Les neutres sont volontairement teintes de vert pour que l'ensemble reste
   d'une seule famille.
   ========================================================================== */

:root {
  /* Echelle verte */
  --g-900: #06291f;
  --g-800: #0b3b2e;
  --g-700: #10513e;
  --g-600: #14664f;
  --g-500: #17795e;   /* action principale */
  --g-400: #24956f;
  --g-300: #6fbfa2;
  --g-200: #b9e0ce;
  --g-100: #dcefe6;
  --g-50:  #f1f8f4;

  /* Neutres teintes de vert */
  --ink:    #0d1a15;
  --body-c: #3f544b;
  --muted:  #6c8378;
  --line:   #dde7e1;
  --line-2: #eef4f0;
  --surface: #ffffff;
  --canvas:  #f4f8f6;

  /* Statuts */
  --free:     #17795e;
  --free-bg:  #dcefe6;
  --visit:    #a35a06;
  --visit-bg: #fbeedd;
  --adopted:  #454aa0;
  --adopted-bg: #e6e7f7;

  --danger:    #b3261e;
  --danger-bg: #fceceb;

  /* Compatibilite : noms utilises dans les gabarits */
  --paper: var(--surface);
  --wash:  var(--canvas);
  --wash-2: var(--line-2);
  --rule:  var(--line);
  --slate: var(--body-c);
  --mute:  var(--muted);
  --brand: var(--g-500);
  --brand-lo: var(--g-100);
  --alert: var(--danger);
  --alert-lo: var(--danger-bg);
  --ok-lo: var(--free-bg);

  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: var(--body);
  --data: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;

  --radius:    12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(13, 26, 21, .05);
  --shadow-2: 0 4px 12px rgba(13, 26, 21, .07), 0 1px 3px rgba(13, 26, 21, .05);
  --shadow-3: 0 12px 32px rgba(13, 26, 21, .12);
  --sidebar: 252px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0; overflow-x: hidden;
  font-family: var(--body);
  font-size: 16px; line-height: 1.55;
  color: var(--body-c); background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--ink); font-weight: 700;
  line-height: 1.2; letter-spacing: -.021em;
  margin: 0 0 var(--s3);
}
h1 { font-size: clamp(1.5rem, 1.15rem + 1.5vw, 2.2rem); letter-spacing: -.03em; }
h2 { font-size: clamp(1.15rem, 1.05rem + .45vw, 1.4rem); }
h3 { font-size: 1.02rem; }
h1, h2, h3, h4 { overflow-wrap: break-word; }
p { margin: 0 0 var(--s4); }

a { color: var(--g-600); text-decoration: none; }
a:hover { color: var(--g-800); text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }

:focus-visible { outline: 2px solid var(--g-500); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--g-800); color: #fff; padding: var(--s3) var(--s4); border-radius: 0 0 var(--radius-sm) 0; }
.skip:focus { left: 0; }

/* --- Utilitaires ---------------------------------------------------------- */
.wrap { width: min(1180px, 100% - 2 * var(--s4)); margin-inline: auto; }
@media (min-width: 720px) { .wrap { width: min(1180px, 100% - 2 * var(--s6)); } }
.stack > * + * { margin-top: var(--s4); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.data { font-family: var(--data); font-size: .9em; letter-spacing: -.02em; }
.center { text-align: center; }
.hide { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .8rem; font-weight: 600; color: var(--g-600);
  margin: 0 0 var(--s2);
}
.eyebrow::before { content: ""; width: 14px; height: 2px; background: var(--g-400); border-radius: 2px; flex: none; }
.eyebrow a { color: inherit; }

/* --- Boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-weight: 600; font-size: .93rem; line-height: 1.2;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--g-500); color: #fff;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .08s ease;
}
.btn:hover { background: var(--g-600); color: #fff; text-decoration: none; box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-1); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn--ghost:hover { background: var(--g-50); color: var(--g-700); border-color: var(--g-300); box-shadow: none; }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #8f1e17; }
.btn--sm { padding: 6px 12px; font-size: .84rem; border-radius: 6px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Badges de statut ------------------------------------------------------ */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .76rem; font-weight: 600; line-height: 1.4;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tag--libre     { color: var(--free);    background: var(--free-bg);    border-color: #bfe2d3; }
.tag--en_visite { color: var(--visit);   background: var(--visit-bg);   border-color: #f0dcc0; }
.tag--adopte    { color: var(--adopted); background: var(--adopted-bg); border-color: #cdcff0; }
.tag--plain { color: var(--muted); background: var(--line-2); border-color: var(--line); }
.tag--plain::before { display: none; }
.tag--big { font-size: .88rem; padding: 6px 14px; }
.tag--big::before { width: 8px; height: 8px; }

/* --- Surfaces -------------------------------------------------------------- */
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.card__body { padding: var(--s5); }
.panel { padding: var(--s5); }
.panel + .panel { margin-top: var(--s5); }
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3); flex-wrap: wrap; margin: 0 0 var(--s4);
}
.panel__head h2, .panel__head h3 { margin: 0; }

.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
@media (min-width: 900px) { .grid { gap: var(--s5); } }

/* --- Vignette animal -------------------------------------------------------- */
.beast {
  display: flex; flex-direction: column; position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: inherit; box-shadow: var(--shadow-1);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.beast:hover { box-shadow: var(--shadow-3); transform: translateY(-3px); border-color: var(--g-200); color: inherit; text-decoration: none; }
.beast::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--free); }
.beast[data-status="en_visite"]::after { background: var(--visit); }
.beast[data-status="adopte"]::after { background: var(--adopted); }

.beast__media { aspect-ratio: 4 / 3; background: var(--g-50); position: relative; }
.beast__media img { width: 100%; height: 100%; object-fit: cover; }
.beast__media--empty { display: grid; place-items: center; font-size: 2.2rem; font-weight: 700; color: var(--g-300); }
.beast__tag { position: absolute; top: var(--s3); left: var(--s3); background: rgba(255,255,255,.94); backdrop-filter: blur(4px); }
.beast__body { padding: var(--s4); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.beast__name { font-size: 1.08rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; margin: 0; }
.beast__meta { font-size: .86rem; color: var(--muted); margin: 0; }
.beast__foot { margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line-2); font-size: .8rem; color: var(--muted); }
.visits-strip { margin: 0; padding: 0; list-style: none; }
.visits-strip .when { color: var(--visit); font-weight: 600; }

/* --- Indicateurs ------------------------------------------------------------ */
.counters { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.counter {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--s4) var(--s5);
  box-shadow: var(--shadow-1);
}
.counter::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--g-300); }
.counter--libre::before     { background: var(--free); }
.counter--en_visite::before { background: var(--visit); }
.counter--adopte::before    { background: var(--adopted); }
.counter__n {
  display: block; font-size: 2rem; font-weight: 700; line-height: 1.1;
  color: var(--ink); letter-spacing: -.04em; font-variant-numeric: tabular-nums;
}
.counter__label { display: block; font-size: .82rem; font-weight: 500; color: var(--muted); margin-top: 2px; }

/* --- Tableaux ---------------------------------------------------------------- */
.matrix, .roster { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td, .roster th, .roster td { padding: 12px var(--s3); text-align: left; border-bottom: 1px solid var(--line-2); }
.matrix thead th, .roster thead th {
  font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); background: var(--g-50); border-bottom: 1px solid var(--line);
  padding-top: 10px; padding-bottom: 10px;
}
.matrix thead th:first-child, .roster thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.matrix thead th:last-child, .roster thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
.matrix { font-size: .92rem; }
.matrix td + td, .matrix th + th { text-align: right; font-variant-numeric: tabular-nums; }
.matrix tbody tr:last-child td { border-bottom: 0; }
.matrix tfoot td { font-weight: 700; color: var(--ink); border-top: 1px solid var(--line); border-bottom: 0; background: var(--g-50); }

.roster td { vertical-align: middle; }
.roster tbody tr { transition: background .12s ease; }
.roster tbody tr:hover { background: var(--g-50); }
.roster tbody tr:last-child td { border-bottom: 0; }
.roster .thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover; background: var(--g-50); }
.roster .thumb--empty { display: grid; place-items: center; font-weight: 700; color: var(--g-300); }
.roster .name { font-weight: 600; color: var(--ink); text-decoration: none; }
.roster .name:hover { color: var(--g-600); text-decoration: underline; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Actions rapides d'une ligne du registre. */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 760px) {
  .row-actions { width: 100%; justify-content: stretch; }
  .row-actions > * { flex: 1 1 auto; text-align: center; justify-content: center; }
}

/* Sur mobile, un tableau devient une pile de fiches : chaque cellule affiche
   son intitule (attribut data-label) au lieu d'un defilement horizontal. */
@media (max-width: 760px) {
  .roster, .roster tbody, .roster tr, .roster td { display: block; width: 100%; }
  .roster thead { display: none; }
  .roster tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--s3) var(--s4); margin-bottom: var(--s3); background: var(--surface);
  }
  .roster tr:last-child { margin-bottom: 0; }
  .roster td { border: 0; padding: 5px 0; display: flex; gap: var(--s4); align-items: center; justify-content: space-between; }
  .roster td::before {
    content: attr(data-label); flex: none;
    font-size: .78rem; font-weight: 600; color: var(--muted);
  }
  .roster td[data-label=""]::before { content: none; }
  .roster td[data-label=""] { justify-content: flex-start; }
  .roster td:last-child { justify-content: flex-end; padding-top: var(--s3); margin-top: var(--s2); border-top: 1px solid var(--line-2); }
  .roster .col-opt { display: flex; }
  .roster td > * { text-align: right; }
  .roster td[data-label=""] > * { text-align: left; }
  .matrix th, .matrix td { padding: 10px 8px; font-size: .88rem; }
}

/* --- Formulaires -------------------------------------------------------------- */
.field { margin-bottom: var(--s4); }
.field > label, .field-label { display: block; font-weight: 600; font-size: .88rem; color: var(--ink); margin-bottom: 6px; }
.field .hint { display: block; font-size: .81rem; color: var(--muted); margin-top: 5px; }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=url], input[type=date], input[type=time], input[type=search],
select, textarea {
  width: 100%; font: inherit; font-size: .94rem; color: var(--ink);
  padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .14s ease, box-shadow .14s ease;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236c8378' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
input:hover, select:hover, textarea:hover { border-color: var(--g-300); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--g-500); box-shadow: 0 0 0 3px var(--g-100); }
input::placeholder, textarea::placeholder { color: #9bada4; }
textarea { min-height: 118px; resize: vertical; }
input[type=file] {
  font-size: .88rem; padding: 9px 12px; background: var(--g-50);
  border: 1px dashed var(--line); border-radius: var(--radius-sm); width: 100%;
}

.row { display: grid; gap: var(--s4); grid-template-columns: 1fr 1fr; }
.row--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 700px) { .row, .row--3 { grid-template-columns: 1fr; } }

.checks { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s5); }
.check { display: flex; align-items: center; gap: 9px; font-size: .93rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--g-500); flex: none; }

fieldset { border: 0; padding: 0; margin: 0 0 var(--s6); }
legend {
  font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--g-600); padding: 0; margin-bottom: var(--s4);
  width: 100%; padding-bottom: var(--s2); border-bottom: 1px solid var(--line);
}

.form-actions { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; padding-top: var(--s5); border-top: 1px solid var(--line); }
@media (max-width: 560px) { .form-actions .btn { flex: 1 1 100%; } }

.filters { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; flex: 1 1 150px; min-width: 0; }
.filters .grow { flex: 2 1 220px; }
@media (max-width: 620px) {
  .filters .field, .filters .grow { flex-basis: 100%; }
  .filters .btn { flex: 1; }
}

/* --- Messages ------------------------------------------------------------------ */
.flash {
  display: flex; gap: var(--s3);
  border-radius: var(--radius-sm); padding: var(--s3) var(--s4);
  margin-bottom: var(--s4); font-size: .92rem;
  border: 1px solid var(--line); border-left: 3px solid var(--muted); background: var(--surface);
}
.flash--success { background: var(--free-bg);   border-color: #bfe2d3; border-left-color: var(--free);   color: #0f4c3a; }
.flash--error   { background: var(--danger-bg); border-color: #f1cfcd; border-left-color: var(--danger); color: #8f1e17; }
.flash--info    { background: var(--g-50); border-left-color: var(--g-400); color: var(--ink); }

.empty {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: var(--s7) var(--s5); text-align: center; color: var(--muted); background: var(--surface);
}
.empty h3 { margin-bottom: var(--s2); }

/* ==========================================================================
   Site public
   ========================================================================== */
.site-header {
  background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30;
}
.site-header .wrap { display: flex; align-items: center; gap: var(--s3) var(--s5); min-height: var(--header-h); flex-wrap: wrap; padding-block: var(--s2); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 700; letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand__mark { width: 30px; height: 30px; flex: none; color: var(--g-500); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.site-nav a:not(.btn) { color: var(--body-c); font-weight: 500; font-size: .93rem; text-decoration: none; }
.site-nav a:not(.btn):hover { color: var(--g-600); }
.site-nav a:not(.btn)[aria-current="page"] { color: var(--g-600); font-weight: 600; }
@media (max-width: 620px) {
  .site-nav { margin-left: 0; width: 100%; gap: var(--s3); }
  .site-nav a[href$="associations"] { display: none; }
  .site-nav .btn { margin-left: auto; }
}

/* La banniere d'accueil : grand aplat vert, le geste le plus affirme du site. */
.hero { padding: var(--s7) 0; background: var(--g-50); border-bottom: 1px solid var(--line); }
.hero--home {
  background:
    radial-gradient(1100px 420px at 88% -10%, rgba(36, 149, 111, .38), transparent 62%),
    linear-gradient(160deg, var(--g-800) 0%, var(--g-900) 100%);
  border-bottom: 0; color: rgba(255, 255, 255, .82);
  padding-block: var(--s8);
}
.hero--home h1 { color: #fff; max-width: 18ch; }
.hero--home .eyebrow { color: var(--g-200); }
.hero--home .eyebrow::before { background: var(--g-300); }
.hero__lead { font-size: 1.05rem; max-width: 56ch; color: var(--muted); }
.hero--home .hero__lead { color: rgba(255,255,255,.8); }
.hero__actions { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s5); }
.hero--home .btn { background: #fff; color: var(--g-800); }
.hero--home .btn:hover { background: var(--g-100); color: var(--g-900); }
.hero--home .btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.hero--home .btn--ghost:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.7); }
@media (max-width: 560px) { .hero__actions .btn { flex: 1 1 100%; } }

.hero__counts {
  display: grid; gap: var(--s3); margin-top: var(--s7);
  grid-template-columns: repeat(auto-fit, minmax(min(45%, 150px), 1fr));
}
.hero__count {
  padding: var(--s3) var(--s4); border-radius: var(--radius-sm);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
}
.hero__count b { display: block; font-size: 1.75rem; font-weight: 700; color: #fff; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hero__count span { font-size: .84rem; color: rgba(255,255,255,.72); }

.section { padding: var(--s7) 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.section__head h1, .section__head h2 { margin: 0; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: var(--s6) 0; margin-top: var(--s7); color: var(--muted); font-size: .89rem; }
.site-footer .wrap { display: flex; gap: var(--s5); flex-wrap: wrap; justify-content: space-between; }

/* --- Fiche detaillee ------------------------------------------------------------ */
.detail { display: grid; gap: var(--s6); grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; gap: var(--s5); } }
.detail__photo { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--g-50); aspect-ratio: 4 / 3; box-shadow: var(--shadow-1); }
.detail__photo img { width: 100%; height: 100%; object-fit: cover; }
.detail__photo--empty { display: grid; place-items: center; font-size: 3.4rem; font-weight: 700; color: var(--g-300); }

.facts { margin: 0; display: grid; grid-template-columns: minmax(90px, max-content) 1fr; gap: 0; font-size: .93rem; }
.facts dt { font-size: .84rem; color: var(--muted); padding: 10px var(--s4) 10px 0; border-bottom: 1px solid var(--line-2); }
.facts dd { margin: 0; padding: 10px 0; color: var(--ink); border-bottom: 1px solid var(--line-2); }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }

.visit-log { list-style: none; margin: 0; padding: 0; }
.visit-log li { display: grid; grid-template-columns: 92px 1fr auto; gap: var(--s4); align-items: start; padding: var(--s3) 0; border-bottom: 1px solid var(--line-2); }
.visit-log li:last-child { border-bottom: 0; }
.visit-log .date { font-weight: 700; font-size: .88rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.visit-log .date small { display: block; font-weight: 500; color: var(--muted); }
.visit-log--past { opacity: .55; }
@media (max-width: 640px) { .visit-log li { grid-template-columns: 1fr; gap: var(--s2); } }

/* ==========================================================================
   Espace association
   ========================================================================== */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; min-height: 100dvh; }

.side {
  background: linear-gradient(180deg, var(--g-800) 0%, var(--g-900) 100%);
  color: rgba(255,255,255,.72);
  padding: var(--s5) var(--s4);
  display: flex; flex-direction: column; gap: var(--s5);
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.side .brand { color: #fff; }
.side .brand:hover { color: #fff; }
.side .brand__mark { color: var(--g-300); }
.side__org { font-size: .85rem; color: rgba(255,255,255,.62); border-bottom: 1px solid rgba(255,255,255,.12); padding-bottom: var(--s4); }
.side__org b { display: block; color: #fff; font-size: .95rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 2px; }
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px var(--s3); border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75); text-decoration: none; font-size: .92rem; font-weight: 500;
  transition: background .14s ease, color .14s ease;
}
.side__nav a:hover { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.side__nav a[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.side__foot { margin-top: auto; font-size: .83rem; border-top: 1px solid rgba(255,255,255,.12); padding-top: var(--s4); color: rgba(255,255,255,.6); }
.side__foot .btn--ghost { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.22); margin-top: var(--s2); }
.side__foot .btn--ghost:hover { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.4); }

.main { padding: var(--s6); min-width: 0; }
.main__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.main__head h1 { margin: 0; }
@media (max-width: 560px) { .main__head .btn { flex: 1 1 100%; } }

.tabbar { display: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 25; height: auto;
    flex-direction: row; align-items: center;
    padding: var(--s3) var(--s4); gap: var(--s4);
  }
  .side__nav, .side__org, .side__foot .role { display: none; }
  .side__foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .side__foot .btn--ghost { margin-top: 0; }
  .main { padding: var(--s5) var(--s4) calc(var(--s8) + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 4px 8px; font-size: .68rem; font-weight: 500;
    color: var(--muted); text-decoration: none;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--g-600); font-weight: 700; }
  .tabbar svg { width: 22px; height: 22px; }
}

.dash { display: grid; gap: var(--s5); grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
@media (max-width: 1080px) { .dash { grid-template-columns: 1fr; } }

/* --- Boites de dialogue ---------------------------------------------------------- */
dialog {
  border: 0; border-radius: var(--radius); padding: 0;
  max-width: min(600px, calc(100vw - 2 * var(--s4))); width: 100%;
  color: var(--body-c); background: var(--surface); box-shadow: var(--shadow-3);
}
dialog::backdrop { background: rgba(6, 41, 31, .5); backdrop-filter: blur(2px); }
dialog .card__body { padding: var(--s5); max-height: 82vh; overflow-y: auto; }
.dialog__title { font-size: 1.15rem; font-weight: 700; color: var(--ink); letter-spacing: -.02em; margin: 0 0 var(--s4); padding-bottom: var(--s3); border-bottom: 1px solid var(--line); }
@media (max-width: 560px) {
  dialog { max-width: 100%; margin: auto auto 0; border-radius: var(--radius) var(--radius) 0 0; }
  dialog .card__body { max-height: 86vh; }
}

.offline-bar { background: var(--visit); color: #fff; text-align: center; padding: 8px var(--s4); font-size: .87rem; font-weight: 500; }

/* Invitation a installer l'application (PWA) */
.install-cta {
  display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  background: var(--g-50); border: 1px solid var(--g-200);
  border-radius: var(--radius); padding: var(--s3) var(--s4); margin-bottom: var(--s5);
  font-size: .9rem; color: var(--ink);
}
.install-cta .btn { margin-left: auto; }
@media (max-width: 560px) { .install-cta .btn { margin-left: 0; width: 100%; } }

/* --- Connexion et inscription ------------------------------------------------------ */
.auth-page {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s5) var(--s4);
  background:
    radial-gradient(900px 400px at 50% -10%, var(--g-100), transparent 70%),
    var(--canvas);
}
.auth-card { width: min(520px, 100%); }
.auth-card .card__body { padding: var(--s6); }
.auth-head { text-align: center; margin-bottom: var(--s5); }
.auth-head h1 { font-size: 1.5rem; }
.auth-head .brand { justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .side, .tabbar, .form-actions, .site-nav, .filters, .btn, .install-cta { display: none !important; }
  body { background: #fff; }
  .panel, .card { border: 1px solid #ccc; box-shadow: none; }
}
