/* ============================================================
   星澜复盘工作台 · 金融极简主题
   A股配色约定：红涨、绿跌；暗色为默认
   ============================================================ */

:root {
  --font: "PingFang SC","Hiragino Sans GB","Microsoft YaHei","Source Han Sans SC","Noto Sans CJK SC",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  --mono: "SF Mono","JetBrains Mono",Menlo,Consolas,"Roboto Mono",monospace;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --side-w: 226px;
  --rail-w: 288px;
  --shadow: 0 8px 28px rgba(0,0,0,.22);
  --t-fast: .14s ease;
  --t-slow: .24s ease;
}

/* ---------- 暗色（默认） ---------- */
:root[data-theme="dark"], :root {
  color-scheme: dark;
  --bg0: #070d18;
  --bg1: #0b1526;
  --panel: #0e1a2e;
  --panel2: #13233c;
  --panel3: #1a2e4e;
  --input-bg: #0b1526;
  --line: #1d3152;
  --line2: #2b456d;
  --text: #e9eff7;
  --muted: #93a7c0;
  --faint: #61758f;
  --accent: #4f8dff;
  --accent-2: #6fa4ff;
  --accent-soft: rgba(79,141,255,.13);
  --accent-line: rgba(79,141,255,.38);
  --up: #ff5257;
  --up-bg: rgba(255,82,87,.10);
  --down: #18c98a;
  --down-bg: rgba(24,201,138,.10);
  --flat: #a9b8c9;
  --warn: #ffb020;
  --warn-bg: rgba(255,176,32,.12);
  --danger: #ff6b62;
  --ok: #18c98a;
  --shadow: 0 10px 30px rgba(0,0,0,.34);
  --sidebar-bg: linear-gradient(180deg,#0a1322 0%,#0d1b31 100%);
  --rail-bg: #0b172a;
}

/* ---------- 亮色 ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg0: #e9eef6;
  --bg1: #f2f5fa;
  --panel: #ffffff;
  --panel2: #f6f8fc;
  --panel3: #eef2f8;
  --input-bg: #ffffff;
  --line: #dde5ef;
  --line2: #c9d6e6;
  --text: #1a2535;
  --muted: #5e7189;
  --faint: #8b9cb2;
  --accent: #2d6de0;
  --accent-2: #5a8ff2;
  --accent-soft: rgba(45,109,224,.09);
  --accent-line: rgba(45,109,224,.35);
  --up: #d93a41;
  --up-bg: rgba(217,58,65,.07);
  --down: #0a9f6c;
  --down-bg: rgba(10,159,108,.07);
  --flat: #7b8da3;
  --warn: #cf8418;
  --warn-bg: rgba(207,132,24,.10);
  --danger: #d6453f;
  --ok: #0a9f6c;
  --shadow: 0 8px 24px rgba(28,44,68,.10);
  --sidebar-bg: linear-gradient(180deg,#f7f9fc 0%,#eef3fa 100%);
  --rail-bg: #f0f4fa;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  background: var(--bg0);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
svg { display: block; }
::selection { background: rgba(79,141,255,.3); }

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
*::-webkit-scrollbar-track { background: transparent; }

.noscript { padding: 40px; text-align: center; }

/* ============ 应用骨架 ============ */
.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0,1fr) var(--rail-w);
  height: 100vh;
  overflow: hidden;
  background: var(--bg0);
}
.app-shell.rail-hidden { grid-template-columns: var(--side-w) minmax(0,1fr); }
.rail-float {
  position: fixed; right: 16px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 44px; border-radius: 10px;
  border: 1px solid var(--line2); background: var(--panel);
  color: var(--muted); cursor: pointer; z-index: 90;
  display: none; align-items: center; justify-content: center; padding: 0;
  box-shadow: var(--shadow);
}
.rail-float svg { width: 15px; height:15px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.rail-float:hover { color: var(--accent); border-color: var(--accent-line); }
.app-shell.rail-hidden + .rail-float { display: inline-flex; }

/* ---------- 侧边导航 ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  padding: 16px 12px 12px;
  user-select: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 16px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg,#2f6fe4,#1d4ea8);
  box-shadow: 0 6px 16px rgba(47,111,228,.35);
  flex: 0 0 auto;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.18; }
.brand-text b { font-size: 16px; letter-spacing: 1px; }
.brand-text i { font-style: normal; font-size: 9px; letter-spacing: 2px; color: var(--faint); font-weight: 600; }

.side-nav { flex: 1; overflow-y: auto; margin: 2px -2px; padding-right: 2px; }
.side-nav::-webkit-scrollbar { width: 5px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  margin: 2px 0;
  border-radius: var(--radius-s);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.nav-item svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  flex: 0 0 auto;
  opacity: .85;
}
.nav-item:hover { background: var(--accent-soft); color: var(--text); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(79,141,255,.28), rgba(79,141,255,.08));
  border-left-color: var(--accent);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; }

.side-foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 9px; }
.theme-switch-card {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted);
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s);
  cursor: pointer; transition: border-color var(--t-fast), background var(--t-fast);
}
.theme-switch-card:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.switch {
  position: relative; width: 34px; height: 19px; border-radius: 20px;
  background: var(--panel3); border: 1px solid var(--line2); transition: background var(--t-fast);
  display: inline-block; flex: 0 0 auto;
}
.switch i {
  position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); transition: transform var(--t-fast);
}
:root[data-theme="light"] .switch i { transform: translateX(15px); }

.user-mini { display: flex; align-items: center; gap: 9px; padding: 5px 7px; border-radius: var(--radius-s); }
.user-mini:hover { background: var(--accent-soft); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg,#385f9e,#274c86); color:#fff; font-size: 13px; font-weight: 700;
  flex: 0 0 auto;
}
.um { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.um b { font-size: 13px; color: var(--text); }
.um i { font-style: normal; font-size: 10px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 主区与顶栏 ---------- */
.main-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg0); }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 13px 20px 11px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg0) 88%, transparent);
  backdrop-filter: blur(10px);
  position: relative; z-index: 20;
}
.page-head h1 { margin: 0; font-size: 18px; letter-spacing: .3px; line-height: 1.3; }
.page-head p { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); }
.page-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-head > div { min-width: 0; }
.menu-btn { display: none; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.global-search {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 9px; padding: 0 10px; height: 34px;
  width: min(300px, 26vw);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.global-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.global-search svg { width: 14px; height: 14px; fill:none; stroke: var(--muted); stroke-width: 1.8; flex: 0 0 auto; }
.global-search input {
  border: 0; outline: 0; background: transparent; color: var(--text); width: 100%; font: inherit; font-size: 12.5px;
}
.global-search input::placeholder { color: var(--faint); }

.view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 20px 28px; min-height: 0; scroll-behavior: smooth; }
.loading-view { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 45vh; color: var(--muted); }
.spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line2); border-top-color: var(--accent);
  animation: sp .8s linear infinite; display: inline-block;
}
@keyframes sp { to { transform: rotate(360deg); } }
.app-foot {
  display: flex; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line); padding: 7px 20px;
  font-size: 11px; color: var(--faint); background: var(--bg0);
}

