/* ============================================
   大圣学成财务系统 - 主样式表
   电脑/手机自适应
   ============================================ */

/* === 基础变量 === */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #ea580c;
    --warning-light: #fff7ed;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --purple: #7c3aed;
    --purple-light: #f3e8ff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 220px;
    --topbar-height: 56px;
    --mobile-nav-height: 56px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* === 重置 === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; }

/* === 登录页 === */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-container { width: 100%; max-width: 400px; }
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-header h1 {
    font-size: 28px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 4px;
}
.login-header p { color: var(--gray-500); font-size: 14px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-weight: 500; margin-bottom: 6px; color: var(--gray-700); }
.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
    outline: none;
}
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-footer { text-align: center; margin-top: 20px; color: var(--gray-400); font-size: 12px; }

/* === 应用布局 === */
.app-container { display: flex; min-height: 100vh; }

/* === 侧边栏 === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}
.logo { font-size: 22px; font-weight: 700; color: #fff; margin: 0; }
.logo-sub { font-size: 11px; color: var(--gray-400); }
.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--gray-300);
    font-size: 14px;
    transition: all 0.2s;
    position: relative;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { margin-right: 12px; font-size: 18px; width: 24px; text-align: center; }
.nav-badge {
    position: absolute;
    right: 12px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* === 主内容 === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === 顶部栏 === */
.top-bar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--gray-600);
    padding: 4px 8px;
}
.top-bar-right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.notification-bell {
    position: relative;
    font-size: 20px;
    color: var(--gray-600);
    cursor: pointer;
}
.bell-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}
.user-info { display: flex; flex-direction: column; align-items: flex-end; }
.user-name { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.user-role { font-size: 11px; color: var(--gray-400); }
.btn-logout { color: var(--gray-400); font-size: 18px; padding: 4px; }
.btn-logout:hover { color: var(--danger); }

/* === 页面内容 === */
.page-content { flex: 1; padding: 24px; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--gray-800); }
.page-date { color: var(--gray-500); font-size: 13px; }

/* === 统计卡片 === */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.stat-blue::before { background: var(--primary); }
.stat-green::before { background: var(--success); }
.stat-orange::before { background: var(--warning); }
.stat-purple::before { background: var(--purple); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--gray-800); margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--gray-500); margin-bottom: 4px; }
.stat-sub { font-size: 12px; color: var(--gray-400); }

/* === 卡片 === */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 20px; }

/* === 表格 === */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    background: var(--gray-50);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}
.table tbody tr:hover { background: var(--gray-50); }
.table-compact th, .table-compact td { padding: 6px 10px; font-size: 12px; }

/* === 表单 === */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 4px;
}
.form-group label .required { color: var(--danger); }
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-inline { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

/* === 按钮 === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 6px;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { opacity: 0.9; color: #fff; }
.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* === 提示框 === */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.alert-info { background: var(--primary-light); color: var(--primary); border: 1px solid #bfdbfe; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fed7aa; }

/* === 标签 === */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--primary-light); color: var(--primary); }

/* === 文本工具类 === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-400); }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary) !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* === 筛选栏 === */
.filter-bar {
    background: #fff;
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.filter-bar .form-inline { gap: 12px; }
.filter-bar .form-group { min-width: 120px; }

/* === 模态框 === */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-400);
    line-height: 1;
}
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 20px; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* === 通知弹窗 === */
.notification-popup {
    position: fixed;
    top: 70px;
    right: 20px;
    width: 320px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    border: 1px solid var(--gray-200);
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    font-weight: 600;
    font-size: 14px;
}
.popup-header button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.8;
}
.popup-header button:hover { opacity: 1; }
.popup-body { padding: 12px 16px; max-height: 300px; overflow-y: auto; }
.popup-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}
.popup-item:last-child { border-bottom: none; }
.popup-item .popup-time { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* === 通知列表 === */
.notification-list { list-style: none; }
.notification-item {
    display: flex;
    align-items: flex-start;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    gap: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.notification-item:hover { background: var(--gray-50); }
.notification-item.unread { background: var(--primary-light); }
.notification-item.unread:hover { background: #c7d9f5; }
.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}
.notification-dot.read { background: transparent; }
.notification-content { flex: 1; }
.notification-title { font-weight: 600; font-size: 14px; color: var(--gray-800); }
.notification-text { font-size: 13px; color: var(--gray-600); margin-top: 2px; }
.notification-time { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* === 表单分区标签 === */
.form-section-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    padding: 12px 0 8px;
    margin-top: 8px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 12px;
}

/* === 折叠按钮 === */
.mobile-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: var(--gray-50);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius);
    color: var(--gray-500);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 8px 0 16px;
}
.mobile-toggle-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.mobile-toggle-btn:active { transform: scale(0.98); }

