/* =============================================================================
   CEVA Logistics - Frontend CSS (Mobile-first, Auth + App)
   -----------------------------------------------------------------------------
   Sections:
     1.  CSS Variables / Theme Tokens
     2.  Reset & Base
     3.  Mobile Frame (auto-fit on desktop)
     4.  Auth Page  (login / register)  — uses background image
     5.  Auth Components: header, card, form, alerts
     6.  App Page (home, history, profile, help, chat)
     7.  Components: buttons, inputs, badges, chips, modals, alerts
     8.  Bottom Navigation + Floating Chat
     9.  Order Card, Stats, Quick Actions
    10.  Utilities (muted, small, text-success, etc.)
   =========================================================================== */


/* ---------- 1. Theme Tokens ---------- */
:root {
    --primary:        #ff6b00;
    --primary-dark:   #e55a00;
    --primary-light:  #ffa040;

    --secondary:      #1e88ff;

    --bg:             #f5f6fa;
    --bg-dark:        #1a1c2e;
    --bg-darker:      #2b2d42;
    --card-bg:        #ffffff;

    --text:           #1c1e21;
    --text-muted:     #8a8d93;
    --text-on-dark:   rgba(255,255,255,0.9);

    --border:         #e6e8ee;
    --border-strong:  #d1d5db;

    --success:        #2eb867;
    --danger:         #ef4444;
    --warning:        #f59e0b;
    --info:           #3b82f6;

    --shadow-sm:      0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md:      0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg:      0 8px 24px rgba(0, 0, 0, 0.12);

    --radius-sm:      8px;
    --radius:         12px;
    --radius-lg:      18px;
    --radius-xl:      24px;

    --bn-h:           64px;
    --header-h:       60px;
    --frame-w:        480px;

    /* Auth background image — relative to public/ */
}


/* ---------- 2. Reset & Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
                 "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-tap-highlight-color: transparent;
    overflow: hidden;
}

a       { color: inherit; text-decoration: none; }
button  { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
img     { max-width: 100%; display: block; }
input, textarea, select { font: inherit; color: inherit; }
code    { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; }


/* ---------- 3. Mobile Frame ---------- */
.mobile-frame {
    position: relative;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0 auto;
    background: var(--bg);
    overflow: hidden;
}

/* Desktop / tablet: centered frame, square edges, capped at 680px */
@media (min-width: 768px) {
    body {
        background: #fafafa;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: auto;
        /* Make sure flex centering actually works even when child sets own size */
        width: 100%;
        min-height: 100vh;
    }

    .mobile-frame {
        width: 680px;
        max-width: 680px;
        height: 100vh;
        height: 100dvh;
        /* Square edges — no phone-look rounding on PC */
        border-radius: 0;
        /* Lighter, simpler shadow since frame is no longer a "device" */
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
        overflow: hidden;
    }

    /* Hide scrollbars on PC — clean look, but scroll still works */
    body::-webkit-scrollbar,
    .mobile-frame::-webkit-scrollbar,
    .page::-webkit-scrollbar { width: 0; height: 0; display: none; }

    body,
    .mobile-frame,
    .page {
        scrollbar-width: none;          /* Firefox */
        -ms-overflow-style: none;       /* IE/old Edge */
    }
}

/* Page (scrollable container inside frame) */
.page {
    position: absolute;
    inset: 0;
    bottom: calc(var(--bn-h) + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 16px;
    scrollbar-width: thin;
}
.auth-body .page { bottom: 0; }
.page::-webkit-scrollbar       { width: 4px; }
.page::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }


/* ---------- 4. Auth Page (login / register) ---------- */
/* Background image lives OUTSIDE the mobile-frame card area — visible on
   desktop around the frame and on mobile fills the whole screen. */
body.auth-body {
    /* On mobile (no @media above): the frame is fullscreen, so put bg on frame. */
    overflow: hidden;
}
.mobile-frame.auth-frame {
    /* Mobile: full-bleed background inside the frame */
    background-image: var(--auth-bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #1f2937; /* fallback while image loads */
}
.mobile-frame.auth-frame .page.auth-page {
    /* Push card down a bit so it doesn't overlap header */
    padding: 8px 16px 16px;
    background: transparent; /* let the banner show through */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* On desktop: show the banner as the body background (visible around frame) */
@media (min-width: 768px) {
    body.auth-body {
        background:
            linear-gradient(rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.55)),
            var(--auth-bg-image);
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-attachment: fixed;
    }
    .mobile-frame.auth-frame {
        /* Inside the frame, use a lighter wash so the card is readable */
        background:
            linear-gradient(180deg, rgba(255,107,0,0.12), rgba(30,136,255,0.12)),
            var(--auth-bg-image);
        background-size: cover;
        background-position: center;
    }
}

/* Auth header strip */
.auth-header {
    position: relative;
    z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    color: #fff;
}
.auth-header .brand {
    display: flex; align-items: center; gap: 10px;
}
.auth-header .brand img {
    width: 36px; height: 36px; object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.auth-header .brand h1 {
    font-size: 16px; font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.auth-header .brand small {
    font-size: 11px; opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.auth-header .lang-switch { position: relative; }
.lang-btn {
    padding: 6px 12px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border-radius: 999px;
    color: #fff;
    font-size: 13px; font-weight: 500;
    border: 1px solid rgba(255,255,255,0.25);
}
.lang-btn:hover { background: rgba(255,255,255,0.3); }
.lang-menu {
    position: absolute;
    right: 0; top: calc(100% + 6px);
    list-style: none;
    background: #fff;
    color: var(--text);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    min-width: 140px;
    padding: 4px 0;
    display: none;
}
.lang-menu.open { display: block; }
.lang-menu li a {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
}
.lang-menu li a:hover     { background: var(--bg); }
.lang-menu li a.active    { color: var(--primary); font-weight: 600; }


/* ---------- 5. Auth Card & Form ---------- */
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    margin: 16px 0;
    animation: cardIn 0.4s ease;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}
.auth-card > p.muted { margin-bottom: 18px; }

.field {
    display: block;
    margin-bottom: 12px;
}
.field input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.field input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}

.row-between {
    display: flex; align-items: center; justify-content: space-between;
    margin: 8px 0 16px;
    font-size: 13px;
}
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.check input { accent-color: var(--primary); }

.btn-primary {
    display: inline-flex; align-items: center; justify-content: center;
    height: 46px;
    padding: 0 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    font-weight: 600;
    border-radius: var(--radius);
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.35);
    transition: transform .1s, box-shadow .15s;
}
.btn-primary:hover  { box-shadow: 0 8px 20px rgba(255, 107, 0, 0.45); }
.btn-primary:active { transform: translateY(1px); }
.btn-block { width: 100%; }

.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center;
    height: 42px;
    padding: 0 16px;
    background: #f1f3f7;
    color: var(--text);
    border-radius: var(--radius);
    font-weight: 500;
}
.btn-secondary:hover { background: #e6e9ef; }

.btn-primary:disabled,
.btn-secondary:disabled,
.btn:disabled,
.btn[disabled] {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.auth-foot {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}
.auth-foot a {
    color: var(--primary);
    font-weight: 600;
    margin-left: 4px;
}

.hint-box {
    margin-top: 16px;
    padding: 10px 12px;
    background: #f0f7ff;
    border: 1px dashed var(--secondary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: #1e5fa8;
    text-align: center;
}
.hint-box small { display: block; margin-top: 4px; opacity: 0.7; }
.hint-box code  { background: rgba(30,136,255,0.1); padding: 1px 5px; border-radius: 4px; }


/* ---------- 6. App Page (post-login) ---------- */

/* ====== Top bar (used on EVERY app page — home, starting, profile, etc.) ======
   Left: brand logo (from setting) + brand name
   Right: chat / notification icon (handled by view)
*/
.app-topbar {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 16px);
    padding: clamp(12px, 2.5vw, 20px) clamp(12px, 3vw, 20px);
    min-height: 64px;
   /*  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08); */
}
.app-topbar-brand,
.app-topbar-actions {
    max-width: 1200px;
}
.app-topbar-brand {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 12px);
    flex: 1 1 auto;
    min-width: 0;
}
.app-topbar-logo {
    flex: 0 1 auto;
    width: clamp(160px, 32vw, 260px);
    max-width: 65%;
    height: clamp(42px, 10vw, 60px);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 1;
}
.app-topbar-logo img {
    width: auto;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    display: block;
}
.app-topbar-logo-fallback { font-size: clamp(18px, 4vw, 22px); }
.app-topbar-title {
    display: flex; flex-direction: column;
    min-width: 0; line-height: 1.15;
    flex: 1 1 auto;
}
.app-topbar-title b {
    font-size: clamp(15px, 3.2vw, 18px);
    font-weight: 700;
    color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-topbar-title small {
    font-size: clamp(11px, 2.4vw, 13px);
    color: rgba(255,255,255,0.85);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 10px);
    flex: 0 0 auto;
}
.app-topbar-avatar {
    width: clamp(32px, 7vw, 40px);
    height: clamp(32px, 7vw, 40px);
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-weight: 700;
    font-size: clamp(13px, 2.8vw, 15px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255,255,255,0.4);
    overflow: hidden;
    flex-shrink: 0;
}
.app-topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Mobile: thu gọn, ẩn subtitle, giảm padding/logo để cân đối */
@media (max-width: 480px) {
    .app-topbar {
        gap: 8px;
        padding: 10px 12px;
        min-height: 52px;
    }
    .app-topbar-logo {
        width: clamp(110px, 32vw, 160px);
        height: 36px;
    }
    .app-topbar-title small { display: none; }
}

/* ====== Page breadcrumb (back + current title) ======
   Sits below the top-bar. Compact pill on the left, faded.
*/
.app-crumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 0;
    color: var(--text-muted);
    font-size: 13px;
}
.app-crumb-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 8px;
    color: var(--text-muted);
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 500;
    transition: background .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    box-shadow: var(--shadow-sm);
}
.app-crumb-back svg { display: block; }
.app-crumb-back-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #fff7e6;
    color: var(--primary);
    transition: transform .25s ease, background .2s ease, color .2s ease;
}
.app-crumb-back-icon svg { display: block; }
.app-crumb-back:hover {
    color: var(--primary);
    background: #fff7e6;
    border-color: var(--primary-light);
    text-decoration: none;
}
.app-crumb-back:hover .app-crumb-back-icon {
    background: var(--primary);
    color: #fff;
    transform: translateX(-3px);  /* icon uốn ngược về phía "back" */
}
.app-crumb-back:active { transform: scale(0.97); }
.app-crumb-back:active .app-crumb-back-icon { transform: translateX(-5px); }
.app-crumb-sep {
    color: var(--text-muted);
    opacity: 0.5;
    font-size: 16px;
    line-height: 1;
}
.app-crumb-title {
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Legacy .app-header — kept for views that still use it (page-specific headers) */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.app-header h2 { font-size: 20px; font-weight: 700; }
.app-header small { font-size: 12px; opacity: 0.85; }
.app-header.simple {
    background: transparent;
    color: var(--text);
    box-shadow: none;
    padding: 16px 16px 8px;
}
.header-icon {
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
}

/* ====== Profile page ======
   The whole top region uses a full-width background image (from setting
   `profile_cover`). Avatar + name sit on top, slightly larger than before.
*/
.profile-cover {
    position: relative;
    margin: 0;
    padding: 24px 16px 70px;
    /* Fallback gradient; image overrides if --cover-url is provided inline */
    background:
        linear-gradient(180deg, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.35) 100%),
        linear-gradient(135deg, var(--primary), var(--primary-light));
    background-size: cover;
    background-position: center;
    color: #fff;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.profile-cover-top {
    display: flex; align-items: center; justify-content: space-between;
}
.profile-cover-title {
    font-size: 20px; font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.profile-cover .header-icon {
    background: rgba(0,0,0,0.25);
}
.profile-card {
    display: flex; align-items: center; gap: 14px;
    margin: -50px 14px 14px;       /* pull up so it overlaps the bottom of the cover */
    padding: 14px 16px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1;
    overflow: hidden;              /* clip the absolute cover image inside rounded corners */
}
/* Decorative cover image — same source as the top banner, rendered as a
   subtle background hint behind avatar/info/edit-btn.  Content sits above
   via z-index so text stays readable. */
.profile-card-cover {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;          /* don't intercept avatar clicks */
}
.profile-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.08;
    display: block;
}
.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    border: 2.5px solid rgba(255,255,255,0.9);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    overflow: hidden;
    flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.profile-info h3 { font-size: 17px; margin-bottom: 8px; color: var(--text); }

