/* ==========================================================================
   气象要素实时监测 · 统一视觉规范
   1. 设计令牌  2. 基础元素  3. 顶栏  4. 页面容器  5. 卡片 / 统计
   6. 设备卡片  7. 设备数据页  8. 表单 / 登录  9. 表格  10. 管理后台
   11. 提示 / 空态  12. 大屏模式  13. 响应式
   ========================================================================== */

/* ---------- 1. 设计令牌 ---------- */
:root {
  /* 配色 */
  --bg: #f3f6f8;
  --bg-grad: radial-gradient(1100px 400px at 10% -12%, #e5f1ee 0%, rgba(243, 246, 248, 0) 62%),
             radial-gradient(900px 360px at 98% -4%, #e8eef7 0%, rgba(243, 246, 248, 0) 58%);
  --card: #ffffff;
  --ink: #12212b;
  --ink-2: #41525e;
  --muted: #7b8b96;
  --line: #e4e9ed;
  --line-2: #eef2f4;
  --accent: #0f766e;
  --accent-ink: #0b5d56;
  --accent-soft: #e6f2ef;
  --danger: #c2453d;
  --danger-soft: #fdf1f0;
  --amber: #d98324;

  /* 字体 */
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  --fs-page-title: 21px;
  --fs-card-title: 15px;
  --fs-body: 14px;
  --fs-sm: 12.5px;
  --fs-xs: 11.5px;

  /* 尺寸 */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --control-h: 36px;
  --page-max: 1440px;
  --pad-x: clamp(16px, 3.2vw, 32px);
  --gap: 16px;
  --gap-sm: 12px;
  --chart-h: 340px;

  /* 阴影 */
  --shadow: 0 1px 2px rgba(15, 35, 45, .04), 0 8px 24px -18px rgba(15, 35, 45, .35);
  --shadow-lift: 0 2px 6px rgba(15, 35, 45, .05), 0 18px 40px -26px rgba(15, 45, 55, .5);
}

/* ---------- 2. 基础元素 ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--bg-grad), var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
button, select, input { font: inherit; color: inherit; }
b, strong { font-weight: 600; }
a { color: var(--accent-ink); }
.hidden { display: none !important; }
:where(button, a, input, select, label):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 3. 顶栏 ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.appbar-inner {
  max-width: var(--page-max); margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 10px var(--pad-x);
  min-height: 62px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); flex: none;
}
.nav-brand svg { width: 32px; height: 32px; color: var(--accent); flex: none; }
.nav-brand b { font-size: 16px; font-weight: 650; letter-spacing: .2px; white-space: nowrap; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-link {
  padding: 7px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--ink-2);
  font-size: 13px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: #f2f5f6; color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; flex-direction: column; line-height: 1.3; text-align: right; min-width: 0; }
.user-chip b { font-size: var(--fs-sm); font-weight: 600; }
.user-chip em { font-style: normal; font-size: 11px; color: var(--muted); }

/* ---------- 3.1 左侧导航（登录后的页面） ---------- */
body.has-sidenav { padding-left: 216px; }
body.has-sidenav .appbar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 216px;
  border-bottom: none; border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .94); z-index: 40;
}
body.has-sidenav .appbar-inner {
  max-width: none; min-height: 100vh;
  flex-direction: column; align-items: stretch; gap: 6px;
  padding: 18px 14px;
}
body.has-sidenav .nav-brand { padding: 4px 6px 14px; border-bottom: 1px solid var(--line); }
body.has-sidenav .nav-brand b { font-size: 15px; white-space: normal; line-height: 1.35; }
body.has-sidenav .nav-links { flex-direction: column; align-items: stretch; gap: 4px; padding-top: 12px; }
body.has-sidenav .nav-link { padding: 9px 12px; font-size: 13.5px; }
body.has-sidenav .nav-user {
  margin: auto 0 0; flex-direction: column; align-items: stretch;
  gap: 8px; padding-top: 14px; border-top: 1px solid var(--line);
}
body.has-sidenav .user-chip { text-align: left; }
body.has-sidenav .page { padding-top: 28px; }
body.screen.has-sidenav { padding-left: 0; }
body.screen.has-sidenav .appbar { display: none; }

@media (max-width: 900px) {
  body.has-sidenav { padding-left: 0; }
  body.has-sidenav .appbar {
    position: sticky; width: auto; height: auto; bottom: auto;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  body.has-sidenav .appbar-inner {
    min-height: 62px; flex-direction: row; align-items: center;
    gap: 20px; padding: 10px var(--pad-x);
  }
  body.has-sidenav .nav-brand { padding: 0; border-bottom: none; }
  body.has-sidenav .nav-links { flex-direction: row; padding-top: 0; }
  body.has-sidenav .nav-user {
    margin: 0 0 0 auto; flex-direction: row; align-items: center;
    border-top: none; padding-top: 0;
  }
  body.has-sidenav .user-chip { text-align: right; }
}

/* ---------- 3.2 要素名称设置 ---------- */
.metric-name-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.mn-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fbfdfd; }
.mn-group h3 {
  font-size: 12.5px; color: var(--muted); font-weight: 600;
  margin: 0 0 8px; letter-spacing: .3px;
}
.mn-rows { display: flex; flex-direction: column; gap: 6px; }
.mn-row { display: grid; grid-template-columns: 98px minmax(0, 1fr); align-items: center; gap: 10px; }
.mn-label { font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; line-height: 1.25; }
.mn-label em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.mn-row .input { padding: 6px 10px; font-size: 13px; }

