/* =============================================================================
 * 百援精养 · CEO 数据看板 —— 第一层样式
 * 设计基调：浅色底 + 白卡片，品牌红橙作为主色，适合投屏与高管快速扫读
 * ========================================================================== */

:root {
  --brand: #E8442E;
  --brand-dark: #C6321F;
  --brand-soft: #FDEDEA;
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --line: #E7EAEF;
  --text: #1B2330;
  --text-2: #5B6779;
  --text-3: #93A0B2;
  --ok: #16A34A;
  --warn: #E8A33D;
  --bad: #DC2F3C;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 32, 51, .04), 0 8px 24px rgba(20, 32, 51, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC",
               -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ------------------------------- 顶部栏 ------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #F5734E);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 1px;
}

.brand-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .5px;
  white-space: nowrap;
}

/* 右上角切换按钮 */
.tabs {
  display: inline-flex;
  padding: 4px;
  background: #F1F3F7;
  border-radius: 11px;
  gap: 2px;
  flex: 0 0 auto;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  padding: 9px 22px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 8px rgba(232, 68, 46, .28);
}

/* ------------------------------- 页面主体 ------------------------------- */
.app { padding: 22px 28px 40px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-title { display: flex; align-items: baseline; gap: 12px; }
.page-title h2 { margin: 0; font-size: 20px; font-weight: 600; }
.page-title .sub { font-size: 13px; color: var(--text-3); }

/* 时间筛选 */
.filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-label { font-size: 13px; color: var(--text-2); }

.segment {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.segment button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  padding: 7px 15px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .16s ease;
}
.segment button:hover { color: var(--brand); }
.segment button.is-active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }

.custom-range { display: flex; align-items: center; gap: 6px; }
.custom-range input[type="date"] {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.custom-range input[type="date"]:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.custom-range .between { color: var(--text-3); font-size: 12px; }
.custom-range .apply {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
}
.custom-range .apply:hover { background: var(--brand-dark); }

.updated { font-size: 12.5px; color: var(--text-3); }
.updated .live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  margin-right: 5px;
  vertical-align: middle;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .25 } }

/* ------------------------------- 事业部卡片 ------------------------------- */
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), #F89B6E);
  opacity: 0;
  transition: opacity .16s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: #F3C3B8;
  box-shadow: 0 10px 28px rgba(20, 32, 51, .10);
}
.card:hover::before { opacity: 1; }
.card:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 2px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 4px;
}
.card-name { font-size: 15.5px; font-weight: 600; letter-spacing: .2px; }
.card-go {
  font-size: 12px;
  color: var(--brand);
  opacity: 0;
  transform: translateX(-4px);
  transition: all .16s ease;
  white-space: nowrap;
}
.card:hover .card-go { opacity: 1; transform: translateX(0); }

.metric-list { display: flex; flex-direction: column; }
.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #F4F6F9;
}
.metric:last-child { border-bottom: 0; }
.metric-label { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.metric-value {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
  white-space: nowrap;
}
.metric.is-primary { padding: 6px 0 14px; border-bottom: 1px dashed var(--line); }
.metric.is-primary .metric-label { font-size: 13.5px; color: var(--text-2); }
.metric.is-primary .metric-value { font-size: 28px; font-weight: 700; color: var(--brand); line-height: 1.15; }
.metric-unit { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 3px; }

/* ------------------------------- 目标进度 ------------------------------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 28px 0 14px;
}
.section-title h3 { margin: 0; font-size: 16px; font-weight: 600; }
.section-title .hint { font-size: 12.5px; color: var(--text-3); }

.targets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.target-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.target-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.target-name { font-size: 14.5px; font-weight: 600; }
.target-rate { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.target-rate.is-ok { color: var(--ok); }
.target-rate.is-warn { color: var(--warn); }
.target-rate.is-bad { color: var(--bad); }

.bar {
  height: 10px;
  border-radius: 999px;
  background: #EEF1F5;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width .5s cubic-bezier(.22, .61, .36, 1);
}
.bar > i.is-ok { background: linear-gradient(90deg, #34C77B, #16A34A); }
.bar > i.is-warn { background: linear-gradient(90deg, #F3C05E, #E8A33D); }
.bar > i.is-bad { background: linear-gradient(90deg, #F0705F, #DC2F3C); }

.target-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-2);
}
.target-foot b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------- 第二层占位页 ------------------------------- */
.detail-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.back-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13.5px;
  cursor: pointer;
}
.back-btn:hover { color: var(--brand); border-color: #F3C3B8; }
.detail-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.crumb { font-size: 12.5px; color: var(--text-3); }

.placeholder {
  background: #fff;
  border: 1px dashed #D8DEE8;
  border-radius: var(--radius);
  padding: 40px 28px;
  text-align: center;
  color: var(--text-2);
}
.placeholder h3 { margin: 0 0 8px; font-size: 16px; color: var(--text); }
.placeholder p { margin: 0; font-size: 13.5px; line-height: 1.9; }

.skeleton {
  padding: 60px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ------------------------------- 响应式 ------------------------------- */
@media (max-width: 1400px) {
  .cards, .targets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .topbar { padding: 0 16px; height: auto; min-height: 68px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .brand-title { font-size: 16px; }
  .app { padding: 16px; }
  .cards, .targets { grid-template-columns: minmax(0, 1fr); }
  .tab { padding: 8px 14px; font-size: 14px; }
}
