/* ===== Equi-Vibes — charte ===== */
:root {
  --beige: #F5EFE4;
  --beige-2: #EDE4D3;
  --blanc: #FFFFFF;
  --foret: #2E4A38;
  --foret-fonce: #1F3A2B;
  --sauge: #5C7060;
  --sauge-claire: #8FA193;
  --vert-pale: #DCE8DD;
  --ocre: #C08552;
  --ocre-pale: #F0E0CE;
  --ocre-fonce: #6B4423;
  --bordure: #DCD2BF;
  --rouge-doux: #793030;
  --ombre: 0 1px 3px rgba(31, 58, 43, 0.07);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--beige);
  color: var(--foret-fonce);
  font-family: "Nunito Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Quicksand", "Nunito Sans", sans-serif; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
:focus-visible { outline: 2px solid var(--foret); outline-offset: 2px; border-radius: 6px; }
svg { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Connexion ===== */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--blanc);
  border: 0.5px solid var(--bordure);
  border-radius: 22px;
  box-shadow: var(--ombre);
  padding: 34px 30px 24px;
  text-align: center;
}
.login-logo { width: 170px; max-width: 70%; height: auto; margin: 0 auto 22px; display: block; }
.login form { text-align: left; display: flex; flex-direction: column; gap: 6px; }
.login label { font-size: 13px; font-weight: 600; color: var(--sauge); margin-top: 8px; }
.login input {
  font: inherit; color: var(--foret-fonce);
  background: var(--beige);
  border: 1px solid var(--bordure);
  border-radius: 12px;
  padding: 11px 14px;
}
.login input:focus { outline: 2px solid var(--foret); border-color: var(--foret); }
.login button[type="submit"] {
  margin-top: 18px;
  background: var(--foret); color: var(--beige);
  border-radius: 12px;
  padding: 12px;
  font-weight: 600; font-family: "Quicksand", sans-serif;
  transition: background 0.15s ease;
}
.login button[type="submit"]:hover { background: var(--foret-fonce); }
.login button[type="submit"]:disabled { opacity: 0.6; cursor: wait; }
.login-error { color: var(--rouge-doux); font-size: 13px; margin: 10px 0 0; }
.login-foot { font-size: 12px; color: var(--sauge-claire); margin: 22px 0 0; }

/* ===== Barre du haut ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--blanc);
  border-bottom: 0.5px solid var(--bordure);
  display: flex; align-items: center; gap: 14px;
  padding: 8px 16px;
  padding-top: calc(8px + env(safe-area-inset-top));
}
.logo-btn { padding: 2px; border-radius: 50%; flex-shrink: 0; }
.logo-btn img { height: 46px; width: auto; display: block; }
.tabs { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.tab {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--sauge);
  padding: 7px 10px; border-radius: 9px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab svg { width: 17px; height: 17px; flex-shrink: 0; }
.tab:hover { background: var(--beige); color: var(--foret-fonce); }
.tab.active { background: var(--foret); color: var(--beige); font-weight: 600; }
.tab-2lines span { line-height: 1.15; text-align: left; font-size: 12px; }
.iconbtn { color: var(--sauge); padding: 8px; border-radius: 9px; }
.iconbtn svg { width: 19px; height: 19px; display: block; }
.iconbtn:hover { background: var(--beige); color: var(--foret-fonce); }

/* ===== Contenu ===== */
#content {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 18px calc(86px + env(safe-area-inset-bottom));
}
.page h1 { font-size: 24px; font-weight: 600; margin: 4px 0 16px; }
.hello h1 { margin-bottom: 2px; }
.hello p { margin: 0 0 18px; color: var(--sauge); font-size: 14px; text-transform: capitalize; }
.card {
  background: var(--blanc);
  border: 0.5px solid var(--bordure);
  border-radius: 16px;
  box-shadow: var(--ombre);
  padding: 18px 20px;
}
.welcome-card { background: var(--foret); border-color: var(--foret); color: var(--beige); }
.welcome-card h2 { margin: 0 0 6px; font-size: 17px; }
.welcome-card p { margin: 0; font-size: 14px; color: var(--vert-pale); }

