:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #172338;
  --muted: #66758d;
  --line: #dce3ef;
  --accent: #0f6dff;
  --up: #d93025;
  --down: #1f9d55;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top right, #e9f0ff 0%, var(--bg) 40%, #f7f9ff 100%);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.view-pane {
  height: 100vh;
}

.home-view-pane {
  background: #ffffff;
}

.home-view {
  position: relative;
  min-height: 100%;
  display: flex;
  align-items: center;
  flex-direction: column;
  padding: 17vh 20px 70px;
  overflow: hidden;
}

.home-view::before,
.home-view::after {
  display: none;
}

.home-card {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 34px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.home-logo {
  width: min(600px, 86vw);
  max-height: 190px;
  object-fit: contain;
}

.home-enter-btn {
  border: none;
  border-radius: 10px;
  min-width: 138px;
  height: 46px;
  padding: 0 30px;
  background: #4e6ef2;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(78, 110, 242, 0.22);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.home-enter-btn:hover,
.home-enter-btn:focus-visible {
  background: #4662d9;
  box-shadow: 0 8px 20px rgba(78, 110, 242, 0.28);
  transform: translateY(-1px);
  outline: none;
}

.home-footer {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 18px;
  text-align: center;
  padding: 0 14px;
}

.home-footer a {
  color: #5f7291;
  font-size: 12px;
  text-decoration: none;
}

.home-footer a:hover {
  color: #335ca8;
  text-decoration: underline;
}

.auth-modal {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(3px);
}

.auth-modal.is-collapsed {
  display: none;
}

.auth-card {
  width: min(380px, calc(100vw - 44px));
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
  padding: 26px 24px 22px;
}

.auth-card h2 {
  margin: 0;
  color: #172338;
  font-size: 20px;
}

.auth-card p {
  margin: 10px 0 0;
  color: #66758d;
  font-size: 14px;
  line-height: 1.6;
}

.auth-code-input {
  width: 100%;
  height: 44px;
  margin-top: 18px;
  border: 1px solid #cfd7e6;
  border-radius: 10px;
  padding: 0 12px;
  color: #172338;
  font-size: 16px;
  outline: none;
}

.auth-code-input:focus {
  border-color: #4e6ef2;
  box-shadow: 0 0 0 3px rgba(78, 110, 242, 0.12);
}

.auth-error {
  min-height: 20px;
  color: #d93025 !important;
  font-size: 13px !important;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.auth-btn {
  height: 38px;
  min-width: 82px;
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.auth-btn:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.auth-btn-secondary {
  background: #ffffff;
  border-color: #d8deea;
  color: #516176;
}

.auth-btn-primary {
  background: #4e6ef2;
  color: #ffffff;
}

.auth-btn-primary:hover:not(:disabled),
.auth-btn-primary:focus-visible {
  background: #4662d9;
}

@media (max-width: 640px) {
  .home-view {
    padding-top: 20vh;
  }

  .home-card {
    gap: 26px;
  }

  .home-logo {
    width: min(440px, 88vw);
  }

  .home-enter-btn {
    min-width: 118px;
    padding: 0 14px;
    font-size: 15px;
  }
}

.page-mode-switch {
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 80;
}

.mode-select {
  border: 1px solid #cfdcf6;
  background: rgba(255, 255, 255, 0.9);
  color: #2d456c;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  backdrop-filter: blur(6px);
}

.sector-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 54px 12px 12px;
}

.sector-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #d9e5f7;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(5px);
}

.sector-header h2 {
  margin: 0;
  font-size: 18px;
  color: #213853;
}

.sector-header p {
  margin: 0;
  color: #5f7291;
  font-size: 12px;
}

.sector-history-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 28px;
}

.sector-history-modal.is-hidden {
  display: none;
}

.sector-history-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 112, 87, 0.14), transparent 30%),
    rgba(18, 33, 55, 0.38);
  backdrop-filter: blur(6px);
}

