/* =========================================================
   软件授权系统 · 设计系统
   基础令牌 → 排版 → 控件 → 布局 → 页面 → 响应式
   ========================================================= */

:root {
  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  /* 表面与文字：暖白 / 米色纸感 */
  --bg: #f6f0e3;
  --surface: #fffdf7;
  --surface-sunken: #f3ecdb;
  --surface-hover: #f8f2e6;
  --text: #2a2419;
  --text-2: #4d4335;
  --muted: #786c5c;
  --faint: #9c8d77;
  --line: #e9e0cf;
  --line-strong: #d9cdb8;

  /* 品牌：陶土橙 */
  --brand: #b0501f;
  --brand-strong: #93401a;
  --brand-ink: #78341a;
  --brand-soft: #fbeade;
  --brand-line: #f0d3bd;

  /* 语义：统一向暖偏移 */
  --ok: #3d6b46;
  --ok-soft: #eef4e6;
  --ok-line: #cfe0bd;
  --warn: #9a5b0e;
  --warn-soft: #fdf3e0;
  --warn-line: #f0d9ac;
  --err: #a4342a;
  --err-soft: #fbeae6;
  --err-line: #f1c8c0;

  /* 圆角 */
  --r-xl: 22px;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --r-xs: 7px;
  --r-pill: 999px;

  /* 阴影：暖灰，避免在白底上发冷 */
  --sh-1: 0 1px 2px rgba(72, 56, 34, 0.06);
  --sh-2: 0 1px 3px rgba(72, 56, 34, 0.07), 0 1px 2px rgba(72, 56, 34, 0.05);
  --sh-3: 0 8px 24px -6px rgba(72, 56, 34, 0.14), 0 2px 6px -2px rgba(72, 56, 34, 0.07);
  --sh-4: 0 24px 48px -16px rgba(72, 56, 34, 0.22);

  /* 动效 */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 140ms var(--ease);
  --t-base: 220ms var(--ease);
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  /* 三个页面共用同一层暖色底纹 */
  background:
    radial-gradient(760px 460px at 14% -12%, #f9e5d1 0%, transparent 62%),
    radial-gradient(700px 440px at 104% 106%, #efe6d0 0%, transparent 58%),
    var(--bg);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
h1 { font-size: 26px; }
h2 { font-size: 15.5px; }
h3 { font-size: 14.5px; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.55; }

/* 作者样式里的 display 会盖掉 UA 的 [hidden]，这里显式兜底 */
[hidden] { display: none !important; }

.eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}
.spacer { flex: 1; }
.divider { width: 1px; height: 20px; background: var(--line); }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1.5px 6px;
  border-radius: 5px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  color: var(--text-2);
}

/* ---------- 品牌标识 ---------- */
.mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(145deg, #c9763f, #9d451b);
  color: #fffcf6;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 rgba(255, 250, 240, 0.3), 0 2px 6px -1px rgba(157, 69, 27, 0.36);
  flex: 0 0 auto;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-name { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast),
    box-shadow var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.btn:hover { background: var(--surface-hover); border-color: #cbbca3; color: var(--text); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.primary {
  background: linear-gradient(180deg, #bd5c2c, #b0501f);
  border-color: #a0481c;
  color: #fffcf6;
  box-shadow: inset 0 1px 0 rgba(255, 250, 240, 0.18), 0 1px 2px rgba(176, 80, 31, 0.26);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #b5541f, #93401a);
  border-color: #8a3c18;
  color: #fffcf6;
  box-shadow: inset 0 1px 0 rgba(255, 250, 240, 0.18), 0 3px 10px -2px rgba(176, 80, 31, 0.38);
}

/* 支付渠道品牌色：微信绿 / 支付宝蓝 */
.btn.pay-wechat {
  background: #07c160;
  border-color: #06ad56;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(7, 193, 96, 0.24);
}
.btn.pay-wechat:hover {
  background: #06ad56;
  border-color: #059b4d;
  color: #fff;
}
.btn.pay-alipay {
  background: #1677ff;
  border-color: #0e63e0;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(22, 119, 255, 0.24);
}
.btn.pay-alipay:hover {
  background: #0e63e0;
  border-color: #0b56c7;
  color: #fff;
}

.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-hover); border-color: transparent; color: var(--text); }

.btn.danger { color: var(--err); border-color: var(--err-line); background: var(--surface); }
.btn.danger:hover { background: var(--err-soft); border-color: #e3a79d; color: var(--err); }

.btn.small { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-xs); }
.btn.block { width: 100%; min-height: 42px; font-size: 14px; }

.link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--brand);
  cursor: pointer;
  font-weight: 500;
}
.link:hover { color: var(--brand-strong); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 表单控件 ---------- */
input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input::placeholder,
textarea::placeholder { color: var(--faint); }
input:hover,
select:hover,
textarea:hover { border-color: #cbbca3; }
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px rgba(176, 80, 31, 0.16);
}
select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' stroke='%23786c5c' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
textarea.code-area {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

label.field {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}
label.field > input,
label.field > select,
label.field > textarea { margin-top: 7px; }
label.field .suffix { float: right; font-weight: 400; color: var(--faint); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--sh-1);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head > div { min-width: 0; }
.card-head h2 { font-size: 15.5px; }
.card-head .sub { margin-top: 2px; font-size: 12.5px; color: var(--muted); }
.sec-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

/* ---------- 提示条 ---------- */
.error,
.hint,
.notice-text {
  font-size: 13px;
  margin: 0;
  min-height: 0;
}
.error { color: var(--err); }
.error:empty,
.hint:empty { display: none; }
.error:not(:empty) {
  padding: 9px 12px;
  background: var(--err-soft);
  border: 1px solid var(--err-line);
  border-radius: var(--r-sm);
}
.hint:not(:empty) { color: var(--brand-ink); }
.auth-form .hint:not(:empty) {
  padding: 9px 12px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: var(--r-sm);
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border-radius: var(--r-pill);
  border: 1px solid var(--ok-line);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.tag.off { background: #f2ebdd; border-color: #e9e0cf; color: var(--muted); }
.tag.expired { background: var(--err-soft); border-color: var(--err-line); color: var(--err); }
.tag.warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.tag.plain { background: var(--surface-sunken); border-color: var(--line); color: var(--text-2); }
.tag.plain::before { display: none; }

/* =========================================================
   登录 / 注册页
   ========================================================= */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  padding: clamp(16px, 4vw, 40px) clamp(14px, 3vw, 24px);
}

/* margin:auto 居中：内容超出一屏时也不会被裁掉顶部 */
.auth-card {
  width: 100%;
  max-width: 384px;
  margin: auto;
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 5vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-4), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.auth-mark {
  width: 38px;
  height: 38px;
  margin: 0 auto 20px;
  border-radius: 11px;
  font-size: 16px;
}

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.seg-btn {
  flex: 1;
  min-height: 36px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh-2);
}

.auth-form { display: grid; gap: 14px; }

.code-row { display: flex; gap: 8px; margin-top: 7px; }
.code-row input { flex: 1; min-width: 0; }
.code-row .btn { flex: 0 0 auto; min-height: 40px; min-width: 108px; }

.auth-title {
  margin: -2px 0 16px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

.auth-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.5;
}
.auth-foot .link { font-size: 12.5px; }

/* ---------- 账号设置（控制台） ---------- */
.settings { display: grid; }
.setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 8px 18px;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.setting:first-child { border-top: 0; padding-top: 0; }
.setting:last-child { padding-bottom: 0; }
.setting-info { min-width: 0; }
.setting-info strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.setting-info p {
  margin-top: 3px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.setting-info .ok-text { color: var(--ok); }

.setting-form { display: flex; gap: 8px; }
.setting-form > input { flex: 1; min-width: 0; }
.setting-form > .btn { flex: 0 0 auto; }

.pwd-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}
.pwd-form #old-password { grid-column: 1 / -1; }
.pwd-form .btn { grid-column: 1 / -1; justify-self: end; min-width: 112px; }

/* =========================================================
   应用外壳（控制台 / 管理后台）
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 20px;
  background: rgba(255, 253, 247, 0.88);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
}
.topbar .who {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--muted);
}
.topbar-tag {
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand-ink);
  font-size: 11.5px;
  font-weight: 600;
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 20px 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

/* =========================================================
   控制台
   ========================================================= */
.overview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 2px 2px;
}
.overview h1 { margin-top: 6px; font-size: 24px; }
.overview .lead { margin-top: 6px; font-size: 13.5px; color: var(--muted); }

.ov-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.ov-stat {
  min-width: 108px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}
.ov-stat .n {
  display: block;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.ov-stat .n.ok { color: var(--ok); }
.ov-stat .l { font-size: 11.5px; color: var(--muted); }

/* 需绑定手机号的提示卡 */
.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-color: var(--warn-line);
  background: linear-gradient(180deg, #fffaf0, var(--warn-soft));
}
.notice .notice-body { display: flex; align-items: flex-start; gap: 11px; min-width: 240px; flex: 1; }
.notice .ico-warn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--warn-line);
  color: var(--warn);
}
.notice strong { font-size: 13.5px; color: #7d420a; }
.notice p { font-size: 12.5px; color: var(--warn); margin-top: 1px; }
.notice .create-row { margin: 0; flex: 0 0 auto; }

/* 授权列表 */
.list { display: grid; gap: 10px; }
.list .empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface-sunken);
}

