/* ===== css/tokens.css ===== */
/* ============================================================
   Fox Mini App — Design Tokens
   5 themes, each a full token set driven by CSS custom properties.
   Swapped at runtime by theme.js (applyTheme) — same mechanism as
   the previous app, just a richer variable set.
   ============================================================ */

:root {
    /* ---- type scale ---- */
    --fs-h1: 28px;
    --fs-h2: 20px;
    --fs-h3: 16px;
    --fs-body: 14px;
    --fs-caption: 12px;
    --fs-btn: 14px;
    --fw-h1: 900;
    --fw-h2: 700;
    --fw-h3: 700;
    --fw-body: 400;
    --fw-btn: 700;

    /* ---- spacing (4px grid) ---- */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 24px;
    --sp-6: 32px;

    /* ---- radius ---- */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    /* ---- fonts ---- */
    --font-ar: 'Cairo', sans-serif;
    --font-latin: 'Inter', sans-serif;
    --font-family: var(--font-ar);
}

/* ================= THEME: dark (default — Fox orange) ================= */
:root,
:root[data-theme="dark"] {
    --primary: #ff6b00;
    --primary-glow: rgba(255, 107, 0, 0.4);
    --fox-gold: #ffcc00;
    --accent-2: #7b2cbf;

    --bg-dark: #080808;
    --body-bg-image: radial-gradient(circle at 0% 0%, rgba(255, 107, 0, 0.18) 0%, transparent 45%), radial-gradient(circle at 100% 100%, rgba(123, 44, 191, 0.12) 0%, transparent 45%);

    --surface-1: rgba(255, 255, 255, 0.06);
    --surface-2: rgba(255, 255, 255, 0.10);
    --glass-bg: var(--surface-1);
    --glass-border: rgba(255, 255, 255, 0.12);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);

    --text-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);

    --success: #2ed573;
    --warning: #ffb020;
    --danger: #ef4444;

    --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-3: 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* ================= THEME: light (day mode) ================= */
:root[data-theme="light"] {
    --primary: #ff6b00;
    --primary-glow: rgba(255, 107, 0, 0.25);
    --fox-gold: #c98a00;
    --accent-2: #7b2cbf;

    --bg-dark: #f4f6fb;
    --body-bg-image: radial-gradient(circle at 0% 0%, rgba(255, 107, 0, 0.08) 0%, transparent 45%), radial-gradient(circle at 100% 100%, rgba(123, 44, 191, 0.06) 0%, transparent 45%);

    --surface-1: rgba(15, 23, 42, 0.04);
    --surface-2: rgba(15, 23, 42, 0.07);
    --glass-bg: var(--surface-1);
    --glass-border: rgba(15, 23, 42, 0.10);
    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.18);

    --text-color: #0f172a;
    --text-secondary: rgba(15, 23, 42, 0.62);
    --text-muted: rgba(15, 23, 42, 0.42);

    --success: #0e9f6e;
    --warning: #b45309;
    --danger: #dc2626;

    --shadow-1: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-2: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-3: 0 16px 40px rgba(15, 23, 42, 0.12);
}

/* ================= THEME: blue (electric cyber) ================= */
:root[data-theme="blue"] {
    --primary: #0084ff;
    --primary-glow: rgba(0, 132, 255, 0.4);
    --fox-gold: #00d2ff;
    --accent-2: #7c3aed;

    --bg-dark: #050b14;
    --body-bg-image: radial-gradient(circle at 0% 0%, rgba(0, 132, 255, 0.2) 0%, transparent 45%), radial-gradient(circle at 100% 100%, rgba(124, 58, 237, 0.14) 0%, transparent 45%);

    --surface-1: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.09);
    --glass-bg: var(--surface-1);
    --glass-border: rgba(0, 194, 255, 0.18);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(0, 194, 255, 0.3);

    --text-color: #eaf6ff;
    --text-secondary: rgba(234, 246, 255, 0.6);
    --text-muted: rgba(234, 246, 255, 0.4);

    --success: #2ed573;
    --warning: #ffb020;
    --danger: #ff5577;

    --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 8px 24px rgba(0, 132, 255, 0.18);
    --shadow-3: 0 16px 40px rgba(0, 132, 255, 0.22);
}