/* === 可选字段折叠区 === */
#optionalFields.collapsed { display: none; }

/* === 凭证上传区域 === */
.upload-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.upload-hint {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* === 表单操作按钮区 === */
.form-actions {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

/* === 图片上传 === */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-area:active { transform: scale(0.98); border-color: var(--primary); }
.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.upload-icon { font-size: 32px; color: var(--gray-400); margin-bottom: 8px; }
.upload-text { font-size: 13px; color: var(--gray-500); }
.upload-preview {
    display: inline-block;
    margin: 8px;
    position: relative;
}
.upload-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
}
.upload-preview .remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === 业绩榜单 === */
.ranking-list { list-style: none; }
.ranking-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    gap: 16px;
}
.ranking-item:hover { background: var(--gray-50); }
.ranking-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    background: var(--gray-100);
    color: var(--gray-600);
    flex-shrink: 0;
}
.ranking-item:nth-child(1) .ranking-num { background: #fbbf24; color: #fff; }
.ranking-item:nth-child(2) .ranking-num { background: #9ca3af; color: #fff; }
.ranking-item:nth-child(3) .ranking-num { background: #d97706; color: #fff; }
.ranking-info { flex: 1; }
.ranking-name { font-weight: 600; font-size: 15px; color: var(--gray-800); }
.ranking-detail { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.ranking-amount { font-weight: 700; font-size: 16px; color: var(--primary); text-align: right; }

/* === 分页 === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-size: 13px;
    color: var(--gray-600);
    text-decoration: none;
}
.pagination a:hover { background: var(--gray-100); }
.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.pagination .disabled { opacity: 0.5; pointer-events: none; }

/* === 设置页 === */
.settings-section { margin-bottom: 24px; }
.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--gray-100);
    border-radius: 16px;
    font-size: 13px;
}
.tag-item .tag-remove {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}
.tag-item .tag-remove:hover { color: var(--danger); }
.tag-add-form { display: flex; gap: 8px; }
.tag-add-form input { flex: 1; }

/* === 开关 === */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-300);
    border-radius: 24px;
    transition: 0.3s;
}
.switch .slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* === 备份记录 === */
.backup-list { list-style: none; }
.backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
}
.backup-info { flex: 1; }
.backup-name { font-weight: 500; font-size: 14px; }
.backup-meta { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* === 预警卡片 === */
.alert-card { border-left: 4px solid var(--warning); }
.alert-section { margin-bottom: 16px; }
.alert-section:last-child { margin-bottom: 0; }
.alert-section h4 { margin-bottom: 8px; font-size: 14px; }

/* === Tab切换 === */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab-item {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-item:hover { color: var(--gray-700); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* === 移动端底部导航 === */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: #fff;
    border-top: 1px solid var(--gray-200);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
}
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    color: var(--gray-500);
    text-decoration: none;
    padding: 4px 8px;
    position: relative;
}
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-icon { font-size: 20px; margin-bottom: 2px; }
.mobile-badge {
    position: absolute;
    top: 0;
    right: 2px;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    padding: 0 4px;
    border-radius: 8px;
    min-width: 14px;
    text-align: center;
}

/* === 遮罩层（移动端侧边栏） === */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ============================================
   响应式 - 平板
   ============================================ */
@media (max-width: 1024px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .form-row-3 { grid-template-columns: 1fr 1fr; }
}

/* ============================================
   响应式 - 手机
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    
    .main-content {
        margin-left: 0;
        padding-bottom: calc(var(--mobile-nav-height) + 16px);
    }
    
    .menu-toggle { display: block; }
    .mobile-nav { display: flex; }
    
    .top-bar { padding: 0 12px; }
    .user-info { display: none; }
    .page-content { padding: 12px; }
    
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 14px; }
    .stat-sub { font-size: 12px; }
    
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .form-row-3 { grid-template-columns: 1fr; }
    .form-inline { flex-direction: column; }
    .form-inline .form-group { width: 100%; }
    
    .page-header h2 { font-size: 22px; }
    
    .card-body { padding: 14px; }
    .card-header { padding: 14px 16px; }
    .card-header h3 { font-size: 18px; }
    
    .table th, .table td { padding: 10px 8px; font-size: 14px; }
    
    .filter-bar { padding: 14px; }
    .filter-bar .form-group select,
    .filter-bar .form-group input { font-size: 15px; padding: 10px 12px; }
    
    .btn { font-size: 15px; padding: 10px 18px; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; }
    
    .modal { max-width: 100%; margin: 10px; border-radius: 12px; }
    
    .notification-popup { width: calc(100% - 24px); right: 12px; }
    
    .ranking-item { padding: 12px 14px; gap: 10px; }
    .ranking-name { font-size: 17px; }
    .ranking-detail { font-size: 14px; }
    .ranking-amount { font-size: 17px; }
    
    .tabs { overflow-x: auto; }
    .tab-item { padding: 10px 16px; font-size: 15px; white-space: nowrap; }
    
    /* === 移动端表单优化 - 大字体 === */
    body { font-size: 16px; }
    .form-group { margin-bottom: 18px; }
    .form-group label {
        font-size: 17px;
        font-weight: 600;
        padding: 4px 0;
        color: var(--gray-800);
    }
    .form-group label .required { font-size: 17px; }
    .form-control {
        padding: 14px 16px;
        font-size: 18px; /* 大字体 + 防止iOS自动缩放 */
        border-radius: 8px;
    }
    select.form-control {
        padding: 14px 16px;
        font-size: 18px;
        min-height: 50px; /* 触摸友好最小高度 */
    }
    textarea.form-control { min-height: 110px; font-size: 17px; }
    input[type="date"].form-control { font-size: 17px; min-height: 50px; }
    input[type="tel"].form-control { font-size: 18px; letter-spacing: 1px; }
    
    /* 金额输入特别突出 */
    .amount-input {
        font-size: 20px !important;
        font-weight: 700;
        color: var(--gray-900);
    }
    
    /* 移动端上传区域：更大更明显 */
    .upload-section {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .upload-area {
        padding: 32px 16px;
        min-height: 130px;
        border-radius: 12px;
        border-width: 2px;
    }
    .upload-icon { font-size: 44px; margin-bottom: 10px; }
    .upload-text { font-size: 17px; color: var(--gray-600); font-weight: 500; }
    .upload-hint { font-size: 14px; margin-top: 6px; }
    
    /* 移动端折叠按钮更大 */
    .mobile-toggle-btn {
        padding: 16px;
        font-size: 16px;
        font-weight: 500;
        border-radius: 10px;
        min-height: 52px;
    }
    
    /* 移动端表单操作按钮 */
    .form-actions {
        position: sticky;
        bottom: calc(var(--mobile-nav-height) + 8px);
        background: #fff;
        padding: 14px 0;
        margin-bottom: 0;
        z-index: 10;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
        border-radius: 0 0 var(--radius) var(--radius);
    }
    .form-actions .btn {
        min-height: 52px;
        font-size: 18px;
        font-weight: 700;
    }
    
    /* 移动端分区标签 */
    .form-section-label {
        font-size: 18px;
        font-weight: 700;
        padding: 12px 0 10px;
        color: var(--gray-800);
    }
    
    /* 移动端预览图更大 */
    .upload-preview img {
        width: 120px;
        height: 120px;
    }
    
    /* 移动端分页 */
    .pagination a, .pagination span {
        padding: 8px 14px;
        font-size: 15px;
    }
    
    /* 移动端提示框 */
    .alert { font-size: 15px; padding: 14px 16px; }
    
    /* 移动端标签 */
    .badge { font-size: 13px; padding: 3px 10px; }
    
    /* 移动端通知项 */
    .notification-title { font-size: 16px; }
    .notification-text { font-size: 15px; }
    .notification-time { font-size: 13px; }
}

@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 13px; }
    .login-card { padding: 28px 20px; }
    
    /* 小屏手机也保持大字体 */
    .form-group label { font-size: 16px; }
    .form-control { font-size: 17px; padding: 13px 14px; }
    select.form-control { font-size: 17px; }
    .amount-input { font-size: 19px !important; }
    .form-section-label { font-size: 17px; }
    .form-actions .btn { font-size: 17px; min-height: 50px; }
    .upload-text { font-size: 16px; }
    .table th, .table td { font-size: 13px; padding: 9px 6px; }
}

