:root {
  --navy: #0e2a47;
  --navy-2: #163d63;
  --navy-3: #1f5280;
  --gold: #c9a227;
  --gold-light: #e7c96a;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2a37;
  --muted: #6b7787;
  --border: #e2e8f0;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --warn: #b9770e;
  --warn-bg: #fff7e0;
  --ok: #1e7a46;
  --ok-bg: #e9f7ef;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* decorative background */
.bg-orb { position: fixed; border-radius: 50%; filter: blur(60px); opacity: .18; z-index: 0; pointer-events: none; }
.orb1 { width: 340px; height: 340px; background: var(--navy-3); top: -120px; right: -90px; }
.orb2 { width: 300px; height: 300px; background: var(--gold); bottom: -120px; left: -100px; opacity: .12; }

/* topbar */
.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 100%);
  color: #fff;
  padding: 20px 18px 18px;
  border-bottom: 3px solid var(--gold);
  position: relative;
  z-index: 1;
}
.topbar > * { max-width: 900px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy); font-size: 22px; font-weight: 800;
}
.brand-text h1 { font-size: 20px; font-weight: 700; letter-spacing: 1px; }
.brand-text p { font-size: 12.5px; color: rgba(255,255,255,.78); margin-top: 2px; }
.userbox { position: absolute; top: 18px; right: 18px; display: flex; align-items: center; gap: 8px; }
.login-user { font-size: 13px; color: var(--gold-light); }