/* ================= THEME: green (emerald) ================= */
:root[data-theme="green"] {
    --primary: #2ed573;
    --primary-glow: rgba(46, 213, 115, 0.4);
    --fox-gold: #b6ff3c;
    --accent-2: #0ea5a3;

    --bg-dark: #060f0a;
    --body-bg-image: radial-gradient(circle at 0% 0%, rgba(46, 213, 115, 0.18) 0%, transparent 45%), radial-gradient(circle at 100% 100%, rgba(14, 165, 163, 0.12) 0%, transparent 45%);

    --surface-1: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.09);
    --glass-bg: var(--surface-1);
    --glass-border: rgba(182, 255, 60, 0.14);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(46, 213, 115, 0.28);

    --text-color: #eafff2;
    --text-secondary: rgba(234, 255, 242, 0.6);
    --text-muted: rgba(234, 255, 242, 0.4);

    --success: #2ed573;
    --warning: #ffb020;
    --danger: #ff5577;

    --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 8px 24px rgba(46, 213, 115, 0.16);
    --shadow-3: 0 16px 40px rgba(46, 213, 115, 0.2);
}

/* ================= THEME: purple (royal) ================= */
:root[data-theme="purple"] {
    --primary: #a020f0;
    --primary-glow: rgba(160, 32, 240, 0.4);
    --fox-gold: #ff7edb;
    --accent-2: #f59e0b;

    --bg-dark: #0b0512;
    --body-bg-image: radial-gradient(circle at 0% 0%, rgba(160, 32, 240, 0.2) 0%, transparent 45%), radial-gradient(circle at 100% 100%, rgba(245, 158, 11, 0.1) 0%, transparent 45%);

    --surface-1: rgba(255, 255, 255, 0.05);
    --surface-2: rgba(255, 255, 255, 0.09);
    --glass-bg: var(--surface-1);
    --glass-border: rgba(255, 126, 219, 0.16);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(160, 32, 240, 0.3);

    --text-color: #f6ecff;
    --text-secondary: rgba(246, 236, 255, 0.6);
    --text-muted: rgba(246, 236, 255, 0.4);

    --success: #2ed573;
    --warning: #ffb020;
    --danger: #ff5577;

    --shadow-1: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 8px 24px rgba(160, 32, 240, 0.18);
    --shadow-3: 0 16px 40px rgba(160, 32, 240, 0.22);
}

/* ===== css/components.css ===== */
/* ============================================================
   Fox Mini App — Reusable Components
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg-dark); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[dir="ltr"] body { font-family: var(--font-latin); }
html[dir="rtl"] body { font-family: var(--font-ar); }

body {
    font-family: var(--font-family);
    background: var(--bg-dark);
    background-image: var(--body-bg-image);
    min-height: 100vh;
    padding: var(--sp-4);
    color: var(--text-color);
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
    font-size: var(--fs-body);
    line-height: 1.5;
}

.container { max-width: 500px; margin: 0 auto; position: relative; }

/* ---------------- Typography ---------------- */
h1, .h1 { font-size: var(--fs-h1); font-weight: var(--fw-h1); }
h2, .h2 { font-size: var(--fs-h2); font-weight: var(--fw-h2); }
h3, .h3 { font-size: var(--fs-h3); font-weight: var(--fw-h3); }
.caption { font-size: var(--fs-caption); color: var(--text-secondary); }
.muted { color: var(--text-muted); }

/* ---------------- Section wrapper ---------------- */
.section {
    padding: var(--sp-4) 0;
    animation: fadeInDown 0.35s ease;
}
.section-title {
    font-size: var(--fs-h2);
    font-weight: var(--fw-h2);
    margin-bottom: var(--sp-3);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

/* ---------------- Top app bar ---------------- */
.app-bar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
    min-height: 40px;
}
.app-bar .app-bar-title {
    flex: 1;
    font-size: var(--fs-h3);
    font-weight: 800;
}

