/* ===== 财务一体化演示系统 全局样式（浅色主题） ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #0891b2;
    --text: #1f2937;
    --text-sub: #6b7280;
    --border: #e5e7eb;
    --bg: #f3f5f9;
    --card: #ffffff;
    --sidebar-w: 232px;
    --red: #dc2626;   /* 涨 */
    --green: #16a34a; /* 跌 */
}
body { font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== 布局 ===== */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.logo-mark {
    width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.logo-text strong { display: block; font-size: 15px; }
.logo-text small { color: var(--text-sub); font-size: 11px; }
.nav { flex: 1; overflow-y: auto; padding: 8px 0 16px; }
.nav-title { padding: 14px 20px 6px; font-size: 11px; color: #9ca3af; letter-spacing: 1px; font-weight: 600; }
.nav-item {
    display: flex; align-items: center; gap: 8px; padding: 8px 20px; color: var(--text);
    font-size: 13.5px; border-left: 3px solid transparent;
}
.nav-item:hover { background: #f8fafc; text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 14px; }
.scan-nav.active { background: #fef2f2; color: var(--danger); border-left-color: var(--danger); }
.sidebar-foot { padding: 12px 18px; border-top: 1px solid var(--border); }
.pseudo-tag { font-size: 11px; color: #9ca3af; background: #f8fafc; border: 1px dashed #d1d5db; border-radius: 6px; padding: 6px 8px; text-align: center; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: #fff; border-bottom: 1px solid var(--border); padding: 0 24px; height: 60px;
    display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 40;
}
.page-title { font-size: 17px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.burger { display: none; border: none; background: none; font-size: 20px; cursor: pointer; }

.content { padding: 24px; flex: 1; }
.footer { padding: 14px 24px; color: #9ca3af; font-size: 12px; border-top: 1px solid var(--border); background: #fff; }

/* ===== 卡片 ===== */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-header h2 { font-size: 15px; }
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }
.card-title { font-size: 15px; font-weight: 600; }

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; flex-shrink: 0; }
.stat-label { color: var(--text-sub); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { background: #f9fafb; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-sub); font-weight: 600; white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.table tr:hover td { background: #fafbfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .empty { text-align: center; color: #9ca3af; padding: 40px 0; }

/* ===== 徽章 ===== */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-gray { background: #f3f4f6; color: #4b5563; }
.badge-purple { background: #ede9fe; color: #6d28d9; }

/* 涨跌色（中国习惯：涨红跌绿） */
.up { color: var(--red); font-weight: 600; }
.down { color: var(--green); font-weight: 600; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font-size: 13.5px; cursor: pointer; transition: .15s; text-decoration: none !important; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-xs { padding: 2px 8px; font-size: 12px; border-radius: 5px; }
.btn-link { color: var(--primary); background: none; border: none; cursor: pointer; font-size: 13px; padding: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; color: var(--text-sub); font-weight: 500; }
.form-group .required::after { content: " *"; color: var(--danger); }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
    border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; font-family: inherit;
    background: #fff; color: var(--text); outline: none; transition: .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }
.form-hint { font-size: 12px; color: #9ca3af; }
.checkbox-list { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #fff; cursor: pointer; transition: .15s; }
.checkbox-item:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.checkbox-item input { accent-color: var(--primary); width: 16px; height: 16px; }
.radio-item { display: flex; align-items: center; gap: 6px; }

/* ===== 提示条 ===== */
.flash { padding: 12px 20px; margin: 16px 24px 0; border-radius: 10px; font-size: 13.5px; cursor: pointer; }
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

/* ===== 页签 ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 9px 18px; font-size: 13.5px; color: var(--text-sub); cursor: pointer; border-bottom: 2px solid transparent; text-decoration: none !important; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ===== 工具栏 ===== */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* ===== 详情页 ===== */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.detail-item { background: #f9fafb; border-radius: 10px; padding: 12px 14px; }
.detail-item .k { font-size: 12px; color: var(--text-sub); }
.detail-item .v { font-size: 15px; font-weight: 600; margin-top: 4px; word-break: break-all; }

/* ===== 轨迹 ===== */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2px; background: #e5e7eb; }
.tl-item { position: relative; padding: 0 0 20px; }
.tl-item::before { content: ""; position: absolute; left: -23px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.tl-item.in::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.tl-item.out::before { background: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.tl-item.adjust::before { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }
.tl-time { font-size: 12px; color: #9ca3af; }
.tl-body { margin-top: 3px; }

/* ===== 图表 ===== */
.chart-box { position: relative; width: 100%; }
.chart-box svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-sub); margin-top: 8px; }
.chart-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.cost-bar { height: 16px; border-radius: 4px; transition: .3s; min-width: 2px; }
.cost-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cost-bar-row .lbl { width: 150px; font-size: 12.5px; color: var(--text-sub); text-align: right; flex-shrink: 0; }
.cost-bar-row .bar-track { flex: 1; background: #f3f4f6; border-radius: 6px; overflow: hidden; display: flex; }
.cost-bar-row .val { width: 130px; font-size: 12.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* ===== 扫描识别 ===== */
.scan-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.conf { font-size: 11px; margin-left: 6px; }
.conf-high { color: var(--success); }
.conf-low { color: var(--warning); }

/* ===== 登录页 ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%); }
.login-box { width: 400px; max-width: 92vw; background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(37,99,235,.12); padding: 36px 36px 28px; }
.login-box .logo-mark { width: 52px; height: 52px; font-size: 26px; margin: 0 auto 14px; }
.login-box h1 { text-align: center; font-size: 19px; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: var(--text-sub); font-size: 12.5px; margin-bottom: 24px; }
.demo-accounts { background: #f8fafc; border-radius: 10px; padding: 12px 14px; font-size: 12px; color: var(--text-sub); margin-top: 20px; line-height: 1.9; }
.demo-accounts code { background: #eef2ff; color: var(--primary); padding: 1px 6px; border-radius: 4px; font-size: 11.5px; }

/* ===== 弹窗 ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 14px; width: 420px; max-width: 92vw; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal h3 { margin-bottom: 10px; }
.modal p { color: var(--text-sub); margin-bottom: 20px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ===== 其他 ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--text-sub); }
.text-center { text-align: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: #f3f4f6; border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--text-sub); }
.pill-blue { background: #dbeafe; color: #1d4ed8; }
.tag { display: inline-block; background: #eef2ff; color: var(--primary); border-radius: 6px; padding: 1px 8px; font-size: 12px; }
.pseudo-url { font-family: Consolas, monospace; font-size: 12px; color: #6b7280; background: #f8fafc; border: 1px dashed #d1d5db; border-radius: 6px; padding: 3px 8px; }
.banner { background: linear-gradient(135deg, var(--primary-light), #f5f3ff); border: 1px solid #dbeafe; border-radius: 12px; padding: 16px 20px; margin-bottom: 20px; }
.banner h3 { color: var(--primary); font-size: 15px; margin-bottom: 6px; }
.banner p { color: var(--text-sub); font-size: 13px; line-height: 1.7; }

/* 移动端 */
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: .25s; }
    body.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.2); }
    .main { margin-left: 0; }
    .burger { display: block; }
    .content { padding: 14px; }
}
