/* 动量策略 · 网页版 —— 与小程序端共用同一套色彩语言
   （品牌红 #B3271E；涨=红 #C62828、跌=绿 #1B8A4B，沿用 A 股习惯） */

:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --line: #E6E8EC;
  --text: #1F2329;
  --muted: #8A8F99;
  --brand: #B3271E;
  --brand-weak: #FDECEA;
  --up: #C62828;
  --down: #1B8A4B;
  --flat: #8A8F99;
  --danger: #A3281F;
  --warn-bg: #FFF8E6;
  --warn-line: #F0D48A;
  --err-bg: #FDECEA;
  --err-line: #F3C4BF;
  --ok-bg: #EAF6EF;
  --ok-line: #B9DFC8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

/* ---------------- 顶栏 ---------------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.appbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 56px;
  flex-wrap: wrap;
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; white-space: nowrap; }
.brand-sub { font-size: 12px; font-weight: 400; opacity: .78; margin-left: 6px; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: nowrap; min-width: 0; }
.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .82);
  font: inherit;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.tab:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.tab.on { background: #fff; color: var(--brand); font-weight: 600; }
.acct { font-size: 13px; color: rgba(255, 255, 255, .9); display: flex; align-items: center; gap: 10px; }
.acct button {
  appearance: none; border: 1px solid rgba(255, 255, 255, .6); background: transparent;
  color: #fff; font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 7px; cursor: pointer;
}
.acct button:hover { background: rgba(255, 255, 255, .16); }

/* ---------------- 布局 ---------------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 20px 64px; }
.view { display: none; }
.view.on { display: block; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: 16px; font-weight: 600; margin-bottom: 14px;
}
.card-title .muted { font-weight: 400; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.sub-title { font-size: 14px; font-weight: 600; margin: 18px 0 8px; color: #3C4149; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------------- 顶部信息条 ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border-radius: var(--radius); padding: 12px 18px;
  margin-bottom: 14px; box-shadow: var(--shadow); flex-wrap: wrap;
}
.tb-main { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tb-date { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tb-src { font-size: 12.5px; color: var(--muted); }
.tb-rule { font-size: 13px; color: var(--brand); cursor: pointer; }
.tb-act { display: flex; align-items: center; gap: 12px; }
.tb-btn {
  font-size: 13px; color: var(--brand); cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px;
  user-select: none;
}
.tb-btn:hover { background: #F7F8FA; }

.alert {
  border-radius: 8px; padding: 11px 14px; font-size: 13.5px; margin-bottom: 14px;
  line-height: 1.55;
}
.alert.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: #7A5A00; }
.alert.err { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--danger); }
.alert.ok { background: var(--ok-bg); border: 1px solid var(--ok-line); color: #14663A; }

/* ---------------- 模型切换 ---------------- */
.seg {
  display: inline-flex; background: #E9EBEF; border-radius: 10px; padding: 3px; gap: 3px;
  margin-bottom: 8px;
}
.seg-item {
  appearance: none; border: 0; background: transparent; cursor: pointer; font: inherit;
  padding: 8px 18px; border-radius: 8px; color: #5A6169; text-align: center; line-height: 1.25;
}
.seg-item .seg-name { display: block; font-size: 14.5px; font-weight: 600; }
.seg-item .seg-sub { display: block; font-size: 11.5px; opacity: .75; }
.seg-item.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.model-meta { font-size: 13px; color: var(--muted); margin: 0 0 14px; }

/* 结论卡：与小程序同款配色（2026-10-07 复利哥要求两端统一格式）
   小程序 pages/index/index.wxss：action=红渐变 / ok=绿渐变 / login=深灰渐变，白字 */
