/* Xiaobai 2026 visual renovation
   Structural layer built on semantic tokens. Page-specific character (notably Wentian)
   remains owned by the underlying feature styles. */

html { background: var(--surface-canvas); }

body {
  grid-template-columns: 204px minmax(0, 1fr);
  grid-template-rows: 56px minmax(0, 1fr) 28px;
  background: var(--surface-canvas);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; letter-spacing: 0; }

/* Shell: preserve the app's own navigation model, but tighten its hierarchy. */
.app-header {
  min-height: 56px;
  height: 56px;
  grid-template-columns: 204px minmax(0, 1fr);
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .97);
  box-shadow: none;
}

.brand-block { min-width: 186px; gap: 10px; }
.brand-mark { width: 30px; height: 30px; }
.brand-block h1 { font-size: 15px; font-weight: 760; color: var(--text-primary); }
.market-tape { gap: 18px; color: var(--text-secondary); font-size: 12px; }
.market-item strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.market-item.up strong { color: var(--danger); }
.market-item.down strong { color: var(--success); }

.header-actions { gap: 7px; }
.header-date-group,
.icon-button,
.button,
.date-input {
  min-height: var(--control-height);
  border-color: var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: none;
}

.button {
  padding: 0 12px;
  background: var(--surface-raised);
  color: var(--xb-gray-700);
  font-size: 12px;
  font-weight: 620;
  transition: border-color var(--duration-fast), color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast);
}
.button:hover { border-color: #b8c7e8; color: var(--primary); background: var(--xb-gray-25); }
.button:active { transform: translateY(1px); }
.button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.button.primary:hover { border-color: var(--primary-hover); background: var(--primary-hover); color: #fff; }

.module-nav {
  top: 56px;
  width: 204px;
  height: calc(100vh - 56px);
  padding: 9px 8px 10px;
  border-right: 1px solid var(--border);
  background: var(--surface-raised);
  box-shadow: none;
}

.nav-brand { padding: 5px 9px 8px; color: var(--text-tertiary); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.nav-group { gap: 1px; margin: 0 0 8px; }
.nav-group-label { padding: 9px 9px 5px; color: var(--text-tertiary); font-size: 11px; font-weight: 650; }
.module-tab {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  color: #4b5565;
  font-size: 12.5px;
  gap: 9px;
  transition: color var(--duration-fast), background var(--duration-fast);
}
.module-tab .lucide { width: 16px; height: 16px; color: #8d96a7; }
.module-tab:hover { background: var(--xb-gray-50); color: var(--text-primary); }
.module-tab.active { background: var(--xb-blue-50); color: var(--primary); font-weight: 700; box-shadow: none; }
.module-tab.active .lucide { color: var(--primary); }
.sidebar-collapse-button { margin-top: auto; border-top: 1px solid var(--border); color: var(--text-secondary); }

.app-main {
  width: auto;
  min-width: 0;
  margin-left: 0;
  padding: 0;
  background: var(--surface-canvas);
}

body.sidebar-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
body.sidebar-collapsed .app-main { margin-left: 0; }

/* Market summary: one calm strip by default, full metric card only on demand. */
.overview-strip {
  position: relative;
  display: grid;
  grid-template-columns: minmax(178px, 1.25fr) repeat(5, minmax(74px, .55fr)) minmax(180px, 1fr) 104px;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  gap: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-raised);
  box-shadow: none;
}

.overview-strip .sentiment-block,
.overview-strip .metric {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--xb-gray-100);
  background: transparent;
}

.overview-strip .sentiment-gauge { width: 26px; height: 26px; flex: 0 0 26px; border-width: 2px; font-size: 10px; }
.overview-strip .sentiment-text { font-size: 12px; white-space: nowrap; }
.overview-strip .metric-label { color: var(--text-tertiary); font-size: 10.5px; white-space: nowrap; }
.overview-strip .metric-value { color: var(--text-primary); font-size: 13px; font-weight: 720; white-space: nowrap; font-variant-numeric: tabular-nums; }
.overview-strip .metric-value.small { overflow: hidden; font-size: 11.5px; text-overflow: ellipsis; }
.overview-strip .metric-value.up { color: var(--danger); }
.overview-strip .metric-value.down { color: var(--success); }
.overview-strip .metric-value.warning { color: var(--warning); }

.overview-toggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 11.5px;
  cursor: pointer;
}
.overview-toggle .lucide { width: 14px; height: 14px; }

.overview-strip[data-overview-expanded="true"] {
  grid-template-columns: minmax(200px, 1.2fr) repeat(5, minmax(90px, .62fr)) minmax(190px, 1fr) 104px;
  min-height: 76px;
}
.overview-strip[data-overview-expanded="true"] .sentiment-block,
.overview-strip[data-overview-expanded="true"] .metric { min-height: 76px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 4px; }
.overview-strip[data-overview-expanded="true"] .sentiment-block { flex-direction: row; justify-content: flex-start; align-items: center; }
.overview-strip[data-overview-expanded="true"] .sentiment-gauge { width: 48px; height: 48px; flex-basis: 48px; font-size: 13px; }
/* Page frame and shared information architecture. */
.workspace-view,
body[data-active-view="screenerView"] .workspace-view,
body[data-active-view="mentorView"] .workspace-view,
body[data-active-view="reviewWorkspaceView"] .workspace-view {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 14px 16px 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.workspace-view.active-view { display: block; }
.workspace-view.active-view.view-entering { animation: xb-view-enter 240ms ease both; }
@keyframes xb-view-enter { from { opacity: .35; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.section-toolbar {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
}
.section-title-group { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.section-title-group h2 { margin: 0; color: var(--text-primary); font-size: 17px; line-height: 1.25; font-weight: 780; }
.section-subtitle { color: var(--text-tertiary); font-size: 11.5px; }
.count-badge { min-height: 22px; padding: 2px 7px; border-radius: 5px; background: var(--xb-gray-200); color: var(--text-secondary); font-size: 11px; }
.toolbar-controls { margin-left: auto; gap: 7px; }

.page-headline-stats { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.page-headline-stats span { min-height: 27px; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-raised); color: var(--text-secondary); font-size: 11px; }
.page-headline-stats strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }

.table-frame,
.phase-table-frame,
.sentiment-chart-card,
.sentiment-composition-card,
.rotation-history-panel,
.performance-panel,
.theme-library-layout,
.popularity-layout,
.auction-workspace,
.review-panel,
.review-section,
.dragon-workspace {
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
}

.table-frame { overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table thead th {
  height: 36px;
  padding: 0 11px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}
.data-table tbody td { height: 42px; padding: 6px 11px; border-bottom: 1px solid #edf0f4; color: var(--xb-gray-700); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background var(--duration-fast); }
.data-table tbody tr:hover td { background: #f8faff; }
.data-table .stock-name { color: var(--text-primary); font-weight: 700; }
.number { font-variant-numeric: tabular-nums; }

.segmented { padding: 2px; border: 0; border-radius: 7px; background: #eceff4; }
.segment { min-height: 28px; padding: 0 10px; border: 0; border-radius: 5px; color: var(--text-secondary); font-size: 11.5px; }
.segment.active { background: var(--surface-raised); color: var(--text-primary); box-shadow: 0 1px 2px rgba(16, 24, 40, .09); }

.search-field,
.curated-search,
.form-field input,
.form-field select,
.form-field textarea {
  border-color: var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: none;
}
.search-field:focus-within,
.curated-search:focus-within,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: #8eacef; box-shadow: 0 0 0 3px rgba(53, 106, 230, .1); }

/* Market ladder: the tier bands are the main actor; interpretation stays secondary. */
.ladder-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 294px; gap: 12px; align-items: start; }
.ladder-board { display: flex; flex-direction: column; gap: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); overflow: hidden; }
.ladder-step {
  --ladder-accent: var(--primary);
  --ladder-tint: var(--xb-blue-50);
  width: 100%;
  min-height: 92px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  align-items: stretch;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-raised);
  box-shadow: none;
}
.ladder-step:last-child { border-bottom: 0; }
.ladder-step[data-ladder-level-card="1"] { --ladder-accent: #336ae8; --ladder-tint: #eef4ff; }
.ladder-step[data-ladder-level-card="2"] { --ladder-accent: #159953; --ladder-tint: #edf9f2; }
.ladder-step[data-ladder-level-card="3"] { --ladder-accent: #d67b05; --ladder-tint: #fff7e8; }
.ladder-step[data-ladder-level-card="4"] { --ladder-accent: #db4d3f; --ladder-tint: #fff1f0; }
.ladder-step[data-ladder-level-card="5"],
.ladder-step[data-ladder-level-card="6"],
.ladder-step[data-ladder-level-card="7"] { --ladder-accent: #9a4c76; --ladder-tint: #fbf1f7; }

.ladder-step-header {
  min-width: 0;
  display: block;
  padding: 15px 13px;
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--ladder-tint);
}
.ladder-level-dot { width: 8px; height: 8px; display: inline-block; margin-right: 6px; border-radius: 50%; background: var(--ladder-accent); vertical-align: 1px; }
.ladder-step-header > div { display: inline; }
.ladder-step-header strong { display: inline; color: var(--ladder-accent); font-size: 15px; font-weight: 800; }
.ladder-step-header small { display: block; margin: 5px 0 0 15px; color: var(--text-secondary); font-size: 11px; }
.ladder-step-header em { display: block; margin: 8px 0 0 15px; color: var(--text-secondary); font-size: 10.5px; font-style: normal; line-height: 1.45; }

.ladder-step-stocks { min-width: 0; display: flex; align-content: center; align-items: center; flex-wrap: wrap; gap: 7px; padding: 12px 14px; }
.ladder-step .ladder-stock {
  min-width: 196px;
  max-width: 240px;
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid #dfe4ec;
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--text-primary);
  text-align: left;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast);
}
.ladder-step .ladder-stock:hover { border-color: #aebfe5; background: #fff; color: var(--text-primary); box-shadow: 0 5px 14px rgba(31, 55, 100, .09); transform: translateY(-1px); }
.ladder-stock-title { display: flex; align-items: center; gap: 5px; min-width: 0; }
.ladder-stock-title strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.ladder-stock-title .stock-code { color: var(--text-tertiary); font-size: 10px; }
.ladder-stock-tag { margin-left: auto; padding: 2px 5px; border-radius: 4px; background: var(--xb-red-50); color: var(--danger); font-size: 9.5px; font-style: normal; white-space: nowrap; }
.ladder-stock-tag.broken { background: var(--xb-amber-50); color: var(--warning); }
.ladder-stock-meta { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-tertiary); font-size: 9.5px; }
.ladder-stock-meta b { max-width: 78px; overflow: hidden; padding: 2px 5px; border-radius: 4px; background: var(--xb-blue-50); color: var(--primary); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ladder-stock-meta small { white-space: nowrap; }
.ladder-more { align-self: center; margin-right: 12px; padding: 7px 8px; border: 1px dashed var(--border-strong); border-radius: 6px; color: var(--text-secondary); font-size: 11px; white-space: nowrap; }
.ladder-gap { min-height: 68px; background: repeating-linear-gradient(135deg, #fff, #fff 9px, #fafbfc 9px, #fafbfc 18px); }
.ladder-gap .ladder-step-header { background: rgba(248, 249, 251, .86); }
.ladder-gap-note { color: var(--text-tertiary); font-size: 11.5px; }

.ladder-insights { display: grid; gap: 10px; }
.ladder-insight-card { border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); overflow: hidden; }
.ladder-insight-card > header { min-height: 40px; display: flex; align-items: center; padding: 0 13px; border-bottom: 1px solid var(--border); }
.ladder-insight-card > header h3 { margin: 0; font-size: 13.5px; }
.ladder-insight-card > header span { margin-left: auto; padding: 2px 6px; border-radius: 4px; background: var(--xb-gray-100); color: var(--text-secondary); font-size: 10px; }
.ladder-insight-card > p { margin: 0; padding: 0 13px 12px; color: var(--text-secondary); font-size: 10.5px; line-height: 1.65; }
.ladder-apex { display: flex; flex-direction: column; gap: 5px; padding: 14px 13px 9px; }
.ladder-apex strong { color: var(--danger); font-size: 25px; }
.ladder-apex span { color: var(--text-primary); font-size: 12px; font-weight: 650; line-height: 1.55; }
.ladder-structure-bars { display: grid; gap: 7px; padding: 12px 13px; }
.ladder-structure-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 38px; align-items: center; gap: 7px; font-size: 10.5px; }
.ladder-structure-row > span { color: var(--text-secondary); text-align: right; }
.ladder-structure-row > i,
.ladder-rate-list i { height: 8px; overflow: hidden; border-radius: 4px; background: var(--xb-gray-100); }
.ladder-structure-row > i b { height: 100%; display: block; border-radius: inherit; background: var(--primary); }
.ladder-structure-row:nth-child(2) > i b { background: var(--danger); }
.ladder-structure-row:nth-child(3) > i b { background: var(--warning); }
.ladder-structure-row:nth-child(4) > i b { background: var(--success); }
.ladder-structure-row.is-gap i { background: repeating-linear-gradient(135deg, #e8ebf0, #e8ebf0 4px, #f6f7f9 4px, #f6f7f9 8px); }
.ladder-structure-row > strong { font-size: 10.5px; }
.ladder-rate-list { display: grid; gap: 9px; padding: 12px 13px; }
.ladder-rate-list > div { display: grid; grid-template-columns: 72px minmax(0, 1fr) 42px; align-items: center; gap: 7px; color: var(--text-secondary); font-size: 10px; }
.ladder-rate-list i b { height: 100%; display: block; border-radius: inherit; background: var(--primary); }
.ladder-rate-list strong { color: var(--text-primary); text-align: right; }

/* Rotation: nine-day heat matrix and cross-day tracking. */
.rotation-history-panel { overflow: hidden; padding: 0; }
.rotation-history-heading { min-height: 44px; display: flex; align-items: center; padding: 0 13px; border-bottom: 1px solid var(--border); }
.rotation-history-heading h3 { margin: 0; font-size: 13.5px; }
.rotation-history-heading span { margin-left: 7px; color: var(--text-tertiary); font-size: 11px; }
.rotation-legend { min-height: 34px; display: flex; align-items: center; gap: 13px; padding: 0 13px; border-bottom: 1px solid #edf0f4; color: var(--text-secondary); font-size: 10.5px; }
.rotation-legend span { display: inline-flex; align-items: center; gap: 4px; }
.rotation-legend small { margin-left: auto; color: var(--text-tertiary); }
.rotation-swatch { width: 14px; height: 9px; border-radius: 2px; background: rgba(53, 106, 230, .12); }
.rotation-swatch.warm { background: rgba(53, 106, 230, .30); }
.rotation-swatch.strong { background: rgba(53, 106, 230, .56); }

.rotation-tracker { min-height: 48px; display: flex; align-items: center; gap: 20px; padding: 7px 13px; border-bottom: 1px solid #cbd9f7; background: var(--xb-blue-50); }
.rotation-tracker[hidden] { display: none; }
.rotation-tracker-copy { min-width: 210px; display: flex; flex-direction: column; gap: 3px; }
.rotation-tracker-copy strong { color: var(--primary); font-size: 13px; }
.rotation-tracker-copy span { color: #526b9f; font-size: 10.5px; }
.rotation-tracker-spark { height: 32px; flex: 1; display: grid; grid-template-columns: repeat(9, minmax(20px, 1fr)); align-items: end; gap: 4px; }
.rotation-tracker-spark > span { height: 100%; display: flex; align-items: end; justify-content: center; position: relative; }
.rotation-tracker-spark i { width: min(18px, 70%); height: var(--spark-height); min-height: 5px; display: block; border-radius: 3px 3px 0 0; background: #88aaf1; }
.rotation-tracker-spark small { position: absolute; top: -1px; color: #4664a0; font-size: 8px; }
.rotation-tracker-spark .missing i { height: 7px; border: 1px dashed #b7c5e0; border-bottom: 0; background: transparent; }

.rotation-history { width: 100%; min-height: 0; display: grid; grid-template-columns: repeat(9, minmax(112px, 1fr)); gap: 0; padding: 0; overflow-x: auto; }
.rotation-day { min-width: 112px; border: 0; border-right: 1px solid #edf0f4; border-radius: 0; background: #fff; box-shadow: none; }
.rotation-day:last-child { border-right: 0; }
.rotation-day > header { min-height: 42px; padding: 7px 9px; border-bottom: 1px solid #edf0f4; background: var(--surface-subtle); }
.rotation-day > header time { display: block; color: var(--text-primary); font-size: 11px; font-weight: 700; }
.rotation-day > header span { display: block; margin-top: 2px; color: var(--text-tertiary); font-size: 9.5px; }
.rotation-day.latest-day > header { background: var(--xb-blue-50); }
.rotation-day.latest-day > header time { color: var(--primary); }
.rotation-day-sectors { display: grid; gap: 0; padding: 0; }
.rotation-sector-chip {
  min-width: 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 0;
  border-bottom: 1px dashed rgba(135, 149, 173, .22);
  border-radius: 0;
  background: rgba(53, 106, 230, calc(.04 + var(--rotation-heat) * .46));
  text-align: left;
  transition: opacity var(--duration-fast), filter var(--duration-fast), box-shadow var(--duration-fast);
}
.rotation-sector-chip:hover { filter: saturate(1.08) brightness(.97); }
.rotation-sector-chip strong { min-width: 0; overflow: hidden; color: var(--text-primary); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rotation-sector-chip small { grid-column: 2; margin-top: -4px; color: #5d6b82; font-size: 8.5px; white-space: nowrap; }
.rotation-sector-chip small b { color: var(--text-primary); }
.rotation-rank { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 4px; background: rgba(255, 255, 255, .72); color: var(--text-secondary); font-size: 8.5px; font-weight: 750; }
.rotation-rank.rank-1 { background: #df493b; color: #fff; }
.rotation-rank.rank-2 { background: #f07754; color: #fff; }
.rotation-rank.rank-3 { background: #e8a226; color: #fff; }
.rotation-history.tracking .rotation-sector-chip:not(.selected) { opacity: .20; }
.rotation-history.tracking .rotation-sector-chip.selected { opacity: 1; box-shadow: inset 0 0 0 2px var(--primary); }
.rotation-detail-toolbar { margin-top: 13px; }
.rotation-detail-row { cursor: pointer; }
.rotation-detail-row.selected td { background: var(--xb-blue-50) !important; }

/* Screener: method tabs lead; working state and results stay in the first viewport. */
#screenerView { padding-top: 12px; }
.screener-page-heading { margin-bottom: -36px; pointer-events: none; }
.screener-mode-tabs { min-height: 38px; justify-content: flex-end; gap: 2px; margin: 0 0 12px; padding: 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; }
.screener-mode-tabs button { min-height: 38px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--text-secondary); font-size: 12px; }
.screener-mode-tabs button:hover { background: transparent; color: var(--text-primary); }
.screener-mode-tabs button.active { border-bottom-color: var(--primary); background: transparent; color: var(--primary); }
#screenerView .screener-strategy-view { display: grid; gap: 10px; padding: 0; background: transparent; }
.screener-stepper { min-height: 56px; margin: 0; padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); }
.screener-step { min-width: 0; }
.screener-step .step-marker { width: 22px; height: 22px; font-size: 10px; }
.screener-step strong { font-size: 11.5px; }
.screener-step small { font-size: 9.5px; }
.screener-overview-grid { gap: 10px; margin: 0; }
.screener-overview-card { min-height: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); }
.screener-runbar { margin: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); }
.screener-backtest-strip { margin: 0; border: 1px solid #ecdcb8; border-radius: var(--card-radius); }

.curated-screener-panel { height: auto; min-height: 0; display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; overflow: visible; }
.curated-library-pane { min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); }
.curated-library-heading { min-height: 34px; align-items: center; }
.curated-library-heading > div { display: flex; align-items: baseline; gap: 8px; }
.curated-library-heading span { color: var(--text-tertiary); font-size: 10px; }
.curated-library-heading h3 { margin: 0; font-size: 14px; }
.curated-library-controls { display: flex; align-items: center; gap: 10px; margin: 9px 0 12px; }
.curated-search { width: 220px; height: 34px; flex: 0 0 220px; margin: 0; }
.curated-category-filters { flex: 1; margin: 0; }
.curated-strategy-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin: 0; max-height: none; overflow: visible; }
.curated-strategy-card {
  width: 100%;
  min-height: 176px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-primary);
  text-align: left;
  transition: border-color var(--duration-normal), box-shadow var(--duration-normal), transform var(--duration-normal);
}
.curated-strategy-card:hover { border-color: #adbee7; box-shadow: 0 7px 19px rgba(35, 66, 124, .09); transform: translateY(-2px); }
.curated-strategy-card.active { border-color: #8aa8eb; background: #fbfdff; box-shadow: inset 0 3px var(--primary), 0 6px 16px rgba(35, 66, 124, .08); }
.curated-card-head { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.curated-strategy-rank { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 5px; background: var(--xb-gray-100); color: var(--text-secondary); font-size: 10px; font-style: normal; }
.curated-card-head span strong,
.curated-card-head span small { display: block; }
.curated-card-head span strong { font-size: 13px; }
.curated-card-head span small { margin-top: 2px; color: var(--text-tertiary); font-size: 9.5px; }
.curated-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.curated-card-tags em { padding: 2px 6px; border-radius: 4px; background: var(--xb-blue-50); color: var(--primary); font-size: 9.5px; font-style: normal; }
.curated-card-tags em:nth-child(2) { background: var(--xb-gray-100); color: var(--text-secondary); }
.curated-card-tags em:nth-child(3) { background: var(--xb-amber-50); color: var(--warning); }
.curated-card-description { flex: 1; color: var(--text-secondary); font-size: 11px; line-height: 1.65; }
.curated-card-foot { display: flex; align-items: center; padding-top: 8px; border-top: 1px solid #edf0f4; }
.curated-card-foot small { color: var(--text-tertiary); font-size: 9.5px; }
.curated-card-foot strong { margin-left: auto; display: inline-flex; align-items: center; gap: 3px; color: var(--primary); font-size: 10.5px; }
.curated-card-foot .lucide { width: 12px; height: 12px; }
.curated-detail-pane { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); }
.curated-detail-header { padding-bottom: 13px; }
.curated-detail-grid { padding: 14px 0; }
.curated-execution-bar { min-height: 54px; }

.quant-screener-panel { height: auto; min-height: 0; margin: 0; gap: 10px; border: 0; background: transparent; box-shadow: none; }
.quant-builder-pane,
.quant-preview-pane { border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); overflow: hidden; }

/* Secondary pages: consistent card rhythm without erasing feature identity. */
.sentiment-cycle-hero,
.sentiment-stage-strip,
.auction-expectation-panel,
.auction-theme-panel,
.auction-volume-panel,
.auction-news-panel,
.theme-directory-panel,
.theme-detail-panel,
.popularity-main-panel,
.popularity-side-panel,
.mentor-directory-panel,
.mentor-chat-panel,
.review-summary-panel,
.review-content-panel {
  border-color: var(--border);
  border-radius: var(--card-radius);
  background: var(--surface-raised);
  box-shadow: var(--card-shadow);
}

.inline-notice { border-radius: 7px; font-size: 11.5px; }
.empty-state { color: var(--text-tertiary); font-size: 11.5px; }
.dialog-card,
.settings-card,
.stock-detail-card,
.entity-detail-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-float);
}

/* Page architecture: independent modules, deliberate whitespace, one primary task. */
.screener-page-bar {
  min-height: 46px;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.screener-page-bar .screener-page-heading { min-height: 45px; flex: 1; margin: 0; padding-bottom: 10px; pointer-events: auto; }
.screener-page-bar .screener-mode-tabs { min-height: 45px; flex: 0 0 auto; margin: 0; border: 0; }
.screener-page-bar .screener-mode-tabs button { min-height: 45px; }

#screenerView .screener-strategy-view { gap: 14px; }
#screenerView .screener-overview-grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: 14px; }
#screenerView .screener-overview-card { padding: 0; overflow: hidden; }
#screenerView .screener-card-heading { min-height: 42px; padding: 0 16px; border-bottom: 1px solid var(--border); }
#screenerView .screener-card-heading h3 { font-size: 14px; }
#screenerView .screener-regime-body {
  display: grid;
  grid-template-columns: 138px 128px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  padding: 0;
}
#screenerView .regime-summary,
#screenerView .regime-temperature { min-height: 112px; display: flex; flex-direction: column; justify-content: center; padding: 16px; border-right: 1px solid var(--border); }
#screenerView .regime-summary strong { color: var(--danger); font-size: 25px; line-height: 1.1; }
#screenerView .regime-summary span { margin-top: 7px; color: var(--text-secondary); font-size: 10.5px; }
#screenerView .regime-temperature span { color: var(--text-secondary); font-size: 10.5px; }
#screenerView .regime-temperature strong { margin-top: 4px; color: var(--text-primary); font-size: 25px; font-variant-numeric: tabular-nums; }
#screenerView .regime-temperature small { margin-top: 5px; color: var(--success); font-size: 10.5px; }
#screenerView .regime-evidence { min-width: 0; min-height: 112px; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 14px 16px; border: 0; border-radius: 0; background: var(--xb-amber-50); }
#screenerView .regime-evidence strong { color: #925806; font-size: 12px; line-height: 1.55; }
#screenerView .regime-evidence div { max-height: none; overflow: visible; color: #a26a18; font-size: 10.5px; line-height: 1.55; }
#screenerView .regime-selector { min-height: 54px; display: flex; align-items: center; gap: 5px; padding: 9px 16px; border-top: 1px solid var(--border); background: var(--surface-subtle); }
#screenerView .regime-selector::before { content: "阶段校准"; margin-right: 4px; color: var(--text-tertiary); font-size: 10px; }
#screenerView .regime-selector button { min-height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: 5px; background: #fff; font-size: 10.5px; }
#screenerView .factor-data-status { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-top: 1px solid var(--border); }
#screenerView .factor-data-status small { margin-left: auto; }

#screenerView .screener-strategy-summary { min-height: 208px; display: flex; flex-direction: column; padding: 18px 18px 14px; }
#screenerView .screener-strategy-title { align-items: flex-start; }
#screenerView .screener-strategy-title strong { font-size: 18px; }
#screenerView .screener-strategy-summary > p { flex: 1; margin: 13px 0; color: var(--text-secondary); font-size: 12px; line-height: 1.75; }
#screenerView .screener-strategy-actions { margin-top: auto; }

#screenerView .screener-stepper { min-height: 48px; margin: 0; padding: 6px 14px; box-shadow: none; }
#screenerView .screener-step .step-marker { width: 20px; height: 20px; }
#screenerView .screener-step strong { font-size: 10.5px; }
#screenerView .screener-step small { font-size: 9px; }
#screenerView .screener-runbar { min-height: 56px; padding: 9px 12px; }
#screenerView .screener-results-view,
#screenerView .strategy-tracking-panel { margin-top: 16px; padding: 13px; border: 1px solid var(--border); border-radius: var(--card-radius); background: var(--surface-raised); box-shadow: var(--card-shadow); }
#screenerView .screener-results-view .section-toolbar,
#screenerView .strategy-tracking-panel .section-toolbar { margin-bottom: 10px; }
#screenerView .screener-result-frame,
#screenerView .tracking-table-frame { border-radius: 7px; }

.curated-screener-panel { gap: 16px; }
.curated-library-pane { padding: 16px; }
.curated-library-heading { min-height: 38px; }
.curated-library-controls { margin: 10px 0 14px; }
.curated-strategy-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.curated-strategy-card { min-height: 190px; padding: 14px; }
.curated-card-foot { min-height: 38px; gap: 8px; }
.curated-card-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.curated-card-actions button { min-height: 28px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: 5px; background: #fff; color: var(--text-secondary); font-size: 10.5px; }
.curated-card-actions button.primary { border-color: var(--primary); background: var(--primary); color: #fff; }
.curated-card-actions button:disabled { border-color: var(--border); background: var(--xb-gray-100); color: var(--text-tertiary); cursor: not-allowed; }
.curated-card-actions .lucide { width: 11px; height: 11px; }
.curated-detail-dialog { width: min(860px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 32px)); padding: 0; overflow: visible; border: 0; border-radius: 10px; background: transparent; }
.curated-detail-dialog::backdrop { background: rgba(20, 29, 44, .38); backdrop-filter: blur(3px); }
.curated-detail-dialog .curated-detail-pane { position: relative; max-height: min(760px, calc(100dvh - 32px)); overflow-y: auto; padding: 20px; }
.curated-detail-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.curated-detail-dialog .curated-detail-header { padding-right: 48px; }

.quant-screener-panel { grid-template-columns: minmax(0, 1.12fr) minmax(380px, .88fr); gap: 14px; align-items: start; }
.quant-builder-pane,
.quant-summary-pane { min-width: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.quant-panel-heading,
.quant-summary-pane > header { min-height: 52px; display: flex; align-items: center; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.quant-panel-heading > div span,
.quant-summary-pane > header span { color: var(--primary); font-size: 10px; font-weight: 700; }
.quant-panel-heading h3,
.quant-summary-pane > header h3 { margin: 2px 0 0; font-size: 14px; }
.quant-panel-heading .button { margin-left: auto; }
.quant-universe-section,
.quant-rule-section { padding: 14px 16px; }
.quant-universe-section { border-bottom: 1px solid var(--border); }
.quant-universe-grid { grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: 9px; margin: 10px 0 0; padding: 0; border: 0; background: transparent; }
.quant-st-toggle { grid-column: 1 / 4; min-height: 36px; padding: 0 10px; border-radius: 6px; background: var(--surface-subtle); }
.quant-rule-section + .quant-rule-section { border-top: 1px solid var(--border); }
.quant-rule-rows { gap: 8px; }
.quant-rule-row { min-height: 46px; border-color: var(--border); background: var(--surface-subtle); }
.quant-summary-pane > header { display: block; padding-top: 10px; }
.quant-filter-section { min-height: 164px; border-bottom: 1px solid var(--border); }
.quant-execution-heading { display: flex; align-items: center; padding: 14px 16px 0; }
.quant-execution-heading span { color: var(--text-primary); font-size: 12px; font-weight: 700; }
.quant-execution-heading small { margin-left: auto; color: var(--text-tertiary); font-size: 9.5px; }
.quant-formula-summary { margin: 10px 16px 14px; }
.quant-weight-status { margin: 0 16px 14px; }
.quant-summary-pane > .checkbox-control { margin: 0 16px 8px; }
.quant-summary-pane > .button { width: calc(100% - 32px); margin: 7px 16px 0; }
.quant-summary-pane > .quant-validation-message { margin: 10px 16px 14px; }

/* Shared module spacing for every workspace. */
.main-grid { gap: 14px; align-items: start; }
.main-grid > .table-frame { border-radius: var(--card-radius); }
.insight-rail { display: grid; gap: 12px; border: 0; background: transparent; }
.insight-rail .rail-section { border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.insight-rail .rail-section + .rail-section { border-top: 1px solid var(--border); }

#performanceView { display: none; }
#performanceView.active-view { display: block; }
#performanceView .performance-cards { gap: 12px; margin-bottom: 12px; }
#performanceView .market-breadth-panel { margin: 0 0 12px; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); }
#performanceView .performance-table-frame { margin-top: 0; }

.sentiment-cycle-summary { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.sentiment-cycle-analysis { gap: 14px; margin-bottom: 18px; }
.sentiment-trend-panel,
.sentiment-components-panel { border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.sentiment-detail-toolbar { margin-top: 0; }

.auction-workspace-layout { gap: 14px; align-items: start; }
.auction-main-workspace { border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.auction-evidence-rail { display: grid; gap: 12px; border: 0; background: transparent; }
.auction-evidence-section,
.auction-news-entry { border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.auction-evidence-section + .auction-evidence-section,
.auction-news-entry { border-top: 1px solid var(--border); }
.auction-evidence-section .auction-theme-row { border-bottom-style: solid; border-bottom-color: #edf0f4; }

#themeSummary,
#popularitySummary,
#dragonSummary { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.theme-library-layout { gap: 14px; border: 0; background: transparent; box-shadow: none; }
.theme-directory-panel,
.theme-detail-panel { border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.market-feature-filterbar { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); }

.dragon-filterbar { margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); }
.dragon-card-stage { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.dragon-trader-detail { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }

.review-workspace { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 14px; border: 0; background: transparent; box-shadow: none; }
.review-workspace .workspace-section { border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.review-workspace .watchlist-section,
.review-workspace .journal-section { min-height: 410px; }
.review-workspace .trade-journal-section,
.review-workspace .notes-history-section { grid-column: 1 / 3; }
.review-workspace .workspace-section + .workspace-section { border-top: 1px solid var(--border); }

@media (max-width: 1280px) {
  .overview-strip { grid-template-columns: minmax(160px, 1.15fr) repeat(5, minmax(64px, .5fr)) minmax(150px, 1fr) 82px; padding: 0 10px; }
  .overview-strip .sentiment-block,
  .overview-strip .metric { padding: 0 8px; }
  .overview-toggle span { display: none; }
  .ladder-workspace { grid-template-columns: minmax(0, 1fr) 260px; }
  .ladder-step { grid-template-columns: 104px minmax(0, 1fr) auto; }
  .ladder-step .ladder-stock { min-width: 180px; }
  .rotation-history { grid-template-columns: repeat(9, minmax(126px, 1fr)); }
  .curated-strategy-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .quant-screener-panel { grid-template-columns: minmax(0, 1fr) minmax(340px, .82fr); }
}

@media (max-width: 900px) {
  .app-main { margin-left: 0; }
  .workspace-view,
  body[data-active-view="screenerView"] .workspace-view,
  body[data-active-view="mentorView"] .workspace-view,
  body[data-active-view="reviewWorkspaceView"] .workspace-view { padding: 10px 10px 84px; }
  .overview-strip { grid-template-columns: minmax(150px, 1.3fr) repeat(3, minmax(58px, .5fr)); padding: 0 8px; }
  .overview-strip .metric:nth-of-type(n+4),
  .overview-strip .metric-wide { display: none; }
  .overview-toggle { justify-content: center; }
  .overview-strip[data-overview-expanded="true"] { grid-template-columns: repeat(3, 1fr); padding: 8px; }
  .overview-strip[data-overview-expanded="true"] .sentiment-block { grid-column: 1 / 4; min-height: 56px; }
  .overview-strip[data-overview-expanded="true"] .metric:nth-of-type(n),
  .overview-strip[data-overview-expanded="true"] .metric-wide { min-height: 54px; display: flex; border-bottom: 1px solid var(--border); }
  .overview-strip[data-overview-expanded="true"] .overview-toggle { min-height: 54px; }
  .section-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .section-title-group { align-items: flex-start; flex-direction: column; gap: 2px; }
  .page-headline-stats { width: 100%; margin-left: 0; overflow-x: auto; }
  .ladder-workspace { grid-template-columns: 1fr; }
  .ladder-insights { grid-template-columns: 1fr; }
  .ladder-step { grid-template-columns: 82px minmax(0, 1fr); }
  .ladder-step-stocks { padding: 9px; }
  .ladder-step .ladder-stock { min-width: min(100%, 188px); max-width: 100%; flex: 1 1 180px; }
  .ladder-more { grid-column: 2; margin: 0 9px 9px; }
  .rotation-history { grid-template-columns: repeat(9, 128px); }
  .rotation-legend small { display: none; }
  .screener-page-heading { margin-bottom: 0; pointer-events: auto; }
  .screener-page-bar { align-items: stretch; flex-direction: column; gap: 0; }
  .screener-mode-tabs { justify-content: stretch; }
  .screener-mode-tabs button { flex: 1; padding: 0 5px; }
  #screenerView .screener-overview-grid,
  .quant-screener-panel { grid-template-columns: 1fr; }
  #screenerView .screener-regime-body { grid-template-columns: 1fr 1fr; }
  #screenerView .regime-evidence { grid-column: 1 / 3; min-height: 80px; }
  .curated-library-controls { align-items: stretch; flex-direction: column; }
  .curated-search { width: 100%; flex-basis: auto; }
  .curated-strategy-list { grid-template-columns: 1fr; }
  .curated-detail-grid { grid-template-columns: 1fr; gap: 14px; }
  .review-workspace { grid-template-columns: 1fr; }
  .review-workspace .trade-journal-section,
  .review-workspace .notes-history-section { grid-column: 1; }
}

@media (max-width: 720px) {
  body,
  body.sidebar-collapsed {
    display: block;
    min-height: 100dvh;
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .app-header {
    width: 100%;
    height: 108px;
    min-height: 108px;
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 8px 10px 0;
  }

  .brand-block { height: 42px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-block h1 { font-size: 16px; }
  .header-actions { position: absolute; inset: 56px 10px auto; display: flex; justify-content: space-between; gap: 6px; }
  .header-date-group { height: 42px; min-width: 0; flex: 1; }
  .header-date-group .date-input { width: 104px; flex: 1; }
  .header-actions > .icon-button { width: 40px; min-width: 40px; min-height: 42px; }

  .module-nav,
  body.sidebar-collapsed .module-nav {
    width: 100%;
    height: calc(64px + env(safe-area-inset-bottom));
    min-height: 64px;
    position: fixed;
    inset: auto 0 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    padding: 4px 4px max(4px, env(safe-area-inset-bottom));
    overflow: hidden;
    border-top: 1px solid var(--border);
    border-right: 0;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -5px 18px rgba(16, 24, 40, .08);
  }

  .module-nav .nav-brand,
  .module-nav .nav-group-label,
  .module-nav .market-sub-tab,
  .module-nav .sidebar-collapse-button { display: none; }
  .module-nav .nav-group,
  body.sidebar-collapsed .module-nav .nav-group { display: contents; margin: 0; padding: 0; border: 0; }
  .module-nav .module-tab,
  body.sidebar-collapsed .module-nav .module-tab { min-height: 54px; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 3px; padding: 3px 2px; font-size: 10px; }
  .module-nav .module-tab.mobile-primary-tab,
  body.sidebar-collapsed .module-nav .module-tab.mobile-primary-tab { display: flex; }

  .app-main { width: 100%; min-height: calc(100dvh - 176px); margin: 0; padding: 10px 8px 20px; }
  .mobile-market-selector:not([hidden]) { margin-bottom: 8px; }
  .overview-strip {
    min-height: 108px;
    grid-template-columns: 1.3fr 1fr 1fr;
    grid-template-rows: 54px 54px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }
  .overview-strip .sentiment-block { grid-column: 1; grid-row: 1 / 3; min-height: 108px; }
  .overview-strip .metric:nth-of-type(1) { grid-column: 2; grid-row: 1; }
  .overview-strip .metric:nth-of-type(2) { grid-column: 3; grid-row: 1; }
  .overview-strip .metric:nth-of-type(3) { grid-column: 2; grid-row: 2; }
  .overview-strip .metric:nth-of-type(4) { grid-column: 3; grid-row: 2; display: flex; }
  .overview-strip .metric:nth-of-type(n+5),
  .overview-strip .metric-wide { display: none; }
  .overview-strip .sentiment-block,
  .overview-strip .metric { min-height: 54px; }
  .overview-toggle { display: none; }
  .workspace-view,
  body[data-active-view="screenerView"] .workspace-view,
  body[data-active-view="mentorView"] .workspace-view,
  body[data-active-view="reviewWorkspaceView"] .workspace-view { padding: 0 0 76px; }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-view.active-view.view-entering,
  .ladder-stock,
  .curated-strategy-card { animation: none !important; transition: none !important; }
}

body {
  grid-template-columns: 200px minmax(0, 1fr);
  grid-template-rows: 46px minmax(0, 1fr) 30px;
  background: var(--surface-canvas);
  font-size: 13px;
}

.app-header {
  min-height: 46px;
  height: 46px;
  grid-template-columns: 200px minmax(260px, 1fr) auto;
  padding: 0 14px 0 16px;
}

.brand-block { min-width: 184px; gap: 8px; }
.brand-mark,
.brand-logo { width: 27px; height: 27px; }
.brand-block h1 { font-size: 15px; font-weight: 760; }

.market-tape { display: flex; gap: 14px; font-size: 12px; }
.market-tape { grid-column: 2; grid-row: 1; min-width: 0; align-self: center; }
.market-item,
.market-item strong { font-size: 12px; white-space: nowrap; }

.header-actions { grid-column: 3; grid-row: 1; align-self: center; gap: 4px; }
.header-date-group { min-height: 32px; padding: 1px 2px; border-radius: 7px; background: #fff; }
.header-date-group .date-input { width: 122px; height: 28px; padding: 0 3px; font-size: 12px; font-weight: 650; }
.header-date-group .icon-button { width: 25px; min-height: 28px; }
.header-date-group .lucide { width: 14px; height: 14px; }
.date-input::-webkit-calendar-picker-indicator { opacity: .48; }

.header-actions > .icon-button {
  width: 31px;
  min-width: 31px;
  min-height: 31px;
  border-color: transparent;
  background: transparent;
  color: #647083;
}
.header-actions > .icon-button:hover { border-color: transparent; background: #f1f3f6; color: var(--primary); }
.header-actions > .icon-button .lucide { width: 15px; height: 15px; stroke-width: 1.8; }
.header-command-group { gap: 4px; }
.header-command-group .command-button { min-height: 31px; padding: 0 9px; border-radius: 7px; font-size: 11.5px; }
.header-command-group .command-button .lucide { width: 14px; height: 14px; }
.account-role-badges { gap: 3px; }
.account-role-badge { min-height: 27px; padding: 0 7px; border-radius: 14px; font-size: 10.5px; }
.account-button { max-width: 108px; }

.module-nav {
  top: 46px;
  width: 200px;
  height: calc(100vh - 46px);
  padding: 8px 8px 10px;
}
.nav-brand { min-height: 28px; padding: 0 9px; font-size: 10px; }
.nav-group { gap: 1px; }
.nav-group + .nav-group { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--border); }
.nav-group-label { height: 23px; padding: 0 9px; font-size: 10.5px; }
.module-tab { min-height: 34px; gap: 8px; padding: 0 10px; border-radius: 7px; font-size: 12.5px; font-weight: 500; }
.module-tab .lucide { width: 15px; height: 15px; stroke-width: 1.75; color: #8893a4; }
.module-tab.active { position: relative; font-weight: 650; }
.module-tab.active::before { content: ""; width: 3px; position: absolute; inset: 8px auto 8px 0; border-radius: 0 3px 3px 0; background: var(--primary); }
.sidebar-collapse-button { min-height: 34px; border-top: 1px solid var(--border); border-radius: 0; }

.app-main { padding: 0; }
.status-bar { padding: 0 16px; justify-content: center; color: var(--text-tertiary); font-size: 11px; }
.status-bar #statusText,
.status-bar #updatedAt { display: none; }
.status-bar .risk-note { margin: 0; }

.overview-strip {
  grid-template-columns: minmax(178px, 1.15fr) repeat(5, minmax(68px, .52fr)) minmax(168px, .9fr) 92px;
  min-height: 32px;
  height: 32px;
  padding: 0 12px;
}
.overview-strip .sentiment-block,
.overview-strip .metric { min-height: 32px; flex-direction: row; align-items: center; gap: 6px; padding: 0 10px; }
.overview-strip .sentiment-gauge { width: 20px; height: 20px; flex-basis: 20px; font-size: 8.5px; }
.overview-strip .sentiment-text { font-size: 11.5px; }
.overview-strip .metric-label { font-size: 10px; }
.overview-strip .metric-value { font-size: 12px; }
.overview-toggle { min-height: 32px; font-size: 11px; }
.overview-strip[data-overview-expanded="true"] { min-height: 70px; }
.overview-strip[data-overview-expanded="true"] { height: 70px; }
.overview-strip[data-overview-expanded="true"] .sentiment-block,
.overview-strip[data-overview-expanded="true"] .metric { min-height: 70px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; }

.workspace-view,
body[data-active-view="screenerView"] .workspace-view,
body[data-active-view="mentorView"] .workspace-view,
body[data-active-view="reviewWorkspaceView"] .workspace-view { padding: 14px 16px 24px; }
.section-toolbar { min-height: 34px; margin-bottom: 10px; }
.section-title-group h2 { font-size: 17px; font-weight: 800; }
.section-subtitle { font-size: 11.5px; }
.workspace-heading { min-height: 44px; padding: 9px 14px; }
.workspace-heading h3 { font-size: 14px; }
.table-frame,
.phase-table-frame { border-radius: var(--card-radius); }
.data-table thead th { height: 36px; font-size: 11.5px; }
.data-table tbody td { height: 41px; }

/* Sentiment keeps the full history while adopting the prototype's visual focus. */
.sentiment-cycle-analysis { grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; margin-bottom: 16px; }
.sentiment-analysis-rail { display: grid; gap: 12px; }
.sentiment-trend-panel,
.sentiment-cycle-summary,
.sentiment-components-panel { margin: 0; border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.sentiment-trend-panel .workspace-heading > div span { display: block; margin-top: 2px; color: var(--text-tertiary); font-size: 10.5px; }
.sentiment-chart-legend { min-height: 34px; display: flex; align-items: center; gap: 18px; padding: 0 14px; border-bottom: 1px solid #edf0f4; color: var(--text-secondary); font-size: 10.5px; }
.sentiment-chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sentiment-chart-legend span::before { content: ""; width: 12px; height: 3px; border-radius: 2px; background: var(--primary); }
.sentiment-chart-legend .retreat-point::before { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.sentiment-chart-legend .repair-point::before { width: 7px; height: 7px; border-radius: 50%; background: #e69a16; }
.sentiment-chart-legend .temperature-average::before { height: 1px; background: #c9d1dc; }
.sentiment-chart-shell { height: 320px; padding: 16px 18px 12px; }
.sentiment-cycle-summary { display: block; }
.sentiment-cycle-summary > .workspace-heading,
.sentiment-components-panel > .workspace-heading { border-bottom: 1px solid var(--border); }
.sentiment-cycle-current { min-height: 116px; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; padding: 13px 14px; border: 0; }
.sentiment-cycle-score-marker { width: 72px; height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #f3c9c3; border-left-width: 1px; border-radius: 9px; background: var(--xb-red-50); }
.sentiment-cycle-score-marker strong { color: var(--danger); font-size: 25px; line-height: 1; }
.sentiment-cycle-score-marker span { margin-top: 6px; color: var(--text-secondary); font-size: 9.5px; }
.sentiment-current-copy h3 { margin: 3px 0 2px; font-size: 15px; }
.sentiment-current-copy small { color: var(--text-tertiary); font-size: 10.5px; }
.sentiment-stage-state { grid-column: 1 / 3; min-height: 54px; display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 8px; margin: 0 -14px -13px; padding: 9px 14px; border-top: 1px solid var(--border); background: var(--xb-amber-50); }
.sentiment-stage-state span { grid-row: 1 / 3; }
.sentiment-stage-state strong { font-size: 16px; }
.sentiment-stage-state small { color: #9a650e; font-size: 10.5px; }
.sentiment-cycle-foot { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); }
.sentiment-cycle-foot .sentiment-cycle-state { min-height: 72px; padding: 10px 13px; border-right: 1px solid var(--border); }
.sentiment-cycle-foot .sentiment-cycle-state:last-child { border-right: 0; }
.sentiment-cycle-state span,
.sentiment-cycle-state small { display: block; color: var(--text-tertiary); font-size: 10px; }
.sentiment-cycle-state strong { display: block; margin: 4px 0 2px; color: var(--text-primary); font-size: 14px; }
.sentiment-component-list { padding: 8px 14px 11px; }
.sentiment-component-row { padding: 8px 0; }
.sentiment-detail-toolbar { margin-top: 0; }
.sentiment-history-frame { max-height: none; }

/* Ladder and pools use the same restrained hierarchy as the reference pages. */
.main-grid { grid-template-columns: minmax(0, 1fr) 310px; gap: 12px; }
.insight-rail { gap: 12px; }
.rail-heading { min-height: 42px; }
.ladder-workspace { grid-template-columns: minmax(0, 1fr) 320px; }
.ladder-step { grid-template-columns: 118px minmax(0, 1fr) auto; }
.ladder-step .ladder-stock { min-width: 174px; max-width: 220px; min-height: 55px; }
.ladder-insights { gap: 12px; }
.ladder-insight-card > header { min-height: 42px; }

/* Rotation order is a user choice; matrix remains a single nine-day canvas. */
.rotation-order-control { margin-right: 2px; }
.rotation-history-heading { min-height: 43px; }
.rotation-history { grid-template-columns: repeat(9, minmax(118px, 1fr)); }
.rotation-day > header { min-height: 43px; }
.rotation-sector-chip { min-height: 39px; }

/* Auction: remove the unfinished news panel and dedicate the rail to evidence. */
.auction-workspace-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; min-height: 590px; }
.auction-evidence-rail { display: grid; align-content: start; gap: 12px; background: transparent; }
.auction-evidence-section { border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); }
.auction-theme-list { max-height: 390px; overflow-y: auto; scrollbar-width: thin; }
.auction-theme-row { min-height: 58px; }
.auction-news-entry { display: none !important; }

/* Preserve the product's richer theme information architecture. */
.theme-library-layout { grid-template-columns: 300px minmax(0, 1fr); gap: 14px; min-height: 650px; }
.theme-directory-panel,
.theme-detail-panel { border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); }
.theme-chart-shell { height: 300px; }

/* Screener follows the reference workbench proportions without hiding features. */
.screener-page-bar { min-height: 46px; margin-bottom: 12px; }
.screener-page-bar .screener-page-heading,
.screener-page-bar .screener-mode-tabs { min-height: 45px; }
.screener-mode-tabs button { min-width: 108px; min-height: 45px; padding: 0 16px; }
#screenerView .screener-strategy-view { gap: 12px; }
#screenerView .screener-stepper { min-height: 48px; }
#screenerView .screener-overview-grid { gap: 12px; }
#screenerView .screener-runbar { min-height: 54px; }
#screenerView .screener-result-frame { min-height: 240px; }
#screenerView .tracking-table-frame { min-height: 160px; }
.curated-strategy-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.curated-strategy-card { min-height: 184px; }
.quant-screener-panel { grid-template-columns: 400px minmax(0, 1fr); gap: 12px; }
.quant-builder-pane { order: 0; }
.quant-summary-pane { order: 1; }
.quant-rule-row { min-height: 44px; }

/* Mentor: filters lead the page, conversation stays visually quiet. */
.mentor-page-controls { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.mentor-page-controls .mentor-evidence-filters { margin: 0; padding: 2px; border-radius: 7px; background: #eef0f3; }
.mentor-evidence-filters { display: inline-flex; gap: 2px; }
.mentor-evidence-filters button { min-height: 28px; padding: 0 12px; border-radius: 5px; color: var(--text-secondary); font-size: 11.5px; }
.mentor-evidence-filters button.active { background: #fff; color: var(--text-primary); box-shadow: 0 1px 2px rgba(16, 24, 40, .09); }
.mentor-evidence-filters button[data-mentor-grade="A"] { color: #16814a; }
.mentor-evidence-filters button[data-mentor-grade="B"] { color: #2e67c7; }
.mentor-evidence-filters button[data-mentor-grade="C"] { color: #a76608; }
.mentor-layout { height: calc(100vh - 142px); min-height: 620px; grid-template-columns: 340px minmax(0, 1fr); border: 1px solid var(--border); border-radius: var(--card-radius); background: #fff; box-shadow: var(--card-shadow); overflow: hidden; }
.mentor-chat-header { min-height: 82px; padding: 12px 16px; }
.mentor-messages { padding: 18px; }
.mentor-chat-form { min-height: 58px; padding: 8px 14px; }
.mentor-chat-form textarea { height: 42px; min-height: 42px; max-height: 92px; padding: 9px 11px; resize: vertical; }
.mentor-chat-form .button { min-height: 38px; }

/* Review mirrors the approved daily workflow instead of equal-width form columns. */
.review-workspace { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "watch journal" "trades journal" "notes notes"; gap: 12px; background: transparent; }
.review-workspace .watchlist-section { grid-area: watch; min-height: 0; }
.review-workspace .journal-section { grid-area: journal; min-height: 0; }
.review-workspace .trade-journal-section { grid-area: trades; min-height: 0; }
.review-workspace .notes-history-section { grid-area: notes; }
.review-workspace .workspace-section { border: 1px solid var(--border); border-radius: var(--card-radius); box-shadow: var(--card-shadow); }
.review-workspace .workspace-section + .workspace-section { border-top: 1px solid var(--border); }
.journal-form textarea { min-height: 98px; }

@media (min-width: 1280px) and (max-width: 1510px) {
  .market-tape { gap: 10px; }
  .header-command-group .command-button { width: 31px; padding: 0; }
  .header-command-group .command-button > span { display: none; }
  .account-role-badge span { display: none; }
  .account-role-badge { min-width: 27px; justify-content: center; }
}

@media (min-width: 1380px) and (max-width: 1510px) {
  #settingsButton,
  .header-command-group .account-button { width: auto; padding: 0 9px; }
  #settingsButton > span,
  .header-command-group .account-button > span { display: inline; }
}

@media (min-width: 721px) and (max-width: 1279px) {
  body { grid-template-columns: 64px minmax(0, 1fr); }
  .app-header { grid-template-columns: 176px minmax(0, 1fr) auto; }
  .market-tape { display: none; }
  .module-nav { width: 64px; }
  .quant-screener-panel { grid-template-columns: 1fr; }
  .curated-strategy-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sentiment-cycle-analysis,
  .ladder-workspace,
  .auction-workspace-layout,
  .review-workspace { grid-template-columns: 1fr; }
  .review-workspace { grid-template-areas: "watch" "journal" "trades" "notes"; }
  .sentiment-analysis-rail { grid-template-columns: 1fr; }
  .mentor-page-controls { width: 100%; justify-content: space-between; }
  .mentor-page-controls .mentor-evidence-filters { overflow-x: auto; }
}

/* Keep the final desktop precision pass from overriding the mobile shell. */
@media (max-width: 720px) {
  body,
  body.sidebar-collapsed {
    display: block;
    min-height: 100dvh;
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .app-header {
    width: 100%;
    height: 108px;
    min-height: 108px;
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 8px 10px 0;
  }

  .brand-block { height: 42px; }
  .brand-mark,
  .brand-logo { width: 34px; height: 34px; }
  .brand-block h1 { font-size: 16px; }
  .header-actions { position: absolute; inset: 56px 10px auto; display: flex; justify-content: space-between; gap: 6px; }
  .header-date-group { height: 42px; min-width: 0; flex: 1; }
  .header-date-group .date-input { width: 104px; flex: 1; }
  .header-actions > .icon-button { width: 40px; min-width: 40px; min-height: 42px; }

  .module-nav,
  body.sidebar-collapsed .module-nav {
    width: 100%;
    height: calc(64px + env(safe-area-inset-bottom));
    min-height: 64px;
    position: fixed;
    inset: auto 0 0;
    z-index: 45;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    padding: 4px 4px max(4px, env(safe-area-inset-bottom));
    overflow: hidden;
    border-top: 1px solid var(--border);
    border-right: 0;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -5px 18px rgba(16, 24, 40, .08);
  }

  .module-nav .module-tab,
  body.sidebar-collapsed .module-nav .module-tab { min-height: 54px; }

  .app-main { width: 100%; min-height: calc(100dvh - 176px); margin: 0; padding: 10px 8px 20px; }
  .workspace-view,
  body[data-active-view="screenerView"] .workspace-view,
  body[data-active-view="mentorView"] .workspace-view,
  body[data-active-view="reviewWorkspaceView"] .workspace-view { padding: 0 0 76px; }

  .mentor-layout { height: auto; min-height: calc(100dvh - 252px); grid-template-columns: 1fr; }
  .quant-screener-panel,
  #screenerView .screener-overview-grid,
  .review-workspace { grid-template-columns: 1fr; }
  .curated-strategy-list { grid-template-columns: 1fr; }
}

/* Strict prototype alignment: visible hierarchy and proportions. */
.brand-block .brand-mark,
.auth-brand .brand-mark {
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  box-shadow: none;
}
.auth-brand .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
.brand-glyph {
  font-family: "Songti SC", "SimSun", serif;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.workspace-view:not(#heavenView) .section-toolbar:first-child {
  min-height: 32px;
  margin-bottom: 10px;
}
.workspace-view:not(#heavenView) .section-title-group h2 { font-size: 17px; }
.workspace-view:not(#heavenView) .section-subtitle { color: #98a1b2; font-size: 11px; }

body[data-active-view="screenerView"] .overview-strip,
body[data-active-view="mentorView"] .overview-strip,
body[data-active-view="reviewWorkspaceView"] .overview-strip { display: grid; }

/* Sentiment follows the approved chart + compact analysis + guide composition. */
.sentiment-cycle-analysis {
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
  margin-bottom: 12px;
}
.sentiment-trend-panel { min-height: 398px; }
.sentiment-chart-shell { height: 320px; padding: 14px 18px 10px; }
.sentiment-analysis-rail { gap: 12px; }
.sentiment-cycle-current { min-height: 102px; padding: 11px 14px; }
.sentiment-cycle-foot .sentiment-cycle-state { min-height: 48px; padding: 7px 12px; }
.sentiment-component-list { padding: 4px 14px 7px; }
.sentiment-component-item { min-height: 0; padding: 4px 0; }
.sentiment-component-item > div:first-child { grid-template-columns: minmax(76px, 1fr) auto 34px; }
.sentiment-component-item small { display: block; overflow: hidden; margin-top: 1px; font-size: 9px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.sentiment-component-track { margin-top: 4px; }

.sentiment-stage-guide {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-xs);
}
.sentiment-stage-guide .workspace-heading { min-height: 42px; border-bottom: 1px solid var(--border); }
.sentiment-stage-guide-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.sentiment-stage-guide-grid article {
  min-width: 0;
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  background: #fff;
}
.sentiment-stage-guide-grid article:last-child { border-right: 0; }
.sentiment-stage-guide-grid strong { font-size: 12.5px; }
.sentiment-stage-guide-grid span,
.sentiment-stage-guide-grid small { overflow: hidden; color: var(--text-secondary); font-size: 10px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.sentiment-stage-guide-grid small { color: var(--text-tertiary); }
.sentiment-stage-guide-grid article.current {
  background: #fff0ee;
  box-shadow: inset 0 -2px 0 var(--danger);
}
.sentiment-stage-guide-grid article.current strong,
.sentiment-stage-guide-grid article.current small { color: var(--danger); }
.sentiment-detail-toolbar { margin-top: 0; }

/* Pool pages use the prototype's compact table-first proportions. */
.main-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
.main-grid .data-table thead th { height: 34px; padding: 6px 10px; }
.main-grid .data-table tbody td { height: 40px; padding: 5px 10px; }
.insight-rail { gap: 12px; }
.insight-card { border-radius: 10px; box-shadow: var(--shadow-xs); }

/* Screener uses the prototype's compact workbench instead of tall empty canvases. */
#screenerView .screener-strategy-view { gap: 12px; }
#screenerView .screener-stepper { min-height: 56px; padding: 8px 14px; }
#screenerView .screener-overview-card { padding: 12px 14px; }
#screenerView .screener-regime-body { min-height: 94px; }
#screenerView .screener-strategy-card { min-height: 182px; }
#screenerView .screener-result-frame { min-height: 220px; }
#screenerView .tracking-table-frame { min-height: 130px; }
#screenerView .screener-results-view,
#screenerView .strategy-tracking-panel { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; box-shadow: var(--shadow-xs); }
#screenerView .screener-results-view .result-toolbar,
#screenerView .strategy-tracking-panel .result-toolbar { min-height: 42px; }

/* Review mirrors the reference's compact two-column daily workflow. */
.review-workspace {
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas: "watch journal" "trades journal" "notes notes";
  align-items: start;
  gap: 12px;
}
.review-workspace .workspace-section { min-height: 0 !important; }
.review-workspace .workspace-heading { min-height: 42px; padding: 8px 14px; }
.review-workspace .watchlist-section { grid-area: watch; }
.review-workspace .journal-section { grid-area: journal; }
.review-workspace .trade-journal-section { grid-area: trades; }
.review-workspace .notes-history-section { grid-area: notes; }
.watchlist-section .workspace-table-frame { min-height: 0; }
.watchlist-section .data-table tbody td { height: 41px; }
.journal-form { padding: 13px 16px 14px; }
.journal-form .form-field { gap: 5px; }
.journal-form textarea { min-height: 82px; height: 82px; }
.journal-form .dialog-actions { margin-top: 4px; }
.trade-journal-section .trade-log-summary { min-height: 58px; }
.trade-log-table-frame { min-height: 96px; }
.trade-log-table-frame .empty-state { min-height: 94px; }
.notes-history-section .notes-history { min-height: 84px; }
.notes-history .note-item { padding: 12px 14px; }

/* Mentor proportions from the prototype: compact directory and quieter composer. */
.mentor-layout { grid-template-columns: 300px minmax(0, 1fr); }
.mentor-chat-header { min-height: 76px; }
.mentor-chat-form { min-height: 56px; padding: 7px 12px; }
.mentor-chat-form textarea { height: 40px; min-height: 40px; }
.mentor-chat-form .button { min-height: 38px; }

@media (max-width: 900px) {
  .sentiment-stage-guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sentiment-stage-guide-grid article:nth-child(3) { border-right: 0; }
  .sentiment-stage-guide-grid article:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 720px) {
  .sentiment-stage-guide-grid { grid-template-columns: 1fr 1fr; }
  .sentiment-stage-guide-grid article,
  .sentiment-stage-guide-grid article:nth-child(3) { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .sentiment-stage-guide-grid article:nth-child(even) { border-right: 0; }
  .sentiment-stage-guide-grid article:nth-last-child(-n+2) { border-bottom: 0; }
  .review-workspace { grid-template-columns: 1fr; grid-template-areas: "watch" "journal" "trades" "notes"; }
  .mentor-layout { grid-template-columns: 1fr; }
}

/* 2026-07-25 structural alignment pass
   These rules mirror the approved prototypes' composition, not the legacy page geometry. */
@media (min-width: 901px) {
  .workspace-view:not(#heavenView) { padding: 14px 16px 22px; }
  .workspace-view:not(#heavenView) > .section-toolbar:first-child,
  .screener-page-bar { min-height: 34px; margin: 0 0 10px; }
}

.workspace-view:not(#heavenView) .section-title-group { gap: 9px; }
.workspace-view:not(#heavenView) .section-title-group h2 { font-size: 17px; font-weight: 800; }
.workspace-view:not(#heavenView) .section-subtitle { font-size: 11.5px; }
.workspace-heading,
.screener-card-heading,
.quant-panel-heading { min-height: 42px; padding: 9px 14px; }
.workspace-heading h3,
.screener-card-heading h3,
.quant-panel-heading h3 { font-size: 14px; font-weight: 750; }

/* The judgement guide is a reference table, matching the approved emotion page. */
.sentiment-stage-guide { border-radius: 10px; }
.sentiment-stage-guide-head,
.sentiment-stage-guide-grid article {
  display: grid;
  grid-template-columns: 17% minmax(260px, 1fr) 17% 25%;
  align-items: center;
}
.sentiment-stage-guide-head {
  min-height: 34px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 650;
}
.sentiment-stage-guide-grid { display: block; }
.sentiment-stage-guide-grid article,
.sentiment-stage-guide-grid article:last-child {
  min-height: 35px;
  padding: 0 14px;
  gap: 0;
  border: 0;
  border-bottom: 1px solid var(--xb-gray-100);
  background: #fff;
  box-shadow: none;
}
.sentiment-stage-guide-grid article:last-child { border-bottom: 0; }
.sentiment-stage-guide-grid article > * { min-width: 0; padding-right: 14px; }
.sentiment-stage-guide-grid article strong { font-size: 12.5px; }
.sentiment-stage-guide-grid article span,
.sentiment-stage-guide-grid article small {
  display: block;
  margin: 0;
  overflow: visible;
  color: var(--text-primary);
  font-size: 11.5px;
  line-height: 1.35;
  text-overflow: clip;
  white-space: normal;
}
.sentiment-stage-guide-grid article .stage-range { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.sentiment-stage-guide-grid article.current {
  background: var(--xb-red-50);
  box-shadow: inset 3px 0 0 var(--danger);
}
.sentiment-stage-guide-grid article.current strong,
.sentiment-stage-guide-grid article.current small { color: var(--danger); }
.sentiment-cycle-analysis { align-items: stretch; }
.sentiment-trend-panel { min-height: 0; }
.sentiment-chart-shell { height: 296px; }
.sentiment-cycle-summary,
.sentiment-components-panel { min-height: 0; }
.sentiment-history-frame { min-height: 0; max-height: none; }
.sentiment-history-table tbody td { height: 35px; padding-top: 5px; padding-bottom: 5px; }

/* Pool pages share the prototype's table-first density. */
#limitPool .data-table,
#brokenView .data-table,
#downView .data-table,
#yesterdayView .data-table,
#performanceView .data-table,
#popularityView .data-table { font-size: 12px; }
#limitPool .data-table thead th,
#brokenView .data-table thead th,
#downView .data-table thead th,
#yesterdayView .data-table thead th,
#performanceView .data-table thead th,
#popularityView .data-table thead th { height: 32px; padding: 6px 9px; font-size: 11.5px; }
#limitPool .data-table tbody td,
#brokenView .data-table tbody td,
#downView .data-table tbody td,
#yesterdayView .data-table tbody td,
#performanceView .data-table tbody td,
#popularityView .data-table tbody td { height: 39px; padding: 5px 9px; }
#limitPool .main-grid { grid-template-columns: minmax(0, 1fr) 308px; }
#limitPool .table-frame,
.phase-table-frame,
.performance-table-frame,
.market-feature-table-frame { border-radius: 10px; background: #fff; box-shadow: var(--shadow-xs); }
.phase-table-frame,
.performance-table-frame,
.market-feature-table-frame { min-height: 300px; }
.toolbar-controls .search-field { height: 34px; }

/* Screener: one compact workbench, then results. */
.screener-page-bar { align-items: center; border-bottom: 0; }
.screener-mode-tabs { align-self: stretch; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.screener-mode-tabs button { min-width: 116px; min-height: 30px; padding: 0 15px; border: 0; border-radius: 7px; }
.screener-mode-tabs button.active { background: var(--primary); color: #fff; box-shadow: none; }
.screener-mode-tabs button.active::after { display: none; }
.screener-stepper { padding: 10px 18px !important; }
.screener-step { min-width: 150px; }
.screener-step .step-marker { width: 24px; height: 24px; border-radius: 50%; }
.screener-step[data-state="complete"] .step-marker { background: var(--success); color: transparent; }
.screener-step[data-state="complete"] .step-marker::after { content: "✓"; color: #fff; font-weight: 800; }
.screener-step[data-state="active"] .step-marker { background: var(--primary); color: #fff; }
.screener-overview-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
.screener-overview-card { min-height: 0; border-radius: 10px; box-shadow: var(--shadow-xs); }
#screenerView .screener-regime-body { min-height: 0; display: grid; grid-template-columns: 112px 128px minmax(0, 1fr); gap: 0; padding: 0; }
#screenerView .regime-summary { grid-row: auto; align-self: stretch; display: grid; place-content: center; min-height: 100px; padding: 10px; border: 0; border-right: 1px solid var(--border); border-radius: 0; background: var(--xb-red-50); text-align: center; }
#screenerView .regime-summary strong { color: var(--danger); font-size: 19px; }
#screenerView .regime-temperature { align-self: stretch; min-height: 100px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; padding: 12px 14px; border-right: 1px solid var(--border); }
#screenerView .regime-temperature strong { font-size: 15px; }
#screenerView .regime-evidence { align-self: stretch; min-height: 100px; max-height: 100px; padding: 12px 14px; overflow: hidden; }
#screenerView .regime-selector { min-height: 38px; margin: 0; padding: 5px 16px; border-top: 1px solid var(--border); background: #fff; }
#screenerView .regime-selector button { min-height: 26px; }
#screenerView .factor-data-status { min-height: 28px; padding: 5px 16px; border-top: 1px solid var(--border); background: #f8fafc; }
#screenerView .screener-strategy-summary { min-height: 166px; padding: 14px 16px; }
#screenerView .screener-strategy-title strong { font-size: 15px; }
#screenerView .screener-strategy-summary p { min-height: 38px; margin: 8px 0 10px; line-height: 1.65; }
.screener-runbar { min-height: 52px; padding: 8px 14px; border-radius: 10px; }
.screener-pipeline-status { margin-left: auto; }
#screenerView .screener-results-view,
#screenerView .strategy-tracking-panel { padding: 0; overflow: hidden; }
#screenerView .screener-result-frame { min-height: 230px; border-width: 1px 0 0; border-radius: 0; }
#screenerView .tracking-table-frame { min-height: 120px; border-width: 1px 0 0; border-radius: 0; }
.curated-screener-panel { display: block; }
.curated-library-pane { border: 0; background: transparent; box-shadow: none; }
.curated-library-heading,
.curated-library-controls { padding-left: 0; padding-right: 0; }
.curated-strategy-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; padding: 0; }
.curated-strategy-card { min-height: 154px; border: 1px solid var(--border); border-radius: 10px; background: #fff; box-shadow: var(--shadow-xs); }
.curated-strategy-card:hover { border-color: var(--xb-blue-100); box-shadow: 0 4px 14px rgba(37, 99, 235, .08); }
.quant-screener-panel { grid-template-columns: 400px minmax(0, 1fr); gap: 12px; align-items: start; }
.quant-builder-pane,
.quant-summary-pane { border-radius: 10px; box-shadow: var(--shadow-xs); }
.quant-rule-row { min-height: 42px; padding: 7px 12px; }
.quant-weight-control {
  height: 38px;
  display: grid;
  grid-template-columns: minmax(72px, 1fr) 42px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}
.quant-rule-row .quant-weight-control input[type="range"] {
  width: 100%;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #dfe5ee;
  accent-color: var(--primary);
  box-shadow: none;
  cursor: pointer;
}
.quant-weight-control output {
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 750;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Auction: dominant candidate table, compact evidence rail. */
.auction-workspace-layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; }
.auction-main-workspace,
.auction-evidence-section { border-radius: 10px; box-shadow: var(--shadow-xs); }
.auction-dataset-bar { min-height: 46px; padding: 6px 12px; }
.auction-dataset-segments { padding: 0; background: transparent; }
.auction-dataset-segments .segment { min-height: 34px; border-radius: 7px; }
.auction-expectation-filterbar { min-height: 44px; padding: 6px 12px; }
.auction-unified-table-frame { max-height: calc(100vh - 270px); min-height: 430px; border: 0; border-top: 1px solid var(--border); border-radius: 0; }
.auction-evidence-rail { gap: 12px; }
.auction-evidence-section { padding: 0; overflow: hidden; }
.auction-insight-heading { padding: 11px 14px; border-bottom: 1px solid var(--border); }
.auction-theme-list,
.auction-new-theme-line,
.auction-amount-trend,
.auction-amount-compare { margin-left: 14px; margin-right: 14px; }

/* Popularity remains intentionally simple. */
#popularityView .market-feature-summary { margin-bottom: 12px; }
#popularityView .market-feature-filterbar { min-height: 46px; padding: 6px 10px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: #fff; }
#popularityView .market-feature-table-frame { border-radius: 0 0 10px 10px; }

/* Mentor: compact directory and an input that does not dominate the conversation. */
.mentor-layout { grid-template-columns: 292px minmax(0, 1fr); gap: 12px; }
.mentor-sidebar,
.mentor-chat-panel { border-radius: 10px; box-shadow: var(--shadow-xs); }
.mentor-directory-heading { min-height: 42px; }
.mentor-search-field { margin: 10px 12px 7px; }
.mentor-list { padding: 0 8px 8px; }
.mentor-option { border-radius: 7px; }
.mentor-chat-header { min-height: 68px; padding: 10px 14px; }
.mentor-chat-form { min-height: 54px; padding: 7px 10px; }
.mentor-chat-form textarea { height: 38px; min-height: 38px; }

/* Review: prototype's left workflow + right daily form. History opens on demand. */
#reviewWorkspaceView > .section-toolbar { margin-bottom: 10px; }
.review-workspace {
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas: "watch journal" "trades journal" "notes notes";
  align-items: start;
  gap: 12px;
}
.review-workspace .workspace-section { overflow: hidden; border-radius: 10px; box-shadow: var(--shadow-xs); }
.review-workspace .watchlist-section { grid-area: watch; }
.review-workspace .trade-journal-section { grid-area: trades; }
.review-workspace .journal-section { grid-area: journal; }
.review-workspace .notes-history-section { grid-area: notes; }
.review-workspace .workspace-heading { min-height: 42px; }
.watchlist-section .data-table thead th { height: 32px; padding: 6px 12px; }
.watchlist-section .data-table tbody td { height: 44px; padding: 7px 12px; }
.watchlist-section .workspace-table-frame { max-height: 240px; }
.watchlist-section .empty-state { min-height: 150px; }
.trade-journal-section .trade-log-summary:empty { display: none; }
.trade-journal-section .trade-log-summary:not(:empty) { min-height: 56px; }
.trade-log-table-frame { min-height: 102px; }
.trade-log-table-frame .empty-state { min-height: 100px; }
.journal-form { padding: 14px 16px; }
.journal-form .form-field > span { color: var(--text-primary); font-size: 12px; font-weight: 700; }
.journal-form textarea { min-height: 112px; height: 112px; line-height: 1.7; }
.journal-form .form-field:last-of-type textarea { min-height: 86px; height: 86px; }
.journal-form .dialog-actions { justify-content: flex-end; }
.notes-history-section[hidden] { display: none !important; }
#reviewHistoryToggle[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }

@media (max-width: 1100px) {
  .sentiment-stage-guide-head,
  .sentiment-stage-guide-grid article { grid-template-columns: 110px minmax(230px, 1fr) 120px minmax(190px, .8fr); }
  .auction-workspace-layout { grid-template-columns: 1fr; }
  .auction-evidence-rail { grid-template-columns: 1fr 1fr; }
  .quant-screener-panel { grid-template-columns: 360px minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .sentiment-stage-guide-head { display: none; }
  .sentiment-stage-guide-grid { display: grid; grid-template-columns: 1fr; }
  .sentiment-stage-guide-grid article,
  .sentiment-stage-guide-grid article:nth-child(3),
  .sentiment-stage-guide-grid article:nth-child(even),
  .sentiment-stage-guide-grid article:nth-last-child(-n+2) {
    grid-template-columns: 72px minmax(0, 1fr) 92px;
    min-height: 60px;
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sentiment-stage-guide-grid article small { grid-column: 2 / -1; margin-top: 3px; }
  .screener-mode-tabs { width: 100%; overflow-x: auto; }
  .screener-mode-tabs button { min-width: 104px; }
  .screener-overview-grid,
  .quant-screener-panel,
  .auction-evidence-rail,
  .review-workspace { grid-template-columns: 1fr; }
  .review-workspace { grid-template-areas: "watch" "journal" "trades" "notes"; }
}