/* ─── Redesigned profile-card (compact row layout) ─── */
.profile-card {
    display: block;
    margin: -50px 14px 14px;
    padding: 0;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1;
    overflow: hidden;
}
.profile-card-cover {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.profile-card-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0.06;
    display: block;
}
.profile-card-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    position: relative;
    z-index: 1;
}
.profile-avatar-wrap { flex-shrink: 0; }
.profile-details { flex: 1; min-width: 0; }
.profile-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.profile-username {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}
.profile-vip-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.4;
    box-shadow: 0 1px 4px rgba(245,158,11,0.35);
}
.profile-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--success, #16a34a);
}
.profile-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success, #16a34a);
    flex-shrink: 0;
}
.profile-id-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
}
.profile-id-label { color: var(--text-muted); font-weight: 500; }
.profile-id-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--text-muted);
}
.profile-edit-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: rgba(255,255,255,0.85);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 8px);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, color .15s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.profile-edit-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.profile-edit-btn-icon { display: flex; align-items: center; }
.profile-edit-btn-label { white-space: nowrap; }

/* ---------- Profile meta — emphasised rows ----------
   Three rows stacked: ID (masked), VIP (loudest), status.
   VIP is the focal point — gold gradient pill with shadow.
   ID is muted and uses asterisks so the numeric part is hidden.
*/
.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}
.meta-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.3;
}
.meta-row .meta-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 50px;
}
.meta-row .meta-value {
    font-weight: 700;
    font-size: 13px;
}

/* ID — masked (******123), intentionally low-emphasis */
.meta-row.meta-id .meta-value.meta-id-mask {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--text-muted);
    background: var(--bg);
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--border);
    letter-spacing: 0.08em;
    font-size: 12px;
    font-weight: 600;
}

/* VIP — the loudest row: gold gradient pill, white text, drop-shadow */
.meta-row.meta-vip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ffb300 0%, #ff6b00 60%, #ff3d00 100%);
    color: #fff;
    padding: 6px 12px 6px 10px;
    border-radius: 999px;
    width: fit-content;
    max-width: 100%;
    box-shadow:
        0 4px 12px rgba(255, 107, 0, 0.32),
        0 0 0 3px rgba(255, 179, 0, 0.18);
    position: relative;
}
.meta-row.meta-vip::before {
    /* little crown/diamond accent before the label */
    content: '★';
    font-size: 14px;
    line-height: 1;
    color: #fff8e1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.meta-row.meta-vip .meta-label {
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.95;
}
.meta-row.meta-vip .meta-value.meta-vip-level {
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Status — green dot + text, mid-emphasis */
.meta-row.meta-status {
    color: var(--success);
    font-weight: 600;
}
.meta-row.meta-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(46, 184, 103, 0.2);
    flex-shrink: 0;
}
.meta-row.meta-status .meta-label {
    min-width: 0;
    color: var(--text-muted);
}
.meta-row.meta-status .meta-value {
    color: var(--success);
    font-size: 12px;
    font-weight: 700;
}

/* On very narrow screens keep things one column, but tight */
@media (max-width: 360px) {
    .meta-row .meta-label { min-width: 44px; font-size: 10px; }
    .meta-row .meta-value { font-size: 12px; }
}

