/* ============================================================
   模拟炒股 · 公共样式（v3 · Binance 深色科技风）
   - 默认深色主题（#0b0e11 背景 / #181a20 卡片），币安黄 #f0b90b 点缀
   - 红涨绿跌保留（A 股惯例）；涨 #f6465d / 跌 #0ecb81（币安行情色）
   - 浅色主题：body.light 切换
   - 4/8px 间距系统、tabular 数字、150ms 微交互、焦点环可见
   ============================================================ */

:root {
  /* —— 币安深色（默认） —— */
  --bg: #0b0e11;
  --surface: #181a20;
  --surface-2: #1e2329;
  --surface-3: #242830;
  --border: #2b3139;
  --border-strong: #3e4650;

  --text: #eaecef;
  --text-2: #b7bdc6;
  --text-3: #848e9c;

  /* —— 行情色（红涨绿跌，币安色值） —— */
  --buy: #f6465d;
  --buy-deep: #d13a4e;
  --sell: #0ecb81;
  --sell-deep: #0bb571;
  --flat: #848e9c;

  /* —— 品牌 —— */
  --brand: #f0b90b;
  --brand-2: #ffd54a;
  --brand-deep: #d4a508;
  --brand-soft: rgba(240, 185, 11, 0.14);
  --accent: #3861fb;
  --accent-soft: rgba(56, 97, 251, 0.16);

  --text-invert: #0b0e11;

  /* —— 导航 —— */
  --nav-bg: #0b0e11;
  --nav-text: #848e9c;
  --nav-text-active: #eaecef;
  --nav-hover: rgba(255, 255, 255, 0.06);

  /* —— 阴影 / 圆角 —— */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.65);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --focus-ring: 0 0 0 3px rgba(240, 185, 11, 0.4);

  --header-h: 58px;
  --aside-w: 198px;
  --z-dropdown: 100;
  --z-modal: 200;
  --z-toast: 300;
  font-size: 14px;
}

/* ============================================================
   主题二：经典简约风（data-theme="classic" · 类同花顺浅色）
   ============================================================ */
[data-theme="classic"] {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --surface-3: #e9edf2;
  --border: #e0e5eb;
  --border-strong: #c2cbd5;

  --text: #1a2332;
  --text-2: #4d5b6b;
  --text-3: #8794a6;

  --buy: #e03131;
  --buy-deep: #c92a2a;
  --sell: #0ca678;
  --sell-deep: #099268;
  --flat: #868e96;

  --brand: #e03131;
  --brand-2: #ff6b6b;
  --brand-deep: #c92a2a;
  --brand-soft: rgba(224, 49, 49, 0.08);
  --accent: #1a73e8;
  --accent-soft: rgba(26, 115, 232, 0.1);

  --text-invert: #ffffff;

  --nav-bg: #1e3a5f;
  --nav-text: #b9c8de;
  --nav-text-active: #ffffff;
  --nav-hover: rgba(255, 255, 255, 0.08);

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 3px 10px rgba(16, 24, 40, 0.1);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, 0.16);
  --focus-ring: 0 0 0 3px rgba(26, 115, 232, 0.3);
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 10px;
}

/* ================= 基础重置 ================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
img, svg { display: inline-block; vertical-align: middle; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }
::selection { background: rgba(240, 185, 11, 0.3); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ================= 涨跌色 ================= */
.up   { color: var(--buy); }
.down { color: var(--sell); }
.flat { color: var(--flat); }
.bg-up   { background: var(--buy); }
.bg-down { background: var(--sell); }

/* ================= 布局骨架 ================= */
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.app-body { display: flex; flex: 1; min-height: 0; }
.main {
  flex: 1; min-width: 0; overflow-y: auto;
  padding: 16px; background: var(--bg);
}
.shell-max { max-width: 1560px; margin: 0 auto; }

/* ================= 顶部导航 ================= */
.topbar {
  height: var(--header-h);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px; color: var(--nav-text);
  flex-shrink: 0; position: relative; z-index: var(--z-dropdown);
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16.5px; color: var(--text); letter-spacing: 0.3px; user-select: none; }
.logo-badge {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #ffd54a, #f0b90b 55%, #d4a508);
  display: flex; align-items: center; justify-content: center;
  color: #14161a; font-size: 15px; font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 2px 8px rgba(240, 185, 11, 0.3);
}
.market-status {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px; font-size: 12px; color: var(--text-2);
}
.market-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sell); box-shadow: 0 0 0 3px rgba(14, 203, 129, 0.22); }
.market-status.closed .dot { background: var(--brand); box-shadow: 0 0 0 3px rgba(240, 185, 11, 0.22); }
.search-box { flex: 1; max-width: 380px; position: relative; }
.search-box input {
  width: 100%; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); padding: 0 14px 0 38px; font-size: 13px; outline: none; transition: all 0.15s;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input:hover { border-color: var(--border-strong); }
