/* 视觉层（简约）：只覆盖样式，不改页面结构和脚本，最后加载（见 index.html 末尾）。
   原则：界面框架只用灰与墨色，颜色留给行情（红涨绿跌）；字重克制；圆角统一；无阴影。
   图表（svg / canvas）内部以及图表图例的颜色不在此处设置。 */

:root {
  --bg: #f6f7f8;
  --card: #fff;
  --line: #e5e8eb;
  --line-soft: #eef0f2;
  --ink: #15181c;
  --ink-2: #3a4148;
  --muted: #5f6770;
  --fill: #f1f3f5;
  --r-card: 12px;
  --r-ctl: 8px;
  --r-chip: 6px;
}

/* ---------- 基础 ---------- */
body { background: var(--bg); color: var(--ink); font-weight: 400; }
.app-shell { background: var(--bg); }
h1, h2, h3 { letter-spacing: 0; font-weight: 600; }
.eyebrow { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: #fffffff7;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 17px; font-weight: 600; color: var(--ink); }
.section-heading h2,
.dashboard-head h2,
.resonance-head h2 { font-size: 17px; font-weight: 600; color: var(--ink); }
.header-status { color: var(--muted); }

.icon-button { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.profile-shortcut { background: #fff; color: var(--ink); border-color: #d3d8dd; font-weight: 500; }
.refresh-label { background: var(--ink); color: #fff; border-radius: var(--r-ctl); font-weight: 500; }
#openScreener.screener-trigger {
  background: #fff;
  border: 1px solid #d3d8dd;
  border-radius: var(--r-ctl);
  color: var(--ink);
  font-weight: 500;
}
#openScreener:hover { background: var(--fill); }
#radarToast { background: var(--ink); }

/* ---------- 状态条：浅色卡片，不再是深色大块 ---------- */
.hero {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: none;
}
.hero h2 { font-weight: 600; color: var(--ink); }
.hero p { color: var(--muted); }
.market-dot { background: #12805d; box-shadow: none; }
.score-ring { background: var(--fill); color: var(--ink); border: 0; border-radius: var(--r-ctl); }
.score-ring span { color: var(--muted); }
.scan-time { border-top-color: var(--line-soft); color: var(--muted); }
.hero .scan-time,
.hero .data-source { color: var(--muted); }

/* ---------- 卡片：统一圆角与发丝边线，无阴影 ---------- */
.signal-card,
.position-card,
.rule-card,
.comparison-card,
.alert-card,
.market-turnover,
.market-breadth,
#recentSearches,
.holdings-quick-view,
.stock-chart-collapse,
.stock-volume-chart {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: none;
}
.signal-card { padding: 16px 18px; }
.market-tone,
.status-chip { background: var(--fill); color: var(--ink-2); border-radius: var(--r-chip); font-weight: 500; }

/* 三大指数：去掉“卡片里再套卡片”，改为竖线分隔 */
#marketAlerts .index-monitor {
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line-soft);
  border-radius: 0;
  padding: 4px 18px;
}
#marketAlerts .index-monitor:first-child { border-left: 0; padding-left: 0; }
#marketAlerts .index-monitor:last-child { padding-right: 0; }
@media (max-width: 800px) {
  #marketAlerts .index-monitor { border-left: 0; border-top: 1px solid var(--line-soft); padding: 16px 0; }
  #marketAlerts .index-monitor:first-child { border-top: 0; padding-top: 0; }
}

/* ---------- 信号卡片内部 ---------- */
.signal-icon { width: 34px; height: 34px; border-radius: var(--r-ctl); font-size: 16px; font-weight: 600; }
.signal-title h3 { font-size: 15px; line-height: 1.45; font-weight: 600; color: var(--ink); }
.reason { color: var(--ink-2); line-height: 1.75; }
.metric { background: var(--fill); border-radius: var(--r-ctl); }
.metric strong { font-size: 14px; font-weight: 500; color: var(--ink); }
.action { border-radius: var(--r-ctl); font-size: 13px; line-height: 1.6; font-weight: 500; }
.tag { border-radius: var(--r-chip); font-weight: 500; }
.index-price { font-weight: 600; }
.stock-avatar { font-weight: 500; }

/* ---------- 筛选与快捷入口 ---------- */
.filter { min-height: 40px; padding: 0 16px; background: transparent; border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.filter.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.holding-quick-link { min-height: 40px; border-color: var(--line); border-radius: var(--r-ctl); background: #fff; color: var(--ink); font-weight: 500; }
.holding-quick-link:hover { background: var(--fill); border-color: #c9cfd5; }
.holdings-quick-heading { color: var(--ink); font-weight: 600; }
.signal-event-list button { border-radius: var(--r-ctl); }
.signal-event-list button.selected { border-color: var(--ink); background: var(--fill); }

/* ---------- 次要文字：加深到可读对比度 ---------- */
.signal-title p,
.metric span,
.stock-info p,
.profit small,
.disclaimer,
.index-foot,
.chart-note,
.turnover-status,
.turnover-metrics span,
.market-turnover h3 small,
.empty-message,
.market-breadth small,
.index-monitor header span,
.index-monitor > small,
.monitor-chart-note,
.alert-item small,
.panel-status,
.stock-note small,
.recent-search-empty,
.monitor-info > small,
.monitor-info > summary,
.stock-chart-legend,
.stock-chart-head span,
.stock-select small,
.resonance-table td small,
.subsector-source,
.index-monitor p,
.signal-event-list button span,
.trend-range,
.trend-hint,
.signal-explanation small,
.trade-history small,
.source-note { color: var(--muted) !important; }
.source-note { margin-top: 2px; }

/* 红涨绿跌的“文字”色相不变，仅略降明度以达到 4.5:1；K 线等图形颜色不动 */
.up,
.positive .index-signal { color: #cb413c; }
.down,
.risk .index-signal { color: #12805d; }
.reduce .signal-icon { color: #c73c34; }
.add .signal-icon { color: #0f7a58; }
.watch .signal-icon,
.watch .tag { color: #94600b; }
.watch .action { color: #8a5a0a; }
.signal-position-actions .reduce-position { color: #8f5a0e; }
.clear-position { color: #c23a31; }

/* ---------- 小字号下限（只针对 HTML 文字，不含图表内文字） ---------- */
.signal-title p,
.stock-info p,
.disclaimer,
.index-foot,
.index-foot .index-signal,
.chart-note,
.turnover-status,
.holding-quick-status,
.tag,
.move-button,
.recent-search-empty,
.stock-note small,
.monitor-info > summary,
.monitor-info > small,
.alert-item p,
.alert-item small,
.panel-status,
.data-source,
.scan-time { font-size: 12px !important; }
.metric span,
.monitor-chart-key,
.monitor-chart-note,
.stock-chart-head,
.stock-chart-head span,
.stock-chart-legend,
.index-monitor header span,
.index-monitor > small,
.source-note,
.trend-quote,
.trend-hint,
.score-ring span { font-size: 11px !important; }
.index-foot .index-signal { font-size: 13px !important; font-weight: 500; }
#sectorList .tag { font-size: 11px !important; }
#sectorList .stock-note { width: 100%; }

/* ---------- 按钮、开关与表单 ---------- */
.primary-small,
.submit-btn { background: var(--ink); color: #fff; border-radius: var(--r-ctl); font-weight: 500; }
.text-button { color: var(--ink-2); font-weight: 500; }
.move-button { font-weight: 500; }
.switch:checked { background: var(--ink); }
dialog { border-radius: var(--r-card); }
dialog form small { display: block; margin-top: 8px; font-size: 12px; font-weight: 400; line-height: 1.6; color: var(--muted); }
form label { font-weight: 500; color: var(--ink-2); }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]),
select { border-color: var(--line); border-radius: var(--r-ctl); background: #fff; }
#recentSearches h2 { color: var(--ink); font-weight: 600; }
#recentSearches h2 span,
#recentSearches p { color: var(--muted); }
#recentNewSearch { color: var(--ink); font-weight: 500; }
.quick-view-return { background: var(--ink); border-color: var(--ink); }
.quick-view-return:hover { background: var(--ink-2); }
.owl-links button { color: var(--ink-2); }

/* ---------- 底部导航（手机 / 平板）：线性图标，当前项只用墨色 ---------- */
.bottom-nav {
  background: #fffffff7;
  border-top: 1px solid var(--line);
  height: calc(64px + env(safe-area-inset-bottom));
  padding-top: 6px;
}
.bottom-nav button { gap: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.bottom-nav button.active { color: var(--ink); }
.bottom-nav button.active::after {
  content: '';
  width: 16px;
  height: 2px;
  margin-top: 0;
  border-radius: 2px;
  background: var(--ink);
}
.bottom-nav button span {
  display: block;
  width: 22px;
  height: 22px;
  font-size: 0;
  background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
.bottom-nav [data-page=position] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='7' width='18' height='13' rx='2'/%3E%3Cpath d='M9 7V5.5A1.5 1.5 0 0 1 10.5 4h3A1.5 1.5 0 0 1 15 5.5V7M3 13h18'/%3E%3C/svg%3E"); }
.bottom-nav [data-page=signals] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Ccircle cx='12' cy='12' r='4.5'/%3E%3Cpath d='M12 12l6-6'/%3E%3C/svg%3E"); }
.bottom-nav [data-page=watch] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.bottom-nav [data-page=sector] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='7' height='7' rx='1.5'/%3E%3Crect x='13' y='4' width='7' height='7' rx='1.5'/%3E%3Crect x='4' y='13' width='7' height='7' rx='1.5'/%3E%3Crect x='13' y='13' width='7' height='7' rx='1.5'/%3E%3C/svg%3E"); }
.bottom-nav [data-page=funds] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9c3-3 6 3 9 0s6-3 9 0M3 15c3-3 6 3 9 0s6-3 9 0'/%3E%3C/svg%3E"); }
.bottom-nav [data-page=patterns] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='8' width='4' height='8' rx='1'/%3E%3Cpath d='M7 4v4m0 8v4'/%3E%3Crect x='15' y='6' width='4' height='9' rx='1'/%3E%3Cpath d='M17 3v3m0 9v5'/%3E%3C/svg%3E"); }
.bottom-nav [data-page=strategy] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h9M19 7h1M4 17h1M11 17h9'/%3E%3Ccircle cx='16' cy='7' r='2.5'/%3E%3Ccircle cx='8' cy='17' r='2.5'/%3E%3C/svg%3E"); }
.bottom-nav [data-page=profile] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5'/%3E%3C/svg%3E"); }

/* ---------- 悬浮元素：缩小并让出数据区 ---------- */
.snowy-owl { width: 132px; height: 165px; }
.owl-panel { bottom: 170px; }
.quick-view-return { width: 40px; height: 40px; font-size: 22px; right: 158px; bottom: 28px; }

/* ---------- 手机 / 平板（<1100px） ---------- */
@media (max-width: 1099px) {
  .topbar { height: 56px; min-height: 0; padding: 8px 14px; flex-wrap: nowrap; gap: 8px; }
  .topbar h1 { font-size: 17px; white-space: nowrap; }
  .topbar-actions { flex-wrap: nowrap; gap: 8px; }
  .icon-button { width: 36px; height: 36px; }
  .refresh-label { width: auto; height: 36px; padding: 0 12px; font-size: 13px; white-space: nowrap; }
  #openScreener.screener-trigger { min-width: 0; height: 36px; padding: 0 10px; font-size: 13px; }
  #recentSearches { margin: 12px 16px 14px; padding: 12px 14px; }
  .hero { margin: 0 16px 16px; padding: 16px 18px; }
  .hero h2 { font-size: 20px; line-height: 1.35; margin: 10px 0 6px; }
  .score-ring { width: 60px; height: 52px; }
  .score-ring strong { font-size: 20px; }
  .market-dashboard { padding-bottom: 16px; }
  .snowy-owl { width: 92px; height: 115px; right: 6px; bottom: calc(70px + env(safe-area-inset-bottom)); }
  .owl-panel { bottom: 122px; width: min(272px, calc(100vw - 24px)); }
  .quick-view-return { right: 106px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .move-button,
  .primary-small { min-height: 36px; padding: 0 12px; }
  .delete-position,
  .edit-position { width: 36px; height: 36px; flex-basis: 36px; }
  #holdingsQuickView { margin: 16px 16px; }
  .stock-note { width: 100%; }
}

/* ---------- 板块按宽度排列；个股固定宽度规则见文件末尾 ---------- */
@media (min-width: 700px) {
  .signal-list:not(.hidden) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
    align-items: start;
  }
  .signal-list .signal-card { margin: 0; }
  #sectorList { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* 信号卡片头部：标题独占整行，状态与操作按钮另起一行（卡片宽度小于约 430px 时） */
@media (max-width: 900px) {
  #signalList .signal-header { flex-wrap: wrap; }
  #signalList .signal-title { flex: 1 1 0; min-width: 0; }
  #signalList .signal-position-controls {
    flex: 1 0 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-left: 0;
    gap: 8px;
  }
}

/* ---------- 手机 / 平板紧凑排版（<1100px）：字号与间距收紧，一屏放更多信息 ----------
   字号档位：分区标题 15 · 卡片标题 14 · 正文 13 · 次要文字 11 · 大数字 16–19。 */
@media (max-width: 1099px) {
  .section-heading { margin: 4px 2px 10px; }
  .section-heading h2,
  .dashboard-head h2 { font-size: 15px; }
  .dashboard-head,
  .resonance-head { margin-bottom: 10px; }
  .market-tone,
  .status-chip { font-size: 11px; padding: 4px 8px; }

  .hero { padding: 12px 14px; margin-bottom: 12px; }
  .hero h2 { font-size: 16px; margin: 6px 0 4px; }
  .hero p { margin: 4px 0; }
  #marketStatus { font-size: 13px; }
  .score-ring { width: auto; min-width: 60px; height: 44px; padding: 0 8px; white-space: nowrap; }
  .score-ring strong { font-size: 17px; }
  .scan-time { margin-top: 8px; padding-top: 8px; }
  #recentSearches { margin: 10px 16px 12px; padding: 10px 12px; }
  #recentSearches h2 { font-size: 13px; }

  .market-dashboard { padding: 0 16px 12px; }
  .market-turnover { margin-top: 10px; padding: 10px 12px; }
  .market-turnover h3 { font-size: 14px; margin: 0 0 8px; }
  .turnover-metrics { padding: 10px; gap: 8px; }
  .turnover-metrics strong { font-size: 16px; }
  .market-breadth { margin: 10px 0 12px; padding: 10px 12px; }
  .alert-card,
  .comparison-card { padding: 12px; }
  .alert-card h3,
  .comparison-card h3 { font-size: 14px; margin: 0 0 8px; }
  .monitor-price { font-size: 18px; margin: 8px 0; }
  #marketOverviewPanel .index-price { font-size: 19px; margin: 6px 0; }
  .index-title strong { font-size: 13px; }

  .signal-card { padding: 12px 14px; }
  .signal-icon { width: 28px; height: 28px; font-size: 14px; }
  .signal-title h3 { font-size: 14px; }
  .reason { font-size: 13px; line-height: 1.65; margin: 10px 0 8px; }
  .metric { padding: 6px 8px; }
  .metric strong { font-size: 13px; }
  .action { font-size: 12px; padding: 8px 10px; margin-top: 10px; }
  .position-card { padding: 12px; }
  .stock-info h3 { font-size: 14px; }
  .rule-card { padding: 12px 14px; }
  .filter { min-height: 34px; padding: 0 13px; font-size: 12px; }
  .holding-quick-link { min-height: 34px; padding: 4px 8px; font-size: 12px; }
  .holdings-quick-view { padding: 10px; gap: 6px; }
  .holdings-quick-heading { font-size: 13px; }

  .index-foot,
  .index-foot .index-signal,
  .chart-note,
  .turnover-status,
  .panel-status,
  .disclaimer,
  .signal-title p,
  .stock-info p,
  .stock-note small,
  .recent-search-empty,
  .holding-quick-status,
  .tag,
  .move-button,
  .alert-item p,
  .alert-item small,
  .data-source,
  .scan-time { font-size: 11px !important; }
  .index-foot .index-signal { font-size: 12px !important; }
}

/* 手机（≤740px）：四大指数一排并排，名称与涨跌幅上下叠放 */
@media (max-width: 740px) {
  #marketOverviewPanel > .index-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 0; padding-bottom: 10px; margin-bottom: 12px; }
  #marketOverviewPanel .index-card { padding: 0 6px; border-right: 1px solid var(--line); }
  #marketOverviewPanel .index-card:nth-child(odd) { padding-left: 6px; }
  #marketOverviewPanel .index-card:nth-child(even) { padding-right: 6px; border-right: 1px solid var(--line); }
  #marketOverviewPanel .index-card:first-child { padding-left: 0; }
  #marketOverviewPanel .index-card:last-of-type { padding-right: 0; border-right: 0; }
  .index-title { flex-direction: column; gap: 1px; }
  .index-title strong { font-size: 12px; }
  .index-title b { font-size: 12px; font-weight: 500; }
  #marketOverviewPanel .index-price { font-size: clamp(13px, 3.7vw, 15px); margin: 4px 0; letter-spacing: 0; white-space: nowrap; }
  .index-foot { line-height: 1.5; }
  .index-foot .index-signal { font-size: 11px !important; margin-bottom: 2px; }
}

/* ---------- 桌面（≥1100px）：顶部标签栏，取消侧栏 ---------- */
@media (min-width: 1100px) {
  .app-shell { max-width: none; padding: 0 0 30px; }
  .topbar { height: 56px; padding: 0 24px; background: #fff; }
  .topbar::before { content: none; }
  .topbar h1 { font-size: 16px; }
  .app-shell main { padding: 28px 32px; }
  .signal-list:not(.hidden) {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 16px;
  }

  .bottom-nav {
    position: fixed;
    top: 0;
    bottom: auto;
    left: 140px;
    right: auto;
    transform: none;
    width: auto;
    height: 56px;
    flex-direction: row;
    align-items: stretch;
    gap: 2px;
    padding: 0;
    background: transparent;
    border: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    overflow: visible;
    z-index: 12;
  }
  .bottom-nav button {
    position: relative;
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    height: 56px;
    margin: 0;
    padding: 0 14px;
    flex-direction: row;
    justify-content: center;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
  }
  .bottom-nav button:hover { color: var(--ink); }
  .bottom-nav button.active { color: var(--ink); font-weight: 600; background: none; box-shadow: none; }
  .bottom-nav button.active::after {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    width: auto;
    height: 2px;
    margin: 0;
    border-radius: 2px 2px 0 0;
    background: var(--ink);
  }
  .bottom-nav button span { display: none; }
  .bottom-nav [data-page=profile] { display: none; }
}

/* 个股以 580px 固定卡宽换行，最多三列，不拉伸填满剩余空间。
   屏幕不足一张卡宽时才收窄，避免手机横向溢出。 */
#signalList:not(.hidden),
#watchList:not(.hidden) {
  display: grid;
  width: 100%;
  max-width: 1772px;
  margin-inline: auto;
  padding: 0;
  grid-template-columns: repeat(auto-fill, min(100%, 580px));
  gap: 16px;
  align-items: start;
  justify-content: center;
}
#signalList > .signal-card,
#watchList > .signal-card { margin: 0; }

/* 恢复个股快速查看与信号的粗体层级。 */
:is(#holdingsQuickView, #watchQuickView) :is(.holdings-quick-heading, .holding-quick-link, .holding-quick-status),
:is(#signalList, #watchList) :is(.signal-title h3, .tag, .action, .signal-position-actions .move-button) {
  font-weight: 700;
}

/* 页面内容与个股网格共享宽度：580 / 1176 / 1772px。 */
.app-shell main { container-type: inline-size; }
.app-shell main > :is(section, nav) {
  width: 100%;
  max-width: 580px;
  margin-inline: auto;
}
.app-shell main > :is(.market-dashboard, .filter-row, .position-panel, .strategy-panel) {
  padding-inline: 0;
}
#holdingsQuickView,
#recentSearches { margin-inline: auto; }
@container (min-width: 1176px) {
  .app-shell main > :is(section, nav) { max-width: 1176px; }
}
@container (min-width: 1772px) {
  .app-shell main > :is(section, nav) { max-width: 1772px; }
}
/* Local sector comparison preview; chart styling stays in its own SVG. */
.has-rotation-preview .turnover-layout { max-width:none; grid-template-columns:minmax(0,1fr) 190px 350px; gap:22px; align-items:start; }
.has-rotation-preview .turnover-summary { padding-left:18px; }
.has-rotation-preview .turnover-metrics { padding:16px; }
.has-rotation-preview .turnover-metrics strong { font-size:21px; }
.has-rotation-preview .chart-note { max-width:none; }
.rotation-preview { min-width:0; padding-left:22px; border-left:1px solid var(--line,#e5e7eb); color:#262a30; font-variant-numeric:tabular-nums; }
.rotation-heading { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:12px; }
.rotation-heading h3 { margin:0!important; font-size:14px; font-weight:600; }
.rotation-heading>span { font-size:10px; color:#777; border:1px solid #ddd; padding:3px 6px; border-radius:6px; }
.rotation-context { margin:0 0 12px; padding:9px 10px; border-radius:6px; background:#f5f6f7; font-size:11px; color:#73777e; }
.rotation-context b { margin-left:6px; color:#454a52; font-weight:500; }
.rotation-preview table { width:100%; border-collapse:collapse; font-size:13px; }
.rotation-preview th { font-size:10px; color:#81858c; font-weight:400; padding:0 8px 8px; text-align:right; }
.rotation-preview th:first-child,.rotation-preview td:first-child { text-align:left; }
.rotation-preview td { padding:9px 8px; text-align:right; border-bottom:1px solid #f0f1f2; }
.rotation-preview td small { display:block; font-size:10px; color:#8a8e94; margin-top:3px; }
.rotation-preview td b { font-weight:600; }
.rotation-base { background:#f5f6f7; }
.rotation-muted { color:#989ca2; font-size:11px; }
.rotation-chart-heading { display:flex; justify-content:space-between; margin-top:17px; align-items:center; }
.rotation-chart-heading b { font-size:11px; font-weight:500; }
.rotation-chart-heading>span { font-size:10px; color:#90949a; }
.rotation-legend { display:flex; gap:15px; margin-top:9px; font-size:10px; color:#70757c; }
.rotation-legend span { display:flex; gap:5px; align-items:center; }
.rotation-chart { display:block; width:100%; height:auto; margin-top:4px; }
.rotation-chart text { font-size:10px; fill:#90949a; }
.rotation-footnote { font-size:10px; color:#90949a; margin:8px 0 0; line-height:1.7; }
@media(max-width:1099px) {
 .has-rotation-preview .turnover-layout { grid-template-columns:minmax(0,1fr) 180px; gap:16px; }
 .rotation-preview { grid-column:1/-1; border-left:0; border-top:1px solid #e5e7eb; padding:16px 0 0; }
}
@media(max-width:740px) {
 .has-rotation-preview .turnover-layout { grid-template-columns:minmax(0,1fr); }
 .has-rotation-preview .turnover-summary { padding-left:0; }
}

/* Market turnover and rotation dashboard, local comparison layout. */
#marketTurnover.rotation-dashboard { display:grid; grid-template-columns:minmax(0,1.22fr) minmax(0,1fr); column-gap:24px; row-gap:16px; align-items:start; }
.rotation-dashboard .turnover-layout { display:contents; }
.rotation-dashboard>h3 { grid-column:1; grid-row:1; margin:0; }
.rotation-dashboard .turnover-summary { grid-column:1; grid-row:2; border:0; padding:0; }
.rotation-dashboard .turnover-metrics { grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; padding:14px; border-radius:8px; background:var(--fill); }
.rotation-dashboard .turnover-metrics strong { font-size:17px; font-weight:600; }
.rotation-dashboard .turnover-metrics span { font-size:10px; }
.rotation-dashboard .turnover-visual { grid-column:1; grid-row:3; }
.rotation-dashboard .turnover-status { margin-top:8px; }
.rotation-dashboard>.chart-note { grid-column:1; grid-row:4; margin:0; }
.rotation-dashboard .rotation-preview { grid-column:2; grid-row:1/5; border:1px solid var(--line); border-radius:12px; padding:18px; background:var(--card); }
.rotation-dashboard .rotation-heading h3 { font-size:17px; }
.rotation-dashboard .rotation-context { margin-bottom:8px; }
.rotation-description { font-size:11px; color:var(--muted); line-height:1.6; margin:0 0 14px; }
.rotation-block { border:1px solid var(--line); border-radius:8px; padding:12px; margin:0 0 12px; min-width:0; }
.rotation-block h4 { font-size:13px; font-weight:600; margin:0 0 12px; }
.rotation-block h4 small { font-size:10px; font-weight:400; color:var(--muted); margin-left:6px; }
.rotation-dashboard .rotation-legend { flex-wrap:wrap; gap:8px 15px; }
.rotation-dashboard table { font-size:11px; table-layout:fixed; }
.rotation-dashboard th { font-size:9px; padding:0 3px 8px; white-space:nowrap; }
.rotation-dashboard th:first-child { width:29%; }
.rotation-dashboard td { padding:9px 3px; white-space:nowrap; }
.rotation-dashboard td small { padding-left:13px; font-size:9px; }
.rotation-table-note { font-size:9px; color:var(--muted); margin:10px 0 0; }
.rotation-insight { display:flex; gap:12px; align-items:center; padding:12px; background:var(--fill); border:1px solid var(--line); border-radius:8px; }
.rotation-insight>svg { flex:0 0 48px; }
.rotation-insight strong { font-size:12px; font-weight:600; }
.rotation-insight p { font-size:10px; line-height:1.7; color:var(--muted); margin:5px 0 0; }
@media(min-width:1100px) {
 .market-turnover .rotation-dashboard .turnover-visual>svg { height:320px; }
 .market-turnover .rotation-dashboard .turnover-visual>.turnover-delta-chart { height:130px; }
}
@media(max-width:1099px) {
 #marketTurnover.rotation-dashboard { display:block; }
 .rotation-dashboard .turnover-layout { display:flex; flex-direction:column; gap:18px; }
 .rotation-dashboard .turnover-layout>* { width:100%; }
 .rotation-dashboard .turnover-summary { order:-1; }
 .rotation-dashboard .rotation-preview { padding:14px; }
 .rotation-dashboard>.chart-note { margin-top:12px; }
}
@media(max-width:480px) {
 .rotation-dashboard .turnover-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
 .rotation-dashboard .rotation-preview { padding:10px; }
 .rotation-block { padding:9px; }
}

/* Native chart controls: text actions share one type scale. */
.trend-dialog .trend-controls :is([data-open-trend],[data-trend="latest"],[data-trend="reset"]){font-family:inherit;font-size:12px;font-weight:400}
.trend-inline .trend-controls :is([data-open-trend],[data-trend="latest"],[data-trend="reset"]){font-size:11px}
.trend-dialog .trend-monitor-actions{flex-wrap:wrap}
