/* =============================================================================
   April · 设计系统（浅色）
   —— 共用令牌 + 组件 + 登录页 + 工作台
   ============================================================================= */

:root {
  /* 底色 */
  --bg: #f5f7fc;
  --bg-deep: #eef2f9;
  --surface: #ffffff;
  --surface-soft: #f8fafd;
  --line: #e7ecf5;
  --line-strong: #d8e0ee;
  --line-soft: #eff3fa;

  /* 文字 */
  --text: #101828;
  --text-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;

  /* 主色 */
  --primary: #4f6ef7;
  --primary-dark: #3d5ae0;
  --primary-soft: #eef2ff;
  --primary-line: #d6dffd;
  --violet: #7c5cf6;

  /* 语义色 */
  --success: #0f9d58;
  --success-soft: #e9f8f0;
  --warning: #d97706;
  --warning-soft: #fef6e7;
  --danger: #dc2f2f;
  --danger-soft: #fdeeee;

  /* 尺寸 */
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 9px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, 0.08), 0 2px 6px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 24px 48px -16px rgba(16, 24, 40, 0.18), 0 8px 16px -8px rgba(16, 24, 40, 0.08);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* hidden 属性必须能压住所有自定义 display，否则 .btn{display:inline-flex}
   之类的规则会让 hidden 失效（按钮藏不住） */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================================================================ 通用控件 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background .16s, border-color .16s, box-shadow .16s, transform .1s;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(79, 110, 247, 0.65);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 8px 22px -8px rgba(79, 110, 247, 0.75);
  filter: saturate(1.06);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-soft); border-color: #c9d3e5; }

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: var(--primary-line);
}
.btn-soft:hover:not(:disabled) { background: #e5ebff; }

.btn-danger-ghost {
  background: var(--surface);
  color: var(--danger);
  border-color: #f6cfcf;
}
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { padding: 12px 20px; font-size: 15px; }

.btn-spinner {
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  opacity: .85;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 输入 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label {
  font-size: 12.5px; font-weight: 550; color: var(--text-2);
  display: flex; align-items: center; gap: 7px;
}
.field-label .req { color: var(--danger); }
.field-tip { font-size: 11.5px; color: var(--faint); line-height: 1.5; }

/* 「建议填」这类轻提示徽标 */
.badge-tip {
  font-size: 10.5px;
  font-weight: 650;
  padding: 1px 7px;
  border-radius: 5px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  letter-spacing: .2px;
}

/* 必填徽标：红色，语义上和「建议」必须能一眼区分 */
.badge-must {
  font-size: 10.5px;
  font-weight: 650;
  padding: 1px 7px;
  border-radius: 5px;
  color: #b42318;
  background: var(--danger-soft);
  border: 1px solid #f6cfcf;
  letter-spacing: .2px;
}

/* 校验不通过时输入框标红 */
input.invalid,
input.invalid:hover {
  border-color: var(--danger);
}
input.invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(220, 47, 47, 0.12);
}

/* 关键词填写规则：做成醒目的说明块，不要藏在灰色小字里 */
.keyword-hint {
  margin-top: 2px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
  border-left: 3px solid var(--primary);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-2);
}
.keyword-hint .kh-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.keyword-hint .kh-row + .kh-row { margin-top: 5px; }
.keyword-hint .arrow { color: var(--primary); font-weight: 700; flex: 0 0 auto; }
.keyword-hint .kh-title {
  margin-bottom: 7px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary-dark);
}
.keyword-hint .kh-notes {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--primary-line);
}
.keyword-hint .kh-notes div + div { margin-top: 3px; }
.keyword-hint b { color: var(--primary-dark); font-weight: 650; }
.keyword-hint code {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid var(--primary-line);
  color: var(--text-2);
  white-space: nowrap;
}
.keyword-hint code.val {
  color: var(--primary-dark);
  font-weight: 700;
}

input:not([type]),
input[type="text"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .16s, box-shadow .16s, background .16s;
}

/* 下拉框：去掉系统外观，换成自绘箭头 */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%23667085' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
select:hover { border-color: #c3cee0; }
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.12);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, textarea:hover { border-color: #c3cee0; }
input:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.12);
}
textarea { resize: vertical; min-height: 80px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.card-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.1px; }
.card-head .hint { font-size: 12px; color: var(--faint); }