.balance-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    padding: 0 14px 14px;
}
.bal-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 14px;
    box-shadow: var(--shadow-sm);
}
.bal-card.muted { background: #fff7ed; }
.bal-card small { font-size: 11px; color: var(--text-muted); }
.bal-num { font-size: 22px; font-weight: 700; margin: 4px 0; }

.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 14px 14px; }
.act {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.act.recharge { background: linear-gradient(135deg, #10b981, #34d399); }
.act.withdraw { background: linear-gradient(135deg, var(--primary), var(--primary-light)); }

.menu-list { list-style: none; padding: 0 14px 8px; }
.menu-list li a {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
}
.menu-list li a i { margin-left: auto; color: var(--text-muted); }
.menu-list li a small { display: block; font-size: 11px; color: var(--text-muted); }

.tx-list { padding: 0 14px 24px; }
.tx-row {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--card-bg);
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}
.tx-row small { font-size: 11px; color: var(--text-muted); }
.tx-amount { text-align: right; }
.tx-amount strong { display: block; font-size: 14px; }

/* Banner slider */
.banner-slider {
    position: relative;
    margin: clamp(16px, 3vw, 24px) auto 0;
    max-width: 1200px;
    width: calc(100% - 2 * clamp(12px, 3vw, 20px));
    height: clamp(150px, 22vw, 220px);
    border-radius: clamp(12px, 2vw, 20px);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    background: var(--bg);
}
.slides {
    display: flex;
    height: 100%;
    transition: transform .5s ease;
}
.slide {
    flex: 0 0 100%;
    height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    padding: 20px;
    position: relative;
}
/* Khi slide được bọc trong <a class="slide-link"> để click mở link,
   <a> phải cũng trở thành 1 flex item chiếm 100% width (giống .slide),
   vì <a> là inline mặc định → nếu không ép nó sẽ co lại và .slide bên
   trong bị chồng theo chiều dọc. */
.slide-link {
    flex: 0 0 100%;
    min-width: 100%;
    height: 100%;
    display: block;
    text-decoration: none;
    color: inherit;
}
.slide-link:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.slide.s1 { background: linear-gradient(135deg, #ff6b00, #ff8c3a); }
.slide.s2 { background: linear-gradient(135deg, #1e88ff, #4ea8ff); }
.slide.s3 { background: linear-gradient(135deg, #2eb867, #5ed18a); }
.slide.slide-img {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--bg);
}
.slide-text h3 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.slide-text p  { font-size: 13px; opacity: 0.9; }
.dots {
    position: absolute; bottom: 10px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 6px;
}
.dots span {
    width: 6px; height: 6px; border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transition: width .25s, background .25s;
}
.dots span.active { width: 18px; background: #fff; border-radius: 3px; }

/* Notice bar */
.notice-bar {
    display: flex; align-items: center; gap: 8px;
    margin: 0 16px 12px;
    padding: 10px 12px;
    background: #fff7e6;
    border: 1px solid #ffe2a8;
    border-radius: var(--radius);
    font-size: 13px;
    color: #8a5500;
}
.notice-icon { font-size: 16px; }
.notice-track {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(to right, transparent, #000 12px, #000 calc(100% - 24px), transparent);
}
.notice-track > #noticeText {
    display: inline-block;
    white-space: nowrap;
    padding-left: 100%;
    animation: notice-scroll 18s linear infinite;
    will-change: transform;
}
@keyframes notice-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* News feed (notices/articles from admin) */
.news-feed { margin: 0 16px 16px; }
.news-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px; }
.news-head h3 { font-size: 14px; font-weight: 700; }
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}
.news-cover {
    width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    overflow: hidden;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.news-cover img { width: 100%; height: 100%; object-fit: cover; }
.news-cover-icon { font-size: 28px; opacity: 0.6; }
.news-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.news-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: #000;
    /* Show full title — no clamp */
    word-break: break-word;
}
.news-summary {
    font-size: 13px;
    color: #333;
    line-height: 1.5;
    /* Show full summary — no clamp */
    word-break: break-word;
}
.news-meta { font-size: 11px; color: var(--text-subtle); }

/* Compact card: title rỗng / chỉ 1 ký tự → thu gọn sát banner */
.news-feed--tight { margin: 0 16px 12px; }
.news-feed--tight .news-head { padding: 4px 4px 6px; }
.news-feed--tight .news-list { gap: 8px; }
.news-card--compact {
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    padding: 8px 10px;
}
.news-card--compact .news-cover {

    min-height: 56px;
    flex: 0 0 76px;
    border-radius: var(--radius-sm);
}
.news-card--compact .news-cover-icon { font-size: 20px; }
.news-card--compact .news-body { gap: 4px; justify-content: center; }
.news-card--compact .news-summary { font-size: 12.5px; line-height: 1.45; }
.news-card--compact .news-inline-body { margin-top: 8px; padding-top: 8px; }

/* Title link inherits black color, no underline */
.news-title-link { color: inherit; text-decoration: none; display: block; }
.news-title-link:hover .news-title { color: var(--primary); }

/* Summary link: same target as title, wraps the summary text */
.news-summary-link { color: inherit; text-decoration: none; display: block; }
.news-summary-link:hover .news-summary { color: #000; }

/* No-click variant: cover / title / summary are clickable to expand inline */
.news-card--noclick .news-cover-link,
.news-card--noclick .news-title-link,
.news-card--noclick .news-summary-link {
    cursor: pointer;
    user-select: none;
}
.news-card--noclick .news-title-link:hover .news-title,
.news-card--noclick .news-summary-link:hover .news-summary { color: #000; }

.news-expand-icon {
    display: inline-block;
    margin-left: 4px;
    transition: transform .2s ease;
    opacity: .6;
}
.news-card.is-expanded .news-expand-icon {
    transform: rotate(180deg);
    opacity: 1;
}

.news-inline-body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #e5e7eb;
    font-size: 13px;
    color: #374151;
    line-height: 1.65;
}
.news-inline-body p { margin: 0 0 8px; }
.news-inline-body p:last-child { margin-bottom: 0; }
.news-inline-body img { max-width: 100%; height: auto; border-radius: 8px; }
.news-inline-body h3, .news-inline-body h4 { font-size: 14px; margin: 8px 0 6px; }
.news-inline-body a { color: var(--primary, #ff6b00); }

/* ================================================================
   ARTICLE SECTION — longer-form, evergreen content
   ================================================================ */
.article-section {
    margin: 0px 16px 24px;
    background: linear-gradient(180deg, #fff 0%, #fffbf5 100%);
    border: 1px solid #ffe2b8;
    border-radius: 16px;
    padding: 14px 14px 6px;
    box-shadow: var(--shadow-sm);
}
.article-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 2px;
}
.article-head h3 {
    font-size: 14px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 6px;
    color: #b35900;
}
.article-head-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px;
    border-radius: 8px;
    background: #fff3e0;
    color: var(--primary);
}
.article-more {
    display: inline-flex; align-items: center; gap: 2px;
    font-size: 12px; color: var(--primary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 999px;
    transition: background .15s ease;
}
.article-more:hover { background: #fff3e0; }
.article-more svg { display: block; }

.article-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.article-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    display: flex; flex-direction: column;
    transition: transform .2s ease, box-shadow .2s ease;
}
.article-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.article-cover-link { display: block; text-decoration: none; }
.article-cover {
    position: relative;
    aspect-ratio: 16/10;
    background: linear-gradient(135deg, #fff3e0 0%, #ffd9a3 100%);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.article-cover img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.article-cover-icon { color: var(--primary); }
.article-read-time {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 10px; font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
    backdrop-filter: blur(4px);
}
.article-body { padding: 10px 12px 12px; flex: 1; display: flex; flex-direction: column; }
.article-cat {
    display: inline-block;
    font-size: 10px; font-weight: 600;
    color: var(--primary);
    background: #fff3e0;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.article-title-link { color: inherit; text-decoration: none; }
.article-title {
    font-size: 13px; font-weight: 700;
    line-height: 1.35;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #1a1a1a;
}
.article-title-link:hover .article-title { color: var(--primary); }
.article-excerpt {
    font-size: 11px; color: var(--text-muted);
    line-height: 1.45;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.article-foot {
    margin-top: auto;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 10px;
    color: var(--text-subtle);
    padding-top: 6px;
    border-top: 1px dashed var(--border);
}
.article-author {
    display: inline-flex; align-items: center; gap: 3px;
}
.article-author-icon { color: var(--text-muted); }

/* Articles list page (client/articles) */
.article-page { padding: 16px; }
.article-page-title { font-size: 20px; margin-bottom: 4px; }
.article-page-sub   { margin-bottom: 16px; }
.article-list-full  { grid-template-columns: repeat(2, 1fr); }
.article-cover-large { aspect-ratio: 16/9; }
@media (max-width: 480px) {
    .article-list-full { grid-template-columns: 1fr; }
}

/* Article detail page */
.article-detail .article-cat { margin-bottom: 8px; display: inline-block; }
.article-detail .notice-title { font-size: 22px; line-height: 1.3; }
.article-detail .article-cover-large { border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.article-detail .article-cover-large img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Single-column on very narrow screens */
@media (max-width: 360px) {
    .article-list { grid-template-columns: 1fr; }
}

.badge.badge-pinned { margin-left: 6px; font-size: 12px; }

/* Cover link: ensure the clickable area covers the full image */
.news-cover-link { display: block; flex-shrink: 0; width: 100%; }
.news-cover-link:hover .news-cover img { transform: scale(1.02); }
.news-cover img { transition: transform .25s ease; }

/* News card clickable (entire card) */
.news-card-link { display: flex; gap: 12px; color: inherit; }
.news-card-link:hover { text-decoration: none; }
.news-card-link:hover .news-cover { opacity: 0.92; }

/* ---------- Notice detail page (client/notice) ---------- */
.header-back {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    transition: background .2s ease;
}
.header-back:hover { background: var(--border); text-decoration: none; }
.header-title { flex: 1; min-width: 0; padding: 0 8px; }
.header-title small { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.notice-detail {
    margin: 12px 16px 80px;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.notice-cover-link { display: block; }
.notice-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--bg);
    overflow: hidden;
}
.notice-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.notice-cover-link:hover .notice-cover img { transform: scale(1.03); }

.notice-head { padding: 16px 18px 8px; }
.notice-title {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
    margin-bottom: 8px;
}
.notice-meta {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.notice-summary {
    margin: 0 18px;
    padding: 12px 14px;
    background: var(--bg);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
    font-style: italic;
}
.notice-body {
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
}
.notice-body p { margin-bottom: 12px; }
.notice-body h1, .notice-body h2, .notice-body h3 {
    font-weight: 700;
    margin: 16px 0 8px;
    line-height: 1.3;
}
.notice-body h1 { font-size: 20px; }
.notice-body h2 { font-size: 17px; }
.notice-body h3 { font-size: 15px; }
.notice-body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 8px 0; }
.notice-body ul, .notice-body ol { margin: 8px 0 12px 20px; }
.notice-body li { margin-bottom: 4px; }
.notice-body a { color: var(--primary); text-decoration: underline; word-break: break-word; }
.notice-body blockquote {
    margin: 12px 0;
    padding: 8px 14px;
    border-left: 3px solid var(--border-strong);
    background: var(--bg);
    color: var(--text-muted);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.notice-body code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.notice-body pre {
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 12px 0;
    font-size: 12px;
}

.notice-foot {
    padding: 16px 18px;
    border-top: 1px solid var(--border);
}
.btn-block { display: flex; align-items: center; justify-content: center; width: 100%; padding: 12px; border-radius: var(--radius-sm); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); text-decoration: none; }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 0 16px 16px;
}
.stat {
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 8px;
    box-shadow: var(--shadow-sm);
}
.stat.highlight { background: linear-gradient(135deg, #ff6b00, #272625); color: #fff; }
.stat.warn      { background: linear-gradient(135deg, #ff6b00, #ed2626); color: #fff; grid-column: span 2; }
.stat-num   { font-size: 20px; font-weight: 700; line-height: 2.2; }
.stat-label { font-size: 16px; opacity: 0.75; margin-top: 2px; }

/* PC: 4 ô trên 1 hàng (mobile là 2 hàng x 2 cột) */
@media (min-width: 769px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .stat.warn  { grid-column: span 1; }
}

/* Quick actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 0 16px 16px;
    padding: 12px 8px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.qa {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 11px; color: var(--text-muted);
    padding: 6px 4px;
}
.qa-icon { font-size: 22px; }

/* Hero CTA — floating action button, always visible while scrolling.
   Trục X phải trùng tâm .bn-center-inner (cột giữa của .bottom-nav).
   Vì .bottom-nav nằm trong .mobile-frame (680px trên desktop) còn
   position:fixed lấy 50% theo viewport, nên ở >=768px phải neo theo
   tâm frame thay vì 50% viewport — dùng inset-inline: 0 + margin auto. */
.hero-cta {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 30px;
    margin-inline: auto;
    z-index: 2147483647;

    width: 120px;
    height: 120px;
    top: 50%;
    border-radius:50%;

    display:flex;
    align-items:center;
    justify-content:center;

    pointer-events:auto;

    isolation:isolate;

    overflow:visible;
}

/* Desktop: .mobile-frame bị giới hạn 680px và căn giữa trong viewport.
   Giới hạn hero-cta trong cùng bề rộng để tâm nút trùng tâm .bn-center-inner. */
@media (min-width: 768px) {
    .hero-cta {
        max-width: 680px;
    }
}

.hero-cta:before {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 5px solid rgba(255, 160, 64, .38);
    background: transparent;
    box-sizing: border-box;
    pointer-events: none
}

.hero-cta:disabled {
    cursor: not-allowed;
    animation: none;
    opacity: .65
}
/* When the user scrolls, fade slightly so it doesn't fight for attention
   with the actual content. Still very visible — just less "shouting". */

.hero-cta .ring {
    position: absolute; inset: 0;
    border: 2px dashed rgba(255,107,0,0.45);
    border-radius: 50%;
    animation: spin 14s linear infinite;
}
.hero-cta .pulse {
    position: absolute; inset: -14px;
    border-radius: 50%;
    background: rgba(255,107,0,0.18);
    animation: pulse 2s ease-out infinite;
}
.hero-cta .core {
    position: absolute; inset: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
    box-shadow: 0 12px 28px rgba(255,107,0,0.5),
                0 0 0 6px rgba(255,107,0,0.08);
    letter-spacing: 0.05em;
    transition: transform .25s ease;
}
.hero-cta:hover .core { transform: scale(1.04); }
.hero-cta:active .core { transform: scale(0.96); }
.hero-cta:focus-visible {
    outline: 3px solid var(--primary-light);
    outline-offset: 6px;
    border-radius: 50%;
}
/* When the order modal opens, dim the floating CTA so the dialog wins focus. */
body.modal-open .hero-cta {
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

/* Block body scroll bounce when modal is open on mobile */
body.modal-open {
    overflow: hidden;
    overscroll-behavior: none;
}

/* Also block mobile-frame scroll when modal is open */
body.modal-open .mobile-frame {
    overflow: hidden;
}

/* Block page scroll when modal is open */
body.modal-open .mobile-frame .page {
    overscroll-behavior: none;
}

/* CTA hint — lives INSIDE .hero-cta so it inherits the fixed positioning
   and "scrolls along" with the button without needing any JS tweaks.
   Sits right below the button and is always visible. */
.cta-hint {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    z-index: 3;
    pointer-events: none;
    margin: 0;
    padding: 5px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255,107,0,0.95) 0%, rgba(255,140,0,0.95) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        0 4px 14px rgba(255,107,0,0.45),
        0 1px 3px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.25);
    letter-spacing: 0.04em;
    white-space: nowrap;
    animation: hero-cta-pop .55s cubic-bezier(.2, 1.2, .4, 1) .15s both;
    transition: opacity .25s ease, transform .25s ease;
}

@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(0.95); opacity: 1; } 100% { transform: scale(1.5);  opacity: 0; } }
@keyframes hero-cta-pop {
    0%   { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    60%  { transform: translate(-50%, -50%) scale(1.06); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .hero-cta, .cta-hint, .hero-cta .pulse, .hero-cta .ring { animation: none; }
}

/* Filter chips */
.filter-bar {
    display: flex; gap: 6px;
    padding: 8px 16px 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.chip {
    display: inline-flex; align-items: center;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Order list / card */
.order-list { padding: 0 16px 24px; }
.order-card {
    display: flex; gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.order-card img {
    width: 20%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.order-info { flex: 1; min-width: 0; }
.order-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.order-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.order-meta code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.order-row {
    display: flex; justify-content: space-between;
    font-size: 12px; color: var(--text-muted);
    margin-top: 2px;
}
.order-row.total { font-weight: 700; color: var(--text); font-size: 13px; padding-top: 6px; border-top: 1px dashed var(--border); }
.order-row span { white-space: nowrap; }

.empty-state {
    padding: 40px 16px;
    text-align: center;
    color: var(--text-muted);
}

/* Help / FAQ */
.help-banner {
    display: flex; align-items: center; gap: 14px;
    margin: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #1e88ff, #4ea8ff);
    color: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.help-banner .hb-icon { font-size: 30px; }
.help-banner h3 { font-size: 16px; margin-bottom: 2px; }
.help-banner p  { font-size: 12px; opacity: 0.9; }

.faq-list { margin: 0 16px 16px; }
.faq {
    background: #fff;
    border-radius: var(--radius);
    padding: 0 14px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}
.faq summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 0;
    font-weight: 500;
    display: flex; justify-content: space-between; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 20px; color: var(--primary); transition: transform .2s; }
.faq[open] summary::after { content: '−'; }
.faq p { padding: 0 0 14px; font-size: 13px; color: var(--text-muted); }

.section-title {
    padding: 8px 16px 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0 16px 16px;
}
.contact-card {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: #fff;
    border-radius: var(--radius);
    padding: 14px 6px;
    font-size: 11px;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}
.contact-card span { font-size: 22px; }


/* ---------- 7. Badges, Alerts, Modal ---------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    text-transform: capitalize;
}
.badge-pending   { background: #fff7e6; color: #b97a00; }
.badge-completed { background: #e6f7ee; color: #1f8a4f; }
.badge-cancelled { background: #fdeaea; color: #c4322d; }
.badge-failed    { background: #fdeaea; color: #c4322d; }

.alert {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 12px;
}
.alert-error   { background: #fdeaea; color: #b3251f; border: 1px solid #f8c5c1; }
.alert-success { background: #e6f7ee; color: #1f8a4f; border: 1px solid #b8e6c8; }
.alert-info    { background: #e8f1ff; color: #1e5fa8; border: 1px solid #c4dafd; }
.alert-warning { background: #fff6e0; color: #8a5a00; border: 1px solid #f5d994; }
.alert-warning { background: #fff7e6; color: #8a5500; border: 1px solid #ffe2a8; }

/* Modal */
.modal {
    position: fixed; inset: 0;
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    isolation: isolate;
}
.modal[hidden] { display: none; }

/* On mobile: align to top, allow scrolling */
@media (max-width: 480px) {
    .modal {
        align-items: flex-start;
        padding: 12px 16px 24px;
    }
}
/* Trước khi JS set hidden=false, modal MẶC ĐỊNH pointer-events:none.
   Modal.open() sẽ add class `is-ready` để bật click. Tránh tình trạng
   modal lỗi/bị kẹt che toàn bộ page khiến user "không thao tác được". */
.modal:not(.is-ready) { pointer-events: none; }
.modal-mask {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}
.modal-content {
    position: relative;
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-lg);
    animation: modalIn .25s ease;
}
/* Order modal: vuốt từ trái vào giữa khi mở, vuốt từ giữa ra phải khi đóng.
   JS sẽ toggle class `.om-anim-in` / `.om-anim-out` để chạy keyframes
   tương ứng; `.om-anim-out` kết thúc thì JS mới set hidden=true. */
.order-modal-content {
    animation: none;            /* override animation mặc định của .modal-content */
    /* Dịch modal lên cao hơn vị trí center một chút (do .modal cha đã
       căn giữa bằng flex). translateY(-30px) là default → sau khi
       animation kết thúc, modal vẫn giữ vị trí "lên cao" thay vì
       snap về đúng tâm. */
    transform: translateY(-30px);
    opacity: 1;
    overscroll-behavior: none;  /* prevent scroll pass-through to page */
    /* Desktop: giới hạn chiều cao để tạo boundary cho scroll */
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Modal header (title + close button) - sticky at top */
.order-modal-content .modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    flex-shrink: 0;
}
.order-modal-content .modal-header .modal-title {
    margin: 0;
    padding-right: 0;
}

/* Scrollable body inside modal */
.modal-body-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    flex: 1;
    min-height: 0; /* CRITICAL for flex child to shrink */
}

/* Actions inside scrollable body */
.modal-body-scroll .modal-actions {
    margin-top: 16px;
    padding-bottom: 8px;
    flex-shrink: 0;
}
.order-modal-content.om-anim-in {
    animation: orderModalIn .42s cubic-bezier(.22,.9,.32,1) both;
}
.order-modal-content.om-anim-out {
    animation: orderModalOut .35s cubic-bezier(.55,.05,.85,.4) both;
}
@keyframes orderModalIn {
    from { transform: translateX(-105%) translateY(-30px); opacity: 0; }
    to   { transform: translateX(0)      translateY(-30px); opacity: 1; }
}
@keyframes orderModalOut {
    from { transform: translateX(0)      translateY(-30px); opacity: 1; }
    to   { transform: translateX(105%)  translateY(-30px); opacity: 0; }
}
/* Mask ăn nhịp với content: sáng dần khi mở, tối dần khi đóng */
.modal:not([hidden]).om-mask-in .modal-mask {
    animation: orderMaskIn .35s ease both;
}
.modal.om-mask-out .modal-mask {
    animation: orderMaskOut .35s ease both;
}
@keyframes orderMaskIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes orderMaskOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.modal-actions {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 16px;
}
.modal-close {
    position: absolute;
    top: 10px; right: 12px;
    width: 32px; height: 32px;
    border: 0; background: transparent;
    font-size: 22px; line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: background .15s, color .15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

/* ==========================================================
   Redesigned order-popup (.order-modal-content)
   ----------------------------------------------------------
   Modal riêng cho popup đơn hàng — rộng hơn, có hero image
   lớn phía trên và chip "đơn dính" ở góc.
   ========================================================== */
.order-modal-content {
    max-width: 380px;
    padding: 18px 18px 16px;
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.order-modal-content .modal-title {
    font-size: 17px;
    margin: 0 0 12px;
    padding-right: 28px;
}

.order-card--modal {
    padding: 0;
    margin-bottom: 4px;
    box-shadow: none;
    background: transparent;
    flex-direction: column;
    gap: 0;
}
.order-card,
.order-card--modal {
    /* Remove fixed height and scroll - let parent .order-modal-content handle scrolling */
    max-height: none;
    overflow-y: visible;
    overflow-x: hidden;
}
/* Giữ nguyên cấu trúc phần hiển thị ảnh */
.order-card--modal .order-hero {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: var(--radius);
    transition: height .3s ease;
}

.order-card--modal .order-hero.is-expanded {
    height: 320px;
}

.order-card--modal .order-hero img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

@media (max-width: 480px) {
    .order-card--modal .order-hero {
        position: relative;
        width: 100%;
        height: 160px;
        margin: -4px -4px 8px;
        border-radius: var(--radius-lg);
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f8f9fa;
        transition: height .3s ease;
    }
    .order-card--modal .order-hero.is-expanded {
        height: 280px;
    }
    .order-card--modal .order-hero img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
}

/* Button expand image */
.btn-expand-img {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: calc(100% + 8px);
    margin: 0 -4px 10px;
    padding: 4px 12px;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: #000000;
    font-size: 13px;
    cursor: pointer;
    transition: background .2s, color .2s;
}
.btn-expand-img:hover {
    background: #f0f4ff;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-expand-img.is-expanded span::before {
    content: 'Thu gọn ';
}

.order-stuck-chip {
    position: absolute;
    top: 10px; right: 10px;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 10px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}
.order-stuck-icon { font-size: 12px; }
.order-stuck-count { font-weight: 700; }
.order-stuck-label {
    font-weight: 500;
    opacity: 0.9;
    font-size: 11px;
}

.order-card--modal .order-info {
    padding: 0 4px;
}
.order-card--modal .order-name {
    font-size: 15px;
    margin-bottom: 4px;
}
.order-card--modal .order-meta {
    margin-bottom: 10px;
}
.order-card--modal .order-meta code {
    font-size: 11px;
}

.order-percent-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px;
    margin: 8px 0 10px;
    background: linear-gradient(135deg, #fff7e6, #fff1d6);
    border: 1px dashed #ffcc80;
    border-radius: var(--radius);
}
.order-percent-label {
    font-size: 12px;
    color: #8a5500;
    font-weight: 600;
}
.order-percent-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    display: inline-flex; align-items: baseline; gap: 6px;
}
.order-percent-dice {
    font-style: normal;
    font-size: 11px;
    font-weight: 500;
    color: var(--primary);
    padding: 1px 6px;
    background: #fff;
    border-radius: 999px;
    border: 1px solid var(--primary-light);
}

.order-row--stuck strong {
    color: var(--warning);
}
.order-row--frozen {
    background: linear-gradient(90deg, rgba(255, 179, 0, 0.08), rgba(255, 107, 0, 0.04));
    padding: 6px 10px;
    border-radius: 6px;
    margin: 2px 0;
}
.order-row--frozen strong.text-warning {
    color: var(--warning);
    font-size: 14px;
}
.order-row--frozen strong.text-success {
    color: var(--success);
    font-size: 14px;
}
.order-banner--frozen {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin: 0 0 12px;
    background: linear-gradient(135deg, #fff4e5 0%, #ffe7c2 100%);
    border: 1px solid var(--warning);
    border-radius: 8px;
    color: #8a5300;
}
.order-banner--frozen i {
    font-size: 22px;
    line-height: 1;
    color: var(--warning);
    flex-shrink: 0;
}
.order-banner--frozen strong {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}
.order-banner--frozen small {
    display: block;
    font-size: 12px;
    color: #a36a00;
    opacity: 0.9;
}
.order-card--frozen-wait {
    border-color: var(--warning) !important;
    background: linear-gradient(135deg, #fffaf0 0%, #fff 60%);
}
.order-card--frozen-wait .order-actions .btn-primary[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}
.order-profit-percent {
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
    color: var(--text-muted);
}


/* ---------- 8. Bottom Nav + Floating Chat ---------- */
.bottom-nav {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 80px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    display: grid;
    /* Cột giữa phải là cột 70px để .bn-center (grid-column: 3) rơi đúng
       tâm khung. Trước đây là repeat(4, 1fr) 70px → cột 70px nằm cuối,
       làm tâm .bn-center-inner lệch ~41px so với .hero-cta (left: 50%). */
    grid-template-columns: 1fr 1fr 70px 1fr 1fr;
    align-items: center;
    z-index: 90;
}
.bn-item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    height: 100%;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
}
.bn-item:nth-child(1) { grid-column: 1; }  /* home */
.bn-item:nth-child(2) { grid-column: 2; }  /* history */
.bn-item:nth-child(4) { grid-column: 4; }  /* help */
.bn-item:nth-child(5) { grid-column: 5; }  /* profile */
.bn-item.active { color: var(--primary); }
.bn-item svg { width: 22px; height: 22px; }

.bn-center {
    position: relative;
    display: block; /* <a> mặc định inline → không chiếm đủ width cell grid */
    grid-column: 3;
    grid-row: 1;
    width: 70px; height: 70px;
    margin: 0;
    align-self: start;
    justify-self: center;
    transform: translateY(-28px);
}
.bn-center-inner {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(255, 107, 0, 0.45);
    display: flex; align-items: center; justify-content: center;
}
.bn-center-inner::after {
    content: '';
    position: absolute;
    inset: -8px;
    border: 2px dashed rgba(255, 107, 0, 0.4);
    border-radius: 50%;
    animation: spin 12s linear infinite;
}
.bn-center-label {
    position: absolute;
    bottom: -18px; left: 50%; transform: translateX(-50%);
    font-size: 13px; color: #ff0000; white-space: nowrap;
    font-weight: bold;
}

/* Floating chat button */
.floating-chat {
    position: absolute;
    right: 16px; bottom: calc(var(--bn-h) + 16px + env(safe-area-inset-bottom, 0px));
    width: 50px; height: 50px;
    background: linear-gradient(135deg, var(--secondary), #4ea8ff);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 16px rgba(30, 136, 255, 0.45);
    z-index: 80;
}
.floating-chat .fc-dot {
    position: absolute; top: 4px; right: 4px;
    width: 10px; height: 10px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid #fff;
}


/* ---------- 9. Order Card (modal variant) ---------- */
.order-card .order-info { width: 100%; }

/* Product card on /starting — same look as order-card but selectable */
.product-card {
    background: #fff;
    transition: transform .1s, box-shadow .15s, border-color .15s;
    border: 2px solid transparent;
}
.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.product-card:active {
    transform: translateY(0);
}
.product-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}


/* ---------- 10. Utilities ---------- */
.muted       { color: var(--text-muted); }
.small       { font-size: 12px; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info    { color: var(--info); }
.text-center  { text-align: center; }
.hidden      { display: none !important; }
.notice-bell-icon {
    width: 20px;
    height: 20px;
  }


/* ==========================================================================
   11. FORM CARD — reusable "card" form used by bank-link, withdraw, etc.
       Visually identical to the auth-card on the login/register screens so
       the UI stays consistent everywhere a form is shown inside the app.
   ========================================================================== */
.form-card {
    margin: 14px 14px 16px;
    padding: 22px 20px 20px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: cardIn 0.35s ease;
}
.form-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.form-card-head h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}
.form-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(255, 107, 0, 0.28);
}
.form-card-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: -6px 0 6px;
    line-height: 1.5;
}
.form-card .alert { margin: 0; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form-foot {
    margin-top: 4px;
    text-align: center;
}
.form-foot.muted { color: var(--text-muted); }

/* "field" inside the form-card uses the same look as auth-card fields
   so every form in the app feels identical. */
.form .field {
    display: block;
    margin-bottom: 0;            /* spacing handled by .form gap */
    position: relative;
}
.form .field input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
    transition: border-color .15s, background .15s, box-shadow .15s;
    font-size: 14px;
    color: var(--text);
}
.form .field input::placeholder {
    color: #aab0b8;
}
.form .field input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}
.form .field input:disabled,
.form .field input[readonly] {
    background: #f3f4f7;
    color: var(--text-muted);
}

/* Bank summary block shown at the top of the withdraw form */
.bank-summary {
    position: relative;
    background: linear-gradient(180deg, #fff7ed 0%, #fff 100%);
    border: 1px solid #ffe2a8;
    border-radius: var(--radius);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bank-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-size: 13px;
    color: var(--text-muted);
}
.bank-summary-row b {
    color: var(--text);
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}
.bank-summary-edit {
    position: absolute;
    right: 0px;
    top: 29px;
    font-size: 8px;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #ffd9a3;
    transition: background .15s ease, border-color .15s ease;
}
.bank-summary-edit:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    text-decoration: none;
}

/* ---------- Withdraw: amount input + "Max" side button ---------- */
.field-amount {
    position: relative;       /* anchor for absolute-positioned Max button */
    display: block;           /* no longer flex; the button floats over the input */
    padding: 0;
    border: none;
    background: transparent;
}
.field-amount input {
    width: 100%;
    /* reserve room on the right so the number text never hides under the button */
    padding-right: 76px;
}
.amount-max-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    height: 36px;
    min-width: 60px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid #ffd9a3;
    background: #fff7e6;
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: .02em;
    cursor: pointer;
    transition: background .15s ease,
                border-color .15s ease,
                color .15s ease,
                box-shadow .15s ease,
                transform .1s ease;
}
.amount-max-btn:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 6px 16px rgba(255, 107, 0, 0.35);
}
.amount-max-btn:active { transform: translateY(-50%) scale(.97); }
.amount-max-btn:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}

/* Bank status badge inside the profile menu */
.menu-list li a .badge {
    display: inline-block;
    margin-top: 4px;
    vertical-align: middle;
}
.menu-list li a small .badge {
    margin-left: 4px;
    font-size: 10px;
    padding: 1px 6px;
}

/* Alerts inside form-card: keep them inline-friendly */
.form-card .alert {
    margin: 0;
}

/* Active state on the bank-link / withdraw menu rows */
.menu-list li a[aria-current="page"] {
    border: 1px solid var(--primary);
    box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.12);
}

/* On very narrow screens, form-card has tighter padding */
@media (max-width: 360px) {
    .form-card {
        margin: 12px 12px 14px;
        padding: 18px 16px 18px;
    }
    .form-card-head h2 { font-size: 16px; }
    .form .field input { height: 44px; }
}

/* ==========================================================================
   12. LAYOUT FIXES — add CSS that was missing from the served bundle
       (these classes are referenced by profile/withdraw/bank-link views but
       were never declared in fe/index.css, so the UI was previously broken)
   ========================================================================== */

/* Withdraw: balance-mini block — gradient banner with current balance + min/max */
.balance-mini {
    margin: 14px;
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.balance-mini small {
    opacity: 0.9;
    font-size: 11px;
    display: block;
}
.balance-mini .bal-num { color: #fff; margin-top: 6px; }
.balance-mini small.muted { opacity: 0.8; margin-top: 6px; font-size: 11px; }

/* Withdraw form (kept for legacy but .form .field is preferred) */
.withdraw-form { padding: 0 14px 24px; }
.withdraw-form .bank-info {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
    background: #fafbfc;
}
.withdraw-form .bank-info legend {
    padding: 0 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}
.withdraw-form .field {
    margin-bottom: 12px;
}
.withdraw-form .field input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    transition: border-color .15s, background .15s, box-shadow .15s;
    font-size: 14px;
}
.withdraw-form .field input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}

/* Action row icons (used in profile/recharge, profile/withdraw big buttons) */
.act-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* Menu list — extra polish for the icon + chevron spacing */
.menu-list li a .menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #fff7ed;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.menu-list li a .menu-icon.menu-icon-danger {
    background: #fee2e2;
    color: var(--danger);
}
.menu-list li a .menu-chevron {
    margin-left: auto;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.menu-list li a .menu-text {
    flex: 1;
    min-width: 0;
}
.menu-list li a .menu-text b {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}
.menu-list li a .menu-text small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
}

/* Edit personal info page */
.profile-edit-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 16px 14px;
    padding: 12px 14px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.profile-edit-summary-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex: 0 0 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 18px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.25);
}
.profile-edit-summary-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.profile-edit-summary-meta b {
    font-size: 14px;
    color: var(--text);
    line-height: 1.3;
    word-break: break-word;
}
.profile-edit-summary-meta small {
    color: var(--text-muted);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.profile-edit-summary-meta small code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}
.profile-edit-summary-vip {
    background: linear-gradient(135deg, #ffb300 0%, #ff6b00 60%, #ff3d00 100%);
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(255, 107, 0, 0.28);
    flex-shrink: 0;
}
.profile-edit-readonly {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg);
    border: 1px dashed var(--border);
    border-radius: 10px;
}
.profile-edit-readonly-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.profile-edit-readonly-row b {
    color: var(--text);
    font-weight: 600;
    word-break: break-word;
    text-align: right;
}
.profile-edit-readonly-row code {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}
.field-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
}
.field-label .required { color: var(--danger); margin-left: 2px; }
.field textarea {
    width: 100%;
    border: 1px solid var(--input-border, var(--border));
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    color: inherit;
    background: var(--input-bg, var(--card-bg));
    resize: vertical;
    min-height: 84px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}
.profile-edit-cancel {
    margin-top: 8px;
    text-align: center;
}
.profile-edit-link .menu-icon {
    background: #fff4e0;
}

/* Transaction history page */
.transaction-page {
    padding-bottom: 24px;
}
.transaction-hero {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 16px 12px;
    padding: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.transaction-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 14px;
}
.transaction-hero h2 { font-size: 18px; line-height: 1.25; }
.transaction-hero p { margin-top: 3px; font-size: 12px; opacity: 0.88; }
.transaction-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 16px 18px;
}
.transaction-summary-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.transaction-summary-icon,
.transaction-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 12px;
}
.transaction-summary-icon { width: 30px; height: 30px; }
.transaction-summary-icon.is-income { color: var(--success); background: #e6f7ee; }
.transaction-summary-icon.is-outcome { color: var(--danger); background: #fdeaea; }
.transaction-summary-item small,
.transaction-summary-item strong { display: block; }
.transaction-summary-item small { overflow: hidden; color: var(--text-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-summary-item strong { margin-top: 2px; font-size: 14px; }
.transaction-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 16px 10px;
}
.transaction-toolbar h3 { font-size: 15px; }
.transaction-toolbar p { margin-top: 2px; color: var(--text-muted); font-size: 11px; }
.transaction-toolbar-icon { color: var(--primary); }
.transaction-list { display: flex; flex-direction: column; gap: 9px; padding: 0 16px; }
.transaction-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 13px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.transaction-item-icon { width: 40px; height: 40px; }
.transaction-item-icon.type-recharge { color: #0f9f6e; background: #e6f7ee; }
.transaction-item-icon.type-withdraw { color: #df4d45; background: #fdeaea; }
.transaction-item-content { flex: 1; min-width: 0; }
.transaction-item-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.transaction-item-topline strong { font-size: 14px; line-height: 1.35; }
.transaction-amount { flex: 0 0 auto; font-size: 14px; white-space: nowrap; }
.transaction-item-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--text-muted); font-size: 11px; }
.transaction-note { margin-top: 8px; color: var(--text-muted); font-size: 11px; line-height: 1.4; word-break: break-word; }
.transaction-balance { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--border); color: var(--text-muted); font-size: 11px; }
.transaction-balance b { color: var(--text); font-size: 12px; }
.transaction-empty { padding: 42px 18px; text-align: center; color: var(--text-muted); background: var(--card-bg); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.transaction-empty-icon { display: flex; justify-content: center; margin-bottom: 10px; color: var(--primary-light); }
.transaction-empty strong { display: block; color: var(--text); font-size: 14px; }
.transaction-empty p { margin-top: 5px; font-size: 12px; line-height: 1.5; }


/* ==========================================================================
   12. PROFILE EDIT — pencil button on profile card + edit-info modal.
       Only 3 fields are user-editable from here:
         fullname, phone, address
       (username, ID, balance, VIP, bank info stay read-only — those
        are locked for security / business reasons.)
   ========================================================================== */

/* Pencil button — sits on the right edge of the profile card.
   Pill-style with an icon + short label. Hidden on the narrowest phones
   where we collapse the label and only show the icon. */
.profile-edit-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    box-shadow: 0 4px 10px rgba(255, 107, 0, 0.32);
    transition: transform .1s ease, box-shadow .15s ease, filter .15s ease;
    z-index: 2;
}
.profile-edit-btn:hover { box-shadow: 0 6px 14px rgba(255, 107, 0, 0.45); }
.profile-edit-btn:active { transform: scale(.97); }
.profile-edit-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.25),
                0 4px 10px rgba(255, 107, 0, 0.32);
}
.profile-edit-btn-icon { display: inline-flex; }
.profile-edit-btn-label { line-height: 1; }

/* On phones narrower than the 480px frame the label might overflow —
   keep the icon and trim the label gracefully. */
@media (max-width: 380px) {
    .profile-edit-btn { padding: 0 10px; }
    .profile-edit-btn-label { display: none; }
    .profile-edit-btn-icon svg { width: 18px; height: 18px; }
}



/* Edit modal — same shell as `.modal` in section 7, but a hair wider
   so the address textarea doesn't feel cramped. */
.profile-edit-modal-content,
.password-modal-content {
    max-width: 420px;
    padding: 22px 20px 18px;
}
.profile-edit-modal-head,
.password-modal-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.profile-edit-modal-icon,
.password-modal-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(255, 107, 0, 0.28);
}
.profile-edit-modal-sub,
.password-modal-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* Divider giữa phần thông tin và phần nút bấm trong modal Edit profile */
.profile-edit-sep {
    height: 1px;
    background: var(--border);
    margin: 18px 0 16px;
}

/* Modal dùng chung cho Edit profile + 2 dialog mật khẩu */
.profile-edit-form,
.password-form { margin-bottom: 0; }
.profile-edit-form .field + .field,
.password-form .field + .field { margin-top: 12px; }
.profile-edit-form .field-label,
.password-form .field-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: .02em;
}
.profile-edit-form input,
.profile-edit-form textarea,
.password-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
    transition: border-color .15s, background .15s, box-shadow .15s;
    font-size: 14px;
    color: var(--text);
    font-family: inherit;
    resize: vertical;
    min-height: 48px;
}
.profile-edit-form textarea {
    min-height: 64px;
    line-height: 1.4;
}
.profile-edit-form input:focus,
.profile-edit-form textarea:focus,
.password-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}
.profile-edit-form input[aria-invalid="true"],
.profile-edit-form textarea[aria-invalid="true"],
.password-form input[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.profile-edit-modal-actions,
.password-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}
.profile-edit-modal-actions .btn-secondary,
.password-modal-actions .btn-secondary { height: 44px; min-width: 92px; }
.profile-edit-modal-actions .btn-primary,
.password-modal-actions .btn-primary { height: 44px; min-width: 120px; }
.profile-edit-modal-actions .btn-primary[disabled],
.password-modal-actions .btn-primary[disabled] { opacity: .6; cursor: not-allowed; }

/* Khi modal hồ sơ (sửa thông tin / đổi mật khẩu) mở, làm mờ nút chat
   nổi để nó không chồng lên nền modal. */
body.profile-edit-open .floating-chat,
body.password-modal-open .floating-chat { opacity: .35; pointer-events: none; }


/* ==========================================================================
   13. LANGUAGE PICKER — inline <select> rendered under the logout row on
       /profile so users can switch UI language without leaving the page.
       Visually consistent with the .menu-list / .form-card styling so it
       blends in with the rest of the profile screen.
   ========================================================================== */
.lang-picker {
    margin: 6px 14px 28px;
    padding: 14px 16px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
    display: grid;
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 4px;
    align-items: center;
}
.lang-picker-icon {
    grid-row: 1 / span 2;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(255, 107, 0, 0.28);
}
.lang-picker-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.lang-picker-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .02em;
    text-transform: uppercase;
}
.lang-picker-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    height: 40px;
    padding: 0 36px 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-color: #fafbfc;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 18px,
        calc(100% - 13px) 18px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.lang-picker-select:hover {
    border-color: var(--border-strong);
    background-color: #fff;
}
.lang-picker-select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}
.lang-picker-hint {
    grid-column: 2;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* When the user is mid-switch — lock the select so the page reload
   triggered by I18N.switch() can't be cancelled by another tap. */
.lang-picker.is-switching .lang-picker-select {
    opacity: .55;
    pointer-events: none;
}

/* =============================================================================
   Live Chat v2 (client side) — full screen chat with image attachments
   -----------------------------------------------------------------------------
   The chat shell occupies the area below the top-bar / breadcrumb and above
   the bottom nav. Header is sticky, messages scroll, and the input area is
   pinned to the bottom of the visible area with a textarea + attach + send.
   =========================================================================== */
.chat-shell {
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 0% 0%, rgba(255, 107, 0, .06), transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(14, 165, 233, .05), transparent 40%),
        var(--bg);
    position: absolute;
    inset: 0;
    bottom: calc(var(--bn-h, 64px) + env(safe-area-inset-bottom, 0px));
}

.chat-head {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    padding: 12px 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    z-index: 2;
}
.chat-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-head-right { display: flex; align-items: center; gap: 6px; }
.chat-head-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.18);
    color: #fff;
    transition: background .15s ease;
    border: 0;
    cursor: pointer;
}
.chat-head-icon:hover { background: rgba(255,255,255,0.30); }
.chat-sound-toggle.is-muted {
    background: rgba(239, 68, 68, 0.45);
}
.chat-sound-toggle.is-muted:hover {
    background: rgba(239, 68, 68, 0.60);
}