/* ---------- 右侧快捷面板 ---------- */
.rail { min-width: 0; background: var(--rail-bg); border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; }
.rail-inner { display: flex; flex-direction: column; min-height: 100%; }
.rail-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px; color: var(--faint); font-size: 11px; letter-spacing: 2px; font-weight: 600;
  position: sticky; top: 0; z-index: 5;
}
.widgets { padding: 0 10px 16px; display: flex; flex-direction: column; gap: 10px; }
.widget { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.widget-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px 7px; cursor: pointer; user-select: none;
}
.widget-head h3 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text); display:flex; align-items:center; gap:6px; }
.widget-head h3 .wdot { width:6px; height:6px; border-radius:50%; background: var(--accent); display:inline-block; }
.widget-head .chev { width: 14px; height:14px; fill:none; stroke: var(--faint); stroke-width: 2; transition: transform var(--t-fast); }
.widget.collapsed .chev { transform: rotate(-90deg); }
.widget-body { padding: 4px 12px 11px; }
.widget.collapsed .widget-body { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  padding: 7px 13px; border-radius: 8px; font-size: 13px; cursor: pointer;
  transition: all var(--t-fast); white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.btn:hover { border-color: var(--accent-line); color: var(--accent-2); background: var(--accent-soft); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; box-shadow: 0 5px 14px rgba(79,141,255,.3); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 7%, var(--panel)); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, var(--panel)); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  cursor: pointer; transition: all var(--t-fast); padding: 0;
}
.icon-btn svg { width: 16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.icon-btn:hover { color: var(--accent-2); border-color: var(--accent-line); background: var(--accent-soft); }
.icon-btn-sm { width: 25px; height: 25px; border-radius: 7px; border: 0; background: transparent; }
.icon-btn-sm svg { width: 13px; height: 13px; }
#top-theme-btn .icon-moon { display: none; }
:root[data-theme="light"] #top-theme-btn .icon-sun { display: none; }
:root[data-theme="light"] #top-theme-btn .icon-moon { display: block; }

/* ============ 卡片 / 区块 ============ */
.section-stack { display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-l); overflow: hidden;
}
.card.collapsed .card-body { display: none; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; min-height: 42px;
  border-bottom: 1px solid var(--line);
}
.card.collapsed .card-head { border-bottom: 0; }
.card-head h2, .card-head h3 { margin: 0; font-size: 13.5px; font-weight: 700; letter-spacing: .4px; display:flex; align-items:center; gap:8px; }
.card-head h2::before { content:""; width: 3px; height: 13px; border-radius: 3px; background: var(--accent); display:inline-block; }
.card-sub { font-size: 11px; color: var(--faint); font-weight: 400; margin-left: 2px; }
.card-tools { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.card-tools .btn { font-size: 11.5px; }
.collapse-btn {
  border: 0; background: transparent; color: var(--faint); width: 24px; height:24px; border-radius:6px; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; padding:0; margin-left:auto;
}
.collapse-btn svg { width: 14px; height:14px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; transition: transform var(--t-fast); }
.card.collapsed .collapse-btn svg { transform: rotate(-90deg); }
.collapse-btn:hover { background: var(--accent-soft); color: var(--accent); }
.card-body { padding: 13px 14px 14px; }
.card-head + .card-body { border-top: 1px solid transparent; }

.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 11px 13px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.kpi:hover { border-color: var(--accent-line); }
.kpi .k-label { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; align-items:center; gap:6px; }
.kpi .k-label .k-ico { width:13px; height:13px; fill:none; stroke: var(--faint); stroke-width:1.7; }
.kpi .k-value { font-size: 21px; font-weight: 700; letter-spacing: -.2px; line-height: 1.1; font-family: var(--mono); }
.kpi .k-sub { font-size: 11px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.kpi-accent { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); background: linear-gradient(150deg, var(--accent-soft), transparent 70%); }
.kpi.mini { padding: 9px 11px; }
.kpi.mini .k-value { font-size: 16px; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.warn { color: var(--warn); }
.ok { color: var(--ok); }
.danger { color: var(--danger); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.tnum { font-variant-numeric: tabular-nums; }
.up-bg { background: var(--up-bg); }
.down-bg { background: var(--down-bg); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.cols-65-35 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.cols-35-65 { display: grid; grid-template-columns: 1fr 1.55fr; gap: 14px; align-items: start; }
@media (max-width: 1500px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cols-65-35, .cols-35-65 { grid-template-columns: 1fr; }
}

.empty {
  padding: 24px 12px; text-align: center; color: var(--faint); font-size: 13px;
}
.empty svg { width: 30px; height:30px; margin: 0 auto 8px; fill:none; stroke: var(--line2); stroke-width:1.2; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-s); }
table.table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 620px; }
.table th {
  text-align: left; padding: 7px 10px; font-size: 11px; font-weight: 600; color: var(--faint);
  border-bottom: 1px solid var(--line); white-space: nowrap; letter-spacing: .3px;
  background: color-mix(in srgb, var(--panel) 70%, var(--panel2));
}
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td {
  padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  white-space: nowrap; vertical-align: middle; font-variant-numeric: tabular-nums;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--accent-soft); }
.table .code { font-family: var(--mono); font-size: 12px; color: var(--accent-2); cursor: pointer; }
.table .row-actions { display: inline-flex; gap: 3px; opacity: .1; transition: opacity var(--t-fast); }
.table tr:hover .row-actions { opacity: 1; }
.row-actions button {
  border: 0; background: transparent; color: var(--faint); width: 24px; height:24px; border-radius:5px; cursor:pointer;
  display:inline-flex; align-items:center; justify-content:center; padding:0;
}
.row-actions button svg { width: 13px; height:13px; fill:none; stroke: currentColor; stroke-width:1.8; }
.row-actions button:hover { background: var(--accent-soft); color: var(--accent); }
.row-actions button.del:hover { color: var(--danger); background: var(--danger-bg, var(--up-bg)); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; line-height: 1.5;
  background: var(--panel3); color: var(--muted); white-space: nowrap;
}
.badge.b-up { background: var(--up-bg); color: var(--up); }
.badge.b-down { background: var(--down-bg); color: var(--down); }
.badge.b-accent { background: var(--accent-soft); color: var(--accent-2); }
.badge.b-warn { background: var(--warn-bg); color: var(--warn); }
.badge.b-ok { background: var(--down-bg); color: var(--down); }
.tag {
  display:inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px;
  background: var(--accent-soft); color: var(--accent-2); margin: 0 4px 3px 0;
}
.tag.t2 { background: var(--warn-bg); color: var(--warn); }
.tag.t3 { background: var(--down-bg); color: var(--down); }
.tag.t4 { background: var(--up-bg); color: var(--up); }

/* ---------- 表单 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.form-item { display: flex; flex-direction: column; gap: 4px; }
.form-item.wide { grid-column: 1 / -1; }
.form-item label { font-size: 11px; color: var(--muted); font-weight: 600; }
.form-item .required::after { content:" *"; color: var(--danger); }
.input, .select, .textarea {
  border: 1px solid var(--line); background: var(--input-bg); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px;
  width: 100%; outline: none; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
.textarea.lg { min-height: 170px; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 28px; cursor: pointer; }
.checkbox-row { display:flex; align-items:center; gap:7px; cursor:pointer; font-size:12.5px; }
.checkbox-row input { accent-color: var(--accent); width: 15px; height:15px; cursor:pointer; }
.form-row { display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap; }
.form-actions { display:flex; gap:8px; align-items:center; }
.form-hint { font-size: 11px; color: var(--faint); line-height: 1.5; }
.field-error { color: var(--danger); font-size: 11px; }

.filter-bar {
  display: flex; align-items:center; gap: 8px; flex-wrap: wrap;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 8px 10px; margin-bottom: 12px;
}
.filter-bar .input { width: auto; }
.filter-bar .f-label { font-size: 11px; color: var(--faint); }
.seg { display: inline-flex; background: var(--panel3); border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px;
  padding: 4px 11px; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.seg button.active { background: var(--accent); color:#fff; font-weight:600; }
.seg button:not(.active):hover { color: var(--text); }

/* ---------- 涨跌 / 图表 ---------- */
.chart-box { position: relative; width: 100%; }
.chart-box svg { width: 100%; height: auto; display: block; }
.chart-box .chart-note { position:absolute; right:8px; top:4px; font-size:10.5px; color:var(--faint); }
.chart-legend { display:flex; gap:14px; flex-wrap:wrap; font-size:11px; color:var(--muted); margin-top:6px; }
.chart-legend i { display:inline-block; width:9px; height:9px; border-radius:2px; margin-right:4px; vertical-align:-1px; }
.mini-stats { display:grid; grid-template-columns: 1fr 1fr; gap:7px; }
.mini-stat { background: var(--panel2); border:1px solid var(--line); border-radius:9px; padding:7px 9px; }
.mini-stat b { font-size:15px; display:block; font-family:var(--mono); }
.mini-stat span { font-size:10.5px; color:var(--faint); }

.list-line { display:flex; justify-content:space-between; gap:10px; padding:6px 0; border-bottom:1px dashed var(--line); font-size:12.5px; align-items:center; }
.list-line:last-child { border-bottom:0; }
.list-line .ll-main { min-width:0; }
.list-line .ll-name { font-weight:600; color:var(--text); }
.list-line .ll-sub { color:var(--faint); font-size:11px; }
.list-line .ll-val { text-align:right; flex:0 0 auto; font-family:var(--mono); font-weight:600; }

.theme-chip {
  border:1px solid var(--line); border-radius:10px; padding:9px 11px; background: var(--panel2);
}
.theme-chip .tc-head { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.theme-chip .tc-name { font-weight:700; font-size:13px; }
.theme-chip .tc-sub { color:var(--faint); font-size:11px; margin-top:2px; }

.ladder-item { display:flex; gap:10px; align-items:stretch; }
.ladder-step { flex:1; background:var(--panel2); border:1px solid var(--line); border-radius:9px; padding:7px 9px; }
.ladder-step .ls-h { font-size:11px; color:var(--faint); }
.ladder-step .ls-v { font-family:var(--mono); font-weight:700; font-size:16px; line-height:1.2; }
.ladder-step .ls-stocks { font-size:10.5px; color:var(--muted); margin-top:3px; line-height:1.4; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }

.progress { height:6px; background: var(--panel3); border-radius:5px; overflow:hidden; }
.progress i { display:block; height:100%; border-radius:5px; background: var(--accent); }
.progress.p-up i { background: var(--up); }
.progress.p-down i { background: var(--down); }
.progress.p-warn i { background: var(--warn); }
.pbar-row { display:flex; align-items:center; gap:8px; font-size:11px; margin:5px 0; }
.pbar-row .pb-l { width:76px; color:var(--muted); flex:0 0 auto; overflow:hidden; text-overflow:ellipsis; }
.pbar-row .progress { flex:1; }
.pbar-row .pb-v { width:48px; text-align:right; font-family:var(--mono); flex:0 0 auto; }

/* ---------- 日报 / 文本 ---------- */
.report-paper {
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 12px 14px; white-space: pre-wrap; font-size: 13px; line-height: 1.8;
  max-height: 260px; overflow-y:auto; color: var(--text);
}
.muted-box {
  background: var(--panel2); border:1px dashed var(--line2); border-radius:10px; padding:10px 12px;
  font-size:12px; color:var(--muted); line-height:1.7;
}

/* ---------- 笔记 / 卡片列表 ---------- */
.note-card { padding: 0; display:flex; flex-direction:column; }
.note-card .nc-body { padding: 10px 14px 12px; flex:1; display:flex; flex-direction:column; gap:7px; min-width:0; }
.note-card .nc-title { font-size:14px; font-weight:700; cursor:pointer; line-height:1.4; }
.note-card .nc-title:hover { color: var(--accent-2); }
.note-card .nc-meta { font-size:11px; color:var(--faint); display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.note-card .nc-text {
  font-size:12.5px; color:var(--muted); line-height:1.7; overflow:hidden;
  display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical; white-space:pre-wrap;
}
.note-card .nc-foot { display:flex; align-items:center; justify-content:space-between; border-top:1px solid var(--line); padding:7px 12px; background:var(--panel2); }
.pinned { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.preview-box { border:1px solid var(--line); border-radius:8px; padding:10px 12px; background:var(--panel2); font-size:13px; line-height:1.8; overflow-wrap:break-word; }
.preview-box h4 { margin:.5em 0; font-size:14px; }
.preview-box ul, .preview-box ol { padding-left:20px; margin:.3em 0; }
.preview-box code { background:var(--panel3); padding:1px 5px; border-radius:4px; font-family:var(--mono); font-size:12px; }
.preview-box blockquote { margin:6px 0; padding:4px 10px; border-left:3px solid var(--accent); color:var(--muted); background:var(--accent-soft); border-radius:0 6px 6px 0; }
.preview-box b, .preview-box strong { color: var(--text); }

/* ---------- 交易模式卡 ---------- */
.pattern-card { display:flex; flex-direction:column; }
.pattern-card .pc-head { display:flex; align-items:flex-start; gap:10px; padding:12px 13px 4px; }
.pattern-card .pc-icon {
  width: 34px; height:34px; border-radius:9px; display:inline-flex; align-items:center; justify-content:center;
  color: var(--accent-2); background: var(--accent-soft); font-size:16px; font-weight:800; flex:0 0 auto; font-family:var(--mono);
}
.pattern-card .pc-name { font-weight:700; font-size:14px; }
.pattern-card .pc-type { font-size:11px; color:var(--faint); margin-top:1px; }
.pattern-card .pc-body { padding:6px 13px 12px; flex:1; display:flex; flex-direction:column; gap:7px; }
.pattern-card .pc-item { font-size:12px; color:var(--muted); display:flex; gap:6px; }
.pattern-card .pc-item b { color:var(--text); font-weight:600; white-space:nowrap; }
.pattern-card .pc-foot { border-top:1px solid var(--line); padding:8px 12px; background:var(--panel2); display:flex; justify-content:space-between; align-items:center; }
.pc-stat { font-size:11px; color:var(--faint); }
.pc-stat b { color:var(--accent-2); font-family:var(--mono); }

/* ---------- 风控 ---------- */
.rule-item { display:flex; gap:10px; align-items:flex-start; padding:9px 11px; border:1px solid var(--line); border-radius:10px; background:var(--panel2); }
.rule-item .ri-ico { width:28px; height:28px; flex:0 0 auto; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; background:var(--accent-soft); color:var(--accent-2); }
.rule-item .ri-ico svg { width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2; }
.rule-item.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-bg); }
.rule-item.breach { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); background: var(--up-bg); }
.rule-item h4 { margin:0 0 2px; font-size:13px; }
.rule-item p { margin:0; font-size:11.5px; color:var(--muted); line-height:1.5; }
.gauge-wrap { position:relative; width:132px; margin:0 auto; }
.gauge-txt { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.gauge-txt b { font-size:27px; font-family:var(--mono); line-height:1; }
.gauge-txt span { font-size:11px; color:var(--faint); margin-top:3px; }

/* ---------- 清单 ---------- */
.check-list { list-style:none; margin:0; padding:0; }
.check-list li { display:flex; gap:9px; align-items:flex-start; padding:7px 2px; border-bottom:1px dashed var(--line); }
.check-list li:last-child { border-bottom:0; }
.check-list input[type=checkbox] { margin-top:3px; accent-color: var(--accent); width:15px;height:15px; flex:0 0 auto; cursor:pointer; }
.check-list .ck-label { font-size:13px; cursor:pointer; line-height:1.5; }
.check-list li.done .ck-label { color: var(--faint); text-decoration: line-through; }
.check-list .ck-del { margin-left:auto; }

/* ---------- 计划表 ---------- */
.plan-row { display:grid; grid-template-columns: 66px minmax(80px,1fr) 110px 110px 110px 32px; gap:7px; align-items:center; padding:6px 2px; border-bottom:1px dashed var(--line); }
.plan-head { display:grid; grid-template-columns: 66px minmax(80px,1fr) 110px 110px 110px 32px; gap:7px; font-size:11px; color:var(--faint); font-weight:600; padding:4px 2px 6px; }
.plan-row input[type=date], .plan-row .input { padding:5px 8px; font-size:12px; }
.plan-row .status { justify-self:center; }

/* ---------- 搜索 ---------- */
.result-group { margin-bottom:8px; }
.result-group > h3 { font-size:12px; color:var(--faint); letter-spacing:1.5px; margin:10px 0 6px; display:flex; align-items:center; gap:8px; }
.result-group > h3::after { content:""; height:1px; background:var(--line); flex:1; }
.result-item { display:flex; gap:10px; padding:8px 9px; border-bottom:1px dashed var(--line); font-size:12.5px; align-items:flex-start; }
.result-item:hover { background:var(--accent-soft); }
.result-item .ri-type { color:var(--accent-2); font-weight:700; flex:0 0 auto; font-size:11px; }
.result-item b { font-weight:600; }
.result-item .snip { color:var(--muted); }
mark { background: rgba(255,176,32,.35); color: inherit; border-radius: 2px; padding:0 1px; }

/* ---------- 工具 ---------- */
.tool-card .tool-head { display:flex; gap:11px; align-items:center; padding:12px 14px 0; }
.tool-num {
  width:32px; height:32px; border-radius:9px; flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center;
  font-weight:800; font-family:var(--mono); color:#fff; background:linear-gradient(135deg,#3f7ce6,#2454b1); font-size:14px;
}
.tool-card h3 { margin:0; font-size:14px; }
.tool-card .tool-sub { font-size:11.5px; color:var(--faint); margin-top:1px; }
.result-panel { background:var(--panel2); border:1px solid var(--line2); border-radius:10px; padding:10px 12px; display:flex; flex-direction:column; gap:5px; }
.result-panel .rp-line { display:flex; justify-content:space-between; font-size:12.5px; }
.result-panel .rp-line b { font-family:var(--mono); font-weight:700; }

/* ---------- 导入 / 文本区 ---------- */
.import-area { font-family: var(--mono); font-size: 12px; }
.import-sample {
  font-family:var(--mono); font-size:10.8px; line-height:1.7; white-space:pre; overflow-x:auto;
  background:var(--bg1); border:1px solid var(--line); border-radius:8px; padding:9px 11px; color:var(--muted);
}

/* ---------- 个人中心 ---------- */
.profile-hero { display:flex; gap:14px; align-items:center; padding:16px; background:linear-gradient(135deg, var(--accent-soft), transparent 80%); border-radius:var(--radius-l); }
.profile-hero .avatar-lg {
  width:58px; height:58px; border-radius:16px; display:inline-flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,#3f7ce6,#2653ab); color:#fff; font-size:23px; font-weight:800; flex:0 0 auto;
}
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 300;
  display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none;
}
.toast {
  display:flex; align-items:center; gap:10px;
  background: var(--panel2); border:1px solid var(--line2); color:var(--text);
  border-radius: 11px; padding: 9px 12px; font-size: 12.5px;
  box-shadow: var(--shadow); pointer-events:auto;
  animation: toast-in .2s ease;
  max-width: min(520px, 90vw);
}
.toast.out { animation: toast-out .2s ease forwards; }
.toast svg { width:15px; height:15px; flex:0 0 auto; fill:none; stroke:var(--ok); stroke-width:2; }
.toast.err svg { stroke: var(--danger); }
.toast .toast-btn { border:0; background:var(--accent-soft); color:var(--accent-2); border-radius:6px; font-size:12px; font-weight:700; padding:3px 8px; cursor:pointer; }
.toast .toast-close { border:0; background:transparent; color:var(--faint); cursor:pointer; font-size:15px; line-height:1; padding:2px; }
@keyframes toast-in { from { opacity:0; transform: translateY(8px);} }
@keyframes toast-out { to { opacity:0; transform: translateY(8px);} }

/* 折叠面板骨架 */
.module-collapse { cursor:pointer; }

/* ---------- 响应式 ---------- */
@media (max-width: 1660px) {
  :root { --rail-w: 258px; }
  .global-search { width: 220px; }
}
@media (max-width: 1460px) {
  :root { --side-w: 208px; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 1300px) {
  .app-shell { grid-template-columns: var(--side-w) minmax(0,1fr); }
  .rail { display: none; }
  .app-shell.rail-hidden { grid-template-columns: var(--side-w) minmax(0,1fr); }
}
@media (max-width: 980px) {
  :root { --side-w: 62px; }
  .brand-text, .nav-item span, .theme-switch-card, .user-mini .um { display:none; }
  .brand { justify-content:center; padding-left:0; padding-right:0; }
  .nav-item { justify-content:center; }
  .nav-item.active { border-left:0; border-radius:9px; }
  .side-foot { align-items:center; }
  .theme-switch-card { padding:6px; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .global-search { width:100%; }
  .view { padding: 12px; }
}

/* ---------- 手机（iPhone 竖屏为主） ---------- */
@media (max-width: 760px) {
  .app-shell { display: block; height: 100vh; overflow: hidden; }
  .main-col { height: 100vh; width: 100%; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 400;
    width: min(78vw, 292px); transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 12px 0 34px rgba(0,0,0,.32);
    border-right: 1px solid var(--line);
  }
  .sidebar.open { transform: none; }
  .sidebar .brand-text, .sidebar .nav-item span, .sidebar .user-mini .um { display: flex; }
  .sidebar .theme-switch-card { display: flex; }
  .brand-text { display: flex; flex-direction: column; }
  .user-mini .um { flex-direction: column; }
  .side-foot .theme-switch-card { justify-content: space-between; width: 100%; }
  .menu-btn { display: inline-flex; flex: 0 0 auto; }
  .topbar { padding: 10px 12px; }
  .top-actions { gap: 6px; }
  .global-search { width: 100%; }
  .view { padding: 10px 10px 20px; }
  .app-foot { flex-direction: column; gap: 2px; padding: 6px 12px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .kpi { padding: 9px 10px; }
  .kpi .k-value { font-size: 18px; }
  .grid-2, .grid-3, .grid-4, .cols-65-35, .cols-35-65 { grid-template-columns: 1fr; gap: 10px; }
  .card { border-radius: 12px; }
  .card-body { padding: 10px; }
  .card-head { padding: 9px 11px; }
  .card-tools .btn { padding: 4px 8px; font-size: 11px; }
  .table { font-size: 11.5px; min-width: 560px; }
  .table th, .table td { padding: 6px 7px; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar .input { width: 100% !important; }
  .filter-bar .select { width: 100% !important; }
  .form-row { align-items: stretch; }
  .form-row .btn, .form-row .input { width: 100%; }
  .section-stack { gap: 10px; }
  .toast-wrap { left: 10px; right: 10px; transform: none; align-items: stretch; }
  .toast { max-width: none; }
  .ladder-item { flex-wrap: wrap; }
  .profile-hero { flex-direction: column; text-align: center; }
  .profile-hero .avatar-lg { margin: 0 auto; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .theme-chip .tc-head { align-items: flex-start; flex-direction: column; }
}

/* 无障碍焦点 */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.view:focus { outline: none; }

/* 打印不适用 */ 
@media print { .sidebar, .rail, .topbar, .app-foot { display:none; } .app-shell { display:block; overflow:visible; height:auto; } .card { break-inside: avoid; } }