/* 状态标签 */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 550;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.pill[data-s="waiting"],
.pill[data-s="listening"] { color: var(--primary-dark); background: var(--primary-soft); border-color: var(--primary-line); }
.pill[data-s="received"], .pill[data-s="paid"] { color: var(--success); background: var(--success-soft); border-color: #c6ecda; }
.pill[data-s="timeout"], .pill[data-s="pending"] { color: var(--warning); background: var(--warning-soft); border-color: #fae5c2; }
.pill[data-s="stopped"], .pill[data-s="closed"] { color: var(--muted); background: var(--surface-soft); border-color: var(--line); }
.pill[data-s="failed"] { color: var(--danger); background: var(--danger-soft); border-color: #f6cfcf; }

/* Toast */
.toast-stack {
  position: fixed; right: 22px; bottom: 22px;
  display: flex; flex-direction: column; gap: 10px; z-index: 200;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  min-width: 200px; max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .22s cubic-bezier(.2,.8,.3,1);
  transition: opacity .22s, transform .22s;
}
.toast.leaving { opacity: 0; transform: translateX(14px); }
.toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: 0 0 7px; }
.toast.err .toast-dot { background: var(--danger); }
.toast.warn .toast-dot { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d3dbeb; border-radius: 999px; border: 3px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: #bcc7dd; background-clip: padding-box; }

/* ================================================================ 登录页 */

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--surface);
}

/* 左侧视觉区 */
.auth-visual {
  position: relative;
  overflow: hidden;
  padding: 52px 56px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(150deg, #4b63f0 0%, #5b5cf0 42%, #7c5cf6 100%);
  color: #fff;
}
.auth-visual::before,
.auth-visual::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  opacity: .5;
}
.auth-visual::before {
  width: 420px; height: 420px;
  right: -140px; top: -120px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.42), transparent 68%);
}
.auth-visual::after {
  width: 520px; height: 520px;
  left: -200px; bottom: -240px;
  background: radial-gradient(circle at 60% 40%, rgba(120, 220, 255, .38), transparent 66%);
}
.auth-visual > * { position: relative; z-index: 1; }

.visual-brand { display: flex; align-items: center; gap: 12px; }
.visual-logo {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  backdrop-filter: blur(6px);
  font-weight: 800; font-size: 19px;
}
.visual-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.visual-brand-text strong { font-size: 15px; letter-spacing: 2.6px; font-weight: 700; }
.visual-brand-text span { font-size: 11.5px; opacity: .8; letter-spacing: .5px; }

.visual-main { margin-top: auto; margin-bottom: auto; padding: 40px 0; }
.visual-main h1 {
  font-size: 36px; line-height: 1.28; font-weight: 700; letter-spacing: -0.6px;
}
.visual-main h1 em {
  font-style: normal;
  background: linear-gradient(90deg, #ffffff, #cfe3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.visual-main p.lead {
  margin-top: 14px;
  font-size: 14.5px;
  line-height: 1.7;
  color: rgba(255,255,255,.82);
  max-width: 400px;
}

.visual-points { margin-top: 36px; display: flex; flex-direction: column; gap: 14px; }
.visual-point { display: flex; align-items: flex-start; gap: 12px; }
.visual-point .ico {
  flex: 0 0 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.22);
  font-size: 14px;
}
.visual-point b { display: block; font-size: 13.5px; font-weight: 600; }
.visual-point span { font-size: 12.5px; color: rgba(255,255,255,.75); }

.visual-foot {
  display: flex; gap: 28px;
  padding-top: 26px;
  border-top: 1px solid rgba(255,255,255,.2);
}
.visual-stat b {
  display: block; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.visual-stat span { font-size: 11.5px; color: rgba(255,255,255,.72); }

/* 右侧表单区 */
.auth-form-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 32px;
  background:
    radial-gradient(600px 300px at 100% 0%, #f3f6ff, transparent 70%),
    var(--surface);
}

.auth-card { width: 100%; max-width: 392px; }

.auth-card h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.auth-card .sub { margin-top: 6px; font-size: 13.5px; color: var(--muted); }

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 24px 0 24px;
  background: var(--bg-deep);
  border-radius: var(--r-md);
}
.auth-tab {
  flex: 1;
  padding: 9px 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all .16s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-form { display: flex; flex-direction: column; }
.auth-form[hidden] { display: none; }

.input-affix { position: relative; }
.input-affix input { padding-right: 42px; }

/* Edge / WebView2 会在密码框里塞一个原生的「眼睛」显隐按钮，
   和我们自己的「显示/隐藏」文字按钮重复了。Chrome 没有这个原生按钮，
   所以统一隐藏原生、保留文字按钮，保证各端表现一致。 */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
  width: 0;
  height: 0;
}
.input-affix .affix {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer;
  color: var(--faint); font-size: 12px; padding: 6px 8px; border-radius: 6px;
}
.input-affix .affix:hover { color: var(--text-2); background: var(--surface-soft); }