/* ---------------- Back button ---------------- */
.back-btn {
    width: 38px; height: 38px;
    border-radius: var(--radius-pill);
    background: var(--surface-1);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
    transition: 0.2s;
}
.back-btn:active { transform: scale(0.92); background: var(--surface-2); }
[dir="rtl"] .back-btn.icon-chevron::before { content: "→"; }
[dir="ltr"] .back-btn.icon-chevron::before { content: "←"; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    width: 100%;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    border: none;
    font-family: inherit;
    font-size: var(--fs-btn);
    font-weight: var(--fw-btn);
    cursor: pointer;
    transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--fox-gold));
    color: #fff;
    box-shadow: var(--shadow-2);
}
.btn-secondary {
    background: var(--surface-1);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
}
.btn-ghost {
    background: transparent;
    color: var(--primary);
}
.btn-danger {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid var(--danger);
    color: var(--danger);
}
.btn-sm { padding: 8px 14px; font-size: var(--fs-caption); width: auto; }

/* ---------------- Cards ---------------- */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    box-shadow: var(--shadow-1);
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-3);
    margin-top: var(--sp-3);
}
.category-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4) var(--sp-3);
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
}
.category-card:active { transform: scale(0.96); border-color: var(--primary); background: var(--surface-2); }
.category-card .cc-icon { font-size: 30px; }
.category-card .cc-label { font-weight: 800; font-size: var(--fs-caption); line-height: 1.3; }
.category-card .cc-sub { font-size: 10px; color: var(--text-muted); }

/* ---------------- Catalog item (service/game/network/product unified) ---------------- */
.catalog-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--sp-3) var(--sp-4);
    display: flex; align-items: center; gap: var(--sp-3);
    cursor: pointer;
    transition: 0.2s;
    margin-bottom: var(--sp-2);
}
.catalog-item:active { transform: scale(0.98); border-color: var(--primary); background: rgba(255,107,0,0.06); }
.catalog-item .ci-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0; overflow: hidden;
}
.catalog-item .ci-icon img { width: 100%; height: 100%; object-fit: cover; }
.catalog-item .ci-body { flex: 1; min-width: 0; }
.catalog-item .ci-name { font-weight: 800; font-size: var(--fs-body); line-height: 1.3; }
.catalog-item .ci-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.catalog-item .ci-price { color: var(--fox-gold); font-weight: 900; font-size: var(--fs-body); white-space: nowrap; }
.catalog-item .ci-stock { font-size: 10px; color: var(--success); }

/* country/server pick list (alias of catalog-item, kept name for compat) */
.country-btn {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: 14px 16px; display: flex; justify-content: space-between; align-items: center;
    gap: var(--sp-3); cursor: pointer; transition: 0.2s; margin-bottom: var(--sp-2);
}
.country-btn:active { transform: scale(0.98); border-color: var(--primary); background: rgba(255,107,0,0.08); }
.country-btn .cname { font-weight: 800; font-size: 13px; flex: 1; line-height: 1.4; }
.country-btn .cprice { color: var(--fox-gold); font-weight: 900; font-size: 14px; white-space: nowrap; }

/* ---------------- Search box ---------------- */
.search-box {
    position: relative;
    margin-bottom: var(--sp-3);
}
.search-box input {
    width: 100%;
    padding: 12px 40px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--glass-border);
    background: var(--surface-1);
    color: var(--text-color);
    font-family: inherit;
    font-size: var(--fs-body);
}
.search-box .search-icon {
    position: absolute; top: 50%; transform: translateY(-50%);
    inset-inline-start: 14px;
    opacity: 0.5; font-size: 14px;
}

/* ---------------- Forms ---------------- */
.order-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-group label { font-size: var(--fs-caption); color: var(--text-secondary); font-weight: 700; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: var(--surface-1);
    color: var(--text-color);
    font-family: inherit;
    font-size: var(--fs-body);
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.form-group.error input, .form-group.error select { border-color: var(--danger); }
.form-group .hint { font-size: 11px; color: var(--text-muted); }
.form-group .error-text { font-size: 11px; color: var(--danger); }

/* ---------------- Price preview ---------------- */
.price-preview {
    background: var(--surface-1);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--sp-3) var(--sp-4);
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; bottom: 0;
}
.price-preview .pp-label { font-size: var(--fs-caption); color: var(--text-secondary); }
.price-preview .pp-value { font-size: 18px; font-weight: 900; color: var(--fox-gold); }
.price-preview.insufficient .pp-value { color: var(--danger); }

