/* =============================================================================
 * 依朵智控 · 样式
 * 纯 CSS，无框架、无构建。浅色为默认，支持跟随系统与手动切换深色。
 * ========================================================================== */

:root {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #f1f3fa;
  --line: #e7eaf3;
  --line-strong: #d8dceb;
  --text: #17203a;
  --text-2: #5a6580;
  --text-3: #939db4;
  --primary: #5b63f0;
  --primary-2: #7c5cf5;
  --primary-soft: #eeeefe;
  --primary-ink: #4b52d8;
  --green: #16b47c;
  --green-soft: #e5f8f0;
  --amber: #e99223;
  --amber-soft: #fff4e2;
  --red: #e0525c;
  --red-soft: #ffeded;
  --shadow: 0 1px 2px rgba(24, 36, 74, .04), 0 8px 28px rgba(24, 36, 74, .06);
  --shadow-lg: 0 12px 40px rgba(24, 36, 74, .12);
  --radius: 20px;
  --radius-sm: 13px;
  --grad: linear-gradient(125deg, #4f57e8 0%, #6a5cf0 46%, #8a5be8 100%);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC",
          "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --card-h: 398px;      /* 所有设备卡片统一高度 */
}

html[data-theme="dark"] {
  --bg: #0d1220;
  --bg-soft: #121a2c;
  --surface: #171f31;
  --surface-2: #1c253a;
  --surface-3: #222c43;
  --line: #28324a;
  --line-strong: #36415d;
  --text: #eaf0ff;
  --text-2: #a3afca;
  --text-3: #74809c;
  --primary: #8189ff;
  --primary-2: #a184ff;
  --primary-soft: #262a52;
  --primary-ink: #a9b0ff;
  --green: #36d39a;
  --green-soft: #123a2e;
  --amber: #f0ac4e;
  --amber-soft: #3a2c17;
  --red: #ff7a83;
  --red-soft: #3d2229;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 8px 28px rgba(0, 0, 0, .22);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* 弹窗用了 display:grid/flex，必须压过 hidden */
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
::selection { background: rgba(91, 99, 240, .22); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== 顶栏 ===================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 11px 22px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 186px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; background: var(--grad);
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px rgba(91, 99, 240, .32);
}
.brand-mark svg { width: 22px; height: 22px; stroke-width: 2.2; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 16px; letter-spacing: .2px; }
.brand-text span { font-size: 9.5px; letter-spacing: 1.7px; color: var(--text-3); font-weight: 700; }

.topnav { display: flex; gap: 4px; margin: 0 auto; }
.topnav-btn {
  border: 0; background: transparent; color: var(--text-2);
  padding: 8px 15px; border-radius: 11px; display: flex; align-items: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; transition: .18s;
}
.topnav-btn svg { width: 17px; height: 17px; }
.topnav-btn:hover { background: var(--surface-3); color: var(--text); }
.topnav-btn.is-active { background: var(--primary-soft); color: var(--primary-ink); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.cloud-pill {
  display: flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  background: var(--surface-2); border-radius: 999px; padding: 7px 13px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.cloud-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.cloud-pill.ok .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.cloud-pill.err .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.cloud-pill.busy .dot { background: var(--amber); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 11px; color: var(--text-2); transition: .18s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn.inset { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; }

/* ===================== 布局 ===================== */
.main { max-width: 1240px; margin: 0 auto; padding: 26px 22px 120px; }
.view { display: none; animation: viewIn .28s ease both; }
.view.is-active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 20px; }
.section-head h2 { margin: 0; font-size: 21px; letter-spacing: -.3px; }
.section-head p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.head-actions { display: flex; gap: 8px; }

/* ===================== Hero ===================== */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; padding: 28px 30px;
  background: var(--grad); color: #fff; display: flex; gap: 24px;
  align-items: center; justify-content: space-between; box-shadow: 0 16px 40px rgba(79, 87, 232, .24);
}
.hero-glow {
  position: absolute; width: 460px; height: 460px; right: -110px; top: -250px;
  background: radial-gradient(circle, rgba(255,255,255,.28), transparent 62%); pointer-events: none;
}
.hero::after {
  content: ''; position: absolute; width: 320px; height: 320px; left: -140px; bottom: -250px;
  background: radial-gradient(circle, rgba(56, 189, 248, .35), transparent 65%); pointer-events: none;
}
.hero-main { position: relative; z-index: 1; min-width: 0; }
.hero-eyebrow { display: flex; align-items: center; gap: 7px; font-size: 12px; opacity: .85; font-weight: 600; letter-spacing: .3px; }
.hero-eyebrow svg { width: 15px; height: 15px; }
.hero-title { display: flex; align-items: baseline; gap: 6px; font-size: 46px; font-weight: 750; letter-spacing: -1.5px; margin: 6px 0 2px; line-height: 1.1; }
.hero-title small { font-size: 14px; font-weight: 500; opacity: .85; letter-spacing: 0; margin-left: 4px; }
.hero-slash { opacity: .5; font-weight: 400; }
.hero-sub { font-size: 13px; opacity: .82; min-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.hero-stats {
  position: relative; z-index: 1; display: flex; gap: 10px;
  background: rgba(255, 255, 255, .13); border: 1px solid rgba(255,255,255,.2);
  border-radius: 18px; padding: 14px 6px; backdrop-filter: blur(10px);
}
.hero-stat { min-width: 92px; padding: 0 14px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid rgba(255,255,255,.18); }
.hero-stat:last-child { border-right: 0; }
.hero-stat-k { font-size: 11px; opacity: .78; }
.hero-stat strong { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 12px; padding: 9px 15px;
  font-size: 13.5px; font-weight: 650; transition: .18s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 5px 14px rgba(91, 99, 240, .25); }
.btn-primary:hover { background: var(--primary-2); }
.btn-soft { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.btn-soft:hover { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
.btn-light { background: #fff; color: #3d44b8; }
.btn-light:hover { background: #f0f1ff; }
.btn-ghost-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.28); }
.btn-ghost-light:hover { background: rgba(255,255,255,.24); }
.btn-danger { background: var(--red); color: #fff; }
.btn-lg { padding: 12px 22px; font-size: 14.5px; }
.danger-text { color: var(--red); }
.btn-align-end { align-self: flex-end; height: 42px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ===================== 工具条 ===================== */
.toolbar { display: flex; align-items: center; gap: 14px; margin: 22px 0 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; transition: .18s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--surface); }
html[data-theme="dark"] .chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.searchbox {
  display: flex; align-items: center; gap: 8px; min-width: 220px; flex: 1;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 12px; height: 38px; transition: .18s;
}
.searchbox:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.searchbox svg { width: 16px; height: 16px; flex: none; color: var(--text-3); }
/* 后面的全局 input[type=search] 规则会盖掉「无边框」设置，这里提高特异性：
   搜索框只保留 label 这一层外框，聚焦时也只有 :focus-within 的一圈高亮 */
.searchbox input[type="search"],
.searchbox input[type="search"]:focus {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 0; width: 100%; height: 100%;
  border: 0; outline: 0; box-shadow: none; background: transparent;
  padding: 0; border-radius: 0; font-size: 13px;
}
.searchbox input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.searchbox input::placeholder { color: var(--text-3); }
.searchbox.slim { margin: 0 0 14px; max-width: 360px; }
.sortbox {
  display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; flex: none;
}
.sortbox svg { width: 15px; height: 15px; color: var(--text-3); }
.sortbox select {
  width: auto; border: 0; background: transparent; box-shadow: none; padding: 0 20px 0 0;
  font-size: 12.5px; font-weight: 650; color: var(--text-2);
}
.sortbox select:focus { border: 0; box-shadow: none; }

.result-line {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 16px; font-size: 11.5px; color: var(--text-3);
}
.result-line #resultCount { font-weight: 700; color: var(--text-2); }
.result-hint { display: inline-flex; align-items: center; gap: 5px; }
.result-hint svg { width: 13px; height: 13px; }
#btnEditOrder { flex: none; white-space: nowrap; }

/* 排序编辑态：给「完成 / 撤销」一个始终可见的明确出口 */
.sort-banner {
  position: sticky; top: 68px; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 16px; padding: 11px 14px;
  border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--primary-soft) 86%, var(--surface));
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  box-shadow: 0 8px 22px rgba(20, 30, 70, .09);
}
.sort-banner-icon {
  flex: none; width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; background: var(--primary); color: #fff;
}
.sort-banner-icon svg { width: 18px; height: 18px; }
.sort-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sort-banner-text strong { font-size: 12.5px; font-weight: 750; color: var(--text); }
.sort-banner-text span { font-size: 11px; color: var(--text-2); line-height: 1.45; }
.sort-banner-actions { flex: none; display: flex; gap: 8px; }
.sort-banner-actions .btn { white-space: nowrap; }

/* 分组分区 */
.device-group { margin-bottom: 26px; }
.device-group:last-child { margin-bottom: 0; }
.group-head { display: flex; align-items: center; gap: 9px; margin: 0 0 13px; }
.group-bar { width: 4px; height: 16px; border-radius: 3px; }
.group-head h3 { margin: 0; font-size: 13.5px; font-weight: 750; letter-spacing: .2px; }
.group-count {
  font-size: 10.5px; color: var(--text-3); background: var(--surface-3);
  padding: 2px 8px; border-radius: 7px; font-weight: 700;
}
.group-line { flex: 1; height: 1px; background: var(--line); margin-left: 4px; }

/* ===================== 设备卡片（统一高度） =====================
 * 结构固定为：头部 / 状态 / 读数 / 主操作(flex 吸收余量) / 说明 / 底栏。
 * 其余控件收进「全部控制」抽屉，所以每张卡严格等高、底部按钮对齐。
 * ------------------------------------------------------------------ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: stretch; }
.card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  height: var(--card-h); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  transition: box-shadow .22s, border-color .22s;
  animation: cardIn .3s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, var(--accent, var(--primary)) 0%, transparent 76%); opacity: .85;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent, var(--primary)) 32%, var(--line)); }
.card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }
.card.is-offline { opacity: .97; }
/* 自定义排序：拖拽状态与目标提示 */
.card.is-sortable { cursor: grab; }
.card.is-sortable:active { cursor: grabbing; }
.card.is-dragging { opacity: .38; transform: scale(.985); }
.card.is-drop-target { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow); }
.card.is-drop-target::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--primary); pointer-events: none;
}
.card.is-drop-target.drop-after::after { left: auto; right: 0; }
.card-head { display: flex; gap: 12px; padding: 17px 18px 10px; align-items: flex-start; flex: none; }
.card-icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  flex: none; color: #fff; box-shadow: 0 5px 14px rgba(24, 36, 74, .12);
}
.card-icon svg { width: 23px; height: 23px; stroke-width: 1.9; }
.card-title { min-width: 0; flex: 1; }
.card-title h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.2px; display: flex; align-items: center; gap: 7px; }
.card-title h3 .feat { font-size: 9px; padding: 2px 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; letter-spacing: .4px; flex: none; white-space: nowrap; }
.card-title .model { font-size: 11.5px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 名称后的小铅笔：改的是本机显示名，不动物件与云端昵称 */
.name-edit {
  width: 21px; height: 21px; flex: none; border: 0; background: transparent; color: var(--text-3);
  border-radius: 6px; display: inline-grid; place-items: center; opacity: .5; transition: .16s;
}
.name-edit svg { width: 13px; height: 13px; stroke-width: 2; }
.name-edit:hover { opacity: 1; color: var(--primary); background: var(--primary-soft); }
.card.is-sortable .name-edit { display: none; }
.card-head-actions { display: flex; gap: 4px; align-items: center; }
.mini-btn {
  width: 28px; height: 28px; border: 0; background: transparent; color: var(--text-3);
  border-radius: 8px; display: grid; place-items: center; transition: .18s;
}
.mini-btn svg { width: 16px; height: 16px; }
.mini-btn:hover { background: var(--surface-3); color: var(--primary); }
.mini-btn.is-on { color: var(--amber); }
.mini-btn.is-on svg { fill: currentColor; }
.mini-btn.spinning svg { animation: spin .8s linear infinite; }
/* 手风琴箭头：只在移动端出现（桌面端卡片本来就是全展开的） */
.card-expand { display: none; }
.card-expand.is-open { color: var(--primary); background: var(--primary-soft); }

.card-meta {
  display: flex; align-items: center; gap: 6px; padding: 0 18px 12px;
  flex: none; white-space: nowrap; overflow: hidden;
}
.badge {
  display: inline-flex; align-items: center; flex: none; min-width: 0;
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 7px;
  background: var(--surface-3); color: var(--text-2); letter-spacing: .2px;
}
.card-meta .badge:last-child { overflow: hidden; text-overflow: ellipsis; display: inline-block; }
.badge.topic { font-family: var(--mono); font-size: 10.5px; background: var(--primary-soft); color: var(--primary-ink); }
.badge.status { display: flex; align-items: center; gap: 5px; }
.badge.status .sdot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.badge.status.online { background: var(--green-soft); color: var(--green); }
.badge.status.online .sdot { background: var(--green); }
.badge.status.warn { background: var(--amber-soft); color: var(--amber); }
.badge.status.warn .sdot { background: var(--amber); }
.badge.status.muted { background: var(--surface-3); color: var(--text-3); }

.card-readout {
  position: relative; flex: none; height: 106px; overflow: hidden;
  margin: 0 18px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 9px 12px; line-height: 1.3;
}
.card-readout::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 16px;
  background: linear-gradient(transparent, var(--surface-2)); pointer-events: none;
}
.metrics { display: flex; gap: 8px; flex-wrap: nowrap; overflow: hidden; }
.metric { flex: 1 1 0; min-width: 0; }
.metric-k { font-size: 10.5px; color: var(--text-3); display: flex; align-items: center; gap: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-k svg { width: 12px; height: 12px; }
.metric-v { font-size: 18px; font-weight: 700; letter-spacing: -.6px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-v small { font-size: 11px; font-weight: 600; color: var(--text-3); margin-left: 2px; }
.raw-line { font-family: var(--mono); font-size: 11px; color: var(--text-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: 5px; padding-top: 5px;
  border-top: 1px dashed var(--line-strong); }
.raw-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 6px;
  background: var(--amber-soft); color: var(--amber); font-family: system-ui, -apple-system, "PingFang SC", sans-serif;
  font-size: 9.5px; font-weight: 700; letter-spacing: .2px; vertical-align: 1px; }
.readout-time { font-size: 10.5px; color: var(--text-3); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 主操作区：吸收卡片剩余高度，内容垂直居中，超出部分由抽屉承接 */
.card-primary {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden;
  padding: 10px 18px; display: flex; flex-direction: column; justify-content: center;
}
.card-primary .control { margin: 0; }
.card-primary .control-label { margin-bottom: 5px; font-size: 11px; line-height: 1.2; }
.card-primary .btn-row { flex-wrap: nowrap; overflow: hidden; }
.card-primary .act-btn { min-width: 0; padding: 9px 7px; font-size: 12px; }
.card-primary .control-hint { display: none; }
.card-primary .note { font-size: 11px; line-height: 1.5; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-primary .garage-btn { padding: 8px 5px 7px; gap: 3px; }
.card-primary .garage-btn svg { width: 19px; height: 19px; }
/* 主操作区也露码值：一眼看到这个按钮发的是哪个码（v1.6.4） */
.card-primary .garage-btn small { display: block; font-size: 10px; }
.card-primary .big-toggle { padding: 10px 14px; }
.card-primary .c-input, .card-primary select { padding: 8px 10px; }
.card-primary.has-more::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background: linear-gradient(transparent, var(--surface)); pointer-events: none;
}
.primary-empty { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-3); }
.primary-empty svg { width: 18px; height: 18px; }

.card-desc {
  flex: none; height: 48px; margin: 0 18px; padding: 9px 0 0;
  border-top: 1px solid var(--line); font-size: 11.5px; color: var(--text-2); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-body { border-top: 1px solid var(--line); padding: 14px 18px 18px; }
.control { margin-bottom: 14px; }
.control:last-child { margin-bottom: 0; }
.control-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.control-label svg { width: 14px; height: 14px; color: var(--text-3); }
.control-label .sub { margin-left: auto; font-weight: 500; color: var(--text-3); font-size: 10.5px; }
.control-label .param-cur {
  margin-left: auto; flex: none; max-width: 62%; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 7px;
  background: var(--primary-soft); color: var(--primary-ink);
}
.control-label .param-cur.cloud { background: var(--green-soft); color: var(--green); }
.card-primary .control-label .param-cur { display: none; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.act-btn {
  flex: 1; min-width: 78px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  padding: 9px 10px; border-radius: 11px; font-size: 12.5px; font-weight: 650;
  white-space: nowrap; transition: .16s;
}
.act-btn svg { width: 15px; height: 15px; }
.act-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.act-btn:active { transform: scale(.96); }
.act-btn.sending { opacity: .6; pointer-events: none; }
.act-btn.danger { color: var(--red); border-color: var(--line); background: var(--red-soft); }
.act-btn.danger:hover { border-color: var(--red); }
.act-btn.compact { min-width: 0; font-size: 11.5px; padding: 7px 9px; }
.act-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.act-btn.primary:hover { background: var(--primary-2); color: #fff; }
/* 参数当前值：高亮本机最后一次成功下发 / 云端状态帧对应的选项 */
.act-btn.is-current {
  border-color: var(--primary); color: var(--primary-ink); background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 40%, transparent);
}
.act-btn.is-current::after {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary); flex: none;
}

/* 大开关 */
.toggle-wrap { display: flex; align-items: center; gap: 14px; }
.big-toggle {
  flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px;
  padding: 12px 15px; font-weight: 700; font-size: 14px; transition: .2s;
}
.big-toggle .state { display: flex; align-items: center; gap: 9px; }
.big-toggle .state svg { width: 20px; height: 20px; }
.big-toggle .track { width: 48px; height: 27px; border-radius: 999px; background: var(--line-strong); position: relative; transition: .22s; }
.big-toggle .track::after { content: ''; position: absolute; width: 21px; height: 21px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .22s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.big-toggle.is-on { background: var(--green-soft); border-color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, transparent); color: var(--green); }
.big-toggle.is-on .track { background: var(--green); }
.big-toggle.is-on .track::after { transform: translateX(21px); }
.big-toggle.is-unknown { color: var(--text-3); border-style: dashed; }
.big-toggle.is-unknown .track { opacity: .5; }
.big-toggle:active { transform: scale(.985); }

/* 车库三态 */
.garage-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.garage-btn {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px;
  padding: 14px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 700; transition: .18s;
}
.garage-btn svg { width: 22px; height: 22px; }
.garage-btn small { font-family: var(--mono); font-size: 9.5px; font-weight: 500; color: var(--text-3); }
.garage-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.garage-btn.stop { color: var(--amber); }
.garage-btn.stop:hover { border-color: var(--amber); background: var(--amber-soft); color: var(--amber); }
.garage-btn:active { transform: scale(.96); }
.garage-btn.is-empty { color: var(--text-3); background: transparent; border-style: dashed; cursor: not-allowed; }
.garage-btn.is-empty:hover { border-color: var(--line); color: var(--text-3); background: transparent; transform: none; }
.garage-btn.is-empty small { color: var(--text-3); }

/* 车库门码值绑定（抽屉里） */
.gc-box { gap: 9px; }
.gc-hint { font-size: 12px; line-height: 1.7; color: var(--text-3); }
.gc-hint code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border-radius: 5px; padding: 1px 5px; }
.gc-row { display: flex; align-items: center; gap: 9px; }
.gc-row > span { flex: none; width: 42px; display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.gc-row > span svg { width: 13px; height: 13px; }
.gc-row input { font-family: var(--mono); font-size: 12.5px; }
.gc-params { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gc-params label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-3); }
.gc-params input { font-family: var(--mono); font-size: 12.5px; padding: 7px 9px; }
.gc-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.gc-acts .btn { flex: 1 1 auto; min-height: 38px; }

/* 滑块 / 下拉 / 输入框 */
select, input[type="text"], input[type="password"], input[type="search"], textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2);
  border-radius: 11px; padding: 9px 11px; outline: 0; transition: .18s; font-size: 13px;
}
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23939db4' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
textarea { resize: vertical; font-family: var(--mono); line-height: 1.6; }
select:focus, input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.range-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.range-head output { font-family: var(--mono); font-size: 12px; color: var(--primary-ink); background: var(--primary-soft); padding: 2px 8px; border-radius: 7px; }
.range-line { display: flex; align-items: center; gap: 10px; }
input[type="range"] { -webkit-appearance: none; appearance: none; flex: 1; height: 5px; border-radius: 5px;
  background: linear-gradient(90deg, var(--primary) var(--fill, 50%), var(--surface-3) var(--fill, 50%)); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 19px; height: 19px; border-radius: 50%;
  background: #fff; border: 3px solid var(--primary); box-shadow: 0 2px 6px rgba(0,0,0,.18); cursor: grab; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); cursor: grab; }
.link-btn { font-size: 11px; font-weight: 650; color: var(--primary); border: 0; background: var(--primary-soft); padding: 6px 9px; border-radius: 9px; }
.text-line { display: flex; gap: 8px; }
.text-line input { flex: 1; min-width: 0; }
.text-line .btn { flex: none; }
.control-hint { font-size: 10.5px; color: var(--text-3); margin-top: 6px; }
.note { font-size: 11.5px; color: var(--text-2); background: var(--surface-2); border-left: 3px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; line-height: 1.6; }
.note.warn { background: var(--amber-soft); border-left-color: var(--amber); color: var(--text); }
.card-link { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--primary); text-decoration: none; }
.card-link svg { width: 15px; height: 15px; }
.card-link:hover { text-decoration: underline; }