.sector-history-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 40px));
  max-height: min(680px, calc(100vh - 56px));
  border: 1px solid rgba(218, 229, 247, 0.94);
  border-radius: 20px;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 112, 87, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 249, 255, 0.96));
  padding: 14px;
  box-shadow: 0 26px 70px rgba(21, 38, 64, 0.28);
  overflow: hidden;
}

.sector-history-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.sector-history-head h3 {
  margin: 0;
  color: #213853;
  font-size: 15px;
}

.sector-history-head p {
  margin: 3px 0 0;
  color: #657899;
  font-size: 12px;
}

.sector-history-close {
  border: 1px solid #d2def2;
  border-radius: 999px;
  background: #ffffff;
  color: #355174;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.sector-history-chart {
  min-height: 260px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  padding: 10px;
  overflow: hidden;
}

.sector-history-chart svg {
  width: 100%;
  height: min(42vh, 360px);
  min-height: 240px;
  display: block;
}

.sector-history-grid {
  stroke: rgba(116, 135, 165, 0.2);
  stroke-width: 1;
}

.sector-history-zero {
  stroke: rgba(55, 75, 104, 0.42);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}

.sector-history-axis-label,
.sector-history-date-label {
  fill: #70819c;
  font-size: 11px;
}

.sector-history-area {
  fill: rgba(224, 68, 54, 0.08);
  stroke: none;
}

.sector-history-line {
  fill: none;
  stroke: #d84a3a;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sector-history-point {
  stroke: #ffffff;
  stroke-width: 1.5;
}

.sector-history-point.is-up {
  fill: #d84a3a;
}

.sector-history-point.is-down {
  fill: #1f9f68;
}

.sector-history-message {
  margin: 0;
  min-height: 260px;
  display: grid;
  place-items: center;
  color: #657899;
  font-size: 13px;
}

.sector-history-message.is-error {
  color: #b0443a;
}

.sector-panels {
  margin-top: 10px;
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(280px, 1fr);
}

.sector-panel {
  min-width: 0;
  border: 1px solid #dbe6f9;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f1f6ff 100%);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
}

.sector-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 6px;
}

.sector-panel-header h3 {
  margin: 0;
  font-size: 14px;
  color: #2a4568;
}

.sector-count-tag {
  min-width: 34px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e9f0ff;
  color: #325aa2;
  font-size: 12px;
}

.sector-board-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.44);
  padding: 8px;
}

.sector-board-scroll {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.sector-board-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sector-board {
  position: relative;
}

.sector-tile {
  position: absolute;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 14px rgba(16, 33, 62, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  padding: 8px;
  color: #1f3250;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, outline-color 0.16s ease;
}

.sector-tile:hover,
.sector-tile:focus-visible,
.sector-tile.is-selected {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 10px 20px rgba(16, 33, 62, 0.18);
  outline: 2px solid rgba(47, 94, 176, 0.38);
  outline-offset: 2px;
}

.sector-tile .tile-name {
  font-weight: 600;
  line-height: 1.2;
  word-break: break-all;
}

.sector-tile .tile-zf {
  font-weight: 700;
  letter-spacing: 0.2px;
}

.backtest-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 54px 12px 12px;
  gap: 10px;
}

.backtest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #d9e5f7;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
}

.backtest-title h2 {
  margin: 0;
  font-size: 18px;
  color: #213853;
}

.backtest-title p {
  margin: 3px 0 0;
  color: #5f7291;
  font-size: 12px;
}

.backtest-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 min(430px, 48vw);
}

.backtest-code-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 1px solid #d5e1f6;
  border-radius: 10px;
  background: #fbfdff;
  color: #233852;
  padding: 0 11px;
  font-size: 13px;
}

.backtest-code-input:focus {
  outline: none;
  border-color: #b9d0ff;
  box-shadow: 0 0 0 3px rgba(15, 109, 255, 0.1);
}

.backtest-load-btn,
.backtest-run-btn {
  border: 1px solid #c6d9ff;
  background: #eff5ff;
  color: #335ca8;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.backtest-load-btn {
  height: 34px;
  padding: 0 14px;
  flex-shrink: 0;
}

