/* ============================================================
   分分秒秒旗舰店 · 后台管理样式 (admin.css) v2.0
   设计系统：深色侧边栏 + 浅灰内容区 + 品牌金强调
   对标 Ant Design Pro · 企业级售后运营平台
   ============================================================ */

:root {
  /* 深色侧边栏 */
  --side: #0f172a;
  --side-2: #16203a;
  --side-3: #1e2a48;
  --side-line: rgba(255, 255, 255, .08);
  --side-text: #94a3b8;
  --side-text-hi: #e2e8f0;

  /* 品牌金 */
  --gold: #c9a227;
  --gold-bright: #e3bc45;
  --gold-deep: #a8861b;
  --gold-soft: #faf3dd;
  --gold-grad: linear-gradient(135deg, #e3bc45, #c9a227);

  /* 内容区 */
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --bg: #f1f5f9;
  --card: #ffffff;

  /* 状态色 */
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --warn: #d97706;
  --warn-bg: #fef3c7;
  --err: #dc2626;
  --err-bg: #fee2e2;
  --info: #2563eb;
  --info-bg: #dbeafe;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --sidebar-w: 236px;
  --topbar-h: 60px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .1);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .24);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.3; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img, svg { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
code, pre { font-family: var(--mono); }

::selection { background: rgba(201, 162, 39, .25); }

.muted { color: var(--ink-3); }
.gold { color: var(--gold-deep); }
.strong { font-weight: 700; }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.flex { display: flex; }
.acenter { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap12 { gap: 12px; } .gap16 { gap: 16px; } .gap20 { gap: 20px; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.mb4 { margin-bottom: 4px; } .mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; } .mb20 { margin-bottom: 20px; }

/* ============================================================
   布局骨架
   ============================================================ */
.admin { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--side) 0%, #0b1120 100%);
  color: var(--side-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 11px;
  padding: 17px 18px; border-bottom: 1px solid var(--side-line);
  flex: 0 0 auto;
}
.sidebar__brand img { width: 36px; height: 36px; flex: 0 0 auto; filter: drop-shadow(0 2px 6px rgba(201, 162, 39, .35)); }
.sidebar__brand b { display: block; font-size: 14px; color: #f1f5f9; letter-spacing: .5px; }
.sidebar__brand .brand-sub { display: block; font-size: 10.5px; color: var(--gold-bright); letter-spacing: 1.5px; margin-top: 2px; }

.sidebar__nav { flex: 1 1 auto; overflow-y: auto; padding: 12px 10px 20px; }
.sidebar__nav::-webkit-scrollbar { width: 5px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 3px; }

.nav-group { margin-bottom: 3px; }
.nav-group__head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--side-text); font-size: 13px; text-align: left;
  transition: background .15s, color .15s;
}
.nav-group__head:hover { background: rgba(255, 255, 255, .06); color: var(--side-text-hi); }
.nav-group__head svg { width: 17px; height: 17px; flex: 0 0 auto; }
.nav-group__head .caret { margin-left: auto; transition: transform .2s; width: 13px; height: 13px; }
.nav-group.is-open .nav-group__head { color: var(--side-text-hi); }
.nav-group.is-open .caret { transform: rotate(90deg); }
.nav-group__items { overflow: hidden; max-height: 0; transition: max-height .22s ease; }
.nav-group.is-open .nav-group__items { max-height: 480px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 39px; margin: 1px 0; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--side-text); position: relative;
  transition: background .15s, color .15s;
}
.nav-item::before {
  content: ""; position: absolute; left: 21px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .2);
  transition: background .15s, box-shadow .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: var(--side-text-hi); }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(201, 162, 39, .24), rgba(201, 162, 39, .06));
  color: var(--gold-bright); font-weight: 600;
}
.nav-item.is-active::before { background: var(--gold-bright); box-shadow: 0 0 8px rgba(227, 188, 69, .8); }
.nav-item .badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--err); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 700;
}

