/* ============================================================
   清新浅色主题 — 白卡片 + 浅灰背景 + 品牌红克制点缀
   ============================================================ */
:root {
  /* 品牌色（克制使用） */
  --brand: #FF4655;
  --brand-dark: #E83A48;
  --brand-soft: #FFF1F2;

  /* 中性色 */
  --bg: #F6F8FB;
  --card: #FFFFFF;
  --card-2: #F8FAFC;
  --line: #EBEEF3;
  --text: #1F2937;
  --muted: #6B7280;
  --faint: #9CA3AF;

  /* 功能色 */
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #FF4655;
  --info: #3B82F6;

  /* 兼容旧语义变量 */
  --primary: var(--brand);
  --primary-dark: var(--brand-dark);
  --primary-soft: var(--brand-soft);
  --val-red: var(--brand);
  --val-red-dark: var(--brand-dark);
  --val-red-soft: var(--brand-soft);
  --val-cream: var(--text);
  --val-muted: var(--muted);
  --val-line: var(--line);
  --val-card: var(--card);
  --val-card-2: var(--card-2);
  --val-navy: var(--bg);
  --val-navy-2: var(--bg);
  --sidebar-bg: var(--card);
  --sidebar-active: var(--brand-soft);
  --border: var(--line);
  --text-muted: var(--muted);
  --radius: 10px;
  --shadow: 0 4px 16px rgba(17, 24, 39, .06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
}
::selection { background: var(--brand); color: #fff; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
button { font-family: inherit; cursor: pointer; }

/* 浅色滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D6DCE4; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ============================================================
   登录页
   ============================================================ */
.login-wrap {
  position: relative; height: 100vh; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #F7F9FC 0%, #EEF2F8 100%);
}
/* 柔和的红色光晕（不刺眼） */
.login-wrap::before {
  content: ""; position: absolute; top: -160px; right: -120px;
  width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 70, 85, .12), transparent 70%);
}
.login-deco {
  position: absolute; bottom: -180px; left: -120px;
  width: 440px; height: 440px; border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, .10), transparent 70%);
}
.login-card {
  position: relative; z-index: 2;
  width: 400px; background: var(--card);
  border: 1px solid var(--line); border-radius: 16px;
  padding: 42px 36px;
  box-shadow: 0 20px 50px rgba(17, 24, 39, .08);
}
.login-logo {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  margin-bottom: 8px; font-size: 21px; font-weight: 800; color: var(--text);
}
.brand-logo { width: 34px; height: auto; display: block; flex: 0 0 auto; }
.login-sub {
  text-align: center; color: var(--muted); margin-bottom: 28px;
  font-size: 12.5px; letter-spacing: 1px;
}

/* ============================================================
   表单
   ============================================================ */
.field { margin-bottom: 16px; }
.field label {
  display: block; margin-bottom: 7px; font-weight: 600;
  color: #374151; font-size: 13px;
}
.input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; outline: none;
  background: var(--card); color: var(--text);
  transition: border-color .15s, box-shadow .15s; font-family: inherit;
}
.input::placeholder, textarea::placeholder { color: var(--faint); }
.input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 70, 85, .12);
}
select option { background: var(--card); color: var(--text); }
textarea { resize: vertical; min-height: 70px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  padding: 9px 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  background: var(--card); color: var(--text);
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 6px 16px rgba(255, 70, 85, .28); }
.btn-ghost { border-color: var(--line); color: var(--text); background: var(--card); }
.btn-ghost:hover { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-dark); }
.btn-danger { background: var(--brand); color: #fff; }
.btn-danger:hover { background: var(--brand-dark); }
.btn-cyan { background: var(--brand); color: #fff; }
.btn-cyan:hover { background: var(--brand-dark); }
.btn-warn { background: var(--warning); color: #fff; }
.btn-warn:hover { background: #d9860a; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   布局
   ============================================================ */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; background: var(--card); color: var(--muted);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--line);
}
.sidebar-brand {
  padding: 22px 20px; font-size: 16px; font-weight: 800; color: var(--text);
  display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid var(--line);
}
.sidebar-brand .brand-logo { width: 30px; }
.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: 8px; color: var(--muted);
  cursor: pointer; margin-bottom: 3px; font-weight: 500;
  transition: all .15s; user-select: none;
}
.nav-item:hover { background: var(--card-2); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 700; }
.nav-ico { width: 18px; text-align: center; font-size: 15px; }
.sidebar-foot {
  padding: 14px 18px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--faint);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 700;
}
.content { padding: 26px; flex: 1; }