/* ---------------- Confirm card ---------------- */
.confirm-card {
    background: var(--glass-bg); border: 1px solid var(--primary-glow); border-radius: var(--radius-lg);
    padding: var(--sp-5); margin-top: var(--sp-2);
}
.confirm-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-body); }
.confirm-row:last-child { border-bottom: none; }
.confirm-row .label { color: var(--text-secondary); }
.confirm-row .value { font-weight: 800; }

.order-phone { font-size: 28px; font-weight: 900; letter-spacing: 1px; color: var(--fox-gold); text-align: center; margin: var(--sp-4) 0; }
.code-box { background: rgba(46,213,115,0.1); border: 1px solid var(--success); border-radius: var(--radius-lg); padding: var(--sp-4); text-align: center; margin: var(--sp-4) 0; }
.code-box .code-val { font-size: 30px; font-weight: 900; color: var(--success); letter-spacing: 3px; word-break: break-all; }

/* ---------------- Track result ---------------- */
.track-result {
    margin-top: var(--sp-4);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
}
.track-result.status-success { border-color: var(--success); }
.track-result.status-pending { border-color: var(--warning); }
.track-result.status-error { border-color: var(--danger); }

/* ---------------- List rows (logs / history) ---------------- */
.log-card, .history-item {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-md);
    padding: var(--sp-3); display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2);
    animation: slideInLeft 0.25s ease;
}
.log-card .log-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.log-card .log-info { flex: 1; min-width: 0; }
.log-card .log-title { font-weight: 800; font-size: var(--fs-caption); }
.log-card .log-sub { font-size: 10px; color: var(--text-muted); }
.log-card .log-meta { text-align: end; }
.log-card .log-price { font-weight: 800; font-size: var(--fs-caption); color: var(--fox-gold); }
.log-card .log-time { font-size: 10px; color: var(--text-muted); }

/* ---------------- Badges / status pills ---------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 800; }
.badge-success { background: rgba(46,213,115,0.15); color: var(--success); }
.badge-warning { background: rgba(255,176,32,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: var(--surface-2); color: var(--text-secondary); }
.vip-badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 10px; border-radius: var(--radius-pill); background: linear-gradient(45deg, var(--primary), var(--fox-gold)); color: #fff; }

/* ---------------- Tab bar (used inside G2B store) ---------------- */
.tab-bar { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); background: var(--surface-1); border-radius: var(--radius-pill); padding: 4px; }
.tab-btn {
    flex: 1; text-align: center; padding: 10px 6px; border-radius: var(--radius-pill);
    font-size: var(--fs-caption); font-weight: 800; cursor: pointer; color: var(--text-secondary);
    transition: 0.2s; border: none; background: transparent;
}
.tab-btn.active { background: linear-gradient(45deg, var(--primary), var(--fox-gold)); color: #fff; }

/* ---------------- Modal / bottom sheet ---------------- */
.app-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: flex-end; justify-content: center;
    z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.app-modal.open { opacity: 1; pointer-events: auto; }
.app-modal .modal-content {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: var(--sp-5);
    width: 100%; max-width: 500px;
    max-height: 85vh; overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-3);
}
.app-modal.open .modal-content { transform: translateY(0); }
.app-modal.modal-center { align-items: center; padding: 0 var(--sp-4); }
.app-modal.modal-center .modal-content {
    border-radius: var(--radius-lg);
    transform: scale(0.9);
    max-width: 320px;
}
.app-modal.modal-center.open .modal-content { transform: scale(1); }
.modal-close { position: absolute; top: var(--sp-3); inset-inline-end: var(--sp-3); width: 32px; height: 32px; border-radius: var(--radius-pill); background: var(--surface-1); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.modal-icon { font-size: 40px; text-align: center; margin-bottom: var(--sp-3); }
.modal-text { text-align: center; font-size: var(--fs-body); line-height: 1.6; }

/* ---------------- Empty state ---------------- */
.empty-state { text-align: center; padding: var(--sp-6) var(--sp-4); color: var(--text-muted); }
.empty-state .es-icon { font-size: 40px; margin-bottom: var(--sp-3); opacity: 0.6; }
.empty-state .es-text { font-size: var(--fs-caption); }

/* ---------------- Spinner / Skeleton ---------------- */
.spinner {
    width: 30px; height: 30px; margin: 0 auto;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.loading { text-align: center; padding: var(--sp-6) 0; color: var(--text-muted); font-size: var(--fs-caption); }
.loading .loading-text { margin-top: var(--sp-3); }

.skeleton { background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 37%, var(--surface-1) 63%); background-size: 400% 100%; animation: skeleton-shimmer 1.4s ease infinite; border-radius: var(--radius-md); }
.skeleton-row { height: 58px; margin-bottom: var(--sp-2); }

/* ---------------- Toast ---------------- */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: #1a1a1a; color: #fff; padding: 12px 22px; border-radius: var(--radius-pill);
    font-size: var(--fs-caption); font-weight: 700; z-index: 3000;
    box-shadow: var(--shadow-3); opacity: 0; transition: 0.25s;
    max-width: 85vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--success); color: #072; }