/* Quick Replies popover ----------------------------------------- */
.chat-quick-btn { color: #475569; }
.chat-quick-btn:hover { background: rgba(15, 23, 42, 0.06); color: #1e88ff; }
.chat-quick-popover {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 92px;
    max-width: 380px;
    margin: 0 auto;
    background: var(--card, #fff);
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
    z-index: 30;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    animation: chat-popover-up .18s ease-out;
}
.chat-quick-popover[hidden] { display: none !important; }
@keyframes chat-popover-up {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.chat-quick-head {
    padding: 12px 14px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    background: linear-gradient(135deg, #1e88ff 0%, #00b8d4 100%);
    color: #fff;
}
.chat-quick-head strong { font-size: 14px; font-weight: 600; }
.chat-quick-close {
    background: transparent; border: none; color: #fff;
    font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; opacity: .85;
}
.chat-quick-close:hover { opacity: 1; }
.chat-quick-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 8px;
    display: flex; flex-direction: column; gap: 6px;
}
.chat-quick-empty {
    margin: 0; padding: 18px;
    text-align: center; color: var(--text-muted, #64748b); font-size: 13px;
}
.chat-quick-item {
    appearance: none; -webkit-appearance: none;
    text-align: left;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    display: flex; flex-direction: column; gap: 4px;
    transition: transform .12s ease, background .12s ease, border-color .12s ease;
    width: 100%;
    font-family: inherit;
}
.chat-quick-item:hover {
    background: #eef6ff;
    border-color: rgba(30, 136, 255, 0.45);
    transform: translateY(-1px);
}
.chat-quick-item:active { transform: translateY(0); }
.chat-quick-t {
    font-weight: 600;
    font-size: 13px;
    color: #0f172a;
    display: flex; align-items: center; gap: 6px;
}
.chat-quick-cat {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(30, 136, 255, 0.12);
    color: #1e88ff;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 500;
}
.chat-quick-b {
    font-size: 12px;
    color: #475569;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chat-head-avatar {
    position: relative;
    width: 38px; height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.chat-head-avatar-admin { background: rgba(255,255,255,0.30); }
.chat-head-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}
.chat-head-avatar span { letter-spacing: -0.5px; }
.chat-head-online {
    position: absolute;
    bottom: -2px; right: -2px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--primary);
    box-sizing: content-box;
}
.chat-head-info { display: flex; flex-direction: column; min-width: 0; }
.chat-head-info strong {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .01em;
    line-height: 1.2;
}
.chat-head-info small.chat-head-status {
    font-size: 11px;
    opacity: .9;
    display: flex; align-items: center; gap: 4px;
    margin-top: 2px;
}
.chat-head-status .chat-head-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, .25);
    display: inline-block;
}
.vip-tag {
    background: rgba(255,255,255,0.25);
    color: #fff;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
    letter-spacing: .04em;
}

.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 12px 12px;
    display: flex; flex-direction: column;
    gap: 6px;
    background:
        repeating-linear-gradient(45deg, rgba(0,0,0,0.012) 0 2px, transparent 2px 12px),
        transparent;
    scroll-behavior: smooth;
}
.chat-messages .empty-state {
    align-self: center;
    margin: auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 24px;
    opacity: .7;
}

.chat-day-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 8px 0 4px;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.chat-day-divider::before,
.chat-day-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0,0,0,0.08);
}

