* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; background: #f0f2f5; color: #333; font-size: 14px; }

/* 登录页 */
.login-page { width: 100vw; height: 100vh; background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 100%); display: flex; align-items: center; justify-content: center; }
.login-box { width: 400px; background: #fff; border-radius: 12px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-header { text-align: center; margin-bottom: 25px; padding-top: 10px; }
.login-header h1 { font-size: 24px; color: #1a73e8; margin-bottom: 8px; letter-spacing: 1px; }
.login-header p { color: #999; font-size: 13px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; margin-bottom: 6px; color: #555; font-weight: 500; }
.login-form input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border-color 0.2s; }
.login-form input:focus { outline: none; border-color: #1a73e8; }
.login-tip { text-align: center; color: #999; font-size: 12px; margin-top: 15px; }

/* 主布局 */
.main-app { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 220px; background: #001529; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-header { padding: 18px 16px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid #1f3a5f; }
.logo-text { font-size: 15px; font-weight: 600; text-align: center; line-height: 1.4; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-group { margin-bottom: 4px; }
.nav-title { padding: 10px 16px; font-size: 13px; color: #6b8cae; cursor: pointer; user-select: none; display: flex; justify-content: space-between; align-items: center; transition: color 0.2s; }
.nav-title:hover { color: #fff; }
.nav-title .arrow { font-size: 10px; transition: transform 0.2s; }
.nav-group.collapsed .nav-title .arrow { transform: rotate(-90deg); }
.nav-group.collapsed .nav-items { display: none; }
.nav-items { overflow: hidden; }
.nav-item { display: block; padding: 9px 16px 9px 28px; color: #b8c7d9; text-decoration: none; cursor: pointer; transition: all 0.2s; font-size: 13px; border-left: 3px solid transparent; }
.nav-item:hover { background: #1f3a5f; color: #fff; }
.nav-item.active { background: #1a73e8; color: #fff; border-left-color: #4fc3f7; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: 56px; background: #fff; border-bottom: 1px solid #e8e8e8; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0; }
.page-title { font-size: 16px; font-weight: 600; color: #262626; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-info { color: #595959; }
.content-body { flex: 1; overflow-y: auto; padding: 20px; }

/* 通用组件 */
.card { background: #fff; border-radius: 8px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: #262626; display: flex; justify-content: space-between; align-items: center; }

.btn { padding: 6px 16px; border-radius: 4px; border: 1px solid #d9d9d9; background: #fff; cursor: pointer; font-size: 13px; transition: all 0.2s; display: inline-flex; align-items: center; gap: 4px; }
.btn:hover { border-color: #1a73e8; color: #1a73e8; }
.btn-primary { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.btn-primary:hover { background: #1557b0; color: #fff; }
.btn-danger { background: #ff4d4f; color: #fff; border-color: #ff4d4f; }
.btn-danger:hover { background: #d9363e; color: #fff; }
.btn-success { background: #52c41a; color: #fff; border-color: #52c41a; }
.btn-success:hover { background: #389e0d; color: #fff; }
.btn-warning { background: #faad14; color: #fff; border-color: #faad14; }
.btn-text { background: none; border: none; color: #1a73e8; cursor: pointer; padding: 4px 8px; font-size: 13px; }
.btn-text:hover { text-decoration: underline; }
.btn-text.danger { color: #ff4d4f; }
.btn-block { width: 100%; padding: 11px; }
.btn-sm { padding: 3px 10px; font-size: 12px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: #fafafa; padding: 10px 12px; text-align: left; font-weight: 600; color: #595959; border-bottom: 1px solid #e8e8e8; white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; color: #333; }
tr:hover td { background: #f5f8ff; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* 表单 */
.form-row { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.form-group { flex: 1; min-width: 200px; }
.form-group label { display: block; margin-bottom: 6px; color: #595959; font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 7px 10px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #1a73e8; }
.form-group textarea { resize: vertical; min-height: 60px; }

/* 搜索栏 */
.search-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.search-bar .form-group { min-width: 160px; flex: none; }

/* 标签 */
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; }
.tag-blue { background: #e6f4ff; color: #1a73e8; }
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-red { background: #fff1f0; color: #ff4d4f; }
.tag-orange { background: #fff7e6; color: #fa8c16; }
.tag-gray { background: #f5f5f5; color: #8c8c8c; }
.tag-purple { background: #f9f0ff; color: #722ed1; }

/* 统计卡片 */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.stat-card .stat-label { color: #8c8c8c; font-size: 13px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: #262626; }
.stat-card .stat-value.blue { color: #1a73e8; }
.stat-card .stat-value.green { color: #52c41a; }
.stat-card .stat-value.red { color: #ff4d4f; }
.stat-card .stat-value.orange { color: #fa8c16; }
.stat-card .stat-sub { font-size: 12px; color: #8c8c8c; margin-top: 4px; }

/* 分页 */
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 16px; }
.pagination button { padding: 5px 12px; border: 1px solid #d9d9d9; background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; }
.pagination button:hover:not(:disabled) { border-color: #1a73e8; color: #1a73e8; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination .page-info { color: #8c8c8c; font-size: 13px; }

/* 弹窗 */
.modal-mask { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 8px; width: 90%; max-width: 800px; max-height: 85vh; display: flex; flex-direction: column; }
.modal.large { max-width: 1000px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #999; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #f0f0f0; display: flex; justify-content: flex-end; gap: 10px; }

/* 明细表格编辑 */
.detail-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.detail-table th { background: #fafafa; padding: 8px; font-size: 12px; }
.detail-table td { padding: 6px; }
.detail-table input, .detail-table select { width: 100%; padding: 5px 8px; border: 1px solid #d9d9d9; border-radius: 3px; font-size: 12px; }
.detail-table .btn-del { background: none; border: none; color: #ff4d4f; cursor: pointer; font-size: 16px; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; }
.toast { padding: 10px 20px; border-radius: 4px; color: #fff; margin-bottom: 8px; animation: slideIn 0.3s; font-size: 13px; }
.toast.success { background: #52c41a; }
.toast.error { background: #ff4d4f; }
.toast.info { background: #1a73e8; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 空状态 */
.empty { text-align: center; padding: 40px; color: #999; }
.empty-icon { font-size: 48px; margin-bottom: 10px; }

/* 图表区 */
.chart-container { height: 300px; display: flex; align-items: flex-end; gap: 8px; padding: 20px; }
.chart-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bars { display: flex; gap: 3px; align-items: flex-end; height: 240px; }
.chart-bar { width: 20px; border-radius: 3px 3px 0 0; transition: height 0.3s; }
.chart-bar.in { background: #52c41a; }
.chart-bar.out { background: #ff4d4f; }
.chart-label { font-size: 11px; color: #999; }

/* 两列布局 */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1200px) { .two-col { grid-template-columns: 1fr; } }

/* 金额高亮 */
.amount { font-weight: 600; color: #ff4d4f; }
.amount.in { color: #52c41a; }

/* 滚动条 */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-track { background: #f5f5f5; }
