/* ==========================================================================
   南宅IP · 越南代理
   深色科技风双主题（暗色 / 亮色）+ 响应式。
   所有颜色、阴影、圆角都走 CSS 变量，换主题只改变量块。

   分层原则（暗色下最容易被做砸的一点）：
     背景 < 卡片 < 卡片内嵌块，三级底色必须拉开亮度差，
     否则所有东西会糊成一块。卡片再叠「顶部 1px 高光 + 大范围柔和投影」，
     才能读成「浮在背景上」而不是「贴在背景上」。
   ========================================================================== */

:root {
  color-scheme: dark;

  /* 三级底色：每级约 +4% 亮度，保证肉眼可分辨 */
  --bg:        #060911;
  --bg-soft:   #0a0f1c;
  --surface:   #0e1626;
  --surface-2: #141f34;
  --surface-3: #1b2842;
  --line:      #1e2b45;
  --line-soft: #17223a;

  --fg:        #e9eefb;
  --fg-soft:   #c3cde4;
  --muted:     #7d8bab;

  /* 品牌：电光蓝 → 靛蓝，青做点缀 */
  --brand:     #4c8dff;
  --brand-2:   #6d5cff;
  --cyan:      #22d3ee;
  --brand-ink: #ffffff;

  --ok:    #34d399;  --ok-bg:   rgba(52, 211, 153, .13);
  --warn:  #fbbf24;  --warn-bg: rgba(251, 191, 36, .13);
  --bad:   #fb7185;  --bad-bg:  rgba(251, 113, 133, .13);

  --glow-1: rgba(76, 141, 255, .17);
  --glow-2: rgba(34, 211, 238, .11);
  --glow-3: rgba(109, 92, 255, .13);

  --zebra:     rgba(255, 255, 255, .018);
  --row-hover: rgba(76, 141, 255, .07);
  --inset-hi:  rgba(255, 255, 255, .05);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow:    0 1px 0 var(--inset-hi) inset, 0 20px 44px -24px rgba(0, 0, 0, .9);
  --shadow-lg: 0 1px 0 var(--inset-hi) inset, 0 30px 64px -26px rgba(0, 0, 0, .95);

  --radius: 16px;
  --radius-sm: 11px;

  font-family: "Outfit", "Noto Sans SC", -apple-system, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", system-ui, sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;

  --bg:        #f5f8fd;
  --bg-soft:   #eef2fa;
  --surface:   #ffffff;
  --surface-2: #f5f8fd;
  --surface-3: #eaf0fb;
  --line:      #dde5f3;
  --line-soft: #ebf0f9;

  --fg:        #0c1526;
  --fg-soft:   #2c3b56;
  --muted:     #64748b;

  --brand:     #2563eb;
  --brand-2:   #4f46e5;
  --cyan:      #0891b2;
  --brand-ink: #ffffff;

  --ok:    #0f9d63;  --ok-bg:   rgba(15, 157, 99, .10);
  --warn:  #b7791f;  --warn-bg: rgba(183, 121, 31, .10);
  --bad:   #dc2626;  --bad-bg:  rgba(220, 38, 38, .09);

  --glow-1: rgba(37, 99, 235, .11);
  --glow-2: rgba(8, 145, 178, .08);
  --glow-3: rgba(79, 70, 229, .08);

  --zebra:     rgba(15, 23, 42, .018);
  --row-hover: rgba(37, 99, 235, .05);
  --inset-hi:  rgba(255, 255, 255, .9);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow:    0 1px 2px rgba(15, 23, 42, .05), 0 16px 36px -18px rgba(15, 23, 42, .18);
  --shadow-lg: 0 1px 2px rgba(15, 23, 42, .06), 0 28px 58px -24px rgba(15, 23, 42, .24);
}