.backtest-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 10px;
}

.backtest-score-panel,
.backtest-chart-panel {
  min-height: 0;
  border: 1px solid #dbe6f9;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(23, 35, 56, 0.05);
}

.backtest-score-panel {
  display: flex;
  flex-direction: column;
  padding: 12px;
  overflow: hidden;
}

.backtest-score-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5edf9;
}

.backtest-score-head span {
  color: #2d456c;
  font-size: 13px;
  line-height: 1.35;
}

.backtest-score-head strong {
  color: #0f4fa8;
  white-space: nowrap;
  font-size: 16px;
}

.backtest-status,
.backtest-score-reason {
  margin: 8px 0;
  color: #6a7a95;
  font-size: 12px;
  line-height: 1.45;
}

.backtest-score-reason {
  margin-top: 10px;
  color: #8a5b1f;
}

.backtest-score-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-right: 2px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.backtest-score-grid::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.backtest-score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #edf2fb;
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfdff 0%, #f7faff 100%);
}

.backtest-score-item span {
  color: #516685;
  font-size: 12px;
}

.backtest-score-item strong {
  color: #263b5b;
  font-size: 12px;
  white-space: nowrap;
}

.backtest-chart-panel {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

.backtest-chart-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.backtest-chart-top h3 {
  margin: 0;
  color: #213853;
  font-size: 15px;
}

.backtest-chart-top p {
  margin: 3px 0 0;
  color: #6a7a95;
  font-size: 12px;
}

.backtest-chart-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

#backtest-chart {
  width: 100%;
  height: 100%;
  min-height: 420px;
  display: block;
}

.backtest-run-btn {
  position: absolute;
  z-index: 4;
  min-width: 78px;
  padding: 6px 10px;
  background: #173f70;
  border-color: #244a7c;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(23, 63, 112, 0.24);
  transform: translate(-50%, 0);
}

.backtest-run-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.backtest-range-row {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: #6a7a95;
  font-size: 11px;
}

.backtest-range {
  width: 100%;
  accent-color: #0f6dff;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f9fbff 0%, #f2f5fc 100%);
  padding: 56px 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  min-height: 0;
}

