:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --purple: #7c3aed;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif; }
.page { max-width: 1600px; margin: 0 auto; padding: 24px; }
.header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 16px; }
h1 { margin: 0 0 8px; font-size: 26px; }
.subtitle { margin: 0; color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.date-box { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.date-box input, .search { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; font-size: 14px; }
.button { border: 0; border-radius: 10px; padding: 11px 14px; cursor: pointer; font-weight: 600; }
.primary { background: var(--blue); color: #fff; }
.secondary { background: #e0e7ff; color: #1e40af; }
.status-line { display: flex; gap: 10px; align-items: center; margin: 12px 0 18px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 6px 10px; background: #dbeafe; color: #1d4ed8; font-weight: 700; font-size: 13px; }
.badge.muted { background: #f3f4f6; color: #374151; }
.badge.live { background: #dcfce7; color: #166534; }
.badge.closed { background: #fee2e2; color: #991b1b; }
.note { color: var(--muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card .label { color: var(--muted); font-size: 13px; }
.card .value { margin-top: 6px; font-size: 24px; font-weight: 800; }
.filters { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #374151; padding: 8px 12px; cursor: pointer; }
.tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.search { min-width: 280px; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: auto; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
table { border-collapse: collapse; width: 100%; min-width: 1450px; }
th, td { border-bottom: 1px solid var(--line); padding: 10px 12px; vertical-align: top; font-size: 13px; }
th { text-align: left; background: #f9fafb; color: #374151; position: sticky; top: 0; z-index: 1; }
tr:hover td { background: #f8fafc; }
.stock-name { font-weight: 800; }
.code { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.hot { font-weight: 800; color: var(--blue); }
.money-line { white-space: nowrap; }
.pos { color: var(--red); font-weight: 700; }
.neg { color: var(--green); font-weight: 700; }
.pill { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: 12px; margin: 1px; background: #f3f4f6; color: #374151; }
.pill.active { background: #dcfce7; color: #166534; }
.pill.triggered { background: #fee2e2; color: #991b1b; }
.pill.invalid { background: #ffedd5; color: #9a3412; }
.pill.filled { background: #ede9fe; color: #5b21b6; }
.empty { padding: 36px; text-align: center; color: var(--muted); }
.hidden { display: none; }
@media (max-width: 1100px) {
  .header, .filters { flex-direction: column; align-items: stretch; }
  .cards { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .search { min-width: 100%; }
}

.rank-time { font-weight: 700; color: #374151; white-space: nowrap; }
.finance-cell { white-space: nowrap; line-height: 1.45; }
.finance-yoy { font-weight: 800; }
.finance-amount { color: var(--text); }
.gap-stats { display: inline-block; min-width: 104px; padding: 7px 10px; border-radius: 10px; background: #f8fafc; border: 1px solid #e2e8f0; color: #334155; line-height: 1.65; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; box-shadow: inset 0 1px 0 rgba(255,255,255,.8); }

.gap-stats div:first-child { font-weight: 700; color: #1e293b; }

.gap-stats div:last-child { color: #475569; }

.remaining-badge { display: inline-flex; align-items: center; width: fit-content; margin-top: 3px; padding: 3px 8px; border-radius: 8px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-weight: 700; }


/* v28 UI tweaks */
.date-panel { display: flex; flex-direction: column; gap: 6px; }
.date-nav { display: flex; gap: 8px; justify-content: center; }
.nav-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #374151;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.nav-button:hover { background: #f8fafc; }

.gap-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 142px;
  line-height: 1.2;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.gap-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 4px 7px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.gap-chip.total { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.gap-chip.active { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.gap-chip.triggered { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.gap-chip.invalid { background: #ffedd5; border-color: #fed7aa; color: #9a3412; }
.gap-chip.filled { background: #ede9fe; border-color: #ddd6fe; color: #5b21b6; }

.remaining-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 3px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-weight: 800;
}

/* v29 UI polish */
.toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}
.date-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.date-main-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.toolbar .compact-button,
.toolbar > .button {
  height: 42px;
  min-width: 58px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 42px;
}
.date-box input {
  height: 42px;
  min-width: 160px;
  padding: 8px 12px;
  border-radius: 12px;
}
.date-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.nav-button {
  height: 28px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-size: 15px;
  font-weight: 400;
}
.nav-button:hover { background: #f8fafc; }

.gap-stats {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  line-height: 1.2;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.gap-stat-row {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}
.gap-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 3px 7px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 400;
  box-shadow: none;
}
.gap-chip.total { background: #f8fbff; border-color: #dbeafe; color: #2563eb; }
.gap-chip.active { background: #f7fef9; border-color: #dcfce7; color: #15803d; }
.gap-chip.triggered { background: #fffafa; border-color: #fee2e2; color: #dc2626; }
.gap-chip.invalid { background: #fffaf5; border-color: #ffedd5; color: #ea580c; }
.gap-chip.filled { background: #fbfaff; border-color: #ede9fe; color: #7c3aed; }



/* v30 date toolbar polish */
.toolbar {
  align-items: center;
}

.date-box {
  justify-content: center;
}

.date-box input {
  height: 44px;
}

#prevDayBtn,
#nextDayBtn {
  min-width: 46px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 24px;
  line-height: 1;
  font-weight: 500;
}

#refreshBtn,
#todayBtn {
  min-height: 44px;
}
