/* ============================================================
 * 利维智能 (Livy Intelligent) — 工业物联网 PWA Demo
 * css/style.css — 统一设计令牌体系
 *
 * 架构：
 *   :root        = 暗色主题令牌（默认）
 *   html.light   = 亮色主题令牌（仅覆盖颜色变量，不写组件规则）
 *   组件规则     = 只引用 var(--token)，零硬编码颜色
 *
 * 这样两套主题彻底分离，不存在"覆盖补丁打架"的问题。
 * ============================================================ */

/* ---------- 设计令牌：暗色（纯黑白 / strict monochrome） ---------- */
:root {
  /* 表面层级（纯黑 + 白色透明度分层，不用灰色） */
  --bg: #000000;              /* 页面背景：纯黑 */
  --panel: rgba(255, 255, 255, .04);   /* 卡片/主面板 */
  --panel-2: rgba(255, 255, 255, .07); /* 次级面板（磁贴、输入框底） */
  --surface-inset: rgba(255, 255, 255, .03); /* 凹陷表面 */
  --border: rgba(255, 255, 255, .16);  /* 边框 */
  --border-subtle: rgba(255, 255, 255, .08); /* 弱边框 */

  /* 文字（纯白 — 去掉所有灰色） */
  --text: #ffffff;
  --text-dim: #ffffff;
  --text-faint: #ffffff;

  /* 强调色（纯白 — 去掉灰阶强调） */
  --accent-pink: #ffffff;
  --accent-cyan: #ffffff;
  --accent-yellow: #ffffff;
  --accent-soft: rgba(255, 255, 255, .10);   /* 选中项底色 */
  --accent-softer: rgba(255, 255, 255, .05); /* 更弱的强调底 */
  --accent-glow: rgba(255, 255, 255, .20);   /* 发光阴影 */

  /* 状态色（唯一保留的颜色 — 指示灯） */
  --ok: #4ade80;
  --warn: #facc15;
  --fault: #f87171;
  --offline: rgba(255, 255, 255, .40);  /* 离线 → 半透明白（非彩色） */
  --ok-soft: rgba(74, 222, 128, .14);
  --warn-soft: rgba(250, 204, 21, .14);
  --fault-soft: rgba(248, 113, 113, .14);
  --offline-soft: rgba(255, 255, 255, .08);

  /* 能源管理图表色 */
  --en-power: #ffa726;
  --en-water: #4dd0e1;

  /* 交互反馈（黑白） */
  --hover-bg: rgba(255, 255, 255, .08);
  --active-bg: rgba(255, 255, 255, .10);
  --btn-hover-bg: rgba(255, 255, 255, .12);
  --overlay: rgba(0, 0, 0, .82);
  --scrim: rgba(0, 0, 0, .65);
  --scrollbar-thumb: rgba(255, 255, 255, .20);
  --scrollbar-thumb-hover: rgba(255, 255, 255, .35);

  /* 实心按钮（黑底 + 白框） */
  --btn-solid-bg: #000000;
  --btn-solid-border: #ffffff;

  /* 渐变端点：固定彩色（不随主题变）— logo/头像/AI 头像保持原样不发灰 */
  --grad-cyan-a: #22d3ee;   /* 青 */
  --grad-cyan-b: #3b82f6;   /* 蓝 */
  --grad-pink-a: #e879f9;   /* 粉紫 */
  --grad-pink-b: #a855f7;   /* 紫 */
  --book-a: rgba(255, 255, 255, .07);
  --book-b: rgba(255, 255, 255, .04);
  --header-a: rgba(255, 255, 255, .05);
  --header-b: rgba(255, 255, 255, .03);
  --sidebar-bg: rgba(255, 255, 255, .03);
  --table-head-bg: rgba(255, 255, 255, .05);

  /* 几何 / 字体 */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --header-h: 56px;
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 64px;
  --ai-w: 340px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- 设计令牌：亮色（工业风 / 性冷淡） ---------- */
html.light {
  /* 表面层级 */
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #eceef1;
  --surface-inset: #e2e5ea;
  --border: #d8dde3;
  --border-subtle: #e8ebef;

  /* 文字 */
  --text: #1a1d21;
  --text-dim: #5c6470;
  --text-faint: #9aa3ad;

  /* 强调色（中性灰，去掉粉/蓝霓虹） */
  --accent-pink: #374151;
  --accent-cyan: #4b5563;
  --accent-yellow: #6b7280;
  --accent-soft: rgba(75, 85, 99, .10);
  --accent-softer: rgba(75, 85, 99, .05);
  --accent-glow: rgba(75, 85, 99, .18);

  /* 状态色（M3 工业色，沉稳但醒目） */
  --ok: #188038;
  --warn: #ea8600;
  --fault: #d93025;
  --offline: #9aa0a6;
  --ok-soft: rgba(24, 128, 56, .10);
  --warn-soft: rgba(234, 134, 0, .12);
  --fault-soft: rgba(217, 48, 37, .10);
  --offline-soft: rgba(154, 160, 166, .15);

  /* 能源管理图表色 */
  --en-power: #e65100;
  --en-water: #00838f;

  /* 交互反馈 */
  --hover-bg: #f1f3f6;
  --active-bg: #e4e7ec;
  --btn-hover-bg: #e2e5ea;
  --overlay: rgba(100, 116, 139, .35);
  --scrim: rgba(15, 23, 42, .30);
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-thumb-hover: #94a3b8;

  /* 实心按钮（亮色保持黑底，边框透明避免双重描边） */
  --btn-solid-bg: #1a1d21;
  --btn-solid-border: transparent;

  /* 渐变端点：固定彩色（不随主题变）— 亮色用沉稳彩色 */
  --grad-cyan-a: #0891b2;   /* 青 */
  --grad-cyan-b: #2563eb;   /* 蓝 */
  --grad-pink-a: #c026d3;   /* 粉紫 */
  --grad-pink-b: #7c3aed;   /* 紫 */
  --book-a: #e8ebef;
  --book-b: #dfe3e8;
  --header-a: #ffffff;
  --header-b: #f8fafc;
  --sidebar-bg: #ffffff;
  --table-head-bg: #f1f3f6;

  /* 阴影更轻 */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: var(--accent-cyan); text-decoration: none; }

/* ---------- 通用 ---------- */
.hidden { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* 状态点 */
.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 6px currentColor;
}
.dot.normal  { background: var(--ok);      color: var(--ok); }
.dot.warn    { background: var(--warn);    color: var(--warn); }
.dot.fault   { background: var(--fault);   color: var(--fault); }
.dot.offline { background: var(--offline); color: var(--offline); box-shadow: none; }

/* 状态标签 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; }
.badge.normal  { background: var(--ok-soft);      color: var(--ok); }
.badge.warn    { background: var(--warn-soft);    color: var(--warn); }
.badge.fault   { background: var(--fault-soft);   color: var(--fault); }
.badge.offline { background: var(--offline-soft); color: var(--offline); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: all .18s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent-cyan); background: var(--btn-hover-bg); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--btn-solid-bg);
  border-color: var(--btn-solid-border);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.25); border-color: var(--accent-pink); }
.btn-cyan {
  background: var(--btn-solid-bg);
  border-color: var(--btn-solid-border);
  color: #fff;
  font-weight: 600;
}
.btn-cyan:hover { filter: brightness(1.25); border-color: var(--accent-cyan); }

/* 输入 */
.input, .select {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.input:focus, .select:focus { border-color: var(--accent-cyan); }
.input::placeholder { color: var(--text-faint); }
.select option { background: var(--surface-inset); }

/* ============================================================
 * 登录页
 * ============================================================ */
#login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--accent-softer), transparent 60%),
    radial-gradient(1000px 700px at 110% 110%, var(--accent-softer), transparent 60%),
    var(--bg);
  padding: 20px;
  z-index: 50;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 32px 30px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-pink), var(--accent-cyan), var(--accent-yellow));
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  width: 132px; height: 62px;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
}
.login-logo img { height: 100%; width: auto; display: block; }
.login-brand h1 { font-size: 21px; font-weight: 700; letter-spacing: 1px; }
.login-brand p { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

.login-tabs {
  display: flex;
  background: var(--surface-inset);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 22px;
}
.login-tab {
  flex: 1;
  padding: 9px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  transition: all .18s;
}
.login-tab.active {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.login-form { display: flex; flex-direction: column; gap: 15px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.login-submit { margin-top: 8px; width: 100%; padding: 12px; font-size: 15px; }
.login-hint { text-align: center; color: var(--text-faint); font-size: 12px; margin: -4px 0 0; }
.login-hint b { color: var(--text-dim); font-weight: 700; }

/* ============================================================
 * 主页面布局
 * ============================================================ */
#main-page {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.header {
  height: var(--header-h);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: linear-gradient(90deg, var(--header-a), var(--header-b));
  border-bottom: 1px solid var(--border);
  z-index: 30;
}
.header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-toggle {
  width: 40px; height: 40px;
  border: none; background: transparent;
  color: var(--text);
  font-size: 20px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.menu-toggle:hover { background: var(--panel-2); }
.crumbs {
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.crumbs:hover { background: var(--panel-2); }
.crumb { font-size: 15px; font-weight: 600; white-space: nowrap; }
.crumb-sep { color: var(--text-faint); }
.crumb.port { color: var(--accent-cyan); }
.crumb-change { color: var(--text-faint); font-size: 13px; }

.header-right { display: flex; align-items: center; gap: 8px; }
.ai-toggle {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--accent-cyan);
  border-radius: var(--radius-sm);
  font-size: 19px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  padding: 0;
  overflow: hidden;
}
.ai-toggle-img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  display: block;
}
.ai-toggle.active {
  border-color: var(--accent-cyan);
  background: var(--accent-soft);
}
.ai-toggle:hover { border-color: var(--accent-cyan); }
.ai-toggle .ai-badge {
  position: absolute; top: -4px; right: -4px;
  width: 10px; height: 10px;
  background: var(--accent-pink);
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-pink-a), var(--grad-pink-b));
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #fff;
  border: 2px solid rgba(255,255,255,.15);
  cursor: pointer;
}
.avatar:hover { filter: brightness(1.1); }

