/* BBTEK Wallet (back-office) — compléments à Bootstrap 5 (aucun style inline : CSP stricte). */
:root {
    --bb-primary: #0b4f6c;
    --bb-accent: #f2a541;
    --bb-sidebar: #0e2a38;
    --bb-sidebar-width: 250px;
}

body { background: #f4f6f8; font-size: .925rem; }

/* ---------- Menu latéral ---------- */
.app-sidebar {
    --bs-offcanvas-width: 280px;
    --bs-offcanvas-bg: var(--bb-sidebar);
    --bs-offcanvas-color: #d5e3ea;
    background-color: var(--bb-sidebar);
    color: #d5e3ea;
}
.app-sidebar.offcanvas-lg { background-color: var(--bb-sidebar) !important; }
.app-sidebar .brand { color: #fff; font-weight: 700; letter-spacing: .5px; padding: 1rem 1.25rem; display: block; text-decoration: none; }
.app-sidebar .brand span { color: var(--bb-accent); }
.app-sidebar .offcanvas-header { border-bottom: 1px solid rgba(255,255,255,.08); }

.app-sidebar .nav-section {
    display: flex; width: 100%; align-items: center; justify-content: space-between;
    background: none; border: 0; color: #7fa3b5; font-size: .7rem; text-transform: uppercase;
    letter-spacing: 1px; padding: .9rem 1.25rem .35rem; text-align: left;
}
.app-sidebar .nav-section:hover, .app-sidebar .nav-section:focus-visible { color: #fff; }
.app-sidebar .nav-section:focus-visible { outline: 2px solid var(--bb-accent); outline-offset: -2px; }
.app-sidebar .nav-caret { width: .45rem; height: .45rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; margin-bottom: 2px; }
.app-sidebar .nav-section[aria-expanded="false"] .nav-caret { transform: rotate(-45deg); }

.app-sidebar .nav-link { color: #d5e3ea; padding: .45rem 1.25rem; border-left: 3px solid transparent; white-space: normal; }
.app-sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.app-sidebar .nav-link.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--bb-accent); }
.app-sidebar .sidebar-footer { border-top: 1px solid rgba(255,255,255,.08); padding: .75rem 1.25rem; font-size: .8rem; color: #7fa3b5; }
.app-sidebar .sidebar-footer a { color: #fff; text-decoration: none; overflow-wrap: anywhere; }

/* Écran large : menu fixe sur toute la hauteur, défilement indépendant de la page. */
@media (min-width: 992px) {
    .app-sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; width: var(--bb-sidebar-width);
        display: flex; flex-direction: column; z-index: 1030;
    }
    .app-sidebar .offcanvas-header { display: none; }
    .app-sidebar .offcanvas-body.app-sidebar-body {
        display: block; position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
        padding-bottom: 1rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent;
    }
    .app-main { margin-left: var(--bb-sidebar-width); }
}

/* Tablette et téléphone : panneau coulissant (offcanvas). */
@media (max-width: 991.98px) {
    .app-sidebar { display: flex; flex-direction: column; }
    .app-sidebar .offcanvas-body.app-sidebar-body { padding: 0 0 1rem; overflow-y: auto; }
}

.hamburger, .hamburger::before, .hamburger::after { display: inline-block; width: 1rem; height: 2px; background: currentColor; position: relative; vertical-align: middle; }
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -5px; }
.hamburger::after { top: 5px; }

/* ---------- Mise en page ---------- */
.app-main { min-height: 100vh; min-width: 0; }
.app-topbar { background: #fff; border-bottom: 1px solid #e3e8ec; position: sticky; top: 0; z-index: 1020; }
.topbar-user, .topbar-context, .page-title { overflow-wrap: anywhere; }

.card { border: 0; box-shadow: 0 1px 3px rgba(16,24,40,.08); }
.card-header { background: #fff; font-weight: 600; }
.stat-card .stat-value { font-size: 1.45rem; font-weight: 700; color: var(--bb-primary); overflow-wrap: anywhere; }
.stat-card .stat-label { color: #6c757d; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }

/* Les noms ne sont jamais tronqués : ils passent à la ligne. */
td, th, dd, dt, .list-group-item { overflow-wrap: break-word; }
.table-sm td, .table-sm th { vertical-align: middle; }
.table th { white-space: nowrap; }
.amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mono { font-family: SFMono-Regular, Menlo, Consolas, monospace; }
.select-hint { margin-top: .2rem; color: var(--bs-body-color); overflow-wrap: anywhere; }
.text-uppercase::placeholder { text-transform: none; font-family: var(--bs-body-font-family); }

.withdrawal-code { font-size: clamp(1.4rem, 7vw, 2.2rem); letter-spacing: .25rem; font-weight: 700; color: var(--bb-primary); background: #fff8e8; border: 2px dashed var(--bb-accent); border-radius: .5rem; padding: .75rem 1rem; display: inline-block; max-width: 100%; }

.qr-box svg { width: 220px; height: 220px; max-width: 100%; }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.bar-chart .bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-chart .bar { width: 100%; background: var(--bb-primary); border-radius: 3px 3px 0 0; min-height: 2px; height: 0; }
.bar-chart .bar-label { font-size: .65rem; color: #6c757d; margin-top: 4px; white-space: nowrap; }

.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0e2a38, #0b4f6c); }
.login-card { width: 100%; max-width: 420px; }

.details-json { font-size: .78rem; background: #f8f9fa; border-radius: .25rem; padding: .5rem; max-height: 240px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.sticky-actions { position: sticky; bottom: 0; background: #fff; padding: .75rem 0; border-top: 1px solid #e3e8ec; }

/* ---------- Petits écrans ---------- */
@media (max-width: 575.98px) {
    body { font-size: .9rem; }
    .bar-chart { gap: 3px; }
    .bar-chart .bar-col:nth-child(even) .bar-label { visibility: hidden; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1 1 auto; }
    .stat-card .stat-value { font-size: 1.2rem; }
}

/* Simulateur USSD (back-office) */
.ussd-phone { max-width: 340px; padding: 18px 14px; border-radius: 28px; background: #1d2b33; }
.ussd-screen { min-height: 260px; max-height: 420px; overflow-y: auto; padding: 12px; border-radius: 10px; background: #d9e8d3;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; color: #1b2a1a;
    display: flex; flex-direction: column-reverse; } /* défilement calé sur la dernière réponse */
.ussd-screen > div { white-space: pre-wrap; }
.ussd-in { color: #0b4f6c; font-weight: 600; margin: 4px 0; }
.ussd-out { margin: 4px 0 8px; }
.ussd-end { text-align: center; color: #6c757d; }
.ussd-phone .form-control { background: #f8f9fa; }
