/* ═══════════════════════════════════════
   竞价分时采集 Web版 — 样式
   与 Tkinter 版 UI 布局保持一致
   ═══════════════════════════════════════ */

body {
  font-family: -apple-system, "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f5f5f5;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.left-panel {
  width: 330px;
  min-width: 330px;
  background: #fff;
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.left-panel .panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
}

.right-panel .panel-header {
  padding: 8px 10px;
  border-bottom: 1px solid #dee2e6;
  background: #fafafa;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  row-gap: 6px;
}
/* ★ 2026-10-01：标题栏子项一律不收缩、文字不折行。
   原先是 nowrap flex：尾盘视图的计数标签「(尾盘一 1只 ＋ 尾盘二 1只)」比
   主视图的「(170只)」宽约 110px，flex 会把标题 / 标签按钮 / 右侧链接一起压扁，
   文字在控件内部折成两行（看起来就是表头「变两行」）。
   改为 wrap + 子项 nowrap：宽度不够时整块换到第二行，绝不压字、不断词。 */
.right-panel .panel-header > * { flex-shrink: 0; white-space: nowrap; }
.right-panel .panel-header > #stockCount { margin-left: 4px !important; }
.right-panel .panel-header > a { margin-left: 2px !important; }
.right-panel .panel-header #viewTabs { margin-left: 8px !important; }

.right-panel .panel-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

h1.app-title { margin: 0; }   /* SEO: h1 默认 margin 归零，保持原布局 */

.app-title {
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  padding: 8px 0 2px 0;
  color: #212529;
}

.settings-card {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fff;
}

.settings-card .card-title {
  font-size: 11px;
  font-weight: 600;
  color: #616161;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

.date-row {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-bottom: 4px;
}

.date-row .form-control {
  flex: 1;
  font-size: 13px;
  height: 30px;
  padding: 2px 8px;
}

.date-row .btn {
  font-size: 12px;
  height: 30px;
  padding: 2px 8px;
  white-space: nowrap;
}

.btn-row {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.btn-row .btn {
  font-size: 12px;
  height: 30px;
  padding: 2px 10px;
}

.collect-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.collect-row label {
  font-size: 12px;
  margin: 0;
  white-space: nowrap;
}

.collect-row .form-control-sm {
  width: 60px;
  font-size: 12px;
  height: 28px;
}

.collect-row .btn {
  font-size: 12px;
  height: 30px;
  padding: 2px 10px;
}

.progress-area {
  margin: 6px 0;
}

.progress-text {
  font-size: 11px;
  color: #616161;
  text-align: center;
}

.progress {
  height: 8px;
  margin-top: 2px;
}

.log-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log-area {
  flex: 1;
  background: #1e1e1e;
  color: #d4d4d4;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 4px;
  overflow-y: auto;
  min-height: 180px;
  max-height: 300px;
  line-height: 1.5;
}

.log-area .log-entry {
  white-space: pre-wrap;
  word-break: break-all;
}

.log-area .log-time {
  color: #6a9955;
}

#stockTable {
  font-size: 12px;
  width: 100% !important;
}

.table-container {
  flex: 1;
  overflow-y: auto;
}

#stockTable thead th {
  background: #f0f0f0;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

#stockTable thead th.sorting:after,
#stockTable thead th.sorting_asc:after,
#stockTable thead th.sorting_desc:after {
  position: absolute;
  right: 4px;
  font-size: 10px;
}

#stockTable tbody td {
  padding: 3px 6px;
  vertical-align: middle;
  font-size: 12px;
}

/* 名称列：防止折行 */
#stockTable tbody td:nth-child(3) {
  white-space: nowrap;
  min-width: 76px;
}

/* 形态列：迷你分时图 + 文字 */
#stockTable tbody td:nth-child(14) {
  white-space: nowrap;
  text-align: center;
  min-width: 90px;
}