.chat-msg {
    display: flex; align-items: flex-end; gap: 6px;
    max-width: 85%;
    align-self: flex-start;
    animation: chat-bubble-in .25s cubic-bezier(.2,.9,.3,1.2) both;
}
.chat-msg.me {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-msg .chat-msg-body { padding-left: 2px; }
.chat-msg.me .chat-msg-body { padding-left: 0; padding-right: 2px; }
@keyframes chat-bubble-in {
    from { opacity: 0; transform: translateY(6px) scale(.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.chat-msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    flex-shrink: 0;
    margin-bottom: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.chat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.chat-msg.me .chat-msg-avatar { display: none; }

.chat-msg-body {
    display: flex; flex-direction: column;
    gap: 4px;
    max-width: 100%;
}
.chat-msg.me .chat-msg-body { align-items: flex-end; }

.chat-msg-image {
    overflow: hidden;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    background: #fff;
    box-shadow: var(--shadow-sm);
    max-width: 240px;
    cursor: zoom-in;
}
.chat-msg.me .chat-msg-image {
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 4px;
}
.chat-msg-image img {
    display: block;
    width: 100%;
    max-width: 240px;
    height: auto;
    max-height: 280px;
    object-fit: cover;
    background: #f1f1f1;
}

.chat-msg .bubble {
    padding: 9px 13px;
    background: #fff;
    color: var(--text);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}
.chat-msg.me .bubble {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.25);
}

.chat-msg-time {
    font-size: 10px;
    color: var(--text-muted);
    margin: 0 4px 2px;
    letter-spacing: .02em;
}
.chat-msg.me .chat-msg-time { text-align: right; }

.chat-msg-seen {
    font-size: 10px;
    color: #34b7f1;
    letter-spacing: .02em;
}
.chat-msg.me .chat-msg-seen { text-align: right; }

/* Inline row that holds the timestamp + delete button — both live
   inside the body so the delete button always sits next to its
   message (no JS repaint needed for it to appear on a freshly
   arrived message). */
.chat-msg-foot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 2px 2px;
}
.chat-msg-foot .chat-msg-time { margin: 0; }

/* System messages */
.chat-msg.system { align-self: center; max-width: 85%; }
.chat-msg.system .bubble {
    background: var(--bg-2);
    border: 1px dashed var(--border);
    color: var(--text-muted);
    font-size: 12px;
    padding: 5px 14px;
    border-radius: 20px;
}
.chat-msg.system .bubble::before { content: '🤖 '; font-size: 11px; }
.chat-msg.system .chat-msg-time { display: none; }

/* ── Chat Context Menu (right-click delete) ──────────────── */
.chat-msg .chat-msg-body { cursor: context-menu; }

.chat-context-menu {
    position: fixed;
    z-index: 9999;
    background: #1e2535;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.45);
    padding: 5px 0;
    min-width: 150px;
    animation: chat-ctx-in .12s ease;
}
@keyframes chat-ctx-in {
    from { opacity: 0; transform: scale(.92) translateY(-4px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);   }
}
.chat-context-menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    color: #e2e8f0;
    font-size: 13px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .1s;
}
.chat-context-menu-item:hover { background: rgba(255,255,255,.08); }
.chat-context-menu-item:active { background: rgba(255,255,255,.14); }
.chat-context-menu-item.is-delete { color: #f87171; }
.chat-context-menu-item.is-delete:hover { background: rgba(248,113,113,.15); }
.chat-context-menu-item svg { flex-shrink: 0; }

/* ── Deleted message ghost ─────────────────────────────── */
.chat-msg.is-deleted { opacity: .38; }
.chat-msg.is-deleted .chat-msg-body { pointer-events: none; }
.chat-msg.is-deleted .bubble {
    font-style: italic;
    color: var(--text-muted);
}
.chat-msg.is-deleted .chat-msg-image img {
    filter: grayscale(1) blur(2px);
}

/* ── Delete button on each message ────────────────────── */

.chat-msg-delete {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.18);
    background: linear-gradient(145deg, #2a3344 0%, #1a1f2e 100%);
    color: #94a3b8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: .45;
    transition:
        opacity .15s ease,
        background .15s ease,
        color .15s ease,
        border-color .15s ease,
        transform .15s cubic-bezier(.34,1.56,.64,1),
        box-shadow .15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.06);
}
/* Always visible (dimmed) so freshly-arrived live messages can be
   deleted without a manual hover + reload. Hover/focus brings it
   to full opacity so it doesn't shout at idle users. */
.chat-msg:hover .chat-msg-delete,
.chat-msg-delete:focus-visible {
    opacity: 1;
}
.chat-msg-delete:hover {
    background: linear-gradient(145deg, #f87171 0%, #dc2626 100%);
    border-color: rgba(255,255,255,.25);
    color: #fff;
    transform: scale(1.12) rotate(8deg);
    opacity: 1;
    box-shadow:
        0 0 0 4px rgba(248,113,113,.25),
        0 4px 16px rgba(220,38,38,.45),
        inset 0 1px 0 rgba(255,255,255,.2);
}
.chat-msg-delete:active {
    transform: scale(.92) rotate(8deg);
}
.chat-msg-delete svg {
    transition: transform .2s ease;
}
.chat-msg-delete:hover svg {
    transform: scale(1.1);
}

/* Mobile screens */
@media (max-width: 480px) {
    .chat-msg-delete {
        width: 20px;
        height: 20px;
    }
}
.chat-msg-pending {
    color: var(--text-muted);
    font-size: 8px;
    margin-right: 4px;
    animation: chat-pending-pulse 1s infinite;
}
@keyframes chat-pending-pulse { 0%,100% { opacity: .3; } 50% { opacity: 1; } }
.chat-msg-failed {
    background: #ef4444; color: #fff;
    border-radius: 50%;
    width: 14px; height: 14px;
    font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
    margin-right: 4px;
}
.chat-msg.failed .bubble {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, .35), var(--shadow-sm);
}

/* ---- Attachment preview + input area ---- */
.chat-attach-preview {
    position: relative;
    padding: 8px 12px 0;
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.chat-attach-preview img {
    max-height: 110px;
    max-width: 110px;
    border-radius: 10px;
    border: 1px solid var(--border, #e5e7eb);
    display: block;
}
.chat-attach-remove {
    position: absolute;
    top: 4px; left: 100px;
    width: 22px; height: 22px;
    border: 0;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(239,68,68,.4);
    transition: transform .12s ease;
}
.chat-attach-remove:hover { transform: scale(1.08); }

.chat-input {
    display: flex; align-items: flex-end;
    gap: 8px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.06);
    transition: background .15s ease, box-shadow .15s ease;
}
.chat-input.chat-drop {
    background: #fff8f0;
    box-shadow: inset 0 0 0 2px var(--primary);
}

.chat-attach-btn,
.chat-send-btn {
    width: 40px; height: 40px;
    border: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform .12s ease, background .15s ease, opacity .15s ease;
}
.chat-attach-btn {
    background: #f1f2f6;
    color: var(--text-muted);
}
.chat-attach-btn:hover { background: #e5e7eb; color: var(--primary); }
.chat-attach-btn:active { transform: scale(.94); }

.chat-send-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 107, 0, 0.30);
}
.chat-send-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255,107,0,0.35); }
.chat-send-btn:active { transform: translateY(0) scale(.96); }
.chat-send-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.chat-input textarea {
    flex: 1 1 auto;
    min-height: 40px;
    max-height: 140px;
    padding: 10px 14px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 22px;
    outline: none;
    font-size: 14px;
    line-height: 1.4;
    font-family: inherit;
    resize: none;
    background: #f7f8fa;
    color: var(--text);
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.chat-input textarea::placeholder { color: var(--text-muted); }
.chat-input textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.12);
}

