/* ============================================================
   抖音任务管理系统 - 样式表
   ============================================================ */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --primary-line: #c7d2fe;

  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-line: #fecaca;

  --success: #16a34a;
  --success-soft: #f0fdf4;
  --success-line: #bbf7d0;

  --warn: #d97706;
  --warn-soft: #fffbeb;

  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --line: #e5e7eb;
  --line-2: #eef0f4;
  --bg: #f5f6fa;
  --card: #ffffff;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.07), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 18px 44px rgba(16, 24, 40, 0.13), 0 4px 10px rgba(16, 24, 40, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

button { font-family: inherit; }

/* ---------------- 演示模式横幅 ---------------- */
.demo-banner {
  position: relative;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 9px 40px 9px 16px;
  background: linear-gradient(90deg, #fff7ed, #fef3c7);
  border-bottom: 1px solid #fcd34d;
  color: #92400e;
  font-size: 12.5px;
  text-align: center;
}
.demo-banner strong { font-weight: 700; }
.demo-banner b { font-weight: 700; }

/* 断网 / 演示模式：醒目红，提醒「数据没进库」 */
.demo-banner.is-alert {
  background: linear-gradient(90deg, #fef2f2, #fee2e2);
  border-bottom-color: #fca5a5;
  color: #991b1b;
}
/* 云端恢复 */
.demo-banner.is-recovered {
  background: linear-gradient(90deg, #ecfdf5, #d1fae5);
  border-bottom-color: #6ee7b7;
  color: #065f46;
}

.demo-retry {
  flex: none;
  padding: 4px 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.demo-retry:hover { background: #fff; }
.demo-close {
  position: absolute;
  right: 8px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border: none;
  background: transparent;
  color: #92400e;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.demo-close:hover { background: rgba(146, 64, 14, 0.1); }
body.has-demo-banner .auth-wrap { min-height: calc(100vh - 38px); }

/* ---------------- 轻提示 ---------------- */
.toast-wrap {
  position: fixed;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 180px;
  max-width: min(92vw, 460px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #1f2937;
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.22);
  animation: toastIn 0.22s ease-out;
  word-break: break-word;
}
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
.toast.out { animation: toastOut 0.2s ease-in forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px) scale(0.97); }
}

/* ---------------- 登录 / 注册 ---------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background:
    radial-gradient(900px 500px at 12% -10%, #e0e7ff 0%, rgba(224, 231, 255, 0) 62%),
    radial-gradient(760px 460px at 92% 108%, #dbeafe 0%, rgba(219, 234, 254, 0) 60%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 30px 28px 26px;
}

.auth-head { text-align: center; margin-bottom: 20px; }
.logo {
  width: 52px; height: 52px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  background: linear-gradient(140deg, #6366f1, #4f46e5 55%, #7c3aed);
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.32);
}
.logo-sm {
  width: 34px; height: 34px;
  margin: 0;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.28);
}
.auth-head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.auth-head .sub {
  margin: 5px 0 0;
  color: var(--text-3);
  font-size: 12.5px;
}

.auth-foot {
  margin-top: 18px;
  color: var(--text-3);
  font-size: 12px;
}

/* 分段控件 */
.seg {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: #f3f4f6;
  border-radius: 11px;
  margin-bottom: 20px;
}
.seg-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* 表单 */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}
.req { color: var(--danger); font-style: normal; }
.hint { font-size: 11.5px; color: var(--text-3); }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
  appearance: none;
  -webkit-appearance: none;
}
textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}
input[type="date"] { min-height: 41px; }
select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.13);
}
input:disabled, input[readonly], select:disabled, textarea:disabled {
  background: #f9fafb;
  color: var(--text-2);
  cursor: not-allowed;
}
input::placeholder, textarea::placeholder { color: #b6bcc7; }
input.invalid, select.invalid, textarea.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 58px; }
.pw-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}
.pw-toggle:hover { color: var(--primary); background: var(--primary-soft); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(140deg, #5b52ea, var(--primary) 60%, #4338ca);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.26);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.34);
  filter: brightness(1.04);
}
.btn-block { width: 100%; padding: 11px 18px; font-size: 14.5px; }
.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) {
  border-color: #d1d5db;
  color: var(--text);
  background: #f9fafb;
}
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-danger {
  background: var(--danger-soft);
  border-color: var(--danger-line);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #fee2e2; }
.btn-success {
  background: var(--success-soft);
  border-color: var(--success-line);
  color: var(--success);
}
.btn-success:hover:not(:disabled) { background: #dcfce7; }

/* ---------------- 应用外壳 ---------------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.user-chip:hover {
  border-color: var(--primary-line);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.09);
}
.user-chip:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}
.avatar {
  width: 28px; height: 28px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(140deg, #818cf8, #4f46e5);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-name {
  font-size: 12.5px;
  font-weight: 600;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role { font-size: 10.5px; color: var(--text-3); }

/* 顶部导航 */
.tabs {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
}
.tab {
  position: relative;
  padding: 9px 14px 11px;
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: color 0.16s ease;
}
.tab:hover { color: var(--primary); background: var(--primary-soft); }
.tab.active { color: var(--primary); }
.tab.active::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 0;
  height: 2.5px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 56px;
}

/* ---------------- 卡片 / 区块 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .dot {
  width: 4px; height: 16px;
  border-radius: 2px;
  background: var(--primary);
}
.section-desc { margin: 4px 0 0; color: var(--text-3); font-size: 12.5px; }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

/* 表单内并排两列 */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-row input { min-width: 0; }
@media (max-width: 400px) {
  .field-row { grid-template-columns: 1fr; }
}

/* 纵向堆叠布局（表单在上，表格整行宽） */
.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.form-narrow { max-width: 860px; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.form-actions .btn { min-width: 150px; }

/* ---------------- 统计卡片 ---------------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
}
.stat.is-danger::before { background: var(--danger); }
.stat.is-success::before { background: var(--success); }
.stat.is-warn::before { background: var(--warn); }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.stat-value.danger { color: var(--danger); }
.stat-value.success { color: var(--success); }

/* ---------------- 表格 ---------------- */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafbfc;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-2);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fcfcfd; }
tbody tr.row-pending { background: #fffafa; }
tbody tr.row-pending:hover { background: #fff5f5; }
tbody tr.row-refunded { background: #f8fdf9; }
tbody tr.row-refunded:hover { background: #f1fbf4; }

.cell-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text-2);
}
.cell-nowrap { white-space: nowrap; }
/* 提交内容是较长的分享文案，单行截断，hover 看全文 */
.cell-clamp {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.cell-sub { display: block; font-size: 11.5px; color: var(--text-3); }
.cell-strong { font-weight: 600; }
.link {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}
.link:hover { text-decoration: underline; }

/* 状态标签：红=未返款，绿=已返款 */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-line);
}
.pill-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-line);
}