/* ============================================
   步骤向导
   ============================================ */
.wizard-container {
    max-width: 600px;
    margin: 0 auto;
}

/* 顶部栏 */
.wizard-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 1px solid var(--gray-200);
}
.wizard-back-btn {
    font-size: 15px;
    color: var(--gray-500);
    text-decoration: none;
    padding: 4px 0;
}
.wizard-back-btn:hover { color: var(--primary); }
.wizard-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--gray-800);
}
.wizard-step-counter {
    font-size: 14px;
    color: var(--gray-400);
    font-weight: 500;
}

/* 进度条 */
.wizard-progress {
    height: 4px;
    background: var(--gray-200);
    position: relative;
}
.wizard-progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    width: 12.5%;
    border-radius: 0 2px 2px 0;
}

/* 步骤主体 */
.wizard-body {
    background: #fff;
    min-height: 320px;
    padding: 0;
}

/* 每个步骤默认隐藏 */
.wizard-step {
    display: none;
    padding: 28px 20px;
    animation: wizardFadeIn 0.25s ease;
}
.wizard-step.active {
    display: block;
}
@keyframes wizardFadeIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 步骤图标 */
.wizard-step-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
    line-height: 1;
}

/* 步骤标题 */
.wizard-step-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-800);
    text-align: center;
    margin-bottom: 8px;
}
.wizard-step-title .required { color: var(--danger); }