/* ---- Lightbox ---- */
.chat-lightbox {
    position: fixed; inset: 0;
    z-index: 500;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    padding: 24px;
    animation: chat-fade-in .15s ease;
}
/* `display: flex` above overrides the default `display: none` from the
   HTML `hidden` attribute. This explicit selector wins regardless of
   source order so the lightbox actually closes. */
.chat-lightbox[hidden] { display: none !important; }
@keyframes chat-fade-in { from { opacity: 0; } to { opacity: 1; } }
.chat-lightbox img {
    max-width: 100%;
    max-height: 78vh;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    background: #fff;
    cursor: zoom-out;
}
.chat-lightbox-caption {
    color: #fff;
    margin-top: 14px;
    text-align: center;
    font-size: 14px;
    max-width: 90vw;
    line-height: 1.5;
    word-break: break-word;
}
.chat-lightbox-close {
    position: absolute;
    top: 16px; right: 16px;
    width: 40px; height: 40px;
    border: 0; border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s ease;
    z-index: 1;
}
.chat-lightbox-close:hover { background: rgba(255,255,255,0.30); }

/* ---- Typing indicator (used by future typing signal) ---- */
.chat-typing {
    align-self: flex-start;
    display: inline-flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}
.chat-typing span {
    width: 6px; height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: chat-typing-bounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Responsive: hide avatar on very narrow screens */
@media (max-width: 360px) {
    .chat-msg-avatar { display: none; }
    .chat-msg { max-width: 92%; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .chat-msg, .chat-msg-pending { animation: none !important; }
    .chat-typing span { animation: none !important; }
}


/* ================================================================
   CEVA — Redesigned starting page
   Layout: header + scrollable content + sticky bottom CTA
   ================================================================ */

/* ── Page wrapper ──────────────────────────────────────────── */
.page-wrap {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg);
}

/* ── Header ────────────────────────────────────────────────── */
.home-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
    z-index: 10;
}
.header-left  { display: flex; align-items: center; gap: 10px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.header-username { font-weight: 600; font-size: 15px; line-height: 1.2; }
.header-user-info { display: flex; flex-direction: column; gap: 2px; }

.vip-badge-small {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.vip-badge-active {
    background: #fff8e6;
    color: #e67e22;
    border-color: #f5c518;
}

.header-icon-btn {
    position: relative;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: background 0.2s;
}
.header-icon-btn:hover { background: var(--bg); color: var(--text); }
.notif-dot {
    position: absolute; top: 4px; right: 4px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid #fff;
}

/* ── Language toggle ───────────────────────────────────────── */
.lang-toggle { position: relative; }
.lang-current {
    font-size: 12px; color: var(--text-muted);
    cursor: pointer; padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    white-space: nowrap;
    background: var(--bg);
}
.lang-current:hover { border-color: var(--primary); color: var(--primary); }
.lang-dropdown {
    position: absolute; top: calc(100% + 4px); right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 130px;
    z-index: 100;
    overflow: hidden;
}
.lang-opt {
    display: block; width: 100%;
    padding: 8px 14px;
    text-align: left; font-size: 13px;
    transition: background 0.15s;
}
.lang-opt:hover { background: var(--bg); }
.lang-opt.active { color: var(--primary); font-weight: 600; background: #fff8f0; }

/* ── Scrollable content ────────────────────────────────────── */
.home-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 80px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
}

/* ── Stats row ─────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 10px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.stat-card__icon {
    margin-bottom: 4px;
    opacity: 0.5;
}
.stat-card__value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
    font-family: ui-monospace, monospace;
}
.stat-card__label {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.3;
}
.stat-card--completed .stat-card__value { color: var(--success); }
.stat-card--earnings  .stat-card__value { color: var(--primary); }
.stat-card--today     .stat-card__value { color: var(--secondary); }

/* ── VIP progress card ────────────────────────────────────── */
.vip-progress-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.vip-card-top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}
.vip-ring-wrap {
    position: relative;
    width: 88px; height: 88px;
    flex-shrink: 0;
}
.vip-ring-svg { position: absolute; inset: 0; }
.vip-ring-center {
    position: absolute; inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}
.vip-ring-num {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    font-family: ui-monospace, monospace;
}
.vip-ring-denom {
    font-size: 11px;
    color: var(--text-muted);
    font-family: ui-monospace, monospace;
}
.vip-card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 2px;
}
.vip-card-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.vip-commission {
    color: var(--primary);
    font-weight: 600;
}
.vip-card-remaining {
    font-size: 12px;
    color: var(--text-muted);
}
.vip-progress-bar-wrap { margin-bottom: 10px; }
.vip-progress-bar-track {
    height: 8px;
    border-radius: 999px;
    background: #e8eaf0;
    overflow: hidden;
}
.vip-progress-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.6s ease;
}
.vip-progress-bar-fill.fill--complete {
    background: linear-gradient(90deg, var(--success), #4ade80);
}
.vip-card-tip {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* ── Balance strip ────────────────────────────────────────── */
.balance-strip {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: var(--radius);
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    gap: 12px;
}
.balance-item {
    flex: 1;
    text-align: center;
}
.balance-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.balance-value {
    font-size: 16px;
    font-weight: 700;
    font-family: ui-monospace, monospace;
}
.balance-value--avail { color: var(--success); }
.balance-value--frozen { color: var(--warning); }
.balance-divider {
    width: 1px; height: 32px;
    background: var(--border);
}

/* ── Bottom CTA footer ────────────────────────────────────── */
.home-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--border);
    z-index: 20;
}
.start-order-btn {
    width: 100%;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(255, 107, 0, 0.35);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.start-order-btn:active:not(:disabled) {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.3);
}
.start-order-btn--disabled {
    background: var(--border-strong);
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
}