/* 未显式指定主题时跟随系统 */
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]):not([data-theme="light"]) {
    color-scheme: light;
    --bg:        #f5f8fd;
    --bg-soft:   #eef2fa;
    --surface:   #ffffff;
    --surface-2: #f5f8fd;
    --surface-3: #eaf0fb;
    --line:      #dde5f3;
    --line-soft: #ebf0f9;
    --fg:        #0c1526;
    --fg-soft:   #2c3b56;
    --muted:     #64748b;
    --brand:     #2563eb;
    --brand-2:   #4f46e5;
    --cyan:      #0891b2;
    --brand-ink: #ffffff;
    --ok:    #0f9d63;
    --ok-bg: rgba(15, 157, 99, .10);
    --warn:  #b7791f;
    --warn-bg: rgba(183, 121, 31, .10);
    --bad:   #dc2626;
    --bad-bg: rgba(220, 38, 38, .09);
    --glow-1: rgba(37, 99, 235, .11);
    --glow-2: rgba(8, 145, 178, .08);
    --glow-3: rgba(79, 70, 229, .08);
    --zebra: rgba(15, 23, 42, .018);
    --row-hover: rgba(37, 99, 235, .05);
    --inset-hi: rgba(255, 255, 255, .9);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 16px 36px -18px rgba(15, 23, 42, .18);
    --shadow-lg: 0 1px 2px rgba(15, 23, 42, .06), 0 28px 58px -24px rgba(15, 23, 42, .24);
  }
}

/* ---------------------------------------------------------------- 基础 --- */

* { box-sizing: border-box; }

/* .stack / .card 等设了 display，会盖过浏览器默认的 [hidden]，必须显式压住 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* 三团极淡的色光，给纯色背景一点纵深。z-index:-1 保证不挡内容。 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(52% 38% at 8% -10%, var(--glow-1), transparent 68%),
    radial-gradient(46% 36% at 100% -2%, var(--glow-3), transparent 70%),
    radial-gradient(60% 44% at 50% 106%, var(--glow-2), transparent 72%);
}

body.plain { display: grid; place-items: center; padding: 24px; }
body.plain .card { width: min(100%, 540px); }

/* 字体层级：h1 明显压住 h2，h2 压住正文 */
h1 { margin: 0 0 6px; font-size: 27px; font-weight: 700; letter-spacing: -.015em; line-height: 1.25; }
h2 { margin: 0; font-size: 16.5px; font-weight: 650; letter-spacing: -.005em; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 16px 0; }
code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 1px 6px;
}
.muted { color: var(--muted); }
.amount { color: var(--brand); font-weight: 650; }

/* 图标：全部内联 SVG，描边用 currentColor，尺寸随字号 */
.ico { flex: 0 0 auto; display: block; }
.ico-wrap {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--brand);
  border: 1px solid var(--line-soft);
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }

/* 带图标的标题：h2 里 icon() 与文字是兄弟节点，用 inline-flex 才能对齐。
   （.stack / .card 里的 h2 会被 grid 块化，这里管的是它内部的排布。） */
.card > h2, .stack > h2 { display: inline-flex; align-items: center; gap: 9px; }

/* --------------------------------------------------------------- 布局 --- */

.shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 20px 16px 56px;
  display: grid;
  gap: 16px;
  align-content: start;
}
/* grid 子项默认 min-width:auto，会按内容最小宽度撑开列。
   卡片里装 overflow-x:auto 的表格时仍会被算进最小宽度，
   导致窄视口下整个页面出现横向滚动条。显式归零交给容器决定宽度。 */
.shell > * { min-width: 0; }
.home > *, .split-layout > * { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 2px 0 4px;
}

.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand:hover { color: inherit; }

.mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--brand-ink);
  background: linear-gradient(150deg, var(--brand-2), var(--brand));
  box-shadow: 0 8px 22px -8px var(--glow-1), 0 1px 0 rgba(255, 255, 255, .28) inset;
}

.brand-text { display: grid; line-height: 1.22; }
.brand-text strong { font-size: 19px; letter-spacing: .04em; font-weight: 700; }
.brand-text small { color: var(--muted); font-size: 12px; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.who em {
  font-style: normal;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 11.5px;
  font-weight: 700;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg-soft);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--surface-2); }
html[data-theme="dark"] .i-light,
html[data-theme="light"] .i-dark { display: none; }

/* ---------------------------------------------------------------- 导航 --- */

.nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 5px;
  width: fit-content;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.nav.sub { border-radius: var(--radius); width: 100%; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  min-height: 40px;          /* 触屏最小点击高度；桌面下几乎看不出差别 */
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  transition: background .15s, color .15s;
}
.nav.sub .nav-link { border-radius: var(--radius-sm); }
.nav-link:hover { color: var(--fg); background: var(--surface-2); }
.nav-link.on {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--brand-ink);
  font-weight: 650;
  box-shadow: 0 6px 16px -8px var(--glow-1);
}
.nav-link.on .ico { color: var(--brand-ink); }

/* ---------------------------------------------------------------- 卡片 --- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}
/* 顶部 1px 高光，让卡片上沿「亮起来」，是暗色下制造厚度最省力的手法 */
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, transparent, var(--inset-hi) 22%, var(--inset-hi) 78%, transparent);
  pointer-events: none;
}
.card.narrow { width: min(100%, 480px); }
.card.empty { text-align: center; color: var(--muted); }
.card.empty .ico-wrap { margin: 0 auto 10px; }
.card.empty p { margin: 0; }
.card.accent { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.card-head h2 { display: inline-flex; align-items: center; gap: 9px; }

.stack { display: grid; gap: 12px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid .span-all { grid-column: 1 / -1; }

.home { display: grid; gap: 16px; }
.split-layout { display: grid; gap: 16px; }
@media (min-width: 880px) { .home { grid-template-columns: 1.05fr .95fr; align-items: start; } }
@media (min-width: 980px) {
  .split-layout { grid-template-columns: minmax(0, 1.5fr) minmax(0, .85fr); align-items: start; }
}
aside.stack { display: grid; gap: 14px; align-content: start; }

/* ------------------------------------------------------- 登录页视觉锚点 --- */

/* 登录页是访客看到的第一屏。原版卡片孤零零贴在左上角、下方三分之二全空，
   所以这里：主区垂直居中 + 品牌块 + 三条卖点，把空白填成「产品介绍」。 */
.auth {
  display: grid;
  gap: 22px;
  align-items: center;
  padding: 18px 0 28px;
}
@media (min-width: 900px) {
  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 44px; padding: 34px 0 48px; }
}

.auth-intro { display: grid; gap: 18px; align-content: center; }
.auth-intro h1 { font-size: 34px; line-height: 1.22; }
.auth-intro h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-intro > p { color: var(--muted); font-size: 15.5px; max-width: 46ch; }

.hero-points { display: grid; gap: 12px; }
.hero-point { display: flex; align-items: flex-start; gap: 11px; }
.hero-point b { display: block; font-size: 14.5px; font-weight: 620; }
.hero-point small { color: var(--muted); font-size: 13px; }
.hero-point .ico-wrap { width: 32px; height: 32px; border-radius: 9px; }

.hero-stats {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}
.hero-stats div { display: grid; gap: 2px; }
.hero-stats b { font-size: 21px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-stats span { color: var(--muted); font-size: 12.5px; }

.auth-card { padding: 24px; }

/* ---------------------------------------------------------------- 提示 --- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
}
.alert.ok    { background: var(--ok-bg);   border-color: transparent; color: var(--ok); }
.alert.warn  { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.alert.bad   { background: var(--bad-bg);  border-color: transparent; color: var(--bad); }
.alert.muted { background: var(--surface-2); color: var(--muted); }
.alert[data-toast] { animation: rise .28s ease both; }
.alert[data-toast].fade { opacity: 0; transform: translateY(-6px); transition: .35s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

.checklist { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--warn); font-size: 14px; }

/* ---------------------------------------------------------------- 按钮 --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s, background .15s, border-color .15s, filter .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); color: var(--fg); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: var(--brand-ink);
  box-shadow: 0 10px 24px -12px var(--glow-1), 0 1px 0 rgba(255, 255, 255, .22) inset;
}
.btn.primary:hover {
  filter: brightness(1.08);
  color: var(--brand-ink);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn.sm { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: 9px; }
.btn.disabled, .btn:disabled { opacity: .45; pointer-events: none; }

.copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 3px 9px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s, background .15s;
}
.copy:hover { color: var(--fg); border-color: var(--brand); background: var(--surface-2); }
.copy.done { color: var(--ok); border-color: var(--ok); }

/* 打码的密码：等宽 + 字距，点「显示」才出现明文 */
.secret {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: .08em;
}

/* 输入框 + 显示按钮并排 */
.input-row { display: flex; align-items: center; gap: 6px; }
.input-row input { flex: 1 1 auto; min-width: 0; }
.input-row .copy { flex: 0 0 auto; }

/* 列表顶部的到期提醒条 */
.notice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 550;
}
.notice-bar.warn { background: var(--warn-bg); color: var(--warn); }
.notice-bar.bad { background: var(--bad-bg); color: var(--bad); }
.notice-bar a { text-decoration: underline; margin-left: auto; }

/* 价格预估 */
.price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.price-line .total {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.row-actions form { display: inline; margin: 0; }

/* ---------------------------------------------------------------- 表单 --- */

.field { display: grid; gap: 6px; }
.field > span { color: var(--muted); font-size: 13px; font-weight: 550; }

input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--fg);
  font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder { color: var(--muted); opacity: .75; }
input:hover, select:hover, textarea:hover { border-color: var(--surface-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}

.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form input, .inline-form select {
  width: auto;
  min-width: 140px;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13.5px;
}
.inline-form .btn { min-height: 36px; }

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  margin-bottom: 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.seg-btn {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn:hover { color: var(--fg); }
.seg-btn.on {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: var(--brand-ink);
  box-shadow: 0 8px 18px -10px var(--glow-1);
}

/* 大类切换：购买页的「住宅静态 / 动态」，以及「我的 IP」页的两组库存。
   按钮里带图标和角标，所以排列方式是 flex + 居中，而不是纯文字的两个格子。 */
.seg.wide { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.seg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
/* 「我的 IP」那一组是 <a>，去掉链接默认下划线，其余跟随 .seg-btn */
a.seg-btn { text-decoration: none; }
.seg-btn .pill {
  padding: 1px 7px;
  font-size: 11px;
  line-height: 1.5;
}
.seg-btn.on .pill {
  background: rgba(0, 0, 0, .18);
  color: inherit;
  border-color: transparent;
}
.list-tabs { margin: 0 0 14px; }

/* 大类说明段：购买页切换之后先说清「这是什么」再给表单 */
.kind-intro {
  margin: -4px 0 16px;
  padding: 11px 13px;
  border-left: 2px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-soft);
}
.kind-intro p { margin: 0; font-size: 13px; line-height: 1.65; }

/* ---------------------------------------------------------------- 表格 --- */

/* 外框 + 圆角裁切，让表格读成一张「数据面板」而不是一堆裸露的行 */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }

th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 11px 14px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* 数字列右对齐并等宽，竖着看能对齐 */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, th.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 13px; }

tr.clickable { cursor: pointer; }
tbody tr:hover { background: var(--row-hover); }
tr.active { background: var(--row-hover); box-shadow: inset 3px 0 0 var(--brand); }

.empty { padding: 28px 14px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  /* 手机端：顶栏只留品牌 + 主题按钮，导航移到屏幕底部。
     移动端拇指自然落点是屏幕下半部，顶部标签栏够不着；
     吸底标签栏还能顺手解决「滚动时切页要滑回顶部」的问题。 */
  .shell {
    padding: 14px 13px calc(84px + env(safe-area-inset-bottom, 0px));
    gap: 13px;
  }

  .topbar { gap: 8px; }
  .brand { gap: 9px; }
  .mark { width: 34px; height: 34px; font-size: 16px; border-radius: 10px; }
  .brand-text strong { font-size: 16.5px; }
  .brand-text small { display: none; }        /* 副标题在窄屏是纯负担 */
  .who { display: none; }                     /* 用户名移到「账号」页 */

  /* 主题按钮给足触控尺寸 */
  .icon-btn { width: 44px; height: 44px; }

  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    gap: 2px;
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--line);
    background: var(--bg-soft);
    /* 玻璃感：内容从底下滚过时仍能看清标签 */
    backdrop-filter: blur(14px);
    box-shadow: 0 -8px 26px -14px rgba(0, 0, 0, .5);
    justify-content: space-between;
  }
  .nav.sub { position: static; border: 1px solid var(--line); border-radius: var(--radius); padding: 5px; }

  .nav-link {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;      /* 图标在上、文字在下 */
    gap: 3px;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    line-height: 1.1;
    justify-content: center;
    min-height: 48px;            /* 拇指最小点击尺寸 */
    white-space: nowrap;
  }
  .nav-link .ico { flex: 0 0 auto; }
  .nav-link.on {
    background: transparent;
    color: var(--brand);
    font-weight: 650;
    box-shadow: none;
  }
  .nav-link.on .ico { color: var(--brand); }
  /* 选中项改用顶部短横线：底色块在底部栏里会显得很重 */
  .nav-link.on::before {
    content: "";
    position: absolute;
    top: 3px;
    width: 20px;
    height: 2.5px;
    border-radius: 2px;
    background: var(--brand);
  }
  .nav-link { position: relative; }
}

