:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --border: #e5e9f0;
  --border-strong: #d8dfeb;
  --text: #1f2a3d;
  --muted: #7b879b;
  --primary: #2f6bff;
  --primary-dark: #2557d8;
  --green: #12a05c;
  --orange: #f59e0b;
  --red: #e5484d;
  --purple: #8b5cf6;
  --cyan: #0ea5c9;
  --blue: #2f80ed;
  --shadow: 0 2px 12px rgba(31, 42, 61, .06);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

button, input, select { font-family: inherit; }
button { cursor: pointer; }

/* ---------- Auth ---------- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 15% 15%, rgba(47, 107, 255, .12), transparent 32%),
    radial-gradient(circle at 85% 80%, rgba(18, 160, 92, .10), transparent 30%),
    var(--bg);
}

.auth-card {
  width: 420px;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(31, 42, 61, .10);
  padding: 34px 36px 30px;
}

.brand-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f6bff, #1c4fd8);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -1px;
  box-shadow: 0 4px 12px rgba(47, 107, 255, .28);
}
.brand-mark.small { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.brand-title { font-size: 15px; font-weight: 700; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: .8px; margin-top: 2px; }

.auth-card h1 { font-size: 24px; margin: 0 0 8px; letter-spacing: -.5px; }
.auth-desc { color: var(--muted); margin: 0 0 26px; line-height: 1.6; }
.field-label { display: block; font-weight: 600; margin: 16px 0 7px; font-size: 12px; }
.auth-field input, .auth-code-row input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus, .auth-code-row input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .10);
}
.auth-code-row { display: flex; gap: 8px; }
.auth-code-row input { flex: 1; min-width: 0; }
.auth-code-row .btn { height: 40px; white-space: nowrap; }
.field-error { min-height: 16px; color: var(--red); font-size: 11px; margin-top: 4px; }
.auth-message { min-height: 18px; margin-top: 12px; font-size: 12px; color: var(--red); }
.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}
.link-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  padding: 2px 0;
}
.link-button:hover { text-decoration: underline; }
.auth-footnote {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
  color: var(--muted);
  line-height: 1.6;
  font-size: 11px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform .1s, filter .15s, background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--primary); border-color: #bcd0ff; }
.btn-outline:hover { background: #f2f6ff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: #eef1f6; }
.btn-sm { height: 28px; padding: 0 10px; }
.btn-block { width: 100%; height: 42px; margin-top: 8px; font-size: 14px; }
.btn-green { background: var(--green); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-cyan { background: var(--cyan); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-white { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-white:hover { background: #f7f9fc; }
.btn-danger-outline { background: #fff; color: var(--red); border-color: #f3b6b8; }
.btn-page { height: 28px; background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-page:disabled { opacity: .4; }

/* ---------- Shell ---------- */
.app-shell { min-height: 100vh; }
.topbar {
  height: 62px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 11px; }
.topbar-title { font-size: 15px; font-weight: 700; }
.topbar-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.sync-status { font-size: 11px; color: var(--green); display: inline-flex; align-items: center; gap: 5px; }
.sync-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.sync-status.error { color: var(--red); }
.sync-status.error i { background: var(--red); }
.user-chip { display: flex; align-items: center; gap: 7px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e8efff; color: var(--primary); font-size: 12px; font-weight: 700;
}
.user-name { font-size: 12px; font-weight: 600; }