.up { color: #d32f2f !important; }
.down { color: #2e7d32 !important; }

.typeA { background-color: #fff0f0 !important; }
.typeB { background-color: #f0fff0 !important; }
.typeC { background-color: #fff8e1 !important; }
.typeD { background-color: #f3e5f5 !important; }
.typeE { background-color: #e3f2fd !important; }
.typeF { background-color: #eceff1 !important; }
.typeG { background-color: #fff3e0 !important; }
.morph-qiao { color: #d32f2f !important; font-weight: bold !important; }

.score-high { color: #d32f2f; font-weight: bold; }
.score-mid { color: #e65100; }
.score-low { color: #9e9e9e; }

/* 行点击高亮（联动选中） */
#stockTable tbody tr.row-active {
  background-color: #bbdefb !important;
  outline: 1px solid #1976d2;
}
#stockTable tbody tr.row-active td {
  background-color: transparent !important;
}

.status-bar {
  padding: 4px 12px;
  background: #fafafa;
  border-top: 1px solid #dee2e6;
  font-size: 11px;
  color: #9e9e9e;
  display: flex;
  align-items: center;
  gap: 12px;
}

.calendar-popup {
  position: fixed;
  z-index: 10000;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 12px;
  width: 310px;
}

.calendar-popup .cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.calendar-popup .cal-header select {
  font-size: 13px;
  padding: 2px 4px;
  margin: 0 2px;
}

.calendar-popup .cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: bold;
  color: #9e9e9e;
  margin-bottom: 4px;
}

.calendar-popup .cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.calendar-popup .cal-day {
  text-align: center;
  padding: 4px 2px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  border: none;
  background: none;
}

.calendar-popup .cal-day:hover {
  background: #e3f2fd;
}

.calendar-popup .cal-day.holiday {
  background: #e53935;
  color: #fff;
}

.calendar-popup .cal-day.workday {
  background: #ff9800;
  color: #fff;
}

.calendar-popup .cal-day.weekend {
  color: #9e9e9e;
}

.calendar-popup .cal-day.today {
  color: #1565c0;
  font-weight: bold;
}

.calendar-popup .cal-day.selected {
  background: #bbdefb;
}

.calendar-popup .cal-legend {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 10px;
  color: #616161;
}

.calendar-popup .cal-legend span { display: flex; align-items: center; gap: 2px; }

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-idle { background: #4caf50; }
.status-loading { background: #ff9800; animation: pulse 1s infinite; }
.status-collecting { background: #2196f3; animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.left-panel .panel-body::-webkit-scrollbar,
.right-panel .panel-body::-webkit-scrollbar,
.log-area::-webkit-scrollbar {
  width: 6px;
}

.left-panel .panel-body::-webkit-scrollbar-thumb,
.right-panel .panel-body::-webkit-scrollbar-thumb,
.log-area::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

@media (max-width: 768px) {
  .left-panel { width: 100%; min-width: 100%; border-right: none; border-bottom: 1px solid #dee2e6; }
  .app-container { flex-direction: column; }
}

/* ───── 分时图悬浮浮层（echarts 三图纵向排列）───── */
.hover-chart-panel {
  display: none;
  position: fixed;
  z-index: 10000;
  width: 680px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  overflow: hidden;
  pointer-events: auto;
}
.hover-chart-panel.active {
  display: block;
}
.hover-chart-title {
  padding: 6px 12px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  font-size: 13px;
  color: #c9d1d9;
  white-space: nowrap;
}
.hover-chart-body {
  display: flex;
  flex-direction: column;
  height: 440px;
}
.hover-chart-row {
  flex-shrink: 0;
  overflow: hidden;
}
.hover-chart-main {
  flex: 3;
  min-height: 0;
}
.hover-chart-sub {
  flex: 1;
  min-height: 0;
}
.hover-chart-container {
  width: 100%;
  height: 100%;
}

/* ═══ 登录弹窗 ═══ */
#loginOverlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-modal {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.login-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 24px;
}
.login-buttons button {
  height: 48px;
  font-size: 16px;
}
#loginError {
  color: #dc3545;
  display: none;
  margin-top: 8px;
  text-align: center;
  font-size: 14px;
}

/* 登录表单 */
.login-form {
  text-align: left;
}
.login-form .form-control-lg {
  height: 48px;
  font-size: 16px;
}
.login-error {
  color: #dc3545;
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
}
#guestLink:hover {
  text-decoration: underline !important;
}

/* 免责声明 */
.disclaimer-box {
  margin: 10px 12px 8px;
  padding: 10px 14px;
  font-size: 11px;
  line-height: 1.6;
  color: #c62828;
  background: linear-gradient(135deg, #fff5f5 0%, #ffeaea 100%);
  border: 1px solid #ef9a9a;
  border-left: 4px solid #e53935;
  border-radius: 6px;
  opacity: 0.85;
}

/* 入群邀请 */

.beta-apply {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(135deg, #667eea11, #764ba211);
  border: 1px solid #667eea44;
  border-radius: 10px;
  margin-bottom: 8px;
}

.group-invite {
  margin: 6px 12px 10px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 1px solid #90caf9;
  border-radius: 8px;
  font-size: 12px;
}
.group-text {
  color: #1565c0;
  font-weight: 500;
}
.group-btn {
  display: inline-block;
  padding: 4px 14px;
  background: linear-gradient(135deg, #1565c0, #1976d2);
  color: #fff;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.group-btn:hover {
  background: linear-gradient(135deg, #0d47a1, #1565c0);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(21,101,192,.3);
}

/* 二维码弹窗 */
.qr-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .2s ease;
}
.qr-modal {
  background: #fff;
  border-radius: 14px;
  padding: 28px 32px 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  position: sticky;
  top: 0;
  z-index: 10;
  max-width: 320px;
  animation: scaleIn .25s ease;
}
.qr-close {
  position: absolute;
  top: 8px;
  right: 14px;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  transition: color .2s;
}
.qr-close:hover { color: #333; }
.qr-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 16px;
}
.qr-image {
  width: 220px;
  height: auto;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  object-fit: contain;
  background: #fff;
}
.qr-hint {
  margin-top: 12px;
  font-size: 12px;
  color: #888;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes scaleIn { from { transform: scale(.85); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* ───── 2026 交割日历嵌入 ───── */
.cal-embed-wrap { margin: 0 12px; }
.cal-embed-title { font-size: 12px; font-weight: 600; color: #2e7d32; margin-bottom: 4px; }
.cal-embed-box { position: relative; overflow: hidden; border-radius: 8px; height: 286px; background: #e8f5e9; }
.cal-embed-box iframe { position: absolute; top: 0; left: 0; width: 500px; height: 500px; border: 0;
  transform-origin: top left; transform: scale(0.572); }

/* ───── 视图标签（主力评分 / 红星第一 / 虎符第一）───── */
.vt-btn { padding: 2px 7px; font-size: 12px; border-radius: 12px; border: 1px solid #90caf9;
  background: #fff; color: #1565c0; cursor: pointer; transition: all .15s; }
.vt-btn:hover { background: #e3f2fd; }
.vt-btn.vt-active { background: #1565c0; border-color: #1565c0; color: #fff; font-weight: 500; }
.vt-btn.vt-locked { background: #f5f5f5; border-color: #e0e0e0; color: #b0bec5; cursor: not-allowed; }
.vt-btn.vt-locked:hover { background: #f5f5f5; }
.vt-btn.vt-locked::after { content: " \1F512"; font-size: 10px; }
/* ★ 2026-09-28：标签带「公开内容区」（如回测报告）时，右侧面板整体滚动，
   数据表给一个上限高度，回测报告接在它下面 */
.right-panel .panel-body.has-embed { overflow-y: auto; }
/* ★ 2026-09-27：数据区（尾盘一/尾盘二 两行结果；未授权时是提示条）钉在面板顶部，
   不随下方回测页滚走。#viewDenied 与 .table-container 互斥，可共用 top:0 */
.right-panel .panel-body.has-embed .table-container,
.right-panel .panel-body.has-embed #viewDenied {
  position: sticky; top: 0; z-index: 6;
  flex: none; max-height: 58vh; overflow-y: auto;
  background: #fff;
  box-shadow: 0 4px 8px -4px rgba(16,24,40,.12);
}
#viewEmbed iframe { display: block; }
tr.rank1 td { background: #fff8e1 !important; font-weight: 500; }

/* ══════════════════════════════════════════════════════════════════════
   ★ 2026-10-08 「上一交易日」区块（尾盘 / 黄金：今日数据下方追加）
   目的：一眼分辨「今日」与「上一交易日」—— 分隔标题条 + 子表头 + 灰底行
   ══════════════════════════════════════════════════════════════════════ */
#stockTable tbody tr.row-sep td {
  background: #e8eef5 !important;
  color: #37474f;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
  text-align: left;
  padding: 6px 8px;
  border-top: 2px solid #90a4ae;
  border-bottom: 1px solid #cfd8dc;
}
#stockTable tbody tr.row-subhead td {
  background: #f4f7fa !important;
  color: #607d8b;
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid #e0e6ea;
  white-space: nowrap;
}
#stockTable tbody tr.row-prev td {
  background: #fafbfc !important;
  color: #78909c;
}
#stockTable tbody tr.row-prev:hover td {
  background: #f0f4f8 !important;
}


/* ★ 2026-10-18 并排双入口：左=加群，右=申请试用 */
.dual-entry {
  display: flex;
  gap: 10px;
  margin: 6px 12px 10px;
}
.dual-cell {
  flex: 1 1 50%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
  border: 1px solid #90caf9;
}
.dual-cell:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(21,101,192,.18); }
.dual-cell:active { transform: translateY(0); }
.dual-ico { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.dual-txt { font-size: 12px; font-weight: 600; color: #0d47a1; line-height: 1.25; }
.dual-apply {
  background: linear-gradient(135deg, #667eea11, #764ba211);
  border-color: #667eea66;
}
.dual-apply .dual-txt { color: #534AB7; }
