/* ============ 卡片 ============ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card-title .spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ============ 指标卡 ============ */
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { color: var(--text-sub); font-size: 12px; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 800; }
.stat-value small { font-size: 13px; color: var(--text-sub); font-weight: 400; margin-left: 4px; }
.stat-sub { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { background: #f6f8fa; font-weight: 600; color: var(--text-sub); position: sticky; top: 0; }
.table tr:hover td { background: #f6fbff; }
.table td:first-child, .table th:first-child { padding-left: 14px; }
.table td:last-child, .table th:last-child { padding-right: 14px; }
/* 自动换行表格：长文本列（如合同要素核心内容/依据）纵向铺开，无需左右拖曳 */
.table.wrap-cells { table-layout: fixed; }
.table.wrap-cells th, .table.wrap-cells td { white-space: normal; word-break: break-word; vertical-align: top; }

/* ============ 按钮 ============ */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; transition: .15s; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: rgba(207,34,46,.4); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { color: var(--success); border-color: rgba(45,164,78,.4); }
.btn-success:hover { background: var(--success); color: #fff; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { border: none; background: none; color: var(--text-sub); }
.btn-ghost:hover { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============ 徽章 / 标签 ============ */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-red { background: #ffebe9; color: var(--danger); }
.badge-yellow { background: #fff8c5; color: #9a6700; }
.badge-blue { background: #ddf4ff; color: var(--info); }
.badge-green { background: #dafbe1; color: #1a7f37; }
.badge-gray { background: #eef1f4; color: var(--text-sub); }
.badge-purple { background: #fbefff; color: #8250df; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #eef1f4; color: var(--text-sub); font-size: 12px; margin: 1px 2px 1px 0; }

/* ============ 表单 ============ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.input, .select, textarea.input {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #fff; color: var(--text);
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
.form-error { color: var(--danger); font-size: 12px; margin-bottom: 10px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 140px; }

/* ============ 弹窗 ============ */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 100%; max-height: 85vh; overflow-y: auto; padding: 20px; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* ============ 建议 / 列表 ============ */
.suggest-list { list-style: none; }
.suggest-list li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: 13px; line-height: 1.6; }
.suggest-list li:last-child { border-bottom: none; }
.suggest-tag { flex-shrink: 0; }
.empty { text-align: center; color: var(--text-sub); padding: 40px 0; font-size: 13px; }

/* ============ 雷达/图表容器 ============ */
.chart-box { position: relative; height: 300px; }
.chart-box-sm { position: relative; height: 220px; }

/* ============ 进度条 ============ */
.progress { height: 8px; background: #eef1f4; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 6px; }
.progress-red > div { background: var(--danger); }
.progress-yellow > div { background: var(--warning); }
.progress-green > div { background: var(--success); }
.progress-blue > div { background: var(--primary); }

/* ============ Toast ============ */
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: #24292f; color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* ============ 维度评分条 ============ */
.dim-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.dim-name { width: 76px; font-size: 13px; color: var(--text-sub); }
.dim-bar { flex: 1; }
.dim-score { width: 64px; text-align: right; font-weight: 700; font-size: 14px; }

/* ============ 标签页（管理后台） ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 9px 16px; font-size: 13px; border: none; background: none; cursor: pointer; color: var(--text-sub); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

/* ============ 管理后台补充控件 ============ */
.btn-warn { color: #9a6700; border-color: rgba(154,103,0,.4); }
.btn-warn:hover { background: #9a6700; color: #fff; }
.btn-edit { color: var(--primary); border-color: rgba(31,111,235,.4); }
.btn-edit:hover { background: var(--primary); color: #fff; }
.textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; }
.textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,111,235,.15); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px 16px; max-height: 160px; overflow-y: auto; padding: 6px; border: 1px dashed var(--border); border-radius: 8px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.chk input { accent-color: var(--primary); }
.rule-json { margin: 0; font-size: 12px; background: #f6f8fa; padding: 8px; border-radius: 6px; color: #57606a; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.rule-json, pre { font-family: Consolas, Monaco, monospace; }

/* ============ KPI 量词统一右端弱化 ============ */
.stat-value .unit, .stat-card .stat-value small {
  font-size: 12px; font-weight: 400; color: #98a2b3; margin-left: 3px;
}
/* 页头释义与卡片标题注释：统一浅色弱化 */
.pd-note { color: #98a2b3; font-size: 12px; font-weight: 400; }
.pd-note .unit { font-size: 12px; margin-left: 2px; }

/* ============ 彩色标签色板（节点类型/策划板块分色） ============ */
.tag-c1 { background: #e7f0fe; color: #1f5eff; }
.tag-c2 { background: #fff3e0; color: #b25e09; }
.tag-c3 { background: #f1e9fd; color: #7c3aed; }
.tag-c4 { background: #e8f7ef; color: #15803d; }
.tag-c5 { background: #fdeeee; color: #c62828; }
.tag-c6 { background: #e0f4f5; color: #0e7490; }
.tag-c7 { background: #fdf6e3; color: #a16207; }
.tag-c8 { background: #eceef1; color: #57606a; }

/* ============ AI 分析报告（DeepSeek） ============ */
.ai-rpt { border: 1px solid rgba(31,111,235,.3); border-radius: 10px; padding: 16px 18px; background: linear-gradient(180deg,#fbfdff,#f6faff); }
.ai-rpt-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-rpt-sum { font-size: 14px; font-weight: 600; color: #24292f; line-height: 1.7; margin-bottom: 4px; }
.ai-rpt-meta { font-size: 12px; color: #98a2b3; }
.ai-rpt-sec { margin-top: 12px; }
.ai-rpt-sec h4 { margin: 0 0 6px; font-size: 13px; color: #1f5eff; display: flex; align-items: center; gap: 6px; }
.ai-rpt-sec h4::before { content: ''; width: 4px; height: 14px; background: #1f6feb; border-radius: 2px; display: inline-block; }
.ai-rpt-sec p { margin: 0; font-size: 13px; color: #33445c; line-height: 1.8; }
.ai-rpt-actions { margin-top: 14px; background: #fff7e8; border: 1px dashed rgba(245,166,35,.5); border-radius: 8px; padding: 10px 14px; }
.ai-rpt-actions h4 { margin: 0 0 6px; font-size: 13px; color: #8a5b00; }
.ai-rpt-actions ol { margin: 0; padding-left: 20px; font-size: 13px; color: #33445c; line-height: 1.9; }
.ai-loading { display: flex; align-items: center; gap: 10px; padding: 24px; color: #57606a; font-size: 13px; justify-content: center; }
.ai-loading .spin { width: 18px; height: 18px; border: 2px solid #d0d7de; border-top-color: #1f6feb; border-radius: 50%; animation: ai-spin 0.8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* ============ 履约穿透：航拍对比 / 热力 ============ */
.modal-wide { width: 960px; }
.cmp-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; position: relative; background: #f6f8fa; }
.cmp-card.cmp-cur { border-color: rgba(31,111,235,.5); box-shadow: 0 0 0 2px rgba(31,111,235,.12); }
.cmp-tag { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(36,41,47,.75); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 10px; }
.cmp-card img { width: 100%; height: 240px; object-fit: cover; display: block; cursor: zoom-in; }
.cmp-card.img-error img { display: none; }
.cmp-card.img-error::after { content: '图片加载失败'; display: flex; align-items: center; justify-content: center; height: 240px; color: var(--text-sub); font-size: 13px; }
.cmp-empty { height: 240px; display: flex; align-items: center; justify-content: center; color: var(--text-sub); font-size: 13px; }
.cmp-label { padding: 8px 12px; font-size: 12px; color: var(--text-sub); background: #fff; border-top: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cmp-grid-item { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #f6f8fa; }
.cmp-grid-item img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: zoom-in; }
.heat { display: inline-block; min-width: 26px; text-align: center; font-weight: 700; border-radius: 6px; padding: 2px 8px; font-size: 13px; }
.heat-ok { background: #e6f6ec; color: var(--success); }
.heat-bad { background: #fdecec; color: var(--danger); }
.ai-note { margin-top: 10px; background: #f0f6ff; border: 1px solid rgba(31,111,235,.25); border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #33445c; line-height: 1.7; }

/* ============ 风险提示卡片 ============ */
.risk-alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; font-size: 13px; line-height: 1.7; border: 1px solid; }
.risk-high { background: #fdecec; border-color: rgba(229,72,77,.4); color: #a02321; }
.risk-medium { background: #fff7e8; border-color: rgba(245,166,35,.45); color: #8a5b00; }
.risk-low { background: #eefaf3; border-color: rgba(34,160,107,.35); color: #14795a; }

/* ============ 整改单卡片 ============ */
.ro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.ro-card { border: 1px solid var(--border); border-left: 4px solid var(--text-sub); border-radius: 10px; padding: 14px 16px; background: #fff; box-shadow: var(--shadow); }
.ro-card.code-红 { border-left-color: var(--danger); }
.ro-card.code-黄 { border-left-color: var(--warning); }
.ro-card.code-蓝 { border-left-color: var(--primary); }
.ro-card.closed { opacity: .65; }
.ro-title { font-size: 14px; font-weight: 600; margin: 6px 0 8px; line-height: 1.5; }
.ro-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.ro-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ============ 打印 ============ */
@media print {
  .topbar, .sidebar, .sidebar-mask, .no-print { display: none !important; }
  .content { padding: 0 !important; overflow: visible !important; }
  .rpt-doc { font-size: 12px; }
}
