/* =========================================================
   初始号选号站 · 样式表
   - 设计令牌集中在 :root，便于统一换肤
   - 深色为主、亮色自动跟随系统
   - 移动端优先：筛选栏在窄屏变成抽屉
   ========================================================= */

:root {
  --bg: #0b0e14;
  --bg-soft: #111726;
  --bg-card: #151b2b;
  --bg-card-hover: #1b2334;
  --bg-input: #0e1421;
  --bg-elevated: #1a2233;
  --border: #232c40;
  --border-strong: #2f3a52;

  --text: #e8ecf5;
  --text-dim: #9aa6bd;
  --text-mute: #6c7891;

  --brand: #7c8cff;
  --brand-2: #c06bff;
  --brand-soft: rgba(124, 140, 255, 0.14);
  --accent: #3ddc97;
  --warn: #ffc857;
  --danger: #ff6b81;
  --gold: #ffcf6b;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);

  --header-h: 60px;
  --sidebar-w: 268px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f7fb;
    --bg-soft: #eef1f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f9ff;
    --bg-input: #ffffff;
    --bg-elevated: #ffffff;
    --border: #e2e7f0;
    --border-strong: #cdd5e4;
    --text: #1a2233;
    --text-dim: #5a6780;
    --text-mute: #8592a8;
    --shadow: 0 10px 30px rgba(31, 45, 74, 0.12);
    --shadow-sm: 0 4px 14px rgba(31, 45, 74, 0.08);
  }
}

* { box-sizing: border-box; }

/* 长短文案切换：桌面显示 .full-label，手机（≤1024px）显示 .short-label */
.full-label { display: inline; }
.short-label { display: none; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- 启动占位 ---------- */
.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--text-dim);
}
.boot-logo {
  font-size: 40px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .45; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  transition: background .16s, border-color .16s, transform .1s, opacity .16s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover:not(:disabled) { background: var(--bg-card-hover); border-color: var(--brand); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-elevated); color: var(--text); border-color: transparent; }
.btn-danger { border-color: rgba(255, 107, 129, .5); color: var(--danger); background: rgba(255, 107, 129, .08); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 107, 129, .16); border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-icon { padding: 6px 8px; }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-mute); }
.textarea { min-height: 120px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }

.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.field-hint { margin-top: 5px; font-size: 11.5px; color: var(--text-mute); line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.7;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-dim);
  white-space: nowrap;
}
.badge-server { border-color: rgba(61, 220, 151, .35); color: var(--accent); background: rgba(61, 220, 151, .08); }
.badge-tag { border-color: rgba(255, 200, 87, .3); color: var(--warn); background: rgba(255, 200, 87, .08); }
/* 库存徽章：只在同规格不止一个时出现 */
.badge-stock { border-color: rgba(120, 180, 255, .4); color: #7fb3ff; background: rgba(120, 180, 255, .1); }
.badge-reserved { border-color: rgba(255, 200, 87, .45); color: var(--warn); }
.badge-sold { border-color: var(--border-strong); color: var(--text-mute); }
.badge-offline { border-color: var(--border); color: var(--text-mute); }
.badge-full { border-color: rgba(192, 107, 255, .45); color: var(--brand-2); background: rgba(192, 107, 255, .1); }
.badge-partial { border-color: var(--border-strong); color: var(--text-dim); }
.badge-ok { border-color: rgba(61, 220, 151, .4); color: var(--accent); background: rgba(61, 220, 151, .1); }
.badge-warn { border-color: rgba(255, 200, 87, .4); color: var(--warn); background: rgba(255, 200, 87, .1); }
.badge-err { border-color: rgba(255, 107, 129, .4); color: var(--danger); background: rgba(255, 107, 129, .1); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 12px;
  background: rgba(124, 140, 255, .12);
  border: 1px solid rgba(124, 140, 255, .22);
  color: #b8c2ff;
  white-space: nowrap;
}
.chip-weapon { background: rgba(61, 220, 151, .1); border-color: rgba(61, 220, 151, .22); color: #8ff0c4; }
.chip-5star { position: relative; }
.chip-star { color: var(--gold); font-size: 10px; }

/* ---------- 顶部栏 ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; letter-spacing: .2px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 15px;
  box-shadow: 0 4px 14px rgba(124, 140, 255, .35);
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--text-mute); letter-spacing: 0; }
.appbar-search { flex: 1; max-width: 520px; position: relative; }
.appbar-search .input { padding-left: 34px; }
.appbar-search .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-mute); font-size: 14px; pointer-events: none; }
.appbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.appbar-stats { font-size: 12px; color: var(--text-mute); }
.appbar-stats b { color: var(--text); font-variant-numeric: tabular-nums; }

.layout { display: flex; align-items: flex-start; gap: 18px; max-width: 1560px; margin: 0 auto; padding: 18px 16px 90px; }
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 18px);
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  max-height: calc(100vh - var(--header-h) - 36px);
  overflow-y: auto;
  padding-right: 4px;
}
.content { flex: 1; min-width: 0; }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700;
}
.panel-head .muted { font-weight: 400; font-size: 11.5px; color: var(--text-mute); }
.panel-body { padding: 12px 14px; }
.panel-body.tight { padding: 8px 10px; }
/* 危险操作面板：整块泛红，和普通维护操作明显区分，防手滑 */
.panel-danger { border-color: rgba(255, 107, 129, .45); }
.panel-danger > .panel-head { color: var(--danger); background: rgba(255, 107, 129, .07); }

.filter-group { margin-bottom: 14px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-title { font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 7px; display: flex; justify-content: space-between; align-items: center; }
.filter-list { display: flex; flex-direction: column; gap: 2px; max-height: 208px; overflow-y: auto; }
/* 横向 chip 组：不限制高度、不裁切（此前继承高度导致 chip 被压扁不可读） */
.filter-list.cols { flex-direction: row; flex-wrap: wrap; max-height: none; overflow: visible; gap: 6px; }
.filter-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 8px; border-radius: 7px; cursor: pointer;
  font-size: 12.5px; color: var(--text-dim);
  border: 1px solid transparent;
  transition: background .14s, color .14s;
}
.filter-item:hover { background: var(--bg-elevated); color: var(--text); }
.filter-item.active { background: var(--brand-soft); border-color: rgba(124, 140, 255, .4); color: var(--text); font-weight: 600; }
.filter-item .count { font-size: 11px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.filter-item input { margin: 0; accent-color: var(--brand); }
.filter-chip {
  padding: 4px 9px; border-radius: 999px; cursor: pointer; font-size: 12px;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-dim);
  transition: all .14s;
}
.filter-chip:hover { border-color: var(--brand); color: var(--text); }
.filter-chip.active { background: var(--brand-soft); border-color: var(--brand); color: #fff; font-weight: 600; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .result-count { font-size: 13px; color: var(--text-dim); }
.toolbar .result-count b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.toolbar .spacer { flex: 1; }

.list-hint {
  display: none;
  margin: -2px 0 10px;
  font-size: 12.5px;
  color: var(--text-mute);
  line-height: 1.5;
}
@media (max-width: 1024px) { .list-hint { display: block; } }

/* =========================================================
   账号列表：一个账号一行
   ---------------------------------------------------------
   一行里固定展示三样东西：价格（必备）、服务器（必备）、主字段（默认「配置」）。
   其余字段（角色/武器/标签/自定义字段）默认折叠，点「详情」展开，
   这样在手机上一屏能扫到更多账号。
   ========================================================= */
.account-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .16s, background .16s;
}
.account-row:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); background: var(--bg-card-hover); }
.account-row.is-open { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); }
.account-row.is-sold { opacity: .62; }

/* 主行：第一行（价格/服务器/按钮）+ 第二行（主字段独占整行） */
.row-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px 11px;
}
.row-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.row-grow { flex: 1 1 auto; min-width: 0; }
.row-actions-inline { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }

.row-price {
  flex: 0 0 auto;
  font-size: 19px;
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.2;
}
.row-price small { font-size: 12px; font-weight: 600; margin-right: 1px; }