/* ---------------- Profile / balance ---------------- */
.profile-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: var(--sp-4); display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3);
    position: relative;
}
.profile-avatar { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(45deg, var(--primary), var(--fox-gold)); display: flex; align-items: center; justify-content: center; font-size: 22px; line-height: 1; overflow: hidden; flex-shrink: 0; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; min-width: 0; }
.welcome-text { font-weight: 800; font-size: var(--fs-body); }

.balance-card {
    background: linear-gradient(135deg, var(--surface-2), var(--surface-1));
    border: 1px solid var(--primary-glow);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    text-align: center;
    margin-bottom: var(--sp-4);
    animation: pulse-border 3s ease infinite;
}
.balance-card .balance-label { font-size: var(--fs-caption); color: var(--text-secondary); }
.balance-card .balance-value { font-size: 26px; font-weight: 900; color: var(--fox-gold); margin-top: 4px; }

/* ---------------- Header ---------------- */
.header { text-align: center; margin-bottom: var(--sp-5); animation: fadeInDown 0.8s ease; }
.header h1 {
    font-size: var(--fs-h1); font-weight: 900;
    background: linear-gradient(45deg, var(--primary), var(--fox-gold));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.header p { font-size: 11px; color: var(--text-color); font-weight: 700; text-transform: uppercase; letter-spacing: 2px; opacity: 0.7; margin-top: -5px; }

/* ---------------- Currency / theme picker list ---------------- */
.currency-item, .lang-item, .theme-item {
    display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
    padding: 14px 16px; border-radius: var(--radius-md); background: var(--glass-bg);
    border: 1px solid var(--glass-border); margin-bottom: var(--sp-2); cursor: pointer; transition: 0.2s;
}
.currency-item.active, .lang-item.active, .theme-item.active { border-color: var(--primary); background: rgba(255,107,0,0.08); }
.currency-item .check, .lang-item .check, .theme-item .check { color: var(--primary); font-weight: 900; }

/* ---------------- Keyframes ---------------- */
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
[dir="rtl"] .log-card, [dir="rtl"] .history-item { animation-name: slideInRight; }
@keyframes slideInRight { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeleton-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes pulse-border { 0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); } 50% { box-shadow: 0 0 0 6px transparent; } }

/* ===== css/screens.css ===== */
/* ============================================================
   Fox Mini App — screen-specific styles (mascot, access-denied, misc)
   ============================================================ */

.fox-logo-container {
    width: 110px; height: 110px; margin: 0 auto var(--sp-3);
    position: relative;
    filter: drop-shadow(0 8px 25px var(--primary-glow));
    touch-action: none;
    user-select: none;
    overflow: visible;
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
}
.fox-interactive-wrapper { width: 100%; height: 100%; touch-action: none; user-select: none; will-change: transform; }
.fox-svg { width: 100%; height: 100%; transition: filter 0.3s; overflow: visible !important; cursor: grab; }
.fox-eye { animation: fox-blink 4s infinite; transform-origin: center; }