/* ============================================================
   卡片
   ============================================================ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 20px;
}
.card-title {
  font-size: 15px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title:first-child { position: relative; padding-left: 12px; }
.card-title:first-child::before {
  content: ""; position: absolute; left: 0; top: 3px; bottom: 3px;
  width: 4px; border-radius: 2px; background: var(--brand);
}

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 20px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px;
}
.stat-ico {
  width: 50px; height: 50px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.stat-num { font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12.5px; }

/* ============================================================
   表格
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; padding: 12px 14px; background: var(--card-2);
  color: #475569; font-size: 12.5px; font-weight: 700;
  white-space: nowrap; border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  font-size: 13.5px; vertical-align: middle; color: var(--text);
}
table.data tr:hover td { background: var(--card-2); }
table.data tr:last-child td { border-bottom: none; }

/* ============================================================
   徽章
   ============================================================ */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-10 { background: #FEF3C7; color: #92400E; }
.badge-20 { background: #DCFCE7; color: #166534; }
.badge-30 { background: var(--brand-soft); color: #B91C1C; }
.badge-gray { background: #F1F5F9; color: #475569; }
.badge-cyan { background: var(--brand-soft); color: var(--brand-dark); }
.badge-manual { background: #FFEDD5; color: #C2410C; }

/* ============================================================
   工具条
   ============================================================ */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input, .toolbar select { width: auto; min-width: 160px; }
.toolbar .spacer { flex: 1; }

/* ============================================================
   分页
   ============================================================ */
.pagination { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 16px; }
.pagination .btn { min-width: 38px; justify-content: center; }
.page-info { color: var(--muted); font-size: 13px; margin-right: 8px; }

/* ============================================================
   模态框
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; width: 600px; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(17, 24, 39, .18);
}
.modal.modal-lg { width: 820px; }
.modal.modal-sm { width: 440px; }

.connect-item { margin-bottom: 14px; }
.connect-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.connect-val { display: flex; gap: 8px; align-items: center; }
.connect-val .input { flex: 1; }

.nowrap { white-space: nowrap; }
.text-up { color: var(--success); font-weight: 700; }
.text-down { color: var(--brand); font-weight: 700; }
.modal-head {
  padding: 18px 22px; font-size: 15px; font-weight: 700;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-close {
  background: none; border: none; font-size: 22px;
  color: var(--muted); line-height: 1;
}
.modal-close:hover { color: var(--brand); }
.modal-body { padding: 22px; }
.modal-foot {
  padding: 16px 22px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ============================================================
   提示
   ============================================================ */
.alert { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.alert-danger { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }
.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 12px 18px; border-radius: 8px; background: #1F2937;
  color: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  min-width: 220px; font-size: 13.5px;
  animation: slidein .2s ease;
}
.toast.success { background: #15803D; }
.toast.error { background: #B91C1C; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* 日志时间线 */
.timeline { list-style: none; }
.timeline li {
  position: relative; padding: 0 0 18px 22px;
  border-left: 2px solid var(--line);
}
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 3px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand);
}
.timeline li.error::before { background: var(--danger); }
.timeline .tl-time { font-size: 12px; color: var(--muted); }
.timeline .tl-msg { font-size: 13.5px; margin-top: 2px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { font-size: 40px; margin-bottom: 10px; opacity: .6; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }
.qr-box {
  background: var(--card-2); border: 1px dashed var(--line);
  border-radius: 10px; padding: 16px; text-align: center; word-break: break-all;
}
.muted { color: var(--muted); }
.mt-2 { margin-top: 12px; }
.mb-2 { margin-bottom: 12px; }

/* ============================================================
   余额胶囊
   ============================================================ */
.balance-pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-weight: 700; white-space: nowrap;
}

/* 复选行 */
.check-line { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check-line input { width: 16px; height: 16px; accent-color: var(--brand); }

/* ============================================================
   雷蛇账号选择
   ============================================================ */
.razer-options { display: flex; flex-direction: column; gap: 10px; }
.razer-option {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.razer-option:hover { border-color: var(--brand); }
.razer-option.sel { border-color: var(--brand); background: var(--brand-soft); }
.razer-option.disabled { opacity: .5; cursor: not-allowed; }
.razer-option input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--brand); }
.razer-option-main { flex: 1 1 auto; min-width: 0; }
.razer-option-name { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.razer-option-balance { flex: 0 0 auto; }

/* ============================================================
   复制单元格
   ============================================================ */
.copy-cell { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.copy-btn {
  border: 1px solid var(--line); background: var(--card);
  color: var(--brand-dark); border-radius: 6px; padding: 1px 8px;
  font-size: 12px; line-height: 1.6; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.copy-btn:hover { background: var(--brand-soft); border-color: var(--brand); }
.small { font-size: 12px; }
table.data td .small { margin-top: 2px; }
.text-danger { color: var(--danger); }

/* ============================================================
   利润测算
   ============================================================ */
.profit-pos { color: var(--success); font-weight: 600; }
.profit-neg { color: var(--danger); font-weight: 600; }
.profit-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-top: 6px;
}
.profit-item {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 16px; text-align: center;
}
.profit-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.profit-value { font-size: 24px; font-weight: 700; color: var(--text); }
.profit-value.cost { color: var(--muted); font-weight: 600; }
@media (max-width: 900px) { .profit-grid { grid-template-columns: repeat(2, 1fr); } }
