:root {
  --bg: #060b14;
  --bg-soft: #0b1424;
  --panel: rgba(17, 27, 45, 0.72);
  --panel-solid: #111b2d;
  --line: rgba(148, 178, 220, 0.13);
  --line-strong: rgba(148, 178, 220, 0.24);
  --text: #e9f0fb;
  --muted: #8fa2bf;
  --dim: #647691;
  --green: #3ee0a6;
  --cyan: #45c8ff;
  --orange: #ffa15c;
  --red: #ff6f6f;
  --amber: #ffc266;
  --temp: #ff9f5a;
  --humi: #46cfff;
  --radius: 20px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100dvh;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 15% -10%, rgba(62, 224, 166, 0.13), transparent 60%),
    radial-gradient(800px 500px at 105% 0%, rgba(69, 200, 255, 0.12), transparent 55%),
    var(--bg);
  font-family: system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, select, a { font-family: inherit; }
button { cursor: pointer; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding-bottom: calc(74px + var(--safe-bottom));
}

/* ================= 顶栏 ================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
  background: linear-gradient(180deg, rgba(6, 11, 20, 0.94) 60%, rgba(6, 11, 20, 0));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

.logo {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  border-radius: 13px;
  color: #07130f;
  background: linear-gradient(145deg, #55f0b8, #2cc3ff);
  box-shadow: 0 6px 18px rgba(62, 224, 166, 0.28);
}
.logo svg { width: 28px; height: 28px; }

.brand-text h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.02em;
  font-weight: 700;
}
.brand-text p {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.conn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
  transition: 0.25s;
}
.conn .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dim);
}
.conn.ok { color: var(--green); border-color: rgba(62, 224, 166, 0.35); background: rgba(62, 224, 166, 0.08); }
.conn.ok .dot { background: var(--green); box-shadow: 0 0 0 0 rgba(62, 224, 166, 0.6); animation: pulse 2.2s infinite; }
.conn.bad { color: var(--red); border-color: rgba(255, 111, 111, 0.35); background: rgba(255, 111, 111, 0.08); }
.conn.bad .dot { background: var(--red); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 224, 166, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(62, 224, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 224, 166, 0); }
}

/* ================= 主体 ================= */
.main { padding: 4px 16px 0; }

.view { display: none; }
.view.is-active { display: block; animation: fadeUp 0.25s ease both; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head .card-title { margin-bottom: 0; }
.card-head.range-head { justify-content: flex-end; margin-top: -6px; margin-bottom: 10px; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #071510;
  background: var(--red);
  box-shadow: 0 0 12px rgba(255, 111, 111, 0.35);
}
.pill.soft { background: rgba(62, 224, 166, 0.14); color: var(--green); box-shadow: none; }
.pill.warn { background: rgba(255, 194, 102, 0.14); color: var(--amber); box-shadow: none; }
.pill.quiet { background: rgba(148, 178, 220, 0.14); color: var(--muted); box-shadow: none; }

.link-btn {
  border: 0;
  background: none;
  color: var(--cyan);
  font-size: 12px;
  padding: 4px 2px;
}

.muted { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
  color: var(--green);
  background: rgba(62, 224, 166, 0.08);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ================= 节点条 ================= */
.node-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.node-select {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  padding: 9px 30px 9px 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238fa2bf' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.node-select:focus { outline: 1px solid rgba(69, 200, 255, 0.5); }

.node-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  flex: none;
}
.node-state i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--dim);
}
.node-state.on i { background: var(--green); box-shadow: 0 0 8px var(--green); }
.node-state.off i { background: var(--red); }

/* ================= 温度主卡 ================= */
.hero {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 20px 18px;
  background:
    linear-gradient(135deg, rgba(255, 159, 90, 0.10), rgba(69, 200, 255, 0.06) 55%, transparent),
    var(--panel);
}
.hero-glow {
  position: absolute;
  right: -60px; top: -70px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 159, 90, 0.22), transparent 65%);
  pointer-events: none;
}