/* ── Modal ────────────────────────────────────────────────── */
.modal[hidden] { display: none !important; }
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 50;
}
.modal-content {
    position: fixed; top: 40%; left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px 18px 16px;
    width: calc(100% - 32px);
    max-width: 380px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 51;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

/* Gộp các thuộc tính chung cho màn hình dưới 480px */
@media (max-width: 480px) {
    .modal-content {
        position: fixed; /* Hoặc absolute tùy thuộc vào layout của bạn */
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 48px);
        max-width: 100%;
        padding: 16px 14px 90px;
        overflow-y: auto;
        
        /* Cấu hình riêng cho màn hình từ 381px đến 480px */
        top: 10%;
        max-height: calc(100vh - 80px);
    }
}

/* Chỉ ghi đè các thuộc tính thay đổi cho màn hình dưới 380px */
@media (max-width: 380px) {
    .modal-content {
        top: 5px;
        max-height: calc(100vh - 160px);
        /* padding: 16px 14px 40px; */ /* Khuyên dùng: giảm padding bottom nếu màn hình quá nhỏ */
    }
}
.order-modal-content {
    max-width: 380px;
    padding: 18px 18px 16px;
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* ── Order Waiting Modal ──────────────────────────────────── */
.order-waiting-content {
    max-width: 300px;
    padding: 24px 20px 20px;
    text-align: center;
}
.order-waiting-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.order-waiting-icon {
    width: 80px;
    height: 80px;
}
.order-waiting-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.order-waiting-progress {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}
.order-waiting-progress-fill {
    width: 100%;
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    animation: waitingProgress 15s linear forwards;
}
@keyframes waitingProgress {
    from { width: 100%; }
    to { width: 0%; }
}
.modal-close {
    position: absolute; top: 12px; right: 12px;
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--bg);
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
}
.modal-title {
    font-size: 17px; font-weight: 700;
    margin: 0 36px 14px 0;
}

/* ── Order modal rows ──────────────────────────────────────── */
.order-card--modal {
    display: flex; flex-direction: column;
    gap: 0; border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.order-hero {
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
}
.order-hero img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Mobile: thu nhỏ order-hero */

.order-info { padding: 12px; }
.order-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.order-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; display: flex; gap: 6px; align-items: center; }
.order-meta code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.order-row {
    display: flex; justify-content: space-between;
    font-size: 12px; color: var(--text-muted);
    padding: 3px 0;
}
.order-row span { color: var(--text-muted); }
.order-row strong { color: var(--text); }
.order-row--total {
    font-size: 14px; font-weight: 700;
    color: var(--text);
    border-top: 1px dashed var(--border);
    margin-top: 4px; padding-top: 6px;
}

/* ── Modal actions ────────────────────────────────────────── */
.modal-actions {
    display: flex; gap: 10px;
    margin-top: 4px;
}
.btn-primary {
    flex: 1; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; font-weight: 700; font-size: 15px;
    box-shadow: 0 2px 8px rgba(255,107,0,0.3);
    border: none; cursor: pointer;
    transition: transform 0.15s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
    flex: 1; height: 44px;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text); font-weight: 600; font-size: 15px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}
.btn-secondary:active { background: var(--border); }

.btn-primary:disabled,
.btn-secondary:disabled,
.btn:disabled,
.btn[disabled] {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 32px 0; color: var(--text-muted); font-size: 14px; }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.inline-icon  { vertical-align: middle; }

/* ── Badge variants ────────────────────────────────────────── */
.badge-pending   { background:#fff3e0; color:#e67e22; }
.badge-published { background:#e8f5e9; color:#2eb867; }
.badge-archived  { background:#f5f5f5; color:#9e9e9e; }
.badge-draft     { background:#e3f2fd; color:#1976d2; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 400px) {
    .stats-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .stat-card__value { font-size: 15px; }
    .stat-card__label { font-size: 9px; }
}

/* ── Hero CTA: badge "có đơn chờ" gắn trên nút Bắt đầu ──────── */

.cta-pending-badge {
    position: absolute;
    top: -6px; right: -6px;
    min-width: 22px; height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 12px; font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    border: 2px solid #fff;
}

/* Nút hero-cta đã position:fixed ở rule .hero-cta phía trên; chỉ cần
   relative cho badge bên trong, nên giữ nguyên fixed (bỏ override này). */
.hero-cta { position: fixed; }

/* ── Recharge Modal ───────────────────────────────────────── */
/* ── 1. Thẻ cha bao bọc toàn màn hình (Modal Overlay Wrapper) ── */
.modal,
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important; /* Đảm bảo nổi lên trên cùng */
    pointer-events: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── 2. Nội dung chính của Modal (Recharge Modal Content) ── */
.recharge-modal-content {
    position: relative !important;
    max-width: 460px !important;
    width: calc(100% - 32px) !important;
    max-height: 90vh !important;
    overflow-y: auto !important; /* Tránh tràn màn hình trên mobile */
    padding: 0 !important;
    border-radius: 16px !important;
    z-index: 10000 !important;
    background: #fff !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    pointer-events: auto !important;
    /* Xóa bỏ các thuộc tính margin hoặc transform cũ làm lệch vị trí */
    margin: auto !important; 
    transform: none !important;
}
.recharge-modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    position: relative;
}
.recharge-modal-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.recharge-modal-head h3 {
    margin: 0;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
}
.recharge-modal-sub {
    margin: 4px 0 0;
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    line-height: 1.4;
}
.recharge-modal-head .modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.recharge-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.recharge-amount-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border: 2px solid var(--border, #e2e8f0);
    border-radius: 12px;
    padding: 0 14px;
    background: #fff;
    transition: border-color 0.2s;
}
.recharge-amount-wrap:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.recharge-amount-prefix {
    font-size: 22px;
    font-weight: 700;
    color: #10b981;
    margin-right: 6px;
}
.recharge-amount-input {
    border: 0 !important;
    background: transparent !important;
    flex: 1;
    padding: 12px 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    color: #0f172a;
    outline: none;
    box-shadow: none !important;
    height: 48px;
}
.recharge-methods {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.recharge-method {
    cursor: pointer;
    display: block;
}
.recharge-method input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.recharge-method-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    transition: all 0.2s;
}
.recharge-method input[type="radio"]:checked + .recharge-method-card {
    border-color: #10b981;
    background: #ecfdf5;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.recharge-method-icon {
    font-size: 22px;
    line-height: 1;
}
.recharge-method-label {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}
.recharge-quick {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 0;
}
.recharge-quick .chip {
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #0f172a;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
}
.recharge-quick .chip:hover {
    background: #ecfdf5;
    border-color: #10b981;
    color: #047857;
}
.recharge-modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}
.recharge-modal-actions button {
    min-width: 110px;
    height: 44px;
    border-radius: 10px;
    font-weight: 700;
}
.recharge-modal-actions .btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}
.recharge-modal-actions .btn-primary:hover {
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4) !important;
}

/* ── VIP Progress Card (client profile) ───────────────────── */
.vip-progress-card {
    background: linear-gradient(135deg, #fef9c3 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 14px;
    padding: 14px 16px;
    margin: 12px 16px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.vip-progress-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.vip-progress-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
}
.vip-progress-text { flex: 1; min-width: 0; }
.vip-progress-title {
    font-size: 13px;
    font-weight: 700;
    color: #78350f;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.vip-progress-title .badge {
    font-size: 10px;
    padding: 1px 8px;
}
.vip-progress-sub {
    font-size: 11px;
    color: #92400e;
    margin-top: 3px;
    line-height: 1.4;
}
.vip-progress-bar {
    height: 8px;
    background: rgba(255,255,255,0.55);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 10px;
}
.vip-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b 0%, #ea580c 100%);
    border-radius: 999px;
    transition: width 0.5s ease;
}
.vip-progress-foot {
    margin-top: 6px;
    font-size: 11px;
    color: #78350f;
}

/* ── Profile cover banner polish ──────────────────────────── */
.profile-cover {
    position: relative;
    height: 120px;
    background: linear-gradient(135deg, #1e40af 0%, #7c3aed 100%);
    background-size: cover;
    background-position: center;
}
.profile-cover-title {
    color: #fff;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.header-icon {
    color: #fff;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: background 0.15s;
}
.header-icon:hover { background: rgba(255,255,255,0.3); }
.profile-cover-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
}

/* ── VIP Info Bar (starting page) ─────────────────────────── */
.vip-info-bar {
    margin: 12px 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #38bdf8;
    border-radius: 14px;
    padding: 12px 14px;
}
.vip-info-bar-inner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.vip-info-bar-icon {
    font-size: 22px;
    line-height: 1;
    background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.vip-info-bar-text { flex: 1; min-width: 0; }
.vip-info-bar-title {
    font-size: 13px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.vip-info-bar-title strong { font-weight: 700; }
.vip-info-bar-title .badge {
    font-size: 10px;
    padding: 1px 8px;
}
.vip-info-bar-sub {
    font-size: 11px;
    color: #475569;
    margin-top: 3px;
    line-height: 1.45;
}
.vip-info-bar-sub a {
    color: #0ea5e9;
    font-weight: 700;
    text-decoration: none;
}
.vip-info-bar-sub a:hover { text-decoration: underline; }
.vip-info-bar-progress {
    height: 6px;
    background: rgba(255,255,255,0.7);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 8px;
}
.vip-info-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0ea5e9 0%, #0284c7 100%);
    border-radius: 999px;
    transition: width 0.4s ease;
}

/* ── Freeze Banner (starting page) ─────────────────────────
   Hiện khi admin đóng băng 1 phần đơn pending của user. Dùng
   tone đỏ-cam để báo "bị khóa", đối lập với VIP bar tone xanh. */
.freeze-banner {
    margin: 12px 16px 0;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe4e4 100%);
    border: 1px solid #fca5a5;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 4px 14px rgba(192, 57, 43, 0.08);
}
.freeze-banner-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.freeze-banner-icon {
    font-size: 22px;
    line-height: 1;
    background: linear-gradient(135deg, #ef4444 0%, #c0392b 100%);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}
.freeze-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: #991b1b;
    margin: 0;
}
.freeze-banner-hint {
    font-size: 11px;
    color: #7f1d1d;
    margin: 4px 0 0;
    line-height: 1.5;
}
.freeze-banner-stats {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.freeze-banner-stats li {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(252, 165, 165, 0.6);
    border-radius: 10px;
    padding: 8px 10px;
    text-align: center;
}
.freeze-banner-label {
    display: block;
    font-size: 10px;
    color: #7f1d1d;
    line-height: 1.3;
    margin-bottom: 2px;
}
.freeze-banner-num {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #991b1b;
    line-height: 1.2;
}
.freeze-banner-num--money {
    font-variant-numeric: tabular-nums;
}
@media (max-width: 360px) {
    .freeze-banner-stats {
        grid-template-columns: 1fr;
    }
}


/* Full screen loader — pointer-events:none từ đầu để user có thể
   thao tác ngay khi trang đã render dù JS chưa chạy.
   Class .hide chỉ dùng để transition opacity, không còn block events. */
#page-loader {
    position: fixed;
    inset:0;
    z-index:999999;
    background:#ffffff;
    display:flex;
    align-items:center;
    justify-content:center;
    pointer-events: none;  /* ← Luôn xuyên click được */
    transition:
        opacity .5s ease,
        visibility .5s ease;
}

/* Transition mượt khi ẩn loader (opacity + visibility),
   pointer-events:none đã set ở trên nên KHÔNG còn block click. */
#page-loader.hide {
    opacity:0;
    visibility:hidden;
}


