/* =====================================================================
   Espace marchand FalPay — style « SaaS clair epure » (12/11/2026).
   Charge par page_app APRES app.css : on remplace le relief Soft UI par des
   cartes blanches a filet fin, et on ajoute les graphiques (graphiques.py).
   Les noms de jetons restent ceux de FalPay Soft : tout le portail suit.
   ===================================================================== */
:root {
  --bg: #F6F7F9; --surface: #FFFFFF; --surface-sunken: #F2F4F7; --line: #E6E8EC;
  --ink: #0B1220; --ink-muted: #667085;
  --raise: 0 1px 2px rgba(16, 24, 40, .04); --raise-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --press: none;
  --radius-lg: 14px; --radius-md: 10px; --radius-sm: 8px;
  --g1: var(--brand); --g1-doux: color-mix(in srgb, var(--brand) 30%, transparent);
  --g2: #0EA5E9; --g3: #F59E0B; --g4: #10B981; --g5: #A855F7;
  --ok: #12B76A; --warn: #F79009; --ko: #F04438;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0C0E; --surface: #151518; --surface-sunken: #1D1D21; --line: #26262B;
    --ink: #F4F4F5; --ink-muted: #9A9AA3; --raise: none; --raise-sm: none;
    --g2: #38BDF8; --g3: #FBBF24; --g4: #34D399; --g5: #C084FC; --ok: #32D583; --warn: #FDB022; --ko: #F97066;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0C0E; --surface: #151518; --surface-sunken: #1D1D21; --line: #26262B;
  --ink: #F4F4F5; --ink-muted: #9A9AA3; --raise: none; --raise-sm: none;
  --g2: #38BDF8; --g3: #FBBF24; --g4: #34D399; --g5: #C084FC; --ok: #32D583; --warn: #FDB022; --ko: #F97066;
}

/* ---------------------------------------------------------------- coquille */
body.app { background: var(--bg); }
.side { background: var(--surface); border-right: 1px solid var(--line); }
.side nav a { padding: 8px 10px; border-radius: var(--radius-md); font-weight: 500; font-size: .92rem; position: relative; }
.side nav a:hover { background: var(--surface-sunken); }
.side nav a.on { background: color-mix(in srgb, var(--brand) 9%, transparent); color: var(--brand); box-shadow: none; }
.side nav a.on::before { content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand); }
.side-foot { background: var(--bg); border: 1px solid var(--line); box-shadow: none; border-radius: var(--radius-lg); }
.app-top { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); }
.app-top h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; }
.app-body { max-width: 1280px; }

/* ------------------------------------------------------------- composants */
.card { border: 1px solid var(--line); box-shadow: var(--raise); }
.card-hd { padding: 16px 20px 6px; }
.card-hd h2 { font-size: .98rem; font-weight: 650; letter-spacing: -.01em; }
.card-ft { background: transparent; border-top: 1px solid var(--line); }
.kpi { border: 1px solid var(--line); box-shadow: var(--raise); }
.btn { box-shadow: none; border: 1px solid var(--line); }
.btn.primary { border-color: var(--brand); }
.btn.ghost { border-color: transparent; }
.btn:hover { transform: none; }
input, select, textarea { box-shadow: none !important; border: 1px solid var(--line) !important; background: var(--surface) !important; }
input:focus, select:focus, textarea:focus { border-color: var(--brand) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent) !important; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }

/* ------------------------------------------------------- tableau de bord */
.d-grille { display: grid; gap: 16px; }
.d-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.d-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.d-trio { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.d-grille > .card { margin: 0; }
.d-grille + .d-grille, .d-grille + .card, .card + .d-grille { margin-top: 16px; }
@media (max-width: 1100px) { .d-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-main, .d-trio { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .d-kpis { grid-template-columns: minmax(0, 1fr); } }
.d-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 16px 0;
  display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.d-kpi-l { font-size: .84rem; color: var(--ink-muted); font-weight: 500; }
.d-kpi-v { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-kpi-s { font-size: .8rem; color: var(--ink-muted); margin-top: 2px; min-height: 1.2em; }
.d-kpi .g-spark { width: calc(100% + 32px); margin: 10px -16px 0; height: 42px; display: block; }
.d-kpi.vide-spark { padding-bottom: 16px; }
.d-pastille { display: inline-flex; padding: 1px 7px; border-radius: 999px; font-size: .75rem; font-weight: 650; }
.d-pastille.up { color: #067647; background: #ECFDF3; } .d-pastille.down { color: #B42318; background: #FEF3F2; }
:root[data-theme="dark"] .d-pastille.up { color: #75E0A7; background: rgba(18, 183, 106, .16); }
:root[data-theme="dark"] .d-pastille.down { color: #FDA29B; background: rgba(240, 68, 56, .16); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .d-pastille.up { color: #75E0A7; background: rgba(18, 183, 106, .16); }
  :root:not([data-theme="light"]) .d-pastille.down { color: #FDA29B; background: rgba(240, 68, 56, .16); } }
.d-bandeau { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); margin: 0 -20px -18px; }
.d-bandeau > div { padding: 12px 20px; border-left: 1px solid var(--line); min-width: 0; }
.d-bandeau > div:first-child { border-left: 0; }
.d-bandeau span { display: block; font-size: .74rem; color: var(--ink-muted); }
.d-bandeau b { display: block; font-size: .96rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .d-bandeau { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .d-bandeau > div:nth-child(3) { border-left: 0; } .d-bandeau > div:nth-child(n+3) { border-top: 1px solid var(--line); } }
.d-sante { display: flex; justify-content: space-around; align-items: center; gap: 12px; flex-wrap: wrap; }
.d-sante > div { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.d-sante small { color: var(--ink-muted); font-size: .78rem; }
.d-tel { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.d-tel:last-child { border-bottom: 0; }
.d-tel-n { flex: 1; min-width: 0; }
.d-tel-n b { display: block; font-size: .92rem; } .d-tel-n span { font-size: .78rem; color: var(--ink-muted); }
.d-batt { width: 46px; height: 8px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; flex: none; }
.d-batt i { display: block; height: 100%; border-radius: 999px; }

/* --------------------------------------------------------------- graphiques */
.g-cadre { width: 100%; }
.g-aire { display: block; width: 100%; height: 240px; overflow: visible; }
.g-grille { stroke: var(--line); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.g-axe { font-size: 11px; fill: var(--ink-muted); font-variant-numeric: tabular-nums; }
.g-ligne { fill: none; stroke-width: 2.4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.g-zone { fill: transparent; }
.g-zone:hover { fill: color-mix(in srgb, var(--ink) 4%, transparent); }
.g-legende { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-muted); margin-top: 6px; }
.g-legende span { display: inline-flex; align-items: center; gap: 6px; }
.g-legende i { width: 10px; height: 10px; border-radius: 3px; }
.g-vide { padding: 32px 8px; text-align: center; color: var(--ink-muted); font-size: .88rem; margin: 0; }
.g-anneau { position: relative; flex: none; }
.g-anneau svg { width: 100%; height: 100%; display: block; }
.g-piste { fill: none; stroke: var(--surface-sunken); }
.g-val { fill: none; stroke-linecap: round; }
.g-centre { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.g-centre b { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.g-centre span { font-size: .72rem; color: var(--ink-muted); }
.g-jauge { width: 190px; max-width: 100%; }
.g-jauge svg { width: 100%; display: block; }
.g-aiguille { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.g-moyeu { fill: var(--ink); }
.g-jauge-v { text-align: center; margin-top: -6px; }
.g-jauge-v b { display: block; font-size: 1.2rem; font-weight: 700; }
.g-jauge-v span { font-size: .72rem; color: var(--ink-muted); }
.g-repart { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.g-leg { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 8px; font-size: .85rem; }
.g-leg li { display: flex; align-items: center; gap: 8px; }
.g-leg i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.g-leg span { flex: 1; color: var(--ink-muted); }
.g-barres { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.g-barres-t { display: flex; justify-content: space-between; gap: 8px; font-size: .86rem; margin-bottom: 5px; }
.g-barres-t b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.g-barres-r { height: 8px; background: var(--surface-sunken); border-radius: 999px; overflow: hidden; }
.g-barres-r i { display: block; height: 100%; border-radius: 999px; }
.g-barres-s { font-size: .74rem; color: var(--ink-muted); margin-top: 3px; }
.g-voyant { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 550; color: var(--ink-muted); white-space: nowrap; }
.g-voyant i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); position: relative; }
.g-voyant-ok i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.g-voyant-warn i { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent); }
.g-voyant-ko i { background: var(--ko); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ko) 22%, transparent); }
.g-voyant-ko i::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--ko);
  animation: g-ping 1.8s ease-out infinite; }
@keyframes g-ping { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .g-voyant-ko i::after { animation: none; } }

/* =====================================================================
   REFONTE (16/11/2026) — meme direction que le panneau de l'agent :
   le comptoir d'un kiosque Mobile Money, sur, attentif, sobre.
   Surfaces neutres, filets fins, un seul accent (--brand), DM Sans,
   aucun libelle en capitales, le POINT D'ETAT des telephones en signature
   et la batterie dessinee comme moment. Scope : body.app (portail + admin).
   La page de paiement publique (body.public) n'est pas touchee.
   ===================================================================== */
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 100 1000; font-display: swap;
  src: url('/static/fonts/DMSans-var.woff2') format('woff2'); }
body.app {
  --bg: #F5F5F3; --surface: #FFFFFF; --surface-sunken: #EFEFEC; --line: #E4E4E0;
  --ink: #17181A; --ink-2: #4A4C52; --ink-muted: #73757B;
  --g1: var(--brand); --g2: #A3A5AA; --g3: #6B6E75; --g4: #C9CBCF; --g5: #4A4C52;
  --ok: #1F8A55; --warn: #B76E00; --ko: #C2362B;
  --ok-doux: #E7F3EC; --warn-doux: #FBF0DE; --ko-doux: #FBE9E7;
  --radius-lg: 14px; --radius-md: 10px; --radius-sm: 8px;
  --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
  font-family: var(--font-sans); background: var(--bg); color: var(--ink);
}
:root[data-theme="dark"] body.app {
  --bg: #0E0E0F; --surface: #161618; --surface-sunken: #1E1E21; --line: #27272B;
  --ink: #EDEDEE; --ink-2: #C4C5C9; --ink-muted: #8E9096;
  --g2: #5C5E64; --g3: #8E9096; --g4: #3A3B40; --g5: #C4C5C9;
  --ok: #4CC38A; --warn: #E0A341; --ko: #F07A6E;
  --ok-doux: rgba(76, 195, 138, .12); --warn-doux: rgba(224, 163, 65, .12); --ko-doux: rgba(240, 122, 110, .12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.app {
    --bg: #0E0E0F; --surface: #161618; --surface-sunken: #1E1E21; --line: #27272B;
    --ink: #EDEDEE; --ink-2: #C4C5C9; --ink-muted: #8E9096;
    --g2: #5C5E64; --g3: #8E9096; --g4: #3A3B40; --g5: #C4C5C9;
    --ok: #4CC38A; --warn: #E0A341; --ko: #F07A6E;
    --ok-doux: rgba(76, 195, 138, .12); --warn-doux: rgba(224, 163, 65, .12); --ko-doux: rgba(240, 122, 110, .12);
  }
}

/* libelles en casse de phrase, poids 400 a 600 */
body.app .table th, body.app .form label, body.app .kpi-l, body.app .adm-tag {
  text-transform: none; letter-spacing: 0; }
body.app .table th { font-size: 12px; font-weight: 500; }
body.app .form label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
body.app .kpi-l { font-size: 13px; font-weight: 400; }
body.app h1, body.app h2, body.app h3, body.app .app-top h1 { font-weight: 500; letter-spacing: -.01em; }
body.app .app-top h1 { font-size: 26px; letter-spacing: -.02em; }
body.app .card-hd h2 { font-size: 15px; font-weight: 500; }
body.app b, body.app strong { font-weight: 600; }

/* barre laterale : dense, selection par un cran de surface */
body.app .side { background: var(--bg); }
body.app .side nav a { min-height: 36px; padding: 0 10px; font-size: 14px; font-weight: 500; color: var(--ink-2);
  border: 1px solid transparent; transition: background-color .15s var(--ease), color .15s var(--ease); }
body.app .side nav a svg { color: var(--ink-muted); }
body.app .side nav a:hover { background: var(--surface-sunken); color: var(--ink); }
body.app .side nav a.on { background: var(--surface); color: var(--ink); border-color: var(--line); font-weight: 500; }
body.app .side nav a.on svg { color: var(--brand); }
body.app .side nav a.on::before { display: none; }
body.app .side-foot { background: var(--surface); }
body.app .app-top { background: var(--bg); backdrop-filter: none; }

/* composants */
body.app .card, body.app .kpi, body.app .d-kpi { box-shadow: none; border-color: var(--line); }
body.app .card-hd { padding: 20px 24px 4px; }
body.app .card-bd { padding: 16px 24px 24px; }
body.app .btn { font-weight: 500; transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease); }
body.app .btn:active { transform: scale(.98); }
body.app .badge { font-weight: 500; letter-spacing: 0; text-transform: none; }
body.app .notice { border: 1px solid var(--line); background: var(--surface); }
body.app .notice.warn { background: var(--warn-doux); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
body.app .notice.ko { background: var(--ko-doux); border-color: color-mix(in srgb, var(--ko) 30%, transparent); }
body.app .notice.ok { background: var(--ok-doux); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }

/* tableau de bord : une bande de chiffres, pas de mini-courbes */
body.app .d-kpis { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
body.app .d-kpis .d-kpi { border: 0; border-left: 1px solid var(--line); border-radius: 0; padding: 20px 24px; background: transparent; }
body.app .d-kpis .d-kpi:first-child { border-left: 0; }
body.app .d-kpi .g-spark { display: none; }
body.app .d-kpi-l { font-size: 13px; font-weight: 400; }
body.app .d-kpi-v { font-size: 30px; font-weight: 500; }
body.app .d-kpi-s { font-size: 13px; margin-top: 6px; }
@media (max-width: 1100px) { body.app .d-kpis .d-kpi:nth-child(3) { border-left: 0; }
  body.app .d-kpis .d-kpi:nth-child(n+3) { border-top: 1px solid var(--line); } }
@media (max-width: 560px) { body.app .d-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.app .d-kpis .d-kpi { padding: 16px; } body.app .d-kpi-v { font-size: 22px; } }
body.app .d-pastille { padding: 0; background: none !important; font-weight: 500; }
body.app .d-pastille.up { color: var(--ok); } body.app .d-pastille.down { color: var(--ko); }
body.app .g-ligne { stroke-width: 2; }
body.app .g-centre b, body.app .g-jauge-v b { font-weight: 500; }
/* le voyant d'alerte ne clignote plus : la couleur suffit */
body.app .g-voyant-ko i::after { display: none; }

/* ============================================================ TELEPHONES */
.tel-dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-muted); }
.tel-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-doux); }
.tel-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-doux); }
.tel-dot.ko { background: var(--ko); box-shadow: 0 0 0 3px var(--ko-doux); }
.tel-dot.off { background: var(--g4); }
.batt { display: inline-flex; align-items: center; gap: 2px; vertical-align: middle; }
.batt-corps { width: 44px; height: 20px; border: 1.5px solid var(--ink-2); border-radius: 5px; padding: 2px; }
.batt-corps > i { display: block; height: 100%; border-radius: 2px; background: var(--ok); min-width: 2px; }
.batt.warn .batt-corps > i { background: var(--warn); }
.batt.ko .batt-corps > i { background: var(--ko); }
.batt.inconnue .batt-corps { border-style: dashed; border-color: var(--ink-muted); }
.batt-bout { width: 3px; height: 8px; border-radius: 0 2px 2px 0; background: var(--ink-2); }
.batt.inconnue .batt-bout { background: var(--ink-muted); }
.batt.petite .batt-corps { width: 22px; height: 11px; border-width: 1px; border-radius: 3px; padding: 1px; }
.batt.petite .batt-bout { width: 2px; height: 5px; }
.tel-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.tel-carte { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 24px 24px;
  display: flex; flex-direction: column; gap: 20px; min-width: 0; background: var(--surface); }
.tel-carte.ko { border-color: color-mix(in srgb, var(--ko) 40%, var(--line)); }
.tel-carte.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.tel-hd { display: flex; align-items: flex-start; gap: 10px; }
.tel-hd .tel-dot { margin-top: 7px; }
.tel-nom { font-size: 17px; font-weight: 500; }
.tel-op { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.tel-etat { font-size: 14px; color: var(--ink-2); }
.tel-etat.ko { color: var(--ko); } .tel-etat.warn { color: var(--warn); }
.tel-batt { display: flex; align-items: center; gap: 16px; }
.tel-batt .batt-corps { width: 64px; height: 28px; border-radius: 7px; padding: 3px; }
.tel-batt .batt-bout { width: 4px; height: 12px; }
.tel-pct { font-size: 32px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.tel-pct small { display: block; font-size: 13px; font-weight: 400; color: var(--ink-muted); letter-spacing: 0; margin-top: 6px; }
.tel-faits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px;
  padding-top: 16px; border-top: 1px solid var(--line); }
.tel-faits span { display: block; font-size: 12px; color: var(--ink-muted); }
.tel-faits b { display: block; font-size: 14px; font-weight: 500; margin-top: 2px; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: -4px; }
.tel-carte details.regle { margin: 0; }
@media (max-width: 420px) { .tel-grille { grid-template-columns: minmax(0, 1fr); } .tel-carte { padding: 16px 20px 20px; } }
.d-tel-b { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; flex: none; }
.d-tel .tel-dot { margin-right: 2px; }
.d-sante2 { display: grid; gap: 20px; }
.d-sante-l { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.d-sante-l span { font-size: 13px; color: var(--ink-muted); }
.d-sante-l b { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
.d-barre { height: 6px; border-radius: 3px; background: var(--surface-sunken); margin-top: 8px; overflow: hidden; }
.d-barre > i { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
.d-sante2 small { display: block; font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
.d-sante-tel { display: flex; align-items: center; gap: 10px; margin: 0; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-2); }
body.app details.regle summary { font-size: 14px; font-weight: 500; }