.sidebar,
.content,
.content-body,
.scoring-lists,
.stock-list {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.sidebar::-webkit-scrollbar,
.content::-webkit-scrollbar,
.content-body::-webkit-scrollbar,
.scoring-lists::-webkit-scrollbar,
.stock-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar-header h1 {
  margin: 0;
  font-size: 22px;
}

.sidebar-header p {
  margin: 6px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.data-source-tag {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3ff;
  color: #2f4f93;
  font-size: 12px;
}

.stock-group {
  background: #ffffff;
  border: 1px solid #e1e8f5;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  min-height: 62px;
}

.stock-group.expanded {
  flex: 1;
  min-height: 0;
}

.group-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.scoring-title-row {
  min-height: 56px;
  align-items: flex-start;
}

.watchlist-title-row {
  min-height: 50px;
  align-items: flex-start;
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.group-actions-scoring {
  align-items: flex-start;
}

.group-actions-watchlist {
  align-items: flex-start;
}

.group-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.group-title-row h3 {
  margin: 0;
  font-size: 14px;
}

.group-count {
  min-width: 26px;
  text-align: center;
  padding: 2px 8px;
  background: #eef4ff;
  color: #365ca8;
  border-radius: 999px;
  font-size: 12px;
}

.group-updated-at {
  color: #7b8ca8;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.group-toggle {
  border: 1px solid #d6e1f7;
  background: #f7faff;
  color: #4f648a;
  border-radius: 8px;
  font-size: 12px;
  padding: 3px 8px;
  cursor: pointer;
}

.group-toggle.active {
  border-color: #bfd4ff;
  background: #edf4ff;
  color: #2a4f94;
}

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

.watchlist-search-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d9e5fa;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 12px;
  color: #233852;
  background: #fbfdff;
}

.watchlist-search-input:focus {
  outline: none;
  border-color: #b9d0ff;
  box-shadow: 0 0 0 3px rgba(15, 109, 255, 0.1);
}

.watchlist-search-btn {
  border: 1px solid #c6d9ff;
  background: #eff5ff;
  color: #335ca8;
  border-radius: 9px;
  font-size: 12px;
  padding: 8px 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.watchlist-search-status {
  margin: 0 2px 8px;
  min-height: 18px;
  color: #7b8ca8;
  font-size: 11px;
  line-height: 1.4;
}

.watchlist-search-status[data-tone="success"] {
  color: #19724f;
}

.watchlist-search-status[data-tone="error"] {
  color: #bf3f36;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 6px;
  margin-bottom: 8px;
}

.filter-row label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: #6880a8;
}

.filter-row input {
  width: 100%;
  border: 1px solid #d9e5fa;
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
}

.filter-btn {
  align-self: end;
  border: 1px solid #c6d9ff;
  background: #eff5ff;
  color: #335ca8;
  border-radius: 8px;
  font-size: 12px;
  padding: 5px 8px;
  cursor: pointer;
}

.filter-btn.active {
  border-color: #bfd4ff;
  background: #eaf2ff;
  color: #1f4f9f;
}

.filter-btn.secondary {
  border-color: #dbe3f0;
  background: #f8fbff;
  color: #51617d;
}

.scoring-lists {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stock-group.expanded .scoring-lists {
  flex: 1;
}

.scoring-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
}

.scoring-section-title {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px 7px;
  border-bottom: 1px solid rgba(225, 232, 245, 0.7);
  background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0.95) 100%);
  color: #263b5b;
  font-size: 12px;
  font-weight: 700;
}

.scoring-section-title small {
  color: #7b8ca8;
  font-size: 11px;
  font-weight: 500;
}

.scoring-section-title strong {
  min-width: 22px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1f6ff;
  color: #365ca8;
  font-size: 11px;
}

.scoring-section-toggle {
  margin-left: auto;
  border: 1px solid #d6e1f7;
  background: #f7faff;
  color: #4f648a;
  border-radius: 8px;
  font-size: 11px;
  padding: 2px 7px;
  cursor: pointer;
  flex-shrink: 0;
}

.scoring-section-toggle.active {
  border-color: #bfd4ff;
  background: #edf4ff;
  color: #2a4f94;
}

.scoring-lists .stock-list {
  overflow: visible;
}

.stock-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.stock-item {
  border: 1px solid transparent;
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.stock-item:hover {
  border-color: #bdd3ff;
  transform: translateY(-1px);
}

.stock-item.active {
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(15, 109, 255, 0.1);
}

.stock-item .row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.item-change {
  font-size: 12px;
  font-weight: 600;
}

.item-metrics {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: 0 0 auto;
}

.item-wave-score {
  font-size: 11px;
  color: #2455a6;
  white-space: nowrap;
}

.stock-item strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.stock-item span,
.item-code {
  color: var(--muted);
  font-size: 12px;
}

.item-code {
  line-height: 1.2;
}

.content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.content-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 8px;
}

.content-header {
  position: relative;
  z-index: 5;
  padding: 14px 16px;
  background: var(--panel);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(23, 35, 56, 0.06);
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.header-main.dual-score-layout {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  grid-template-rows: auto auto auto;
  align-items: start;
  gap: 7px 12px;
}

.header-main.dual-score-layout .header-identity {
  grid-column: 1;
  grid-row: 1;
}

.header-main.dual-score-layout .header-actions {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

.header-main.dual-score-layout #header-metrics-score,
.header-main.dual-score-layout #header-metrics-wave {
  grid-column: 1 / -1;
  justify-content: flex-start;
  padding: 6px 9px;
  border-radius: 10px;
  background: #f8fbff;
  border: 1px solid #e6edf8;
}

.header-main.dual-score-layout #header-metrics-score {
  grid-row: 2;
}