.roadmap-title { font-size: 14px; color: var(--sauge); font-weight: 600; margin: 24px 0 10px; }
.roadmap { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.roadmap li {
  display: flex; align-items: center; gap: 14px;
  background: var(--blanc);
  border: 0.5px solid var(--bordure);
  border-radius: 14px;
  padding: 12px 16px;
}
.roadmap .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--beige-2); border: 1.5px solid var(--bordure);
  flex-shrink: 0;
}
.roadmap li.done .dot { background: var(--foret); border-color: var(--foret); }
.roadmap div { flex: 1; min-width: 0; }
.roadmap strong { display: block; font-size: 14px; }
.roadmap small { color: var(--sauge-claire); font-size: 12px; }
.roadmap em {
  font-style: normal; font-size: 12px; color: var(--sauge);
  background: var(--beige); border-radius: 7px; padding: 3px 9px;
  white-space: nowrap;
}
.roadmap li.done em { background: var(--vert-pale); color: var(--foret-fonce); font-weight: 600; }

.placeholder { text-align: center; padding: 42px 20px; }
.placeholder p { margin: 4px 0; color: var(--sauge); font-size: 14px; }
.placeholder p strong { color: var(--foret-fonce); font-size: 15px; }
.ph-icon { width: 34px; height: 34px; color: var(--sauge-claire); margin-bottom: 8px; }

.app-foot {
  text-align: center;
  font-size: 12px; color: var(--sauge-claire);
  margin-top: 34px;
}

/* ===== Barre mobile ===== */
.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--blanc);
  border-top: 0.5px solid var(--bordure);
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.bb {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--sauge-claire);
  font-size: 10.5px;
  padding: 4px 10px; border-radius: 10px;
  min-width: 56px;
}
.bb svg { width: 22px; height: 22px; }
.bb.active { color: var(--foret-fonce); font-weight: 700; }

/* ===== Volet "Plus" ===== */
#sheet-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(31, 58, 43, 0.35);
}
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  background: var(--blanc);
  border-radius: 20px 20px 0 0;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(31, 58, 43, 0.18);
}
.sheet-link {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 14px 12px;
  font-size: 15px; color: var(--foret-fonce);
  border-radius: 12px;
  text-align: left;
}
.sheet-link svg { width: 20px; height: 20px; color: var(--sauge); }
.sheet-link:hover { background: var(--beige); }
.sheet-logout { color: var(--rouge-doux); border-top: 0.5px solid var(--bordure); border-radius: 0 0 12px 12px; margin-top: 6px; }
.sheet-logout svg { color: var(--rouge-doux); }

/* ===== Responsive ===== */
.desktop-only { display: flex; }
@media (max-width: 919px) {
  .tabs, .desktop-only { display: none; }
  .topbar { justify-content: center; }
  .logo-btn img { height: 42px; }
}
@media (min-width: 920px) {
  .bottombar, #sheet, #sheet-backdrop { display: none !important; }
  #content { padding-bottom: 40px; }
  .logo-btn img { height: 50px; }
}

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

/* ===========================================================
   Session 2 — Agenda & Clients
   =========================================================== */

