/* ========== 扫码支付卦象报告系统 - 管理端样式 ========== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  --primary: #6C5CE7;
  --primary-light: #EEEAFE;
  --primary-dark: #5849C4;
  --primary-gradient: linear-gradient(135deg, #6C5CE7, #8B7FF0);
  --success: #00B894;
  --success-light: #E8F8F5;
  --danger: #E74C3C;
  --danger-light: #FDEDEC;
  --warning: #F39C12;
  --warning-light: #FEF5E7;
  --bg: #F0F2F5;
  --white: #FFFFFF;
  --ink: #2D3436;
  --text-secondary: #636E72;
  --text-muted: #A5A8AE;
  --border: #DFE6E9;
  --border-light: #F0F2F5;
  --sidebar-bg: #1E1E2D;
  --sidebar-active: #6C5CE7;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
input, textarea, select, button { font-family: inherit; font-size: inherit; outline: none; border: none; }
button { cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

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

/* 侧边栏 */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar__logo-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-gradient);
  border-radius: 8px;
  font-size: 16px;
}

.sidebar__nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar__item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar__item.active {
  color: #fff;
  background: rgba(108,92,231,0.15);
  border-left-color: var(--primary);
}

.sidebar__item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
}

/* 主内容区 */
.main {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 顶部栏 */
.topbar {
  height: 60px;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar__title { font-size: 18px; font-weight: 700; color: var(--ink); }

.topbar__user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

/* 内容区 */
.content { flex: 1; padding: 20px 24px; }

/* ========== 卡片 ========== */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card__title { font-size: 16px; font-weight: 600; color: var(--ink); }

/* ========== 统计卡片 ========== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-card__icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon svg { width: 24px; height: 24px; }
.stat-card__icon--primary { background: var(--primary-light); color: var(--primary); }
.stat-card__icon--success { background: var(--success-light); color: var(--success); }
.stat-card__icon--danger { background: var(--danger-light); color: var(--danger); }
.stat-card__icon--warning { background: var(--warning-light); color: var(--warning); }

.stat-card__value { font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stat-card__label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ========== 表格 ========== */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-table { width: 100%; }

.data-table th {
  background: #FAFBFC;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--ink);
  border-bottom: 1px solid var(--border-light);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAFBFC; }

/* ========== 链接单元格 ========== */
.link-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 260px;
}

.link-cell__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
  min-width: 0;
}

/* ========== 表单 ========== */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 8px;
}

.form-label .required { color: var(--danger); }

.form-input, .form-textarea, .form-select {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--primary);
}

.form-textarea {
  height: auto;
  padding: 10px 14px;
  min-height: 80px;
  resize: vertical;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.form-radio-group { display: flex; gap: 20px; }

.form-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.form-radio input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--primary);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn--primary {
  background: var(--primary);
  color: #fff;
}
.btn--primary:hover { background: var(--primary-dark); }