/* 手机端表格转卡片。
   独立成块是因为上面那条媒体查询只管「顶栏 + 底部标签栏」的排布，
   而表格转卡片还必须在 761–900px（平板竖屏）生效 —— 那一段侧栏已转横条、
   内容区变全宽，表格 min-width 会把页面撑出横向滚动条。 */
@media (max-width: 900px) {
  .table-wrap { overflow: visible; border: 0; background: transparent; }
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  tr {
    margin-bottom: 10px;
    padding: 6px 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
  }
  tbody tr:nth-child(even) { background: var(--surface); }
  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 12px;
    border: 0;
    text-align: right;
    /* 卡片化之后每行都成了独立的小格子，行高直接决定可点性 */
    min-height: 42px;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12.5px;
    flex: 0 0 auto;
    text-align: left;
  }
  td.empty { display: block; text-align: center; }
  td.empty::before { content: none; }
  td.row-actions { justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
  .row-actions { justify-content: flex-end; }
  /* 卡片里带 data-label 的单元格，值过长时不要顶掉标签 */
  td > .mono, td > .num { text-align: right; word-break: break-all; min-width: 0; }
}

/* 触控尺寸补足：触屏设备上所有可点元素至少 44px 高。
   44px 是 Apple HIG 的最小值；低于这个数拇指会频繁点空。
   断点取 900 而不是 760 —— 平板竖屏（768）也是触屏，
   手机断点的「底部标签栏」不该在平板上生效，但触控尺寸应该。 */