/* vòng tròn loading */

.loader-circle {

    width:70px;

    height:70px;

    border-radius:50%;

    border:6px solid rgba(255,120,30,.15);

    border-top-color:#ff7a2f;

    animation:
        spinLoader 1s linear infinite;

}


/* ánh sáng bên ngoài */

.loader-circle::after {

    content:"";

    position:absolute;

    width:90px;

    height:90px;

    border-radius:50%;

    background:
    radial-gradient(
        circle,
        rgba(255,120,30,.25),
        transparent 70%
    );

    animation:pulseLoader 1.5s infinite;

}


@keyframes spinLoader {

    from{
        transform:rotate(0deg);
    }

    to{
        transform:rotate(360deg);
    }

}


@keyframes pulseLoader {

    0%{
        transform:scale(.8);
        opacity:.5;
    }

    100%{
        transform:scale(1.4);
        opacity:0;
    }

}


/* ==========================================================
   Event popup dialog (Thông báo sự kiện)
   ----------------------------------------------------------
   - Overlay (.event-mask) riêng, đậm hơn .modal thường.
   - Content tự co giãn theo chiều dài content + viewport:
       max-width  : giới hạn trên PC
       width      : responsive theo container
       max-height : giới hạn viewport, body trong dialog scrollable
   - Slider dùng <img> + object-fit:contain để hiện TOÀN BỘ ảnh
     (kể cả ảnh dọc/ngang khác tỉ lệ), không crop.
   ========================================================== */
.event-modal {
    z-index: 220; /* cao hơn .modal thường (200) */
}
/* Event-modal cũng phải tôn trọng safety: pointer-events:none mặc định.
   Khi event popup open() thì class `is-ready` được add → bật click. */
.event-modal:not(.is-ready) { pointer-events: none; }
.event-modal[hidden] { display: none; }

.event-mask {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    animation: eventMaskIn .2s ease;
}
@keyframes eventMaskIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Shell: auto co giãn theo content, có cap theo viewport */
.event-modal-inner {
    top: -10%;
    position: relative;
    /* Responsive width: mobile full-width (trừ padding), PC max 420px */
    width: calc(100% - 24px);
    max-width: 340px;
    /* Cap chiều cao theo viewport để luôn vừa màn hình */
    max-height: calc(100vh - 60px);
    /* Cho phép tự co khi content ngắn, dài thì scroll bên trong */
    display: flex;
    flex-direction: column;
    background: var(--card, #fff);
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 20px 50px rgba(0,0,0,.35);
    overflow: hidden;
    animation: modalIn .25s ease;
}

.event-modal-close {
    position: absolute;
    top: 10px; right: 10px;
    z-index: 3;
    width: 34px; height: 34px;
    border: 0;
    background: rgba(0,0,0,0.45);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, transform .15s;
    backdrop-filter: blur(4px);
}
.event-modal-close:hover { background: rgba(0,0,0,0.65); transform: scale(1.05); }

/* ─── Slider ───
   Dùng <img> bên trong .event-slide để giữ tỉ lệ + object-fit:contain
   để ảnh dọc/ngang khác tỉ lệ đều hiển thị đầy đủ, không crop.
*/
.event-slider {
    position: relative;
    width: 100%;
    /* Không ép aspect-ratio cứng nữa — chiều cao do ảnh quyết định */
    background: #0f172a;
    flex-shrink: 0; /* không bị nén khi dialog quá ngắn */
}
.event-slides {
    position: relative;
    width: 100%;
}
.event-slide {
    display: none;       /* chỉ slide active mới render → giảm DOM */
    width: 100%;
    text-align: center;
}
.event-slide.is-active {
    display: block;
    animation: eventSlideIn .3s ease;
}
@keyframes eventSlideIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.event-slide img {
    display: block;
    width: 100%;
    height: auto;        /* giữ aspect ratio gốc → ảnh cao/ngang đều OK */
    max-height: 60vh;    /* cap khi ảnh quá dài, tránh chiếm hết dialog */
    object-fit: contain; /* hiện toàn bộ ảnh, không crop */
    background: #0f172a;
}

.event-dots {
    position: absolute;
    bottom: 10px; left: 0; right: 0;
    display: flex; justify-content: center; gap: 6px;
    z-index: 2;
}
.event-dots span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.55);
    transition: background .15s, transform .15s;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.event-dots span.is-active {
    background: #fff;
    transform: scale(1.25);
}

/* ─── Body (text + summary + body) ───
   min-height: 0 để flex con co giãn đúng + cho phép scroll nội bộ
   khi text quá dài.
*/
.event-modal-body {
    padding: 18px 20px 4px;
    overflow-y: auto;
    min-height: 0;       /* quan trọng: để flex con scroll được */
    -webkit-overflow-scrolling: touch;
}
.event-modal-eyebrow {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: var(--primary, #0ea5e9);
    background: var(--primary-soft, #e0f2fe);
    padding: 3px 8px;
    border-radius: 999px;
    margin-bottom: 8px;
}
.event-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text, #0f172a);
    line-height: 1.35;
    margin: 0 0 8px;
}
.event-modal-summary {
    font-size: 14px;
    color: var(--text-muted, #64748b);
    line-height: 1.55;
    margin-bottom: 10px;
}
.event-modal-text {
    font-size: 13.5px;
    color: var(--text, #0f172a);
    line-height: 1.6;
    word-wrap: break-word;     /* chống tràn khi URL dài */
    overflow-wrap: break-word;
}
.event-modal-text p { margin: 0 0 10px; }
.event-modal-text p:last-child { margin-bottom: 0; }
.event-modal-text strong { font-weight: 700; }
.event-modal-text a {
    color: var(--primary, #0ea5e9);
    text-decoration: underline;
    word-break: break-all;
}

/* List event phụ (pill) */
.event-modal-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0 4px;
}
.event-pill {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 12px;
    background: var(--bg, #f8fafc);
    color: var(--text, #0f172a);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.event-pill:hover { background: var(--primary-soft, #e0f2fe); color: var(--primary-dark, #0284c7); text-decoration: none; }

/* Footer */
.event-modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--border, #e2e8f0);
    background: var(--bg, #f8fafc);
    flex-shrink: 0;        /* footer luôn hiển thị, không bị body đẩy ra */
}
.event-modal-foot .btn { padding: 6px 14px; }

/* Khóa scroll body khi dialog mở */
body.event-modal-open { overflow: hidden; }

/* ─── Responsive ─── */

/* Tablet: dialog vẫn căn giữa, nhỏ lại */
@media (max-width: 768px) {
    .event-modal { padding: 12px; }
    .event-modal-inner { max-width: 380px; }
}

/* Mobile: bottom-sheet style, full-width, cao tối đa 92vh */
@media (max-width: 480px) {
    .event-modal {
        align-items: flex-end;
        padding: 0;
    }
    .event-modal-inner {
        width: 70%;
        max-width: 100%;
        border-radius: 18px 18px 0 0;
        max-height: 70vh;
    }
    .event-modal-close {
        top: 8px; right: 8px;
    }
    .event-modal-body {
        padding: 16px 16px 4px;
    }
    .event-modal-title { font-size: 17px; }
    .event-slide img { max-height: 50vh; }
}

/* PC nhỏ: dialog vẫn gọn */
@media (min-width: 1024px) {
    .event-modal-inner { max-width: 340px; }
}


/* ─── Site footer (client layout) ─── */
.app-footer {
    margin-top: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-top: 1px solid var(--border, #e5e7eb);
    color: #4b5563;
    font-size: 13px;
    line-height: 1.55;
}
.app-footer-inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.2fr;
    gap: 20px;
    padding: 22px 18px 16px;
}
.app-footer-col { min-width: 0; }
.app-footer-title {
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.app-footer-brand-row {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 10px;
}
.app-footer-logo {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--border, #e5e7eb);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; flex-shrink: 0;
}
.app-footer-logo img { width: 100%; height: 100%; object-fit: contain; }
.app-footer-logo-fallback { font-size: 20px; }
.app-footer-brand-text b {
    display: block;
    color: #111827;
    font-size: 14px;
    line-height: 1.2;
}
.app-footer-brand-text small {
    display: block;
    color: #6b7280;
    font-size: 11px;
    margin-top: 2px;
}
.app-footer-desc {
    margin: 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.6;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    writing-mode: horizontal-tb;
    max-width: 600px;
    width: 100%;
}

/* PC: app-footer-desc nằm dưới app-footer-brand-row, dài như mobile */
@media (min-width: 769px) {
    .app-footer-inner {
        grid-template-columns: 1fr 1fr 1fr 1fr !important;
    }
    .app-footer-brand {
        grid-column: 1 / -1 !important;
    }
    .app-footer-desc {
        max-width: none;
        white-space: normal;
    }
}
.app-footer-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 6px;
}
.app-footer-list a {
    color: #4b5563;
    text-decoration: none;
    transition: color .15s;
    font-size: 12.5px;
}
.app-footer-list a:hover { color: var(--primary, #ff6b00); }

/* Support channels: small pill with icon */
.app-footer-list--channels { gap: 6px; }
.app-footer-channel {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151 !important;
    font-size: 12px;
    font-weight: 500;
    transition: background .15s, color .15s, transform .15s;
    max-width: 100%;
}
.app-footer-channel:hover { background: var(--primary, #ff6b00); color: #fff !important; transform: translateY(-1px); }
.app-footer-channel-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    color: var(--primary, #ff6b00);
    font-size: 10px; font-weight: 700;
    flex-shrink: 0;
}
.app-footer-channel--zalo     .app-footer-channel-icon { color: #0068ff; }
.app-footer-channel--telegram .app-footer-channel-icon { color: #229ed9; }
.app-footer-channel--hotline  .app-footer-channel-icon { color: #ea4335; }
.app-footer-channel:hover .app-footer-channel-icon { color: #fff; background: rgba(255,255,255,.25); }

/* Contact column: label trên / value dưới */
.app-footer-list--contact { gap: 10px; }
.app-footer-list--contact li { display: flex; flex-direction: column; gap: 2px; }
.app-footer-contact-label {
    font-size: 11px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.app-footer-contact-value {
    color: #374151;
    font-size: 12.5px;
    text-decoration: none;
    word-break: break-word;
}
a.app-footer-contact-value:hover { color: var(--primary, #ff6b00); }

/* Company info column (HTML allowed) */
.app-footer-company-info {
    font-size: 12px;
    color: #374151;
    line-height: 1.7;
    word-break: break-word;
}
.app-footer-company-info p { margin: 0 0 6px; }
.app-footer-company-info strong { color: #111827; }
.app-footer-company-info a { color: var(--primary, #ff6b00); }

/* Bottom strip */
.app-footer-bottom {
    border-top: 1px solid var(--border, #e5e7eb);
    padding: 10px 18px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
    background: #fff;
}
.app-footer-copyright {
    font-size: 11.5px;
    color: #9ca3af;
}
.app-footer-legal { display: inline-flex; align-items: center; gap: 6px; }
.app-footer-legal a {
    font-size: 11.5px;
    color: #6b7280;
    text-decoration: none;
    transition: color .15s;
}
.app-footer-legal a:hover { color: var(--primary, #ff6b00); }
.app-footer-legal-sep { color: #d1d5db; font-size: 11.5px; }

/* Responsive: chuyển sang 2 cột / 1 cột trên mobile hẹp */
@media (max-width: 480px) {
    .app-footer-inner {
        grid-template-columns: 1fr 1fr;
        gap: 18px;
        padding: 18px 14px 12px;
    }
    .app-footer-brand { grid-column: 1 / -1; }
    .app-footer-bottom { padding: 10px 14px; }
}
@media (max-width: 320px) {
    .app-footer-inner { grid-template-columns: 1fr; }
}


/* ─── Pagination (user-facing: /history, /transactions) ─── */
.client-pagination {
    margin: 14px 16px 24px;
}
.client-pagination .pagination-info {
    color: #6b7280;
    font-size: 12px;
    text-align: center;
    margin-bottom: 8px;
}
.client-pagination .pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}
.client-pagination .pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.client-pagination .pagination a:hover:not(.disabled):not(.active) {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #3b82f6;
}
.client-pagination .pagination a.active {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}
.client-pagination .pagination a.disabled,
.client-pagination .pagination span.disabled {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
    background: #f5f5f5;
}