.fox-particle {
    position: absolute; font-size: 24px; pointer-events: none; z-index: 999;
    animation: particle-float 1s ease-out forwards;
}
@keyframes particle-float {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    30% { opacity: 1; }
    100% { transform: translate(-50%, -100px) scale(1.3) rotate(15deg); opacity: 0; }
}

#fox-head-group { transition: transform 0.1s ease-out; transform-origin: 100px 140px; }
.fox-pupil { transition: transform 0.1s ease-out; }
.fox-eyebrow { transition: transform 0.3s ease; transform-origin: center; }
#fox-mouth { transition: d 0.3s ease, fill 0.3s ease; }

.fox-svg.angry { filter: drop-shadow(0 8px 25px rgba(239, 68, 68, 0.85)) !important; animation: fox-shake 0.1s infinite !important; }
@keyframes fox-shake {
    0%, 100% { transform: translate(0, 0) rotate(0); }
    25% { transform: translate(-2px, 1px) rotate(-1deg); }
    75% { transform: translate(2px, -1px) rotate(1deg); }
}
.fox-svg.angry .fox-eyebrow.left { transform: translate(3px, 4px) rotate(15deg); }
.fox-svg.angry .fox-eyebrow.right { transform: translate(-3px, 4px) rotate(-15deg); }
.fox-svg.happy { filter: drop-shadow(0 8px 25px rgba(46, 213, 115, 0.75)) !important; }

@keyframes fox-blink {
    0%, 42%, 46%, 100% { transform: scaleY(1); }
    44% { transform: scaleY(0.1); }
}

/* access-denied fallback screen (set via innerHTML in app.js, kept here for completeness) */
.access-denied { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100vh; text-align: center; padding: 20px; }

/* ============================================================
   Bottom tab bar + Dashboard widgets
   ============================================================ */

body { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }

/* ---- Instagram-style: icon-only, barely-there glass (mostly transparent, not a solid
   floating card), real icon glyphs (Tabler webfont, loaded in MINI_APP_HTML) instead of
   emoji. Active state is just a color change + lift + small dot, no filled badge behind
   it — reads as minimal/native rather than a decorated button. ---- */
.tabbar {
    position: fixed; inset-inline: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 500;
    display: flex; align-items: center;
    background: color-mix(in srgb, var(--bg-dark) 30%, transparent);
    backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
    border: 1px solid color-mix(in srgb, var(--glass-border) 60%, transparent);
    border-radius: var(--radius-pill);
    padding: 6px;
}
.tabbar-item {
    flex: 1; min-width: 0; position: relative; display: flex; align-items: center; justify-content: center;
    padding: 9px 0; border-radius: var(--radius-pill); cursor: pointer;
    color: var(--text-muted); background: none; border: none; font-family: inherit;
    transition: color 0.2s, transform 0.15s;
}
.tabbar-item .ti-icon {
    font-size: 21px; line-height: 1;
    transition: transform 0.2s;
}
.tabbar-item .ti-label { display: none; }
.tabbar-item.active { color: var(--primary); }
.tabbar-item.active .ti-icon { transform: translateY(-2px) scale(1.1); }
.tabbar-item.active::after {
    content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%; background: var(--primary);
}
.tabbar-item:active { transform: scale(0.9); }

/* ---- home hero (fox + profile + balance) is kept exactly as-is but only
   shown on the Home tab; other tabs get their own clean section layout ---- */
body:not([data-tab="home"]) #home-hero { display: none; }

/* ---- decorative background glow (premium fintech feel, pure CSS) ---- */
.dash-wrap { position: relative; overflow: hidden; }
.dash-glow-orb {
    position: absolute; border-radius: 50%; filter: blur(50px); pointer-events: none; z-index: 0;
    opacity: 0.35;
}
.dash-glow-orb.o1 { width: 220px; height: 220px; top: -90px; inset-inline-end: -60px; background: radial-gradient(circle, var(--primary), transparent 70%); }
.dash-glow-orb.o2 { width: 180px; height: 180px; top: 140px; inset-inline-start: -70px; background: radial-gradient(circle, var(--fox-gold), transparent 70%); opacity: 0.22; }
.dash-wrap > *:not(.dash-glow-orb) { position: relative; z-index: 1; }