.card-foot {
  flex: none; height: 54px; border-top: 1px solid var(--line); padding: 0 14px 0 18px;
  display: flex; align-items: center; gap: 8px;
}
.card-quick {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent);
  mask-image: linear-gradient(90deg, #000 84%, transparent);
}
.card-quick .cmd-chip { flex: none; }
.card-quick .foot-note { font-size: 11px; color: var(--text-3); }
.card-foot .foot-warn { font-size: 10.5px; color: var(--amber); font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sort-bar { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; }
.sort-grip { display: grid; place-items: center; color: var(--text-3); cursor: grab; flex: none; }
.sort-grip svg { width: 16px; height: 16px; }
.sort-num { flex: none; font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  color: var(--primary-ink); background: var(--primary-soft); padding: 3px 7px; border-radius: 7px; }
.sort-tip { font-size: 10.5px; color: var(--text-3); margin-left: auto; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.mini-btn[disabled] { opacity: .3; pointer-events: none; }
.cmd-chip { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); padding: 4px 8px; border-radius: 7px; transition: .16s; }
.cmd-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.detail-btn {
  flex: none; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--primary-ink); border-radius: 10px;
  padding: 7px 10px; font-size: 11.5px; font-weight: 700; transition: .16s;
}
.detail-btn svg { width: 14px; height: 14px; }
.detail-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.detail-btn .cnt { font-family: var(--mono); font-size: 10px; opacity: .7; }
.setup-banner { margin: 0 0 14px; padding: 11px 12px; border-radius: 12px; background: var(--amber-soft);
  color: var(--amber); font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.setup-banner svg { width: 17px; height: 17px; }
.setup-banner button { margin-left: auto; border: 0; background: transparent; color: inherit; font-weight: 700; text-decoration: underline; }

.empty { text-align: center; padding: 70px 20px; color: var(--text-3); }
.empty svg { width: 36px; height: 36px; margin-bottom: 8px; }
.empty p { margin: 0; font-weight: 650; color: var(--text-2); }
.empty span { font-size: 12.5px; }

/* ===================== 连接门槛（未就绪时不显示设备卡片） ===================== */
/* 私钥没填 / 被云端拒绝 / 云端不可达：设备区整块换成说明面板，导航里的「调试」也隐藏。
 * 任一条件成立时 #view-devices 带 .is-gated，下面是它要藏起来的东西。 */
#view-devices.is-gated .hero,
#view-devices.is-gated .toolbar,
#view-devices.is-gated .result-line,
#view-devices.is-gated .sort-banner,
#view-devices.is-gated #deviceGrid,
#view-devices.is-gated #deviceEmpty { display: none !important; }

.link-gate { padding: 6px 0 44px; }
.link-gate-card { max-width: 620px; margin: 0 auto; text-align: center; padding: 40px 34px 30px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.link-gate-icon { width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 20px;
  display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.link-gate-icon svg { width: 30px; height: 30px; }
.link-gate.is-bad .link-gate-icon { background: var(--red-soft); color: var(--red); }
.link-gate.is-warn .link-gate-icon { background: var(--amber-soft); color: var(--amber); }
.link-gate-card h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.2px; }
.link-gate-text { margin: 0 auto; max-width: 470px; color: var(--text-2); font-size: 13.5px; line-height: 1.75; }
.link-gate-hints { list-style: none; margin: 18px auto 22px; padding: 0; max-width: 480px; text-align: left;
  display: grid; gap: 8px; }
.link-gate-hints li { display: flex; gap: 9px; font-size: 12.5px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 12px; line-height: 1.65; }
.link-gate-hints li::before { content: ''; width: 6px; height: 6px; margin-top: 7px; border-radius: 50%;
  background: var(--primary); flex: none; }
.link-gate-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.link-gate-foot { margin: 18px 0 0; font-size: 11.5px; color: var(--text-3); line-height: 1.7; }
/* 首屏还没同步完：图标转起来，别让人以为卡死了 */
.link-gate.is-busy .link-gate-icon svg { animation: spin 1.4s linear infinite; }

@media (max-width: 768px) {
  .link-gate { padding: 0 0 28px; }
  .link-gate-card { padding: 30px 20px 24px; border-radius: 18px; }
  .link-gate-card h2 { font-size: 18px; }
  .link-gate-text { font-size: 13px; }
  .link-gate-actions .btn { flex: 1; min-width: 128px; justify-content: center; }
}

/* ===================== 面板 / 表单 ===================== */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 16px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.panel-title svg { width: 18px; height: 18px; color: var(--primary); }
.panel-title .tag { margin-left: auto; font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--text-3); background: var(--surface-3); padding: 3px 8px; border-radius: 7px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin-bottom: 13px; }
.field > span { font-size: 11.5px; font-weight: 700; color: var(--text-2); }
.field > span em { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--text-3); font-weight: 500; margin-left: 3px; }
.field-grow { flex: 1; }
.field-row { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.field-row > .field { flex: 1; min-width: 150px; }
.field-row.three > .field { min-width: 165px; }
.input-with-btn { position: relative; }
.input-with-btn input { padding-right: 44px; }
.hint { font-size: 12px; color: var(--text-2); line-height: 1.7; margin: 4px 0 14px; }
.hint code, .note code, .steps code { font-family: var(--mono); font-size: 11px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.row-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 6px; }
.quick-wrap { margin: 2px 0 14px; }
.quick-head { display: flex; align-items: baseline; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.quick-head small { font-weight: 500; color: var(--text-3); font-size: 10.5px; }
.quick-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.quick-chips button { font-family: var(--mono); font-size: 11px; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); transition: .16s; }
.quick-chips button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.quick-chips button.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.debug-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.kbd-hint { font-size: 11px; color: var(--text-3); margin-left: auto; }
.response { margin-top: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-all; min-height: 52px; }
.response-empty { color: var(--text-3); font-family: var(--sans); }
.response.ok { border-color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); }
.response.bad { border-color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.history-list, .info-list { max-height: 280px; overflow: auto; }
.history-item { display: flex; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.history-item:last-child { border-bottom: 0; }
.history-item code { font-family: var(--mono); color: var(--primary-ink); font-size: 11.5px; word-break: break-all; flex: 1; }
.history-item time { color: var(--text-3); font-size: 10.5px; white-space: nowrap; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text-2); }
.kv strong { font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.muted { color: var(--text-3); font-size: 12.5px; margin: 0; }

/* 调试页 · 云端设备列表（仓库固件设备 + 云端发现主题） */
.cloud-devs { display: flex; flex-direction: column; gap: 8px; }
.cloud-dev {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2);
  border-left: 3px solid var(--accent);
}
.cd-ico {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.cd-ico svg { width: 16px; height: 16px; }
.cd-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cd-main strong { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.cd-main .feat { font-size: 9px; padding: 2px 6px; border-radius: 6px; background: var(--primary-soft);
  color: var(--primary-ink); font-weight: 700; letter-spacing: .4px; flex: none; }
.cd-main code { font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-acts { display: flex; gap: 6px; flex: none; }
.cd-acts .btn svg { width: 12px; height: 12px; }
@media (max-width: 768px) {
  .cloud-dev { flex-wrap: wrap; }
  .cd-main { flex: 1 1 auto; }
  .cd-acts { flex: none; }
}

.cmd-ref { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.cmd-block { border: 1px solid var(--line); border-radius: 13px; padding: 12px 13px; background: var(--surface-2); }
.cmd-block h4 { margin: 0 0 4px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.cmd-block h4 .topic { font-family: var(--mono); font-size: 10px; color: var(--text-3); font-weight: 500; }
.cmd-block .cmd-lines { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.cmd-block .cmd-lines button { font-family: var(--mono); font-size: 10.5px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); border-radius: 7px; padding: 3px 7px; }
.cmd-block .cmd-lines button:hover { border-color: var(--primary); color: var(--primary); }
.cmd-block .cmd-note { font-size: 10.5px; color: var(--text-3); margin-top: 9px; line-height: 1.6; }

/* 日志 */
.log-panel { padding: 6px 18px; }
.log-item { display: flex; gap: 12px; align-items: flex-start; padding: 13px 0; border-bottom: 1px solid var(--line); }
.log-item:last-child { border-bottom: 0; }
.log-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.log-icon svg { width: 15px; height: 15px; }
.log-icon.ok { background: var(--green-soft); color: var(--green); }
.log-icon.bad { background: var(--red-soft); color: var(--red); }
.log-icon.pending { background: var(--amber-soft); color: var(--amber); }
.log-main { flex: 1; min-width: 0; }
.log-main .l1 { font-size: 12.5px; font-weight: 650; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.log-main code { font-family: var(--mono); color: var(--primary-ink); font-size: 12px; }
.log-main .l2 { font-size: 11px; color: var(--text-3); margin-top: 2px; word-break: break-all; }
.log-time { font-size: 10.5px; color: var(--text-3); white-space: nowrap; font-family: var(--mono); }
.log-empty { text-align: center; padding: 60px 0; color: var(--text-3); font-size: 13px; }

/* 设置 */
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch-row span { flex: 1; font-size: 13px; font-weight: 600; display: flex; flex-direction: column; }
.switch-row small { font-size: 11px; font-weight: 400; color: var(--text-3); margin-top: 1px; }
.switch-row input { display: none; }
.switch-row i { width: 44px; height: 25px; border-radius: 999px; background: var(--line-strong); position: relative; transition: .2s; flex: none; }
.switch-row i::after { content: ''; position: absolute; width: 19px; height: 19px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.switch-row input:checked + i { background: var(--primary); }
.switch-row input:checked + i::after { transform: translateX(19px); }
.steps { margin: 0 0 12px; padding-left: 20px; font-size: 12.5px; color: var(--text-2); line-height: 1.9; }
.steps li { margin-bottom: 4px; }
.custom-list { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.custom-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 9px 12px; font-size: 12.5px; flex-wrap: wrap; }
.custom-item strong { font-weight: 650; }
.custom-item code { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.custom-item .mini-btn { margin-left: 0; }
.custom-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.custom-ico svg { width: 14px; height: 14px; }
.tpl-tag { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.custom-meta { font-size: 11px; color: var(--text-3); margin-left: auto; }

/* 自定义设备表单：模板说明 + 基础功能勾选 */
.tpl-hint { margin: 0; font-size: 11.5px; line-height: 1.65; color: var(--text-3); }
.cap-block { margin: 2px 0 14px; padding: 12px 14px; border: 1px solid var(--line);
  background: var(--surface-2); border-radius: 13px; }
.cap-head { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 9px;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.cap-head small { font-weight: 500; color: var(--text-3); font-size: 11px; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.cap-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: .16s; }
.cap-item input { accent-color: var(--primary); margin: 2px 0 0; flex: none; }
.cap-item span { display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  font-size: 12px; font-weight: 650; color: var(--text-2); }
.cap-item span svg { width: 13px; height: 13px; color: var(--text-3); }
.cap-item small { flex-basis: 100%; font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--text-3); }
.cap-item:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.cap-item.is-danger:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.cap-item:hover { border-color: var(--line-strong); }

/* 自定义按键：一行一个键（序号 / 图标 / 名称 / 命令），数量 2~12 可加减 */
.key-count { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.key-count .mini-btn {
  width: 26px; height: 26px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; line-height: 1; color: var(--text-2);
}
.key-count .mini-btn:hover { color: var(--primary); }
.key-count input[type="number"] {
  width: 46px; text-align: center; font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 2px; outline: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.key-count input[type="number"]::-webkit-outer-spin-button,
.key-count input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.key-count input[type="number"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.key-count em { font-style: normal; font-size: 11px; color: var(--text-3); }
.key-rows { display: flex; flex-direction: column; gap: 7px; }
/* 表单区块顺序切换（按键在上 / 数据在上） */
.form-order {
  display: flex; align-items: center; gap: 6px; margin: 2px 0 9px;
  font-size: 11px; color: var(--text-3);
}
.form-order button {
  font-size: 11px; padding: 4px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
}
.form-order button:hover { border-color: var(--primary); color: var(--primary); }
.form-order button.is-active { background: var(--primary-soft); border-color: var(--primary);
  color: var(--primary-ink); font-weight: 600; }
.row-spring { flex: 1; }
/* 卡片主题旁的备注标签：可点击修改 */
.badge-remark { cursor: pointer; }
.badge-remark svg { width: 10px; height: 10px; opacity: .55; margin-right: 3px; }
.badge-remark:hover { border-color: var(--primary); color: var(--primary); }
.badge-remark:hover svg { opacity: 1; }
/* 数据展示项行：复用 key-row 的编号/预览样式，只加自己的网格与输入。
 * 名称与单位都吃 fr，避免名称独占过长、单位被挤成一条缝。 */
.metric-row { display: grid; grid-template-columns: 18px 30px minmax(0, 1fr) 106px 64px minmax(0, 1fr);
  gap: 7px; align-items: center; }
.metric-row input, .metric-row select { padding: 7px 9px; font-size: 12.5px; border-radius: 9px; min-width: 0; }
.metric-row select { padding-right: 26px; background-position: right 8px center; }
.metric-row input.m-idx { font-family: var(--mono); }
.key-row { display: grid; grid-template-columns: 18px 30px minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 7px; align-items: center; }
.key-idx { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--text-3); text-align: center; }
/* 图标预览 + 透明下拉罩层：看不见的下拉原位盖在预览方块上，
 * 点预览 = 点下拉，任何浏览器（含老 iOS）都会弹原生选择面板 */
.key-icw { position: relative; width: 30px; height: 30px; }
.key-icw .key-prev { width: 100%; height: 100%; }
.key-icw:hover .key-prev { border-color: var(--primary); color: var(--primary); }
.key-icw .k-icon { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0;
  margin: 0; border: 0; padding: 0; outline: none; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: none; }
.key-prev { border-radius: 9px; display: grid; place-items: center; padding: 0;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2); }
.key-prev:hover { border-color: var(--primary); color: var(--primary); }
.key-prev svg { width: 15px; height: 15px; }
.key-prev.is-empty { color: var(--text-3); opacity: .5; }
.key-row input, .key-row select { padding: 7px 9px; font-size: 12.5px; border-radius: 9px; }
.key-row select { padding-right: 26px; background-position: right 8px center; }
.key-row input.k-cmd { font-family: var(--mono); }
.cap-foot { margin: 9px 0 0; font-size: 11px; line-height: 1.6; color: var(--text-3); }
.cap-foot strong { color: var(--text-2); }
@media (max-width: 768px) {
  .key-count { width: 100%; margin-left: 0; padding-top: 4px; }
  /* 按键行：整行包成一张圆角小卡，两行对齐——
   * 第一行 = 序号 · 图标预览 · 名称（图标下拉已收进预览方块里），
   * 第二行 = 命令拉通全宽 */
  .key-row {
    grid-template-columns: 16px 30px minmax(0, 1fr);
    grid-template-areas:
      "idx prev lbl"
      "cmd cmd cmd";
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px;
  }
  .key-row .key-idx { grid-area: idx; align-self: start; line-height: 34px; }
  .key-row .key-icw { grid-area: prev; width: 34px; height: 34px; }
  .key-row .k-label { grid-area: lbl; }
  .key-row .k-cmd { grid-area: cmd; }
  .key-row input, .key-row select { padding: 9px 10px; }
  /* 数据展示项行：第一行 序号·图标预览·名称，第二行 取值方式+位置，第三行 单位全宽 */
  .metric-row {
    grid-template-columns: 16px 30px minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "idx  prev lbl  lbl"
      ".    .    src  pos"
      "unit unit unit unit";
  }
  .metric-row .key-idx { grid-area: idx; align-self: start; line-height: 34px; }
  .metric-row .key-icw { grid-area: prev; width: 34px; height: 34px; }
  .metric-row .m-label { grid-area: lbl; }
  .metric-row .m-src { grid-area: src; }
  .metric-row .m-idx { grid-area: pos; }
  .metric-row .m-unit { grid-area: unit; }
  .metric-row input, .metric-row select { padding: 9px 10px; }
}
.about-line { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11px; color: var(--text-3); font-family: var(--mono); }

/* ===================== 设备控制抽屉 ===================== */
body.has-drawer { overflow: hidden; }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 88; background: rgba(12, 18, 34, .46);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fadeIn .2s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(440px, 100%);
  display: flex; flex-direction: column; background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: -18px 0 50px rgba(12, 18, 34, .2);
  padding-top: env(safe-area-inset-top);
  animation: drawerIn .26s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 18px 20px 15px; border-bottom: 1px solid var(--line);
}
.drawer-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  color: #fff; flex: none; box-shadow: 0 5px 14px rgba(24, 36, 74, .12); }
.drawer-icon svg { width: 23px; height: 23px; }
.drawer-title { min-width: 0; }
.drawer-title h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 7px; }
.drawer-title div { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-head .icon-btn { margin-left: auto; }
.drawer-scroll {
  flex: 1; min-height: 0; overflow: auto; padding: 16px 20px 26px;
  -webkit-overflow-scrolling: touch;
}
.drawer-status { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.drawer-section { margin-bottom: 22px; }
.drawer-section:last-child { margin-bottom: 0; }
.drawer-section > h4 {
  margin: 0 0 10px; font-size: 11.5px; font-weight: 750; color: var(--text-2);
  letter-spacing: .4px; display: flex; align-items: center; gap: 7px;
}
.drawer-section > h4 svg { width: 14px; height: 14px; color: var(--primary); }
.drawer-section > h4 .cnt { margin-left: auto; font-family: var(--mono); font-size: 10px;
  color: var(--text-3); font-weight: 600; letter-spacing: 0; }
.drawer .card-readout { height: auto; overflow: visible; margin: 0; }
.drawer .card-readout::after { display: none; }
.drawer .card-readout .raw-line { white-space: pre-wrap; word-break: break-all; }
.drawer .card-readout .readout-time { white-space: normal; }
.param-summary .hint-box {
  margin: 0; font-size: 11.5px; line-height: 1.65; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px;
}
.param-summary .hint-box code {
  font-family: var(--mono); font-size: 11px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px;
}
.param-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.param-tag {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-2);
  background: var(--surface-3); padding: 4px 8px; border-radius: 8px;
}
.param-tag b { font-family: var(--sans); font-weight: 700; color: var(--text); }
.param-tag.cloud { background: var(--green-soft); color: var(--green); }
.btn.btn-sm { padding: 6px 11px; font-size: 11.5px; border-radius: 9px; }
.drawer .metrics { flex-wrap: wrap; }
.drawer .metric { flex: 1 1 84px; }
.drawer-controls { display: flex; flex-direction: column; gap: 17px; }
.drawer-controls .control { margin: 0; }
.drawer-notes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.drawer-notes li { font-size: 11.5px; color: var(--text-2); line-height: 1.6;
  background: var(--surface-2); border-left: 3px solid var(--line-strong);
  border-radius: 8px; padding: 8px 11px; }
.drawer-cmds { display: flex; flex-wrap: wrap; gap: 6px; }
.drawer-cmds .cmd-chip { cursor: pointer; }
.drawer-desc { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.75; }
.drawer-foot {
  flex: none; display: flex; gap: 9px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface-2);
}
.drawer-foot .btn { flex: 1; }

/* ===================== 浮层 ===================== */
.tabbar { display: none; }
.toasts { position: fixed; z-index: 100; top: calc(env(safe-area-inset-top) + 70px); right: 20px;
  display: flex; flex-direction: column; gap: 9px; max-width: min(360px, calc(100vw - 40px)); }
.toast { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  border-radius: 13px; padding: 11px 15px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 9px;
  animation: toastIn .26s ease both; }
.toast svg { width: 17px; height: 17px; }
.toast.ok svg { color: var(--green); }
.toast.bad svg { color: var(--red); }
.toast.info svg { color: var(--primary); }
.toast.out { animation: toastOut .22s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(18px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(18px); } }

.modal-backdrop { position: fixed; inset: 0; z-index: 110; background: rgba(12, 18, 34, .48);
  backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 22px; padding: 26px; width: min(400px, 100%);
  box-shadow: var(--shadow-lg); animation: viewIn .2s ease both; }
.modal-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--red-soft); color: var(--red);
  display: grid; place-items: center; margin-bottom: 14px; }
.modal-icon svg { width: 24px; height: 24px; }
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 20px; font-size: 13px; color: var(--text-2); line-height: 1.7; }
.modal-field { display: block; margin: -6px 0 20px; }
.modal-field[hidden] { display: none; }
.modal-field input { font-size: 14px; padding: 11px 13px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; }

.ios-tip { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 78px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 12px 14px; display: flex; align-items: center; gap: 12px; animation: viewIn .3s ease both; }
.ios-tip-icon { width: 38px; height: 38px; border-radius: 11px; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; flex: none; }
.ios-tip strong { font-size: 13px; }
.ios-tip p { margin: 1px 0 0; font-size: 11.5px; color: var(--text-2); }
.ios-tip .icon-btn { margin-left: auto; border: 0; background: transparent; }

/* ===================== 响应式 ===================== */
@media (max-width: 980px) {
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-stats { width: 100%; }
  .hero-stat { flex: 1; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  /* 手机端信息分层：首屏只给「在几台在线 + 筛选 + 设备名单」，
   * 卡片折叠成两行，点开才展开读数/主操作/快捷指令/全部控制。 */
  .topbar-inner { padding: 10px 16px; gap: 10px; }
  .brand { min-width: 0; }
  .brand-text span { display: none; }
  .topnav { display: none; }
  .top-actions { margin-left: auto; }
  .cloud-pill { padding: 6px 10px; font-size: 11.5px; }
  .main { padding: 14px 14px calc(env(safe-area-inset-bottom) + 96px); }

  /* Hero 压缩成一条状态带：标题 + 三个统计，装饰层与重复按钮全部收起 */
  .hero { padding: 14px 16px; border-radius: 20px; gap: 10px; flex-direction: column; align-items: stretch; }
  .hero-eyebrow, .hero-glow, .hero::after { display: none; }
  .hero-title { font-size: 27px; letter-spacing: -.9px; margin: 0; }
  .hero-title small { font-size: 12.5px; }
  .hero-sub { font-size: 12px; min-height: 0; margin-top: 1px; }
  .hero-actions { display: none; }
  .hero-stats { padding: 8px 4px; border-radius: 14px; gap: 2px; }
  .hero-stat { min-width: 0; padding: 0 8px; gap: 1px; }
  .hero-stat-k { font-size: 10px; }
  .hero-stat strong { font-size: 14px; }

  .grid { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 17px 16px; border-radius: 18px; }

  /* 工具条：筛选改成单行横滑，搜索与排序并排一行 */
  .toolbar { gap: 9px; margin: 14px 0 10px; flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  .chips {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px 2px;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 8px 14px; }
  .toolbar-right { width: 100%; margin-left: 0; gap: 8px; }
  .searchbox { width: auto; min-width: 0; flex: 1; }
  .sort-tip { display: none; }
  .result-hint { display: none; }
  .result-line { margin-bottom: 10px; font-size: 11.5px; }

  .sort-banner { top: 60px; flex-wrap: wrap; padding: 11px 12px; gap: 9px; }
  .sort-banner-text { flex: 1 1 calc(100% - 46px); }
  .sort-banner-actions { width: 100%; }
  .sort-banner-actions .btn { flex: 1; justify-content: center; }
  .device-group { margin-bottom: 20px; }

  /* ---------- 卡片手风琴 ---------- */
  .card { height: auto; }                       /* 折叠时只有两行，没必要撑到 398px */
  .card:not(.is-open) .card-readout,
  .card:not(.is-open) .card-primary,
  .card:not(.is-open) .card-desc,
  .card:not(.is-open) .card-foot { display: none; }
  .card-head, .card-meta { cursor: pointer; }
  .card-head { padding: 13px 16px 6px; }
  .card-icon { width: 40px; height: 40px; border-radius: 13px; }
  .card-meta { padding: 0 16px 12px; }
  .card.is-open .card-meta { padding-bottom: 10px; }
  .card-expand { display: grid; }
  .card-expand svg { transform: rotate(90deg); transition: transform .22s; }
  .card-expand.is-open svg { transform: rotate(-90deg); }
  .card.is-open .card-readout,
  .card.is-open .card-primary,
  .card.is-open .card-desc,
  .card.is-open .card-foot { animation: foldIn .2s ease both; }
  @keyframes foldIn { from { opacity: 0; transform: translateY(-5px); } }

  .card-readout { height: 92px; margin: 0 16px; padding: 9px 11px; }
  .card-primary { padding: 10px 16px 12px; }
  .card-desc { height: auto; margin: 0 16px; padding: 9px 0 4px; -webkit-line-clamp: 2; }
  .card-foot { height: 54px; padding: 0 12px 0 16px; }

  /* 触屏友好：可点元素不小于 ~32px，主操作按钮更高 */
  .card-head-actions { gap: 2px; }
  .mini-btn { width: 32px; height: 32px; border-radius: 9px; }
  .mini-btn svg { width: 17px; height: 17px; }
  /* 手机上铅笔要能点到，透明度也别太淡 */
  .name-edit { width: 26px; height: 26px; opacity: .7; }
  .name-edit svg { width: 14px; height: 14px; }
  .cap-grid { grid-template-columns: 1fr 1fr; }
  .custom-item { padding: 8px 10px; }
  .detail-btn { min-height: 40px; }
  .act-btn { min-height: 42px; }
  /* 控制按键：手机上要有明显的「可点按钮」感——描边加重、加投影、按下给主题色反馈 */
  .act-btn, .drawer-controls .btn-row .act-btn {
    border: 1.5px solid var(--line-strong);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(24, 36, 74, .05), 0 3px 10px rgba(24, 36, 74, .07);
    padding: 11px 10px;
  }
  .act-btn:active { transform: scale(.97); background: var(--primary-soft); border-color: var(--primary); color: var(--primary-ink); }
  .act-btn.danger { border-color: color-mix(in srgb, var(--red) 34%, var(--line-strong)); }
  .act-btn.danger:active { background: var(--red-soft); border-color: var(--red); color: var(--red); }
  .act-btn.primary, .act-btn.primary:active { color: #fff; }
  .cmd-chip { min-height: 32px; }
  .card:not(.is-open) .card-head:active,
  .card:not(.is-open) .card-meta:active { background: var(--surface-2); }
  .card.is-open { box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--accent, var(--primary)) 32%, var(--line)); }

  /* iOS 聚焦字号 <16px 的输入框会自动放大整页 —— 统一提到 16px，键盘弹出不再跳版 */
  select, input[type="text"], input[type="password"], input[type="search"], textarea,
  .searchbox input[type="search"], .searchbox input[type="search"]:focus { font-size: 16px; }
  .sortbox select { font-size: 14px; }

  .drawer {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: min(88vh, 780px);
    border-left: 0; border-top: 1px solid var(--line); border-radius: 22px 22px 0 0;
    box-shadow: 0 -16px 44px rgba(12, 18, 34, .24); padding-top: 0;
    animation-name: sheetIn;
  }
  @keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
  .drawer::before { content: ''; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); }
  .drawer-head { padding: 20px 16px 14px; }
  .drawer-scroll { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); }
  .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .drawer-controls .btn-row .act-btn { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .drawer-controls .btn-row { flex-wrap: wrap; }
  .field-row.three > .field { min-width: 100%; }
  .kbd-hint { display: none; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .tabbar {
    display: flex; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .tab { flex: 1; border: 0; background: transparent; color: var(--text-3); display: flex;
    flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; font-size: 10px; font-weight: 600;
    position: relative; border-radius: 10px; }
  .tab svg { width: 21px; height: 21px; }
  .tab.is-active { color: var(--primary); }
  .tab-badge { position: absolute; top: 3px; right: calc(50% - 18px); width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
  .toasts { top: calc(env(safe-area-inset-top) + 62px); right: 12px; left: 12px; max-width: none; }
  .cmd-ref { grid-template-columns: 1fr; }
  .field-row { gap: 0; }
  .field-row > .field { min-width: 100%; }
}
@media (max-width: 400px) {
  .hero-stats { flex-wrap: wrap; }
  .hero-stat { min-width: 80px; }
  .card-title h3 { font-size: 15px; }
}
/* 触屏设备没有真正的 hover：清掉会「粘住」的悬停样式，避免点完颜色一直留着 */
@media (hover: none) {
  .card:hover { box-shadow: var(--shadow); border-color: var(--line); }
  .mini-btn:hover { background: transparent; color: var(--text-3); }
  .mini-btn.is-on:hover { color: var(--amber); }
  .chip:hover { border-color: var(--line); color: var(--text-2); }
  .act-btn:hover { border-color: var(--line); color: var(--text); background: var(--surface-2); }
  .detail-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
  .btn-soft:hover { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
  .topnav-btn:hover { background: transparent; color: var(--text-2); }
  .topnav-btn.is-active:hover { background: var(--primary-soft); color: var(--primary); }
}

@media (prefers-reduced-motion: reduce) {
  /* 直接禁用动画，避免 fill-mode:both 的入场动画停在起始帧（元素不可见/错位） */
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