.hero-main { flex: 1; min-width: 0; }
.metric-label { font-size: 12.5px; color: var(--muted); letter-spacing: 0.08em; }
.metric-big {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 2px 0 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.metric-big span {
  font-size: clamp(52px, 17vw, 72px);
  font-weight: 200;
  letter-spacing: -0.04em;
  background: linear-gradient(180deg, #fff 20%, #ffd9bd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.metric-big small { font-size: 18px; color: var(--muted); font-weight: 400; }

.delta { font-size: 12px; color: var(--dim); min-height: 18px; }
.delta.up { color: var(--orange); }
.delta.down { color: var(--cyan); }

.hero-side {
  width: 108px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  border-left: 1px solid var(--line);
  padding-left: 14px;
}
.mini-label { font-size: 11.5px; color: var(--muted); }
.mini-value { display: flex; align-items: baseline; gap: 2px; min-width: 0; }
.mini-value b {
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-value i { font-style: normal; font-size: 11px; color: var(--muted); }

/* ================= 两列 ================= */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid2 .card { margin-bottom: 12px; }

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.stat { margin-bottom: 0; padding: 14px; }
.stat span { display: block; font-size: 11.5px; color: var(--muted); }
.stat b { display: block; margin-top: 4px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ================= 姿态 ================= */
.tilt-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.tilt-row b {
  margin-left: auto;
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tilt-row em { font-style: normal; font-size: 11px; color: var(--dim); }
.tilt-row.mt { margin-top: 14px; }

/* 尾部甩动卡片 */
.motion-value {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 2px;
}
.motion-value b {
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.motion-value i { font-style: normal; font-size: 11px; color: var(--muted); }
.motion-value.active b { color: var(--green); text-shadow: 0 0 18px rgba(62, 224, 166, 0.35); }
.motion-value.still b { color: var(--muted); }

.motion-caption { font-size: 10px; color: var(--dim); }

.motion-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
  margin: 8px 0 7px;
}
.motion-bars i {
  flex: 1;
  min-width: 2px;
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(180deg, #5ff0b8, rgba(62, 224, 166, 0.28));
  transition: height 0.35s ease;
}
.motion-bars i.zero { background: rgba(148, 178, 220, 0.13); }

.motion-meta { display: grid; gap: 2px; font-size: 10.5px; color: var(--muted); }
.motion-meta b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.angle-row {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.angle-row b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.bar {
  height: 5px;
  margin-top: 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.bar-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  transition: width 0.5s ease;
}
.bar-fill.warn { background: linear-gradient(90deg, var(--amber), var(--red)); }

/* ================= 键值表 ================= */
.kv { margin: 0; display: grid; gap: 9px; }
.kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}
.kv dt { color: var(--muted); flex: none; }
.kv dd {
  margin: 0;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kv dd.ok { color: var(--green); }
.kv dd.bad { color: var(--red); }

/* ================= 告警列表 ================= */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.alert-list li.empty {
  display: block;
  color: var(--dim);
  text-align: center;
  padding: 16px 10px;
  background: transparent;
  border-style: dashed;
}
.alert-list .ai {
  flex: none;
  width: 7px; height: 7px; border-radius: 50%;
  margin-top: 6px;
  background: var(--amber);
}
.alert-list .ad { flex: 1; min-width: 0; }
.alert-list .ad b { display: block; font-size: 12.5px; color: var(--text); }
.alert-list .ad p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.alert-list .at { flex: none; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.alert-list li.danger { border-color: rgba(255, 111, 111, 0.3); background: rgba(255, 111, 111, 0.06); }
.alert-list li.danger .ai { background: var(--red); box-shadow: 0 0 8px rgba(255, 111, 111, 0.7); }

/* ================= 提示卡 ================= */
.tips {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(69, 200, 255, 0.05);
  border-color: rgba(69, 200, 255, 0.18);
}
.tips-icon {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(69, 200, 255, 0.14);
  color: var(--cyan);
  font-weight: 600;
  font-size: 14px;
  font-style: italic;
}
.tips b { font-size: 13px; }
.tips p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

/* ================= 图表 ================= */
.chart-card { padding-bottom: 14px; }
.seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}
.seg button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 11.5px;
  padding: 5px 8px;
  border-radius: 8px;
  white-space: nowrap;
}
.seg button.on { background: rgba(62, 224, 166, 0.15); color: var(--green); }

.chart-wrap {
  position: relative;
  width: 100%;
  height: clamp(220px, 38vh, 300px);
}
.chart-wrap canvas { width: 100%; height: 100%; display: block; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 12.5px;
  pointer-events: none;
  transition: opacity 0.3s;
}
.chart-empty.hide { opacity: 0; }

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 4px 0;
  font-size: 11.5px;
  color: var(--muted);
}
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .lg i { width: 14px; height: 3px; border-radius: 2px; }
.legend .temp i { background: var(--temp); }
.legend .humi i { background: var(--humi); }
.legend .lg.motion { display: none; }
.legend .lg.motion i { background: var(--green); }
.legend.motion-mode .lg.temp,
.legend.motion-mode .lg.humi { display: none; }
.legend.motion-mode .lg.motion { display: inline-flex; }
.legend .chart-note { margin-left: auto; color: var(--dim); }

/* ================= 日志 ================= */
.log-list {
  max-height: 52vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  gap: 6px;
  margin: 0 -4px;
  padding: 0 4px;
}
.log-list .empty { color: var(--dim); text-align: center; padding: 24px 0; font-size: 12.5px; }
.log-list::-webkit-scrollbar { width: 0; height: 0; }
.log-list { scrollbar-width: none; }
.log-item {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.028);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.log-item time { color: var(--dim); font-size: 11.5px; }
.log-item .vals { color: var(--muted); }
.log-item .vals b { color: var(--text); font-weight: 500; }
.log-item .tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(62, 224, 166, 0.1);
  color: var(--green);
}
.log-item .tag.warn { background: rgba(255, 111, 111, 0.12); color: var(--red); }
.log-item .tag.quiet { background: rgba(148, 178, 220, 0.12); color: var(--muted); }

/* ================= 按钮 ================= */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  transition: 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #45e0a8, #2fb8ff);
  color: #061018;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(62, 224, 166, 0.22);
}
.btn.off { color: var(--dim); border-style: dashed; background: transparent; }

.addr-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
}
.addr-box span { font-size: 11.5px; color: var(--muted); }
.addr-box b {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 14px;
  color: var(--green);
  word-break: break-all;
}

.code {
  margin: 10px 0 0;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line);
  color: #b9d7ff;
  font-size: 11.5px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ================= 底部导航 ================= */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 980px);
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 10px calc(6px + var(--safe-bottom));
  background: rgba(8, 14, 25, 0.88);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.tab {
  border: 0;
  background: none;
  color: var(--dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0 4px;
  font-size: 10.5px;
  border-radius: 12px;
  transition: color 0.2s;
}
.tab svg { width: 21px; height: 21px; }
.tab.is-active { color: var(--green); }
.tab.is-active svg { filter: drop-shadow(0 0 7px rgba(62, 224, 166, 0.45)); }

/* ================= Toast / 离线条 ================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--safe-bottom));
  transform: translate(-50%, 14px);
  z-index: 60;
  max-width: min(88vw, 420px);
  padding: 10px 15px;
  border-radius: 12px;
  background: rgba(16, 26, 43, 0.96);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 12.5px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: 0.28s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { border-color: rgba(255, 111, 111, 0.45); color: #ffdcdc; }

.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 70;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
  text-align: center;
  font-size: 12px;
  color: #1a0a0a;
  background: linear-gradient(90deg, #ffb36b, #ff7d7d);
  transform: translateY(-100%);
  transition: transform 0.25s;
}
.offline-banner.show { transform: none; }

/* ================= 大屏 ================= */
@media (min-width: 700px) {
  body { font-size: 15.5px; }
  .main { padding: 8px 24px 0; }
  .topbar { padding: 18px 24px 12px; }
  .hero { padding: 26px 24px; }
  .hero-side { width: 150px; padding-left: 20px; }
  .metric-big span { font-size: 78px; }
  .card { padding: 18px; }
  .chart-wrap { height: 320px; }
  .brand-text h1 { font-size: 19px; }
  .grid2 { gap: 14px; }
}

@media (max-width: 360px) {
  .hero-side { width: 92px; padding-left: 10px; }
  .metric-big span { font-size: 46px; }
  .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
  .seg button { padding: 5px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ================= 牛群列表 ================= */
.herd-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 14px 10px;
  margin-bottom: 4px;
}
.summary-item { position: relative; text-align: center; }
.summary-item + .summary-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 1px;
  background: var(--line);
}
.summary-item span { display: block; font-size: 11px; color: var(--muted); }
.summary-item b {
  font-size: 23px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.summary-item small { margin-left: 2px; font-size: 10px; color: var(--dim); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 4px 10px;
}
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.section-head span { font-size: 11px; color: var(--dim); }

.herd-list { display: grid; gap: 10px; margin-bottom: 12px; }

.animal-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.15s ease, border-color 0.2s;
}
.animal-card:active { transform: scale(0.985); }
.animal-card.offline { opacity: 0.55; }

.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #06130f;
  background: linear-gradient(145deg, #55f0b8, #33c9ff);
}
.animal-card.offline .avatar {
  background: rgba(148, 178, 220, 0.22);
  color: var(--muted);
}

.animal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.animal-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.animal-top b {
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.live-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.animal-sub {
  font-size: 10.5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.animal-metrics { display: flex; gap: 10px; margin-top: 3px; font-size: 11px; color: var(--muted); }
.animal-metrics b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.animal-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.state-tag {
  font-size: 10.5px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 99px;
  background: rgba(148, 178, 220, 0.13);
  color: var(--muted);
}
.state-tag.hot { background: rgba(62, 224, 166, 0.14); color: var(--green); }
.badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #1a0a0a;
  font-size: 10px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
}

.empty-card {
  padding: 34px 16px;
  text-align: center;
  color: var(--dim);
  font-size: 12.5px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ================= 单牛详情 ================= */
.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 12px;
}
.back-btn {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.detail-title { flex: 1; min-width: 0; }
.detail-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-title p {
  margin: 1px 0 0;
  font-size: 10.5px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-toolbar { margin-bottom: 10px; padding: 0 2px; }
.chart-toolbar .node-select { width: 100%; }

.name-row { display: flex; gap: 8px; margin-top: 10px; }
.name-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
}
.name-row input:focus { outline: 1px solid rgba(69, 200, 255, 0.5); }
.name-row .btn { flex: none; padding: 10px 16px; }

.kv.mt-kv { margin-top: 12px; }

.alert-list .ad b em {
  font-style: normal;
  font-weight: 400;
  font-size: 11px;
  color: var(--muted);
}

@media (min-width: 700px) {
  .herd-list { grid-template-columns: 1fr 1fr; }
  .herd-summary { padding: 18px 14px; }
  .summary-item b { font-size: 26px; }
}