.verdict { border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow); color: #fff; }
.verdict .v-title { font-size: 19px; font-weight: 700; margin-bottom: 6px; letter-spacing: .5px; }
.verdict .v-desc { font-size: 13.5px; opacity: .9; line-height: 1.6; }
.verdict.action { background: linear-gradient(135deg, #C62828 0%, #8E1C14 100%); }
.verdict.ok { background: linear-gradient(135deg, #2E7D5B 0%, #1B5E45 100%); }
.verdict.login { background: linear-gradient(135deg, #4A5568 0%, #2D3748 100%); }
.v-login {
  display: inline-block; margin-top: 12px; color: #fff;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .5);
  padding: 8px 18px; border-radius: 8px; font-size: 14px; cursor: pointer; font-family: inherit;
}

/* ---------------- 操作清单 ---------------- */
.act { border-top: 1px solid var(--line); padding: 12px 0; }
.act:first-of-type { border-top: 0; }
.act-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.act-title { font-size: 15px; font-weight: 600; }
.tag {
  display: inline-block; font-size: 11.5px; line-height: 19px; padding: 0 8px; border-radius: 5px;
  white-space: nowrap;
}
.tag-action { background: var(--brand-weak); color: var(--danger); }
.tag-keep { background: #EEF1F4; color: #5A6169; }
.tag-block { background: #F1F2F5; color: #6B7280; }
.tag-qdii { background: #FFF3E0; color: #B26A00; }
.tag-prem { background: var(--brand-weak); color: var(--danger); }
.tag-line { background: var(--err-bg); color: var(--danger); }
.act-line { font-size: 13.5px; color: #454B54; font-variant-numeric: tabular-nums; }
.act-warn { margin-top: 6px; font-size: 13px; color: var(--danger); }

/* ---------------- 溢价顺延 ---------------- */
.df { border-top: 1px solid var(--line); padding: 12px 0; }
.df:first-of-type { border-top: 0; }
.df-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.df-skip { font-weight: 600; font-size: 14.5px; }
.df-reason { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.df-arrow { color: var(--brand); font-weight: 700; }
.df-sub { font-size: 14px; font-weight: 600; color: var(--down); }
.df-sub.none { color: var(--danger); font-weight: 500; }
.df-detail { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.foot-note {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 12.5px; color: var(--muted); line-height: 1.65;
}
.foot-note + .foot-note { border-top: 0; margin-top: 6px; padding-top: 0; }

/* ---------------- KV / 计划 ---------------- */
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 4px 0; }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; font-weight: 600; }

/* 现金行：未建仓的份数按现金计（2026-10-07 复利哥要求） */
.cash-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line);
}
.cash-l { display: flex; flex-direction: column; }
.cash-name { font-weight: 600; font-size: 13.5px; }
.cash-sub { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.cash-val { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

.pl-row, .hd-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--line); font-size: 13.5px; flex-wrap: wrap;
}
.pl-row:last-child, .hd-row:last-child { border-bottom: 0; }
.pl-name { font-weight: 600; min-width: 128px; }
.pl-code { color: var(--muted); font-size: 12px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.pl-mid { color: var(--muted); flex: 1; min-width: 160px; font-variant-numeric: tabular-nums; }
.pl-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.pl-amt.up { color: var(--up); }
.pl-amt.down { color: var(--down); }
.pl-amt.flat { color: var(--muted); }

/* 持仓勾选（去金额改造：只记「持有 / 不持有」，无份额与金额） */
.hd-pick { cursor: pointer; }
.hd-pick:hover { background: rgba(179, 39, 30, .04); }
.hd-pick .pl-name { flex: 1 1 auto; min-width: 0; }
.hd-pick .pl-mid { flex: 0 1 auto; min-width: 0; text-align: right; }
.pick {
  flex: 0 0 auto;
  width: 19px; height: 19px; border-radius: 50%;
  border: 2px solid #D8DBE0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1; color: #fff;
}
.pick.on { background: var(--brand); border-color: var(--brand); }

/* 持仓勾选行：已达上限后未勾选的行置灰不可选（2026-10-07） */
.hd-pick { cursor: pointer; user-select: none; }
.hd-row.locked { cursor: not-allowed; }
.hd-row.locked .pick { border-color: #EDEFF2; background: #F7F8FA; }
.hd-row.locked .pl-name,
.hd-row.locked .pl-mid { color: #B8BDC5; }
.hd-row.locked .pl-code { color: #C6CAD1; }

/* 单只占比输入框（2026-10-07）：可自由改，现金自动联动；未勾选时置灰不可编辑 */
.hd-pick .w-box {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px;
  border: 1px solid var(--line); border-radius: 8px; padding: 2px 7px;
  background: var(--surface);
}
.hd-pick .w-box .w-inp {
  width: 50px; border: 0; outline: none; background: transparent; padding: 0;
  font: inherit; font-weight: 600; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.hd-pick .w-box .w-unit { font-size: 12.5px; color: var(--muted); }
.hd-pick .w-box.off { background: #F7F8FA; border-color: #EDEFF2; }
.hd-pick .w-box.off .w-inp { color: #B8BDC5; -webkit-text-fill-color: #B8BDC5; }
.hd-pick .w-box.off .w-unit { color: #C6CAD1; }
.hd-row.locked .w-box { background: #F7F8FA; border-color: #EDEFF2; }

/* ---------------- 表格 ---------------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px;
  padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td {
  padding: 9px 8px; border-bottom: 1px solid #F1F2F5; vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr.top td { background: #FFFBF5; }
table.tbl td.num, table.tbl th.num { text-align: right; }
td.name { white-space: nowrap; font-weight: 600; }
td.name .code { color: var(--muted); font-weight: 400; font-size: 11.5px; margin-left: 6px; }
td.rank { color: var(--muted); width: 34px; }
/* 现价列（2026-10-08）：最新成交价，盘中随实时行情变动 */
td.px { white-space: nowrap; }
.th-prem { white-space: normal; }   /* 表头文字长，窄屏允许折行，避免把表格撑宽 */
.prem-cell { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.prem-line { font-size: 11px; color: var(--muted); }
.prem-line.miss { color: var(--danger); font-weight: 600; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.prem-danger { color: var(--danger); font-weight: 600; }
.prem-warn { color: var(--up); font-weight: 600; }
.prem-ok { color: var(--down); }
.prem-flat { color: var(--flat); }

/* ---------------- 表单 ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  font: inherit; font-size: 14.5px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); width: 100%;
}
input:focus { outline: 2px solid rgba(179, 39, 30, .18); border-color: var(--brand); }
/* 「记住密码」勾选行：登录表单里跟在密码下方 */
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  margin: -4px 0 4px; cursor: pointer; user-select: none; line-height: 1.5; }
.check input[type="checkbox"] { flex: none; width: 15px; height: 15px; margin: 0;
  accent-color: var(--brand); cursor: pointer; }
.row-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn {
  appearance: none; border: 0; background: var(--brand); color: #fff; font: inherit;
  font-size: 14.5px; padding: 10px 20px; border-radius: 8px; cursor: pointer;
}
.btn:disabled { background: #D8DBE0; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-plain { background: #F1F2F5; color: #454B54; }
.btn-sm { font-size: 13px; padding: 6px 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.switch { display: inline-flex; background: #E9EBEF; border-radius: 8px; padding: 3px; gap: 3px; }
.switch button {
  appearance: none; border: 0; background: transparent; font: inherit; font-size: 13.5px;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; color: #5A6169;
}
.switch button.on { background: #fff; color: var(--brand); font-weight: 600; }

.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.chk input { width: auto; }

/* ---------------- 历史记录 ---------------- */
.hist {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; cursor: pointer;
}
.hist:hover { border-color: #D6DAE0; }
.hist-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hist-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.hist-target { font-size: 13.5px; color: #454B54; margin-top: 4px; }
.hist-body { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); cursor: default; }
.delta { font-size: 13px; }
.delta .add { color: var(--up); }
.delta .del { color: var(--down); }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex;
  align-items: center; justify-content: center; padding: 20px; z-index: 60;
}
.mask[hidden] { display: none; }
.dialog {
  background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 460px;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .24);
}
.dialog h3 { margin: 0 0 14px; font-size: 17px; }
.dialog .close-x { float: right; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--muted); }
.auth-tabs { display: flex; gap: 4px; background: #F1F2F5; border-radius: 8px; padding: 3px; margin-bottom: 16px; }
.auth-tabs button {
  flex: 1; appearance: none; border: 0; background: transparent; font: inherit; font-size: 13.5px;
  padding: 7px 4px; border-radius: 6px; cursor: pointer; color: #5A6169;
}
.auth-tabs button.on { background: #fff; color: var(--brand); font-weight: 600; }
.tip { font-size: 12.5px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.form-err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.modal-body { font-size: 14px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; }
.modal-body table { white-space: normal; }

#toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%);
  background: rgba(31, 35, 41, .92); color: #fff; font-size: 14px; padding: 10px 20px;
  border-radius: 22px; z-index: 90; opacity: 0; pointer-events: none; transition: opacity .22s;
}
#toast.on { opacity: 1; }

.empty { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; font-size: 14px; }

/* ---------------- 手机端适配（≤720px）----------------
   顶栏改两行：第一行 品牌+账号，第二行 4 个页签均分一行、禁止换行 */
@media (max-width: 720px) {
  .appbar-inner {
    padding: 8px 12px 0;
    gap: 4px;
    min-height: 0;
    flex-wrap: wrap;
  }
  .brand { order: 1; }
  .acct { order: 2; margin-left: auto; gap: 8px; }
  .tabs {
    order: 3;
    flex-basis: 100%;
    gap: 2px;
    padding: 2px 0 6px;
  }
  .tab {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    padding: 8px 2px;
    font-size: 14px;
  }
  .wrap { padding: 14px 12px 48px; }
  .card { padding: 16px 14px; margin-bottom: 12px; }
  .verdict { padding: 15px 16px; }
  .verdict .v-title { font-size: 17px; }
  .card-title { flex-wrap: wrap; row-gap: 2px; }
  .topbar { padding: 10px 14px; }
  .mask { padding: 12px; }
  .dialog { padding: 18px 16px; }
  .pl-name { min-width: 0; }
  .hd-pick .pl-mid { display: none; }          /* 手机上略去分类，给占比输入框让位 */
  .hd-pick .w-box .w-inp { width: 42px; }
  .hd-pick .w-box { padding: 2px 5px; }
  .acct .acct-email { display: none; }  /* 邮箱太长，手机上只留操作按钮 */
  /* 排名表：压紧字号与内边距，让 6 列（含新增的「现价」）在手机上一屏放下。
     标签（QDII/高溢价…）是名称列里最宽的元素，也要一起缩小，否则会把表格撑出横向滚动 */
  table.tbl { font-size: 12px; }
  table.tbl th { padding: 6px 3px; font-size: 10.5px; }
  table.tbl td { padding: 8px 3px; }
  table.tbl td.num, table.tbl th.num { padding-left: 2px; padding-right: 2px; }
  table.tbl td.px { font-size: 11.5px; }
  .tag { font-size: 10px; line-height: 16px; padding: 0 5px; }
  td.name .code { display: none; }      /* 手机上隐藏代码，只留名称 */
  td.rank { width: 18px; }
  .prem-line { font-size: 10px; }
}
