/* =========================================================================
 * 智投 · 被投企业驾驶舱 — 主题样式
 * 设计语言：深色导航侧栏 + 浅色工作区，克制配色，强调数据可读性。
 * ========================================================================= */
:root {
  --navy: #16203a;
  --navy-2: #1f2a44;
  --navy-soft: #243154;
  --ink: #1f2a44;
  --ink-2: #5b6678;
  --ink-3: #8a93a6;
  --line: #e6eaf2;
  --line-2: #eef1f7;
  --bg: #f4f6fb;
  --card: #ffffff;
  --blue: #3b6ef5;
  --blue-soft: #eaf0ff;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #e08a1e;
  --shadow: 0 1px 2px rgba(16,32,64,.04), 0 8px 24px rgba(16,32,64,.06);
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
select { font-family: inherit; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- 顶部栏 ---------- */
.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 0 rgba(255,255,255,.04);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg,#3b6ef5,#6f9bff); font-weight: 800; font-size: 15px; letter-spacing: 1px;
}
.brand-title { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 11px; color: #9fb0d4; letter-spacing: .5px; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.view-switch { display: flex; background: rgba(255,255,255,.08); border-radius: 10px; padding: 4px; }
.vs-btn { color: #c7d2ea; font-size: 13px; font-weight: 600; padding: 7px 16px; border-radius: 7px; transition: .18s; }
.vs-btn.active { background: #fff; color: var(--navy); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.topbar-meta { font-size: 12px; color: #9fb0d4; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 60px); }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 256px; flex-shrink: 0; background: var(--navy-2); color: #cdd6ea;
  display: flex; flex-direction: column; position: sticky; top: 60px; height: calc(100vh - 60px);
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 10px; font-size: 12px; letter-spacing: 1px; color: #7e8db0; text-transform: uppercase;
}
.count-badge { background: rgba(255,255,255,.1); color: #cdd6ea; border-radius: 20px; padding: 1px 9px; font-size: 11px; }
.company-list { flex: 1; overflow-y: auto; padding: 4px 12px; }
.company-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px;
  margin-bottom: 4px; cursor: pointer; transition: background .15s; position: relative;
}
.company-item:hover { background: rgba(255,255,255,.06); }
.company-item.active { background: rgba(59,110,245,.18); }
.company-item.active::before {
  content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--blue);
}
.ci-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ci-body { flex: 1; min-width: 0; }
.ci-name { font-size: 13.5px; font-weight: 600; color: #eef2fb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-sector { font-size: 11px; color: #8a99bd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-health { font-size: 11px; font-weight: 700; flex-shrink: 0; }
.sidebar-foot { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.07); }
.total-invest { display: flex; flex-direction: column; gap: 2px; }
.total-invest span { font-size: 11px; color: #8294ba; }
.total-invest strong { font-size: 17px; color: #fff; }

/* ---------- 主区域 ---------- */
.main { flex: 1; padding: 22px 26px 40px; min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.ph-title { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.ph-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.ph-right { display: flex; align-items: center; }

/* 时间筛选 */
.time-filter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tf-label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.tf-presets { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.tf-presets button { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 6px 11px; border-radius: 6px; transition: .15s; }
.tf-presets button:hover { color: var(--ink); }
.tf-presets button.active { background: var(--navy); color: #fff; }
.tf-custom { display: flex; align-items: center; gap: 6px; }
.tf-custom select, .cmp-controls select {
  font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink);
}
.tf-tilde { font-size: 12px; color: var(--ink-3); }

/* ---------- KPI 卡片 ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi-card {
  background: var(--card); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow);
  border: 1px solid var(--line-2); position: relative; overflow: hidden;
}
.kpi-card .kc-label { font-size: 12.5px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi-card .kc-value { font-size: 23px; font-weight: 800; margin-top: 8px; letter-spacing: .3px; }
.kpi-card .kc-unit { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.kpi-card .kc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.kpi-card .kc-delta { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 3px; }
.kpi-card .kc-delta.up { color: var(--green); }
.kpi-card .kc-delta.down { color: var(--red); }
.kpi-card .kc-spark { width: 78px; height: 30px; }
.kpi-card .kc-tag { position: absolute; top: 0; right: 0; width: 4px; height: 100%; }
.kc-tag.rev { background: var(--blue); }
.kc-tag.exp { background: var(--amber); }
.kc-tag.pro { background: var(--green); }
.kc-tag.cf  { background: #0ea5b7; }
.kc-tag.gm  { background: #8e44ad; }
.kc-tag.div { background: #d4a017; }
.kc-tag.pay { background: #0f766e; }
.kc-tag.eq  { background: #64748b; }
.kc-status { font-size: 12px; font-weight: 700; white-space: nowrap; }
.kc-status.warn { color: var(--amber); }
.kc-status.good { color: var(--green); }
.kc-value.is-good { color: var(--green); }

/* ---------- 面板/图表 ---------- */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line-2); }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px 6px; }
.panel-title { font-size: 14.5px; font-weight: 700; }
.panel-hint { font-size: 11.5px; color: var(--ink-3); }
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 18px; }
.chart-panel .chart { width: 100%; height: 300px; padding: 4px 8px 10px; }
.span-2 { grid-column: span 2; }
.chart-panel.span-2 .chart { height: 320px; }

/* ---------- 财务报表 ---------- */
.statements-panel { margin-bottom: 8px; }
.tabs-head { padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.stmt-tabs { display: flex; gap: 4px; }
.stmt-tab { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 7px 14px; border-radius: 8px; transition: .15s; }
.stmt-tab:hover { background: var(--line-2); }
.stmt-tab.active { background: var(--blue-soft); color: var(--blue); }
.stmt-table-wrap { padding: 8px 18px 20px; overflow-x: auto; }
.stmt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stmt-table th, .stmt-table td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line-2); }
.stmt-table th:first-child, .stmt-table td:first-child { text-align: left; }
.stmt-table thead th { color: var(--ink-2); font-weight: 600; font-size: 12px; background: #fafbfe; }
.stmt-table tbody tr:hover { background: #fafbff; }
.stmt-table .row-section td { background: #f3f6fc; font-weight: 700; color: var(--navy); text-align: left; }
.stmt-table .row-sub td:first-child { padding-left: 30px; color: var(--ink-2); }
.stmt-table .num { font-variant-numeric: tabular-nums; }
.stmt-table .delta-pos { color: var(--green); font-weight: 600; }
.stmt-table .delta-neg { color: var(--red); font-weight: 600; }
.stmt-table .muted { color: var(--ink-3); }

/* ---------- 对比分析 ---------- */
.cmp-mode-switch { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.cmp-mode { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 8px 18px; border-radius: 7px; transition: .15s; }
.cmp-mode.active { background: var(--navy); color: #fff; }
.cmp-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; background: #fff; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.cmp-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cmp-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.cmp-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 20px; border: 1.5px solid var(--line); color: var(--ink-2); transition: .15s; }
.cmp-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.cmp-chip.on { color: #fff; border-color: transparent; }
.cmp-metric { display: flex; gap: 6px; flex-wrap: wrap; }
.cmp-metric button { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 6px 12px; border-radius: 7px; border: 1px solid var(--line); transition: .15s; }
.cmp-metric button:hover { background: var(--line-2); }
.cmp-metric button.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.cmp-controls .tf-custom select { min-width: 92px; }
#cmpEntityPanel .panel, #cmpPeriodPanel .panel { margin-bottom: 16px; }
#cmpEntityPanel .chart, #cmpPeriodPanel .chart { width: 100%; height: 340px; padding: 8px 10px 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { width: 210px; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}
@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { display: none; }
}

/* ---------- 数据管理按钮 ---------- */
.data-btn { font-size: 13px; font-weight: 600; color: #cdd6ea; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); padding: 8px 14px; border-radius: 8px; transition: .15s; }
.data-btn:hover { background: rgba(255,255,255,.16); color: #fff; }

/* ---------- 模态框 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15,25,45,.5); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 24px; }
.modal-mask[hidden] { display: none; }
.modal { width: min(960px, 100%); max-height: 88vh; background: #fff; border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(16,32,64,.28); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-title { font-size: 17px; font-weight: 800; }
.modal-head-right { display: flex; align-items: center; gap: 10px; }
.modal-close { font-size: 24px; line-height: 1; color: var(--ink-3); width: 32px; height: 32px; border-radius: 8px; }
.modal-close:hover { background: var(--line-2); }
.ghost-btn { font-size: 12.5px; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line); padding: 7px 12px; border-radius: 8px; }
.ghost-btn:hover { background: var(--line-2); }
.ghost-btn.danger { color: var(--red); border-color: #f3c9c9; }
.ghost-btn.danger:hover { background: #fdeaea; }
.modal-tabs { display: flex; gap: 4px; padding: 12px 20px 0; border-bottom: 1px solid var(--line-2); }
.dtab { font-size: 13.5px; font-weight: 600; color: var(--ink-2); padding: 9px 16px; border-radius: 8px 8px 0 0; }
.dtab:hover { background: var(--line-2); }
.dtab.active { color: var(--blue); border-bottom: 2px solid var(--blue); margin-bottom: -1px; }
.modal-body { padding: 18px 20px 22px; overflow-y: auto; }
.hint { font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; line-height: 1.6; }
.muted { color: var(--ink-3); font-weight: 400; }

/* 数据表（管理/录入/预览共用） */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line-2); border-radius: 10px; margin-bottom: 14px; }
.data-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-tbl th, .data-tbl td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.data-tbl thead th { background: #fafbfe; color: var(--ink-2); font-weight: 600; position: sticky; top: 0; }
.data-tbl input { width: 96px; font-size: 12.5px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; }
.data-tbl input.w-name { width: 130px; }
.data-tbl .row-act { color: var(--blue); cursor: pointer; }
.data-tbl .row-del { color: var(--red); cursor: pointer; }
.data-tbl tbody tr:hover { background: #fafbff; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.form-grid input { font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.form-grid input[type=color] { padding: 2px; height: 38px; }
.rows-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 8px; font-size: 13px; font-weight: 700; }
.rows-head .inline { font-weight: 600; display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.rows-head .inline input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; width: 220px; }
.mini-btn { font-size: 13px; font-weight: 600; color: #fff; background: var(--blue); padding: 9px 16px; border-radius: 8px; }
.mini-btn:hover { background: #2f5fe0; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.err { color: var(--red); font-size: 12.5px; font-weight: 600; }

/* 上传区 */
.tpl-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.tpl-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tpl-link { font-size: 12.5px; font-weight: 600; color: var(--blue); background: var(--blue-soft); padding: 7px 12px; border-radius: 8px; text-decoration: none; border: 1px solid #d8e2ff; }
.tpl-link:hover { background: #dbe6ff; }
.upload-zone { border: 2px dashed var(--line); border-radius: 12px; padding: 30px; text-align: center; cursor: pointer; color: var(--ink-2); transition: .15s; margin-bottom: 16px; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--blue); background: var(--blue-soft); }
.uz-icon { font-size: 30px; color: var(--blue); margin-bottom: 8px; }
.uz-inner div { font-size: 13px; margin: 4px 0; }
.map-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px; margin-bottom: 14px; }
.map-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.map-grid select { font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.map-grid .req { color: var(--red); }

/* ---------- 当月流水 ---------- */
.flow-month { display: flex; align-items: center; gap: 8px; }
.flow-month select {
  font-size: 13px; font-weight: 600; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
.flow-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.flow-card {
  background: var(--card); border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow);
  border: 1px solid var(--line-2); position: relative; overflow: hidden;
}
.flow-card::before { content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 100%; background: var(--fc-accent, var(--blue)); }
.flow-card .fc-label { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-card .fc-value { font-size: 21px; font-weight: 800; margin-top: 7px; letter-spacing: .2px; font-variant-numeric: tabular-nums; }
.flow-card .fc-value .fc-unit { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-left: 3px; }
.flow-card .fc-foot { font-size: 11.5px; color: var(--ink-3); margin-top: 7px; display: flex; align-items: center; gap: 6px; }
.flow-card .fc-foot .up { color: var(--green); font-weight: 700; }
.flow-card .fc-foot .down { color: var(--red); font-weight: 700; }
.flow-card .fc-foot .tag { font-weight: 700; }
.flow-value-neg { color: var(--red); }
.flow-value-pos { color: var(--green); }

.flow-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 16px; margin-bottom: 16px; }
.flow-grid .chart-panel .chart { height: 268px; }
.flow-channels { padding: 6px 18px 18px; }
.flow-ch-row { padding: 11px 0; border-bottom: 1px dashed var(--line-2); }
.flow-ch-row:last-child { border-bottom: none; }
.flow-ch-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.flow-ch-top .ch-dot { width: 9px; height: 9px; border-radius: 3px; }
.flow-ch-top .ch-name { font-weight: 700; color: var(--ink); }
.flow-ch-top .ch-amt { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.flow-ch-top .ch-pct { font-size: 11.5px; color: var(--ink-3); width: 52px; text-align: right; }
.flow-ch-bar { height: 7px; border-radius: 4px; background: #eef1f7; margin: 8px 0 6px; overflow: hidden; }
.flow-ch-bar i { display: block; height: 100%; border-radius: 4px; transition: width .3s; }
.flow-ch-meta { font-size: 11.5px; color: var(--ink-3); }
.flow-ch-meta .up { color: var(--green); font-weight: 700; }
.flow-ch-meta .down { color: var(--red); font-weight: 700; }

#flowView .panel { margin-bottom: 16px; }
#flowView .stmt-table td.num, #flowView .stmt-table th:not(:first-child) { text-align: right; }

@media (max-width: 1280px) {
  .flow-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  .flow-grid { grid-template-columns: 1fr; }
  .flow-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- 流水：操作区 / 空状态 / 对账 ---------- */
.flow-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flow-actions .mini-btn { padding: 8px 14px; }
.flow-actions .ghost-btn { padding: 8px 12px; background: #fff; }
.ph-count { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-left: 6px; }

.flow-empty { padding: 44px 20px 40px; text-align: center; }
.flow-empty .fe-icon {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 12px; background: var(--blue-soft);
  color: var(--blue); font-size: 24px; line-height: 46px; font-weight: 700;
}
.flow-empty .fe-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.flow-empty .fe-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.8; margin-top: 8px; }
.flow-empty .fe-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.flow-empty .fe-actions .ghost-btn { background: #fff; padding: 9px 16px; }

.flow-recon { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.flow-recon .recon-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); padding: 3px 0; }
.flow-recon .recon-row b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.flow-recon .recon-row b.up { color: var(--green); }
.flow-recon .recon-row b.down { color: var(--red); }
.flow-recon .recon-row b.demo-num { color: var(--ink-2); font-weight: 600; }
.flow-recon .recon-note { font-size: 11.5px; color: var(--amber); line-height: 1.7; margin-top: 8px; }
.fc-src {
  font-size: 10px; font-weight: 600; color: var(--ink-3); background: var(--line-2);
  border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: 1px;
}

.flow-tx-table td:nth-child(2) { text-align: left; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.flow-tx-table .tx-co {
  display: inline-block; font-size: 11px; color: var(--ink-2); background: var(--line-2);
  border-radius: 4px; padding: 1px 6px; margin-left: 8px; vertical-align: 1px;
}
.flow-tx-table .tx-ch {
  display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--c);
  background: #f5f7fc; border-radius: 5px; padding: 2px 8px; border: 1px solid var(--line-2);
}
.flow-tx-table .tx-del { font-size: 12px; }

/* 流水录入弹窗 */
.data-tbl select { font-size: 12.5px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.rows-head .inline select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 12.5px; }
.tx-fallbacks { display: flex; gap: 22px; flex-wrap: wrap; margin: 4px 0 14px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.tx-fallbacks label { display: flex; align-items: center; gap: 8px; }
.tx-fallbacks select { font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }

/* ---------- 空状态（系统无演示数据） ---------- */
.empty-hero { display: none; }
.is-empty > *:not(.empty-hero) { display: none !important; }
.is-empty .empty-hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: var(--shadow); padding: 56px 40px; text-align: center; margin-top: 8px;
  min-height: calc(100vh - 120px);
}
.empty-hero .eh-icon {
  width: 62px; height: 62px; margin: 0 auto 20px; border-radius: 18px; background: var(--blue-soft);
  color: var(--blue); font-size: 30px; line-height: 62px; font-weight: 700;
}
.empty-hero .eh-title { font-size: 21px; font-weight: 800; letter-spacing: .3px; }
.empty-hero .eh-desc { font-size: 13.5px; color: var(--ink-2); line-height: 1.9; margin-top: 12px; }
.empty-hero .eh-actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; }
.empty-hero .eh-actions .mini-btn, .empty-hero .eh-actions .ghost-btn { padding: 11px 22px; font-size: 13.5px; }
.empty-hero .eh-actions .ghost-btn { background: #fff; }
.empty-hero .eh-tip { font-size: 11.5px; color: var(--ink-3); margin-top: 18px; }
.ci-empty { padding: 22px 12px; font-size: 12.5px; color: #8a99bd; line-height: 1.8; text-align: center; }
.ci-empty span { font-size: 11.5px; color: #6b7a9c; }

/* =========================================================================
 * v4 新增：自动口径提示 / 企业卡片 / 合同台账 / 附件 / 预览
 * ========================================================================= */

/* 顶部栏：5 个视图 + 2 个操作，压缩间距避免溢出 */
.topbar-right { gap: 12px; }
.vs-btn { padding: 7px 13px; font-size: 12.8px; }
.topbar .mini-btn { padding: 7px 13px; font-size: 12.5px; }
.topbar .ghost-btn { color: #c7d2ea; border-color: rgba(255,255,255,.18); background: transparent; }
.topbar .ghost-btn:hover { background: rgba(255,255,255,.1); }

/* 自动口径说明条 */
.auto-note {
  display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap;
  background: #f0f4ff; border: 1px solid #dbe4ff; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 18px; font-size: 12.2px; color: #44507a; line-height: 1.75;
}
.auto-note b { color: var(--blue); font-weight: 700; flex-shrink: 0; }
.auto-note span { flex: 1; min-width: 240px; }

/* ---------- 企业卡片页 ---------- */
.co-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.co-card {
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 14px;
  transition: box-shadow .18s, transform .18s;
}
.co-card:hover { box-shadow: 0 4px 10px rgba(16,32,64,.08), 0 16px 40px rgba(16,32,64,.10); transform: translateY(-1px); }
.co-head { display: flex; align-items: flex-start; gap: 10px; }
.co-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.co-name { font-size: 16px; font-weight: 800; letter-spacing: .2px; }
.co-meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.co-badge {
  margin-left: auto; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px;
  background: #f1f4fa; color: var(--ink-2); white-space: nowrap;
}
.co-badge.good { background: #e8f7ee; color: #15803d; }
.co-badge.warn { background: #fdf3e3; color: #b45309; }
.co-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.co-fig { background: #fafbfe; border-radius: 10px; padding: 10px 11px; }
.co-fig span { display: block; font-size: 11px; color: var(--ink-3); margin-bottom: 3px; }
.co-fig strong { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.co-fig strong.neg { color: var(--red); }
.co-fig strong.pos { color: var(--green); }
.co-actions { display: flex; gap: 8px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.co-actions .ghost-btn { flex: 1; text-align: center; }
.co-actions .ghost-btn.danger { flex: 0 0 52px; }

/* ---------- 合同台账 ---------- */
.ct-stats { grid-template-columns: repeat(5, 1fr); }
.tx-co { display: inline-block; margin-left: 8px; font-size: 10.5px; color: var(--ink-3); background: #f1f4fa; padding: 1px 6px; border-radius: 5px; }
.ct-tbl td.amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.ct-tbl td.amt.rebate { color: var(--amber); }
.ct-inv { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; display: inline-block; }
.ct-inv.yes { background: #e8f7ee; color: #15803d; }
.ct-inv.no { background: #fdf3e3; color: #b45309; }
.ct-file-btn {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600;
  color: var(--blue); background: var(--blue-soft); padding: 3px 9px; border-radius: 6px; cursor: pointer;
}
.ct-file-btn:hover { background: #dbe6ff; }
.ct-file-none { font-size: 11.5px; color: var(--ink-3); }

/* ---------- 表单补充 ---------- */
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid select {
  font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.f-tip { font-size: 11px; font-weight: 400; color: var(--ink-3); line-height: 1.5; }
.f-full { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 16px; }
.f-full input { font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.modal-sm { width: min(680px, 100%); }
.req { color: var(--red); font-weight: 700; }

/* ---------- 附件上传 ---------- */
.file-block { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 14px 12px; margin-bottom: 16px; background: #fcfdff; }
.file-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.file-head span:first-child { font-size: 13px; font-weight: 700; }
.file-head .muted { font-size: 11.5px; }
.file-drop {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px dashed #cfd8ea; border-radius: 10px; padding: 16px; cursor: pointer;
  font-size: 12.5px; color: var(--ink-2); background: #fff; transition: .15s;
}
.file-drop:hover, .file-drop.drag { border-color: var(--blue); background: #f5f8ff; color: var(--blue); }
.fd-icon { font-size: 16px; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-list:empty { margin-top: 0; }
.file-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px 6px 10px; font-size: 12px;
}
.file-chip .fc-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--ink); }
.file-chip .fc-size { color: var(--ink-3); font-size: 11px; }
.file-chip .fc-x { color: var(--ink-3); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.file-chip .fc-x:hover { color: var(--red); }
.file-chip .fc-open { color: var(--blue); cursor: pointer; font-size: 11.5px; font-weight: 600; }

/* ---------- 流水凭证缩略图 ---------- */
.proof-cell { display: flex; align-items: center; gap: 6px; }
.proof-thumb {
  width: 34px; height: 34px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line);
  cursor: pointer; background: #f4f6fb;
}
.proof-add {
  width: 34px; height: 34px; border-radius: 6px; border: 1.5px dashed #cfd8ea; display: grid; place-items: center;
  color: var(--ink-3); cursor: pointer; font-size: 15px; background: #fff;
}
.proof-add:hover { border-color: var(--blue); color: var(--blue); }
.proof-file { font-size: 11px; color: var(--blue); cursor: pointer; font-weight: 600; }

/* 图片预览 */
.lightbox {
  position: fixed; inset: 0; background: rgba(8,14,28,.86); z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 32px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #fff; }
.lb-close {
  position: absolute; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; font-size: 24px; line-height: 1;
}
.lb-close:hover { background: rgba(255,255,255,.26); }

/* ---------- 填写说明 ---------- */
.guide h4 { font-size: 13.5px; font-weight: 800; margin: 16px 0 8px; color: var(--ink); }
.guide h4:first-child { margin-top: 0; }
.guide ol, .guide ul { padding-left: 20px; font-size: 12.8px; color: var(--ink-2); line-height: 2; }
.guide li b { color: var(--ink); }
.guide p { font-size: 12.5px; line-height: 1.8; }

/* 月度数据表：只读列 */
.data-tbl td.ro { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; background: #fafbfe; }
.data-tbl td.ro.neg { color: var(--red); }
.data-tbl td.ro.pos { color: var(--green); }

/* 行内小圆点 */
.dot-inline { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }

/* ---------- 修正：表单标签不换行（星号不单独成行） ---------- */
.form-grid label { white-space: nowrap; }
.form-grid label .f-tip { white-space: normal; }
.form-grid label select { width: 100%; }

/* ---------- 修正：企业卡片撑满可用宽度 ---------- */
.co-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

/* 修正：表单 label 用块级流，避免「文字 + 星号」被 flex 拆成两行 */
.form-grid label {
  display: block !important; white-space: normal;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); line-height: 1.6;
}
.form-grid label input,
.form-grid label select { display: block; width: 100%; margin-top: 5px; }
.form-grid label .f-tip { display: block; margin-top: 4px; font-weight: 400; }
.form-grid label .req { margin-left: 1px; }

/* ---------- 仪表盘提示条 ---------- */
.dash-notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fff8ec; border: 1px solid #f6e0b8; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px;
}
.dash-notice[hidden] { display: none; }
.dash-notice .dn-icon {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: #e08a1e; color: #fff; font-size: 13px; font-weight: 800;
  display: grid; place-items: center;
}
.dash-notice .dn-body { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 3px; }
.dash-notice .dn-body b { font-size: 13px; color: #8a5a12; }
.dash-notice .dn-body span { font-size: 12.2px; color: #7a6337; line-height: 1.7; }
.dash-notice .dn-actions { display: flex; gap: 8px; flex-shrink: 0; }
.dash-notice .dn-actions .mini-btn { padding: 7px 13px; font-size: 12.5px; }
.dash-notice .dn-actions .ghost-btn { padding: 7px 12px; font-size: 12.5px; background: #fff; }

/* ---------- 返款：只读自动算 ---------- */
.form-grid label input.ro {
  background: #f4f6fb; color: var(--ink-2); font-weight: 700;
  border-style: dashed; cursor: not-allowed; font-variant-numeric: tabular-nums;
}
.form-grid label input.ro:focus { outline: none; border-color: var(--line); }
.data-tbl .th-sub,
.ct-tbl .th-sub { display: block; font-size: 10.5px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; margin-top: 2px; }

/* 合同表列宽与折行修正 */
.ct-tbl th, .ct-tbl td { white-space: nowrap; }
.ct-tbl td:nth-child(2) { white-space: normal; max-width: 190px; }
.ct-tbl td:nth-child(3) { white-space: normal; max-width: 210px; }
.ct-tbl .th-sub { white-space: nowrap; }
.ct-inv { white-space: nowrap; }

/* =========================================================================
 * v5：全元口径 + 仅流水
 * ========================================================================= */

/* KPI：金额变长（元），字号收一点 */
.kpi-card .kc-value { font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-card .kc-value.is-neg { color: var(--red); }
.kpi-card .kc-unit { font-size: 11.5px; }
.kpi-card .kc-foot .muted { font-size: 11.5px; }

/* 回本进度卡 */
.payback-box { padding: 18px 20px 20px; }
.pb-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 34px 0; line-height: 1.9; }
.pb-empty span { font-size: 12px; color: #a9b2c4; }
.pb-head { display: flex; align-items: baseline; justify-content: space-between; }
.pb-pct { font-size: 30px; font-weight: 800; color: var(--navy); letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.pb-pct em { font-size: 14px; font-style: normal; color: var(--ink-3); margin-left: 2px; }
.pb-state { font-size: 12px; font-weight: 700; }
.pb-state.warn { color: var(--amber); }
.pb-state.good { color: var(--green); }
.pb-track { height: 8px; border-radius: 6px; background: #eef1f7; margin: 14px 0 12px; overflow: hidden; }
.pb-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #f6b73c, #e08a1e); transition: width .4s ease; }
.pb-fill.done { background: linear-gradient(90deg, #34d399, #16a34a); }
.pb-row { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--ink-3); }
.pb-row b { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pb-note { margin-top: 10px; font-size: 12px; color: var(--ink-2); font-weight: 600; }

/* 渠道条 */
.fch-row { display: grid; grid-template-columns: 10px 46px 1fr 110px 42px; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--line-2); }
.fch-row:last-child { border-bottom: none; }
.fch-dot { width: 8px; height: 8px; border-radius: 50%; }
.fch-name { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.fch-bar { height: 7px; border-radius: 5px; background: #eef1f7; overflow: hidden; }
.fch-bar i { display: block; height: 100%; border-radius: 5px; }
.fch-val { font-size: 12.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.fch-val em { font-style: normal; font-size: 10.5px; color: var(--ink-3); margin-left: 2px; }
.fch-pct { font-size: 11.5px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }

/* 流水表：收支徽标 / 凭证缩略图 */
.dir-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.dir-badge.in { background: #e8f5ee; color: #15803d; }
.dir-badge.out { background: #fdf0e3; color: #b45309; }
.stmt-table td.amt.in { color: var(--green); font-weight: 700; }
.stmt-table td.amt.out { color: var(--red); font-weight: 700; }
.flow-tbl td { white-space: nowrap; }
.flow-tbl td:nth-child(6) { white-space: normal; max-width: 300px; }
.proof-thumb { position: relative; width: 34px; height: 34px; border-radius: 6px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--line-2); cursor: pointer; }
.proof-thumb img { width: 100%; height: 100%; object-fit: cover; }
.proof-thumb em { position: absolute; right: 0; bottom: 0; background: rgba(31,42,68,.8); color: #fff; font-style: normal; font-size: 9px; padding: 0 3px; border-radius: 3px 0 0 0; }
.proof-add { display: inline-flex; width: 26px; height: 26px; border-radius: 6px; border: 1px dashed var(--line); align-items: center; justify-content: center; color: var(--ink-3); cursor: pointer; font-size: 14px; }
.proof-add:hover { border-color: var(--blue); color: var(--blue); }

/* 空状态 / 表格空行 */
.sb-empty { padding: 26px 18px; font-size: 12.5px; color: #93a0b5; line-height: 1.9; }
.sb-empty span { font-size: 11.5px; color: #7d8aa0; }
.tbl-empty { padding: 40px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.stmt-table tr.sec td { background: #f3f6fc; font-weight: 700; color: var(--navy); }
.stmt-table td.up { color: var(--green); }
.stmt-table td.down { color: var(--red); }

/* 企业卡回本行 */
.co-pay { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; margin: 0 16px 12px; border-radius: 8px; background: #f8fafd; }
.co-pay .cp-label { font-size: 11.5px; color: var(--ink-3); }
.co-pay .cp-val { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.co-pay .cp-val.warn { color: var(--amber); }
.co-pay .cp-val.good { color: var(--green); }

/* 弹窗内联输入 */
.cell-input { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; font-family: inherit; background: #fff; }
.cell-input.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(47,107,246,.12); }
.data-tbl td .cell-input { min-width: 90px; }

/* 侧边栏列表项（v5 结构类名对齐） */
.ci-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ci-sub { font-size: 11px; color: #8a99bd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-score { font-size: 11.5px; font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* 回本进度卡在同行中垂直居中 */
.payback-box { height: 100%; display: flex; flex-direction: column; justify-content: center; box-sizing: border-box; }

/* 时间段下拉最小宽度，避免空选项时塌陷 */
.tf-custom select { min-width: 92px; }

/* 企业卡底部按钮：主按钮撑开，编辑/删除按内容宽度 */
.co-actions { align-items: center; }
.co-actions .mini-btn { flex: 1; }
.co-actions .ghost-btn { flex: 0 0 auto; }
.co-actions .row-del { margin-left: auto; }

/* =========================================================================
 * 云端协作：登录闸门 + 同步状态
 * ========================================================================= */
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: #c7d2ea; background: rgba(255,255,255,.08);
  padding: 5px 10px; border-radius: 20px; white-space: nowrap; transition: .18s;
}
.sync-pill .sp-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.18); }
.sync-pill.is-saving .sp-dot { background: #fbbf24; box-shadow: 0 0 0 3px rgba(251,191,36,.18); animation: spPulse 1s infinite; }
.sync-pill.is-error .sp-dot { background: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,.18); }
.sync-pill.is-local .sp-dot { background: #94a3b8; box-shadow: none; }
@keyframes spPulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.login-gate {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% 0%, #22305a 0%, #16203a 45%, #0e1526 100%);
}
.login-gate[hidden] { display: none; }
.lg-card {
  width: 360px; padding: 38px 32px 26px; border-radius: 18px; text-align: center;
  background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 24px 60px rgba(0,0,0,.38); backdrop-filter: blur(12px);
}
.lg-logo {
  width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg,#3b6ef5,#6f9bff); color: #fff; font-weight: 800; font-size: 18px; letter-spacing: 1px;
}
.lg-title { color: #fff; font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.lg-sub { color: #93a3c6; font-size: 12.5px; margin-top: 8px; }
.lg-form { margin-top: 26px; display: flex; flex-direction: column; gap: 12px; }
.lg-input {
  width: 100%; height: 44px; border-radius: 10px; padding: 0 14px; font-size: 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); color: #fff;
  font-family: inherit; letter-spacing: 2px;
}
.lg-input::placeholder { color: #7c8bab; letter-spacing: 0; }
.lg-input:focus { outline: none; border-color: #5b8bff; background: rgba(255,255,255,.1); box-shadow: 0 0 0 3px rgba(91,139,255,.18); }
.lg-btn {
  height: 44px; border-radius: 10px; background: linear-gradient(135deg,#3b6ef5,#5b8bff);
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 1px; transition: .18s;
}
.lg-btn:hover { filter: brightness(1.08); }
.lg-btn:disabled { opacity: .6; cursor: default; }
.lg-err { min-height: 18px; margin-top: 12px; font-size: 12.5px; color: #fca5a5; }
.lg-foot { margin-top: 16px; font-size: 11.5px; color: #6f7f9f; line-height: 1.6; }
