/* ============================================================
   财报深度分析 · 前端样式
   只做展示，不含任何业务规则
   ============================================================ */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1b2733;
  --ink-2: #3d4c5c;
  --muted: #6b7a8c;
  --line: #e4eaf1;
  --line-2: #eef2f7;
  --navy: #1f2d3d;
  --accent: #c0392b;
  --accent-soft: #fdf2f0;
  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --warn: #b45309;
  --warn-soft: #fef6e7;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(27, 39, 51, .04), 0 6px 20px rgba(27, 39, 51, .05);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text b { font-size: 15.5px; font-weight: 700; letter-spacing: .2px; }
.brand-text i { font-style: normal; font-size: 12px; color: var(--muted); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}
.pill-mute { background: #f1f4f8; color: var(--muted); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }

/* ---------------- 布局 ---------------- */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 28px 60px;
}

.report-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 26px 28px 80px;
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}

/* ---------------- 首屏 ---------------- */
.hero { padding: 8px 0 26px; }

.hero h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--navy);
}

.hero-sub {
  margin-top: 8px;
  max-width: 760px;
  color: var(--muted);
  font-size: 14px;
}

.searchbar {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  max-width: 760px;
}

.field { flex: 1; position: relative; }

.field input {
  width: 100%;
  height: 46px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  font-size: 14.5px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #9aa7b5; }
.field input:focus {
  outline: none;
  border-color: #b9c6d4;
  box-shadow: 0 0 0 3px rgba(31, 45, 61, .07);
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .06s, background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #2a3b4f; }

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-2);
}
.btn-ghost:hover:not(:disabled) { border-color: #cdd8e3; color: var(--navy); }

.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 8px; }

/* ---------------- 任务进度 ---------------- */
.jobbox {
  max-width: 760px;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.job-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 9px;
}
.bar { height: 6px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2f4a63, var(--accent));
  border-radius: 999px;
  transition: width .3s ease;
}
.job-failed {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--danger);
  max-height: 90px;
  overflow: auto;
}

/* ---------------- 统计卡 ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-label { display: block; font-size: 12.5px; color: var(--muted); }
.stat-value {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 卡片与表格 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-2);
}
.card-head h2 { font-size: 15px; font-weight: 700; color: var(--navy); }
.card-tools { display: flex; align-items: center; gap: 10px; }

.mini-input {
  height: 34px;
  width: 230px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fbfcfe;
}
.mini-input:focus { outline: none; border-color: #b9c6d4; background: #fff; }

.count { font-size: 12.5px; color: var(--muted); }

.table-wrap { overflow-x: auto; }

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.grid thead th {
  position: sticky;
  top: 0;
  background: #fafbfd;
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  user-select: none;
}
table.grid thead th[data-sort] { cursor: pointer; }
table.grid thead th[data-sort]:hover { color: var(--navy); }
table.grid thead th.sorted::after { content: " ↓"; color: var(--accent); }
table.grid thead th.sorted.asc::after { content: " ↑"; }

table.grid tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
  white-space: nowrap;
}
table.grid tbody tr { cursor: pointer; transition: background .12s; }
table.grid tbody tr:hover { background: #f8fafc; }
table.grid tbody tr:last-child td { border-bottom: none; }

.th-rank { width: 46px; color: #b6c2cf !important; }
td.rank { color: #b6c2cf; font-family: var(--mono); font-size: 12.5px; }

td.code { font-family: var(--mono); font-weight: 600; color: var(--navy); }
td.name { font-weight: 600; }
td.industry { color: var(--muted); }
td.period { color: var(--muted); font-size: 12.5px; }
.num { text-align: right; }
td.score { text-align: right; font-family: var(--mono); font-weight: 700; font-size: 14.5px; color: var(--navy); }
td.updated { color: #98a5b3; font-size: 12.5px; font-family: var(--mono); }

.grade {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.grade-优秀 { background: #fdeeed; color: #a52a1f; }
.grade-良好 { background: #fdf3e7; color: #a25a10; }
.grade-中性 { background: #eef3fb; color: #24548f; }
.grade-偏弱 { background: #f2f4f6; color: #5c6b7a; }

.row-open { text-align: right; color: #c3ccd6; font-size: 15px; }

.empty { padding: 44px 20px; text-align: center; }
.empty p { font-size: 14px; }
.empty .muted { margin-top: 6px; font-size: 13px; }

/* ---------------- 页脚 ---------------- */
.foot {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px 40px;
  font-size: 12px;
  color: #9aa7b5;
}

