/* =============================================
   BrownDataHub — Refreshed look (2026)
   Loaded AFTER style.css / dashboard.css / admin.css on every layout.
   1. Base + shared components restyled (every page, admin included)
   2. Customer app shell (sidebar, mobile header, tab bar)
   3. ui-* components used by the redesigned customer pages
   Tokens live in style.css (:root and [data-theme="dark"]).
   ============================================= */

/* ─── 1. BASE ────────────────────────────── */
body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-body);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

h1 {
    font-family: var(--font-heading);
    font-weight: 500;
    letter-spacing: -0.02em;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

:focus-visible {
    outline: 2px solid var(--caramel);
    outline-offset: 2px;
}

::selection { background: var(--accent-light); color: var(--text-primary); }

.text-gradient {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--primary-light);
}

.text-muted { color: var(--text-muted); }

/* The hidden attribute always wins over component display rules */
[hidden] { display: none !important; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ─── Page header (older pages) ── */
.page-header h1 { font-size: 34px; line-height: 1.1; }
.page-header .subtitle { color: var(--text-secondary); font-size: 15px; margin-top: 6px; }

/* ─── Cards ── */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-card);
}
.glass-card:hover { border-color: var(--border); box-shadow: var(--shadow-card); }
.card-header h3 { font-family: var(--font-body); font-size: 17px; font-weight: 700; }

