/* 复盘系统 v1.1 —— 冷灰紧凑金融数据界面 */
:root {
  --bg: #eaf0f5;
  --card: #ffffff;
  --surface: #f5f7f9;
  --surface-2: #edf2f5;
  --ink: #1d2938;
  --ink-2: #405064;
  --muted: #647589;
  --faint: #8796a7;
  --line: #d6e0e8;
  --line-2: #e6ecf1;
  --up: #c9474e;
  --up-bg: #fff0f1;
  --down: #1f7a67;
  --down-bg: #e9f6f2;
  --accent: #182638;
  --accent-2: #263548;
  --accent-bg: #e8edf2;
  --teal: #176f75;
  --teal-bg: #dff1f2;
  --theme-neutral: #465b70;
  --theme-neutral-bg: #f2f5f7;
  --theme-neutral-line: #ccd7e0;
  --theme-up: #a8323a;
  --theme-up-bg: #fde5e7;
  --theme-up-line: #dfa0a6;
  --theme-down: #155f50;
  --theme-down-bg: #cce8dd;
  --theme-down-line: #4f9f8c;
  --warn: #9f5c12;
  --warn-bg: #fff0dc;
  --breakout: #6550a3;
  --breakout-bg: #f0edfb;
  --shadow: 0 1px 2px rgba(25, 43, 62, .025);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.warn-text { color: var(--warn) !important; }
.muted { color: var(--muted); font-size: 12px; }
.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  transition: top .16s ease;
}
.skip-link:focus { top: 12px; outline: 2px solid #fff; outline-offset: 2px; }

/* 左侧主导航 */
#side {
  width: 176px;
  flex: none;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  padding: 17px 11px;
  background: #eef3f7;
  border-right: 1px solid #d7e0e8;
}
#side .brand {
  padding: 2px 8px 16px;
  border-bottom: 1px solid #d8e1e9;
}
#side .brand .logo { display: flex; align-items: center; gap: 10px; }
#side .brand .dot {
  position: relative;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  background: var(--accent);
  box-shadow: none;
}
#side .brand .dot::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 14px;
  height: 14px;
  opacity: .9;
  background:
    linear-gradient(90deg,
      #fff 0 14%, transparent 14% 31%,
      #fff 31% 55%, transparent 55% 72%,
      #fff 72% 100%);
  clip-path: polygon(0 42%, 14% 42%, 14% 100%, 0 100%,
    31% 16%, 55% 16%, 55% 100%, 31% 100%,
    72% 0, 100% 0, 100% 100%, 72% 100%);
}
#side .brand b {
  color: var(--accent);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .35px;
}
#side .brand .sub {
  margin: 5px 0 0 38px;
  color: #8d9aac;
  font-size: 9px;
  letter-spacing: .35px;
}
#side .nav { padding: 13px 0; flex: 1; }
#side .item {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  margin: 1px 0;
  padding: 8px 10px;
  border-radius: 6px;
  color: #67768a;
  font-size: 12px;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
#side .item:hover { color: var(--accent); background: #e4eaf0; }
#side .item.on {
  color: var(--accent);
  background: #fff;
  box-shadow: inset 2px 0 var(--accent);
  font-weight: 700;
}
#side .item.off { color: #a8b2be; cursor: default; }
#side .item.off:hover { color: #a8b2be; background: transparent; }
.nav-icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#content { min-width: 0; flex: 1; }
.wrap {
  width: 100%;
  max-width: 1440px;
  margin: 13px auto;
  padding: 0 18px 30px;
}

