﻿:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --primary-bg: #f5f3ff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f8fafc;
    --white: #ffffff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow: 0 4px 24px rgba(124, 58, 237, 0.08);
    --radius: 12px;
    --content-max: 1680px;
    --page-padding: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
.container {
    width: min(96%, var(--content-max));
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--page-padding);
}

.main-content { width: 100%; }
.top-nav {
    width: 100%;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.nav-inner {
    display: flex; align-items: center; min-height: 64px; gap: 16px; padding: 8px 0; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand-icon {
    width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.main-menu { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; align-items: center; }
.main-menu a {
    padding: 6px 12px; border-radius: 8px; color: var(--text-muted); font-weight: 500;
    transition: all .2s; font-size: 13px; white-space: nowrap;
}
.main-menu a:hover, .main-menu a.active { background: var(--primary-bg); color: var(--primary); }
.nav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-collapse { display: flex; flex: 1; align-items: center; gap: 16px; min-width: 0; }
.nav-toggle {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    width: 40px; height: 40px; padding: 8px; border: 1px solid var(--border);
    border-radius: 10px; background: var(--white); cursor: pointer; flex-shrink: 0;
}
.nav-toggle span {
    display: block; width: 100%; height: 2px; background: var(--text);
    border-radius: 2px; transition: transform .2s, opacity .2s;
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-overlay {
    display: none; position: fixed; inset: 0; top: 56px;
    background: rgba(15, 23, 42, 0.45); z-index: 90;
}
body.nav-open .nav-overlay { display: block; }
.balance-chip {
    background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e;
    padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
    text-decoration: none; transition: opacity .2s;
}
.balance-chip:hover { opacity: 0.9; color: #92400e; }
.username { font-size: 14px; color: var(--text-muted); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
    font-size: 14px; font-weight: 500; transition: all .2s; gap: 6px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: white; border: 1px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-bg); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-hero-outline {
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.45);
    color: #fff; backdrop-filter: blur(4px);
}
.btn-hero-outline:hover { background: rgba(255,255,255,0.25); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* Hero */
.hero-banner {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 50%, #c084fc 100%);
    border-radius: var(--radius); padding: 40px; margin: 24px 0; color: white;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px;
}
.hero-text h1 { font-size: 28px; margin-bottom: 8px; }
.hero-text p { opacity: 0.9; }
.hero-stats { display: flex; gap: 32px; }
.hero-stat { text-align: center; }
.hero-stat strong { display: block; font-size: 28px; }
.hero-stat span { font-size: 13px; opacity: 0.85; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card {
    background: white; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}
.stat-card.purple { border-color: #7c3aed; }
.stat-card.blue { border-color: #3b82f6; }
.stat-card.green { border-color: #10b981; }
.stat-card.orange { border-color: #f59e0b; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; }

/* Panel */
.panel {
    background: white; border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 24px; overflow: hidden;
}
.panel-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.panel-header h2 { font-size: 18px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.panel-desc { padding: 16px 24px 0; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.media-cache-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 20px 24px 24px; }
.media-cache-card {
    border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; background: #fafafa;
}
.media-cache-title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.media-cache-count { font-size: 24px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.media-cache-meta { font-size: 13px; color: var(--text-muted); line-height: 1.7; }
.sync-tip {
    margin: 0 24px 20px; padding: 12px 16px; border-radius: 8px;
    background: #fff7ed; color: #c2410c; font-size: 14px;
}
.dashboard-section { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.chart-box { height: 320px; padding: 16px; }
.chart-screen { background: linear-gradient(180deg, #faf5ff, #ffffff); }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 40px; }
.action-card {
    background: white; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s; color: var(--text);
}
.action-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(124,58,237,0.15); }
.action-icon {
    width: 48px; height: 48px; background: var(--primary-bg); color: var(--primary);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; margin-bottom: 12px;
}
.action-card h3 { font-size: 16px; margin-bottom: 6px; }
.action-card p { font-size: 13px; color: var(--text-muted); }

/* Media page */
.page-title-bar { padding: 24px 0 16px; }
.page-title-bar h1 { font-size: 24px; margin-bottom: 4px; }
.page-title-bar p { color: var(--text-muted); font-size: 14px; }

.filter-panel {
    background: white; border-radius: var(--radius); padding: 20px 24px;
    box-shadow: var(--shadow); margin-bottom: 16px;
}
.filter-row { display: flex; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.filter-row:last-child { border-bottom: none; }
.filter-label { width: 90px; flex-shrink: 0; font-size: 13px; color: var(--text-muted); padding-top: 6px; font-weight: 500; }
.filter-tags { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.filter-tag {
    padding: 4px 14px; border-radius: 6px; font-size: 13px; cursor: pointer;
    background: #f3f4f6; color: var(--text); border: 1px solid transparent; transition: all .15s;
}
.filter-tag:hover { border-color: var(--primary-light); }
.filter-tag.active { background: var(--primary); color: white; }
.filter-empty { padding: 20px; color: var(--text-muted); text-align: center; }

.search-bar {
    display: flex; gap: 12px; margin-bottom: 20px;
}
.search-bar input {
    flex: 1; padding: 12px 16px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.search-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }

/* Media list - 妯悜鍒楄〃鏍峰紡锛堝弬鑰冨浘2锛?*/
.media-list {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.media-item {
    border-bottom: 1px solid #f0f0f0;
    padding: 0;
}
.media-item:last-child { border-bottom: none; }
.media-row {
    display: flex;
    align-items: center;
    padding: 18px 20px;
    gap: 12px;
    min-height: 72px;
}
.media-col { flex-shrink: 0; }
.media-col-name { width: 140px; min-width: 120px; }
.media-col-cat { width: 100px; min-width: 90px; }
.media-col-weight { width: 100px; }
.media-col-stat { width: 90px; text-align: center; }
.media-col-price { width: 80px; text-align: center; }
.media-col-actions { width: 72px; margin-left: auto; }

.media-name-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.media-name {
    font-size: 14px; font-weight: 600;
    background: #1f2937; color: #fff;
    padding: 6px 12px; border-radius: 6px;
    display: inline-block; max-width: 120px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.media-case-btn {
    font-size: 12px; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 4px;
    padding: 2px 8px; background: #fafafa;
    transition: all .15s;
}
.media-case-btn:hover { color: var(--primary); border-color: var(--primary); }

.cat-primary { font-size: 13px; color: #2563eb; font-weight: 500; line-height: 1.4; }
.cat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.weight-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: #eff6ff; color: #2563eb;
    padding: 4px 8px; border-radius: 4px;
    font-size: 12px; font-weight: 500; white-space: nowrap;
}
.weight-badge.weight-empty { background: #f9fafb; color: #d1d5db; }
.weight-icon { flex-shrink: 0; }

.media-col-stat strong {
    display: block; font-size: 14px; font-weight: 600; color: #111827;
    line-height: 1.3;
}
.media-col-stat span {
    display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px;
}

.media-price {
    display: inline-block;
    background: #fff1f2; color: #e11d48;
    padding: 8px 14px; border-radius: 6px;
    font-size: 18px; font-weight: 700; line-height: 1;
}
.media-price em { font-style: normal; font-size: 14px; }
.media-price small { font-size: 12px; font-weight: 500; margin-left: 1px; }

.media-col-actions { display: flex; flex-direction: column; gap: 6px; }
.btn-submit {
    width: 100%; padding: 7px 0; border: none; border-radius: 6px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: white; font-size: 13px; font-weight: 500; cursor: pointer;
    transition: opacity .2s;
}
.btn-submit:hover { opacity: 0.9; }
.btn-fav {
    width: 100%; padding: 6px 0; border-radius: 6px;
    background: white; border: 1px solid var(--primary);
    color: var(--primary); font-size: 13px; cursor: pointer;
    transition: all .15s;
}
.btn-fav:hover, .btn-fav.favorited { background: var(--primary-bg); }

.media-remarks {
    padding: 10px 20px 14px;
    font-size: 12px; color: #9ca3af; line-height: 1.6;
    border-top: 1px dashed #f0f0f0;
    margin: 0;
}

.loading-state, .empty-state {
    text-align: center; padding: 60px; color: var(--text-muted);
    background: white; border-radius: var(--radius);
}

.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 24px 0; flex-wrap: wrap; }
.page-btn {
    padding: 8px 14px; border: 1px solid var(--border); background: white;
    border-radius: 6px; cursor: pointer; font-size: 13px;
}
.page-btn.active, .page-btn:hover:not(:disabled) { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.page-ellipsis { color: var(--text-muted); padding: 0 4px; font-size: 13px; }
.page-info { font-size: 13px; color: var(--text-muted); margin-left: 8px; }

/* Profile */
.profile-page { display: grid; grid-template-columns: 240px 1fr; gap: 24px; padding: 24px 0; }
.profile-card { background: white; border-radius: var(--radius); padding: 24px; text-align: center; box-shadow: var(--shadow); margin-bottom: 16px; }
.profile-avatar {
    width: 64px; height: 64px; background: var(--primary); color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 24px; margin: 0 auto 12px;
}
.profile-balance { font-size: 24px; font-weight: 700; color: var(--primary); margin-top: 8px; }
.profile-nav { background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.profile-nav a {
    display: block; padding: 14px 20px; color: var(--text-muted); border-left: 3px solid transparent;
}
.profile-nav a:hover, .profile-nav a.active { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }

.recharge-section { padding: 24px; }
.balance-display { text-align: center; padding: 32px; background: var(--primary-bg); border-radius: var(--radius); margin-bottom: 24px; }
.balance-display strong { display: block; font-size: 36px; color: var(--primary); margin-top: 8px; }
.form-inline { display: flex; gap: 12px; margin: 16px 0; }
.form-inline input { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { background: #f9fafb; font-weight: 600; color: var(--text-muted); font-size: 13px; }
.data-table .empty { text-align: center; color: var(--text-muted); padding: 40px; }
.filter-inline { display: flex; gap: 12px; padding: 16px 24px; flex-wrap: wrap; }
.filter-inline select, .filter-inline input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; }
.admin-filter-inline { padding: 0 0 20px; }
.dash-code { font-size: 12px; background: #f1f5f9; padding: 2px 6px; border-radius: 4px; }

/* Badges */
.badge { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-default { background: #f3f4f6; color: #4b5563; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.price-input { color: #dc2626 !important; font-weight: 700; font-size: 18px !important; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: white; border-radius: var(--radius); width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal-lg { max-width: 720px; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }
.modal-content form { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding-top: 16px; }

/* Premium Recharge Modal */
.recharge-modal { background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(8px); padding: 24px; }
.recharge-modal-panel {
    width: 100%; max-width: 480px; background: #fff; border-radius: 20px;
    box-shadow: 0 32px 64px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(255,255,255,0.06);
    overflow: hidden; animation: rechargeSlideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes rechargeSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.recharge-modal-hero {
    position: relative; padding: 28px 28px 24px;
    background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 45%, #7c3aed 100%);
    color: #fff; text-align: center;
}
.admin-sidebar-platform ~ .admin-main .recharge-modal-hero,
.recharge-modal-hero.platform {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%);
}
.recharge-modal-close {
    position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
    border: none; border-radius: 10px; background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9); font-size: 22px; line-height: 1; cursor: pointer;
    transition: background 0.2s;
}
.recharge-modal-close:hover { background: rgba(255,255,255,0.22); }
.recharge-modal-icon {
    width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px;
    background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center;
    font-size: 22px; backdrop-filter: blur(4px);
}
.recharge-modal-tag {
    display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 11px;
    font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.85); margin-bottom: 10px;
}
.recharge-modal-hero h3 { font-size: 22px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.02em; }
.recharge-modal-hero p { font-size: 14px; color: rgba(255,255,255,0.78); margin: 0; }
.recharge-modal-body { padding: 24px 28px 8px; }
.recharge-balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.recharge-balance-grid.single { grid-template-columns: 1fr; }
.recharge-balance-card {
    padding: 16px; border-radius: 14px; background: #f8fafc;
    border: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 4px;
}
.recharge-balance-card.source {
    background: linear-gradient(145deg, #f5f3ff, #ede9fe);
    border-color: #ddd6fe;
}
.recharge-balance-label { font-size: 12px; color: #64748b; font-weight: 500; }
.recharge-balance-value { font-size: 22px; font-weight: 700; color: #0f172a; letter-spacing: -0.02em; }
.recharge-balance-card.source .recharge-balance-value { color: #6d28d9; }
.recharge-balance-name { font-size: 12px; color: #94a3b8; }
.recharge-balance-hint { font-size: 11px; color: #7c3aed; margin-top: 2px; }
.recharge-field-label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 10px; }
.recharge-amount-block { margin-bottom: 20px; }
.recharge-amount-input-wrap {
    display: flex; align-items: center; gap: 4px; padding: 4px 16px;
    border: 2px solid #e2e8f0; border-radius: 14px; background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.recharge-amount-input-wrap:focus-within {
    border-color: #7c3aed; box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}
.recharge-currency { font-size: 28px; font-weight: 700; color: #94a3b8; line-height: 1; }
.recharge-amount-input-wrap input {
    flex: 1; border: none; outline: none; padding: 14px 0; font-size: 32px;
    font-weight: 700; color: #0f172a; background: transparent; letter-spacing: -0.02em;
}
.recharge-amount-input-wrap input::placeholder { color: #cbd5e1; font-weight: 500; }
.recharge-quick-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.recharge-quick-btn {
    padding: 8px 16px; border-radius: 999px; border: 1px solid #e2e8f0;
    background: #fff; font-size: 13px; font-weight: 600; color: #475569; cursor: pointer;
    transition: all 0.18s;
}
.recharge-quick-btn:hover { border-color: #c4b5fd; color: #6d28d9; background: #faf5ff; }
.recharge-quick-btn.active { border-color: #7c3aed; background: #7c3aed; color: #fff; }
.recharge-hint { font-size: 12px; color: #94a3b8; margin-top: 10px; }
.recharge-remark-block { margin-bottom: 8px; }
.recharge-remark-block input {
    width: 100%; padding: 12px 16px; border: 1px solid #e2e8f0; border-radius: 12px;
    font-size: 14px; transition: border-color 0.2s;
}
.recharge-remark-block input:focus { outline: none; border-color: #7c3aed; }
.recharge-modal-footer {
    display: flex; gap: 12px; padding: 16px 28px 28px;
}
.recharge-modal-footer .recharge-btn-cancel { flex: 1; padding: 12px; border-radius: 12px; }
.recharge-btn-submit {
    flex: 2; padding: 12px 20px; border: none; border-radius: 12px; cursor: pointer;
    background: linear-gradient(135deg, #6d28d9, #7c3aed); color: #fff;
    font-size: 15px; font-weight: 600; box-shadow: 0 8px 24px rgba(109, 40, 217, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.recharge-btn-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(109, 40, 217, 0.42); }
.recharge-btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Auth */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}
.auth-card {
    background: white; border-radius: 16px; padding: 40px; width: 100%; max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.auth-card h1 { font-size: 24px; margin-bottom: 8px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

.text-muted { color: var(--text-muted); font-size: 13px; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.link { color: var(--primary); }
.price-cell { color: #dc2626; font-weight: 600; }
.views-count { color: var(--primary); font-size: 16px; }

.site-footer { text-align: center; padding: 24px; color: var(--text-muted); font-size: 13px; border-top: 1px solid var(--border); margin-top: 40px; }

/* Admin */
.admin-body { background: #eef2f7; }
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 260px; flex-shrink: 0; display: flex; flex-direction: column;
    padding: 24px 16px; color: white;
}
.admin-sidebar-platform {
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
    box-shadow: 4px 0 24px rgba(15, 23, 42, 0.12);
}
.admin-sidebar-oem {
    background: linear-gradient(180deg, #4c1d95 0%, #5b21b6 50%, #6d28d9 100%);
    box-shadow: 4px 0 24px rgba(91, 33, 182, 0.15);
}
.admin-brand-block {
    display: flex; align-items: center; gap: 14px;
    padding: 8px 12px 24px; margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-brand-logo {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; letter-spacing: 0.5px; color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}
.admin-brand-logo.oem { background: linear-gradient(135deg, #a855f7, #c084fc); box-shadow: 0 4px 16px rgba(168, 85, 247, 0.35); }
.admin-brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.admin-brand-text strong { font-size: 15px; font-weight: 700; line-height: 1.3; }
.admin-brand-text span { font-size: 12px; color: rgba(255,255,255,0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.admin-nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    color: rgba(255,255,255,0.72); font-size: 14px; font-weight: 500;
    transition: all .2s;
}
.admin-nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.admin-nav-link.active {
    background: rgba(255,255,255,0.14); color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.admin-nav-muted { color: rgba(255,255,255,0.5); }
.admin-nav-icon {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    background: rgba(255,255,255,0.08);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
}
.admin-nav-link.active .admin-nav-icon { background: rgba(255,255,255,0.18); }
.admin-nav-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 12px 8px; }
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
    background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
    padding: 14px 32px; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.admin-topbar-left, .admin-topbar-right { display: flex; align-items: center; gap: 16px; }
.admin-topbar-tag {
    font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: #6366f1; background: #eef2ff; padding: 5px 12px; border-radius: 20px;
}
.admin-topbar-tag.oem { color: #7c3aed; background: #f5f3ff; }
.admin-topbar-date { font-size: 13px; color: var(--text-muted); }
.admin-user-pill {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 14px 6px 6px; border-radius: 999px;
    background: #f8fafc; border: 1px solid var(--border); font-size: 14px; font-weight: 500;
}
.admin-user-pill.oem { background: #faf5ff; border-color: #e9d5ff; }
.admin-user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
}
.admin-user-pill.oem .admin-user-avatar { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.admin-logout-btn { border-radius: 8px; }
.admin-balance-chip {
    padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
    background: #f5f3ff; color: #7c3aed; border: 1px solid #e9d5ff;
}
.admin-balance-chip:hover { background: #ede9fe; color: #6d28d9; }
.admin-content { padding: 28px 32px 40px; flex: 1; }
.admin-title { font-size: 24px; margin-bottom: 24px; font-weight: 700; }
.admin-quick { grid-template-columns: repeat(3, 1fr); }
.admin-thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: #f8fafc; border: 1px solid var(--border); }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-danger-text { color: var(--danger); border-color: #fecaca; }
.btn-danger-text:hover { background: #fef2f2; }
.admin-inline-form { padding: 0 24px 24px; }
.form-group-action { display: flex; align-items: flex-end; }

/* Admin dashboard */
.admin-dashboard { max-width: 1400px; }
.admin-hero {
    position: relative; overflow: hidden; border-radius: 20px;
    margin-bottom: 24px; color: #fff;
}
.admin-hero-platform { background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #6366f1 100%); }
.admin-hero-oem { background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 50%, #9333ea 100%); }
.admin-hero-bg {
    position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(circle at 15% 30%, rgba(255,255,255,0.14) 0%, transparent 42%),
        radial-gradient(circle at 85% 70%, rgba(255,255,255,0.08) 0%, transparent 38%);
}
.admin-hero-inner {
    position: relative; display: flex; justify-content: space-between; align-items: center;
    gap: 32px; padding: 36px 40px; flex-wrap: wrap;
}
.admin-hero-main { flex: 1; min-width: 280px; }
.admin-hero-tag {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    background: rgba(255,255,255,0.14); font-size: 11px; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 14px;
}
.admin-hero-main h1 { font-size: 30px; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.02em; }
.admin-hero-main p { font-size: 15px; color: rgba(255,255,255,0.86); max-width: 560px; line-height: 1.7; }
.admin-hero-side {
    min-width: 200px; padding: 24px 28px; border-radius: 16px;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.18);
    backdrop-filter: blur(8px); text-align: center;
}
.admin-hero-side-label { font-size: 13px; color: rgba(255,255,255,0.75); margin-bottom: 8px; }
.admin-hero-side-value { font-size: 40px; font-weight: 800; line-height: 1.1; margin-bottom: 6px; }
.admin-hero-side-sub { font-size: 13px; color: rgba(255,255,255,0.7); }
.admin-dashboard-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; margin-bottom: 24px; }

/* Dashboard Analytics */
.dash-analytics { margin-bottom: 24px; }
.dash-analytics > .panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.admin-dashboard > .panel-dashboard { margin-bottom: 24px; }
.dash-stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 20px;
}
.dash-stat-card {
    position: relative; padding: 22px 22px 20px; border-radius: 18px;
    background: #fff; border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.05);
    overflow: hidden; transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none; color: inherit; display: block;
}
.dash-stat-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08); }
.dash-stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--dash-accent, linear-gradient(90deg, #6366f1, #818cf8));
}
.dash-stat-card.indigo { --dash-accent: linear-gradient(90deg, #4338ca, #6366f1); }
.dash-stat-card.violet { --dash-accent: linear-gradient(90deg, #6d28d9, #a855f7); }
.dash-stat-card.emerald { --dash-accent: linear-gradient(90deg, #059669, #34d399); }
.dash-stat-card.amber { --dash-accent: linear-gradient(90deg, #d97706, #fbbf24); }
.dash-stat-card.rose { --dash-accent: linear-gradient(90deg, #e11d48, #fb7185); }
.dash-stat-card.sky { --dash-accent: linear-gradient(90deg, #0284c7, #38bdf8); }
.dash-stat-card.slate { --dash-accent: linear-gradient(90deg, #475569, #94a3b8); }
.dash-stat-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dash-stat-icon {
    width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: #fff;
    background: var(--dash-icon-bg, linear-gradient(135deg, #6366f1, #818cf8));
    box-shadow: 0 6px 16px var(--dash-icon-shadow, rgba(99, 102, 241, 0.35));
}
.dash-stat-card.indigo .dash-stat-icon { --dash-icon-bg: linear-gradient(135deg, #4338ca, #6366f1); --dash-icon-shadow: rgba(67, 56, 202, 0.35); }
.dash-stat-card.violet .dash-stat-icon { --dash-icon-bg: linear-gradient(135deg, #6d28d9, #a855f7); --dash-icon-shadow: rgba(109, 40, 217, 0.35); }
.dash-stat-card.emerald .dash-stat-icon { --dash-icon-bg: linear-gradient(135deg, #059669, #34d399); --dash-icon-shadow: rgba(5, 150, 105, 0.35); }
.dash-stat-card.amber .dash-stat-icon { --dash-icon-bg: linear-gradient(135deg, #d97706, #fbbf24); --dash-icon-shadow: rgba(217, 119, 6, 0.35); }
.dash-stat-card.rose .dash-stat-icon { --dash-icon-bg: linear-gradient(135deg, #e11d48, #fb7185); --dash-icon-shadow: rgba(225, 29, 72, 0.35); }
.dash-stat-card.sky .dash-stat-icon { --dash-icon-bg: linear-gradient(135deg, #0284c7, #38bdf8); --dash-icon-shadow: rgba(2, 132, 199, 0.35); }
.dash-stat-card.slate .dash-stat-icon { --dash-icon-bg: linear-gradient(135deg, #475569, #94a3b8); --dash-icon-shadow: rgba(71, 85, 105, 0.35); }
.dash-stat-chip {
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    background: #f1f5f9; color: #64748b;
}
.dash-stat-chip.up { background: #ecfdf5; color: #059669; }
.dash-stat-value { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.dash-stat-label { font-size: 14px; font-weight: 600; color: #334155; margin-bottom: 4px; }
.dash-stat-desc { font-size: 12px; color: #94a3b8; line-height: 1.5; }
.dash-analytics-row { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.dash-chart-card {
    background: #fff; border: 1px solid rgba(226, 232, 240, 0.95); border-radius: 18px;
    padding: 24px; box-shadow: 0 8px 32px rgba(15, 23, 42, 0.05);
}
.dash-chart-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.dash-chart-card-header h3 { font-size: 16px; font-weight: 700; color: #0f172a; }
.dash-chart-card-header p { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.dash-chart-area { height: 260px; width: 100%; }
.dash-insight-stack { display: flex; flex-direction: column; gap: 16px; }
.dash-insight-card {
    flex: 1; background: #fff; border: 1px solid rgba(226, 232, 240, 0.95); border-radius: 18px;
    padding: 22px; box-shadow: 0 8px 32px rgba(15, 23, 42, 0.05);
    display: flex; align-items: center; gap: 20px;
}
.dash-ring {
    width: 108px; height: 108px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: conic-gradient(var(--ring-color, #7c3aed) calc(var(--ring-pct, 0) * 1%), #eef2ff 0);
}
.dash-ring-inner {
    width: 84px; height: 84px; border-radius: 50%; background: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 1px #f1f5f9;
}
.dash-ring-inner strong { font-size: 22px; font-weight: 800; color: #0f172a; line-height: 1; }
.dash-ring-inner span { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.dash-insight-body h4 { font-size: 15px; font-weight: 700; margin-bottom: 6px; color: #0f172a; }
.dash-insight-body p { font-size: 13px; color: #64748b; line-height: 1.6; margin-bottom: 10px; }
.dash-insight-metrics { display: flex; gap: 20px; flex-wrap: wrap; }
.dash-insight-metric strong { display: block; font-size: 20px; font-weight: 800; color: #0f172a; }
.dash-insight-metric span { font-size: 11px; color: #94a3b8; }
.dash-bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 72px; margin-top: 12px; }
.dash-bar-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dash-bar-fill {
    width: 100%; max-width: 28px; border-radius: 6px 6px 2px 2px;
    background: linear-gradient(180deg, #a78bfa, #7c3aed); min-height: 4px;
    transition: height 0.3s;
}
.dash-bar-item span { font-size: 10px; color: #cbd5e1; }
.dash-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.dash-info-item {
    padding: 16px; border-radius: 14px; background: #f8fafc; border: 1px solid #eef2f7;
}
.dash-info-item label { display: block; font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.dash-info-item strong { font-size: 15px; font-weight: 700; color: #0f172a; }
.dash-info-item p { font-size: 12px; color: #94a3b8; margin-top: 4px; }

.panel-dashboard {
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.04);
}
.panel-header-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; font-weight: 400; }
.dashboard-table th {
    background: #f8fafc; font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em; color: #64748b;
    padding: 14px 20px; border-bottom: 1px solid #e2e8f0;
}
.dashboard-table td { padding: 16px 20px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.dashboard-table tbody tr:hover { background: #fafbff; }
.dashboard-table tbody tr:last-child td { border-bottom: none; }
.dash-metric-name { font-weight: 600; color: var(--text); }
.dash-metric-value { font-size: 18px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-metric-value.highlight { color: var(--primary); }
.dash-badge {
    display: inline-flex; align-items: center; padding: 4px 10px;
    border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4;
}
.dash-badge-success { background: #ecfdf5; color: #059669; }
.dash-badge-warning { background: #fffbeb; color: #d97706; }
.dash-badge-info { background: #eff6ff; color: #2563eb; }
.dash-badge-purple { background: #f5f3ff; color: #7c3aed; }
.dash-badge-muted { background: #f1f5f9; color: #64748b; }
.dash-link { font-size: 13px; font-weight: 600; color: var(--primary); }
.dash-link:hover { text-decoration: underline; }
.dashboard-alert {
    display: flex; gap: 16px; align-items: flex-start;
    margin: 20px 24px 24px; padding: 20px 22px;
    background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px;
}
.dashboard-alert-icon {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: #f59e0b; color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.dashboard-alert strong { display: block; margin-bottom: 4px; color: #92400e; }
.dashboard-alert p { font-size: 14px; color: #a16207; margin-bottom: 8px; }
.text-muted { color: var(--text-muted); }
.admin-hero-compact .admin-hero-inner { padding: 28px 36px; }
.admin-hero-compact .admin-hero-main h1 { font-size: 26px; }
.admin-hero-compact .admin-hero-side-value { font-size: 32px; }
.price-chain-cell { font-size: 13px; color: #64748b; max-width: 320px; line-height: 1.6; }

/* Customer service widget */
.cs-widget { position: fixed; right: 24px; bottom: 24px; z-index: 200; }
.cs-widget-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 12px 18px; border: none; border-radius: 999px;
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.35);
    transition: transform .2s, box-shadow .2s;
}
.cs-widget-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(124, 58, 237, 0.42); }
.cs-widget-icon {
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.cs-widget-panel {
    position: absolute; right: 0; bottom: calc(100% + 12px);
    width: 280px; background: #fff; border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    border: 1px solid var(--border); overflow: hidden;
}
.cs-widget-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; background: linear-gradient(135deg, #7c3aed, #9333ea); color: #fff;
}
.cs-widget-close {
    border: none; background: transparent; color: #fff; font-size: 22px;
    line-height: 1; cursor: pointer; opacity: 0.85;
}
.cs-widget-body { padding: 20px 16px 18px; text-align: center; }
.cs-widget-qrcode {
    width: 180px; height: 180px; object-fit: contain;
    border-radius: 12px; border: 1px solid var(--border); background: #fafafa;
    margin-bottom: 12px;
}
.cs-widget-body p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.service-qrcode-preview {
    width: 180px; height: 180px; border: 1px dashed var(--border); border-radius: 12px;
    display: flex; align-items: center; justify-content: center; background: #fafafa; overflow: hidden;
}
.service-qrcode-preview img { width: 100%; height: 100%; object-fit: contain; }
.service-qrcode-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.oem-logo-preview {
    width: 120px; height: 120px; border-radius: 14px; border: 1px dashed #cbd5e1;
    background: #f8fafc; display: flex; align-items: center; justify-content: center;
    overflow: hidden; padding: 8px;
}
.oem-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.price-tabs { display: flex; gap: 8px; padding: 0 24px 16px; border-bottom: 1px solid var(--border); margin-bottom: 0; }
.price-tab {
    border: 1px solid var(--border); background: white; padding: 8px 16px; border-radius: 8px;
    cursor: pointer; font-size: 14px; color: var(--text-muted);
}
.price-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.price-tab-panel { display: none; padding: 24px; }
.price-tab-panel.active { display: block; }
.empty-cell { text-align: center; color: var(--text-muted); padding: 24px !important; }
.brand-logo { height: 36px; width: auto; max-width: 120px; object-fit: contain; border-radius: 6px; }
.auth-brand-logo { text-align: center; margin-bottom: 16px; }
.auth-brand-logo img { max-height: 56px; max-width: 180px; object-fit: contain; }
.stat-value-sm { font-size: 20px; line-height: 1.3; word-break: break-all; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.auth-page-admin .auth-card { border-top: 4px solid #6366f1; }
.auth-page-oem .auth-card { border-top: 4px solid #7c3aed; }
.auth-page-merchant .auth-card { border-top: 4px solid var(--primary); }
.api-balance { padding: 20px 24px; display: flex; gap: 32px; font-size: 16px; }
.new-codes { margin-bottom: 16px; }
.card-new-codes { margin: 0 0 4px; }
.card-gen-panel {
    margin-bottom: 20px;
    padding: 22px 24px;
    border-radius: 16px;
    border: 1px solid #e9e5ff;
    background: linear-gradient(135deg, #faf8ff 0%, #f5f3ff 48%, #fefefe 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
.card-gen-panel-head { margin-bottom: 18px; }
.card-gen-panel-head h3 { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.card-gen-panel-head p { font-size: 13px; color: var(--text-muted); margin: 0; }
.card-gen-panel-body {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 24px;
    align-items: end;
}
.card-gen-fields { display: flex; gap: 16px; flex-wrap: wrap; }
.card-gen-field-box { min-width: 168px; }
.card-gen-field-box label {
    display: block; font-size: 13px; font-weight: 600; color: #4c1d95; margin-bottom: 8px;
}
.card-gen-input-wrap {
    display: flex; align-items: center;
    background: #fff; border: 1px solid #ddd6fe; border-radius: 12px;
    overflow: hidden; box-shadow: 0 2px 8px rgba(124, 58, 237, 0.06);
    transition: border-color .2s, box-shadow .2s;
}
.card-gen-input-wrap:focus-within {
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.18);
}
.card-gen-input-wrap input {
    flex: 1; min-width: 0; border: none; background: transparent;
    padding: 12px 14px; font-size: 18px; font-weight: 700; color: var(--text);
    font-variant-numeric: tabular-nums;
}
.card-gen-input-wrap input:focus { outline: none; }
.card-gen-prefix, .card-gen-suffix {
    flex-shrink: 0; padding: 0 14px; font-size: 15px; font-weight: 600; color: #7c3aed;
    background: #f5f3ff; border-right: 1px solid #ede9fe;
}
.card-gen-suffix { border-right: none; border-left: 1px solid #ede9fe; }
.card-gen-field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.card-gen-presets-box { min-width: 0; }
.card-gen-presets-title {
    display: block; font-size: 13px; font-weight: 600; color: #4c1d95; margin-bottom: 10px;
}
.card-gen-presets-list { display: flex; flex-wrap: wrap; gap: 8px; }
.card-amount-preset {
    padding: 8px 14px; border-radius: 999px; border: 1px solid #ddd6fe;
    background: #fff; color: #6d28d9; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all .2s;
}
.card-amount-preset:hover {
    border-color: #a78bfa; background: #faf5ff; transform: translateY(-1px);
}
.card-amount-preset.active {
    border-color: #7c3aed; background: linear-gradient(135deg, #7c3aed, #9333ea);
    color: #fff; box-shadow: 0 4px 14px rgba(124, 58, 237, 0.28);
}
.card-gen-action .btn-primary {
    min-width: 120px; padding: 12px 24px; font-size: 15px; font-weight: 600;
    border-radius: 12px; box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
}
.card-gen-inline {
    margin-bottom: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.card-gen-inline input[type="number"] { width: 120px; }
.admin-form-actions { margin-top: 8px; margin-bottom: 24px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.mb-4 { margin-bottom: 16px; }

@media (max-width: 960px) {
    .card-gen-panel-body { grid-template-columns: 1fr; gap: 18px; }
    .card-gen-action .btn-primary { width: 100%; }
}

@media (max-width: 640px) {
    .card-gen-fields { flex-direction: column; }
    .card-gen-field-box { width: 100%; }
}

/* Toast */
.toast-container { position: fixed; top: 80px; right: 24px; z-index: 999; }
.toast {
    background: white; padding: 14px 20px; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 8px; font-size: 14px; animation: slideIn .3s;
    border-left: 4px solid var(--primary);
}
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Page shell */
.page-shell { padding: 8px 0 40px; }
.page-stats-grid { margin-bottom: 24px; grid-template-columns: repeat(3, 1fr); }
.table-scroll { overflow-x: auto; }

/* Home dashboard */
.home-page { padding-bottom: 48px; }
.home-hero {
    position: relative; overflow: hidden; margin-bottom: 32px;
    background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 45%, #9333ea 100%);
}
.home-hero-bg {
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.12) 0%, transparent 40%),
        radial-gradient(circle at 80% 60%, rgba(255,255,255,0.08) 0%, transparent 35%);
    pointer-events: none;
}
.home-hero-inner {
    position: relative; display: grid; grid-template-columns: 1.2fr 0.8fr;
    gap: 32px; align-items: center; padding: 48px 24px;
}
.home-hero-tag, .account-hero-tag {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.95);
    font-size: 12px; font-weight: 600; margin-bottom: 16px;
}
.home-hero-main h1 { font-size: 32px; color: #fff; margin-bottom: 12px; font-weight: 700; }
.home-hero-main p { color: rgba(255,255,255,0.88); font-size: 15px; max-width: 520px; margin-bottom: 24px; }
.home-hero-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.home-hero-panel {
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 16px; padding: 24px; backdrop-filter: blur(8px);
}
.home-hero-panel-title { color: rgba(255,255,255,0.85); font-size: 13px; margin-bottom: 16px; }
.home-hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.home-hero-stat { text-align: center; }
.home-hero-stat strong { display: block; font-size: 28px; color: #fff; font-weight: 700; }
.home-hero-stat span { font-size: 12px; color: rgba(255,255,255,0.75); }

.home-body { padding-bottom: 8px; }
.home-metric-row {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px;
}
.home-metric-card {
    background: #fff; border-radius: 16px; padding: 22px 20px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px; position: relative;
    transition: transform .2s, box-shadow .2s;
}
.home-metric-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(124,58,237,0.12); }
.home-metric-card.highlight { border-color: #fde68a; background: linear-gradient(135deg, #fffbeb, #fff); }
.home-metric-icon {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700; color: #fff;
}
.home-metric-icon.purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.home-metric-icon.blue { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.home-metric-icon.green { background: linear-gradient(135deg, #10b981, #34d399); }
.home-metric-icon.orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.home-metric-label { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.home-metric-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.2; }
.home-metric-link {
    position: absolute; right: 16px; bottom: 16px; font-size: 12px;
    color: var(--primary); font-weight: 600;
}

.home-bento { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.home-bento-chart { margin-bottom: 0; }
.home-chart { height: 340px; }
.home-chart-sm { height: 220px; }
.home-bento-side { display: flex; flex-direction: column; gap: 20px; }
.home-distribution { margin-bottom: 0; }
.home-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.home-shortcut {
    display: flex; align-items: center; gap: 12px; padding: 16px;
    background: #fff; border-radius: 12px; border: 1px solid var(--border);
    color: var(--text); transition: all .2s;
}
.home-shortcut:hover {
    border-color: var(--primary-light); box-shadow: 0 4px 20px rgba(124,58,237,0.1);
    transform: translateY(-1px); color: var(--text);
}
.home-shortcut-icon {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    background: var(--primary-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.home-shortcut strong { display: block; font-size: 14px; margin-bottom: 2px; }
.home-shortcut p { font-size: 12px; color: var(--text-muted); margin: 0; }

/* Account / profile center */
.account-page { padding-bottom: 48px; }
.account-hero {
    background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 50%, #7c3aed 100%);
    margin-bottom: 32px;
}
.account-hero-inner {
    display: flex; justify-content: space-between; align-items: center;
    gap: 24px; flex-wrap: wrap; padding: 40px 24px;
}
.account-profile { display: flex; align-items: center; gap: 20px; }
.account-avatar {
    width: 88px; height: 88px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
    background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.35);
    display: flex; align-items: center; justify-content: center;
}
.account-profile h1 { color: #fff; font-size: 28px; margin-bottom: 6px; }
.account-profile p { color: rgba(255,255,255,0.85); font-size: 14px; }
.account-balance-card {
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22);
    border-radius: 16px; padding: 24px 32px; text-align: center; min-width: 220px;
    backdrop-filter: blur(8px);
}
.account-balance-label { display: block; color: rgba(255,255,255,0.8); font-size: 13px; margin-bottom: 8px; }
.account-balance-value { display: block; color: #fff; font-size: 36px; font-weight: 700; }

.account-body { padding-bottom: 8px; }
.account-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; margin-bottom: 24px; }
.account-recharge-body { padding: 24px; }
.recharge-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.account-tips {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin-top: 24px; padding-top: 24px; border-top: 1px dashed var(--border);
}
.account-tip-item {
    background: var(--primary-bg); border-radius: 10px; padding: 16px;
}
.account-tip-item strong { display: block; font-size: 14px; margin-bottom: 4px; color: var(--primary-dark); }
.account-tip-item p { font-size: 13px; color: var(--text-muted); margin: 0; }
.account-summary-list { padding: 8px 24px 24px; }
.account-summary-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 0; border-bottom: 1px solid var(--border); gap: 16px;
}
.account-summary-item:last-child { border-bottom: none; }
.account-summary-item span { color: var(--text-muted); font-size: 14px; }
.account-summary-item strong { font-size: 15px; }
.account-quick-links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.account-quick-links a {
    padding: 4px 10px; border-radius: 6px; background: var(--primary-bg);
    color: var(--primary); font-size: 12px; font-weight: 500;
}
.account-quick-links a:hover { background: #ede9fe; }
.account-logs-panel { margin-bottom: 0; }

.account-settings-panel { margin-bottom: 24px; }
.account-settings-body { padding: 8px 24px 24px; }
.account-setting-block {
    padding: 24px 0; border-bottom: 1px solid var(--border);
}
.account-setting-block:last-child { border-bottom: none; padding-bottom: 8px; }
.account-setting-title { font-size: 16px; margin-bottom: 16px; color: var(--text); }

.avatar-setting { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.avatar-preview {
    width: 88px; height: 88px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
    background: var(--primary-bg); border: 2px solid #ddd6fe;
    display: flex; align-items: center; justify-content: center;
}
.account-avatar-inner, .user-avatar-img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.user-avatar-fallback, .account-avatar-inner.user-avatar-fallback {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-light));
}
.avatar-preview .user-avatar-fallback { color: var(--primary); background: #ede9fe; font-size: 28px; }
.avatar-upload-btn { cursor: pointer; }
.account-form { max-width: 560px; }
.account-form .form-group { margin-bottom: 14px; }
.account-form .form-row { margin-bottom: 0; }

.nav-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-bg);
    transition: border-color .2s;
    line-height: 0;
    vertical-align: middle;
}
.nav-avatar:hover { border-color: var(--primary-light); }
.nav-avatar .nav-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.nav-avatar img.nav-avatar-inner { display: block; }
.nav-avatar .nav-avatar-inner.user-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

@media (max-width: 1024px) {
    .stats-grid, .quick-actions, .dashboard-section { grid-template-columns: repeat(2, 1fr); }
    .admin-dashboard-grid { grid-template-columns: 1fr; }
    .dash-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-analytics-row { grid-template-columns: 1fr; }
    .dash-info-grid { grid-template-columns: 1fr; }
    .admin-sidebar { width: 220px; }
    .admin-content { padding: 20px; }
    .admin-hero-inner { padding: 28px 24px; }
    .home-hero-inner, .home-bento, .account-grid { grid-template-columns: 1fr; }
    .home-metric-row { grid-template-columns: repeat(2, 1fr); }
    .page-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .media-row { flex-wrap: wrap; gap: 16px; }
    .media-col-actions { margin-left: 0; flex-direction: row; width: auto; }
    .profile-page { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    :root { --page-padding: 16px; }
    .top-nav .container { width: 100%; }
    .nav-inner { flex-wrap: nowrap; min-height: 56px; gap: 12px; }
    .brand-text {
        max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .nav-toggle { display: flex; margin-left: auto; }
    .nav-collapse {
        position: fixed; top: 56px; left: 0; right: 0; bottom: 0; z-index: 100;
        flex: none; flex-direction: column; align-items: stretch; gap: 0;
        padding: 16px; background: var(--white); overflow-y: auto;
        transform: translateX(100%); transition: transform .25s ease;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
    }
    body.nav-open .nav-collapse { transform: translateX(0); }
    body.nav-open { overflow: hidden; }
    .main-menu {
        order: 0; width: 100%; flex-direction: column; flex-wrap: nowrap;
        overflow: visible; padding-bottom: 0; gap: 4px;
    }
    .main-menu a {
        padding: 12px 16px; font-size: 15px; border-radius: 10px;
    }
    .nav-right {
        order: 1; width: 100%; flex-direction: column; align-items: stretch;
        margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); gap: 12px;
    }
    .nav-right .balance-chip { text-align: center; justify-content: center; }
    .nav-right .username { text-align: center; }
    .nav-right .btn-ghost { width: 100%; }
    .nav-avatar { align-self: center; }
    .page-title-bar { padding: 16px 0 12px; }
    .page-title-bar h1 { font-size: 20px; }
    .panel-header {
        flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px;
    }
    .panel-actions { width: 100%; }
    .panel-actions .btn { flex: 1; }
    .filter-inline {
        flex-direction: column; padding: 0 16px 16px;
    }
    .filter-inline select,
    .filter-inline input,
    .filter-inline .btn { width: 100%; }
    .form-inline { flex-direction: column; }
    .form-row { grid-template-columns: 1fr; }
    .hero-banner { padding: 24px; margin: 16px 0; }
    .hero-text h1 { font-size: 22px; }
    .hero-stats { gap: 20px; width: 100%; justify-content: space-around; }
    .toast-container { top: 64px; left: 16px; right: 16px; }
    .toast { margin-bottom: 8px; }
    .cs-widget { right: 16px; bottom: 16px; }
    .cs-widget-btn { padding: 10px 14px; font-size: 13px; }
    .cs-widget-panel { width: min(280px, calc(100vw - 32px)); }
    .auth-page { padding: 16px; align-items: flex-start; padding-top: 10vh; }
    .auth-card { padding: 28px 20px; border-radius: 14px; }
    .modal-content { width: calc(100% - 32px); max-height: calc(100vh - 32px); }
    .recharge-modal { padding: 16px; }
    .recharge-modal-panel { max-width: 100%; }
    .recharge-balance-grid { grid-template-columns: 1fr; }
    .recharge-modal-footer { flex-direction: column; }
    .recharge-btn-submit, .recharge-modal-footer .recharge-btn-cancel { flex: none; width: 100%; }

    .responsive-table thead { display: none; }
    .responsive-table tbody tr {
        display: block; margin-bottom: 12px; border: 1px solid var(--border);
        border-radius: 12px; overflow: hidden; background: var(--white);
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    }
    .responsive-table tbody td {
        display: flex; justify-content: space-between; align-items: flex-start;
        gap: 12px; padding: 12px 16px; text-align: right; border-bottom: 1px solid #f3f4f6;
    }
    .responsive-table tbody td:last-child { border-bottom: none; }
    .responsive-table tbody td::before {
        content: attr(data-label); font-weight: 600; color: var(--text-muted);
        font-size: 12px; text-align: left; flex-shrink: 0; max-width: 42%;
    }
    .responsive-table tbody td.empty,
    .responsive-table tbody td.empty-cell,
    .responsive-table tbody td.loading-cell {
        display: block; text-align: center; padding: 32px 16px;
    }
    .responsive-table tbody td.empty::before,
    .responsive-table tbody td.empty-cell::before,
    .responsive-table tbody td.loading-cell::before { content: none; }
    .responsive-table .col-action {
        justify-content: space-between; align-items: center;
    }
    .responsive-table .col-action .submission { width: auto; min-width: 88px; }
}
@media (max-width: 640px) {
    .container { width: 100%; padding: 0 16px; }
    .stats-grid, .quick-actions, .dashboard-section { grid-template-columns: 1fr; }
    .home-metric-row, .home-shortcuts, .page-stats-grid, .account-tips { grid-template-columns: 1fr; }
    .home-hero-stats { grid-template-columns: 1fr; }
    .home-hero-main h1, .account-profile h1 { font-size: 24px; }
    .account-balance-card { width: 100%; }
    .home-hero-inner { padding: 32px 0; }
    .account-hero-inner { padding: 28px 0; }
    .account-grid { gap: 16px; }
    .dash-stat-grid { grid-template-columns: 1fr; }
    .hero-banner { flex-direction: column; text-align: center; }
    .media-row { flex-direction: column; align-items: flex-start; }
    .media-col { width: 100% !important; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; padding: 16px; }
    .admin-nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
    .admin-nav-link { padding: 8px 12px; font-size: 13px; }
    .admin-nav-divider { display: none; }
    .admin-topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
    .admin-topbar-date { display: none; }
    .admin-hero-main h1 { font-size: 24px; }
    .admin-hero-side-value { font-size: 32px; }
    .dashboard-table th, .dashboard-table td { padding: 12px 14px; }
}
