/* ============================================================
   AirPanel v2 · Liquid Glass 控制台
   设计令牌与组件基线：深浅色 + 可调玻璃通透度
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --accent: #0A84FF;
  --green: #34C759;
  --orange: #FF9F0A;
  --red: #FF3B30;
  --purple: #AF52DE;
  --teal: #5AC8FA;
  --indigo: #5856D6;
  --pink: #FF2D55;
  --yellow: #FFD60A;
  --ga: 1;
  --radius: 22px;
}

html[data-theme="light"] {
  --canvas: #edf0f6;
  --ink: #0a0a0f;
  --ink2: rgba(60, 60, 67, .64);
  --ink3: rgba(60, 60, 67, .4);
  --ink4: rgba(60, 60, 67, .2);
  --glass: rgba(255, 255, 255, calc(.54 * var(--ga)));
  --glass2: rgba(255, 255, 255, calc(.76 * var(--ga)));
  --stroke: rgba(255, 255, 255, .82);
  --hair: rgba(60, 60, 67, .1);
  --fill: rgba(120, 120, 128, .13);
  --fill2: rgba(120, 120, 128, .075);
  --spec: rgba(255, 255, 255, .9);
  --shadow: 0 26px 60px -36px rgba(28, 38, 68, .42);
  --seg-on: #fff;
  --console: linear-gradient(165deg, rgba(27, 32, 44, .95), rgba(13, 17, 26, .98));
  --drawer: rgba(247, 249, 253, .9);
}

html[data-theme="dark"] {
  --canvas: #05070c;
  --ink: #ffffff;
  --ink2: rgba(235, 235, 245, .64);
  --ink3: rgba(235, 235, 245, .38);
  --ink4: rgba(235, 235, 245, .18);
  --glass: rgba(255, 255, 255, calc(.065 * var(--ga)));
  --glass2: rgba(255, 255, 255, calc(.105 * var(--ga)));
  --stroke: rgba(255, 255, 255, .13);
  --hair: rgba(255, 255, 255, .085);
  --fill: rgba(120, 120, 128, .26);
  --fill2: rgba(120, 120, 128, .15);
  --spec: rgba(255, 255, 255, .16);
  --shadow: 0 30px 70px -34px rgba(0, 0, 0, .85);
  --seg-on: rgba(255, 255, 255, .17);
  --console: linear-gradient(165deg, rgba(18, 22, 32, .92), rgba(8, 11, 18, .96));
  --drawer: rgba(17, 21, 30, .92);
}

/* ---------- 环境背景 ---------- */
.wall {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background:
    radial-gradient(900px 620px at 6% -10%, rgba(10, 132, 255, .22), transparent 62%),
    radial-gradient(820px 600px at 96% -4%, rgba(175, 82, 222, .18), transparent 62%),
    radial-gradient(900px 720px at 52% 112%, rgba(90, 200, 250, .16), transparent 62%),
    var(--canvas);
}
html[data-theme="dark"] .wall {
  background:
    radial-gradient(900px 620px at 6% -10%, rgba(10, 132, 255, .2), transparent 62%),
    radial-gradient(820px 600px at 96% -4%, rgba(175, 82, 222, .16), transparent 62%),
    radial-gradient(900px 720px at 52% 112%, rgba(90, 200, 250, .1), transparent 62%),
    var(--canvas);
}
.wall i { position: absolute; border-radius: 50%; filter: blur(70px); display: block; }
.wall .b1 { width: 420px; height: 420px; left: -140px; top: -120px; background: rgba(10, 132, 255, .3); }
.wall .b2 { width: 360px; height: 360px; right: -100px; top: -80px; background: rgba(175, 82, 222, .24); }
.wall .b3 { width: 460px; height: 460px; left: 38%; bottom: -220px; background: rgba(90, 200, 250, .18); }
html[data-theme="dark"] .wall i { opacity: .7; }

