/* Registre (Suivi Coffre). Style « pastel-consumer » du plugin design-pro, tirage 564067641.
   Le geste : une teinte pâle par titulaire (encre = le foncé de la même teinte), un grand rayon,
   aucune couleur dans la coque. Les montants sont en chiffres tabulaires. */
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url("https://cdn.jsdelivr.net/npm/@fontsource/manrope@5.0.20/files/manrope-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 500; font-display: swap; src: url("https://cdn.jsdelivr.net/npm/@fontsource/manrope@5.0.20/files/manrope-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url("https://cdn.jsdelivr.net/npm/@fontsource/manrope@5.0.20/files/manrope-latin-600-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --ground: #f3f5f7; --surface: #ffffff; --raised: #f2f8fd; --border: #e6e6e6; --rule: #f1f2f3; --control: #d6d9dd;
  --text: #1b1d1f; --muted: #5c6064; --accent: #1d5fd6; --accent-soft: #dcf1ff; --accent-ink: #0a3a80;
  --positive: #2f7a45; --negative: #c41c29; --warning: #92400e;
  --ok-bg: #dcfae5; --ok-ink: #04250e; --bad-bg: #ffedea; --bad-ink: #831c1e; --warn-bg: #fff4d6; --warn-ink: #7a3a05;
  --neutre-bg: #eef1f4; --neutre-ink: #3a3d40; --active: #e9ecef; --voile: rgba(20, 24, 28, .45);
  /* une teinte par titulaire : fond pâle, encre foncée de la même teinte */
  --t0-bg: #dcf1ff; --t0-ink: #0a3a80; --t1-bg: #fdeed3; --t1-ink: #7a4a06; --t2-bg: #dcf5e4; --t2-ink: #14532d;
  --t3-bg: #fde4ea; --t3-ink: #8a1538; --t4-bg: #d6f1f1; --t4-ink: #0e4f55; --t5-bg: #ece9d8; --t5-ink: #4d4712;
  --r-carte: 20px; --r-ctrl: 10px; --gap: 24px; --pad: 24px; --h-ctrl: 44px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0f1113; --surface: #181b1e; --raised: #1d2226; --border: #2a2e33; --rule: #22262a; --control: #3a4046;
  --text: #eceef0; --muted: #9ba1a8; --accent: #7fb2ff; --accent-soft: #14304f; --accent-ink: #cfe4ff;
  --positive: #6fcf8a; --negative: #ff7b84; --warning: #f2b765;
  --ok-bg: #12301c; --ok-ink: #b9f0c9; --bad-bg: #3a1618; --bad-ink: #ffc9cc; --warn-bg: #3a2a0c; --warn-ink: #ffdf9e;
  --neutre-bg: #23282d; --neutre-ink: #d2d6da; --active: #262b30; --voile: rgba(0, 0, 0, .6);
  --t0-bg: #14304f; --t0-ink: #cfe4ff; --t1-bg: #3d2c0a; --t1-ink: #ffe0a6; --t2-bg: #12331f; --t2-ink: #bff0cf;
  --t3-bg: #40141f; --t3-ink: #ffcbd7; --t4-bg: #0d3336; --t4-ink: #bdeef0; --t5-bg: #33301a; --t5-ink: #ece6b5;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 16px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.saut { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.saut:focus { left: 8px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muet { color: var(--muted); }
.plein { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }
body.masque .m { color: transparent !important; position: relative; }
body.masque .m::after { content: "•••••"; color: var(--muted); position: absolute; right: 0; top: 0; letter-spacing: 1px; }
body.masque .m.g::after { left: 0; right: auto; }

/* ---------- coque ---------- */
.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100dvh; }
.cote { padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; }
.marque { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-weight: 600; font-size: 17px; }
.marque svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 0; background: none; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 15px; width: 100%; text-align: left; }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav:hover { color: var(--text); }
.nav[aria-current="page"] { background: var(--active); color: var(--text); font-weight: 500; }
.nav .compte { margin-left: auto; font-size: 12px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 999px; padding: 1px 8px; }
.cote .bas { margin-top: auto; display: grid; gap: 4px; }
.page { padding: 32px 32px 64px; max-width: 1164px; width: 100%; margin: 0 auto; }
.tete { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.tete h1 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.tete .sous { color: var(--muted); font-size: 15px; margin-top: 4px; }
.tete .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.barre-bas { display: none; }

/* ---------- boutons et champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--h-ctrl); padding: 0 18px; border-radius: 999px; border: 1px solid transparent; background: var(--neutre-bg); color: var(--text); font-weight: 500; font-size: 15px; text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.principal { background: var(--text); color: var(--surface); }
.btn.contour { background: transparent; border-color: var(--control); }
.btn.danger { background: var(--bad-bg); color: var(--bad-ink); }
.btn.petit { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg { width: 18px; height: 18px; }
.icone { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 12px; color: var(--muted); }
.icone:hover { background: var(--active); color: var(--text); }
.icone svg { width: 20px; height: 20px; }
.champ { display: grid; gap: 6px; }
label.champ { min-height: 44px; cursor: pointer; }
.champ > label, .champ > .lib { font-size: 14px; font-weight: 500; }
.champ .aide { font-size: 13px; color: var(--muted); }
.champ .erreur { font-size: 13px; color: var(--negative); }
.saisie { width: 100%; min-height: var(--h-ctrl); padding: 0 12px; background: var(--surface); border: 1px solid var(--control); border-radius: var(--r-ctrl); font-size: 16px; }
textarea.saisie { padding: 10px 12px; min-height: 72px; resize: vertical; }
.saisie[aria-invalid="true"] { border-color: var(--negative); }
.saisie.gros { font-size: 28px; font-weight: 600; min-height: 60px; font-variant-numeric: tabular-nums; }
.deux { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.champ { min-width: 0; }
.saisie { min-width: 0; max-width: 100%; }
input[type="date"].saisie { -webkit-appearance: none; appearance: none; display: block; }
.choix { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--control); background: var(--surface); font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.puce[aria-pressed="true"], .puce[aria-checked="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.segments { display: inline-flex; background: var(--neutre-bg); border-radius: 999px; padding: 4px; gap: 2px; max-width: 100%; overflow-x: auto; }
.segments button { border: 0; background: none; min-height: 36px; padding: 0 16px; border-radius: 999px; font-size: 15px; color: var(--muted); white-space: nowrap; }
.segments button[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 500; }

/* ---------- cartes ---------- */
.grille { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.carte { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-carte); padding: var(--pad); min-width: 0; }
.carte > header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.carte > header h2 { font-size: 17px; font-weight: 500; }
.carte > header .lien { margin-left: auto; }
.lien { color: var(--accent); text-decoration: none; background: none; border: 0; padding: 0; font-size: 14px; font-weight: 500; min-height: 32px; }
.solde { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.solde small { font-size: 18px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.constat { margin-top: 8px; font-size: 15px; color: var(--muted); }
.constat strong { color: var(--text); font-weight: 600; }
.tuiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.tuile { border: 0; border-radius: 16px; padding: 14px 8px; min-height: 76px; display: grid; gap: 6px; justify-items: center; align-content: center; font-size: 14px; font-weight: 500; background: var(--accent-soft); color: var(--accent-ink); }
.tuile svg { width: 22px; height: 22px; }
.tuile:active { transform: scale(.97); }

/* ---------- listes ---------- */
.liste { display: grid; }
.ligne { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 64px; padding: 10px 0; border: 0; border-top: 1px solid var(--rule); background: none; text-align: left; width: 100%; }
.liste > .ligne:first-child { border-top: 0; }
button.ligne:hover, a.ligne:hover { background: var(--raised); box-shadow: 0 0 0 8px var(--raised); border-radius: 4px; border-top-color: transparent; }
.ligne .t1 { font-weight: 500; display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.ligne .t1 > .txt { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ligne > span { min-width: 0; }
.ligne .t2 { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne .droite { text-align: right; }
.ligne .droite .t1 { font-variant-numeric: tabular-nums; }
.pastille { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 15px; background: var(--neutre-bg); color: var(--neutre-ink); flex: none; }
.pastille.petite { width: 28px; height: 28px; font-size: 12px; }
.pastille svg { width: 18px; height: 18px; }
.t0 { background: var(--t0-bg); color: var(--t0-ink); } .t1c { background: var(--t1-bg); color: var(--t1-ink); } .t2c { background: var(--t2-bg); color: var(--t2-ink); }
.t3 { background: var(--t3-bg); color: var(--t3-ink); } .t4 { background: var(--t4-bg); color: var(--t4-ink); } .t5 { background: var(--t5-bg); color: var(--t5-ink); }
.pilule { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--neutre-bg); color: var(--neutre-ink); white-space: nowrap; flex: none; }
.pilule.ok { background: var(--ok-bg); color: var(--ok-ink); } .pilule.bad { background: var(--bad-bg); color: var(--bad-ink); } .pilule.warn { background: var(--warn-bg); color: var(--warn-ink); }
.plus { color: var(--positive); }
.neg { color: var(--negative); }
.vide { padding: 28px 8px; text-align: center; color: var(--muted); display: grid; gap: 12px; justify-items: center; }

/* la part de chacun dans le coffre : barres autour d'un zéro commun */
.parts { display: grid; gap: 14px; }
.part { text-decoration: none; color: inherit; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; border: 0; background: none; padding: 0; text-align: left; width: 100%; min-height: 44px; }
.part .nom { font-size: 15px; font-weight: 500; }
.part .piste { grid-column: 2 / 4; height: 8px; border-radius: 4px; position: relative; background: var(--rule); }
.part .piste i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.part .piste b { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--control); }
.note-alerte { display: flex; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; align-items: flex-start; }
.note-alerte.bad { background: var(--bad-bg); color: var(--bad-ink); }
.note-alerte svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.etat { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.etat i { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); }
.etat.ko i { background: var(--negative); }

/* tableau de comptes */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { font-weight: 400; font-size: 13px; color: var(--muted); text-align: right; padding: 8px 0 8px 16px; white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; padding-left: 0; }
.table td { padding: 12px 0 12px 16px; text-align: right; border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tr.total td { font-weight: 600; border-top-color: var(--border); }
.table td .qui { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.table tbody tr[tabindex] { cursor: pointer; }
.table tbody tr[tabindex]:hover td { background: var(--raised); }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; font-size: 15px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.kv .fort { font-weight: 600; color: var(--text); }
.filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filtres .saisie { width: auto; min-width: 0; flex: 1 1 150px; max-width: 220px; }
.filtres .recherche { flex: 2 1 220px; max-width: 320px; }

/* ---------- feuilles (fenêtres de saisie) ---------- */
.voile { position: fixed; inset: 0; background: var(--voile); z-index: 30; display: grid; place-items: center; padding: 24px; }
.feuille { background: var(--surface); border-radius: 24px; width: min(560px, 100%); max-height: min(88dvh, 860px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.feuille > header { display: flex; align-items: center; gap: 8px; padding: 16px 12px 8px 24px; }
.feuille > header h2 { font-size: 20px; font-weight: 600; flex: 1; }
.feuille .corps { padding: 8px 24px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; -webkit-overflow-scrolling: touch; }
.feuille .corps > * { flex: none; }
.feuille .corps > .segments { align-self: flex-start; }
.feuille > footer { padding: 12px 24px calc(16px + env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--rule); flex-wrap: wrap; }
.resume { background: var(--raised); border-radius: 14px; padding: 12px 14px; font-size: 14px; display: grid; gap: 4px; }
.toasts { position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 0; right: 0; display: grid; justify-items: center; gap: 8px; z-index: 60; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 480px; }
.toast.ko { background: var(--negative); color: #fff; }

/* ---------- connexion et code ---------- */
.porte { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.porte .boite { width: min(360px, 100%); display: grid; gap: 16px; }
.porte h1 { font-size: 24px; font-weight: 600; }
.points { display: flex; gap: 14px; justify-content: center; margin: 8px 0; }
.points i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--control); }
.points i.plein-pt { background: var(--text); border-color: var(--text); }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pave button { height: 64px; border-radius: 18px; border: 0; background: var(--surface); font-size: 24px; font-weight: 500; }
.pave button:active { background: var(--active); }
.pave .vide-touche { visibility: hidden; }

/* ---------- téléphone ---------- */
@media (max-width: 1180px) { .g2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .cote { display: none; }
  .page { padding: calc(16px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .tete { margin-bottom: 16px; align-items: center; }
  .tete h1 { font-size: 24px; }
  .barre-bas { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); z-index: 20; }
  .barre-bas .nav { flex-direction: column; gap: 2px; height: 52px; padding: 0; justify-content: center; font-size: 12px; text-align: center; }
  .barre-bas .nav[aria-current="page"] { background: none; }
  .barre-bas .nav svg { width: 22px; height: 22px; }
  .barre-bas .nav .compte { display: none; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  :root { --gap: 16px; --pad: 18px; }
  .solde { font-size: 36px; }
  .voile { padding: 0; place-items: end stretch; }
  .feuille { width: 100%; max-height: 94dvh; border-radius: 24px 24px 0 0; }
  .feuille > header { padding-left: 18px; }
  .feuille .corps { padding: 8px 18px 16px; }
  .feuille > footer { padding-left: 18px; padding-right: 18px; }
  .feuille > footer .btn { flex: 1; }
  .table.replie thead { display: none; }
  .table.replie, .table.replie tbody, .table.replie tr, .table.replie td { display: block; }
  .table.replie tr { padding: 12px 0; border-top: 1px solid var(--rule); }
  .table.replie td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; }
  .table.replie td::before { content: attr(data-lib); color: var(--muted); font-size: 14px; }
  .table.replie td:first-child::before { content: none; }
  .table.replie td:first-child { padding-bottom: 6px; }
  .filtres .saisie, .filtres .recherche { flex: 1 1 140px; max-width: none; }
}
@media (max-width: 900px) and (orientation: landscape) { .feuille { max-height: 100dvh; border-radius: 0; } }
@media (max-width: 480px) { .segments button { padding: 0 11px; font-size: 14px; } }
@media (max-width: 380px) { .tuile { font-size: 12.5px; padding: 12px 4px; } .deux { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print { .cote, .barre-bas, .toasts { display: none; } }
