/* ==========================================================================
   assets/quant.css —— 「量化」专区共享样式
   --------------------------------------------------------------------------
   只服务 pages/quant/ 下的工具页；全部类名加 q- 前缀，避免与 app.css /
   skin.css 的通用类冲突。主色沿用全站靛青蓝 #27548c + 赭石 #b45309。
   涨跌配色遵中国习惯：涨红跌绿。
   ========================================================================== */

:root {
  --q-blue: #27548c;
  --q-blue-l: #eef3fa;
  --q-ochre: #b45309;
  --q-ochre-l: #fdf3e6;
  --q-ink: #1d2b3e;
  --q-mut: #8a93a5;
  --q-line: #e6e9ef;
  --q-bg: #f6f7f9;
  --q-up: #e03131;
  --q-dn: #0ca678;
}

/* hidden 兜底：本区大量用 display:flex/grid，会压掉 UA 的 [hidden] 规则 */
.quant-scope [hidden] { display: none !important; }

/* ------------------------- 页头 ------------------------- */
.q-hd { margin-bottom: 6px; }
.q-hd h1 {
  margin: 0 0 5px; font-size: 21px; font-weight: 700;
  letter-spacing: .4px; color: #0a0a0a;
}
.q-hd h1 em { font-style: normal; color: var(--q-blue); }
.q-hd .sub { font-size: 12.5px; color: var(--q-mut); line-height: 1.75; }
.q-hd .sub b { color: var(--q-blue); }