/* 空状态 / 加载 */
.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}
.empty svg { color: #d1d5db; margin-bottom: 10px; }
.loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.spinner {
  width: 20px; height: 20px;
  margin: 0 auto 10px;
  border: 2.5px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 筛选栏 */
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 16px 12px;
  background: #fbfcfd;
  border-radius: var(--radius) var(--radius) 0 0;
}
.filters .field { gap: 5px; }
.filters .label { font-size: 12px; }
/* 搜索框占两列，其余筛选一列 */
.field-wide { grid-column: span 2; }

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 14px;
  background: #fbfcfd;
  border-top: 1px solid var(--line-2);
  border-radius: 0 0 var(--radius) var(--radius);
  flex-wrap: wrap;
}
.filter-summary { font-size: 12.5px; color: var(--text-3); }
.filter-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.legend { display: flex; gap: 8px; align-items: center; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
  flex-wrap: wrap;
}
.pager-info { color: var(--text-3); font-size: 12.5px; }
.pager-btns { display: flex; gap: 8px; align-items: center; }
.pager-page {
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}

/* 我的记录小表 */
.mini-table { min-width: 820px; }
.mini-table .cell-actions .btn {
  padding: 4px 6px;
  min-width: 28px;
  font-size: 12px;
}
.mini-table .cell-actions .btn + .btn { margin-left: 4px; }
.mini-table thead th,
.mini-table tbody td { padding-left: 10px; padding-right: 10px; }
.mini-table .cell-clamp { max-width: 320px; }

/* 管理后台表格：固定列宽，永不出横向滚动条 */
.admin-table {
  table-layout: fixed;
  width: 100%;
}
.admin-table th,
.admin-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
}
.admin-table th { font-size: 11.5px; }
.admin-table .cell-clamp { max-width: 100%; }
.admin-table .seg-toggle { margin: 0; }
.admin-table .btn-sm { padding: 5px 8px; }
.admin-table .cell-actions .btn {
  padding: 4px 5px;
  min-width: 24px;
  font-size: 12px;
}
.admin-table .cell-actions .btn + .btn { margin-left: 4px; }

/* ---------------- 是 / 否 分段按钮 ---------------- */
.seg-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  vertical-align: middle;
}
.seg-item {
  min-width: 30px;
  padding: 4px 7px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.seg-item + .seg-item { border-left: 1px solid var(--line); }
.seg-item:hover:not(:disabled):not(.active) { background: #f3f4f6; color: var(--text-2); }
.seg-item.is-yes.active { background: var(--success); color: #fff; }
.seg-item.is-no.active { background: var(--danger); color: #fff; }
.seg-item:disabled { opacity: 0.55; cursor: wait; }

/* 浅色主按钮 */
.btn-soft {
  background: var(--primary-soft);
  border-color: var(--primary-line);
  color: var(--primary);
}
.btn-soft:hover:not(:disabled) { background: #e0e7ff; }

/* ---------------- 弹窗 ---------------- */
body.modal-open { overflow: hidden; }

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.16s ease;
}
.modal-in .modal-mask { opacity: 1; }

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.modal-in .modal-panel { opacity: 1; transform: none; }
.modal-wide { max-width: 720px; }

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line-2);
}
.modal-title { margin: 0; font-size: 16px; font-weight: 700; }
.modal-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--text-3); }
.modal-x {
  flex: none;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 22px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
}
.modal-x:hover { background: #f3f4f6; color: var(--text); }
.modal-body { padding: 18px 20px 22px; }

/* 带底部操作栏的弹窗（编辑记录） */
.modal-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  background: #fff;
  border-top: 1px solid var(--line-2);
}
.modal-foot .btn { min-width: 96px; }
.modal-body .form { gap: 14px; }