.auth-submit { margin-top: 6px; }

/* 登录页的「记住账号密码」 */
.auth-form .remember-line {
  margin-bottom: 18px;
  font-size: 12.5px;
  color: var(--text-2);
}

.auth-error {
  display: none;
  margin-bottom: 14px;
  padding: 10px 13px;
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  border: 1px solid #f6cfcf;
  color: #a32222;
  font-size: 12.5px;
}
.auth-error.show { display: block; }

.auth-foot { margin-top: 22px; font-size: 12px; color: var(--faint); text-align: center; line-height: 1.7; }
.auth-switch-hint { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }

/* ================================================================ 工作台 */

.app {
  display: flex;
  height: 100vh;
  background:
    radial-gradient(900px 420px at 8% -10%, #eef3ff, transparent 62%),
    radial-gradient(700px 380px at 100% 0%, #f4f0ff, transparent 58%),
    var(--bg);
}

/* 侧栏 */
.sidebar {
  width: 226px;
  flex: 0 0 226px;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 24px; }
.brand-logo {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: #fff;
  font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  box-shadow: 0 6px 14px -6px rgba(79, 110, 247, .8);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 14.5px; letter-spacing: 2.2px; font-weight: 700; }
.brand-text span { font-size: 11px; color: var(--faint); letter-spacing: .4px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 0; border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: background .16s, color .16s;
  text-align: left;
}
.nav-item svg {
  width: 17px; height: 17px; flex: 0 0 17px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.nav-item:hover { background: var(--surface-soft); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--primary-line);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.stat { background: var(--surface); padding: 10px 11px; display: flex; flex-direction: column; gap: 1px; }
.stat-label { font-size: 10.5px; color: var(--faint); }
.stat strong { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

.conn { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--faint); padding-left: 3px; }
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.conn.online .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(15,157,88,.12); }
.conn.offline .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(220,47,47,.12); }

/* 主区 */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 26px;
  background: rgba(255,255,255,.7);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar-title h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; }
