* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* 登录/注册页面 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    text-align: center;
}

.auth-card h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 8px;
}

.auth-subtitle {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #eee;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 1rem;
    color: #999;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.auth-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 8px;
}

.auth-btn:hover {
    opacity: 0.9;
}

.auth-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 12px;
    min-height: 20px;
}

/* 头部用户信息 */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-top h1 {
    font-size: 2.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.user-info span {
    font-size: 0.95rem;
    opacity: 0.9;
}

.btn-logout {
    padding: 6px 16px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

.container {
    max-width: 1920px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 8px;
}

main {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    overflow: hidden;
}

/* 上传区域 */
.upload-section {
    padding: 30px;
    border-bottom: 1px solid #eee;
}

.upload-area {
    border: 2px dashed #ddd;
    border-radius: 12px;
    padding: 50px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
}

.upload-icon {
    color: #667eea;
    margin-bottom: 15px;
}

.upload-text {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 0.9rem;
    color: #999;
}

/* 上传进度 */
.upload-progress {
    margin-top: 20px;
    text-align: center;
}

.progress-bar {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    animation: progress 1.5s ease-in-out infinite;
    width: 30%;
}

@keyframes progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.progress-text {
    color: #666;
    font-size: 0.9rem;
}

.progress-info {
    color: #999;
    font-size: 0.85rem;
    margin-top: 5px;
}

/* 操作栏 */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.stats {
    color: #666;
    font-size: 0.95rem;
}

.stats span {
    color: #667eea;
    font-weight: 600;
}

.category-stats {
    margin-top: 10px;
    display: block;
}

.category-stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #666;
    padding: 6px 0;
    border-bottom: 1px dashed #e0e0e0;
}

.category-stat-row:last-child {
    border-bottom: none;
}

.category-stat-row .category-tag {
    min-width: 60px;
    text-align: center;
}

.stat-text {
    flex: 1;
}

.stat-num {
    display: inline-block;
    text-align: right;
    font-weight: 600;
    color: #667eea;
}

.amount-num {
    width: 50px;
}

.tax-num {
    width: 45px;
}

.price-tax-num {
    width: 60px;
}

.category-stat-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #555;
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 6px;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-export {
    background: #667eea;
    color: white;
}

.btn-export:hover:not(:disabled) {
    background: #5a6fd6;
    transform: translateY(-1px);
}

.btn-export-pdf {
    background: #e74c3c;
    color: white;
}

.btn-export-pdf:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-1px);
}

.btn-sort {
    background: #fff;
    color: #667eea;
    border: 1px solid #667eea;
}

.btn-sort:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
}

.btn-clear {
    background: #fff;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.btn-clear:hover:not(:disabled) {
    background: #e74c3c;
    color: white;
}

/* 表格 */
.table-section {
    padding: 0;
}

.table-wrapper {
    overflow-x: auto;
}

.record-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.record-table thead {
    background: #f8f9fa;
}

.record-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    border-bottom: 2px solid #eee;
}

.record-table td {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    color: #555;
    font-size: 0.9rem;
}

.record-table tbody tr:hover {
    background: #f8f9fa;
}

.record-table tbody tr:last-child td {
    border-bottom: none;
}

/* 文件名可点击样式 */
.filename-cell {
    cursor: pointer;
    color: #667eea;
    font-weight: 500;
}

.filename-cell:hover {
    text-decoration: underline;
}

/* 复选框样式 */
.row-checkbox, #selectAll {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 类别标签 */
.category-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.category-餐饮 { background: #fff3e0; color: #e65100; }
.category-汽油 { background: #fce4ec; color: #c62828; }
.category-交通 { background: #e3f2fd; color: #1565c0; }
.category-住宿 { background: #f3e5f5; color: #6a1b9a; }
.category-办公 { background: #e8f5e9; color: #2e7d32; }
.category-通讯 { background: #fff8e1; color: #f57f17; }
.category-其他 { background: #eceff1; color: #546e7a; }

/* 导出状态 */
.export-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}
.export-status.exported {
    background: #e8f5e9;
    color: #2e7d32;
}
.export-status.not-exported {
    background: #fff3e0;
    color: #e65100;
}

/* 删除按钮 */
.delete-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.delete-btn:hover {
    background: #fde8e8;
}

/* 空状态 */
.empty-state td {
    text-align: center;
    padding: 60px 20px !important;
    color: #999;
}

.empty-icon {
    color: #ddd;
    margin-bottom: 15px;
}

.empty-state p {
    margin: 5px 0;
}

.empty-hint {
    font-size: 0.85rem;
    color: #bbb;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: #27ae60;
}

.toast.error {
    background: #e74c3c;
}

/* 响应式 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 15px;
    }
    
    .record-table {
        font-size: 0.8rem;
    }
    
    .record-table th,
    .record-table td {
        padding: 10px;
    }
    
    .upload-area {
        padding: 30px 15px;
    }
}

/* 管理员按钮 */
.btn-admin {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 10px;
}

.btn-admin:hover {
    background: #5a6fd6;
}

/* 管理员页面 */
.admin-container {
    min-height: 100vh;
    background: #f5f7fa;
    padding: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: white;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.admin-header h1 {
    color: #333;
    margin: 0;
}

.btn-back {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-back:hover {
    background: #5a6fd6;
}

.admin-content {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-section {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.admin-section h3 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.log-filter {
    margin-bottom: 15px;
}

.log-filter select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
}

.btn-view-logs {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-view-logs:hover {
    background: #5a6fd6;
}

.log-action {
    display: inline-block;
    padding: 4px 10px;
    background: #e8eaf6;
    color: #667eea;
    border-radius: 4px;
    font-size: 0.85rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    background: #f8f9fa;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    color: #555;
}

.admin-table tbody tr:hover {
    background: #f8f9fa;
}

.role-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    background: white;
}

.role-select:focus {
    outline: none;
    border-color: #667eea;
}
