/* ============================================================
   SAMS 2.0 补充样式
   1) 旧组件向 2.0 令牌靠拢
   2) 数据展示：口径说明 / 横向对比条 / 页脚
   3) 移动端卡片 / 底部导航 / 审批卡
   依赖 style.css 中已定义的 :root 令牌
   ============================================================ */

/* ---------- 1. 旧组件适配 ---------- */
body {
  background: var(--bg);
  color: var(--ink);
}

.card {
  border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  padding: 14px 17px;
  font-size: 13.5px;
  font-weight: 750;
  letter-spacing: -.1px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.card-body { padding: 16px 17px; }
.card-footer { border-top-color: var(--line); color: var(--ink-3); }

.stats-grid { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; }

.stat-card {
  border-radius: var(--r);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 17px 18px;
}
.stat-card::before { display: none; }
.stat-card:hover { transform: none; box-shadow: var(--shadow); border-color: var(--line); }
.stat-card .stat-value { color: var(--ink); font-size: 26px; }
.stat-card .stat-label { color: var(--ink-3); font-size: 12px; }

.table-container {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
}
thead th {
  background: #f7f9fc;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 750;
  padding: 11px 14px;
  letter-spacing: .2px;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f2f5f9;
  color: var(--ink-2);
}
tbody tr:nth-child(even) td { background: transparent; }
tbody tr:hover td { background: #f8fafc; }

.btn { border-radius: 8px; font-weight: 600; }
.btn-primary {
  background: var(--blue);
  box-shadow: 0 2px 6px rgba(26, 115, 232, .28);
}
.btn-primary:hover {
  background: var(--blue-dark);
  box-shadow: 0 4px 12px rgba(26, 115, 232, .35);
  transform: none;
}
.btn-success { background: var(--green); box-shadow: none; }
.btn-success:hover { background: #0d9c5b; transform: none; }
.btn-danger { background: var(--red); box-shadow: none; }
.btn-danger:hover { background: #dc3a30; transform: none; }
.btn-outline {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
}
.btn-outline:hover {
  background: var(--bg);
  border-color: var(--ink-4);
  color: var(--ink);
}

.badge {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 5px;
  padding: 2px 8px;
  line-height: 1.6;
}
.badge-success { background: var(--green-50); color: #067647; }
.badge-warning { background: var(--amber-50); color: #b45309; }
.badge-danger  { background: var(--red-50);   color: #c0261c; }
.badge-info    { background: var(--blue-50);  color: var(--blue-dark); }
.badge-gray    { background: #f1f4f9;         color: var(--ink-2); }

.form-control {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, .12);
  outline: none;
}
.form-group label { color: var(--ink-2); font-weight: 600; }

.page-header h1 {
  color: var(--ink);
  font-size: 22px;
  padding-left: 0;
  letter-spacing: -.3px;
}
.page-header h1::before { display: none; }

.welcome-banner {
  background: linear-gradient(135deg, #1a73e8, #3f7ef0 60%, #5b93f7);
  border-radius: var(--r);
  box-shadow: 0 10px 24px -10px rgba(26, 115, 232, .5);
}

.empty-state { color: var(--ink-3); }
.chart-container { height: 300px; position: relative; }

/* 分段控件 / Tab：胶囊风 */
.wseg {
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.wseg button {
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 4px 10px;
}
.wseg button:hover { color: var(--ink); }
.wseg button.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}
.wtabs {
  display: inline-flex;
  gap: 2px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  border-bottom: none;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.wtabs button {
  border: none;
  border-bottom: none;
  background: transparent;
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.wtabs button:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.wtabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}

/* ---------- 2. 数据展示 ---------- */
.info {
  position: relative;
  display: inline-flex;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.2px solid var(--ink-4);
  color: var(--ink-3);
  font-size: 9.5px;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  cursor: help;
  flex-shrink: 0;
  font-style: normal;
  margin-left: 2px;
}
.info-pop {
  position: absolute;
  left: 0;
  bottom: 22px;
  width: 270px;
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 9px;
  padding: 11px 13px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.7;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .3);
  z-index: 30;
  display: none;
  text-align: left;
  letter-spacing: 0;
}
.info:hover .info-pop,
.info:focus .info-pop,
.info.open .info-pop { display: block; }
.info-pop b { color: #fff; font-weight: 700; display: block; margin-bottom: 2px; }
.info-pop em {
  color: #93c5fd;
  font-style: normal;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 10.5px;
}

.hbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid #f3f6fa;
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
  transition: background .15s ease;
}
.hbar:last-child { border-bottom: none; }
a.hbar:hover { background: #f8fafc; color: inherit; }
.hb-n {
  width: 70px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hb-t {
  flex: 1;
  height: 22px;
  min-width: 60px;
  background: #eef2f7;
  border-radius: 5px;
  position: relative;
  overflow: hidden;
}
.hb-t i { display: block; height: 100%; border-radius: 5px; transition: width .5s ease; }
.hb-t s {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 0;
  border-left: 1px dashed;
  pointer-events: none;
}
.hb-t s.v90 { left: 90%; border-color: rgba(18, 183, 106, .75); }
.hb-t s.v80 { left: 80%; border-color: rgba(240, 68, 56, .7); }
.hb-v {
  width: 78px;
  font-size: 11px;
  color: var(--ink-3);
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.hb-p {
  width: 46px;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.hb-p.g { color: #0d9c5b; }
.hb-p.a { color: #d97706; }
.hb-p.r { color: #dc3a30; }
.hb-go { color: var(--ink-4); font-size: 13px; flex-shrink: 0; width: 12px; }

.legend-h {
  display: flex;
  gap: 14px;
  font-size: 10.5px;
  color: var(--ink-2);
  margin-bottom: 10px;
  align-items: center;
}
.legend-h i {
  display: inline-block;
  width: 14px;
  height: 0;
  border-top: 1px dashed;
  margin-right: 4px;
  vertical-align: middle;
}
.legend-h i.v90 { border-color: #12b76a; }
.legend-h i.v80 { border-color: #f04438; }

.footnote {
  font-size: 11px;
  color: var(--ink-3);
  padding: 11px 17px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
  background: #fcfdfe;
}
.footnote b { color: var(--ink-2); font-weight: 650; }
.footnote .live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  margin-right: 5px;
}

.ana-body { display: grid; grid-template-columns: 1fr 244px; }
.chart-box {
  padding: 14px 14px 6px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.hover-card {
  margin: 10px 14px 0;
  background: #0f172a;
  border-radius: 11px;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .22);
}
.hc-t { font-size: 10.5px; color: #94a3b8; font-weight: 600; letter-spacing: .3px; margin-bottom: 7px; }
.hc-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; padding: 4px 0; color: #cbd5e1; }
.hc-row b { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.hc-row.g b { color: #4ade80; }
.hc-row.r b { color: #f87171; }

/* ---------- 3. 移动端组件 ---------- */
.p-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.p-card.hero {
  background: linear-gradient(135deg, #1a73e8, #3f7ef0 60%, #5b93f7);
  color: #fff;
  border: none;
  box-shadow: 0 10px 24px -8px rgba(26, 115, 232, .55);
  position: relative;
  overflow: hidden;
}
.p-card.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, .13);
  border-radius: 50%;
}
.p-card.hero .hl { font-size: 11px; opacity: .82; font-weight: 600; letter-spacing: .3px; }
.p-card.hero .ht {
  font-size: 17px;
  font-weight: 800;
  margin: 4px 0 2px;
  letter-spacing: -.2px;
  position: relative;
  z-index: 1;
}
.p-card.hero .hm { font-size: 11px; opacity: .82; position: relative; z-index: 1; }
.p-card.hero .hbtn {
  margin-top: 13px;
  background: #fff;
  color: var(--blue);
  height: 42px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  text-decoration: none;
}
.p-card.hero .hbtn:hover { color: var(--blue-dark); }
.p-card.hero .hbtn svg { width: 17px; height: 17px; }
.p-card.hero .hero-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; position: relative; z-index: 1; flex-wrap: wrap; }
.p-card.hero .hero-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.p-sec-t {
  font-size: 11.5px;
  font-weight: 750;
  color: var(--ink-2);
  margin: 0 4px 8px;
  display: flex;
  align-items: center;
}
.p-sec-t span { margin-left: auto; font-size: 10.5px; color: var(--blue); font-weight: 700; }
.p-sec-t a { margin-left: auto; font-size: 10.5px; color: var(--blue); font-weight: 700; }
.p-list {
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.p-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-bottom: 1px solid #f2f5f9;
}
.p-row:last-child { border-bottom: none; }
.p-row .pi {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.p-row .pi svg { width: 15px; height: 15px; }
.p-row .pt { font-size: 12.5px; font-weight: 700; line-height: 1.35; color: var(--ink); }
.p-row .pm { font-size: 10.5px; color: var(--ink-3); }
.p-row .pr { margin-left: auto; text-align: right; }
.p-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.p-tag.ok { background: var(--green-50); color: #0d9c5b; }
.p-tag.warn { background: var(--amber-50); color: #b45309; }
.p-tag.bad { background: var(--red-50); color: #c0261c; }

.bnav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62px;
  background: #fff;
  border-top: 1px solid var(--line);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 16px rgba(16, 24, 40, .05);
}
.bnav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 9.5px;
  color: var(--ink-3);
  text-decoration: none;
  font-weight: 600;
  position: relative;
}
.bnav a svg { width: 20px; height: 20px; stroke-width: 1.75; }
.bnav a.on { color: var(--blue); }
.bnav a.on::before {
  content: "";
  position: absolute;
  top: 0;
  width: 20px;
  height: 2.5px;
  background: var(--blue);
  border-radius: 0 0 3px 3px;
}
.bnav a.mid svg { width: 24px; height: 24px; }
.bnav a.mid .ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: 0 6px 14px rgba(26, 115, 232, .4);
  border: 3px solid #fff;
}
.bnav a.mid .ring svg { width: 19px; height: 19px; stroke-width: 2.2; }

.apv {
  background: #fff;
  border-radius: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.apv .ah { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.apv .ah .av2 {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
.apv .ah .an { font-size: 12.5px; font-weight: 750; color: var(--ink); }
.apv .ah .at { font-size: 10px; color: var(--ink-3); margin-left: auto; }
.apv .ab {
  font-size: 11px;
  color: var(--ink-2);
  background: var(--bg);
  border-radius: 7px;
  padding: 7px 9px;
  margin-bottom: 9px;
  line-height: 1.5;
}
.apv .af { display: flex; gap: 7px; }
.apv .af button,
.apv .af a {
  flex: 1;
  height: 32px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 750;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.apv .af .no { background: #fff; border: 1px solid var(--line); color: var(--ink-2); }
.apv .af .ok { background: var(--blue); color: #fff; }

/* 移动端侧栏 / 顶栏 / 悬浮菜单按钮 */
.sb-toggle {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1200;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--ink-2);
}
.sb-toggle svg { width: 18px; height: 18px; }

@media (min-width: 769px) {
  .p-card.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "hl btn" "ht btn" "hm btn" "row btn";
    align-items: center;
    column-gap: 28px;
  }
  .p-card.hero .hl { grid-area: hl; }
  .p-card.hero .ht { grid-area: ht; }
  .p-card.hero .hm { grid-area: hm; }
  .p-card.hero .hero-row { grid-area: row; margin-top: 8px; }
  .p-card.hero .hbtn {
    grid-area: btn;
    margin-top: 0;
    padding: 0 26px;
    min-width: 186px;
  }
}

.mk-cards { display: none; }

@media (max-width: 768px) {
  .sb {
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 248px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
  }
  .sb.open { transform: none; }
  .sb-toggle { display: flex; }
  .main-content { padding: 54px 14px 88px; margin-left: 0; }
  .topbar {
    margin: 0 -14px 12px;
    padding: 10px 14px;
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar .search { display: none; }
  .crumb { font-size: 10.5px; }
  .crumb b { font-size: 14px; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .k-num { font-size: 22px; }
  .grid-2 { grid-template-columns: 1fr; }
  .rank-wrap { grid-template-columns: 1fr; }
  .rank-col + .rank-col { border-left: none; border-top: 1px solid var(--line); }
  .chart-container { height: 230px; }
  .ana-body { grid-template-columns: 1fr; }
  .chart-box { border-right: none; border-bottom: 1px solid var(--line); }
  .hover-card { margin: 14px; }
  .bnav { display: flex; }
  .fab { bottom: 86px !important; }
  .footnote { padding: 10px 14px; gap: 8px 14px; }
  .hb-n { width: 58px; font-size: 11.5px; }
  .hb-v { width: 62px; font-size: 10.5px; }
  .hb-p { width: 42px; font-size: 11px; }
  .hb-t { height: 18px; }
  .info-pop { left: auto; right: -60px; width: 240px; }
  .mk-cards { display: block; }
  .fab { display: none !important; }
  .wtabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .wtabs::-webkit-scrollbar { display: none; }
  .wtabs button { flex: 0 0 auto; }
  .makeup-table-wrap { display: none; }
  .batch-bar { display: none !important; }
  .filter-bar { margin-bottom: 12px; }
  .mk-cards .apv .af { align-items: center; }
}