.header-main.dual-score-layout #header-metrics-wave {
  grid-row: 3;
}

.header-main.dual-score-layout #header-metrics-score::before,
.header-main.dual-score-layout #header-metrics-wave::before {
  display: inline-flex;
  align-items: center;
  height: 20px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.header-main.dual-score-layout #header-metrics-score::before {
  content: "短线";
  color: #1d4ea5;
  background: #eaf2ff;
}

.header-main.dual-score-layout #header-metrics-wave::before {
  content: "波段";
  color: #7a5610;
  background: #fff3d7;
}

.header-identity {
  min-width: 180px;
}

.header-metrics-inline {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px 16px;
  padding: 0 8px;
  flex-wrap: wrap;
}

.metric-inline-item {
  color: #6a7a95;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.metric-inline-item strong {
  color: #243852;
  font-size: 13px;
  font-weight: 600;
}

.wave-veto-warning {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ffd7a8;
  border-radius: 999px;
  background: #fff6e9;
  color: #a85a00;
  padding: 3px 8px;
  font-weight: 600;
}

.content-header h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.content-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.watch-btn {
  border: 1px solid #c5d8ff;
  background: #f3f7ff;
  color: #1d4ea5;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.watch-btn.active {
  border-color: #bce8cf;
  background: #e9f8ef;
  color: #157347;
}

.price-box {
  text-align: right;
}

#stock-price {
  display: block;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

#stock-change {
  font-size: 13px;
}

.up {
  color: var(--up);
}

.down {
  color: var(--down);
}

.neutral {
  color: var(--muted);
}

.empty-tip {
  margin: 8px 4px 2px;
  color: #7b879c;
  font-size: 12px;
}

.is-collapsed {
  display: none;
}

.chart-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.macd-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 12px 12px;
}

.macd-header {
  font-size: 12px;
  color: #6c7c96;
  margin-bottom: 6px;
}

#macd-chart {
  width: 100%;
  height: 190px;
  display: block;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.chart-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-toolbar span {
  font-size: 12px;
  color: var(--muted);
}

.chart-mode-switch {
  display: inline-flex;
  gap: 6px;
}

.chart-mode-btn {
  border: 1px solid #d7e3f8;
  background: #f6f9ff;
  color: #486186;
  border-radius: 8px;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}

.chart-mode-btn.active {
  border-color: #b9d0ff;
  background: #eaf2ff;
  color: #1f4f9f;
}

.boll-btn.active {
  border-color: #ffe39a;
  background: #fff6dc;
  color: #8a6200;
}

.ma-btn.active {
  border-color: #d7c8ff;
  background: #f3edff;
  color: #5a3ba6;
}

.ma-latest {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 10px;
}

.ma-latest.is-collapsed {
  display: none;
}

.ma-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid #dce4f2;
  background: #f8fbff;
  color: #4c5f80;
  font-size: 12px;
}

.ma-tag.ma5 {
  border-color: #decdfd;
  color: #6a3fd8;
  background: #f5f0ff;
}

.ma-tag.ma10 {
  border-color: #ffdcb8;
  color: #c86908;
  background: #fff4e8;
}

.ma-tag.ma20 {
  border-color: #c9ddff;
  color: #2f6fdf;
  background: #eef5ff;
}

#chart {
  width: 100%;
  height: 420px;
  display: block;
}

.ai-diagnosis-panel {
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid #e4ebf8;
  background: #fbfdff;
  color: #26364f;
  font-size: 13px;
  line-height: 1.7;
  padding: 10px 12px;
}

.funds-flow-panel {
  min-height: 420px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid #e4ebf8;
  background: #fbfdff;
  color: #26364f;
  padding: 12px;
  overflow: auto;
}

.wave-history-panel {
  min-height: 420px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid #e4ebf8;
  background:
    radial-gradient(circle at 14% 18%, rgba(61, 118, 255, 0.08), transparent 30%),
    #fbfdff;
  color: #26364f;
  padding: 12px;
}