.lic {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.lic:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.lic-main { flex: 1 1 260px; min-width: 0; }
.lic-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.lic-meta {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.lic-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* 购买 */
.buy { display: grid; gap: 16px; }
.buy-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.buy-row > label { flex: 1 1 190px; min-width: 160px; }
.pay-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
.pay-actions .btn { min-height: 40px; }

.pay-panel {
  display: flex;
  gap: 22px;
  align-items: center;
  margin-top: 4px;
  padding: 20px;
  border: 1px solid var(--brand-line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #fdf6ef, var(--brand-soft));
}
.qr-wrap {
  flex: 0 0 auto;
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  overflow: hidden;
}
.qr-wrap img { width: 100%; height: 100%; object-fit: contain; }
.pay-info { display: grid; gap: 9px; align-content: start; min-width: 0; flex: 1; }
.pay-info .pay-line { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--text-2); }
.pay-info .pay-line code { word-break: break-all; }
.pay-info .status { font-size: 13.5px; font-weight: 600; color: var(--warn); }
.pay-info .status.ok { color: var(--ok); }
.pay-info .pay-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

.result {
  display: grid;
  gap: 12px;
  margin-top: 4px;
  padding: 20px;
  border: 1px solid var(--ok-line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, #f7fbf3, var(--ok-soft));
}
.result h3 { color: var(--ok); font-size: 15px; }
.result .result-meta { font-size: 12.5px; color: var(--ok); opacity: 0.85; }
.result .result-exp { font-size: 13px; color: var(--text-2); }
.result textarea { background: var(--surface); }
.result .row { display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================================================
   管理后台
   ========================================================= */
.admin-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 72px;
  display: grid;
  grid-template-columns: 198px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.sidenav {
  position: sticky;
  top: 82px;
  display: grid;
  gap: 2px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
}
.sidenav-label {
  padding: 6px 10px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}
.sidenav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border-radius: var(--r-xs);
  font-size: 13.5px;
  color: var(--text-2);
  transition: background var(--t-fast), color var(--t-fast);
}
.sidenav a:hover { background: var(--surface-hover); color: var(--text); }
.sidenav a.active {
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
}
.sidenav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 16px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
  transform: translateY(-50%);
}

.stack { display: grid; gap: 18px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
/* 卡片作为网格项必须可收缩，否则超宽表格会把整页撑出屏幕 */
.stack > * { min-width: 0; }
section[id] { scroll-margin-top: 78px; }

/* 统计 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.stat { padding: 15px 16px 14px; background: var(--surface); }
.stat .k { font-size: 11.5px; color: var(--muted); }
.stat .v {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

/* 新增行 */
.create-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.create-row input,
.create-row select { flex: 1 1 150px; min-width: 110px; width: auto; }
.create-row .btn { flex: 0 0 auto; }

/* 表格 */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding: 9px 12px;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text-2);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover td { background: #fdf8ee; }
td .btn.small + .btn.small { margin-left: 4px; }
td[colspan] { text-align: center; color: var(--muted); padding: 26px 12px; }
.days-input { width: 62px; padding: 4px 7px; min-height: 28px; font-size: 12.5px; display: inline-block; }

/* =========================================================
   轻提示
   ========================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 100;
  max-width: min(88vw, 420px);
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: #2f271d;
  color: #fff8ee;
  font-size: 13px;
  text-align: center;
  box-shadow: var(--sh-3);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity var(--t-base), transform var(--t-base);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); }

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); padding: 16px 14px 64px; gap: 14px; }
  .sidenav {
    position: sticky;
    top: 58px;
    z-index: 20;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 6px;
    border-radius: var(--r-md);
    box-shadow: var(--sh-2);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav-label { display: none; }
  .sidenav a { white-space: nowrap; padding: 7px 12px; }
  .sidenav a.active::before { display: none; }
  section[id] { scroll-margin-top: 128px; }
  .page { padding: 18px 14px 64px; }
  /* 表格在窄屏保持可读宽度，容器内横向滚动 */
  .table-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .table-scroll table { min-width: 640px; }
  /* 触屏设备上放大点击热区 */
  .btn.small { min-height: 34px; padding: 0 12px; }
  td .btn.small + .btn.small { margin-left: 6px; }
  td .days-input { min-height: 32px; }
}

@media (max-width: 760px) {
  .pay-panel { flex-direction: column; align-items: stretch; }
  .qr-wrap { width: 100%; height: 220px; }
  .overview { align-items: flex-start; gap: 14px; }
  .ov-stats { width: 100%; }
  .ov-stat { flex: 1 1 0; min-width: 0; padding: 10px 12px; }
  .ov-stat .n { font-size: 20px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .stat { padding: 13px 14px; }
  /* 账号设置：说明与表单上下排布 */
  .setting { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .pwd-form { grid-template-columns: minmax(0, 1fr); }
  .pwd-form #old-password,
  .pwd-form .btn { grid-column: auto; }
  .pwd-form .btn { justify-self: stretch; }
}

@media (max-width: 640px) {
  h1 { font-size: 22px; }
  .auth-page { padding: 16px 12px; }
  .auth-card { border-radius: 18px; padding: 22px 18px; }
  .card { padding: 16px; border-radius: var(--r-md); }
  .card-head { margin-bottom: 13px; flex-wrap: wrap; align-items: flex-start; }
  .card-head > .btn { margin-left: auto; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .who,
  .topbar-tag { display: none; }
  .topbar .btn.small { padding: 0 9px; }
  .topbar .divider { display: none; }
  .page { padding: 14px 12px 56px; gap: 14px; }
  .overview h1 { margin-top: 4px; }
  .lic { align-items: flex-start; flex-direction: column; gap: 12px; }
  /* 纵向排列时取消横向的 flex-basis，避免撑出大片空白 */
  .lic-main { flex: 0 0 auto; width: 100%; }
  .lic-actions { width: 100%; }
  .lic-actions .btn { flex: 1; }
  .notice { flex-direction: column; align-items: stretch; }
  .notice .create-row { width: 100%; }
  .buy-row > label { flex: 1 1 100%; }
  .pay-actions { width: 100%; }
  .pay-actions .btn { flex: 1; }
  .result .row .btn { flex: 1 1 auto; }
  .create-row input,
  .create-row select { flex: 1 1 100%; max-width: 100% !important; }
  .create-row .btn { flex: 1 1 100%; }
  .stat .v { font-size: 19px; }
  /* 两列统计时，落单的最后一项占满一行，避免留出空格子 */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* iOS Safari 聚焦小于 16px 的控件会自动放大页面 */
  input,
  select,
  textarea { font-size: 16px; }
  .days-input { font-size: 16px; width: 74px; }
  /* 底部长条提示避开 iPhone 底部安全区 */
  .toast { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); max-width: 92vw; }
}

@media (max-width: 400px) {
  .brand-name { display: none; }
  .seg-btn { min-height: 34px; font-size: 13px; }
  .card { padding: 14px; }
  .code-row .btn { min-width: 96px; padding: 0 8px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
