:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e4e9f2;
  --line-strong: #d3dae6;
  --text: #161c29;
  --muted: #6b7688;
  --brand: #d8332f;
  --brand-dark: #b62a26;
  --brand-soft: #fdeeee;
  --ok: #12805a;
  --ok-soft: #e8f7f0;
  --warn: #a86200;
  --warn-soft: #fdf3e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px -24px rgba(16, 24, 40, 0.35);
}

* {
  box-sizing: border-box;
}

/* 让 hidden 属性优先级高于各类 display 声明 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #e5453f, #c12925);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px -8px rgba(200, 45, 40, 0.8);
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c2c9d6;
  display: inline-block;
}

.pill.on {
  color: var(--ok);
  border-color: #c8e9da;
  background: var(--ok-soft);
}

.pill.on i {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(18, 128, 90, 0.12);
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.card-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.card-hd h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.step {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: #f0f3f8;
  border-radius: 6px;
  padding: 2px 6px;
  letter-spacing: 0.5px;
}

.hint {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- 表单控件 ---------- */
.btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: #b9c3d4;
  background: #fbfcfe;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.btn.primary:hover:not(:disabled) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn.danger {
  background: #cf2e2a;
  border-color: #cf2e2a;
  color: #fff;
  font-weight: 600;
}

.btn.danger:hover:not(:disabled) {
  background: #b02420;
  border-color: #b02420;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.btn.sm {
  height: 32px;
  font-size: 12.5px;
  padding: 0 12px;
}

.input,
select {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 0 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(216, 51, 47, 0.1);
}

select {
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b7688' d='M0 0h10L5 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
  cursor: pointer;
}

select:disabled {
  background-color: #f7f9fc;
  color: var(--muted);
  cursor: not-allowed;
}

input:disabled {
  background: #f6f8fb;
  color: #97a1b2;
  border-color: var(--line);
  cursor: not-allowed;
}

.selects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.selects label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- 账号 ---------- */
.kv {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.kv b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- 结果 ---------- */
.result-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #fdfefe, #f9fbfd);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
}

.metric-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.3;
  word-break: break-all;
}

.metric-value.accent {
  color: var(--brand);
}

.metric-sub {
  font-size: 11.5px;
  color: #97a1b2;
}

.items {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: #f8fafc;
  border: 1px solid #eef2f8;
  font-size: 13px;
}

.item-row.hl {
  background: var(--brand-soft);
  border-color: #f7d5d4;
}

.item-row span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  background: #fff;
  border: 1px solid #f0cccb;
  border-radius: 6px;
  padding: 1px 7px;
  flex: none;
}

/* ---------- 改名 ---------- */
.rename-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.rename-row .input {
  flex: 1;
}

.attempts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--muted);
  background: #fff;
  white-space: nowrap;
}

.attempts input {
  width: 44px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: center;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
}

.attempts input:focus {
  border-color: var(--brand);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 10px;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}

/* ---------- 日志 ---------- */
.live {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ok);
  background: var(--ok-soft);
  border: 1px solid #d4ede2;
  border-radius: 999px;
  padding: 1px 9px;
}

.log-list {
  height: 232px;
  overflow-y: auto;
  border-radius: 10px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-family: ui-monospace, "SF Mono", Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.9;
}

.log-line {
  display: flex;
  gap: 8px;
  color: #3d4757;
  word-break: break-all;
}

.log-line .t {
  color: #a8b1c1;
  flex: none;
}

.log-line .lv {
  flex: none;
  width: 38px;
  font-weight: 600;
  color: #98a2b3;
}

.log-line.ok .lv {
  color: var(--ok);
}

.log-line.warn .lv {
  color: var(--warn);
}

.log-line.error .lv {
  color: var(--brand);
}

.log-line.step .lv {
  color: #2c6cd6;
}

.log-line.empty {
  color: #a8b1c1;
}