.wave-history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.wave-history-header h3 {
  margin: 0;
  color: #17253d;
  font-size: 16px;
}

.wave-history-header p {
  margin: 4px 0 0;
  color: #73829a;
  font-size: 12px;
}

.wave-history-latest {
  border-radius: 999px;
  border: 1px solid #dce7fb;
  background: #ffffff;
  color: #345174;
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.wave-history-chart {
  min-height: 320px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  overflow: hidden;
}

.wave-history-chart svg {
  width: 100%;
  height: 330px;
  display: block;
}

.wave-history-grid {
  stroke: rgba(116, 135, 165, 0.2);
  stroke-width: 1;
}

.wave-history-axis-label,
.wave-history-date-label {
  fill: #70819c;
  font-size: 11px;
}

.wave-history-area {
  fill: rgba(47, 111, 223, 0.08);
  stroke: none;
}

.wave-history-line {
  fill: none;
  stroke: #2f6fdf;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wave-history-point {
  fill: #2f6fdf;
  stroke: #ffffff;
  stroke-width: 1.5;
  transition: r 0.16s ease, filter 0.16s ease;
}

.wave-history-point.is-veto {
  fill: #f08a24;
}

.wave-history-point-wrap {
  outline: none;
}

.wave-history-point-hit {
  fill: transparent;
  cursor: pointer;
}

.wave-history-tooltip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.wave-history-tooltip-bg {
  fill: rgba(16, 28, 48, 0.92);
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1;
}

.wave-history-tooltip-text {
  fill: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.wave-history-point-wrap:hover .wave-history-tooltip,
.wave-history-point-wrap:focus .wave-history-tooltip,
.wave-history-point-wrap:focus-within .wave-history-tooltip {
  opacity: 1;
}

.wave-history-point-wrap:hover .wave-history-point,
.wave-history-point-wrap:focus .wave-history-point,
.wave-history-point-wrap:focus-within .wave-history-point {
  r: 5;
  filter: drop-shadow(0 3px 6px rgba(47, 111, 223, 0.35));
}

.wave-history-message {
  min-height: 320px;
  display: grid;
  place-items: center;
  margin: 0;
  color: #657899;
  font-size: 13px;
  text-align: center;
}

.wave-history-message.is-error {
  color: #b0443a;
}

.funds-flow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.funds-flow-header h3 {
  margin: 0;
  color: #17253d;
  font-size: 16px;
}

.funds-flow-header p,
.funds-updated {
  margin: 4px 0 0;
  color: #73829a;
  font-size: 12px;
}

.funds-total-card,
.funds-category-card {
  border: 1px solid #e6edf8;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(23, 35, 56, 0.04);
}

.funds-total-card {
  margin-bottom: 12px;
  padding: 12px;
}

.funds-total-card span,
.funds-category-card span {
  display: block;
  color: #6b7b93;
  font-size: 12px;
}

.funds-total-card strong {
  display: block;
  margin-top: 5px;
  color: #17253d;
  font-size: 24px;
}

.funds-total-card small,
.funds-category-card small {
  display: block;
  margin-top: 6px;
  color: #73829a;
  font-size: 12px;
  line-height: 1.4;
}

.funds-increase.positive {
  color: #d74a43;
  font-weight: 700;
}

.funds-increase.negative {
  color: #16895a;
  font-weight: 700;
}

.funds-increase.neutral {
  color: #536681;
}

.funds-category-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.funds-category-card {
  padding: 12px;
}

.funds-category-card strong {
  display: block;
  margin-top: 6px;
  color: #17253d;
  font-size: 18px;
}

.funds-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  color: #73829a;
  font-size: 13px;
}

.funds-error {
  color: #b24a44;
}

.split-dark-panel {
  margin-top: 12px;
  border: 1px solid #e6edf8;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  padding: 12px;
}

.split-dark-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.split-dark-header h3 {
  margin: 0;
  color: #17253d;
  font-size: 16px;
}

.split-dark-header p,
.split-dark-grid small,
.split-dark-group-row small {
  margin: 4px 0 0;
  color: #73829a;
  font-size: 12px;
}

.split-dark-conclusion {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #eef5ff;
  color: #173f70;
  padding: 5px 10px;
  font-size: 12px;
}

.split-dark-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.split-dark-grid article {
  position: relative;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e8eff9;
  padding: 10px;
}

.split-dark-grid span {
  display: block;
  color: #6b7b93;
  font-size: 12px;
}

.split-dark-grid strong {
  display: block;
  margin-top: 5px;
  color: #17253d;
  font-size: 17px;
}

.split-dark-info {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
}

.split-dark-info summary {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #c9d7ea;
  border-radius: 999px;
  background: #f7fbff;
  color: #5d708d;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  list-style: none;
}

.split-dark-info summary::-webkit-details-marker {
  display: none;
}

.split-dark-info[open] summary {
  border-color: #173f70;
  background: #173f70;
  color: #ffffff;
}

.split-dark-info p {
  position: absolute;
  top: 24px;
  right: 0;
  width: 220px;
  margin: 0;
  border: 1px solid #dbe6f5;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(23, 35, 56, 0.16);
  color: #40536d;
  font-size: 12px;
  line-height: 1.55;
  padding: 9px 10px;
}

.split-dark-panel .positive,
.split-dark-group-row .positive {
  color: #d74a43;
}

.split-dark-panel .negative,
.split-dark-group-row .negative {
  color: #16895a;
}

.split-dark-panel .neutral,
.split-dark-group-row .neutral {
  color: #536681;
}

.split-dark-groups {
  margin-top: 12px;
}

.split-dark-groups h4 {
  margin: 0 0 8px;
  color: #17253d;
  font-size: 13px;
}

.split-dark-group-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #eef3fa;
  padding: 7px 0;
  color: #52647e;
  font-size: 12px;
}