.topbar-title p { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.balance-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.balance-chip .label { font-size: 11.5px; color: var(--muted); }
.balance-chip .value {
  font-size: 16px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.balance-chip .value small { font-size: 11px; font-weight: 500; color: var(--faint); margin-right: 1px; }
.balance-chip .btn { padding: 6px 13px; font-size: 12.5px; border-radius: 999px; }

.user-menu { position: relative; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: linear-gradient(135deg, #eef2ff, #f3efff);
  color: var(--primary-dark);
  font-weight: 700; font-size: 14px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: box-shadow .16s, border-color .16s;
}
.avatar:hover { border-color: var(--primary-line); box-shadow: 0 0 0 4px rgba(79,110,247,.1); }

.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 190px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  display: none;
}
.dropdown.open { display: block; animation: dropIn .16s ease-out; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-head {
  padding: 9px 11px 11px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
}
.dropdown-head b { display: block; font-size: 13px; }
.dropdown-head span { font-size: 11.5px; color: var(--faint); }
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border: 0; border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font: inherit; font-size: 13px;
  cursor: pointer; text-align: left;
}
.dropdown-item:hover { background: var(--surface-soft); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }

/* 视图 */
.view { display: none; padding: 22px 26px 28px; overflow-y: auto; flex: 1; }
.view.active { display: block; }
#view-work.active { display: flex; flex-direction: column; }

.workspace { display: grid; grid-template-columns: 344px minmax(0, 1fr); gap: 18px; align-items: start; }

/* 分组标题 */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.section-title h2 { font-size: 14.5px; font-weight: 650; }

/* 分段控件 */
.segmented {
  display: flex; gap: 3px;
  padding: 3px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.seg {
  flex: 1; padding: 7px 0;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all .16s;
}
.seg:hover { color: var(--text-2); }
.seg.active {
  background: var(--surface); color: var(--primary-dark);
  font-weight: 600; box-shadow: var(--shadow-sm);
}

/* 开关 */
.switch-line {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--text-2);
  cursor: pointer; user-select: none; margin-bottom: 18px;
}
.switch-line input { display: none; }
.switch {
  width: 36px; height: 20px; border-radius: 999px;
  background: #d6ddeb; position: relative;
  transition: background .18s; flex: 0 0 36px;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.25);
  transition: transform .18s;
}
.switch-line input:checked + .switch { background: linear-gradient(135deg, var(--primary), var(--violet)); }
.switch-line input:checked + .switch::after { transform: translateX(16px); }

/* 筛选 chip */
.chip {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font: inherit; font-size: 12px;
  cursor: pointer; transition: all .16s;
}
.chip:hover { color: var(--text-2); border-color: #c3cee0; }
.chip.active {
  background: var(--primary-soft); border-color: var(--primary-line);
  color: var(--primary-dark); font-weight: 600;
}

/* 号码卡片 */
.order-list { display: flex; flex-direction: column; gap: 11px; }
.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 15px 17px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
/* 入场动画只给「新出现」的卡片；每次轮询都播放会变成每 3 秒闪一下 */
.order-card.is-new { animation: cardIn .2s ease-out; }
@keyframes cardIn { from { opacity: 0; transform: translateY(-5px); } }
.order-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.order-card[data-status="received"] { border-color: #c6ecda; box-shadow: 0 0 0 3px rgba(15,157,88,.05); }
.order-card[data-status="timeout"], .order-card[data-status="failed"] { background: #fdfcfc; }

.oc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.oc-phone {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 15.5px; font-weight: 600; letter-spacing: .3px;
}
.copy-mini {
  border: 0; background: var(--surface-soft); color: var(--muted);
  font: inherit; font-size: 11px; font-family: var(--font);
  cursor: pointer; padding: 3px 8px; border-radius: 6px;
  border: 1px solid var(--line);
}
.copy-mini:hover { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary-line); }

.oc-body { margin-top: 11px; }

.waiting { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.waiting b { color: var(--text-2); font-variant-numeric: tabular-nums; }
.pulse { display: inline-flex; gap: 3px; }
.pulse i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--primary); animation: pulse 1.25s infinite ease-in-out;
}
.pulse i:nth-child(2) { animation-delay: .16s; }
.pulse i:nth-child(3) { animation-delay: .32s; }
@keyframes pulse { 0%,100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }

.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 15px;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, #f0fbf6, #f4fdf9);
  border: 1px solid #c6ecda;
  cursor: pointer;
  transition: box-shadow .16s, background .16s;
}
.code-box:hover { box-shadow: 0 0 0 3px rgba(15,157,88,.1); }
.code-value {
  font-family: var(--mono); font-size: 23px; font-weight: 700;
  letter-spacing: 3px; color: #0a7f47;
  font-variant-numeric: tabular-nums;
}
.code-value.none { font-size: 14px; letter-spacing: 0; color: var(--muted); font-family: var(--font); font-weight: 400; }
.code-hint { font-size: 11.5px; color: #4f9c76; }

.sms-text {
  margin-top: 9px; padding: 9px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-2);
  font-family: var(--mono);
  max-height: 66px; overflow-y: auto;
  word-break: break-all;
}

.oc-foot { display: flex; align-items: center; gap: 9px; margin-top: 12px; flex-wrap: wrap; }
.meta { font-size: 11.5px; color: var(--faint); }
.meta b { color: var(--text-2); font-weight: 600; }
.kw-tag {
  font-size: 11.5px; padding: 2px 9px; border-radius: 6px;
  background: var(--primary-soft); color: var(--primary-dark);
  border: 1px solid var(--primary-line); font-weight: 500;
}
.oc-foot .spacer { flex: 1; }

.icon-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 8px;
  padding: 6px 11px;
  font: inherit; font-size: 11.5px;
  cursor: pointer; transition: all .16s;
  box-shadow: var(--shadow-xs);
}
.icon-btn:hover { background: var(--surface-soft); border-color: #c3cee0; color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); border-color: #f6cfcf; background: var(--danger-soft); }

.err-line {
  margin-top: 9px; padding: 8px 11px;
  border-radius: 8px;
  background: var(--danger-soft);
  border: 1px solid #f6cfcf;
  font-size: 11.5px; color: #a32222;
}

/* 空状态 */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 60px 20px; text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
}
.empty-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 20px; font-weight: 700;
  margin-bottom: 4px;
}
.empty p { font-size: 14px; font-weight: 550; color: var(--text-2); }
.empty span { font-size: 12.5px; color: var(--faint); }

