/* ========== 基础重置 ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #f8f9fb;
    --sidebar-bg: #1a202c;
    --sidebar-w: 220px;
    --card-bg: #fff;
    --border: #e8eaed;
    --border-light: #f1f3f5;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #2563eb;
    --accent-light: #eff4ff;
    --green: #16a34a;
    --green-bg: #f0fdf4;
    --red: #dc2626;
    --red-bg: #fef2f2;
    --yellow: #ca8a04;
    --yellow-bg: #fefce8;
    --radius: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 1px 3px rgba(0,0,0,.06);
    --font: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html { font-size: 14px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ========== 布局 ========== */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 28px;
    font-size: 15px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: .3px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all .15s;
}

.nav-item:hover {
    background: rgba(255,255,255,.06);
    color: #e2e8f0;
}

.nav-item.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

/* ========== 主内容区 ========== */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 0 32px 32px;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 24px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d1d5db;
}
.status-dot.online { background: var(--green); }

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -.3px;
}

/* ========== 卡片 ========== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 10px 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    background: #fafbfc;
    border-bottom: 1px solid var(--border-light);
}

td {
    padding: 12px 20px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* ========== 状态标签 ========== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2px;
}
.badge-pending { background: var(--yellow-bg); color: var(--yellow); }
.badge-paid { background: var(--green-bg); color: var(--green); }
.badge-expired { background: var(--red-bg); color: var(--red); }

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    font-family: var(--font);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: #f9fafb; }

.btn-danger {
    background: transparent;
    color: var(--red);
    border: 1px solid #fecaca;
}
.btn-danger:hover { background: var(--red-bg); }

/* ========== 表单 ========== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-primary);
    background: #fff;
    transition: border-color .15s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* ========== 收款码网格 ========== */
.qrcode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
}

.qrcode-item {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-align: center;
}

.qrcode-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #fafbfc;
    padding: 12px;
}

.qrcode-item-info {
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border-light);
}

.qrcode-item-info span {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.modal-overlay.show { display: flex; }

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-body { padding: 20px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
}

/* ========== Tab 切换 ========== */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 0 16px 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