/* ----- Boutons & en-têtes de page ----- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.head-actions { display: flex; gap: 8px; }
.btn-primary {
  background: var(--foret); color: var(--beige);
  border-radius: 11px; padding: 9px 16px;
  font-weight: 600; font-family: "Quicksand", sans-serif; font-size: 14px;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--foret-fonce); }
.btn-primary.full { width: 100%; margin-top: 10px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--blanc); color: var(--foret-fonce);
  border: 1px solid var(--bordure);
  border-radius: 11px; padding: 8px 14px;
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn-ghost:hover { background: var(--beige); }
.btn-ghost.small { padding: 5px 11px; font-size: 13px; }
.btn-ghost svg { width: 16px; height: 16px; }
.sub-title { font-size: 14px; color: var(--sauge); font-weight: 600; margin: 24px 0 10px; }
.sub-head { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.sub-head .sub-title { margin: 0; }
.empty-card { text-align: center; color: var(--sauge); font-size: 14px; padding: 24px 18px; }

/* ----- Calendrier ----- */
.cal-card { padding: 16px 14px 12px; }
.cal-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-title { font-family: "Quicksand", sans-serif; font-weight: 600; font-size: 16px; text-transform: capitalize; flex: 1; text-align: center; }
.cal-arrow { font-size: 22px; line-height: 1; color: var(--sauge); padding: 4px 12px; border-radius: 9px; }
.cal-arrow:hover { background: var(--beige); color: var(--foret-fonce); }
.cal-grid-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid-head span { text-align: center; font-size: 11px; font-weight: 700; color: var(--sauge-claire); padding: 4px 0; }
.cal-cell {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  background: var(--beige);
  border: 1px solid var(--beige-2);
  border-radius: 10px;
  padding: 6px 7px;
  min-height: 84px;
  font-size: 13.5px; color: var(--foret-fonce);
  overflow: hidden;
}
.cal-cell:hover { background: var(--beige-2); }
.cal-cell.empty { background: transparent; border-color: transparent; pointer-events: none; }
.cal-num { font-weight: 600; line-height: 1; }
.cal-cell.today .cal-num { color: var(--ocre); font-weight: 800; }
.cal-cell.selected { background: var(--foret); border-color: var(--foret); color: var(--beige); }
.cal-cell.selected .cal-num, .cal-cell.selected.today .cal-num { color: var(--beige); }
.cal-ev {
  display: block; width: 100%;
  font-size: 11px; line-height: 1.3; text-align: left;
  background: var(--vert-pale); color: var(--foret-fonce);
  border-radius: 6px; padding: 2px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-cell.selected .cal-ev { background: rgba(245, 239, 228, 0.2); color: var(--beige); }
.cal-more { font-size: 10.5px; color: var(--sauge); }
.cal-cell.selected .cal-more { color: var(--vert-pale); }
.cal-dot { display: none; width: 5px; height: 5px; border-radius: 50%; background: var(--ocre); }

/* Mobile : cases compactes, point sous le numéro */
@media (max-width: 640px) {
  .cal-grid-head, .cal-grid { gap: 3px; }
  .cal-cell {
    min-height: 0; aspect-ratio: 1 / 0.9;
    align-items: center; justify-content: center;
    padding: 2px; gap: 2px;
    background: transparent; border: none;
  }
  .cal-cell:hover { background: var(--beige); }
  .cal-cell.selected { background: var(--foret); }
  .cal-ev, .cal-more { display: none; }
  .cal-dot { display: block; }
  .cal-cell.selected .cal-dot { background: var(--beige); }
}

/* ----- Cartes rendez-vous ----- */
.rdv-list { display: flex; flex-direction: column; gap: 8px; }
.rdv-item {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 16px;
}
.rdv-item.annule { opacity: 0.55; }
.rdv-time {
  font-family: "Quicksand", sans-serif; font-weight: 700; font-size: 13px;
  color: var(--foret); min-width: 52px; max-width: 120px;
  text-transform: capitalize; line-height: 1.3;
}
.rdv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rdv-main strong { font-size: 14.5px; }
.rdv-main small { color: var(--sauge); font-size: 12.5px; }
.rdv-lieu { display: inline-flex; align-items: center; gap: 4px; }
.rdv-lieu svg { width: 12px; height: 12px; flex-shrink: 0; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 8px; white-space: nowrap; }
.badge-prevu { background: var(--vert-pale); color: var(--foret-fonce); }
.badge-fait { background: var(--ocre-pale); color: var(--ocre-fonce); }
.badge-annule { background: var(--beige-2); color: var(--sauge); }
.rdv-actions { display: flex; gap: 4px; }
.mini-btn {
  width: 32px; height: 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sauge); text-decoration: none;
}
.mini-btn svg { width: 16px; height: 16px; }
.mini-btn:hover { background: var(--beige); color: var(--foret-fonce); }
.mini-btn.done { color: var(--ocre); }

