/* ============================================================
   供应链管理画像原型 - 样式
   Design Tokens & Global Styles
   ============================================================ */
:root {
  /* 品牌色 */
  --brand: #1890FF;
  --brand-hover: #40A9FF;
  --brand-active: #096DD9;
  --brand-light: #E6F7FF;
  --brand-bg: #F3F9FF;
  /* 功能色 */
  --success: #00B42A;
  --warning: #FF7D00;
  --danger: #F5222D;
  /* 文字颜色 */
  --text-1: #333333;
  --text-2: #666666;
  --text-3: #999999;
  --text-4: #CCCCCC;
  /* 中性色 */
  --white: #FFFFFF;
  --bg-page: #F0F2F5;
  --bg-row: #FAFAFA;
  --bg-hover: #F3F9FF;
  --border: #E8E8E8;
  --border-strong: #D9D9D9;
  /* 按钮（数字供应链规范） */
  --btn-primary: #1890FF;
  --btn-primary-hover: #40A9FF;
  --btn-primary-active: #096DD9;
  /* 字体 */
  --font: "PingFang SC", "Microsoft YaHei", "微软雅黑", "Helvetica Neue", Arial, sans-serif;
  /* 间距 */
  --sp-8: 8px;
  --sp-12: 12px;
  --sp-16: 16px;
  --sp-24: 24px;
  /* 圆角 */
  --radius: 4px;
  /* 尺寸 */
  --topbar-h: 56px;
  --sidebar-w: 216px;
  --sidebar-w-min: 52px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ============ 布局骨架 ============ */
.layout { display: flex; flex-direction: column; height: 100vh; }
.body { display: flex; flex: 1; overflow: hidden; }
.main { flex: 1; overflow-y: auto; padding: 0 var(--sp-24) var(--sp-24); }

/* ============ 顶部导航（蓝色，依据数字供应链UE/UI规范） ============ */
.topbar {
  height: var(--topbar-h);
  /* 顶部导航与面包屑为同一横向蓝色渐变背景区域（左 #0A75D9 → 右 #1890FF），无缝整体、不设阴影 */
  background: linear-gradient(90deg, #0A75D9 0%, #1890FF 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-24);
  flex-shrink: 0;
  z-index: 100;
  box-shadow: none;
  border-bottom: none;
}
.topbar-left { display: flex; align-items: center; height: 100%; gap: var(--sp-24); }
.logo { display: flex; align-items: center; gap: var(--sp-8); }
.logo-badge {
  width: 30px; height: 30px; border-radius: 6px;
  background: #FFF;
  color: #0A75D9; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.logo-text { font-size: 16px; font-weight: 600; color: #FFF; white-space: nowrap; }
.topnav { display: flex; height: 100%; align-items: stretch; }
.topnav-item {
  display: flex; align-items: center; padding: 0 var(--sp-16);
  font-size: 14px; color: rgba(255,255,255,0.82); position: relative;
  border-radius: 4px; white-space: nowrap;
  margin: 4px 0;
  transition: background 0.15s, color 0.15s;
}
.topnav-item:hover { background: rgba(255,255,255,0.16); color: #FFF; }
.topnav-item.active {
  background: transparent; color: #FFF; font-weight: 600;
  box-shadow: inset 0 -3px 0 #FFF;
}
.topbar-right { display: flex; align-items: center; gap: var(--sp-16); }
.icon-btn {
  position: relative; width: 34px; height: 34px; border: none; background: transparent;
  color: #FFF; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: rgba(255,255,255,0.18); color: #FFF; }
.badge {
  position: absolute; top: -2px; right: -6px; min-width: 18px; height: 16px;
  padding: 0 4px; background: var(--danger); color: #fff;
  font-size: 10px; line-height: 16px; border-radius: 8px; text-align: center;
}
.user-box {
  display: flex; align-items: center; gap: 6px; border: none; background: transparent;
  color: #FFF; font-size: 13px; padding: 4px 6px; border-radius: 4px;
}
.user-box:hover { background: rgba(255,255,255,0.18); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: #FFF;
  color: #0A75D9; font-size: 13px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ============ 左侧导航 ============ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-w-min); }
.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--sp-8) 0; }
.side-item {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 var(--sp-16);
  color: var(--text-2); font-size: 14px; cursor: pointer;
  white-space: nowrap; position: relative;
}
.side-item svg { flex-shrink: 0; color: var(--text-2); }
.side-item:hover { background: var(--brand-bg); color: var(--brand); }
.side-item:hover svg { color: var(--brand); }
/* 选中态：渐变蓝底白字、圆角 6px */
.side-item.active {
  background: linear-gradient(90deg, #1890FF 0%, #45ADFF 100%);
  color: #FFF; font-weight: 600; border-radius: 6px;
}
.side-item.active svg { color: #FFF; }
.side-group-title { font-weight: 600; color: var(--text-1); }
.side-group-title .chev { margin-left: auto; transition: transform 0.2s; }
.side-group:not(.open) .chev { transform: rotate(-90deg); }
.side-children { display: block; padding: 0 8px; }
.side-group:not(.open) .side-children { display: none; }
.side-child { padding-left: 14px; font-size: 13px; color: var(--text-2); }
.side-child.active {
  color: #FFF; font-weight: 600;
  background: linear-gradient(90deg, #1890FF 0%, #45ADFF 100%);
  border-radius: 6px;
}
.child-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); flex-shrink: 0;
}
.side-child.active .child-dot { background: #FFF; }
.sidebar-bottom { border-top: 1px solid var(--border); padding: var(--sp-8) 0; }
.collapse-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 40px;
  padding: 0 var(--sp-16); border: none; background: transparent;
  color: var(--text-2); font-size: 13px; white-space: nowrap;
}
.collapse-btn:hover { color: var(--brand); background: var(--bg-row); }

/* 折叠态：隐藏文字 */
.sidebar.collapsed .side-label,
.sidebar.collapsed .chev,
.sidebar.collapsed .child-dot,
.sidebar.collapsed .badge { display: none; }
.sidebar.collapsed .side-child { padding-left: 0; justify-content: center; }
.sidebar.collapsed .side-item { justify-content: center; padding: 0; }
.sidebar.collapsed .side-children .side-item svg { display: none; }
.sidebar.collapsed .side-child::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-4);
}
.sidebar.collapsed .side-child.active::after { background: var(--brand); }

/* ============ 面包屑（与顶部导航同一横向蓝色渐变，同列同色无缝整体） ============ */
.breadcrumb {
  display: flex; align-items: center; gap: var(--sp-8);
  height: 40px; font-size: 13px; color: rgba(255,255,255,0.9); flex-shrink: 0;
  background: linear-gradient(90deg, #0A75D9 0%, #1890FF 100%);
  margin: 0 -24px; padding: 0 var(--sp-24);
}
.breadcrumb a { color: rgba(255,255,255,0.9); }
.breadcrumb a:hover { color: #FFF; }
.breadcrumb .sep { color: rgba(255,255,255,0.5); }
.breadcrumb .cur { color: #FFF; font-weight: 600; }

/* ============ 通用卡片 ============ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--sp-16);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-16);
  border-bottom: 1px solid var(--border);
  gap: var(--sp-12);
  flex-wrap: wrap;
}
.card-title {
  font-size: 15px; font-weight: 600; color: var(--text-1);
  display: flex; align-items: center; gap: var(--sp-8);
}
.card-title::before {
  content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--brand);
}
.card-body { padding: var(--sp-16); }
.card-note { font-size: 12px; color: var(--text-3); font-weight: 400; }

/* ============ 按钮（规范：主按钮 / 次按钮 / 文字按钮） ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 var(--sp-16);
  font-size: 14px; border-radius: var(--radius);
  border: 1px solid transparent; transition: all 0.15s; white-space: nowrap;
}
.btn-sm { height: 24px; padding: 0 10px; font-size: 12px; }
.btn-primary { background: var(--btn-primary); color: #fff; border-color: var(--btn-primary); }
.btn-primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn-primary:active { background: var(--btn-primary-active); border-color: var(--btn-primary-active); }
.btn-default { background: #fff; color: var(--text-2); border-color: var(--border-strong); }
.btn-default:hover { color: var(--btn-primary); border-color: var(--btn-primary); }
.btn-link { background: transparent; color: var(--btn-primary); height: auto; padding: 0 4px; }
.btn-link:hover { color: var(--btn-primary-hover); }
.btn-text { background: transparent; color: var(--text-2); }
.btn-text:hover { color: var(--btn-primary); }
.btn[disabled] { background: #F5F5F5; color: #BEBEBE; border-color: var(--border-strong); cursor: not-allowed; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  background: var(--bg-row); color: var(--text-1); font-weight: 600;
  padding: 10px var(--sp-12); border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.table td {
  padding: 10px var(--sp-12); border-bottom: 1px solid var(--border);
  color: var(--text-1); font-variant-numeric: tabular-nums;
}
.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; }
.table .center { text-align: center; }
.table .row-link { color: var(--brand); cursor: pointer; }
.table .row-link:hover { text-decoration: underline; }
.table tfoot td {
  background: var(--bg-row); font-weight: 600; border-bottom: none;
}

/* ============ 标签 ============ */
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  font-size: 12px; border-radius: 2px; border: 1px solid; white-space: nowrap;
}
.tag-gray { color: #666666; border-color: #D9D9D9; background: #FAFAFA; }
.tag-blue { color: #1890FF; border-color: #91D5FF; background: #E6F7FF; }
.tag-green { color: #52C41A; border-color: #B7EB8F; background: #F6FFED; }
.tag-orange { color: #FA8C16; border-color: #FFD591; background: #FFF7E6; }
.tag-red { color: #F5222D; border-color: #FFA39E; background: #FFF1F0; }
.tag-cyan { color: #13C2C2; border-color: #87E8DE; background: #E6FFFB; }
.tag-grade-好 { color: #52C41A; border-color: #B7EB8F; background: #F6FFED; }
.tag-grade-较好 { color: #1890FF; border-color: #91D5FF; background: #E6F7FF; }
.tag-grade-一般 { color: #666666; border-color: #D9D9D9; background: #FAFAFA; }
.tag-grade-较弱 { color: #FA8C16; border-color: #FFD591; background: #FFF7E6; }
.tag-grade-弱 { color: #F5222D; border-color: #FFA39E; background: #FFF1F0; }

/* 排名高亮：前三红、后三绿（沿用原始报表约定） */
.t-top3 { color: var(--danger); font-weight: 600; }
.t-bot3 { color: var(--success); font-weight: 600; }

/* ============ 筛选区 ============ */
.filter-bar { display: flex; align-items: center; gap: var(--sp-12); flex-wrap: wrap; }
.form-label { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.input, .select {
  height: 32px; padding: 0 var(--sp-12); font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: #fff; color: var(--text-1); outline: none; min-width: 0;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(24,144,255,0.12); }
.input::placeholder { color: var(--text-4); }
.search-box { position: relative; }
.search-box .input { width: 220px; padding-left: 30px; }
.search-box svg {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-4); pointer-events: none;
}

/* ============ 统计卡片 ============ */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-16); margin-bottom: var(--sp-16); }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-16); display: flex; flex-direction: column; gap: 6px;
}
.stat-label { font-size: 12px; color: var(--text-3); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-1); font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: 13px; font-weight: 400; color: var(--text-3); margin-left: 4px; }
.stat-sub { font-size: 12px; color: var(--text-2); }
.stat-card.brand { border-top: 3px solid var(--brand); }

/* ============ 总览页：排名条形图 ============ */
.rank-bars { display: flex; flex-direction: column; gap: 6px; }
.rank-row { display: flex; align-items: center; gap: var(--sp-8); font-size: 12px; }
.rank-no { width: 30px; text-align: right; color: var(--text-3); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.rank-name { width: 64px; text-align: right; color: var(--text-1); flex-shrink: 0; white-space: nowrap; }
.rank-track { flex: 1; height: 14px; background: var(--bg-page); border-radius: 3px; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 3px; background: var(--brand); transition: width 0.3s; }
.rank-fill.top3 { background: #F5222D; }
.rank-fill.bot3 { background: #52C41A; }
.rank-val { width: 64px; color: var(--text-1); font-weight: 600; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* 等级分布 */
.grade-dist { display: flex; flex-direction: column; gap: var(--sp-16); }
.grade-stack { display: flex; height: 18px; border-radius: 3px; overflow: hidden; }
.grade-stack .seg { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; }
.grade-list { display: flex; flex-wrap: wrap; gap: var(--sp-16); }
.grade-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.grade-dot { width: 10px; height: 10px; border-radius: 2px; }
.grade-item b { color: var(--text-1); font-variant-numeric: tabular-nums; }

/* ============ 详情页 ============ */
.detail-head { padding: var(--sp-16) var(--sp-24); }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-16); flex-wrap: wrap; }
.detail-title { font-size: 20px; font-weight: 700; color: var(--text-1); }
.meta-tags { display: flex; align-items: center; gap: var(--sp-8); margin-top: var(--sp-8); flex-wrap: wrap; }
.detail-actions { display: flex; align-items: center; gap: var(--sp-8); flex-wrap: wrap; }
.overall-banner {
  margin-top: var(--sp-16);
  background: linear-gradient(90deg, #E6F7FF 0%, #F4FBFF 100%);
  border: 1px solid #91D5FF; border-radius: var(--radius);
  padding: var(--sp-16);
  display: flex; gap: var(--sp-12); align-items: flex-start;
}
.overall-banner svg { color: var(--brand); flex-shrink: 0; margin-top: 2px; }
.overall-label { color: var(--brand); font-weight: 600; font-size: 13px; white-space: nowrap; }
.overall-text { flex: 1; font-size: 14px; color: var(--text-1); line-height: 1.7; }
.auto-tag { color: var(--text-3); font-size: 12px; white-space: nowrap; }

.detail-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--sp-16); align-items: start; }
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } }

.chart-box { padding: var(--sp-16); display: flex; flex-direction: column; align-items: center; }
.chart-note { padding: 0 var(--sp-16) var(--sp-12); font-size: 12px; color: var(--text-3); text-align: center; }

.tab-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.tab-item {
  height: 28px; padding: 0 var(--sp-12); border: none; background: #fff;
  font-size: 13px; color: var(--text-2);
}
.tab-item + .tab-item { border-left: 1px solid var(--border-strong); }
.tab-item.active { background: var(--brand); color: #fff; }

/* 维度条形图 */
.dim-bars { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.dim-row { display: flex; align-items: center; gap: var(--sp-8); font-size: 12px; }
.dim-name { width: 88px; text-align: right; color: var(--text-1); flex-shrink: 0; white-space: nowrap; }
.dim-track { flex: 1; height: 16px; background: var(--bg-page); border-radius: 3px; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 3px; }
.dim-val { width: 84px; color: var(--text-2); flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* 定性展示区 */
.qual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-16); }
@media (max-width: 1100px) { .qual-grid { grid-template-columns: 1fr; } }
.qual-text { padding: var(--sp-16); font-size: 13px; color: var(--text-1); line-height: 1.8; }

/* 折叠面板 */
.collapse-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-16); cursor: pointer; user-select: none;
}
.collapse-head .chev { transition: transform 0.2s; color: var(--text-3); }
.collapse-head.open .chev { transform: rotate(180deg); }
.collapse-body { border-top: 1px solid var(--border); padding: var(--sp-16); }
.collapse-body.hidden { display: none; }
.src-list { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text-2); line-height: 2; }
.src-list b { color: var(--text-1); }

/* ============ 填报页 ============ */
.flow-banner {
  background: linear-gradient(90deg, #E6F7FF 0%, #F4FBFF 100%);
  border: 1px solid #91D5FF; border-radius: var(--radius);
  padding: var(--sp-16); margin-bottom: var(--sp-16);
  display: flex; gap: var(--sp-16); align-items: center; flex-wrap: wrap;
}
.flow-step { display: flex; align-items: center; gap: var(--sp-8); font-size: 13px; color: var(--text-1); }
.flow-step .step-no {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.flow-arrow { color: var(--text-4); }
.flow-note { flex: 1; font-size: 12px; color: var(--text-2); min-width: 240px; line-height: 1.7; }

/* ============ 弹窗 ============ */
.dialog-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: var(--sp-24);
}
.dialog {
  background: #fff; border-radius: var(--radius); width: 560px; max-width: 100%;
  max-height: 84vh; display: flex; flex-direction: column;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  animation: dlgIn 0.15s ease;
}
@keyframes dlgIn { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog-head {
  padding: var(--sp-16) var(--sp-24); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.dialog-title { font-size: 16px; font-weight: 600; }
.dialog-close { border: none; background: transparent; color: var(--text-3); font-size: 18px; line-height: 1; }
.dialog-close:hover { color: var(--text-1); }
.dialog-body { padding: var(--sp-16) var(--sp-24); overflow-y: auto; }
.dialog-foot {
  padding: var(--sp-12) var(--sp-24); border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: var(--sp-8);
}
.form-row { display: flex; align-items: flex-start; gap: var(--sp-12); margin-bottom: var(--sp-16); }
.form-row:last-child { margin-bottom: 0; }
.form-row .form-label { width: 96px; text-align: right; line-height: 32px; flex-shrink: 0; }
.form-row .form-label .req { color: var(--danger); margin-left: 2px; }
.form-ctl { flex: 1; min-width: 0; }
.form-ctl .input, .form-ctl .select, .form-ctl textarea { width: 100%; }
.form-ctl textarea {
  min-height: 88px; padding: var(--sp-8) var(--sp-12); font-size: 13px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); resize: vertical; outline: none;
}
.form-ctl textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(24,144,255,0.12); }
.form-err { font-size: 12px; color: var(--danger); margin-top: 4px; display: none; }
.form-ctl.invalid .form-err { display: block; }
.form-ctl.invalid .input, .form-ctl.invalid .select, .form-ctl.invalid textarea { border-color: var(--danger); }
.form-tip { font-size: 12px; color: var(--text-3); margin-top: 4px; line-height: 1.6; }

/* ============ Toast ============ */
#toastWrap { position: fixed; top: 68px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: var(--sp-8); align-items: center; }
.toast {
  background: rgba(0,0,0,0.78); color: #fff; font-size: 13px;
  padding: 9px var(--sp-16); border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  animation: toastIn 0.2s ease;
  max-width: 560px;
}
.toast.success { background: rgba(0, 139, 68, 0.92); }
.toast.warn { background: rgba(210, 105, 30, 0.94); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ============ 页脚 ============ */
.page-foot { padding: var(--sp-12) 0 var(--sp-8); font-size: 12px; color: var(--text-3); line-height: 1.6; }

/* 空状态 */
.empty-state { padding: 48px 0; text-align: center; color: var(--text-3); font-size: 13px; }
