:root {
  --green: #0B5D46; --green-2: #0E7A5C; --green-soft: #E3F0EB;
  --gold: #F2C14E; --ink: #1B1F1D; --muted: #66706B; --line: #E4E1D9;
  --bg: #F6F4EF; --card: #FFFFFF; --red: #C0392B; --red-soft: #FBE9E7;
  --amber: #B7791F; --amber-soft: #FFF4DC; --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--green); }
.app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(96px + var(--safe-b)); }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--green); color: #fff; }
.brand { font-weight: 800; letter-spacing: .12em; font-size: 20px; }
.brand::after { content: ""; display: inline-block; width: 7px; height: 7px; background: var(--gold); border-radius: 50%; margin-left: 4px; }
.spacer { flex: 1; }
.icon-btn { background: transparent; border: 0; color: inherit; font-size: 22px; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.icon-btn:active { background: rgba(255,255,255,.15); }
.badge-mode { background: var(--gold); color: #3a2c00; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar a { flex: 1; text-align: center; padding: 10px 4px 12px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
.tabbar a .ti { display: flex; justify-content: center; margin-bottom: 3px; }
.tabbar a .ico { stroke-width: 1.7; }
.tabbar a.on .ico { stroke-width: 2.2; }
.tabbar a.on { color: var(--green); }

h1 { font-size: 24px; margin: 8px 0 4px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.99); }
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }
.title { font-weight: 700; }
.muted { color: var(--muted); font-size: 14px; }
.amount { font-weight: 800; font-size: 20px; white-space: nowrap; }
.big-amount { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px 18px; font-weight: 700; font-size: 16px; cursor: pointer; text-align: center; text-decoration: none; background: var(--green); color: #fff; margin-top: 12px; }
.btn:active { background: var(--green-2); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.secondary { background: var(--green-soft); color: var(--green); }
.btn.ghost { background: transparent; color: var(--green); border: 1.5px solid var(--line); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.small { display: inline-block; width: auto; padding: 9px 14px; font-size: 14px; margin: 0; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; } .btn-row .btn { flex: 1; }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input, select { width: 100%; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; }
input:focus, select:focus { outline: none; border-color: var(--green); }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.otp { letter-spacing: .5em; text-align: center; font-size: 24px; font-weight: 700; }

.choice { display: grid; gap: 10px; }
.choice button { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px; background: #fff; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.choice button.on { border-color: var(--green); background: var(--green-soft); }
.choice .ci { width: 48px; height: 48px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); border-radius: 12px; flex: none; }
.ops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ops button { padding: 12px 6px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font-weight: 700; font-size: 14px; }
.ops button.on { border-color: var(--green); background: var(--green-soft); color: var(--green); }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill.paid, .pill.SUCCESS, .pill.active { background: var(--green-soft); color: var(--green); }
.pill.due, .pill.PENDING, .pill.PROCESSING, .pill.pending { background: var(--amber-soft); color: var(--amber); }
.pill.late, .pill.FAILED, .pill.CANCELLED, .pill.EXPIRED, .pill.rejected { background: var(--red-soft); color: var(--red); }

.hero { background: var(--green); color: #fff; border-radius: 20px; padding: 20px; margin: 4px 0 12px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(242,193,78,.18); }
.hero .muted { color: rgba(255,255,255,.75); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stats div { background: rgba(255,255,255,.12); border-radius: 12px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 22px; }
.stats span { font-size: 12px; color: rgba(255,255,255,.8); }

.qr-box { background: #fff; border-radius: 20px; padding: 20px; text-align: center; border: 1px solid var(--line); }
.qr-box img { width: 100%; max-width: 280px; image-rendering: pixelated; }
.code-big { font-family: ui-monospace, Menlo, monospace; font-size: 26px; font-weight: 800; letter-spacing: .18em; margin: 10px 0 2px; }
.timer { color: var(--muted); font-size: 14px; }

.scanner { position: relative; background: #000; border-radius: 20px; overflow: hidden; aspect-ratio: 1; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 15%; border: 3px solid var(--gold); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }

.lines { margin: 0; padding: 0; list-style: none; }
.lines li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.lines li:last-child { border-bottom: 0; }
.lines li.total { font-weight: 800; font-size: 18px; border-top: 2px solid var(--ink); border-bottom: 0; margin-top: 4px; }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .ei { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-soft); color: var(--green); }
.alert { background: var(--amber-soft); color: #6b4a10; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 12px 0; }
.alert.err { background: var(--red-soft); color: var(--red); }
.spinner { width: 54px; height: 54px; border: 5px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; animation: spin 1s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.check { width: 72px; height: 72px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; margin: 12px auto; }
.fail { background: var(--red); }

.toast { position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; max-width: 90vw; z-index: 50; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

.login-hero { text-align: center; padding: 36px 8px 8px; }
.login-hero .logo { width: 84px; height: 84px; margin: 0 auto 10px; }
.login-hero h1 { font-size: 34px; letter-spacing: .1em; margin: 0; }

/* Quittance imprimable */
.receipt { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.receipt .rh { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--green); padding-bottom: 12px; margin-bottom: 12px; }
.receipt .rh .brand { color: var(--green); }
@media print {
  .topbar, .tabbar, .no-print, .toast { display: none !important; }
  body, .app { background: #fff; padding: 0; }
  .receipt { border: 0; }
}

/* Écran de confirmation du paiement */
.confirm { padding: 4px 16px; }
.confirm .ci { padding: 12px 0; border-bottom: 1px solid var(--line); }
.confirm .ci:last-child { border-bottom: 0; }
.confirm .cl { color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.confirm .cv { font-size: 17px; font-weight: 600; }
.confirm .cs { color: var(--muted); font-size: 13px; }
.confirm .tot .cv { font-size: 22px; font-weight: 800; color: var(--green); }

/* Icônes */
.ico { display: block; flex: none; }
.icon-btn { display: grid; place-items: center; }
.btn-ico { display: inline-flex; vertical-align: -4px; margin-right: 8px; }
.row .ci.avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); flex: none; }
.icon-btn[hidden] { display: none; }
.choice button.on .ci { background: #fff; }
[hidden] { display: none !important; }

@font-face { font-family: Questrial; src: url('/fonts/questrial.woff2') format('woff2'); font-weight: 400; font-display: swap; }

/* =====================================================================
   Mise en forme inspirée de cv-professionnel.com (couleurs BILL conservées)
   Police Century Gothic, fond blanc, boutons « pilule » avec ombre douce,
   cartes arrondies à fine bordure, petite barre d'accent sur les titres.
   ===================================================================== */
:root { --radius: 18px; --ink: #111827; --text: #1F2937; --muted: #6B7280; --line: #E5E7EB; --bg: #FFFFFF; --soft: #F4F7F5;
  --shadow: 0 6px 18px rgba(11, 93, 70, .25); --card-shadow: 0 2px 10px rgba(17, 24, 39, .05); }
html, body { background: var(--bg); color: var(--text);
  font-family: "Century Gothic", CenturyGothic, Questrial, "URW Gothic L", AppleGothic, system-ui, sans-serif; line-height: 1.6; }
button, input, select { font-family: inherit; }

/* En-tête blanc : logo carré + nom + slogan */
.topbar { background: #fff; color: var(--ink); border-bottom: 1px solid var(--line); padding: 10px 14px; }
.brandmark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo-sq { width: 38px; height: 38px; border-radius: 10px; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; position: relative; }
.logo-sq::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.bm-text { display: flex; flex-direction: column; line-height: 1.15; }
.topbar .brand { font-size: 18px; letter-spacing: .02em; font-weight: 700; color: var(--ink); }
.topbar .brand::after { display: none; }
.tagline { font-size: 12px; color: var(--muted); }
.icon-btn { color: var(--ink); border-radius: 99px; }
.icon-btn:active { background: var(--soft); }
.badge-mode { background: var(--green-soft); color: var(--green); border: 1px solid rgba(11,93,70,.2); }

/* Titres : grands, serrés, avec barre d'accent */
h1 { font-size: 28px; line-height: 1.15; letter-spacing: -.015em; color: var(--ink); margin: 14px 0 6px; }
h1::before { content: ""; display: block; width: 40px; height: 3px; border-radius: 3px; background: var(--green); margin-bottom: 12px; }
.login-hero h1::before, .receipt h1::before { display: none; }
h2 { font-size: 20px; color: var(--ink); letter-spacing: -.01em; }
.sub { color: var(--muted); font-size: 15px; }
.muted { color: var(--muted); }

/* Boutons « pilule » */
.btn { border-radius: 99px; padding: 15px 26px; box-shadow: var(--shadow); letter-spacing: .01em; }
.btn.secondary { box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.danger { box-shadow: none; }
.btn.small { border-radius: 99px; padding: 8px 16px; box-shadow: none; }

/* Cartes */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 18px; }
.qr-box, .receipt { border-radius: var(--radius); box-shadow: var(--card-shadow); }
.hero { border-radius: 22px; padding: 22px; box-shadow: 0 10px 30px rgba(11, 93, 70, .22); }
.stats div { border-radius: 14px; }

/* Champs */
label { color: var(--ink); }
input, select { border-radius: 14px; border: 1.5px solid var(--line); }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(11, 93, 70, .1); }

/* Choix (moyen de paiement, rôle, opérateur) : style « puce » */
.choice button { border-radius: var(--radius); border: 1.5px solid var(--line); box-shadow: var(--card-shadow); }
.choice button.on { border: 1.5px solid var(--green); box-shadow: 0 0 0 4px rgba(11, 93, 70, .08); }
.ops button { border-radius: 99px; border: 1.5px solid var(--line); font-weight: 600; font-size: 13px; padding: 10px 6px; }
.ops button.on { border-color: var(--green); }
.pill { font-weight: 600; padding: 4px 12px; }

/* Lignes de montants : séparateurs fins */
.lines li { border-bottom: 1px solid var(--line); }
.lines li.total { border-top: 1.5px solid var(--ink); }

/* Barre d'onglets : onglet actif en « puce » douce */
.tabbar { border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b)); gap: 4px; }
.tabbar a { border-radius: 14px; padding: 8px 4px; font-weight: 600; }
.tabbar a.on { background: var(--green-soft); color: var(--green); }

/* Pages vides et alertes */
.empty { background: var(--soft); border-radius: var(--radius); }
.alert { border-radius: 14px; }
.login-hero h1 { letter-spacing: .04em; }
/* Message d'info / d'erreur : bandeau arrondi pleine largeur au-dessus de la barre d'onglets */
.toast { left: 16px; right: 16px; width: auto; max-width: 520px; margin: 0 auto; transform: translateY(20px);
  border-radius: 14px; padding: 14px 16px; line-height: 1.4; text-align: left; overflow-wrap: anywhere; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.toast.on { transform: translateY(0); }
details.card > summary { cursor: pointer; padding: 2px 0; }
details.card[open] > summary { margin-bottom: 10px; }
h2.row { display: flex; align-items: baseline; gap: 8px; }
.link-more { font-size: 14px; font-weight: 600; color: var(--green); text-decoration: none; }

/* ---------- Menu latéral (☰) ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(86vw, 340px); background: var(--card, #fff);
  padding: calc(14px + env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto; transform: translateX(100%); transition: transform .2s ease; box-shadow: -8px 0 30px rgba(0,0,0,.15); }
.drawer.on .drawer-bg { opacity: 1; }
.drawer.on .drawer-panel { transform: translateX(0); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 4px 6px 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.drawer-list { list-style: none; margin: 0; padding: 0; }
.drawer-list a, .drawer-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 10px; border-radius: 12px;
  color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; background: none; border: 0; text-align: left; cursor: pointer; }
.drawer-list a:hover, .drawer-list button:hover, .drawer-list a:focus-visible, .drawer-list button:focus-visible { background: var(--soft); outline: none; }
.drawer-list a.on { background: var(--green-soft); color: var(--green); }
.drawer-list li:last-child { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.drawer-list li:last-child button { color: var(--red); }
@media (prefers-reduced-motion: reduce) { .drawer-bg, .drawer-panel { transition: none; } }

/* ---------- Salaires des agents ---------- */
.agent-row { padding-top: 12px; padding-bottom: 12px; }
.agent-row input[type=checkbox], .check-all input { width: 22px; height: 22px; accent-color: var(--green); flex: none; margin: 0; }
.agent-row .amount { font-size: 17px; }
.agent-row .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.check-all { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--muted); cursor: pointer; margin: 0; }
.run-stats { margin: 6px 0 12px; }
.run-stats div { background: var(--green-soft); color: var(--green); }
.run-stats span { color: var(--muted); }
.lines li.tap { cursor: pointer; }
.pill.WAITING, .pill.REVIEW { background: var(--amber-soft); color: var(--amber); }
.lines li.run-line > span:first-child { flex: 1; min-width: 0; }
.lines li.run-line > span:last-child { flex: none; }
/* Interrupteur (option « Payer des salaires ») */
.switch-row { display: flex; align-items: center; gap: 14px; margin: 0; cursor: pointer; font-weight: 400; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 48px; height: 28px; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Titres de blocs (cartes) : léger fond vert pour bien les distinguer du texte */
.card > .title:first-child { display: block; background: rgba(11, 93, 70, .10); color: var(--green); padding: 9px 14px; border-radius: 12px; margin: 0 0 14px; font-weight: 700; }
.card.law p > b:first-child { font-weight: 700; color: var(--green); }
.wa-btn, .call-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; text-decoration: none !important; white-space: nowrap; }
.wa-btn { background: #25D366; color: #fff !important; box-shadow: 0 2px 8px rgba(37,211,102,.35); }
.call-btn { background: rgba(11, 93, 70, .10); color: var(--green) !important; }
.wa-btn svg, .call-btn svg { flex: none; }
.lines li:has(.wa-btn), .lines li:has(.call-btn) { align-items: center; }

/* ---------- Photos de profil ---------- */
.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  background: var(--green) center / cover no-repeat; color: #fff; font-weight: 700; letter-spacing: .02em; overflow: hidden; user-select: none; }
.avatar.has-photo { background-color: var(--soft); box-shadow: 0 0 0 1px var(--line); }
.card .row > .avatar { margin-right: 12px; }
.profile-photo { display: flex; align-items: center; gap: 16px; }
.profile-photo .btn.small { display: inline-flex; width: auto; padding: 8px 14px; margin: 0 6px 0 0; font-size: 14px; min-height: 0; }
.person-head { display: flex; align-items: center; gap: 14px; }
.person-head h1 { margin: 0; }
.person-head.small { gap: 10px; margin: 6px 0 12px; }
.ci-person { display: flex; align-items: center; gap: 10px; }
.hero-person { display: flex; align-items: center; gap: 8px; }
.hello { display: inline-flex; align-items: center; gap: 10px; margin: 4px 0 10px; color: var(--muted); text-decoration: none; }
.drawer-head .avatar { margin-right: 4px; }
/* Pastilles opérateurs dans les bulles de choix */
.ops button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.ops .op-mark { flex: none; border-radius: 50%; }
/* Bulles opérateurs : libellé sur une ligne, pastille alignée à gauche */
.ops button { justify-content: flex-start; padding: 10px 12px; gap: 8px; min-width: 0; }
.ops button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 440px) { .ops { grid-template-columns: repeat(2, 1fr); } }
/* Logos officiels des opérateurs : contenus dans une pastille blanche pour que les logos larges tiennent */
.op-logo { flex: none; display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); overflow: hidden; }
.op-logo img { width: 80%; height: 80%; object-fit: contain; display: block; }
.ops button { font-size: 13px; padding: 10px 8px; gap: 6px; }
.op-logo img { width: 86%; height: 86%; }

/* Logos opérateurs : cadre blanc arrondi (logos larges ou carrés entièrement visibles) */
.op-logo { border-radius: 7px; padding: 2px 3px; box-sizing: border-box; }
.op-logo img { width: 100%; height: 100%; object-fit: contain; }

/* Photo de profil : crayon de modification + feuille d'actions */
.avatar-edit { position: relative; flex: none; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.avatar-edit .pencil { position: absolute; right: -2px; bottom: -2px; width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff;
  border: 3px solid #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); box-sizing: border-box; }
.avatar-edit:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
.sheet { position: fixed; inset: 0; z-index: 70; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.4); opacity: 0; transition: opacity .18s; }
.sheet-panel { position: absolute; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 8px; transform: translateY(110%); transition: transform .18s ease; }
.sheet.on .sheet-bg { opacity: 1; }
.sheet.on .sheet-panel { transform: translateY(0); }
.sheet-panel button { width: 100%; padding: 16px; border: 0; border-radius: 14px; background: #fff; font: inherit; font-weight: 600; font-size: 16px; color: var(--green); cursor: pointer; }
.sheet-panel button.danger-text { color: var(--red); }
.sheet-panel button.cancel { color: var(--ink); margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .sheet-bg, .sheet-panel { transition: none; } }
.ops button { padding: 10px 6px; gap: 5px; letter-spacing: -.1px; }

/* Bulles opérateurs « logo seul » : le logo remplit la bulle sans être déformé */
.ops button.logo-only { position: relative; justify-content: center; height: 56px; padding: 6px 12px; background: #fff; }
.ops button.logo-only .op-full { display: block; max-width: 80%; height: 70%; max-height: 38px; object-fit: contain; }
.ops button.logo-only.on { background: var(--green-soft); border-color: var(--green); border-width: 2px; }
.ops button.logo-only.on::after { content: "✓"; position: absolute; top: -6px; right: -4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.ops button.logo-only { height: 60px; padding: 4px 10px; }
.ops button.logo-only .op-full { height: 80%; max-height: 46px; max-width: 86%; }

/* ---------- Cloche des notifications ---------- */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; color: inherit; text-decoration: none; }
.bell-ico { display: inline-flex; }
.bell-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid #fff; box-sizing: content-box; }
.bell-badge[hidden] { display: none; }
.notif .row { align-items: flex-start; gap: 12px; }
.notif-ico { flex: none; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--muted); }
.notif-ico.ok { background: var(--green-soft); color: var(--green); }
.notif-ico.bad { background: var(--red-soft); color: var(--red); }
.notif.unread { border-color: var(--green); background: #f6fbf8; }
.notif.unread .title { color: var(--green); }
.notif-time { font-size: 12px; color: var(--muted); margin-top: 4px; }
.notif-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--green); margin-top: 6px; }
button.link-more { background: none; border: 0; cursor: pointer; padding: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--green); }
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
/* Barre du haut chargée (badge, cloche, menu) : slogan masqué sur les petits écrans */
@media (max-width: 400px) { .topbar .tagline { display: none; } }

/* ---------- Messagerie ---------- */
.menu-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; flex: none; }
.conv .row { align-items: center; gap: 12px; }
.conv .grow { min-width: 0; }
.conv-top { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.conv-last { color: var(--muted); font-size: 14px; margin-top: 2px; }
.conv-last.unread { color: var(--ink); font-weight: 700; }
.contact-row { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; flex-wrap: wrap; }
.contact-row .chat-btn { flex: 1 1 140px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 0; }
.wa-wrap { flex: 1 1 140px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.wa-wrap .wa-btn { justify-content: center; }
.wa-btn[aria-disabled] { opacity: .6; }
.wa-btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.hint { font-size: 12px; color: var(--muted); }
.chat-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.chat-note { margin: 0 0 8px; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 360px); min-height: 200px; overflow-y: auto; padding: 10px; background: var(--soft); border-radius: 16px; }
.msg { display: flex; align-items: flex-end; gap: 6px; max-width: 86%; }
.msg.me { align-self: flex-end; }
.msg.them { align-self: flex-start; }
.bubble { padding: 9px 12px; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.msg.me .bubble { background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.msg.them .bubble { border-bottom-left-radius: 4px; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-meta { font-size: 11px; opacity: .7; margin-top: 3px; text-align: right; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-form textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; margin: 0; }
.chat-send { width: 48px; height: 48px; min-height: 0; padding: 0; margin: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; }
.chat-form textarea { font: inherit; font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 16px; background: #fff; }
.chat-form textarea:focus { outline: none; border-color: var(--green); }

/* ---------- Payer / Recevoir par QR ---------- */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 18px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 16px; }
.quick-btn .qb-ico { width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 6px 16px rgba(11, 93, 70, .25); transition: transform .12s; }
.quick-btn.pay .qb-ico { background: var(--green); }
.quick-btn.recv .qb-ico { background: #fff; color: var(--green); border: 3px solid var(--green); box-sizing: border-box; }
.quick-btn:active .qb-ico { transform: scale(.94); }
.recv { text-align: center; }
.recv-who { display: flex; align-items: center; justify-content: center; gap: 12px; text-align: left; margin: 6px 0 14px; }
.qr-box { background: #fff; border-radius: 22px; padding: 16px; display: inline-block; box-shadow: 0 6px 20px rgba(0,0,0,.08); border: 1px solid var(--line); }
.qr-box img { width: min(72vw, 300px); height: auto; display: block; image-rendering: pixelated; }
.recv-code { font-size: 15px; margin: 4px 0; }
.recv-code b { letter-spacing: .18em; font-size: 18px; }
.amount-row { display: flex; gap: 8px; align-items: stretch; }
.amount-row input { flex: 1; font-size: 26px; font-weight: 700; margin: 0; }
.cur-toggle { display: flex; border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden; flex: none; }
.cur-toggle button { border: 0; background: #fff; padding: 0 14px; font: inherit; font-weight: 700; cursor: pointer; color: var(--muted); }
.cur-toggle button.on { background: var(--green); color: #fff; }
.p2p-confirm { text-align: left; }
.p2p-to { display: flex; align-items: center; gap: 14px; }
.p2p-amount { font-size: 36px; font-weight: 800; text-align: center; margin: 14px 0 0; color: var(--green); }
.p2p-total { text-align: center; margin: 12px 0 0; font-size: 14px; }
.amount.in { color: var(--green); }

/* ---------- Carnet de loyer ---------- */
.book-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.year-nav { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 6px 0 12px; font-size: 20px; }
.year-nav .icon-btn { font-size: 26px; text-decoration: none; color: var(--green); width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--green-soft); }
.year-nav .icon-btn[aria-disabled] { opacity: .3; pointer-events: none; }
.book { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.month { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); min-height: 74px; }
.month .m-name { font-weight: 700; text-transform: capitalize; }
.month .m-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.month .m-label { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.2; }
.month.paid { background: var(--green-soft); border-color: var(--green); }
.month.paid .m-dot { background: var(--green); }
.month.paid .m-label { color: var(--green); font-weight: 600; }
.month.due, .month.pending { background: var(--amber-soft); border-color: var(--amber); }
.month.due .m-dot, .month.pending .m-dot { background: var(--amber); }
.month.late { background: var(--red-soft); border-color: var(--red); }
.month.late .m-dot { background: var(--red); }
.month.late .m-label { color: var(--red); font-weight: 600; }
.month.none { opacity: .45; }
.month.current { box-shadow: 0 0 0 3px rgba(11, 93, 70, .18); }
.book-legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 12px 0; font-size: 12px; color: var(--muted); }
.book-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; background: var(--line); }
.book-legend i.paid { background: var(--green); } .book-legend i.due { background: var(--amber); } .book-legend i.late { background: var(--red); }
.month .m-amt { font-size: 11px; color: var(--green); }
.month.pending { background: var(--amber-soft); border-color: var(--amber); }
.month.outside { opacity: .4; border-style: dashed; }
.book-legend i.pending { background: var(--amber); }
.book-sum { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; margin: 10px 0 4px; }
.book-sum > div { background: var(--soft); border-radius: 14px; padding: 10px; text-align: center; }
.book-sum b { display: block; font-size: 18px; color: var(--green); }
.book-sum .bad b { color: var(--red); }
.book-sum span { font-size: 12px; color: var(--muted); }
/* Carnet imprimable */
.print-only { display: none; }
@media print {
  .print-only { display: block; }
  .drawer, .sheet { display: none !important; }
  .book-print .rh { display: flex; justify-content: space-between; border-bottom: 2px solid #0B5D46; padding-bottom: 10px; margin-bottom: 12px; }
  .book-print .brand { color: #0B5D46; font-weight: 800; font-size: 22px; }
  .book-print table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
  .book-print th, .book-print td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; }
  .book-print th { background: #eef5f1; }
  .book-print .signs { display: flex; justify-content: space-between; margin-top: 40px; }
  .book-print .signs div { width: 45%; border-top: 1px solid #333; padding-top: 6px; font-size: 13px; }
}