/* ---- hero "total spent" card ---- */
.hero-spend-card {
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 16%, var(--glass-bg)), var(--glass-bg));
    border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: var(--sp-4); margin-bottom: var(--sp-3);
    box-shadow: 0 8px 28px -12px color-mix(in srgb, var(--primary) 55%, transparent);
    overflow: hidden; position: relative;
}
.hero-spend-card .hs-label { font-size: 11px; color: var(--text-secondary); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.hero-spend-card .hs-value {
    font-size: 34px; font-weight: 900; margin-top: 6px; line-height: 1.1;
    background: linear-gradient(90deg, var(--fox-gold), var(--primary));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-spend-card .hs-sub { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ---- premium stat row: orders count + VIP ring ---- */
.premium-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.ps-card {
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: var(--sp-3); display: flex; align-items: center; gap: var(--sp-2);
}
.ps-icon-circle {
    width: 40px; height: 40px; min-width: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 18px; background: linear-gradient(135deg, var(--primary), var(--fox-gold)); box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--primary) 60%, transparent);
}
.ps-card .ps-value { font-size: 16px; font-weight: 900; color: var(--text-color); line-height: 1.2; }
.ps-card .ps-label { font-size: 9px; color: var(--text-muted); margin-top: 1px; }
.vip-ring-wrap { position: relative; width: 44px; height: 44px; min-width: 44px; }
.vip-ring-wrap svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.vip-ring-fill { transition: stroke-dashoffset 1s cubic-bezier(0.22, 0.9, 0.3, 1); }
.vip-ring-wrap .vr-emoji { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.vip-note { display: flex; align-items: center; gap: 6px; justify-content: center; text-align: center; font-size: 11px; color: var(--text-secondary); margin-bottom: var(--sp-4); padding: 0 var(--sp-2); }

/* ---- quick-access row on Home (currently: orders only) ---- */
.dash-quick-btn {
    width: 100%; display: flex; align-items: center; gap: var(--sp-3);
    background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
    padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); cursor: pointer;
    color: var(--text-color); font-family: inherit; transition: background 0.2s, transform 0.15s;
}
.dash-quick-btn:active { transform: scale(0.98); }
.dash-quick-btn .dqb-icon {
    width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; font-size: 17px;
    background: linear-gradient(135deg, var(--primary), var(--fox-gold)); color: #1a0c00;
}
.dash-quick-btn .dqb-label { flex: 1; text-align: start; font-size: 13.5px; font-weight: 800; }
.dash-quick-btn .dqb-arrow { color: var(--text-muted); font-size: 16px; }

/* ---- weekly activity: SVG area/line trend chart, single hue, gradient fill ---- */
.trend-card { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: var(--sp-4); margin-bottom: var(--sp-4); }
.trend-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: var(--sp-2); }
.trend-head .trend-title { font-size: 11px; color: var(--text-secondary); font-weight: 700; }
.trend-head .trend-total { font-size: 19px; font-weight: 900; color: var(--text-color); margin-top: 2px; }
.trend-chip { font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: var(--radius-pill); display: flex; align-items: center; gap: 3px; white-space: nowrap; }
.trend-chip.up { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.trend-chip.down { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.trend-chart-wrap { position: relative; }
.trend-chart-wrap svg { width: 100%; height: 108px; display: block; overflow: visible; }
.trend-dot-pulse { animation: trendPulse 1.8s ease-out infinite; }
@keyframes trendPulse {
    0% { r: 4; opacity: 0.9; }
    70% { r: 11; opacity: 0; }
    100% { r: 11; opacity: 0; }
}
.trend-days-row { display: flex; justify-content: space-between; margin-top: 6px; }
.trend-days-row span { flex: 1; text-align: center; font-size: 9px; color: var(--text-muted); }
.trend-days-row span.today { color: var(--primary); font-weight: 800; }

/* ---- recent activity preview ---- */
.recent-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--sp-2); }
.recent-head .rh-link { font-size: 11px; color: var(--primary); font-weight: 800; cursor: pointer; }