/* 表格 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 550; font-size: 11.5px; color: var(--faint);
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: var(--surface-soft);
}
.table th:first-child { border-top-left-radius: var(--r-sm); }
.table th:last-child { border-top-right-radius: var(--r-sm); }
.table td {
  padding: 11px 12px; border-bottom: 1px solid var(--line);
  color: var(--text-2); vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-soft); }
.table .mono { font-family: var(--mono); color: var(--text); font-weight: 500; }
.table .code-cell { color: #0a7f47; font-family: var(--mono); font-weight: 650; letter-spacing: .6px; }
.table .clip { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-empty td { text-align: center; color: var(--faint); padding: 32px; }

/* 充值页 */
.recharge-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 18px; align-items: start; }

.balance-hero {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border-radius: var(--r-lg);
  color: #fff;
  background: linear-gradient(135deg, #4b63f0, #6f5cf6 60%, #8b5cf6);
  box-shadow: 0 16px 36px -18px rgba(79, 110, 247, .85);
}
.balance-hero::after {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  right: -80px; top: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.28), transparent 65%);
}
.balance-hero .label { font-size: 12.5px; opacity: .82; }
.balance-hero .amount {
  margin-top: 4px;
  font-size: 38px; font-weight: 700; letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.balance-hero .amount small { font-size: 17px; font-weight: 500; opacity: .85; margin-right: 3px; }
.balance-hero .foot {
  display: flex; gap: 22px; margin-top: 18px;
  padding-top: 15px; border-top: 1px solid rgba(255,255,255,.22);
  font-size: 12px; color: rgba(255,255,255,.85);
}
.balance-hero .foot b { color: #fff; font-weight: 600; }

.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.amount-opt {
  padding: 14px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: all .16s;
  font: inherit;
}
.amount-opt:hover { border-color: #c3cee0; box-shadow: var(--shadow-xs); }
.amount-opt b { display: block; font-size: 17px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.amount-opt span { font-size: 11px; color: var(--faint); }
.amount-opt.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px rgba(79,110,247,.1);
}
.amount-opt.active b { color: var(--primary-dark); }

.pay-method {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--primary-line);
  background: var(--primary-soft);
  margin-bottom: 16px;
}
.pay-logo {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: #1677ff; color: #fff; font-weight: 700; font-size: 13px;
}
.pay-method b { font-size: 13.5px; display: block; }
.pay-method span { font-size: 11.5px; color: var(--muted); }
.pay-method .ok { margin-left: auto; color: var(--primary-dark); font-size: 16px; }

.notice {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid;
}
.notice.info { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-dark); }
.notice.warn { background: var(--warning-soft); border-color: #fae5c2; color: #92510a; }

/* 账户页 */
.profile-head { display: flex; align-items: center; gap: 15px; margin-bottom: 4px; }
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 21px; font-weight: 700; color: var(--primary-dark);
  background: linear-gradient(135deg, #eef2ff, #f3efff);
  border: 1px solid var(--primary-line);
}
.profile-meta b { font-size: 17px; font-weight: 650; display: block; }
.profile-meta span { font-size: 12.5px; color: var(--muted); }

.kv-list { display: flex; flex-direction: column; }
.kv {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; color: var(--text); }

/* 窄屏 */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .recharge-grid { grid-template-columns: 1fr; }
  .sidebar { width: 196px; flex-basis: 196px; }
}

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-form-wrap { min-height: 100vh; }
}

@media (max-width: 780px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex: 0 0 auto; flex-direction: row; align-items: center;
    gap: 10px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .brand-text span { display: none; }
  .nav { flex-direction: row; gap: 2px; }
  .nav-item span { display: none; }
  .nav-item { padding: 9px; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .stat-grid { display: none; }
  .topbar { padding: 12px 16px; }
  .view { padding: 16px; }
  .field-row { grid-template-columns: 1fr; }
  .topbar-title p { display: none; }
}

/* ================================================================ 在线客服 */

/* 侧栏未读红点 */
.nav-item { position: relative; }
.nav-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.chat-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 168px);
  min-height: 420px;
}
.chat-shell.solo { grid-template-columns: minmax(0, 1fr); }