/* 步骤描述 */
.wizard-step-desc {
    font-size: 15px;
    color: var(--gray-400);
    text-align: center;
    margin-bottom: 28px;
}

/* 步骤输入区域 */
.wizard-step-input {
    max-width: 400px;
    margin: 0 auto;
}
.wizard-step-input .form-control {
    text-align: center;
    font-size: 20px;
    padding: 16px;
}
.wizard-step-input .form-control::placeholder {
    color: var(--gray-300);
    font-size: 17px;
}

/* 多字段步骤中的小组 */
.wizard-mini-group {
    margin-bottom: 16px;
}
.wizard-mini-group label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
    text-align: left;
}
.wizard-mini-group .form-control {
    text-align: left;
    font-size: 17px;
    padding: 12px 14px;
}

/* 向导中的上传卡片 */
.wizard-upload-card {
    margin-bottom: 16px;
}
.wizard-mini-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 8px;
    text-align: left;
}

/* 底部导航栏 */
.wizard-nav {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid var(--gray-200);
    border-radius: 0 0 var(--radius) var(--radius);
    position: sticky;
    bottom: 0;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.wizard-nav-btn {
    flex: 1;
    min-height: 52px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 10px;
}
.wizard-skip-btn {
    background: var(--gray-100);
    color: var(--gray-500);
    border: none;
}
.wizard-skip-btn:hover { background: var(--gray-200); color: var(--gray-700); }

/* 隐藏第一步的上一步按钮 */
.wizard-step[data-step="1"] ~ .wizard-nav #wizardPrev,
.wizard-nav.at-first #wizardPrev { visibility: hidden; }

/* 最后一步的导航 */
.wizard-nav.at-last #wizardSkip { display: none; }
.wizard-nav.at-last #wizardNext {
    background: var(--success);
}
.wizard-nav.at-last #wizardNext::after { content: ''; }

/* 确认列表 */
.review-list {
    width: 100%;
}
.review-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    gap: 12px;
}
.review-item:last-child { border-bottom: none; }
.review-label {
    font-size: 14px;
    color: var(--gray-400);
    flex-shrink: 0;
    min-width: 80px;
    padding-top: 2px;
}
.review-value {
    font-size: 17px;
    font-weight: 600;
    color: var(--gray-800);
    text-align: right;
    flex: 1;
    word-break: break-all;
}
.review-value.empty {
    color: var(--gray-300);
    font-weight: 400;
    font-style: italic;
}
.review-edit-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 2px 4px;
    white-space: nowrap;
}
.review-edit-btn:hover { text-decoration: underline; }

/* 必填校验抖动动画 */
@keyframes wizardShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}
.wizard-shake {
    animation: wizardShake 0.4s ease;
}
.wizard-error-hint {
    color: var(--danger);
    font-size: 14px;
    text-align: center;
    margin-top: 12px;
    display: none;
}
.wizard-error-hint.show { display: block; }