.sidebar__foot { flex: 0 0 auto; padding: 12px 16px; border-top: 1px solid var(--side-line); font-size: 11px; color: #64748b; letter-spacing: .3px; }

.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: rgba(255, 255, 255, .88); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar__toggle { display: none; width: 34px; height: 34px; border-radius: var(--radius-sm); color: var(--ink-2); align-items: center; justify-content: center; }
.topbar__toggle:hover { background: var(--bg); }
.topbar__toggle svg { width: 20px; height: 20px; }
.crumb { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 13px; }
.crumb b { color: var(--ink); font-weight: 700; font-size: 14.5px; }
.crumb svg { width: 13px; height: 13px; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.top-user { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: var(--radius-pill); background: var(--bg); border: 1px solid var(--line); }
.top-user__avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--gold-grad);
  color: #231a04; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
  box-shadow: 0 2px 8px rgba(201, 162, 39, .4);
}
.top-user__meta { line-height: 1.25; }
.top-user__meta b { display: block; font-size: 12.5px; }
.top-user__meta span { display: block; font-size: 10.5px; color: var(--gold-deep); }

.content { flex: 1 1 auto; padding: 20px; min-width: 0; }

/* ============================================================
   页头 / 工具条 / 卡片
   ============================================================ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; letter-spacing: .3px; }
.page-head .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card__head { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card__title { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card__title::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--gold-grad); }
.card__title--plain::before { display: none; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--line-2); background: #fbfcfe; }
.toolbar .field-inline { display: flex; align-items: center; gap: 6px; }
.toolbar label { font-size: 12.5px; color: var(--ink-3); }

/* ============================================================
   统计卡（.stats 兼容旧版 / .stat-grid 新版）
   ============================================================ */