/* ---------- 扫码登录 ---------- */
.scan-body {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.qr-wrap {
  width: 248px;
  height: 248px;
  border-radius: 16px;
  border: 1.5px dashed var(--line-strong);
  background: #fbfcfe;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.qr-wrap.active {
  border-style: solid;
  border-color: #cfd8e6;
  background: #fff;
}

.qr-img {
  width: 232px;
  height: 232px;
  display: block;
  image-rendering: pixelated;
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.qr-wrap.expired .qr-img {
  opacity: 0.28;
  filter: grayscale(1);
}

.qr-empty,
.qr-done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  padding: 0 18px;
}

.qr-empty-mark {
  font-size: 34px;
  line-height: 1;
  color: #cbd4e2;
}

.qr-empty p,
.qr-done p {
  margin: 0;
  line-height: 1.7;
}

.qr-done b {
  color: var(--text);
  font-size: 14px;
}

.qr-done-mark {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 22px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 1px solid #c8e9da;
}

.scan-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scan-tip {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 40px;
}

.scan-tip.ok {
  background: var(--ok-soft);
  border-color: #c8e9da;
  color: var(--ok);
}

.scan-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
}

.mini-state {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  background: #f2f5f9;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 10px;
}

.mini-state.on {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #c8e9da;
}

.check.inline {
  margin: 0 0 0 4px;
  font-size: 12.5px;
}

@media (max-width: 720px) {
  .scan-body {
    grid-template-columns: 1fr;
  }

  .qr-wrap {
    width: 100%;
    max-width: 248px;
  }
}

/* ---------- 抢占 ---------- */
.mode-switch {
  display: inline-flex;
  padding: 3px;
  background: #f2f5f9;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 14px;
}

.mode-btn {
  height: 30px;
  padding: 0 14px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-btn.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

.grab-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 12px;
}

.grab-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.grab-grid .span2 {
  grid-column: span 2;
}

.grab-grid select {
  height: 42px;
}

.grab-grid .input {
  height: 42px;
  font-size: 15px;
}

.grab-note {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.75;
  color: #8a94a6;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.cloud-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.cloud-label {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.cloud-row .input {
  flex: 1;
  height: 38px;
  font-size: 13px;
}

.cloud-tip {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

.grab-stat {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  margin-left: auto;
}

.grab-stat.on {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: #f7d5d4;
}

.grab-until {
  margin: 0 0 12px;
}

@media (max-width: 720px) {
  .grab-grid {
    grid-template-columns: 1fr 1fr;
  }

  .grab-stat {
    margin-left: 0;
  }
}

/* ---------- 账号切换 ---------- */
.acct-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.acct-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.acct-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.15s ease;
}

.acct-chip:hover {
  border-color: #b9c3d4;
}

.acct-chip b {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.acct-chip span {
  font-size: 11.5px;
  color: var(--muted);
}

.acct-chip.active {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.acct-chip.active b {
  color: var(--brand);
}

.acct-empty {
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- 任务列表 ---------- */
.task-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcfe;
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.task-acct {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 5px;
  margin-left: 6px;
}

.task-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-badge {
  flex: none;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f0f3f8;
  color: var(--muted);
  border: 1px solid var(--line);
}

.task-badge.on {
  color: var(--brand);
  background: var(--brand-soft);
  border-color: #f7d5d4;
}

.task-badge.ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: #c8e9da;
}

.task-empty {
  color: #a8b1c1;
  font-size: 12.5px;
  padding: 14px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(12px);
  background: #1c2333;
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 12px 30px -12px rgba(16, 24, 40, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s ease;
  z-index: 99;
  max-width: 80vw;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.err {
  background: #b3261e;
}

@media (max-width: 720px) {
  .selects,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- 云端降级提示 ---------- */
.callout {
  margin: 12px 0 4px;
  padding: 11px 13px;
  border: 1px solid #f2dfc8;
  background: #fffaf2;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.8;
  color: #8a6a3c;
}

.callout b {
  color: #a5622a;
}

.callout a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

/* 禁用态统一灰掉，尤其是红色主按钮 */
.btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.65);
  cursor: not-allowed;
  box-shadow: none;
}