/* ---- 接待列表（客服端） ---- */
.chat-side {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.chat-side[hidden] { display: none; }
.chat-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.chat-list { flex: 1; overflow-y: auto; }
.chat-item {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .14s;
}
.chat-item:hover { background: #f7f9fc; }
.chat-item.active { background: var(--primary-soft); }
.ci-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 3px;
}
.ci-top b { font-weight: 650; }
.ci-top .meta { margin-left: auto; font-size: 11px; color: var(--faint); }
.ci-sub {
  font-size: 11.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-block;
}
.dot.waiting { background: var(--warning); }
.dot.online { background: var(--success); }
.badge {
  font-style: normal;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ---- 会话区 ---- */
.chat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.chat-head-info { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.chat-head-info b { font-size: 14px; }
.chat-head-info .meta { font-size: 12px; color: var(--faint); }

.chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fbfcfe;
}
.msg {
  max-width: min(78%, 560px);
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.6;
}
.msg .msg-text { white-space: pre-wrap; word-break: break-word; }
.msg .msg-time { margin-top: 3px; font-size: 10.5px; opacity: .55; text-align: right; }
.msg.mine {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.other {
  align-self: flex-start;
  background: #eef2f8;
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg.system {
  align-self: center;
  max-width: 88%;
  padding: 4px 10px;
  background: transparent;
  color: var(--faint);
  font-size: 11.5px;
  text-align: center;
}

.chat-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.chat-input textarea {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  padding: 11px 13px;
  resize: none;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
.chat-input textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 110, 247, 0.12);
}
.chat-input .btn { height: 42px; padding: 0 20px; }

.chat-empty {
  padding: 18px 14px;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
}
.chat-empty.tall {
  margin: auto;
  padding: 40px 20px;
  font-size: 13px;
}

@media (max-width: 980px) {
  .chat-shell { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 150px); }
  .chat-side { display: none; }
}

/* ---------------- 客服：输入区 / 表情 / 图片 ---------------- */

.chat-main { position: relative; }

.chat-input { align-items: flex-end; }
.chat-tools { display: flex; gap: 6px; padding-bottom: 3px; }
.tool-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.tool-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.tool-btn:disabled { opacity: .45; cursor: not-allowed; }

/* 输入框：默认不出滚动条（之前右边那条竖线就是它） */
.chat-input textarea {
  overflow-y: hidden;
  scrollbar-width: thin;
}

/* 表情面板 */
.emoji-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 68px;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.emoji-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--line);
  background: #fafbfd;
}
.emoji-title { font-size: 12px; color: var(--faint); }
.emoji-head .tool-btn { width: 26px; height: 26px; border-radius: 7px; font-size: 15px; }
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 4px;
  padding: 10px;
  max-height: 272px;
  overflow-y: auto;
}
.emoji-item {
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  padding: 3px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.emoji-item:hover { background: var(--primary-soft); border-color: var(--primary-line); }
.emoji-item img { width: 100%; height: 36px; object-fit: contain; display: block; }

/* 图片 / 表情气泡：不要底板 */
.msg.bare { padding: 0; background: transparent; }
.msg.bare.mine, .msg.bare.other { background: transparent; }
.msg-image {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.msg-emoji { display: block; width: 72px; height: 72px; object-fit: contain; }

/* 接待列表分组 */
.chat-group-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 6px;
  font-size: 11.5px;
  color: var(--faint);
  background: #fafbfd;
  border-bottom: 1px solid var(--line-soft);
}
.chat-group-head em { font-style: normal; font-weight: 700; color: var(--text-2); }
.dot.ended { background: var(--faint); }

/* 细一点的滚动条，别抢视线 */
.chat-msgs::-webkit-scrollbar,
.chat-list::-webkit-scrollbar,
.emoji-grid::-webkit-scrollbar,
.chat-input textarea::-webkit-scrollbar { width: 6px; }
.chat-msgs::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb,
.emoji-grid::-webkit-scrollbar-thumb,
.chat-input textarea::-webkit-scrollbar-thumb {
  background: #d3dae6;
  border-radius: 3px;
}

/* ---------------- 客服：头像 / 表情分类 / 层级修复 ---------------- */

/* 顶栏用 backdrop-filter 会生成层叠上下文，导致右上角菜单被后面的
   客服窗口盖住。把顶栏整体抬到最上层即可。 */
.topbar { position: relative; z-index: 60; }

.chat-head-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.chat-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid var(--primary-line);
}
.chat-head-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chat-head-text .meta { font-size: 11.5px; color: var(--faint); }

