/* 励行科技经营数据管理平台 —— 参考 apipok 管理后台视觉风格 */
:root {
  --sidebar-bg: #0c1424;
  --sidebar-hover: #16223a;
  --primary: #1677ff;
  --primary-light: #e8f2ff;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --text-muted: #8b95a5;
  --border: #e9edf2;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 13px; -webkit-font-smoothing: antialiased;
}
.app { display: flex; height: 100vh; overflow: hidden; }

/* 侧边栏 */
.sidebar {
  width: 210px; min-width: 210px; background: var(--sidebar-bg); color: #c8d1de;
  display: flex; flex-direction: column; transition: width .2s, min-width .2s; z-index: 20;
}
.sidebar.collapsed { width: 60px; min-width: 60px; }
.sidebar.collapsed .logo-text, .sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-item span:not(.ico), .sidebar.collapsed .side-report { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding-left: 0; }
.sidebar.collapsed .logo { justify-content: center; }
.logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px 20px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #2b7fff, #0d4fd0);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; font-weight: 700; box-shadow: 0 2px 8px rgba(22,119,255,.4);
}
.logo-title { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.logo-sub { font-size: 9px; color: #6b7a90; letter-spacing: 1.5px; margin-top: 1px; }
.nav { flex: 1; overflow-y: auto; padding: 0 8px; }
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: #2a3a55; border-radius: 2px; }
.nav-group-label {
  font-size: 10px; color: #5c6b80; padding: 14px 10px 6px; letter-spacing: 1px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0;
  border-radius: 6px; cursor: pointer; color: #aab6c6; font-size: 12.5px;
  transition: background .15s, color .15s; user-select: none; white-space: nowrap;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(22,119,255,.3); }
.nav-item .ico { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; opacity: .9; }
.sidebar-foot { padding: 12px; border-top: 1px solid #1c2739; }
.side-report { background: #131f33; border-radius: 6px; padding: 10px 12px; }
.side-report-label { font-size: 10px; color: #6b7a90; }
.side-report-value { font-size: 12px; color: #7fb0ff; font-weight: 600; margin-top: 3px; }
.side-report-no { font-size: 9px; color: #5c6b80; margin-top: 2px; font-family: monospace; }

/* 主区域 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; min-height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 22px; gap: 14px;
}
.menu-toggle {
  background: none; border: none; font-size: 16px; color: #64748b; cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.menu-toggle:hover { background: #f1f5f9; }
.breadcrumb { font-size: 12px; color: #94a3b8; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.mode-badge {
  background: #eff6ff; color: #2563eb; font-size: 11px; padding: 5px 10px; border-radius: 20px; font-weight: 600;
}
.user-info { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,#60a5fa,#2563eb);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.user-name { font-size: 12px; font-weight: 600; }
.user-dept { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.content { flex: 1; overflow-y: auto; padding: 20px 22px 30px; }
.content::-webkit-scrollbar { width: 7px; }
.content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* 通用卡片 */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }
.page-title { font-size: 19px; font-weight: 700; margin: 0 0 4px; }
.page-desc { font-size: 12px; color: var(--text-muted); margin: 0; }
.tag-report { font-size: 10px; background: #f0fdf4; color: #16a34a; padding: 3px 8px; border-radius: 4px; margin-left: 8px; font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 13px; font-weight: 700; }
.card-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 8px; }
.card-body { padding: 16px 18px; }

/* 指标卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-grid.three { grid-template-columns: repeat(3, 1fr); }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 15px 17px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.stat-card::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px; background: var(--primary); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.purple::before { background: #8b5cf6; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; }
.stat-value .unit { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-left: 3px; }
.stat-foot { margin-top: 9px; font-size: 10.5px; color: #94a3b8; display: flex; justify-content: space-between; }
.stat-foot .up { color: var(--danger); font-weight: 600; }
.stat-foot .down { color: var(--success); font-weight: 600; }

/* 图表 */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart-box { width: 100%; overflow: visible; }
.chart-legend { display: flex; gap: 16px; font-size: 10.5px; color: var(--text-muted); }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  text-align: left; padding: 10px 14px; background: #f8fafc; color: #64748b; font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 11px;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fbff; }
.rank-badge { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 4px; background: #f1f5f9; color: #64748b; font-size: 10px; font-weight: 700; }
.rank-badge.top { background: #fef3c7; color: #b45309; }
.number { font-variant-numeric: tabular-nums; text-align: right; }
.money { font-weight: 600; }
.pct { color: #ea580c; font-variant-numeric: tabular-nums; }
.status-ok { display: inline-block; background: #f0fdf4; color: #16a34a; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
.company-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.link-blue { color: var(--primary); cursor: pointer; }
.link-blue:hover { text-decoration: underline; }

/* 筛选栏 */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-input, .select-input {
  border: 1px solid #dbe2ea; border-radius: 6px; padding: 7px 11px; font-size: 12px; outline: none; background: #fff; color: var(--text);
}
.search-input:focus, .select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,.1); }
.btn {
  border: 1px solid #dbe2ea; background: #fff; border-radius: 6px; padding: 7px 13px; font-size: 12px;
  cursor: pointer; color: #475569; font-weight: 500;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #1069e6; color: #fff; }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 18px; font-size: 11px; color: #64748b; }
.page-btn { border: 1px solid #dbe2ea; border-radius: 4px; padding: 4px 9px; cursor: pointer; background: #fff; font-size: 11px; }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 企业信息 */
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; }
.info-item { display: flex; border-bottom: 1px solid #f1f5f9; padding: 11px 0; }
.info-item .k { width: 120px; color: var(--text-muted); flex-shrink: 0; font-size: 12px; }
.info-item .v { font-weight: 500; font-size: 12px; }
.score-bar { height: 8px; border-radius: 4px; background: linear-gradient(90deg,#ef4444 0%,#f59e0b 35%,#22c55e 70%,#16a34a 100%); position: relative; margin: 12px 0 6px; }
.score-pin { position: absolute; top: -4px; width: 4px; height: 16px; background: #1e293b; border-radius: 2px; }
.score-labels { display: flex; justify-content: space-between; font-size: 10px; color: #94a3b8; }
.score-value { font-size: 30px; font-weight: 800; color: #16a34a; }

/* 上下游结构图 */
.chain-flow { display: flex; align-items: stretch; gap: 14px; padding: 10px 0; }
.chain-col { flex: 1; min-width: 0; }
.chain-col-title { font-size: 12px; font-weight: 700; text-align: center; padding: 8px; border-radius: 6px; margin-bottom: 10px; }
.chain-supply .chain-col-title { background: #fff7ed; color: #c2410c; }
.chain-core .chain-col-title { background: #eff6ff; color: #1d4ed8; }
.chain-customer .chain-col-title { background: #f0fdf4; color: #15803d; }
.chain-node {
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin-bottom: 7px; font-size: 11px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #fff;
}
.chain-node .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chain-node .amt { color: #64748b; font-size: 10px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.chain-arrow { display: flex; align-items: center; color: #cbd5e1; font-size: 22px; padding: 0 4px; }
.core-box { background: linear-gradient(135deg,#eff6ff,#f0f9ff); border: 1px solid #bfdbfe; border-radius: 10px; padding: 22px 14px; text-align: center; }
.core-box .core-name { font-size: 14px; font-weight: 700; color: #1e40af; }
.core-box .core-stat { font-size: 11px; color: #64748b; margin-top: 8px; line-height: 1.8; }

/* 校验提示 */
.verify-banner {
  background: linear-gradient(90deg,#f0fdf4,#f7fee7); border: 1px solid #bbf7d0; border-radius: 8px;
  padding: 12px 16px; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 12px;
}
.verify-icon { width: 22px; height: 22px; border-radius: 50%; background: #16a34a; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.verify-banner b { color: #15803d; }
.verify-banner .detail { color: #65a30d; font-size: 11px; margin-left: auto; }

/* 标签页 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 9px 16px; cursor: pointer; font-size: 12px; color: #64748b; border-bottom: 2px solid transparent; font-weight: 500; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* 提示 */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 12px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 响应式 */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .stat-grid, .stat-grid.three { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}

/* ====== 弹窗 ====== */
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: #fff; border-radius: 10px; width: 560px; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { width: 800px; }
.modal-head { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; }
.modal-head button { background: none; border: none; font-size: 20px; cursor: pointer; color: #94a3b8; line-height: 1; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; font-size: 12px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.form-row label { width: 110px; flex-shrink: 0; text-align: right; color: #64748b; font-size: 12px; }
.form-row input, .form-row select, .form-row textarea { flex: 1; border: 1px solid #dbe2ea; border-radius: 5px; padding: 7px 10px; font-size: 12px; outline: none; font-family: inherit; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row textarea { min-height: 70px; resize: vertical; }
.form-hint { font-size: 10px; color: #94a3b8; margin-top: 4px; }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input { accent-color: var(--primary); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.badge-green { background: #f0fdf4; color: #16a34a; }
.badge-red { background: #fef2f2; color: #dc2626; }
.badge-blue { background: #eff6ff; color: #2563eb; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-gray { background: #f1f5f9; color: #64748b; }
.tag-model { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 10px; margin: 1px 2px; }
.tag-model.ok { background: #dcfce7; color: #15803d; }
.tag-model.no { background: #fee2e2; color: #b91c1c; }
.action-icon { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border: 1px solid #e2e8f0; border-radius: 4px; margin-right: 4px; cursor: pointer; font-size: 12px; color: #64748b; background: #fff; }
.action-icon:hover { border-color: var(--primary); color: var(--primary); }
.action-icon.del:hover { border-color: var(--danger); color: var(--danger); }
.tabs-sub { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs-sub .tab { padding: 7px 13px; font-size: 11.5px; }
.mini-stat { display: flex; flex-direction: column; gap: 2px; }
.mini-stat .lbl { font-size: 10px; color: #94a3b8; }
.mini-stat .num { font-size: 13px; font-weight: 700; }
.progress-line { height: 5px; background: #e8edf3; border-radius: 3px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.progress-line > i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.code-box { background: #0f172a; color: #a5f3fc; padding: 12px; border-radius: 6px; font-family: Consolas, Monaco, monospace; font-size: 11px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; max-height: 200px; overflow-y: auto; }
