/* ============================================================
 * BigAuto 用户中控样式 · 浅色高信息密度（移动端优先）
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

:root {
  --primary: #2563eb;
  --primary-weak: #eff6ff;
  --green: #16a34a;
  --green-weak: #dcfce7;
  --yellow: #b45309;
  --yellow-weak: #fef3c7;
  --red: #dc2626;
  --red-weak: #fee2e2;
  --gray: #6b7280;
  --gray-weak: #f3f4f6;
  --text: #111827;
  --text-sub: #4b5563;
  --line: #e5e7eb;
  --bg: #eef3f9;
  --card: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(17, 24, 39, .06);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }

.muted { color: var(--gray); font-size: 13px; }
.small { font-size: 12px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 按钮 / 输入 ---------- */
.btn {
  min-height: 40px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: 10px;
  font-size: 15px; background: #e5e7eb; color: var(--text);
  transition: opacity .15s, background .15s;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: var(--card); border-color: #d1d5db; color: var(--text-sub); }
.btn-ghost {
  background: #fff; border-color: #dbe3ef; color: var(--text-sub);
}
.btn-ghost:hover { border-color: #93c5fd; color: var(--primary); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 14px; }
.btn-block { width: 100%; }

.input {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid #e2e8f0; border-radius: 12px; background: #f5f8fc;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input:focus {
  outline: none; background: #fff; border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.textarea { resize: vertical; line-height: 1.6; min-height: 96px; padding: 12px 14px; }
.select { min-height: 38px; padding: 6px 10px; width: auto; flex: 1; background: #fff; }

/* ---------- 登录/注册页 ---------- */
.auth-view {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(700px 360px at 50% -8%, rgba(37,99,235,.12), transparent 60%),
    radial-gradient(520px 280px at 90% 90%, rgba(14,165,233,.08), transparent 55%),
    #eef3f9;
}
.auth-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.auth-grid {
  position: absolute; inset: -20%;
  background-image:
    linear-gradient(rgba(37,99,235,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,.07) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, #000 35%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at center, #000 35%, transparent 78%);
  animation: auth-grid-drift 28s linear infinite;
}
.auth-scan {
  position: absolute; left: 0; right: 0; height: 90px;
  background: linear-gradient(180deg, transparent, rgba(37,99,235,.07), transparent);
  animation: auth-scan 7.5s ease-in-out infinite;
}
.auth-node {
  position: absolute; width: 8px; height: 8px; border-radius: 50%;
  background: #60a5fa; box-shadow: 0 0 0 7px rgba(96,165,250,.12);
  animation: auth-pulse 3.6s ease-in-out infinite;
}
.auth-node.n1 { left: 14%; top: 22%; animation-delay: 0s; }
.auth-node.n2 { right: 16%; top: 30%; animation-delay: .7s; background: #38bdf8; }
.auth-node.n3 { left: 20%; bottom: 20%; animation-delay: 1.3s; background: #34d399; }
.auth-node.n4 { right: 18%; bottom: 24%; animation-delay: 1.9s; }
.auth-beam {
  position: absolute; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(37,99,235,.35), transparent);
  animation: auth-beam 6s ease-in-out infinite;
}
.auth-beam.b1 { top: 36%; left: 12%; width: 28%; }
.auth-beam.b2 { bottom: 32%; right: 12%; width: 24%; animation-delay: 1.8s; }

.auth-card {
  position: relative;
  width: min(400px, 100%);
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(191,219,254,.75);
  border-radius: 22px;
  padding: 28px 26px 22px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, .08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: auth-card-in .5s ease both;
}
.auth-card::before {
  content: "";
  position: absolute; left: 22px; right: 22px; top: 0; height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #60a5fa, #34d399, transparent);
}
.auth-brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 22px;
}
.auth-mark {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #eff6ff, #fff);
  color: var(--primary);
  font-weight: 700; letter-spacing: .04em; font-size: 14px;
  border: 1px solid #dbeafe;
}
.auth-brand-name { font-size: 15px; font-weight: 700; letter-spacing: .04em; color: var(--text); }
.auth-brand-sub { margin-top: 2px; font-size: 12px; color: var(--gray); }
.auth-form.auth-enter { animation: auth-rise .32s ease both; }
.auth-title { font-size: 24px; font-weight: 700; margin-bottom: 18px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--gray); }
.link-btn { background: none; border: none; color: var(--primary); font-size: 14px; padding: 0 2px; min-height: 0; height: auto; }
.link-btn:hover { text-decoration: underline; }

.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 7px; font-weight: 500; }
.field-control {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 14px;
  border-radius: 14px;
  background: #f5f8fc;
  border: 1px solid #e2e8f0;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field-control:focus-within {
  background: #fff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.field-icon { flex: none; color: #94a3b8; }
.field-control:focus-within .field-icon { color: var(--primary); }
.field-control input {
  flex: 1; min-width: 0; border: 0; outline: none;
  background: transparent; min-height: 46px; padding: 0;
  font-size: 16px; color: var(--text);
}
.field-control input::placeholder { color: #a0aec0; }
.auth-submit {
  min-height: 48px; border-radius: 14px; margin-top: 4px;
  font-weight: 600; letter-spacing: .02em;
  transition: transform .15s, opacity .15s, background .15s;
}
.auth-submit:hover:not(:disabled) { transform: translateY(-1px); }
.auth-submit:active:not(:disabled) { transform: translateY(0); }
.form-error {
  background: var(--red-weak); color: var(--red);
  border: 1px solid #fecaca; border-radius: 12px;
  padding: 10px 12px; font-size: 14px; margin-bottom: 14px; word-break: break-all;
}
.notice-warn {
  background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
  border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
@keyframes auth-grid-drift {
  from { transform: translate3d(0,0,0); }
  to { transform: translate3d(-44px, -44px, 0); }
}
@keyframes auth-scan {
  0% { top: -10%; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes auth-pulse {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.25); opacity: 1; }
}
@keyframes auth-beam {
  0%, 100% { opacity: .25; transform: scaleX(.85); }
  50% { opacity: .7; transform: scaleX(1); }
}
@keyframes auth-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 520px) {
  .auth-card { padding: 24px 18px 18px; border-radius: 18px; }
  .auth-beam, .auth-node.n2, .auth-node.n4 { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-grid, .auth-scan, .auth-node, .auth-beam, .auth-card, .auth-form.auth-enter { animation: none; }
}

/* ---------- 主界面氛围底 ---------- */
#mainView {
  display: flex; flex-direction: column; min-height: 100%;
  position: relative;
  background:
    radial-gradient(720px 340px at 12% -8%, rgba(37,99,235,.11), transparent 58%),
    radial-gradient(560px 300px at 96% 8%, rgba(14,165,233,.08), transparent 52%),
    var(--bg);
}
.main-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
.main-grid {
  position: absolute; inset: -10%;
  background-image:
    linear-gradient(rgba(37,99,235,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37,99,235,.055) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 20%, #000 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 20%, #000 20%, transparent 72%);
  animation: auth-grid-drift 36s linear infinite;
}
.main-glow {
  position: absolute; border-radius: 50%;
  filter: blur(2px); opacity: .45;
}
.main-glow.g1 {
  width: 160px; height: 160px; left: -30px; top: 120px;
  background: rgba(147,197,253,.45);
}
.main-glow.g2 {
  width: 180px; height: 180px; right: -40px; top: 40%;
  background: rgba(125,211,252,.35);
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid rgba(191,219,254,.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.topbar-inner {
  max-width: 1280px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #eff6ff, #fff);
  color: var(--primary); font-weight: 700; font-size: 12px; letter-spacing: .04em;
  border: 1px solid #dbeafe;
}
.brand-text { min-width: 0; line-height: 1.15; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: .03em; color: var(--text); }
.brand-sub { margin-top: 2px; font-size: 11px; color: var(--gray); }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-bind { flex: none; border-radius: 10px; }
.user-name {
  font-size: 13px; color: var(--text-sub);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px;
}
.topbar-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: #f5f8fc; border: 1px solid #e2e8f0; color: #64748b;
}
.topbar-icon-btn:hover { border-color: #93c5fd; color: var(--primary); }
.topbar-icon-btn.active {
  background: #eff6ff; border-color: #93c5fd; color: #b45309;
}
.topbar-icon-btn .icon { display: inline-flex; }

/* ---------- 汇总条 ---------- */
.summary-bar-wrap {
  position: sticky; top: 57px; z-index: 19;
  background: linear-gradient(180deg, rgba(238,243,249,.92), rgba(238,243,249,.78));
  padding: 10px 16px 6px;
}
.summary-bar {
  max-width: 1280px; margin: 0 auto;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(191,219,254,.7);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 12px;
}
.summary-item { display: flex; align-items: baseline; gap: 6px; flex: 1; justify-content: center; min-width: 0; }
.summary-num { font-size: 19px; font-weight: 700; line-height: 1.1; }
.summary-label { font-size: 12px; color: var(--gray); white-space: nowrap; }
.summary-sep { width: 1px; height: 22px; background: #e2e8f0; flex: none; }

/* ---------- 内容区 ---------- */
.content { flex: 1; max-width: 1280px; margin: 0 auto; padding: 10px 16px 88px; width: 100%; }

.card {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(191,219,254,.65);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
  padding: 16px; margin-bottom: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h3 { font-size: 16px; }

/* 绑定设备弹层 */
.bind-modal { max-width: 460px; }
.bind-modal .modal-body { padding-bottom: 6px; }
.bind-field { margin-bottom: 0; }
.bind-hint { margin: 10px 0 0; line-height: 1.55; }
.bind-modal .bind-result { margin-top: 12px; }
.field-control-area {
  align-items: flex-start;
  min-height: 0;
  padding: 12px 14px;
}
.field-control-area textarea {
  flex: 1; width: 100%; min-width: 0;
  border: 0; outline: none; resize: vertical;
  background: transparent; min-height: 84px;
  padding: 0; line-height: 1.55;
  font-size: 15px; color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.field-control-area textarea::placeholder { color: #a0aec0; font-family: inherit; }

/* 工具行 / 搜索 + 排序 */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.toolbar-filters {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
}
.search-control { flex: 1.1; min-width: 0; }
.search-input {
  width: 100%; box-sizing: border-box;
  min-height: 40px; padding: 8px 12px;
  border-radius: 12px; border: 1px solid #e2e8f0;
  background: #f5f8fc; color: var(--text); font-size: 14px;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.search-input::placeholder { color: #a0aec0; }
.search-input:focus {
  outline: none; background: #fff; border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.sort-control {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
}
.sort-label { font-size: 13px; color: var(--text-sub); white-space: nowrap; font-weight: 500; }
.select-wrap { position: relative; flex: 1; min-width: 0; }
.select-nice {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  padding: 8px 36px 8px 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background-color: #f5f8fc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  color: var(--text);
  font-size: 14px;
  transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.select-nice:focus {
  outline: none;
  background-color: #fff;
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.refresh-btn {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 12px; min-height: 40px;
  background: #fff; border-color: #e2e8f0; color: var(--text-sub);
}
.refresh-btn:hover { border-color: #93c5fd; color: var(--primary); }
.foot-tip { text-align: center; margin-top: 8px; }

/* ---------- 绑定结果 ---------- */
.bind-result { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.bind-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; line-height: 1.5; word-break: break-all; }
.bind-item .mark { flex: none; font-weight: 600; }
.bind-item.ok .mark { color: var(--green); }
.bind-item.fail .mark { color: var(--red); }

/* ---------- 通用卡片列表：按列排布，展开只拉高所在列 ---------- */
.card-list {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.card-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (min-width: 700px) {
  .card-list, .card-col { gap: 12px; }
}
.loading-tip { text-align: center; color: var(--gray); padding: 30px 0; font-size: 14px; width: 100%; }
.empty-tip {
  text-align: center; color: var(--gray); padding: 30px 10px; font-size: 14px; line-height: 1.8;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  width: 100%;
}

/* ---------- 设备卡（方块式） ---------- */
.device-card, .account-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; position: relative;
  border-top: 4px solid var(--primary);
}
/* 需要关注时只给标题区一层很淡的底，展开后的账号列表仍是白底。 */
.device-card.st-yellow, .account-card.st-yellow {
  background: #fff;
  border-color: #efe6d6;
  border-top-color: #c4841d;
}
.device-card.st-yellow .dev-head,
.account-card.st-yellow .acc-head {
  background: #fbf7ef;
}
.device-card.st-red, .account-card.st-red {
  background: #fff;
  border-color: #f0dede;
  border-top-color: #c24141;
}
.device-card.st-red .dev-head,
.account-card.st-red .acc-head {
  background: #fbf4f4;
}

.dev-head, .acc-head {
  width: 100%; text-align: left; background: none;
  padding: 12px 14px 11px; display: block;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.arrow { float: right; color: var(--gray); font-size: 12px; transition: transform .2s; margin-top: 4px; }
.device-card.open .arrow, .account-card.open .arrow { transform: rotate(180deg); }

/* 行1：名称 + 改名按钮（名称超长省略号，保证每卡行数一致） */
.dev-title-row { display: flex; align-items: center; gap: 8px; }
.dev-name { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-name.is-placeholder { color: var(--gray); font-weight: 500; }
.device-card.st-red .dev-name { color: var(--red); }
.device-card.st-red .dev-name.is-placeholder { color: var(--gray); }

.rename-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: transparent; border: none; color: var(--gray);
}
.rename-btn:active { background: var(--gray-weak); color: var(--primary); }

/* 行2：在线时三项分散对齐；离线只留状态（运行/电量由 JS 隐藏） */
.dev-status-row {
  margin-top: 6px; display: flex; align-items: center; gap: 8px; min-height: 22px;
  flex-wrap: nowrap; font-size: 12px; color: var(--text-sub);
}
.dev-status-row.is-online {
  justify-content: space-between;
}
.dev-status-row.is-offline {
  justify-content: flex-start;
}
.conn { display: inline-flex; align-items: center; gap: 5px; flex: none; }
.conn.is-offline { color: var(--gray); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-on { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.dot-off { background: #d1d5db; box-shadow: 0 0 0 3px rgba(209,213,219,.25); }
.dot-breathe { animation: dot-breathe 2.2s ease-in-out infinite; }
@keyframes dot-breathe {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
  50% { opacity: .42; box-shadow: 0 0 0 5px rgba(22,163,74,.06); }
}
.run-state { flex: none; white-space: nowrap; }
.run-state.is-running { color: var(--green); font-weight: 600; }
.run-state.is-stopped { color: var(--red); font-weight: 600; }
.run-state.is-unknown { color: var(--gray); }
.batt {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-variant-numeric: tabular-nums; color: var(--text-sub);
}
.batt.is-low { color: var(--red); }
.batt.is-mid { color: var(--yellow); }
.batt-icon { display: block; flex: none; }
.batt-pct { font-size: 12px; line-height: 1; }

/* 设备码到 App：同一行高、同一间距 */
.dev-meta {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dev-id-row,
.dev-info .row {
  min-height: 22px;
  display: flex;
  align-items: center;
  margin: 0;
  line-height: 22px;
}
.dev-id-row { gap: 6px; min-width: 0; }
.dev-id {
  flex: 1; min-width: 0;
  font-size: 13px; color: #475569; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.copy-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: #f5f8fc; border: 1px solid #e2e8f0; color: #64748b;
}
.copy-btn:hover { border-color: #93c5fd; color: var(--primary); background: #eff6ff; }
.copy-btn:active { transform: scale(.96); }

.dev-info { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-sub); margin: 0; }
.dev-info .row { gap: 14px; }
.dev-info .row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-info .row > span:last-child { flex: none; }
.dev-info .k { color: var(--gray); flex: none; }
.dev-info .v { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dev-info .expired { color: var(--gray); }
.dev-info .expire-ok { color: var(--green); font-weight: 600; }

/* 行5：账号数 + 哈夫币（大数字醒目） */
.dev-stats {
  margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line);
  display: flex; align-items: center;
}
.dev-stats .stat { flex: 1; display: flex; align-items: baseline; gap: 6px; justify-content: center; min-width: 0; }
.dev-stats .stat-sep { width: 1px; height: 24px; background: var(--line); flex: none; }
.stat-num { font-size: 16px; font-weight: 700; line-height: 1.1; }
.stat-num.coins { color: var(--green); }
.stat-label { font-size: 11px; color: var(--gray); white-space: nowrap; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.5; flex: none;
}
.badge-green { background: var(--green-weak); color: var(--green); }
.badge-gray { background: var(--gray-weak); color: var(--gray); }
.badge-yellow { background: var(--yellow-weak); color: var(--yellow); }
.badge-red { background: var(--red-weak); color: var(--red); }
.badge-blue { background: var(--primary-weak); color: var(--primary); }

/* 展开区 */
.dev-body, .acc-body { border-top: 1px solid var(--line); padding: 12px 14px 12px 12px; display: none; }
.device-card.open .dev-body, .account-card.open .acc-body { display: block; }

.queue-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 13px; margin-bottom: 10px; }
.queue-row .val { color: var(--text); }
.countdown { font-weight: 600; color: var(--primary); }

/* 账号行（设备卡展开态内）——第一行昵称/QQ，第二行固定等级+哈夫币；状态徽章右对齐 */
.acc-list { display: flex; flex-direction: column; gap: 6px; }
.acc-row {
  display: flex; align-items: center; gap: 10px;
  background: #f8f9fb; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 13px;
}
.acc-row-main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.acc-row-line1 {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  min-width: 0;
}
.acc-row-line2 {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.acc-row .acc-name { font-weight: 600; min-width: 0; }
.acc-row .acc-qq,
.acc-row .acc-level { color: var(--gray); }
.acc-row .acc-coins { color: var(--yellow); font-weight: 600; }
.acc-row .acc-status { flex: none; margin-left: auto; align-self: center; }
.snap-empty { color: var(--gray); font-size: 13px; padding: 6px 0; }
.reported-at { margin-top: 10px; }
.dev-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px;
}
.dev-actions .btn { flex: 1; max-width: 48%; }
.dev-actions .btn-run-start { background: var(--green); color: #fff; border-color: transparent; }
.dev-actions .btn-run-stop { background: var(--card); border-color: #d1d5db; color: var(--text-sub); }
.dev-actions .btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 账号卡（我的账号页，方块式） ---------- */
.acc-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  column-gap: 6px;
  row-gap: 2px;
  align-items: center;
}
.acc-card-name { grid-column: 1; grid-row: 1; min-width: 0; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card.st-red .acc-card-name { color: var(--red); }
.acc-top > .acc-badges,
.acc-top > .badge,
.acc-top > .acc-level-badge {
  grid-column: 2;
  justify-self: stretch;
  box-sizing: border-box;
  width: 100%;
  text-align: center;
}
.acc-top > .acc-badges,
.acc-top > .badge { grid-row: 1; }
.acc-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
}
.acc-badges > .badge { width: auto; }
.acc-row .acc-badges { margin-left: auto; flex: none; }
.acc-top > .arrow {
  grid-column: 3; grid-row: 1;
  float: none; margin: 0; width: 14px; text-align: center;
}
.acc-device-name {
  grid-column: 1; grid-row: 2;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; color: var(--gray); line-height: 20px;
}
.acc-level-badge {
  grid-row: 2;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--primary); color: var(--primary);
  border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--primary-weak);
  line-height: 18px;
}
.acc-meta {
  margin-top: 4px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
.acc-meta-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.acc-device-line,
.acc-qq-line,
.acc-info {
  margin: 0;
  min-height: 20px;
  line-height: 20px;
}
.acc-device-line {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 12px; color: var(--gray);
}
.acc-device-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-qq-line { font-size: 12px; color: var(--gray); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-info { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--text-sub); }
.acc-info .row { display: flex; gap: 14px; flex-wrap: wrap; }
.acc-info .k { color: var(--gray); flex: none; }
.acc-info .v { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 备注行常驻占位：无备注也占一行（虚线灰样式），保证所有账号卡等高；
   两种行都带 1px 边框（占位虚线 / 真实透明），高度严格一致 */
.acc-remark-line {
  margin-top: 6px; font-size: 12px; color: #0D47A1; font-weight: 600; background: var(--gray-weak);
  border: 1px solid transparent; border-radius: 8px; padding: 3px 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.acc-remark-line .k { color: var(--gray); font-weight: 400; margin-right: 2px; }
.acc-remark-line.empty { background: transparent; border-color: var(--line); border-style: dashed; color: var(--gray); font-weight: 400; }
.acc-stats {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line);
  display: flex; align-items: center;
}
.acc-stats .stat {
  flex: 1; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.acc-stats .stat-sep { width: 1px; height: 24px; background: var(--line); flex: none; }
.acc-stats .stat-num { font-size: 16px; font-weight: 700; color: var(--green); line-height: 1.1; }
.btn-acc-ctrl {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 28px; min-height: 28px; padding: 0 10px;
  background: #fff; color: var(--green);
  border: 1px solid #e5e7eb; border-radius: 999px;
  box-sizing: border-box; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn-acc-ctrl svg { flex: none; }
.btn-acc-ctrl .acc-ctrl-text {
  font-size: 12px; font-weight: 600; color: var(--gray); line-height: 1; white-space: nowrap;
}
.btn-acc-ctrl:hover:not([disabled]) {
  background: #f0fdf4; border-color: #bbf7d0; color: #15803d;
}
.btn-acc-ctrl:hover:not([disabled]) .acc-ctrl-text { color: #15803d; }
.btn-acc-ctrl:active:not([disabled]) { transform: scale(.96); }
.btn-acc-ctrl.is-busy,
.btn-acc-ctrl[disabled] { opacity: .55; cursor: not-allowed; }

/* 账号卡分享按钮（体力/负重右侧空白） */
.btn-acc-share {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  background: #fff; color: var(--primary);
  border: 1px solid #e5e7eb; border-radius: 999px;
  box-sizing: border-box; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn-acc-share:hover {
  background: var(--primary-weak); border-color: #bfdbfe; color: #1d4ed8;
}
.btn-acc-share:active { transform: scale(.96); }
.btn-acc-share svg { display: block; }
/* 已生成分享链接：红标提示，取消后恢复蓝色 */
.btn-acc-share.is-shared {
  background: var(--red-weak); color: var(--red); border-color: #fca5a5;
}
.btn-acc-share.is-shared:hover {
  background: #fecaca; color: #b91c1c; border-color: #f87171;
}

/* 分享菜单：复用云控弹层样式，加开关行 */
.acc-share-popover .acc-share-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--text);
}
.acc-share-popover .acc-share-switch:hover { background: #f1f5f9; }
.acc-share-popover .switch {
  position: relative; width: 40px; height: 22px; flex: none;
  appearance: none; border: 0; border-radius: 999px;
  background: #cbd5e1; cursor: pointer; transition: background .15s;
}
.acc-share-popover .switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,.2); transition: transform .15s;
}
.acc-share-popover .switch.on { background: var(--primary); }
.acc-share-popover .switch.on::after { transform: translateX(18px); }

/* 账号云控弹出菜单 */
.acc-ctrl-popover {
  position: fixed; z-index: 180;
  min-width: 168px; max-width: min(240px, 86vw);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 28px rgba(15, 23, 42, .16);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.acc-ctrl-popover .acc-ctrl-title {
  padding: 6px 10px 4px; font-size: 12px; color: var(--gray); font-weight: 600;
}
.acc-ctrl-popover button {
  appearance: none; border: 0; background: transparent; text-align: left;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; color: var(--text);
  cursor: pointer; line-height: 1.3;
}
.acc-ctrl-popover button:hover { background: #f1f5f9; }
.acc-ctrl-popover button:disabled { opacity: .45; cursor: not-allowed; }
.acc-ctrl-popover button.is-danger { color: var(--red); }
.acc-ctrl-popover button.is-muted { color: var(--text-sub); }
.acc-ctrl-popover .acc-ctrl-sep {
  height: 1px; background: var(--line); margin: 4px 6px;
}

/* 工作台 2x2 网格（账号卡展开态） */
.stations-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.station-box { background: #f8f9fb; border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 12px; }
.station-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 5px; }
.station-name { font-size: 13px; font-weight: 600; color: var(--text-sub); }
.station-product { color: var(--text); font-weight: 500; min-height: 17px; }
.station-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.station-remain { font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.station-done { color: var(--green); font-weight: 500; }
.station-idle { color: var(--gray); }

/* ---------- 弹窗 / 轻提示 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(17,24,39,.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { width: 100%; max-width: 340px; background: var(--card); border-radius: 14px; max-height: 80vh; display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 0; }
.modal-head h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--gray); line-height: 1; min-height: 0; height: auto; }
.modal-body { padding: 14px 16px; font-size: 14px; line-height: 1.7; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; padding: 0 16px 16px; }
.modal-foot .btn { flex: 1; }

.toast-box { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; width: max-content; max-width: 90vw; }
.toast {
  background: #1f2937; color: #fff; border-radius: 10px; padding: 10px 16px;
  font-size: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.2);
  animation: toast-in .2s ease-out; text-align: center;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 底部 Tab 栏（随视口全宽） ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: none;
  z-index: 30;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  gap: 0;
  margin: 0;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(191,219,254,.75);
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
@media (prefers-reduced-motion: reduce) {
  .main-grid { animation: none; }
}
.tabbar-item {
  flex: 1 1 0;
  max-width: none;
  min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  background: none; border: none; color: var(--gray);
  font-size: 12px; padding: 8px 12px; border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
}
.tabbar-item.active {
  color: var(--primary); font-weight: 600;
  background: rgba(37,99,235,.06);
}
.tabbar-item .tab-icon { display: inline-flex; }

/* ---------- 窄屏微调 ---------- */
@media (max-width: 480px) {
  .summary-num { font-size: 17px; }
  .stations-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}

/* ---------- 双列小卡紧凑化（<700px）----------
 * 注意：必须放在所有卡片基础规则之后，否则同特异性会被后面的基础规则覆盖。
 * 布局哲学：放不下就拆行（到期日期/剩余天数、型号/App 已在 HTML 拆行），不靠截断硬挤。 */
@media (max-width: 699px) {
  .dev-head, .acc-head { padding: 10px 11px 9px; }
  .dev-name, .acc-card-name { font-size: 15px; }
  .dev-id { font-size: 12px; }
  .dev-info, .acc-info { font-size: 12px; gap: 2px; }
  .acc-meta .acc-info { margin-top: 0; }
  .stat-num,
  .acc-stats .stat-num { font-size: 14px; }
  .stat-label { font-size: 10px; }
  .dev-stats, .acc-stats { margin-top: 6px; padding-top: 6px; }
  .acc-remark-line { font-size: 11px; padding: 2px 7px; margin-top: 4px; }
  .acc-level-badge { font-size: 11px; padding: 0 6px; line-height: 16px; }
  .acc-top > .badge,
  .acc-top > .acc-badges .badge { font-size: 11px; }
  .acc-device-line { white-space: nowrap; min-height: 20px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar-filters { flex: 1 1 100%; }
  .search-control, .sort-control { flex: 1 1 0; min-width: 0; }
}

/* 上报 v2：同步记录弹窗 */
.sync-list { margin: 4px 0 12px; padding-left: 18px; max-height: 240px; overflow-y: auto; font-size: 13px; line-height: 1.7; }