/* 口径说明条 */
.q-cal {
  font-size: 11.5px; color: #5b6478; line-height: 1.85;
  background: #f6f9fd; border-left: 3px solid var(--q-blue);
  border-radius: 8px; padding: 9px 13px; margin: 10px 0 14px;
}
.q-cal b { color: #0a0a0a; }
.q-cal code {
  background: #e9eff7; border-radius: 4px; padding: 0 5px;
  font-family: Consolas, Monaco, monospace; font-size: 11px; color: #31445e;
}

/* 来源徽标 */
.q-src {
  display: inline-block; font-size: 11px; color: var(--q-blue);
  background: var(--q-blue-l); border-radius: 20px; padding: 1px 9px;
  margin-right: 6px; white-space: nowrap;
  max-width: 100%; overflow-wrap: anywhere; vertical-align: top;
}
@media (max-width: 620px) {
  .q-src { white-space: normal; border-radius: 10px; }
}
.q-src.ochre { color: var(--q-ochre); background: var(--q-ochre-l); }

/* ------------------------- 分区标题 ------------------------- */
.q-sec { margin: 26px 0 12px; }
.q-sec h2 {
  display: inline-block; margin: 0; font-size: 15px; font-weight: 700;
  color: #16233a; padding-left: 10px; border-left: 3px solid var(--q-blue);
}
.q-sec .note { display: block; margin-top: 6px; font-size: 12px; color: var(--q-mut); line-height: 1.75; }

/* ------------------------- 卡片 ------------------------- */
.q-card {
  background: #fff; border: 1px solid var(--q-line);
  border-radius: 12px; padding: 14px 16px; margin: 12px 0;
}
.q-card > h3 {
  margin: 0 0 10px; font-size: 13.5px; font-weight: 700; color: #16233a;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.q-card > h3 .tag {
  font-size: 11px; font-weight: 500; color: var(--q-mut);
  background: #f2f4f7; border-radius: 20px; padding: 1px 8px;
}

/* ------------------------- KPI ------------------------- */
.q-kpi {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin: 12px 0;
}
.q-k {
  background: #fff; border: 1px solid var(--q-line);
  border-radius: 10px; padding: 11px 13px; min-width: 0;
}
.q-k b {
  display: block; font-size: 19px; letter-spacing: .2px;
  color: var(--q-blue); font-variant-numeric: tabular-nums;
}
.q-k b.up { color: var(--q-up); }
.q-k b.dn { color: var(--q-dn); }
.q-k b.mut { color: #9aa3b2; }
.q-k span { font-size: 11.5px; color: var(--q-mut); line-height: 1.5; }
.q-k i {
  display: block; font-style: normal; font-size: 11px;
  color: #9aa3b2; margin-top: 3px;
}

/* ------------------------- 表格 ------------------------- */
.q-tblwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.q-tbl {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
  background: #fff; font-variant-numeric: tabular-nums;
}
.q-tbl th, .q-tbl td {
  border-bottom: 1px solid var(--q-line); padding: 7px 9px;
  text-align: right; white-space: nowrap;
}
.q-tbl th {
  position: sticky; top: 0; z-index: 2;
  background: #f2f5f9; font-weight: 600; color: #33445c;
  font-size: 12px; text-align: right;
}
.q-tbl th:first-child, .q-tbl td:first-child { text-align: left; }
.q-tbl tbody tr:hover { background: #f8fafd; }
.q-tbl td.up { color: var(--q-up); }
.q-tbl td.dn { color: var(--q-dn); }
.q-tbl td.mut { color: #9aa3b2; }
.q-tbl .name { font-weight: 600; color: #16233a; }
.q-tbl th.sortable { cursor: pointer; user-select: none; }
.q-tbl th.sortable:hover { color: var(--q-blue); }
.q-tbl th .ar { font-style: normal; color: var(--q-blue); margin-left: 3px; }

/* 表内小徽标 */
.q-tbl .chip {
  display: inline-block; min-width: 34px; text-align: center;
  font-size: 11px; border-radius: 5px; padding: 1px 6px;
}

/* ------------------------- 分位热条 ------------------------- */
.q-heat { display: flex; align-items: center; gap: 7px; min-width: 92px; }
.q-heat .bar {
  flex: 1; height: 6px; border-radius: 4px; background: #eef0f3;
  overflow: hidden; position: relative; min-width: 40px;
}
.q-heat .bar i {
  display: block; height: 100%; border-radius: 4px;
  background: var(--q-blue);
}
.q-heat .bar i.hi { background: #e8590c; }
.q-heat .bar i.xh { background: #c92a2a; }
.q-heat .bar i.lo { background: #4c8bf5; }
.q-heat .bar i.xl { background: #1c7ed6; }
.q-heat em {
  font-style: normal; font-size: 11.5px; color: #4a5468;
  min-width: 34px; text-align: right;
}

/* ------------------------- 状态标签 ------------------------- */
.q-tag {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  border-radius: 5px; padding: 2px 7px; white-space: nowrap;
}
.q-tag.on { background: #e7f7f0; color: #087f5b; }
.q-tag.off { background: #f1f3f5; color: #868e96; }
.q-tag.warn { background: #fff4e6; color: #b45309; }
.q-tag.danger { background: #ffe8e8; color: #c92a2a; }
.q-tag.info { background: var(--q-blue-l); color: var(--q-blue); }

/* ------------------------- 网格 ------------------------- */
.q-grid { display: grid; gap: 12px; }
.q-grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.q-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.q-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .q-grid.c3, .q-grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .q-grid.c2, .q-grid.c3, .q-grid.c4 { grid-template-columns: 1fr; }
}
.q-grid > * { min-width: 0; }

/* ------------------------- 四象限矩阵 ------------------------- */
.q-quad {
  position: relative; background: #fff; border: 1px solid var(--q-line);
  border-radius: 12px; padding: 16px; overflow: hidden;
}
.q-quad .plane {
  position: relative; height: 340px; margin: 6px 0 0;
  border-left: 1px solid var(--q-line); border-bottom: 1px solid var(--q-line);
}
.q-quad .plane .vline, .q-quad .plane .hline {
  position: absolute; background: #eef1f5;
}
.q-quad .plane .vline { top: 0; bottom: 0; width: 1px; }
.q-quad .plane .hline { left: 0; right: 0; height: 1px; }
.q-quad .cell {
  position: absolute; font-size: 11px; color: #aab2bf;
  line-height: 1.5; pointer-events: none;
}
.q-quad .dot {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, 50%); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18); cursor: pointer;
}
.q-quad .dot em {
  position: absolute; left: 50%; top: -16px; transform: translateX(-50%);
  font-style: normal; font-size: 10.5px; color: #4a5468; white-space: nowrap;
}
.q-quad .axis { font-size: 11.5px; color: var(--q-mut); }
.q-quad .ax-x { text-align: center; margin-top: 6px; }
.q-quad .ax-y {
  position: absolute; left: -2px; top: 50%; transform: rotate(-90deg) translateX(-50%);
  transform-origin: left center; white-space: nowrap;
}

/* ------------------------- 图表容器 ------------------------- */
.q-chart { width: 100%; height: 300px; }
.q-chart.tall { height: 380px; }
.q-chart.short { height: 220px; }

/* ------------------------- 切换条 ------------------------- */
.q-tabs {
  display: inline-flex; gap: 4px; padding: 4px; background: #f2f3f5;
  border-radius: 12px; overflow-x: auto; scrollbar-width: none; max-width: 100%;
}
.q-tabs::-webkit-scrollbar { display: none; }
.q-tabs button {
  flex: none; border: 0; background: transparent; cursor: pointer;
  padding: 6px 14px; border-radius: 9px; font-size: 13px; font-weight: 600;
  color: #48484a; white-space: nowrap; font-family: inherit;
}
.q-tabs button.on { background: #fff; color: var(--q-blue); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

/* 通用小按钮 */
.q-btn {
  border: 1px solid var(--q-line); background: #fff; color: #33445c;
  border-radius: 8px; padding: 5px 12px; font-size: 12.5px; cursor: pointer;
  font-family: inherit;
}
.q-btn:hover { border-color: var(--q-blue); color: var(--q-blue); }
.q-btn.primary { background: var(--q-blue); border-color: var(--q-blue); color: #fff; }

/* ------------------------- 状态占位 ------------------------- */
.q-empty {
  padding: 26px 16px; text-align: center; color: var(--q-mut);
  font-size: 13px; line-height: 1.8;
  background: #fafbfc; border: 1px dashed var(--q-line); border-radius: 10px;
}
.q-empty b { color: var(--q-blue); }
.q-load { padding: 20px; text-align: center; color: var(--q-mut); font-size: 12.5px; }
.q-load::after { content: '…'; animation: q-blink 1.2s infinite; }
@keyframes q-blink { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

/* 说明小字 */
.q-note { font-size: 11.5px; color: var(--q-mut); line-height: 1.8; margin-top: 8px; }
.q-note b { color: #33445c; }
.q-warn {
  font-size: 12px; color: #8a6100; line-height: 1.8;
  background: #fff9f0; border: 1px solid #f2ddbb; border-radius: 8px;
  padding: 9px 13px; margin: 10px 0;
}
.q-warn b { color: #7a4f00; }

/* 免责 */
.q-foot {
  margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--q-line);
  font-size: 11.5px; color: var(--q-mut); line-height: 1.85;
}

/* ==========================================================================
   手工录入控件（服务「风险状态三温矩阵」等需要用户输入数据的工具）
   ========================================================================== */
.q-form { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .q-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .q-form { grid-template-columns: 1fr; } }
.q-form > * { min-width: 0; }

.q-field { display: flex; flex-direction: column; gap: 4px; }
.q-field label {
  font-size: 11.5px; color: #5b6478; font-weight: 600;
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px;
}
.q-field label em {
  font-style: normal; font-size: 10.5px; font-weight: 500;
  color: var(--q-blue); background: var(--q-blue-l);
  border-radius: 20px; padding: 0 7px; white-space: nowrap;
}
.q-field input[type="number"], .q-field input[type="date"], .q-field input[type="text"] {
  font: inherit; font-size: 13px; color: #16233a;
  border: 1px solid var(--q-line); border-radius: 7px;
  padding: 6px 9px; background: #fff; width: 100%; box-sizing: border-box;
}
.q-field input:focus { outline: none; border-color: var(--q-blue); box-shadow: 0 0 0 2px rgba(39, 84, 140, .1); }
.q-field input.warn { border-color: #f0b26b; background: #fffaf3; }

.q-range { display: flex; align-items: center; gap: 10px; }
.q-range input[type="range"] { flex: 1; min-width: 0; accent-color: var(--q-blue); }
.q-range b { font-size: 12.5px; color: var(--q-blue); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

.q-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* 矩阵四象限（2×2 平面） */
.q-mx { position: relative; padding: 0 0 26px 34px; }
.q-mx .plane {
  position: relative; height: 300px;
  background: #fbfcfe;
  border: 1px solid var(--q-line); border-radius: 8px;
}
.q-mx .plane::before, .q-mx .plane::after {
  content: ''; position: absolute; background: #cdd6e2;
}
.q-mx .plane::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.q-mx .plane::after { top: 50%; left: 0; right: 0; height: 1px; }
.q-mx .zone {
  position: absolute; width: 50%; height: 50%; box-sizing: border-box;
  padding: 6px 9px; font-size: 11px; color: #7c8798; line-height: 1.45;
}
.q-mx .zone.tl { left: 0; top: 0; }
.q-mx .zone.tr { right: 0; top: 0; text-align: right; }
.q-mx .zone.bl { left: 0; bottom: 0; display: flex; align-items: flex-end; }
.q-mx .zone.br { right: 0; bottom: 0; text-align: right; display: flex; align-items: flex-end; justify-content: flex-end; }
.q-mx .zone b { display: block; color: #5b6478; font-size: 11.5px; }
.q-mx .dot, .q-mx .hdot {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  transform: translate(-50%, -50%); box-sizing: border-box;
}
.q-mx .hdot { width: 9px; height: 9px; background: #b9c3d1; border: 1px solid #fff; cursor: help; }
.q-mx .dot {
  width: 15px; height: 15px; background: var(--q-ochre);
  border: 2px solid #fff; box-shadow: 0 0 0 2px var(--q-ochre); z-index: 3;
}
.q-mx .dot em {
  position: absolute; left: 50%; top: -22px; transform: translateX(-50%);
  font-style: normal; font-size: 10.5px; color: #fff; background: var(--q-ochre);
  border-radius: 5px; padding: 1px 6px; white-space: nowrap;
}
.q-mx .ax-y, .q-mx .ax-x { position: absolute; font-size: 11px; color: var(--q-mut); }
.q-mx .ax-y { left: -4px; top: 50%; transform: rotate(-90deg) translateX(-50%); transform-origin: left top; white-space: nowrap; }
.q-mx .ax-x { left: 50%; bottom: 4px; transform: translateX(-50%); white-space: nowrap; }

/* 录入记录小表 */
.q-rec { font-size: 12px; }
.q-rec .del { color: #c92a2a; cursor: pointer; font-size: 11.5px; }
.q-rec .del:hover { text-decoration: underline; }

/* 「当前所在象限」高亮 */
.q-mx .zone.on { background: rgba(180, 83, 9, .07); color: var(--q-ochre); border-radius: 6px; }
.q-mx .zone.on b { color: var(--q-ochre); }

/* 参数调节条（工具页顶部可调参数） */
.q-param { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; }
.q-param .f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.q-param .f label { font-size: 11.5px; color: var(--q-mut); white-space: nowrap; }
.q-param .f label em { font-style: normal; color: var(--q-blue); margin-left: 4px; }
.q-param .f input {
  width: 92px; padding: 6px 9px; border: 1px solid var(--q-line);
  border-radius: 7px; font-size: 12.5px; color: #16233a; background: #fff;
}
.q-param .f input:focus { outline: none; border-color: var(--q-blue); box-shadow: 0 0 0 2px rgba(39, 84, 140, .1); }

/* 可点开的表格行 */
.q-tbl tbody tr.on { background: #fdf4f7; }
.q-tbl tbody tr.on:hover { background: #fbeaf0; }
.q-tbl tbody tr[data-ind], .q-tbl tbody tr[data-idx] { cursor: pointer; }

/* 弹层（遮罩 + 卡片）：用 class 切换，不依赖 hidden 属性 */
.q-mask {
  position: fixed; inset: 0; background: rgba(20, 24, 30, .46); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.q-mask.hide { display: none !important; }
.q-modal {
  background: #fff; border-radius: 12px; width: min(840px, 100%); max-height: 88vh;
  overflow: auto; box-shadow: 0 20px 54px rgba(0, 0, 0, .24); padding: 16px 20px 20px;
}
.q-modal .mh { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.q-modal .mh h3 { font-size: 15px; color: #16233a; margin: 0; }
.q-modal .x { cursor: pointer; color: #98a1af; font-size: 20px; line-height: 1; padding: 0 4px; }
.q-modal .x:hover { color: #c92a2a; }
.q-modal .mb { margin-top: 10px; }

/* 基差页：贴水 / 升水为定价描述而非涨跌，用中性冷暖色，不套红涨绿跌 */
.bs-disc { color: var(--q-ochre); }
.bs-prem { color: var(--q-blue); }
.q-tbl .name em {
  display: block; font-style: normal; font-size: 10.5px;
  color: #9aa3b2; font-weight: 400; margin-top: 1px;
}
.q-tbl tbody tr[data-code] { cursor: pointer; }

