/* ============================================================
   录入表单统一样式  form-entry.css  (P1 · 2026-10-15)
   ------------------------------------------------------------
   来源：原内联在 templates/dashboard/widgets/stock_code_input.html 的 <style> 块。
   抽离原因：te-* 样式原先随该 widget 的 include 才输出，导致不引入 widget 的
   页面（如 input_subscription）无法使用同一套表单布局。
   作用域：全部选择器挂在 .te-scope 下（原为 #tradeEntryForm，只有 2/6 个页面
   带该 id，其余页面样式静默失效）；任何表单加 class="te-scope" 即可复用。
   依赖：tokens.css 的 --bb-* 变量。
   ============================================================ */

/* ===================== 交易录入专用样式（v4.6 设计稿落地）=====================
   所有选择器都挂在 .te-scope 下，避免污染后台其它页面 */
.te-scope .te-sec{padding:2px 0}
.te-scope .te-sec + .te-sec{border-top:1px solid var(--bb-divider);margin-top:18px;padding-top:16px}
.te-scope .te-head{display:flex;align-items:center;gap:9px;margin-bottom:14px;flex-wrap:wrap}
.te-scope .te-head h6{margin:0;font-weight:700;color:var(--bb-primary);font-size:.95rem}
.te-scope .te-no{width:22px;height:22px;border-radius:50%;flex:0 0 22px;background:var(--bb-primary-soft);
  color:var(--bb-primary);display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700}
.te-scope .te-head .te-hint{margin-left:auto;color:var(--bb-text-muted);font-size:12.5px}

