/* ═══════════════════════════════════════════════════════════
   业务视图：链路卡 / 统计块 / 实时流 / 设备详情 / 采集卡片
   ═══════════════════════════════════════════════════════════ */

/* ── 链路总览：四张卡 ── */
.chain-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 1280px) { .chain-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .chain-grid { grid-template-columns: minmax(0, 1fr); } }

.chain-card {
  position: relative;
  padding: 13px 14px 14px;
  border-radius: var(--r-md);
  background: var(--bg-1);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

/* 顶部链路色条 */
.chain-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--ch);
  opacity: 0.85;
}

.chain-card:hover {
  border-color: var(--ch);
  transform: translateY(-1px);
  background: var(--bg-2);
}

.chain-card .cc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.chain-card .cc-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--fg-0);
  flex: 1 1 auto;
  min-width: 0;
}

.chain-card .cc-ios {
  font-size: 11px;
  color: var(--fg-2);
  font-family: var(--mono);
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chain-card .cc-nums {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 9px;
}

.chain-card .cc-num { min-width: 0; }
.chain-card .cc-num b {
  display: block;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--fg-0);
}
.chain-card .cc-num b.zero { color: var(--fg-3); }
.chain-card .cc-num small {
  display: block;
  font-size: 10.5px;
  color: var(--fg-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chain-card .cc-note {
  font-size: 11.5px;
  color: var(--fg-2);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 状态徽标 */
.st-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-xs);
  font-size: 10.5px;
  font-weight: 600;
  flex: none;
}
.st-running { background: var(--ok-soft); color: var(--ok); }
.st-limited { background: var(--warn-soft); color: var(--warn); }
.st-not_deployed { background: var(--bg-3); color: var(--fg-3); }
.st-unknown { background: var(--bg-3); color: var(--fg-2); }

/* ── 版本路由表 ── */
.routing-list { display: flex; flex-direction: column; gap: 1px; }

.routing-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  align-items: center;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.routing-row:last-child { border-bottom: none; }
.routing-row .v {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--fg-0);
  font-weight: 550;
  white-space: nowrap;
}
.routing-row .d { color: var(--fg-1); }

/* ── 实时日志流 ── */
.stream {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
  font-size: 12px;
}

.stream-row {
  display: grid;
  grid-template-columns: 62px 74px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: baseline;
  padding: 6px 13px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s;
}
.stream-row:hover { background: var(--bg-2); }
.stream-row:last-child { border-bottom: none; }