.search-box input:focus { border-color: var(--brand); background: var(--surface); box-shadow: var(--focus-ring); }
.search-box .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--nav-text); cursor: pointer;
  position: relative; transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn .badge {
  position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px;
  background: var(--buy); color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid var(--nav-bg);
}
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 5px;
  border-radius: 8px; cursor: pointer; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--text);
  transition: all 0.15s; font-size: 13px;
}
.user-chip:hover { border-color: var(--border-strong); }
.avatar {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #3861fb, #6a4ff0);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.avatar.amber { background: linear-gradient(135deg, #f0b90b, #d4a508); color: #14161a; }
.avatar.gray { background: linear-gradient(135deg, #5b6470, #3e4650); }

.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 190px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: var(--z-dropdown);
  display: none; animation: popIn 0.15s ease;
}
.dropdown.open { display: block; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.dropdown .dd-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text);
  transition: background 0.12s; border: none; background: none; width: 100%; text-align: left;
}
.dropdown .dd-item:hover { background: var(--surface-3); }
.dropdown .dd-item svg { color: var(--text-3); }
.dropdown .dd-item.danger, .dropdown .dd-item.danger svg { color: var(--buy); }
.dropdown .dd-divider { height: 1px; background: var(--border); margin: 5px 4px; }

/* ================= 左侧导航 ================= */
.aside {
  width: var(--aside-w); flex-shrink: 0; background: var(--nav-bg);
  border-right: 1px solid var(--border); overflow-y: auto; padding: 12px 10px;
}
.aside-user {
  padding: 4px 8px 14px; border-bottom: 1px solid var(--border); margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.aside-user .u-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.aside-user .u-asset { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.nav-group-title {
  font-size: 11px; color: var(--text-3); padding: 14px 10px 6px;
  letter-spacing: 1.2px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--nav-text); font-size: 13.5px; margin-bottom: 2px;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: all 0.13s; font-weight: 500;
}
.nav-item svg { flex-shrink: 0; color: var(--nav-text); transition: color 0.13s; }
.nav-item:hover { background: var(--nav-hover); color: var(--text); }
.nav-item:hover svg { color: var(--text-2); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-item.active svg { color: var(--brand); }

/* ================= 面板/卡片 ================= */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
}
.panel-head h3 { font-size: 14.5px; font-weight: 650; letter-spacing: 0.2px; }
.panel-head .sub { font-size: 12px; color: var(--text-3); }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 16px; }
.panel-body.pad-0 { padding: 0; }

/* ================= 表格 ================= */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; padding: 9px 12px; font-weight: 600; color: var(--text-3);
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  white-space: nowrap; font-size: 11.5px; letter-spacing: 0.4px; position: sticky; top: 0; z-index: 1;
}
.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl tbody tr { transition: background 0.1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr.row-click { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .th-num { text-align: right; }
.tbl .mono { font-variant-numeric: tabular-nums; }

/* ================= 标签/徽章 ================= */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 4px; font-size: 12px; font-weight: 500; line-height: 1.6;
}
.tag-buy    { background: rgba(246, 70, 93, 0.14); color: var(--buy); }
.tag-sell   { background: rgba(14, 203, 129, 0.14); color: var(--sell); }
.tag-brand  { background: var(--brand-soft); color: var(--brand); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-gray   { background: var(--surface-3); color: var(--text-2); }
.tag-warn   { background: rgba(240, 185, 11, 0.14); color: var(--brand); }
.tag-purple { background: rgba(122, 90, 248, 0.16); color: #9d7bff; }
.tag-ok     { background: rgba(14, 203, 129, 0.14); color: var(--sell); }

/* ================= 按钮 ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); padding: 8px 15px; border-radius: 6px;
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: all 0.15s; user-select: none;
}
.btn:hover { border-color: var(--text-3); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--text-invert); font-weight: 650; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-buy    { background: var(--buy); border-color: var(--buy); color: #fff; }
.btn-buy:hover { background: var(--buy-deep); border-color: var(--buy-deep); }
.btn-sell   { background: var(--sell); border-color: var(--sell); color: #0b0e11; font-weight: 650; }
.btn-sell:hover { background: var(--sell-deep); border-color: var(--sell-deep); }
.btn-ghost  { background: transparent; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 5px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-link {
  border: none; background: none; color: var(--accent); padding: 3px 4px;
  font-size: 12.5px; cursor: pointer; border-radius: 4px;
}
.btn-link:hover { text-decoration: underline; background: var(--accent-soft); }
.btn-link.danger { color: var(--buy); }
.btn-link.danger:hover { background: rgba(246, 70, 93, 0.12); }

/* ================= 表单 ================= */
.form-item { margin-bottom: 16px; }
.form-item > label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.form-item .required::after { content: " *"; color: var(--buy); }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--surface-2); color: var(--text);
  font-size: 13.5px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--focus-ring); background: var(--surface); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.form-row { display: flex; gap: 14px; }
.form-row .form-item { flex: 1; }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 12px; pointer-events: none; }
.form-help { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.6; }
.form-error { font-size: 12px; color: var(--buy); margin-top: 5px; }
.field-error { border-color: var(--buy) !important; }