.main { padding: 20px 24px 36px; max-width: 1920px; margin: 0 auto; }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent, var(--primary));
}
.stat-label { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 5px; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 7px; letter-spacing: -.5px; }
.stat-hint { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ---------- Product bar ---------- */
.product-panel { margin-bottom: 16px; }
.product-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.product-title-wrap { display: flex; align-items: baseline; gap: 10px; }
.product-title-wrap h2 { font-size: 14px; margin: 0; }
.product-count { font-size: 11px; color: var(--muted); }
.product-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
}
.product-tab {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: border-color .15s, background .15s;
}
.product-tab:hover { border-color: var(--primary); }
.product-tab.active { border-color: var(--primary); background: #eef3ff; box-shadow: inset 0 0 0 1px var(--primary); }
.product-tab-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}
.product-tab.active .product-tab-main { color: var(--primary); font-weight: 600; }
.product-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: #eef1f6;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.product-tab.active .product-tab-count { background: var(--primary); color: #fff; }
.product-tab-tools {
  display: inline-flex;
  align-items: stretch;
  border-left: 1px solid var(--border);
}
.product-tab-tools button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 14px;
  line-height: 1;
}
.product-tab-tools button:hover { background: #ffecec; color: var(--red); }
.product-tab-tools button[data-action="edit-product"]:hover { background: #eef3ff; color: var(--primary); }

/* ---------- Product cards ---------- */
.product-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.product-count-wrap { font-size: 13px; color: var(--text); }
.product-count-num { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }
.product-toolbar-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fav-filter { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.fav-filter button {
  border: 0;
  background: #fff;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
}
.fav-filter button + button { border-left: 1px solid var(--border); }
.fav-filter button.active { background: #eef3ff; color: var(--primary); font-weight: 600; }
.product-toolbar-filters .control { min-width: 150px; }
.product-toolbar-filters .btn-search { min-width: 42px; padding: 0 10px; }

.product-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(31, 42, 61, .05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, border-color .15s;
}
.product-card:hover { border-color: var(--primary); box-shadow: 0 4px 16px rgba(47, 107, 255, .12); }
.pc-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 10px; position: relative; }
.pc-avatar {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d92b2b, #a31515);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(169, 21, 21, .3);
}
.pc-head-main { min-width: 0; flex: 1 1 auto; }
.pc-name-row { display: flex; align-items: center; gap: 4px; }
.pc-name { font-size: 13px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.pc-rate { margin-top: 3px; font-size: 11px; color: var(--muted); }
.pc-rate span { color: var(--orange); font-weight: 600; }
.pc-copy { border: 0; background: transparent; color: #9aa5b5; font-size: 12px; padding: 1px 3px; line-height: 1; }
.pc-copy:hover { color: var(--primary); }
.pc-side { flex: 0 0 auto; text-align: right; }
.pc-heart {
  border: 0; background: transparent; color: #b9c2d0;
  font-size: 22px; line-height: 1; padding: 2px 4px;
  cursor: pointer; transition: transform .12s, color .12s;
}
.pc-heart:hover { transform: scale(1.15); color: var(--red); }
.pc-heart.on { color: var(--red); text-shadow: 0 1px 4px rgba(229,72,77,.35); }
.pc-bonus { color: var(--red); font-weight: 700; font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.pc-rows { padding: 0 14px 10px; }
.pc-row { display: flex; align-items: center; gap: 5px; padding: 3px 0; font-size: 11.5px; }
.pc-label { color: var(--muted); white-space: nowrap; }
.pc-value { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-value.code { color: var(--red); }
.pc-row.attribution .pc-value { color: #d946a8; font-weight: 600; white-space: normal; }
.pc-amounts { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 14px; }
.pc-amount { padding: 10px 4px; text-align: center; }
.pc-amount + .pc-amount { border-left: 1px solid var(--border); }
.pc-amount-label { display: block; font-size: 11px; color: var(--muted); }
.pc-amount-value { display: block; margin-top: 3px; font-size: 13px; font-weight: 700; color: var(--orange); font-variant-numeric: tabular-nums; }
.pc-foot { padding: 12px 14px 14px; margin-top: auto; display: flex; align-items: center; gap: 8px; }
.pc-tools { display: flex; gap: 2px; flex: 0 0 auto; }
.pc-tools button { border: 1px solid var(--border); background: #fff; color: var(--muted); width: 30px; height: 30px; font-size: 14px; line-height: 1; border-radius: 6px; }
.pc-tools button:hover { background: #eef3ff; color: var(--primary); border-color: var(--primary); }
.pc-tools button[data-action="delete-product"]:hover { background: #ffecec; color: var(--red); border-color: var(--red); }
.btn-manage {
  flex: 1 1 auto;
  border: 1px solid var(--border-strong);
  background: #f8fafc;
  color: var(--text);
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
  font-weight: 600;
}
.btn-manage:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.pc-foot-count { display: inline-block; margin-left: 4px; background: #eef1f6; color: var(--muted); border-radius: 9px; padding: 0 6px; font-size: 10px; }
.btn-manage:hover .pc-foot-count { background: rgba(255,255,255,.22); color: #fff; }

.account-area-bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; margin-bottom: 16px; }
.account-area-title { font-size: 13px; color: var(--muted); }
.account-area-title b { color: var(--text); }

/* ---------- Sub-list bar ---------- */
.sublist-panel { margin-bottom: 16px; }
.sublist-panel .product-panel-head { padding: 10px 16px 10px 28px; }
.sublist-panel .product-title-wrap h2::before {
  content: "└";
  color: var(--muted);
  font-weight: 400;
  margin-right: 6px;
}
.sublist-tabs { padding: 10px 16px 10px 28px; }
.sublist-tab .product-tab-main { padding: 5px 10px; font-size: 11px; }
.sublist-tab.active { background: #eef8f4; border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.sublist-tab.active .product-tab-main { color: var(--green); }
.sublist-tab.active .product-tab-count { background: var(--green); color: #fff; }
.sublist-hint { font-size: 11px; color: var(--muted); padding: 4px 0; }

/* ---------- Panel / filters ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 14px; margin: 0; }
.panel-sub { font-size: 11px; color: var(--muted); margin: 3px 0 0; }
.panel-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

.filter-area { padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fbfcfe; }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.filter-row.second { margin-top: 9px; }
.control {
  height: 30px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  outline: none;
  font-size: 12px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.10); }
.control::placeholder { color: #a5aebb; }
.control-select { min-width: 104px; padding-right: 20px; }
.control-select.narrow { min-width: 68px; }
.control-select.compact { min-width: 92px; }
.control-select.mini { min-width: 84px; height: 28px; }
#keywordInput { width: 128px; }
#nicknameInput { width: 150px; }
.remark-input { width: 150px; }
.date-control {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  padding: 0 8px;
}
.date-label { color: var(--text); font-size: 12px; white-space: nowrap; }
.date-control input { border: 0; outline: none; font-size: 11px; width: 108px; background: transparent; color: var(--text); }
.date-sep { color: var(--muted); font-size: 11px; }
.btn-search { min-width: 66px; }
.bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 2100px; font-size: 12px; }
.data-table thead th {
  background: #f7f9fc;
  color: #5a667a;
  font-weight: 600;
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.data-table th[data-sort] { cursor: pointer; user-select: none; }
.data-table th[data-sort]:hover { color: var(--primary); }
.data-table th.num, .data-table td.num { text-align: right; }
.sort-icon { font-size: 9px; color: #aeb6c3; margin-left: 2px; }
.sort-icon.active { color: var(--primary); }
.data-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid #f0f2f6;
  white-space: nowrap;
  color: #354154;
}
.data-table tbody tr:hover { background: #f8faff; }
.data-table tbody tr.deleted { opacity: .55; }
.data-table tfoot td {
  padding: 10px;
  border-top: 2px solid var(--border);
  background: #f7f9fc;
  color: #354154;
  white-space: nowrap;
  font-weight: 600;
}
.data-table tfoot td.sum-label { text-align: center; color: #5a667a; letter-spacing: 2px; }
.data-table tfoot td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--primary); }
.check-col { width: 34px; text-align: center; }
.action-col { min-width: 230px; }
.data-table td.cell-time { color: var(--muted); font-size: 11px; }
.data-table td.cell-error { max-width: 150px; overflow: hidden; text-overflow: ellipsis; color: #d14343; }
.data-table td.cell-error:not(:empty) { cursor: help; }
input[type="checkbox"] { accent-color: var(--primary); width: 14px; height: 14px; cursor: pointer; }
.account-cell { display: flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text); }
.account-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.account-dot.off { background: #aab3c2; }
.account-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-main { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.account-sub { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 400; color: var(--muted); }
.account-key { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 400; color: var(--muted); }
.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #eef2f7;
  color: #5c687a;
}
.tag.green { background: #e7f8ef; color: var(--green); }
.tag.orange { background: #fff3e0; color: #c77700; }
.tag.red { background: #fdecec; color: var(--red); }
.tag.blue { background: #e9f1ff; color: var(--primary); }
.tag.purple { background: #f1eafe; color: var(--purple); }
.tag.gray { background: #eef1f5; color: #7c8798; }
.status-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  color: #8a94a3;
  font-size: 11px;
  font-weight: 600;
}
.switch-track {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
  border-radius: 8px;
  background: #c6cdd7;
  transition: background .18s ease;
  flex-shrink: 0;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform .18s ease;
}
.status-switch.on { color: var(--green); }
.status-switch.on .switch-track { background: var(--green); }
.status-switch.on .switch-thumb { transform: translateX(14px); }
.status-switch.urgent.on { color: var(--orange); }
.status-switch.urgent.on .switch-track { background: var(--orange); }
.status-switch:hover .switch-track { filter: brightness(.95); }
.num-value { font-variant-numeric: tabular-nums; }
.num-positive { color: var(--primary); font-weight: 600; }
.num-warn { color: var(--orange); font-weight: 600; }
.row-actions { display: flex; gap: 4px; }
.link-btn {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
}
.link-btn:hover { background: #eef4ff; }
.link-btn.danger { color: var(--red); }
.link-btn.muted { color: var(--muted); }

/* 功能列下拉菜单 */
.func-menu { position: relative; display: inline-block; }
.func-trigger {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  padding: 3px 4px;
  white-space: nowrap;
  cursor: pointer;
}
.func-trigger:hover { background: #eef4ff; }
.func-trigger .caret { margin-left: 3px; font-size: 10px; }
.func-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  min-width: 112px;
  padding: 6px 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(30, 50, 90, .16);
}
.func-dropdown.hidden { display: none; }
.func-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: #445069;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.func-dropdown button:hover { background: #eef4ff; color: var(--primary); }
.func-dropdown button.danger { color: var(--red); }
.func-dropdown button.danger:hover { background: #fdecec; }
.channel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.channel-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.channel-option:has(input:checked) { border-color: var(--primary); background: #f0f6ff; color: var(--primary); }
.channel-option input { accent-color: var(--primary); }
.ch-section-title { font-size: 11px; font-weight: 600; color: #586477; margin: 14px 0 8px; }
.ch-amount-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.ch-amount-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); }
.ch-amount-item span { min-width: 58px; }
.ch-amount-item input { width: 100%; border: 1px solid var(--border-strong); border-radius: 5px; padding: 6px 8px; font-size: 12px; outline: none; }
.ch-amount-item input:focus { border-color: var(--primary); }
.ch-hint { font-size: 10px; color: var(--muted); line-height: 1.6; }
.ch-advanced { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 10px; }
.ch-advanced summary { font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; margin-bottom: 10px; }
.ch-paste-detail { margin-bottom: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--bg-soft, #f7f9fc); }
.ch-paste-detail summary, .ch-paste-title { font-size: 12px; font-weight: 600; color: var(--primary); cursor: pointer; }
.ch-paste-body { margin-top: 10px; }
.ch-paste-body textarea { width: 100%; min-height: 96px; resize: vertical; border: 1px solid var(--border-strong); border-radius: 5px; padding: 8px; outline: none; word-break: break-all; }
.ch-paste-body textarea:focus { border-color: var(--primary); }
.ch-paste-body .ch-hint { margin-top: 8px; }
.ch-mono, .rg-output { font-family: Consolas, Monaco, monospace !important; font-size: 11px !important; line-height: 1.6 !important; }
.rg-output { min-height: 220px; resize: vertical; word-break: break-all; }
/* 拉单测试：点击金额直接拉取收款码 */
.tt-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.tt-preset { border: 1px solid #d7dce5; background: #fff; color: var(--text); border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.tt-preset:hover, .tt-preset.on { border-color: var(--primary); color: var(--primary); background: #f2f6ff; }
.tt-actions { display: flex; justify-content: flex-start; margin-bottom: 10px; }
.tt-pay-result { display: grid; justify-items: center; gap: 8px; padding: 12px; border: 1px solid #e4e8f0; border-radius: 8px; background: #fafbfe; margin-bottom: 12px; }
.tt-pay-order { font-size: 12px; color: #586477; }
.tt-pay-order b { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tt-pay-img { width: 220px; height: 220px; object-fit: contain; background: #fff; border: 1px solid #e4e8f0; border-radius: 6px; }
.tt-pay-link { color: var(--primary); font-size: 12px; word-break: break-all; text-align: center; }
.tt-pay-empty { font-size: 12px; color: #8a93a4; text-align: center; }
.tt-pay-codes { width: 100%; font-size: 11px; color: #8a93a4; word-break: break-all; }
.btn-xs { padding: 5px 10px; font-size: 11px; line-height: 1.4; border-radius: 5px; }

/* ---------- 配置渠道：游戏账号充值档位（图2 卡片样式） ---------- */
.tier-box { margin-top: 2px; }
.tier-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tier-card {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 12px 12px 10px;
  background: linear-gradient(180deg, #2b3442 0%, #212936 100%);
  color: #fff;
  min-width: 0;
}
.tier-card-head { display: flex; align-items: center; gap: 4px; }
.tier-name {
  flex: 1; min-width: 0; border: 0; background: transparent; color: #fff;
  font-size: 15px; font-weight: 700; text-align: center; outline: none; padding: 2px 0;
}
.tier-name:focus { border-bottom: 1px solid #7aa5ff; }
.tier-name::placeholder { color: #9aa6b8; }
.tier-del {
  flex: 0 0 auto; border: 0; background: transparent; color: #9aa6b8;
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.tier-del:hover { color: #ff8080; }
.tier-range { text-align: center; font-size: 13px; font-weight: 600; color: #ffd08a; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.tier-amt-row { display: flex; align-items: center; gap: 6px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 8px; }
.tier-amt-row span { font-size: 10px; color: #9aa6b8; white-space: nowrap; }
.tier-amt {
  width: 100%; min-width: 0; border: 1px solid rgba(255,255,255,.2); border-radius: 5px;
  padding: 4px 6px; font-size: 12px; outline: none; background: rgba(255,255,255,.08); color: #fff;
}
.tier-amt:focus { border-color: #7aa5ff; }
.tier-amt::placeholder { color: #8d99ab; }
.tier-actions { display: flex; gap: 8px; margin-top: 10px; }
.tier-empty { border: 1px dashed var(--border-strong); border-radius: 7px; padding: 14px; text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) {
  .tier-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- 配置渠道：参考站风格分组通道卡片 ---------- */
/* 参考站「渠道配置」：白底卡片网格，紫色=开启，绿色测试按钮 */
.modal.channel-modal { width: 880px; max-width: calc(100vw - 32px); }
.channel-modal .modal-body { padding: 12px 16px 16px; }
.channel-main { margin-bottom: 4px; }
.channel-main-hint { margin-top: 8px; text-align: center; }
.tunnel-empty { border: 1px solid var(--border); background: var(--card); padding: 22px 12px; text-align: center; font-size: 12px; color: var(--muted); }
.channel-tools { border-top: 0; margin-top: 14px; padding-top: 10px; }
.channel-tools > summary { text-align: center; }
.tunnel-box { margin-top: 2px; }
.tunnel-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.tunnel-tab {
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); font-size: 12px; font-weight: 600; padding: 6px 16px; cursor: pointer;
}
.tunnel-tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.tunnel-panel.hidden { display: none; }
.tunnel-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; background: var(--border); padding: 1px; }
.tunnel-card {
  position: relative; cursor: pointer; border: 1px solid var(--border); border-radius: 2px;
  padding: 8px 8px 10px; background: var(--card); color: var(--text); min-width: 0;
  display: flex; flex-direction: column; transition: background .15s, color .15s;
}
.tunnel-card:hover { box-shadow: 0 0 0 2px rgba(90,80,200,.35); }
.tunnel-card.on { background: #5137a8; border-color: #5137a8; color: #fff; }
.tunnel-card-title { font-size: 12px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-bottom: 6px; border-bottom: 1px solid rgba(128,128,128,.25); }
.tunnel-card-id { font-size: 12px; font-weight: 600; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tunnel-card-range { font-size: 11px; opacity: .85; margin: 3px 0 8px; font-variant-numeric: tabular-nums; }
.tunnel-card .tunnel-test {
  margin-top: auto; align-self: flex-start; border: 0; border-radius: 3px; cursor: pointer;
  background: #22a85c; color: #fff; font-size: 11px; font-weight: 600; padding: 3px 12px;
}
.tunnel-card .tunnel-test:hover { background: #1b8e4d; }
.tunnel-actions { display: flex; gap: 8px; margin: 10px 0 2px; }
@media (max-width: 900px) { .tunnel-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tunnel-cards { grid-template-columns: 1fr 1fr; } }

.record-summary {
  display: flex;
  gap: 18px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: #f5f8fd;
  border-radius: 6px;
  font-size: 12px;
  color: var(--muted);
}
.record-summary b { color: var(--text); font-size: 14px; margin-left: 4px; }

.empty-state { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty-icon { font-size: 34px; color: #cbd3df; margin-bottom: 8px; }
.empty-state p { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 6px; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}
.page-buttons { display: flex; align-items: center; gap: 5px; }
.page-num {
  min-width: 26px;
  height: 26px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 5px;
  font-size: 11px;
}
.page-num.active { background: var(--primary); color: #fff; }
.page-ellipsis { padding: 0 2px; }

/* ---------- Modal / drawer / toast ---------- */
.modal-mask, .drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 29, 44, .38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 20px;
}
.modal {
  width: 560px;
  max-width: 100%;
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(20, 29, 44, .22);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-close { border: 0; background: transparent; font-size: 20px; color: var(--muted); line-height: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.account-form-modal { width: 620px; }
.account-form { padding: 2px 0; }
.account-form-row {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 15px;
}
.account-form-row > label {
  text-align: right;
  font-size: 12px;
  color: #4b5563;
  padding-top: 8px;
  line-height: 1.4;
}
.account-form-row .req { color: var(--red); margin-right: 3px; }
.account-form-row .af-control,
.account-form-row textarea {
  width: 100%;
  border: 1px solid #d9dee8;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.account-form-row textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
.account-form-row textarea.short { min-height: 92px; }
.account-form-row .af-control:focus,
.account-form-row textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,107,255,.09); }
.account-form-row .af-control.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(229,72,77,.08); }
.af-error { color: var(--red); font-size: 11px; margin-top: 4px; min-height: 14px; }
.radio-group { display: flex; align-items: center; gap: 22px; min-height: 34px; }
.radio-group label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text); cursor: pointer; }
.account-form-msg { color: var(--red); font-size: 11px; min-height: 16px; margin: -4px 0 8px 124px; }
.af-parse-btn {
  display: block;
  margin: 4px 0 0 auto;
  border: 0;
  background: #eaf1ff;
  color: var(--primary);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.af-parse-btn:hover { background: #dbe7ff; }
.af-parse-preview {
  margin-top: 8px;
  padding: 10px 12px;
  background: #f5f8fd;
  border: 1px solid #e3e9f4;
  border-radius: 6px;
}
.af-parse-preview.hidden { display: none; }
.af-parse-title { font-size: 11px; font-weight: 600; color: var(--primary); margin-bottom: 8px; }
.af-parse-channel { margin-top: 8px; padding: 6px 8px; background: #eaf5ee; border: 1px solid #cfe8d7; border-radius: 5px; color: #257a45; font-size: 10px; line-height: 1.5; }
.af-parse-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.af-parse-item { display: flex; gap: 6px; font-size: 10px; line-height: 1.5; min-width: 0; }
.af-parse-item span { color: var(--muted); flex-shrink: 0; }
.af-parse-item b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-meta { color: #8a94a6; font-size: 10px; font-weight: 400; cursor: pointer; text-decoration: underline dotted; }
.account-meta:hover { color: var(--primary); }
.meta-list { display: grid; gap: 8px; }
.meta-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; font-size: 12px; align-items: start; }
.meta-item span { color: var(--muted); }
.meta-item b { color: var(--text); font-weight: 500; word-break: break-all; }
.meta-raw-title { font-size: 12px; color: var(--text); margin: 20px 0 8px; }
.meta-raw {
  margin: 0;
  padding: 12px;
  background: #f6f8fb;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.6;
  color: #5c6675;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow: auto;
}

/* 充值订单 / 支付码 */
.paycode-list { display: grid; gap: 8px; }
.paycode-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 26px;
  gap: 8px;
  align-items: start;
  padding: 9px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  font-size: 12px;
}
.paycode-item span { color: #9a6a2f; font-weight: 600; }
.paycode-item b { color: #7c4a12; font-weight: 500; word-break: break-all; }
.paycode-copy {
  border: 1px solid #fed7aa;
  background: #fff;
  color: #b45309;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 3px 0;
}
.paycode-copy:hover { background: #ffedd5; }
.paycode-actions { margin-top: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 6px; color: #586477; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  outline: none;
  background: #fff;
  color: var(--text);
}
.form-field textarea { min-height: 64px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47,107,255,.09);
}
.modal-tip { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 0 0 14px; }
.auth-msg { min-height: 18px; margin-top: 8px; color: var(--red); font-size: 12px; }
.auth-msg:empty { display: none; }
.form-field textarea[readonly] { background: #f6f8fc; color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.drawer-mask { justify-content: flex-end; padding: 0; }
.drawer {
  width: 560px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  box-shadow: -8px 0 30px rgba(20, 29, 44, .14);
  display: flex;
  flex-direction: column;
}
.drawer-body { overflow: auto; padding: 16px 20px; flex: 1; }
.log-item { padding: 12px 0; border-bottom: 1px solid #f0f2f6; }
.log-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 12px; }
.log-time { color: var(--muted); font-size: 10px; font-weight: 400; }
.log-detail { color: #667286; font-size: 11px; margin-top: 5px; line-height: 1.5; }

.toast-root { position: fixed; right: 20px; top: 74px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  min-width: 220px;
  max-width: 360px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31,42,61,.12);
  padding: 10px 14px;
  font-size: 12px;
  animation: toastIn .18s ease-out;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--orange); }
@keyframes toastIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: translateX(0); } }

@media (max-width: 1400px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .product-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .panel-actions { justify-content: flex-start; }
  .topbar { padding: 0 14px; }
  .main { padding: 14px; }
  .sync-status { display: none; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .product-cards { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 26px 22px; }
}