@media (max-width: 900px) {
  .btn {
    min-height: 44px;
    padding: 11px 16px;
  }
  .btn.sm { min-height: 40px; padding: 9px 13px; }
  .copy {
    min-height: 40px;
    padding: 8px 12px;
    gap: 6px;
  }
  .row-actions .btn, .row-actions .copy { flex: 0 1 auto; }
  /* 表格里的操作按钮排成一行时容易被挤成两行，给足间距 */
  td.row-actions > * { min-height: 40px; }
  .th-sort { min-height: 40px; display: inline-flex; align-items: center; }
  /* 顶栏的主题按钮（.icon-btn 基础定义在前面，这里显式再声明一次） */
  .icon-btn { width: 44px; height: 44px; }
}

/* ---------------------------------------------------------------- 徽标 --- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill.ok    { color: var(--ok);   background: var(--ok-bg); }
.pill.warn  { color: var(--warn); background: var(--warn-bg); }
.pill.bad   { color: var(--bad);  background: var(--bad-bg); }
.pill.muted { color: var(--muted); background: var(--surface-2); border-color: var(--line); }

/* ------------------------------------------------------------ 键值列表 --- */

.kv { display: grid; gap: 10px; }
.kv > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
}
.kv > div:last-child { padding-bottom: 0; border-bottom: 0; }
.kv > div > span { color: var(--muted); font-size: 13px; }
.kv > div > b {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
  text-align: right;
}

/* -------------------------------------------------------------- 其他 --- */

.delivery {
  margin-top: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.delivery .row-actions { justify-content: flex-start; margin-top: 12px; }

.polling {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.spinner {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pay-actions { display: grid; gap: 10px; margin: 14px 0; }
.pay-actions .btn { width: 100%; }

.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; text-align: center; }
.qr img { width: 100%; max-width: 150px; height: auto; background: #fff; padding: 8px; border-radius: 10px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; font-size: 13px; }

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