/* ----- Liste & fiche client ----- */
.search {
  width: 100%; font: inherit; color: var(--foret-fonce);
  background: var(--blanc); border: 1px solid var(--bordure);
  border-radius: 12px; padding: 11px 15px; margin-bottom: 14px;
}
.search:focus { outline: 2px solid var(--foret); border-color: var(--foret); }
.client-item, .animal-item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; width: 100%; text-align: left; }
.client-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--vert-pale); color: var(--foret);
  display: flex; align-items: center; justify-content: center;
  font-family: "Quicksand", sans-serif; font-weight: 700; font-size: 17px;
}
.client-avatar.animal { background: var(--ocre-pale); font-size: 19px; }
.client-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.client-main strong { font-size: 14.5px; }
.client-main small { color: var(--sauge); font-size: 12.5px; }
.animal-notes { white-space: pre-line; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 40%; }
.chip { background: var(--beige); border: 1px solid var(--bordure); border-radius: 8px; padding: 2px 8px; font-size: 11.5px; color: var(--sauge); }
.back-btn { color: var(--sauge); font-size: 14px; font-weight: 600; padding: 6px 10px 6px 0; margin-bottom: 4px; border-radius: 8px; }
.back-btn:hover { color: var(--foret-fonce); }
.detail-card { display: flex; flex-direction: column; gap: 9px; }
.detail-row { display: flex; gap: 14px; font-size: 14px; }
.detail-row span { color: var(--sauge); min-width: 86px; flex-shrink: 0; font-size: 13px; padding-top: 1px; }
.detail-row strong { font-weight: 600; word-break: break-word; }
.detail-row.notes strong { font-weight: 400; white-space: pre-line; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; padding-top: 12px; border-top: 0.5px solid var(--bordure); }
.danger-link {
  color: var(--rouge-doux); font-size: 13px; font-weight: 600;
  margin: 26px auto 0; display: block; padding: 8px 14px; border-radius: 9px;
}
.danger-link:hover { background: #f7eaea; }

/* ----- Modales ----- */
#modal-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(31, 58, 43, 0.4); }
.no-scroll { overflow: hidden; }
.modal {
  position: fixed; z-index: 41;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(100% - 28px); max-width: 460px;
  max-height: calc(100dvh - 40px); overflow-y: auto;
  background: var(--blanc); border-radius: 18px;
  box-shadow: 0 12px 40px rgba(31, 58, 43, 0.25);
  padding: 22px 22px 18px;
}
.modal h2 { font-size: 18px; margin: 0 0 14px; }
.modal-hint { font-size: 13px; color: var(--sauge); margin: -6px 0 10px; }
.modal form { display: flex; flex-direction: column; gap: 4px; }
.modal label { font-size: 12.5px; font-weight: 600; color: var(--sauge); margin-top: 9px; }
.modal input, .modal select, .modal textarea {
  font: inherit; color: var(--foret-fonce);
  background: var(--beige); border: 1px solid var(--bordure);
  border-radius: 11px; padding: 10px 13px; width: 100%;
}
.modal input:focus, .modal select:focus, .modal textarea:focus { outline: 2px solid var(--foret); border-color: var(--foret); }
.modal textarea { resize: vertical; }
#f-ex-texte { margin-bottom: 2px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid-3 { grid-template-columns: 1.2fr 1fr 1fr; }
.form-grid label { display: block; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions .danger-link { margin: 0 auto 0 0; padding: 8px 0; }

/* ----- Toast ----- */
#toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--foret-fonce); color: var(--beige);
  border-radius: 12px; padding: 11px 20px;
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; z-index: 60;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 920px) { #toast { bottom: 30px; } }

@media (max-width: 520px) {
  .rdv-time { min-width: 44px; }
  .chips { display: none; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .form-grid-3 div:first-child { grid-column: 1 / -1; }
}

/* ----- Code couleur par type de prestation -----
   Vert sapin : séances & stages (RDV extérieurs)
   Beige      : communication animale & soins énergétiques */
.cal-ev.t-seance, .cal-ev.t-stage { background: var(--foret); color: var(--beige); }
.cal-ev.t-comm, .cal-ev.t-soin { background: var(--beige-2); color: var(--foret-fonce); border: 1px solid var(--bordure); }
.cal-ev.t-autre { background: var(--vert-pale); color: var(--foret-fonce); }
.cal-cell.selected .cal-ev.t-seance, .cal-cell.selected .cal-ev.t-stage { background: rgba(245, 239, 228, 0.22); color: var(--beige); }
.cal-cell.selected .cal-ev.t-comm, .cal-cell.selected .cal-ev.t-soin { background: var(--beige); color: var(--foret-fonce); border-color: var(--beige); }

/* Liseré assorti sur les cartes rendez-vous (listes) */
.rdv-item { border-left: 4px solid var(--bordure); }
.rdv-item.t-seance, .rdv-item.t-stage { border-left-color: var(--foret); }
.rdv-item.t-comm, .rdv-item.t-soin { border-left-color: var(--beige-2); }

/* ===========================================================
   Session 3 — Factures & Compta
   =========================================================== */
.badge-f-brouillon { background: var(--beige-2); color: var(--sauge); }
.badge-f-envoyee { background: var(--vert-pale); color: var(--foret-fonce); }
.badge-f-payee { background: var(--ocre-pale); color: var(--ocre-fonce); }

/* Lignes de facture */
.ligne-row { display: grid; grid-template-columns: 1fr 64px 92px 30px; gap: 6px; margin-bottom: 6px; align-items: center; }
.l-del { color: var(--sauge); font-size: 18px; border-radius: 8px; padding: 4px; }
.l-del:hover { background: #f7eaea; color: var(--rouge-doux); }
#fact-ligne-add { align-self: flex-start; margin-top: 2px; }
#fact-frais-box { margin-top: 12px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--foret-fonce); flex-wrap: wrap; margin-top: 0 !important; }
.check-line input { width: auto; accent-color: var(--foret); }
.check-line small { color: var(--sauge); }
.frais-info { color: var(--sauge-claire); font-size: 12.5px; }
.total-box { display: flex; flex-direction: column; }
.total-box strong { font-size: 20px; font-family: "Quicksand", sans-serif; color: var(--foret); padding: 8px 0 0 2px; }
.dep-montant { color: var(--rouge-doux); font-size: 14px; white-space: nowrap; }

/* KPIs compta */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.kpi { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; }
.kpi small { color: var(--sauge); font-size: 12px; }
.kpi strong { font-size: 18px; font-family: "Quicksand", sans-serif; color: var(--foret); }
.urssaf-card { background: var(--vert-pale); border-color: var(--vert-pale); margin-bottom: 14px; }
.urssaf-card p { margin: 4px 0 0; font-size: 14px; }
.urssaf-card small { color: var(--sauge); }
@media (max-width: 700px) { .kpis { grid-template-columns: 1fr 1fr; } }

/* Tableau annuel */
.table-wrap { overflow-x: auto; }
.ctable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ctable th { text-align: left; color: var(--sauge); font-size: 12px; font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--bordure); }
.ctable td { padding: 7px 10px; border-bottom: 0.5px solid var(--beige-2); white-space: nowrap; }
.ctable tr.vide td { color: var(--sauge-claire); }
.ctable tfoot td { font-weight: 700; border-top: 1.5px solid var(--bordure); border-bottom: none; color: var(--foret); }

/* ----- Impression facture ----- */
#print-area { display: none; }
@media print {
  body { background: #fff; }
  .topbar, .bottombar, #content, #sheet, #sheet-backdrop, #toast, .modal, #modal-backdrop, #login-view { display: none !important; }
  #print-area { display: block !important; padding: 10mm 6mm; color: #1F3A2B; font-family: "Nunito Sans", sans-serif; }
}
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.inv-head img { height: 90px; }
.inv-id { text-align: right; }
.inv-id h1 { font-family: "Quicksand", sans-serif; font-size: 26px; margin: 0; letter-spacing: 2px; }
.inv-id p { margin: 2px 0; font-size: 13px; }
.inv-parties { display: flex; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.inv-parties h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: #5C7060; margin: 0 0 6px; }
.inv-parties p { margin: 0; font-size: 13.5px; line-height: 1.6; }
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.inv-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: #5C7060; border-bottom: 1.5px solid #2E4A38; padding: 8px 6px; }
.inv-table td { padding: 9px 6px; border-bottom: 0.5px solid #DCD2BF; font-size: 13.5px; }
.inv-table th:nth-child(n+2), .inv-table td:nth-child(n+2) { text-align: right; }
.inv-total { text-align: right; font-size: 17px; margin: 8px 0 2px; }
.inv-tva { text-align: right; font-size: 12px; color: #5C7060; margin: 0 0 22px; }
.inv-notes { font-size: 13px; margin: 0 0 14px; }
.inv-mentions { font-size: 10.5px; color: #5C7060; line-height: 1.5; margin: 0 0 26px; }
.inv-foot { text-align: center; font-size: 11px; color: #8FA193; }

/* Session 3b — catalogue & RIB */
#f-fa-presta { margin-bottom: 8px; color: var(--sauge); }
.inv-rib { font-size: 12.5px; background: #F5EFE4; border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; line-height: 1.6; }

/* Session 4 — Communication Animale & volet mail */
select.search { appearance: auto; }
#m-mail-to, #m-mail-subject { background: var(--beige-2); }
#modal-mail label { margin-top: 9px; display: block; font-size: 12.5px; font-weight: 600; color: var(--sauge); }
#modal-mail input, #modal-mail textarea {
  font: inherit; color: var(--foret-fonce); background: var(--beige);
  border: 1px solid var(--bordure); border-radius: 11px; padding: 10px 13px; width: 100%;
}
#modal-mail textarea { resize: vertical; font-size: 14px; }

/* Session 4b — éditeur compte rendu & export PDF */
.modal-large { max-width: 720px; }
.cr-lab { display: block; font-size: 13px; font-weight: 700; color: var(--foret); margin-top: 14px; font-family: "Quicksand", sans-serif; }
.cr-lab.tir { color: var(--ocre-fonce); }
.cr-h4 { font-family: "Quicksand", sans-serif; font-size: 14.5px; color: var(--foret); margin: 18px 0 6px; }
.cr-h4 small { font-weight: 400; font-size: 11px; color: var(--sauge); display: block; }
.cr-table { border: 1px solid var(--bordure); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.cr-th { background: var(--foret); color: var(--beige); font-weight: 600; font-size: 13px; padding: 7px 12px; font-family: "Quicksand", sans-serif; }
.cr-tr { display: grid; grid-template-columns: 170px 1fr; border-top: 0.5px solid var(--beige-2); }
.cr-tr span { padding: 8px 12px; font-size: 12.5px; background: var(--vert-pale); color: var(--foret-fonce); font-weight: 600; }
.cr-tr input { border: none; border-radius: 0; background: var(--blanc); padding: 8px 12px; font-size: 13px; }
.ph-block { margin: 8px 0 4px; }
.ph-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.ph-thumb { position: relative; }
.ph-thumb img { height: 74px; border-radius: 9px; display: block; }
.ph-x { position: absolute; top: -7px; right: -7px; width: 21px; height: 21px; border-radius: 50%; background: var(--rouge-doux); color: #fff; font-size: 13px; line-height: 1; }
.libre-row { border: 1px solid var(--bordure); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--blanc); }
.libre-row .l-titre { font-weight: 700; margin-bottom: 6px; }
@media (max-width: 520px) { .cr-tr { grid-template-columns: 120px 1fr; } }

/* PDF compte rendu */
.crp { background: #F0EBE0; padding: 14mm 12mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 13px; line-height: 1.6; color: #1F2A1F; }
.crp-top { display: flex; justify-content: space-between; align-items: flex-start; }
.crp-top img { height: 110px; }
.crp-sign { font-style: italic; color: #4a5a3a; font-size: 13px; text-align: right; }
.crp-h1 { text-align: center; font-family: "Quicksand", sans-serif; font-style: italic; font-size: 30px; color: #5a6e3a; text-decoration: underline; margin: 10px 0 18px; }
.crp-quote { text-align: center; font-style: italic; color: #8a9a5b; margin: 0 0 26px; }
.crp-id { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.crp-id p { margin: 0 0 14px; font-size: 15px; }
.crp-animal { width: 200px; border-radius: 14px; object-fit: cover; }
.crp-tit { font-family: "Quicksand", sans-serif; font-style: italic; font-weight: 700; color: #5a6e3a; font-size: 15px; }
.crp-sec { margin: 0 0 16px; }
.crp-note { font-style: italic; font-size: 11px; color: #6b7a5a; }
.crp-table { width: 100%; border-collapse: collapse; margin: 0 0 16px; page-break-inside: avoid; }
.crp-table th { background: #7a9447; color: #fff; text-align: left; padding: 7px 10px; font-family: "Quicksand", sans-serif; }
.crp-table th + th { width: 68%; }
.crp-table td { padding: 6px 10px; border-bottom: 1px solid #fff; }
.crp-table td:first-child { background: #a8bf7a; color: #2a331a; font-weight: 600; }
.crp-table td:last-child { background: #dde7c8; }
.crp-q { font-family: "Quicksand", sans-serif; font-style: italic; font-weight: 700; color: #8a6d3b; text-decoration: underline; margin: 14px 0 8px; }
.crp-photos { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; page-break-inside: avoid; }
.crp-photos img { max-width: 100%; max-height: 105mm; border-radius: 8px; }
.crp-photos.cartes img { max-width: 46%; max-height: 120mm; object-fit: contain; background: #fff; }
.crp-foot { text-align: center; font-size: 11px; color: #8a9a5b; margin-top: 30px; }

/* v9 — éditeur tableaux, PDF compact, Publications & Etho */
.cr-th { display: flex; gap: 8px; align-items: center; padding: 4px 8px 4px 12px; }
.cr-th-in { flex: 1; background: transparent; border: none; color: var(--beige); font-weight: 600; font-family: "Quicksand", sans-serif; font-size: 13px; padding: 4px 0; }
.tb-del, .tr-del { color: var(--sauge-claire); font-size: 16px; padding: 2px 8px; border-radius: 7px; }
.cr-th .tb-del { color: var(--beige); opacity: 0.7; }
.tr-del:hover, .tb-del:hover { color: var(--rouge-doux); background: rgba(255,255,255,0.25); }
.cr-tr { grid-template-columns: 158px 1fr 30px; }
.cr-lab-in { background: var(--vert-pale); border: none; border-radius: 0; padding: 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--foret-fonce); }
.cr-table .row-add { margin: 6px 8px 8px; }
.pub-num { font-family: "Quicksand", sans-serif; font-weight: 700; color: var(--ocre); min-width: 42px; }
.etho-mois { margin-top: 18px; }
#print-area.pdf-render { display: block !important; position: fixed; left: -2000px; top: 0; width: 794px; }
.crp-top img { height: 78px; }
.crp-h1 { font-size: 24px; margin: 6px 0 12px; }
.crp-quote { margin-bottom: 16px; }
.crp-id { margin-bottom: 16px; align-items: flex-start; }
.crp-animal { width: 150px; height: 150px; object-fit: cover; border-radius: 12px; }
.crp { padding: 10mm; }

/* v10 — PDF : photo non déformée, noms centrés, pagination */
.crp-animal { width: 150px; height: 150px; border-radius: 12px; background-size: cover; background-position: center; flex-shrink: 0; }
.crp-id { align-items: center; }
.crp-noms p { margin: 0 0 16px; }
#print-area.pdf-render .crp { position: relative; }

/* v11 — facture PDF, grille publications, Etho résumés */
.invp { background: #fff; padding: 12mm 10mm; position: relative; }
.pub-table .pcell { cursor: pointer; text-align: center; font-size: 15px; font-weight: 700; user-select: none; }
.pub-table .pcell:hover { background: var(--beige); }
.p-pub { color: var(--foret); }
.p-pret { color: var(--ocre); }
.p-na { color: var(--sauge-claire); }
.pub-titre { white-space: normal; min-width: 180px; }
.pub-titre small { display: block; color: var(--sauge-claire); font-size: 11px; }
.pub-act { white-space: nowrap; }
.pub-leg { font-size: 11.5px; color: var(--sauge); margin: 10px 4px 0; }
.etho-card { display: flex; flex-direction: column; gap: 2px; }
.etho-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.etho-src { color: var(--sauge); font-size: 12px; }
.etho-resume { white-space: pre-line; font-size: 13.5px; margin: 8px 0 0; line-height: 1.6; }

/* v12 — onglet Mails & bouton envoyer */
.mails-intro { color: var(--sauge); font-size: 14px; margin: 0 0 16px; }
.mail-box { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; transition: background 0.15s ease; }
.mail-box:hover { background: var(--beige); }
.mail-box.pro { border-color: var(--foret); border-width: 1px; }
.mail-ico { font-size: 24px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--vert-pale); border-radius: 12px; flex-shrink: 0; }
.mail-box.pro .mail-ico { background: var(--foret); }
.mail-go { color: var(--foret); font-weight: 600; font-size: 13px; white-space: nowrap; }
#mail-send[disabled] { opacity: 0.6; cursor: wait; }

/* ===========================================================
   v12b — Affinage affichage mobile (perfectionnisme !)
   =========================================================== */
@media (max-width: 600px) {
  /* En-têtes de page : titre + bouton bien séparés */
  .page-head { align-items: center; }
  .page-head h1 { font-size: 21px; }
  .head-actions { width: auto; }

  /* Cartes liste (factures, CR, RDV, publications, dépenses) :
     on réorganise en grille pour que rien ne s'empile n'importe comment */
  .rdv-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "time main badge"
      "time main actions";
    align-items: center;
    gap: 4px 12px;
    padding: 12px 14px;
  }
  .rdv-time { grid-area: time; min-width: 42px; font-size: 12px; }
  .rdv-main { grid-area: main; }
  .rdv-item .badge { grid-area: badge; justify-self: end; align-self: start; margin-top: 2px; }
  .rdv-actions {
    grid-area: actions;
    justify-self: end;
    align-self: end;
    gap: 2px;
  }
  /* Cartes Etho (sans badge) gardent leur affichage flex, pas de grille */
  .etho-card { display: flex !important; }

  .mini-btn { width: 34px; height: 34px; }
  .rdv-main strong { font-size: 14px; line-height: 1.25; }
  .rdv-main small { font-size: 12px; }

  /* Factures/CR : la liste d'actions ne déborde plus, elle est sur sa ligne */
  .pub-act { display: flex; gap: 2px; }

  /* Boîtes mail : flèche "Ouvrir" qui ne colle pas au texte */
  .mail-box { padding: 14px; }
  .mail-go { font-size: 12px; }

  /* Modales : un peu plus d'air en haut sur mobile */
  .modal { padding: 20px 16px 16px; border-radius: 16px; }
  .modal-actions { flex-wrap: wrap; gap: 8px; }
  .modal-actions .btn-primary,
  .modal-actions .btn-ghost { flex: 1; text-align: center; justify-content: center; min-width: 0; }
  .modal-actions .danger-link { flex-basis: 100%; order: 3; text-align: center; }

  /* Volet mail : 3 boutons empilés proprement plutôt que serrés */
  #modal-mail .modal-actions { flex-direction: column; }
  #modal-mail .modal-actions button { width: 100%; }

  /* Calendrier : cellules un poil plus compactes */
  .cal-cell { font-size: 12.5px; }

  /* Tableau publications : lisible sans déborder */
  .pub-table .pcell { font-size: 16px; padding: 8px 4px; }
  .pub-titre { min-width: 130px; }
}

/* Très petits écrans : on réduit encore légèrement */
@media (max-width: 380px) {
  .rdv-time { min-width: 38px; font-size: 11.5px; }
  .mini-btn { width: 32px; height: 32px; }
  .mini-btn svg { width: 15px; height: 15px; }
  .page-head h1 { font-size: 20px; }
  .btn-primary { padding: 9px 13px; font-size: 13px; }
}
