/* ============================================================
 * 远程设备管理后台 — 深色运维主题
 * ============================================================ */

:root {
  --bg: #0a0e14;
  --bg2: #0e141d;
  --panel: #121a26;
  --panel2: #17212f;
  --panel3: #1c2836;
  --line: #22303f;
  --line2: #2d3f52;
  --txt: #dce8f5;
  --muted: #8499ae;
  --dim: #5d7288;
  --acc: #3ba7ff;
  --acc2: #00d6a4;
  --warn: #ffb020;
  --err: #ff5c72;
  --radius: 10px;
  --shadow: 0 8px 26px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 12% -10%, #12243a 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #101c2c 0%, transparent 55%),
    var(--bg);
  color: var(--txt);
  font: 14px/1.55 "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.wrap { word-break: break-all; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12.5px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #26374a; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #33495f; }

/* ---------------------------- 通用控件 ---------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--txt);
  transition: background .15s, border-color .15s, transform .06s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel3); border-color: #3a5470; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-primary { background: linear-gradient(180deg, #2f93e6, #1f77c4); border-color: #2b86d2; color: #f2f9ff; font-weight: 600; }
.btn-primary:hover { background: linear-gradient(180deg, #3aa2f5, #2484d6); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--panel2); }
.btn-block { width: 100%; padding: 10px; margin-top: 6px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: 0 0 32px;
  border-radius: 8px; border: 1px solid var(--line2);
  background: var(--panel2); color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1;
}
.icon-btn:hover { color: var(--txt); background: var(--panel3); }

input[type="text"], input[type="search"], input[type="password"], input[type="number"], select {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line2); background: #0b1119; color: var(--txt);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--acc); box-shadow: 0 0 0 3px rgba(59, 167, 255, .14); }
input[type="search"]::-webkit-search-cancel-button { filter: invert(.6); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px;
  background: #22303f; outline: none; width: 100%; margin: 6px 0 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--acc); border: 2px solid #0a1119; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%; background: var(--acc);
  border: 2px solid #0a1119; cursor: pointer;
}

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.chk { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; cursor: pointer; user-select: none; }
.chk input { width: 15px; height: 15px; accent-color: var(--acc); }

/* ---------------------------- 登录页 ---------------------------- */

.login-view {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.login-card {
  width: 100%; max-width: 370px; padding: 30px 28px 24px;
  background: linear-gradient(180deg, rgba(23, 33, 47, .96), rgba(13, 19, 27, .98));
  border: 1px solid var(--line2); border-radius: 16px;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .6);
  animation: pop .28s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #2f93e6, #0f6fb5);
  color: #fff; font-size: 22px; box-shadow: 0 8px 20px rgba(47, 147, 230, .35);
}
.login-card h1 { margin: 0; font-size: 19px; text-align: center; letter-spacing: .5px; }
.login-sub { margin: 6px 0 22px; text-align: center; color: var(--dim); font-size: 12px; }
.login-error { min-height: 18px; margin: 2px 0 6px; color: var(--err); font-size: 12.5px; }
.login-tip { margin: 14px 0 0; text-align: center; color: var(--dim); font-size: 11.5px; }

/* ---------------------------- 整体布局 ---------------------------- */

.app-view { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100vh; }

.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, #0d141e, #0a1017);
  border-right: 1px solid var(--line);
}

.sb-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.brand-mark {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #2f93e6, #12629f); color: #fff; font-size: 15px;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-txt b { font-size: 14.5px; letter-spacing: .4px; }
.brand-txt small { color: var(--dim); font-size: 11.5px; }

.sb-search { display: flex; gap: 8px; padding: 10px 14px; }
.sb-search input { flex: 1 1 auto; }

.device-list { flex: 1 1 auto; overflow-y: auto; padding: 4px 10px 12px; }

.dev-group-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 6px 6px;
  font-size: 11.5px; letter-spacing: 1px; color: var(--dim); text-transform: uppercase;
}
.dev-group-head .count {
  font-size: 11px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 20px; padding: 0 7px; color: var(--muted); letter-spacing: 0;
}