.stream-row .t { font-family: var(--mono); font-size: 11px; color: var(--fg-3); white-space: nowrap; }
.stream-row .s { font-size: 11.5px; color: var(--fg-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stream-row .m {
  color: var(--fg-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stream-row .ip { font-family: var(--mono); font-size: 10.5px; color: var(--fg-3); white-space: nowrap; }

.stream-row.lv-WARN { background: rgba(226, 163, 60, 0.05); }
.stream-row.lv-ERROR { background: rgba(229, 72, 77, 0.06); }

@media (max-width: 700px) {
  .stream-row { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .stream-row .s { display: none; }
}

/* ── 统计小块（设备详情顶栏） ── */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-bottom: 14px;
}

.stat-cell {
  padding: 10px 12px;
  background: var(--bg-1);
  min-width: 0;
}
.stat-cell b {
  display: block;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.stat-cell b.zero { color: var(--fg-3); }
.stat-cell small {
  display: block;
  font-size: 10.5px;
  color: var(--fg-2);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 标签页 ── */
.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin-bottom: 13px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  transition: color 0.13s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--fg-0); }
.tab.active { color: var(--fg-0); border-bottom-color: var(--accent); font-weight: 600; }

.tab .cnt {
  font-size: 10.5px;
  padding: 0 5px;
  height: 16px;
  line-height: 16px;
  border-radius: 8px;
  background: var(--bg-3);
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
}
.tab.active .cnt { background: var(--accent-soft); color: var(--accent); }
.tab .cnt.zero { opacity: 0.5; }

/* ── 采集数据卡片列表（备忘录/通讯录） ── */
.rec-list { display: flex; flex-direction: column; gap: 1px; }

.rec {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.12s;
}
.rec:hover { background: var(--bg-2); }
.rec:last-child { border-bottom: none; }

.rec-top {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 3px;
}

.rec-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-0);
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rec-meta {
  flex: none;
  font-size: 10.5px;
  color: var(--fg-3);
  font-family: var(--mono);
  white-space: nowrap;
}

.rec-body {
  font-size: 12px;
  color: var(--fg-1);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.rec-foot {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  align-items: center;
}

/* ── 图片网格 ── */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.img-cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  cursor: pointer;
}
.img-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}
.img-cell:hover img { transform: scale(1.04); }

.img-cell .cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 14px 7px 5px;
  font-size: 10px;
  color: #dfe5ee;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 登录页 ── */
.login-wrap {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(76, 141, 255, 0.09), transparent 70%),
    var(--bg-0);
}

.login-card {
  width: min(376px, 100%);
  padding: 26px 24px 24px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
}

.login-card .lg-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.login-card .lg-brand .brand-mark { width: 34px; height: 34px; }
.login-card .lg-brand b { display: block; font-size: 16px; letter-spacing: 0.02em; }
.login-card .lg-brand small { font-size: 11.5px; color: var(--fg-2); }

.field { margin-bottom: 13px; }
.field label {
  display: block;
  margin-bottom: 5px;
  font-size: 11.5px;
  font-weight: 550;
  color: var(--fg-1);
}
.field .input { width: 100%; height: 34px; }

.login-card .btn-primary { width: 100%; height: 34px; margin-top: 6px; }

.login-err {
  display: flex;
  gap: 7px;
  padding: 8px 10px;
  margin-bottom: 13px;
  border-radius: var(--r-sm);
  font-size: 12px;
  background: var(--err-soft);
  border: 1px solid rgba(229, 72, 77, 0.3);
  color: #ff9599;
}

/* ── 详情抽屉式头部 ── */
.detail-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.detail-head .dh-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--bg-3);
  color: var(--accent);
  flex: none;
}

.detail-head .dh-main { flex: 1 1 260px; min-width: 0; }
.detail-head .dh-main h2 {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-head .dh-main .sub {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--fg-2);
  font-family: var(--mono);
}
.detail-head .dh-acts { display: flex; gap: 7px; flex-wrap: wrap; }

/* ── 链路横幅（某条链的详情页） ── */
.chain-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 17px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background:
    linear-gradient(100deg, var(--ch-soft, transparent), transparent 65%),
    var(--bg-1);
  position: relative;
  overflow: hidden;
  margin-bottom: 13px;
  flex-wrap: wrap;
}
.chain-banner::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--ch);
}

.chain-banner .cb-main { flex: 1 1 300px; min-width: 0; }
.chain-banner h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.chain-banner .cb-ios {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ch);
  margin-bottom: 6px;
}
.chain-banner .cb-note { font-size: 12px; color: var(--fg-2); line-height: 1.55; }

/* ── 步骤流水线 ── */
.pipeline {
  display: flex;
  align-items: stretch;
  gap: 0;
  overflow-x: auto;
  padding: 3px 0 6px;
}

.pipe-node {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 86px;
  padding: 9px 6px;
  position: relative;
  text-align: center;
}

.pipe-node::after {
  content: "";
  position: absolute;
  top: 24px;
  left: 50%;
  width: 100%;
  height: 1px;
  background: var(--line);
}
.pipe-node:last-child::after { display: none; }

.pipe-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid var(--line);
  position: relative;
  z-index: 1;
  transition: all 0.15s;
}
.pipe-node.hit .pipe-dot {
  background: var(--ch);
  border-color: var(--ch);
  box-shadow: 0 0 0 3px var(--ch-soft);
}
.pipe-node .pipe-label {
  font-size: 10.5px;
  color: var(--fg-2);
  line-height: 1.35;
  max-width: 82px;
}
.pipe-node.hit .pipe-label { color: var(--fg-0); font-weight: 550; }
.pipe-node .pipe-cnt {
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--fg-1);
}
.pipe-node.hit .pipe-cnt { color: var(--ch); }

/* ── 加载条 ── */
.loadbar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  z-index: 200;
  transition: width 0.25s ease, opacity 0.3s 0.15s;
  box-shadow: 0 0 8px var(--accent);
}