/* 只读展示框 */
.readonly-box {
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #f9fafb;
  color: var(--text-2);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

/* 设置分区 */
.psec { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.psec:first-child { padding-top: 0; }
.psec:last-child { border-bottom: none; padding-bottom: 0; }
.psec-title { margin: 0 0 12px; font-size: 13.5px; font-weight: 700; color: var(--text); }
.psec-note { font-weight: 400; font-size: 12px; color: var(--text-3); margin-left: 6px; }
.psec .field-row { margin-bottom: 10px; }
.psec-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* 收款码上传卡片 */
.qr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fcfcfd; }
.qr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.qr-label {
  width: auto;
  padding: 4px 26px 4px 8px;
  font-size: 12.5px;
  border-radius: 7px;
  background-position: right 6px center;
}
.qr-del {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
}
.qr-del:hover { background: var(--danger-soft); }
.qr-empty-tag { font-size: 11.5px; color: var(--text-3); }

.qr-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.qr-box:hover { border-color: var(--primary-line); background: #fafaff; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; }
.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 12px;
}
.qr-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.72);
}
.qr-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--line);
  border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
}

/* 管理员查看收款码 */
.qr-view-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.qr-view { margin: 0; text-align: center; }
.qr-view img {
  width: 100%;
  max-width: 300px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}
.qr-view figcaption { margin-top: 8px; }
.qr-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

/* ---------------- 手机卡片视图 ---------------- */
.record-cards { display: none; }

.rc {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.rc-pending { border-left-color: var(--danger); }
.rc-paid { border-left-color: var(--success); }

.rc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.rc-date {
  font-size: 12.5px;
  color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding-top: 2px;
}
.rc-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.rc-pills .pill { font-size: 11.5px; padding: 2px 8px; }

.rc-user {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line-2);
}
.rc-name { font-size: 14px; font-weight: 700; }
.rc-wx {
  font-size: 12px;
  color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.rc-row { display: flex; gap: 10px; font-size: 13px; align-items: baseline; }
.rc-label { flex: none; width: 66px; color: var(--text-3); font-size: 12px; }
.rc-value { flex: 1; min-width: 0; word-break: break-word; }
.rc-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.rc-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.rc-row-block { flex-direction: column; gap: 4px; }
.rc-row-block .rc-label { width: auto; }
.rc-row-block .rc-value { width: 100%; line-height: 1.55; }
.rc-link { display: block; white-space: normal; word-break: break-word; }

.rc-flags {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--line-2);
}
.rc-flag { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rc-flag .rc-label { width: auto; font-size: 12.5px; color: var(--text-2); }

.rc-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 9px;
  border-top: 1px dashed var(--line-2);
}

/* 窄屏切换成卡片，表格整块隐藏 */
@media (max-width: 820px) {
  .records-table { display: none; }
  .record-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .auth-card { padding: 24px 20px 22px; border-radius: 16px; }
  .auth-head h1 { font-size: 18px; }
  .topbar-inner { padding: 9px 14px; }
  .topbar-title { display: none; }
  .tabs { padding: 0 14px; }
  .main { padding: 16px 14px 48px; }
  .card-pad { padding: 16px; }
  .stat-row { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 5 张卡时最后一张独占一行，避免落单 */
  .stat-row .stat:last-child { grid-column: span 2; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 20px; }
  .filters { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .field-wide { grid-column: span 1; }
  .filter-bar { padding: 10px 14px 14px; }
  .filter-btns { width: 100%; }
  .filter-btns .btn { flex: 1; }
  .user-chip { padding: 3px 8px 3px 3px; }
  .user-meta { display: none; }
  .section-title { font-size: 15px; }
  .toast-wrap { top: 12px; }
  .modal-root { padding: 12px 10px; align-items: flex-end; }
  .modal-panel { max-height: calc(100vh - 24px); border-radius: 16px 16px 12px 12px; }
  .modal-body { padding: 16px 16px 20px; }
  .qr-grid { grid-template-columns: 1fr; }
  .qr-view-grid { grid-template-columns: 1fr; }
  .legend { display: none; }
  .form-actions { justify-content: stretch; }
  .form-actions .btn { flex: 1; min-width: 0; }
}

@media print {
  .topbar, .filters, .pager, .filter-actions, .btn { display: none !important; }
  body { background: #fff; }
  .table-wrap { border: none; }
}
