/* ===== 基础变量 ===== */
:root {
    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --primary-dark: #3730a3;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --warning: #ca8a04;
    --warning-light: #fefce8;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

/* ===== 全局重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--gray-900);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 导航栏 ===== */
.navbar {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}
.nav-links {
    display: flex;
    gap: 4px;
}
.nav-links a {
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--gray-700);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-links a:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-links a.active { background: var(--primary-light); color: var(--primary); }

/* ===== 主内容区 ===== */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ===== 页面标题 ===== */
.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}
.page-subtitle {
    color: var(--gray-500);
    font-size: 15px;
    margin-bottom: 32px;
}

/* ===== 卡片 ===== */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: var(--font);
    transition: border-color 0.2s;
}
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-group { flex: 1; }

/* ===== 拖拽上传区 ===== */
.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--gray-50);
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.drop-zone-icon {
    color: var(--gray-500);
    margin-bottom: 12px;
}
.drop-zone-text {
    font-size: 16px;
    color: var(--gray-700);
    margin-bottom: 4px;
}
.drop-zone-hint {
    font-size: 13px;
    color: var(--gray-500);
}
.drop-zone .file-input {
    display: none;
}

/* ===== 文件列表 ===== */
.file-list {
    margin-top: 16px;
}
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 14px;
}
.file-item-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-700);
}
.file-item-remove {
    color: var(--danger);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
}
.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-100); }
.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ===== 状态标签 ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-approved { background: var(--success-light); color: var(--success); }
.badge-rejected { background: var(--danger-light); color: var(--danger); }
.badge-pending { background: var(--warning-light); color: var(--warning); }
.badge-error { background: var(--danger-light); color: var(--danger); }

/* ===== 表格 ===== */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
thead th {
    background: var(--gray-100);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-900);
}
tbody tr:hover { background: var(--gray-50); }
tr.row-rejected { background: var(--danger-light); }
tr.row-rejected:hover { background: #fee2e2; }

/* ===== 删除按钮 ===== */
.btn-danger {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
}
.btn-danger:hover { background: #b91c1c; }

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 13px;
    color: var(--gray-500);
}
.stat-card.green .stat-value { color: var(--success); }
.stat-card.blue .stat-value { color: var(--primary); }
.stat-card.red .stat-value { color: var(--danger); }
.stat-card.yellow .stat-value { color: var(--warning); }

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-bar select, .filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font);
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 20px;
}
.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
}
.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 上传结果 ===== */
.result-item {
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    border: 1px solid var(--gray-200);
}
.result-item.approved { border-left: 4px solid var(--success); background: var(--success-light); }
.result-item.rejected { border-left: 4px solid var(--danger); background: var(--danger-light); }
.result-item.error { border-left: 4px solid var(--danger); background: var(--danger-light); }
.result-item .result-name { font-weight: 600; margin-bottom: 4px; }
.result-item .result-detail { font-size: 13px; color: var(--gray-500); }

/* ===== 加载动画 ===== */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } }

/* ===== 页脚 ===== */
.footer {
    text-align: center;
    padding: 16px;
    color: var(--gray-500);
    font-size: 13px;
    border-top: 1px solid var(--gray-200);
    background: white;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}
.empty-state-icon { margin-bottom: 12px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .form-row { flex-direction: column; }
    .nav-container { padding: 0 12px; }
    .main-content { padding: 16px 12px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ===== 导航用户态 ===== */
.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
}
.user-role {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-700);
}
.user-role.admin {
    background: var(--primary-light);
    color: var(--primary);
}
.btn-logout {
    font-size: 13px;
    color: var(--danger);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius);
    border: 1px solid transparent;
}
.btn-logout:hover { border-color: var(--danger); }

/* ===== 当前录入人 ===== */
.current-user-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}
.current-user-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}
.session-hint {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 12px;
}

/* ===== 登录页 ===== */
.login-body {
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    align-items: center;
    justify-content: center;
    display: flex;
}
.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}
.login-box {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    text-align: center;
}
.login-logo {
    color: var(--primary);
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}
.login-subtitle {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 28px;
}
.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius);
}
.login-tab {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
}
.login-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow);
}
.login-error {
    background: var(--danger-light);
    color: var(--danger);
    font-size: 13px;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    text-align: left;
}
.login-submit {
    width: 100%;
    margin-top: 8px;
}
.login-footer {
    color: var(--gray-500);
    font-size: 12px;
    margin-top: 24px;
}

/* ===== 复核弹窗 ===== */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
}
.modal-box {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 16px;
    font-weight: 700;
}
.modal-close {
    background: none;
    border: none;
    font-size: 26px;
    line-height: 1;
    color: var(--gray-500);
    cursor: pointer;
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ===== 文本域 ===== */
textarea.form-input {
    resize: vertical;
    min-height: 80px;
    font-family: var(--font);
}

/* ===== 核对识别结果表单 ===== */
.review-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    background: var(--gray-50);
}
.review-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.review-card-head strong {
    font-size: 14px;
    word-break: break-all;
}
.review-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}
.review-grid label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    color: var(--gray-500);
    gap: 4px;
}
.review-grid .form-input {
    font-size: 14px;
    padding: 8px 10px;
}
.review-error {
    color: var(--danger);
    font-size: 12px;
    margin-bottom: 8px;
}
@media (max-width: 640px) {
    .review-grid { grid-template-columns: 1fr; }
}
