:root {
    --gold: #FFD700; --gold-dim: rgba(255, 215, 0, 0.15); --dark-bg: #0a0a0a; --card-bg: #161616;
    --text-primary: #f0f0f0; --text-secondary: #888; --border-color: rgba(255, 255, 255, 0.08);
    --success: #22C55E; --danger: #EF4444; --blue: #3B82F6;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: var(--dark-bg); color: var(--text-primary); line-height: 1.6; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.main-content { padding: 3rem 0; }

.page-title { display: flex; align-items: center; gap: 0.75rem; font-family: 'Playfair Display', serif; font-size: 1.8rem; color: var(--gold); margin-bottom: 0.5rem; }
.page-subtitle { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.95rem; }

/* Stats Row */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 1.25rem; display: flex; align-items: center; gap: 1rem; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-icon.gold { background: var(--gold-dim); color: var(--gold); }
.stat-icon.green { background: rgba(34,197,94,0.15); color: var(--success); }
.stat-icon.blue { background: rgba(59,130,246,0.15); color: var(--blue); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-label { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; }

/* VIP Cards Grid */
.vip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.vip-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 14px; padding: 1.5rem; position: relative; overflow: visible; transition: transform 0.2s, border-color 0.2s; }
.vip-card:hover { transform: translateY(-3px); border-color: rgba(255,215,0,0.25); }
.vip-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700); border-radius: 13px; clip-path: inset(0 0 calc(100% - 3px) 0); pointer-events: none; }

.vip-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.75rem; }
.vip-avatar-col { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; position: relative; border-radius: 8px; background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,165,0,0.15)); border: 1px solid rgba(255,215,0,0.2); padding: 0.5rem 0.4rem; }
.vip-avatar-col .vip-avatar { display: none; }
.vip-avatar { width: 48px; height: 48px; border-radius: 12px; background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,165,0,0.15)); color: var(--gold); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; flex-shrink: 0; border: 1px solid rgba(255,215,0,0.2); }
.vip-avatar-col .vip-dropdown-btn { font-size: 1.4rem; padding: 0; opacity: 0.7; transition: opacity 0.2s, color 0.2s; color: var(--gold); line-height: 1; }
.vip-avatar-col .vip-dropdown-btn:hover { opacity: 1; }
.vip-avatar-col .vip-dropdown-menu { left: 0; right: auto; }
.vip-name-wrap { flex: 1; margin-left: 0.75rem; min-width: 0; }
.vip-name { font-family: 'Playfair Display', serif; font-size: 1.15rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vip-phone { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.15rem; }

.vip-balance { text-align: right; margin-left: auto; }
.vip-balance-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary); font-weight: 600; }
.vip-balance-value { font-size: 1.4rem; font-weight: 800; color: var(--success); }
.vip-balance-value.zero { color: var(--text-secondary); }

.vip-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.vip-meta-item { display: flex; align-items: center; gap: 0.3rem; white-space: nowrap; }

.vip-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.vip-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.6rem 0.75rem; border-radius: 8px; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Inter', sans-serif; white-space: nowrap; }
.vip-actions .vip-btn { flex: 1; }
.vip-btn:hover { color: var(--text-primary); border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.03); }
.vip-btn.primary { background: var(--color-primary-dim); color: var(--color-primary); border-color: var(--color-primary-transparent); }
.vip-btn.primary:hover { background: var(--color-primary-transparent); border-color: var(--color-primary); color: var(--color-primary-hover); }

/* Search bar */
.search-bar { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; align-items: center; flex-wrap: nowrap; }
.search-wrap { position: relative; flex: 1; min-width: 0; }
.search-input { width: 100%; box-sizing: border-box; padding: 0.75rem 1rem 0.75rem 2.5rem; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px; color: var(--text-primary); font-family: 'Inter', sans-serif; font-size: 0.9rem; transition: border-color 0.2s; }
.search-input:focus { border-color: var(--border-color) !important; box-shadow: none !important; }