/* 通用卡片与分区标题 */
#main { counter-reset: fupan-section; }
#main > section {
  counter-increment: fupan-section;
  scroll-margin-top: 56px;
}
.card {
  margin-bottom: 11px;
  padding: 11px 13px 12px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
h1 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 18px;
  line-height: 1.3;
}
h2 {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 750;
}
h2 .src {
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.section-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid #c5d8da;
  border-radius: 999px;
  background: #eef6f6;
  color: #326d72;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .01em;
  white-space: nowrap;
}
.section-source::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 2px rgba(22, 125, 130, .10);
}
.card-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}
.card-head-actions .section-source { margin-left: 0; }
#main > section > .card > h2:first-child,
#main > section > div > .card > h2:first-child {
  display: flex;
  align-items: center;
  min-height: 37px;
  margin: -11px -13px 9px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-2);
}
#main > section > .card > h2:first-child::before,
#main > section > div > .card > h2:first-child::before {
  content: counter(fupan-section);
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  margin-right: 8px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

/* 六个科技复盘基准：独立位于“1 竞价信息”前，不占用分区编号 */
#main > section.market-index-section { counter-increment: none; }
#main > section.market-index-section > .card > h2:first-child::before {
  display: none;
  content: none;
}
.market-index-panel > h2:first-child {
  gap: 8px;
}
.market-index-panel > h2:first-child > span:first-child {
  flex: none;
}
.index-section-note {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 450;
}
.market-index-panel .section-source { margin-left: auto; }
.market-index-panel .index-head-actions { margin-left: auto; }
.market-index-panel .index-head-actions .section-source { margin-left: 0; }
.index-domestic-head,
.index-overseas-head,
.overseas-index-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.index-domestic-head {
  margin: 0 0 7px;
}
.index-domestic-head strong,
.index-overseas-head strong {
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
}
.index-domestic-head span,
.index-overseas-head span,
.index-overseas-head small,
.overseas-index-group-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 450;
}
.index-domestic-head span { margin-right: auto; }
.index-sync-panel {
  margin: 0 0 9px;
  border: 1px solid #d8e4ec;
  border-radius: 8px;
  background: #f7fafc;
  color: var(--ink2);
}
.index-sync-main {
  display: grid;
  grid-template-columns: minmax(205px, auto) minmax(360px, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 10px;
}
.index-sync-state {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.index-sync-state > span {
  width: 8px;
  height: 8px;
  flex: none;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #8091a4;
  box-shadow: 0 0 0 2px #cbd5df;
}
.index-sync-state.is-fresh > span { background: var(--teal); box-shadow: 0 0 0 2px #b8ddd8; }
.index-sync-state.is-settled > span { background: #476d99; box-shadow: 0 0 0 2px #cad8e8; }
.index-sync-state.is-checking > span { background: #477da6; box-shadow: 0 0 0 2px #c3d8e7; }
.index-sync-state.is-warning > span { background: #b17a27; box-shadow: 0 0 0 2px #ead5b0; }
.index-sync-state div { min-width: 0; }
.index-sync-state strong,
.index-sync-state small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.index-sync-state strong { color: var(--ink2); font-size: 11.5px; font-weight: 780; }
.index-sync-state small { margin-top: 2px; color: var(--muted); font-size: 9.5px; }
.index-sync-chips {
  display: flex;
  min-width: 0;
  align-items: stretch;
  gap: 5px;
}
.index-sync-chips > span {
  display: inline-flex;
  min-width: 58px;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  padding: 5px 7px;
  border: 1px solid #d8e3eb;
  border-radius: 6px;
  background: #fff;
  white-space: nowrap;
}
.index-sync-chips > span:first-child { min-width: 125px; }
.index-sync-chips small { color: var(--muted); font-size: 9px; }
.index-sync-chips b { color: var(--ink2); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.index-sync-chips .is-warning { border-color: #e5cfaa; background: #fffaf2; }
.index-sync-chips .is-warning b { color: #95631d; }
.index-sync-times {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  white-space: nowrap;
}
.index-sync-times b { color: var(--ink2); font-weight: 700; font-variant-numeric: tabular-nums; }
.index-refresh-btn {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid #b7c8d6;
  border-radius: 7px;
  background: #fff;
  color: #3f607b;
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}
.index-refresh-btn:hover { border-color: #819bad; background: #f4f8fb; }
.index-refresh-btn:focus-visible { outline: 2px solid rgba(49, 94, 131, .48); outline-offset: 2px; }
.index-refresh-btn:disabled { cursor: wait; opacity: .65; }
.index-refresh-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.index-refresh-btn.is-loading svg { animation: index-refresh-spin .8s linear infinite; }
@keyframes index-refresh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .index-refresh-btn.is-loading svg { animation: none; }
}
.index-status-guide { border-top: 1px solid #e1e9ef; }
.index-status-guide summary {
  width: max-content;
  margin: 0 10px 6px auto;
  color: #526a7e;
  font-size: 9.5px;
  font-weight: 700;
  cursor: pointer;
}
.index-status-guide summary:focus-visible { outline: 2px solid rgba(49, 94, 131, .48); outline-offset: 2px; }
.index-status-guide > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 0 10px 8px;
  color: var(--muted);
  font-size: 9.5px;
}
.index-status-guide span { display: inline-flex; align-items: center; gap: 5px; }
.index-status-guide b,
.index-state-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid #d3dee7;
  border-radius: 999px;
  background: #fff;
  font-size: 9px;
  font-style: normal;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}
.index-status-guide .is-fresh,
.index-state-badge.is-fresh { border-color: #b8ddd8; background: #edf8f6; color: #1e756b; }
.index-status-guide .is-warning,
.index-state-badge.is-warning,
.index-status-guide .is-fallback,
.index-state-badge.is-fallback { border-color: #e5cfaa; background: #fff7e9; color: #95631d; }
.index-state-badge.is-settled { border-color: #c9d8e8; background: #f0f5fa; color: #466a91; }
.index-state-badge.is-history { border-color: #d2dbe4; background: #f4f6f8; color: #607286; }
.index-status-guide .is-unavailable,
.index-state-badge.is-unavailable,
.index-state-badge.is-neutral { border-color: #d5dde5; background: #f3f5f7; color: #68798a; }
.index-sync-loading {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 10.5px;
}
.index-sync-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8095a8;
}
.market-index-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.index-overseas-head {
  margin: 13px 0 8px;
  padding-top: 11px;
  border-top: 1px solid var(--line-2);
}
.index-overseas-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.index-overseas-head small {
  flex: none;
}
.overseas-index-groups {
  display: grid;
  gap: 10px;
}
.overseas-index-group {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: #f8fafc;
}
.overseas-index-group-head {
  justify-content: flex-start;
  margin: 0 2px 7px;
}
.overseas-index-group-head strong {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 1px 7px;
  border: 1px solid #c9d6e1;
  border-radius: 4px;
  background: #fff;
  color: #415a72;
  font-size: 10.5px;
  font-weight: 720;
}
.overseas-index-group[data-index-group="overnight"] .overseas-index-group-head strong {
  border-color: #c8d5e8;
  background: #edf3fb;
  color: #3f6297;
}
.overseas-index-group[data-index-group="asia"] .overseas-index-group-head strong {
  border-color: #bedfe1;
  background: var(--teal-bg);
  color: var(--teal);
}
.overseas-index-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.overseas-index-grid .market-index-item {
  min-height: 178px;
  background: rgba(255, 255, 255, .96);
}
.market-index-item {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 184px;
  padding: 11px 12px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(25, 43, 62, .018);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
button.market-index-item:hover {
  border-color: #a8b8c6;
  box-shadow: 0 4px 12px rgba(25, 43, 62, .07);
  transform: translateY(-1px);
}
button.market-index-item:active { transform: translateY(0); }
button.market-index-item:focus-visible {
  outline: 2px solid rgba(49, 94, 131, .48);
  outline-offset: 2px;
}
.market-index-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: #8295a7;
}
.market-index-item.up::before { background: var(--up); }
.market-index-item.down::before { background: var(--down); }
.market-index-item.flat::before { background: #8295a7; }
.index-card-top,
.index-card-main,
.index-card-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.index-card-top {
  padding-right: 40px;
  color: var(--ink);
}
.index-card-top b {
  overflow: hidden;
  font-size: 13px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index-card-top small {
  flex: none;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .02em;
}
.index-card-main {
  align-items: center;
  margin-top: 5px;
}
.index-card-main strong,
.market-index-item.is-empty > strong {
  color: var(--accent);
  font-size: 20px;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
}
.index-card-main em {
  flex: none;
  font-size: 12px;
  font-style: normal;
  font-weight: 720;
}
.index-card-bottom {
  align-items: flex-end;
  margin-top: 5px;
}
.index-card-bottom small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 450;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index-card-status {
  display: flex;
  min-height: 20px;
  margin-top: 6px;
  align-items: center;
}
.index-card-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid #e8eef3;
}
.index-card-details > span { display: flex; min-width: 0; align-items: baseline; gap: 4px; }
.index-card-details .is-source { grid-column: 1 / -1; }
.index-card-details i {
  flex: none;
  color: var(--faint);
  font-size: 8.5px;
  font-style: normal;
  font-weight: 500;
}
.index-card-details b {
  min-width: 0;
  overflow: hidden;
  color: #53687d;
  font-size: 8.8px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.index-card-details b.is-fallback { color: #95631d; }
.index-card-note {
  display: block;
  margin-top: 6px;
  padding: 5px 6px;
  border-radius: 5px;
  background: #f3f6f8;
  color: #68798a;
  font-size: 8.8px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.35;
}
.index-card-note.is-warning,
.index-card-note.is-fallback { background: #fff7e9; color: #8e611e; }
.index-health-light {
  position: absolute;
  top: 11px;
  right: 10px;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(91, 112, 132, .18);
}
.index-health-light.is-ok {
  background: #23916f;
  box-shadow: 0 0 0 2px rgba(35, 145, 111, .20), 0 0 7px rgba(35, 145, 111, .28);
}
.index-health-light.is-error {
  background: #c9474e;
  box-shadow: 0 0 0 2px rgba(201, 71, 78, .20), 0 0 7px rgba(201, 71, 78, .25);
}
.index-card-freshness {
  display: block;
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: #287078;
  font-size: 9px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index-card-freshness.is-stale {
  color: #9a6826;
}
.market-index-item.is-stale {
  background: #fffdfa;
}
.index-history-icon {
  position: absolute;
  top: 10px;
  right: 31px;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #9aabba;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.market-index-item:hover .index-history-icon,
.market-index-item:focus-visible .index-history-icon { stroke: #315e83; }
.index-spark {
  width: 82px;
  height: 23px;
  flex: none;
  overflow: visible;
}
.index-spark polyline {
  fill: none;
  stroke: #8295a7;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.index-spark.up polyline { stroke: var(--up); }
.index-spark.down polyline { stroke: var(--down); }
.index-spark-empty {
  color: var(--faint);
  font-size: 9.5px;
}
.market-index-item.is-empty {
  cursor: not-allowed;
  background: #f8fafb;
  opacity: 1;
}
.market-index-item.is-empty > strong {
  display: block;
  margin-top: 8px;
}
.market-index-item.is-empty em {
  color: var(--faint);
  font-size: 9.5px;
  font-style: normal;
}
.index-loading {
  pointer-events: none;
}
.index-loading i,
.index-loading > span:last-child {
  display: block;
  height: 16px;
  margin-top: 9px;
  border-radius: 4px;
  background: linear-gradient(90deg, #eef2f5 25%, #f8fafb 50%, #eef2f5 75%);
  background-size: 200% 100%;
  animation: index-loading 1.25s ease-in-out infinite;
}
.index-loading i { width: 58%; height: 22px; }
.index-loading > span:last-child { width: 82%; height: 12px; }
@keyframes index-loading {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
.index-panel-error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 24px 12px;
}