.stats, .stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid--2 { grid-template-columns: repeat(2, 1fr); }
.stat {
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold-grad); opacity: 0; transition: opacity .2s; }
.stat:hover::after { opacity: 1; }
.stat__label { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.stat__label svg { width: 15px; height: 15px; }
.stat__value { font-size: 26px; font-weight: 800; margin-top: 8px; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.stat__value .cur { font-size: .55em; margin-right: 2px; color: var(--ink-3); font-weight: 600; }
.stat__foot { font-size: 11.5px; color: var(--ink-3); margin-top: 7px; }
.stat__foot .up { color: var(--ok); font-weight: 600; }
.stat--hero { background: linear-gradient(135deg, #1e293b, #0f172a); border-color: #1e293b; color: #f1f5f9; }
.stat--hero .stat__label, .stat--hero .stat__foot { color: #94a3b8; }
.stat--hero .stat__value { color: var(--gold-bright); }
.stat--hero::after { opacity: 1; }

/* ============================================================
   表格
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.data { font-size: 13px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; vertical-align: middle; white-space: nowrap; }
table.data th {
  background: #f8fafc; color: var(--ink-2); font-weight: 600; font-size: 12.5px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1;
}
table.data tbody tr { border-bottom: 1px solid var(--line-2); transition: background .12s; }
table.data tbody tr:nth-child(even) { background: #fbfdff; }
table.data tbody tr:last-child { border-bottom: 0; }
table.data tbody tr:hover { background: var(--gold-soft); }
table.data .wrap-cell { display: inline-block; vertical-align: top; white-space: normal; max-width: 320px; word-break: break-word; }
table.data .t-title { font-weight: 600; color: var(--ink); }
table.data .t-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
table.data .t-mono { font-family: var(--mono); font-size: 12.5px; }
.t-title { font-weight: 600; color: var(--ink); }
.t-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.t-mono { font-family: var(--mono); font-size: 12.5px; }
.thumb { width: 42px; height: 42px; border-radius: var(--radius-sm); object-fit: cover; background: var(--bg); border: 1px solid var(--line); }
.actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* 头像 */
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #eef2f7; border: 1px solid var(--line); flex: 0 0 auto; }
.avatar--ph { display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 14px; font-weight: 600; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); }

/* ============================================================
   标签 / 状态（圆角胶囊）
   ============================================================ */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; font-size: 12px; border-radius: var(--radius-pill); background: var(--gold-soft); color: var(--gold-deep); font-weight: 600; line-height: 1.7; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .7; }
.tag--line { background: #fff; border: 1px solid var(--line); color: var(--ink-3); font-weight: 500; }
.tag--line::before { display: none; }
.tag--ok { background: var(--ok-bg); color: var(--ok); }
.tag--warn { background: var(--warn-bg); color: var(--warn); }
.tag--err { background: var(--err-bg); color: var(--err); }
.tag--info { background: var(--info-bg); color: var(--info); }
.tag--muted { background: #e9eef5; color: var(--ink-3); }

/* 简易 pill（兼容旧代码） */
.pill { display: inline-flex; align-items: center; padding: 2px 10px; font-size: 12px; border-radius: var(--radius-pill); background: #e9eef5; color: var(--ink-3); font-weight: 600; }
.pill--ok { background: var(--ok-bg); color: var(--ok); }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.2;
  transition: background .18s, color .18s, border-color .18s, box-shadow .18s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }
.btn--gold { background: var(--gold-grad); color: #231a04; box-shadow: 0 4px 14px rgba(201, 162, 39, .35); }
.btn--gold:hover { filter: brightness(1.06); box-shadow: 0 6px 18px rgba(201, 162, 39, .45); }
.btn--dark { background: var(--side); color: #e8edf5; }
.btn--dark:hover { background: var(--side-3); }
.btn--line { border-color: var(--line); background: #fff; color: var(--ink-2); }
.btn--line:hover { border-color: var(--gold); color: var(--gold-deep); background: var(--gold-soft); }
.btn--danger { background: var(--err-bg); color: var(--err); }
.btn--danger:hover { background: #fecaca; }
.btn--ghost { background: #eef2f7; color: var(--ink-2); }
.btn--ghost:hover { background: #e2e8f0; }
.btn--text { padding: 6px 8px; color: var(--gold-deep); }
.btn--text:hover { color: var(--gold-bright); }
.btn--sm { padding: 5px 12px; font-size: 12px; }
.btn--xs { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn--block { width: 100%; }
.btn--icon { padding: 6px; }

/* 点亮眼睛按钮（查看脱敏数据） */
.eye-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; margin-left: 6px; border-radius: 6px;
  color: var(--ink-3); vertical-align: middle;
  transition: background .15s, color .15s;
}
.eye-btn:hover { background: var(--gold-soft); color: var(--gold-deep); }
.eye-btn svg { width: 15px; height: 15px; }
.eye-btn.is-on { color: var(--gold-deep); }

/* ============================================================
   表单
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: 0; }
.field__label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.field__label .req { color: var(--err); margin-left: 2px; }
.field__hint { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.6; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; outline: none; font-size: 13px; transition: border-color .16s, box-shadow .16s;
}
.input:hover, .select:hover, .textarea:hover { border-color: #cbd5e1; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .16); }
.input::placeholder, .textarea::placeholder { color: #b6c0cf; }
.textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.textarea--code { min-height: 160px; font-family: var(--mono); font-size: 12.5px; }
.select { appearance: none; background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.input--sm, .select--sm { padding: 7px 10px; font-size: 12.5px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--gold-deep); cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { display: none; }
.switch__track { width: 38px; height: 21px; border-radius: 11px; background: #cbd5e1; position: relative; transition: background .2s; flex: 0 0 auto; }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + .switch__track { background: var(--gold-deep); }
.switch input:checked + .switch__track::after { transform: translateX(17px); }

/* 单选分段（发放方式等） */
.seg { display: inline-flex; background: #eef2f7; border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg label { padding: 6px 14px; border-radius: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s; }
.seg input { display: none; }
.seg label:has(input:checked) { background: #fff; color: var(--gold-deep); font-weight: 700; box-shadow: var(--shadow-sm); }

/* 上传 */
.uploader { display: flex; gap: 12px; align-items: flex-start; }
.uploader__preview {
  width: 96px; height: 96px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  overflow: hidden; color: var(--ink-3); flex: 0 0 auto; cursor: pointer; position: relative;
  transition: border-color .15s;
}
.uploader__preview:hover { border-color: var(--gold); }
.uploader__preview img { width: 100%; height: 100%; object-fit: cover; }
.uploader__preview svg { width: 22px; height: 22px; }
.uploader__ops { display: flex; flex-direction: column; gap: 8px; }

/* ============================================================
   弹窗（圆角 16px）
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 940;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px;
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-mask.is-open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: 560px; background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); transform: translateY(-12px) scale(.98); transition: transform .22s cubic-bezier(.34, 1.4, .64, 1); margin: auto;
  overflow: hidden;
}
.modal--wide { max-width: 860px; }
.modal--slim { max-width: 400px; }
.modal-mask.is-open .modal { transform: translateY(0) scale(1); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal__head h3 { font-size: 15.5px; }
.modal__close { width: 30px; height: 30px; border-radius: var(--radius-sm); color: var(--ink-3); display: flex; align-items: center; justify-content: center; transition: background .15s, color .15s; }
.modal__close:hover { background: var(--bg); color: var(--ink); }
.modal__close svg { width: 17px; height: 17px; }
.modal__body { padding: 20px; max-height: 66vh; overflow-y: auto; }
.modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-2); background: #f8fafc; }
.modal__foot .left { margin-right: auto; }

/* ============================================================
   右侧抽屉（用户详情 / 客户档案）
   ============================================================ */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 920;
  opacity: 0; visibility: hidden; transition: opacity .22s, visibility .22s;
}
.drawer-mask.is-open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 96vw); z-index: 921;
  background: var(--bg); box-shadow: -16px 0 48px rgba(15, 23, 42, .22);
  transform: translateX(100%); transition: transform .26s cubic-bezier(.32, .72, .24, 1);
  display: flex; flex-direction: column;
}
.drawer-mask.is-open + .drawer, .drawer.is-open { transform: translateX(0); }
.drawer__head {
  display: flex; align-items: center; gap: 12px; padding: 16px 20px;
  background: linear-gradient(135deg, #1e293b, #0f172a); color: #f1f5f9; flex: 0 0 auto;
}
.drawer__head h3 { font-size: 15.5px; flex: 1 1 auto; }
.drawer__close { width: 32px; height: 32px; border-radius: var(--radius-sm); color: #94a3b8; display: flex; align-items: center; justify-content: center; }
.drawer__close:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.drawer__close svg { width: 17px; height: 17px; }
.drawer__body { flex: 1 1 auto; overflow-y: auto; padding: 18px 20px 30px; }

/* 详情区块 */
.dsec { background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 14px; overflow: hidden; }
.dsec__head { padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dsec__body { padding: 14px 16px; }
.dsec__body--flush { padding: 0; }

/* 详情列表 */
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 0; font-size: 13px; }
.dl dt { color: var(--ink-3); padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.dl dd { padding: 8px 0; margin: 0; border-bottom: 1px dashed var(--line-2); word-break: break-all; }
.dl dt:last-of-type, .dl dd:last-of-type { border-bottom: 0; }
.dl--2col { grid-template-columns: 96px 1fr 96px 1fr; }
.dl--2col dt, .dl--2col dd { border-bottom: 1px dashed var(--line-2); }

/* 迷你统计条（详情页） */
.minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.mini { background: #f8fafc; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.mini__l { font-size: 11.5px; color: var(--ink-3); }
.mini__v { font-size: 16px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* ============================================================
   分页
   ============================================================ */
.pager { display: flex; align-items: center; gap: 6px; padding: 14px 16px; flex-wrap: wrap; }
.pager__info { font-size: 12.5px; color: var(--ink-3); margin-right: auto; }
.pager button { min-width: 32px; height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink-2); font-size: 13px; transition: border-color .15s, color .15s; }
.pager button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-deep); }
.pager button.is-active { background: var(--side); color: #fff; border-color: var(--side); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager__jump { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.pager__jump input { width: 52px; padding: 6px 8px; text-align: center; }

/* ============================================================
   空态 / 加载 / 提示
   ============================================================ */
.empty { text-align: center; padding: 54px 20px; color: var(--ink-3); }
.empty svg { width: 52px; height: 52px; margin: 0 auto 12px; color: #cbd5e1; }
.empty__title { font-size: 14.5px; color: var(--ink-2); font-weight: 600; }
.loading { text-align: center; padding: 50px 0; color: var(--ink-3); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; margin: 0 auto 10px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 1200; display: flex; flex-direction: column; gap: 9px; align-items: center; pointer-events: none; }
.toast {
  max-width: 86vw; padding: 10px 18px; border-radius: var(--radius-pill); background: rgba(15, 23, 42, .94);
  color: #f1f5f9; font-size: 13px; box-shadow: var(--shadow-md); opacity: 0; transform: translateY(-8px);
  transition: opacity .22s, transform .22s;
}
.toast.is-show { opacity: 1; transform: translateY(0); }
.toast--ok { background: #15803d; }
.toast--err { background: #b91c1c; }
.toast--warn { background: #b45309; }

/* ============================================================
   迷你柱状图
   ============================================================ */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding: 10px 4px 0; }
.bars__item { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; cursor: default; }
.bars__bar { width: 100%; max-width: 36px; border-radius: 6px 6px 2px 2px; background: var(--gold-grad); min-height: 3px; transition: height .4s ease, filter .15s; }
.bars__item:hover .bars__bar { filter: brightness(1.1); }
.bars__val { font-size: 11px; color: var(--ink-3); }
.bars__label { font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* 提成排行榜 */
.rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; transition: border-color .15s, background .15s; }
.rank-item:hover { border-color: var(--gold); }
.rank-item.is-me { background: var(--gold-soft); border-color: var(--gold); }
.rank-item__no { width: 26px; height: 26px; border-radius: 50%; background: #eef2f7; color: var(--ink-2); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.rank-item:nth-child(1) .rank-item__no { background: #fef3c7; color: #b45309; }
.rank-item:nth-child(2) .rank-item__no { background: #e2e8f0; color: #475569; }
.rank-item:nth-child(3) .rank-item__no { background: #ffe4d6; color: #c2410c; }
.rank-item__name { flex: 1 1 auto; font-weight: 600; font-size: 13px; }
.rank-item__meta { font-size: 12px; color: var(--ink-3); }
.rank-item__amt { font-weight: 800; font-size: 14.5px; color: var(--gold-deep); font-variant-numeric: tabular-nums; }

/* 权限矩阵 */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 14px; }
.perm-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 12.5px; }
.role-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.role-tabs button { padding: 7px 14px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: #fff; font-size: 13px; color: var(--ink-2); }
.role-tabs button.is-active { background: var(--side); color: #e8edf5; border-color: var(--side); }

/* 日志块 */
.log-detail { font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: pre-wrap; word-break: break-all; }

/* 移动遮罩 */
.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 25; }
.sidebar-mask.is-open { display: block; }

/* ============================================================
   登录页（深色渐变 + 玻璃拟态卡片）
   ============================================================ */
.login-body { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: var(--bg); }
.login-side {
  position: relative; color: #f1f5f9;
  background:
    radial-gradient(ellipse 620px 480px at 85% -10%, rgba(201, 162, 39, .22), transparent 60%),
    radial-gradient(ellipse 500px 420px at -10% 110%, rgba(37, 99, 235, .16), transparent 60%),
    linear-gradient(160deg, #0f172a 0%, #111c33 55%, #0b1120 100%);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px 52px; overflow: hidden;
}
.login-side::before {
  content: ""; position: absolute; right: -140px; top: -140px; width: 440px; height: 440px; border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, .25);
}
.login-side::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, .2), transparent 70%);
}
.login-side__inner { position: relative; z-index: 2; }
.login-side h1 { font-size: 32px; line-height: 1.35; margin-bottom: 14px; letter-spacing: 1px; }
.login-side p { color: #b8c2d4; max-width: 430px; line-height: 1.8; }
.login-side__foot { position: relative; z-index: 2; font-size: 12.5px; color: #7c8aa5; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; }
.login-brand img { width: 44px; height: 44px; filter: drop-shadow(0 3px 10px rgba(201, 162, 39, .45)); }
.login-brand b { display: block; font-size: 15px; color: #f1f5f9; letter-spacing: .5px; }
.login-brand .brand-sub { display: block; font-size: 10.5px; color: var(--gold-bright); letter-spacing: 2px; margin-top: 3px; }

.login-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; position: relative; }
.login-card {
  width: 100%; max-width: 392px; background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px); border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 20px; box-shadow: 0 24px 60px rgba(15, 23, 42, .12);
  padding: 34px 32px;
}
.login-card .head { margin-bottom: 24px; }
.login-card .head h2 { font-size: 21px; margin-bottom: 5px; }
.login-card .head p { color: var(--ink-3); font-size: 13px; }

/* 备案信息（登录页底部） */
.login-beian { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.login-beian a { display: inline-flex; align-items: center; gap: 5px; color: inherit; text-decoration: none; }
.login-beian a:hover { color: var(--gold-bright); }
.login-beian img { width: 14px; height: 14px; display: block; }
.login-main__beian { display: none; margin-top: 34px; justify-content: center; }
.login-main__beian .login-beian a:hover { color: var(--gold-deep); }

/* 飞书入口 */
.btn--feishu { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 12px 16px; background: var(--side); color: #e8edf5; border-radius: 10px; }
.btn--feishu:hover:not(:disabled) { background: var(--side-3); }
.btn--feishu:disabled { opacity: .55; cursor: not-allowed; }
.btn--feishu svg { width: 18px; height: 18px; }
.login-feishu-tip { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.login-alert { display: flex; align-items: flex-start; gap: 8px; padding: 11px 13px; margin-bottom: 16px; border: 1px solid #fecaca; border-radius: var(--radius-sm); background: #fef2f2; color: #b91c1c; font-size: 13px; line-height: 1.6; }
.login-alert[hidden] { display: none; }
.login-alert svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* MFA 验证码输入 */
.mfa-input { display: flex; gap: 10px; justify-content: center; }
.mfa-input input { width: 46px; height: 54px; text-align: center; font-size: 22px; font-weight: 700; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.mfa-input input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .16); }

/* ============================================================
   全站水印
   ============================================================ */
#ffmm-watermark-layer {
  position: fixed; inset: 0; z-index: 800; pointer-events: none;
  background-repeat: repeat; background-position: 0 0;
}

/* 飞书导入选择器 */
.picker-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; max-height: 196px; overflow: auto; padding: 6px 10px; }
.picker-box--tall { max-height: 280px; }
.picker-box label { display: flex; align-items: center; gap: 8px; padding: 5px 2px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.picker-box label:hover { background: var(--bg); }
.picker-box input[type="checkbox"] { accent-color: var(--gold-deep); width: 14px; height: 14px; flex: none; }
.picker-box .picker__meta { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.picker-box .picker__meta.is-exists { color: var(--gold-deep); }

/* ============================================================
   客服工作台（三栏布局）
   ============================================================ */
.cs-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 14px; align-items: stretch; height: calc(100vh - var(--topbar-h) - 40px); min-height: 520px; }
.cs-layout__col { display: flex; flex-direction: column; min-height: 0; }
.cs-layout .card { display: flex; flex-direction: column; min-height: 0; height: 100%; }

/* 会话列表 */
.cs-filter { padding: 12px 12px 10px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }
.cs-filter__row { display: flex; gap: 6px; }
.cs-convs { flex: 1 1 auto; overflow-y: auto; }
.cs-conv { display: flex; gap: 10px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--line-2); position: relative; transition: background .13s; }
.cs-conv:hover { background: #f8fafc; }
.cs-conv.is-active { background: var(--gold-soft); }
.cs-conv.is-active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold-grad); }
.cs-conv__avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); color: var(--ink-2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.cs-conv__main { flex: 1 1 auto; min-width: 0; }
.cs-conv__top { display: flex; align-items: center; gap: 8px; }
.cs-conv__name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-conv__time { margin-left: auto; font-size: 11px; color: var(--ink-3); flex: 0 0 auto; }
.cs-conv__preview { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.cs-conv__meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.cs-conv__badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--err); color: #fff; font-size: 10.5px; line-height: 17px; text-align: center; font-weight: 700; }

/* 聊天窗 */
.cs-chat { display: flex; flex-direction: column; min-height: 0; }
.cs-chat__head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); flex: 0 0 auto; }
.cs-chat__name { font-size: 14.5px; font-weight: 700; }
.cs-chat__meta { font-size: 12px; color: var(--ink-3); }
.cs-chat__ops { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.cs-msgs { flex: 1 1 auto; overflow-y: auto; padding: 18px 16px; background: #f8fafc; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.cs-msg { max-width: 76%; display: flex; flex-direction: column; align-items: flex-start; }
.cs-msg--me { align-self: flex-end; align-items: flex-end; }
.cs-msg__bubble { padding: 10px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; box-shadow: var(--shadow-sm); }
.cs-msg--me .cs-msg__bubble { background: var(--gold-grad); border-color: transparent; color: #231a04; }
.cs-msg__meta { margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.cs-reply { border-top: 1px solid var(--line-2); padding: 12px 16px 14px; flex: 0 0 auto; background: #fff; }
.cs-reply__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.cs-reply__tip { font-size: 12px; color: var(--ink-3); }

/* 客户侧栏 */
.cs-side { overflow-y: auto; }
.cs-side__head { padding: 16px; border-bottom: 1px solid var(--line-2); text-align: center; }
.cs-side__avatar { width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 10px; background: linear-gradient(135deg, #e2e8f0, #cbd5e1); color: var(--ink-2); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; overflow: hidden; }
.cs-side__avatar img { width: 100%; height: 100%; object-fit: cover; }
.cs-side__name { font-size: 15px; font-weight: 700; }
.cs-side__sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.cs-side__body { padding: 14px 16px; }
.cs-kv { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line-2); }
.cs-kv:last-child { border-bottom: 0; }
.cs-kv dt { color: var(--ink-3); }
.cs-kv dd { margin: 0; font-weight: 600; display: flex; align-items: center; }

/* 兼容旧两栏（保留类避免残留引用报错） */
.cs-wrap { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cs-col-list { flex: 1 1 400px; min-width: 300px; }
.cs-col-chat { flex: 1 1 460px; min-width: 320px; }
.cs-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.cs-user__name { font-size: 14px; font-weight: 600; }
.cs-user__meta { font-size: 12px; color: var(--ink-3); }
.cs-user__actions { margin-left: auto; display: flex; gap: 8px; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1280px) {
  .cs-layout { grid-template-columns: 280px minmax(0, 1fr); }
  .cs-layout__col--side { display: none; }
}
@media (max-width: 1100px) {
  .stats, .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-mask { display: block; opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
  .sidebar-mask.is-open { opacity: 1; visibility: visible; }
  .topbar__toggle { display: flex; }
  .form-grid { grid-template-columns: 1fr; }
  .login-body { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-main__beian { display: flex; }
  .content { padding: 14px; }
  .cs-layout { grid-template-columns: 1fr; height: auto; }
  .drawer { width: 100vw; }
  .dl--2col { grid-template-columns: 96px 1fr; }
}
@media (max-width: 520px) {
  .stats, .stat-grid { grid-template-columns: 1fr; }
}