.split-dark-group-row strong {
  font-size: 12px;
  text-align: right;
}

.split-dark-empty,
.split-dark-veto-list {
  margin: 8px 0 0;
  color: #73829a;
  font-size: 12px;
}

.split-dark-veto-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: #9a6a27;
}

.split-dark-veto-label {
  font-weight: 700;
}

.split-dark-veto-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  background: #fff7e8;
  padding: 3px 6px;
}

.split-dark-veto-info {
  position: relative;
  top: auto;
  right: auto;
}

.split-dark-veto-info p {
  left: 0;
  right: auto;
}

.ai-diagnosis-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-diagnosis-start {
  height: 30px;
  border: 1px solid #244a7c;
  border-radius: 999px;
  background: #173f70;
  color: #ffffff;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ai-diagnosis-start:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ai-model-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #536681;
  font-size: 12px;
}

.ai-model-select {
  height: 30px;
  border: 1px solid #d7e1ef;
  border-radius: 999px;
  background: #ffffff;
  color: #26364f;
  padding: 0 28px 0 10px;
  font-size: 12px;
}

.ai-diagnosis-output {
  margin-top: 10px;
  color: #25364f;
  font-size: 13px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.ai-diagnosis-output h1,
.ai-diagnosis-output h2,
.ai-diagnosis-output h3,
.ai-diagnosis-output h4,
.ai-diagnosis-output h5,
.ai-diagnosis-output h6 {
  margin: 14px 0 8px;
  color: #14213d;
  font-weight: 800;
  line-height: 1.3;
}

.ai-diagnosis-output h1 {
  font-size: 22px;
}

.ai-diagnosis-output h2 {
  font-size: 18px;
}

.ai-diagnosis-output h3 {
  font-size: 15px;
}

.ai-diagnosis-output p {
  margin: 8px 0;
}

.ai-diagnosis-output ul,
.ai-diagnosis-output ol {
  margin: 8px 0 10px;
  padding-left: 22px;
}

.ai-diagnosis-output li {
  margin: 4px 0;
}

.ai-diagnosis-output blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 3px solid #9bb4d6;
  border-radius: 0 8px 8px 0;
  background: #f6f9ff;
  color: #41536f;
}