.row-server {
  flex: 0 1 auto;
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 主字段：占满整行，宽度是"塞在一行里"方案的两倍多 */
.row-primary {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-primary.is-empty { color: var(--text-mute); }

.row-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.row-toggle:hover { border-color: var(--brand); color: var(--text); }
.row-toggle .caret { transition: transform .18s; font-size: 10px; }
.account-row.is-open .row-toggle .caret { transform: rotate(180deg); }
.row-count {
  font-size: 11px;
  color: var(--text-mute);
  background: var(--bg-input);
  border-radius: 999px;
  padding: 1px 6px;
}

/* 展开区：额外字段的键值对 + 操作按钮 */
.row-extra {
  border-top: 1px dashed var(--border);
  padding: 11px 12px 12px;
  background: color-mix(in srgb, var(--bg-input) 55%, transparent);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.row-extra .extra-title {
  font-size: 11.5px;
  color: var(--text-mute);
  letter-spacing: .3px;
}
.extra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px 16px;
}
.extra-item { display: flex; gap: 8px; font-size: 13px; line-height: 1.55; min-width: 0; }
.extra-item .k { flex: 0 0 auto; color: var(--text-mute); min-width: 60px; }
.extra-item .v { flex: 1 1 auto; min-width: 0; color: var(--text); word-break: break-word; }
.extra-item .v.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.row-extra .row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-extra .row-actions .btn { flex: 1 1 120px; }

@media (max-width: 1024px) {
  /* 行内边距与字号收到最紧：目标是"一屏至少 5 个账号"且触控目标 ≥44px */
  .row-main { gap: 3px; padding: 8px 12px 9px; }
  .row-top { gap: 8px; }
  .row-price { font-size: 18px; }
  .row-server { max-width: 90px; }
  .row-server .badge-server {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    padding: 1px 7px;
    font-size: 11.5px;
    line-height: 1.6;
  }
  /* 主字段独占整行，行距压到 1.35 保证与按钮同高时也不超行 */
  .row-primary { font-size: 13.5px; line-height: 1.35; }
  /* 触控目标：高度 44px（拇指友好），宽度保证 44px 以上 */
  .row-toggle { min-height: 44px; min-width: 44px; justify-content: center; padding: 5px 10px; gap: 3px; }
  .extra-grid { grid-template-columns: 1fr; }
  /* 展开区里的复制/详情按钮在手机上也做成整行大按钮 */
  .row-extra .row-actions { gap: 8px; }
  .row-extra .row-actions .btn { flex: 1 1 100%; min-height: 46px; }

  /* 工具条在手机上尽量省纵向空间，把首屏让给账号行 */
  .toolbar { gap: 6px; margin-bottom: 7px; }
  .toolbar .btn, .toolbar a.btn, .toolbar .select { min-height: 44px; }
  .list-hint { margin-bottom: 7px; }
  .account-list { gap: 6px; }
}
@media (max-width: 380px) {
  .row-price { font-size: 18px; }
  .row-server { max-width: 76px; }
  .row-toggle .toggle-text { display: none; }
  .row-actions-inline .badge { display: none; }
}
/* 旧的卡片布局保留：详情弹窗里的相似推荐等场景仍在使用 .account-card 的部分样式 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

.account-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  transition: transform .16s, border-color .16s, box-shadow .16s, background .16s;
}
.account-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
  box-shadow: var(--shadow-sm);
  background: var(--bg-card-hover);
}
.account-card.is-sold { opacity: .62; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-code { font-family: var(--mono); font-size: 11.5px; color: var(--text-mute); letter-spacing: .3px; }
.card-price { font-size: 22px; font-weight: 800; color: var(--gold); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-price small { font-size: 13px; font-weight: 600; margin-right: 1px; }
.card-title { font-size: 14.5px; font-weight: 700; margin: 2px 0 9px; line-height: 1.45; word-break: break-word; }
/* 配置是必备字段，卡片上单独一行展示（详情里看完整内容） */
.card-config {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
  background: var(--bg-input);
  border-left: 2px solid var(--brand);
  border-radius: 0 6px 6px 0;
  padding: 6px 9px;
  margin: 0 0 9px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.card-section { margin-bottom: 8px; }
.card-label { font-size: 11px; color: var(--text-mute); margin-bottom: 4px; letter-spacing: .3px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.card-actions .btn { flex: 1; }
.card-highlight { animation: highlightCard 1.1s ease; }
@keyframes highlightCard {
  0% { box-shadow: 0 0 0 0 rgba(124, 140, 255, .6); }
  100% { box-shadow: 0 0 0 12px rgba(124, 140, 255, 0); }
}

/* ---------- 空状态 / 加载 ---------- */
.empty-state { text-align: center; padding: 64px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 44px; margin-bottom: 12px; opacity: .7; }
.empty-state h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.empty-state p { margin: 0 0 18px; font-size: 13px; }

.skeleton-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.sk { background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--border) 37%, var(--bg-elevated) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-title { height: 18px; width: 70%; }
.sk-price { height: 24px; width: 40%; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 22px 0 8px; flex-wrap: wrap; }
.page-btn {
  min-width: 34px; height: 34px; padding: 0 9px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card);
  color: var(--text-dim); cursor: pointer; font-size: 13px;
}
.page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--text); }
.page-btn.active { background: var(--brand-soft); border-color: var(--brand); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-info { font-size: 12.5px; color: var(--text-mute); margin: 0 6px; }

/* ---------- 列表底部：手机端无限滚动 ---------- */
.list-footer { margin-top: 18px; }
.load-more-status {
  text-align: center;
  padding: 16px 0;
  font-size: 13px;
  color: var(--text-mute);
}
.load-more-sentinel { height: 1px; }
/* 加载更多按钮做成虚线区，视觉上表示"下面还有内容" */
.list-footer .btn-block {
  min-height: 48px;
  border-style: dashed;
  color: var(--text-dim);
  background: transparent;
}

/* 自定义字段在卡片/详情里的键值行 */
.custom-rows { display: flex; flex-direction: column; gap: 3px; }
.custom-row { display: flex; gap: 6px; font-size: 12.5px; line-height: 1.6; }
.custom-row .k { color: var(--text-mute); flex: 0 0 auto; min-width: 52px; }
.custom-row .v { color: var(--text-dim); word-break: break-word; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.data th, table.data td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th { background: var(--bg-soft); font-size: 12px; color: var(--text-dim); font-weight: 700; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.data tbody tr:hover { background: var(--bg-card-hover); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }
table.data .price-cell { font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
table.data input.cell-input {
  width: 100%; min-width: 70px; padding: 5px 7px;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: inherit;
}
table.data input.cell-input:hover { border-color: var(--border-strong); background: var(--bg-input); }
table.data input.cell-input:focus { border-color: var(--brand); background: var(--bg-input); box-shadow: 0 0 0 3px var(--brand-soft); }
table.data tr.is-edited { background: rgba(255, 200, 87, .07); }
.row-actions { display: flex; gap: 5px; }

/* ---------- 模态 / 抽屉 / Toast ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(4, 6, 12, .62);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 640px; max-height: 88vh; overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: slideUp .2s ease;
}
.modal.wide { max-width: 980px; }
.modal.narrow { max-width: 440px; }
@keyframes slideUp { from { transform: translateY(14px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-elevated); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--bg-elevated); }

.toast-root { position: fixed; z-index: 300; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto;
  min-width: 200px; max-width: 380px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 13px;
  display: flex; gap: 9px; align-items: flex-start;
  animation: toastIn .22s ease;
}
@keyframes toastIn { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.ok { border-left: 3px solid var(--accent); }
.toast.err { border-left: 3px solid var(--danger); }
.toast.warn { border-left: 3px solid var(--warn); }
.toast .toast-text { flex: 1; word-break: break-word; }

.drawer-mask { position: fixed; inset: 0; z-index: 90; background: rgba(4, 6, 12, .55); animation: fadeIn .16s ease; }
.drawer {
  position: fixed; z-index: 91; left: 0; right: 0; bottom: 0;
  max-height: 84vh; overflow-y: auto;
  background: var(--bg-soft);
  border-top: 1px solid var(--border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 16px 16px 26px;
  animation: drawerUp .22s ease;
}
@keyframes drawerUp { from { transform: translateY(30px); } to { transform: none; } }

.mobile-filter-bar {
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
  display: none; gap: 10px; align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.mobile-filter-bar .btn { flex: 1; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  padding: 9px 14px; cursor: pointer; color: var(--text-dim); font-size: 13.5px;
  border-bottom: 2px solid transparent; white-space: nowrap; background: none; border-top: none; border-left: none; border-right: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 700; }

/* ---------- 管理端 ---------- */
.admin-layout { display: flex; align-items: flex-start; gap: 18px; max-width: 1560px; margin: 0 auto; padding: 18px 16px 90px; }
.admin-nav { width: 196px; flex: 0 0 196px; position: sticky; top: calc(var(--header-h) + 18px); }
.admin-nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: 9px; color: var(--text-dim);
  margin-bottom: 3px; font-size: 13.5px; border: 1px solid transparent;
}
.admin-nav a:hover { background: var(--bg-elevated); color: var(--text); text-decoration: none; }
.admin-nav a.active { background: var(--brand-soft); border-color: rgba(124, 140, 255, .4); color: var(--text); font-weight: 700; }
.admin-nav .nav-count {
  margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-weight: 700;
}
.admin-main { flex: 1; min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 15px; }
.stat-card .k { font-size: 11.5px; color: var(--text-mute); margin-bottom: 5px; }
.stat-card .v { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-card .v.small { font-size: 15px; font-weight: 700; }
.stat-card.warn .v { color: var(--warn); }
.stat-card.danger .v { color: var(--danger); }
.stat-card.ok .v { color: var(--accent); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 384px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 30px 26px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 6px; font-size: 21px; text-align: center; }
.login-card .sub { text-align: center; color: var(--text-mute); font-size: 12.5px; margin-bottom: 22px; }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius);
  padding: 26px 18px; text-align: center; color: var(--text-dim);
  cursor: pointer; transition: all .16s; background: var(--bg-input);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--brand); background: var(--brand-soft); color: var(--text); }
.dropzone .big { font-size: 30px; margin-bottom: 8px; }

.diff-list { display: flex; flex-direction: column; gap: 7px; max-height: 320px; overflow-y: auto; }
.diff-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border); font-size: 12.5px; }
.diff-row .field-name { color: var(--text-dim); min-width: 68px; }
.diff-row .before { color: var(--danger); text-decoration: line-through; opacity: .8; }
.diff-row .arrow { color: var(--text-mute); }
.diff-row .after { color: var(--accent); font-weight: 600; }