/* ─── Buttons (older .btn API) ── */
.btn {
    min-height: 44px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 14.5px;
    font-weight: 700;
    box-shadow: none;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.btn-primary,
.btn-primary:hover { background: var(--primary); color: var(--on-primary); box-shadow: none; transform: none; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #FFFFFF; }
.btn-danger { background: var(--danger); color: #FFFFFF; }
[data-theme="dark"] .btn-success,
[data-theme="dark"] .btn-danger { color: #15110E; }
.btn-outline {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-card); border-color: var(--caramel); color: var(--text-primary); }
.btn-ghost { color: var(--primary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--primary); }
.btn-sm { min-height: 36px; font-size: 13.5px; }
.btn-lg { min-height: 52px; font-size: 16px; }
.btn .spinner,
.ui-btn .spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid currentColor; border-top-color: transparent;
    animation: spin 0.6s linear infinite; display: inline-block;
}

/* ─── Forms ── */
.form-label { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.form-input,
.form-select {
    min-height: 48px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--bg-input);
    color: var(--text-primary);
}
.form-input:focus,
.form-select:focus { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(184, 112, 47, 0.18); }

/* ─── Badges → status pills ── */
.badge {
    gap: 6px;
    height: 26px;
    padding: 0 10px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
}
.badge-processing { background: var(--info-bg); color: var(--info); }

/* ─── Alerts / flash ── */
.alert { border-radius: 14px; border: 1px solid transparent; font-weight: 600; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border-color: transparent; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: transparent; }

/* ─── Tables (older .data-table) ── */
.data-table th {
    background: var(--bg-surface);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}
.data-table td { font-size: 14px; border-bottom: 1px solid var(--border-light); }
.data-table tr:hover td { background: var(--bg-surface); }

/* ─── Pagination ── */
.pagination a,
.pagination span { border-radius: 10px; }
.pagination a { background: var(--bg-card); border: 1px solid var(--border-strong); color: var(--text-primary); }
.pagination a:hover { background: var(--bg-card); border-color: var(--caramel); color: var(--primary); }
.pagination .active { background: var(--primary); color: var(--on-primary); }

/* ─── Modals ── */
.modal-overlay { background: rgba(31, 26, 23, 0.55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.modal { border-radius: 22px; border-color: var(--border); box-shadow: var(--shadow-xl); }

/* ─── Toasts ── */
.toast { border: 0; border-radius: 14px; backdrop-filter: none; font-weight: 600; box-shadow: var(--shadow-lg); }
.toast-success { background: #2F7A55; color: #FFFFFF; }
.toast-error, .toast-danger { background: #B3372F; color: #FFFFFF; }
.toast-warning { background: #8A6100; color: #FFFFFF; }
.toast-info { background: #2A1F19; color: #F7F3EE; }

/* ─── Announcement banner ── */
.announcement-banner { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; backdrop-filter: none; margin-bottom: 0; }
.announcement-banner.promo { background: var(--accent-light); border-color: transparent; }
.announcement-banner.warning { background: var(--warning-bg); border-color: transparent; }
.announcement-banner.info { background: var(--info-bg); border-color: transparent; }
.announcement-banner .banner-icon { color: var(--primary-light); display: flex; }

/* ─── Older dashboard pieces still used by store / referral / admin pages ── */
.balance-card { background: var(--espresso); color: var(--on-espresso); border-radius: 20px; }
.balance-card::before { background: none; border: 1px solid rgba(227, 178, 122, 0.18); }
.balance-card::after { background: none; border: 1px solid rgba(227, 178, 122, 0.10); }
.balance-card .balance-label { color: var(--on-espresso-muted); opacity: 1; }
.balance-card .balance-amount { font-weight: 500; letter-spacing: -0.02em; }
[data-theme="dark"] .balance-card { border: 1px solid #3A2E26; }

.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; box-shadow: none; }
.stat-card:hover { transform: none; box-shadow: none; }
.stat-icon { border-radius: 10px; }
.stat-icon.purple { background: var(--accent-light); color: var(--primary-light); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.blue   { background: var(--info-bg); color: var(--info); }
.stat-icon.red    { background: var(--danger-bg); color: var(--danger); }
.stat-value { font-family: var(--font-heading); font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ─── 2. SIDEBAR (customer + admin) ──────── */
.sidebar {
    width: var(--sidebar-width);
    box-sizing: border-box;
    padding: 24px 16px 18px;
    gap: 20px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}
.sidebar-brand { padding: 0 10px; border-bottom: 0; gap: 12px; text-decoration: none; }
.sidebar-brand .logo-icon {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--espresso); color: var(--caramel-light);
    font-family: var(--font-heading); font-size: 22px; font-weight: 600;
}
[data-theme="dark"] .sidebar-brand .logo-icon { background: #3A2C22; }
.sidebar-brand .brand-text { font-family: var(--font-heading); font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.sidebar-brand .brand-text span { color: var(--primary-light); }

.sidebar-nav { padding: 0; overflow: visible; flex: 1 0 auto; }
.sidebar-nav .nav-label {
    padding: 16px 12px 8px;
    font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
    color: var(--text-muted);
}
.sidebar-nav .nav-label:first-child { padding-top: 0; }
.nav-item {
    min-height: 44px;
    box-sizing: border-box;
    padding: 0 12px;
    gap: 12px;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--primary); font-weight: 700; box-shadow: none; }
.nav-item .nav-icon { width: 20px; height: 20px; opacity: 0.85; stroke-width: 1.8; }

.sidebar-footer { padding: 0; border-top: 0; text-align: left; display: flex; flex-direction: column; gap: 14px; }
.sidebar-copyright { font-size: 11.5px; color: var(--text-muted); text-align: center; }

.sidebar-promo { padding: 18px; border-radius: 16px; background: var(--accent-light); display: flex; flex-direction: column; gap: 8px; }
.sidebar-promo strong { font-family: var(--font-heading); font-size: 17px; font-weight: 600; color: var(--text-primary); }
.sidebar-promo p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.sidebar-promo a { font-size: 13px; font-weight: 700; color: var(--primary); text-decoration: none; }

.sidebar-user { display: flex; align-items: center; gap: 6px; padding: 8px 4px 8px 10px; border: 1px solid var(--border); border-radius: 14px; }
.sidebar-user__avatar {
    width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
    background: var(--accent-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 13.5px; font-weight: 700; text-decoration: none;
}
.sidebar-user__who { flex: 1; min-width: 0; margin-left: 4px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.sidebar-user__name { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user__role { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-icon-btn,
.theme-toggle.sidebar-icon-btn {
    width: 34px; height: 40px; flex-shrink: 0;
    border: 0; border-radius: 10px; background: transparent;
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; text-decoration: none;
}
.sidebar-icon-btn:hover,
.theme-toggle.sidebar-icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: transparent; }

/* Admin top bar (and any page still using it) */
.top-nav { background: var(--bg-primary); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 1px solid var(--border); }
.top-nav-brand .logo-icon { display: none; }
.top-nav .page-title { font-family: var(--font-heading); font-weight: 500; letter-spacing: -0.02em; }
.theme-toggle { background: var(--bg-card); border-color: var(--border); border-radius: 12px; }
.topbar-user .avatar,
#userAvatarToggle { background: var(--accent-light) !important; color: var(--primary) !important; box-shadow: none !important; }

/* ─── 2b. CUSTOMER APP SHELL ─────────────── */
.ui-app { min-height: 100vh; background: var(--bg-primary); }
.ui-main { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; }
.ui-page {
    flex: 1;
    width: 100%;
    max-width: 1320px;
    box-sizing: border-box;
    padding: 32px 40px 56px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.ui-page > .alert { margin: 0; }
.ui-mobilebar, .ui-tabbar { display: none; }

@media (max-width: 768px) {
    .ui-main { margin-left: 0; }
    .ui-mobilebar {
        display: flex; align-items: center; gap: 8px;
        position: sticky; top: 0; z-index: 900;
        height: 64px; padding: 0 12px 0 16px;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border);
    }
    .ui-page { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); gap: 18px; }
    .ui-tabbar {
        display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 950;
        height: calc(66px + env(safe-area-inset-bottom));
        padding: 0 4px env(safe-area-inset-bottom);
        background: var(--bg-card);
        border-top: 1px solid var(--border);
    }
}
.ui-mobilebar__brand {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--text-primary);
    font-family: var(--font-heading); font-size: 18px; font-weight: 600;
}
.ui-mobilebar__brand span span { color: var(--primary-light); }
.ui-logo {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
    background: var(--espresso); color: var(--caramel-light);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-heading); font-size: 19px; font-weight: 600;
}
.ui-iconbtn,
.theme-toggle.ui-iconbtn {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 12px; border: 1px solid var(--border); background: var(--bg-card);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; text-decoration: none; font-size: 13.5px; font-weight: 700;
}
.ui-iconbtn--avatar { border-radius: 50%; background: var(--accent-light); color: var(--primary); border-color: transparent; }
.ui-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 44px; border: 0; background: none; cursor: pointer;
    font-family: var(--font-body); font-size: 11.5px; font-weight: 600;
    color: var(--text-muted); text-decoration: none;
}
.ui-tab svg { width: 22px; height: 22px; }
.ui-tab.is-active { color: var(--primary); font-weight: 800; }

/* ─── 3. UI COMPONENTS ───────────────────── */
.ui-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.ui-page-head h1 { margin: 0; font-family: var(--font-heading); font-size: 34px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.ui-page-head p { margin: 6px 0 0; font-size: 15px; color: var(--text-secondary); }
.ui-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ui-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--text-secondary); text-decoration: none; margin-bottom: 8px; }

/* Buttons */
.ui-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 20px; box-sizing: border-box;
    border: 1px solid transparent; border-radius: 12px;
    font-family: var(--font-body); font-size: 14.5px; font-weight: 700; line-height: 1;
    text-decoration: none; white-space: nowrap; cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}
.ui-btn svg { flex-shrink: 0; }
.ui-btn--primary { background: var(--primary); color: var(--on-primary); }
.ui-btn--primary:hover { background: var(--primary-dark); color: var(--on-primary); }
.ui-btn--secondary { background: var(--bg-card); border-color: var(--border-strong); color: var(--text-primary); }
.ui-btn--secondary:hover { border-color: var(--caramel); color: var(--text-primary); }
.ui-btn--soft { background: var(--accent-light); color: var(--primary); }
.ui-btn--soft:hover { color: var(--primary-dark); }
.ui-btn--light { background: var(--caramel-light); color: #2A1F19; }
.ui-btn--light:hover { background: #EDC392; color: #2A1F19; }
.ui-btn--on-dark { border-color: #5A4A3E; color: var(--on-espresso); background: transparent; }
.ui-btn--on-dark:hover { border-color: var(--caramel-light); color: var(--on-espresso); }
.ui-btn--lg { height: 54px; border-radius: 14px; font-size: 15.5px; }
.ui-btn--sm { height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13.5px; }
.ui-btn--block { width: 100%; }
.ui-btn[disabled], .ui-btn.loading { opacity: 0.6; cursor: not-allowed; }
.ui-link { font-size: 13.5px; font-weight: 700; color: var(--primary); text-decoration: none; }
.ui-link:hover { text-decoration: underline; }

/* Cards */
.ui-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 18px; min-width: 0; }
.ui-card--pad { padding: 24px; }
.ui-card--clip { overflow: hidden; }
.ui-card-head { min-height: 60px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ui-card-head h2,
.ui-card h2,
.ui-summary h2 { margin: 0; font-family: var(--font-body); font-size: 17px; font-weight: 700; letter-spacing: 0; }
.ui-card-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.ui-card-foot {
    min-height: 60px; padding: 10px 24px; box-sizing: border-box;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    border-top: 1px solid var(--border-light); font-size: 13.5px; color: var(--text-secondary);
}

/* Grids */
.ui-grid-main { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; }
.ui-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
@media (max-width: 1100px) { .ui-grid-main { grid-template-columns: minmax(0, 1fr); } }

/* Balance card (espresso) */
.ui-balance {
    position: relative; overflow: hidden;
    min-height: 232px; box-sizing: border-box;
    padding: 26px 30px; border-radius: 20px;
    background: var(--espresso); color: var(--on-espresso);
    display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
}
[data-theme="dark"] .ui-balance { border: 1px solid #3A2E26; }
.ui-balance > * { position: relative; }
.ui-balance__rings { position: absolute !important; right: -90px; top: -80px; pointer-events: none; }
.ui-balance__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ui-balance__label { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #D9C3AC; }
.ui-balance__tag { height: 26px; padding: 0 12px; border-radius: 999px; background: #3D2E24; color: var(--caramel-light); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; }
.ui-balance__amount {
    font-family: var(--font-heading); font-size: 52px; font-weight: 500;
    letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.ui-balance__cur { font-size: 0.46em; color: #D9C3AC; margin-right: 8px; }
.ui-balance__meta { margin-top: 8px; font-size: 13.5px; color: #CDB9A5; }
.ui-balance__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.ui-balance__split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-top: 18px; border-top: 1px solid #45362B; }
.ui-balance__split span { display: block; font-size: 12.5px; color: #CDB9A5; }
.ui-balance__split strong { display: block; margin-top: 4px; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Stat tiles */
.ui-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.ui-stat {
    min-height: 104px; box-sizing: border-box; padding: 18px 20px;
    border-radius: 16px; background: var(--bg-card); border: 1px solid var(--border);
    display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
}
.ui-stat__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.ui-stat__icon { width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.ui-stat__icon--caramel { background: var(--accent-light); color: var(--primary-light); }
.ui-stat__icon--success { background: var(--success-bg); color: var(--success); }
.ui-stat__icon--info { background: var(--info-bg); color: var(--info); }
.ui-stat__icon--cocoa { background: var(--bg-sunken); color: var(--primary); }
.ui-stat__value { font-family: var(--font-heading); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ui-stat__note { margin-left: 8px; font-family: var(--font-body); font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--text-muted); }

/* Network marks */
.ui-net {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--font-body); font-size: 10.5px; font-weight: 800; letter-spacing: 0.02em; line-height: 1;
}
.ui-net--mtn { background: #FFCB05; color: #1F1A17; }
.ui-net--telecel { background: #D1111C; color: #FFFFFF; }
.ui-net--airteltigo { background: #1D4F91; color: #FFFFFF; }
.ui-net--other { background: var(--espresso); color: var(--caramel-light); }
.ui-net--lg { width: 44px; height: 44px; border-radius: 12px; font-size: 12px; }
.ui-net--xl { width: 56px; height: 56px; border-radius: 16px; font-size: 14px; }
.ui-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.ui-dot--mtn { background: #FFCB05; }
.ui-dot--telecel { background: #D1111C; }
.ui-dot--airteltigo { background: #1D4F91; }
.ui-dot--other { background: var(--caramel); }

/* Status pills */
.ui-pill {
    display: inline-flex; align-items: center; gap: 6px;
    height: 26px; padding: 0 10px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.ui-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ui-pill--delivered { background: var(--success-bg); color: var(--success); }
.ui-pill--processing { background: var(--info-bg); color: var(--info); }
.ui-pill--pending { background: var(--warning-bg); color: var(--warning); }
.ui-pill--failed { background: var(--danger-bg); color: var(--danger); }
.ui-pill--sm { height: 22px; padding: 0 8px; font-size: 11.5px; }

/* Tables */
.ui-table-wrap { width: 100%; overflow-x: auto; }
.ui-table { width: 100%; border-collapse: collapse; }
.ui-table th {
    height: 36px; padding: 0 16px; text-align: left; white-space: nowrap;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light);
    font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted);
}
.ui-table td { height: 62px; padding: 8px 16px; border-bottom: 1px solid var(--border-light); font-size: 14px; color: var(--text-primary); vertical-align: middle; }
.ui-table th:first-child, .ui-table td:first-child { padding-left: 24px; }
.ui-table th:last-child, .ui-table td:last-child { padding-right: 24px; }
.ui-table tbody tr:last-child td { border-bottom: 0; }
.ui-table tbody tr:hover td { background: var(--bg-surface); }
.ui-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-table .end { text-align: right; }
.ui-table .muted { color: var(--text-secondary); }
.ui-table .mono { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); }
.ui-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ui-cell__title { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }
.ui-cell__sub { margin-top: 3px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ui-only-sm, .ui-only-sm-i { display: none; }
.ui-cell__amount { margin-bottom: 5px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-table .ui-cell__title { white-space: nowrap; }
.ui-amount-in { color: var(--success); font-weight: 700; }
.ui-amount-out { color: var(--text-primary); font-weight: 700; }
@media (max-width: 768px) {
    .ui-hide-sm { display: none !important; }
    .ui-only-sm { display: block; }
    .ui-only-sm-i { display: inline; }
    .ui-end-sm { text-align: right; }
    .ui-table .ui-cell__title { white-space: normal; }
    .ui-table th:first-child, .ui-table td:first-child { padding-left: 16px; }
    .ui-table th:last-child, .ui-table td:last-child { padding-right: 16px; }
    .ui-table td { height: 64px; padding: 8px 10px; }
}

/* Activity list */
.ui-activity { display: flex; align-items: center; gap: 14px; min-height: 70px; padding: 10px 24px; box-sizing: border-box; border-bottom: 1px solid var(--border-light); }
.ui-activity:last-child { border-bottom: 0; }
.ui-activity__icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.ui-activity__icon--in { background: var(--success-bg); color: var(--success); }
.ui-activity__icon--out { background: var(--accent-light); color: var(--primary-light); }
.ui-activity__body { flex: 1; min-width: 0; }
.ui-activity__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-activity__sub { margin-top: 3px; font-size: 12px; color: var(--text-muted); }
.ui-activity__amount { font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 7-day bar chart (single series: no legend; today labelled; hover title per bar) */
.ui-chart { height: 132px; display: flex; align-items: flex-end; gap: 8px; padding: 0 6px; border-bottom: 1px solid var(--border); }
.ui-chart__col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.ui-chart__bar { width: 24px; max-width: 100%; border-radius: 4px 4px 0 0; background: var(--caramel); }
.ui-chart__val { font-size: 12px; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.ui-chart__days { display: flex; gap: 8px; padding: 6px 6px 0; }
.ui-chart__day { flex: 1; text-align: center; font-size: 12px; color: var(--text-muted); }
.ui-chart__day.is-today { font-weight: 700; color: var(--text-primary); }

/* Empty state */
.ui-empty { padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; color: var(--text-secondary); }
.ui-empty__icon { width: 52px; height: 52px; border-radius: 16px; background: var(--accent-light); color: var(--primary-light); display: flex; align-items: center; justify-content: center; }
.ui-empty h3 { margin: 4px 0 0; font-size: 16px; }
.ui-empty p { margin: 0; font-size: 14px; max-width: 360px; }

/* Segmented control */
.ui-seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-sunken); max-width: 100%; overflow-x: auto; }
.ui-seg__item {
    height: 40px; padding: 0 16px; box-sizing: border-box;
    border: 0; border-radius: 10px; background: transparent;
    display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
    font-family: var(--font-body); font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
    text-decoration: none; white-space: nowrap; cursor: pointer;
}
.ui-seg__item:hover { color: var(--text-primary); }
.ui-seg__item.is-active { background: var(--bg-card); color: var(--text-primary); font-weight: 700; box-shadow: 0 1px 2px rgba(31, 26, 23, 0.1); }
.ui-seg__count { font-size: 12px; font-weight: 700; color: var(--text-muted); }

/* Fields */
.ui-field { display: flex; flex-direction: column; gap: 7px; }
.ui-label { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.ui-help { font-size: 12.5px; color: var(--text-muted); }
.ui-input,
.ui-select {
    width: 100%; height: 50px; box-sizing: border-box;
    padding: 0 16px; border-radius: 12px;
    border: 1px solid var(--border-strong); background: var(--bg-input); color: var(--text-primary);
    font-family: var(--font-body); font-size: 16px; font-weight: 600;
}
.ui-select {
    height: 44px; width: auto; padding: 0 38px 0 14px; font-size: 14px;
    -webkit-appearance: none; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236F655E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}
.ui-input::placeholder { color: var(--text-muted); font-weight: 500; }
.ui-input:focus, .ui-select:focus { outline: none; border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(184, 112, 47, 0.18); }
.ui-input--date { height: 44px; width: auto; font-size: 14px; }
.ui-search {
    height: 44px; min-width: 240px; box-sizing: border-box;
    padding: 0 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-card);
    display: flex; align-items: center; gap: 10px; color: var(--text-muted);
}
.ui-search:focus-within { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(184, 112, 47, 0.18); }
.ui-search input { flex: 1; min-width: 0; height: 40px; border: 0; outline: none; background: transparent; font-family: var(--font-body); font-size: 14px; color: var(--text-primary); }
.ui-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.ui-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Selectable cards (network + bundle) */
.ui-choice {
    position: relative; box-sizing: border-box;
    border: 0; border-radius: 16px;
    background: var(--bg-card); box-shadow: inset 0 0 0 1px var(--border);
    color: var(--text-primary); font-family: var(--font-body);
    text-align: left; text-decoration: none; cursor: pointer;
    transition: box-shadow var(--transition), background var(--transition);
}
.ui-choice:hover { box-shadow: inset 0 0 0 1px var(--caramel); color: var(--text-primary); }
.ui-choice.is-selected { background: #FFFBF6; box-shadow: inset 0 0 0 2px var(--caramel), 0 8px 20px rgba(184, 112, 47, 0.12); }
[data-theme="dark"] .ui-choice.is-selected { background: #2A211B; }
.ui-choice__check {
    position: absolute; top: 14px; right: 14px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--caramel); color: #FFFFFF;
    display: none; align-items: center; justify-content: center;
}
.ui-choice.is-selected .ui-choice__check { display: flex; }
.ui-step { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; }
.ui-step__n { width: 24px; height: 24px; border-radius: 50%; background: var(--espresso); color: var(--on-espresso); font-size: 12px; display: flex; align-items: center; justify-content: center; }
[data-theme="dark"] .ui-step__n { background: var(--caramel); color: #15110E; }

.ui-networks { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.ui-network { min-height: 84px; padding: 0 44px 0 18px; display: flex; align-items: center; gap: 14px; }
.ui-network__name { display: block; font-size: 16px; font-weight: 700; }
.ui-network__sub { display: block; margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }
.ui-network .ui-choice__check { top: 50%; margin-top: -11px; }

.ui-bundles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.ui-bundle { width: 100%; min-height: 148px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ui-bundle__size { font-family: var(--font-heading); font-size: 32px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; padding-right: 26px; }
.ui-bundle__meta { display: block; margin-top: 5px; font-size: 12.5px; color: var(--text-muted); }
.ui-bundle__price { width: 100%; padding-top: 12px; border-top: 1px solid var(--border-light); font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 1280px) { .ui-bundles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Buy layout + order summary */
.ui-buy { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.ui-buy__main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.ui-summary {
    position: sticky; top: 24px;
    padding: 24px; border-radius: 20px;
    background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-md);
    display: flex; flex-direction: column; gap: 20px;
}
.ui-summary__item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; background: var(--bg-surface); }
.ui-summary__title { font-size: 16px; font-weight: 700; }
.ui-summary__sub { margin-top: 3px; font-size: 12.5px; color: var(--text-muted); }
.ui-summary__price { margin-left: auto; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-lines { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.ui-lines--rule { padding-top: 16px; border-top: 1px solid var(--border-light); }
.ui-lines > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.ui-lines > div > span:first-child { color: var(--text-secondary); }
.ui-lines > div > span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.ui-lines .is-total { padding-top: 10px; border-top: 1px solid var(--border); }
.ui-lines .is-total > span:first-child { color: var(--text-primary); font-weight: 700; }
.ui-lines .is-total > span:last-child { font-family: var(--font-heading); font-size: 22px; font-weight: 600; }
.ui-box { padding: 16px 18px; border-radius: 14px; background: var(--bg-surface); }
.ui-note { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.ui-note svg { flex-shrink: 0; margin-top: 1px; color: var(--success); }
.ui-strip { min-height: 60px; padding: 10px 20px; box-sizing: border-box; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border); display: flex; align-items: center; gap: 14px; }
.ui-strip__icon { width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; background: var(--bg-sunken); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.ui-strip__text { flex: 1; font-size: 14px; color: var(--text-secondary); }

/* Wallet */
.ui-wallet-top { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; }
.ui-topup { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; padding: 24px; }
.ui-topup__col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ui-topup__col--end { justify-content: flex-end; }
.ui-amount {
    height: 68px; box-sizing: border-box; padding: 0 18px;
    border-radius: 14px; border: 1px solid var(--border-strong); background: var(--bg-input);
    display: flex; align-items: center; gap: 10px;
}
.ui-amount:focus-within { border-color: var(--caramel); box-shadow: 0 0 0 3px rgba(184, 112, 47, 0.18); }
.ui-amount__cur { font-size: 18px; font-weight: 700; color: var(--text-muted); }
.ui-amount input {
    flex: 1; min-width: 0; height: 60px; border: 0; outline: none; background: transparent; padding: 0;
    font-family: var(--font-heading); font-size: 34px; font-weight: 500; color: var(--text-primary);
    font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.ui-amount input::-webkit-outer-spin-button,
.ui-amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ui-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(52px, 1fr)); gap: 8px; }
.ui-chip {
    height: 44px; border: 0; border-radius: 12px;
    background: var(--bg-card); box-shadow: inset 0 0 0 1px var(--border-strong);
    font-family: var(--font-body); font-size: 14px; font-weight: 700; color: var(--text-primary);
    cursor: pointer; font-variant-numeric: tabular-nums;
}
.ui-chip:hover { box-shadow: inset 0 0 0 1px var(--caramel); }
.ui-chip.active,
.ui-chip.is-active { background: #FFFBF6; box-shadow: inset 0 0 0 2px var(--caramel); color: var(--primary); }
[data-theme="dark"] .ui-chip.active,
[data-theme="dark"] .ui-chip.is-active { background: #2A211B; }

/* Detail page */
.ui-detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.ui-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.ui-kv dt { font-size: 12.5px; color: var(--text-muted); }
.ui-kv dd { margin: 4px 0 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.ui-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ui-steps li { display: flex; gap: 14px; min-height: 58px; }
.ui-steps li:last-child { min-height: 0; }
.ui-steps__rail { display: flex; flex-direction: column; align-items: center; }
.ui-steps__dot { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--bg-sunken); color: var(--text-muted); }
.ui-steps__dot.is-done { background: var(--success); color: #FFFFFF; }
.ui-steps__dot.is-now { background: var(--info); color: #FFFFFF; }
.ui-steps__dot.is-fail { background: var(--danger); color: #FFFFFF; }
.ui-steps__line { width: 2px; flex-grow: 1; background: var(--border); }
.ui-steps__line.is-done { background: var(--success-bg); }
.ui-steps__title { font-size: 14.5px; font-weight: 700; }
.ui-steps__sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* Mobile-only quick actions + store promo (dashboard) */
.ui-quick { display: none; }
.ui-quick a {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-decoration: none; text-align: center;
}
.ui-quick span {
    width: 56px; height: 56px; border-radius: 18px;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 1100px) {
    .ui-buy, .ui-wallet-top, .ui-detail { grid-template-columns: minmax(0, 1fr); }
    .ui-summary { position: static; }
}

@media (max-width: 768px) {
    .page-header h1 { font-size: 26px; }
    .ui-page-head h1 { font-size: 26px; }
    .ui-page-head p { font-size: 14px; }
    .ui-page-head .ui-actions { width: 100%; }
    .ui-page-head .ui-actions .ui-btn { flex: 1; }

    .ui-balance { min-height: 0; padding: 20px 22px; border-radius: 22px; }
    .ui-balance__amount { font-size: 40px; }
    .ui-balance__actions .ui-btn { flex: 1; }

    .ui-stats { gap: 12px; }
    .ui-stat { min-height: 92px; padding: 14px 16px; }
    .ui-stat__value { font-size: 24px; }
    .ui-stat__note { display: block; margin: 2px 0 0; }

    .ui-quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }

    .ui-card-head { padding: 0 16px; min-height: 56px; }
    .ui-activity { padding: 10px 16px; }
    .ui-card-foot { padding: 10px 16px; }

    .ui-toolbar, .ui-filters { width: 100%; }
    .ui-search { width: 100%; min-width: 0; }
    .ui-filters > * { flex: 1 1 140px; }
    .ui-select, .ui-input--date { width: 100%; }

    /* Networks become a compact 3-across picker */
    .ui-networks { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
    .ui-network { min-height: 52px; padding: 0 10px; gap: 8px; justify-content: center; }
    .ui-network .ui-net--lg { width: 26px; height: 26px; font-size: 8.5px; border-radius: 8px; }
    .ui-network__name { font-size: 13.5px; white-space: nowrap; }
    .ui-network__sub, .ui-network .ui-choice__check { display: none !important; }
    .ui-bundles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .ui-bundle { min-height: 112px; padding: 14px 16px; }
    .ui-bundle__size { font-size: 26px; }

    /* Summary: in the page flow until a bundle is picked, then a bottom sheet above the tab bar */
    .ui-summary { position: static; }
    .ui-summary.is-active {
        position: sticky; top: auto; bottom: calc(66px + env(safe-area-inset-bottom));
        margin: 0 -16px; padding: 18px 16px 18px;
        border-radius: 24px 24px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
        box-shadow: 0 -10px 30px rgba(42, 31, 25, 0.10); gap: 14px; z-index: 5;
    }

    .ui-topup { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 18px; }
    .ui-kv { grid-template-columns: minmax(0, 1fr); }
}

/* ─── Sign-in / sign-up pages ────────────── */
.auth-wrapper::before,
.auth-wrapper::after { display: none; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow-md); backdrop-filter: none; }
.auth-brand .auth-logo {
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--espresso); color: var(--caramel-light);
    font-family: var(--font-heading); font-size: 26px; font-weight: 600; text-decoration: none;
}
[data-theme="dark"] .auth-brand .auth-logo { background: #3A2C22; }
.auth-brand h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.auth-brand .auth-subtitle { font-size: 14px; }

/* In dark mode the brand fill is light caramel: anything that sat white text on it gets dark text instead */
[data-theme="dark"] .bulk-save-btn,
[data-theme="dark"] .btn-key-gen,
[data-theme="dark"] .btn-done,
[data-theme="dark"] .network-tab.active,
[data-theme="dark"] .admin-table td .user-avatar,
[data-theme="dark"] .modal-btn-ok.btn-primary { color: var(--on-primary) !important; }

/* Leftover accents from the older purple theme */
.trace-avatar { background: var(--accent-light); color: var(--primary); }
.skeleton { background: linear-gradient(90deg, var(--bg-surface) 0%, var(--bg-sunken) 50%, var(--bg-surface) 100%); background-size: 200% 100%; }

/* ─── Dealer store pages ─────────────────── */
.sf-tabs { position: relative; align-self: flex-start; scrollbar-width: none; }
.sf-tabs::-webkit-scrollbar { display: none; }
.sf-savebar {
    position: sticky; bottom: 16px; z-index: 5;
    display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
    padding: 14px 18px; border: 1px solid var(--border); border-radius: 18px;
    background: var(--bg-card); box-shadow: var(--shadow-lg);
}
.sf-savebar p { margin: 0; font-size: 13.5px; color: var(--text-secondary); }
.sf-savebar p.dirty { color: var(--warning); font-weight: 700; }
@media (max-width: 768px) {
    .sf-tabs { align-self: stretch; }
    /* sit above the phone tab bar instead of behind it */
    .sf-savebar { bottom: calc(66px + env(safe-area-inset-bottom) + 10px); padding: 10px; gap: 8px; }
    .sf-savebar p { display: none; }
    .sf-savebar p.dirty { display: block; width: 100%; text-align: center; }
    .sf-savebar .ui-btn, .sf-savebar .btn { width: 100%; }
}