/* tabs */
.tabs {
  max-width: 900px; margin: 0 auto;
  display: flex; gap: 6px; padding: 12px 14px 0;
  position: relative; z-index: 2;
}
.tab {
  flex: 1;
  border: 1px solid var(--border);
  border-bottom: none;
  background: #e7edf5;
  color: var(--muted);
  border-radius: 12px 12px 0 0;
  padding: 11px 8px;
  font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.tab.active { background: var(--card); color: var(--navy); border-color: var(--gold); border-bottom: 2px solid var(--card); position: relative; top: 1px; }

.container { max-width: 900px; margin: 0 auto; padding: 16px 14px 50px; position: relative; z-index: 1; }
.panel { display: none; }
.panel.active { display: block; }

/* cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(14,42,71,.06);
}
.ask-card { border-top: 3px solid var(--gold); }
.field-label { display: block; font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }

textarea {
  width: 100%; min-height: 88px; resize: vertical;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 16px; font-family: inherit; color: var(--text);
  outline: none; transition: border-color .2s;
}
textarea:focus { border-color: var(--navy-3); }

.ask-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: center; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 11px 18px; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: transform .08s, opacity .2s, background .15s;
  font-family: inherit;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: #3a2c00; }
.btn-ghost { background: #eef2f8; color: var(--navy-2); border-color: var(--border); padding: 9px 14px; font-size: 14px; }
.btn-ghost:hover { background: #e2e9f4; }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: auto; }

.hint { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.loading { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.loading::before {
  content: ""; width: 16px; height: 16px; border: 2.5px #d5deea solid; border-top-color: var(--navy-3);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* answer */
.answer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.badge { font-size: 12.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px; }
.badge-green { background: var(--ok-bg); color: var(--ok); }
.badge-gold { background: var(--warn-bg); color: var(--warn); }
.answer-meta { font-size: 12px; color: var(--muted); }

.answer-text { font-size: 15.5px; }
.markdown p { margin: 8px 0; }
.markdown ul, .markdown ol { margin: 8px 0 8px 22px; }
.markdown li { margin: 4px 0; }
.markdown h1, .markdown h2, .markdown h3 { color: var(--navy); margin: 14px 0 6px; font-size: 16px; }
.markdown strong { color: var(--navy-2); }
.markdown code { background: #eef2f8; padding: 1px 6px; border-radius: 4px; font-size: 14px; }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.markdown blockquote { border-left: 3px solid var(--gold); padding-left: 12px; color: var(--muted); margin: 8px 0; }

.cite-block { margin-top: 14px; }
.cite-title {
  font-size: 14px; font-weight: 700; color: var(--navy);
  margin: 14px 0 8px; display: flex; align-items: center; gap: 8px;
}
.cite-title::before { content: ""; width: 4px; height: 15px; background: var(--gold); border-radius: 2px; }
.cite-title:first-child { margin-top: 0; }

.cite-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; flex-wrap: wrap;
}
.cite-item-main { flex: 1; min-width: 200px; }
.cite-item-num { font-size: 13.5px; font-weight: 700; color: var(--navy-2); }
.cite-item-title { font-size: 13.5px; color: var(--text); margin-top: 2px; }
.cite-item-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cite-tag { flex-shrink: 0; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.cite-tag.active { background: var(--ok-bg); color: var(--ok); }
.cite-tag.partial { background: var(--warn-bg); color: var(--warn); }
.cite-tag.archived { background: var(--danger-bg); color: var(--danger); }

.answer-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.feedback { display: flex; align-items: center; gap: 6px; }
.feedback-label { font-size: 13px; color: var(--muted); }
.feedback-thanks { font-size: 13px; color: var(--ok); }

.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item {
  text-align: left; background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px; font-size: 13.5px; cursor: pointer;
}
.history-item:hover { background: #eef2f8; }
.history-item .t { color: var(--muted); font-size: 11.5px; }

/* scenario facts */
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.fact-cell { background: #f7f9fc; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.fact-cell .k { font-size: 12px; color: var(--muted); }
.fact-cell .v { font-size: 14.5px; font-weight: 600; color: var(--navy-2); word-break: break-all; }
.missing-box { margin-top: 12px; background: var(--warn-bg); border: 1px solid #f0d98a; border-radius: 10px; padding: 12px 14px; }
.question-list { margin-left: 20px; font-size: 14px; color: #6b4e08; }
.question-list li { margin: 4px 0; }

/* calc tables */
.calc-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; background: #fbfcfe; }
.calc-card .calc-head { font-weight: 700; color: var(--navy); margin-bottom: 8px; font-size: 14.5px; }
.calc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 6px 0; }
.calc-table th, .calc-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.calc-table th { background: #eef2f8; color: var(--navy-2); font-weight: 600; white-space: nowrap; }
.calc-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-table tr.total td { background: #fdf8e7; font-weight: 700; color: #6b4e08; }
.calc-note { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.formula { background: #eef2f8; border-radius: 6px; padding: 4px 8px; font-size: 13px; color: var(--navy-2); margin: 3px 0; }

/* plans */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.plan-card { border: 1.5px solid var(--border); border-radius: 12px; padding: 14px; position: relative; }
.plan-card.best { border-color: var(--gold); box-shadow: 0 4px 16px rgba(201,162,39,.18); }
.plan-card .plan-name { font-weight: 700; color: var(--navy); font-size: 15px; margin-bottom: 8px; }
.plan-card .plan-line { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.plan-card .plan-line:last-child { border-bottom: none; }
.plan-card .plan-total { font-size: 17px; font-weight: 800; color: var(--danger); margin-top: 8px; }
.plan-badge { position: absolute; top: -10px; right: 12px; background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: #3a2c00; font-size: 11.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }

/* diagnose upload */
.upload-zone {
  border: 2px dashed var(--navy-3); border-radius: 12px; padding: 20px;
  text-align: center; background: #f7f9fc; cursor: pointer; transition: background .15s, border-color .15s;
}
.upload-zone.drag { background: #eef4fb; border-color: var(--gold); }
.upload-zone input[type=file] { display: block; margin: 0 auto 10px; font-size: 14px; max-width: 100%; }
.upload-tip { font-size: 12.5px; color: var(--muted); }

.progress-bar { height: 12px; background: #e7edf5; border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--navy-3), var(--gold)); border-radius: 999px; transition: width .4s; }
.progress-text { font-size: 13.5px; color: var(--muted); }

.disclaimer-strip {
  background: var(--warn-bg); border: 1px solid #f0d98a; border-left: 4px solid var(--gold);
  color: #6b4e08; font-size: 13px; font-weight: 600; padding: 9px 12px; border-radius: 8px; margin-bottom: 12px;
}
.summary-box { background: #f7f9fc; border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; white-space: pre-wrap; }

.risk-legend { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.lv-tag { font-size: 13px; padding: 4px 12px; border-radius: 999px; font-weight: 600; }
.lv-tag b { font-weight: 800; }
.lv-high { background: var(--danger-bg); color: var(--danger); }
.lv-medium { background: var(--warn-bg); color: var(--warn); }
.lv-low { background: var(--ok-bg); color: var(--ok); }

.findings-list { display: flex; flex-direction: column; gap: 10px; }
.finding {
  border: 1px solid var(--border); border-left-width: 5px; border-radius: 10px; padding: 12px 14px; background: #fcfdff;
}
.finding.high { border-left-color: var(--danger); }
.finding.medium { border-left-color: var(--warn); }
.finding.low { border-left-color: var(--ok); }
.finding-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.finding-name { font-weight: 700; color: var(--navy); font-size: 15px; }
.finding-level { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.finding-level.high { background: var(--danger-bg); color: var(--danger); }
.finding-level.medium { background: var(--warn-bg); color: var(--warn); }
.finding-level.low { background: var(--ok-bg); color: var(--ok); }
.finding-row { font-size: 13.5px; margin: 3px 0; display: flex; gap: 6px; }
.finding-row .rk { color: var(--muted); flex-shrink: 0; min-width: 64px; }
.finding-row .rv { word-break: break-all; }
.finding-advice { font-size: 13.5px; color: var(--navy-2); background: #f3f7fc; border-radius: 6px; padding: 6px 10px; margin-top: 6px; }
.finding-refs { font-size: 12px; color: var(--muted); margin-top: 4px; }
.manual-flag { color: var(--warn); font-weight: 700; }

/* footer */
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 10px 18px 30px; position: relative; z-index: 1; }
.footer-sub { margin-top: 3px; opacity: .8; }

@media (max-width: 560px) {
  .brand-text h1 { font-size: 17px; }
  .brand-text p { font-size: 11.5px; }
  .tab { font-size: 13px; padding: 10px 4px; }
  .userbox { top: 14px; }
  .ask-row .btn { flex: 1; }
  .calc-table { font-size: 12.5px; }
  .calc-table th, .calc-table td { padding: 5px 7px; }
}

/* ============================================================
   二期新增样式
   ============================================================ */

/* inputs / selects */
.input, .select {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 15px; color: var(--text);
  background: #fff; outline: none; transition: border-color .2s;
}
.input:focus, .select:focus { border-color: var(--navy-3); }
.input-sm { padding: 6px 8px; font-size: 14px; border-radius: 8px; }
input[type="file"] { width: 100%; font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.flex-end { display: flex; align-items: flex-end; justify-content: flex-end; }
.check { font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.hint { font-size: 13px; color: var(--muted); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.sub-title { font-size: 14.5px; color: var(--navy); margin: 10px 0 6px; }
.muted { color: var(--muted); font-size: 13px; }
.gold { color: var(--gold); }
.btn-ghost { background: transparent; color: var(--gold-light); border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.warn-box { background: var(--warn-bg); border: 1px solid #ecd9a0; color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin: 8px 0; }
.ok-box { border-left: 4px solid var(--ok); }
.error-box { color: var(--danger); background: var(--danger-bg); border: 1px solid #f3c7c2; border-radius: 10px; padding: 10px 12px; }
.loading { color: var(--muted); padding: 12px; text-align: center; }

/* data tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.data-table thead th { background: #eef3f9; color: var(--navy); font-size: 13px; }
.table-scroll { overflow-x: auto; }
code { background: #f1f5f9; padding: 2px 5px; border-radius: 5px; font-size: 12px; word-break: break-all; }

/* facts */
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 8px; }
.fact-item { background: #f6f9fc; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.fact-key { color: var(--muted); }
.fact-val { font-weight: 600; word-break: break-all; text-align: right; }

/* steps / refs */
.steps { margin: 6px 0 6px 20px; font-size: 14px; }
.steps li { margin: 4px 0; }
.ref-list { margin: 4px 0 4px 20px; font-size: 13.5px; }
.basis { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.answer-text p { margin: 6px 0; font-size: 14.5px; }
.disclaimer { font-size: 12.5px; color: var(--muted); margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }

/* plans */
.recommend-banner { background: linear-gradient(135deg, var(--navy), var(--navy-3)); color: #fff; border-radius: 10px; padding: 10px 14px; font-size: 14.5px; margin-bottom: 12px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 12px; }
.plan-box { border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; position: relative; background: #fbfcfe; }
.plan-recommended { border: 2px solid var(--gold); background: #fffdf5; }
.plan-badge { position: absolute; top: -11px; right: 12px; background: var(--gold); color: var(--navy); font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.plan-box h4 { font-size: 14.5px; color: var(--navy); margin-bottom: 6px; padding-right: 40px; }
.plan-tax { font-size: 14px; margin: 4px 0; }
.plan-diff, .plan-save { font-size: 12.5px; color: var(--danger); margin: 2px 0; }
.plan-save { color: var(--ok); }
.plan-pros ul, .plan-cons ul { margin: 2px 0 2px 18px; font-size: 12.5px; }
.plan-compliance { font-size: 12px; color: var(--muted); background: #f3f7fc; border-radius: 6px; padding: 6px 8px; margin-top: 6px; }

/* parsed editor */
.edit-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.quality-bar { font-size: 12.5px; color: var(--muted); margin: 6px 0; }
.low-conf-list { background: var(--warn-bg); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; color: var(--warn); margin: 6px 0; }
.low-conf-tag { display: inline-block; background: #fff; border: 1px solid #ecd9a0; border-radius: 999px; padding: 1px 9px; margin: 2px 3px; }

/* metrics */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 10px; margin: 10px 0; }
.metric-box { background: #f6f9fc; border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; }
.metric-val { font-size: 18px; font-weight: 700; color: var(--navy); }
.metric-label { font-size: 12px; color: var(--muted); margin-top: 3px; }
.benchmark-note { font-size: 12.5px; color: var(--muted); background: #f3f7fc; border-radius: 8px; padding: 7px 10px; margin-top: 8px; }
.benchmark-source { font-size: 12px; color: var(--navy-3); margin-top: 3px; }
.change-up { color: var(--ok); font-weight: 600; }
.change-down { color: var(--danger); font-weight: 600; }
.chart-wrap { margin-top: 8px; overflow-x: auto; }
#trendChart { max-width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fff; }

/* modal */
.modal-mask { position: fixed; inset: 0; background: rgba(14,42,71,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 20px 22px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 90vh; overflow-y: auto; }
.modal-lg { max-width: 640px; }
.modal h3 { color: var(--navy); margin-bottom: 10px; }
.form-error { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }
.json-area { min-height: 140px; font-family: Menlo, Consolas, monospace; font-size: 13px; }

/* admin */
.admin-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-table .cond-cell, .admin-table .advice-cell, .admin-table .source-cell { max-width: 240px; }
.admin-table .op-cell { white-space: nowrap; }
.admin-table .value-cell { font-weight: 600; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.status-dot.on { background: var(--ok); }
.status-dot.off { background: var(--muted); }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .edit-tables { grid-template-columns: 1fr; }
}


/* ===== 三期·块1：全税种联动测算 ===== */
.tag { display:inline-block; font-size:12px; line-height:1; padding:4px 9px; border-radius:999px;
  background:#eef1f5; color:#44506a; border:1px solid #d9e0ea; margin:0 2px; white-space:nowrap; }
.tag-high { background:#fdeceb; color:#c0392b; border-color:#f5c6c2; }
.tag-medium { background:#fef5e3; color:#b9770e; border-color:#f5ddae; }
.tag-low { background:#e9f7ef; color:#1e8449; border-color:#bfe6cf; }

.bundle-item { border:1px solid var(--border); border-radius:10px; padding:12px 14px; margin:10px 0; background:#fcfdff; }
.bundle-head { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.bundle-name { font-size:15px; font-weight:700; color:var(--navy); }
.bundle-amount { margin-left:auto; font-size:17px; font-weight:800; color:#c0392b; }
.bundle-meta { margin-top:8px; font-size:13.5px; color:#44506a; }
.bundle-steps { margin:8px 0 4px; padding-left:20px; font-size:13px; color:#5a6577; }
.bundle-steps li { margin:2px 0; }
.bundle-docs { margin-top:6px; }
.bundle-total { display:flex; align-items:center; justify-content:space-between; margin-top:14px;
  padding:12px 14px; border-radius:10px; background:linear-gradient(90deg,#fbeaea,#fdf3ec);
  font-size:15px; font-weight:700; color:var(--navy); }
.bundle-total-num { font-size:21px; font-weight:800; color:#c0392b; }

.missing-list { padding-left:20px; }
.missing-list li { margin:6px 0; color:#44506a; }
.table-wrap { overflow-x:auto; }
.row-rec { background:#fdf6f5; }
.row-rec td { font-weight:600; }

@media (max-width:640px) {
  .bundle-amount { margin-left:0; width:100%; }
  .bundle-total { flex-direction:column; gap:6px; align-items:flex-start; }
}


/* ============================================================
   行业风险评分（三期块2 P1） — 藏青深蓝 + 金色
   ============================================================ */
.ir-section { margin-top: 18px; }
.ir-section .hint { margin: 6px 0 14px; color: var(--text-soft, #b8c6e0); font-size: 13px; line-height: 1.7; }

.ir-modebar {
  display: flex; gap: 8px; margin-bottom: 16px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
}
.ir-modebtn {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-soft, #b8c6e0);
  font-size: 14px; padding: 8px 16px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .2s, border-color .2s;
}
.ir-modebtn:hover { color: var(--gold, #d4af37); }
.ir-modebtn.active {
  color: var(--gold, #d4af37);
  border-bottom-color: var(--gold, #d4af37);
}
.ir-select-btn { display: inline-block; cursor: pointer; }

/* ---- 多期录入卡片 ---- */
.ir-period {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.02);
}
.ir-period-head { margin-bottom: 10px; }
.ir-period-title {
  color: var(--gold, #d4af37);
  font-weight: 600; font-size: 14px;
}

/* ---- 文件 chips ---- */
.file-list { margin-top: 12px; }
.file-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  font-size: 13px;
}
.file-icon { font-size: 16px; }
.file-name { color: var(--text, #e8eefc); }
.file-size { color: var(--text-soft, #b8c6e0); font-size: 12px; }
.file-ok { color: #4ade80; margin-left: auto; font-size: 12px; font-weight:600; }
.file-wait { color: #fbbf24; margin-left: auto; font-size: 12px; }
.file-fail { color: #f87171; margin-left: auto; font-size: 12px; font-weight:600; max-width:50%; text-align:right; }
.file-chip-fail { border-color: rgba(248,113,113,0.55); background: rgba(248,113,113,0.08); }

/* ---- 仪表盘 ---- */
.ir-dash { margin-bottom: 16px; }
.ir-dash-top {
  display: flex; align-items: center; gap: 28px;
  flex-wrap: wrap;
}
.ir-gauge {
  width: 150px; height: 150px; border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 8px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.ir-gauge.g-critical { border-color: #ef4444; box-shadow: 0 0 28px rgba(239,68,68,0.35); }
.ir-gauge.g-high     { border-color: #f59e0b; box-shadow: 0 0 28px rgba(245,158,11,0.30); }
.ir-gauge.g-medium   { border-color: var(--gold, #d4af37); box-shadow: 0 0 28px rgba(212,175,55,0.30); }
.ir-gauge.g-low      { border-color: #22c55e; box-shadow: 0 0 24px rgba(34,197,94,0.25); }
.ir-gauge-num { font-size: 44px; font-weight: 800; line-height: 1; color: var(--text, #e8eefc); }
.ir-gauge-unit { font-size: 12px; color: var(--text-soft, #b8c6e0); margin-top: 6px; }

.ir-dash-meta { flex: 1; min-width: 200px; }
.ir-industry-name { font-size: 16px; color: var(--text, #e8eefc); margin-bottom: 8px; }
.ir-grade-badge {
  display: inline-block;
  padding: 5px 16px; border-radius: 20px;
  font-size: 14px; font-weight: 700;
  margin-bottom: 8px;
}
.ir-grade-badge.g-critical { background: rgba(239,68,68,0.18); color: #fca5a5; border: 1px solid rgba(239,68,68,0.5); }
.ir-grade-badge.g-high     { background: rgba(245,158,11,0.18); color: #fcd34d; border: 1px solid rgba(245,158,11,0.5); }
.ir-grade-badge.g-medium   { background: rgba(212,175,55,0.18); color: var(--gold, #d4af37); border: 1px solid rgba(212,175,55,0.5); }
.ir-grade-badge.g-low      { background: rgba(34,197,94,0.16); color: #86efac; border: 1px solid rgba(34,197,94,0.5); }
.ir-grade-line { font-size: 13px; color: var(--text-soft, #b8c6e0); margin-bottom: 4px; }

.ir-grade-track {
  flex-basis: 100%;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; margin-top: 6px;
}
.ir-grade-track span {
  text-align: center; font-size: 11px;
  color: var(--text-soft, #b8c6e0);
  padding: 5px 0; border-radius: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ---- 维度得分 ---- */
.ir-dims { margin-top: 22px; display: grid; gap: 14px; }
.ir-dim-head {
  display: flex; justify-content: space-between;
  font-size: 13px; margin-bottom: 6px;
  color: var(--text, #e8eefc);
}
.ir-dim-score { color: var(--gold, #d4af37); }
.ir-dim-bar {
  height: 8px; border-radius: 4px; overflow: hidden;
  background: rgba(255,255,255,0.07);
}
.ir-dim-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--navy-2, #1e3a6b), var(--gold, #d4af37));
  border-radius: 4px;
}

/* ---- 基准对比表 ---- */
.ir-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ir-table th {
  text-align: left; padding: 10px 12px;
  color: var(--gold, #d4af37); font-weight: 600;
  border-bottom: 1px solid rgba(212,175,55,0.25);
  white-space: nowrap;
}
.ir-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--text, #e8eefc);
}
.ir-st {
  display: inline-block; padding: 2px 10px;
  border-radius: 12px; font-size: 12px; white-space: nowrap;
}
.st-below { background: rgba(239,68,68,0.15); color: #fca5a5; }
.st-above { background: rgba(245,158,11,0.15); color: #fcd34d; }
.st-ok    { background: rgba(34,197,94,0.14); color: #86efac; }

/* ---- 命中明细 ---- */
.ir-hit {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: rgba(255,255,255,0.02);
}
.ir-hit-head {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 12px;
}
.ir-hit-no {
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(212,175,55,0.18);
  color: var(--gold, #d4af37);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.ir-hit-name { font-weight: 600; color: var(--text, #e8eefc); flex: 1; min-width: 120px; }
.ir-hit-weight { color: var(--gold, #d4af37); font-weight: 700; font-size: 13px; }
.ir-hit-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin-bottom: 10px;
}
.ir-hit-grid > div { font-size: 13px; color: var(--text, #e8eefc); }
.ir-hit-grid .muted { display: block; font-size: 11px; margin-bottom: 2px; }
.ir-hit-src { font-size: 12px; color: var(--text-soft, #b8c6e0); margin-bottom: 8px; }
.ir-hit-evidence {
  font-size: 13px; line-height: 1.7;
  color: var(--text-soft, #b8c6e0);
  border-left: 3px solid var(--gold, #d4af37);
  padding: 4px 0 4px 12px; margin-bottom: 10px;
}
.ir-hit-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.ir-hit-advice { font-size: 13px; line-height: 1.7; color: var(--text, #e8eefc); }

/* ---- 移动端自适应 ---- */
@media (max-width: 720px) {
  .ir-dash-top { gap: 18px; justify-content: center; text-align: center; }
  .ir-dash-meta { text-align: center; }
  .ir-gauge { width: 128px; height: 128px; }
  .ir-gauge-num { font-size: 36px; }
  .ir-hit-grid { grid-template-columns: repeat(2, 1fr); }
  .ir-grade-track span { font-size: 10px; }
  .ir-table { font-size: 12px; }
  .ir-table th, .ir-table td { padding: 8px; }
  .table-wrap { overflow-x: auto; }
}

/* ================= 凭证抽查（三期·块3） ================= */
.va-statrow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.va-stat {
  background: linear-gradient(160deg, var(--navy-2), var(--navy));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  color: #fff;
}
.va-stat-num { font-size: 26px; font-weight: 700; color: var(--gold-light); line-height: 1.2; }
.va-stat-label { font-size: 13px; color: #c6d4e6; margin-top: 4px; }
.va-find-total .va-stat-num { color: #ffb3a8; }
.va-high .va-stat-num { color: #ffd9a0; }

.va-agg { margin-bottom: 14px; }
.va-aggblock { padding: 10px 0; border-top: 1px dashed var(--border); }
.va-aggblock:first-of-type { border-top: none; }
.va-agg-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.va-agg-items { display: flex; flex-wrap: wrap; gap: 8px; }
.va-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--text);
}
.va-chip b { color: var(--navy-3); }

.va-filterbar { gap: 10px; flex-wrap: wrap; }
.select-sm { width: auto; min-width: 140px; padding: 7px 10px; font-size: 13px; }

.va-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1000px; }
.va-table th {
  background: var(--navy); color: #fff; font-weight: 600;
  text-align: left; padding: 10px; white-space: nowrap;
}
.va-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.va-table tr:hover td { background: #f8fafd; }
.ta-r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.va-actual { font-weight: 600; color: var(--warn); white-space: nowrap; }
.va-thr { font-size: 12px; white-space: nowrap; }
.va-refs { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.va-advice { max-width: 240px; font-size: 12.5px; color: #374151; }

@media (max-width: 720px) {
  .va-statrow { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .va-stat:nth-child(5) { grid-column: span 2; }
  .va-stat-num { font-size: 22px; }
  .va-table { font-size: 12px; min-width: 820px; }
  .va-table th, .va-table td { padding: 8px; }
  .select-sm { flex: 1 1 30%; min-width: 0; }
}

/* ========== 诊断报告：导出PDF ========== */
.diag-export-bar { display: flex; justify-content: flex-end; margin-bottom: 10px; }

/* 风险等级标签（diagnose 渲染用 level-tag，此前缺屏幕样式） */
.level-tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.level-tag.level-high { background: var(--danger-bg); color: var(--danger); }
.level-tag.level-medium { background: var(--warn-bg); color: var(--warn); }
.level-tag.level-low { background: var(--ok-bg); color: var(--ok); }

/* PDF 专用头尾：屏幕上不显示 */
.pdf-report-head, .pdf-report-footer { display: none; }

@media print {
  @page { size: A4; margin: 12mm 10mm; }
  html, body { background: #fff !important; }
  body.pdf-printing .topbar,
  body.pdf-printing .tabs,
  body.pdf-printing .bg-orb,
  body.pdf-printing .mb-clock,
  body.pdf-printing .mb-quick,
  body.pdf-printing #pane-diagnose > .card,
  body.pdf-printing .ir-section { display: none !important; }
  body.pdf-printing .container { max-width: 100%; padding: 0; }
  body.pdf-printing .panel { display: none !important; }
  body.pdf-printing #panel-health { display: block !important; }
  body.pdf-printing #pane-diagnose { display: block !important; }
  body.pdf-printing #pane-healthanalysis,
  body.pdf-printing #pane-voucheraudit { display: none !important; }

  body.pdf-printing #diagResult { display: block; }
  body.pdf-printing #diagResult .card {
    box-shadow: none; border: 1px solid #cbd5e1; border-radius: 0;
    padding: 10px 12px; margin-bottom: 10px; break-inside: avoid;
  }
  body.pdf-printing #diagResult .finding {
    border: 1px solid #d7dee8; border-radius: 6px; padding: 8px 10px;
    margin-bottom: 8px; break-inside: avoid;
  }
  body.pdf-printing .data-table thead th { background: #eef3f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.pdf-printing .level-tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; border: 1px solid currentColor; }
  body.pdf-printing .metric-box { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.pdf-printing .finding-advice,
  body.pdf-printing .benchmark-note { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.pdf-printing .table-scroll { overflow: visible; }
  body.pdf-printing #trendChart { max-width: 100%; height: auto; }
  body.pdf-printing .diag-export-bar,
  body.pdf-printing .btn-relations { display: none !important; }

  body.pdf-printing .pdf-report-head { display: block; margin-bottom: 8px; }
  body.pdf-printing .pdf-head-row { display: flex; justify-content: space-between; align-items: flex-end; }
  body.pdf-printing .pdf-company { font-size: 19px; font-weight: 800; color: var(--navy); }
  body.pdf-printing .pdf-gen-date { font-size: 11.5px; color: var(--muted); }
  body.pdf-printing .pdf-head-line { height: 3px; background: var(--navy); margin-top: 6px; }

  body.pdf-printing .pdf-report-footer {
    display: block; margin-top: 14px; padding-top: 8px;
    border-top: 1px solid #cbd5e1; font-size: 11px; color: var(--muted); line-height: 1.7;
  }
}

/* ============================================================
   手机端标签栏：横滑胶囊（2026-11-14）
   现状问题：.tab 是 flex:1 平分，375 屏下每个仅 44px，13px 字号
   装不下 4~6 个字，被挤成 2~3 行，整排 74px 高且难看。
   改为：宽度按文字自适应、一行不折行、横向可滑，右侧露出半截
   下一个标签暗示可滑。桌面端（>720px）完全不受影响。
   ============================================================ */
@media (max-width: 720px) {
  .tabs {
    gap: 8px;
    padding: 12px 14px 2px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tabs::-webkit-scrollbar { display: none; }

  .tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 16px;
    font-size: 13.5px;
    line-height: 1.35;
    border: 1px solid #dbe3ed;
    border-radius: 999px;
    background: #fff;
    color: #5a6b7d;
    box-shadow: 0 1px 2px rgba(16, 40, 70, .05);
    transition: all .18s;
  }
  .tab:active { transform: scale(.97); }

  .tab.active {
    background: linear-gradient(135deg, #0a2444, #11355d);
    color: #ffd76a;
    border: 1px solid transparent;
    border-bottom: 1px solid transparent;
    box-shadow: 0 3px 10px rgba(10, 36, 68, .28);
    top: 0;
  }
}


/* ================= 三层体检引导条（v20261118） ================= */
.ck-bar { margin: 0 0 14px; }
.ck-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.ck-head strong { font-size: 14.5px; color: var(--navy); }
.ck-sub { font-size: 12px; color: var(--muted); }
.ck-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ck-step {
  position: relative; display: flex; align-items: center; gap: 9px;
  padding: 11px 12px 11px 15px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--card); cursor: pointer; text-align: left;
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
  overflow: hidden; font-family: inherit;
}
.ck-step::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: #94a3b8; }
.ck-step:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(14,42,71,.12); }
.ck-no {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: #fff; background: #94a3b8; line-height: 1;
}
.ck-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ck-txt b { font-size: 14px; color: var(--navy); white-space: nowrap; }
.ck-txt i { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ck-when {
  margin-left: auto; flex: 0 0 auto; font-size: 11px; color: #4b5a54;
  background: #f0f5f3; border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.ck-blue::before, .ck-blue .ck-no { background: #2563eb; }
.ck-amber::before, .ck-amber .ck-no { background: #d97706; }
.ck-violet::before, .ck-violet .ck-no { background: #7c3aed; }
.ck-blue.ck-on { border-color: #2563eb; background: #f5f9ff; box-shadow: 0 0 0 2px rgba(37,99,235,.16); }
.ck-amber.ck-on { border-color: #d97706; background: #fffbf2; box-shadow: 0 0 0 2px rgba(217,119,6,.16); }
.ck-violet.ck-on { border-color: #7c3aed; background: #faf7ff; box-shadow: 0 0 0 2px rgba(124,58,237,.16); }

/* Tab 步骤序号 */
.tab .tab-idx {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; margin-right: 4px;
  font-size: 10px; font-weight: 800; line-height: 1; vertical-align: 1px;
  background: rgba(14,42,71,.13); color: inherit;
}
.tab.active .tab-idx { background: rgba(201,162,58,.25); }

@media (max-width: 640px) {
  .ck-steps { grid-template-columns: 1fr; gap: 8px; }
  .ck-when { display: none; }
  .ck-txt b { font-size: 13.5px; }
  .ck-head strong { font-size: 13.5px; }
  .ck-sub { font-size: 11.5px; }
}

/* ================= 企业体检（三合一入口） ================= */
.ck-pane { display: none; }
.ck-pane.active { display: block; }

.ck-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--border);
}
.ck-hint { font-size: 12px; color: var(--muted); line-height: 1.5; }

.tab .tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 5px; padding: 1px 6px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; line-height: 1.6; vertical-align: 1px;
  background: rgba(201,162,58,.18); color: #8a6a14;
}
.tab.active .tab-badge { background: rgba(201,162,58,.32); color: #7a5c10; }

/* 凭证多文件列表 */
.va-files { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.va-file-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: #fafcff; font-size: 13px;
}
.va-file-row .va-fi-idx {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  background: #e2e9f3; color: #41546b; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.va-file-row .va-fi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--navy); }
.va-file-row .va-fi-size { flex: 0 0 auto; color: var(--muted); font-size: 11.5px; }
.va-file-row .va-fi-del {
  flex: 0 0 auto; border: none; background: none; color: #b91c1c;
  cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 5px; border-radius: 6px;
}
.va-file-row .va-fi-del:hover { background: #fee2e2; }
.va-files-sum { font-size: 12px; color: var(--muted); padding: 2px 2px 0; }

/* 单项报告下载条 */
.report-dl-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 12px;
  background: #f7faf8; border: 1px dashed #c9d8cf; border-radius: 10px;
}
.report-dl-bar .dl-txt { font-size: 12.5px; color: #4b5a54; flex: 1; min-width: 180px; }

@media (max-width: 640px) {
  .ck-actions { flex-direction: column; align-items: stretch; }
  .ck-actions .btn { width: 100%; }
  .tab .tab-badge { display: none; }
  .report-dl-bar { flex-direction: column; align-items: stretch; }
}