/* ---------- 4. 页面容器 ---------- */
.page {
  width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: 24px var(--pad-x) 40px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head h1 { font-size: var(--fs-page-title); font-weight: 650; letter-spacing: -.2px; line-height: 1.3; }
.page-head .sub { margin-top: 5px; font-size: var(--fs-sm); color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-picker { display: flex; align-items: center; gap: 6px; }
.page-picker-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.page-picker .input { min-width: 260px; }

/* ---------- 5. 卡片 / 按钮 / 统计 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  min-width: 0;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-head h2 { font-size: var(--fs-card-title); font-weight: 620; letter-spacing: .1px; }
.card-head .sub { margin-top: 3px; font-size: var(--fs-xs); color: var(--muted); }
.chip-note { font-size: var(--fs-xs); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.section { margin-top: var(--gap); }

.ghost-btn, .primary-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-h); padding: 0 14px;
  border-radius: 9px; border: 1px solid transparent;
  font-size: 13px; font-weight: 500; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.ghost-btn { border-color: var(--line); background: #fff; color: var(--ink-2); }
.ghost-btn:hover { border-color: #cfd8de; background: #f8fafb; color: var(--ink); }
.ghost-btn svg { width: 15px; height: 15px; }
.primary-btn {
  border-color: var(--accent); background: var(--accent); color: #fff;
  box-shadow: 0 6px 16px -12px rgba(15, 118, 110, .9);
}
.primary-btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.ghost-btn:disabled, .primary-btn:disabled, .mini-btn:disabled { opacity: .55; cursor: not-allowed; }

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 18px;
}
.stat { padding: 12px 18px; border-left: 1px solid var(--line-2); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat span { display: block; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.stat b {
  display: block; margin-top: 2px;
  font-size: 20px; font-weight: 620; line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.stat b.stat-text { font-size: 14px; font-weight: 600; }

/* KPI 指标卡 */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap-sm); margin-bottom: var(--gap);
}
.kpi-grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-grid.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi {
  position: relative; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 13px; box-shadow: var(--shadow); overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--kpi-accent, var(--accent)); opacity: .85;
}
.kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kpi-label span {
  font-size: var(--fs-xs); color: var(--muted); letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-label svg { width: 16px; height: 16px; color: var(--kpi-accent, var(--accent)); opacity: .85; flex: none; }
.kpi-value { display: flex; align-items: baseline; gap: 4px; margin-top: 8px; }
.kpi-value b {
  font-size: clamp(22px, 2vw, 28px); font-weight: 620; line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: -.5px;
}
.kpi-value span { font-size: var(--fs-xs); color: var(--muted); }
.kpi-meta { margin-top: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi-value.stale b { color: var(--muted); }

/* 可点击指标卡（点击切换下方曲线） */
.kpi.kpi-click { cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s, background .15s; }
.kpi.kpi-click:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -18px rgba(16, 42, 51, .5); }
.kpi.kpi-click:active { transform: translateY(0); }
.kpi.kpi-click.active { border-color: var(--kpi-accent, var(--accent)); }
.kpi.kpi-click.active::after { width: 5px; opacity: 1; }
.kpi.kpi-click.active .kpi-label span { color: var(--kpi-accent, var(--accent)); font-weight: 600; }
body.screen.demo-screen .kpi.kpi-click.active .kpi-label span { color: var(--kpi-accent, var(--accent)); }
body.screen.demo-screen .kpi.kpi-click.active { border-color: var(--kpi-accent, var(--accent)); box-shadow: var(--d-shadow); }

/* 大图标指标卡：图标 100×100、天空蓝 */
.kpi.kpi-iconic { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.kpi-iconic .kpi-icon { display: flex; line-height: 0; }
.kpi-iconic .kpi-icon svg { width: 100px; height: 100px; color: #4db2ed; stroke-width: 1.25; }
.kpi-iconic .kpi-body { width: 100%; min-width: 0; }
@media (max-width: 760px) {
  .kpi-iconic .kpi-icon svg { width: 72px; height: 72px; }
}

/* 主区两栏 */
.layout-main {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: var(--gap); margin-bottom: var(--gap);
}

/* 分段控件 */
.seg { display: inline-flex; background: #f0f3f5; border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px 11px; border-radius: 7px; font-size: 12px; cursor: pointer;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink-2); }
.seg button.active {
  background: #fff; color: var(--ink);
  box-shadow: 0 1px 3px rgba(20, 40, 50, .14); font-weight: 600;
}

/* 图例 chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: #fbfcfd; color: var(--ink-2);
  font-size: 12px; cursor: pointer; user-select: none;
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: #cfd8de; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; }
.chip.active {
  border-color: color-mix(in srgb, var(--c) 45%, #fff);
  background: color-mix(in srgb, var(--c) 9%, #fff);
  color: var(--ink); font-weight: 600;
}

.chart { width: 100%; height: var(--chart-h); }
.mini-chart { width: 100%; height: 168px; }
.rose-chart { width: 100%; height: 250px; }

/* ---------- 6. 设备卡片 ---------- */
.device-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.device-card {
  display: block; color: inherit; text-decoration: none;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 17px 18px 15px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.device-card:hover {
  transform: translateY(-2px); border-color: #cbd9d6; box-shadow: var(--shadow-lift);
}
.device-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dc-main { min-width: 0; }
.device-name {
  font-size: 16px; font-weight: 620; letter-spacing: -.2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.device-id { margin-top: 3px; font-size: var(--fs-xs); color: var(--muted); font-family: var(--mono); }
.device-site { font-size: 12.5px; color: #446b76; margin-top: 2px; }
.loc-chip-sm {
  display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 10px;
  background: #e4f3f0; color: #0f766e; border-radius: 9px; vertical-align: 1px;
}
.device-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.dm { background: #f6f9fa; border-radius: 9px; padding: 8px 10px; min-width: 0; }
.dm span {
  display: block; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dm b { font-size: 15px; font-weight: 620; font-variant-numeric: tabular-nums; }
.dm b i { font-style: normal; font-size: 10px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.device-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2);
  font-size: var(--fs-xs); color: var(--muted);
}
.owner-tag {
  font-size: 10.5px; background: #eef2f6; color: #5b6e79;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.owner-tag.none { background: #fdf3e0; color: #8a5a12; }

/* 状态点 */
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #b9c4ca; display: inline-block; flex: none;
}
.dot.online { background: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, .16); animation: breathe 2.4s infinite; }
.dot.offline { background: var(--danger); }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.inline-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap;
}
.sim-flag {
  font-size: 11px; font-weight: 600; letter-spacing: .4px;
  color: #8a5a12; background: #fdf3e0; border: 1px solid #f2dfb9;
  padding: 2px 7px; border-radius: 6px; white-space: nowrap;
}

/* ---------- 7. 设备数据页 ---------- */
.device-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 4px;
}
.head-main { min-width: 0; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.device-header h1 { font-size: var(--fs-page-title); font-weight: 650; letter-spacing: -.2px; line-height: 1.3; }
.device-sub {
  display: flex; flex-wrap: wrap; gap: 5px 16px;
  margin-top: 7px; font-size: var(--fs-xs); color: var(--muted);
}
.device-sub > span { display: inline-flex; align-items: center; gap: 5px; }
.device-sub code {
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  background: #eef2f4; padding: 1px 6px; border-radius: 5px;
}
.device-actions { display: flex; align-items: center; gap: 8px; }

.view-tabs {
  display: flex; gap: 2px; overflow-x: auto;
  border-bottom: 1px solid var(--line);
  margin: 14px 0 18px; scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }
.view-tab {
  padding: 9px 13px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0;
  color: var(--muted); text-decoration: none; font-size: 13px; white-space: nowrap;
  transition: color .15s, background .15s, border-color .15s;
}
.view-tab:hover { color: var(--ink-2); background: #f5f8f9; }
.view-tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }

/* 风向盘 */
.wind-card { display: flex; flex-direction: column; }
.compass-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 132px;
  gap: 8px; align-items: center; flex: 1;
}
.compass-box { position: relative; display: flex; flex-direction: column; align-items: center; }
#compass { width: min(100%, 220px); height: auto; }
.compass-readout { display: flex; align-items: baseline; gap: 5px; margin-top: -4px; }
.compass-readout b { font-size: 26px; font-weight: 620; font-variant-numeric: tabular-nums; }
.compass-readout .unit { font-size: 12px; color: var(--muted); }
.compass-readout em {
  font-style: normal; font-size: 12px;
  color: var(--accent-ink); background: var(--accent-soft);
  padding: 3px 8px; border-radius: 6px; margin-left: 4px;
}
.compass-readout.readout-sub { margin-top: 2px; }
.compass-readout.readout-sub b { font-size: 18px; }
.compass-ring { fill: none; stroke: #e5ebee; stroke-width: 1; }
.compass-ring.dashed { stroke-dasharray: 3 5; opacity: .8; }
.compass-tick { stroke: #ccd7dc; stroke-width: 1; }
.compass-tick.major { stroke: #93a6b0; stroke-width: 1.7; }
.compass-label { fill: #8296a0; font-size: 10.5px; font-weight: 500; letter-spacing: 1px; }
.compass-label.north { fill: #0f766e; font-weight: 700; }

/* 全部要素 */
.all-metrics {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0 18px; margin-top: 10px;
}
.am-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 12px;
}
.am-item span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-item b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.am-item b i { font-style: normal; font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 2px; }

/* 历史查询 */
.history-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hist-check {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--ink-2);
  font-size: 12px; cursor: pointer; user-select: none;
  transition: border-color .15s, background .15s, color .15s;
}
.hist-check:hover { border-color: #cfd8de; }
.hist-check.active { border-color: #cbe5df; background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.hist-check input { accent-color: var(--accent); }
.hint-line { margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); }

/* ---------- 8. 表单 / 登录 ---------- */
.form-grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form-field { flex: 1 1 160px; min-width: 150px; }
.form-field > label,
.form-field > span {
  display: block; margin-bottom: 6px;
  font-size: var(--fs-xs); font-weight: 500; color: var(--ink-2);
}
.form-field.field-sm { flex: 0 0 auto; width: 170px; min-width: 0; }
.input {
  width: 100%; height: var(--control-h); min-width: 0;
  padding: 0 11px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.input:hover { border-color: #cfd8de; }
.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
select.input {
  appearance: none; cursor: pointer; padding-right: 30px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237b8b96' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 11px center;
}
select.select-sm {
  height: 30px; width: auto; padding: 0 28px 0 9px;
  font-size: 12px; border-radius: var(--radius-sm);
}
.check {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-sm); color: var(--ink-2);
  user-select: none; cursor: pointer;
}
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

/* 登录页 / 密码表单共用 */
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .form-field { flex: none; }
.auth-form .primary-btn { width: 100%; }
.form-alert,
.auth-error {
  display: flex; align-items: center;
  min-height: 36px; padding: 7px 11px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: transparent;
  font-size: var(--fs-sm); line-height: 1.45;
  transition: color .15s, background .15s, border-color .15s;
}
.form-alert.show,
.auth-error.show {
  color: #8f3a34; background: var(--danger-soft); border-color: #f0d8d5;
}

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: min(400px, 100%);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 32px 30px 24px;
  box-shadow: 0 24px 60px -30px rgba(15, 45, 55, .4);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-brand svg { width: 44px; height: 44px; color: var(--accent); }
.auth-brand h1 { margin-top: 12px; font-size: 20px; font-weight: 650; letter-spacing: .2px; }
.auth-brand p { margin-top: 5px; font-size: var(--fs-sm); color: var(--muted); }
.auth-card .auth-form { margin-top: 22px; }
.auth-foot {
  margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line-2);
  text-align: center; font-size: 11px; color: var(--muted);
}
.auth-page .auth-foot { margin-top: 20px; }

/* ---------- 9. 表格 ---------- */
.table-wrap {
  margin-top: 12px; overflow: auto; max-height: 356px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
}
.table-wrap.tall { max-height: 520px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 9px 12px; background: #f7f9fa; color: var(--ink-2);
  font-weight: 600; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
thead th:first-child, tbody td:first-child { text-align: left; }
tbody td {
  padding: 9px 12px; text-align: right;
  border-bottom: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap;
}
tbody tr:hover td { background: #fafcfd; }
tbody tr:last-child td { border-bottom: none; }
.table-wrap table td { white-space: nowrap; }
.table-note { margin-top: 9px; font-size: var(--fs-xs); color: var(--muted); }

/* ---------- 10. 管理后台 / 个人中心 ---------- */
.admin-tabs {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 18px;
  background: #e9eef1; border-radius: 10px;
}
.admin-tab {
  border: 0; background: transparent; color: var(--ink-2);
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer; transition: background .15s, color .15s;
}
.admin-tab:hover { color: var(--ink); }
.admin-tab.active {
  background: #fff; color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 3px rgba(20, 40, 50, .14);
}
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.toolbar h2 { font-size: var(--fs-card-title); font-weight: 620; }
.toolbar .sub { margin-top: 3px; font-size: var(--fs-xs); color: var(--muted); }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.mini-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink-2);
  font-size: 11.5px; line-height: 1.5; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.mini-btn:hover { border-color: #cfd8de; background: #f8fafb; }
.mini-btn.danger { color: #a33; border-color: #f0d8d5; }
.mini-btn.danger:hover { background: var(--danger-soft); }
.mini-btn.primary { color: var(--accent-ink); border-color: #cbe5df; background: var(--accent-soft); }
code.mono { font-family: var(--mono); font-size: 11.5px; }

.account-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gap); align-items: start;
}
.profile-list, .dev-list { margin-top: 6px; }
.account-grid .auth-form { margin-top: 16px; }
.profile-line {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--line-2);
  font-size: 13px;
}
.profile-line:last-child { border-bottom: 0; padding-bottom: 0; }
.profile-line span { color: var(--muted); font-size: var(--fs-sm); }
.mini-device {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--line-2);
  font-size: var(--fs-sm);
}
.mini-device:last-child { border-bottom: 0; padding-bottom: 0; }
.mini-device a { color: var(--accent-ink); text-decoration: none; white-space: nowrap; }
.mini-device a:hover { text-decoration: underline; }
.mini-right { display: flex; align-items: center; gap: 10px; flex: none; }

/* 页脚 */
.foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: var(--fs-xs); color: var(--muted);
}
.foot b { color: var(--ink-2); font-weight: 600; }

/* ---------- 11. 提示 / 空态 ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state svg { width: 56px; height: 56px; opacity: .28; margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 6px; font-size: 16px; color: var(--ink-2); font-weight: 600; }
.empty-state p { font-size: 13px; }
.empty-state p a { color: var(--accent-ink); }
.empty-card { padding: 0; }
.empty-banner { margin-bottom: var(--gap); padding: 12px; }
.empty-inline {
  padding: 28px 16px; text-align: center;
  font-size: var(--fs-sm); color: var(--muted);
  background: #fafcfd; border: 1px dashed var(--line); border-radius: 10px;
}
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100;
  transform: translateX(-50%) translateY(6px);
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 18px; border-radius: 10px;
  background: #12212b; color: #fff; font-size: 13px;
  opacity: 0; pointer-events: none;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #a33a33; }

/* ---------- 12. 大屏模式 ---------- */
.screen-clock {
  position: fixed; right: var(--pad-x); top: 76px; z-index: 25;
  text-align: right; color: #cfe9e4; pointer-events: none;
}
.sc-time { font-size: 30px; font-weight: 300; letter-spacing: 2px; font-variant-numeric: tabular-nums; }
.sc-date { margin-top: 2px; font-size: 11px; letter-spacing: 2px; opacity: .55; }

body.screen { background: #071219; color: #e9f2f4; min-height: 100vh; --chart-h: min(46vh, 460px); }
body.screen .appbar, body.screen .view-tabs { display: none; }
body.screen .page { max-width: none; padding-top: 20px; }
body.screen .device-header h1 { color: #e9f2f4; }
body.screen .device-sub { color: #6f8993; }
body.screen .device-sub code { background: #152c37; color: #a9c3ca; }
body.screen .ghost-btn { background: #0c1b24; border-color: #1d333f; color: #a9c3ca; }
body.screen .ghost-btn:hover { background: #11242e; }
body.screen .card { background: #0b1a22; border-color: #152c37; box-shadow: 0 20px 45px -30px #000; }
body.screen .card-head h2 { color: #e9f2f4; }
body.screen .card-head .sub,
body.screen .chip-note,
body.screen .kpi-label span,
body.screen .kpi-meta,
body.screen .kpi-value span { color: #6f8993; }
body.screen .kpi { background: #0b1a22; border-color: #152c37; box-shadow: 0 20px 45px -30px #000; }
body.screen .kpi-value b { color: #f0faf9; font-size: clamp(24px, 2.2vw, 32px); }
body.screen .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
body.screen .layout-main { grid-template-columns: minmax(0, 1fr) 420px; }
body.screen .seg { background: #0a1720; }
body.screen .seg button { color: #6f8993; }
body.screen .seg button.active { background: #17323d; color: #e9f2f4; box-shadow: none; }
body.screen .chip { background: #0e2029; border-color: #1a303b; color: #a9c3ca; }
body.screen .chip.active { background: #14313a; border-color: #2a5a5e; color: #e9f2f4; }
body.screen .dm { background: #0e2029; }
body.screen .dm span { color: #6f8993; }
body.screen .dm b { color: #f0faf9; }
body.screen .empty-inline { background: #0e2029; border-color: #1a303b; color: #6f8993; }
body.screen .stat-row { background: #0b1a22; border-color: #152c37; box-shadow: 0 20px 45px -30px #000; }
body.screen .stat { border-left-color: #152c37; }
body.screen .stat span { color: #6f8993; }
body.screen .stat b { color: #f0faf9; }
body.screen .foot { border-top-color: #152c37; color: #5f7882; }
body.screen .foot b { color: #9fb8bf; }
body.screen #compass { width: min(100%, 290px); }
body.screen .compass-ring { stroke: #1d333f; }
body.screen .compass-tick { stroke: #243d48; }
body.screen .compass-tick.major { stroke: #3c5c68; }
body.screen .compass-label { fill: #7a949e; }
body.screen .compass-label.north { fill: #37b3a4; }
body.screen .compass-readout em { color: #6fe0cf; background: rgba(20, 90, 82, .35); }

/* ---------- 位置编辑 + 地图 ---------- */
.loc-chip {
  display: inline-block; margin-left: 6px; padding: 1px 7px; font-size: 10.5px;
  background: #e4f3f0; color: #0f766e; border-radius: 10px;
}
.device-sub { font-size: 11.5px; color: #7b8b96; margin-top: 2px; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 25, 32, .55);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 8vh; z-index: 9999; opacity: 0; visibility: hidden;
  transition: opacity .18s;
}
.modal-backdrop.open { opacity: 1; visibility: visible; }
.modal-card {
  width: min(560px, 92vw); background: #fff; border-radius: 12px;
  padding: 20px 22px 14px; box-shadow: 0 18px 48px rgba(20, 50, 60, .25);
  transform: translateY(-8px); transition: transform .2s;
}
.modal-backdrop.open .modal-card { transform: translateY(0); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; grid-column: 1 / -1; margin-top: 6px; }
.inline-check { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: #47646d; cursor: pointer; }
/* Leaflet 标记 */
.device-marker { background: transparent !important; border: none !important; }
.marker-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: #c2453d; box-shadow: 0 0 0 3px rgba(194,69,61,.25);
  border: 2px solid #fff;
}
.marker-dot.online { background: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,.28); }
#deviceMap .leaflet-popup-content-wrapper { border-radius: 10px; }

/* ---------- 13. 响应式 ---------- */
@media (max-width: 1200px) {
  .layout-main { grid-template-columns: minmax(0, 1fr) 320px; }
  body.screen .layout-main { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1024px) {
  .layout-main,
  body.screen .layout-main { grid-template-columns: 1fr; }
  .compass-row { grid-template-columns: 220px minmax(0, 1fr); }
  .mini-chart { height: 190px; }
}
@media (max-width: 900px) {
  .account-grid { grid-template-columns: 1fr; }
  .kpi-grid.c5, .kpi-grid.c6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --chart-h: 280px; }
  .kpi-grid, .kpi-grid.c5, .kpi-grid.c6, body.screen .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .page { padding: 18px var(--pad-x) 30px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1,
  .device-header h1 { font-size: 19px; }
  .card { padding: 15px 15px; border-radius: var(--radius); }
  .appbar-inner { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; min-height: 0; }
  .nav-brand b { font-size: 15px; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; }
  .nav-user { gap: 8px; }
  .user-chip em { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .kpi { padding: 12px 13px 11px; }
  .kpi-value b { font-size: 23px; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 10px 14px; border-left: 0; border-top: 1px solid var(--line-2); }
  .stat:first-child { border-top: 0; }
  .stat:nth-child(2) { border-top: 0; }
  .stat:nth-child(odd):last-child { grid-column: 1 / -1; }
  .view-tab { padding: 9px 10px; font-size: 12.5px; }
  .device-grid { grid-template-columns: 1fr; }
  .device-actions { width: 100%; justify-content: flex-end; }
  .compass-row { grid-template-columns: 1fr; justify-items: center; }
  .mini-chart { height: 180px; width: 100%; }
  .form-grid { flex-direction: column; align-items: stretch; }
  .form-field,
  .form-field.field-sm { width: 100%; flex: 1 1 auto; }
  .form-grid .primary-btn { width: 100%; }
  .history-tools { width: 100%; }
  .history-tools .seg { flex: 1; justify-content: space-between; }
  .all-metrics { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 14px; }
  .mini-device { flex-wrap: wrap; gap: 6px; }
  .mini-right { width: 100%; justify-content: space-between; }
  .screen-clock { display: none; }
  .foot { flex-direction: column; gap: 4px; }
  body.screen { --chart-h: 300px; }
  body.screen .page { padding-top: 18px; }
  body.screen #compass { width: 220px; }
}
@media (max-width: 480px) {
  .auth-page { padding: 16px 12px; }
  .auth-card { padding: 26px 20px 20px; border-radius: var(--radius-lg); }
  .auth-brand h1 { font-size: 18px; }
  .device-metrics { gap: 6px; }
  .dm { padding: 7px 8px; }
}

/* ---------- 15. 演示页：浅色大屏 ---------- */
body.screen.demo-screen {
  --d-bg: #f4f8fb;
  --d-card: #ffffff;
  --d-ink: #1f2c39;
  --d-ink-2: #48596a;
  --d-muted: #7b8c9d;
  --d-line: #e4ecf3;
  --d-line-2: #eef4f8;
  --d-accent: #2f6fed;
  --d-accent-ink: #2559c4;
  --d-accent-soft: #eaf1fe;
  --d-shadow: 0 1px 2px rgba(23, 42, 58, .04), 0 14px 34px -26px rgba(23, 42, 58, .5);
  --d-gap: clamp(14px, 1.3vw, 20px);
  --chart-h: min(44vh, 460px);
  background:
    radial-gradient(900px 380px at 6% -14%, #e6f1f8 0%, rgba(244, 248, 251, 0) 62%),
    radial-gradient(820px 340px at 99% -2%, #eaeffc 0%, rgba(244, 248, 251, 0) 58%),
    var(--d-bg);
  color: var(--d-ink);
}
body.screen.demo-screen .appbar {
  display: block;
  background: rgba(255, 255, 255, .86);
  border-bottom: 1px solid var(--d-line);
}
body.screen.demo-screen .appbar-inner {
  max-width: 1680px; margin: 0 auto;
  padding: 0 clamp(16px, 2.2vw, 34px);
  min-height: 60px;
}
body.screen.demo-screen .nav-brand { color: var(--d-ink); }
body.screen.demo-screen .nav-brand svg { color: var(--d-accent); }
body.screen.demo-screen .primary-btn {
  background: var(--d-accent); border-color: var(--d-accent); color: #fff;
  box-shadow: 0 8px 18px -14px rgba(47, 111, 237, .8);
}
body.screen.demo-screen .primary-btn:hover {
  background: var(--d-accent-ink); border-color: var(--d-accent-ink);
}
body.screen.demo-screen .page {
  max-width: 1680px; margin: 0 auto;
  padding: 20px clamp(16px, 2.4vw, 34px) 28px;
}
body.screen.demo-screen .demo-banner {
  margin-bottom: var(--d-gap);
  background: #fffaf0; border-color: #f1e1c0; color: #8a6220; box-shadow: none;
}
body.screen.demo-screen .demo-banner b { color: #7a5312; }
body.screen.demo-screen .demo-banner a { color: var(--d-accent); }
body.screen.demo-screen .demo-pill { background: #b7791f; }
body.screen.demo-screen .device-header { margin-bottom: var(--d-gap); }
body.screen.demo-screen .device-header h1 {
  color: var(--d-ink); font-size: clamp(21px, 1.7vw, 28px);
}
body.screen.demo-screen .device-sub { color: var(--d-muted); }
body.screen.demo-screen .device-sub code { background: var(--d-line-2); color: var(--d-ink-2); }
body.screen.demo-screen .kpi-grid { gap: var(--d-gap); margin-bottom: var(--d-gap); }
body.screen.demo-screen .kpi {
  background: var(--d-card); border-color: var(--d-line); box-shadow: var(--d-shadow);
  border-radius: 16px; padding: 16px 18px 14px;
}
body.screen.demo-screen .kpi::after { width: 3px; opacity: .72; }
body.screen.demo-screen .kpi-label span,
body.screen.demo-screen .kpi-value span,
body.screen.demo-screen .kpi-meta { color: var(--d-muted); }
body.screen.demo-screen .kpi-value b {
  color: var(--d-ink); font-size: clamp(25px, 1.9vw, 34px);
}
body.screen.demo-screen .layout-main {
  grid-template-columns: minmax(0, 1fr) clamp(320px, 26vw, 400px);
  gap: var(--d-gap); margin-bottom: 0;
}
body.screen.demo-screen .layout-main > .card:last-child {
  display: flex; flex-direction: column;
}
body.screen.demo-screen .layout-main > .card:last-child .compass-box {
  flex: 1; justify-content: center; padding: 10px 0 4px;
}
body.screen.demo-screen .card {
  background: var(--d-card); border-color: var(--d-line); box-shadow: var(--d-shadow);
  border-radius: 16px; padding: 18px 20px;
}
body.screen.demo-screen .card-head h2 { color: var(--d-ink); font-size: 15.5px; }
body.screen.demo-screen .card-head .sub,
body.screen.demo-screen .chip-note { color: var(--d-muted); }
body.screen.demo-screen .seg { background: #eef3f8; }
body.screen.demo-screen .seg button { color: #6d7f90; }
body.screen.demo-screen .seg button:hover { color: var(--d-ink-2); }
body.screen.demo-screen .seg button.active {
  background: #fff; color: var(--d-ink); box-shadow: 0 1px 3px rgba(23, 42, 58, .13);
}
body.screen.demo-screen .chip {
  background: #f8fbfd; border-color: var(--d-line); color: var(--d-ink-2);
}
body.screen.demo-screen .chip.active {
  border-color: color-mix(in srgb, var(--c) 42%, #fff);
  background: color-mix(in srgb, var(--c) 10%, #fff);
  color: var(--d-ink);
}
body.screen.demo-screen .empty-inline {
  background: #fafcfe; border-color: var(--d-line); color: var(--d-muted);
}
body.screen.demo-screen .compass-ring { stroke: #e0e9f1; }
body.screen.demo-screen .compass-tick { stroke: #d3dfe9; }
body.screen.demo-screen .compass-tick.major { stroke: #b3c3d1; }
body.screen.demo-screen .compass-label { fill: var(--d-muted); }
body.screen.demo-screen .compass-label.north { fill: var(--d-accent); }
body.screen.demo-screen .compass-readout b { color: var(--d-ink); }
body.screen.demo-screen .compass-readout em { color: #17695f; background: #e8f4f1; }
body.screen.demo-screen #compass { width: min(100%, 260px); }
body.screen.demo-screen .foot {
  margin-top: var(--d-gap); border-top-color: var(--d-line); color: var(--d-muted);
}
body.screen.demo-screen .foot a { color: var(--d-accent); }
body.screen.demo-screen .windrose-card,
body.screen.demo-screen .elements-card { margin-top: var(--d-gap); }
@media (max-width: 1024px) {
  body.screen.demo-screen .layout-main { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body.screen.demo-screen {
    --chart-h: 260px;
    --d-gap: 12px;
    --d-shadow: 0 1px 2px rgba(23, 42, 58, .03), 0 10px 24px -22px rgba(23, 42, 58, .45);
  }
  body.screen.demo-screen .appbar-inner { padding: 8px 14px; min-height: 52px; }
  body.screen.demo-screen .nav-brand b { font-size: 14.5px; }
  body.screen.demo-screen .page { padding: 12px 14px 20px; }
  body.screen.demo-screen .demo-banner { padding: 10px 12px; }
  body.screen.demo-screen .demo-banner p { font-size: 11.5px; line-height: 1.55; }
  body.screen.demo-screen .kpi { padding: 12px 13px 11px; }
  body.screen.demo-screen .kpi-value b { font-size: 24px; }
  body.screen.demo-screen .card { padding: 14px; border-radius: 14px; }
  body.screen.demo-screen #compass { width: min(100%, 210px); }
}

/* ---------- 16. 风玫瑰与全部要素 ---------- */
.windrose-card, .elements-card { margin-top: var(--gap); }
.rose-body {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(240px, 20vw, 300px);
  gap: 18px; align-items: center;
}
.rose-chart { height: 400px; }
.rose-side { display: flex; flex-direction: column; gap: 14px; }
.rose-stat {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed #e8eff5;
}
.rose-stat:last-child { border-bottom: 0; }
.rose-stat span { font-size: 12px; color: #7b8c9d; }
.rose-stat b { font-size: 16px; color: #1f2c39; font-variant-numeric: tabular-nums; }
.rose-legend { list-style: none; display: flex; flex-direction: column; gap: 7px; margin-top: 2px; }
.rose-legend li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #56687a; }
.rose-legend i { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.rose-legend em { font-style: normal; margin-left: auto; color: #8a9aa9; font-variant-numeric: tabular-nums; }
.rose-note { font-size: 11.5px; color: #8a9aa9; line-height: 1.6; }

.metric-picker {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 14px; padding-top: 12px; padding-right: 4px;
  border-top: 1px solid var(--d-line-2, #eef4f8);
  max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
}
.picker-group {
  border: 1px solid var(--d-line-2, #eef4f8); border-radius: 11px;
  background: #fbfdff;
}
.picker-group > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; list-style: none;
  font-size: 12.5px; font-weight: 600; color: #3f5162;
}
.picker-group > summary::-webkit-details-marker { display: none; }
.picker-group > summary::before {
  content: ''; width: 0; height: 0; flex: none;
  border-left: 5px solid #93a3b1;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s ease;
}
.picker-group[open] > summary::before { transform: rotate(90deg); }
.picker-group > summary em {
  margin-left: auto; font-style: normal; font-size: 10.5px; font-weight: 400; color: #93a3b1;
}
.picker-items {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 6px; padding: 0 10px 10px;
}
.metric-btn {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: 6px 8px; border-radius: 9px;
  background: #fff; border: 1px solid #eaf1f6;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.metric-btn:hover {
  border-color: #cfdfeb;
  box-shadow: 0 6px 16px -14px rgba(23, 42, 58, .5);
}
.metric-btn:focus-visible { outline: 2px solid #2f6fed; outline-offset: 1px; }
.metric-btn.active {
  border-color: #2f6fed; background: #eaf1fe;
  box-shadow: inset 0 0 0 1px #2f6fed;
}
.mb-name {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11.5px; color: #7b8c9d;
}
.metric-btn.active .mb-name { color: #2559c4; font-weight: 600; }
.mb-val { display: flex; align-items: baseline; gap: 3px; margin-top: 1px; }
.mb-val b { font-size: 15px; color: #1f2c39; font-variant-numeric: tabular-nums; }
.mb-val i { font-style: normal; font-size: 10px; color: #8fa0ae; }
.metric-btn.is-empty .mb-val b { color: #b4685f; }
@media (max-width: 900px) {
  .rose-body { grid-template-columns: 1fr; }
  .rose-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
  .rose-legend { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .rose-chart { height: 320px; }
  .rose-side { grid-template-columns: 1fr; }
  .metric-picker { max-height: 300px; }
  .picker-items { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .metric-btn { padding: 5px 7px; }
  .mb-val b { font-size: 14px; }
}

/* ---------- 14. 公开演示页 ---------- */
.demo-banner {
  display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
  margin-bottom: var(--gap); padding: 12px 16px;
  background: #fdf6e7; border: 1px solid #f0dfba; border-radius: var(--radius);
  color: #7a5312; font-size: var(--fs-sm); line-height: 1.6;
}
.demo-banner p { flex: 1 1 320px; min-width: 0; }
.demo-banner b { color: #6b4708; font-weight: 600; }
.demo-banner a { color: #8a5a12; font-weight: 600; }
.demo-pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  margin-top: 1px; padding: 2px 10px; border-radius: 999px;
  background: var(--amber); color: #fff;
  font-size: 11.5px; font-weight: 600; letter-spacing: .5px;
}
.demo-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #fff; animation: breathe 2s infinite;
}
@media (max-width: 760px) {
  .demo-banner { padding: 10px 12px; gap: 8px; }
  .demo-banner p { flex-basis: 100%; }
}

/* ---------- 17. 单要素曲线（实时曲线卡） ---------- */
.chart-tools {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin: 10px 0;
}
.chart-hint { font-size: 11.5px; color: var(--d-muted, #7b8c9d); }
.metric-date {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--d-muted, #7b8c9d);
}
.metric-date input {
  height: 34px; padding: 0 10px;
  border: 1px solid var(--d-line, #e4ecf3); border-radius: 9px;
  background: #fff; color: var(--d-ink, #172a3a);
  font-size: 12.5px; font-family: inherit;
}
.metric-date input:focus-visible { outline: 2px solid #2f6fed; outline-offset: 1px; }

.metric-stats {
  display: flex; flex-wrap: wrap; gap: 6px 20px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--d-line-2, #eef4f8);
}
.metric-stats span { font-size: 11.5px; color: var(--d-muted, #7b8c9d); }
.metric-stats b {
  margin-left: 5px; font-size: 14px; font-weight: 600;
  color: var(--d-ink, #172a3a); font-variant-numeric: tabular-nums;
}

#demoChart > .empty-inline {
  height: 100%; box-sizing: border-box; margin: 0; padding: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
}
#demoChart > .empty-inline b { font-size: 14px; color: var(--d-ink, #172a3a); font-weight: 600; }
#demoChart > .empty-inline span { font-size: 12px; color: var(--d-muted, #7b8c9d); }

@media (max-width: 760px) {
  .chart-tools { justify-content: flex-start; }
  .chart-hint { display: none; }
  .metric-date { width: 100%; justify-content: space-between; }
  .metric-date input { flex: 1; min-width: 0; max-width: 200px; }
}

/* 后台：首页板块开关 */
.home-metric-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 18px;
  padding: 4px 2px 8px;
}
.home-metric-item {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--d-ink, #172a3a);
  padding: 9px 12px; border: 1px solid var(--d-line, #e2eaf2); border-radius: 9px; cursor: pointer;
  background: #fff; transition: border-color .15s, background .15s;
}
.home-metric-item:hover { border-color: #b9d4e6; background: #f7fbfe; }
.home-metric-item input { width: 15px; height: 15px; accent-color: var(--d-accent, #2f6fed); cursor: pointer; }
.home-metric-item em { font-style: normal; color: var(--d-muted, #7b8c9d); font-size: 12px; }