/* ---------- 主体三栏 ---------- */
.body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  position: relative;
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 auto;
  background: var(--sidebar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width .22s ease;
  z-index: 25;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar-head {
  height: var(--header-h);
  display: flex; align-items: center;
  padding: 0 14px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.sidebar-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--grad-cyan-a), var(--grad-cyan-b));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex: 0 0 auto;
}
/* 侧边栏 logo（横版图：图标+LEEWELL 利维智能文字） */
.sidebar-logo-img {
  display: block;
  height: 42px; width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}
.sidebar.collapsed .sidebar-logo-img {
  width: 34px; height: 34px;
  object-fit: cover;
  object-position: center;
  border-radius: 9px;
}
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 10px 8px; }
.sidebar-collapse-btn {
  height: 46px;
  flex: 0 0 auto;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
}
.sidebar-collapse-btn:hover { background: var(--panel-2); color: var(--text); }
.sidebar.collapsed .sidebar-collapse-btn span { display: none; }

/* 菜单项 */
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
  transition: all .15s;
  user-select: none;
}
.nav-item:hover { background: var(--hover-bg); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 2px;
  background: var(--accent-cyan);
}
.nav-icon { font-size: 17px; width: 22px; text-align: center; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 18px; height: 18px; color: var(--text-dim); }
.nav-item.active .nav-icon svg, .nav-item.open .nav-icon svg { color: var(--accent-cyan); }
.nav-label { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-caret { font-size: 11px; color: var(--text-faint); transition: transform .2s; }
.nav-item.open .nav-caret { transform: rotate(90deg); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-caret,
.sidebar.collapsed .nav-sub { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }

/* 子菜单（设备组）：展开时不限高，避免多设备同时展开时底部被遮挡 */
.nav-sub { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-sub.open { max-height: none; }
.nav-sub-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px 8px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14.5px;
  cursor: pointer;
  margin-bottom: 1px;
}
.nav-sub-item:hover { background: var(--hover-bg); color: var(--text); }
.nav-sub-item.active { background: var(--active-bg); color: var(--text); }
.nav-sub-code { color: var(--text-faint); font-size: 12px; margin-left: auto; }

/* 机构子项（含状态点） */
.nav-mech {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 34px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  cursor: pointer;
  margin-bottom: 1px;
  position: relative;
  transition: all .15s;
  user-select: none;
}
.nav-mech:hover { background: var(--hover-bg); color: var(--text); }
.nav-mech.active { background: var(--active-bg); color: var(--text); }
.nav-mech-name { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-mech-caret { font-size: 10px; color: var(--text-faint); transition: transform .2s; }
.nav-mech.open .nav-mech-caret { transform: rotate(90deg); }
.nav-subsub { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.nav-subsub.open { max-height: none; }
.nav-subsub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 48px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 1px;
  transition: all .15s;
}
.nav-subsub-item:hover { background: var(--hover-bg); color: var(--text); }
.nav-subsub-item.active { background: var(--active-bg); color: var(--text); }

/* 测点：gauge 图标，不用状态点 */
.nav-point-icon { font-size: 13px; color: var(--accent-cyan); flex: 0 0 auto; display: flex; align-items: center; }
.nav-point-icon svg { width: 13px; height: 13px; color: var(--accent-cyan); }

/* 三级菜单：机构（tree-dot） */
.tree-dot { flex: 0 0 auto; }
.tree-val { font-size: 11px; color: var(--text-faint); margin-left: auto; font-variant-numeric: tabular-nums; }

/* 五级菜单：测点（nav-point） */
.nav-point {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 62px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 11.5px;
  cursor: pointer;
  margin-bottom: 1px;
  transition: all .15s;
}
.nav-point:hover { background: var(--hover-bg); color: var(--text); }
.nav-point.active { background: var(--active-bg); color: var(--text); }
.nav-point .nav-point-icon { font-size: 12px; }

/* 可展开项的 caret 旋转 */
.nav-sub-item.expandable .nav-caret,
.nav-item.expandable .nav-caret { transition: transform .2s; }
.nav-sub-item.open .nav-caret,
.nav-item.open .nav-caret { transform: rotate(90deg); }

/* 侧边栏遮罩（移动端） */
.sidebar-overlay {
  position: fixed; inset: 0;
  background: var(--scrim);
  z-index: 24;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

/* ---------- 内容区 ---------- */
.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}
.content-head {
  padding: 16px 22px 0;
  flex: 0 0 auto;
}
.content-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.content-title { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.content-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

/* Tabs */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-top: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.tab {
  padding: 10px 18px;
  border: none; background: transparent;
  color: var(--text-dim);
  font-size: 14.5px; font-weight: 600;
  position: relative;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-cyan); }
.tab.active::after {
  content: '';
  position: absolute; left: 14px; right: 14px; bottom: -1px;
  height: 2px; background: var(--accent-cyan); border-radius: 2px;
}

.content-body { flex: 1 1 auto; overflow-y: auto; padding: 20px 22px 30px; }

/* 卡片 */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title .accent { color: var(--accent-cyan); }
.card-title .ct-sub { font-size: 12px; font-weight: 500; color: var(--text-faint); }

/* ---------- 测点数值实时跳变动画 ---------- */
/* 数值变化时：短暂高亮 + 轻微上浮，模拟实时跳动 */
@keyframes lv-tick {
  0%   { transform: translateY(0);        color: inherit; }
  18%  { transform: translateY(-3px);     color: var(--grad-cyan-a); text-shadow: 0 0 10px color-mix(in srgb, var(--grad-cyan-a) 60%, transparent); }
  100% { transform: translateY(0);        color: inherit; text-shadow: none; }
}
.lv-flash {
  display: inline-block;
  animation: lv-tick 0.5s ease-out;
  will-change: transform, color;
}
/* 数值元素的容器需要 inline-block 才能 translateY */
.mech-point-val, .vt-val { display: inline-block; }
/* 侧边栏树里的测点值同样可闪 */
.tree-val { display: inline-block; }

/* 摘要文本 */
.summary {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
  background: var(--accent-softer);
  border-left: 3px solid var(--accent-cyan);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.summary b { color: var(--text); }
.summary .hl-pink { color: var(--accent-pink); font-weight: 700; }
.summary .hl-warn { color: var(--warn); font-weight: 700; }

/* RUL 剩余寿命 + 劣化趋势（占整行） */
.rul-row { display: flex; gap: 18px; align-items: stretch; }
.rul-big {
  flex: 0 0 180px;
  display: flex; flex-direction: column; justify-content: center;
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 16px;
  text-align: center;
}
.rul-num { font-size: 42px; font-weight: 800; color: var(--accent-cyan); line-height: 1; }
.rul-cap { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.rul-health { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.rul-health-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.rul-health-bar i { display: block; height: 100%; border-radius: 3px; }
.rul-health-num { font-size: 12px; font-weight: 700; }
.rul-chart-wrap { flex: 1 1 auto; min-width: 0; height: 220px; }
@media (max-width: 820px) {
  .rul-row { flex-direction: column; }
  .rul-big { flex: none; }
  .rul-chart-wrap { height: 240px; }
}

/* 总览·概要 tab 顶部装饰图：固定 500px 高，宽屏从中间裁切，窄屏完整显示 */
.splash-card { height: 500px; max-height: 60vw; padding: 0; overflow: hidden; }
.splash-card img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }

/* ---------- 通知中心 ---------- */
.tab-badge {
  display: inline-block; min-width: 18px; height: 18px; line-height: 18px;
  padding: 0 5px; margin-left: 6px; border-radius: 9px;
  background: var(--fault, #f87171); color: #fff;
  font-size: 11px; font-weight: 600; text-align: center;
  vertical-align: middle;
}
.notify-summary {
  display: flex; gap: 24px; flex-wrap: wrap;
  padding: 14px 20px; margin-bottom: 16px;
}
.notify-sum-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.notify-sum-item b { color: var(--text); font-size: 16px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.warn { background: var(--warn, #facc15); }
.dot.fault { background: var(--fault, #f87171); }

.notify-list { display: flex; flex-direction: column; gap: 10px; }
.notify-item {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px;
  transition: border-color .15s; cursor: pointer;
}
.notify-item:hover { border-color: var(--accent-cyan); }
.notify-item.read { opacity: .55; }
.notify-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.notify-dot.warn { background: var(--warn, #facc15); box-shadow: 0 0 6px rgba(250,204,21,.5); }
.notify-dot.fault { background: var(--fault, #f87171); box-shadow: 0 0 6px rgba(248,113,113,.5); }

.notify-body { flex: 1; min-width: 0; }
.notify-title { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.notify-level {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; flex-shrink: 0;
}
.notify-level.warn { background: rgba(250,204,21,.15); color: var(--warn, #facc15); }
.notify-level.fault { background: rgba(248,113,113,.15); color: var(--fault, #f87171); }
.notify-tracktag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; flex-shrink: 0;
  background: rgba(79,209,197,.15); color: var(--accent-cyan, #4fd1c5);
}
.notify-title-text { font-size: 14px; font-weight: 600; color: var(--text); }
.notify-desc { font-size: 13px; color: var(--text-dim); line-height: 1.5; margin-bottom: 6px; }
.notify-meta { font-size: 12px; color: var(--text-dim); opacity: .7; }

.notify-action { flex-shrink: 0; align-self: center; }
.btn-read, .btn-handle {
  padding: 6px 16px; border: none; border-radius: 6px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: opacity .15s;
}
.btn-read { background: rgba(255,255,255,.08); color: var(--text); }
.btn-read:hover { background: rgba(255,255,255,.14); }
.btn-handle { background: var(--fault, #f87171); color: #fff; }
.btn-handle:hover { opacity: .85; }
.read-mark { font-size: 13px; color: var(--text-dim); opacity: .6; }

/* 亮色模式适配 */
html.light .btn-read { background: rgba(0,0,0,.06); color: var(--text); }
html.light .btn-read:hover { background: rgba(0,0,0,.1); }
html.light .notify-level.warn { background: rgba(234,134,0,.12); }
html.light .notify-level.fault { background: rgba(217,48,37,.1); }

/* 统计块 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.stat.ok::before { background: var(--ok); }
.stat.warn::before { background: var(--warn); }
.stat.fault::before { background: var(--fault); }
.stat.offline::before { background: var(--offline); }
.stat.neutral::before { background: var(--accent-cyan); }
.stat-num { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.stat.ok .stat-num { color: var(--ok); }
.stat.warn .stat-num { color: var(--warn); }
.stat.fault .stat-num { color: var(--fault); }
.stat.offline .stat-num { color: var(--offline); }

/* 图表容器 */
.chart-wrap { position: relative; height: 260px; width: 100%; }

/* 部件瓦片 */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }

/* ---------- 周报 / 月报（QC21 抄表数据） ---------- */
.report-filter {
  display: flex; align-items: center; flex-wrap: wrap; gap: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
}
.rf-group { display: flex; align-items: center; gap: 8px; }
.rf-group label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.rf-group select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  min-width: 120px;
}
.rf-group select:focus { outline: none; border-color: var(--accent-cyan); }
.rf-note {
  font-size: 12px; color: var(--text-tertiary);
  margin-left: auto;
}
/* 汇总卡 */
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.report-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-cyan);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.report-card.ok { border-left-color: var(--ok); }
.report-card.bad { border-left-color: var(--fault); }
.rc-name { font-size: 13px; color: var(--text-dim); font-weight: 600; margin-bottom: 6px; }
.rc-val { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.rc-val .rc-unit { font-size: 13px; color: var(--text-faint); font-weight: 500; margin-left: 4px; }
.rc-meta { font-size: 12px; color: var(--text-faint); margin-top: 6px; }
/* 图表卡 */
.report-chart-card { margin-bottom: 14px; }
.rc-chart-wrap { position: relative; height: 300px; padding: 8px 4px 4px; }
/* 明细表 */
.report-table-card { margin-bottom: 6px; }
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.report-table th, .report-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.report-table thead th {
  background: var(--panel-2);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.report-table tbody tr:hover { background: var(--panel-2); }
.report-table td.num, .report-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table td.rk { font-weight: 600; }
.report-table td.cur { background: var(--accent-soft); font-weight: 700; }
.report-table td.ok { color: var(--ok); }
.report-table td.bad { color: var(--fault); }
.report-table tr.overall td { font-weight: 700; border-top: 2px solid var(--border); }
.report-table tr.idle td { color: var(--offline); }
.report-table tr.idle td.rk { color: var(--text-dim); }
.tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
  cursor: pointer;
  transition: all .18s;
  position: relative;
}
.tile:hover { border-color: var(--accent-cyan); transform: translateY(-2px); box-shadow: var(--shadow); }
.tile.special { border-color: var(--accent-yellow); }
.tile-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tile-name { font-size: 14px; font-weight: 600; }
.tile-rows { display: flex; flex-direction: column; gap: 7px; }
.tile-row { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.tile-row .k { color: var(--text-dim); }
.tile-row .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.tile-foot .arrow { color: var(--accent-cyan); font-size: 13px; }

/* 设备状态一览 — 分组（横向排列） */
.tile-group { display: contents; }
.tile-group-title {
  grid-column: 1 / -1;
  font-size: 14px; font-weight: 700; color: var(--accent-cyan);
  margin-top: 6px; margin-bottom: 2px;
  display: flex; align-items: center; gap: 8px;
}
.tile-group:first-child .tile-group-title { margin-top: 0; }
.tile-group-count {
  font-size: 11px; font-weight: 500; color: var(--text-faint);
  background: var(--surface-inset); padding: 1px 8px; border-radius: 10px;
}

/* 钢丝绳统计 */
.wr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.wr-stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: all .18s; }
.wr-stat:hover { border-color: var(--accent-cyan); transform: translateY(-2px); }
.wr-name { font-size: 13px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.wr-val { font-size: 30px; font-weight: 800; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.wr-val .unit { font-size: 14px; color: var(--text-dim); font-weight: 500; margin-left: 3px; }
.wr-limit { font-size: 12px; color: var(--text-faint); }
.wr-stat.warn .wr-val { color: var(--warn); }
.wr-stat.fault .wr-val { color: var(--fault); }
.wr-stat.normal .wr-val { color: var(--ok); }

/* ---------- 维保记录表格 ---------- */
.maint-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.maint-search { flex: 1 1 220px; min-width: 180px; position: relative; }
.maint-search .input { padding-left: 34px; }
.maint-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.filter-group { display: flex; gap: 6px; }
.filter-btn { padding: 8px 14px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text-dim); border-radius: var(--radius-sm); font-size: 13px; white-space: nowrap; }
.filter-btn.active { border-color: var(--accent-cyan); color: var(--accent-cyan); background: var(--accent-soft); }
.date-range { display: flex; gap: 6px; align-items: center; }
.date-range .input { width: auto; padding: 8px 10px; font-size: 13px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.data thead th {
  text-align: left; padding: 12px 14px;
  background: var(--table-head-bg); color: var(--text-dim);
  font-weight: 600; font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
table.data tbody tr { cursor: pointer; transition: background .12s; }
table.data tbody tr:hover { background: var(--hover-bg); }
table.data tbody tr:last-child td { border-bottom: none; }
.empty-row { text-align: center; color: var(--text-faint); padding: 30px !important; }

/* ---------- 组织架构 ---------- */
.org-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.org-search { flex: 1 1 200px; min-width: 160px; }
.org-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.org { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.org thead th { text-align: left; padding: 12px 14px; background: var(--table-head-bg); color: var(--text-dim); font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.org tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
table.org tbody tr:last-child td { border-bottom: none; }
.org-actions { display: flex; gap: 6px; }
.icon-btn { width: 30px; height: 30px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); border-radius: 7px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.icon-btn.danger:hover { border-color: var(--fault); color: var(--fault); }

/* ---------- 报告书架 ---------- */
.report-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.report-search { flex: 1 1 220px; min-width: 180px; position: relative; }
.report-search .input { padding-left: 34px; }
.report-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.report-year-group { margin-bottom: 26px; }
.report-year-title { font-size: 16px; font-weight: 700; color: var(--accent-cyan); margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.report-year-title .count { font-size: 12px; color: var(--text-faint); font-weight: 500; }
.shelf { display: flex; gap: 16px; overflow-x: auto; padding: 6px 2px 14px; }
.book {
  flex: 0 0 auto;
  width: 150px;
  background: linear-gradient(160deg, var(--book-a), var(--book-b));
  border: 1px solid var(--border);
  border-radius: 8px 14px 14px 8px;
  padding: 18px 14px 16px;
  cursor: pointer;
  position: relative;
  transition: all .2s;
  overflow: hidden;
}
.book::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--accent-pink), var(--accent-cyan));
}
.book:hover { transform: translateY(-6px) rotate(-1deg); box-shadow: var(--shadow); border-color: var(--accent-cyan); }
.book-month { font-size: 12px; color: var(--text-dim); }
.book-title { font-size: 14px; font-weight: 700; margin: 8px 0; line-height: 1.35; min-height: 38px; }
.book-meta { font-size: 11px; color: var(--text-faint); display: flex; flex-direction: column; gap: 3px; }
.book-cover {
  height: 60px; margin-bottom: 10px; border-radius: 6px;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}

/* ---------- 系统设置 ---------- */
/* ---------- 百科知识 ---------- */
.wiki-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
@media (max-width: 768px) { .wiki-grid { grid-template-columns: repeat(2, 1fr); } }
.wiki-card {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; text-align: center; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.wiki-card:hover { border-color: var(--accent-cyan); transform: translateY(-2px); }
.wiki-card-icon { width: 64px; height: 64px; margin: 0 auto 8px; }
.wiki-card-icon img { width: 100%; height: 100%; object-fit: contain; }
.wiki-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.wiki-card-steps { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.wiki-back-btn { margin-left: auto; background: none; border: 1px solid var(--border); color: var(--accent-cyan); font-size: 12px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.wiki-back-btn:hover { background: var(--accent-soft); }
.wiki-steps { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.wiki-step {
  display: flex; gap: 12px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
}
.wiki-step-num {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%;
  background: var(--accent-cyan); color: #0a192f; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
html.light .wiki-step-num { color: #fff; }
.wiki-step-body { flex: 1; }
.wiki-step-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.wiki-step-content { font-size: 13px; color: var(--text-dim); line-height: 1.7; margin: 0 0 8px; }
.wiki-step-imgs { display: flex; gap: 8px; flex-wrap: wrap; }
.wiki-step-imgs img {
  max-width: 220px; max-height: 140px; object-fit: contain;
  border-radius: 6px; border: 1px solid var(--border); background: #fff;
}
html.light .wiki-step-imgs img { background: #f8fafc; }
.wiki-back-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.wiki-detail-title { font-size: 16px; font-weight: 700; color: var(--text); }
.wiki-back-btn { margin-left: 0; }
.lang-select { max-width: 110px; font-size: 13px; padding: 5px 8px; }

.settings-group { margin-bottom: 22px; }
.settings-group h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: var(--accent-cyan); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--border-subtle); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; }
.setting-desc { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.toggle {
  width: 46px; height: 26px; border-radius: 14px;
  background: var(--surface-inset); border: 1px solid var(--border);
  position: relative; cursor: pointer; transition: background .2s; flex: 0 0 auto;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--text-dim); transition: all .2s;
}
.toggle.on { background: var(--accent-soft); border-color: var(--accent-cyan); }
.toggle.on::after { left: 22px; background: var(--accent-cyan); }

/* ---------- AI 面板 ---------- */
.ai-panel {
  width: var(--ai-w);
  flex: 0 0 auto;
  background: var(--sidebar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  transition: width .25s ease, margin .25s ease;
  z-index: 20;
}
.ai-panel.collapsed { width: 0; border-left: none; overflow: hidden; }
.ai-resize {
  position: absolute; left: -4px; top: 0; bottom: 0;
  width: 8px; cursor: col-resize; z-index: 5;
}
.ai-resize:hover { background: var(--accent-soft); }
.ai-head {
  height: 52px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.ai-head-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; }
.ai-head-title .ai-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent-cyan); box-shadow: 0 0 8px var(--accent-cyan); }
.ai-close { width: 32px; height: 32px; border: none; background: transparent; color: var(--text-dim); font-size: 18px; border-radius: 7px; }
.ai-close:hover { background: var(--panel-2); color: var(--text); }
.ai-messages { flex: 1 1 auto; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ai-msg { display: flex; gap: 9px; max-width: 88%; }
.ai-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-avatar { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 15px; }
/* AI 消息头像（avatar.png 图片版） */
.ai-avatar-img {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  flex: 0 0 auto;
  display: block;
}
.ai-msg.bot .ai-avatar { background: linear-gradient(135deg, var(--grad-cyan-a), var(--grad-cyan-b)); }
.ai-msg.user .ai-avatar { background: linear-gradient(135deg, var(--grad-pink-a), var(--grad-pink-b)); }
.ai-bubble { padding: 10px 13px; border-radius: 12px; font-size: 13.5px; line-height: 1.55; word-break: break-word; }
.ai-msg.bot .ai-bubble { background: var(--panel-2); border: 1px solid var(--border); border-top-left-radius: 3px; }
.ai-msg.user .ai-bubble { background: var(--accent-soft); border: 1px solid var(--border); border-top-right-radius: 3px; }
.ai-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.ai-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); animation: blink 1.2s infinite; }
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .3; } 40% { opacity: 1; } }
.ai-input-row { flex: 0 0 auto; display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.ai-input { flex: 1 1 auto; padding: 10px 13px; background: var(--surface-inset); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; outline: none; resize: none; max-height: 90px; }
.ai-input:focus { border-color: var(--accent-cyan); }
.ai-send { width: 42px; flex: 0 0 auto; }
.ai-quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 10px; }
.ai-quick-btn { padding: 5px 11px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); border-radius: 16px; font-size: 12px; }
.ai-quick-btn:hover { border-color: var(--accent-cyan); color: var(--accent-cyan); }

/* 桌面端 AI 面板 */

/* ============================================================
 * 弹窗 (Modal)
 * ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 560px;
  max-height: 86vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transform: translateY(14px) scale(.98);
  transition: transform .22s;
  overflow: hidden;
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-overlay.wide .modal { max-width: 920px; }
@media (max-width: 768px) { .modal-overlay.wide .modal { max-width: 100%; } }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal-close { width: 34px; height: 34px; border: none; background: transparent; color: var(--text-dim); font-size: 20px; border-radius: 8px; }
.modal-close:hover { background: var(--panel-2); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* 历史时间轴 */
.hist-timeline { position: relative; padding-left: 28px; }
.hist-timeline::before {
  content: ''; position: absolute; left: 13px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.hist-item { position: relative; padding-bottom: 22px; }
.hist-item:last-child { padding-bottom: 0; }
.hist-item.current .hist-marker { transform: scale(1.15); }
.hist-marker {
  position: absolute; left: -28px; top: 2px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--marker-color, var(--text-faint));
  display: flex; align-items: center; justify-content: center;
  z-index: 1; transition: transform .15s;
}
.hist-marker-icon { font-size: 12px; font-weight: 700; color: var(--marker-color, var(--text-faint)); }
.hist-content { padding-left: 4px; }
.hist-date { font-size: 11px; color: var(--text-faint); margin-bottom: 3px; }
.hist-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.hist-desc { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* 切换集团/港口 */
.switch-group { margin-bottom: 18px; }
.switch-group h4 { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.switch-list { display: flex; flex-direction: column; gap: 8px; }
.switch-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; background: var(--panel-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s;
}
.switch-item:hover { border-color: var(--accent-cyan); }
.switch-item.active { border-color: var(--accent-cyan); background: var(--accent-soft); }
.switch-item .name { font-size: 14px; font-weight: 600; }
.switch-item .check { color: var(--accent-cyan); opacity: 0; }
.switch-item.active .check { opacity: 1; }
.switch-ports { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.switch-port {
  padding: 7px 13px; border: 1px solid var(--border); background: var(--surface-inset);
  border-radius: 16px; font-size: 13px; cursor: pointer; transition: all .15s;
}
.switch-port:hover { border-color: var(--accent-cyan); }
.switch-port.active { border-color: var(--accent-cyan); background: var(--accent-soft); color: var(--accent-cyan); }

/* 树状切换弹窗 */
.tree-switch { display: flex; flex-direction: column; gap: 14px; }
.tree-group { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.tree-group.active { border-color: var(--accent-cyan); }
.tree-node {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px; font-size: 14px; cursor: pointer;
  transition: background .15s;
}
.tree-node-group { font-weight: 600; background: var(--panel-2); }
.tree-node-group:hover { background: var(--surface-inset); }
.tree-group.active .tree-node-group { background: var(--accent-soft); color: var(--accent-cyan); }
.tree-arrow { font-size: 12px; color: var(--text-dim); transition: transform .2s; }
.tree-name { flex: 1; }
.tree-ports { padding: 4px 0 6px 24px; }
.tree-node-port {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  transition: background .15s; position: relative;
}
.tree-node-port::before {
  content: ''; position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 1px; background: var(--border);
}
.tree-node-port:hover { background: var(--panel-2); }
.tree-node-port.active { background: var(--accent-soft); color: var(--accent-cyan); }
.tree-node-port input[type="radio"] { margin: 0; width: 14px; height: 14px; accent-color: var(--accent-cyan); }
.tree-home {
  margin-top: 8px; padding: 12px 14px;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
}
.tree-home-label { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-bottom: 8px; letter-spacing: 1px; }
.tree-home-options { display: flex; gap: 16px; flex-wrap: wrap; }
.tree-home-option {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer;
}
.tree-home-option input[type="radio"] { width: 14px; height: 14px; accent-color: var(--accent-cyan); }

/* 3D 地图/港口场景容器 */
.map-container {
  width: 100%; height: 420px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel-2);
  position: relative;
  margin-bottom: 16px;
}
.map-view { width: 100%; height: 100%; position: relative; }
.map-view canvas { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.map-static-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.map-container .map-back-btn {
  position: absolute; top: 12px; left: 12px;
  padding: 6px 14px; border-radius: 16px;
  background: rgba(0,0,0,.5); color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  font-size: 12px; cursor: pointer; z-index: 10;
  backdrop-filter: blur(4px);
}
.map-container .map-back-btn:hover { background: rgba(0,0,0,.7); }
.map-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-cyan); font-size: 14px;
  background: var(--panel-2);
  z-index: 5;
}
.map-loading.error { color: var(--danger); }

/* ---------- QC21 小车轨道 tab ---------- */
.track-summary-card {
  margin-bottom: 16px;
  border-left: 4px solid var(--warn);
}
.track-summary {
  display: flex; align-items: flex-start; gap: 14px;
}
.track-summary-icon {
  font-size: 28px; line-height: 1; margin-top: 2px;
}
.track-summary-text { flex: 1; }
.track-summary-line1 {
  font-size: 15px; font-weight: 600; color: var(--warn);
  margin-bottom: 4px;
}
.track-summary-line2 {
  font-size: 13px; color: var(--text-dim);
}
.track-summary-line2 b { color: var(--text); }

.stat[data-kind] {
  cursor: pointer; transition: transform 0.15s, border-color 0.15s;
}
.stat[data-kind]:hover {
  transform: translateY(-2px);
  border-color: var(--fault);
}
.stat-hint {
  font-size: 12px; color: var(--fault); opacity: 0.7;
}

.track-legend {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  margin-bottom: 10px; font-size: 12px; color: var(--text-dim);
}
.track-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.track-legend .lg-fault { color: var(--fault); }
.track-legend .lg-ok { color: var(--ok); }
.track-legend .lg-hinge { color: var(--accent-yellow); }
.track-legend .lg-note { color: var(--text-dim); }

.track-svg-pan {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  cursor: grab;
  user-select: none;
}
.track-svg-pan:active {
  cursor: grabbing;
}
.track-svg-pan svg {
  display: block;
}
.track-image-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.track-image-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.track-image-label {
  font-size: 12px;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.track-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}
@media (max-width: 600px) {
  .track-image-row {
    grid-template-columns: 1fr;
  }
}
.track-drag-hint {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 8px;
}
.track-tools {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.track-tools .tbtn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}
.track-tools .tbtn:hover {
  background: var(--accent-cyan);
  color: #000;
  border-color: var(--accent-cyan);
}

.track-fault-table {
  width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px;
}
.track-fault-table thead th {
  text-align: left; padding: 8px 10px;
  background: var(--panel-2);
  color: var(--text-dim); font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.track-fault-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.track-fault-table .tt-code {
  font-weight: 700; font-family: ui-monospace, monospace;
  color: var(--fault);
}
.track-fault-table .tt-detail {
  color: var(--text-dim); font-size: 12px;
}
.track-fault-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
  background: var(--fault); color: #fff; opacity: 0.9;
}
@media (max-width: 768px) {
  .map-container { height: 280px; }
}

/* 设置弹窗（用户） */
.user-profile { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.user-avatar-lg { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, var(--grad-pink-a), var(--grad-pink-b)); display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; color: #fff; }
.user-name { font-size: 17px; font-weight: 700; }
.user-role { font-size: 13px; color: var(--text-dim); }
.logout-row { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

/* 维保详情 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.detail-item .k { font-size: 12px; color: var(--text-faint); }
.detail-item .v { font-size: 15px; font-weight: 600; margin-top: 3px; }
.detail-desc { font-size: 14px; line-height: 1.7; color: var(--text-dim); background: var(--panel-2); border-radius: var(--radius-sm); padding: 14px; }

/* 钢丝绳详情 */
.wr-detail-img {
  width: 100%; height: 200px;
  background: linear-gradient(135deg, var(--panel-2), var(--surface-inset));
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 56px; margin-bottom: 16px;
  position: relative; overflow: hidden;
}
.wr-detail-img::after { content: '钢丝绳检测图像（占位）'; position: absolute; bottom: 10px; font-size: 12px; color: var(--text-faint); }
.wr-detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.wr-detail-stat { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.wr-detail-stat .v { font-size: 22px; font-weight: 800; }
.wr-detail-stat .k { font-size: 12px; color: var(--text-dim); margin-top: 3px; }

/* 报告详情 */
.report-detail-cover { height: 140px; border-radius: var(--radius-sm); background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 48px; margin-bottom: 16px; }
.report-detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================
 * PWA 安装引导横幅（移动端）
 * ============================================================ */
.pwa-banner {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 90;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  transform: translateY(100%);
  transition: transform .3s ease;
  box-shadow: 0 -8px 30px rgba(0,0,0,.12);
}
html:not(.light) .pwa-banner {
  background: rgba(10, 25, 47, .75);
  box-shadow: 0 -8px 30px rgba(0,0,0,.25);
}
.pwa-banner.show { transform: translateY(0); }
.pwa-icon {
  width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 10px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.pwa-text { flex: 1 1 auto; min-width: 0; }
.pwa-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.pwa-steps { display: flex; flex-direction: column; gap: 2px; }
.pwa-step { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.pwa-btn { flex: 0 0 auto; padding: 8px 16px; font-size: 13px; }
.pwa-close {
  position: absolute; top: 8px; right: 10px;
  width: 26px; height: 26px;
  border: none; background: transparent;
  color: var(--text-faint); font-size: 16px;
  border-radius: 6px; cursor: pointer;
}
.pwa-close:hover { background: var(--panel-2); color: var(--text); }

/* Toast */
.toast-wrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  padding: 11px 20px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 9px;
  animation: toastIn .25s ease;
}
.toast.success { border-color: var(--ok); }
.toast.success .t-icon { color: var(--ok); }
.toast.info .t-icon { color: var(--accent-cyan); }
.toast.error { border-color: var(--fault); }
.toast.error .t-icon { color: var(--fault); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
 * 磁贴可点击
 * ============================================================ */
.tile .arrow { color: var(--accent-cyan); font-size: 12px; margin-left: auto; }

/* ============================================================
 * 机构详情页
 * ============================================================ */
/* 机构趋势图：两图并排，移动端堆叠 */
.mech-trend-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px;
}
.mech-trend-card { min-width: 0; }
.mech-trend-chart { height: 220px; }

/* 门限设置表格 */
.th-filter { display: flex; gap: 12px; margin-bottom: 14px; }
.th-filter select {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-size: 13px; color: var(--text); cursor: pointer;
}
.th-table-wrap { overflow-x: auto; margin-bottom: 14px; }
.th-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 900px; }
.th-table th, .th-table td {
  padding: 8px 10px; border: 1px solid var(--border); text-align: center; white-space: nowrap;
}
.th-table thead th {
  background: var(--panel-2); color: var(--text-dim); font-weight: 600;
  position: sticky; top: 0; z-index: 1;
}
.th-table .th-row-h {
  text-align: left; font-weight: 600; color: var(--text);
  background: var(--panel-2); min-width: 140px;
}
.th-cell { color: var(--text); cursor: text; }
.th-cell:hover { background: var(--hover-bg); }
.th-cell-check { text-align: center; }
.th-cell-check input[type="checkbox"] { width: 16px; height: 16px; cursor: default; }
.th-summary {
  display: flex; justify-content: flex-end; gap: 16px; font-size: 12px; color: var(--text-dim);
  flex-wrap: wrap;
}
.th-summary b { color: var(--text); }
.th-summary .th-warn b { color: var(--warn); }
.th-summary .th-fault b { color: var(--fault); }

/* 测点网格 */
.mech-points-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px;
}
/* 紧凑模式：自适应列数，卡片约 180px 宽 */
.mech-points-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px;
}
.mech-point {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; transition: border-color .2s; cursor: pointer;
}
.mech-point:hover { border-color: var(--accent-cyan); }
.mech-point.warn { border-left: 3px solid var(--warn); }
.mech-point.fault { border-left: 3px solid var(--fault); }
.mech-point-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.mech-point-icon { font-size: 18px; flex-shrink: 0; }
.mech-point-name { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.mech-point-body { margin-bottom: 8px; }
.mech-point-val { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.1; margin-bottom: 8px; }
.mech-point-unit { font-size: 13px; color: var(--text-dim); font-weight: 400; margin-left: 4px; }
.mech-point-bar { height: 4px; background: var(--surface-inset); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.mech-point-bar-fill { height: 100%; border-radius: 2px; transition: width .4s ease; }

/* 紧凑卡片样式 */
.mech-point.compact { padding: 10px 12px; }
.mech-point.compact .mech-point-val { font-size: 16px; margin-bottom: 5px; }
.mech-point.compact .mech-point-name { font-size: 11px; }
.mech-point.compact .mech-point-icon { font-size: 14px; }

/* 部件类别分组 */
.mech-cat-block { margin-bottom: 18px; }
.mech-cat-block:last-child { margin-bottom: 0; }
.mech-cat-title {
  font-size: 13px; font-weight: 700; color: var(--accent-cyan);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.mech-cat-count {
  font-size: 11px; font-weight: 500; color: var(--text-faint);
  background: var(--surface-inset); padding: 1px 8px; border-radius: 10px;
}

/* 设备仿真图 */

/* 波形分析 */
.wf-filter { margin-bottom: 12px; }
.wf-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.wf-chart-card {
  background: var(--surface-inset);
  border-radius: 8px;
  padding: 12px 14px;
}
.wf-chart-card.span2 {
  grid-column: span 2;
}
.wf-chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.wf-chart-card .chart-wrap {
  height: 180px;
}
.wf-chart-card.span2 .chart-wrap {
  height: 220px;
}
@media (max-width: 768px) {
  .wf-grid { grid-template-columns: 1fr; }
  .wf-chart-card.span2 { grid-column: span 1; }
}

/* 采集站 */
.collector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.collector-card.full-width {
  grid-column: 1 / -1;
}
.collector-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ci-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ci-row:last-child { border-bottom: none; }
.ci-label {
  color: var(--text-dim);
  min-width: 80px;
}
.ci-val {
  color: var(--text);
  font-weight: 500;
  text-align: right;
}
.ci-val.mono, .mono {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
}
.collector-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.collector-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
}
.collector-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.collector-table tr:last-child td { border-bottom: none; }
.ct-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-faint);
}
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.sensor-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}
.sensor-ch {
  background: var(--surface-inset);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sensor-ch-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
}
.sensor-ch-status {
  font-size: 11px;
  font-weight: 500;
}
.sensor-ch-status.ok { color: var(--ok); }
.sensor-ch-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.sensor-sub-title {
  margin-top: 18px;
}
@media (max-width: 768px) {
  .collector-grid { grid-template-columns: 1fr; }
  .sensor-grid { grid-template-columns: repeat(2, 1fr); }
}

/* 监测站状态卡片 */
.station-card .station-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}
.station-item {
  background: var(--surface-inset); border-radius: 8px;
  padding: 12px 16px;
}
.station-label {
  font-size: 12px; color: var(--text-dim); margin-bottom: 4px;
}
.station-val {
  font-size: 16px; font-weight: 700; color: var(--text);
}
.station-val .station-sub {
  font-size: 11px; font-weight: 400; color: var(--text-faint);
}

.mech-sim-wrap { position: relative; }
.mech-sim-svg {
  width: 100%; height: auto; max-height: 380px;
  background: var(--accent-softer);
  border-radius: 10px; border: 1px solid var(--border);
}
.sim-dot:hover circle:nth-child(2) { stroke-width: 3; filter: drop-shadow(0 0 6px currentColor); }
.sim-legend {
  display: flex; gap: 18px; margin-top: 10px; padding: 0 4px;
  font-size: 12px; color: var(--text-dim);
}
.sim-legend-item { display: flex; align-items: center; gap: 6px; }
.sim-legend-item i {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}

/* 钢丝绳实况图 */
.wr-live-img { border-radius: 10px; overflow: hidden; }

/* 钢丝绳页顶部：实况 + 应力图表 并排 */
.wr-top-card { max-height: 500px; }
.wr-top-row { display: flex; gap: 16px; align-items: stretch; height: 440px; }
.wr-top-row .wr-live-img { flex: 1; min-width: 0; }
.wr-stress-chart { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.wr-chart-title { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; text-align: right; }
.wr-stress-chart canvas { flex: 1; min-height: 0; }
@media (max-width: 768px) {
  .wr-top-row { flex-direction: column; height: auto; }
  .wr-top-row .wr-live-img { height: 260px; }
  .wr-stress-chart { height: 260px; }
}

/* 机构总览卡片（设备态势页） */
.mech-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
@media (max-width: 640px) { .mech-cards-grid { grid-template-columns: 1fr; } }
.mech-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px; border-radius: 12px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--border);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.mech-card:hover { transform: translateY(-3px); border-color: var(--accent-cyan); box-shadow: var(--shadow); }
.mech-card-top { display: flex; align-items: center; gap: 10px; }
.mech-card-icon { font-size: 28px; line-height: 1; }
.mech-card-name { font-size: 15px; font-weight: 700; color: var(--text); flex: 1; }
.mech-card-meta { display: flex; align-items: center; gap: 8px; }
.mech-card-tag {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  background: var(--surface-inset); color: var(--text-dim); white-space: nowrap;
}
.mech-card-desc { font-size: 11px; color: var(--text-dim); }
.mech-card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.mech-card-time { font-size: 10px; color: var(--text-dim); opacity: .7; }
.mech-card-arrow {
  font-size: 18px; color: var(--text-dim); opacity: .5;
  transition: opacity .2s, transform .2s;
}
.mech-card:hover .mech-card-arrow { opacity: 1; transform: translateX(2px); color: var(--accent-cyan); }

/* 振温一体卡片：振动为主（第一行），温度为辅（第二行） */
.vt-card { padding: 10px; }
.vt-main { margin-top: 6px; }
.vt-row { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; margin-bottom: 3px; }
.vt-row.sub { margin-top: 8px; }
.vt-tag { font-size: 10px; color: var(--text-dim); white-space: nowrap; }
.vt-val { font-size: 16px; font-weight: 700; line-height: 1.2; }
.vt-row.sub .vt-val { font-size: 13px; font-weight: 600; opacity: .85; }
.vt-unit { font-size: 9px; font-weight: 500; opacity: .7; margin-left: 1px; }

/* 振温双轴图：横向指标行（无卡片，仅数值 label） */
.pd-metrics-row { display: flex; gap: 22px; margin-bottom: 14px; flex-wrap: wrap; }
.pd-metric { display: flex; align-items: baseline; gap: 9px; white-space: nowrap; }
.pd-metric-label { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.pd-metric-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mc, var(--text-faint)); display: inline-block; }
.pd-metric-val { font-size: 17px; font-weight: 700; color: var(--mc, var(--text)); }
.pd-metric-sub { font-size: 11px; color: var(--text-faint); }
.pd-metric-sub-inline { font-size: 10px; color: var(--text-faint); font-weight: 400; }
.pd-chart-lg { height: 260px; }

/* 应力监测：光纤光栅解调仪通道网格 */
.fbg-summary { display: flex; gap: 16px; margin-bottom: 12px; font-size: 13px; font-weight: 600; }
.fbg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; }
.fbg-ch {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 4px; border-radius: 6px; cursor: default;
  background: var(--panel-2); border: 1px solid var(--border);
  transition: transform .15s, border-color .15s;
}
.fbg-ch:hover { transform: scale(1.05); border-color: var(--accent-cyan); }
.fbg-ch.warn { border-color: var(--warn); }
.fbg-ch.fault { border-color: var(--fault); background: var(--fault-soft); }
.fbg-ch-id { font-size: 10px; font-weight: 700; color: var(--text-dim); }
.fbg-ch-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* 测点详情弹窗 */
.pd-header {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px;
}
.pd-stat {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; text-align: center;
}
.pd-stat .v { font-size: 20px; font-weight: 700; color: var(--text); }
.pd-stat .k { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.pd-desc {
  font-size: 12px; color: var(--text-dim); line-height: 1.5;
  background: var(--panel-2); border-radius: 6px; padding: 10px 12px; margin-bottom: 14px;
}
.pd-filter { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.pd-chart { height: 220px; }

/* ============================================================
 * 响应式
 * ============================================================ */
@media (max-width: 768px) {
  :root { --header-h: 52px; }
  .header { padding: 0 10px; }
  .crumb { font-size: 14px; }
  .crumb-change { display: none; }
  .sidebar {
    position: fixed; top: var(--header-h); bottom: 0; left: 0;
    width: min(300px, 85vw);
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: min(300px, 85vw); }
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-caret,
  .sidebar.collapsed .nav-sub,
  .sidebar.collapsed .sidebar-title { display: block; }
  .sidebar-collapse-btn { display: none; }
  .content-head { padding: 12px 14px 0; }
  .content-body { padding: 14px 14px 90px; }
  .content-title { font-size: 17px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-num { font-size: 24px; }
  .tile-grid { grid-template-columns: 1fr; }
  .mech-points-grid { grid-template-columns: 1fr; }
  .mech-trend-row { grid-template-columns: 1fr; }
  .mech-trend-chart { height: 200px; }
  .mech-point-val { font-size: 22px; }
  .wr-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .wr-detail-stats { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; }
  .ai-panel {
    position: fixed; top: var(--header-h); right: 0; bottom: 0;
    width: min(360px, 92vw);
    transform: translateX(100%);
    transition: transform .28s ease;
    box-shadow: var(--shadow);
  }
  .ai-panel.collapsed { transform: translateX(100%); width: min(360px, 92vw); }
  .ai-panel.open-mobile { transform: translateX(0); }
  .ai-resize { display: none; }
  .forecast-row { grid-template-columns: repeat(2, 1fr); }
  .weather-meta { margin-left: 0; width: 100%; }
}
@media (min-width: 769px) {
  .sidebar-overlay { display: none; }
}

/* 打印 */
@media print {
  .sidebar, .ai-panel, .header { display: none !important; }
  body { overflow: visible; }
}

/* ============================================================
 * 主题切换按钮（胶囊滑块）
 * ============================================================ */
.theme-switch {
  width: 52px; height: 28px; border-radius: 14px;
  position: relative; cursor: pointer; flex: 0 0 auto;
  transition: background .25s ease;
  display: flex; align-items: center;
}
.theme-switch.dark { background: #1e293b; }
.theme-switch.dark .theme-icon { left: 26px; }
.theme-switch.light { background: #e2e8f0; }
.theme-switch.light .theme-icon { left: 4px; }
.theme-icon {
  position: absolute; top: 2px;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: left .25s ease, background .25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.theme-switch.dark .theme-icon { background: #334155; }
.theme-switch.light .theme-icon { background: #ffffff; }
