/* ===================================================================
   A股每日信号记录板 · v1.4
   -------------------------------------------------------------------
   视觉体系对齐 1w_a_share_plan.html：
     浅灰底 + 白卡 + 左侧红标题条，靠留白与边框分层，不靠背景色块
     红涨绿跌（A 股惯例）：#c0392b / #1e7e34
     .pick 卡片沿用参照文件的 buy/watch 左色条思路，按信号档位上色
   =================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #f0f2f5;

  --border: #e3e6ec;
  --border-soft: #eef0f3;
  --border-strong: #d4d8e0;

  --text: #1a1d24;
  --text-sub: #6b7280;
  --text-mute: #8b93a1;

  --primary: #c0392b;
  --primary-hover: #a5281c;
  --primary-soft: #fdecec;

  /* A股：红涨绿跌 */
  --up: #c0392b;
  --up-soft: #fdecec;
  --up-border: #f5c6c2;
  --down: #1e7e34;
  --down-soft: #eaf6ed;
  --down-border: #bfe0c6;
  --warn: #b7791f;
  --warn-soft: #fff8f0;
  --warn-border: #f5dcb8;
  --violet: #6b46c1;
  --violet-soft: #f0ebfa;

  --radius: 12px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 1px 3px rgba(26, 29, 36, .06);
  --focus: 0 0 0 3px rgba(192, 57, 43, .18);
  --mono: "SF Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }

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

body.is-popup { width: 800px; height: 620px; }
body.is-full { width: 100%; height: 100vh; }

/* 数值统一等宽，避免刷新时跳动 */
.num, .sig-price, .row-val, .sum-bar b, .lv b, .kpi .v, .bm .v, .pk-p {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.up { color: var(--up); font-weight: 600; }
.down { color: var(--down); font-weight: 600; }
.hide { display: none !important; }

/* ---------------- header ---------------- */
.app-header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-icon { width: 24px; height: 24px; border-radius: 6px; }
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: -.2px; white-space: nowrap; }
.brand-sub {
  font-size: 11px; color: var(--text-sub); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  padding: 2px 8px; border-radius: 4px; background: var(--surface-3);
}
.brand-sub.is-fresh { color: var(--down); background: var(--down-soft); }
.brand-sub.is-stale { color: var(--warn); background: var(--warn-soft); }

