
        /* ── Page header layout (from personal-rag.css) ──── */
        .page-header {
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-items: flex-start;
            gap: var(--space-4, 1rem);
            padding: 20px;
            text-align: left;
        }

        .page-header-leading {
            flex: 1;
            min-width: 240px;
            display: flex;
            flex-direction: column;
            gap: var(--space-2, .5rem);
        }

        .page-header .page-title  { justify-content: flex-start; }
        .page-header .page-subtitle { text-align: left; margin: 0; color: var(--text-secondary); }

        .page-header-actions {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: var(--space-3, .75rem);
        }

        /* ── Utilities ────────────────────────────────────── */
        .hidden { display: none; }

        /* ── Balance Card ─────────────────────────────────── */
        .balance-card {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 2rem;
            flex-wrap: wrap;
            padding: 2rem;
            background: var(--card-bg, var(--surface-2));
            border: 1px solid var(--border);
            border-radius: var(--radius-lg, 12px);
            margin-bottom: 1.5rem;
        }

        .balance-info { flex: 1; min-width: 200px; }

        .balance-label {
            font-size: .75rem;
            font-weight: 600;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: .06em;
            margin-bottom: .5rem;
        }

        .balance-value {
            font-size: 2.75rem;
            font-weight: 800;
            line-height: 1;
            color: var(--primary, #8b5cf6);
        }

        .balance-value.low  { color: #f59e0b; }
        .balance-value.zero { color: var(--text-secondary); }

        .balance-currency {
            font-size: 1.25rem;
            font-weight: 500;
            color: var(--text-secondary);
            margin-left: .25rem;
        }

        .wallet-status-badge {
            display: inline-flex;
            align-items: center;
            gap: .375rem;
            font-size: .75rem;
            font-weight: 600;
            padding: .25rem .75rem;
            border-radius: 9999px;
            margin-top: .75rem;
        }

        .wallet-status-badge.active    { background: rgba(16,185,129,.12); color: #10b981; }
        .wallet-status-badge.suspended { background: rgba(239,68,68,.12);  color: #ef4444; }

        .status-dot { font-size: .45rem; }

        /* ── Recharge ─────────────────────────────────────── */
        .recharge-section {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: .75rem;
        }

        .recharge-amounts {
            display: flex;
            gap: .5rem;
            flex-wrap: wrap;
            justify-content: flex-end;
        }

        .amount-btn {
            border: 1px solid var(--border);
            background: var(--surface-1, transparent);
            color: var(--text-primary);
            border-radius: 8px;
            padding: .45rem 1rem;
            font-size: .875rem;
            font-weight: 500;
            cursor: pointer;
            transition: all .15s;
        }

        .amount-btn:hover,
        .amount-btn.selected {
            background: var(--primary, #8b5cf6);
            border-color: var(--primary, #8b5cf6);
            color: #fff;
        }

        /* ── Tabs ─────────────────────────────────────────── */
        .wallet-tabs {
            display: flex;
            gap: .25rem;
            margin-bottom: 1.5rem;
            background: var(--card-bg, var(--surface-2));
            border: 1px solid var(--border);
            border-radius: var(--radius-lg, 12px);
            padding: .375rem;
        }

        .wallet-tab {
            flex: 1;
            padding: .6rem 1rem;
            border: none;
            background: transparent;
            color: var(--text-secondary);
            border-radius: 8px;
            cursor: pointer;
            font-size: .875rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: .5rem;
            transition: all .15s;
        }

        .wallet-tab.active                 { background: var(--primary, #8b5cf6); color: #fff; }
        .wallet-tab:not(.active):hover     { background: var(--surface-1, rgba(255,255,255,.06)); color: var(--text-primary); }

        /* ── Table card ───────────────────────────────────── */
        .table-card {
            background: var(--card-bg, var(--surface-2));
            border: 1px solid var(--border);
            border-radius: var(--radius-lg, 12px);
            overflow: hidden;
        }

        .table-card table { width: 100%; border-collapse: collapse; margin: 0; }

        .table-card thead th {
            background: var(--surface-1, rgba(0,0,0,.08));
            color: var(--text-secondary);
            font-size: .7rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: .06em;
            padding: .875rem 1rem;
            border-bottom: 1px solid var(--border);
            white-space: nowrap;
        }

        .table-card tbody td {
            padding: .875rem 1rem;
            border-bottom: 1px solid var(--border);
            font-size: .875rem;
            vertical-align: middle;
            color: var(--text-primary);
        }

        .table-card tbody tr:last-child td { border-bottom: none; }
        .table-card tbody tr:hover         { background: rgba(139,92,246,.04); }

        /* ── Table cell helpers ───────────────────────────── */
        .td-date   { white-space: nowrap; color: var(--text-secondary); }
        .td-tabular{ font-variant-numeric: tabular-nums; }
        .td-desc   { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
        .td-model  { font-size: .8rem; }
        .td-tokens { font-variant-numeric: tabular-nums; font-size: .8rem; }
        .td-agent  { font-size: .75rem; color: var(--text-secondary); }
        .provider-name  { font-weight: 600; }
        .model-name     { color: var(--text-secondary); font-size: .75rem; }
        .tokens-detail  { color: var(--text-secondary); font-size: .7rem; }

        /* ── Badges ───────────────────────────────────────── */
        .tx-badge {
            display: inline-flex;
            align-items: center;
            gap: .25rem;
            padding: .2rem .6rem;
            border-radius: 9999px;
            font-size: .7rem;
            font-weight: 700;
            white-space: nowrap;
        }

        .tx-recharge  { background: rgba(16,185,129,.12); color: #10b981; }
        .tx-deduction { background: rgba(239,68,68,.1);   color: #f87171; }
        .tx-bonus     { background: rgba(245,158,11,.12); color: #f59e0b; }
        .tx-other     { background: rgba(107,114,128,.12);color: #9ca3af; }
        .op-chat      { background: rgba(99,102,241,.12); color: #818cf8; }
        .op-embedding { background: rgba(245,158,11,.12); color: #fbbf24; }
        .op-image     { background: rgba(236,72,153,.12); color: #f472b6; }
        .op-other     { background: rgba(107,114,128,.12);color: #9ca3af; }

        .amount-plus  { color: #10b981; font-weight: 700; }
        .amount-minus { color: #f87171; font-weight: 700; }

        /* ── Loading / Empty ──────────────────────────────── */
        .table-loading, .table-empty {
            text-align: center;
            padding: 3.5rem 2rem;
            color: var(--text-secondary);
        }

        .table-loading i, .table-empty i {
            font-size: 2rem;
            display: block;
            margin-bottom: .75rem;
            opacity: .35;
        }

        /* ── Pagination ───────────────────────────────────── */
        .pagination-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: .75rem 1rem;
            border-top: 1px solid var(--border);
            font-size: .8rem;
            color: var(--text-secondary);
            flex-wrap: wrap;
            gap: .5rem;
        }

        .pagination-controls { display: flex; gap: .375rem; align-items: center; }
        .pager-label         { padding: .375rem .5rem; }

        /* ── Tab pane ─────────────────────────────────────── */
        .tab-pane        { display: none; }
        .tab-pane.active { display: block; }

        /* ── Responsive (legacy) ─────────────────────────────────── */
        @media (max-width: 600px) {
            .balance-card      { flex-direction: column; }
            .recharge-section  { align-items: flex-start; width: 100%; }
            .recharge-amounts  { justify-content: flex-start; }
            .balance-value     { font-size: 2rem; }
            .table-card        { overflow-x: auto; }
            .table-card table  { min-width: 500px; }
        }

        /* ══ WALLET CONSOLE (redesign v3 – 4 blocchi) ═══════════════════ */
        .wallet-console {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 1rem;
            margin-bottom: 1.5rem;
            align-items: stretch;
        }

        /* Shared block base */
        .wc-block {
            border-radius: 14px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            gap: .5rem;
        }

        /* Shared grey card style for blocks 2–4 */
        .wc-block-amounts,
        .wc-block-topup,
        .wc-block-pay {
            background: #f4f5f9;
            border: 1px solid rgba(0,0,0,.07);
            padding: .85rem 1rem;
            box-shadow: 0 2px 10px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
        }

        /* Block label (title row inside grey cards) */
        .wc-block-label {
            display: flex;
            align-items: center;
            gap: .4rem;
            font-size: .68rem;
            font-weight: 700;
            letter-spacing: .1em;
            text-transform: uppercase;
            color: var(--text-secondary, #6b7280);
            padding-bottom: .45rem;
            border-bottom: 1px solid rgba(0,0,0,.07);
            margin-bottom: .1rem;
        }
        .wc-block-label i { color: var(--primary, #8b5cf6); font-size: .72rem; }

        /* Block 3 – extra info line */
        .wc-topup-desc {
            font-size: .75rem;
            color: var(--text-secondary, #6b7280);
            line-height: 1.4;
        }
        .wc-topup-selected {
            display: inline-flex;
            align-items: center;
            gap: .3rem;
            font-size: 1.3rem;
            font-weight: 800;
            color: var(--primary, #8b5cf6);
            margin-top: .2rem;
        }

        /* ── Card (Block 1) ───────────────────────────────────────────────── */
        .wc-card {
            min-height: 105px;
            background: linear-gradient(135deg, #2d1b69 0%, #4c35a9 50%, #7c3aed 100%);
            border-radius: 14px;
            padding: .75rem 1rem;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            color: #fff;
            position: relative;
            overflow: hidden;
            box-shadow: 0 4px 16px rgba(109,40,217,.35), 0 2px 8px rgba(0,0,0,.18);
        }

        /* decorative circles */
        .wc-card-deco {
            position: absolute;
            border-radius: 50%;
            pointer-events: none;
        }
        .wc-deco-1 { width: 280px; height: 280px; background: rgba(255,255,255,.055); top: -90px; right: -70px; }
        .wc-deco-2 { width: 190px; height: 190px; background: rgba(255,255,255,.04);  bottom: -65px; right: 90px; }
        .wc-deco-3 { width: 100px; height: 100px; background: rgba(255,255,255,.035); top: 30px; left: -30px; }

        .wc-card-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: relative;
        }

        .wc-brand {
            display: flex;
            align-items: center;
            gap: .5rem;
            font-size: .75rem;
            font-weight: 700;
            letter-spacing: .12em;
            text-transform: uppercase;
            opacity: .88;
        }
        .wc-brand i { font-size: 1.05rem; }

        /* SIM chip */
        .wc-chip {
            width: 38px; height: 28px;
            background: linear-gradient(135deg, #d4af37 0%, #ffd700 55%, #c8a415 100%);
            border-radius: 5px;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: .82;
        }
        .wc-chip-inner {
            width: 24px; height: 18px;
            border: 1.5px solid rgba(0,0,0,.22);
            border-radius: 3px;
            background: linear-gradient(135deg, #e8c84a 0%, #b8960f 100%);
        }

        /* Balance body */
        .wc-card-body { flex: 1; padding: .85rem 0 .5rem; position: relative; }

        .wc-bal-label {
            font-size: .65rem;
            font-weight: 700;
            letter-spacing: .12em;
            text-transform: uppercase;
            opacity: .65;
            margin-bottom: .4rem;
        }
        .wc-bal-row { display: flex; align-items: baseline; gap: .45rem; }
        .wc-bal-value {
            font-size: 1.8rem;
            font-weight: 800;
            line-height: 1;
            letter-spacing: -.025em;
            text-shadow: 0 2px 14px rgba(0,0,0,.22);
        }
        .wc-bal-cur {
            font-size: 1.05rem;
            font-weight: 500;
            opacity: .7;
        }
        .wc-bal-value.wc-low  { color: #fcd34d; }
        .wc-bal-value.wc-zero { opacity: .45; }

        /* Card footer */
        .wc-card-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: .5rem;
            position: relative;
        }
        /* override badge in dark-card context */
        .wc-card .wallet-status-badge.active {
            background: rgba(255,255,255,.15);
            color: #a7f3d0;
            backdrop-filter: blur(4px);
        }
        .wc-card .wallet-status-badge.suspended {
            background: rgba(255,255,255,.12);
            color: #fca5a5;
        }

        .wc-card-num {
            display: flex;
            gap: .45rem;
            font-size: .72rem;
            font-weight: 600;
            opacity: .5;
            letter-spacing: .06em;
            font-family: 'Courier New', monospace;
        }

        /* ── Top-up panel (legacy, not used in 4-block layout) ──────── */
        .wc-topup {
            background: var(--card-bg, var(--surface-2));
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: .75rem .9rem;
            display: flex;
            flex-direction: column;
            gap: .5rem;
        }
        .wc-topup-header {
            display: flex;
            align-items: center;
            gap: .5rem;
            font-size: .875rem;
            font-weight: 700;
            color: var(--text-primary);
        }
        .wc-topup-header i { color: var(--primary, #8b5cf6); }

        /* 2×2 amount grid */
        .wc-amounts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
        .wc-amt {
            position: relative;
            border: 2px solid var(--border);
            background: var(--surface-1, transparent);
            color: var(--text-primary);
            border-radius: 8px;
            padding: .4rem .35rem;
            font-size: .85rem;
            font-weight: 600;
            cursor: pointer;
            transition: all .15s;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: .1rem;
            min-height: 38px;
        }
        .wc-amt:hover {
            border-color: var(--primary, #8b5cf6);
            color: var(--primary, #8b5cf6);
            background: rgba(139,92,246,.06);
        }
        .wc-amt.selected {
            background: var(--primary, #8b5cf6);
            border-color: var(--primary, #8b5cf6);
            color: #fff;
            box-shadow: 0 4px 14px rgba(139,92,246,.38);
        }
        .wc-amt-val   { font-size: .95rem; font-weight: 700; }
        .wc-amt-badge {
            font-size: .58rem;
            font-weight: 700;
            letter-spacing: .04em;
            padding: .1rem .35rem;
            border-radius: 9999px;
            background: rgba(139,92,246,.14);
            color: var(--primary, #8b5cf6);
        }
        .wc-amt.selected .wc-amt-badge {
            background: rgba(255,255,255,.22);
            color: #fff;
        }

        /* Stripe button */
        .wc-stripe-btn {
            width: 100%;
            padding: .875rem 1.25rem;
            background: linear-gradient(135deg, #635bff 0%, #7c3aed 100%);
            border: none;
            border-radius: 10px;
            color: #fff;
            font-size: .875rem;
            font-weight: 600;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: .5rem;
            transition: all .2s;
            box-shadow: 0 4px 14px rgba(99,91,255,.32);
        }
        .wc-stripe-btn:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 6px 20px rgba(99,91,255,.44);
        }
        .wc-stripe-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

        /* Security note */
        .wc-secure {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: .35rem;
            font-size: .67rem;
            color: var(--text-secondary);
            opacity: .72;
        }
        .wc-secure i { color: #10b981; font-size: .65rem; }

        /* ── Wallet Console responsive ──────────────────────────────── */
        @media (max-width: 900px) {
            .wallet-console { grid-template-columns: repeat(2, 1fr); }
        }
        @media (max-width: 520px) {
            .wallet-console { grid-template-columns: 1fr; }
            .wc-bal-value   { font-size: 1.5rem; }
        }
        @media (max-width: 400px) {
            .wc-bal-value   { font-size: 2rem; }
            .table-card     { overflow-x: auto; }
            .table-card table { min-width: 500px; }
        }