/* 行布局：标签右对齐 + 字段自适应。不使用带 gap 的嵌套 flex 容器（零宽元素挡不住 gap） */
.te-scope .te-row{display:flex;align-items:flex-start;margin-bottom:14px}
.te-scope .te-row > .te-label{flex:0 0 130px;text-align:right;padding:8px 14px 0 0;
  font-weight:600;font-size:13.5px;color:#5a5c69}
.te-scope .te-row > .te-field{flex:1;min-width:0}

/* ① 交易方向：两张并排大卡（刻意不用红绿，避免与涨跌色混淆） */
.te-scope .dir-switch{display:flex;gap:12px}
.te-scope .dir-btn{flex:1;position:relative;background:var(--bb-bg-card);border:1.5px solid var(--bb-border);
  border-radius:.5rem;padding:13px 16px;text-align:left;cursor:pointer;transition:all .15s ease;
  font-family:inherit;width:100%}
.te-scope .dir-btn:hover{border-color:#bcc4e8}
.te-scope .dir-btn .t{font-size:1.05rem;font-weight:700;color:var(--bb-text);display:block}
.te-scope .dir-btn .d{font-size:12.5px;color:var(--bb-text-muted);display:block;margin-top:2px}
.te-scope .dir-btn .tick{position:absolute;top:12px;right:14px;font-size:13px;opacity:0;font-weight:700}
.te-scope .dir-btn.on .tick{opacity:1}
.te-scope .dir-btn[data-dir="BUY"].on{border-color:var(--bb-primary);background:var(--bb-primary-soft)}
.te-scope .dir-btn[data-dir="BUY"].on .t,
.te-scope .dir-btn[data-dir="BUY"].on .tick{color:var(--bb-primary)}
.te-scope .dir-btn[data-dir="SELL"].on{border-color:#e37318;background:#fdf1e5}
.te-scope .dir-btn[data-dir="SELL"].on .t,
.te-scope .dir-btn[data-dir="SELL"].on .tick{color:#e37318}

/* ② 两段式选择区 */
.te-scope .te-group{margin-bottom:14px}
.te-scope .te-group:last-of-type{margin-bottom:0}
.te-scope .te-ghead{display:flex;align-items:center;gap:9px;margin-bottom:9px;flex-wrap:wrap}
.te-scope .te-gtitle{font-weight:700;color:var(--bb-text);font-size:13px}
.te-scope .te-badge{display:inline-block;padding:1px 9px;border-radius:20px;font-size:12px;
  font-weight:700;background:var(--bb-primary-soft);color:var(--bb-primary)}
.te-scope .te-badge.sell{background:#fdf1e5;color:#e37318}
.te-scope .te-badge.closed{background:#f2f4f9;color:#8b93a7}
.te-scope .te-gnote{font-size:12px;color:var(--bb-text-muted)}
.te-scope .te-search{margin-left:auto;width:190px;padding:5px 10px;border:1px solid var(--bb-border);
  border-radius:20px;font-size:13px;font-family:inherit}
.te-scope .te-search:focus{outline:0;border-color:#bac8f3}

/* 股票块：grid + auto-fill 保证每块等宽等高；不设 scrollbar-gutter（不滚动就不占位） */
.te-scope .chips{display:grid;grid-template-columns:repeat(auto-fill,minmax(178px,1fr));gap:8px;
  max-height:326px;overflow-y:auto;padding:2px}
.te-scope .chips::-webkit-scrollbar{width:6px}
.te-scope .chips::-webkit-scrollbar-track{background:transparent}
.te-scope .chips::-webkit-scrollbar-thumb{background:#d5daea;border-radius:3px}
.te-scope .chips::-webkit-scrollbar-thumb:hover{background:#bcc4e8}
.te-scope .chips.tight{max-height:none}
.te-scope .chip{border:1px solid var(--bb-divider);background:var(--bb-bg-card);border-radius:.5rem;padding:6px 11px;
  cursor:pointer;text-align:left;font-family:inherit;transition:all .12s ease;overflow:hidden;
  display:block;width:100%}
.te-scope .chip:hover{border-color:#bcc4e8;background:#fbfcff}
.te-scope .chip .l1{display:flex;align-items:baseline;gap:7px;min-width:0}
.te-scope .chip .n{font-weight:700;color:var(--bb-text);font-size:13.5px;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis}
.te-scope .chip .q{flex:0 0 auto;font-size:11.5px;font-weight:600;color:var(--bb-text-muted);
  font-variant-numeric:tabular-nums}
.te-scope .chip .m{display:block;font-size:12px;color:var(--bb-text-muted);margin-top:2px;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis}
.te-scope .chip .mv{display:block;font-size:12px;font-weight:700;color:var(--bb-primary);margin-top:1px;
  font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.te-scope .chip .mv .u{font-weight:600;color:var(--bb-text-muted);font-size:11.5px;margin-right:3px}
.te-scope .chip.on{border-color:var(--bb-primary);background:var(--bb-primary-soft);box-shadow:0 0 0 1px var(--bb-primary) inset}
.te-scope .chip.on .n,.te-scope .chip.on .q{color:var(--bb-primary)}
.te-scope .chip.on-sell{border-color:#e37318!important;background:#fdf1e5!important;
  box-shadow:0 0 0 1px #e37318 inset!important}
.te-scope .chip.on-sell .n,.te-scope .chip.on-sell .q{color:#e37318!important}
.te-scope .chip.on-sell .mv{color:#e37318!important}
/* 已清仓：虚线 + 灰调，与持仓明显区分 */
.te-scope .chip.was{border-style:dashed;background:#fcfcfe}
.te-scope .chip.was .n{color:#6d7484}
.te-scope .chip.was.on{border-color:var(--bb-primary);border-style:solid;background:var(--bb-primary-soft)}
.te-scope .te-more{margin-top:8px;font-size:12.5px}
.te-scope .te-more a{color:var(--bb-primary);cursor:pointer;text-decoration:none;font-weight:600}
.te-scope .te-more a:hover{text-decoration:underline}
.te-scope .te-was-hidden{margin-top:7px;font-size:12px;color:var(--bb-text-muted)}

/* 空态 */
.te-scope .te-empty{border:1px dashed var(--bb-border);border-radius:.5rem;padding:20px;text-align:center;
  color:var(--bb-text-muted);background:#fcfcfe;font-size:13px}
.te-scope .te-empty .te-empty-t{font-weight:700;color:#5a5c69;display:block;margin-bottom:3px}

/* 代码框 + 名称只读行 */
.te-scope .te-codeblock{margin-top:14px}
.te-scope .te-hintline{display:flex;align-items:baseline;gap:10px;margin-top:5px}
.te-scope .te-hintline .form-text{margin:0;flex:1;min-width:0}
.te-scope .te-lock{flex:0 0 auto;white-space:nowrap;margin:0;color:var(--bb-text-muted);font-size:12.5px}
.te-scope .te-namerow{margin-top:14px}
.te-scope .te-ro{padding:8px 12px;border:1px solid var(--bb-divider);border-radius:.35rem;background:var(--bb-bg-page);
  color:var(--bb-text);min-height:38px;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.te-scope .te-ro-ph{color:var(--bb-text-faint)}
.te-scope .te-tag{font-size:12px;padding:1px 8px;border-radius:20px;background:#e8ecf7;
  color:#5a6ba8;white-space:nowrap}
.te-scope .te-tag.was{background:#f0f1f5;color:#7b8294}

/* 数量行：可卖 / 全仓 / 超量 */
.te-scope .te-qty-foot{display:flex;align-items:center;gap:12px;margin-top:6px}
.te-scope .te-qty-foot .form-text{margin:0}
.te-scope .te-qty-foot b{color:var(--bb-text)}
.te-scope .te-btn-all{border:1px solid var(--bb-border);background:var(--bb-bg-card);border-radius:20px;padding:2px 12px;
  font-size:12.5px;cursor:pointer;font-family:inherit;color:#5a5c69}
.te-scope .te-btn-all:hover{border-color:var(--bb-primary);color:var(--bb-primary)}
.te-scope .te-err{color:var(--bb-danger);font-size:12.5px;margin-top:5px;display:none}
.te-scope .te-err.on{display:block}
.te-scope .form-control.over{border-color:var(--bb-danger);box-shadow:0 0 0 .2rem var(--bb-danger-ring)}

/* 口径提示条 */
.te-scope .te-tip{background:#f4f6fc;border-left:3px solid var(--bb-primary);border-radius:.25rem;
  padding:9px 13px;font-size:12.5px;color:#5a5c69;margin-top:14px}
.te-scope .te-tip.sell{background:#fdf6ee;border-left-color:#e37318}
.te-scope .te-tip b{color:var(--bb-text)}