.ai-diagnosis-output pre {
  margin: 10px 0;
  padding: 12px;
  overflow-x: auto;
  border: 1px solid #dce6f4;
  border-radius: 10px;
  background: #0f172a;
  color: #e6edf7;
  line-height: 1.55;
}

.ai-diagnosis-output code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #edf3fb;
  color: #1d3557;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.ai-diagnosis-output pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.ai-diagnosis-output a {
  color: #1f6feb;
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 111, 235, 0.35);
}

.ai-diagnosis-output a:hover {
  border-bottom-color: currentColor;
}

.ai-diagnosis-output hr {
  margin: 14px 0;
  border: 0;
  border-top: 1px solid #dde6f3;
}

.markdown-table-wrap {
  margin: 10px 0;
  overflow-x: auto;
  border: 1px solid #dce6f4;
  border-radius: 10px;
}

.ai-diagnosis-output table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  background: #ffffff;
}

.ai-diagnosis-output th,
.ai-diagnosis-output td {
  padding: 8px 10px;
  border-bottom: 1px solid #e7edf6;
  text-align: left;
  vertical-align: top;
}

.ai-diagnosis-output th {
  background: #f5f8fd;
  color: #1c2e4a;
  font-weight: 800;
}

.ai-diagnosis-output tr:last-child td {
  border-bottom: 0;
}

.ai-diagnosis-output .align-center {
  text-align: center;
}

.ai-diagnosis-output .align-right {
  text-align: right;
}

.chart-overview {
  margin-top: 12px;
  border: 1px solid #e4ebf8;
  border-radius: 10px;
  padding: 8px 10px 10px;
  background: #fafcff;
}

.chart-overview canvas {
  width: 100%;
  height: 68px;
  display: block;
  border-radius: 6px;
  background: linear-gradient(180deg, #fdfefe 0%, #f5f9ff 100%);
}

.overview-range {
  width: 100%;
  margin: 8px 0 2px;
}

.overview-meta {
  display: flex;
  justify-content: space-between;
  color: #6a7a95;
  font-size: 11px;
}

@media (max-width: 960px) {
  body {
    height: auto;
    overflow: auto;
  }

  .sector-panels {
    grid-template-columns: 1fr;
  }

  .sector-panel {
    min-height: 420px;
  }

  .backtest-body {
    grid-template-columns: 1fr;
  }

  .backtest-score-panel {
    max-height: 360px;
  }

  .app {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    min-height: 420px;
  }

  .content {
    overflow: visible;
  }

  .content-body {
    overflow: visible;
    padding-bottom: 0;
  }

  .header-identity {
    min-width: 150px;
  }

  .header-metrics-inline {
    justify-content: flex-start;
    padding: 0 2px;
  }

  .funds-category-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-dark-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .header-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .header-main.dual-score-layout {
    display: flex;
    flex-direction: column;
  }

  .header-main.dual-score-layout #header-metrics-score,
  .header-main.dual-score-layout #header-metrics-wave {
    width: 100%;
  }

  .header-identity {
    min-width: 0;
  }

  .header-metrics-inline {
    width: 100%;
    justify-content: flex-start;
    gap: 4px 10px;
    padding: 0;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .price-box {
    text-align: left;
  }

  .funds-flow-header {
    flex-direction: column;
  }

  .funds-category-list {
    grid-template-columns: 1fr;
  }

  .split-dark-header {
    flex-direction: column;
  }

  .split-dark-grid,
  .split-dark-group-row {
    grid-template-columns: 1fr;
  }

  .split-dark-group-row strong {
    text-align: left;
  }

  .split-dark-info p {
    width: 190px;
  }

  .filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .backtest-header,
  .backtest-form {
    flex-direction: column;
    align-items: stretch;
  }

  .backtest-form {
    flex-basis: auto;
    width: 100%;
  }
}
