/* ==========================================================================
   经营分析工作台 · style.css
   深蓝商务风格（与院部汇报模板一致：藏青主色 + 橙色强调）
   ========================================================================== */
:root {
  --navy: #1f3b66;
  --navy2: #2e5c9e;
  --ink: #262626;
  --gray: #8a8a8a;
  --line: #e3e8ef;
  --bg: #f2f4f8;
  --card: #ffffff;
  --orange: #c05511;
  --red: #c0392b;
  --green: #00b050;
  --gold: #b8860b;
  --shadow: 0 2px 10px rgba(31, 59, 102, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(90deg, #16294a 0%, #1f3b66 60%, #2a4d85 100%);
  color: #fff; padding: 0 20px; height: 56px;
  position: sticky; top: 0; z-index: 100;
}
.brand h1 { font-size: 18px; margin: 0; letter-spacing: 1px; display: inline; }
.brand .sub { font-size: 11px; color: #9db2d4; margin-left: 10px; letter-spacing: 2px; }
.topbar .spacer { flex: 1; }
.topbar .actions { display: flex; align-items: center; gap: 8px; }
.src-badge, .period-badge {
  font-size: 12px; padding: 3px 10px; border-radius: 20px;
  background: rgba(255, 255, 255, .14); color: #dce6f5; white-space: nowrap;
}
.src-badge.upload { background: #c05511; color: #fff; }
.btn {
  font-size: 12.5px; padding: 5px 12px; border-radius: 6px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .35); background: transparent; color: #fff;
}
.btn:hover { background: rgba(255, 255, 255, .15); }

/* ---------- 导航 ---------- */
.navbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  background: #fff; padding: 0 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 56px; z-index: 99;
}
.nav-item {
  border: none; background: none; cursor: pointer;
  padding: 12px 14px; font-size: 14px; color: #45506b;
  border-bottom: 2.5px solid transparent; display: flex; align-items: center; gap: 6px;
}
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: #c6d2e6; }
.nav-item:hover { color: var(--navy2); }
.nav-item.active { color: var(--navy); font-weight: 700; border-bottom-color: var(--orange); }
.nav-item.active .dot { background: var(--orange); }
.nav-item.nav-key { color: var(--orange); }
.nav-item.nav-key.active { color: var(--orange); border-bottom-color: var(--orange); font-weight: 700; }
.nav-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }

/* ---------- 主区 ---------- */
main { max-width: 1440px; margin: 0 auto; padding: 18px 20px 40px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: 10px; box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 16px;
}
.card h3 {
  margin: 0 0 12px; font-size: 15px; color: var(--navy);
  border-left: 4px solid var(--orange); padding-left: 9px; line-height: 1.3;
}
.card h3 .sub { font-size: 12px; color: var(--gray); font-weight: 400; margin-left: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(115deg, #16294a 0%, #1f3b66 55%, #2e5c9e 100%);
  color: #fff; border-radius: 12px; padding: 26px 30px; margin-bottom: 16px;
  display: flex; align-items: stretch; gap: 26px; flex-wrap: wrap;
}
.hero .h-main { flex: 1.4; min-width: 260px; }
.hero .h-title { font-size: 13px; color: #a9bedd; letter-spacing: 1px; }
.hero .h-big { font-size: 30px; font-weight: 800; margin: 6px 0 4px; }
.hero .h-big small { font-size: 14px; font-weight: 400; margin-left: 6px; }
.hero .h-note { font-size: 12.5px; color: #b9c9e2; }
.hero .h-kpis { flex: 2; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px; padding: 12px 14px;
}
.kpi .k-label { font-size: 12px; color: #b9c9e2; }
.kpi .k-val { font-size: 24px; font-weight: 800; margin-top: 2px; }
.kpi .k-val small { font-size: 12px; font-weight: 400; }
.kpi .k-sub { font-size: 11.5px; margin-top: 2px; }
.kpi .up { color: #ff9d7a; } .kpi .down { color: #7ee2a8; } .kpi .flat { color: #cfd8ea; }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar input[type="text"], .toolbar input[type="number"], .toolbar input:not([type]) {
  font-size: 13px; padding: 6px 10px; border: 1px solid #cfd8e6; border-radius: 6px;
  background: #fff; color: var(--ink); outline: none;
}
.toolbar select:focus, .toolbar input:focus { border-color: var(--navy2); }
.seg { display: inline-flex; border: 1px solid #cfd8e6; border-radius: 6px; overflow: hidden; }
.seg button {
  border: none; background: #fff; padding: 6px 14px; cursor: pointer; font-size: 13px; color: #45506b;
}
.seg button.on { background: var(--navy2); color: #fff; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
table.tbl th {
  background: var(--navy); color: #fff; padding: 8px 10px; text-align: left;
  font-weight: 600; white-space: nowrap; position: sticky; top: 0;
}
table.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tbl tr:nth-child(even) td { background: #f7f9fc; }
table.tbl tr:hover td { background: #eef3fb; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .pos { color: var(--red); font-weight: 600; }
table.tbl .neg { color: var(--green); font-weight: 600; }
table.tbl .dim { color: var(--gray); font-size: 12px; }
.tbl-foot { font-size: 12px; color: var(--gray); margin-top: 8px; }

/* ---------- 结论卡 ---------- */
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.ins {
  background: #f7f9fd; border: 1px solid var(--line); border-left: 4px solid var(--navy2);
  border-radius: 8px; padding: 12px 14px;
}
.ins .t {
  display: inline-block; font-size: 12px; font-weight: 700; color: #fff;
  background: var(--navy2); border-radius: 4px; padding: 1px 8px; margin-bottom: 6px;
}
.ins p { margin: 0; font-size: 13.5px; line-height: 1.7; }
.ins b { color: var(--orange); }

/* ---------- 图表 ---------- */
.chart { width: 100%; height: 340px; }
.chart.tall { height: 420px; }
.chart.short { height: 260px; }

/* ---------- 页脚 ---------- */
.foot {
  text-align: center; font-size: 12px; color: #97a3b8; padding: 18px 0 26px;
}
.foot-sep { margin: 0 8px; }

/* ---------- 提示条 ---------- */
.note {
  background: #fff7e8; border: 1px solid #ffd591; color: #ad6800;
  border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}
.note.info { background: #e8f3ff; border-color: #91caff; color: #0958d9; }
.note.ok { background: #f0fff4; border-color: #95de64; color: #389e0d; }
.note.err { background: #fff1f0; border-color: #ffa39e; color: #cf1322; }

/* ---------- 上传 ---------- */
.drop {
  border: 2px dashed #b9c6dc; border-radius: 10px; padding: 22px; text-align: center;
  background: #fbfcfe; cursor: pointer; transition: all .15s;
}
.drop:hover, .drop.over { border-color: var(--navy2); background: #eef3fb; }
.drop .dt { font-size: 15px; font-weight: 600; color: var(--navy); }
.drop .dd { font-size: 12px; color: var(--gray); margin-top: 4px; }
.drop input[type="file"] { display: none; }

/* ---------- 表单 ---------- */
label.fld { display: block; font-size: 12.5px; color: #56617a; margin-bottom: 4px; }
.fld input, .fld textarea, .fld select {
  width: 100%; font-size: 13.5px; padding: 7px 10px; border: 1px solid #cfd8e6;
  border-radius: 6px; outline: none; font-family: inherit;
}
.fld textarea { resize: vertical; min-height: 64px; }
.fld input:focus, .fld textarea:focus { border-color: var(--navy2); }
.frm-row { margin-bottom: 12px; }

.btn-primary {
  background: var(--navy2); color: #fff; border: none; border-radius: 6px;
  padding: 9px 20px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn-primary:hover { background: #24507f; }
.btn-primary:disabled { background: #a9b6cc; cursor: not-allowed; }
.btn-ghost {
  background: #fff; color: var(--navy2); border: 1px solid var(--navy2);
  border-radius: 6px; padding: 8px 16px; font-size: 13px; cursor: pointer;
}
.btn-ghost:hover { background: #eef3fb; }
.btn-warn {
  background: #fff; color: var(--red); border: 1px solid var(--red);
  border-radius: 6px; padding: 8px 16px; font-size: 13px; cursor: pointer;
}
.btn-warn:hover { background: #fff1f0; }

/* ---------- 报告预览 ---------- */
.report-paper {
  background: #fff; max-width: 900px; margin: 0 auto; padding: 40px 48px;
  box-shadow: var(--shadow); border-radius: 8px; line-height: 1.9; font-size: 14.5px;
}
.report-paper h1 { font-size: 22px; text-align: center; color: var(--navy); margin: 0 0 6px; }
.report-paper h2 { font-size: 17px; color: var(--navy); border-left: 4px solid var(--orange); padding-left: 10px; margin: 26px 0 10px; }
.report-paper .rp-meta { text-align: center; color: var(--gray); font-size: 12.5px; margin-bottom: 22px; }
.report-paper table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.report-paper th { background: var(--navy); color: #fff; padding: 6px 9px; text-align: left; }
.report-paper td { border: 1px solid #d9e0ea; padding: 6px 9px; }
.report-paper .pos { color: var(--red); font-weight: 600; }
.report-paper .neg { color: var(--green); font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000; background: rgba(15, 30, 55, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3);
  width: 420px; max-width: 94vw; max-height: 86vh; overflow-y: auto; padding: 24px 26px;
}
.modal-card h3 { margin: 0 0 14px; font-size: 17px; color: var(--navy); }
.modal-card .m-close {
  float: right; border: none; background: none; font-size: 20px; color: #98a6c3; cursor: pointer; line-height: 1;
}
.modal-card .m-close:hover { color: var(--navy); }
.qr-box { text-align: center; padding: 6px 0 10px; }
.qr-box img, .qr-box canvas, .qr-box table { margin: 0 auto; }
.qr-url { font-size: 12px; color: var(--gray); word-break: break-all; text-align: center; margin-top: 8px; }
.how-step { display: flex; gap: 12px; margin-bottom: 14px; }
.how-step .n {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--navy2); color: #fff;
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.how-step .b { flex: 1; font-size: 13.5px; line-height: 1.7; color: #3c465e; }
.how-step .b b { color: var(--navy); }

/* ---------- 打印 ---------- */
@media print {
  .topbar, .navbar, .foot, .toolbar, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .chart { break-inside: avoid; }
}

/* ---------- 帮助 / 口径 ---------- */
.doc h4 { color: var(--navy); margin: 18px 0 8px; font-size: 15px; }
.doc p, .doc li { font-size: 13.5px; color: #3c465e; }
.doc ul { padding-left: 22px; }
.doc code { background: #eef1f6; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.doc th { background: #eef1f6; color: var(--navy); padding: 7px 10px; text-align: left; }
.doc td { border: 1px solid var(--line); padding: 7px 10px; }
