/* ============================================================
   实时挂单模块（market.html #orders）
   风格沿用平台设计变量：品牌红 --c-brand-*、绿 --c-green-*
   盘口配色遵循国内行情惯例：买方红色、卖方绿色
   ============================================================ */

.card-like {
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---------- 摘要条 ---------- */
.ord-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.ord-stat {
  background: var(--c-bg);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ord-stat > span {
  font-size: 12px;
  color: var(--c-muted);
  white-space: nowrap;
}
.ord-stat > b {
  font-size: 19px;
  font-weight: 700;
  color: var(--c-ink);
  line-height: 1.2;
  white-space: normal;
  word-break: break-all;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ord-stat > b em {
  font-style: normal;
  font-size: 24px;
}
.ord-stat > i {
  font-style: normal;
  font-size: 12px;
  color: var(--c-muted);
  white-space: normal;
  word-break: break-all;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ord-stat--main > b em.up { color: var(--c-brand-500); }
.ord-stat--main > b em.down { color: var(--c-green-600); }
.ord-stat--main > i.up { color: var(--c-brand-500); font-weight: 600; }
.ord-stat--main > i.down { color: var(--c-green-600); font-weight: 600; }
.ord-stat--buy > b, .ord-stat--buy > i { color: var(--c-brand-500); }
.ord-stat--sell > b, .ord-stat--sell > i { color: var(--c-green-600); }

/* ---------- 主面板：盘口 + 挂单明细 ---------- */
.ord-board {
  display: flex;
  gap: 22px;
  align-items: stretch;
}
.ord-depth {
  flex: 0 0 340px;
  padding: 18px 16px 10px;
}
.ord-depth h4,
.ord-list h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--c-ink-2);
}
.ord-list {
  flex: 1 1 0;
  min-width: 0;
  padding: 16px 18px 12px;
  display: flex;
  flex-direction: column;
}

/* 工具条 */
.ord-list__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.ord-tabs {
  display: flex;
  gap: 8px;
}
.ord-tab {
  border: 1px solid var(--c-line);
  background: var(--c-bg-soft);
  color: var(--c-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease;
  font-family: inherit;
}
.ord-tab:hover { border-color: var(--c-brand-300); color: var(--c-ink); }
.ord-tab.is-active[data-side="buy"] {
  background: var(--c-brand-500);
  border-color: var(--c-brand-500);
  color: #fff;
}
.ord-tab.is-active[data-side="sell"] {
  background: var(--c-green-600);
  border-color: var(--c-green-600);
  color: #fff;
}
.ord-dates {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ord-date {
  border: 1px solid var(--c-line);
  background: var(--c-bg);
  color: var(--c-muted);
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.16s ease;
}
.ord-date:hover { border-color: var(--c-brand-300); color: var(--c-ink); }
.ord-date.is-active {
  border-color: var(--c-brand-500);
  color: var(--c-brand-500);
  font-weight: 700;
  background: var(--c-brand-050);
}
.ord-search {
  margin-left: auto;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  width: 220px;
  font-family: inherit;
  color: var(--c-ink);
  background: var(--c-bg-soft);
}
.ord-search:focus {
  outline: none;
  border-color: var(--c-brand-300);
  background: var(--c-bg);
}

/* 表格 */
.ord-table-wrap {
  overflow: auto;
  flex: 1 1 0;
  max-height: 560px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
}
.ord-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.ord-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--c-bg-soft);
  color: var(--c-muted);
  font-weight: 600;
  font-size: 11.5px;
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--c-line);
  white-space: nowrap;
}
.ord-table thead th.num { text-align: right; }
.ord-table thead th.sortable { cursor: pointer; user-select: none; }
.ord-table thead th.sortable:hover { color: var(--c-brand-500); }
.ord-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--c-bg-soft);
  color: var(--c-ink-2);
  vertical-align: top;
}
.ord-table tbody td:nth-child(4) { white-space: nowrap; }
.ord-table tbody tr:hover { background: var(--c-brand-050); }
.ord-table tbody td.num { text-align: right; white-space: nowrap; }
.ord-table tbody td.td-company { color: var(--c-ink); font-weight: 600; min-width: 170px; }
.ord-table tbody td.td-parent { color: var(--c-muted); min-width: 140px; }
.ord-table tbody td .ord-price--buy { color: var(--c-brand-500); font-weight: 700; }
.ord-table tbody td .ord-price--sell { color: var(--c-green-600); font-weight: 700; }
.ord-table tbody td .ord-qty { font-weight: 600; font-variant-numeric: tabular-nums; }
.ord-tag {
  display: inline-block;
  font-size: 11px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  padding: 1px 7px;
  color: var(--c-muted);
  background: var(--c-bg-soft);
  white-space: nowrap;
}
.ord-empty { text-align: center; color: var(--c-muted); padding: 30px 0 !important; }
.ord-note {
  margin: 10px 2px 4px;
  font-size: 12px;
  color: var(--c-muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .ord-stats { grid-template-columns: repeat(3, 1fr); }
  .ord-board { flex-direction: column; }
  .ord-board > *, .ord-bars, .ord-list { min-width: 0; }
  .ord-depth { flex: none; }
}
@media (max-width: 640px) {
  .ord-stats { grid-template-columns: repeat(2, 1fr); }
  .ord-search { width: 100%; margin-left: 0; }
  .ord-table thead th:nth-child(3),
  .ord-table tbody td:nth-child(3) { display: none; }
}

/* ---------- 企业名称悬浮趋势窗 + 更早日期下拉 ---------- */
.ord-co { cursor: help; border-bottom: 1px dotted rgba(192, 36, 52, .45); }
.ord-co:hover { color: var(--c-brand-600, #c02434); }

.ord-date-more {
  border: 1px solid var(--c-line, #e8e0dc);
  border-radius: 999px;
  background: var(--c-bg, #fff);
  color: var(--c-ink-2, #5c534f);
  font-size: 12.5px;
  padding: 6px 10px;
  cursor: pointer;
  max-width: 118px;
}
.ord-date-more:hover, .ord-date-more:focus {
  border-color: var(--c-brand-300, #d9848d);
  color: var(--c-brand-600, #c02434);
  outline: none;
}

.ord-co-tip {
  position: fixed;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 16px);
  background: #fff;
  border: 1px solid var(--c-line, #e8e0dc);
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(30, 20, 18, .16);
  padding: 12px 14px 10px;
  pointer-events: none;
}
/* 触摸模式（点按弹出）：允许与悬浮窗交互（看图表、点关闭） */
.ord-co-tip.is-pinned { pointer-events: auto; }
.ord-co-tip__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #f0f2f5;
  color: #5b6675;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.ord-co-tip__close:active { background: #e2e6ea; }
.ord-co-tip__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.ord-co-tip__head b {
  font-size: 13.5px;
  color: var(--c-ink, #231a16);
  word-break: break-all;
}
.ord-co-tip__head span {
  font-size: 11.5px;
  color: var(--c-muted, #8a7f78);
  white-space: nowrap;
}
.ord-co-tip__chart { width: 100%; height: 208px; }
.ord-co-tip__empty {
  margin: 0;
  padding: 32px 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--c-muted, #8a7f78);
}

/* ---------- 排行图左侧企业名覆盖层（悬停看月度趋势） ---------- */
.ord-bars-chart { position: relative; }
.ord-bars-names {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 200px;
  pointer-events: none;
  z-index: 5;
}
.ord-bar-name {
  position: absolute;
  left: 10px;
  transform: translateY(-50%);
  max-width: 186px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  color: #44505f;
  line-height: 1.4;
  cursor: help;
  pointer-events: auto;
  border-bottom: 1px dotted transparent;
}
.ord-bar-name:hover {
  color: var(--c-brand-600, #c02434);
  border-bottom-color: rgba(192, 36, 52, .4);
}

.ord-co-tip__recent {
  font-size: 11.5px;
  color: var(--c-ink-2, #5c534f);
  margin: -2px 0 6px;
}
.ord-co-tip__recent b { color: var(--c-brand-600, #c02434); }