.log-detail { font-family: var(--mono); font-size: 11.5px; white-space: pre-wrap; word-break: break-all; color: var(--text-dim); }
.mono { font-family: var(--mono); font-size: 12px; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.text-danger { color: var(--danger); }
.text-ok { color: var(--accent); }
.text-warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-14 { margin-bottom: 14px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.flex-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hidden { display: none !important; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .sidebar { display: none; }
  .mobile-filter-bar { display: flex; }
  .admin-nav { position: static; width: 100%; flex: 1 1 100%; display: flex; gap: 6px; overflow-x: auto; }
  .admin-nav a { white-space: nowrap; }
  .admin-layout { flex-direction: column; }
}
@media (max-width: 720px) {
  .layout, .admin-layout { padding: 12px 10px 96px; }
  .card-grid { grid-template-columns: 1fr; }
  .appbar { padding: 0 10px; gap: 8px; }
  .appbar-stats { display: none; }
  .brand small { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { max-height: 92vh; }
  .toast-root { left: 10px; right: 10px; bottom: 74px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (min-width: 1025px) { .mobile-only { display: none !important; } }

/* =========================================================
   手机优先适配层
   ---------------------------------------------------------
   背景：本站绝大多数访客用手机访问，因此以下规则按"拇指操作"重排，
   桌面端（≥1025px）布局完全不受影响。
   解决四类真实问题：
     1) 输入框 <16px → iOS 聚焦时自动放大页面
     2) 可点目标 <44px → 手指点不准
     3) 筛选抽屉里的 chip 被裁切 → 功能看不懂
     4) 底部操作栏文字被挤掉 → 最关键的操作够不到
   所有规则统一放在文件末尾 + 统一断点，避免与上面的规则互相覆盖。
   ========================================================= */

/* ---------- 触摸基础优化（所有屏幕都生效） ---------- */
button, a, .filter-item, .filter-chip, .page-btn, .tab, .account-card, label {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* 去掉手机上 300ms 点击延迟 */
}

/* ---------- 平板及以下：进入手机布局 ---------- */
@media (max-width: 1024px) {
  /* iPhone 刘海/底部横条安全区 */
  :root {
    --appbar-h: 58px;
    --mobile-bar-h: 66px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
  }

  html, body {
    overflow-x: hidden !important; /* 兜底：任何意外超宽都不允许左右拖动 */
    -webkit-text-size-adjust: 100%;
  }

  /* 1) 输入类控件统一 16px，彻底避免 iOS 自动放大页面 */
  .input, .select, .textarea, input, select, textarea {
    font-size: 16px !important;
    min-height: 46px;
  }
  .textarea { min-height: 110px; font-size: 16px !important; }

  /* 2) 可点击目标放大到拇指友好尺寸 */
  .btn { min-height: 46px; padding: 11px 16px; font-size: 15px; }
  .btn-sm { min-height: 42px; padding: 9px 13px; font-size: 14px; }
  .btn-icon { min-height: 42px; min-width: 42px; }
  .filter-item { min-height: 46px; padding: 10px 12px; font-size: 14.5px; }
  .filter-chip { min-height: 38px; display: inline-flex; align-items: center; padding: 8px 14px; font-size: 14px; }
  .page-btn { min-width: 44px; height: 44px; }
  .tab { min-height: 46px; font-size: 15px; }
  input[type="checkbox"] { width: 22px; height: 22px; }

  /* 3) 顶部栏：品牌与搜索不再抢宽度，搜索独占一行 */
  .appbar {
    height: auto;
    min-height: var(--appbar-h);
    padding: calc(8px + var(--safe-top)) 12px 10px;
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .brand { font-size: 15.5px; min-width: 0; }
  .brand > span:last-child { min-width: 0; }
  .brand > span:last-child > span:first-child {
    display: block;
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .appbar-actions { gap: 6px; }
  .appbar-actions .btn { padding: 8px 11px; font-size: 14px; }
  .appbar-search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }

  /* 4) 内容区：单列卡片、底部留出操作栏空间 */
  .layout, .admin-layout {
    flex-direction: column;
    padding: 12px 12px calc(var(--mobile-bar-h) + var(--safe-bottom) + 20px);
    gap: 12px;
    max-width: 100%;
    width: 100%;
  }
  /* 关键：flex 子项默认 min-width:auto，宽表格会把整页撑出横向滚动条 */
  .content, .admin-main { width: 100%; min-width: 0; max-width: 100%; }
  .sidebar, .admin-nav { max-width: 100%; }
  .card-grid { grid-template-columns: 1fr; gap: 10px; }

  /* 工具条：搜索/排序/动作分行排布，不再挤出屏幕 */
  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }
  .toolbar > * { grid-column: 1 / -1; min-width: 0; }
  .toolbar .result-count { font-size: 13.5px; }
  .toolbar .result-count b { font-size: 17px; }
  .toolbar .select { width: 100% !important; min-width: 0 !important; }
  .toolbar .btn,
  .toolbar a.btn {
    width: 100%;
    min-height: 46px;
    white-space: normal; /* 长文案换行显示，而不是被挤出屏幕 */
    text-align: center;
  }
  .toolbar .spacer { display: none; }
  /* 排序与批量复制并排，省掉一行的纵向空间 */
  .toolbar-main-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    align-items: stretch;
  }
  .toolbar-main-row .select { width: 100% !important; }
  .toolbar-main-row .btn { min-height: 46px; }

  /* 手机端把长按钮文案换成短版，避免一行放不下 */
  .full-label { display: none; }
  .short-label { display: inline; }

  /* 5) 账号卡片：手机重排——价格在右上、标题独占一行、操作按钮整行大按钮 */
  .account-card {
    padding: 13px;
    border-radius: 14px;
    transform: none !important;
  }
  .account-card:hover { transform: none; }
  .card-top { margin-bottom: 6px; gap: 8px; align-items: flex-start; }
  .card-code { font-size: 11.5px; }
  .card-price { font-size: 25px; }
  .card-title {
    font-size: 15.5px;
    line-height: 1.4;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .card-section { margin-bottom: 7px; }
  .card-label { font-size: 11.5px; margin-bottom: 5px; }
  .chip { font-size: 13px; padding: 4px 9px; }
  .badge { font-size: 12px; padding: 3px 9px; }
  .card-actions { gap: 8px; padding-top: 11px; }
  .card-actions .btn { min-height: 48px; font-size: 15px; }

  /* 6) 底部操作栏：固定在拇指区，文字完整可见 */
  .mobile-filter-bar {
    display: flex;
    gap: 8px;
    padding: 9px 12px calc(9px + var(--safe-bottom));
    min-height: var(--mobile-bar-h);
  }
  .mobile-filter-bar .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    padding: 0 8px;
    font-size: 14.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 7) 筛选：手机改为整屏面板，底部固定"查看结果"，避免长了够不到按钮 */
  .drawer {
    top: 0;
    bottom: 0;
    max-height: none;
    border-radius: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
  }
  .drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: calc(12px + var(--safe-top)) 14px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 2;
  }
  .drawer-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px; }
  .drawer-foot {
    display: flex;
    gap: 10px;
    padding: 10px 14px calc(10px + var(--safe-bottom));
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
  }
  .drawer-foot .btn { flex: 1; min-height: 48px; }

  /* 筛选列表在手机上整行可点、选项更清晰 */
  .filter-list { max-height: 46vh; }
  .filter-list.cols { max-height: none; overflow: visible; gap: 8px; }
  .filter-item .count { font-size: 12px; }
  .filter-title { font-size: 13px; margin-bottom: 8px; }
  .panel-head { padding: 12px 14px; }
  .panel-body { padding: 13px 14px; }
  .panel-body.tight { padding: 10px 12px; }

  /* 8) 弹窗：接近全屏，底部按钮固定且够大 */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100% !important;
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
  }
  .modal-head { padding: 14px 16px; }
  .modal-head h3 { font-size: 16.5px; }
  .modal-body { padding: 15px 16px; }
  .modal-foot {
    flex-direction: column-reverse;
    gap: 8px;
    padding: 12px 16px calc(12px + var(--safe-bottom));
  }
  .modal-foot .btn { width: 100%; min-height: 50px; }
  .modal-foot > div { width: 100%; }
  .modal-foot .flex-gap { flex-direction: column-reverse; }
  .modal-foot .flex-gap .btn { width: 100%; }

  /* 9) Toast 提到操作栏之上，不遮挡底部按钮 */
  .toast-root {
    left: 12px;
    right: 12px;
    bottom: calc(var(--mobile-bar-h) + var(--safe-bottom) + 12px);
    align-items: stretch;
  }
  .toast { max-width: none; }

  /* 10) 管理端在手机上：导航横向滚动 + 表格可横滑 + 弹窗表单单列 */
  .admin-nav {
    position: static;
    width: 100%;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .admin-nav a { padding: 10px 13px; font-size: 14px; white-space: nowrap; }
  .admin-nav .nav-count { margin-left: 6px; }
  .admin-nav > div { display: flex; gap: 6px; border: none !important; margin: 0 !important; padding: 0 !important; }
  .admin-nav > div .muted { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat-card { min-width: 0; }
  .stat-card .v { font-size: 20px; overflow-wrap: anywhere; }

  /* 宽表格：只在表格容器内部横向滑动，绝不撑破整页 */
  table.data { min-width: 660px; }
  .table-wrap {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  /* 批量操作条：手机上换行排列，避免把页面撑宽 */
  .panel-body.flex-gap { flex-wrap: wrap; }
  .panel-body.flex-gap .btn { flex: 1 1 auto; min-width: 118px; }
  .panel-body.flex-gap .spacer { display: none; }

  /* 审批卡片头部：提交人信息换行，不挤压标题 */
  .panel-head { flex-wrap: wrap; row-gap: 6px; }
  .panel-head > div { min-width: 0; }
  .diff-row { flex-wrap: wrap; row-gap: 4px; }
  .diff-row .field-name { min-width: 0; width: 100%; }

  .field-row { grid-template-columns: 1fr; }
  .login-card { padding: 24px 18px; }
  .login-page { padding: 16px; }
  .dropzone { padding: 22px 14px; }
  .diff-list { max-height: none; }
  .log-detail { font-size: 12px; }
}

/* ---------- 小屏手机微调（≤380px） ---------- */
@media (max-width: 380px) {
  .brand > span:last-child > span:first-child { max-width: 40vw; }
  .appbar-actions .btn { padding: 8px 9px; font-size: 13.5px; }
  .card-price { font-size: 23px; }
  .mobile-filter-bar .btn { font-size: 13.5px; padding: 0 6px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .modal { border-radius: 16px 16px 0 0; }
}

