*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 15px; }
body {
    font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
    color: #1a1a2e;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background: #ffffff;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; outline: none; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

/* Page background layer */
.page-bg { position: fixed; inset: 0; z-index: -2; transition: all 0.3s; }
.page-overlay { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.grid { display: grid; } .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
.space-y-2 > * + * { margin-top: 8px; } .space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; } .space-y-6 > * + * { margin-top: 24px; }

/* Spacing */
.m-auto { margin: auto; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; } .p-5 { padding: 20px; } .p-6 { padding: 24px; } .p-8 { padding: 32px; }

/* Text */
.text-xs { font-size: 12px; } .text-sm { font-size: 13px; } .text-base { font-size: 15px; }
.text-lg { font-size: 18px; } .text-xl { font-size: 22px; } .text-2xl { font-size: 28px; } .text-3xl { font-size: 36px; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.text-center { text-align: center; } .text-left { text-align: left; }
.text-white { color: #fff; }
.text-blue { color: #2563eb; }
.text-blue-dark { color: #1e40af; }
.text-gray { color: #64748b; }
.text-dark-gray { color: #94a3b8; }
.text-red { color: #ef4444; }
.text-green { color: #22c55e; }

/* Cards - white with subtle shadow */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-body { padding: 20px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: #475569; margin-bottom: 6px; font-weight: 500; }
.form-group label .required { color: #ef4444; }
.form-input, .form-select {
    width: 100%; height: 40px; padding: 0 12px;
    background: #fff; border: 1px solid #d1d5db; border-radius: 8px;
    color: #1e293b; font-size: 14px; transition: all 0.2s;
}
.form-input:focus, .form-select:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-input::placeholder { color: #94a3b8; }
.form-input.error { border-color: #ef4444; }
.form-select { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.form-input { height: auto; padding: 8px 12px; resize: vertical; }
.form-error { font-size: 12px; color: #ef4444; margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 40px; padding: 0 20px; border-radius: 8px; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.15s; border: none;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: transparent; border: 1.5px solid #2563eb; color: #2563eb; }
.btn-outline:hover { background: rgba(37,99,235,0.05); }
.btn-secondary { background: #f1f5f9; border: 1px solid #e2e8f0; color: #475569; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 48px; padding: 0 32px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Nav tabs */
.nav-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e2e8f0; margin-bottom: 20px; }
.nav-tab { padding: 10px 16px; font-size: 14px; color: #64748b; border-bottom: 2px solid transparent; cursor: pointer; transition: all 0.15s; }
.nav-tab:hover { color: #1e293b; }
.nav-tab.active { color: #2563eb; border-bottom-color: #2563eb; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 500; color: #64748b; background: #f1f5f9; text-transform: uppercase; }
.data-table td { padding: 10px 12px; font-size: 13px; color: #334155; border-bottom: 1px solid #f1f5f9; }
.data-table tbody tr:hover { background: #ffffff; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 100px; font-size: 11px; font-weight: 500; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-review { background: #dbeafe; color: #1e40af; }
.badge-completed { background: #f1f5f9; color: #475569; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-disabled { background: #fee2e2; color: #991b1b; }

/* Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; cursor: pointer; inset: 0; background: #d1d5db; border-radius: 24px; transition: 0.2s; }
.switch-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.2s; }
.switch input:checked + .switch-slider { background: #2563eb; }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }

/* Toast */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #e2e8f0; border-left: 3px solid; border-radius: 8px; padding: 12px 16px; min-width: 280px; max-width: 400px; animation: toastIn 0.3s ease; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); color: #334155; }
.toast-success { border-left-color: #22c55e; } .toast-error { border-left-color: #ef4444; } .toast-info { border-left-color: #3b82f6; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Modal */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.15); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; gap: 8px; padding: 16px 20px; border-top: 1px solid #f1f5f9; justify-content: flex-end; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { width: 64px; height: 64px; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 28px; }

/* Loading spinner */
.spinner { width: 20px; height: 20px; border: 2px solid #e2e8f0; border-top-color: #2563eb; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin layout */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: #fff; border-right: 1px solid #e2e8f0; display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; }
.admin-sidebar.collapsed { width: 64px; } .admin-sidebar.collapsed .label { display: none; } .admin-sidebar.collapsed #sidebarTitle { display: none; }
.admin-main { flex: 1; margin-left: 240px; min-height: 100vh; background: #ffffff; transition: margin-left 0.3s; }
.admin-sidebar.collapsed + .admin-main { margin-left: 64px; }
.admin-nav { flex: 1; padding: 8px; } .admin-nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 8px; font-size: 14px; color: #64748b; transition: all 0.15s; position: relative; }
.admin-nav a:hover { background: #ffffff; color: #1e293b; }
.admin-nav a.active { background: #eff6ff; color: #2563eb; font-weight: 500; }
.admin-nav a.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: #2563eb; border-radius: 0 2px 2px 0; }
.admin-topbar { height: 56px; background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 40; }

/* Stat cards */
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.stat-card-icon { width: 40px; height: 40px; border-radius: 10px; background: #eff6ff; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-card-value { font-size: 24px; font-weight: 700; color: #2563eb; margin-top: 8px; }
.stat-card-label { font-size: 13px; color: #64748b; }

/* Tag select */
.tag-select { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-option { padding: 6px 14px; border-radius: 100px; font-size: 12px; cursor: pointer; border: 1px solid #d1d5db; color: #64748b; transition: all 0.15s; background: #fff; }
.tag-option:hover { border-color: #3b82f6; color: #2563eb; }
.tag-option.selected { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Upload */
.upload-area { width: 140px; height: 140px; border: 2px dashed #d1d5db; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; color: #94a3b8; font-size: 12px; background: #ffffff; }
.upload-area:hover { border-color: #3b82f6; color: #3b82f6; }
.upload-preview { position: relative; width: 140px; height: 140px; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview .remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(0,0,0,0.6); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; cursor: pointer; font-size: 12px; border: none; }

/* Gradient presets */
.gradient-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.gradient-preset { width: 40px; height: 32px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: all 0.15s; }
.gradient-preset:hover { transform: scale(1.08); }
.gradient-preset.active { border-color: #2563eb; }

/* BG preview */
.bg-preview-box { width: 100%; height: 160px; border-radius: 10px; border: 1px solid #e2e8f0; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.bg-preview-box .overlay-preview { position: absolute; inset: 0; pointer-events: none; }

/* Responsive */
/* Mobile nav */
.mobile-nav-btn { display: none; background: none; border: none; font-size: 24px; color: #64748b; cursor: pointer; padding: 8px; }
.mobile-nav { display: none; position: fixed; top: 64px; left: 0; right: 0; background: #fff; border-bottom: 1px solid #e2e8f0; z-index: 40; padding: 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.mobile-nav.show { display: block; }
.mobile-nav a { display: block; padding: 12px 16px; font-size: 15px; color: #475569; border-radius: 8px; }
.mobile-nav a:hover { background: #ffffff; }
.mobile-nav .btn { display: block; margin-top: 8px; }

/* Admin sidebar overlay */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 49; }
.sidebar-overlay.show { display: block; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #ffffff; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::selection { background: rgba(37,99,235,0.15); }

/* ===== RESPONSIVE ===== */

/* Tablet (769px - 1024px) */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .container { padding: 0 20px; }
}

/* Mobile (<= 768px) */
@media (max-width: 768px) {
    html { font-size: 14px; }
    .container { padding: 0 16px; }
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
    .col-span-2 { grid-column: span 1; }

    /* Hide desktop nav, show mobile */
    .hide-mobile { display: none !important; }
    .mobile-nav-btn { display: block; }

    /* Header */
    .home-header .container { height: 56px; }
    .home-header img { height: 30px; }

    /* Hero */
    section { padding: 40px 0 32px !important; }
    h1 { font-size: 28px !important; }
    .card { padding: 20px !important; }

    /* Forms */
    .form-group { margin-bottom: 14px; }
    .form-input, .form-select { height: 44px; font-size: 16px; }

    /* Buttons */
    .btn-lg { height: 44px; padding: 0 24px; font-size: 14px; }

    /* Auth pages */
    .auth-wrap { padding: 24px 16px !important; }
    .auth-card { padding: 28px 20px !important; max-width: 100% !important; }

    /* Report page */
    .report-hero { padding: 24px 0 !important; }
    .report-hero h2 { font-size: 20px !important; }

    /* Admin */
    .admin-sidebar { width: 0; overflow: hidden; transition: width 0.3s; }
    .admin-sidebar.open { width: 240px; box-shadow: 4px 0 20px rgba(0,0,0,0.15); }
    .admin-main { margin-left: 0 !important; }
    .admin-topbar { padding: 0 16px; }
    .stat-card-value { font-size: 20px; }

    /* Payment options */
    .pay-option { padding: 14px !important; }

    /* Gradient presets */
    .gradient-presets { gap: 6px; }
    .gradient-preset { width: 36px; height: 28px; }

    /* Upload area */
    .upload-area { width: 120px; height: 120px; }

    /* Tables */
    .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }
    .data-table { min-width: 600px; }

    /* Modal */
    .modal { margin: 16px; max-height: 85vh; }

    /* Footer */
    footer { padding: 24px 0 !important; }

    /* Banner image */
    .hero-banner { height: 200px !important; }
}

/* Small mobile (<= 480px) */
@media (max-width: 480px) {
    h1 { font-size: 24px !important; }
    .text-2xl { font-size: 22px; }
    .text-xl { font-size: 18px; }
    .hero-banner { height: 160px !important; border-radius: 10px !important; }
    .stat-card { padding: 16px; }
    .stat-card-value { font-size: 18px; }
    .stat-card-icon { width: 32px; height: 32px; font-size: 16px; }
    .btn-lg { height: 40px; padding: 0 20px; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .feature-icon { width: 48px !important; height: 48px !important; font-size: 20px !important; }
    section { padding: 32px 0 24px !important; }
}

/* Print */
@media print {
    body > *:not(.report-print-area) { display: none !important; }
    .report-print-area { display: block !important; position: static; background: white !important; color: black !important; padding: 40px; }
}

/* Utility */
.hidden { display: none !important; }
.w-full { width: 100%; } .max-w-md { max-width: 480px; } .max-w-lg { max-width: 600px; } .max-w-xl { max-width: 720px; }
.h-full { height: 100%; } .min-h-screen { min-height: 100vh; }
.relative { position: relative; } .sticky { position: sticky; } .top-0 { top: 0; }
.overflow-hidden { overflow: hidden; } .overflow-x-auto { overflow-x: auto; }
.cursor-pointer { cursor: pointer; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-mono { font-family: "SF Mono", Consolas, monospace; }
.rounded { border-radius: 10px; } .rounded-lg { border-radius: 12px; }
.border-t { border-top: 1px solid #e2e8f0; } .border-b { border-bottom: 1px solid #e2e8f0; }
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.opacity-50 { opacity: 0.5; }