/* ================= Tabs ================= */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 10px; background: var(--surface); }
.tab-item {
  padding: 12px 16px; cursor: pointer; font-size: 13.5px; color: var(--text-2);
  border: none; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all 0.15s; font-weight: 500;
}
.tab-item:hover { color: var(--text); }
.tab-item.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ================= 统计卡片 ================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; transition: border-color 0.15s, transform 0.15s;
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card .label { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat-card .label svg { color: var(--text-3); }
.stat-card .value { font-size: 21px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-card .value.sm { font-size: 17px; }
.stat-card .extra { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ================= 模态框 ================= */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.66);
  display: none; align-items: center; justify-content: center; z-index: var(--z-modal);
  backdrop-filter: blur(3px);
}
.modal-mask.open { display: flex; }
.modal {
  width: 470px; max-width: calc(100vw - 32px); max-height: calc(100vh - 56px);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn 0.18s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; flex: 1; font-weight: 650; }
.modal-close {
  border: none; background: none; font-size: 17px; color: var(--text-3); cursor: pointer;
  line-height: 1; width: 30px; height: 30px; border-radius: 6px; transition: all 0.13s;
}
.modal-close:hover { background: var(--surface-3); color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ================= Toast ================= */
.toast-wrap {
  position: fixed; top: calc(var(--header-h) + 12px); right: 16px; z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 11px 15px; min-width: 250px; max-width: 360px;
  box-shadow: var(--shadow-lg); font-size: 13px; display: flex; align-items: center; gap: 9px;
  animation: toastIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.toast svg { flex-shrink: 0; }
.toast.success { border-left-color: var(--sell); }
.toast.success svg { color: var(--sell); }
.toast.error { border-left-color: var(--buy); }
.toast.error svg { color: var(--buy); }
.toast.warn { border-left-color: var(--brand); }
.toast.warn svg { color: var(--brand); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ================= 分页 ================= */
.pager { display: flex; align-items: center; gap: 6px; padding: 13px 16px; justify-content: flex-end; }
.pager .pg-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border-strong);
  background: var(--surface-2); border-radius: 6px; font-size: 12.5px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.13s;
}
.pager .pg-btn:hover:not(:disabled) { color: var(--brand); border-color: var(--brand); }
.pager .pg-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager .pg-btn.active { background: var(--brand); border-color: var(--brand); color: var(--text-invert); font-weight: 700; }
.pager .pg-info { font-size: 12.5px; color: var(--text-3); margin-left: 8px; }

/* ================= 空状态 ================= */
.empty { text-align: center; padding: 52px 16px; color: var(--text-3); }
.empty svg { opacity: 0.5; margin-bottom: 12px; }
.empty p { font-size: 13px; }
.empty .empty-act { margin-top: 12px; }

/* ================= 工具类 ================= */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.muted { color: var(--text-3); }
.secondary { color: var(--text-2); }
.bold { font-weight: 600; }
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-16 { font-size: 16px; } .fs-20 { font-size: 20px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.tabular { font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  :root { --aside-w: 54px; }
  .nav-item span.txt, .nav-group-title { display: none; }
  .nav-item { justify-content: center; padding: 11px; }
}
