:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e6e9f2;
  --text: #1f2430;
  --muted: #7a8194;
  --primary: #4f6ef7;
  --primary-2: #6a5cff;
  --primary-soft: #eef1ff;
  --success: #22b07d;
  --success-soft: #e6f8f1;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warning: #e8a23d;
  --warning-soft: #fdf3e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --sidebar-w: 250px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: .85; }

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

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #1c2340 0%, #151b33 100%);
  color: #c7cde3;
  padding: 20px 14px;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  flex-shrink: 0;
}

.brand {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  padding: 6px 12px 18px;
  letter-spacing: .3px;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #6b7391;
  margin: 14px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  color: #c7cde3;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active {
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(79, 110, 247, .35);
}
.nav-item .ico { width: 18px; text-align: center; }

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 60px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-title { font-size: 17px; font-weight: 700; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.topbar-user .uname { color: var(--text); font-weight: 600; }

.content { padding: 24px; max-width: 1100px; width: 100%; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card h3 { font-size: 15px; margin-bottom: 14px; }
.card h3 .sub { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 8px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* 统计卡片 */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.stat .label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 700; }
.stat .value.green { color: var(--success); }
.stat .value.red { color: var(--danger); }
.stat .value.blue { color: var(--primary); }

/* 行 */
.row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.row:last-child { border-bottom: none; }
.row .label { font-weight: 500; }
.row .hint { color: var(--muted); font-size: 12px; }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  background: var(--primary);
  color: #fff;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: #f5f6fa; }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-outline { background: var(--primary-soft); color: var(--primary); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #d3d7e3; border-radius: 26px; transition: .2s;
}
.slider:before {
  content: ""; position: absolute; height: 20px; width: 20px;
  left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* 表单 */
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  transition: border .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-sm { width: 130px; }
.field { display: flex; align-items: center; gap: 8px; }
.field label { color: var(--muted); font-size: 13px; }

/* 徽章 */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-gray { background: #eef0f5; color: var(--muted); }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfe; }

/* 提示 */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: #1f2430; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: all .25s; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* 空状态 */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* 认证页 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1c2340 0%, #3b2f63 55%, #4f6ef7 100%); padding: 20px; }
.auth-card { background: #fff; border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); padding: 36px; width: 400px; max-width: 100%; }
.auth-card .logo { text-align: center; font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; font-size: 13px; }
.auth-card .input { margin-bottom: 14px; }
.auth-card .btn { width: 100%; padding: 11px; }

/* 标签页 */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab { padding: 9px 16px; color: var(--muted); font-weight: 600; border-radius: 9px 9px 0 0; cursor: pointer; }
.tab.active { color: var(--primary); border-bottom: 2px solid var(--primary); }

/* 号码格子 */
.num-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.num-cell {
  padding: 12px 4px; text-align: center; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; cursor: pointer;
  font-weight: 700; font-size: 15px; transition: all .12s; user-select: none;
}
.num-cell:hover { border-color: var(--primary); }
.num-cell.on { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(79,110,247,.3); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(15, 19, 35, .5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-card { background: #fff; border-radius: 16px; padding: 26px; width: 390px; max-width: 100%; box-shadow: 0 24px 64px rgba(0,0,0,.35); }
.modal-card h3 { margin-bottom: 16px; }
.modal-card .input { margin-bottom: 10px; }
.modal-card .btn { margin-bottom: 8px; }
.modal-hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; }

/* 总览：四大区块 */
.dash-block .kv { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; }
.dash-block .kv .k { color: var(--muted); font-size: 12px; width: 44px; flex-shrink: 0; }
.dash-block .kv .v { font-size: 20px; font-weight: 700; }
.dash-block .kv .pct { font-size: 13px; font-weight: 600; }
.pct.pos { color: var(--success); }
.pct.neg { color: var(--danger); }
.pct.zero { color: var(--muted); }

/* 余额走势图 */
.chart-meta { display: flex; gap: 18px; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.chart-meta b { color: var(--text); font-weight: 700; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 4px; }

/* 投注记录 */
.rec { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.rec:last-child { margin-bottom: 0; }
.rec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rec-time { color: var(--muted); font-size: 13px; }
.rec-issue { font-weight: 700; font-size: 14px; }
.rec-bets { font-size: 14px; line-height: 1.6; word-break: break-all; }
.rec-strategy { font-weight: 600; color: var(--primary); }
.rec-foot { display: flex; align-items: center; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.rec-result { font-weight: 700; color: var(--text); }
.rec-balance { font-weight: 600; }

/* 账号群组管理：搜索 + 投注窗口 */
.badge-purple { background: #f0ecff; color: #7c5cf0; }
.search-row { display: flex; gap: 8px; margin-bottom: 4px; }
.search-box { flex: 1; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; background: #fff; }
.search-ico { color: var(--muted); font-size: 15px; }
.search-input { flex: 1; border: none; outline: none; padding: 10px 0; font-size: 14px; background: transparent; }
.win-section-title { margin-top: 18px; font-size: 13px; font-weight: 700; color: var(--muted); }
.win-item { display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.win-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #eef1f8; flex-shrink: 0; }
.win-info { flex: 1; min-width: 0; }
.win-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.win-sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.win-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* 余额查询货币选择 */
.currency-box { border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; cursor: pointer; transition: all .12s; background: #fff; }
.currency-box:hover { border-color: var(--primary); }
.currency-box.selected { border-color: var(--primary); background: var(--primary-soft); }
.currency-box .c-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.currency-box .c-val { font-size: 20px; font-weight: 700; color: var(--primary); }
.currency-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { width: 64px; padding: 16px 8px; }
  .sidebar .brand, .sidebar .nav-item span, .sidebar .nav-group-title { display: none; }
  .sidebar .nav-item { justify-content: center; }
  .main { margin-left: 64px; }
}