.search-wrap i { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--text-secondary); font-size: 0.95rem; pointer-events: none; }
@media (max-width: 768px) {
    .search-bar .vip-btn { padding: 0.75rem 1rem !important; }
    .hide-mobile { display: none; }
}

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; border: 1px dashed var(--border-color); border-radius: 14px; background: rgba(0,0,0,0.2); }
.empty-state i { font-size: 3rem; color: var(--gold); opacity: 0.4; margin-bottom: 1rem; display: block; }
.empty-state p { color: var(--text-secondary); font-size: 0.95rem; }

/* Modal */
.vip-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(6px); z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 1rem; opacity: 0; visibility: hidden; transition: all 0.25s ease; }
.vip-modal-overlay.active { opacity: 1; visibility: visible; }
.vip-modal { background: #18181B; border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto; box-shadow: 0 25px 60px rgba(0,0,0,0.85); }
.vip-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.08); position: sticky; top: 0; background: #18181B; z-index: 1; }
.vip-modal-title { font-family: 'Playfair Display', serif; font-size: 1.15rem; color: var(--gold); line-height: 1.3; flex: 1; }
.vip-modal-close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: #888; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; font-size: 1rem; flex-shrink: 0; }
.vip-modal-close:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: #ef4444; }
.vip-modal-body { padding: 1.5rem; }