/* ---------------- 报告页 ---------------- */
.toc {
  position: sticky;
  top: 84px;
  align-self: start;
  padding: 16px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.toc h3 {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .6px;
  color: #9aa7b5;
  text-transform: uppercase;
  margin: 0 8px 10px;
}
.toc ol { list-style: none; }
.toc li a {
  display: block;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.35;
  transition: background .12s, color .12s;
}
.toc li a:hover { background: #f4f7fa; color: var(--navy); }
.toc li a.active { background: #eef3f9; color: var(--navy); font-weight: 600; }

.report-main { min-width: 0; }

.report-head {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #1f2d3d 0%, #2b3f55 55%, #3a5570 100%);
  color: #fff;
  border-radius: 14px;
  padding: 24px 26px;
  box-shadow: 0 8px 26px rgba(31, 45, 61, .18);
  margin-bottom: 22px;
}
.rh-main { flex: 1 1 320px; min-width: 280px; }
.rh-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rh-title h1 { font-size: 25px; font-weight: 700; letter-spacing: .2px; }
.rh-code {
  font-family: var(--mono);
  font-size: 13px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .14);
  color: #dbe6f2;
}
.rh-meta {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: #c3d2e2;
}
.rh-meta span {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
}

.rh-score {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 22px;
  border-left: 1px solid rgba(255, 255, 255, .16);
}
.ring {
  position: relative;
  width: 84px; height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.ring::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #22303f;
}
.ring-inner { position: relative; z-index: 1; text-align: center; line-height: 1.1; }
.ring-num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-cap { font-size: 10.5px; color: #a9bbcd; letter-spacing: .5px; }

.rh-grade { display: flex; flex-direction: column; gap: 6px; }
.rh-grade b { font-size: 15px; }
.rh-grade small { font-size: 11.5px; color: #a9bbcd; }

.report-root { min-width: 0; }

.state {
  padding: 40px 24px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.state h2 { font-size: 16px; margin-bottom: 8px; }
.state p { color: var(--muted); font-size: 13.5px; }
.state .btn { margin-top: 16px; }

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,.12), rgba(255,255,255,.22), rgba(255,255,255,.12));
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.3s infinite;
}
.skeleton-title { width: 260px; height: 26px; margin-bottom: 12px; }
.skeleton-line { width: 180px; height: 13px; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------------- 打印 ---------------- */
@media print {
  .topbar, .toc, .foot, #print-btn { display: none !important; }
  .report-shell { display: block; padding: 0; max-width: none; }
  .report-head {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  .rh-code, .rh-meta span { background: #f0f0f0; color: #333; }
  .ring::after { background: #fff; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .report-shell { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 4px; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .wrap, .report-shell { padding: 20px 16px 50px; }
  .hero h1 { font-size: 24px; }
  .searchbar { flex-direction: column; }
  .btn-primary { width: 100%; }
  .stats { grid-template-columns: 1fr; }
  .mini-input { width: 150px; }
  .report-head { padding: 18px; gap: 16px; }
  .rh-score { padding-left: 0; border-left: none; }
}

/* ============================================================
   登录页 · 用户标识 · 水印
   ============================================================ */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1100px 520px at 50% -12%, #e8eef6 0%, rgba(232, 238, 246, 0) 62%),
    var(--bg);
  padding: 24px;
}

.auth-wrap { width: 100%; max-width: 420px; }

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 30px 30px 24px;
  box-shadow: 0 2px 4px rgba(27, 39, 51, .04), 0 22px 48px rgba(27, 39, 51, .09);
}

.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand div { display: flex; flex-direction: column; line-height: 1.3; }
.auth-brand b { font-size: 16px; color: var(--navy); }
.auth-brand i { font-style: normal; font-size: 12px; color: var(--muted); }

.auth-tip {
  margin: 18px 0 20px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field span { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.auth-field input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--ink);
  background: #fbfcfe;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-field input:focus {
  outline: none;
  background: #fff;
  border-color: #b9c6d4;
  box-shadow: 0 0 0 3px rgba(31, 45, 61, .07);
}

.auth-submit { width: 100%; height: 44px; margin-top: 4px; }

.auth-error {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 8px 10px;
}

.auth-foot {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
  font-size: 11.5px;
  color: #9aa7b5;
  text-align: center;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  background: #f1f4f8;
  font-size: 12.5px;
  color: var(--ink-2);
  font-family: var(--mono);
}
.user-chip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #48bb78;
}

/* 报告正文水印：按登录身份平铺，用于泄露溯源 */
.wm {
  position: fixed;
  inset: -25%;
  z-index: 30;
  pointer-events: none;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(4, max-content);
  justify-content: space-around;
  align-content: space-around;
  gap: 64px 40px;
  transform: rotate(-22deg);
  opacity: .055;
  user-select: none;
}
.wm span {
  font-family: var(--mono);
  font-size: 11.5px;
  color: #1f2d3d;
  white-space: nowrap;
}

@media print {
  .wm { opacity: .07; }
}
