/* ===== SmartStock 智选股 · Apple Light 设计系统 v2 ===== */
:root {
  --bg: #f5f5f7;            /* Apple 签名浅灰页面底 */
  --bg-soft: #fbfbfd;       /* 侧栏/输入框底 */
  --panel: #ffffff;         /* 纯白卡片 */
  --panel-2: #f5f5f7;       /* 次级面 */
  --border: #e8e8ed;        /* 发丝线 */
  --border-soft: #eeeff2;
  --text: #1d1d1f;          /* Apple 主文字 */
  --text-dim: #6e6e73;      /* 次级文字 */
  --text-faint: #86868b;    /* 三级文字 */
  --accent: #0071e3;        /* Apple 蓝 */
  --accent-deep: #0066cc;
  --accent-soft: rgba(0,113,227,.10);
  --up: #ff3b30;            /* A股：红涨（Apple System Red） */
  --up-soft: rgba(255,59,48,.10);
  --down: #1fa25a;          /* 绿跌（白底可读绿） */
  --down-soft: rgba(31,162,90,.12);
  --warn: #ff9500;          /* Apple Orange */
  --warn-soft: rgba(255,149,0,.12);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.03), 0 8px 28px rgba(0,0,0,.05);
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased; letter-spacing: -0.01em;
}
::selection { background: rgba(0,113,227,.18); }
a { color: inherit; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex-shrink: 0; background: var(--bg-soft);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 11px; padding: 24px 20px 18px; text-decoration: none; cursor: pointer; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; letter-spacing: -.5px;
  box-shadow: 0 4px 12px rgba(0,113,227,.28);
}
.logo-text b { display: block; font-size: 15px; letter-spacing: -.01em; color: var(--text); font-weight: 700; }
.logo-text span { font-size: 11px; color: var(--text-faint); }
.nav { padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 9px;
  color: var(--text-dim); text-decoration: none; font-size: 13.5px; transition: all .15s; font-weight: 500;
  cursor: pointer;
}
.nav a .ico { width: 18px; text-align: center; opacity: .75; }
.nav a:hover { color: var(--text); background: rgba(0,0,0,.04); }
.nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.nav a.active .ico { opacity: 1; }
.sidebar-foot { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-faint); line-height: 1.9; }
.sidebar-foot b { color: var(--text-dim); font-weight: 600; }
.main { flex: 1; min-width: 0; padding: 28px 36px 48px; }
.page { max-width: 1360px; margin: 0 auto; animation: fadein .3s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ---------- 通用组件 ---------- */
.card { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-soft); }
.card-title { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.card-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.card-sub { font-size: 12px; color: var(--text-faint); font-weight: 400; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3,1fr); }
.g4 { grid-template-columns: repeat(4,1fr); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2,1fr); } .g2,.g3 { grid-template-columns: 1fr; } }

/* 指数卡 */
.idx-card { padding: 18px 20px; position: relative; overflow: hidden; }
.idx-card .name { font-size: 13px; color: var(--text-dim); margin-bottom: 9px; display: flex; justify-content: space-between; font-weight: 500; }
.idx-card .close { font-size: 26px; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; }
.idx-card .pct { font-size: 13px; font-family: var(--mono); margin-top: 3px; font-weight: 600; }
.idx-spark { position: absolute; right: 0; bottom: 0; left: 0; height: 34px; opacity: .8; }