/* 消息行：头像 + 内容 */
.msg-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
}
.msg-row.mine { flex-direction: row-reverse; }
.msg-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: #eef2f8;
  border: 1px solid var(--line);
}
.msg-row.mine .msg-avatar {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: var(--primary-line);
}
.msg-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  max-width: min(78%, 560px);
}
.msg-row.mine .msg-side { align-items: flex-end; }
.msg-name {
  font-size: 11px;
  color: var(--faint);
  padding: 0 3px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.msg-row.mine .msg-name { display: none; }
.msg { max-width: 100%; }

/* 消息少的时候贴在底部，更像聊天窗口；
   用 margin-top:auto 的伪元素而不是 justify-content，避免内容超高时顶部被裁掉 */
.chat-msgs::before { content: ''; margin-top: auto; }

/* 表情网格：不显示滚动条，滚轮照样能翻 */
.emoji-grid {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.emoji-grid::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* ---------------- 图片查看器（软件内，不跳浏览器） ---------------- */
.img-viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(15, 23, 42, .72);
  cursor: zoom-out;
}
.img-viewer img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
}
.iv-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s;
}
.iv-close:hover { background: rgba(255, 255, 255, .3); }
.msg-image { cursor: zoom-in; }

/* ================================================================ 余额流水 */

.ledger-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.ledger-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ledger-dates { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ledger-dates input[type="date"],
.ledger-dates select {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.ledger-dates input[type="date"]:focus,
.ledger-dates select:focus { border-color: var(--primary); }

.ledger-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.ledger-summary > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
}
.ledger-summary span { font-size: 11.5px; color: var(--faint); }
.ledger-summary b { font-size: 16px; }

/* 中文习惯：收入红、支出绿 */
.amount-up, .ledger-summary .up { color: var(--danger); }
.amount-down, .ledger-summary .down { color: var(--success); }
.promo-stat .ok { color: var(--primary); }

.ledger-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 14px;
}

/* 流水 / 提现状态色 */
.pill[data-s="recharge"] { color: var(--danger); background: var(--danger-soft); border-color: rgba(220, 38, 38, .28); }
.pill[data-s="consume"] { color: var(--warning); background: var(--warning-soft); border-color: rgba(217, 119, 6, .28); }
.pill[data-s="pending"] { color: var(--warning); background: var(--warning-soft); border-color: rgba(217, 119, 6, .28); }
.pill[data-s="approved"] { color: var(--success); background: var(--success-soft); border-color: rgba(22, 163, 74, .28); }
.pill[data-s="rejected"] { color: var(--danger); background: var(--danger-soft); border-color: rgba(220, 38, 38, .28); }

/* ================================================================ 推广中心 */

.promo-linkbox { display: flex; gap: 10px; }
.promo-linkbox input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  color: var(--text-2);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12.5px;
  outline: none;
}

.promo-rule {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid #f5ddbd;
  border-radius: var(--r-md);
  background: #fff9f0;
  color: #8a5a1a;
  font-size: 13px;
  line-height: 1.8;
}
.promo-rule b { color: #d97706; }
.promo-rule-example { margin-top: 6px; font-size: 12.5px; }
.promo-rule-note { margin-top: 6px; font-size: 11.5px; opacity: .75; }

.promo-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.promo-stat {
  padding: 18px 12px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.promo-stat b { display: block; margin-bottom: 4px; font-size: 22px; }
.promo-stat span { font-size: 12px; color: var(--faint); }

.promo-list { display: flex; flex-direction: column; }
.promo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.promo-row:last-child { border-bottom: none; }
.promo-row .grow { flex: 1; min-width: 0; }
.promo-row .grow b { font-size: 15px; }
.empty-line { padding: 26px; text-align: center; color: var(--faint); font-size: 12.5px; }

.wd-upload { display: flex; align-items: center; gap: 10px; }

@media (max-width: 720px) {
  .ledger-summary, .promo-stats { grid-template-columns: 1fr; }
  .promo-linkbox { flex-direction: column; }
}
