/* ===== 徕氪科技 ERP 新风格（浅色） ===== */
:root {
    --bg: #f5f7fa;
    --bg-secondary: #eef4ff;
    --card: #ffffff;
    --card-hover: #f0f4f8;
    --accent: #4472C4;
    --accent-dim: #eef4ff;
    --accent-light: rgba(68, 114, 196, 0.08);
    --primary: #1F4E78;
    --text: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border: #e0e6ed;
    --border-focus: rgba(68, 114, 196, 0.4);
    --red: #C00000;
    --green: #70AD47;
    --orange: #ED7D31;
    --purple: #7c3aed;
    --radius: 8px;
    --radius-sm: 5px;
    --radius-lg: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;

    /* 兼容旧变量名 */
    --gray-50: #f8fafc;
    --gray-100: #f0f4f8;
    --gray-200: #e0e6ed;
    --gray-300: #d0d7de;
    --gray-400: #999999;
    --gray-500: #666666;
    --gray-600: #555555;
    --gray-700: #333333;
    --gray-800: #222222;
    --gray-900: #111111;
    --danger: #C00000;
    --success: #70AD47;
    --warning: #ED7D31;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 布局 ===== */
.app-layout { display: flex; min-height: calc(100vh - 60px); }
.main-content { flex: 1; padding: 20px 25px; overflow: auto; max-width: 1400px; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 25px; }

/* ===== 顶部导航 ===== */
.navbar {
    background: linear-gradient(135deg, #1F4E78 0%, #4472C4 100%);
    color: white;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar .brand {
    font-size: 18px; font-weight: 600; color: white;
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
}
.navbar .brand:hover { opacity: 0.92; }
.navbar .brand-dot { width: 8px; height: 8px; background: white; border-radius: 50%; display: inline-block; }
.navbar .brand .sub-title { font-size: 12px; font-weight: 400; color: rgba(255,255,255,0.75); margin-left: 8px; }

.navbar .nav-links { display: flex; gap: 4px; }
.navbar .nav-links a {
    color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 400;
    padding: 6px 14px; border-radius: 6px; transition: all .2s;
}
.navbar .nav-links a:hover { color: white; background: rgba(255,255,255,0.12); text-decoration: none; }
.navbar .nav-links a.active { color: white; font-weight: 600; background: rgba(255,255,255,0.18); }

.navbar .user-info {
    display: flex; align-items: center; gap: 12px;
    font-size: 13px; color: rgba(255,255,255,0.85);
}
.navbar .user-info a { color: rgba(255,255,255,0.85); font-size: 13px; text-decoration: none; }
.navbar .user-info a:hover { color: white; text-decoration: none; }
.navbar .user-info .divider { width: 1px; height: 14px; background: rgba(255,255,255,0.3); }

/* ===== 系统切换下拉 ===== */
.sys-switcher { display: flex; align-items: center; gap: 8px; }
.sys-dropdown {
    display: none; position: fixed; top: 55px; left: 20px;
    background: white; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 1000; min-width: 200px; overflow: hidden; border: 1px solid var(--border);
}
.sys-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    text-decoration: none; font-size: 13px; color: var(--text);
    border-bottom: 1px solid var(--border);
}
.sys-item:last-child { border-bottom: none; }
.sys-item:hover { background: var(--card-hover); color: var(--accent); text-decoration: none; }
.sys-item.active { font-weight: 600; background: var(--accent-dim); color: var(--accent); }
.sys-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ===== 左侧边栏 ===== */
.sidebar {
    width: 170px; background: white; border-right: 1px solid var(--border);
    padding: 10px 0; flex-shrink: 0;
}
.nav-item {
    padding: 10px 16px; cursor: pointer; transition: all 0.2s;
    border-left: 3px solid transparent; font-size: 13px; color: var(--gray-600);
    text-decoration: none; display: block;
}
.nav-item:hover { background: var(--card-hover); text-decoration: none; color: var(--text); }
.nav-item.active { background: var(--accent-dim); border-left-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ===== 页面标题 ===== */
.page-header { margin-bottom: 18px; display: flex; justify-content: space-between; align-items: flex-start; }
.page-header h1 { font-size: 18px; font-weight: 600; color: var(--primary); }
.page-header p { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.page-header h2 { font-size: 18px; font-weight: 600; color: var(--primary); }

/* ===== 卡片 ===== */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--primary); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--accent-dim); display: flex; justify-content: space-between; align-items: center; }
.card-title .sub { font-size: 12px; color: var(--gray-400); font-weight: 400; }
.card h2 { font-size: 15px; font-weight: 600; color: var(--primary); margin-bottom: 12px; }

/* ===== 指标卡片 ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px; margin: 0 0 18px;
}
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); border-left: 4px solid var(--accent);
}
.stat-card .stat-label { font-size: 12px; color: var(--gray-500); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-card .stat-icon { font-size: 20px; margin-bottom: 6px; }
.stat-card.primary { border-left-color: var(--accent); }
.stat-card.success { border-left-color: var(--green); }
.stat-card.warning { border-left-color: var(--orange); }
.stat-card.danger { border-left-color: var(--red); }
.stat-card.primary .stat-value { color: var(--accent); }
.stat-card.success .stat-value { color: var(--green); }
.stat-card.warning .stat-value { color: var(--orange); }
.stat-card.danger .stat-value { color: var(--red); }
.stat-card .stat-sub { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

.metric-card { background: white; border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 6px rgba(0,0,0,0.06); border-left: 4px solid var(--accent); margin-bottom: 12px; }
.metric-card.success { border-left-color: var(--green); }
.metric-card.warning { border-left-color: var(--orange); }
.metric-card.danger { border-left-color: var(--red); }
.metric-label { font-size: 12px; color: var(--gray-500); margin-bottom: 6px; }
.metric-value { font-size: 22px; font-weight: 700; color: var(--primary); }

/* ===== 表格 ===== */
.table-wrapper { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    background: var(--accent); color: white; padding: 8px 12px; text-align: left;
    font-weight: 600; font-size: 12px; position: sticky; top: 0; z-index: 10; white-space: nowrap;
}
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    padding: 8px 16px; border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all .2s; text-decoration: none; line-height: 1.4;
    font-family: var(--font);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #355a9c; text-decoration: none; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { opacity: .9; text-decoration: none; }
.btn-outline { background: white; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent-dim); text-decoration: none; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #a00000; text-decoration: none; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-warning:hover { opacity: .9; text-decoration: none; }
.btn-sm { padding: 4px 12px; font-size: 12px; border-radius: 4px; }
.btn-xs { padding: 2px 8px; font-size: 11px; border-radius: 3px; }
.btn-group { display: flex; gap: 6px; align-items: center; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; display: flex; flex-direction: column; gap: 3px; }
.form-group label { display: block; font-size: 11px; color: var(--gray-500); font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 6px 10px; border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
    color: var(--text); background: white; outline: none; transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

.search-bar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.search-bar .form-group { margin-bottom: 0; flex: 1; min-width: 120px; }
.search-bar .form-group label { font-size: 11px; margin-bottom: 3px; }
.search-bar .form-group input, .search-bar .form-group select { padding: 6px 8px; font-size: 12px; }

/* ===== 状态标签 ===== */
.status-badge {
    display: inline-flex; align-items: center; padding: 2px 8px;
    border-radius: 10px; font-size: 11px; font-weight: 500;
}
.status-pending { background: #fff3e0; color: #92400e; }
.status-processing { background: #e8f0fe; color: var(--accent); }
.status-shipped { background: #f3e8ff; color: var(--purple); }
.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-cancelled { background: #ffebee; color: var(--red); }
.status-error { background: #ffebee; color: var(--red); }

.tag-pending, .tag-approved, .tag-rejected {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 10px; font-size: 11px; font-weight: 500;
}
.tag-pending { background: #fff3e0; color: #92400e; }
.tag-approved { background: #e8f5e9; color: #2e7d32; }
.tag-rejected { background: #ffebee; color: var(--red); }

/* ===== 分页 ===== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; }
.pagination a, .pagination span { padding: 5px 11px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; color: var(--gray-600); background: white; min-width: 32px; text-align: center; text-decoration: none; }
.pagination a:hover { background: var(--gray-50); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

/* ===== 消息 ===== */
.flash-messages { margin-bottom: 16px; }
.flash-msg {
    padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 10px; font-size: 13px;
    display: flex; justify-content: space-between; align-items: center; border: 1px solid;
}
.flash-success { background: #e8f5e9; color: #2e7d32; border-color: rgba(112,173,71,0.3); }
.flash-error { background: #ffebee; color: var(--red); border-color: rgba(192,0,0,0.2); }
.flash-close { cursor: pointer; font-size: 16px; opacity: .5; }
.flash-close:hover { opacity: .8; }

.msg-error { background: #ffebee; border: 1px solid rgba(192,0,0,0.2); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.empty { text-align: center; color: var(--gray-400); padding: 48px 0; font-size: 14px; }

/* ===== 登录页 ===== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 36px 32px; width: 380px; box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.login-card h1 { font-size: 22px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.login-card .sub, .login-card .subtitle { color: var(--gray-500); font-size: 13px; margin-bottom: 24px; text-align: center; }
.login-card .btn { width: 100%; padding: 10px 0; font-size: 14px; font-weight: 600; margin-top: 12px; }
.login-card .form-group input { padding: 10px 12px; }
.login-card .logo-icon { text-align: center; font-size: 32px; margin-bottom: 10px; }
.login-error { background: #ffebee; border: 1px solid rgba(192,0,0,0.2); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }

/* ===== 详情页 ===== */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 32px; }
.detail-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.detail-item .label { font-size: 11px; color: var(--gray-500); margin-bottom: 4px; font-weight: 500; }
.detail-item .value { font-size: 14px; font-weight: 500; color: var(--text); }
.detail-row { display: flex; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 100px; color: var(--gray-500); flex-shrink: 0; }
.detail-value { flex: 1; color: var(--text); }
.detail-value.amount { font-size: 16px; font-weight: 700; color: var(--red); }

/* ===== 附件 ===== */
.attachments-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.attach-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--gray-50); }
.attach-card-title { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.attach-preview { height: 120px; background: white; border-radius: var(--radius-sm); border: 1px dashed var(--gray-300); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; overflow: hidden; }
.attach-preview img { max-width: 100%; max-height: 100%; }
.attach-preview.file { flex-direction: column; gap: 6px; font-size: 12px; color: var(--gray-500); }
.attach-actions { display: flex; gap: 12px; font-size: 12px; }
.attach-actions a { color: var(--accent); text-decoration: none; }
.attach-actions a:hover { text-decoration: underline; }
.attach-actions .delete { color: var(--red); background: none; border: none; cursor: pointer; font-size: inherit; }
.attach-empty { color: var(--gray-400); font-size: 12px; }

/* ===== 上传区 ===== */
.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.drop-zone { border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; transition: all .2s; background: var(--gray-50); }
.drop-zone:hover { border-color: var(--accent); background: var(--accent-dim); }
.drop-zone .dz-title { font-size: 14px; font-weight: 500; color: var(--primary); margin-bottom: 6px; }
.drop-zone .dz-hint { font-size: 12px; color: var(--gray-400); }

/* ===== 流程/审批流 ===== */
.flow-box { padding: 4px 0; }
.flow-item { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.flow-item:last-child { padding-bottom: 0; }
.flow-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-top: 4px; flex-shrink: 0; z-index: 1; }
.flow-item.pending .flow-dot { background: var(--gray-400); }
.flow-item.rejected .flow-dot { background: var(--red); }
.flow-item.paid .flow-dot { background: var(--green); }
.flow-item:not(:last-child)::before { content: ""; position: absolute; left: 4px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.flow-title { font-size: 13px; font-weight: 500; color: var(--text); }
.flow-meta { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.flow-comment { font-size: 12px; color: var(--gray-600); margin-top: 6px; background: var(--gray-50); padding: 8px 12px; border-radius: var(--radius-sm); display: inline-block; }

/* ===== 归档/其他 ===== */
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.archive-item {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none; color: var(--text); font-size: 14px; transition: all .2s;
}
.archive-item:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

.invoice-detail td { padding: 6px 12px 8px; background: var(--gray-50); font-size: 12px; }
.invoice-popup { display: flex; flex-wrap: wrap; gap: 14px; }
.invoice-img { max-width: 260px; max-height: 180px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.invoice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; font-size: 12px; color: var(--gray-500); }
.invoice-grid .inv-label { font-weight: 500; color: var(--gray-400); font-size: 10px; display: block; }

.review-inline { padding: 5px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; width: 110px; background: white; color: var(--text); }
.applicant-input { padding: 5px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; width: 80px; text-align: center; background: white; color: var(--text); }

.submit-form { max-width: 680px; }
.submit-form .card { padding: 24px; }

.ocr-section { margin-bottom: 20px; }
.ocr-result {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px;
    font-size: 13px; padding: 14px; background: var(--gray-50);
    border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 12px;
}

.chart-container { display: flex; align-items: flex-end; gap: 12px; padding: 12px 0; height: 180px; }
.chart-bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar-label { font-size: 11px; color: var(--gray-500); font-weight: 500; }
.chart-bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 4px; transition: height .3s; }
.chart-bar-date { font-size: 10px; color: var(--gray-400); }

.source-distribution { display: flex; gap: 48px; padding: 24px 0; justify-content: center; }
.source-item { text-align: center; }
.source-item .source-number { font-size: 32px; font-weight: 700; color: var(--primary); line-height: 1.1; }

.footer { text-align: center; color: var(--gray-400); font-size: 12px; padding: 24px 0 32px; }

/* ===== 弹窗 ===== */
.wo-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,.5); z-index: 9999; justify-content: center; align-items: center; }
.wo-modal-inner { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; max-width: 440px; width: 90%; text-align: center; }
.wo-drop-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; margin: 14px 0; cursor: pointer; transition: all .2s; color: var(--gray-500); font-size: 13px; }
.wo-drop-zone:hover, .wo-drop-zone.drag-over { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.wo-btns { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }

/* ===== Tab ===== */
.tab-bar { display: flex; gap: 0; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tab-bar a {
    padding: 8px 16px; font-size: 13px; font-weight: 500; text-decoration: none;
    border-bottom: 2px solid transparent; color: var(--gray-500);
}
.tab-bar a:hover { color: var(--text); }
.tab-bar a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== 排序 pill ===== */
.sort-pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sort-pill { padding: 4px 12px; border-radius: 4px; border: 1px solid var(--border); background: white; color: var(--gray-600); font-size: 12px; text-decoration: none; }
.sort-pill:hover { background: var(--gray-50); text-decoration: none; }
.sort-pill.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { padding: 15px; }
    .detail-grid, .form-row, .upload-grid { grid-template-columns: 1fr; }
}