.btn--outline {
  background: var(--white);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn--outline:hover { border-color: var(--primary); color: var(--primary); }

.btn--success { background: var(--success); color: #fff; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--warning { background: var(--warning); color: #fff; }

.btn--small { height: 32px; padding: 0 12px; font-size: 13px; }

.btn--text {
  background: none;
  color: var(--primary);
  padding: 0;
  height: auto;
}
.btn--text:hover { text-decoration: underline; }

.btn--danger-text { background: none; color: var(--danger); padding: 0; height: auto; }

/* ========== 标签 ========== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}
.tag--success { background: var(--success-light); color: var(--success); }
.tag--danger { background: var(--danger-light); color: var(--danger); }
.tag--warning { background: var(--warning-light); color: var(--warning); }
.tag--primary { background: var(--primary-light); color: var(--primary); }
.tag--muted { background: var(--border-light); color: var(--text-muted); }

/* ========== 筛选栏 ========== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar .form-input, .filter-bar .form-select {
  width: auto;
  min-width: 160px;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
}

.pagination__btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--white);
  cursor: pointer;
  transition: all 0.2s;
}

.pagination__btn:hover { border-color: var(--primary); color: var(--primary); }
.pagination__btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
  width: 420px;
  max-width: 90%;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  transform: scale(0.9);
  transition: transform 0.3s;
}
.modal-overlay.active .modal { transform: scale(1); }

.modal__icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal__icon--success { background: var(--success-light); color: var(--success); }
.modal__icon--warning { background: var(--warning-light); color: var(--warning); }
.modal__icon svg { width: 28px; height: 28px; }

.modal__title { font-size: 18px; font-weight: 600; text-align: center; margin-bottom: 8px; }
.modal__desc { font-size: 14px; color: var(--text-muted); text-align: center; margin-bottom: 24px; }
.modal__actions { display: flex; gap: 12px; }
.modal__actions .btn { flex: 1; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 1000;
  padding: 10px 24px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
}
.toast.active { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ========== 报告预览 ========== */
.report-preview {
  background: linear-gradient(135deg, #2D2B55, #1E1E2D);
  border-radius: var(--radius-md);
  padding: 32px;
  color: #E0DCFF;
  line-height: 2;
  position: relative;
  overflow: hidden;
}

.report-preview::before {
  content: '☰';
  position: absolute;
  top: -10px;
  right: 20px;
  font-size: 120px;
  opacity: 0.05;
  color: #fff;
}

.report-preview__time {
  text-align: center;
  font-size: 13px;
  color: #A5A0E0;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.report-preview__gua {
  text-align: center;
  font-size: 48px;
  margin-bottom: 8px;
  color: #FFD700;
}

.report-preview__name {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: #FFD700;
  margin-bottom: 20px;
}

.report-preview__section { margin-bottom: 16px; }
.report-preview__label { font-size: 13px; color: #A5A0E0; margin-bottom: 4px; }
.report-preview__text { font-size: 14px; color: #E0DCFF; }

/* ========== 二维码弹窗 ========== */
.qr-modal {
  width: 360px;
  max-width: 90%;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  text-align: center;
}

.qr-modal__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.qr-modal__code {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.qr-modal__amount {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.qr-modal__canvas-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  padding: 16px;
  background: #FAFBFC;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.qr-modal__canvas-wrap canvas,
.qr-modal__canvas-wrap img {
  display: block;
}

.qr-modal__tip {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.qr-modal__link-section {
  margin-bottom: 20px;
}

.qr-modal__link-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.qr-modal__link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.qr-modal__link-input {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  outline: none;
}

.qr-modal__link-input:focus {
  border-color: var(--primary);
}

.qr-modal__actions {
  display: flex;
  gap: 12px;
}

.qr-modal__actions .btn {
  flex: 1;
}

/* ========== 空状态 ========== */
.empty-row td {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ========== 工具类 ========== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-md { margin-top: 12px; }
.mb-md { margin-bottom: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== 财务管理 ========== */

/* 财务概览卡片 */
.finance-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.finance-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.finance-card__label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.finance-card__value {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.finance-card__sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.finance-card__trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-left: 8px;
}

.finance-card__trend--up {
  background: var(--success-light);
  color: var(--success);
}

.finance-card__trend--down {
  background: var(--danger-light);
  color: var(--danger);
}

.finance-card__trend svg {
  width: 12px;
  height: 12px;
}

/* 图表区域 */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

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

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-canvas-wrap canvas {
  width: 100%;
  height: 100%;
}

/* 图表 tooltip */
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.15s;
}

.chart-tooltip.active {
  opacity: 1;
}

/* 渠道统计 */
.channel-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.channel-item {
  display: flex;
  align-items: center;
  gap: 16px;
}

.channel-item__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.channel-item__icon--wechat {
  background: #E8F5E9;
  color: #09BB07;
}

.channel-item__icon--alipay {
  background: #E3F2FD;
  color: #1677FF;
}

.channel-item__icon svg {
  width: 22px;
  height: 22px;
}

.channel-item__body {
  flex: 1;
  min-width: 0;
}

.channel-item__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}

.channel-item__bar {
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.channel-item__bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.channel-item__bar-fill--wechat {
  background: #09BB07;
}

.channel-item__bar-fill--alipay {
  background: #1677FF;
}

.channel-item__stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.channel-item__revenue {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.channel-item__percent {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== 设置页面 ========== */

.settings-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.settings-profile {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.settings-profile__avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  margin: 0 auto 16px;
}

.settings-profile__name {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.settings-profile__role {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.settings-profile__info {
  text-align: left;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.settings-profile__info-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
}

.settings-profile__info-label {
  color: var(--text-muted);
}

.settings-profile__info-value {
  color: var(--ink);
  font-weight: 500;
}

.settings-form {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.settings-form__section {
  margin-bottom: 32px;
}

.settings-form__section:last-child {
  margin-bottom: 0;
}

.settings-form__section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.settings-form__section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  margin-top: 4px;
}

.settings-form .form-group {
  margin-bottom: 18px;
}

.settings-form .form-input {
  max-width: 360px;
}

.settings-form__actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* 响应式 */
@media (max-width: 1200px) {
  .finance-overview-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .chart-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .finance-overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-form .form-input {
    max-width: 100%;
  }
}