.nav { display: flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: var(--radius-sm); }
.nav-btn {
  appearance: none; border: 0; background: transparent;
  padding: 5px 12px; border-radius: var(--radius-xs); font-family: inherit;
  font-size: 12.5px; color: var(--text-sub); cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-btn:hover { background: var(--border); color: var(--text); }
.nav-btn.is-active { background: var(--text); color: #fff; font-weight: 600; }

.header-actions { margin-left: auto; display: flex; gap: 7px; align-items: center; }

/* ---------------- buttons ---------------- */
.btn {
  appearance: none; border: 1px solid transparent;
  border-radius: var(--radius-xs); padding: 7px 13px;
  font-size: 12.5px; font-family: inherit; cursor: pointer;
  background: var(--surface-3); color: var(--text);
  transition: background .15s, border-color .15s, color .15s, transform .08s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--border); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: btn-spin .7s linear infinite;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary.is-loading::after { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text-sub); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-outline.is-loading::after, .btn-ghost.is-loading::after {
  border-color: var(--border-strong); border-top-color: var(--primary);
}
.btn-ghost { background: transparent; color: var(--text-mute); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn-danger { background: transparent; border-color: var(--up-border); color: var(--up); }
.btn-danger:hover:not(:disabled) { background: var(--up-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible, .control:focus-visible, .nav-btn:focus-visible {
  outline: none; box-shadow: var(--focus);
}
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------------- layout ---------------- */
.app-main { height: calc(100% - 53px); overflow-y: auto; padding: 16px; }
.view { display: none; }
.view.is-active { display: block; }

/* 卡片：白底 + 细边框 + 圆角，标题用左侧红条 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 16px; border-bottom: 1px solid var(--border-soft);
}
.card-title {
  margin: 0; font-size: 14px; font-weight: 700; color: var(--text);
  padding-left: 10px; border-left: 4px solid var(--primary);
  display: flex; align-items: center; gap: 8px; line-height: 1.3;
}
.card-title .count {
  font-size: 11px; padding: 0 7px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-sub); font-weight: 400;
}
.card-head-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 16px; }

/* ---------------- controls ---------------- */
.control {
  appearance: none; border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs); padding: 7px 10px; font-size: 12.5px;
  font-family: inherit; color: var(--text); background: var(--surface);
  min-width: 0; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.control:hover { border-color: var(--text-mute); }
.control:focus { border-color: var(--primary); outline: none; box-shadow: var(--focus); }
.control::placeholder { color: var(--text-mute); }
.control-w92 { width: 92px; flex: 0 0 92px; }
.control-w110 { width: 110px; flex: 0 0 110px; }

select.control {
  cursor: pointer; padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7280' stroke-width='1.4' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
  -webkit-appearance: none;
}

.field-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-sub); }
.field-inline > span { white-space: nowrap; }
.toolbar-row { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }

.form-row { display: grid; gap: 5px; min-width: 0; }
.form-row > span { font-size: 11px; color: var(--text-sub); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }

.ck { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-sub); cursor: pointer; }
.ck input { accent-color: var(--primary); width: 14px; height: 14px; }
.hint { margin: 6px 0 0; font-size: 11.5px; color: var(--text-mute); line-height: 1.6; }

/* ---------------- 提示块（对齐参照文件 note/warn/ok/src）---------------- */
.note, .warn, .ok, .src, .info {
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-size: 12.5px; line-height: 1.65; margin: 12px 0;
}
.note { background: var(--warn-soft); border: 1px solid var(--warn-border); color: #7a5c17; }
.warn { background: var(--up-soft); border: 1px solid var(--up-border); color: #8c2a20; }
.ok { background: var(--down-soft); border: 1px solid var(--down-border); color: #1e6b32; }
.info { background: var(--surface-2); border: 1px solid var(--border); color: var(--text-sub); }
.src { background: transparent; border: 0; padding: 8px 0 0; color: var(--text-mute); font-size: 11.5px; }
.note b, .warn b, .ok b { color: inherit; font-weight: 700; }
.note { margin-top: 0; }
.warn:first-child, .ok:first-child, .info:first-child { margin-top: 0; }

.notice {
  margin: 0 0 16px; padding: 11px 14px; font-size: 12.5px;
  color: var(--text-sub); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; gap: 9px; align-items: flex-start;
}
.notice-icon {
  flex: none; width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--text-sub); margin-top: 2px;
}
.notice.is-warn { background: var(--warn-soft); border-color: var(--warn-border); color: #7a5c17; }
.notice.is-warn .notice-icon { background: var(--primary); color: #fff; }
.notice.is-error { background: var(--up-soft); border-color: var(--up-border); color: #8c2a20; }
.notice.is-error .notice-icon { background: var(--primary); color: #fff; }
.notice.is-ok { background: var(--down-soft); border-color: var(--down-border); color: #1e6b32; }
.notice.is-ok .notice-icon { background: var(--down); color: #fff; }
.notice b { color: inherit; }

/* ---------------- 先看结论 ---------------- */
.verdict {
  padding: 13px 15px; border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.7;
  border: 1px solid var(--border); background: var(--surface-2);
}
.verdict.is-buy { background: var(--up-soft); border-color: var(--up-border); color: #8c2a20; }
.verdict.is-hold { background: var(--warn-soft); border-color: var(--warn-border); color: #7a5c17; }
.verdict.is-sell { background: var(--down-soft); border-color: var(--down-border); color: #1e6b32; }
.verdict b { color: inherit; font-weight: 700; }

/* KPI：参照文件 .kpi */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; margin: 14px 0; }
.kpi {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.kpi .l { font-size: 11.5px; color: var(--text-sub); }
.kpi .v { font-size: 20px; font-weight: 700; margin-top: 2px; letter-spacing: -.3px; }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--text-mute); margin-left: 2px; }

.verdict-why { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.verdict-why h4 { margin: 0 0 6px; font-size: 13.5px; font-weight: 600; color: #2d3748; }
.verdict-why ul { margin: 0 0 0 18px; font-size: 13px; color: var(--text-sub); line-height: 1.75; }
.verdict-why li { margin: 4px 0; }
.verdict-why b { color: var(--text); }

/* ---------------- 今日最优推荐 ---------------- */
/* 沿用参照文件 .pick：左侧 5px 色条按档位区分 */
.pick {
  border: 1px solid var(--border); border-left: 5px solid var(--text-mute);
  border-radius: var(--radius-sm); padding: 16px 18px;
  background: var(--surface-2);
}
.pick.buy { border-left-color: var(--primary); background: var(--surface); }
.pick.watch { border-left-color: #a0aec0; }
.pick.sell { border-left-color: var(--down); }

.pk-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.pk-n { font-size: 17px; font-weight: 700; letter-spacing: -.2px; }
.pk-c { font-size: 12px; color: var(--text-sub); font-family: var(--mono); }
.pk-p { margin-left: auto; font-size: 16px; font-weight: 700; white-space: nowrap; }
.pk-p small { font-size: 12px; font-weight: 600; margin-left: 3px; }
.pk-sub { font-size: 12px; color: var(--text-sub); margin-bottom: 10px; line-height: 1.6; }

.tag {
  display: inline-block; font-size: 11.5px; padding: 2px 9px;
  border-radius: 4px; font-weight: 600; background: var(--surface-3); color: var(--text-sub);
}
.tag.up { background: var(--up-soft); color: var(--up); }
.tag.down { background: var(--down-soft); color: var(--down); }
.tag.n { background: var(--surface-3); color: var(--text-sub); }
.tag.b { background: var(--down-soft); color: var(--down); }
.tag.v { background: var(--violet-soft); color: var(--violet); }

/* 指标概览小格 */
.bm { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 10px 0 12px; }
.bm > div { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius-xs); padding: 7px 9px; }
.bm .l { font-size: 10.5px; color: var(--text-mute); }
.bm .v { font-size: 13px; font-weight: 600; margin-top: 1px; }

/* 键值分析表：完全对齐参照文件 .lv */
.lv { display: grid; grid-template-columns: 88px 1fr; margin-top: 12px; }
.lv .k { color: var(--text-sub); font-size: 12.5px; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
.lv .v { font-weight: 600; padding: 6px 0; border-bottom: 1px solid var(--border-soft); line-height: 1.6; }
.lv .k:nth-last-of-type(1), .lv .v:last-of-type { border-bottom: none; }
.lv .v b { font-weight: 700; }

/* 打分构成条 */
.parts { margin-top: 12px; display: grid; gap: 5px; }
.part-row { display: grid; grid-template-columns: 70px 1fr 48px; gap: 9px; align-items: center; font-size: 11.5px; }
.part-row .pk { color: var(--text-sub); white-space: nowrap; }
.part-row .pb { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.part-row .pb i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.part-row .pb i.is-neg { background: #e08a80; }
.part-row .pv { text-align: right; color: var(--text-sub); font-variant-numeric: tabular-nums; }

/* ---------------- 标的卡 ---------------- */
.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }

.sig-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--text-mute);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}
.sig-card.tone-buy { border-left-color: var(--primary); }
.sig-card.tone-hold { border-left-color: #c9a227; }
.sig-card.tone-sell { border-left-color: var(--down); }
.sig-card:hover { border-color: var(--border-strong); box-shadow: 0 3px 10px rgba(26,29,36,.09); }
.sig-card:hover, .sig-card.tone-buy:hover { border-left-color: var(--primary); }

.sig-head { display: flex; align-items: baseline; gap: 8px; }
.sig-name { font-size: 15px; font-weight: 700; letter-spacing: -.1px; }
.sig-code { font-family: var(--mono); font-size: 11px; color: var(--text-mute); }
.sig-price { margin-left: auto; font-weight: 700; font-size: 14.5px; white-space: nowrap; }

.sig-tags { display: flex; gap: 5px; align-items: center; margin-top: 9px; flex-wrap: wrap; }
.tag-act {
  font-size: 11.5px; padding: 2px 9px; border-radius: 4px;
  font-weight: 600; white-space: nowrap;
}
.tag-act.tone-buy { background: var(--up-soft); color: var(--up); }
.tag-act.tone-hold { background: var(--warn-soft); color: var(--warn); }
.tag-act.tone-sell { background: var(--down-soft); color: var(--down); }
.tag-score {
  font-family: var(--mono); font-size: 11px; padding: 2px 8px;
  border-radius: 4px; background: var(--surface-3); color: var(--text-sub);
}
.tag-lot {
  font-size: 11px; padding: 2px 8px; border-radius: 4px;
  background: var(--violet-soft); color: var(--violet);
}
.tag-src {
  margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 3px;
  background: var(--surface-3); color: var(--text-mute); font-family: var(--mono);
}

.sig-meter { height: 4px; border-radius: 2px; background: var(--surface-3); margin: 10px 0 2px; overflow: hidden; }
.sig-meter i { display: block; height: 100%; border-radius: 2px; background: var(--text-mute); }
.sig-meter.tone-buy i { background: var(--primary); }
.sig-meter.tone-hold i { background: #c9a227; }
.sig-meter.tone-sell i { background: var(--down); }

.sig-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-top: 9px; }
.sig-kv > div {
  display: flex; justify-content: space-between; gap: 6px;
  padding: 4px 0; border-bottom: 1px solid var(--border-soft); font-size: 11.5px;
}
.sig-kv > div:nth-last-child(1), .sig-kv > div:nth-last-child(2) { border-bottom: none; }
.sig-kv span { color: var(--text-mute); white-space: nowrap; }
.sig-kv b { font-weight: 600; white-space: nowrap; }

.sig-why {
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--border-strong);
  font-size: 12px; color: var(--text-sub); line-height: 1.6;
}
.sig-warn {
  margin-top: 7px; font-size: 11.5px; color: var(--warn);
  padding: 6px 9px; border-radius: var(--radius-xs);
  background: var(--warn-soft); border: 1px solid var(--warn-border); line-height: 1.55;
}
.sig-warn.is-danger { color: #8c2a20; background: var(--up-soft); border-color: var(--up-border); }

.sig-detail { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-strong); }
.sig-card.is-open .sig-detail { display: block; }
.sig-detail .lv { grid-template-columns: 70px 1fr; margin-top: 0; }
.sig-detail .lv .k, .sig-detail .lv .v { font-size: 11.5px; padding-top: 4px; padding-bottom: 4px; }

/* ---------------- rows ---------------- */
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface);
  transition: border-color .15s, background .15s;
}
.row:hover { border-color: var(--border-strong); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 13.5px; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.row-sub { font-size: 11.5px; color: var(--text-mute); font-family: var(--mono); }
.row-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.row.is-clickable { cursor: pointer; }
.row.is-clickable:hover { border-color: var(--primary); background: var(--primary-soft); }
.row-val { font-weight: 700; font-size: 14.5px; text-align: right; white-space: nowrap; }
.row.is-broken { background: var(--up-soft); border-color: var(--up-border); }
.flag-broken {
  font-size: 10.5px; padding: 1px 7px; border-radius: 4px;
  background: var(--primary); color: #fff; font-weight: 600;
}

/* ---------------- summary ---------------- */
.sum-bar {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
  box-shadow: var(--shadow);
}
.sum-bar > div { padding: 11px 14px; border-right: 1px solid var(--border-soft); min-width: 0; }
.sum-bar > div:last-child { border-right: none; }
.sum-bar .k { font-size: 11.5px; color: var(--text-sub); display: block; }
.sum-bar b { display: block; font-size: 17px; font-weight: 700; margin-top: 2px; }
.sum-bar b.up { color: var(--up); }
.sum-bar b.down { color: var(--down); }

/* ---------------- 数据源选择 ---------------- */
.src-list { display: grid; gap: 9px; }
.src-card {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 13px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.src-card:hover { border-color: var(--border-strong); }
.src-card.is-current { border-color: var(--primary); background: var(--primary-soft); }
.src-radio {
  flex: none; width: 15px; height: 15px; border-radius: 50%; margin-top: 3px;
  border: 1.5px solid var(--border-strong); display: grid; place-items: center;
}
.src-card.is-current .src-radio { border-color: var(--primary); }
.src-card.is-current .src-radio::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.src-main { flex: 1; min-width: 0; }
.src-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.src-desc { font-family: var(--mono); font-size: 10.5px; color: var(--text-mute); margin-top: 3px; }
.src-note { font-size: 12px; color: var(--text-sub); margin-top: 5px; line-height: 1.6; }
.cap-tag {
  font-size: 10.5px; padding: 1px 7px; border-radius: 3px;
  background: var(--surface-3); color: var(--text-mute);
}
.cap-tag.on { background: var(--down-soft); color: var(--down); }
.cap-tag.off { background: var(--surface-3); color: var(--text-mute); }
.info.is-disabled { opacity: .5; pointer-events: none; }

/* ---------------- 独立预览模式 ---------------- */
.standalone-bar {
  display: none; align-items: center; gap: 9px;
  padding: 8px 16px; font-size: 12px;
  background: var(--warn-soft); border-bottom: 1px solid var(--warn-border);
  color: #7a5c17;
}
body.is-standalone .standalone-bar { display: flex; }
body.is-standalone .app-main { height: calc(100% - 88px); }
body.is-standalone { overflow: auto; height: auto; }
body.is-standalone.is-popup { width: 100%; height: 100vh; }
.standalone-bar b { font-weight: 700; }
.standalone-bar .sb-code {
  font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 3px;
  background: rgba(122, 92, 23, .12);
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.status-dot.ok { background: var(--down); }
.status-dot.fail { background: var(--primary); }
.status-dot.pending { background: var(--text-mute); }

/* ---------------- 历史 ---------------- */
.his-l { margin-top: 3px; font-size: 12px; color: var(--text-sub); line-height: 1.6; }
.his-l i { font-style: normal; color: var(--text-mute); }

/* ---------------- empty ---------------- */
.empty-state { padding: 34px 16px; text-align: center; color: var(--text-mute); font-size: 12.5px; }
.empty-state p { margin: 5px 0; }

/* ---------------- 全局loading ---------------- */
.busy-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(245, 246, 248, .78); backdrop-filter: blur(1.5px);
  display: grid; place-items: center;
}
.busy-mask[hidden] { display: none !important; }
.busy-box {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(26,29,36,.12); font-size: 13px;
}
.busy-box .spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--primary);
  animation: btn-spin .7s linear infinite; flex: none;
}

/* ---------------- toast ---------------- */
.toast-root {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  padding: 9px 16px; border-radius: var(--radius-xs);
  background: #2d3748; color: #fff; font-size: 12.5px;
  box-shadow: 0 6px 20px rgba(26,29,36,.2); max-width: 92vw;
}
.toast.is-success { background: var(--down); }
.toast.is-error { background: #8c2a20; }
.toast.is-warn { background: #7a5c17; }

/* ---------------- scrollbar ---------------- */
.app-main::-webkit-scrollbar { width: 9px; }
.app-main::-webkit-scrollbar-track { background: var(--bg); }
.app-main::-webkit-scrollbar-thumb { background: #cdd2da; border-radius: 5px; border: 2px solid var(--bg); }
.app-main::-webkit-scrollbar-thumb:hover { background: #b3b9c4; }

/* ---------------- responsive ---------------- */
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sum-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-header { flex-wrap: wrap; }
  .header-actions { width: 100%; justify-content: space-between; }
  .lv { grid-template-columns: 74px 1fr; }
}
/* ==================== 全市场扫描来源说明 ==================== */
.scan-basis {
  margin: 0 14px 14px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.7;
}
.scan-basis.is-warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}
.sb-head {
  font-weight: 600;
  color: var(--text-1);
  font-size: 12.5px;
  margin-bottom: 6px;
}
.sb-dims {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}
.scan-dim {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.scan-dim.is-err {
  color: var(--down);
  border-color: var(--down);
  background: var(--down-soft);
}
.sb-meta b {
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.sb-hit {
  color: var(--text-2);
  font-size: 11.5px;
  margin-top: 3px;
}
.scan-warn {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  color: var(--warn);
  font-size: 11.5px;
}

/* 设置页：内联字段标签 */
.fld {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-2);
}
.fld > span { white-space: nowrap; }
.fld .control { width: auto; min-width: 118px; }

/* ==================== 持仓卡片 ==================== */
.hold-row {
  align-items: flex-start;
}
.hold-row .row-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}
/* 名称是主信息，代码是次要信息——截图里两者都同字号，看不出主次 */
.hd-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: .2px;
}
.hd-code {
  font-size: 11.5px;
  color: var(--text-3, #8b93a1);
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.hold-row .his-l {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
}
.hold-row .his-l > span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* 指标名与数值分层，避免"800股 @ 5.94现价 5.14"挤成一片 */
.hold-row .his-l i {
  font-style: normal;
  color: var(--text-3, #8b93a1);
  font-size: 11px;
}
.hold-row .his-l b { font-weight: 600; }
.hold-row .row-val {
  min-width: 78px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ==================== 刷新按钮（图标 + 自转） ==================== */
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-left: 8px;
  padding-right: 10px;
}
.btn-icon .ico-reload {
  width: 13px;
  height: 13px;
  flex: none;
  display: block;
}
/* 刷新时图标自转，比遮住文字转圈更符合"图标按钮"的语义 */
.btn-icon.is-loading::after { display: none; }
.btn-icon.is-loading .ico-reload {
  animation: ico-spin .7s linear infinite;
  transform-origin: 50% 50%;
}
@keyframes ico-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-icon.is-loading .ico-reload { animation-duration: 1.6s; }
}

/* ==================== 持仓决策（持有/减仓/清仓/止盈） ==================== */
.hold-brief {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.hb-tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.hb-tag.is-sell { background: var(--down-soft); color: var(--down); border-color: var(--down-border); }
.hb-tag.is-hold { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.hb-tag.is-buy  { background: #fdeeee; color: var(--primary); border-color: #f2c9c4; }
.hb-note {
  font-size: 11.5px;
  color: var(--text-3, #8b93a1);
  margin-left: auto;
}

/* 单只持仓的决策块 —— 比买入信号更像"指令"，用左色条区分紧急度 */
.dec {
  margin: 6px 0 4px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  background: var(--bg);
  font-size: 12px;
  line-height: 1.65;
}
.dec-hd {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 3px;
}
.dec-label {
  font-size: 11px;
  color: var(--text-3, #8b93a1);
  flex: none;
}
.dec-act {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .3px;
}
.dec-qty {
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.dec-score {
  font-size: 11px;
  color: var(--text-3, #8b93a1);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.dec-why {
  margin: 0;
  padding-left: 15px;
  color: var(--text-2);
}
.dec-why li { margin: 1px 0; }
.dec-warn {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed var(--line);
  color: var(--warn);
  font-size: 11.5px;
}

/* 档位配色：止损/减仓=绿(A股跌) ·止盈/观察=橙 · 持有=红(A股涨) */
.dec-stopOut, .dec-clear, .dec-reduce { border-left-color: var(--down); background: var(--down-soft); }
.dec-stopOut .dec-act, .dec-clear .dec-act, .dec-reduce .dec-act { color: var(--down); }

.dec-take { border-left-color: var(--warn); background: var(--warn-soft); }
.dec-take .dec-act { color: var(--warn); }

.dec-watch { border-left-color: #9aa3b0; }
.dec-watch .dec-act { color: var(--text-2); }

.dec-hold, .dec-add { border-left-color: var(--primary); background: #fdf6f5; }
.dec-hold .dec-act, .dec-add .dec-act { color: var(--primary); }

.dec-none {
  display: flex;
  gap: 8px;
  align-items: baseline;
  border-left-color: var(--warn);
}
.dec-none b { color: var(--warn); }
.dec-none span { font-size: 11.5px; color: var(--text-3, #8b93a1); }
