/* CredFlow — mobile d'abord, gros boutons, montants très lisibles, peu de couleurs, aucune animation inutile. */
:root {
  --brand: #0B6E4F; --accent: #F4A300;
  --brand-dark: #095641; --brand-soft: #E7F1ED; /* recalculés depuis --brand par main.js */
  --bg: #F4F6F3; --card: #fff; --text: #16221C; --muted: #5A665F; --line: #DFE5E0;
  --ok: #167A43; --warn: #B96A00; --bad: #C0262D; --info: #245C8F;
  --ok-bg: #E4F4EA; --warn-bg: #FFF1D9; --bad-bg: #FCE7E7; --info-bg: #E5EFF8;
  --r: 16px; --r-sm: 12px; --nav-h: 72px; --shadow: 0 1px 2px rgba(16,34,26,.06), 0 4px 14px rgba(16,34,26,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-tap-highlight-color: transparent; }
body.no-scroll { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; } h2 { font-size: 21px; } h3 { font-size: 17px; margin-bottom: 10px; }
p { margin: 6px 0; }
a { color: var(--brand); text-decoration: none; font-weight: 600; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 14px; } .center { text-align: center; } .bad { color: var(--bad) !important; } .ok { color: var(--ok) !important; }
.link { background: none; border: 0; color: var(--brand); font-weight: 700; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; }
.splash { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: var(--brand); display: grid; place-items: center; z-index: 100; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ── structure ─────────────────────────────────────────── */
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.view { padding: 0 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
body:not(.has-nav) .view { padding-bottom: 40px; }
.page { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }
.page-form { padding-bottom: 96px; }
.top { display: flex; align-items: center; gap: 8px; min-height: 60px; padding-top: env(safe-area-inset-top); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.top h1 { flex: 1; } .top-title { flex: 1; min-width: 0; } .top-title h1 { font-size: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-title-only { flex: 1; font-size: 21px; } .top-actions { display: flex; gap: 4px; }
.icon-btn { position: relative; width: 48px; height: 48px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 50%; color: var(--text); }
.icon-btn:active { background: var(--line); }
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.card > h3:first-child { margin-top: 0; }
.row { display: flex; align-items: center; gap: 12px; } .row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.count { margin: 0; }

/* ── boutons ───────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 12px 18px; border-radius: var(--r-sm); border: 2px solid transparent; font-weight: 700; font-size: 17px; text-align: center; text-decoration: none; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:active { background: var(--brand-dark); }
.btn-cta { text-transform: uppercase; background: var(--accent); color: #1B1300; min-height: 62px; font-size: 19px; font-weight: 800; letter-spacing: .2px; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.btn-secondary { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-danger { background: var(--bad); color: #fff; } .btn-danger-ghost { background: transparent; color: var(--bad); }
.btn-wa { background: #1FA855; color: #fff; }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-col { display: flex; flex-direction: column; gap: 10px; } .cta { display: flex; flex-direction: column; gap: 10px; } .cta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.recording { background: var(--bad); color: #fff; border-color: var(--bad); animation: mic-pulse 1.8s ease-out infinite; }

/* ── dictée vocale : on doit VOIR que le micro écoute ──── */
@keyframes mic-pulse { 0% { box-shadow: 0 0 0 0 rgba(192,38,45,.45); } 70% { box-shadow: 0 0 0 14px rgba(192,38,45,0); } 100% { box-shadow: 0 0 0 0 rgba(192,38,45,0); } }
@keyframes mic-bar { 0%, 100% { height: 7px; } 50% { height: 22px; } }
.mic-live { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bad-bg); color: #7A1D22; font-weight: 600; font-size: 16px; }
.mic-wave { display: flex; align-items: center; justify-content: center; gap: 3px; width: 26px; height: 24px; flex: none; margin-top: 2px; }
.mic-wave i { width: 4px; height: 7px; border-radius: 2px; background: var(--bad); animation: mic-bar 1.1s ease-in-out infinite; }
.mic-wave i:nth-child(2) { animation-delay: .18s; } .mic-wave i:nth-child(3) { animation-delay: .36s; } .mic-wave i:nth-child(4) { animation-delay: .54s; }
.mic-live-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mic-interim { color: var(--muted); font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .mic-wave i { height: 16px; } }

/* ── montants (toujours très visibles) ─────────────────── */
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amount-sm { font-size: 17px; } .amount-md { font-size: 22px; } .amount-lg { font-size: 30px; } .amount-xl { font-size: clamp(30px, 10.5vw, 42px); letter-spacing: -.5px; }
.amount-strong { font-weight: 800; font-size: 20px; }
.hero { background: var(--brand); color: #fff; border-radius: 22px; padding: 22px 20px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.hero .amount, .hero .hero-label, .hero .hero-note { color: #fff !important; }
.hero .bad { color: #fff !important; }
.hero-label { font-size: 14px; letter-spacing: .8px; font-weight: 700; opacity: .9; margin: 0; } .hero-note { margin: 4px 0 0; opacity: .95; font-size: 15px; }
.hero-sm { padding: 16px 20px; } .hero .badge { align-self: flex-start; margin-top: 6px; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--card); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
.kpi-ico { color: var(--muted); } .kpi-label { font-size: 14px; color: var(--muted); font-weight: 600; } .kpi-value { font-size: clamp(17px, 5.2vw, 21px); font-weight: 800; overflow-wrap: anywhere; }
.kpi.bad .kpi-value, .kpi.bad .kpi-ico { color: var(--bad); } .kpi.ok .kpi-value, .kpi.ok .kpi-ico { color: var(--ok); }

/* ── listes ────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.list > li { border-bottom: 1px solid var(--line); } .list > li:last-child { border-bottom: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--text); text-decoration: none; min-height: 60px; width: 100%; background: none; border: 0; text-align: left; }
.card > .list > li > .item, .card .list .item { padding: 12px 0; }
.item-btn { cursor: pointer; }
.item-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; } .item-main b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.item-main small, .item small { color: var(--muted); font-size: 14px; font-weight: 500; }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.item-col { flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 12px; }
.item-col > .item { padding-bottom: 8px; }
.list-page > li, .page > .list { background: var(--card); border-radius: var(--r); padding: 0 16px; box-shadow: var(--shadow); }
.page > .item.card { padding: 12px 16px; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; flex: none; object-fit: cover; }
.day-head { display: flex; justify-content: space-between; padding: 8px 4px 0; font-size: 15px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.badge .dot, .behavior .dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-warn { background: var(--warn-bg); color: var(--warn); } .badge-bad { background: var(--bad-bg); color: var(--bad); } .badge-neutral { background: #E8ECE9; color: var(--muted); } .badge-muted { background: #EEE; color: #777; }
.hero .badge-ok, .hero .badge-warn, .hero .badge-bad { background: #fff; }
.pro-tag { background: var(--accent); color: #1B1300; font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 6px; vertical-align: middle; }

/* ── formulaires ───────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; } .field-label { font-weight: 700; font-size: 15px; } .field-hint { font-size: 14px; color: var(--muted); } .field-error, .form-error { color: var(--bad); font-weight: 600; margin: 0; }
.input { width: 100%; min-height: 52px; padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--r-sm); background: #fff; font-size: 17px; }
.input:focus { border-color: var(--brand); outline: none; }
.input-big { font-size: 30px; font-weight: 800; min-height: 68px; text-align: right; }
.textarea { min-height: 76px; resize: vertical; }
.search { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A665F' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat 14px center; padding-left: 46px; }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; } .check input { width: 26px; height: 26px; accent-color: var(--brand); flex: none; }
.check-row { padding: 6px 0; border-bottom: 1px solid var(--line); } .check-row:last-child { border: 0; }
.lang { border: 2px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
select.input { appearance: auto; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; } .chips::-webkit-scrollbar { display: none; }
.chips-wrap { flex-wrap: wrap; overflow: visible; } .chips-wrap .chip { white-space: normal; text-align: left; flex: 0 1 auto; }
.chip { flex: none; max-width: 100%; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 15px; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-product { display: flex; flex-direction: column; align-items: center; border-radius: 14px; padding: 8px 14px; line-height: 1.15; } .chip-product small { font-weight: 600; color: var(--muted); font-size: 13px; }
.seg { display: flex; background: #E6EAE7; border-radius: 12px; padding: 4px; gap: 4px; } .seg button { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-weight: 700; } .seg button.on { background: #fff; box-shadow: var(--shadow); color: var(--brand); }
.seg-sm button { min-height: 36px; padding: 0 10px; font-size: 14px; } .seg-sm { width: auto; max-width: 100%; }

/* ── alertes ───────────────────────────────────────────── */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); font-weight: 600; font-size: 16px; text-decoration: none; color: var(--text); }
.alert svg { flex: none; margin-top: 2px; }
.alert-warn { background: var(--warn-bg); color: #6E3F00; } .alert-info { background: var(--info-bg); color: #163F63; } .alert-ok { background: var(--ok-bg); color: #0E4F2B; }
.alert .btn { margin-top: 8px; }

/* ── état vide ─────────────────────────────────────────── */
.empty { text-align: center; padding: 34px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-ico { width: 72px; height: 72px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.empty p { color: var(--muted); max-width: 340px; } .empty .btn, .empty .btn-col { margin-top: 10px; width: 100%; max-width: 320px; }

/* ── navigation basse ──────────────────────────────────── */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .85fr) minmax(0, 1.05fr) minmax(0, 1.05fr) minmax(0, 1fr); align-items: end; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom); background: #fff; border-top: 1px solid var(--line); max-width: 640px; margin: 0 auto; }
.nav-item, .nav-plus { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); text-decoration: none; min-height: 60px; }
.nav-item.on { color: var(--brand); } .nav-item.on .nav-ico { background: var(--brand-soft); }
.nav-ico { position: relative; width: min(52px, 92%); height: 32px; border-radius: 16px; display: grid; place-items: center; }
.nav-label { font-size: 12px; font-size: clamp(10.5px, 3.1vw, 12px); font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.nav-plus { color: var(--brand); } .nav-plus-btn { width: 60px; height: 60px; border-radius: 50%; background: var(--accent); color: #1B1300; display: grid; place-items: center; margin-top: -26px; box-shadow: 0 4px 12px rgba(0,0,0,.22); border: 4px solid #fff; }
.nav-badge { position: absolute; top: -4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-style: normal; font-weight: 800; display: grid; place-items: center; }
.has-badge .nav-badge { top: 6px; right: 6px; }
.banner { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 14px; font-weight: 700; }
.banner-wrap { position: static; }
.banner-col { flex-direction: column; align-items: stretch; gap: 2px; }
.banner-row { display: flex; align-items: center; gap: 8px; } .banner-row span { flex: 1; min-width: 0; } .banner-btn { color: #fff !important; background: rgba(255,255,255,.18); border-radius: 8px; padding: 6px 12px !important; text-decoration: none !important; }
.banner-col small { font-weight: 500; opacity: .9; line-height: 1.3; } .banner-detail { color: #fff; font-size: 13px; text-decoration: underline; align-self: flex-start; }
.banner-demo { background: var(--accent); color: #1B1300; } .banner-off { background: #333; color: #fff; } .banner-sync { background: var(--info-bg); color: var(--info); } .banner .link { color: inherit; margin-left: auto; padding: 0; }

/* ── bas d'écran & feuilles ────────────────────────────── */
.sheet-back { position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(10,20,15,.5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: #fff; padding-top: 6px; z-index: 1; } .sheet-head h2 { font-size: 20px; }
.sheet-body { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 14px); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #222; color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: 480px; box-shadow: var(--shadow); }
.toast-error { background: var(--bad); } .toast-ok { background: var(--ok); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; } .facts dt { color: var(--muted); font-size: 15px; } .facts dd { margin: 0; font-weight: 700; text-align: right; }
.facts-grid { grid-template-columns: 1fr 1fr; } .facts-grid dt { grid-column: auto; } .facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; } .facts-grid dt { margin-top: 8px; } .facts-grid dd { text-align: left; grid-column: auto; }
.facts-grid { grid-auto-flow: row; } .facts-grid dt, .facts-grid dd { min-width: 0; }
.confirm .facts { grid-template-columns: 1fr auto; padding: 4px 0 8px; }

/* ── fiche client / historique ─────────────────────────── */
.cust-head { display: flex; align-items: center; gap: 14px; }
.behavior { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); background: var(--card); box-shadow: var(--shadow); } .behavior .dot { margin-top: 6px; flex: none; width: 14px; height: 14px; }
.behavior p { margin: 0; font-weight: 700; } .behavior small { color: var(--muted); }
.behavior-ok .dot { color: var(--ok); } .behavior-warn .dot { color: var(--warn); } .behavior-bad .dot { color: var(--bad); } .behavior-neutral .dot { color: #9AA39D; }
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); } .tl:last-child { border: 0; }
.tl-ico { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; margin-top: 2px; }
.tl-payment .tl-ico { background: var(--ok-bg); color: var(--ok); } .tl-body { flex: 1; min-width: 0; }
.tl-body p { margin: 2px 0; } .items { margin: 4px 0; font-size: 16px; } .items li { padding: 1px 0; }
.tl-balance { font-size: 15px; color: var(--muted); } .tl-meta { font-size: 13px; color: var(--muted); }
.tl-void { opacity: .6; } .tl-void .amount { text-decoration: line-through; } .void-note { color: var(--bad); font-weight: 700; font-size: 14px; }

/* ── recherche d'article (nouveau crédit) ──────────────── */
.suggest { display: flex; flex-direction: column; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.suggest:not(:empty) { border: 2px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.suggest-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px;
  border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; color: var(--text); font-size: 17px; }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:active, .suggest-item:focus-visible { background: var(--brand-soft); }
.suggest-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.suggest-main b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-main small { color: var(--muted); font-size: 14px; font-weight: 500; }
.suggest-new { color: var(--brand); } .suggest-new b { font-weight: 700; }

/* ── nouveau crédit ────────────────────────────────────── */
.lines { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.line { border: 2px solid var(--line); border-radius: var(--r-sm); padding: 10px; }
.line-top { display: flex; justify-content: space-between; align-items: center; } .line-top .icon-btn { width: 36px; height: 36px; }
.line-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; } .line-row .input { min-height: 48px; text-align: right; font-weight: 700; flex: 1 1 96px; min-width: 0; width: auto; } .line-row .amount { margin-left: auto; }
.stepper { display: flex; align-items: center; background: var(--brand-soft); border-radius: 12px; } .stepper button { width: 46px; height: 48px; border: 0; background: transparent; font-size: 26px; font-weight: 800; color: var(--brand); } .qty-val { min-width: 30px; text-align: center; font-weight: 800; font-size: 19px; }
.times { color: var(--muted); font-weight: 700; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0,0,0,.06); }
.savebar-total { display: flex; flex-direction: column; min-width: 110px; } .savebar-total small { color: var(--muted); font-weight: 700; } .savebar .btn { flex: 1; min-height: 58px; }
.picker { max-height: 300px; overflow-y: auto; }
.und-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); } .und-k { color: var(--muted); } .und-total { border-bottom: 0; font-size: 18px; }
.settled { text-align: center; display: flex; flex-direction: column; gap: 12px; padding: 12px 0; } .settled-ico { width: 88px; height: 88px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; margin: 0 auto; }

/* ── graphique ─────────────────────────────────────────── */
.chart { width: 100%; height: auto; } .ch-axis { stroke: var(--line); stroke-width: 1; } .ch-credit { fill: var(--accent); } .ch-pay { fill: var(--brand); } .ch-debt { stroke: #24322B; stroke-width: 2.4; stroke-linejoin: round; } .ch-dot { fill: #24322B; } .ch-x { font-size: 8.5px; fill: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); font-weight: 600; } .legend span { display: inline-flex; align-items: center; gap: 6px; } .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; } .sw-credit { background: var(--accent); } .sw-pay { background: var(--brand); } .sw-debt { background: #24322B; height: 4px; }
.insight { margin: 4px 0; font-weight: 600; } .insight-warn { color: var(--warn); } .summary { margin: 0; }
.notif { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; }

/* ── connexion / onboarding ────────────────────────────── */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 18px 0; }
.auth-card { display: flex; flex-direction: column; gap: 16px; } .auth-brand { display: flex; gap: 14px; align-items: center; } .auth-brand img { border-radius: 14px; } .auth-brand h1 { font-size: 26px; } .auth-brand p { margin: 0; color: var(--muted); font-size: 15px; }
/* Présentation : langue en haut à gauche, « Passer » en haut à droite, avantage au centre, bouton en bas. */
.onb { display: flex; flex-direction: column; text-align: center; min-height: calc(100vh - 36px); min-height: calc(100dvh - 36px); }
.onb-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.onb-top .lang { max-width: 60%; min-height: 44px; }
.onb-skip { min-height: 44px; padding: 8px 4px; white-space: nowrap; } span.onb-skip { visibility: hidden; }
.onb-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px 0; }
.onb-body h1, .onb-body .lead { max-width: 34ch; margin-left: auto; margin-right: auto; }
.onb-foot { padding-bottom: env(safe-area-inset-bottom, 0); }
.onb-art { width: 150px; height: 150px; margin: 0 auto; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; } .onb h1 { font-size: 28px; } .lead { font-size: 19px; color: var(--muted); }
.dots { display: flex; gap: 8px; justify-content: center; } .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); } .dots i.on { background: var(--brand); width: 26px; border-radius: 6px; }
.demo-box { text-align: center; border-top: 1px dashed var(--line); padding-top: 14px; } .dev-note { background: #222; color: #9f9; font-family: monospace; padding: 6px 10px; border-radius: 8px; }

/* ── divers ────────────────────────────────────────────── */
.menu { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; } .menu-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--text); min-height: 62px; } .menu-item:last-child { border: 0; } .menu-item small { display: block; color: var(--muted); font-weight: 500; }
.menu-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.plan-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--accent); color: #1B1300; } .plan-card small { display: block; font-weight: 600; }
.plan-cur { border: 2px solid var(--brand); } .features { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; } .features li::before { content: "✓ "; color: var(--ok); font-weight: 800; } .plan h2 { font-size: 22px; } .plan small { font-size: 15px; color: var(--muted); font-weight: 600; }
.chat { display: flex; flex-direction: column; gap: 10px; } .msg { max-width: 92%; overflow-wrap: break-word; padding: 12px 14px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); } .msg p { margin: 4px 0; } .msg-me { align-self: flex-end; background: var(--brand); color: #fff; } .msg-src { display: block; color: var(--muted); margin-top: 8px; font-size: 12px; }
.chat-input { position: sticky; bottom: calc(var(--nav-h) + 8px); display: flex; gap: 8px; background: var(--bg); padding: 6px 0; } .chat-input .input { flex: 1; }
.contact { display: flex; flex-direction: column; gap: 10px; } .contact-amount { font-size: 34px; font-weight: 800; margin: 0; }
.qr-box { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; } .qr { image-rendering: pixelated; max-width: 100%; }
.scan-video { width: 100%; border-radius: var(--r); background: #000; aspect-ratio: 1; object-fit: cover; }
.table-wrap { overflow-x: auto; } .tbl { width: 100%; border-collapse: collapse; font-size: 15px; } .tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; } .tbl .num { text-align: right; } .row-bad { color: var(--bad); }
.steps { padding-left: 22px; list-style: decimal; display: flex; flex-direction: column; gap: 6px; } .faq summary { font-weight: 700; cursor: pointer; min-height: 32px; }
.receipt { overflow-wrap: break-word; position: relative; background: #fff; border: 2px dashed var(--line); border-radius: var(--r); padding: 20px; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; } .receipt h2 { text-align: center; text-transform: uppercase; } .receipt-title { text-align: center; font-weight: 800; }
.receipt dd ul { text-align: right; } .receipt .facts { grid-template-columns: auto 1fr; } .receipt-void { opacity: .7; } .stamp { position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%) rotate(-14deg); border: 4px solid var(--bad); color: var(--bad); padding: 6px 18px; font-size: 30px; font-weight: 900; letter-spacing: 3px; opacity: .55; }
.paywall { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }

/* ── impression (reçus, PDF) ───────────────────────────── */
#print-root { display: none; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; } body.printing #print-root { display: block; } body { background: #fff; }
  .print-doc { font-family: Arial, sans-serif; color: #000; } .print-doc table { width: 100%; border-collapse: collapse; margin-top: 12px; } .print-doc th, .print-doc td { border: 1px solid #999; padding: 6px 8px; font-size: 12px; text-align: left; } .print-doc td.num { text-align: right; }
  body:not(.printing) .qr-box ~ *, body:not(.printing) #app > *:not(.sheet-back) { }
}

/* ── abonnement ────────────────────────────────────────── */
.lock-card { background: #fff; border: 2px solid var(--bad); border-radius: var(--r); padding: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lock-ico { width: 64px; height: 64px; border-radius: 50%; background: var(--bad-bg); color: var(--bad); display: grid; place-items: center; }
.lead2 { font-weight: 700; font-size: 18px; margin: 4px 0; }
.pay-btn { min-height: 64px; justify-content: flex-start; gap: 14px; color: #fff; font-size: 18px; text-align: left; }
.pay-wave { background: #1BA1E2; } .pay-om { background: #E56A00; }
.pay-logo { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,.95); display: grid; place-items: center; font-weight: 900; font-size: 22px; flex: none; } .pay-wave .pay-logo { color: #1BA1E2; } .pay-om .pay-logo { color: #E56A00; }
.big-number { font-size: 20px; letter-spacing: .5px; white-space: nowrap; }
.banner-trial { background: var(--warn-bg); color: #6E3F00; text-decoration: none; } .banner-cta { margin-left: auto; background: #6E3F00; color: #fff; border-radius: 999px; padding: 2px 12px; }
/* ── réponsive : tablette (≥768) = menu latéral + fenêtres centrées ─────────── */
img, svg, video { max-width: 100%; }
.auth-card, .onb { width: 100%; max-width: 460px; margin: 0 auto; }
@media (min-width: 768px) {
  :root { --nav-h: 0px; --side: 208px; }
  #app { max-width: 1180px; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); gap: 0 24px; align-items: start; padding: 0 16px; }
  .banner-wrap { grid-column: 1 / -1; margin: 0 -16px; }
  .nav { position: sticky; top: 8px; grid-column: 1; grid-row: 2; display: flex; flex-direction: column; align-items: stretch; height: auto; max-width: none; margin: 16px 0 0; padding: 12px; border: 0; border-radius: var(--r); box-shadow: var(--shadow); gap: 4px; }
  .nav-item, .nav-plus { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 10px; border-radius: 12px; }
  .nav-item.on { background: var(--brand-soft); } .nav-item.on .nav-ico { background: transparent; } .nav-ico { width: 32px; } .nav-plus { order: -1; margin-bottom: 6px; }
  .nav-plus-btn { margin: 0; width: 40px; height: 40px; border: 0; box-shadow: none; } .nav-label { font-size: 15px; text-align: left; }
  .view { grid-column: 2; grid-row: 2; padding: 0 0 40px; max-width: 820px; width: 100%; }
  body:not(.has-nav) #app { display: block; max-width: 640px; }
  body:not(.has-nav) .view { padding: 0 16px 40px; max-width: none; }
  .page-form { padding-bottom: 16px; } .savebar { position: sticky; left: auto; right: auto; bottom: 8px; width: auto; max-width: none; margin-top: 14px; border: 1px solid var(--line); border-radius: 16px; z-index: 6; }
  .toasts { bottom: 20px; } .chat-input { bottom: 8px; }
  .sheet-back { align-items: center; padding: 16px; } .sheet { border-radius: 22px; max-width: 540px; max-height: 88vh; padding-bottom: 20px; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } .kpi-value { font-size: 19px; }
}
/* ── grand écran (≥1100) : le tableau de bord passe sur 2 colonnes ─────────── */
@media (min-width: 1100px) {
  .view { max-width: 900px; }
  .page-home { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
  .page-home > .top, .page-home > .hero, .page-home > .kpis, .page-home > .cta, .page-home > .alert, .page-home > .empty { grid-column: 1 / -1; }
}
/* ── formulaires plein écran sur téléphone : le menu se masque pour laisser la place à la barre d'enregistrement ── */
@media (max-width: 767px) { body.nav-min .nav { display: none; } body.nav-min .view { padding-bottom: 24px; } body.nav-min .page-form { padding-bottom: 96px; } body.nav-min .toasts { bottom: 100px; } }
/* ── petits téléphones (≤360) ────────────────────────────────────────────── */
@media (max-width: 360px) {
  body { font-size: 16px; } .view { padding-left: 12px; padding-right: 12px; } .card { padding: 14px; } .btn { font-size: 16px; padding: 10px 12px; }
  .nav-label { font-size: 11px; } .nav-plus-btn { width: 54px; height: 54px; } .cta-row { gap: 8px; } .grid2 { gap: 8px; }
  .savebar { gap: 8px; padding-left: 12px; padding-right: 12px; } .savebar-total { min-width: 0; } .amount-lg { font-size: 26px; }
  .facts-grid { grid-template-columns: 1fr; } .top-actions .icon-btn { width: 44px; }
  .receipt { padding: 14px; font-size: 15px; } .receipt .facts { grid-template-columns: 1fr; gap: 0; } .receipt .facts dt { margin-top: 8px; } .receipt .facts dd { text-align: left; } .receipt dd ul { text-align: left; }
}
/* ── téléphone en mode paysage / écrans peu hauts ───────────────────────── */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --nav-h: 54px; } .nav-label { display: none; } .nav-item, .nav-plus { min-height: 48px; } .nav-plus-btn { width: 44px; height: 44px; margin-top: -14px; border-width: 3px; }
  .hero { padding: 14px 18px; } .top { min-height: 48px; position: static; } .banner-wrap { position: static; }
  .sheet { max-height: 96vh; } .onb-art { width: 90px; height: 90px; } .empty { padding: 16px 8px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── diagnostic ─────────────────────────────────────────── */
.diag { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; } .diag dt { font-size: 13px; color: var(--muted); font-weight: 700; margin-top: 10px; } .diag dd { margin: 2px 0 0; word-break: break-word; font-size: 15px; }

/* ── premiers pas (boutique neuve) ──────────────────────── */
.start-steps { counter-reset: s; display: flex; flex-direction: column; gap: 16px; }
.start-steps li { counter-increment: s; position: relative; padding-left: 42px; }
.start-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.start-steps b { font-size: 17px; } .start-steps p { margin: 2px 0 8px; color: var(--muted); }

/* ── Connexion Google, « ou », résumé et textes juridiques ─────────────────────── */
.google-block { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 4px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.google-block .google-btn[hidden] + .or { display: none; }
.legal-summary { background: var(--brand-soft); border-radius: var(--r-sm); padding: 14px 16px; }
.legal-summary h3 { margin-bottom: 8px; }
.legal-summary ul { display: flex; flex-direction: column; gap: 8px; }
.legal-summary li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.legal-summary li svg { flex: none; margin-top: 2px; color: var(--brand); }
.legal-links { margin-top: 10px; }
.legal-doc .md { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.md h1 { font-size: 22px; margin-bottom: 4px; } .md h2 { font-size: 18px; margin: 22px 0 8px; } .md h3 { font-size: 16px; margin: 16px 0 6px; }
.md p, .md li { font-size: 16px; }
.md ul { list-style: disc; padding-left: 22px; margin: 6px 0; } .md ol { list-style: decimal; padding-left: 22px; margin: 6px 0; }
.md li { margin: 4px 0; }
.md blockquote { margin: 10px 0; padding: 8px 12px; border-left: 4px solid var(--brand); background: var(--brand-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.md code { background: var(--bg); padding: 1px 5px; border-radius: 6px; font-size: 14px; }
.md-table { overflow-x: auto; margin: 10px 0; -webkit-overflow-scrolling: touch; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.md th { background: var(--bg); }

/* Champ « Pays + numéro » */
.phone-field .phone-country { font-size: 16px; }
.phone-row { display: flex; align-items: stretch; gap: 8px; }
.phone-dial { display: flex; align-items: center; justify-content: center; min-width: 64px; padding: 0 10px; border: 2px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-weight: 700; font-size: 17px; white-space: nowrap; }
.phone-row .input { flex: 1; min-width: 0; }
.identifier { display: flex; flex-direction: column; gap: 12px; }

/* Administration : code de secours */
.rescue { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.rescue-code { background: var(--warn-bg); border-radius: var(--r-sm); padding: 12px 16px; margin: 8px 0; }
.big-code { font-size: 34px; font-weight: 800; letter-spacing: 6px; margin: 4px 0; font-variant-numeric: tabular-nums; }

/* Micro à côté d'un champ (assistant, recherche) */
.search-row { display: flex; gap: 8px; align-items: center; } .search-row .input { flex: 1; min-width: 0; }
.mic-btn { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.mic-btn.recording { background: var(--bad); color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(192, 38, 45, .45); } 50% { box-shadow: 0 0 0 10px rgba(192, 38, 45, 0); } }
@media (prefers-reduced-motion: reduce) { .mic-btn.recording { animation: none; } }
/* Rappels : déjà relancé aujourd'hui */
.btn-wa.btn-done { opacity: .8; }
.cta-row .link.small { padding: 4px 0; }