/* 向导步骤输入框居中（select也居中） */
.wizard-step-input select.form-control {
    text-align: center;
    text-align-last: center;
}

/* 向导中选择框移动端优化 - 确保选项可见 */
@media (max-width: 768px) {
    .wizard-step-input select.form-control {
        text-align: left;
        text-align-last: left;
        font-size: 18px;
        padding: 14px 36px 14px 16px;
        min-height: 52px;
        -webkit-appearance: menulist;
        appearance: menulist;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        background-size: 12px;
        padding-right: 40px;
        color: var(--gray-800);
        background-color: #fff;
    }
    .wizard-step-input select.form-control option {
        text-align: left;
        font-size: 17px;
        padding: 12px 16px;
        color: var(--gray-800);
        background: #fff;
    }
    .wizard-mini-group select.form-control {
        text-align: left;
        text-align-last: left;
        font-size: 17px;
        padding: 12px 36px 12px 14px;
        min-height: 50px;
        -webkit-appearance: menulist;
        appearance: menulist;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='2' fill='none'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        background-size: 12px;
        padding-right: 40px;
    }
    .wizard-mini-group select.form-control option {
        text-align: left;
        font-size: 16px;
        padding: 10px 14px;
        color: var(--gray-800);
        background: #fff;
    }
}

/* === 桌面/手机显示切换 === */
.desktop-only { display: block; }
.mobile-only { display: none; }
.mobile-only.flex-on-mobile { display: none; }
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }
    .mobile-only.flex-on-mobile { display: flex !important; }
}

/* === 手机端快速操作栏 === */
.mobile-quick-actions {
    display: none;
    gap: 10px;
    margin-bottom: 16px;
}
.mobile-quick-add-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 0;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
    transition: all 0.2s;
}
.mobile-quick-add-btn:active { transform: scale(0.97); opacity: 0.9; }
.mobile-quick-export-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    background: #fff;
    color: var(--success);
    border: 1px solid var(--success);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}
.mobile-quick-export-btn:active { background: var(--success-light); }

/* === 手机端学员卡片 === */
.student-cards {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.student-card {
    display: block;
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    border-left: 4px solid transparent;
    position: relative;
}
.student-card:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.student-card.overdue {
    border-left-color: var(--danger);
}
.student-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.student-card-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-800);
}
.student-card-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}
.student-card-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.student-card-tag {
    display: inline-block;
    padding: 2px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}
.student-card-phone {
    font-size: 14px;
    color: var(--gray-500);
}
.student-card-campus {
    font-size: 13px;
    color: var(--gray-400);
}
.student-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
}
.student-card-date {
    font-size: 12px;
    color: var(--gray-400);
}
.student-card-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}
.student-empty-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.student-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.student-empty-text {
    font-size: 16px;
    color: var(--gray-400);
}

/* === 手机端浮动新增按钮 === */
.student-fab {
    display: none;
    position: fixed;
    bottom: calc(var(--mobile-nav-height) + 20px);
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 28px;
    font-weight: 300;
    text-decoration: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
    z-index: 90;
    transition: all 0.2s;
    line-height: 1;
}
.student-fab:active {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}
@media (max-width: 768px) {
    .student-fab { display: flex; }
}

/* === 手机端向导导航修复 - 避免被底部导航遮挡 === */
@media (max-width: 768px) {
    .wizard-nav {
        bottom: var(--mobile-nav-height);
        margin-bottom: 0;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }
    .wizard-container {
        padding-bottom: calc(var(--mobile-nav-height) + 80px);
    }
    .wizard-step-input .form-control {
        font-size: 18px;
        padding: 14px 16px;
    }
    .wizard-step-title {
        font-size: 20px;
    }
    .wizard-step-desc {
        font-size: 14px;
        margin-bottom: 20px;
    }
    .wizard-step-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }
    .review-label {
        font-size: 13px;
        min-width: 70px;
    }
    .review-value {
        font-size: 15px;
    }
    .review-edit-btn {
        font-size: 13px;
        padding: 6px 8px;
    }
}

/* === 打印样式 === */
@media print {
    .sidebar, .top-bar, .mobile-nav, .btn, .filter-bar, .student-fab, .mobile-quick-actions { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd; }
}