/* ---------- 基础 ---------- */
.hidden { display: none !important; }
button { font-family: inherit; }
::selection { background: rgba(10, 132, 255, .22); }
.ic { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: none; color: inherit; }
.ic svg { width: 100%; height: 100%; display: block; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; box-shadow: 0 0 0 3px rgba(52, 199, 89, .14); }
.dot.off { background: #8e8e93; box-shadow: 0 0 0 3px rgba(142, 142, 147, .12); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录 ---------- */
.login { position: relative; z-index: 2; height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(408px, 100%); padding: 30px; border-radius: 30px;
  background: linear-gradient(165deg, var(--glass2), var(--glass));
  border: .5px solid var(--stroke);
  box-shadow: 0 40px 90px -40px rgba(20, 30, 60, .55), inset 0 .5px 0 var(--spec);
  backdrop-filter: blur(36px) saturate(180%);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
}
.login-logo {
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center;
  font-size: 27px; font-weight: 800; color: #fff; letter-spacing: -1px;
  background: linear-gradient(145deg, #57b0ff, #0a6fe0 55%, #8b5cf6);
  box-shadow: 0 18px 34px -14px rgba(10, 132, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .55);
}
.login h1 { font-size: 25px; font-weight: 700; letter-spacing: -.7px; margin: 18px 0 0; }
.login .sub { font-size: 12px; color: var(--ink3); margin: 6px 0 22px; line-height: 1.55; }
.login label { display: block; font-size: 10.5px; font-weight: 600; color: var(--ink3); margin: 0 0 5px 2px; }
.login .field { margin-bottom: 12px; }
.login .btn { width: 100%; margin-top: 4px; }
.login .btn + .btn { margin-top: 8px; }
.login-foot { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 20px; font-size: 10px; color: var(--ink3); }
.login-err { margin: 10px 0 0; font-size: 11px; color: var(--red); min-height: 15px; }

/* ---------- 应用骨架 ---------- */
.app { position: relative; z-index: 2; height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); gap: 14px; padding: 14px; max-width: 1720px; margin: 0 auto; }
.sidebar {
  position: relative; z-index: 60;
  display: flex; flex-direction: column; min-height: 0; padding: 14px 10px 12px; border-radius: 26px;
  background: linear-gradient(170deg, var(--glass2), var(--glass));
  border: .5px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 .5px 0 var(--spec);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  font-size: 16px; font-weight: 800; color: #fff; letter-spacing: -.5px;
  background: linear-gradient(145deg, #57b0ff, #0a6fe0 55%, #8b5cf6);
  box-shadow: 0 10px 22px -10px rgba(10, 132, 255, .8), inset 0 .5px 0 rgba(255, 255, 255, .5);
}
.brand-name { font-size: 13.5px; font-weight: 700; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.brand-sub { font-size: 9px; color: var(--ink3); margin-top: 1px; white-space: nowrap; }

/* 自定义 Logo：替换字母占位，用背景图等比铺满 */
.brand-mark.has-img,
.login-logo.has-img {
  background-color: transparent;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  box-shadow: none;
}

/* 品牌设置行（基本设置 → 界面设置） */
.brand-row { display: flex; gap: 14px; align-items: flex-start; }
.brand-logo {
  width: 62px; height: 62px; flex: none; border-radius: 17px; overflow: hidden;
  display: grid; place-items: center; background: var(--fill);
  border: .5px solid var(--stroke);
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-row .grow { flex: 1; min-width: 0; }
.nav { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 4px; }
.nav::-webkit-scrollbar { width: 0; }
.nav-label { padding: 10px 10px 4px; font-size: 9px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--ink3); }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 35px; padding: 0 10px; border: 0;
  border-radius: 10px; background: transparent; color: var(--ink2); font-size: 11.5px; font-weight: 500;
  cursor: pointer; text-align: left; transition: .14s;
}
.nav-item .ic { width: 17px; height: 17px; opacity: .82; }
.nav-item:hover { background: var(--fill2); color: var(--ink); }
.nav-item.on {
  color: var(--accent);
  background: linear-gradient(90deg, rgba(10, 132, 255, .16), rgba(10, 132, 255, .045));
  font-weight: 650; box-shadow: inset 0 0 0 .5px rgba(10, 132, 255, .18);
}
.nav-item.on .ic { opacity: 1; }
.nav-item .count { margin-left: auto; font-size: 9px; font-weight: 700; color: var(--ink3); background: var(--fill2); padding: 1px 6px; border-radius: 20px; }
.side-foot { margin-top: 8px; padding-top: 10px; border-top: .5px solid var(--hair); }
.server { display: flex; align-items: center; gap: 8px; padding: 6px 8px 10px; }
.server .t { font-size: 10.5px; font-weight: 600; }
.server .s { font-size: 8.5px; color: var(--ink3); margin-top: 2px; }
.acct { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; background: var(--fill2); }
.acct .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(145deg, #57b0ff, #0a6fe0); flex: none; }
.acct .n { font-size: 10.5px; font-weight: 650; }
.acct .r { font-size: 8.5px; color: var(--ink3); }
.acct .acts { margin-left: auto; display: flex; gap: 1px; }

.workspace { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.topbar {
  height: 60px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 20px;
  background: linear-gradient(170deg, var(--glass2), var(--glass));
  border: .5px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 .5px 0 var(--spec);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
}
.menu-btn { display: none; }
.top-title { min-width: 0; }
.crumb { font-size: 9px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); }
.page-name { font-size: 14px; font-weight: 700; letter-spacing: -.3px; margin-top: 1px; }
.top-sep { width: .5px; height: 22px; background: var(--hair); margin: 0 2px; }
.top-device {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; border-radius: 11px;
  border: .5px solid var(--hair); background: var(--fill2); color: var(--ink); font-size: 11px; font-weight: 600;
  cursor: pointer; transition: .14s;
}
.top-device:hover { background: var(--fill); }
.top-device .ic { width: 13px; height: 13px; color: var(--ink3); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; border-radius: 20px; background: rgba(52, 199, 89, .13); color: #1f9d45; font-size: 9.5px; font-weight: 700; }
html[data-theme="dark"] .status-pill { color: #6ee7a0; }
.iconbtn {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: .5px solid var(--hair);
  background: var(--fill2); color: var(--ink2); cursor: pointer; transition: .14s;
}
.iconbtn:hover { background: var(--fill); color: var(--ink); }
.iconbtn .ic { width: 15px; height: 15px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: linear-gradient(145deg, #57b0ff, #0a6fe0); }

.content { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 4px 40px; scrollbar-width: thin; }
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: var(--ink4); border-radius: 8px; }
.page { animation: pageIn .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ---------- 通用 ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 10px 6px 18px; }
.hero h1 { margin: 0; font-size: 31px; font-weight: 700; letter-spacing: -1.1px; line-height: 1.06; }
.hero p { margin: 6px 0 0; font-size: 12px; color: var(--ink2); line-height: 1.55; }
.hero-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.card {
  position: relative; border-radius: var(--radius); padding: 16px;
  background: linear-gradient(165deg, var(--glass2), var(--glass));
  border: .5px solid var(--stroke);
  box-shadow: var(--shadow), inset 0 .5px 0 var(--spec);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title { font-size: 13.5px; font-weight: 650; letter-spacing: -.2px; }
.card-sub { font-size: 10px; color: var(--ink3); margin-top: 3px; line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
  border-radius: 11px; border: .5px solid var(--hair); background: var(--fill2); color: var(--ink);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: .16s; white-space: nowrap;
}
.btn:hover { background: var(--fill); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ic { width: 14px; height: 14px; }
.btn.primary { border-color: transparent; color: #fff; background: linear-gradient(180deg, #3fa4ff, #0a7bf0); box-shadow: 0 12px 24px -14px rgba(10, 132, 255, .85), inset 0 .5px 0 rgba(255, 255, 255, .4); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--fill2); }
.btn.danger { color: var(--red); background: rgba(255, 59, 48, .1); border-color: rgba(255, 59, 48, .18); }
.btn.danger:hover { background: rgba(255, 59, 48, .15); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 10.5px; border-radius: 9px; }
.btn.lg { height: 42px; padding: 0 16px; font-size: 13px; border-radius: 13px; }
.btn.block { width: 100%; }
.mini-btn {
  width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: var(--ink3);
  display: inline-grid; place-items: center; cursor: pointer; transition: .14s;
}
.mini-btn:hover { background: var(--fill2); color: var(--ink); }
.mini-btn:disabled { opacity: .3; cursor: not-allowed; }
.mini-btn .ic { width: 13px; height: 13px; }

.label { display: block; font-size: 10px; font-weight: 600; color: var(--ink3); margin: 0 0 5px 2px; }
.field { min-width: 0; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 11px;
  border: .5px solid var(--hair); background: var(--fill2); color: var(--ink);
  font-family: inherit; font-size: 12px; outline: 0; transition: .16s;
}
.textarea { height: auto; min-height: 74px; padding: 9px 10px; line-height: 1.55; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(10, 132, 255, .5); box-shadow: 0 0 0 3px rgba(10, 132, 255, .11); background: var(--glass2); }
.select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 26px; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ""; position: absolute; right: 11px; top: 50%; width: 5px; height: 5px;
  border-right: 1.5px solid var(--ink3); border-bottom: 1.5px solid var(--ink3);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.input::placeholder, .textarea::placeholder { color: var(--ink3); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--fill2); border: .5px solid var(--hair); }
.seg button {
  height: 26px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink2); font-size: 10.5px; font-weight: 600; cursor: pointer; transition: .14s; white-space: nowrap;
}
.seg button.on { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), inset 0 .5px 0 var(--spec); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 7px; border-radius: 20px;
  font-size: 9px; font-weight: 700; background: var(--fill2); color: var(--ink2); white-space: nowrap;
}
.badge.green { background: rgba(52, 199, 89, .14); color: #1f9d45; }
.badge.red { background: rgba(255, 59, 48, .13); color: #d92c22; }
.badge.orange { background: rgba(255, 159, 10, .15); color: #b56a00; }
.badge.blue { background: rgba(10, 132, 255, .14); color: #0069d9; }
.badge.purple { background: rgba(175, 82, 222, .14); color: #9b34d0; }
.badge.gray { background: var(--fill2); color: var(--ink3); }
html[data-theme="dark"] .badge.green { color: #6ee7a0; }
html[data-theme="dark"] .badge.red { color: #ff8b84; }
html[data-theme="dark"] .badge.orange { color: #ffc46b; }
html[data-theme="dark"] .badge.blue { color: #6fb6ff; }
html[data-theme="dark"] .badge.purple { color: #d08bff; }

.empty { padding: 40px 16px; text-align: center; color: var(--ink3); font-size: 12px; line-height: 1.7; }
.empty .ic { width: 30px; height: 30px; margin-bottom: 8px; opacity: .5; }
.skeleton { height: 84px; border-radius: 16px; background: linear-gradient(90deg, var(--fill2), var(--fill), var(--fill2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- 概览 ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { min-height: 116px; overflow: hidden; }
.metric::after { content: ""; position: absolute; right: -34px; top: -44px; width: 120px; height: 120px; border-radius: 50%; background: var(--tint); opacity: .32; filter: blur(28px); pointer-events: none; }
.metric .k { font-size: 10.5px; font-weight: 600; color: var(--ink2); }
.metric .v { font-size: 30px; font-weight: 700; letter-spacing: -1.2px; line-height: 1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.metric .u { font-size: 10px; font-weight: 500; color: var(--ink3); margin-left: 2px; }
.metric .foot { font-size: 9.5px; color: var(--ink3); margin-top: 8px; }
.metric .badge { position: absolute; right: 12px; top: 12px; }
.spark { position: absolute; right: 12px; bottom: 12px; width: 82px; height: 26px; opacity: .9; }
.ov-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .85fr); gap: 12px; margin-top: 12px; }
.ov-side { display: flex; flex-direction: column; gap: 12px; }
.chart-wrap { height: 232px; margin: 4px 0 0; }
.chart-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.legend { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; color: var(--ink3); }
.legend i { width: 6px; height: 6px; border-radius: 50%; }
.batt { display: flex; align-items: center; gap: 16px; }
.ring { width: 100px; height: 100px; border-radius: 50%; display: grid; place-items: center; position: relative; flex: none; background: conic-gradient(var(--green) 0 0%, var(--fill) 0% 100%); }
.ring::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--glass2); }
.ring .rv { position: relative; z-index: 1; font-size: 23px; font-weight: 700; letter-spacing: -.8px; }
.ring .rv small { font-size: 9px; color: var(--ink3); font-weight: 500; }
.batt-info { flex: 1; min-width: 0; }
.batt-info .row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: .5px solid var(--hair); font-size: 10.5px; }
.batt-info .row:last-child { border-bottom: 0; }
.batt-info .k { color: var(--ink3); }
.batt-info .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 14px; }
.info-grid .k { font-size: 9px; color: var(--ink3); }
.info-grid .v { font-size: 11px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.quick {
  display: flex; align-items: center; gap: 8px; padding: 9px; border-radius: 12px; border: .5px solid var(--hair);
  background: var(--fill2); cursor: pointer; font-size: 10.5px; font-weight: 600; text-align: left; color: var(--ink); transition: .15s;
}
.quick:hover { background: var(--fill); }
.quick .tile { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--qt); color: var(--qf); flex: none; }
.quick .tile .ic { width: 13px; height: 13px; }
.power-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 12px; }
.power-form .btn { height: 36px; }

/* ---------- 设备 ---------- */
.devices-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 12px; }
.dev-tools { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.dev-tools .input { height: 32px; font-size: 11px; }
.dev-list { display: flex; flex-direction: column; gap: 5px; max-height: 560px; overflow-y: auto; padding-right: 2px; }
.dev-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; cursor: pointer; border: .5px solid transparent; transition: .14s; }
.dev-row:hover { background: var(--fill2); }
.dev-row.on { background: var(--fill2); border-color: var(--stroke); box-shadow: inset 0 .5px 0 var(--spec); }
.dev-avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; flex: none; background: linear-gradient(150deg, rgba(52, 199, 89, .32), rgba(52, 199, 89, .08)); color: #1f9d45; border: .5px solid rgba(52, 199, 89, .2); }
.dev-avatar.off { background: var(--fill2); color: var(--ink3); border-color: var(--hair); }
.dev-avatar .ic { width: 17px; height: 17px; }
.dev-avatar.big { width: 56px; height: 56px; border-radius: 18px; }
.dev-avatar.big .ic { width: 24px; height: 24px; }
.dev-name { font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-meta { font-size: 9px; color: var(--ink3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-row .badge { margin-left: auto; }
.detail-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-head h2 { margin: 0; font-size: 23px; font-weight: 700; letter-spacing: -.7px; }
.detail-head .sub { font-size: 10px; color: var(--ink3); margin-top: 3px; }
.detail-actions { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.detail-grid .cell { padding: 10px; border-radius: 12px; background: var(--fill2); border: .5px solid var(--hair); }
.detail-grid .k { font-size: 9px; color: var(--ink3); }
.detail-grid .v { font-size: 11.5px; font-weight: 600; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.mini { padding: 12px; border-radius: 14px; background: var(--fill2); border: .5px solid var(--hair); }
.mini .k { font-size: 9px; color: var(--ink3); }
.mini .v { font-size: 19px; font-weight: 700; letter-spacing: -.6px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mini .v small { font-size: 9px; font-weight: 500; color: var(--ink3); }

/* ---------- 任务 ---------- */
.tasks-layout { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(330px, .85fr); gap: 12px; }
.task-types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 10px; }
.task-type {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px;
  border-radius: 13px; border: .5px solid var(--hair); background: var(--fill2); cursor: pointer;
  text-align: left; transition: .15s; color: var(--ink);
}
.task-type:hover { background: var(--fill); }
.task-type .tile { width: 27px; height: 27px; border-radius: 8px; display: grid; place-items: center; background: var(--tb); color: var(--tf); }
.task-type .tile .ic { width: 14px; height: 14px; }
.task-type .t { font-size: 10.5px; font-weight: 650; }
.task-type .d { font-size: 8.5px; color: var(--ink3); line-height: 1.35; }
.task-type.on { border-color: rgba(10, 132, 255, .42); background: rgba(10, 132, 255, .09); box-shadow: 0 10px 22px -18px rgba(10, 132, 255, .7); }
.task-type.on .t { color: var(--accent); }
.params { margin-top: 14px; padding-top: 14px; border-top: .5px solid var(--hair); }
.params .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.console { background: var(--console); color: #d3e1f2; border-radius: 15px; padding: 11px; font-family: var(--mono); font-size: 10.5px; line-height: 1.7; min-height: 200px; max-height: 280px; overflow: auto; border: .5px solid rgba(255, 255, 255, .08); }
.console .ln { display: flex; gap: 7px; white-space: pre-wrap; word-break: break-word; }
.console .tm { color: #6b7f96; flex: none; }
.console .ok { color: #7ee2a8; }
.console .warn { color: #ffcf7a; }
.console .err { color: #ff8b84; }
.console .muted { color: #8fa2b8; }
.config-editor { margin-top: 12px; }
.config-editor .textarea { font-family: var(--mono); font-size: 10.5px; min-height: 180px; }
.lib-list { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.lib-item { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 10px; background: var(--fill2); border: .5px solid var(--hair); cursor: pointer; font-size: 10.5px; }
.lib-item:hover { background: var(--fill); }
.lib-item .ic { width: 13px; height: 13px; color: var(--accent); }
.lib-item .code { font-family: var(--mono); font-size: 9px; color: var(--ink3); margin-left: auto; }

/* ---------- 定时任务 ---------- */
.schedules-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 12px; }
.sch-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.sch-row { position: relative; display: flex; gap: 10px; padding: 12px 12px 12px 15px; border-radius: 14px; background: var(--fill2); border: .5px solid var(--hair); overflow: hidden; }
.sch-row::before { content: ""; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 2px; background: var(--sc, var(--accent)); }
.sch-main { flex: 1; min-width: 0; }
.sch-name { font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sch-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.sch-actions { display: flex; align-items: center; gap: 3px; margin-left: auto; }
.cycle-detail { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.cycle-detail .input { width: 64px; height: 30px; font-size: 11px; }
.cycle-detail .lbl { font-size: 10px; color: var(--ink3); }

/* ---------- 数据列表 ---------- */
.filter-card { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 9px; padding: 12px; border-radius: 16px; }
.filter-card .field { min-width: 126px; }
.filter-card .field.grow { flex: 1; min-width: 170px; }
.filter-card .btn { height: 34px; }
.data-card { padding: 0; overflow: hidden; }
.data-scroll { overflow-x: auto; }
.data-head, .data-row { display: grid; grid-template-columns: var(--cols); gap: 9px; align-items: center; min-width: var(--minw, 0); padding: 9px 13px; }
.data-head { font-size: 8.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink3); border-bottom: .5px solid var(--hair); }
.data-row { border-bottom: .5px solid var(--hair); font-size: 11px; transition: .12s; }
.data-row:last-child { border-bottom: 0; }
.data-row:hover { background: var(--fill2); }
.cell { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell.strong { font-weight: 600; }
.cell .sub { display: block; font-size: 8.5px; color: var(--ink3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; border-top: .5px solid var(--hair); font-size: 9.5px; color: var(--ink3); }
.pager-btns { display: flex; gap: 2px; }
.pager-btns button { width: 24px; height: 24px; border-radius: 7px; border: .5px solid var(--hair); background: var(--fill2); color: var(--ink2); font-size: 10px; cursor: pointer; }
.pager-btns button.on { background: var(--accent); border-color: transparent; color: #fff; }
.pager-btns button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 录音 ---------- */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 9px; }
.rec-card { display: flex; align-items: center; gap: 10px; padding: 11px; border-radius: 14px; background: var(--fill2); border: .5px solid var(--hair); }
.rec-play { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; border: .5px solid rgba(10, 132, 255, .25); background: rgba(10, 132, 255, .12); color: var(--accent); cursor: pointer; }
.rec-play .ic { width: 14px; height: 14px; }
.rec-main { flex: 1; min-width: 0; }
.rec-name { font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { font-size: 8.5px; color: var(--ink3); margin-top: 2px; }
.wave { display: flex; align-items: center; gap: 2px; height: 16px; margin-top: 5px; }
.wave i { width: 2px; border-radius: 2px; background: var(--accent); opacity: .45; }
.player { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-top: 12px; border-radius: 15px; background: var(--glass2); border: .5px solid var(--stroke); backdrop-filter: blur(24px); box-shadow: var(--shadow); }
.player .rec-play { width: 32px; height: 32px; }
.player .track { flex: 1; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.player .track i { display: block; height: 100%; width: 0%; border-radius: 2px; background: var(--accent); transition: width .2s linear; }

/* ---------- 屏蔽 ---------- */
.seg-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--fill2); border: .5px solid var(--hair); }
.seg-tabs button { height: 28px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink2); font-size: 10.5px; font-weight: 600; cursor: pointer; }
.seg-tabs button.on { background: var(--seg-on); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.rule-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 76px minmax(0, 1fr) 92px; gap: 9px; align-items: center; min-width: 620px; padding: 9px 13px; border-bottom: .5px solid var(--hair); font-size: 11px; }
.rule-row:last-child { border-bottom: 0; }
.rule-row:hover { background: var(--fill2); }

/* ---------- 设置 ---------- */
.settings-layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 12px; }
.set-nav { padding: 7px; display: flex; flex-direction: column; gap: 2px; align-self: start; position: sticky; top: 0; }
.set-item { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 9px; border: 0; border-radius: 9px; background: transparent; color: var(--ink2); font-size: 11px; font-weight: 500; cursor: pointer; text-align: left; }
.set-item .ic { width: 15px; height: 15px; opacity: .8; }
.set-item:hover { background: var(--fill2); color: var(--ink); }
.set-item.on { background: var(--fill2); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 .5px var(--stroke); }
.set-panel { display: none; }
.set-panel.on { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 13px; background: var(--fill2); border: .5px solid var(--hair); }
.switch-row .grow { flex: 1; min-width: 0; }
.switch-row .t { font-size: 11.5px; font-weight: 600; }
.switch-row .s { font-size: 9.5px; color: var(--ink3); margin-top: 2px; line-height: 1.45; }
.switch { position: relative; width: 40px; height: 24px; flex: none; display: block; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 20px; background: var(--fill); transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch.sm { width: 34px; height: 20px; }
.switch.sm i::after { width: 16px; height: 16px; }
.switch.sm input:checked + i::after { transform: translateX(14px); }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; margin-top: 8px; }
.channel { display: flex; align-items: center; gap: 6px; height: 33px; padding: 0 9px; border-radius: 10px; border: .5px solid var(--hair); background: var(--fill2); font-size: 10px; font-weight: 600; cursor: pointer; color: var(--ink2); text-align: left; }
.channel .ck { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--ink4); flex: none; display: grid; place-items: center; }
.channel .ck .ic { width: 9px; height: 9px; opacity: 0; }
.channel.on { border-color: rgba(10, 132, 255, .4); background: rgba(10, 132, 255, .09); color: var(--accent); }
.channel.on .ck { background: var(--accent); border-color: var(--accent); color: #fff; }
.channel.on .ck .ic { opacity: 1; }
.color-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .16); }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--glass2), inset 0 0 0 1px rgba(0, 0, 0, .16); }
.radio-card { display: flex; gap: 10px; padding: 11px 12px; border-radius: 13px; background: var(--fill2); border: .5px solid var(--hair); cursor: pointer; }
.radio-card.on { border-color: rgba(10, 132, 255, .4); background: rgba(10, 132, 255, .08); }
.radio-card .rd { width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--ink4); flex: none; margin-top: 1px; display: grid; place-items: center; }
.radio-card.on .rd { border-color: var(--accent); background: var(--accent); }
.radio-card.on .rd::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.radio-card .t { font-size: 11px; font-weight: 600; }
.radio-card .s { font-size: 9.5px; color: var(--ink3); line-height: 1.5; margin-top: 2px; }
.channel-form { margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--fill2); border: .5px solid var(--hair); }

body[data-density="compact"] .card { padding: 12px; border-radius: 18px; }
body[data-density="compact"] .data-head,
body[data-density="compact"] .data-row,
body[data-density="compact"] .rule-row { padding: 6px 13px; }
body[data-density="compact"] .metric { min-height: 102px; }
body[data-density="cozy"] .data-head,
body[data-density="cozy"] .data-row,
body[data-density="cozy"] .rule-row { padding: 13px 15px; }

/* ---------- 弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-bg { position: absolute; inset: 0; background: rgba(10, 14, 24, .42); backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.modal-panel {
  position: relative; z-index: 1; width: min(580px, 100%); max-height: 84vh; overflow: auto; padding: 18px;
  border-radius: 24px; background: var(--glass2); border: .5px solid var(--stroke);
  box-shadow: 0 44px 100px -34px rgba(0, 0, 0, .6), inset 0 .5px 0 var(--spec);
  backdrop-filter: blur(36px) saturate(180%);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.modal-title { font-size: 15px; font-weight: 650; letter-spacing: -.2px; }
.modal-sub { font-size: 10px; color: var(--ink3); margin-top: 3px; line-height: 1.5; }
.modal-close { width: 28px; height: 28px; border-radius: 50%; border: .5px solid var(--hair); background: var(--fill2); color: var(--ink2); display: grid; place-items: center; cursor: pointer; flex: none; }
.modal-close .ic { width: 12px; height: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 6px; margin-top: 16px; padding-top: 12px; border-top: .5px solid var(--hair); }
.cmd-card { display: flex; gap: 9px; padding: 9px; border-radius: 11px; background: var(--fill2); border: .5px solid var(--hair); cursor: pointer; }
.cmd-card:hover { background: var(--fill); }
.cmd-card .tile { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(10, 132, 255, .12); color: var(--accent); flex: none; }
.cmd-card .tile .ic { width: 14px; height: 14px; }
.cmd-card .t { font-size: 11px; font-weight: 600; }
.cmd-card .c { font-family: var(--mono); font-size: 8.5px; color: var(--ink3); margin-top: 2px; }
.cmd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.help-code { display: inline-block; font-family: var(--mono); font-size: 10px; color: var(--accent); background: rgba(10, 132, 255, .1); padding: 2px 6px; border-radius: 6px; margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 120; transform: translate(-50%, 12px);
  opacity: 0; pointer-events: none; transition: .24s; display: flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 20px; background: var(--glass2); border: .5px solid var(--stroke);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .5), inset 0 .5px 0 var(--spec);
  backdrop-filter: blur(24px); font-size: 11.5px; font-weight: 500; color: var(--ink); white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast .ic { width: 14px; height: 14px; color: var(--green); }
.toast.err .ic { color: var(--red); }

.popover {
  position: fixed; top: 82px; right: 20px; z-index: 90; width: 252px; padding: 13px; border-radius: 18px;
  background: var(--glass2); border: .5px solid var(--stroke);
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .5), inset 0 .5px 0 var(--spec);
  backdrop-filter: blur(30px); display: none;
}
.popover.open { display: block; animation: pageIn .18s ease; }
.pop-head { font-size: 11.5px; font-weight: 650; margin-bottom: 9px; }
.pop-label { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--ink3); margin: 12px 0 6px; }
.pop-label span { color: var(--accent); font-weight: 700; }
.pop-note { font-size: 8.5px; color: var(--ink3); line-height: 1.5; margin-top: 7px; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: var(--fill); outline: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .08); }
/* 移动端抽屉遮罩：必须与 .sidebar 同处 .app 的层叠上下文，
   否则会被 .app 的 z-index:2 压住，连抽屉一起糊掉 */
.scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(10, 14, 24, .36);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
}
.scrim.on { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1220px) {
  .app { grid-template-columns: 214px minmax(0, 1fr); }
  .ov-main, .tasks-layout, .schedules-layout { grid-template-columns: 1fr; }
  .devices-layout { grid-template-columns: 300px minmax(0, 1fr); }
  .task-types { grid-template-columns: repeat(3, 1fr); }
  .metric-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .app { display: block; padding: 10px; }
  .sidebar { position: fixed; left: 10px; top: 10px; bottom: 10px; width: 250px; z-index: 60; transform: translateX(-112%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
  /* 抽屉是覆盖层，需比内嵌侧栏更实一些，否则后面的内容会透上来 */
  .sidebar.open {
    transform: none;
    background: var(--drawer);
    backdrop-filter: blur(42px) saturate(180%);
    -webkit-backdrop-filter: blur(42px) saturate(180%);
    box-shadow: 0 40px 90px -30px rgba(10, 16, 30, .55), inset 0 .5px 0 var(--spec);
  }
  .workspace { height: calc(100vh - 20px); }
  .menu-btn { display: grid; }
  .top-sep, .top-device { display: none; }
  .devices-layout, .settings-layout { grid-template-columns: 1fr; }
  .set-nav { flex-direction: row; overflow-x: auto; position: static; }
  .set-item { flex: none; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
}
@media (max-width: 640px) {
  .metric-grid { grid-template-columns: 1fr; }
  .task-types { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; }
  .hero-actions { width: 100%; flex-wrap: wrap; }
  .status-pill { display: none; }
  .cmd-grid { grid-template-columns: 1fr; }
  .mini-metrics { grid-template-columns: 1fr; }
}