.dev-item {
  position: relative; padding: 9px 11px; margin-bottom: 7px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.dev-item:hover { background: var(--panel2); border-color: var(--line2); }
.dev-item.active { border-color: var(--acc); background: rgba(59, 167, 255, .1); box-shadow: 0 0 0 1px rgba(59, 167, 255, .25) inset; }
.dev-item.offline { opacity: .62; }
.dev-item-top { display: flex; align-items: center; gap: 8px; }
.dev-dot { width: 8px; height: 8px; border-radius: 50%; background: #46586b; flex: 0 0 8px; }
.dev-dot.on { background: var(--acc2); box-shadow: 0 0 8px rgba(0, 214, 164, .75); }
.dev-id { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.dev-batt { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dev-batt.low { color: var(--err); }
.dev-model { margin-top: 3px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-meta-line { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; font-size: 11.5px; color: var(--dim); }
.dev-item-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

.mini {
  font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
  background: var(--panel3); border: 1px solid var(--line2); color: var(--muted);
}
.mini.ok { color: #6ff0cd; border-color: rgba(0, 214, 164, .35); background: rgba(0, 214, 164, .1); }
.mini.live { color: #ffd591; border-color: rgba(255, 176, 32, .4); background: rgba(255, 176, 32, .12); }

.empty { padding: 22px 10px; text-align: center; color: var(--dim); font-size: 12.5px; }

.sb-foot {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 9px 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--dim); background: #0a1017;
}
.sb-foot .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--acc2); }
.sb-foot .sep { color: #33465a; }
.ws-badge {
  margin-left: auto; font-size: 10.5px; padding: 1px 7px; border-radius: 20px;
  border: 1px solid var(--line2); color: var(--dim);
}
.ws-badge.on { color: #6ff0cd; border-color: rgba(0, 214, 164, .4); background: rgba(0, 214, 164, .1); }
.ws-badge.off { color: #ff9aa8; border-color: rgba(255, 92, 114, .35); background: rgba(255, 92, 114, .08); }

/* ---------------------------- 主区域 ---------------------------- */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px; padding: 12px 18px;
  border-bottom: 1px solid var(--line); background: rgba(13, 20, 29, .75);
  backdrop-filter: blur(6px);
}
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat {
  min-width: 92px; padding: 5px 12px; border-radius: 9px;
  background: var(--panel); border: 1px solid var(--line);
  display: flex; flex-direction: column; line-height: 1.25;
}
.stat-label { font-size: 11px; color: var(--dim); }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stat b.v-online { color: var(--acc2); }
.stat b.v-accent { color: var(--acc); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 11.5px; color: var(--muted); padding: 3px 10px;
  border: 1px solid var(--line2); border-radius: 20px; background: var(--panel);
}

.tabs { display: flex; gap: 4px; padding: 8px 18px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab-btn {
  position: relative; padding: 8px 14px 10px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; white-space: nowrap;
  font-size: 13.5px;
}
.tab-btn:hover { color: var(--txt); background: rgba(255, 255, 255, .03); }
.tab-btn.active { color: var(--txt); font-weight: 600; }
.tab-btn.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px;
  background: var(--acc); border-radius: 2px; box-shadow: 0 0 10px rgba(59, 167, 255, .8);
}

.content { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 26px; min-height: 0; }
.panel { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-empty {
  margin-top: 8vh; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.empty-ico { font-size: 44px; color: #26384b; }

.card {
  background: linear-gradient(180deg, rgba(23, 33, 47, .75), rgba(16, 23, 33, .9));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 14.5px; letter-spacing: .3px; }
.card-title { min-width: 0; flex: 1 1 200px; }
#dev-title { margin: 0 0 2px; font-size: 16px; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  border: 1px solid var(--line2); background: var(--panel3); color: var(--muted);
}
.badge.ok { color: #6ff0cd; border-color: rgba(0, 214, 164, .35); background: rgba(0, 214, 164, .1); }
.badge.muted { color: var(--dim); }
.badge.warn { color: #ffd591; border-color: rgba(255, 176, 32, .4); background: rgba(255, 176, 32, .1); }

.device-layout { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(340px, 46%); gap: 14px; align-items: start; }
.dev-col-left, .dev-col-right { min-width: 0; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.meta-item { background: #0d141e; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.meta-k { font-size: 11px; color: var(--dim); }
.meta-v { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }

.raw-info { margin-top: 10px; }
.raw-info summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.raw-pre {
  margin: 8px 0 0; padding: 10px; max-height: 220px; overflow: auto;
  background: #080d13; border: 1px solid var(--line); border-radius: 8px;
  font-size: 11.5px; color: #9fb6cc; white-space: pre-wrap; word-break: break-all;
}

/* ---------------------------- 镜像 ---------------------------- */

.mirror-tools { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
#btn-stream.active { background: rgba(255, 92, 114, .16); border-color: rgba(255, 92, 114, .5); color: #ffb3be; }

.mirror-wrap {
  position: relative; width: 100%; height: min(64vh, 660px); min-height: 340px;
  background: radial-gradient(circle at 50% 30%, #0b1420, #05080c 70%);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
#mirror-img { max-width: 100%; max-height: 100%; display: block; pointer-events: none; user-select: none; }
.mirror-overlay {
  position: absolute; cursor: crosshair; border-radius: 2px;
  background: transparent; touch-action: none;
}
.mirror-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px; text-align: center; color: var(--dim); font-size: 12.5px; pointer-events: none;
}
.mirror-status {
  position: absolute; left: 8px; top: 8px; font-size: 10.5px; color: var(--muted);
  background: rgba(6, 10, 15, .72); border: 1px solid var(--line); border-radius: 20px;
  padding: 1px 9px; pointer-events: none; max-width: 70%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mirror-ghost {
  position: absolute; height: 2px; background: #4ade80; border-radius: 2px;
  transform-origin: 0 50%; pointer-events: none; opacity: .9;
  box-shadow: 0 0 8px rgba(74, 222, 128, .8); z-index: 5;
}

.mirror-qual { display: flex; align-items: flex-end; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.qual-item { flex: 1 1 120px; font-size: 11.5px; color: var(--muted); }
.qual-item b { color: var(--acc); font-variant-numeric: tabular-nums; }

/* ---------------------------- 命令面板 ---------------------------- */

.cmd-groups { display: flex; flex-direction: column; gap: 14px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.cmd-group-title {
  font-size: 11.5px; letter-spacing: 1px; color: var(--dim); text-transform: uppercase;
  margin-bottom: 7px; display: flex; align-items: center; gap: 8px;
}
.cmd-group-title::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.cmd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.cmd-btn {
  padding: 8px 6px; font-size: 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--panel2); color: #c9d9e8;
  transition: background .14s, border-color .14s, color .14s, transform .06s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cmd-btn:hover { background: #22303f; border-color: #3a5470; color: #fff; }
.cmd-btn:active { transform: translateY(1px); }
.cmd-btn.primary { border-color: rgba(59, 167, 255, .5); color: #a9d8ff; background: rgba(59, 167, 255, .12); }
.cmd-btn.danger { border-color: rgba(255, 92, 114, .38); color: #ffb3be; background: rgba(255, 92, 114, .08); }
.cmd-hint { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ---------------------------- 表格 ---------------------------- */

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head .toolbar { margin-bottom: 0; margin-left: auto; }
.card-head .toolbar input[type="search"] { width: 180px; }
.card-head .toolbar input[type="text"] { width: 220px; }

.sub-panel { animation: fade .16s ease-out; }
.cmd-card .card-head, .mirror-card .card-head { align-items: center; }
.cmd-card .card-head h2, .mirror-card .card-head h2 { margin: 0; }

.sub-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.sub-tab {
  padding: 7px 13px; border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.sub-tab:hover { color: var(--txt); }
.sub-tab.active { color: var(--txt); border-bottom-color: var(--acc); font-weight: 600; }

.table-wrap { max-height: 56vh; overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: #14202c; color: var(--muted); font-weight: 600; text-align: left;
  padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 11.5px; letter-spacing: .4px;
}
.tbl tbody td { padding: 8px 10px; border-bottom: 1px solid rgba(34, 48, 63, .65); vertical-align: top; }
.tbl tbody tr:hover { background: rgba(59, 167, 255, .05); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl td.pw { color: #ffd591; }
.empty-cell { text-align: center; color: var(--dim); padding: 24px 10px !important; }
.mini-btn {
  padding: 2px 9px; font-size: 11.5px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--muted);
}
.mini-btn:hover { color: var(--txt); border-color: var(--acc); }
.mini-btn.warn { color: #ffb3be; border-color: rgba(255, 92, 114, .4); }
.switch {
  position: relative; width: 38px; height: 20px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--line2); background: #1a2431; transition: background .15s, border-color .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #6d8298; transition: left .15s, background .15s;
}
.switch.on { background: rgba(0, 214, 164, .18); border-color: rgba(0, 214, 164, .55); }
.switch.on::after { left: 20px; background: var(--acc2); }

.plain-cell { color: var(--acc2); font-family: ui-monospace, Consolas, monospace; }
.cipher-cell { color: var(--dim); word-break: break-all; max-width: 320px; }

.log-list {
  max-height: 58vh; overflow-y: auto; background: #080d13;
  border: 1px solid var(--line); border-radius: 9px; padding: 8px;
}
.log-row {
  display: grid; grid-template-columns: 132px 84px 1fr; gap: 8px;
  padding: 5px 7px; border-radius: 6px; font-size: 12px; align-items: baseline;
}
.log-row:hover { background: rgba(59, 167, 255, .06); }
.log-time { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.log-type {
  font-size: 10.5px; padding: 0 6px; border-radius: 4px; justify-self: start;
  background: var(--panel3); border: 1px solid var(--line2); color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; max-width: 84px; white-space: nowrap;
}
.log-text { color: #b9cbdd; word-break: break-all; white-space: pre-wrap; }

/* ---------------------------- 应用列表 ---------------------------- */

.apps-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 8px; max-height: 56vh; overflow-y: auto;
}
.app-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
}
.app-row:hover { border-color: var(--line2); background: var(--panel2); }
.app-ico {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: 8px;
  background: #0b1119; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--dim); overflow: hidden;
}
.app-ico img { width: 100%; height: 100%; object-fit: contain; }
.app-main { min-width: 0; flex: 1 1 auto; }
.app-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-pkg { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------- Shell ---------------------------- */

.shell-out {
  margin: 0 0 10px; height: 52vh; overflow-y: auto; padding: 10px 12px;
  background: #06090e; border: 1px solid var(--line); border-radius: 9px;
  font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12.5px;
  color: #a8f0c6; white-space: pre-wrap; word-break: break-all;
}
.shell-out .line { padding: 1px 0; }
.shell-out .line.cmd { color: #7fc4ff; }
.shell-out .line.err { color: #ff9aa8; }
.shell-out .line.sys { color: var(--dim); }
.shell-in-row { display: flex; align-items: center; gap: 8px; }
.shell-prompt { color: var(--acc2); font-family: ui-monospace, Consolas, monospace; }
.shell-in-row input { flex: 1 1 auto; font-family: ui-monospace, Consolas, monospace; }

/* ---------------------------- toast ---------------------------- */

.toast-wrap {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 300; pointer-events: none; width: min(92vw, 620px);
}
.toast {
  padding: 9px 16px; border-radius: 9px; font-size: 13px; max-width: 100%;
  background: #17222f; border: 1px solid var(--line2); color: var(--txt);
  box-shadow: var(--shadow); animation: toastIn .2s ease-out;
  word-break: break-all;
}
.toast.ok { border-color: rgba(0, 214, 164, .5); background: #10261f; color: #9df5da; }
.toast.err { border-color: rgba(255, 92, 114, .5); background: #2a1218; color: #ffb3be; }
.toast.info { border-color: rgba(59, 167, 255, .45); background: #101e2c; color: #b8dcff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.copy-tmp { position: fixed; left: -9999px; top: 0; }

/* ---------------------------- 弹窗 ---------------------------- */

.modal-root { position: fixed; inset: 0; z-index: 250; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 10, .72); backdrop-filter: blur(2px); }
.modal {
  position: relative; width: 100%; max-width: 470px; max-height: 88vh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #17212f, #101821);
  border: 1px solid var(--line2); border-radius: 13px; box-shadow: 0 24px 60px rgba(0, 0, 0, .65);
  animation: pop .18s ease-out;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 14.5px; flex: 1 1 auto; }
.modal-body { padding: 15px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 11px 15px; border-top: 1px solid var(--line); }
.form-grid { display: flex; flex-direction: column; gap: 2px; }
.deploy-steps { margin: 0; padding-left: 18px; color: #c2d4e4; font-size: 12.5px; }
.deploy-steps li { margin-bottom: 7px; }
.deploy-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.code-inline {
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
  background: #0b1119; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}

/* ---------------------------- 响应式 ---------------------------- */

.only-mobile { display: none; }

@media (max-width: 1280px) {
  .device-layout { grid-template-columns: minmax(0, 1fr); }
  .dev-col-right { order: -1; }
}

@media (max-width: 900px) {
  .app-view { grid-template-columns: minmax(0, 1fr); }
  .only-mobile { display: inline-flex; }
  .sidebar {
    position: fixed; z-index: 80; left: 0; top: 0; bottom: 0; width: 300px; max-width: 86vw;
    transform: translateX(-102%); transition: transform .22s ease-out;
    box-shadow: 22px 0 48px rgba(0, 0, 0, .55);
  }
  .sidebar.open { transform: none; }
  .drawer-mask {
    position: fixed; inset: 0; z-index: 70; background: rgba(3, 6, 10, .6);
    backdrop-filter: blur(1px);
  }
  .topbar { padding: 10px 12px; gap: 8px; }
  .stat { min-width: 74px; padding: 4px 9px; }
  .stat b { font-size: 15px; }
  .content { padding: 12px 12px 22px; }
  .tabs { padding: 6px 12px 0; }
  .mirror-wrap { height: 52vh; min-height: 280px; }
  .log-row { grid-template-columns: 96px 1fr; }
  .log-type { display: none; }
  .card-head .toolbar input[type="search"],
  .card-head .toolbar input[type="text"] { width: 100%; }
  .card-head .toolbar { margin-left: 0; width: 100%; }
}

@media (max-width: 560px) {
  .stats { gap: 6px; }
  .stat { min-width: 64px; }
  .top-actions .pill { display: none; }
  .mirror-qual { gap: 8px; }
}

/* ===================== 密码采集页 ===================== */
.pill-btn {
  border: 1px solid #24314d;
  background: #101a2c;
  color: #9fb0cc;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12.5px;
  line-height: 1.4;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.pill-btn:hover { background: #16233a; color: #d6e5ff; border-color: #2f4568; }
.pill-btn.active { background: #1d3a63; border-color: #2f6fed; color: #dbe7ff; font-weight: 600; }

.pin-filters { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 320px; }

#ctab-lock .toolbar { flex-wrap: wrap; row-gap: 8px; }

.pin-summary { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 2px 14px; }
.pin-card {
  background: #0f1726;
  border: 1px solid #1e2b44;
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 168px;
  max-width: 260px;
}
.pin-card .k { font-size: 11.5px; color: #7c8ba6; letter-spacing: .3px; }
.pin-card .v {
  font-size: 20px; color: #eaf1ff; margin-top: 3px;
  font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px;
}
.pin-card .t { font-size: 11.5px; color: #5d6d8a; margin-top: 5px; }

.pin-val {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px; color: #6ee7a0; letter-spacing: 1.2px;
}
.pin-src {
  display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 8px;
  background: #16233a; color: #9fb4d6; white-space: nowrap;
}
.pin-src.clip { background: #12351f; color: #6ee7a0; }
.pin-src.setup { background: #2a2140; color: #c4a6ff; }
.pin-src.unlock { background: #1f2b3f; color: #8fb6ff; }

.build-tag {
  font-size: 11.5px; color: #6b7c98; background: #0f1726; border: 1px solid #1e2b44;
  border-radius: 999px; padding: 3px 10px; margin-left: auto; white-space: nowrap;
}

/* ===================== 命令面板：高级折叠 ===================== */
.adv-group { border-top: 1px dashed #1e2b44; padding-top: 10px; margin-top: 4px; }
.adv-toggle {
  width: 100%; text-align: left; background: transparent; border: 0;
  color: #7c8ba6; font-size: 12.5px; padding: 6px 2px; cursor: pointer;
}
.adv-toggle:hover { color: #cfe0ff; }
.adv-body { padding-top: 6px; }
.adv-body .cmd-btn { opacity: .92; }

.mini.warn { background: #3a2a12; color: #f0b45a; }

/* ===================== 屏幕助手 ===================== */
.ui-card { margin-top: 14px; }
.mini-chk { font-size: 12px; color: #9fb0cc; margin-left: 8px; white-space: nowrap; }

.ui-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 2px 10px;
  border-bottom: 1px solid #1c2740;
}
.ui-toolbar #ui-count { margin-right: auto; }

.ui-list {
  max-height: 340px; overflow-y: auto; padding: 8px 2px;
}
.ui-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid #1c2740; background: #0e1728; margin-bottom: 6px;
  transition: background .12s, border-color .12s;
}
.ui-row:hover { background: #14213a; border-color: #2f6fed; }
.ui-row.clickable { border-left: 3px solid #2f9e5e; }
.ui-row.editable { border-left: 3px solid #f0b45a; }
.ui-row-main { flex: 1; min-width: 0; }
.ui-row-text {
  font-size: 13.5px; color: #e6ecf7; word-break: break-all;
}
.ui-row-zh {
  font-size: 12.5px; color: #6ee7a0; margin-top: 2px;
}
.ui-row-meta {
  font-size: 11px; color: #5d6d8a; margin-top: 3px;
  font-family: ui-monospace, Consolas, monospace;
}
.ui-row-tag { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.ui-loading { color: #6b7a94; font-size: 12.5px; padding: 14px 4px; }

.ui-input-row { display: flex; gap: 8px; padding-top: 10px; }
.ui-input-row input {
  flex: 1; background: #0e1728; border: 1px solid #24314d; color: #e6ecf7;
  border-radius: 9px; padding: 8px 11px; font-size: 13px;
}
.ui-input-row input:focus { outline: none; border-color: #2f6fed; }
.ui-hint { padding-top: 8px; line-height: 1.7; }