/* 徽章 / 分数（iOS 淡色胶囊） */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 980px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.tag.up { color: var(--up); background: var(--up-soft); }
.tag.down { color: var(--down); background: var(--down-soft); }
.tag.warn { color: #c77700; background: var(--warn-soft); }
.tag.dim { color: var(--text-dim); background: rgba(0,0,0,.05); }
.tag.blue { color: var(--accent); background: var(--accent-soft); }
.tag.ok { color: var(--down); background: var(--down-soft); }
.tag.run { color: var(--accent); background: var(--accent-soft); }
.tag.late { color: #c77700; background: var(--warn-soft); }
.score-pill { display: inline-block; min-width: 46px; text-align: center; padding: 2px 8px; border-radius: 8px; font-family: var(--mono); font-size: 12.5px; font-weight: 700; }
.score-hi { color: var(--up); background: var(--up-soft); }
.score-mid { color: #c77700; background: var(--warn-soft); }
.score-lo { color: var(--down); background: var(--down-soft); }

/* 看板摘要行 */
.sent-summary { display: flex; align-items: center; gap: 22px; }
.sent-big { flex-shrink: 0; }
.sent-big .v { font-size: 25px; font-weight: 700; font-family: var(--mono); letter-spacing: -.02em; }
.sent-big .v.txt { font-size: 19px; }
.sent-big .l { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.sent-sep { width: 1px; height: 42px; background: var(--border); flex-shrink: 0; }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: right; font-weight: 600; color: var(--text-faint); padding: 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12px; user-select: none; }
.tbl th:first-child, .tbl td:first-child { text-align: left; padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--border-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr { transition: background .12s; cursor: pointer; }
.tbl tbody tr:hover { background: rgba(0,113,227,.045); }
.tbl .num { font-family: var(--mono); font-size: 12.5px; }
.tbl .left { text-align: left; }
.tbl .stock-link { color: var(--accent); cursor: pointer; font-weight: 500; }
.tbl .stock-link:hover { text-decoration: underline; }
.tbl .dim { color: var(--text-faint); }
.rank { color: var(--text-faint); font-family: var(--mono); font-size: 12px; }
.rank.top { color: var(--warn); font-weight: 700; }
th.sortable { cursor: pointer; } th.sortable:hover { color: var(--text-dim); }
th .arrow { font-size: 10px; margin-left: 2px; }
.up { color: var(--up); } .down { color: var(--down); } .mono { font-family: var(--mono); }

/* 工具栏 / 分页（Apple 胶囊） */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border-soft); }
.input, .select {
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13px; outline: none; font-family: inherit;
  transition: border .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,.12); }
.input { width: 220px; }
.btn { background: var(--accent); border: none; color: #fff; padding: 8px 18px; border-radius: 980px; font-size: 13px; cursor: pointer; font-family: inherit; font-weight: 500; transition: all .15s; }
.btn:hover { background: var(--accent-deep); }
.btn.ghost { background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border); }
.btn.ghost:hover { background: #ebebef; }
.btn.sm { padding: 4px 12px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.check { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13px; cursor: pointer; }
.check input { accent-color: var(--accent); }
.toolbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.chips { display: flex; gap: 6px; }
.chip { padding: 5px 15px; border-radius: 980px; font-size: 12.5px; color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--border); cursor: pointer; font-weight: 500; }
.chip.active { color: #fff; background: var(--accent); border-color: var(--accent); }
.pager { display: flex; align-items: center; gap: 8px; padding: 13px 20px; font-size: 12.5px; color: var(--text-dim); }
.pager .pg { font-family: var(--mono); }

/* 研报列表 */
.report-item { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); display: flex; gap: 15px; }
.report-item:hover { background: rgba(0,113,227,.03); }
.report-date { flex-shrink: 0; width: 54px; text-align: center; padding-top: 2px; }
.report-date .d { font-family: var(--mono); font-size: 15px; font-weight: 700; }
.report-date .m { font-size: 11px; color: var(--text-faint); }
.report-main { flex: 1; min-width: 0; }
.report-title { font-size: 13.5px; font-weight: 600; line-height: 1.5; cursor: pointer; letter-spacing: -.01em; }
.report-title:hover { color: var(--accent); }
.report-meta { display: flex; gap: 8px; margin-top: 7px; flex-wrap: wrap; align-items: center; }
.report-summary { font-size: 12.5px; color: var(--text-dim); line-height: 1.75; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stock-chip { padding: 1px 9px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-family: var(--mono); cursor: pointer; margin-right: 4px; font-weight: 500; }
.report-side { flex-shrink: 0; text-align: right; }

/* 个股页 */
.stock-head { display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 18px; }
.stock-name { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stock-code { font-family: var(--mono); color: var(--text-faint); font-size: 13px; margin-top: 3px; }
.stock-price { font-family: var(--mono); font-size: 32px; font-weight: 700; letter-spacing: -.03em; }
.chart-box { width: 100%; height: 420px; }
.chart-box.sm { height: 260px; }
.kv { display: flex; gap: 20px; flex-wrap: wrap; }
.kv .item { min-width: 90px; }
.kv .item .l { font-size: 11.5px; color: var(--text-faint); }
.kv .item .v { font-size: 14.5px; font-family: var(--mono); font-weight: 600; margin-top: 4px; }
.note { font-size: 12px; color: var(--text-faint); padding: 0 20px 12px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 5px; letter-spacing: -.02em; }
.page-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }

/* 数据页状态条 */
.job-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border-soft); }
.job-row:last-child { border-bottom: none; }
.job-row .jname { width: 152px; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.job-row .jdesc { flex: 1; font-size: 12px; color: var(--text-faint); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row .jtime { font-family: var(--mono); font-size: 12px; color: var(--text-dim); flex-shrink: 0; }
.bar-track { height: 6px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg,#0a84ff,#0071e3); }

/* 加载 / 空状态 */
.loading { padding: 60px 0; text-align: center; color: var(--text-faint); font-size: 13px; }
.empty { padding: 48px 0; text-align: center; color: var(--text-faint); font-size: 13px; }
.spin { display: inline-block; width: 22px; height: 22px; border: 2.5px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 自选股 */
.star-btn { cursor: pointer; color: var(--text-faint); user-select: none; line-height: 1; transition: color .15s; }
.star-btn:hover { color: var(--warn); }
.star-btn.on { color: var(--warn); }
.star-btn.big { font-size: 26px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); margin-right: 4px; vertical-align: 0; }
.live-dot.on { background: var(--down); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.add-suggest { border-top: 1px solid var(--border-soft); max-height: 280px; overflow: auto; }
.add-item { display: flex; gap: 10px; align-items: center; padding: 9px 18px; font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.add-item:hover { background: var(--bg); }
.del-btn { color: var(--text-faint); cursor: pointer; padding: 3px 8px; border-radius: 8px; font-size: 13px; }
.del-btn:hover { color: var(--up); background: var(--bg); }

/* ==================== 登录页 / 弹窗 / 侧栏用户区 ==================== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-card { width: 360px; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 18px; padding: 44px 36px 32px; box-shadow: 0 12px 40px rgba(0,0,0,.06); text-align: center; }
.login-logo { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 16px; background: var(--accent); color: #fff; font-size: 34px; font-weight: 700; line-height: 64px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -.3px; }
.login-sub { font-size: 13px; color: var(--text-faint); margin: 6px 0 24px; }
.login-input { width: 100%; margin-bottom: 12px; text-align: left; }
.login-btn { width: 100%; padding: 11px; font-size: 14px; margin-top: 6px; }
.login-err { color: var(--up); font-size: 12px; margin: -2px 0 10px; }
.login-tip { font-size: 11px; color: var(--text-faint); margin-top: 22px; }
.sidebar-user { display: flex; align-items: center; gap: 8px; padding: 12px 20px 14px; font-size: 12px; color: var(--text-dim); border-top: 1px solid var(--border-soft); }
.user-ico { color: var(--accent); }
.user-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-act { color: var(--text-faint); cursor: pointer; padding: 2px 7px; border-radius: 7px; }
.user-act:hover { color: var(--accent); background: var(--bg); }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.32); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(2px); }
.modal-card { width: 340px; background: var(--panel); border-radius: 16px; padding: 26px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