/* Dropdown Menu */
.vip-dropdown-wrapper { position: relative; }
.vip-dropdown-btn { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; padding: 2px 6px; font-size: 1.15rem; transition: color 0.2s; border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.vip-dropdown-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.vip-dropdown-menu { position: absolute; right: 0; top: 100%; margin-top: 0.5rem; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); padding: 0.5rem; min-width: 170px; z-index: 100; opacity: 0; visibility: hidden; transform: translateY(-5px); transition: all 0.2s; }
.vip-dropdown-menu.active { opacity: 1; visibility: visible; transform: translateY(0); }
.vip-dropdown-item { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.75rem; color: var(--text-primary); text-decoration: none; font-size: 0.88rem; border-radius: 6px; cursor: pointer; transition: background 0.2s; border: none; background: transparent; width: 100%; text-align: left; font-family: 'Inter', sans-serif; white-space: nowrap; }
.vip-dropdown-item:hover { background: rgba(255,255,255,0.05); }
.vip-dropdown-item.danger { color: var(--danger); }
.vip-dropdown-item.danger:hover { background: rgba(239,68,68,0.1); }
.vip-dropdown-close { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05); color: #888; cursor: pointer; transition: all 0.2s; font-size: 1rem; margin-left: auto; margin-bottom: 0.25rem; }
.vip-dropdown-close:hover { background: rgba(239,68,68,0.15); border-color: rgba(239,68,68,0.4); color: #ef4444; }

/* Ledger */
.ledger-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.ledger-item:last-child { border-bottom: none; }
.ledger-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; flex-shrink: 0; }
.ledger-icon.credit { background: rgba(34,197,94,0.12); color: var(--success); }
.ledger-icon.debit { background: rgba(239,68,68,0.12); color: var(--danger); }
.ledger-info { flex: 1; min-width: 0; }
.ledger-desc { font-size: 0.85rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ledger-date { font-size: 0.72rem; color: var(--text-secondary); }
.ledger-amount { text-align: right; flex-shrink: 0; }
.ledger-amount-value { font-size: 0.95rem; font-weight: 700; }
.ledger-amount-value.credit { color: var(--success); }
.ledger-amount-value.debit { color: var(--danger); }
.ledger-balance { font-size: 0.68rem; color: var(--text-secondary); }

/* Funds form */
.funds-form-group { margin-bottom: 1rem; }
.funds-label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 500; margin-bottom: 0.4rem; display: block; }
.funds-input { width: 100%; padding: 0.75rem 1rem; background: #0a0a0a; border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-primary); font-family: 'Inter', sans-serif; font-size: 1rem; }
.funds-input:focus { outline: none; border-color: var(--gold); }
.funds-type-row { display: flex; gap: 0.5rem; }
.funds-type-btn { flex: 1; padding: 0.65rem; border-radius: 8px; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Inter', sans-serif; text-align: center; }
.funds-type-btn.active-credit { border-color: rgba(34,197,94,0.5); background: rgba(34,197,94,0.12); color: var(--success); }
.funds-type-btn.active-debit { border-color: rgba(239,68,68,0.5); background: rgba(239,68,68,0.12); color: var(--danger); }
.funds-submit { width: 100%; padding: 0.85rem; border-radius: 10px; border: none; background: linear-gradient(135deg, #FFD700, #FFA500); color: #000; font-size: 0.95rem; font-weight: 700; cursor: pointer; transition: opacity 0.2s; font-family: 'Inter', sans-serif; margin-top: 0.5rem; }
.funds-submit:hover { opacity: 0.9; }
.funds-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* Quick-amount pills */
.quick-amounts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.quick-pill { padding: 0.35rem 0.75rem; border-radius: 20px; border: 1px solid var(--border-color); background: transparent; color: var(--text-secondary); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: 'Inter', sans-serif; }
.quick-pill:hover, .quick-pill.active { border-color: rgba(255,215,0,0.4); color: var(--gold); background: var(--gold-dim); }

@media (max-width: 768px) {
    .vip-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0.75rem; }
    .stat-card { flex-direction: column; justify-content: center; text-align: center; gap: 0.4rem; padding: 1rem 0.5rem; }
    .stat-card > div:last-child { display: flex; flex-direction: column; align-items: center; }
    .stat-icon { width: 32px; height: 32px; font-size: 1.1rem; border-radius: 8px; }
    .stat-value { font-size: 1.15rem; }
    .stat-label { font-size: 0.65rem; line-height: 1.1; }
    .page-title { font-size: 1.4rem; }
}

/* QR Code Modal Styles */
.qr-frame { width: 3.5in; height: 2in; padding: 12px 14px; background: linear-gradient(135deg, #1c1c1c 0%, #111111 100%); border-radius: 8px; border: 1px solid rgba(255, 215, 0, 0.15); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6); position: relative; overflow: hidden; display: flex; align-items: center; margin: 0 auto; }
.abstract-icon { position: absolute; background-color: var(--gold); opacity: 0.04; border-radius: 50%; pointer-events: none; z-index: 0; }
.icon-top-left { width: 60px; height: 60px; top: -20px; left: -20px; }
.icon-bottom-right { width: 70px; height: 70px; bottom: -25px; right: -25px; border-radius: 14px; transform: rotate(45deg); }
.qr-content { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; width: 100%; height: 100%; }
.card-left { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: left; }
.restaurant-logo { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 215, 0, 0.4); margin-bottom: 6px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 0 0 15px rgba(255, 215, 0, 0.15); object-fit: cover; }
.card-business-name { font-family: 'Playfair Display', serif; color: var(--gold); font-size: 1.1rem; line-height: 1.1; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 1.8in; font-weight: 700; margin-top: 0; }
.card-address { font-size: 0.6rem; color: #a1a1aa; display: flex; align-items: flex-start; gap: 4px; line-height: 1.2; margin-bottom: 8px; max-width: 1.8in; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-address i { color: var(--gold); font-size: 0.65rem; margin-top: 1px; }
.instruction { font-size: 0.55rem; color: #e4e4e7; line-height: 1.3; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid rgba(255, 215, 0, 0.15); }
.powered-by { font-size: 0.5rem; color: #71717a; margin-top: auto; margin-bottom: 0; }
.powered-by a { color: var(--gold); font-weight: 800; text-decoration: none; text-shadow: 0 0 10px rgba(255, 215, 0, 0.4); }
.card-right { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.qr-code-container { width: 110px; height: 110px; display: flex; justify-content: center; align-items: center; background-color: white; padding: 6px; border-radius: 8px; overflow: hidden; }
.qr-code-container canvas, .qr-code-container svg, #big-qr-container canvas, #big-qr-container svg { width: 100% !important; height: 100% !important; max-width: 100% !important; max-height: 100% !important; object-fit: contain; }
.scan-label { font-size: 0.55rem; font-weight: 800; letter-spacing: 0.1em; color: var(--gold); text-transform: uppercase; }
@media (max-width: 500px) {
    .qr-frame { transform: scale(0.85); transform-origin: center; margin-top: -10px; margin-bottom: -10px; }
}

@media (max-width: 480px) {
    .vip-card { padding: 1.25rem 1rem; }
    .vip-header { gap: 0.5rem; }
    .vip-header > div:first-child { gap: 0.5rem !important; }
    .vip-balance-value { font-size: 1.15rem; }
}
