/* Strategy library and quantitative screener */
.screener-mode-tabs {
  min-height: 48px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 0 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #f4f5f7;
}

.screener-mode-tabs button {
  min-width: 120px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.screener-mode-tabs button:hover { background: rgba(255, 255, 255, .58); color: #1f2937; }
.screener-mode-tabs button.active { border-bottom-color: #2563eb; color: #1d4ed8; }
.screener-mode-tabs .lucide { width: 16px; height: 16px; }

.curated-screener-panel,
.quant-screener-panel {
  min-height: 620px;
  display: grid;
  margin: 0 14px 14px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
}

.curated-screener-panel { grid-template-columns: 330px minmax(0, 1fr); }
.curated-library-pane { min-width: 0; padding: 16px; border-right: 1px solid #e5e7eb; background: #f8fafc; }
.curated-library-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.curated-library-heading span,
.quant-panel-heading span,
.quant-summary-pane > header span,
.curated-detail-header > div > span { color: #64748b; font-size: 12px; font-weight: 650; }
.curated-library-heading h3,
.quant-panel-heading h3,
.quant-summary-pane > header h3,
.curated-detail-header h3 { margin: 3px 0 0; color: #111827; font-size: 17px; letter-spacing: 0; }
.curated-library-heading > strong { padding: 4px 8px; border-radius: 5px; background: #e8eefc; color: #1d4ed8; font-size: 12px; }

.curated-search { height: 42px; display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 0 11px; border: 1px solid #d8dde5; border-radius: 6px; background: #fff; }
.curated-search:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.curated-search .lucide { width: 16px; height: 16px; color: #94a3b8; }
.curated-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: #111827; font-size: 13px; }
.curated-category-filters { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.curated-category-filters::-webkit-scrollbar { display: none; }
.curated-category-filters button { min-height: 34px; flex: 0 0 auto; padding: 0 10px; border: 1px solid #e1e5eb; border-radius: 5px; background: #fff; color: #64748b; font-size: 12px; cursor: pointer; }
.curated-category-filters button.active { border-color: #b8c8f2; background: #edf3ff; color: #1d4ed8; font-weight: 700; }
.curated-strategy-list { display: grid; gap: 7px; margin-top: 12px; }
.curated-strategy-card { width: 100%; min-height: 76px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; color: #1f2937; text-align: left; cursor: pointer; transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease; }
.curated-strategy-card:hover { border-color: #c9d5ef; box-shadow: 0 2px 8px rgba(37, 99, 235, .08); }
.curated-strategy-card.active { border-color: #8da9e8; background: #f3f7ff; box-shadow: inset 3px 0 #2563eb; }
.curated-strategy-rank { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 5px; background: #eef2f7; color: #475569; font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 800; }
.curated-strategy-card.active .curated-strategy-rank { background: #dce8ff; color: #1d4ed8; }
.curated-strategy-copy { min-width: 0; }
.curated-strategy-copy strong,
.curated-strategy-copy small { display: block; }
.curated-strategy-copy strong { overflow: hidden; color: #111827; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.curated-strategy-copy small { margin-top: 5px; color: #7c8798; font-size: 12px; }
.curated-ready-dot { width: 9px; height: 9px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, .1); }
.curated-ready-dot.missing { background: #dc8b18; box-shadow: 0 0 0 3px rgba(220, 139, 24, .12); }

.curated-detail-pane { min-width: 0; display: flex; flex-direction: column; padding: 20px 22px; }
.curated-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 18px; border-bottom: 1px solid #e8ebef; }
.curated-detail-header p { max-width: 680px; margin: 9px 0 0; color: #64748b; font-size: 13px; line-height: 1.65; }
.curated-strategy-badges { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.curated-strategy-badges span { min-height: 28px; display: inline-flex; align-items: center; padding: 0 9px; border-radius: 5px; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 650; white-space: nowrap; }
.curated-strategy-badges span:first-child { background: #eaf1ff; color: #1d4ed8; }
.curated-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: 26px; padding: 20px 0; }
.curated-condition-section { min-width: 0; }
.mini-section-heading { min-height: 36px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mini-section-heading h4 { margin: 0; color: #1f2937; font-size: 14px; }
.mini-section-heading p { margin: 4px 0 0; color: #94a3b8; font-size: 12px; }
.mini-section-heading > span { color: #64748b; font-size: 12px; }
.curated-rule-list,
.curated-score-list { display: grid; gap: 6px; margin-top: 7px; }
.curated-rule-row { min-height: 43px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 7px 10px; border-bottom: 1px solid #eef0f3; }
.curated-rule-row span { color: #475569; font-size: 13px; }
.curated-rule-row strong { color: #111827; font-size: 13px; font-variant-numeric: tabular-nums; }
.curated-score-row { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(100px, 2fr) 44px; align-items: center; gap: 10px; min-height: 38px; font-size: 12px; }
.curated-score-row > span:first-child { overflow: hidden; color: #475569; text-overflow: ellipsis; white-space: nowrap; }
.curated-score-track { height: 7px; overflow: hidden; border-radius: 4px; background: #edf0f4; }
.curated-score-track i { height: 100%; display: block; border-radius: inherit; background: #4f76c7; }
.curated-score-row strong { color: #334155; text-align: right; font-variant-numeric: tabular-nums; }
.curated-execution-bar { min-height: 70px; display: flex; align-items: center; gap: 16px; margin-top: auto; padding-top: 14px; border-top: 1px solid #e8ebef; }
.curated-data-status { min-width: 0; display: flex; align-items: center; gap: 10px; margin-right: auto; }
.curated-data-status > .lucide { width: 20px; height: 20px; color: #16a34a; }
.curated-data-status.missing > .lucide { color: #d97706; }
.curated-data-status span,
.curated-data-status strong,
.curated-data-status small { display: block; }
.curated-data-status strong { color: #334155; font-size: 13px; }
.curated-data-status small { margin-top: 3px; color: #7c8798; font-size: 12px; }

.quant-screener-panel { grid-template-columns: minmax(0, 1fr) 330px; }
.quant-builder-pane { min-width: 0; padding: 18px 20px; }
.quant-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.quant-universe-grid { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)) minmax(150px, auto); gap: 10px; margin-top: 18px; padding: 14px; border: 1px solid #e5e7eb; border-radius: 7px; background: #f8fafc; }
.quant-universe-grid .form-field { margin: 0; }
.quant-universe-grid input[type="number"] { height: 40px; }
.quant-st-toggle { align-self: end; min-height: 40px; }
.quant-rule-section { margin-top: 22px; }
.icon-text-button { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 1px solid #d8dde5; border-radius: 5px; background: #fff; color: #334155; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.icon-text-button:hover { border-color: #9db2df; color: #1d4ed8; }
.icon-text-button .lucide { width: 14px; height: 14px; }
.quant-rule-rows { display: grid; gap: 7px; margin-top: 9px; }
.quant-rule-row { min-height: 50px; display: grid; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; }
.quant-filter-row { grid-template-columns: minmax(170px, 1.6fr) minmax(92px, .7fr) minmax(110px, .9fr) 38px; }
.quant-score-row { grid-template-columns: minmax(180px, 1.5fr) minmax(120px, 1fr) minmax(110px, .8fr) 38px; }
.quant-rule-row select,
.quant-rule-row input { width: 100%; height: 38px; min-width: 0; padding: 0 9px; border: 1px solid #d8dde5; border-radius: 5px; background: #fff; color: #1f2937; font: inherit; font-size: 12px; }
.quant-rule-row select:focus,
.quant-rule-row input:focus { border-color: #2563eb; outline: 0; box-shadow: 0 0 0 3px rgba(37, 99, 235, .1); }
.quant-direction-control { height: 38px; display: grid; grid-template-columns: 1fr 1fr; padding: 2px; border-radius: 5px; background: #eef1f5; }
.quant-direction-control button { border: 0; border-radius: 4px; background: transparent; color: #64748b; font-size: 12px; cursor: pointer; }
.quant-direction-control button.active { background: #fff; color: #1d4ed8; box-shadow: 0 1px 2px rgba(15, 23, 42, .1); font-weight: 700; }
.quant-remove-button { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 5px; background: transparent; color: #94a3b8; cursor: pointer; }
.quant-remove-button:hover { background: #fff0f0; color: #dc2626; }
.quant-remove-button .lucide { width: 16px; height: 16px; }

.quant-summary-pane { min-width: 0; padding: 20px 18px; border-left: 1px solid #e5e7eb; background: #f8fafc; }
.quant-formula-summary { display: grid; gap: 8px; margin-top: 18px; }
.quant-summary-block { padding: 10px 11px; border: 1px solid #e3e7ed; border-radius: 6px; background: #fff; }
.quant-summary-block > span { color: #64748b; font-size: 12px; }
.quant-summary-block strong { display: block; margin-top: 5px; color: #1f2937; font-size: 13px; line-height: 1.55; }
.quant-weight-status { margin: 18px 0; }
.quant-weight-status > span,
.quant-weight-status > strong { font-size: 12px; }
.quant-weight-status > strong { float: right; color: #1d4ed8; }
.quant-weight-status > div { height: 7px; margin-top: 8px; overflow: hidden; border-radius: 4px; background: #dfe4eb; }
.quant-weight-status i { width: 100%; height: 100%; display: block; border-radius: inherit; background: #2563eb; transition: width 180ms ease, background 180ms ease; }
.quant-summary-pane > .checkbox-control { min-height: 40px; margin-bottom: 10px; }
.quant-summary-pane > .button { width: 100%; min-height: 44px; justify-content: center; margin-top: 8px; }
.quant-validation-message { min-height: 38px; margin: 12px 0 0; color: #64748b; font-size: 12px; line-height: 1.55; }
.quant-validation-message.error { color: #b91c1c; }

@media (max-width: 1050px) {
  .curated-screener-panel { grid-template-columns: 290px minmax(0, 1fr); }
  .curated-detail-grid { grid-template-columns: 1fr; gap: 18px; }
  .quant-screener-panel { grid-template-columns: 1fr; }
  .quant-summary-pane { border-top: 1px solid #e5e7eb; border-left: 0; }
}

@media (max-width: 720px) {
  #screenerView.mobile-results [data-screener-panel]:not([hidden]) { display: none !important; }
  .screener-mode-tabs { align-items: stretch; padding: 0 8px; }
  .screener-mode-tabs button { min-width: 0; flex: 1; padding: 0 5px; font-size: 12px; }
  .curated-screener-panel,
  .quant-screener-panel { min-height: 0; margin: 0 8px 8px; overflow: visible; }
  .curated-screener-panel { grid-template-columns: 1fr; }
  .curated-library-pane { border-right: 0; border-bottom: 1px solid #e5e7eb; }
  .curated-strategy-list { grid-template-columns: 1fr 1fr; }
  .curated-strategy-card { grid-template-columns: 28px minmax(0, 1fr); min-height: 70px; }
  .curated-strategy-rank { width: 28px; height: 28px; }
  .curated-ready-dot { display: none; }
  .curated-detail-pane { padding: 16px 14px; }
  .curated-detail-header { flex-direction: column; }
  .curated-strategy-badges { justify-content: flex-start; }
  .curated-execution-bar { align-items: stretch; flex-direction: column; }
  .curated-data-status { margin-right: 0; }
  .quant-builder-pane { padding: 16px 12px; }
  .quant-universe-grid { grid-template-columns: 1fr 1fr; }
  .quant-filter-row,
  .quant-score-row { grid-template-columns: minmax(0, 1fr) 92px 38px; }
  .quant-filter-row .quant-value-input,
  .quant-score-row .quant-direction-control { grid-column: 1 / 3; grid-row: 2; }
  .quant-remove-button { grid-column: 3; grid-row: 1 / 3; align-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  .screener-mode-tabs button,
  .curated-strategy-card,
  .quant-weight-status i { transition: none; }
}

[hidden] { display: none !important; }

@property --score {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #edf1f4;
}

.auth-gate[hidden] { display: none; }

.auth-shell {
  width: calc(100vw - 40px);
  max-width: 420px;
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand h1 { margin: 0; font-size: 22px; }

.auth-brand span {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 12px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 24px;
  border-bottom: 1px solid var(--line);
}

.auth-tab {
  min-height: 40px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.auth-tab.active {
  border-bottom-color: var(--coral);
  color: var(--text);
  font-weight: 750;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.auth-form .button { width: 100%; min-height: 40px; }

.auth-form .form-field[hidden],
.personal-profile-empty[hidden] {
  display: none;
}

.auth-error {
  margin: 0;
  color: #b93627;
  font-size: 12px;
  line-height: 1.5;
}

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

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid rgba(8, 127, 174, 0.48);
  outline-offset: 2px;
}

.number,
.metric-value,
.market-item strong,
.sentiment-gauge span,
.count-badge,
time {
  font-variant-numeric: tabular-nums;
}

.app-header {
  min-height: 76px;
  display: grid;
  grid-template-columns: 240px minmax(360px, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  border: 2px solid var(--blue);
  border-top-color: var(--coral);
  border-radius: 6px;
  background: var(--surface);
  color: var(--blue-dark);
  font-size: 15px;
  font-weight: 800;
}

.brand-block h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.source-label {
  display: inline-block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.market-tape {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  overflow: hidden;
  white-space: nowrap;
}

.market-item {
  color: var(--text-muted);
  font-size: 13px;
}

.market-item strong {
  margin-left: 5px;
  color: var(--text);
  font-size: 15px;
}

.up {
  color: var(--coral) !important;
}

.down {
  color: var(--green) !important;
}

.warning {
  color: var(--amber) !important;
}

.header-actions,
.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button,
.icon-button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  transition:
    transform var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) ease,
    background-color var(--motion-fast) ease,
    color var(--motion-fast) ease,
    box-shadow var(--motion-fast) ease;
}

.button {
  padding: 0 14px;
  white-space: nowrap;
}

.icon-button {
  width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}

.button:hover,
.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
  box-shadow: 0 2px 8px rgba(8, 100, 135, 0.1);
}

.button:active,
.icon-button:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: none;
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button.primary:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  color: #fff;
}

.button.danger-button {
  border-color: #e2aaa3;
  color: #b93627;
}

.button.danger-button:hover {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: #a72c1e;
}

.account-button {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.date-input {
  width: 138px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
}

.module-nav {
  height: 42px;
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 20px;
  overflow-x: auto;
  background: #0b729d;
  border-bottom: 1px solid #075a7a;
  scrollbar-width: thin;
}

.module-tab {
  min-width: 104px;
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #e9f7fc;
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
}

.module-tab:hover {
  background: rgba(255, 255, 255, 0.09);
}

.module-tab.active {
  border-bottom-color: var(--coral);
  background: var(--surface);
  color: var(--coral);
}

.app-main {
  min-height: calc(100vh - 152px);
  padding: 14px 18px 20px;
}

.overview-strip {
  min-height: 84px;
  display: grid;
  grid-template-columns: minmax(200px, 1.3fr) repeat(5, minmax(100px, 0.7fr)) minmax(170px, 1fr);
  align-items: stretch;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-soft);
}

.sentiment-block,
.metric {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

.sentiment-gauge {
  --score: 0;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 54px;
  border-radius: 50%;
  background: conic-gradient(var(--coral) calc(var(--score) * 1%), #e5eaee 0);
  position: relative;
  transition: --score 650ms var(--ease-out), transform var(--motion-medium) var(--ease-out);
}

.sentiment-gauge:hover { transform: scale(1.035); }

.sentiment-gauge::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--surface);
}

.sentiment-gauge span {
  position: relative;
  font-size: 17px;
  font-weight: 750;
}

.metric-label {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.sentiment-text {
  display: block;
  margin-top: 3px;
  font-size: 16px;
  white-space: nowrap;
}

.metric-value {
  max-width: 100%;
  overflow: hidden;
  font-size: 21px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value.small {
  font-size: 15px;
}

.metric-value.metric-changed,
.market-item strong.metric-changed,
.sentiment-gauge span.metric-changed {
  animation: metric-update 560ms var(--ease-out);
}

@keyframes metric-update {
  0% { opacity: 0.42; transform: translateY(4px); }
  55% { color: var(--blue-dark); }
  100% { opacity: 1; transform: translateY(0); }
}

.sentiment-gauge.sentiment-pulse {
  animation: sentiment-pulse var(--motion-slow) var(--ease-out) both;
}

@keyframes sentiment-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 63, 69, 0); transform: scale(1); }
  48% { box-shadow: 0 0 0 5px rgba(201, 63, 69, 0.13); transform: scale(1.045); }
}

.notice-bar {
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid #ecd28d;
  border-radius: 4px;
  background: var(--amber-soft);
  color: #765314;
  font-size: 13px;
}

.workspace-view {
  display: none;
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow-soft);
}

.workspace-view.active-view.view-entering {
  animation: view-enter var(--motion-medium) var(--ease-out) both;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-toolbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.section-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.section-toolbar h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
  white-space: nowrap;
}

.section-subtitle {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-badge,
.streak-pill,
.sector-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.count-badge {
  background: var(--coral-soft);
  color: var(--coral);
  font-size: 12px;
  font-weight: 700;
}

.warning-badge {
  background: var(--amber-soft);
  color: var(--amber);
}

.down-badge {
  background: var(--green-soft);
  color: var(--green);
}

.segmented {
  height: 34px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.segment {
  min-width: 52px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: var(--blue);
  color: #fff;
}

.search-field input {
  width: 220px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: none;
}

.search-field input:focus,
.form-field input:focus,
.date-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(8, 127, 174, 0.13);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  min-height: 520px;
}

.table-frame {
  position: relative;
  min-width: 0;
  max-height: calc(100vh - 285px);
  overflow: auto;
  border-right: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  height: 38px;
  padding: 0 10px;
  border-right: 1px solid #e4e9ed;
  border-bottom: 1px solid #e4e9ed;
  background: var(--surface);
  text-align: left;
}

.data-table th {
  height: 39px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #edf3f6;
  color: #40515e;
  font-size: 12px;
  font-weight: 700;
}

.data-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}

.data-table th[data-sort]:hover {
  background: #e3edf2;
  color: var(--blue-dark);
}

.data-table th.sort-asc::after {
  content: " ↑";
  color: var(--blue);
}

.data-table th.sort-desc::after {
  content: " ↓";
  color: var(--blue);
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr td {
  transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease;
}

.data-table tbody tr.row-enter {
  animation: row-enter 260ms var(--ease-out) both;
  animation-delay: var(--row-delay, 0ms);
}

.data-table tbody tr.row-pending {
  opacity: 0;
  transform: translateY(4px);
}

@keyframes row-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.data-table tbody tr:hover td {
  background: #edf8fc;
}

.data-table tbody tr.selected td {
  background: var(--blue-soft);
}

.data-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .row-number {
  width: 38px;
  color: var(--text-muted);
  text-align: center;
}

.reason-column {
  min-width: 210px;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-name {
  font-weight: 700;
}

.stock-code {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.streak-value {
  color: var(--coral);
  font-weight: 750;
}

.empty-state {
  padding: 70px 20px;
  color: var(--text-muted);
  text-align: center;
}

.insight-rail {
  min-width: 0;
  background: var(--surface-muted);
}

.rail-section {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.rail-heading h3,
.detail-section h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.rail-heading > span {
  color: var(--coral);
  font-weight: 750;
}

.text-button {
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
}

.ladder-mini,
.sector-mini {
  display: grid;
  gap: 8px;
}

.mini-row {
  min-height: 34px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.mini-row strong,
.mini-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-row strong {
  color: var(--coral);
}

.mini-row small {
  color: var(--text-muted);
}

.sector-mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 32px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.sector-mini-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strength-track,
.strength-cell {
  height: 7px;
  overflow: hidden;
  border-radius: 3px;
  background: #e4e9ed;
}

.strength-track i,
.strength-cell i {
  display: block;
  height: 100%;
  background: var(--blue);
}

.ladder-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0;
}

.ladder-column {
  min-height: 230px;
  padding: 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.ladder-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 9px;
  border-bottom: 3px solid var(--coral);
}

.ladder-column-header strong {
  font-size: 17px;
}

.ladder-column-header span {
  color: var(--text-muted);
}

.ladder-stock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px 4px;
  border-bottom: 1px solid #e8ecef;
  cursor: pointer;
}

.ladder-stock:hover {
  color: var(--blue-dark);
}

.ladder-stock small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ladder-stock time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.phase-table-frame {
  min-height: 510px;
  max-height: calc(100vh - 270px);
  border-right: 0;
}

.performance-table-frame {
  min-height: 280px;
  max-height: none;
  border-top: 1px solid var(--line);
  border-right: 0;
}

.performance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.performance-card {
  min-height: 128px;
  padding: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

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

.performance-card-header strong {
  font-size: 16px;
}

.performance-card-header span {
  color: var(--text-muted);
  font-size: 12px;
}

.performance-rate {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 18px;
}

.performance-rate strong {
  color: var(--coral);
  font-size: 28px;
}

.performance-rate span {
  color: var(--text-muted);
}

.performance-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.outcome-tag,
.trend-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.outcome-advance,
.trend-hot {
  background: var(--coral-soft);
  color: var(--coral);
}

.outcome-broken,
.trend-flat {
  background: var(--amber-soft);
  color: var(--amber);
}

.outcome-down,
.trend-cool {
  background: var(--green-soft);
  color: var(--green);
}

.outcome-open {
  background: #edf1f4;
  color: #5c6973;
}

.delta-positive {
  color: var(--coral);
  font-weight: 700;
}

.delta-negative {
  color: var(--green);
  font-weight: 700;
}

.rotation-strength {
  min-width: 150px;
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 34px;
  align-items: center;
  gap: 8px;
}

.rotation-strength b {
  color: var(--text-muted);
  text-align: right;
}

.inline-notice {
  padding: 9px 14px;
  border-bottom: 1px solid #ecd28d;
  background: var(--amber-soft);
  color: #765314;
  font-size: 12px;
}

.dragon-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  border-bottom: 1px solid var(--line);
}

.dragon-metric {
  min-height: 72px;
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}

.dragon-metric:last-child {
  border-right: 0;
}

.dragon-metric span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.dragon-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.dragon-filterbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

.dragon-filter {
  min-width: 66px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
}

.dragon-filter:last-child {
  border-right: 0;
}

.dragon-filter.active {
  background: var(--blue);
  color: #fff;
}

.dragon-trader-list {
  min-height: 280px;
}

.trader-group {
  border-bottom: 1px solid var(--line);
}

.trader-summary-row {
  min-height: 68px;
  display: grid;
  grid-template-columns: 38px minmax(220px, 1fr) 125px 125px 135px 20px;
  align-items: center;
  gap: 14px;
  padding: 9px 14px;
  cursor: pointer;
  list-style: none;
  transition: background-color var(--motion-fast) ease;
}

.trader-summary-row::-webkit-details-marker {
  display: none;
}

.trader-summary-row:hover {
  background: #f4f9fb;
}

.trader-rank {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.trader-identity,
.trader-flow,
.trader-net {
  min-width: 0;
}

.trader-identity strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trader-identity small,
.trader-flow small,
.trader-net small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

.trader-identity small {
  margin-top: 5px;
}

.trader-flow,
.trader-net {
  text-align: right;
}

.trader-flow strong,
.trader-net strong {
  display: block;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.trader-expand {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--motion-fast) ease;
}

.trader-group[open] .trader-expand {
  transform: rotate(225deg) translate(-2px, -2px);
}

.trader-operations {
  max-height: 330px;
  border-top: 1px solid var(--line);
  border-right: 0;
  background: var(--surface-muted);
}

.dragon-operation-table th,
.dragon-operation-table td {
  background: var(--surface-muted);
}

.dragon-operation-table th {
  background: #e8f0f4;
}

.dragon-stock {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 8px;
}

.dragon-stock small {
  font-size: 11px;
}

.direction-label {
  font-weight: 700;
}

.seat-cell {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dragon-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
}

.unclassified-section {
  background: var(--surface-muted);
}

.unclassified-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  list-style: none;
}

.unclassified-heading::-webkit-details-marker {
  display: none;
}

.unclassified-heading:hover {
  background: #f1f6f8;
}

.unclassified-heading h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.unclassified-heading span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
}

.unclassified-heading > strong {
  color: var(--text-muted);
  font-size: 12px;
}

.unclassified-heading > strong::after {
  content: "  展开";
  color: var(--blue);
  font-weight: 400;
}

.unclassified-section[open] .unclassified-heading > strong::after {
  content: "  收起";
}

.unclassified-seat-list {
  display: grid;
}

.unclassified-seat-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 90px 110px minmax(150px, 220px) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
}

.unclassified-seat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unclassified-seat-stats {
  color: var(--text-muted);
  font-size: 11px;
}

.unclassified-seat-row > strong {
  text-align: right;
  white-space: nowrap;
}

.unclassified-seat-row input,
.inline-edit-form input {
  min-width: 0;
  height: 32px;
  flex: 1;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.unclassified-seat-row .button {
  min-height: 32px;
  padding: 0 10px;
}

.review-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.regime-panel {
  display: grid;
  grid-template-columns: 180px minmax(420px, 1fr) minmax(280px, 0.8fr) 150px;
  min-height: 104px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.regime-summary,
.regime-evidence,
.factor-data-status {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.regime-summary strong {
  color: var(--coral);
  font-size: 24px;
}

.regime-summary > span:last-child,
.factor-data-status > span:last-child {
  color: var(--text-muted);
  font-size: 12px;
}

.regime-selector {
  display: grid;
  grid-template-columns: repeat(6, minmax(62px, 1fr));
  align-items: center;
  gap: 6px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.regime-option {
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 650;
}

.regime-option.active {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral);
}

.regime-evidence strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.regime-evidence div {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.7;
}

.factor-data-status {
  border-right: 0;
}

.factor-data-status strong {
  font-size: 20px;
}

.screener-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}

.strategy-sidebar {
  min-width: 0;
  max-height: 530px;
  overflow-y: auto;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: var(--surface-muted);
}

.strategy-list {
  display: grid;
  gap: 7px;
}

.strategy-item {
  width: 100%;
  min-height: 70px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
}

.strategy-item:hover,
.strategy-item.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.strategy-item strong,
.strategy-item span {
  display: block;
}

.strategy-item span {
  margin-top: 5px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strategy-item small {
  display: inline-block;
  margin-top: 6px;
  color: var(--coral);
}

.strategy-workbench {
  min-width: 0;
  padding: 14px;
}

.strategy-meta-fields {
  display: grid;
  grid-template-columns: minmax(180px, 0.5fr) minmax(260px, 1fr);
  gap: 10px;
}

.strategy-prompt-field {
  margin-top: 12px;
}

.strategy-prompt-field textarea {
  min-height: 74px;
}

.mentor-layout {
  min-height: 650px;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.mentor-sidebar {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: var(--surface-muted);
}

.mentor-list {
  display: grid;
  gap: 8px;
}

.mentor-option {
  width: 100%;
  min-width: 0;
  min-height: 100px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.mentor-option:hover,
.mentor-option.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.mentor-option strong,
.mentor-option span {
  display: block;
}

.mentor-option strong {
  font-size: 15px;
}

.mentor-option span {
  margin-top: 6px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mentor-option small {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.mentor-option i {
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--surface-muted);
  color: var(--blue-dark);
  font-size: 10px;
  font-style: normal;
}

.mentor-chat-panel {
  min-width: 0;
  min-height: 650px;
  display: grid;
  grid-template-rows: auto minmax(330px, 1fr) auto auto auto;
  background: var(--surface);
}

.mentor-chat-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.mentor-chat-header h3 {
  margin: 5px 0 0;
  font-size: 18px;
}

.mentor-model-status {
  max-width: 55%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mentor-messages {
  min-width: 0;
  max-height: 560px;
  overflow-y: auto;
  padding: 18px;
  background: #fbfcfd;
}

.mentor-empty-state {
  min-height: 300px;
  display: grid;
  place-content: center;
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
}

.mentor-empty-state strong {
  color: var(--text);
  font-size: 20px;
}

.mentor-empty-state p {
  max-width: 620px;
  margin: 10px auto 0;
  line-height: 1.8;
}

.mentor-message {
  width: fit-content;
  max-width: min(82%, 820px);
  margin-bottom: 16px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.mentor-message.user {
  margin-left: auto;
  border-color: #a8d6e6;
  background: var(--blue-soft);
}

.mentor-message.assistant {
  border-left: 3px solid var(--coral);
}

.mentor-message-label {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.mentor-message p,
.mentor-message-content {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.75;
  white-space: pre-wrap;
}

.mentor-answer-heading {
  display: inline-block;
  margin: 8px 0 2px;
  color: var(--text);
  font-size: 15px;
}

.mentor-answer-rule {
  display: block;
  height: 1px;
  margin: 8px 0;
  background: var(--line);
}

.mentor-answer-quote {
  display: block;
  padding-left: 10px;
  border-left: 2px solid var(--blue);
  color: var(--text-muted);
}

.mentor-message small {
  display: block;
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.loading-message p {
  color: var(--text-muted);
}

.mentor-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
}

.mentor-quick-prompts button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
}

.mentor-quick-prompts button:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

.mentor-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.mentor-chat-form textarea {
  width: 100%;
  min-width: 0;
  height: 72px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  line-height: 1.55;
  outline: none;
}

.mentor-chat-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(8, 127, 174, 0.13);
}

.mentor-chat-form .button {
  min-width: 82px;
  height: 72px;
}

.mentor-disclaimer {
  margin: 0;
  padding: 0 18px 12px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: right;
}

.heaven-toolbar {
  min-height: 58px;
}

.heaven-tabs {
  min-height: 48px;
  display: flex;
  align-items: end;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.heaven-tab {
  height: 48px;
  padding: 0 4px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 700;
}

.heaven-tab:hover,
.heaven-tab.active {
  border-bottom-color: var(--coral);
  color: var(--text);
}

.heaven-panel {
  display: none;
}

.heaven-panel.active-heaven-panel {
  display: block;
}

.heaven-controls {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(220px, 0.75fr) auto auto;
  align-items: end;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.heaven-controls input,
.heaven-controls select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.heaven-controls input:focus,
.heaven-controls select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(8, 127, 174, 0.13);
}

.heaven-controls > .button {
  height: 40px;
  min-width: 86px;
}

.heaven-trend-layout {
  min-height: 530px;
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(330px, 0.85fr);
  border-bottom: 1px solid var(--line);
}

.hexagram-board {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.hexagram-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.hexagram-heading h3 {
  margin: 5px 0 0;
  font-size: 20px;
}

.hexagram-change {
  text-align: right;
}

.hexagram-change span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
}

.hexagram-change strong {
  display: block;
  margin-top: 4px;
  color: var(--coral);
  font-size: 18px;
}

.hexagram-lines {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.hexagram-line-row {
  min-width: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: 44px 170px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-left: 3px solid transparent;
}

.hexagram-line-row.moving {
  border-left-color: var(--coral);
  background: var(--coral-soft);
}

.hexagram-position {
  color: var(--text-muted);
  font-size: 11px;
}

.hex-line {
  position: relative;
  width: 150px;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.hex-line i {
  height: 8px;
  display: block;
  flex: 1;
  background: #1d2b35;
}

.hex-line b {
  position: absolute;
  right: -22px;
  color: var(--coral);
  font-size: 16px;
}

.hexagram-line-detail {
  min-width: 0;
}

.hexagram-line-detail strong,
.hexagram-line-detail small {
  display: block;
}

.hexagram-line-detail small {
  margin-top: 4px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hexagram-text {
  margin: 16px 0 0;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  line-height: 1.75;
}

.market-movement-summary {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  background: #f2f7f9;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.65;
}

.trend-reading-panel {
  min-width: 0;
  padding: 18px;
  background: var(--surface-muted);
}

.trend-score-line {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.trend-score-line strong {
  display: block;
  margin-top: 5px;
  font-size: 30px;
}

.trend-score-line > span {
  color: var(--coral);
  font-size: 16px;
  font-weight: 750;
}

.three-talent-readings {
  display: grid;
  margin-top: 12px;
}

.talent-reading {
  min-height: 74px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.talent-reading strong,
.talent-reading span,
.talent-reading small {
  display: block;
}

.talent-reading span {
  margin-top: 5px;
}

.talent-reading small {
  margin-top: 5px;
  color: var(--text-muted);
}

.heaven-index-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.heaven-index-strip div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.heaven-index-strip span,
.heaven-index-strip strong,
.heaven-index-strip small {
  display: block;
}

.heaven-index-strip strong {
  margin-top: 4px;
}

.heaven-index-strip small,
.heaven-index-strip p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 10px;
}

.heaven-index-strip p {
  grid-column: 1 / -1;
  line-height: 1.6;
}

.heaven-interpretation {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  line-height: 1.8;
}

.heaven-interpretation > div {
  overflow-wrap: anywhere;
}

.heaven-interpretation > small {
  display: block;
  margin-top: 12px;
  color: var(--text-muted);
}

.fortune-heading {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.fortune-heading h3 {
  margin: 5px 0 0;
  font-size: 20px;
}

.fortune-heading-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.qi-time-field span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 10px;
}

.qi-time-field input {
  width: 132px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.fortune-metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid var(--line);
}

.fortune-metric {
  min-width: 0;
  min-height: 108px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.fortune-metric:last-child {
  border-right: 0;
}

.fortune-metric span,
.fortune-metric strong,
.fortune-metric small {
  display: block;
}

.qi-framework-panel {
  padding: 16px 18px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.qi-framework-layers {
  display: grid;
  grid-template-columns: 1.05fr 1.2fr 0.85fr 0.85fr;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.qi-framework-layer {
  min-width: 0;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.qi-framework-layer:last-child {
  border-right: 0;
}

.qi-framework-layer > span,
.qi-framework-layer > strong,
.qi-framework-layer > small {
  display: block;
}

.qi-framework-layer > span,
.qi-framework-layer > small {
  color: var(--text-muted);
  font-size: 10px;
}

.qi-framework-layer > strong {
  margin-top: 6px;
  font-size: 17px;
}

.qi-framework-layer > small {
  min-height: 30px;
  margin-top: 5px;
  line-height: 1.5;
}

.qi-framework-layer > div {
  height: 7px;
  display: flex;
  margin-top: 9px;
  overflow: hidden;
  background: #e5eaed;
}

.qi-framework-layer > div i {
  height: 100%;
  display: block;
}

.human-field-panel {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #f7faf9;
}

.human-field-summary {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
}

.human-field-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.human-field-grid > div {
  min-width: 0;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.human-field-grid > div:last-child {
  border-right: 0;
}

.human-field-grid span,
.human-field-grid strong {
  display: block;
}

.human-field-grid span {
  color: var(--text-muted);
  font-size: 11px;
}

.human-field-grid strong {
  margin-top: 7px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.65;
}

.fortune-metric span,
.fortune-metric small {
  color: var(--text-muted);
  font-size: 11px;
}

.fortune-metric strong {
  margin-top: 8px;
  font-size: 16px;
}

.fortune-metric small {
  margin-top: 7px;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.fortune-body {
  display: grid;
  grid-template-columns: minmax(430px, 1fr) minmax(360px, 0.9fr);
  border-bottom: 1px solid var(--line);
}

.five-phase-panel,
.phase-sector-panel {
  min-width: 0;
  padding: 18px;
}

.five-phase-panel {
  border-right: 1px solid var(--line);
}

.five-phase-balance {
  display: grid;
  gap: 12px;
}

.phase-balance-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
}

.phase-symbol {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
}

.phase-track {
  height: 8px;
  overflow: hidden;
  background: #e5eaed;
}

.phase-track span {
  height: 100%;
  display: block;
}

.phase-balance-row small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.4;
}

.phase-balance-row > b {
  text-align: right;
}

.phase-wood { background: #278b62 !important; }
.phase-fire { background: #df4e3d !important; }
.phase-earth { background: #b98616 !important; }
.phase-metal { background: #687681 !important; }
.phase-water { background: #147ea7 !important; }

.phase-sector-list {
  display: grid;
}

.phase-sector-row {
  min-width: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.phase-sector-row .phase-symbol {
  width: 26px;
  height: 26px;
}

.phase-sector-row strong,
.phase-sector-row small {
  display: block;
}

.phase-sector-row small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.phase-sector-row > b {
  color: var(--text-muted);
  text-align: right;
}

.sector-phase-manager {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-strong);
}

.sector-phase-manager-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sector-phase-manager-heading strong {
  font-size: 13px;
}

.sector-phase-manager-heading span,
.sector-phase-empty {
  color: var(--text-muted);
  font-size: 11px;
}

.sector-phase-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px auto;
  gap: 8px;
  margin-top: 10px;
}

.sector-phase-form input,
.sector-phase-form select {
  min-width: 0;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.sector-phase-overrides {
  max-height: 174px;
  margin-top: 8px;
  overflow-y: auto;
}

.sector-phase-override-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.sector-phase-override-row .phase-symbol {
  width: 24px;
  height: 24px;
}

.sector-phase-override-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.sector-phase-override-row .icon-button {
  width: 28px;
  min-height: 28px;
  color: var(--text-muted);
  font-size: 18px;
}

.sector-phase-empty {
  margin: 12px 0 2px;
}

.personal-fortune-panel {
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.personal-profile-empty {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
}

.personal-fortune-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(130px, 0.65fr) minmax(110px, 0.55fr) auto auto;
  align-items: end;
  gap: 10px;
  margin-top: 14px;
}

.personal-fortune-form input,
.personal-fortune-form select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.personal-fortune-form input:focus,
.personal-fortune-form select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(8, 127, 174, 0.13);
}

.remember-birth {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.remember-birth input {
  width: 15px;
  height: 15px;
  padding: 0;
  accent-color: var(--blue);
}

.personal-privacy-note {
  margin: 9px 0 0;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1.5;
}

.personal-fortune-result {
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.personal-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--line);
}

.personal-pillars > div {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.personal-pillars > div:last-child {
  border-right: 0;
}

.personal-pillars span,
.personal-pillars strong,
.personal-pillars small {
  display: block;
}

.personal-pillars span,
.personal-pillars small {
  color: var(--text-muted);
  font-size: 10px;
}

.personal-pillars strong {
  margin: 7px 0;
  font-size: 22px;
}

.personal-summary-line {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  border-bottom: 1px solid var(--line);
}

.personal-summary-line > div {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.personal-summary-line > div:last-child {
  border-right: 0;
}

.personal-summary-line span,
.personal-summary-line strong {
  display: block;
}

.personal-summary-line span {
  color: var(--text-muted);
  font-size: 10px;
}

.personal-summary-line strong {
  margin-top: 5px;
  font-size: 13px;
}

.personal-element-balance {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.personal-element-balance > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 7px;
}

.personal-element-balance i {
  height: 7px;
  overflow: hidden;
  background: #e5eaed;
}

.personal-element-balance i b {
  height: 100%;
  display: block;
}

.personal-element-balance > div > strong {
  color: var(--text-muted);
  font-size: 10px;
  text-align: right;
}

.personal-current-effect {
  padding: 14px;
}

.personal-current-effect span,
.personal-current-effect strong,
.personal-current-effect small {
  display: block;
}

.personal-current-effect span,
.personal-current-effect small {
  color: var(--text-muted);
  font-size: 10px;
}

.personal-current-effect strong {
  margin-top: 7px;
  line-height: 1.65;
}

.personal-current-effect p {
  margin: 7px 0;
  line-height: 1.65;
}

.heaven-footnote {
  margin: 0;
  padding: 11px 18px;
  color: var(--text-muted);
  font-size: 11px;
  text-align: right;
}

.heart-stage {
  display: none;
}

.heart-stage.active-heart-stage {
  display: block;
  animation: heart-stage-enter 320ms var(--ease-out) both;
}

@keyframes heart-stage-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.heart-stage-inner {
  min-height: 590px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  padding: 32px 18px;
  text-align: center;
}

.heart-stage-index {
  color: var(--coral);
  font-size: 12px;
  font-weight: 750;
}

.heart-stage-inner h3,
.heart-first-thought h3,
.casting-action-panel h3 {
  margin: 0;
  font-size: 22px;
}

.heart-guidance {
  display: grid;
  gap: 8px;
  color: var(--text-muted);
  line-height: 1.7;
}

.heart-guidance p {
  margin: 0;
}

.breathing-stage {
  position: relative;
  overflow: hidden;
  background: #f7fafb;
}

.breathing-scene {
  width: 260px;
  height: 260px;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.breathing-ring {
  position: absolute;
  border: 1px solid rgba(8, 127, 174, 0.24);
  border-radius: 50%;
  pointer-events: none;
}

.ring-outer {
  width: 248px;
  height: 248px;
  animation: breathing-ring 8s ease-in-out infinite;
}

.ring-inner {
  width: 208px;
  height: 208px;
  border-color: rgba(8, 127, 174, 0.15);
  animation: breathing-ring 8s 380ms ease-in-out infinite;
}

.breathing-orbit {
  width: 158px;
  height: 158px;
  position: relative;
  z-index: 1;
  display: grid;
  place-content: center;
  border: 1px solid #87bed2;
  border-radius: 50%;
  background: var(--blue-soft);
  box-shadow: 0 12px 36px rgba(8, 100, 135, 0.13);
  animation: breathe-core 8s ease-in-out infinite;
  transition: background-color 900ms ease, border-color 900ms ease;
}

.breathing-orbit strong {
  font-size: 42px;
  line-height: 1;
}

.breathing-orbit span {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 11px;
}

.breathing-phase {
  position: absolute;
  bottom: 8px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  transition: color var(--motion-medium) ease;
}

.breathing-scene[data-phase="exhale"] .breathing-orbit {
  border-color: #aabac4;
  background: #f1f4f6;
}

.breathing-scene[data-phase="exhale"] .breathing-phase {
  color: #687681;
}

.breathing-scene[data-phase="settled"] .breathing-orbit,
.breathing-scene[data-phase="settled"] .breathing-ring {
  animation-play-state: paused;
}

.breathing-progress {
  width: min(280px, calc(100vw - 64px));
  height: 3px;
  overflow: hidden;
  background: #dce5ea;
}

.breathing-progress i {
  width: 0;
  height: 100%;
  display: block;
  background: var(--blue);
  transition: width 1s linear;
}

.breathing-stage > h3 {
  min-height: 32px;
  max-width: 520px;
  font-size: 18px;
  transition: opacity var(--motion-medium) ease;
}

@keyframes breathe-core {
  0%, 100% { transform: scale(0.86); }
  50% { transform: scale(1); }
}

@keyframes breathing-ring {
  0%, 100% { opacity: 0.28; transform: scale(0.82); }
  50% { opacity: 0.82; transform: scale(1); }
}

.heart-casting-layout,
.heart-reveal-layout {
  min-height: 590px;
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(300px, 0.75fr);
}

.heart-hexagram-shell,
.heart-reveal-board {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.casting-action-panel,
.heart-first-thought {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 28px;
  background: var(--surface-muted);
  text-align: center;
}

.coin-result {
  display: flex;
  gap: 14px;
}

.coin-result span {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border: 2px solid #c59832;
  border-radius: 50%;
  background: #fff8df;
  color: #805a08;
  font-size: 16px;
  font-weight: 800;
  box-shadow: inset 0 0 0 4px #f0dfaa;
  transition: transform var(--motion-medium) var(--ease-out), background-color var(--motion-medium) ease;
}

.coin-result.is-tossing span {
  animation: coin-toss 620ms var(--ease-out) both;
}

.coin-result.is-tossing span:nth-child(2) { animation-delay: 55ms; }
.coin-result.is-tossing span:nth-child(3) { animation-delay: 110ms; }

@keyframes coin-toss {
  0% { transform: translateY(0) rotateY(0); }
  42% { transform: translateY(-24px) rotateY(180deg); }
  100% { transform: translateY(0) rotateY(360deg); }
}

.ritual-lines {
  max-width: 660px;
  margin: 28px auto 0;
}

.empty-line {
  opacity: 0.45;
}

.hexagram-line-row.new-line .hex-line {
  animation: line-arrive 420ms var(--ease-out) both;
}

@keyframes line-arrive {
  from { opacity: 0; transform: scaleX(0.45); }
  to { opacity: 1; transform: scaleX(1); }
}

.placeholder-line i {
  height: 2px;
  background: #aeb9c0;
}

.heart-first-thought p {
  max-width: 430px;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.75;
}

.heart-line-texts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.heart-line-text {
  min-height: 104px;
  padding: 13px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.heart-line-text:nth-child(3n) {
  border-right: 0;
}

.heart-line-text.moving {
  background: var(--coral-soft);
}

.heart-line-text p {
  margin: 7px 0 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.heart-interpretation-heading {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.heart-interpretation-heading h3 {
  margin: 4px 0 0;
  font-size: 20px;
}

.heart-footnote {
  border-top: 1px solid var(--line);
}

.strategy-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.compiler-status {
  margin-right: auto;
  color: var(--text-muted);
  font-size: 12px;
}

.checkbox-control {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.formula-field {
  margin-top: 10px;
}

.form-field.formula-field textarea {
  min-height: 235px;
  resize: vertical;
  background: #17232d;
  color: #e7f2f6;
  font-family: Consolas, "Microsoft YaHei UI", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.backtest-panel {
  border-bottom: 1px solid var(--line);
}

.backtest-panel > .workspace-heading {
  padding: 10px 14px 0;
}

.backtest-panel .workspace-heading > span {
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-toolbar {
  border-top: 0;
}

.screener-result-frame {
  min-height: 420px;
  max-height: 620px;
  border-right: 0;
}

.probability-value {
  color: var(--blue-dark);
  font-weight: 700;
}

.risk-cell {
  max-width: 240px;
  overflow: hidden;
  color: var(--amber);
  text-overflow: ellipsis;
}

.workspace-section {
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.workspace-heading {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.workspace-heading h3 {
  margin: 0;
  font-size: 15px;
}

.workspace-heading > span {
  color: var(--text-muted);
  font-size: 12px;
}

.workspace-table-frame {
  min-height: 340px;
  max-height: 480px;
  border: 1px solid var(--line);
}

.notes-history-section {
  grid-column: 1 / -1;
  min-height: 260px;
}

.journal-form {
  display: grid;
  gap: 12px;
}

.form-field textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  line-height: 1.6;
  outline: none;
}

.form-field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(8, 127, 174, 0.13);
}

.notes-history {
  display: grid;
  gap: 8px;
}

.note-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.note-row time,
.note-row small {
  color: var(--text-muted);
  font-size: 12px;
}

.note-block strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.note-block p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.6;
  white-space: pre-wrap;
}

.mark-swatch {
  width: 14px;
  height: 14px;
  display: inline-block;
  border-radius: 3px;
  background: var(--coral);
}

.mark-swatch.blue { background: var(--blue); }
.mark-swatch.green { background: var(--green); }
.mark-swatch.amber { background: #d9940a; }

.table-action {
  padding: 3px 7px;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
}

.status-bar {
  min-height: 34px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  border-top: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
}

.status-bar > :last-child {
  text-align: right;
}

.risk-note {
  color: #687681;
}

dialog {
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(21, 36, 47, 0.35);
}

.stock-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  margin: 16px 16px 16px auto;
}

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

.stock-chart-section {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--line);
}

.detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.detail-section-heading h3 {
  margin: 0;
  font-size: 14px;
}

.detail-section-heading span {
  color: var(--text-muted);
  font-size: 12px;
}

.chart-heading-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.chart-mode-toggle.segmented {
  height: 28px;
  flex: 0 0 auto;
}

.chart-mode-toggle .segment {
  min-width: 44px;
  padding: 0 9px;
  font-size: 12px;
}

.price-chart {
  width: 100%;
  height: 300px;
  display: block;
  background: #fbfcfd;
  border: 1px solid var(--line);
}

.moneyflow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.moneyflow-grid div {
  min-height: 62px;
  padding: 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.moneyflow-grid dt {
  color: var(--text-muted);
  font-size: 12px;
}

.moneyflow-grid dd {
  margin: 6px 0 0;
  font-weight: 700;
}

.inline-edit-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.compact-form {
  margin-top: 12px;
}

.compact-form textarea {
  min-height: 78px;
}

.compact-notes {
  margin-top: 14px;
}

.compact-notes .note-row {
  grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr) auto;
}

.settings-dialog {
  width: min(780px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow-x: hidden;
}

.admin-dialog { width: min(1060px, calc(100vw - 24px)); }

.admin-section-picker {
  display: grid;
  grid-template-columns: 96px minmax(220px, 360px);
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
}

.admin-section-picker label {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.admin-section-picker select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
}

.admin-section-picker select:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.admin-panel[hidden] { display: none; }
.admin-inline-actions { display: flex; justify-content: space-between; gap: 10px; }

.settings-section > form,
.admin-dialog > form,
.membership-form { padding: 0; }

.settings-lead {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

.membership-usage {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.llm-mode-form {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.llm-mode-form fieldset {
  min-width: 0;
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
}

.llm-mode-form legend {
  margin-bottom: 7px;
  color: var(--text-muted);
  font-size: 11px;
}

.llm-mode-form label { position: relative; cursor: pointer; }
.llm-mode-form label + label { border-left: 1px solid var(--line-strong); }
.llm-mode-form input { position: absolute; opacity: 0; pointer-events: none; }
.llm-mode-form label span {
  min-height: 36px;
  display: grid;
  place-items: center;
  padding: 7px 13px;
  color: var(--text-secondary);
  font-size: 12px;
}
.llm-mode-form input:checked + span { background: var(--text-primary); color: #fff; }
.llm-mode-form input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.llm-mode-form label.is-disabled { cursor: not-allowed; opacity: 0.42; }

.switch-control {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}

.compact-number-field { width: min(260px, 100%); margin-top: 14px; }
.admin-save-actions { padding: 0 18px 18px; }

.admin-users-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.admin-user-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 160px 100px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.admin-user-identity strong,
.admin-user-identity span,
.admin-user-identity small { display: block; }
.admin-user-identity strong { color: var(--text-primary); font-size: 13px; }
.admin-user-identity span,
.admin-user-identity small,
.admin-user-usage,
.admin-user-lock { margin-top: 4px; color: var(--text-muted); font-size: 11px; }

.membership-form {
  min-width: 0;
  display: grid;
  grid-template-columns: 100px minmax(170px, 0.8fr) minmax(160px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.membership-form label { min-width: 0; display: grid; gap: 5px; }
.membership-form label span { color: var(--text-muted); font-size: 10px; }
.membership-form input,
.membership-form select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
}

.membership-expiry { min-width: 0; display: grid; gap: 5px; align-self: end; }
.membership-expiry span { color: var(--text-muted); font-size: 10px; }
.membership-expiry strong { min-height: 34px; display: flex; align-items: center; color: var(--text-secondary); font-size: 12px; font-weight: 650; }

@media (max-width: 820px) {
  .admin-user-row { grid-template-columns: 1fr auto; }
  .admin-user-row .membership-form { grid-column: 1 / -1; }
  .membership-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .membership-form .button { align-self: end; }
}

@media (max-width: 600px) {
  .llm-mode-form { align-items: stretch; flex-direction: column; }
  .llm-mode-form fieldset { width: 100%; }
  .llm-mode-form label { flex: 1; }
  .membership-form { grid-template-columns: minmax(0, 1fr); }
}

.dialog-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin: 2px 0 0;
  font-size: 19px;
  letter-spacing: 0;
}

.detail-code,
.dialog-eyebrow {
  color: var(--text-muted);
  font-size: 12px;
}

.detail-price-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-price-line strong {
  color: var(--coral);
  font-size: 30px;
}

.detail-price-line > span:nth-child(2) {
  color: var(--coral);
  font-size: 17px;
}

.streak-pill {
  background: var(--coral-soft);
  color: var(--coral);
  font-weight: 700;
}

.detail-section {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-section p {
  line-height: 1.8;
}

.sector-chip {
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.detail-grid div {
  min-height: 68px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-grid dt {
  color: var(--text-muted);
  font-size: 12px;
}

.detail-grid dd {
  margin: 7px 0 0;
  font-weight: 700;
}

.connection-status {
  margin: 18px 18px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
}

.connection-status.connected {
  border-color: #a7dec9;
  background: var(--green-soft);
  color: #086a4b;
}

.settings-dialog form {
  padding: 18px;
}

.settings-dialog .settings-section > form,
.settings-dialog .membership-form,
.settings-dialog.admin-dialog > form { padding: 0; }

.settings-section {
  padding: 18px;
  border-top: 1px solid var(--line);
}

.settings-section h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.settings-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.settings-section-heading span {
  color: var(--text-muted);
  font-size: 12px;
}

.account-birth-form {
  display: grid;
  grid-template-columns: 1fr 0.8fr 0.7fr;
  gap: 10px;
}

.account-birth-form .dialog-actions {
  grid-column: 1 / -1;
}

.backfill-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.model-config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}

.model-role-selectors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 4px 0 16px;
}

.model-role-selectors select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
}

.model-pool-list { display: grid; gap: 10px; }

.model-pool-row {
  display: grid;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.model-pool-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.model-pool-heading strong { color: var(--text-primary); font-size: 14px; }
.model-pool-heading span { color: var(--text-muted); font-size: 11px; }
.model-pool-fields { display: grid; grid-template-columns: 0.75fr 1.35fr 1fr 1.15fr; gap: 10px; }
.model-delete-button { margin-left: auto; color: var(--coral); }

@media (max-width: 900px) {
  .model-pool-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .admin-section-picker,
  .model-role-selectors,
  .model-pool-fields { grid-template-columns: minmax(0, 1fr); }
  .admin-inline-actions { align-items: stretch; flex-direction: column; }
}

.model-config-panel {
  min-width: 0;
  display: grid;
  gap: 11px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.model-config-panel:last-child {
  border-right: 0;
}

.model-config-heading {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.model-config-heading h4 {
  margin: 0;
  font-size: 14px;
}

.model-role {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.primary-role {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.model-test-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.model-test-status {
  min-width: 0;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-test-status.success {
  color: var(--green);
}

.model-test-status.failure {
  color: var(--coral);
}

.fallback-model-panel:has(input[type="checkbox"]:not(:checked)) .form-field {
  opacity: 0.58;
}

.form-field {
  display: grid;
  gap: 7px;
  font-weight: 650;
}

.form-field input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: none;
}

.form-hint {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(244, 246, 248, 0.65);
  backdrop-filter: blur(2px);
  animation: overlay-enter var(--motion-fast) ease both;
}

.loading-overlay[hidden] {
  display: none;
}

.loading-box {
  min-width: 220px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: loading-box-enter var(--motion-medium) var(--ease-out) both;
}

@keyframes overlay-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes loading-box-enter {
  from { opacity: 0; transform: translateY(5px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #d9e4e9;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#toast.toast {
  position: fixed;
  top: auto;
  left: auto;
  right: 18px;
  bottom: 48px;
  z-index: 60;
  width: max-content;
  height: auto;
  max-width: min(420px, calc(100vw - 36px));
  padding: 11px 14px;
  border-radius: 4px;
  background: #21313c;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 1;
  pointer-events: none;
  transform: none;
  animation: toast-enter var(--motion-medium) var(--ease-out) both;
}

#toast.toast[hidden] { display: none; }

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .breathing-orbit,
  .breathing-ring {
    animation: none !important;
  }
}

/* Auction, theme library and popularity views */
.auction-phase-notice {
  min-height: 58px;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7fafb;
}

.auction-phase-marker {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #83909a;
  box-shadow: 0 0 0 4px rgba(131, 144, 154, 0.12);
}

.auction-phase-notice > div { min-width: 0; display: grid; gap: 2px; }
.auction-phase-notice strong { color: var(--text); font-size: 13px; }
.auction-phase-notice span:not(.auction-phase-marker) { color: var(--text-muted); font-size: 12px; line-height: 1.5; }
.auction-phase-notice time { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.auction-phase-notice[data-phase="observing"] { background: #fffaf0; }
.auction-phase-notice[data-phase="observing"] .auction-phase-marker { background: #c58b1c; box-shadow: 0 0 0 4px rgba(197, 139, 28, 0.14); }
.auction-phase-notice[data-phase="selection"] { background: #fff4f1; }
.auction-phase-notice[data-phase="selection"] .auction-phase-marker { background: var(--market-up); box-shadow: 0 0 0 4px rgba(198, 66, 54, 0.14); }
.auction-phase-notice[data-phase="selection"] time { color: var(--market-up); font-weight: 700; }
.auction-phase-notice[data-phase="finalized"] { background: #f2f7f5; }
.auction-phase-notice[data-phase="finalized"] .auction-phase-marker { background: #3f7661; box-shadow: 0 0 0 4px rgba(63, 118, 97, 0.13); }

.market-feature-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.market-feature-summary > div {
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}

.market-feature-summary > div:last-child { border-right: 0; }
.market-feature-summary span { color: var(--text-muted); font-size: 12px; }
.market-feature-summary strong { font-size: 18px; font-variant-numeric: tabular-nums; }

.market-feature-filterbar {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.market-feature-table-frame {
  max-height: calc(100vh - 310px);
  border-right: 0;
}

#auctionView .market-feature-table-frame { max-height: none; }

.auction-insight-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.25fr) minmax(300px, 1fr) minmax(230px, .7fr);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.auction-insight-section {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.auction-insight-section:last-child { border-right: 0; }

.auction-insight-heading,
.auction-candidate-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auction-insight-heading { min-height: 42px; margin-bottom: 10px; }
.auction-insight-heading h3,
.auction-candidate-heading h3 { margin: 2px 0 0; font-size: 15px; }
.auction-amount-value { font-size: 20px; font-variant-numeric: tabular-nums; }

.auction-theme-list { min-height: 162px; display: grid; align-content: start; }
.auction-theme-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
}
.auction-theme-row > div:first-child { min-width: 0; display: grid; gap: 2px; }
.auction-theme-row > div:first-child strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.auction-theme-row > div:first-child span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: 11px; }
.auction-theme-result { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.auction-theme-result small { width: 72px; color: var(--text-muted); font-size: 11px; text-align: right; font-variant-numeric: tabular-nums; }
.auction-theme-status,
.auction-expectation,
.disabled-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.auction-theme-status.strong,
.auction-expectation.above { border-color: #efb7ad; background: var(--coral-soft); color: var(--market-up); }
.auction-theme-status.steady,
.auction-expectation.matched { border-color: #b8ccdc; background: var(--blue-soft); color: #315f7b; }
.auction-theme-status.mixed { border-color: #e4ca88; background: var(--amber-soft); color: #765314; }
.auction-theme-status.weak,
.auction-expectation.below { border-color: #b9d7cb; background: var(--green-soft); color: var(--market-down); }

.auction-new-theme-line { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; min-height: 36px; padding-top: 9px; }
.auction-new-theme-line > strong { color: var(--text-secondary); font-size: 12px; }
.auction-theme-chips { min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.auction-theme-chips > span { padding: 3px 7px; border-radius: 3px; background: var(--surface-muted); color: var(--text-secondary); font-size: 11px; }
.auction-theme-chips > span strong { color: var(--market-up); font-variant-numeric: tabular-nums; }
.auction-theme-chips > small,
.auction-inline-empty { color: var(--text-muted); font-size: 12px; }
.auction-inline-empty { min-height: 80px; display: grid; place-items: center; }

.auction-amount-trend {
  height: 148px;
  display: flex;
  align-items: stretch;
  gap: 5px;
  padding: 8px 2px 0;
  border-bottom: 1px solid var(--line);
}
.auction-amount-day { min-width: 0; flex: 1; display: grid; grid-template-rows: minmax(0, 1fr) 20px; align-items: end; gap: 4px; }
.auction-amount-day > span { width: 100%; min-height: 8px; border-radius: 2px 2px 0 0; background: #a9bdc8; transition: opacity var(--motion-fast) ease; }
.auction-amount-day.current > span { background: var(--market-up); }
.auction-amount-day:hover > span { opacity: .72; }
.auction-amount-day small { overflow: hidden; color: var(--text-muted); font-size: 10px; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.auction-amount-compare { min-height: 34px; display: flex; align-items: end; gap: 18px; padding-top: 7px; }
.auction-amount-compare span { color: var(--text-muted); font-size: 11px; }
.auction-amount-compare strong { margin-left: 5px; color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }

.auction-news-unavailable { background: var(--surface-muted); }
.auction-news-unavailable p { min-height: 74px; margin: 22px 0 18px; color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.auction-news-unavailable .button { width: 100%; justify-content: center; }
.disabled-status { border-color: var(--line); background: var(--surface); color: var(--text-muted); }

.auction-special-section,
.auction-watchlist-section {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.auction-special-section > summary {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  list-style: none;
  transition: background-color var(--motion-fast) ease;
}
.auction-special-section > summary::-webkit-details-marker { display: none; }
.auction-special-section > summary:hover { background: var(--surface-muted); }
.auction-special-section > summary > span { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; }
.auction-special-section > summary > span .lucide { width: 16px; height: 16px; color: #8a671d; }
.auction-special-section > summary > strong { min-width: 42px; color: var(--market-up); font-size: 12px; font-variant-numeric: tabular-nums; }
.auction-special-section > summary > small { color: var(--text-muted); font-size: 11px; }
.auction-special-section > summary::after { content: ""; justify-self: end; width: 7px; height: 7px; border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted); transform: rotate(45deg); transition: transform var(--motion-fast) ease; }
.auction-special-section[open] > summary::after { transform: rotate(225deg); }

.auction-list-heading {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}
.auction-list-heading h3 { margin: 2px 0 0; font-size: 15px; }
.auction-compact-frame { max-height: 300px; border-right: 0; }
.auction-compact-table { min-width: 920px; }
.auction-one-price-tag { display: inline-flex; min-height: 24px; align-items: center; padding: 2px 8px; border: 1px solid #e4ca88; border-radius: 4px; background: var(--amber-soft); color: #765314; font-size: 12px; font-weight: 700; }

.auction-score { color: #315f7b; font-weight: 750; font-variant-numeric: tabular-nums; }
.auction-core-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.auction-core-tags b { padding: 2px 5px; border: 1px solid #ddc16d; border-radius: 3px; background: var(--amber-soft); color: #715113; font-size: 10px; font-weight: 700; white-space: nowrap; }
.table-muted { color: var(--text-muted); font-size: 12px; }

.auction-candidate-heading { min-height: 58px; padding: 8px 14px 0; background: var(--surface-muted); }
.auction-candidate-heading .search-field input { width: min(280px, 32vw); }
.auction-expectation-segments .segment { gap: 6px; }
.auction-expectation-segments .segment strong { min-width: 20px; color: inherit; font-size: 11px; font-variant-numeric: tabular-nums; }
.auction-source { max-width: 180px; color: var(--text-secondary); font-size: 12px; }
.auction-reason { min-width: 310px; max-width: 420px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }

.auction-workspace-layout {
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.auction-main-workspace { min-width: 0; }
.auction-candidate-heading {
  min-height: 58px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.auction-candidate-heading .search-field input { width: min(260px, 28vw); }

.auction-dataset-bar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}
.auction-dataset-segments { width: 100%; }
.auction-dataset-segments .segment { flex: 1 1 0; gap: 6px; }
.auction-dataset-segments strong,
.auction-expectation-segments strong { color: inherit; font-size: 11px; font-variant-numeric: tabular-nums; }

.auction-expectation-filterbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
.auction-expectation-filterbar > span { color: var(--text-muted); font-size: 11px; }
.auction-expectation-filterbar[hidden] { display: none; }
.auction-unified-table-frame {
  min-height: 470px;
  max-height: calc(100vh - 354px);
  border-right: 0;
  border-bottom: 0;
}
.auction-table { min-width: 740px; }
.auction-stock-cell { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 5px; min-width: 105px; }
.auction-stock-cell > b { color: var(--text-muted); font-size: 10px; font-weight: 500; text-align: center; }
.auction-stock-cell > span,
.auction-context-cell,
.auction-volume-cell { min-width: 0; display: grid; gap: 2px; }
.auction-stock-cell strong,
.auction-context-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.auction-stock-cell small,
.auction-context-cell small,
.auction-volume-cell small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: 10px; font-weight: 400; }
.auction-context-cell { max-width: 155px; }
.auction-volume-cell { min-width: 78px; }
.auction-volume-cell strong { font-size: 11px; font-weight: 600; white-space: nowrap; }

.auction-evidence-rail {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--surface-muted);
}
.auction-evidence-section { padding: 12px 13px; border-bottom: 1px solid var(--line); background: var(--surface); }
.auction-evidence-section .auction-insight-heading { min-height: 38px; margin-bottom: 7px; }
.auction-evidence-section .auction-theme-list { min-height: 0; }
.auction-evidence-section .auction-theme-row { min-height: 37px; }
.auction-evidence-section .auction-theme-result { display: grid; justify-items: end; gap: 2px; }
.auction-evidence-section .auction-theme-result small { width: auto; }
.auction-evidence-section .auction-new-theme-line { grid-template-columns: 1fr; gap: 5px; }
.auction-evidence-section .auction-amount-trend { height: 128px; }
.auction-news-entry {
  min-height: 72px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  color: var(--text-muted);
}
.auction-news-entry > .lucide { width: 17px; height: 17px; }
.auction-news-entry h3 { margin: 0 0 2px; color: var(--text-secondary); font-size: 12px; }
.auction-news-entry p { margin: 0; font-size: 10px; line-height: 1.45; }

.auction-signal,
.popularity-source-tag {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.auction-signal.up { border-color: #efb7ad; background: var(--coral-soft); color: var(--market-up); }
.auction-signal.down { border-color: #b9d7cb; background: var(--green-soft); color: var(--market-down); }
.popularity-source-tag.dual { border-color: #e6c773; background: var(--amber-soft); color: #765314; }
.popularity-concepts { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }

.theme-library-layout {
  display: grid;
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  min-height: 650px;
}

.theme-directory-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #f7f9fa;
}

.theme-directory-heading,
.theme-members-heading {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.theme-directory-heading span,
.theme-members-heading span { color: var(--text-muted); font-size: 12px; }
.theme-members-heading h3 { margin: 0; font-size: 15px; }

.theme-directory {
  max-height: calc(100vh - 292px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.theme-directory-item {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.theme-directory-item:hover { background: #edf8fc; }
.theme-directory-item.active { background: var(--blue-soft); box-shadow: inset 3px 0 var(--blue); }
.theme-directory-item > span { min-width: 0; display: grid; gap: 3px; }
.theme-directory-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.theme-directory-item small { color: var(--text-muted); font-size: 11px; }
.theme-directory-item b { flex: 0 0 auto; font-size: 13px; font-variant-numeric: tabular-nums; }

.theme-detail-panel { min-width: 0; background: var(--surface); }
.theme-detail-empty { min-height: 520px; display: grid; place-items: center; }
.theme-detail-heading { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.theme-detail-heading h3 { margin: 3px 0 1px; font-size: 20px; }
.theme-detail-heading small { color: var(--text-muted); }
.theme-detail-heading > strong { font-size: 24px; font-variant-numeric: tabular-nums; }

.theme-detail-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.theme-detail-metrics > div { display: grid; gap: 4px; padding: 9px 14px; border-right: 1px solid var(--line); }
.theme-detail-metrics > div:last-child { border-right: 0; }
.theme-detail-metrics span { color: var(--text-muted); font-size: 11px; }
.theme-detail-metrics strong { font-size: 14px; font-variant-numeric: tabular-nums; }

.theme-chart-shell { height: 300px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.theme-chart-shell canvas { width: 100%; height: 100%; display: block; }
.theme-members-frame { max-height: 330px; border-right: 0; }

@media (max-width: 900px) {
  .theme-library-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .auction-workspace-layout { grid-template-columns: 1fr; }
  .auction-evidence-rail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 0; }
  .auction-news-entry { grid-column: 1 / -1; border-top: 1px solid var(--line); }
  .market-feature-summary { grid-template-columns: repeat(4, minmax(105px, 1fr)); }
  .market-feature-filterbar { align-items: stretch; flex-direction: column; }
  .market-feature-filterbar .search-field input { width: 100%; }
}

@media (max-width: 720px) {
  .auction-phase-notice { grid-template-columns: 10px minmax(0, 1fr); }
  .auction-phase-notice time { grid-column: 2; }
  .market-feature-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-feature-summary > div { min-height: 60px; }
  .auction-candidate-heading { align-items: stretch; flex-direction: column; padding-bottom: 8px; }
  .auction-candidate-heading .search-field input { width: 100%; }
  .auction-dataset-bar { overflow-x: auto; }
  .auction-dataset-segments { min-width: 480px; }
  .auction-expectation-filterbar { align-items: stretch; flex-direction: column; }
  .auction-evidence-rail { display: block; }
  .auction-unified-table-frame { min-height: 360px; max-height: none; }
  .market-feature-segments { width: 100%; height: auto; overflow-x: auto; }
  .market-feature-segments .segment { min-height: 38px; flex: 1 0 auto; }
  .market-feature-table-frame { max-height: none; }
  .theme-library-layout { display: block; min-height: 0; }
  .theme-directory-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .theme-directory { max-height: 280px; }
  .theme-detail-empty { min-height: 260px; }
  .theme-detail-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-detail-metrics > div:nth-child(2) { border-right: 0; }
  .theme-chart-shell { height: 260px; }
  .theme-members-frame { max-height: none; }
}

/* Phase 1 application shell */
html {
  background: var(--canvas);
}

body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  grid-template-rows: 56px minmax(calc(100vh - 86px), auto) 30px;
  align-items: stretch;
}

.lucide {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  stroke-width: 1.75;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: block;
  flex: 0 0 36px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--action);
  font-size: 0;
  overflow: hidden;
}

.brand-logo {
  width: 36px;
  height: 36px;
  display: block;
}

.auth-brand .brand-mark {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
}

.auth-brand .brand-logo {
  width: 44px;
  height: 44px;
}

.app-header {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 56px;
  height: 56px;
  grid-template-columns: 190px minmax(240px, 1fr) auto;
  gap: 18px;
  padding: 0 16px;
  border-bottom-color: var(--border);
  box-shadow: 0 1px 0 rgba(23, 26, 31, 0.02);
}

.brand-block {
  gap: 10px;
}

.brand-block h1 {
  font-size: 17px;
  font-weight: 720;
}

.source-label {
  margin-top: 2px;
  font-size: 11px;
}

.market-tape {
  gap: 18px;
}

.market-item,
.market-item strong {
  font-size: 12px;
}

.header-actions,
.header-date-group,
.header-command-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-actions {
  justify-self: end;
  min-width: 0;
}

.header-date-group {
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
}

.header-date-group .icon-button {
  width: 28px;
  min-height: 28px;
  border: 0;
  background: transparent;
}

.header-date-group .lucide {
  width: 16px;
  height: 16px;
}

.header-date-group .date-input {
  width: 126px;
  height: 28px;
  padding: 0 5px;
  border: 0;
  background: transparent;
  font-size: 12px;
}

.command-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
}

.command-button .lucide {
  width: 16px;
  height: 16px;
}

.account-button > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-menu-button {
  display: none;
}

.module-nav {
  grid-column: 1;
  grid-row: 2 / 4;
  width: 212px;
  height: calc(100vh - 56px);
  min-height: 480px;
  position: sticky;
  top: 56px;
  z-index: 30;
  align-self: start;
  display: flex;
  align-items: stretch;
  flex-direction: column;
  gap: 0;
  padding: 0 9px 10px;
  overflow: hidden auto;
  border-right: 1px solid var(--border);
  border-bottom: 0;
  background: var(--surface);
  scrollbar-width: thin;
}

.nav-brand {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group + .nav-group {
  margin-top: 16px;
}

.nav-group-label {
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  color: #87919d;
  font-size: 11px;
  font-weight: 650;
}

.module-tab {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4d5865;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: color var(--motion-fast) ease, background-color var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}

.module-tab:hover {
  background: #f1f4f7;
  color: var(--text-primary);
}

.module-tab:active {
  transform: scale(0.985);
}

.module-tab.active {
  border: 0;
  background: var(--action-soft);
  color: var(--action);
}

.module-tab.active .lucide {
  stroke-width: 2.15;
}

.nav-label-mobile {
  display: none;
}

.sidebar-collapse-button {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.sidebar-collapse-button:hover {
  background: #f1f4f7;
  color: var(--text-primary);
}

.app-main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  padding: 14px 16px 20px;
}

.status-bar {
  grid-column: 2;
  grid-row: 3;
  min-height: 30px;
  height: 30px;
  border-top-color: var(--border);
}

.overview-strip,
.workspace-view {
  border-color: var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.workspace-view.active-view.view-entering {
  animation-duration: var(--motion-deliberate);
}

.mobile-market-selector {
  display: none;
}

.button,
.icon-button,
.date-input,
select,
input,
textarea {
  border-radius: 6px;
}

.button:focus-visible,
.icon-button:focus-visible,
.module-tab:focus-visible,
.sidebar-collapse-button:focus-visible {
  outline-color: rgba(29, 101, 193, 0.48);
}

body.sidebar-collapsed .module-nav {
  width: 64px;
  padding-right: 7px;
  padding-left: 7px;
}

body.sidebar-collapsed .nav-brand,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .module-tab span,
body.sidebar-collapsed .sidebar-collapse-button span {
  display: none;
}

body.sidebar-collapsed .nav-group:first-of-type {
  margin-top: 10px;
}

body.sidebar-collapsed .nav-group + .nav-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

body.sidebar-collapsed .module-tab,
body.sidebar-collapsed .sidebar-collapse-button {
  justify-content: center;
  padding: 0;
}

body.sidebar-collapsed .sidebar-collapse-button .lucide {
  transform: rotate(180deg);
}

@media (min-width: 721px) and (max-width: 1279px) {
  .app-header {
    grid-template-columns: 190px minmax(0, 1fr) auto;
  }

  .header-actions {
    grid-column: 3;
  }

  .command-button {
    width: 32px;
    padding: 0;
  }

  .command-button > span {
    display: none;
  }

  .account-button {
    width: 32px;
  }
}

@media (min-width: 721px) and (max-width: 1023px) {
  body {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .module-nav {
    width: 64px;
    padding-right: 7px;
    padding-left: 7px;
  }

  .nav-brand,
  .nav-group-label,
  .module-tab span,
  .sidebar-collapse-button span {
    display: none;
  }

  .nav-group:first-of-type {
    margin-top: 10px;
  }

  .nav-group + .nav-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .module-tab,
  .sidebar-collapse-button {
    justify-content: center;
    padding: 0;
  }

  .sidebar-collapse-button {
    display: none;
  }
}

@media (max-width: 720px) {
  html,
  body {
    min-width: 320px;
    width: 100%;
  }

  body,
  body.sidebar-collapsed {
    display: block;
    min-height: 100vh;
    padding-bottom: 64px;
  }

  .app-header {
    width: 100%;
    height: 56px;
    min-height: 56px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 0 10px;
  }

  .brand-block {
    min-width: 0;
  }

  .brand-block .brand-mark,
  .brand-block .brand-logo {
    width: 32px;
    height: 32px;
  }

  .brand-block .brand-mark {
    flex-basis: 32px;
  }

  .brand-block h1 {
    overflow: hidden;
    font-size: 16px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .source-label,
  .market-tape {
    display: none;
  }

  .header-actions {
    grid-column: 2;
    grid-row: 1;
    gap: 5px;
    overflow: visible;
  }

  .header-date-group {
    gap: 1px;
  }

  .header-date-group .icon-button {
    width: 26px;
  }

  .header-date-group .date-input {
    width: 112px;
    min-width: 0;
    flex: 0 0 112px;
    font-size: 11px;
  }

  .header-menu-button {
    width: 34px;
    min-height: 34px;
    display: grid;
    border-color: var(--border);
  }

  .header-command-group {
    position: fixed;
    top: 50px;
    right: 8px;
    z-index: 55;
    width: 196px;
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 3px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .header-command-group.is-open {
    display: flex;
    animation: command-menu-enter var(--motion-medium) var(--ease-out) both;
  }

  .header-command-group .command-button,
  .header-command-group .account-button {
    width: 100%;
    min-height: 38px;
    justify-content: flex-start;
    padding: 0 10px;
    border-color: transparent;
    background: transparent;
  }

  .header-command-group .button.primary {
    border-color: var(--action);
    background: var(--action);
  }

  @keyframes command-menu-enter {
    from { opacity: 0; transform: translateY(-5px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }

  .module-nav,
  body.sidebar-collapsed .module-nav {
    width: 100%;
    height: 64px;
    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 max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    overflow: hidden;
    border-top: 1px solid var(--border);
    border-right: 0;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 -4px 18px rgba(24, 34, 45, 0.07);
  }

  .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;
    border-radius: 6px;
    font-size: 10px;
    text-align: center;
  }

  .module-nav .module-tab span,
  body.sidebar-collapsed .module-nav .module-tab span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .module-nav .module-tab .lucide {
    width: 20px;
    height: 20px;
  }

  .module-nav .module-tab.active,
  .module-nav .module-tab.mobile-active {
    background: transparent;
    color: var(--action);
  }

  .nav-label-desktop {
    display: none !important;
  }

  .nav-label-mobile {
    display: block !important;
  }

  .app-main {
    width: 100%;
    min-height: calc(100vh - 120px);
    padding: 10px 8px 18px;
  }

  .mobile-market-selector:not([hidden]) {
    height: 42px;
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
  }

  .mobile-market-selector > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-secondary);
    font-size: 12px;
  }

  .mobile-market-selector > span .lucide {
    width: 16px;
    height: 16px;
    color: var(--action);
  }

  .mobile-market-selector > span b {
    font-weight: 650;
  }

  .mobile-market-selector select {
    width: 100%;
    height: 38px;
    padding: 0 4px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font-weight: 680;
    text-align: right;
    appearance: none;
  }

  .mobile-market-selector > .lucide {
    width: 16px;
    height: 16px;
    pointer-events: none;
  }

  .status-bar {
    display: none;
  }

  #toast.toast {
    top: auto;
    left: auto;
    right: 10px;
    bottom: 76px;
    width: max-content;
    height: auto;
    max-width: calc(100vw - 20px);
    transform: none;
  }
}

/* Function optimization 1.0 */
.sentiment-gauge::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 64%, rgba(201, 63, 69, .18) 69%, rgba(201, 63, 69, .82) 76%, rgba(201, 63, 69, .12) 83%, transparent 89% 100%);
  -webkit-mask: radial-gradient(circle, transparent 66%, #000 68%);
  mask: radial-gradient(circle, transparent 66%, #000 68%);
  pointer-events: none;
  animation: sentiment-idle 3.8s linear infinite;
}

@keyframes sentiment-idle {
  0% { opacity: .55; transform: rotate(0deg) scale(.98); }
  50% { opacity: 1; transform: rotate(180deg) scale(1.06); }
  100% { opacity: .55; transform: rotate(360deg) scale(.98); }
}

.data-table:not(#limitTable) th[data-auto-sort] {
  cursor: pointer;
  user-select: none;
}

.data-table:not(#limitTable) th[data-auto-sort]:hover {
  background: #e3edf2;
  color: var(--action-hover);
}

.data-table th[data-auto-sort].sort-asc::after { content: " \2191"; color: var(--action); }
.data-table th[data-auto-sort].sort-desc::after { content: " \2193"; color: var(--action); }

.market-breadth-panel {
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}

.market-breadth-panel.breadth-enter {
  animation: breadth-panel-enter 420ms var(--ease-out) both;
}

@keyframes breadth-panel-enter {
  from { opacity: 0.42; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.market-breadth-panel .workspace-heading {
  padding: 0;
}

.market-breadth-panel .workspace-heading > div span {
  display: block;
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 11px;
}

.market-breadth-panel .workspace-heading > strong {
  color: var(--text-primary);
  font-size: 16px;
}

.breadth-distribution {
  height: 10px;
  display: flex;
  gap: 2px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 3px;
  background: #e8ecef;
}

.breadth-distribution i {
  display: block;
  width: 0;
  transition: width 620ms var(--ease-out);
}

.breadth-up { background: var(--market-up); }
.breadth-flat { background: #aab3bc; }
.breadth-down { background: var(--market-down); }

.breadth-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.breadth-metrics > div {
  min-width: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
}

.breadth-metrics > div:last-child { border-right: 0; }
.breadth-metrics span { display: block; color: var(--text-secondary); font-size: 11px; }
.breadth-metrics strong { display: block; margin-top: 5px; font-size: 15px; font-variant-numeric: tabular-nums; }
.breadth-metrics strong.metric-changed,
.market-breadth-panel .workspace-heading > strong.metric-changed { animation: metric-update 560ms var(--ease-out); }

.ladder-board {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding: 18px;
  background: linear-gradient(180deg, #f8fafb 0%, #ffffff 100%);
}

.ladder-step {
  --ladder-accent: #546473;
  --ladder-tint: #f1f4f6;
  --ladder-stock-bg: #fbfcfd;
  --ladder-hover-bg: #eef3f6;
  width: calc(100% - var(--ladder-indent));
  min-width: 0;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  align-items: stretch;
  border: 1px solid var(--border);
  border-left: 4px solid var(--ladder-accent);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.ladder-step[data-ladder-level-card="1"] { --ladder-accent: #3973b7; --ladder-tint: #edf4fb; --ladder-stock-bg: #f8fbfe; --ladder-hover-bg: #e8f2fc; }
.ladder-step[data-ladder-level-card="2"] { --ladder-accent: #16806f; --ladder-tint: #eaf7f4; --ladder-stock-bg: #f7fcfa; --ladder-hover-bg: #e2f5f0; }
.ladder-step[data-ladder-level-card="3"] { --ladder-accent: #b57916; --ladder-tint: #fff5e3; --ladder-stock-bg: #fffcf7; --ladder-hover-bg: #fff0d5; }
.ladder-step[data-ladder-level-card="4"] { --ladder-accent: #b65348; --ladder-tint: #fbecea; --ladder-stock-bg: #fff9f8; --ladder-hover-bg: #f9e7e4; }
.ladder-step[data-ladder-level-card="5"] { --ladder-accent: #6d5b9b; --ladder-tint: #f1eef8; --ladder-stock-bg: #fbfafe; --ladder-hover-bg: #eee9f8; }
.ladder-step[data-ladder-level-card="6"] { --ladder-accent: #9a3f63; --ladder-tint: #f9ecf2; --ladder-stock-bg: #fef9fb; --ladder-hover-bg: #f7e6ee; }

.ladder-step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-right: 1px solid var(--border);
  background: var(--ladder-tint);
}

.ladder-level-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  border-radius: 50%;
  background: var(--ladder-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
}

.ladder-step-header strong,
.ladder-step-header small { display: block; }
.ladder-step-header strong { font-size: 14px; }
.ladder-step-header small { margin-top: 3px; color: var(--text-secondary); font-size: 11px; }

.ladder-step-stocks {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  background: var(--ladder-stock-bg);
}

.ladder-step .ladder-stock {
  min-width: 0;
  min-height: 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--ladder-stock-bg);
  color: inherit;
  text-align: left;
}

.ladder-step .ladder-stock:hover { background: var(--ladder-hover-bg); color: var(--ladder-accent); }
.ladder-step .ladder-stock strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ladder-step .ladder-stock small { max-width: 100%; }

.ladder-more {
  min-width: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--border);
  background: #f7f9fa;
  color: var(--action);
  cursor: pointer;
  white-space: nowrap;
}

.ladder-more:hover { background: var(--action-soft); }
.ladder-more .lucide { width: 15px; height: 15px; }

.rotation-history-panel {
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}

.rotation-history-heading,
.dragon-stage-heading {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.rotation-history-heading h3,
.dragon-stage-heading h3 { margin: 0; font-size: 14px; }
.rotation-history-heading span,
.dragon-stage-heading span { display: block; margin-top: 3px; color: var(--text-secondary); font-size: 11px; }

.rotation-history {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0;
  min-height: 250px;
  overflow: hidden;
}

.rotation-day {
  min-width: 0;
  padding: 9px 7px;
  border-right: 1px solid var(--border);
  transition: background-color var(--motion-medium) ease, opacity var(--motion-medium) ease;
}
.rotation-day header { display: grid; gap: 2px; margin-bottom: 8px; }
.rotation-day header time { font-size: 12px; font-weight: 700; }
.rotation-day header span { color: var(--text-secondary); font-size: 10px; }
.rotation-day.has-selection:not(.selected-day) { opacity: 0.42; }
.rotation-day.selected-day { background: #f0f6fd; }
.rotation-day-sectors { display: grid; gap: 5px; }

.rotation-sector-chip {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.rotation-sector-chip:hover { border-color: var(--border-strong); transform: translateX(2px); }
.rotation-sector-chip.selected { border-color: var(--action); background: var(--action-soft); color: var(--action-hover); }
.rotation-sector-chip > span { color: var(--text-secondary); font-size: 10px; font-variant-numeric: tabular-nums; }
.rotation-sector-chip strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.rotation-sector-chip small { grid-column: 2; color: var(--text-secondary); font-size: 9px; white-space: nowrap; }
.rotation-detail-toolbar { min-height: 48px; }
.rotation-detail-toolbar h2 { font-size: 15px; }

.dragon-card-stage {
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #f7f8fa;
}

.dragon-trader-list {
  --dragon-card-width: 176px;
  position: relative;
  height: 292px;
  min-height: 292px;
  padding: 0 36px;
  overflow: visible;
  perspective: 1000px;
}

.dragon-trader-card {
  --card-accent: #a33f48;
  --card-tint: #fff5f5;
  position: relative;
  position: absolute;
  top: 22px;
  left: 50%;
  width: var(--dragon-card-width);
  height: 238px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 17px 13px 13px;
  overflow: hidden;
  border: 2px solid color-mix(in srgb, var(--card-accent) 62%, #ffffff);
  border-radius: 8px;
  background: linear-gradient(155deg, #ffffff 0%, var(--card-tint) 100%);
  color: inherit;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 5px 15px rgba(24, 34, 45, 0.16), inset 0 0 0 2px rgba(255, 255, 255, 0.74);
  transform: translateX(calc(-50% + var(--card-x, 0px))) translateY(var(--card-y, 0px)) rotate(var(--card-rotation, 0deg));
  transform-origin: 50% 92%;
  transition: transform 320ms cubic-bezier(0.2, 0.85, 0.22, 1.15), border-color 180ms ease, box-shadow 260ms ease, filter 220ms ease;
  will-change: transform;
}

.dragon-card-hit-layer {
  position: absolute;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}

.dragon-card-hit-zone {
  position: absolute;
  top: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.dragon-trader-card:nth-child(6n+1) { --card-accent: #a33f48; --card-tint: #fff2f3; }
.dragon-trader-card:nth-child(6n+2) { --card-accent: #356fa8; --card-tint: #eef6fd; }
.dragon-trader-card:nth-child(6n+3) { --card-accent: #2d7b69; --card-tint: #edf8f4; }
.dragon-trader-card:nth-child(6n+4) { --card-accent: #a8751f; --card-tint: #fff7e8; }
.dragon-trader-card:nth-child(6n+5) { --card-accent: #725c99; --card-tint: #f5f1fb; }
.dragon-trader-card:nth-child(6n+6) { --card-accent: #495762; --card-tint: #f1f4f6; }

.dragon-trader-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 28%, transparent);
  border-radius: 5px;
  pointer-events: none;
}

.dragon-trader-card::after {
  content: "";
  position: absolute;
  top: -45%;
  left: -90%;
  width: 58%;
  height: 190%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  opacity: 0;
  pointer-events: none;
  transform: rotate(18deg);
}

.dragon-trader-card.dealing {
  animation: dragon-card-deal 620ms var(--ease-out) var(--deal-delay, 0ms) both;
}

@keyframes dragon-card-deal {
  from { opacity: 0; transform: translateX(-50%) translateY(78px) scale(0.68) rotate(0deg); filter: blur(2px); }
  65% { opacity: 1; }
  to { opacity: 1; transform: translateX(calc(-50% + var(--card-x, 0px))) translateY(var(--card-y, 0px)) rotate(var(--card-rotation, 0deg)); filter: blur(0); }
}

.dragon-trader-card.hovered {
  z-index: 300 !important;
  border-color: var(--card-accent);
  box-shadow: 0 22px 42px rgba(24, 34, 45, 0.28), 0 0 0 3px color-mix(in srgb, var(--card-accent) 20%, transparent), inset 0 0 0 2px rgba(255, 255, 255, 0.82);
  filter: saturate(1.08);
  outline: none;
  transform: translateX(calc(-50% + var(--card-x, 0px))) translateY(calc(var(--card-y, 0px) - 22px)) scale(1.13) rotate(0deg);
}

.dragon-trader-card.hovered::after { opacity: 1; animation: dragon-card-shine 720ms ease-out both; }

@keyframes dragon-card-shine {
  from { left: -90%; }
  to { left: 145%; }
}

.dragon-trader-card.selected {
  border-color: var(--card-accent);
  box-shadow: 0 7px 18px rgba(24, 34, 45, 0.2), 0 0 0 2px color-mix(in srgb, var(--card-accent) 14%, transparent), inset 0 0 0 2px rgba(255, 255, 255, 0.82);
}

.dragon-trader-card.selected.hovered {
  z-index: 320 !important;
  transform: translateX(calc(-50% + var(--card-x, 0px))) translateY(calc(var(--card-y, 0px) - 24px)) scale(1.15) rotate(0deg);
}

.dragon-card-rank { position: absolute; top: 11px; right: 13px; color: color-mix(in srgb, var(--card-accent) 60%, #ffffff); font-size: 10px; font-weight: 750; }
.dragon-card-monogram { width: 64px; height: 64px; display: grid; place-items: center; flex: 0 0 64px; margin-top: 3px; border: 2px solid rgba(255, 255, 255, 0.92); border-radius: 50%; background: var(--card-accent); color: #fff; font-family: "STKaiti", "KaiTi", serif; font-size: 18px; font-weight: 750; box-shadow: 0 0 0 3px color-mix(in srgb, var(--card-accent) 22%, transparent); }
.dragon-card-copy { width: 100%; min-width: 0; margin-top: 10px; }
.dragon-card-copy strong { display: block; overflow: hidden; color: #20252a; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.dragon-card-copy q { display: -webkit-box; min-height: 44px; margin-top: 7px; overflow: hidden; color: #58636e; font-family: "STKaiti", "KaiTi", serif; font-size: 11px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.dragon-card-stats { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 9px; border-top: 1px solid color-mix(in srgb, var(--card-accent) 22%, #dfe5e9); }
.dragon-card-stats small { color: var(--text-secondary); font-size: 9px; white-space: nowrap; }
.dragon-card-stats b { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.dragon-trader-detail { min-height: 280px; background: var(--surface); }
.dragon-detail-header { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dragon-detail-header > div > span { color: var(--text-secondary); font-size: 10px; }
.dragon-detail-header h3 { margin: 4px 0 0; font-size: 18px; }
.dragon-detail-header p { max-width: 560px; margin: 5px 0 0; color: var(--text-secondary); font-size: 11px; line-height: 1.5; }
.dragon-detail-header dl { display: grid; grid-template-columns: repeat(3, minmax(92px, 1fr)); margin: 0; border: 1px solid var(--border); border-radius: 6px; }
.dragon-detail-header dl div { padding: 8px 11px; border-right: 1px solid var(--border); text-align: right; }
.dragon-detail-header dl div:last-child { border-right: 0; }
.dragon-detail-header dt { color: var(--text-secondary); font-size: 10px; }
.dragon-detail-header dd { margin: 3px 0 0; font-size: 13px; font-weight: 700; white-space: nowrap; }
.dragon-trader-detail .trader-operations { max-height: 380px; }

.stock-heaven-button { display: inline-flex; align-items: center; gap: 5px; }
.stock-heaven-button .lucide { width: 15px; height: 15px; }

.loading-box {
  width: min(320px, calc(100vw - 32px));
  min-height: 92px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto auto;
  justify-content: stretch;
  padding: 18px 20px;
}

.loading-copy { min-width: 0; }
.loading-copy strong,
.loading-copy small { display: block; }
.loading-copy strong { font-size: 14px; line-height: 1.45; }
.loading-copy small { margin-top: 4px; color: var(--text-secondary); font-size: 11px; line-height: 1.45; }
.loading-progress { grid-column: 1 / -1; height: 3px; margin-top: 13px; overflow: hidden; border-radius: 2px; background: #e5eaee; }
.loading-progress i { width: 44%; height: 100%; display: block; background: var(--action); animation: loading-progress 1.25s ease-in-out infinite; }

.loading-overlay[data-context="screener"] .loading-box {
  width: min(430px, calc(100vw - 32px));
  min-height: 138px;
  padding: 24px 26px;
  border-color: #c8d6e4;
  box-shadow: 0 20px 50px rgba(24, 34, 45, 0.18);
}

.loading-overlay[data-context="screener"] .spinner { width: 28px; height: 28px; }
.loading-overlay[data-context="screener"] .loading-copy strong { font-size: 16px; }
.loading-overlay[data-context="screener"] .loading-copy small { margin-top: 7px; font-size: 12px; }

@keyframes loading-progress {
  from { transform: translateX(-110%); }
  to { transform: translateX(250%); }
}

@media (max-width: 1023px) {
  .rotation-history { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rotation-day { border-bottom: 1px solid var(--border); }
  .rotation-day:nth-child(3n) { border-right: 0; }
  .rotation-day:nth-last-child(-n+3) { border-bottom: 0; }
  .ladder-step { width: calc(100% - min(var(--ladder-indent), 120px)); grid-template-columns: 105px minmax(0, 1fr); }
  .ladder-more { grid-column: 1 / -1; min-height: 38px; border-top: 1px solid var(--border); border-left: 0; }
  .dragon-detail-header { align-items: stretch; flex-direction: column; }
  .dragon-detail-header dl { align-self: stretch; }
}

@media (max-width: 720px) {
  .breadth-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .breadth-metrics > div { border-bottom: 1px solid var(--border); }
  .breadth-metrics > div:nth-child(3) { border-right: 0; }
  .breadth-metrics > div:nth-child(n+4) { border-bottom: 0; }
  .rotation-history { min-height: 224px; }
  .rotation-day { padding: 8px 6px; }
  .rotation-sector-chip { grid-template-columns: 14px minmax(0, 1fr); }
  .rotation-sector-chip small { grid-column: 2; }
  .ladder-board { align-items: stretch; padding: 10px; }
  .ladder-step { width: 100%; grid-template-columns: 1fr; }
  .ladder-step-header { border-right: 0; border-bottom: 1px solid var(--border); }
  .ladder-step-stocks { grid-template-columns: 1fr; }
  .ladder-more { grid-column: auto; }
  .dragon-trader-list { height: 246px; min-height: 246px; padding: 0 15px; }
  .dragon-trader-card { top: 17px; width: var(--dragon-card-width); min-width: 0; height: 204px; min-height: 0; padding: 13px 10px 10px; }
  .dragon-card-monogram { width: 52px; height: 52px; flex-basis: 52px; font-size: 15px; }
  .dragon-card-copy { margin-top: 7px; }
  .dragon-card-copy strong { font-size: 14px; }
  .dragon-card-copy q { min-height: 37px; margin-top: 5px; font-size: 10px; -webkit-line-clamp: 3; }
  .dragon-card-stats { padding-top: 7px; }
  .dragon-card-stats small { font-size: 8px; }
  .dragon-card-stats b { font-size: 9px; }
  .dragon-detail-header dl { grid-template-columns: repeat(3, 1fr); }
  .dragon-detail-header dl div { min-width: 0; padding: 8px 6px; }
  .dragon-detail-header dd { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
  .dialog-header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .stock-heaven-button span { display: none; }
  .stock-heaven-button { width: 36px; padding: 0; justify-content: center; }
}

@media (max-width: 360px) {
  .brand-block > div:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .data-table tbody tr.row-pending {
    opacity: 1;
    transform: none;
  }
}

/* Phase 2 stock preview */
.stock-preview-trigger,
.market-preview-trigger {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color var(--motion-fast) ease, text-decoration-color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.stock-preview-trigger:hover,
.stock-preview-trigger:focus-visible,
.market-preview-trigger:hover {
  color: var(--action);
  text-decoration-color: currentColor;
}

.stock-preview-trigger:focus-visible {
  outline: 2px solid rgba(29, 101, 193, 0.42);
  outline-offset: -2px;
}

.stock-preview-backdrop {
  display: none;
}

.stock-preview-backdrop[hidden],
.stock-preview[hidden],
.stock-preview-loading[hidden] {
  display: none;
}

.stock-preview {
  width: 520px;
  height: 398px;
  position: fixed;
  z-index: 65;
  display: grid;
  grid-template-rows: 64px 38px 230px 30px 36px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(24, 34, 45, 0.2);
  animation: stock-preview-enter var(--motion-medium) var(--ease-out) both;
}

@keyframes stock-preview-enter {
  from { opacity: 0; transform: translateY(5px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.stock-preview-header {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--border);
}

.stock-preview-identity {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: 8px;
}

.stock-preview-identity > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.stock-preview-identity > strong {
  min-width: 0;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-preview-identity > small {
  grid-column: 1 / -1;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-preview-quote {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-variant-numeric: tabular-nums;
}

.stock-preview-quote > strong {
  font-size: 21px;
}

.stock-preview-quote > span {
  font-size: 13px;
  font-weight: 700;
}

.stock-preview-close {
  width: 30px;
  min-height: 30px;
  border-color: transparent;
  background: transparent;
}

.stock-preview-close .lucide {
  width: 16px;
  height: 16px;
}

.stock-preview-tabs {
  display: flex;
  align-items: stretch;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
}

.stock-preview-tab {
  min-width: 62px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
}

.stock-preview-tab:hover {
  color: var(--text-primary);
}

.stock-preview-tab.active {
  border-bottom-color: var(--action);
  color: var(--action);
  font-weight: 700;
}

.stock-preview-tabs > span {
  align-self: center;
  margin-left: auto;
  color: var(--text-secondary);
  font-size: 11px;
}

.stock-preview-chart-shell {
  min-width: 0;
  position: relative;
  padding: 6px 10px 2px;
  background: var(--chart-background);
}

.stock-preview-chart-shell canvas {
  width: 100%;
  height: 220px;
  display: block;
}

.stock-preview-loading {
  position: absolute;
  inset: 6px 10px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--chart-background);
  color: var(--text-secondary);
  font-size: 12px;
}

.stock-preview-loading .spinner {
  width: 18px;
  height: 18px;
}

.stock-preview-summary {
  min-width: 0;
  margin: 0;
  padding: 5px 12px;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 8px 3px 12px;
  border-top: 1px solid var(--border);
}

.stock-preview-footer > span {
  min-width: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-preview-footer .button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border-color: transparent;
  color: var(--action);
  font-size: 12px;
}

.stock-preview-footer .lucide {
  width: 14px;
  height: 14px;
}

@media (max-width: 720px) {
  body.stock-preview-open {
    overflow: hidden;
  }

  .stock-preview-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    background: rgba(23, 26, 31, 0.3);
    animation: preview-backdrop-enter var(--motion-medium) ease both;
  }

  @keyframes preview-backdrop-enter {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .stock-preview {
    width: 100%;
    height: min(490px, calc(100dvh - 64px));
    max-height: calc(100dvh - 64px);
    inset: auto 0 0 !important;
    z-index: 80;
    grid-template-rows: 64px 40px minmax(210px, 1fr) 34px 42px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
    animation-name: stock-preview-sheet-enter;
  }

  @keyframes stock-preview-sheet-enter {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .stock-preview-chart-shell canvas {
    height: 100%;
    min-height: 210px;
  }

  .stock-preview-summary {
    padding-right: 10px;
    padding-left: 10px;
  }
}

/* Phase 3 fortune workspace */
#heavenFortunePanel {
  background: var(--surface);
}

#heavenFortunePanel .fortune-heading {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 10px 18px;
}

.fortune-calendar-heading {
  min-width: 0;
}

#heavenFortunePanel .fortune-heading h3 {
  margin-top: 4px;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#heavenFortunePanel .fortune-heading-actions {
  align-items: end;
  gap: 8px;
}

#heavenFortunePanel .qi-time-field input {
  width: 126px;
  height: 34px;
  border-radius: 6px;
}

.qi-climate-panel {
  padding: 20px 18px 18px;
  border-bottom: 1px solid var(--border);
  background: #f7faf9;
}

.qi-climate-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.qi-climate-heading > div > span {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
}

.qi-climate-heading h3 {
  margin: 4px 0 0;
  font-size: 26px;
  font-weight: 720;
}

.qi-climate-heading > strong {
  max-width: min(52%, 620px);
  padding-left: 12px;
  border-left: 3px solid var(--market-down);
  color: #335b4c;
  font-size: 13px;
  line-height: 1.55;
  text-align: right;
}

#heavenFortunePanel .human-field-summary {
  max-width: 1060px;
  margin-top: 12px;
  color: #37414c;
  font-size: 14px;
  line-height: 1.7;
}

#heavenFortunePanel .human-field-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
  border-color: #dce5e1;
}

#heavenFortunePanel .human-field-grid > div {
  min-height: 96px;
  padding: 13px 14px;
  border-color: #dce5e1;
}

#heavenFortunePanel .human-field-grid span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #587064;
  font-size: 11px;
}

#heavenFortunePanel .human-field-grid .lucide {
  width: 15px;
  height: 15px;
}

#heavenFortunePanel .human-field-grid strong {
  margin-top: 8px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.65;
}

.fortune-interpretation {
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--action);
  background: #f8fafc;
}

.qi-core-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.18fr) minmax(360px, 0.82fr);
  border-bottom: 1px solid var(--border);
}

#heavenFortunePanel .qi-framework-panel,
#heavenFortunePanel .five-phase-panel {
  min-width: 0;
  padding: 18px;
  border-bottom: 0;
  background: var(--surface);
}

#heavenFortunePanel .qi-framework-panel {
  border-right: 1px solid var(--border);
}

#heavenFortunePanel .workspace-heading {
  gap: 14px;
}

#heavenFortunePanel .workspace-heading > span {
  max-width: 68%;
  overflow-wrap: anywhere;
  line-height: 1.45;
  text-align: right;
}

#heavenFortunePanel .qi-framework-layers {
  display: block;
  margin-top: 13px;
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

#heavenFortunePanel .qi-framework-layer {
  min-height: 76px;
  display: grid;
  grid-template-columns: 64px 72px minmax(0, 1fr) 126px;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-right: 0;
  border-bottom: 1px solid var(--border);
  animation: qi-row-enter var(--motion-deliberate) var(--ease-out) both;
}

#heavenFortunePanel .qi-framework-layer:nth-child(2) { animation-delay: 35ms; }
#heavenFortunePanel .qi-framework-layer:nth-child(3) { animation-delay: 70ms; }
#heavenFortunePanel .qi-framework-layer:nth-child(4) { animation-delay: 105ms; }

@keyframes qi-row-enter {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

#heavenFortunePanel .qi-framework-layer > span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 680;
}

#heavenFortunePanel .qi-framework-layer > strong {
  margin: 0;
  font-size: 15px;
}

#heavenFortunePanel .qi-framework-layer > small {
  min-height: 0;
  margin: 0;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.55;
}

#heavenFortunePanel .qi-framework-layer > div {
  width: 126px;
  height: 7px;
  margin: 0;
  border-radius: 2px;
}

#heavenFortunePanel .qi-framework-layer > div i {
  width: var(--qi-segment);
  transform-origin: left;
  animation: qi-segment-enter var(--motion-slow) var(--ease-out) both;
}

@keyframes qi-segment-enter {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

#heavenFortunePanel .five-phase-balance {
  margin-top: 13px;
  gap: 0;
  border-top: 1px solid var(--border);
}

#heavenFortunePanel .phase-balance-row {
  min-height: 61px;
  grid-template-columns: 36px minmax(0, 1fr) 40px;
  padding: 7px 2px;
  border-bottom: 1px solid var(--border);
  animation: qi-row-enter var(--motion-deliberate) var(--ease-out) both;
}

#heavenFortunePanel .phase-balance-row .phase-symbol {
  width: 28px;
  height: 28px;
}

#heavenFortunePanel .phase-track {
  height: 7px;
  border-radius: 2px;
}

#heavenFortunePanel .phase-track span {
  width: var(--phase-width);
  transform-origin: left;
  animation: qi-segment-enter var(--motion-slow) var(--ease-out) both;
}

#heavenFortunePanel .phase-balance-row small {
  font-size: 10px;
}

#heavenFortunePanel .personal-fortune-panel {
  padding: 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}

#heavenFortunePanel .personal-profile-empty {
  min-height: 60px;
  margin-top: 12px;
  padding: 8px 0;
}

#heavenFortunePanel .personal-fortune-result {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(440px, 1.2fr);
  margin-top: 13px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.personal-primary-grid {
  min-width: 0;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  border-right: 1px solid var(--border);
}

.personal-day-master,
.personal-ten-gods {
  min-width: 0;
  padding: 13px 14px;
}

.personal-day-master {
  border-right: 1px solid var(--border);
}

.personal-day-master > span,
.personal-day-master > small,
.personal-ten-gods > span {
  color: var(--text-secondary);
  font-size: 10px;
}

.personal-day-master > strong {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  font-size: 20px;
}

.personal-day-master .phase-symbol {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

.personal-day-master > small {
  display: block;
  margin-top: 6px;
}

.personal-ten-gods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
}

.personal-ten-gods > span {
  grid-column: 1 / -1;
}

.personal-ten-gods div {
  min-width: 0;
}

.personal-ten-gods div > strong {
  color: var(--text-secondary);
  font-size: 10px;
}

.personal-ten-gods p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

#heavenFortunePanel .personal-current-effect {
  min-width: 0;
  padding: 12px 16px;
}

#heavenFortunePanel .personal-current-effect strong {
  margin-top: 5px;
  font-size: 13px;
}

#heavenFortunePanel .personal-current-effect p {
  margin: 5px 0;
  font-size: 12px;
}

.personal-elements-details {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
}

.personal-elements-details:not([open]) > .personal-element-balance,
.qi-evidence-panel:not([open]) > .qi-evidence-body,
.sector-phase-manager:not([open]) > .sector-phase-manager-body {
  display: none;
}

.personal-elements-details > summary {
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.personal-elements-details > summary::-webkit-details-marker,
.qi-evidence-summary::-webkit-details-marker,
.sector-phase-manager-heading::-webkit-details-marker {
  display: none;
}

#heavenFortunePanel .personal-element-balance {
  padding: 12px;
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

#heavenFortunePanel .qi-evidence-panel {
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.qi-evidence-summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  cursor: pointer;
  list-style: none;
}

.qi-evidence-summary:hover {
  background: var(--surface-muted);
}

.qi-evidence-summary > div > span {
  color: var(--text-secondary);
  font-size: 10px;
}

.qi-evidence-summary h3 {
  margin: 3px 0 0;
  font-size: 14px;
}

.qi-evidence-summary > span {
  color: var(--text-secondary);
  font-size: 11px;
}

.qi-evidence-summary > .lucide,
.sector-phase-manager-heading > .lucide {
  width: 16px;
  height: 16px;
  transition: transform var(--motion-medium) var(--ease-out);
}

.qi-evidence-panel[open] > .qi-evidence-summary > .lucide,
.sector-phase-manager[open] > .sector-phase-manager-heading > .lucide {
  transform: rotate(180deg);
}

.qi-evidence-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--border);
}

.qi-detail-section {
  min-width: 0;
  padding: 16px 18px;
}

.qi-detail-section:first-child {
  border-right: 1px solid var(--border);
}

#heavenFortunePanel .fortune-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  border: 1px solid var(--border);
}

#heavenFortunePanel .fortune-metric {
  min-height: 92px;
  padding: 11px;
  border-bottom: 1px solid var(--border);
}

#heavenFortunePanel .fortune-metric:nth-child(3n) {
  border-right: 0;
}

#heavenFortunePanel .fortune-metric:nth-child(n+4) {
  border-bottom: 0;
}

#heavenFortunePanel .fortune-metric strong {
  font-size: 14px;
}

#heavenFortunePanel .phase-sector-list {
  margin-top: 12px;
  border-top: 1px solid var(--border);
}

#heavenFortunePanel .sector-phase-manager {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}

#heavenFortunePanel .sector-phase-manager-heading {
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  cursor: pointer;
  list-style: none;
}

#heavenFortunePanel .sector-phase-manager-heading span {
  text-align: right;
}

.sector-phase-manager-body {
  padding: 0 18px 16px;
  border-top: 1px solid var(--border);
}

#heavenFortunePanel .heaven-footnote {
  padding: 9px 18px;
  background: var(--surface-muted);
}

@media (max-width: 1023px) {
  .qi-core-layout {
    grid-template-columns: 1fr;
  }

  #heavenFortunePanel .qi-framework-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  #heavenFortunePanel .personal-fortune-result {
    grid-template-columns: 1fr;
  }

  .personal-primary-grid {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 720px) {
  body[data-active-view="heavenView"] .overview-strip {
    display: none;
  }

  #heavenView > .heaven-toolbar {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    gap: 10px;
    padding: 10px 12px;
  }

  #heavenView > .heaven-toolbar .section-title-group {
    min-width: 0;
    align-items: baseline;
    flex-direction: row;
    gap: 7px;
  }

  #heavenView > .heaven-toolbar .section-title-group h2 {
    flex: 0 0 auto;
  }

  #heavenView > .heaven-toolbar .section-subtitle {
    min-width: 0;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #heavenModelStatus {
    max-width: 92px;
    text-align: right;
  }

  #heavenFortunePanel .fortune-heading {
    display: block;
    padding: 12px;
  }

  #heavenFortunePanel .fortune-heading h3 {
    font-size: 14px;
    white-space: normal;
  }

  #heavenFortunePanel .fortune-heading-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: end;
    margin-top: 10px;
  }

  #heavenFortunePanel .qi-time-field input {
    width: 100%;
  }

  .qi-climate-panel {
    padding: 16px 12px 12px;
  }

  .qi-climate-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .qi-climate-heading h3 {
    font-size: 22px;
  }

  .qi-climate-heading > strong {
    max-width: 100%;
    text-align: left;
  }

  #heavenFortunePanel .human-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #heavenFortunePanel .human-field-grid > div,
  #heavenFortunePanel .human-field-grid > div:nth-child(2n) {
    min-height: 132px;
    padding: 12px;
    border-right: 1px solid #dce5e1;
    border-bottom: 1px solid #dce5e1;
  }

  #heavenFortunePanel .human-field-grid > div:nth-child(2n) {
    border-right: 0;
  }

  #heavenFortunePanel .human-field-grid > div:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  #heavenFortunePanel .qi-framework-panel,
  #heavenFortunePanel .five-phase-panel,
  #heavenFortunePanel .personal-fortune-panel {
    padding: 14px 12px;
  }

  #heavenFortunePanel .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  #heavenFortunePanel .workspace-heading > span {
    max-width: 100%;
    text-align: left;
  }

  #heavenFortunePanel .qi-framework-layer,
  #heavenFortunePanel .qi-framework-layer:nth-child(2),
  #heavenFortunePanel .qi-framework-layer:last-child {
    min-height: 92px;
    grid-template-columns: 52px 58px minmax(0, 1fr);
    gap: 6px;
    padding: 10px 2px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  #heavenFortunePanel .qi-framework-layer > div {
    width: 100%;
    grid-column: 2 / 4;
    margin-top: 2px;
  }

  .personal-primary-grid {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .personal-day-master,
  .personal-ten-gods {
    padding: 11px;
  }

  .personal-ten-gods {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  #heavenFortunePanel .personal-element-balance {
    grid-template-columns: 1fr;
  }

  .qi-evidence-summary {
    grid-template-columns: minmax(0, 1fr) 18px;
    padding: 8px 12px;
  }

  .qi-evidence-summary > span {
    display: none;
  }

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

  .qi-detail-section {
    padding: 14px 12px;
  }

  .qi-detail-section:first-child {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  #heavenFortunePanel .fortune-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #heavenFortunePanel .fortune-metric,
  #heavenFortunePanel .fortune-metric:nth-child(3),
  #heavenFortunePanel .fortune-metric:nth-child(n+4) {
    min-height: 88px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  #heavenFortunePanel .fortune-metric:nth-child(2n) {
    border-right: 0;
  }

  #heavenFortunePanel .fortune-metric:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  #heavenFortunePanel .sector-phase-manager-heading {
    padding: 0 12px;
  }

  .sector-phase-manager-body {
    padding: 0 12px 14px;
  }
}

/* Heaven follow-up refinements */
#heavenTrendPanel .heaven-controls {
  grid-template-columns: minmax(0, 1fr) auto;
}

.heaven-trend-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.heaven-trend-actions .button {
  width: auto;
  min-width: 72px;
  height: 40px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.heaven-stock-query {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(220px, 1fr);
  align-items: end;
  gap: 10px;
}

.heaven-stock-identity {
  min-width: 0;
  height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
}

.heaven-stock-identity > span,
.heaven-stock-identity > small {
  color: var(--text-secondary);
  font-size: 11px;
}

.heaven-stock-identity > strong {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heaven-stock-identity > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heaven-stock-identity > small::before {
  content: "所属板块 · ";
}

.heart-motto {
  margin: 2px 0 0;
  padding: 13px 22px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: #355e50;
  font-size: 15px;
  font-style: normal;
  font-weight: 680;
  line-height: 1.65;
}

.heart-return-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 10px 18px 0;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}

.heart-return-button:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.heart-return-button .lucide {
  width: 16px;
  height: 16px;
}

.heart-return-button + .heart-stage-inner {
  min-height: 536px;
}

.heart-return-button + .heart-casting-layout,
.heart-return-button + .heart-reveal-layout {
  min-height: 536px;
}

@media (max-width: 860px) {
  #heavenTrendPanel .heaven-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .heaven-stock-query {
    grid-template-columns: minmax(220px, 0.9fr) minmax(200px, 1.1fr);
  }
}

@media (max-width: 520px) {
  #heavenTrendPanel .heaven-controls {
    grid-template-columns: 1fr;
  }

  .heaven-stock-query {
    grid-template-columns: 1fr;
  }

  .heaven-trend-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .heaven-trend-actions .button {
    width: 100%;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .heaven-stock-identity {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .heaven-stock-identity > small {
    grid-column: 2;
    grid-row: 2;
    margin-top: -8px;
  }

  .heaven-stock-identity {
    height: 52px;
    align-content: center;
  }

  .heart-motto {
    padding-right: 12px;
    padding-left: 12px;
    font-size: 14px;
  }

  .heart-return-button {
    margin: 8px 12px 0;
  }
}

/* Phase 4 screener workbench */
.screener-mobile-tabs {
  display: none;
}

.screener-task-strip {
  min-height: 54px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}

.screener-task-strip > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-right: 1px solid var(--border);
}

.screener-task-strip > div:last-child {
  border-right: 0;
}

.screener-task-strip .lucide {
  width: 16px;
  height: 16px;
  color: var(--action);
}

.screener-task-strip span {
  color: var(--text-secondary);
  font-size: 11px;
}

.screener-task-strip strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#screenerView .regime-panel {
  min-height: 82px;
  grid-template-columns: 150px minmax(400px, 1fr) minmax(260px, 0.75fr) 150px;
  background: var(--surface);
}

#screenerView .regime-summary,
#screenerView .regime-evidence,
#screenerView .factor-data-status {
  padding: 10px 12px;
}

#screenerView .regime-summary strong {
  font-size: 20px;
}

#screenerView .regime-selector {
  gap: 4px;
  padding: 10px 12px;
}

#screenerView .regime-option {
  height: 34px;
  border-radius: 6px;
  font-size: 12px;
}

#screenerView .regime-evidence strong {
  font-size: 12px;
}

#screenerView .regime-evidence div {
  max-height: 38px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.55;
}

#screenerView .factor-data-status strong {
  font-size: 17px;
}

#screenerView .screener-layout {
  grid-template-columns: 220px minmax(0, 1fr);
}

#screenerView .strategy-sidebar {
  max-height: 430px;
  padding: 12px;
  background: #f8f9fb;
}

#screenerView .strategy-list {
  gap: 5px;
}

#screenerView .strategy-item {
  min-height: 58px;
  padding: 8px 9px;
  border-color: transparent;
  border-radius: 6px;
  background: transparent;
}

#screenerView .strategy-item:hover {
  border-color: var(--border);
  background: var(--surface);
}

#screenerView .strategy-item.active {
  border-color: #c9dbf1;
  background: var(--action-soft);
}

#screenerView .strategy-item strong {
  font-size: 12px;
}

#screenerView .strategy-item span {
  margin-top: 3px;
  font-size: 10px;
}

#screenerView .strategy-item small {
  margin-top: 4px;
  font-size: 10px;
}

#screenerView .strategy-workbench {
  padding: 12px 14px 14px;
}

.strategy-workbench-heading {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -2px 0 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--border);
}

.strategy-workbench-heading span,
.strategy-workbench-heading small {
  color: var(--text-secondary);
  font-size: 10px;
}

.strategy-workbench-heading h3 {
  margin: 3px 0 0;
  font-size: 16px;
}

#screenerView .strategy-meta-fields {
  grid-template-columns: minmax(180px, 0.45fr) minmax(300px, 1fr);
}

#screenerView .strategy-prompt-field textarea {
  min-height: 88px;
}

#screenerView .strategy-actions {
  min-height: 42px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

#screenerView .strategy-actions .checkbox-control {
  margin-right: auto;
  order: -1;
}

.strategy-advanced {
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.strategy-advanced > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.strategy-advanced > summary::-webkit-details-marker {
  display: none;
}

.strategy-advanced > summary div > strong,
.strategy-advanced > summary div > span {
  display: block;
}

.strategy-advanced > summary div > strong {
  font-size: 12px;
}

.strategy-advanced > summary div > span {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 10px;
}

.strategy-advanced > summary .lucide {
  width: 16px;
  height: 16px;
  transition: transform var(--motion-medium) var(--ease-out);
}

.strategy-advanced[open] > summary .lucide {
  transform: rotate(180deg);
}

.strategy-advanced:not([open]) > .formula-field {
  display: none;
}

#screenerView .formula-field {
  margin: 4px 0 0;
}

#screenerView .form-field.formula-field textarea {
  min-height: 210px;
}

#screenerView .backtest-panel {
  padding: 10px 14px 12px;
  background: #fbfcfd;
}

#screenerView .backtest-panel > .workspace-heading {
  padding: 0;
}

#screenerView .backtest-panel .dragon-summary {
  border: 1px solid var(--border);
}

#screenerView .result-toolbar {
  min-height: 58px;
}

#screenerView .screener-results-view {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#screenerView .screener-result-frame {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 440px;
  max-height: 640px;
  overflow: auto;
}

#screenerView .screener-result-frame .data-table {
  min-width: 1420px;
}

#screenerView .screener-result-frame th:nth-child(1),
#screenerView .screener-result-frame td:nth-child(1),
#screenerView .screener-result-frame th:nth-child(2),
#screenerView .screener-result-frame td:nth-child(2),
#screenerView .screener-result-frame th:nth-child(3),
#screenerView .screener-result-frame td:nth-child(3) {
  position: sticky;
  z-index: 2;
  background: var(--surface);
}

#screenerView .screener-result-frame thead th:nth-child(-n+3) {
  z-index: 5;
  background: #edf2f5;
}

#screenerView .screener-result-frame th:nth-child(1),
#screenerView .screener-result-frame td:nth-child(1) {
  left: 0;
  width: 48px;
  min-width: 48px;
}

#screenerView .screener-result-frame th:nth-child(2),
#screenerView .screener-result-frame td:nth-child(2) {
  left: 48px;
  width: 82px;
  min-width: 82px;
}

#screenerView .screener-result-frame th:nth-child(3),
#screenerView .screener-result-frame td:nth-child(3) {
  left: 130px;
  width: 112px;
  min-width: 112px;
  box-shadow: 1px 0 0 var(--border);
}

#screenerView .probability-value small {
  margin-top: 3px;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 500;
}

@media (max-width: 1023px) and (min-width: 721px) {
  #screenerView .regime-panel {
    grid-template-columns: 140px minmax(360px, 1fr);
  }

  #screenerView .regime-evidence,
  #screenerView .factor-data-status {
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 720px) {
  body[data-active-view="screenerView"] .overview-strip {
    display: none;
  }

  #screenerView > .section-toolbar:first-child {
    min-height: 64px;
    align-items: center;
    flex-direction: row;
    padding: 10px 12px;
  }

  #screenerView > .section-toolbar:first-child .section-title-group {
    min-width: 0;
    gap: 2px;
  }

  #screenerView > .section-toolbar:first-child .toolbar-controls {
    width: auto;
    flex-wrap: nowrap;
  }

  #screenerView > .section-toolbar:first-child #factorSyncButton,
  #screenerView > .section-toolbar:first-child #screenerExportButton {
    display: none;
  }

  #screenerView > .section-toolbar:first-child #screenerRunButton {
    min-height: 38px;
    padding: 0 12px;
  }

  .screener-mobile-tabs {
    height: 44px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
  }

  .screener-mobile-tabs button {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 650;
  }

  .screener-mobile-tabs button.active {
    border-bottom-color: var(--action);
    color: var(--action);
  }

  #screenerView.mobile-strategy .screener-results-view,
  #screenerView.mobile-results .screener-strategy-view {
    display: none;
  }

  .screener-task-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .screener-task-strip > div {
    border-bottom: 1px solid var(--border);
  }

  .screener-task-strip > div:nth-child(2n) {
    border-right: 0;
  }

  .screener-task-strip > div:nth-last-child(-n+2) {
    border-bottom: 0;
  }

  #screenerView .regime-panel {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    min-height: 0;
  }

  #screenerView .regime-summary,
  #screenerView .regime-selector,
  #screenerView .regime-evidence,
  #screenerView .factor-data-status {
    min-width: 0;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  #screenerView .regime-selector {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 8px;
  }

  #screenerView .regime-option {
    min-width: 0;
    height: 32px;
    padding: 0 2px;
    font-size: 10px;
  }

  #screenerView .regime-evidence {
    grid-column: 1 / -1;
    border-right: 0;
  }

  #screenerView .factor-data-status {
    grid-column: 1 / -1;
    border-right: 0;
  }

  #screenerView .screener-layout {
    grid-template-columns: 1fr;
  }

  #screenerView .strategy-sidebar {
    max-height: none;
    padding: 10px 12px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  #screenerView .strategy-sidebar .workspace-heading {
    min-height: 28px;
    margin-bottom: 6px;
  }

  #screenerView .strategy-list {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  #screenerView .strategy-item {
    min-width: 208px;
    flex: 0 0 208px;
    scroll-snap-align: start;
  }

  #screenerView .strategy-workbench {
    padding: 12px;
  }

  #screenerView .strategy-meta-fields {
    grid-template-columns: 1fr;
  }

  #screenerView .strategy-actions {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  #screenerView .strategy-actions .checkbox-control {
    grid-column: 1 / -1;
  }

  #screenerView .strategy-actions .danger-button {
    grid-column: 1 / -1;
  }

  #screenerView .backtest-panel {
    padding: 10px 12px;
  }

  #screenerView .result-toolbar {
    min-height: 74px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 5px;
    padding: 10px 12px;
  }

  #screenerView .result-toolbar .section-title-group {
    align-items: center;
    flex-direction: row;
  }

  #screenerView .result-toolbar .section-subtitle {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #screenerView .screener-result-frame {
    min-height: calc(100vh - 248px);
    max-height: calc(100vh - 184px);
  }
}

/* Sentiment cycle */
.sentiment-cycle-summary {
  display: grid;
  grid-template-columns: minmax(250px, 1.25fr) repeat(3, minmax(170px, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.sentiment-cycle-current,
.sentiment-cycle-state {
  min-width: 0;
  min-height: 112px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-right: 1px solid var(--border);
}

.sentiment-cycle-state:last-child {
  border-right: 0;
}

.sentiment-cycle-score-marker {
  width: 74px;
  flex: 0 0 74px;
  padding-left: 11px;
  border-left: 3px solid var(--action);
}

.sentiment-cycle-score-marker strong,
.sentiment-cycle-score-marker span {
  display: block;
}

.sentiment-cycle-score-marker strong {
  font-size: 32px;
  line-height: 1;
}

.sentiment-cycle-score-marker span {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 10px;
}

.sentiment-cycle-score-marker.phase-ice { border-color: #2f6fb2; color: #245b91; }
.sentiment-cycle-score-marker.phase-repair { border-color: #118890; color: #0b6d74; }
.sentiment-cycle-score-marker.phase-fermentation { border-color: #4f8a43; color: #3d7133; }
.sentiment-cycle-score-marker.phase-climax { border-color: #c93f45; color: #a92f35; }
.sentiment-cycle-score-marker.phase-divergence { border-color: #c07814; color: #98600f; }
.sentiment-cycle-score-marker.phase-retreat { border-color: #68717c; color: #525b65; }

.sentiment-cycle-current h3 {
  margin: 5px 0 3px;
  font-size: 18px;
}

.sentiment-cycle-current small,
.sentiment-cycle-state span,
.sentiment-cycle-state small {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
}

.sentiment-cycle-state {
  display: block;
  padding-top: 22px;
}

.sentiment-cycle-state strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 19px;
}

.sentiment-cycle-analysis {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.75fr);
  border-bottom: 1px solid var(--border);
}

.sentiment-trend-panel,
.sentiment-components-panel {
  min-width: 0;
  padding: 14px 16px 16px;
}

.sentiment-trend-panel {
  border-right: 1px solid var(--border);
}

.sentiment-chart-shell {
  height: 270px;
  min-width: 0;
}

.sentiment-chart-shell canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sentiment-component-list {
  display: grid;
  gap: 9px;
}

.sentiment-component-item {
  min-width: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sentiment-component-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.sentiment-component-item > div:first-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 38px;
  align-items: baseline;
  gap: 8px;
}

.sentiment-component-item strong {
  font-size: 12px;
}

.sentiment-component-item span,
.sentiment-component-item small {
  color: var(--text-secondary);
  font-size: 10px;
}

.sentiment-component-item b {
  font-size: 13px;
  text-align: right;
}

.sentiment-component-item small {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sentiment-component-track {
  height: 5px;
  margin-top: 6px;
  overflow: hidden;
  background: #e6ebef;
}

.sentiment-component-track i {
  height: 100%;
  display: block;
  background: var(--action);
  transition: width var(--motion-deliberate) var(--ease-out);
}

.sentiment-component-item:nth-child(2) .sentiment-component-track i { background: var(--market-up); }
.sentiment-component-item:nth-child(3) .sentiment-component-track i { background: var(--market-down); }
.sentiment-component-item:nth-child(4) .sentiment-component-track i { background: var(--warning-color); }
.sentiment-component-item:nth-child(5) .sentiment-component-track i { background: #5d6c78; }

.sentiment-detail-toolbar {
  min-height: 46px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.sentiment-detail-toolbar h2 {
  font-size: 15px;
}

.sentiment-history-frame {
  min-height: 0;
  max-height: 510px;
  border-right: 0;
}

.sentiment-history-table {
  min-width: 980px;
  table-layout: fixed;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.sentiment-history-table .sentiment-col-date { width: 94px; }
.sentiment-history-table .sentiment-col-score { width: 56px; }
.sentiment-history-table .sentiment-col-phase,
.sentiment-history-table .sentiment-col-direction { width: 62px; }
.sentiment-history-table .sentiment-col-count { width: 54px; }
.sentiment-history-table .sentiment-col-height { width: 58px; }
.sentiment-history-table .sentiment-col-feedback { width: 66px; }
.sentiment-history-table .sentiment-col-rate { width: 72px; }

.sentiment-history-table th,
.sentiment-history-table td {
  height: 40px;
  padding: 0 7px;
  text-align: center;
}

.sentiment-history-table .number {
  text-align: center;
}

.sentiment-history-table thead th {
  border-bottom-color: #d8e0e6;
  font-size: 11.5px;
}

.sentiment-history-table .sentiment-history-groups th {
  height: 29px;
  top: 0;
  z-index: 5;
  border-right-color: #d8e0e6;
  color: #52616d;
  font-weight: 700;
}

.sentiment-history-table .sentiment-history-groups .group-state { background: #edf3f8; }
.sentiment-history-table .sentiment-history-groups .group-ladder { background: #f4f5ef; }
.sentiment-history-table .sentiment-history-groups .group-risk { background: #f8eeee; }
.sentiment-history-table .sentiment-history-groups .group-feedback { background: #edf5f2; }

.sentiment-history-table .sentiment-history-columns th {
  height: 34px;
  top: 29px;
  z-index: 5;
  background: #f7f9fa;
  color: #394a56;
  font-size: 12px;
}

.sentiment-history-table tbody td:first-child,
.sentiment-history-table tbody td:nth-child(2),
.sentiment-history-table .sentiment-history-columns th:first-child,
.sentiment-history-table .sentiment-history-columns th:nth-child(2) {
  position: sticky;
  z-index: 3;
  background: var(--surface);
}

.sentiment-history-table tbody td:first-child,
.sentiment-history-table .sentiment-history-columns th:first-child {
  left: 0;
  text-align: left;
}

.sentiment-history-table tbody td:nth-child(2),
.sentiment-history-table .sentiment-history-columns th:nth-child(2) {
  left: 94px;
  box-shadow: 1px 0 0 var(--border);
}

.sentiment-history-table .sentiment-history-columns th:first-child,
.sentiment-history-table .sentiment-history-columns th:nth-child(2) {
  z-index: 7;
  background: #f7f9fa;
}

.sentiment-history-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.sentiment-history-table tbody tr:hover td {
  background: #f1f6f9;
}

.sentiment-history-table tbody tr.latest-row td {
  background: #f2f7fd;
  font-weight: 650;
}

.sentiment-history-table tbody tr.latest-row td:first-child {
  box-shadow: inset 3px 0 0 var(--action);
}

.sentiment-score-cell {
  font-weight: 750;
}

.sentiment-score-cell.score-strong { color: var(--market-up); }
.sentiment-score-cell.score-weak { color: var(--market-down); }
.sentiment-score-cell.score-neutral { color: var(--warning-color); }

.sentiment-phase-badge,
.sentiment-direction {
  display: inline-flex;
  align-items: center;
  min-width: 42px;
  min-height: 21px;
  justify-content: center;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--surface-muted);
  font-size: 11.5px;
  font-weight: 650;
}

.sentiment-phase-badge.phase-ice { background: #eaf2fb; color: #245b91; }
.sentiment-phase-badge.phase-repair { background: #e7f6f6; color: #0b6d74; }
.sentiment-phase-badge.phase-fermentation { background: #edf6ea; color: #3d7133; }
.sentiment-phase-badge.phase-climax { background: #fcecee; color: #a92f35; }
.sentiment-phase-badge.phase-divergence { background: #fff3df; color: #98600f; }
.sentiment-phase-badge.phase-retreat { background: #eef0f2; color: #525b65; }

.sentiment-direction.trend-hot { color: var(--market-up); }
.sentiment-direction.trend-cool { color: var(--market-down); }
.sentiment-direction.trend-flat { color: var(--text-secondary); }

@media (max-width: 1023px) {
  .sentiment-cycle-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sentiment-cycle-current,
  .sentiment-cycle-state:nth-child(2) {
    border-bottom: 1px solid var(--border);
  }

  .sentiment-cycle-state:nth-child(2) {
    border-right: 0;
  }

  .sentiment-cycle-analysis {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  }
}

@media (max-width: 720px) {
  body[data-active-view="sentimentCycleView"] .overview-strip {
    display: none;
  }

  .sentiment-cycle-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .sentiment-cycle-toolbar .toolbar-controls {
    width: 100%;
  }

  .sentiment-cycle-toolbar .sentiment-range-selector {
    flex: 1;
  }

  .sentiment-cycle-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sentiment-cycle-current,
  .sentiment-cycle-state {
    min-height: 98px;
    padding: 12px;
  }

  .sentiment-cycle-current {
    gap: 9px;
  }

  .sentiment-cycle-score-marker {
    width: 62px;
    flex-basis: 62px;
    padding-left: 8px;
  }

  .sentiment-cycle-score-marker strong {
    font-size: 27px;
  }

  .sentiment-cycle-state {
    padding-top: 17px;
  }

  .sentiment-cycle-state strong {
    margin-top: 6px;
    font-size: 16px;
  }

  .sentiment-cycle-analysis {
    grid-template-columns: minmax(0, 1fr);
  }

  .sentiment-trend-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sentiment-chart-shell {
    height: 230px;
  }

  .sentiment-components-panel,
  .sentiment-trend-panel {
    padding: 12px;
  }

  .sentiment-detail-toolbar {
    min-height: 58px;
    padding: 10px 12px;
  }

  .sentiment-history-frame {
    min-height: 0;
    max-height: min(480px, calc(100vh - 210px));
  }
}

/* Ask Heaven: paper, ink and cinnabar visual system */
#heavenView {
  --heaven-paper: #fdfcf8;
  --heaven-paper-muted: #f6f4ed;
  --heaven-ink: #292822;
  --heaven-ink-soft: #6d685b;
  --heaven-ink-faint: #9b9587;
  --heaven-rule: rgba(41, 40, 34, 0.14);
  --heaven-rule-strong: rgba(41, 40, 34, 0.28);
  --heaven-cinnabar: #ad382f;
  --heaven-cinnabar-soft: rgba(173, 56, 47, 0.075);
  --heaven-gold: #9b7a39;
  --heaven-serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", SimSun, serif;
  color: var(--heaven-ink);
  background-color: var(--heaven-paper);
  background-image:
    linear-gradient(rgba(41, 40, 34, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 40, 34, 0.012) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px;
}

#heavenView .heaven-toolbar {
  min-height: 70px;
  padding: 0 22px;
  border-bottom: 1px solid var(--heaven-rule);
  background: rgba(253, 252, 248, 0.94);
}

#heavenView .heaven-toolbar h2,
#heavenView .heaven-panel h3,
#heavenView .heaven-tab,
#heavenView .heart-motto {
  font-family: var(--heaven-serif);
}

#heavenView .heaven-toolbar h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
}

.heaven-title-seal {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(173, 56, 47, 0.7);
  border-radius: 2px;
  color: var(--heaven-cinnabar);
  font-size: 15px;
  transform: rotate(-3deg);
}

#heavenView .section-subtitle {
  color: var(--heaven-ink-faint);
}

#heavenView .heaven-tabs {
  min-height: 52px;
  align-items: stretch;
  gap: 30px;
  padding: 0 22px;
  border-color: var(--heaven-rule);
  background: rgba(253, 252, 248, 0.96);
}

#heavenView .heaven-tab {
  height: 52px;
  position: relative;
  padding: 0 2px;
  border: 0;
  color: var(--heaven-ink-soft);
  font-size: 14px;
  font-weight: 600;
}

#heavenView .heaven-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--heaven-cinnabar);
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity 220ms ease, transform 260ms var(--ease-out);
}

#heavenView .heaven-tab:hover,
#heavenView .heaven-tab.active {
  color: var(--heaven-ink);
}

#heavenView .heaven-tab.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.heaven-proverb {
  margin: 0;
  padding: 9px 22px;
  border-bottom: 1px solid var(--heaven-rule);
  color: var(--heaven-ink-faint);
  font-family: var(--heaven-serif);
  font-size: 11px;
  text-align: right;
}

#heavenView .button {
  border-radius: 2px;
}

#heavenView .button.primary {
  border-color: var(--heaven-cinnabar);
  background: var(--heaven-cinnabar);
}

#heavenView .button.primary:hover:not(:disabled) {
  border-color: #8f2d27;
  background: #8f2d27;
}

#heavenView .button:focus-visible,
#heavenView .heaven-tab:focus-visible,
#heavenView summary:focus-visible {
  outline: 2px solid var(--heaven-cinnabar);
  outline-offset: 3px;
}

/* Trend */
#heavenTrendPanel .heaven-controls {
  min-height: 74px;
  padding: 14px 22px;
  border-color: var(--heaven-rule);
  background: var(--heaven-paper);
}

#heavenTrendPanel .heaven-controls input {
  border-color: var(--heaven-rule-strong);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.68);
  font-family: var(--heaven-serif);
}

#heavenTrendPanel .heaven-controls input:focus {
  border-color: var(--heaven-cinnabar);
  box-shadow: 0 0 0 2px var(--heaven-cinnabar-soft);
}

#heavenTrendPanel .heaven-stock-identity > span,
#heavenTrendPanel .heaven-stock-identity > small {
  color: var(--heaven-ink-faint);
}

.heaven-trend-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  border-top: 1px solid var(--heaven-rule);
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  font-size: 16px;
}

#heavenTrendPanel .heaven-trend-layout {
  min-height: 560px;
  grid-template-columns: minmax(560px, 1.35fr) minmax(360px, 0.85fr);
  border-color: var(--heaven-rule);
  background: var(--heaven-paper);
}

#heavenTrendPanel .hexagram-board {
  padding: 24px 28px 22px;
  border-color: var(--heaven-rule);
  background: rgba(253, 252, 248, 0.86);
}

#heavenTrendPanel .hexagram-heading {
  min-height: 66px;
  border-color: var(--heaven-rule);
}

#heavenTrendPanel .hexagram-heading h3 {
  margin-top: 7px;
  font-size: 27px;
  font-weight: 650;
}

#heavenTrendPanel .hexagram-change strong {
  color: var(--heaven-cinnabar);
  font-family: var(--heaven-serif);
  font-weight: 600;
}

#marketHexagramLines {
  gap: 0;
  margin-top: 10px;
}

.talent-line-group {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 14px;
  padding: 15px 0;
  border-bottom: 1px dashed var(--heaven-rule);
  animation: heaven-group-enter 440ms var(--ease-out) both;
  animation-delay: var(--group-delay);
}

.talent-line-group:last-child {
  border-bottom: 0;
}

.talent-seal {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-top: 9px;
  border: 1px solid var(--heaven-rule-strong);
  border-radius: 2px;
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
}

.talent-line-content > p {
  margin: 0 0 5px 8px;
  color: var(--heaven-ink-faint);
  font-family: var(--heaven-serif);
  font-size: 11px;
}

#marketHexagramLines .hexagram-line-row {
  min-height: 48px;
  grid-template-columns: 42px 150px minmax(0, 1fr);
  padding: 5px 8px;
  border-radius: 1px;
}

#marketHexagramLines .hexagram-line-row.moving {
  border-left-color: var(--heaven-cinnabar);
  background: linear-gradient(90deg, var(--heaven-cinnabar-soft), transparent 78%);
}

#marketHexagramLines .hex-line i {
  height: 7px;
  border-radius: 1px;
  background: #3d3a32;
  transform-origin: center;
  animation: heaven-line-draw 520ms var(--ease-out) both;
}

#marketHexagramLines .hex-line b {
  display: none;
}

#marketHexagramLines .hexagram-line-detail strong {
  font-family: var(--heaven-serif);
  font-weight: 600;
}

#marketHexagramLines .hexagram-line-detail small {
  color: var(--heaven-ink-soft);
}

#heavenTrendPanel .hexagram-text {
  margin-top: 10px;
  padding: 15px 4px 0;
  border-color: var(--heaven-rule);
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  font-size: 14px;
  line-height: 1.9;
}

#heavenTrendPanel .market-movement-summary {
  padding: 10px 13px;
  border-left-color: var(--heaven-cinnabar);
  background: var(--heaven-cinnabar-soft);
  color: var(--heaven-ink-soft);
}

#heavenTrendPanel .trend-reading-panel {
  padding: 22px 24px;
  background: var(--heaven-paper-muted);
}

#heavenTrendPanel .trend-score-line {
  min-height: 90px;
  padding-bottom: 10px;
  border: 0;
}

#heavenTrendPanel .trend-score-line strong {
  margin-top: 6px;
  font-family: var(--heaven-serif);
  font-size: 48px;
  font-variant-numeric: tabular-nums;
}

#heavenTrendPanel .trend-score-line > span {
  padding: 5px 10px;
  border: 2px solid var(--heaven-cinnabar);
  border-radius: 2px;
  color: var(--heaven-cinnabar);
  font-family: var(--heaven-serif);
  font-size: 14px;
  transform: rotate(-3deg);
}

.trend-score-meter {
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--heaven-rule);
}

.trend-score-track {
  height: 4px;
  position: relative;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(63, 99, 80, 0.45), rgba(41, 40, 34, 0.1) 50%, rgba(173, 56, 47, 0.42));
}

.trend-score-track::after {
  content: "";
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: 50%;
  width: 1px;
  background: var(--heaven-rule-strong);
}

#heavenMomentumNeedle {
  width: 13px;
  height: 13px;
  position: absolute;
  top: 50%;
  left: var(--momentum-position, 50%);
  z-index: 1;
  border: 2px solid var(--heaven-paper-muted);
  border-radius: 50%;
  background: var(--heaven-ink);
  box-shadow: 0 2px 7px rgba(41, 40, 34, 0.25);
  transform: translate(-50%, -50%);
  transition: left 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.trend-score-marks {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  color: var(--heaven-ink-faint);
  font-size: 10px;
}

#heavenTrendPanel .three-talent-readings {
  margin-top: 8px;
}

#heavenTrendPanel .talent-reading {
  min-height: 88px;
  padding: 13px 2px;
  border-color: var(--heaven-rule);
}

#heavenTrendPanel .talent-reading > strong {
  font-family: var(--heaven-serif);
  font-size: 14px;
}

#heavenTrendPanel .talent-reading > span {
  color: var(--heaven-ink-soft);
  font-size: 12px;
}

.talent-balance {
  display: grid;
  grid-template-columns: 55px minmax(0, 1fr) 55px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin-top: 9px;
}

.talent-balance small {
  margin: 0 !important;
  color: var(--heaven-ink-faint);
  font-variant-numeric: tabular-nums;
}

.talent-balance i {
  height: 3px;
  overflow: hidden;
  background: var(--heaven-rule);
}

.talent-balance b {
  width: var(--talent-value);
  height: 100%;
  display: block;
  background: var(--heaven-ink-soft);
  transform-origin: left;
  animation: qi-segment-enter 500ms var(--ease-out) both;
}

#heavenTrendPanel .heaven-index-strip {
  gap: 7px;
  margin-top: 12px;
}

#heavenTrendPanel .heaven-index-strip div {
  padding: 10px;
  border-color: var(--heaven-rule);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.58);
}

.trend-evidence-panel {
  margin-top: 16px;
  border-top: 1px solid var(--heaven-rule);
}

.trend-evidence-panel > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--heaven-ink-faint);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.trend-evidence-panel > summary::-webkit-details-marker {
  display: none;
}

.trend-evidence-panel > summary .lucide {
  width: 15px;
  transition: transform 220ms var(--ease-out);
}

.trend-evidence-panel[open] > summary .lucide {
  transform: rotate(180deg);
}

.trend-evidence-body {
  padding: 3px 0 10px;
  color: var(--heaven-ink-faint);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 10px;
  line-height: 1.6;
}

.trend-evidence-body > div {
  display: grid;
  gap: 2px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--heaven-rule);
}

.trend-evidence-body strong,
.trend-evidence-body span,
.trend-evidence-body small {
  font-size: inherit;
  font-weight: 400;
}

/* Fortune */
#heavenFortunePanel {
  background: rgba(253, 252, 248, 0.9);
}

#heavenFortunePanel .fortune-heading {
  min-height: 82px;
  padding: 14px 22px;
  border-color: var(--heaven-rule);
}

#heavenFortunePanel .fortune-heading h3 {
  font-family: var(--heaven-serif);
  font-size: 18px;
}

#heavenFortunePanel .qi-time-field input {
  border-color: var(--heaven-rule-strong);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.65);
}

#heavenFortunePanel .qi-climate-panel {
  position: relative;
  padding: 32px 26px 24px;
  border-color: var(--heaven-rule);
  background: transparent;
}

#heavenFortunePanel .qi-climate-panel::before {
  content: "壹 · 天";
  display: block;
  margin-bottom: 18px;
  color: var(--heaven-cinnabar);
  font-family: var(--heaven-serif);
  font-size: 11px;
}

#heavenFortunePanel .qi-climate-heading {
  align-items: center;
}

#heavenFortunePanel .qi-climate-heading h3 {
  font-family: var(--heaven-serif);
  font-size: 34px;
  font-weight: 600;
}

#heavenFortunePanel .qi-climate-heading > strong {
  border-left-color: var(--heaven-cinnabar);
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  font-weight: 500;
}

#heavenFortunePanel .human-field-summary {
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  line-height: 1.85;
}

#heavenFortunePanel .human-field-grid {
  margin-top: 20px;
  border-color: var(--heaven-rule);
  background: rgba(255, 255, 255, 0.38);
}

#heavenFortunePanel .human-field-grid > div {
  min-height: 112px;
  border-color: var(--heaven-rule);
}

#heavenFortunePanel .human-field-grid span {
  color: var(--heaven-ink-faint);
}

#heavenFortunePanel .human-field-grid strong {
  color: var(--heaven-ink);
  font-family: var(--heaven-serif);
  font-weight: 500;
}

#heavenFortunePanel .qi-core-layout,
#heavenFortunePanel .personal-fortune-panel,
#heavenFortunePanel .qi-evidence-panel {
  border-color: var(--heaven-rule);
  background: rgba(253, 252, 248, 0.72);
}

#heavenFortunePanel .qi-framework-panel,
#heavenFortunePanel .five-phase-panel,
#heavenFortunePanel .personal-fortune-panel {
  padding: 22px;
  background: transparent;
}

#heavenFortunePanel .qi-framework-panel {
  border-color: var(--heaven-rule);
}

#heavenFortunePanel .workspace-heading h3 {
  font-family: var(--heaven-serif);
  font-weight: 600;
}

#heavenFortunePanel .qi-framework-layers,
#heavenFortunePanel .five-phase-balance,
#heavenFortunePanel .personal-fortune-result,
#heavenFortunePanel .phase-sector-list,
#heavenFortunePanel .fortune-metrics {
  border-color: var(--heaven-rule);
}

#heavenFortunePanel .qi-framework-layer,
#heavenFortunePanel .phase-balance-row,
#heavenFortunePanel .fortune-metric,
#heavenFortunePanel .phase-sector-row,
#heavenFortunePanel .personal-primary-grid,
#heavenFortunePanel .personal-day-master,
#heavenFortunePanel .personal-elements-details,
#heavenFortunePanel .qi-detail-section {
  border-color: var(--heaven-rule);
}

#heavenFortunePanel .personal-fortune-panel::before {
  content: "贰 · 人";
  display: block;
  margin-bottom: 15px;
  color: var(--heaven-cinnabar);
  font-family: var(--heaven-serif);
  font-size: 11px;
}

#heavenFortunePanel .personal-day-master > strong,
#heavenFortunePanel .personal-current-effect > strong {
  font-family: var(--heaven-serif);
}

#heavenFortunePanel .qi-evidence-summary {
  min-height: 64px;
  border-color: var(--heaven-rule);
}

#heavenFortunePanel .qi-evidence-summary:hover {
  background: var(--heaven-paper-muted);
}

/* Heart ritual */
#heavenHeartPanel {
  --ritual-bg: #111310;
  --ritual-surface: #181a16;
  --ritual-rule: rgba(232, 222, 199, 0.15);
  --ritual-text: #ece6d8;
  --ritual-muted: #aaa394;
  background: var(--ritual-bg);
  color: var(--ritual-text);
}

#heavenView #heavenHeartPanel > .heart-dust-canvas {
  width: 100%;
  margin: 0;
}

#heavenView #heavenHeartPanel > .heart-lamp {
  width: min(680px, 82vw);
  margin: 0;
}

#heavenView #heavenHeartPanel > .heart-toolbar-controls {
  width: auto;
  margin: 0;
}

#heavenHeartPanel .heart-stage {
  min-height: 620px;
  position: relative;
  overflow: hidden;
  background-color: var(--ritual-bg);
  background-image: linear-gradient(rgba(232, 222, 199, 0.018) 1px, transparent 1px);
  background-size: 100% 38px;
}

#heavenHeartPanel .heart-stage.active-heart-stage {
  animation: ritual-stage-enter 480ms var(--ease-out) both;
}

#heavenHeartPanel .heart-stage-inner {
  min-height: 620px;
  gap: 22px;
  padding: 54px 24px;
}

#heavenHeartPanel .heart-stage-index {
  color: #c46056;
  font-family: var(--heaven-serif);
  font-size: 11px;
}

#heavenHeartPanel .heart-stage-inner h3,
#heavenHeartPanel .heart-first-thought h3,
#heavenHeartPanel .casting-action-panel h3,
#heavenHeartPanel .heart-interpretation-heading h3 {
  color: var(--ritual-text);
  font-family: var(--heaven-serif);
  font-weight: 500;
}

#heavenHeartPanel .heart-guidance,
#heavenHeartPanel .heart-first-thought p,
#heavenHeartPanel .heart-line-text p,
#heavenHeartPanel .heaven-footnote {
  color: var(--ritual-muted);
  font-family: var(--heaven-serif);
}

#heavenHeartPanel .heart-motto {
  margin: 24px 0 8px;
  color: #cabfaa;
  font-size: 16px;
  font-weight: 400;
}

#heavenHeartPanel .button {
  border-color: rgba(196, 96, 86, 0.68);
  background: transparent;
  color: var(--ritual-text);
}

#heavenHeartPanel .button:hover:not(:disabled) {
  border-color: #c46056;
  background: rgba(196, 96, 86, 0.09);
}

#heavenHeartPanel .button.primary {
  border-color: #a9473e;
  background: #a9473e;
  color: #fffaf1;
}

#heavenHeartPanel .button:disabled {
  border-color: var(--ritual-rule);
  background: rgba(255, 255, 255, 0.035);
  color: #746f65;
}

#heavenHeartPanel #heartIntro::before {
  content: "心";
  position: absolute;
  top: 50%;
  left: 50%;
  color: rgba(232, 222, 199, 0.025);
  font-family: var(--heaven-serif);
  font-size: min(42vw, 440px);
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -52%);
}

#heavenHeartPanel .breathing-stage {
  background: transparent;
}

#heavenHeartPanel .breathing-scene {
  width: 280px;
  height: 280px;
}

#heavenHeartPanel .breathing-ring {
  border-color: rgba(194, 159, 90, 0.22);
}

#heavenHeartPanel .ring-outer {
  width: 268px;
  height: 268px;
}

#heavenHeartPanel .ring-inner {
  width: 222px;
  height: 222px;
  border-color: rgba(196, 96, 86, 0.18);
}

#heavenHeartPanel .breathing-orbit {
  width: 162px;
  height: 162px;
  border-color: rgba(194, 159, 90, 0.5);
  background: rgba(194, 159, 90, 0.08);
  box-shadow: 0 0 40px rgba(194, 159, 90, 0.09);
}

#heavenHeartPanel .breathing-orbit strong {
  color: var(--ritual-text);
  font-family: var(--heaven-serif);
  font-weight: 400;
}

#heavenHeartPanel .breathing-orbit span,
#heavenHeartPanel .breathing-phase,
#heavenHeartPanel .breathing-stage > h3 {
  color: var(--ritual-muted);
  font-family: var(--heaven-serif);
}

#heavenHeartPanel .breathing-scene[data-phase="exhale"] .breathing-orbit {
  border-color: rgba(232, 222, 199, 0.28);
  background: rgba(232, 222, 199, 0.04);
}

#heavenHeartPanel .breathing-progress {
  background: rgba(232, 222, 199, 0.12);
}

#heavenHeartPanel .breathing-progress i {
  background: #a9473e;
}

#heavenHeartPanel .heart-return-button {
  z-index: 3;
  border-color: transparent;
}

#heavenHeartPanel .heart-casting-layout,
#heavenHeartPanel .heart-reveal-layout {
  min-height: 620px;
  grid-template-columns: minmax(520px, 1.15fr) minmax(320px, 0.85fr);
}

#heavenHeartPanel .heart-hexagram-shell,
#heavenHeartPanel .heart-reveal-board {
  padding: 28px;
  border-color: var(--ritual-rule);
  background: transparent;
}

#heavenHeartPanel .casting-action-panel,
#heavenHeartPanel .heart-first-thought {
  background: rgba(255, 255, 255, 0.025);
}

#heavenHeartPanel .workspace-heading,
#heavenHeartPanel .hexagram-heading,
#heavenHeartPanel .heart-line-texts,
#heavenHeartPanel .heart-line-text,
#heavenHeartPanel .heart-interpretation-heading,
#heavenHeartPanel .heart-footnote {
  border-color: var(--ritual-rule);
}

#heavenHeartPanel .workspace-heading > span,
#heavenHeartPanel .hexagram-position,
#heavenHeartPanel .hexagram-line-detail small,
#heavenHeartPanel .hexagram-change span {
  color: var(--ritual-muted);
}

#heavenHeartPanel .hexagram-line-detail strong,
#heavenHeartPanel .hexagram-heading h3 {
  color: var(--ritual-text);
  font-family: var(--heaven-serif);
}

#heavenHeartPanel .hexagram-change strong {
  color: #c46056;
}

#heavenHeartPanel .hex-line i {
  background: #d3cbbb;
}

#heavenHeartPanel .placeholder-line i {
  height: 1px;
  background: rgba(232, 222, 199, 0.22);
}

#heavenHeartPanel .hexagram-line-row.moving,
#heavenHeartPanel .heart-line-text.moving {
  border-left-color: #c46056;
  background: rgba(196, 96, 86, 0.08);
}

#heavenHeartPanel .coin-result span {
  width: 70px;
  height: 70px;
  border: 1px solid #b8954f;
  background: #28251d;
  color: #d6bd82;
  font-family: var(--heaven-serif);
  box-shadow: inset 0 0 0 4px #1b1914, inset 0 0 0 5px rgba(184, 149, 79, 0.5);
}

#heavenHeartPanel .heart-line-texts {
  background: rgba(255, 255, 255, 0.018);
}

#heavenHeartPanel .heart-interpretation-heading {
  min-height: 82px;
  padding: 14px 22px;
}

#heavenHeartPanel .heaven-interpretation {
  min-height: 460px;
  padding: 32px max(24px, 8vw);
  border-color: var(--ritual-rule);
  background: transparent;
  color: #d7d0c1;
  font-family: var(--heaven-serif);
  font-size: 15px;
  line-height: 2;
}

@keyframes heaven-group-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heaven-line-draw {
  from { opacity: 0; transform: scaleX(0.25); filter: blur(2px); }
  to { opacity: 1; transform: scaleX(1); filter: blur(0); }
}

@keyframes ritual-stage-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  #heavenTrendPanel .heaven-trend-layout,
  #heavenHeartPanel .heart-casting-layout,
  #heavenHeartPanel .heart-reveal-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #heavenTrendPanel .hexagram-board,
  #heavenHeartPanel .heart-hexagram-shell,
  #heavenHeartPanel .heart-reveal-board {
    border-right: 0;
    border-bottom: 1px solid var(--heaven-rule);
  }

  #heavenHeartPanel .heart-hexagram-shell,
  #heavenHeartPanel .heart-reveal-board {
    border-bottom-color: var(--ritual-rule);
  }

  #heavenFortunePanel .human-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  #heavenView .heaven-toolbar {
    min-height: 60px;
    padding: 0 14px;
  }

  #heavenView .heaven-tabs {
    gap: 22px;
    padding: 0 14px;
  }

  .heaven-proverb {
    padding: 8px 14px;
    text-align: left;
  }

  #heavenTrendPanel .heaven-controls,
  #heavenFortunePanel .fortune-heading {
    padding-right: 14px;
    padding-left: 14px;
  }

  #heavenTrendPanel .hexagram-board,
  #heavenTrendPanel .trend-reading-panel {
    padding: 18px 14px;
  }

  #heavenTrendPanel .hexagram-heading h3 {
    font-size: 21px;
  }

  .talent-line-group {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .talent-seal {
    margin: 0 0 4px 8px;
  }

  #marketHexagramLines .hexagram-line-row {
    grid-template-columns: 38px 104px minmax(0, 1fr);
    gap: 8px;
  }

  #marketHexagramLines .hex-line {
    width: 104px;
  }

  #marketHexagramLines .hexagram-line-detail small {
    white-space: normal;
  }

  .talent-balance {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  #heavenFortunePanel .qi-climate-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  #heavenFortunePanel .qi-climate-heading > strong {
    max-width: none;
    text-align: left;
  }

  #heavenFortunePanel .human-field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #heavenHeartPanel .heart-stage,
  #heavenHeartPanel .heart-stage-inner {
    min-height: 560px;
  }

  #heavenHeartPanel .heart-line-texts {
    grid-template-columns: minmax(0, 1fr);
  }

  #heavenHeartPanel .heart-line-text {
    border-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #heavenView *,
  #heavenView *::before,
  #heavenView *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* Ask Heaven fidelity pass: the reference layouts live inside the app shell. */

#heavenView .heaven-toolbar,
#heavenView .heaven-tabs,
#heavenView .heaven-proverb,
#heavenView .heaven-panel > :not(.heart-ritual-curtain) {
  width: min(100% - 40px, 1280px);
  margin-right: auto;
  margin-left: auto;
}

#heavenView .heaven-toolbar {
  min-height: 68px;
  padding: 0;
  background: transparent;
}

.heaven-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

#heavenView .heaven-tabs {
  min-height: 50px;
  padding: 0;
}

#heavenView .heaven-proverb {
  padding: 8px 0 10px;
}

#heavenView #heavenNotice {
  width: min(100% - 40px, 1280px);
  margin: 12px auto 0;
}

#heavenTrendPanel .heaven-controls {
  padding-right: 0;
  padding-left: 0;
}

#heavenTrendPanel .heaven-trend-layout {
  border-right: 1px solid var(--heaven-rule);
  border-left: 1px solid var(--heaven-rule);
}

#heavenTrendPanel .heaven-interpretation {
  border-right: 1px solid var(--heaven-rule);
  border-left: 1px solid var(--heaven-rule);
}

/* Fortune reference: animated qi field, flow list, three temporal layers. */
#heavenFortunePanel .fortune-heading {
  padding-right: 0;
  padding-left: 0;
}

.qi-hero {
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(340px, 0.85fr);
  gap: 44px;
  padding: 18px 0 12px;
  border-bottom: 1px solid var(--heaven-rule);
}

#heavenFortunePanel .qi-climate-panel {
  min-height: 530px;
  position: relative;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  border: 0;
}

#heavenFortunePanel .qi-climate-panel::before {
  display: none;
}

#qiFieldCanvas {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.qi-climate-center {
  max-width: 520px;
  position: relative;
  z-index: 1;
  text-align: center;
  pointer-events: none;
}

.qi-section-mark {
  display: block;
  margin-bottom: 14px;
  color: var(--heaven-cinnabar);
  font-family: var(--heaven-serif);
  font-size: 11px;
}

#heavenFortunePanel .qi-climate-heading {
  display: block;
}

#heavenFortunePanel .qi-climate-heading > div > span {
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  letter-spacing: 0.45em;
}

#heavenFortunePanel .qi-climate-heading h3 {
  margin-top: 18px;
  font-size: clamp(36px, 4.1vw, 56px);
  letter-spacing: 0;
  animation: qi-word-focus 1.8s var(--ease-out) both;
}

#heavenFortunePanel .qi-climate-heading > strong {
  max-width: 430px;
  display: block;
  margin: 22px auto 0;
  padding: 0;
  border: 0;
  color: var(--heaven-ink-soft);
  font-size: 15px;
  line-height: 2;
  text-align: center;
}

#heavenFortunePanel .human-field-summary {
  max-width: 520px;
  margin: 15px auto 0;
  color: var(--heaven-ink-faint);
  font-size: 12px;
  text-align: center;
}

#heavenFortunePanel .qi-hero > .five-phase-panel {
  padding: 14px 0 0;
}

#heavenFortunePanel .qi-hero > .five-phase-panel .workspace-heading {
  min-height: 44px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--heaven-rule);
}

#heavenFortunePanel .qi-hero > .five-phase-panel .workspace-heading h3 {
  letter-spacing: 0.22em;
}

#heavenFortunePanel .phase-balance-row {
  min-height: 82px;
  grid-template-columns: 38px minmax(0, 1fr) 46px;
  padding: 12px 3px;
}

#heavenFortunePanel .phase-balance-row .phase-symbol {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

#heavenFortunePanel .phase-balance-row small {
  margin-top: 7px;
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  font-size: 11px;
  line-height: 1.5;
}

#heavenFortunePanel > .qi-framework-panel {
  padding: 16px 0 4px;
  border-right: 0;
  border-bottom: 1px solid var(--heaven-rule);
}

#heavenFortunePanel > .qi-framework-panel .workspace-heading {
  min-height: 42px;
  border-bottom: 1px solid var(--heaven-rule);
}

#heavenFortunePanel > .qi-framework-panel .qi-framework-layers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
  border: 0;
}

#heavenFortunePanel > .qi-framework-panel .qi-framework-layer {
  min-height: 124px;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  align-content: center;
  gap: 5px 12px;
  padding: 20px 22px;
  border-right: 1px solid var(--heaven-rule);
  border-bottom: 0;
}

#heavenFortunePanel > .qi-framework-panel .qi-framework-layer:last-child {
  border-right: 0;
}

#heavenFortunePanel > .qi-framework-panel .qi-framework-layer > span {
  grid-row: 1;
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  letter-spacing: 0.12em;
}

#heavenFortunePanel > .qi-framework-panel .qi-framework-layer > strong {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--heaven-serif);
  font-size: 17px;
}

#heavenFortunePanel > .qi-framework-panel .qi-framework-layer > small {
  grid-column: 1 / -1;
  grid-row: 2;
  color: var(--heaven-ink-faint);
}

#heavenFortunePanel > .qi-framework-panel .qi-framework-layer > div {
  width: 100%;
  grid-column: 1 / -1;
  grid-row: 3;
  align-self: end;
}

.qi-instincts-panel {
  border-bottom: 1px solid var(--heaven-rule);
}

#heavenFortunePanel .qi-instincts-panel .human-field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 0;
}

#heavenFortunePanel .qi-instincts-panel .human-field-grid > div {
  min-height: 150px;
  padding: 26px 22px;
  border-right: 1px solid var(--heaven-rule);
  border-bottom: 0;
}

#heavenFortunePanel .qi-instincts-panel .human-field-grid > div:last-child {
  border-right: 0;
}

#heavenFortunePanel .qi-instincts-panel .human-field-grid span {
  padding-bottom: 12px;
  border-bottom: 2px solid var(--water, #31505f);
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  letter-spacing: 0.14em;
}

#heavenFortunePanel .qi-instincts-panel .human-field-grid > div:nth-child(2) span { border-color: #b53a30; }
#heavenFortunePanel .qi-instincts-panel .human-field-grid > div:nth-child(3) span { border-color: #9c7c3c; }
#heavenFortunePanel .qi-instincts-panel .human-field-grid > div:nth-child(4) span { border-color: #b08a3e; }

#heavenFortunePanel .qi-instincts-panel .human-field-grid strong {
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.9;
}

#heavenFortunePanel .personal-fortune-panel {
  margin-top: 58px;
  padding: 0 0 20px;
  border-top: 0;
  background: transparent;
}

#heavenFortunePanel .personal-fortune-panel::before {
  content: "贰 · 人";
  margin-bottom: 10px;
  letter-spacing: 0.35em;
}

#heavenFortunePanel .personal-fortune-panel > .workspace-heading {
  min-height: 48px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--heaven-rule);
}

#heavenFortunePanel .personal-fortune-result {
  grid-template-columns: minmax(430px, 0.9fr) minmax(480px, 1.1fr);
  margin-top: 0;
  border-top: 0;
}

#heavenFortunePanel .personal-primary-grid {
  grid-template-columns: 190px minmax(0, 1fr);
}

#heavenFortunePanel .personal-day-master,
#heavenFortunePanel .personal-ten-gods,
#heavenFortunePanel .personal-current-effect {
  padding: 30px;
}

#heavenFortunePanel .personal-day-master {
  display: grid;
  justify-items: center;
}

.personal-day-master-character {
  margin-top: 13px;
  font-family: var(--heaven-serif);
  font-size: 58px !important;
  font-weight: 500;
  line-height: 1;
}

.personal-day-master-element {
  margin-top: 12px;
  font-family: var(--heaven-serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
}

.phase-text-wood { color: #3f7350 !important; }
.phase-text-fire { color: #b53a30 !important; }
.phase-text-earth { color: #a47725 !important; }
.phase-text-metal { color: #8b6a27 !important; }
.phase-text-water { color: #31505f !important; }

.personal-preferences {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#heavenFortunePanel .personal-preferences > section {
  padding: 30px;
}

#heavenFortunePanel .personal-preferences > section + section {
  border-left: 1px solid var(--heaven-rule);
}

.personal-ten-gods p,
.personal-element-tendency p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.personal-element-tendency {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}

.personal-element-tendency > span {
  grid-column: 1 / -1;
  color: var(--text-secondary);
  font-size: 10px;
}

.personal-element-tendency div {
  min-width: 0;
}

.personal-element-tendency div > strong {
  color: var(--text-secondary);
  font-size: 10px;
}

.personal-element-tendency p {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.personal-ten-gods em,
.personal-element-tendency em {
  padding: 5px 11px;
  border: 1px solid rgba(74, 124, 89, 0.5);
  border-radius: 2px;
  color: #4a7c59;
  font-style: normal;
  font-family: var(--heaven-serif);
}

.personal-ten-gods .ten-god-caution em,
.personal-element-tendency .element-caution em {
  border-color: rgba(181, 58, 48, 0.45);
}

.personal-element-tendency em,
.personal-element-tendency .element-caution em {
  border-color: var(--heaven-rule);
}

#heavenFortunePanel .qi-evidence-panel {
  margin-top: 58px;
  margin-bottom: 34px;
  border-top: 1px solid var(--heaven-rule);
  background: transparent;
}

/* Heart reference: cinematic curtain, single flame and hold-to-cast control. */
#heavenHeartPanel {
  width: 100% !important;
  max-width: none !important;
  min-height: calc(100vh - 128px);
  margin: 0 !important;
}

#heavenHeartPanel .heart-stage,
#heavenHeartPanel .heart-stage-inner {
  min-height: calc(100vh - 128px);
}

.heart-ritual-curtain {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-content: center;
  justify-items: center;
  background: #070910;
  color: #e9e4d6;
  opacity: 0;
  pointer-events: none;
}

.heart-ritual-curtain.is-visible {
  display: grid;
  animation: ritual-curtain-in 650ms ease forwards;
}

.heart-ritual-curtain.is-leaving {
  animation: ritual-curtain-out 700ms ease forwards;
}

.heart-ritual-curtain > i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e8d4a7;
  box-shadow: 0 0 55px 22px rgba(255, 237, 208, 0.14);
  animation: heart-ignite 1.2s var(--ease-out) both;
}

.heart-ritual-curtain > strong {
  margin-top: 48px;
  font-family: var(--heaven-serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.75em;
  text-indent: 0.75em;
}

.heart-ritual-curtain > span {
  margin-top: 18px;
  color: #777269;
  font-family: var(--heaven-serif);
  letter-spacing: 0.35em;
}

#heavenHeartPanel .breathing-scene {
  height: 330px;
}

.heart-breath-flame {
  --flame-brightness: 1.2;
  --flame-opacity: 1;
  --flame-glow: 36px;
  width: 50px;
  height: 66px;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  opacity: var(--flame-opacity);
  filter: brightness(var(--flame-brightness)) drop-shadow(0 0 var(--flame-glow) rgba(255, 174, 78, 0.72));
  transition: filter 3.8s cubic-bezier(0.37, 0.01, 0.22, 1), opacity 3.8s cubic-bezier(0.37, 0.01, 0.22, 1);
}

.heart-breath-flame::before {
  content: "";
  width: 220px;
  height: 220px;
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 110, 0.14), rgba(255, 190, 110, 0) 68%);
  transform: translate(-50%, -50%);
  opacity: calc(var(--flame-opacity) * 0.85);
  transition: opacity 3.8s cubic-bezier(0.37, 0.01, 0.22, 1);
}

.heart-breath-flame > i {
  width: 42px;
  height: 58px;
  position: absolute;
  top: 4px;
  left: 50%;
  border-radius: 48% 52% 52% 48% / 64% 62% 38% 36%;
  background: radial-gradient(circle at 52% 68%, #fff8d8 0 10%, #ffd27a 24%, #ff9b43 55%, #b53a30 82%, rgba(181, 58, 48, 0) 100%);
  transform: translateX(-50%) rotate(1deg);
  transform-origin: 50% 88%;
  clip-path: polygon(50% 0, 73% 28%, 90% 55%, 80% 83%, 58% 100%, 30% 91%, 12% 64%, 23% 32%);
}

#heavenHeartPanel .breathing-scene[data-phase="inhale"] .heart-breath-flame {
  --flame-brightness: 1.28;
  --flame-opacity: 1;
  --flame-glow: 42px;
}

#heavenHeartPanel .breathing-scene[data-phase="exhale"] .heart-breath-flame {
  --flame-brightness: 0.78;
  --flame-opacity: 0.68;
  --flame-glow: 20px;
}

#heavenHeartPanel .breathing-scene[data-phase="settled"] .heart-breath-flame {
  --flame-brightness: 1.05;
  --flame-opacity: 0.9;
  --flame-glow: 30px;
}

#heavenHeartPanel .heart-breath-flame {
  top: 43%;
}

#heavenHeartPanel .breathing-orbit,
#heavenHeartPanel .breathing-scene[data-phase="exhale"] .breathing-orbit {
  width: auto;
  height: auto;
  position: absolute;
  bottom: 34px;
  display: flex;
  align-items: baseline;
  gap: 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  animation: none;
  transform: none;
}

#heavenHeartPanel .breathing-orbit strong {
  font-size: 31px;
}

#heavenHeartPanel .breathing-orbit span {
  margin: 0;
}

#heavenHeartPanel .breathing-orbit {
  z-index: 4;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

#heavenHeartPanel .breathing-orbit strong,
#heavenHeartPanel .breathing-orbit span {
  text-shadow: 0 1px 8px #070910;
}

.heart-cast-button {
  --hold-progress: 0turn;
  width: 128px;
  height: 128px;
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ritual-text);
  cursor: pointer;
  font-family: var(--heaven-serif);
  line-height: 1.7;
  touch-action: none;
}

.heart-cast-button::before,
.heart-cast-button::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.heart-cast-button::before {
  inset: 0;
  border: 1px solid rgba(201, 168, 106, 0.42);
}

.heart-cast-button::after {
  inset: -1px;
  background: conic-gradient(rgba(201, 168, 106, 0.9) var(--hold-progress), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}

.heart-cast-button.is-holding {
  --hold-progress: 1turn;
}

.heart-cast-button.is-holding::after {
  transition: background 680ms linear;
}

.heart-cast-button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

/* Real data settles first; these classes then run a deterministic performance. */
#heavenView {
  position: relative;
}

#heavenView.heaven-data-loading .heaven-panel,
#heavenView.heaven-data-loading .heaven-tabs,
#heavenView.heaven-data-loading .heaven-proverb {
  opacity: 0.42;
  pointer-events: none;
}

#heavenView.heaven-data-loading::after {
  content: "汇集天 · 人 · 地数据";
  position: absolute;
  top: 118px;
  left: 50%;
  z-index: 8;
  padding: 10px 16px;
  border: 1px solid var(--heaven-rule);
  border-radius: 2px;
  background: rgba(253, 252, 248, 0.96);
  color: var(--heaven-ink-soft);
  box-shadow: 0 12px 34px rgba(41, 40, 34, 0.1);
  font-family: var(--heaven-serif);
  font-size: 12px;
  letter-spacing: 0.16em;
  transform: translateX(-50%);
}

#heavenTrendPanel.heaven-performance-pending .talent-line-group {
  opacity: 0.34;
  transform: translateY(7px);
  animation: none;
  transition: opacity 520ms var(--ease-out), transform 520ms var(--ease-out);
}

#heavenTrendPanel.heaven-performance-pending .talent-line-group.is-ready {
  opacity: 1;
  transform: translateY(0);
}

#heavenTrendPanel.heaven-performance-pending .talent-seal {
  filter: grayscale(1);
  opacity: 0.4;
  transition: color 420ms ease, border-color 420ms ease, filter 420ms ease, opacity 420ms ease, box-shadow 420ms ease;
}

#heavenTrendPanel.heaven-performance-pending .talent-line-group.is-ready .talent-seal {
  border-color: rgba(181, 58, 48, 0.7);
  color: var(--heaven-cinnabar);
  filter: none;
  opacity: 1;
  box-shadow: 0 0 18px rgba(181, 58, 48, 0.12);
}

#heavenTrendPanel.heaven-performance-pending .hexagram-line-row .hex-line i {
  opacity: 0.12;
  filter: blur(3px);
  transform: scaleX(0.16);
  animation: none;
  transition: opacity 620ms var(--ease-out), filter 620ms var(--ease-out), transform 620ms var(--ease-out);
}

#heavenTrendPanel.heaven-performance-pending .hexagram-line-row .hexagram-line-detail,
#heavenTrendPanel.heaven-performance-pending .hexagram-line-row .hexagram-position,
#heavenTrendPanel.heaven-performance-pending .hexagram-line-row .hex-line b {
  opacity: 0;
  filter: blur(4px);
  transition: opacity 520ms ease, filter 520ms ease;
}

#heavenTrendPanel.heaven-performance-pending .hexagram-line-row.is-ready .hex-line i {
  opacity: 1;
  filter: blur(0);
  transform: scaleX(1);
}

#heavenTrendPanel.heaven-performance-pending .hexagram-line-row.is-ready .hexagram-line-detail,
#heavenTrendPanel.heaven-performance-pending .hexagram-line-row.is-ready .hexagram-position,
#heavenTrendPanel.heaven-performance-pending .hexagram-line-row.is-ready .hex-line b {
  opacity: 1;
  filter: blur(0);
}

#heavenTrendPanel.heaven-performance-pending #marketHexagramName,
#heavenTrendPanel.heaven-performance-pending #marketTransformedName,
#heavenTrendPanel.heaven-performance-pending .hexagram-change,
#heavenTrendPanel.heaven-performance-pending .trend-score-line > *,
#heavenTrendPanel.heaven-performance-pending .trend-score-meter,
#heavenTrendPanel.heaven-performance-pending .market-movement-summary {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(6px);
  transition: opacity 800ms var(--ease-out), filter 800ms var(--ease-out), transform 800ms var(--ease-out);
}

#heavenTrendPanel.performance-title-ready #marketHexagramName,
#heavenTrendPanel.performance-change-ready #marketTransformedName,
#heavenTrendPanel.performance-change-ready .hexagram-change,
#heavenTrendPanel.performance-score-ready .trend-score-line > *,
#heavenTrendPanel.performance-score-ready .trend-score-meter,
#heavenTrendPanel.performance-text-ready .market-movement-summary {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

#heavenTrendPanel.heaven-performance-pending #heavenMomentumNeedle {
  left: 50%;
  opacity: 0;
}

#heavenTrendPanel.performance-score-ready #heavenMomentumNeedle {
  left: var(--momentum-position, 50%);
  opacity: 1;
  transition: left 1.5s cubic-bezier(0.18, 0.85, 0.3, 1.22), opacity 300ms ease;
}

#heavenTrendPanel.heaven-performance-pending .talent-reading,
#heavenTrendPanel.heaven-performance-pending .heaven-index-strip > * {
  opacity: 0;
  transform: translateY(9px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}

#heavenTrendPanel.heaven-performance-pending .talent-reading.is-ready,
#heavenTrendPanel.heaven-performance-pending .heaven-index-strip > *.is-ready {
  opacity: 1;
  transform: translateY(0);
}

#heavenTrendPanel.heaven-performance-pending .talent-reading:not(.is-ready) .talent-balance b {
  width: 0;
  animation: none;
}

#heavenTrendPanel .heaven-typing::after,
#heavenFortunePanel .heaven-typing::after {
  content: "";
  width: 1px;
  height: 1em;
  display: inline-block;
  margin-left: 3px;
  background: currentColor;
  vertical-align: -0.12em;
  animation: heaven-caret 820ms steps(1) infinite;
}

#heavenFortunePanel.heaven-performance-pending #qiClimateKeyword,
#heavenFortunePanel.heaven-performance-pending .human-field-summary {
  opacity: 0;
  filter: blur(12px);
  transform: translateY(8px);
  transition: opacity 1.1s var(--ease-out), filter 1.1s var(--ease-out), transform 1.1s var(--ease-out);
}

#heavenFortunePanel.performance-climate-ready #qiClimateKeyword,
#heavenFortunePanel.performance-climate-ready .human-field-summary {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

#heavenFortunePanel.heaven-performance-pending .phase-balance-row,
#heavenFortunePanel.heaven-performance-pending .qi-framework-layer,
#heavenFortunePanel.heaven-performance-pending .human-field-grid > div,
#heavenFortunePanel.heaven-performance-pending .personal-fortune-panel {
  opacity: 0.18;
  transform: translateY(12px);
  transition: opacity 650ms var(--ease-out), transform 650ms var(--ease-out);
}

#heavenFortunePanel.heaven-performance-pending .phase-balance-row.is-ready,
#heavenFortunePanel.heaven-performance-pending .qi-framework-layer.is-ready,
#heavenFortunePanel.heaven-performance-pending .human-field-grid > div.is-ready,
#heavenFortunePanel.heaven-performance-pending .personal-fortune-panel.is-ready {
  opacity: 1;
  transform: translateY(0);
}

#heavenFortunePanel.heaven-performance-pending .phase-balance-row .phase-track span,
#heavenFortunePanel.heaven-performance-pending .qi-framework-layer:not(.is-ready) > div i {
  transform: scaleX(0);
  animation: none;
}

#heavenFortunePanel.heaven-performance-pending .phase-balance-row.is-ready .phase-track span,
#heavenFortunePanel.heaven-performance-pending .qi-framework-layer.is-ready > div i {
  transform: scaleX(1);
  transition: transform 760ms var(--ease-out);
}

.qi-use-panel {
  margin-top: 58px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--heaven-rule);
  opacity: 1;
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out);
}

.qi-use-panel > .workspace-heading {
  min-height: 58px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--heaven-rule);
}

.qi-use-panel > .workspace-heading > div > span {
  color: var(--heaven-cinnabar);
  font-family: var(--heaven-serif);
  font-size: 10px;
  letter-spacing: 0.28em;
}

.qi-use-panel > .workspace-heading h3 {
  margin: 5px 0 0;
  font-family: var(--heaven-serif);
  font-weight: 500;
}

#heavenFortunePanel.heaven-performance-pending .qi-use-panel {
  opacity: 0.15;
  transform: translateY(16px);
}

#heavenFortunePanel.performance-use-ready .qi-use-panel {
  opacity: 1;
  transform: translateY(0);
}

.qi-use-map {
  min-height: 360px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(420px, 1.8fr);
  gap: 150px;
  padding: 28px 0 4px;
}

.qi-use-sources,
.qi-sector-groups {
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 10px;
}

.qi-use-source {
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--heaven-rule);
  background: rgba(253, 252, 248, 0.76);
}

.qi-use-source.no-catalog {
  opacity: 0.4;
}

.qi-use-source > strong {
  font-family: var(--heaven-serif);
  font-size: 22px;
}

.qi-use-source span,
.qi-use-source b,
.qi-use-source small {
  display: block;
}

.qi-use-source b {
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  font-size: 12px;
}

.qi-use-source small {
  margin-top: 4px;
  color: var(--heaven-ink-faint);
  font-size: 10px;
}

.qi-use-connections {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}

.qi-use-connections path {
  fill: none;
  stroke-width: 1.2;
  opacity: 0.58;
}

.phase-stroke-wood { stroke: #4a7c59; }
.phase-stroke-fire { stroke: #b53a30; }
.phase-stroke-earth { stroke: #b08a3e; }
.phase-stroke-metal { stroke: #9c7c3c; }
.phase-stroke-water { stroke: #31505f; }

.qi-use-connections path.is-drawing {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.7s cubic-bezier(0.37, 0.01, 0.22, 1);
}

.qi-use-connections path.is-drawing.is-visible {
  stroke-dashoffset: 0;
}

.qi-use-connections path.is-flowing {
  stroke-dasharray: 0.045 0.055;
  animation: qi-flow-line 2.4s linear infinite;
}

.qi-sector-group {
  min-width: 0;
  border: 1px solid var(--heaven-rule);
  background: rgba(253, 252, 248, 0.86);
}

.qi-sector-group > summary {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  color: var(--heaven-ink-soft);
  font-family: var(--heaven-serif);
  cursor: pointer;
  list-style: none;
  transition: background 260ms var(--ease-out), color 260ms var(--ease-out);
}

.qi-sector-group > summary::-webkit-details-marker { display: none; }

.qi-sector-group > summary:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--heaven-ink);
}

.qi-sector-group > summary:focus-visible {
  outline: 2px solid var(--heaven-cinnabar);
  outline-offset: 2px;
}

.qi-sector-group-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.qi-sector-group-title > i {
  width: 20px;
  height: 2px;
  flex: 0 0 auto;
  display: block;
}

.qi-sector-group-title strong {
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.qi-sector-group-count {
  color: var(--heaven-ink-faint);
  font-size: 10px;
}

.qi-sector-chevron {
  width: 16px;
  height: 16px;
  transition: transform 420ms var(--ease-out);
}

.qi-sector-group[open] .qi-sector-chevron { transform: rotate(180deg); }

.qi-sector-fold {
  overflow: hidden;
  padding: 0 12px 13px;
  animation: qi-sector-unfold 480ms var(--ease-out) both;
}

@keyframes qi-sector-unfold {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .qi-sector-fold { animation: none; }
  .qi-sector-chevron { transition: none; }
}

.qi-sector-tags {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qi-sector-tags li {
  min-width: 0;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid var(--heaven-rule);
  border-left-width: 2px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--heaven-ink);
  font-family: var(--heaven-serif);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.qi-sector-tags li small {
  flex: 0 0 auto;
  padding: 1px 4px;
  border: 1px solid var(--heaven-rule-strong);
  color: var(--heaven-cinnabar);
  font-family: var(--font-sans);
  font-size: 8px;
}

.phase-border-wood { border-left-color: #4a7c59; }
.phase-border-fire { border-left-color: #b53a30; }
.phase-border-earth { border-left-color: #b08a3e; }
.phase-border-metal { border-left-color: #9c7c3c; }
.phase-border-water { border-left-color: #31505f; }

.qi-use-empty {
  color: var(--heaven-ink-faint);
  font-family: var(--heaven-serif);
}

@keyframes heaven-caret {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

@keyframes qi-flow-line {
  to { stroke-dashoffset: -0.2; }
}

@keyframes qi-word-focus {
  from { opacity: 0; filter: blur(12px); }
  to { opacity: 1; filter: blur(0); }
}

@keyframes ritual-curtain-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ritual-curtain-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes heart-ignite {
  from { opacity: 0; filter: blur(6px); transform: scale(0.2); }
  to { opacity: 1; filter: blur(0); transform: scale(1); }
}

@media (max-width: 900px) {
  #heavenView .heaven-toolbar,
  #heavenView .heaven-tabs,
  #heavenView .heaven-proverb,
  #heavenView .heaven-panel > :not(.heart-ritual-curtain) {
    width: min(100% - 28px, 1280px);
  }

  .qi-hero {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  #heavenFortunePanel .qi-climate-panel {
    min-height: 470px;
  }

  #heavenFortunePanel > .qi-framework-panel .qi-framework-layers,
  #heavenFortunePanel .qi-instincts-panel .human-field-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #heavenFortunePanel > .qi-framework-panel .qi-framework-layer,
  #heavenFortunePanel .qi-instincts-panel .human-field-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--heaven-rule);
  }

  #heavenFortunePanel .personal-fortune-result,
  #heavenFortunePanel .personal-primary-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #heavenFortunePanel .personal-primary-grid,
  #heavenFortunePanel .personal-day-master {
    border-right: 0;
  }

  #heavenFortunePanel .personal-preferences {
    border-top: 1px solid var(--heaven-rule);
    border-left: 0;
  }

  .qi-use-map {
    grid-template-columns: minmax(150px, 0.65fr) minmax(320px, 1.35fr);
    gap: 72px;
  }

  #heavenFortunePanel .personal-day-master,
  #heavenFortunePanel .personal-ten-gods,
  #heavenFortunePanel .personal-element-tendency,
  #heavenFortunePanel .personal-current-effect {
    border-bottom: 1px solid var(--heaven-rule);
  }
}

@media (max-width: 600px) {
  #heavenView .heaven-toolbar {
    min-height: 64px;
  }

  #heavenView .heaven-toolbar .section-subtitle {
    display: none;
  }

  #heavenView .heaven-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    padding: 0;
  }

  #heavenView .heaven-tab {
    width: 100%;
    min-width: 0;
  }

  #heavenFortunePanel .fortune-heading {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
  }

  #heavenFortunePanel .fortune-heading-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #heavenFortunePanel .fortune-heading-actions .qi-time-field {
    grid-column: 1 / -1;
  }

  #heavenFortunePanel .fortune-heading-actions .button {
    width: 100%;
    grid-column: auto;
  }

  #heavenFortunePanel .qi-time-field input {
    width: 100%;
  }

  #heavenFortunePanel .qi-climate-panel {
    min-height: 430px;
    padding: 18px;
  }

  #heavenFortunePanel .qi-climate-heading h3 {
    font-size: 38px;
  }

  #heavenFortunePanel .personal-preferences,
  .qi-sector-tags {
    grid-template-columns: minmax(0, 1fr);
  }

  #heavenFortunePanel .personal-preferences > section + section {
    border-top: 1px solid var(--heaven-rule);
    border-left: 0;
  }

  .qi-use-map {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .qi-use-connections {
    display: none;
  }

}

@media (max-width: 1180px) {
  .app-header {
    grid-template-columns: 220px 1fr;
  }

  .market-tape {
    grid-column: 1 / -1;
    grid-row: 2;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }

  .header-actions {
    justify-self: end;
  }

  .overview-strip {
    grid-template-columns: minmax(190px, 1.3fr) repeat(3, minmax(100px, 1fr));
  }

  .metric {
    border-top: 1px solid var(--line);
  }

  .metric-wide {
    display: flex;
    grid-column: span 2;
  }

  .regime-panel {
    grid-template-columns: 170px 1fr;
  }

  .regime-evidence,
  .factor-data-status {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 860px) {
  .app-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .header-actions,
  .market-tape {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
  }

  .header-actions {
    overflow-x: auto;
  }

  .date-input {
    min-width: 134px;
    flex: 1;
  }

  .module-nav {
    padding: 0 8px;
  }

  .app-main {
    padding: 10px 8px 18px;
  }

  .overview-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric-wide { grid-column: auto; }

  .sentiment-block {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .metric {
    padding: 10px;
  }

  .metric-value {
    font-size: 17px;
  }

  .section-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-field {
    min-width: 180px;
    flex: 1;
  }

  .search-field input {
    width: 100%;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .table-frame {
    max-height: 520px;
    border-right: 0;
  }

  .insight-rail {
    border-top: 1px solid var(--line);
  }

  .dragon-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .dragon-filterbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dragon-search-field {
    width: 100%;
  }

  .dragon-segments {
    width: 100%;
  }

  .dragon-filter {
    min-width: 0;
    flex: 1;
  }

  .trader-summary-row {
    grid-template-columns: 32px minmax(0, 1fr) 110px 18px;
    gap: 10px;
  }

  .trader-flow {
    display: none;
  }

  .unclassified-seat-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .unclassified-seat-name {
    grid-column: 1;
  }

  .unclassified-seat-stats {
    grid-column: 1;
    grid-row: 2;
  }

  .unclassified-seat-row > strong {
    grid-column: 2;
    grid-row: 1;
  }

  .unclassified-seat-row input {
    grid-column: 1;
    grid-row: 3;
  }

  .unclassified-seat-row .button {
    grid-column: 2;
    grid-row: 3;
  }

  .review-workspace {
    grid-template-columns: 1fr;
  }

  .workspace-section {
    border-right: 0;
  }

  .notes-history-section {
    grid-column: auto;
  }

  .note-row {
    grid-template-columns: 86px minmax(0, 1fr) auto;
  }

  .note-row .note-block:nth-of-type(2) {
    grid-column: 2 / -1;
  }

  .moneyflow-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .screener-layout {
    grid-template-columns: 1fr;
  }

  .mentor-layout {
    grid-template-columns: 1fr;
  }

  .mentor-sidebar {
    max-height: 260px;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mentor-list {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }

  .heaven-trend-layout,
  .fortune-body,
  .heart-casting-layout,
  .heart-reveal-layout {
    grid-template-columns: 1fr;
  }

  .hexagram-board,
  .five-phase-panel,
  .heart-hexagram-shell,
  .heart-reveal-board {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .fortune-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .human-field-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .qi-framework-layers {
    grid-template-columns: 1fr 1fr;
  }

  .qi-framework-layer:nth-child(2n) {
    border-right: 0;
  }

  .qi-framework-layer:nth-child(n+3) {
    border-top: 1px solid var(--line);
  }

  .human-field-grid > div:nth-child(2n) {
    border-right: 0;
  }

  .human-field-grid > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .personal-fortune-form {
    grid-template-columns: repeat(2, 1fr);
  }

  .account-birth-form {
    grid-template-columns: repeat(2, 1fr);
  }

  .personal-fortune-form .button {
    height: 40px;
  }

  .fortune-metric:nth-child(3) {
    border-right: 0;
  }

  .fortune-metric:nth-child(-n+3) {
    border-bottom: 1px solid var(--line);
  }

  .heart-line-texts {
    grid-template-columns: repeat(2, 1fr);
  }

  .heart-line-text:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .heart-line-text:nth-child(2n) {
    border-right: 0;
  }

  .strategy-sidebar {
    max-height: 240px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .strategy-list {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .regime-selector {
    grid-template-columns: repeat(3, 1fr);
  }

  .status-bar {
    grid-template-columns: 1fr auto;
  }

  .risk-note {
    display: none;
  }
}

@media (max-width: 520px) {
  .settings-dialog {
    right: 8px;
    left: 8px;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    margin: 8px 0;
    max-height: calc(100vh - 16px);
  }

  .dialog-header,
  .settings-section,
  .settings-dialog form {
    min-width: 0;
    padding-right: 12px;
    padding-left: 12px;
  }

  .settings-dialog .settings-section > form,
  .settings-dialog .membership-form,
  .settings-dialog.admin-dialog > form { padding: 0; }

  .settings-dialog .form-field,
  .settings-dialog .model-config-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .settings-dialog .connection-status,
  .settings-dialog .form-hint {
    overflow-wrap: anywhere;
  }

  .dialog-header {
    gap: 8px;
  }

  .model-test-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .model-test-status {
    width: 100%;
    white-space: normal;
  }

  .market-tape {
    gap: 12px;
    overflow-x: auto;
  }

  .overview-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-wide { grid-column: 1 / -1; }

  .segmented {
    width: 100%;
  }

  .chart-mode-toggle.segmented {
    width: auto;
  }

  .detail-section-heading {
    align-items: flex-start;
    gap: 8px;
  }

  .chart-heading-controls {
    flex-wrap: wrap;
  }

  .segment {
    min-width: 0;
    flex: 1;
  }

  .section-title-group {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .performance-cards {
    grid-template-columns: 1fr;
  }

  .performance-card {
    min-width: 0;
    overflow: hidden;
  }

  .performance-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px 22px;
  }

  .dragon-summary {
    grid-template-columns: 1fr 1fr;
  }

  .dragon-filterbar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .dragon-filter {
    padding: 0 6px;
    font-size: 12px;
  }

  .trader-summary-row {
    grid-template-columns: minmax(0, 1fr) 100px 16px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .trader-rank {
    display: none;
  }

  .trader-identity strong {
    font-size: 14px;
  }

  .trader-identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .trader-net strong {
    font-size: 12px;
  }

  .unclassified-heading,
  .unclassified-seat-row {
    padding-right: 10px;
    padding-left: 10px;
  }

  .stock-dialog {
    margin: 8px auto;
    max-height: calc(100vh - 16px);
  }

  .price-chart {
    height: 240px;
  }

  .note-row,
  .compact-notes .note-row {
    grid-template-columns: 1fr auto;
  }

  .note-row .note-block,
  .note-row .note-block:nth-of-type(2) {
    grid-column: 1 / -1;
  }

  .backfill-controls {
    grid-template-columns: 1fr;
  }

  .model-config-grid {
    grid-template-columns: 1fr;
  }

  .mentor-layout,
  .mentor-chat-panel {
    min-height: 580px;
  }

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

  .mentor-chat-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 11px 12px;
  }

  .mentor-model-status {
    max-width: 100%;
  }

  .mentor-messages {
    padding: 12px;
  }

  .mentor-message {
    max-width: 92%;
  }

  .mentor-quick-prompts,
  .mentor-chat-form {
    padding-right: 12px;
    padding-left: 12px;
  }

  .mentor-chat-form {
    grid-template-columns: 1fr;
  }

  .mentor-chat-form .button {
    width: 100%;
    height: 38px;
  }

  .mentor-disclaimer {
    padding-right: 12px;
    padding-left: 12px;
    text-align: left;
  }

  .heaven-tabs {
    gap: 0;
    padding: 0 8px;
  }

  .heaven-tab {
    min-width: 0;
    flex: 1;
  }

  .heaven-controls {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .heaven-controls > .button {
    width: 100%;
  }

  .sector-phase-form {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  .sector-phase-form .button {
    grid-column: 1 / -1;
  }

  .hexagram-board,
  .trend-reading-panel,
  .five-phase-panel,
  .phase-sector-panel,
  .heart-hexagram-shell,
  .heart-reveal-board {
    padding: 12px;
  }

  .hexagram-heading {
    align-items: flex-start;
  }

  .hexagram-heading h3 {
    font-size: 17px;
  }

  .hexagram-line-row {
    grid-template-columns: 34px 112px minmax(0, 1fr);
    gap: 6px;
    padding-right: 2px;
    padding-left: 2px;
  }

  .hex-line {
    width: 100px;
    gap: 11px;
  }

  .hex-line b {
    right: -17px;
  }

  .hexagram-line-detail small {
    white-space: normal;
  }

  .heaven-index-strip {
    grid-template-columns: 1fr;
  }

  .fortune-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .fortune-heading .button {
    width: 100%;
  }

  .fortune-heading-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .qi-time-field input {
    width: 100%;
  }

  .fortune-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .human-field-grid,
  .qi-framework-layers,
  .personal-fortune-form,
  .account-birth-form,
  .personal-pillars,
  .personal-summary-line,
  .personal-element-balance {
    grid-template-columns: 1fr;
  }

  .human-field-grid > div,
  .human-field-grid > div:nth-child(2n),
  .personal-pillars > div,
  .personal-summary-line > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .qi-framework-layer,
  .qi-framework-layer:nth-child(2),
  .qi-framework-layer:last-child {
    grid-column: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .qi-framework-layer:last-child {
    border-bottom: 0;
  }

  .human-field-grid > div:last-child,
  .personal-pillars > div:last-child,
  .personal-summary-line > div:last-child {
    border-bottom: 0;
  }

  .personal-fortune-panel,
  .human-field-panel,
  .qi-framework-panel {
    padding: 12px;
  }

  .qi-framework-panel .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .qi-framework-panel .workspace-heading > span {
    max-width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.5;
  }

  .remember-birth {
    white-space: normal;
  }

  .fortune-metric,
  .fortune-metric:nth-child(3) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .fortune-metric:nth-child(2n) {
    border-right: 0;
  }

  .heart-stage-inner {
    min-height: 520px;
  }

  .heart-casting-layout,
  .heart-reveal-layout {
    min-height: 520px;
  }

  .coin-result span {
    width: 54px;
    height: 54px;
  }

  .heart-line-texts {
    grid-template-columns: 1fr;
  }

  .heart-line-text,
  .heart-line-text:nth-child(2n),
  .heart-line-text:nth-child(3n) {
    border-right: 0;
  }

  .model-config-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .model-config-panel:last-child {
    border-bottom: 0;
  }

  .regime-panel {
    grid-template-columns: 1fr;
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .regime-summary,
  .regime-selector,
  .regime-evidence,
  .factor-data-status {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .strategy-meta-fields {
    grid-template-columns: 1fr;
  }

  .regime-selector {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .regime-option {
    min-width: 0;
  }

  .strategy-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .compiler-status {
    width: 100%;
  }
}

/* Heart fidelity completion: cinematic layers stay inside the module. */
#heavenHeartPanel {
  --ritual-bg: #151712;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #f7f5ef;
}

#heavenHeartPanel::before {
  content: "";
  position: absolute;
  inset: 8px 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 58% 60% at 50% 50%, rgba(17, 20, 16, 0.99) 0 62%, rgba(20, 22, 17, 0.94) 70%, rgba(28, 29, 23, 0.62) 79%, rgba(54, 52, 42, 0.18) 89%, transparent 100%),
    radial-gradient(ellipse 55% 58% at 50% 48%, #11140f 0 56%, rgba(17, 20, 15, 0.55) 76%, rgba(17, 20, 15, 0.12) 91%, transparent 100%);
  filter: blur(8px);
  pointer-events: none;
}

.heart-dust-canvas {
  width: 100%;
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.heart-lamp {
  width: min(680px, 82vw);
  aspect-ratio: 1;
  position: absolute;
  top: 46%;
  left: 50%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 237, 208, 0.13), rgba(201, 168, 106, 0.035) 38%, transparent 70%);
  opacity: 0.5;
  transform: translate(-50%, -50%);
  transition: opacity 1.6s ease, top 1.6s ease;
  pointer-events: none;
}

.heart-lamp[data-heart-stage="breathing"] { opacity: 0.95; top: 48%; }
.heart-lamp[data-heart-stage="casting"] { opacity: 0.7; top: 51%; }
.heart-lamp[data-heart-stage="reveal"] { opacity: 1; top: 43%; }
.heart-lamp[data-heart-stage="interpretation"] { opacity: 0.45; top: 35%; }

.heart-toolbar-controls {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 7px;
}

.heart-sound-toggle,
.heart-history-button {
  min-width: 76px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(232, 222, 199, 0.16);
  border-radius: 2px;
  background: rgba(7, 9, 8, 0.54);
  color: #8d877b;
  cursor: pointer;
  font-family: var(--heaven-serif);
  font-size: 11px;
  transition: border-color 240ms ease, color 240ms ease, background-color 240ms ease;
}

.heart-sound-toggle:hover,
.heart-sound-toggle:focus-visible,
.heart-sound-toggle[aria-pressed="true"] {
  border-color: rgba(201, 168, 106, 0.55);
  color: #d7c79f;
  outline: none;
}

.heart-sound-toggle .lucide { width: 15px; height: 15px; }

#heavenHeartPanel .heart-stage,
#heavenHeartPanel .heart-footnote {
  position: relative;
  z-index: 2;
}

#heavenHeartPanel .heart-stage {
  background-color: transparent;
}

.heart-ritual-curtain {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  place-content: center;
  background: radial-gradient(ellipse 60% 62% at 50% 50%, rgba(14, 17, 13, 0.97) 0 58%, rgba(21, 23, 18, 0.84) 73%, rgba(77, 72, 58, 0.26) 90%, transparent 100%);
  color: #eee7d8;
  opacity: 0;
  backdrop-filter: blur(9px);
}

.heart-ritual-curtain.is-visible {
  display: grid;
  animation: heart-ink-veil-in 1.25s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.heart-ritual-curtain.is-visible.is-leaving {
  animation: heart-local-curtain-out 1.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.heart-ritual-curtain > .heart-daybreak-dark {
  width: auto;
  height: auto;
  position: absolute;
  inset: 5%;
  z-index: 0;
  border: 0;
  border-radius: 0;
  background: radial-gradient(ellipse at center, rgba(5, 8, 6, 0.78) 0 28%, rgba(11, 14, 10, 0.36) 56%, transparent 78%);
  box-shadow: none;
  opacity: 0;
  filter: blur(24px);
  transform: scale(0.72);
  animation: heart-daybreak-in 3.2s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.heart-ritual-curtain > strong,
.heart-ritual-curtain > span {
  z-index: 1;
  opacity: 0;
  animation: heart-curtain-copy 1.6s ease 700ms forwards;
}

.heart-whispers {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.heart-whispers span {
  position: absolute;
  top: var(--whisper-y);
  left: var(--whisper-x);
  color: rgba(232, 222, 199, 0.46);
  font-family: var(--heaven-serif);
  font-size: 13px;
  line-height: 1.65;
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.72), 0 0 16px rgba(232, 222, 199, 0.12);
  writing-mode: vertical-rl;
  text-orientation: upright;
  white-space: nowrap;
  animation: heart-whisper var(--whisper-duration) ease-in-out var(--whisper-delay) infinite;
}

#heartIntro .heart-stage-inner {
  width: min(58%, 620px);
  position: relative;
  z-index: 1;
  margin-inline: auto;
}

#heavenHeartPanel .heart-stage.active-heart-stage {
  animation: heart-stage-arrive 1.7s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
  transition: opacity 1.05s cubic-bezier(0.4, 0, 0.2, 1), filter 1.05s cubic-bezier(0.4, 0, 0.2, 1), transform 1.05s cubic-bezier(0.4, 0, 0.2, 1);
}

#heavenHeartPanel .heart-stage.active-heart-stage.is-leaving {
  animation: none;
  opacity: 0;
  filter: blur(7px);
  transform: translateY(-8px);
}

.heart-rise {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(14px);
  transition: opacity 1.65s cubic-bezier(0.22, 0.61, 0.36, 1), filter 1.65s cubic-bezier(0.22, 0.61, 0.36, 1), transform 1.65s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.heart-rise.is-visible { opacity: 1; filter: blur(0); transform: translateY(0); }

.heart-incense {
  width: 2px;
  height: 270px;
  position: absolute;
  top: 50%;
  right: 7%;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(201, 168, 106, 0.05), rgba(201, 168, 106, 0.38));
  transform: translateY(-50%);
}

.heart-incense::after {
  content: "一炷香";
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  color: #5f5a51;
  font-family: var(--heaven-serif);
  font-size: 10px;
  letter-spacing: 0.22em;
  white-space: nowrap;
  transform: translateX(-50%);
}

.heart-incense i {
  width: 10px;
  height: 10px;
  position: absolute;
  top: 0;
  left: 50%;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd9a0 0, #e08840 45%, transparent 75%);
  box-shadow: 0 0 14px 4px rgba(255, 180, 90, 0.35);
}

.heart-incense i.is-burning { animation: heart-incense-burn 45s linear 1s forwards; }

#heavenHeartPanel #beginCastingButton {
  opacity: 0.35;
  transition: opacity 900ms ease, border-color 300ms ease, background-color 300ms ease;
}

#heavenHeartPanel #beginCastingButton.is-ready { opacity: 1; }

.heart-coins {
  min-height: 196px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 22px;
  padding-top: 84px;
  perspective: 900px;
}

.heart-coin {
  width: 86px;
  height: 86px;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
}

.heart-coin-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
}

.heart-coin-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 2px solid #c9a86a;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #d9bf7c, #8d6d31 56%, #3d2e18 100%);
  color: #332515;
  box-shadow: inset 0 0 0 5px rgba(48, 35, 18, 0.48), inset 0 0 18px rgba(255, 231, 160, 0.3), 0 8px 18px rgba(0, 0, 0, 0.25);
  backface-visibility: hidden;
  font-family: var(--heaven-serif);
  font-size: 20px;
  text-shadow: 0 1px rgba(255, 230, 162, 0.34);
}

.heart-coin-face::before {
  content: "";
  width: 18px;
  height: 18px;
  position: absolute;
  top: 50%;
  left: 50%;
  border: 2px solid rgba(46, 31, 14, 0.75);
  background: #14130f;
  transform: translate(-50%, -50%);
}

.heart-coin-face.front { padding-bottom: 52px; }
.heart-coin-face.back { transform: rotateY(180deg); }

.heart-coin-face.back::after {
  content: "";
}

.heart-coin.is-shaking .heart-coin-inner { animation: heart-coin-shake 120ms linear infinite; }

.heart-coin-ring {
  width: 108px;
  height: 34px;
  position: absolute;
  bottom: -17px;
  left: 50%;
  border: 1px solid rgba(201, 168, 106, 0.7);
  border-radius: 50%;
  opacity: 0;
  transform: translateX(-50%) scale(0.35);
  pointer-events: none;
}

.heart-coin-ring.is-bursting { animation: heart-coin-ring-burst 1s ease-out forwards; }
.heart-hold-charge { display: none; }

.heart-cast-button.is-holding {
  color: #f0d9a5;
  text-shadow: 0 0 18px rgba(201, 168, 106, 0.5);
}

#heavenHeartPanel .heart-yao-ghost i {
  opacity: 0.23;
  animation: heart-ghost-breathe 2.8s ease-in-out infinite;
}

#heavenHeartPanel .heart-hexagram-shell.is-complete { animation: heart-board-complete 2.2s ease-in-out both; }

#heartReveal .heart-reveal-line {
  opacity: 0.1;
  filter: blur(3px);
  transition: opacity 1s cubic-bezier(0.37, 0.01, 0.22, 1), filter 1s cubic-bezier(0.37, 0.01, 0.22, 1);
}

#heartReveal .heart-reveal-line.is-revealed { opacity: 1; filter: blur(0); }

#heartReveal .hexagram-heading h3,
#heartReveal .hexagram-change,
#heartReveal .hexagram-text {
  opacity: 0;
  filter: blur(10px);
  transition: opacity 1.5s cubic-bezier(0.37, 0.01, 0.22, 1), filter 1.5s cubic-bezier(0.37, 0.01, 0.22, 1);
}

#heartReveal.is-title-ready .hexagram-heading h3,
#heartReveal.is-title-ready .hexagram-change,
#heartReveal.is-title-ready .hexagram-text { opacity: 1; filter: blur(0); }

#heartReveal .heart-line-texts { opacity: 0; transition: opacity 1.2s ease; }
#heartReveal.is-sequence-ready .heart-line-texts { opacity: 1; }

#heavenHeartPanel .heart-line-text {
  appearance: none;
  display: block;
  border-top: 0;
  border-right: 1px solid var(--ritual-rule);
  border-bottom: 1px solid var(--ritual-rule);
  border-left: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  filter: blur(5px);
  opacity: 0.38;
  transition: filter 800ms ease, opacity 800ms ease, background-color 300ms ease;
}

#heavenHeartPanel .heart-line-text:hover,
#heavenHeartPanel .heart-line-text:focus-visible,
#heavenHeartPanel .heart-line-text.is-inspected {
  z-index: 2;
  background: rgba(255, 255, 255, 0.025);
  filter: blur(0);
  opacity: 1;
  outline: none;
}

#heartReveal .heart-first-thought p,
#heartReveal #interpretHeartButton { opacity: 0; transition: opacity 1s ease; }
#heartReveal.is-thought-typing #heartFirstThoughtPrompt { opacity: 1; }
#heartReveal.is-thought-ready .heart-first-thought p { opacity: 1; }
#heartReveal #interpretHeartButton.is-ready { opacity: 1; }

.heart-typing::after {
  content: "";
  width: 1px;
  height: 1em;
  display: inline-block;
  margin-left: 4px;
  background: currentColor;
  vertical-align: -0.12em;
  animation: heaven-caret 820ms steps(1) infinite;
}

#heartInterpretationStage {
  min-height: calc(100vh - 128px);
  padding: 6vh clamp(24px, 5vw, 74px) 48px;
  overflow: visible;
}

#heavenHeartPanel .heart-interpretation-heading {
  min-height: 76px;
  padding: 0 0 22px;
}

.heart-interpretation-heading > div {
  display: flex;
  align-items: baseline;
  gap: 24px;
}

.heart-interpretation-heading small {
  color: #c46056;
  font-family: var(--heaven-serif);
  opacity: 0;
  transition: opacity 1.4s ease;
}

.heart-read-guaci {
  margin: 18px 0 32px;
  color: #c9a86a;
  font-family: var(--heaven-serif);
  font-size: 14px;
  line-height: 1.9;
  opacity: 0;
  transition: opacity 1.5s ease;
}

.heart-read-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(420px, 1.2fr);
  gap: clamp(34px, 7vw, 110px);
  align-items: start;
}

.heart-read-lines {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 0;
}

.heart-read-line {
  display: grid;
  grid-template-columns: 42px minmax(170px, 230px);
  align-items: center;
  gap: 18px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 850ms cubic-bezier(0.37, 0.01, 0.22, 1), transform 850ms cubic-bezier(0.37, 0.01, 0.22, 1);
}

.heart-read-line > span {
  color: #6e695f;
  font-family: var(--heaven-serif);
  font-size: 12px;
}

.heart-read-line .hex-line { width: 100%; }

.heart-read-texts {
  display: flex;
  flex-direction: column-reverse;
}

.heart-read-text {
  min-height: 98px;
  padding: 20px 8px;
  border-bottom: 1px solid var(--ritual-rule);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 850ms cubic-bezier(0.37, 0.01, 0.22, 1), transform 850ms cubic-bezier(0.37, 0.01, 0.22, 1);
}

.heart-read-line.is-visible,
.heart-read-text.is-visible { opacity: 1; transform: translateY(0); }

.heart-read-text strong {
  color: #c9a86a;
  font-family: var(--heaven-serif);
  font-size: 13px;
}

.heart-read-text.moving strong { color: #c46056; }

.heart-read-text p {
  margin: 8px 0 0;
  color: #aaa394;
  font-family: var(--heaven-serif);
  font-size: 13px;
  line-height: 1.9;
}

#heartInterpretationStage.is-read-heading-ready .heart-interpretation-heading small,
#heartInterpretationStage.is-read-heading-ready .heart-read-guaci { opacity: 1; }

#heavenHeartPanel .heart-read-interpretation {
  min-height: 0;
  margin-top: 46px;
  padding: 30px 0;
  border-top: 1px solid var(--ritual-rule);
  border-bottom: 1px solid var(--ritual-rule);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}

#heartInterpretationStage.is-read-complete .heart-read-interpretation { opacity: 1; transform: translateY(0); }

.heart-read-motto {
  margin: 34px 0 0;
  color: #5f5a51;
  font-family: var(--heaven-serif);
  font-size: 12px;
  letter-spacing: 0.28em;
  opacity: 0;
  transition: opacity 1.2s ease 500ms;
}

#heartInterpretationStage.is-read-complete .heart-read-motto { opacity: 1; }

@keyframes heart-daybreak-in {
  0% { opacity: 0; filter: blur(28px); transform: scale(0.72); }
  34% { opacity: 0.45; }
  100% { opacity: 1; filter: blur(8px); transform: scale(1.08); }
}

@keyframes heart-ink-veil-in {
  from { opacity: 0; filter: blur(8px); }
  to { opacity: 1; filter: blur(0); }
}

@keyframes heart-local-curtain-out {
  from { opacity: 1; filter: blur(0); }
  to { opacity: 0; filter: blur(12px); }
}

@keyframes heart-curtain-copy {
  from { opacity: 0; filter: blur(7px); transform: translateY(8px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes heart-whisper {
  0%, 100% { opacity: 0.55; transform: translateY(0); }
  50% { opacity: 0.96; transform: translateY(-5px); }
}

@keyframes heart-stage-arrive {
  from { opacity: 0; filter: blur(8px); transform: translateY(12px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes heart-incense-burn { to { top: 100%; } }

@keyframes heart-coin-shake {
  0% { transform: rotateX(-5deg) rotateY(-7deg) translate(-1px, 1px); }
  50% { transform: rotateX(6deg) rotateY(8deg) translate(2px, -1px); }
  100% { transform: rotateX(-4deg) rotateY(-5deg) translate(-1px, 0); }
}

@keyframes heart-coin-ring-burst {
  0% { opacity: 0.85; transform: translateX(-50%) scale(0.35); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.45); }
}

@keyframes heart-ghost-breathe {
  0%, 100% { opacity: 0.1; filter: blur(1px); }
  50% { opacity: 0.3; filter: blur(0); }
}

@keyframes heart-board-complete {
  0%, 100% { box-shadow: inset 0 0 0 rgba(255, 237, 208, 0); }
  48% { box-shadow: inset 0 0 80px rgba(255, 237, 208, 0.08), 0 0 42px rgba(201, 168, 106, 0.08); }
}

@media (max-width: 900px) {
  .heart-incense { right: 24px; height: 210px; }
  .heart-read-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .heart-read-lines { position: static; }
}

@media (max-width: 600px) {
  .heart-sound-toggle { top: 8px; right: 8px; min-width: 44px; padding: 0 10px; }
  .heart-sound-toggle span { display: none; }
  #heartIntro .heart-stage-inner { width: calc(100% - 82px); }
  .heart-whispers span { font-size: 9px; line-height: 1.4; white-space: nowrap; }
  .heart-whispers span:nth-child(1) { left: 4% !important; top: 12% !important; }
  .heart-whispers span:nth-child(2) { left: 74% !important; top: 9% !important; }
  .heart-whispers span:nth-child(5) { left: 4% !important; top: 58% !important; }
  .heart-whispers span:nth-child(7) { left: 74% !important; top: 60% !important; }
  .heart-whispers span:nth-child(3),
  .heart-whispers span:nth-child(4),
  .heart-whispers span:nth-child(6) { display: none; }
  #heartIntro .heart-motto { font-size: 13px; white-space: nowrap; }
  .heart-incense { right: 14px; height: 160px; }
  .heart-incense::after { display: none; }
  .heart-coins { min-height: 160px; gap: 12px; padding-top: 66px; }
  .heart-coin { width: 64px; height: 64px; }
  .heart-coin-face { font-size: 15px; }
  .heart-coin-face::before { width: 14px; height: 14px; }
  .heart-coin-face.front { padding-bottom: 40px; }
  .heart-coin-ring { width: 82px; }
  #heartInterpretationStage { padding: 54px 18px 80px; }
  .heart-interpretation-heading > div { display: grid; gap: 5px; }
  .heart-read-line { grid-template-columns: 38px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .heart-whispers span,
  .heart-incense i,
  .heart-coin.is-shaking .heart-coin-inner,
  #heavenHeartPanel .heart-yao-ghost i { animation: none !important; }

  .heart-ritual-curtain.is-visible,
  .heart-ritual-curtain.is-visible.is-leaving,
  #heavenHeartPanel .heart-stage.active-heart-stage,
  .heart-rise {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }

  #heavenHeartPanel .heart-breath-ripple span {
    animation-name: heart-breath-ripple-soft !important;
  }

  #heavenHeartPanel .breathing-phase { transition: none !important; }
}

/* Shared paper mode: every heart stage uses the same surface as trend and fortune. */
#heavenHeartPanel {
  --ritual-bg: var(--heaven-paper);
  --ritual-surface: var(--heaven-paper-muted);
  --ritual-rule: var(--heaven-rule);
  --ritual-text: var(--heaven-ink);
  --ritual-muted: var(--heaven-ink-soft);
  background: var(--heaven-paper);
  color: var(--ritual-text);
}

#heavenHeartPanel::before { display: none; }

#heavenHeartPanel .heart-stage {
  background-color: var(--heaven-paper);
  background-image:
    linear-gradient(rgba(41, 40, 34, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 40, 34, 0.012) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px;
}

#heavenHeartPanel #heartIntro::before { color: rgba(36, 40, 32, 0.035); }
#heavenHeartPanel .heart-motto { color: #716047; }

#heavenHeartPanel .button {
  border-color: rgba(122, 74, 57, 0.52);
  color: var(--ritual-text);
}

#heavenHeartPanel .button:hover:not(:disabled) {
  border-color: #9a5b45;
  background: rgba(154, 91, 69, 0.07);
}

#heavenHeartPanel .button.primary {
  border-color: #9a5b45;
  background: #9a5b45;
  color: #ffffff;
}

#heavenHeartPanel .button:disabled {
  border-color: var(--ritual-rule);
  background: rgba(36, 40, 32, 0.035);
  color: #9a9d96;
}

#heavenHeartPanel .heart-sound-toggle {
  border-color: rgba(36, 40, 32, 0.18);
  background: rgba(253, 252, 248, 0.92);
  color: #62675f;
  box-shadow: 0 4px 18px rgba(36, 40, 32, 0.06);
}

#heavenHeartPanel .heart-sound-toggle:hover,
#heavenHeartPanel .heart-sound-toggle:focus-visible,
#heavenHeartPanel .heart-sound-toggle[aria-pressed="true"] {
  border-color: rgba(154, 91, 69, 0.58);
  color: #824a39;
}

#heavenHeartPanel .heart-lamp {
  background: radial-gradient(circle, rgba(194, 159, 90, 0.13), rgba(194, 159, 90, 0.045) 38%, transparent 70%);
}

#heavenHeartPanel .heart-ritual-curtain {
  background: var(--heaven-paper);
  color: #252821;
  backdrop-filter: blur(9px);
}

#heavenHeartPanel .heart-ritual-curtain > .heart-daybreak-dark {
  background: radial-gradient(ellipse at center, rgba(194, 159, 90, 0.1) 0 28%, rgba(154, 91, 69, 0.035) 56%, transparent 78%);
}

#heavenHeartPanel .heart-whispers span {
  color: rgba(88, 77, 62, 0.72);
  text-shadow: 0 0 8px rgba(253, 252, 248, 0.9), 0 0 16px rgba(194, 159, 90, 0.12);
}

#heavenHeartPanel .heart-incense {
  background: linear-gradient(180deg, rgba(157, 126, 71, 0.08), rgba(157, 126, 71, 0.42));
}

#heavenHeartPanel .heart-cast-button.is-holding {
  color: #7d5b32;
  text-shadow: 0 0 18px rgba(194, 159, 90, 0.34);
}

#heavenHeartPanel .heart-line-text:hover,
#heavenHeartPanel .heart-line-text:focus-visible,
#heavenHeartPanel .heart-line-text.is-inspected {
  background: rgba(36, 40, 32, 0.04);
}

#heavenHeartPanel .heaven-interpretation,
#heavenHeartPanel .heart-read-interpretation {
  color: #3f463e;
  background: var(--heaven-paper);
}

#heavenHeartPanel .heart-read-guaci {
  color: #73552d;
}

#heavenHeartPanel .heart-read-text strong {
  color: #76552c;
}

#heavenHeartPanel .heart-read-text p {
  color: #4f574e;
}

#heavenHeartPanel .heart-read-line > span {
  color: #596158;
}

#heavenHeartPanel .breathing-orbit strong,
#heavenHeartPanel .breathing-orbit span {
  text-shadow: none;
}

#heavenHeartPanel .breathing-progress {
  background: rgba(36, 40, 32, 0.1);
}

/* Breath pearl: a soft expanding field replaces the literal flame silhouette. */
#heavenHeartPanel .heart-breath-flame {
  --breath-scale: 1;
  width: 132px;
  height: 132px;
  top: 43%;
  border: 1px solid rgba(154, 91, 69, 0.24);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(154, 91, 69, 0.18) 0 7%, rgba(194, 159, 90, 0.1) 20%, rgba(194, 159, 90, 0.035) 44%, transparent 72%);
  filter: none;
  opacity: 0.82;
  transform: translate(-50%, -50%) scale(var(--breath-scale));
  transition: transform 3.8s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 3.8s cubic-bezier(0.22, 0.61, 0.36, 1), border-color 3.8s ease;
}

#heavenHeartPanel .heart-breath-flame::before {
  width: 192px;
  height: 192px;
  border: 1px solid rgba(194, 159, 90, 0.18);
  background: transparent;
  box-shadow: 0 0 34px rgba(194, 159, 90, 0.08);
  opacity: 0.8;
  transform: translate(-50%, -50%) scale(0.92);
  transition: transform 3.8s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 3.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#heavenHeartPanel .heart-breath-flame > i {
  width: 28px;
  height: 28px;
  top: 50%;
  border: 1px solid rgba(154, 91, 69, 0.32);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fffdf7 0 14%, #e7c98d 42%, #b87859 78%, rgba(184, 120, 89, 0.1) 100%);
  box-shadow: 0 0 22px rgba(194, 159, 90, 0.34);
  clip-path: none;
  transform: translate(-50%, -50%);
}

#heavenHeartPanel .breathing-scene[data-phase="inhale"] .heart-breath-flame {
  --breath-scale: 1.13;
  opacity: 1;
  border-color: rgba(154, 91, 69, 0.34);
}

#heavenHeartPanel .breathing-scene[data-phase="inhale"] .heart-breath-flame::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.05);
}

#heavenHeartPanel .breathing-scene[data-phase="exhale"] .heart-breath-flame {
  --breath-scale: 0.82;
  opacity: 0.58;
  border-color: rgba(121, 132, 122, 0.28);
}

#heavenHeartPanel .breathing-scene[data-phase="exhale"] .heart-breath-flame::before {
  opacity: 0.55;
  transform: translate(-50%, -50%) scale(0.82);
}

#heavenHeartPanel .breathing-scene[data-phase="settled"] .heart-breath-flame {
  --breath-scale: 0.96;
  opacity: 0.78;
}

/* One nine-second breath: gather, suspend, then release as concentric ripples. */
#heavenHeartPanel .heart-breath-ripple {
  width: 236px;
  height: 236px;
  position: absolute;
  top: 43%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
}

#heavenHeartPanel .heart-breath-ripple span {
  position: absolute;
  border: 1px solid rgba(126, 77, 52, 0.5);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(194, 159, 90, 0.06);
  opacity: 0.12;
  transform: scale(0.7);
  animation: heart-breath-ripple 9s cubic-bezier(0.37, 0.01, 0.22, 1) 1s infinite both;
  will-change: transform, opacity;
}

#heavenHeartPanel .heart-breath-ripple span:nth-child(1) {
  inset: 76px;
  border-color: rgba(126, 77, 52, 0.66);
}

#heavenHeartPanel .heart-breath-ripple span:nth-child(2) {
  inset: 45px;
  border-color: rgba(139, 112, 77, 0.38);
}

#heavenHeartPanel .heart-breath-ripple span:nth-child(3) {
  inset: 13px;
  border-color: rgba(91, 99, 91, 0.24);
}

#heavenHeartPanel .heart-breath-ripple > i {
  width: 14px;
  height: 14px;
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(126, 77, 52, 0.38);
  border-radius: 50%;
  background: rgba(253, 252, 248, 0.92);
  box-shadow: 0 0 0 6px rgba(194, 159, 90, 0.06), 0 0 20px rgba(154, 91, 69, 0.12);
  transform: translate(-50%, -50%);
  animation: heart-breath-ripple-core 9s ease-in-out 1s infinite both;
}

@keyframes heart-breath-ripple {
  0% { opacity: 0.12; transform: scale(0.7); }
  33.333% { opacity: 0.82; transform: scale(0.94); }
  55.556% { opacity: 0.82; transform: scale(0.94); }
  100% { opacity: 0.1; transform: scale(0.62); }
}

@keyframes heart-breath-ripple-core {
  0% { opacity: 0.38; box-shadow: 0 0 0 3px rgba(194, 159, 90, 0.04), 0 0 8px rgba(154, 91, 69, 0.06); transform: translate(-50%, -50%) scale(0.76); }
  33.333%, 55.556% { opacity: 1; box-shadow: 0 0 0 9px rgba(194, 159, 90, 0.09), 0 0 26px rgba(154, 91, 69, 0.18); transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0.3; box-shadow: 0 0 0 2px rgba(194, 159, 90, 0), 0 0 5px rgba(154, 91, 69, 0.03); transform: translate(-50%, -50%) scale(0.64); }
}

@keyframes heart-breath-ripple-soft {
  0% { opacity: 0.24; transform: scale(0.86); }
  33.333%, 55.556% { opacity: 0.68; transform: scale(0.94); }
  100% { opacity: 0.18; transform: scale(0.82); }
}

#heavenHeartPanel .breathing-phase {
  top: 43%;
  bottom: auto;
  z-index: 3;
  color: #76513d;
  font-family: var(--heaven-serif);
  font-size: 20px;
  font-weight: 500;
  transform: translateY(-50%);
  transition: color 480ms ease, opacity 480ms ease;
}

#heavenHeartPanel .breathing-scene[data-phase="prepare"] .breathing-phase {
  color: #858980;
  opacity: 0.62;
}

#heavenHeartPanel .breathing-scene[data-phase="hold"] .breathing-phase {
  color: #8a6b3e;
  opacity: 0.9;
}

#heavenHeartPanel .breathing-scene[data-phase="exhale"] .breathing-phase {
  color: #6f756e;
  opacity: 0.72;
}

#heavenHeartPanel .breathing-scene[data-phase="settled"] .breathing-phase {
  color: #76513d;
  opacity: 1;
}

/* Account identity and membership access states */
.account-menu-shell { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.account-menu-chevron { width: 13px !important; height: 13px !important; margin-left: 1px; transition: transform 180ms var(--ease-out); }
.account-menu-shell.is-open .account-menu-chevron { transform: rotate(180deg); }
.account-dropdown { position: absolute; top: calc(100% + 9px); right: 0; z-index: 90; width: 242px; display: grid; gap: 2px; padding: 7px; border: 1px solid var(--border); border-radius: 10px; background: rgba(255,255,255,.98); box-shadow: 0 16px 40px rgba(31, 42, 55, .16); transform-origin: top right; animation: account-menu-in 180ms var(--ease-out) both; }
.account-dropdown[hidden] { display: none; }
.account-dropdown-head { display: grid; gap: 2px; padding: 9px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 3px; }
.account-dropdown-head strong { color: var(--text-primary); font-size: 13px; overflow-wrap: anywhere; }
.account-dropdown-head span { color: var(--text-muted); font-size: 11px; }
.account-dropdown button { width: 100%; min-height: 40px; display: grid; grid-template-columns: 18px minmax(0,1fr) 16px; align-items: center; gap: 9px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--text-secondary); background: transparent; text-align: left; cursor: pointer; transition: color 160ms ease, background 160ms ease; }
.account-dropdown button:hover, .account-dropdown button:focus-visible { color: var(--text-primary); background: var(--surface-muted); outline: none; }
.account-dropdown button:focus-visible { box-shadow: inset 0 0 0 2px var(--focus-ring, #1268c4); }
.account-dropdown button svg { width: 16px; height: 16px; }
.account-dropdown button svg:last-child { width: 13px; height: 13px; color: var(--text-muted); }
.account-dropdown-separator { height: 1px; margin: 4px 5px; background: var(--border); }
.account-dropdown .account-menu-danger { color: #b53a42; grid-template-columns: 18px minmax(0,1fr); }
.account-dropdown .account-menu-danger:hover, .account-dropdown .account-menu-danger:focus-visible { color: #a32f37; background: #fff2f3; }
@keyframes account-menu-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.account-role-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.account-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 3px 8px 3px 6px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
}

button.account-role-badge { font-family: inherit; cursor: pointer; transition: filter 160ms ease, box-shadow 160ms ease; }
button.account-role-badge:hover { filter: brightness(.98); box-shadow: 0 3px 10px rgba(67, 76, 86, .14); }
button.account-role-badge:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.account-role-badge svg { width: 13px; height: 13px; }
.admin-role-badge { color: #53677c; background: #f4f7fa; }
.vip-role-badge { color: #9a6814; background: linear-gradient(135deg, #fff8e6, #f5e2ad); border-color: #c89b45; box-shadow: 0 2px 8px rgba(180, 132, 41, .18); }
.vip-role-badge.is-nonmember { color: #697580; background: #f4f6f8; border-color: #cbd3da; box-shadow: none; }
.vip-role-badge.is-nonmember b { background: #87939e; color: #fff; }
.vip-role-badge b { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #b88325; color: #fffaf0; font: 700 10px/1 Georgia, serif; box-shadow: inset 0 0 0 1px rgba(255,255,255,.58); }

.member-feature-view.member-locked { position: relative; }
.member-feature-view.member-locked > :not(.member-gate) { opacity: .42; filter: grayscale(.38); pointer-events: none; user-select: none; }
.member-gate { position: relative; z-index: 20; display: flex; align-items: center; gap: 14px; margin: 0 0 22px; padding: 16px 18px; border: 1px solid #ead9ac; border-radius: 14px; background: linear-gradient(135deg, #fffdf7, #fff8e9); box-shadow: 0 10px 24px rgba(147, 107, 31, .08); }
.member-gate-icon { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; color: #9b6a1d; background: #f7e8bb; }
.member-gate-icon svg { width: 20px; height: 20px; }
.member-gate > div:nth-child(2) { display: grid; gap: 3px; min-width: 0; flex: 1; }
.member-gate strong { color: #3c4650; font-size: 14px; }
.member-gate span { color: #7b6b4d; font-size: 12px; line-height: 1.5; }
.member-gate .button { flex: 0 0 auto; }

#settingsDialog[open] { display: flex; flex-direction: column; }
#settingsDialog > .dialog-header { order: 0; }
#settingsDialog > .connection-status { order: 1; }
#settingsDialog > .account-birth-section { order: 2; }
#settingsDialog > .membership-overview { order: 3; }
#settingsDialog > .password-section { order: 5; }
.privacy-note { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; color: #53677c; }
.privacy-note svg { flex: 0 0 15px; width: 15px; height: 15px; margin-top: 3px; color: #34745f; }
.membership-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 18px; }
.membership-status-grid > div { padding: 12px 13px; border: 1px solid var(--line, #e2e8ee); border-radius: 10px; background: #fbfcfd; }
.membership-status-grid span { display: block; color: #74808c; font-size: 11px; }
.membership-status-grid strong { display: block; margin-top: 5px; color: #26323d; font-size: 15px; font-variant-numeric: tabular-nums; }
.membership-comparison { overflow: hidden; border: 1px solid var(--line, #e2e8ee); border-radius: 10px; font-size: 12px; }
.membership-comparison > div { display: grid; grid-template-columns: minmax(0, 1.6fr) .7fr .7fr; gap: 8px; align-items: center; padding: 9px 11px; border-top: 1px solid var(--line, #e2e8ee); }
.membership-comparison > div:first-child { border-top: 0; }
.membership-comparison-head { color: #697683; background: #f7f9fb; font-weight: 700; }
.membership-comparison b { color: #276c58; font-weight: 600; }
.membership-comparison b.muted { color: #9aa4ad; }
.membership-comparison b.available { color: #9a6814; }
.membership-topup-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: #5d6974; font-size: 12px; }
.membership-topup-row > span { display: inline-flex; align-items: center; gap: 7px; }
.membership-topup-row svg { width: 15px; height: 15px; color: #9a6814; }
.password-form { display: grid; gap: 10px; }

.heaven-calibration-panel { margin: 24px 0 28px; padding: 20px 2px 18px; border-top: 1px solid var(--heaven-rule, #ded8cb); border-bottom: 1px solid var(--heaven-rule, #ded8cb); }
.heaven-calibration-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.heaven-calibration-heading h3 { margin: 4px 0 0; color: var(--heaven-ink, #36342f); font-size: 20px; letter-spacing: 0; }
.heaven-calibration-summary { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: #6e6a62; font-size: 11px; }
.heaven-calibration-summary > span { display: inline-flex; align-items: center; gap: 5px; }
.heaven-calibration-summary > strong { min-width: 92px; padding-left: 12px; border-left: 1px solid #ddd7ca; color: #4e4b45; font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.heaven-calibration-summary > strong.is-passed { color: #246b55; }
.heaven-calibration-summary > strong.is-failed { color: #a93630; }
.heaven-calibration-summary > strong.is-manual { color: #946515; }
.status-dot { width: 8px; height: 8px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: #92908a; box-shadow: 0 0 0 3px rgba(146,144,138,.12); }
.status-dot.passed { background: #2b7a60; box-shadow: 0 0 0 3px rgba(43,122,96,.12); }
.status-dot.failed { background: #bf4038; box-shadow: 0 0 0 3px rgba(191,64,56,.12); }
.status-dot.manual { background: #b37a18; box-shadow: 0 0 0 3px rgba(179,122,24,.14); }
.heaven-calibration-panel > p { margin: 8px 0 16px; color: #77736a; font-size: 12px; line-height: 1.6; }
.heaven-line-checks { border-top: 1px solid #ddd7ca; }
.heaven-line-check { border-bottom: 1px solid #e2ddd2; background: rgba(255,255,255,.34); }
.heaven-line-check.is-failed { background: rgba(191,64,56,.035); }
.heaven-line-check.is-manual { background: rgba(179,122,24,.04); }
.heaven-line-check > summary { min-height: 58px; display: grid; grid-template-columns: 94px minmax(0,1fr) 112px 18px; align-items: center; gap: 14px; padding: 8px 10px; color: #403e39; cursor: pointer; list-style: none; }
.heaven-line-check > summary::-webkit-details-marker { display: none; }
.heaven-line-check > summary > svg { width: 16px; height: 16px; color: #888279; transition: transform 180ms ease; }
.heaven-line-check[open] > summary > svg { transform: rotate(180deg); }
.heaven-check-state { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; }
.is-passed .heaven-check-state b { color: #246b55; }
.is-failed .heaven-check-state b { color: #a93630; }
.is-manual .heaven-check-state b { color: #946515; }
.heaven-check-name strong, .heaven-check-name small, .heaven-check-result b, .heaven-check-result small { display: block; }
.heaven-check-name strong { color: #35332f; font-size: 13px; }
.heaven-check-name small { margin-top: 3px; color: #817c73; font-size: 11px; }
.heaven-check-result { text-align: right; font-variant-numeric: tabular-nums; }
.heaven-check-result b { color: #4a4741; font-size: 12px; }
.heaven-check-result small { margin-top: 3px; color: #8a857c; font-size: 10px; }
.heaven-line-check-body { padding: 4px 10px 16px 118px; }
.heaven-check-reasons { margin: 0 0 12px; padding: 9px 12px 9px 28px; border-left: 2px solid #bf4038; color: #7f302b; background: rgba(191,64,56,.055); font-size: 12px; line-height: 1.65; }
.heaven-check-evidence { margin: 0 0 12px; color: #68645d; font-size: 12px; line-height: 1.6; }
.heaven-manual-fields { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px 12px; }
.heaven-manual-field { min-width: 0; display: grid; gap: 6px; color: #6d6961; font-size: 11px; }
.heaven-manual-field > span:first-child { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.heaven-manual-field small { color: #989188; font-size: 9px; font-weight: 400; }
.heaven-manual-field.is-manual small { color: #946515; }
.heaven-field-control { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; border: 1px solid #d7d0c3; border-radius: 5px; background: rgba(255,255,255,.86); transition: border-color 160ms ease, box-shadow 160ms ease; }
.heaven-field-control:focus-within { border-color: #877e6c; box-shadow: 0 0 0 3px rgba(135,126,108,.12); }
.heaven-field-control input, .heaven-field-control select { width: 100%; min-width: 0; height: 40px; padding: 0 9px; border: 0; outline: 0; color: #37342f; background: transparent; font-size: 12px; font-variant-numeric: tabular-nums; }
.heaven-field-control b { padding-right: 9px; color: #8b857b; font-size: 10px; font-weight: 500; }
.calibration-note-field { margin-top: 12px; }
.heaven-calibration-panel .dialog-actions { padding: 0; margin-top: 12px; }

@media (max-width: 720px) {
  .account-menu-shell { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr); }
  .account-menu-shell .account-button { min-width: 0; }
  .account-dropdown { top: calc(100% + 6px); right: 0; width: min(270px, calc(100vw - 28px)); }
  .account-role-badges { gap: 3px; }
  .account-role-badge { padding-inline: 5px; }
  .account-role-badge > span { display: none; }
  .membership-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heaven-calibration-heading { align-items: flex-start; flex-direction: column; }
  .heaven-calibration-summary { justify-content: flex-start; }
  .heaven-calibration-summary > strong { min-width: 0; text-align: left; }
  .heaven-line-check > summary { grid-template-columns: 82px minmax(0,1fr) 18px; gap: 9px; }
  .heaven-check-result { grid-column: 2; grid-row: 2; text-align: left; }
  .heaven-line-check > summary > svg { grid-column: 3; grid-row: 1 / span 2; }
  .heaven-line-check-body { padding-left: 10px; }
  .heaven-manual-fields { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .member-gate { align-items: flex-start; flex-wrap: wrap; }
  .member-gate .button { margin-left: 52px; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.global-search-button .lucide {
  width: 17px;
  height: 17px;
}

.global-search-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(680px, calc(100dvh - 64px));
  margin: 10vh auto auto;
  overflow: hidden;
  border-color: rgba(116, 132, 145, 0.38);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(26, 37, 47, 0.22), 0 3px 14px rgba(26, 37, 47, 0.1);
}

.global-search-dialog::backdrop {
  background: rgba(34, 44, 53, 0.42);
  backdrop-filter: blur(4px);
}

.global-search-shell {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr);
  max-height: min(680px, calc(100dvh - 64px));
}

.global-search-head {
  min-height: 62px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto 34px;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--line);
}

.global-search-head > .lucide {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.global-search-head input {
  min-width: 0;
  height: 60px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 17px;
}

.global-search-head input::-webkit-search-cancel-button {
  display: none;
}

.global-search-head kbd {
  padding: 4px 7px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--text-muted);
  background: var(--surface-muted);
  font: 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.global-search-results {
  min-height: 180px;
  max-height: min(560px, calc(100dvh - 128px));
  overflow-y: auto;
  padding: 8px;
  overscroll-behavior: contain;
}

.global-search-group + .global-search-group {
  margin-top: 6px;
}

.global-search-group-title {
  margin: 0;
  padding: 9px 10px 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
}

.global-search-result {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.global-search-result:hover,
.global-search-result.is-active {
  color: var(--blue-dark);
  background: rgba(8, 100, 135, 0.08);
}

.global-search-result:focus-visible {
  outline: 2px solid rgba(8, 100, 135, 0.38);
  outline-offset: -2px;
}

.global-search-result-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text-muted);
  background: var(--surface);
}

.global-search-result-icon .lucide {
  width: 16px;
  height: 16px;
}

.global-search-result-copy {
  min-width: 0;
}

.global-search-result-copy strong,
.global-search-result-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-result-copy strong {
  font-size: 13px;
}

.global-search-result-copy span {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.global-search-result-code {
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.global-search-empty {
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: var(--text-muted);
  text-align: center;
}

.global-search-empty .lucide {
  width: 22px;
  height: 22px;
}

.global-search-empty p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
}

.global-search-empty span {
  font-size: 11px;
}

.global-search-loading {
  min-height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--text-muted);
  font-size: 12px;
}

.entity-detail-dialog .detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.entity-detail-dialog .detail-grid div {
  min-width: 0;
}

.entity-detail-dialog .detail-grid dd {
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .global-search-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    margin: 8px auto;
  }

  .global-search-shell {
    max-height: calc(100dvh - 16px);
  }

  .global-search-head {
    min-height: 58px;
    grid-template-columns: 22px minmax(0, 1fr) 34px;
    padding-inline: 13px 9px;
  }

  .global-search-head input {
    height: 56px;
    font-size: 16px;
  }

  .global-search-head kbd {
    display: none;
  }

  .global-search-results {
    max-height: calc(100dvh - 74px);
  }

  .global-search-result {
    min-height: 58px;
  }

  .entity-detail-dialog .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-search-result {
    transition: none;
  }
}

.strategy-tracking-panel {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.tracking-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-muted);
}

.tracking-summary > div {
  min-width: 0;
  padding: 11px 16px;
  border-right: 1px solid var(--border);
}

.tracking-summary > div:last-child { border-right: 0; }
.tracking-summary span { display: block; color: var(--text-secondary); font-size: 11px; }
.tracking-summary strong { display: block; margin-top: 4px; font-size: 15px; font-variant-numeric: tabular-nums; }
.tracking-table-frame { border: 0; border-radius: 0; }
.tracking-table { min-width: 1080px; }
.tracking-strategy { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tracking-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.tracking-status.active { border-color: #c5d7ed; background: var(--action-soft); color: var(--action); }
.tracking-status.complete { border-color: #b9dfcf; background: var(--market-down-soft); color: var(--market-down); }

@media (max-width: 720px) {
  .tracking-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tracking-summary > div { border-bottom: 1px solid var(--border); }
  .tracking-summary > div:nth-child(2n) { border-right: 0; }
  .strategy-tracking-panel .section-toolbar { align-items: flex-start; }
}

.alert-button { position: relative; }

.alert-button.has-alerts {
  border-color: #d6b45d;
  background: #fff9e9;
  color: #8a6100;
}

.alert-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid var(--surface);
  border-radius: 9px;
  background: var(--market-up);
  color: #fff;
  font-size: 9px;
  font-weight: 750;
  line-height: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.alerts-dialog { width: min(760px, calc(100vw - 32px)); }
.alerts-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.alert-form { border-bottom: 1px solid var(--border); }
.alert-form-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(150px, 0.7fr) minmax(130px, 0.6fr); gap: 12px; }
.alert-list-section { padding-bottom: 18px; }
.alert-list { display: grid; border-top: 1px solid var(--border); }

.alert-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  min-height: 82px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.alert-item.is-unread { box-shadow: inset 3px 0 var(--action); }
.alert-item.is-read { opacity: 0.68; }
.alert-item.is-upcoming { background: var(--surface-muted); opacity: 1; }
.alert-item-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 6px; background: var(--action-soft); color: var(--action); }
.alert-item-icon .lucide { width: 18px; height: 18px; }
.alert-item-copy { min-width: 0; }
.alert-item-copy > div { display: flex; gap: 10px; color: var(--text-secondary); font-size: 10px; }
.alert-item-copy strong { display: block; margin-top: 5px; font-size: 13px; }
.alert-item-copy p { margin: 5px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.55; }
.alert-stock-link { margin-top: 6px; border: 0; background: transparent; color: var(--action); cursor: pointer; font-size: 11px; }
.alert-item-actions { display: flex; gap: 6px; }
.alert-item-actions .icon-button { width: 34px; height: 34px; }

@media (max-width: 720px) {
  .alerts-dialog { width: calc(100vw - 16px); margin: 8px auto; }
  .alert-form-grid { grid-template-columns: 1fr; }
  .alert-item { grid-template-columns: 32px minmax(0, 1fr); padding-inline: 13px; }
  .alert-item-icon { width: 32px; height: 32px; }
  .alert-item-actions { grid-column: 2; }
}

.trade-journal-section { grid-column: 1 / -1; padding: 0; }
.trade-journal-section > .workspace-heading { padding: 16px 16px 0; }
.trade-log-heading > div { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.trade-log-heading > div > span { color: var(--text-secondary); font-size: 11px; }
.trade-log-heading .button { flex: 0 0 auto; }
.trade-log-dialog { width: min(1020px, calc(100vw - 24px)); overflow-y: auto; }
.trade-log-dialog .trade-log-form { border: 0; }
.trade-log-form { padding: 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-muted); }
.trade-log-form-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.trade-tags-field { grid-column: span 2; }
.trade-log-text-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.trade-log-text-grid textarea { min-height: 82px; }

.trade-log-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.trade-log-summary > div { padding: 11px 16px; border-right: 1px solid var(--border); }
.trade-log-summary > div:last-child { border-right: 0; }
.trade-log-summary span { display: block; color: var(--text-secondary); font-size: 11px; }
.trade-log-summary strong { display: block; margin-top: 4px; font-size: 15px; font-variant-numeric: tabular-nums; }
.trade-log-table-frame { max-height: 520px; border: 0; border-radius: 0; }
.trade-log-table { min-width: 1380px; }
.trade-log-table td.number small { display: block; margin-top: 3px; font-size: 9px; }
.trade-copy { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.trade-row-actions { display: flex; gap: 4px; }

.trade-action,
.trade-emotion {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-muted);
  font-size: 10px;
  white-space: nowrap;
}

.trade-action-buy,
.trade-action-add { border-color: #efc5c8; background: var(--market-up-soft); color: var(--market-up); }
.trade-action-sell,
.trade-action-trim { border-color: #b9dfcf; background: var(--market-down-soft); color: var(--market-down); }
.trade-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.trade-tags em { padding: 2px 5px; border-radius: 3px; background: var(--action-soft); color: var(--action); font-size: 9px; font-style: normal; }

@media (max-width: 900px) {
  .trade-log-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trade-tags-field { grid-column: auto; }
}

@media (max-width: 720px) {
  .trade-log-dialog { width: calc(100vw - 16px); margin: 8px auto; }
  .trade-log-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trade-log-summary > div { border-bottom: 1px solid var(--border); }
  .trade-log-summary > div:nth-child(2n) { border-right: 0; }
  .trade-log-form-grid,
  .trade-log-text-grid { grid-template-columns: 1fr; }
}

.assistant-button.member-locked-control { color: var(--text-secondary); opacity: 0.72; }
.assistant-dialog { width: min(820px, calc(100vw - 32px)); max-height: min(860px, calc(100dvh - 32px)); }
.assistant-member-gate { margin: 14px 18px 0; }
.assistant-member-content { transition: opacity var(--motion-medium) ease, filter var(--motion-medium) ease; }
.assistant-dialog.member-locked .assistant-member-content {
  opacity: .42;
  filter: grayscale(.38);
  pointer-events: none;
  user-select: none;
}
.assistant-messages { min-height: 320px; max-height: min(540px, calc(100dvh - 340px)); overflow-y: auto; padding: 18px; background: var(--surface-muted); scroll-behavior: smooth; }
.assistant-message { max-width: 88%; margin-bottom: 14px; }
.assistant-message.user { margin-left: auto; }
.assistant-message-label { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; color: var(--text-secondary); font-size: 10px; }
.assistant-message.user .assistant-message-label { justify-content: flex-end; }

.assistant-message-content {
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.assistant-message.user .assistant-message-content { border-color: #bed2eb; background: var(--action-soft); }
.assistant-message.is-error .assistant-message-content { border-color: #efc5c8; background: var(--market-up-soft); color: #8b2f34; }
.assistant-message-content p { margin: 0 0 8px; }
.assistant-message-content p:last-child { margin-bottom: 0; }
.assistant-thinking { color: var(--text-secondary); }

.assistant-stream-caret {
  display: inline-block;
  width: 6px;
  height: 14px;
  margin: 0 0 -2px 3px;
  background: var(--action);
  animation: assistant-caret 900ms steps(1) infinite;
}

@keyframes assistant-caret { 50% { opacity: 0; } }

.assistant-quick-prompts { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface); }
.assistant-quick-prompts button { min-height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text-secondary); cursor: pointer; font: inherit; font-size: 11px; transition: border-color var(--motion-fast) ease, color var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.assistant-quick-prompts button:hover { border-color: var(--action); background: var(--action-soft); color: var(--action); }
.assistant-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; padding: 14px 18px; border-top: 1px solid var(--border); }
.assistant-form textarea { width: 100%; min-height: 76px; max-height: 180px; resize: vertical; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 4px; color: var(--text); font: inherit; line-height: 1.6; }
.assistant-form textarea:focus { border-color: var(--action); outline: 2px solid color-mix(in srgb, var(--action) 20%, transparent); outline-offset: 1px; }
.assistant-form-actions { display: flex; gap: 8px; }
.assistant-disclaimer { margin: 0; padding: 0 18px 14px; color: var(--text-secondary); font-size: 10px; }

@media (max-width: 720px) {
  .assistant-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); margin: 8px auto; }
  .assistant-member-gate { margin: 10px 13px 0; }
  .assistant-messages { min-height: 260px; max-height: calc(100dvh - 390px); padding: 13px; }
  .assistant-message { max-width: 96%; }
  .assistant-form { grid-template-columns: 1fr; }
  .assistant-form textarea { font-size: 16px; }
  .assistant-form-actions { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  .assistant-member-content { transition: none; }
  .assistant-stream-caret { animation: none; }
  .assistant-messages { scroll-behavior: auto; }
}

.heart-history-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(36, 40, 32, .18);
  border-radius: 2px;
  background: rgba(253, 252, 248, .92);
  color: #62675f;
  box-shadow: 0 4px 18px rgba(36, 40, 32, .06);
  cursor: pointer;
  font-family: var(--heaven-serif);
  font-size: 11px;
}
.heart-history-button:hover,
.heart-history-button:focus-visible { border-color: rgba(154, 91, 69, .58); color: #824a39; outline: none; }
.heart-history-button .lucide { width: 15px; height: 15px; }
.heart-read-actions { display: flex; gap: 8px; }

.heaven-reading-dialog {
  width: min(920px, calc(100vw - 32px));
  height: min(820px, calc(100dvh - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  background: #fdfcf8;
}
.heaven-reading-dialog[open] { display: grid; }
.heaven-reading-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}
.heaven-reading-tabs button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.heaven-reading-tabs button.active { border-bottom-color: #9a5b45; color: #6f3f31; font-weight: 700; }
.heaven-reading-tabs button:focus-visible { outline: 2px solid #9a5b45; outline-offset: 1px; }
.heaven-reading-current {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 24px 28px 30px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.heaven-reading-current::-webkit-scrollbar,
.heaven-reading-history-detail::-webkit-scrollbar,
.heaven-reading-history-list-wrap::-webkit-scrollbar { width: 9px; }
.heaven-reading-current::-webkit-scrollbar-thumb,
.heaven-reading-history-detail::-webkit-scrollbar-thumb,
.heaven-reading-history-list-wrap::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(112, 94, 72, .34);
  background-clip: padding-box;
}
.heaven-reading-loading {
  width: 100%;
  height: 100%;
  min-height: 360px;
  position: relative;
  overflow: hidden;
  background: #fdfcf8;
}
.heaven-reading-loading[hidden] { display: none; }
.heaven-reading-loading canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.heaven-reading-result > header,
.heaven-reading-history-detail > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.heaven-reading-result > header span,
.heaven-reading-history-detail > header span { color: #9a5b45; font-family: var(--heaven-serif); font-size: 12px; font-weight: 700; }
.heaven-reading-result h3,
.heaven-reading-history-detail h3 { margin: 5px 0 0; color: #2d332e; font-family: var(--heaven-serif); font-size: 22px; font-weight: 600; letter-spacing: 0; }
.heaven-reading-result time,
.heaven-reading-history-detail time { color: var(--text-secondary); font-size: 11px; white-space: nowrap; }
.heaven-reading-result > p,
.heaven-reading-history-detail > p { margin: 12px 0 0; color: var(--text-secondary); font-size: 12px; }
.heaven-reading-answer { margin-top: 24px; color: #303833; font-family: var(--heaven-serif); font-size: 15px; line-height: 1.95; }
.heaven-reading-answer .mentor-answer-heading { color: #713f31; }
.heaven-reading-history { min-height: 0; max-height: none; display: grid; grid-template-columns: 270px minmax(0, 1fr); overflow: hidden; }
.heaven-reading-history[hidden] { display: none; }
.heaven-reading-history-list-wrap { min-width: 0; overflow-y: auto; border-right: 1px solid var(--border); background: rgba(246, 244, 237, .72); }
.heaven-reading-history-heading { display: flex; justify-content: space-between; gap: 10px; padding: 15px 16px 10px; color: var(--text-secondary); font-size: 11px; }
.heaven-reading-history-heading strong { color: var(--text); font-size: 13px; }
.heaven-reading-history-list { display: grid; }
.heaven-reading-history-item { display: grid; gap: 4px; width: 100%; padding: 13px 16px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.heaven-reading-history-item:hover,
.heaven-reading-history-item.active { background: #fff; box-shadow: inset 3px 0 #9a5b45; }
.heaven-reading-history-item:focus-visible { outline: 2px solid #9a5b45; outline-offset: -2px; }
.heaven-reading-history-item span { overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.heaven-reading-history-item small,
.heaven-reading-history-item time { overflow: hidden; color: var(--text-secondary); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.heaven-reading-history-detail { min-width: 0; overflow-y: auto; padding: 24px 28px; }
.heaven-reading-history-detail footer { display: flex; justify-content: flex-end; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border); }

@media (max-width: 720px) {
  .heart-toolbar-controls { top: 8px; right: 8px; gap: 6px; }
  .heart-toolbar-controls .heart-sound-toggle,
  .heart-toolbar-controls .heart-history-button { width: 36px; min-width: 36px; min-height: 36px; padding: 0; }
  .heart-toolbar-controls span { display: none; }
  .heart-read-actions { flex-wrap: wrap; justify-content: flex-end; }
  .heaven-reading-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); margin: 8px auto; }
  .heaven-reading-current { min-height: 0; max-height: none; padding: 20px 17px 24px; }
  .heaven-reading-history { min-height: 0; max-height: none; grid-template-columns: 1fr; overflow-y: auto; }
  .heaven-reading-history-list-wrap { max-height: 210px; border-right: 0; border-bottom: 1px solid var(--border); }
  .heaven-reading-history-detail { overflow: visible; padding: 20px 17px 24px; }
  .heaven-reading-result > header,
  .heaven-reading-history-detail > header { display: grid; }
}

@media (max-height: 520px) {
  .heaven-reading-loading { min-height: 260px; }
}

/* Mentor directory: dense evidence-aware navigation for larger skill libraries. */
.mentor-layout {
  height: clamp(620px, calc(100dvh - 198px), 760px);
  min-height: 620px;
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: hidden;
}

.mentor-sidebar {
  min-height: 0;
  position: relative;
  padding: 0;
  overflow: hidden;
}

.mentor-directory-toggle,
.mentor-directory-close,
.mentor-directory-backdrop {
  display: none;
}

.mentor-directory-content {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px 12px 10px;
}

.mentor-directory-heading {
  min-height: 34px;
  padding: 0 2px;
}

.mentor-directory-heading > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.mentor-directory-heading h3 {
  margin: 0;
  font-size: 14px;
}

.mentor-directory-heading span {
  color: var(--text-muted);
  font-size: 11px;
}

.mentor-directory-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mentor-sort-toggle {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
}

.mentor-sort-toggle:hover,
.mentor-sort-toggle.active {
  border-color: color-mix(in srgb, var(--action) 38%, var(--border));
  background: var(--action-soft);
  color: var(--action);
}

.mentor-sort-toggle .lucide {
  width: 13px;
  height: 13px;
}

.mentor-search-field {
  height: 40px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-muted);
}

.mentor-search-field:focus-within {
  border-color: var(--action);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--action) 14%, transparent);
}

.mentor-search-field .lucide {
  width: 16px;
  height: 16px;
}

.mentor-search-field input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.mentor-evidence-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.mentor-evidence-filters button {
  min-width: 0;
  min-height: 30px;
  padding: 0 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  white-space: nowrap;
}

.mentor-evidence-filters button:hover,
.mentor-evidence-filters button.active {
  background: var(--action-soft);
  color: var(--action);
}

.mentor-evidence-filters button:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: 1px;
}

.mentor-sort-hint {
  margin: 0;
  padding: 0 3px;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.4;
}

.mentor-list {
  min-height: 0;
  display: grid;
  align-content: start;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding-right: 3px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.mentor-option {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 5px 0 0;
  border: 1px solid transparent;
  border-bottom-color: var(--border);
  border-radius: 4px;
  background: transparent;
  transition: border-color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}

.mentor-option-main {
  min-width: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 5px 8px 9px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.mentor-option-main:disabled {
  cursor: default;
}

.mentor-option .mentor-option-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  overflow: visible;
  color: inherit;
  font-size: inherit;
  line-height: normal;
  white-space: normal;
}

.mentor-pin-button,
.mentor-order-button {
  width: 28px;
  min-width: 28px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.mentor-pin-button:hover,
.mentor-order-button:hover:not(:disabled) {
  background: var(--surface-muted);
  color: var(--text);
}

.mentor-pin-button.active {
  background: #fff7df;
  color: #9a6815;
}

.mentor-pin-button.active .lucide {
  fill: currentColor;
}

.mentor-pin-button .lucide,
.mentor-order-button .lucide {
  width: 14px;
  height: 14px;
}

.mentor-order-button:disabled {
  color: color-mix(in srgb, var(--text-muted) 35%, transparent);
  cursor: default;
}

.mentor-list.is-sorting .mentor-option {
  cursor: grab;
}

.mentor-list.is-sorting .mentor-option-badges {
  display: none;
}

.mentor-option.is-dragging {
  opacity: 0.45;
}

.mentor-option.is-drag-over {
  border-color: var(--action);
  background: var(--action-soft);
}

.mentor-option:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.mentor-option.active {
  border-color: color-mix(in srgb, var(--action) 42%, var(--border));
  background: var(--action-soft);
  box-shadow: inset 3px 0 var(--action);
}

.mentor-option:focus-visible {
  outline: 2px solid var(--action);
  outline-offset: -2px;
}

.mentor-option-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.mentor-option .mentor-option-copy {
  display: grid;
  margin: 0;
  overflow: visible;
  color: inherit;
  font-size: inherit;
  line-height: normal;
  white-space: normal;
}

.mentor-option-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mentor-option-copy em {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mentor-option-badges,
.mentor-active-badges {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
}

.mentor-option .mentor-option-badges {
  display: flex;
  margin: 0;
  overflow: visible;
  color: inherit;
  font-size: inherit;
  line-height: normal;
  white-space: normal;
}

.mentor-option-badges {
  max-width: 76px;
}

.mentor-badge {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.mentor-option .mentor-badge {
  display: inline-flex;
  margin: 0;
  overflow: visible;
  line-height: 1;
}

.mentor-badge .lucide {
  width: 11px;
  height: 11px;
}

.mentor-badge.grade-a { border-color: #a9c9b9; background: #eef7f1; color: #2f6a50; }
.mentor-badge.grade-b { border-color: #b3c8db; background: #eff5fa; color: #315f83; }
.mentor-badge.grade-c { border-color: #d9c49c; background: #faf5e9; color: #805d24; }
.mentor-badge.private { border-color: #d7c28e; background: #fff8e5; color: #7a5d16; }
.mentor-badge.quality { background: var(--surface-muted); color: var(--text-muted); }
.mentor-badge.quality.conditional { border-style: dashed; color: #805d24; }

.mentor-list-empty {
  padding: 28px 12px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.mentor-evidence-legend {
  margin: 0;
  padding: 7px 3px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1.55;
}

.mentor-chat-panel {
  min-height: 0;
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
}

.mentor-chat-header {
  min-height: 96px;
  padding: 12px 18px;
}

.mentor-active-profile {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.mentor-active-title {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mentor-active-title h3 {
  margin: 0;
}

.mentor-active-profile > p {
  max-width: 760px;
  margin: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mentor-active-focus {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mentor-active-focus span {
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 9px;
}

.mentor-messages {
  max-height: none;
}

.mentor-message {
  margin-bottom: 12px;
}

.mentor-message-content {
  line-height: 1.62;
  white-space: normal;
}

.mentor-message .mentor-answer-paragraph {
  margin: 0 0 6px;
  line-height: inherit;
}

.mentor-message .mentor-answer-paragraph:last-child {
  margin-bottom: 0;
}

.mentor-answer-heading {
  display: block;
  margin: 9px 0 4px;
  line-height: 1.45;
}

.mentor-message-content > .mentor-answer-heading:first-child {
  margin-top: 0;
}

.mentor-answer-list {
  margin: 3px 0 7px;
  padding-left: 20px;
}

.mentor-answer-list li + li {
  margin-top: 3px;
}

.mentor-message.is-error {
  border-color: var(--danger);
}

@media (min-width: 721px) and (max-width: 1023px) {
  .mentor-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

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

  .mentor-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .mentor-layout {
    height: auto;
    min-height: 580px;
    grid-template-columns: minmax(0, 1fr);
    overflow: visible;
  }

  .mentor-sidebar {
    height: 56px;
    min-height: 56px;
    max-height: none;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }

  .mentor-directory-toggle {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    border: 0;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-align: left;
  }

  .mentor-directory-toggle > span {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mentor-directory-toggle > span > span {
    min-width: 0;
    display: grid;
    gap: 2px;
  }

  .mentor-directory-toggle small {
    color: var(--text-muted);
    font-size: 9px;
  }

  .mentor-directory-toggle strong {
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mentor-directory-toggle > .lucide {
    transition: transform var(--motion-medium) var(--ease-out);
  }

  .mentor-sidebar.is-open .mentor-directory-toggle > .lucide {
    transform: rotate(180deg);
  }

  .mentor-directory-backdrop {
    position: fixed;
    inset: 0;
    z-index: 79;
    display: block;
    background: rgba(20, 27, 33, 0.48);
  }

  .mentor-directory-content {
    height: auto;
    position: fixed;
    inset: 66px 8px 72px;
    z-index: 80;
    padding: 14px 12px 10px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: var(--surface-muted);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity var(--motion-medium) ease, transform var(--motion-medium) var(--ease-out);
  }

  .mentor-sidebar.is-open .mentor-directory-content {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .mentor-directory-close {
    width: 44px;
    min-height: 44px;
    display: grid;
  }

  .mentor-sort-toggle {
    min-height: 44px;
    padding: 0 10px;
    font-size: 11px;
  }

  .mentor-search-field {
    height: 44px;
  }

  .mentor-search-field input {
    height: 42px;
    font-size: 16px;
  }

  .mentor-evidence-filters button {
    min-height: 44px;
    font-size: 11px;
  }

  .mentor-option {
    min-height: 68px;
  }

  .mentor-pin-button,
  .mentor-order-button {
    width: 40px;
    min-width: 40px;
    height: 44px;
  }

  .mentor-chat-panel {
    min-height: 580px;
  }

  .mentor-chat-header {
    min-height: 104px;
    padding: 11px 12px;
  }

  .mentor-active-profile > p {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mentor-directory-content,
  .mentor-directory-toggle > .lucide,
  .mentor-option {
    transition: none;
  }
}

/* Auction and screener page-level visual system */
#auctionView,
#screenerView {
  --action: #2563eb;
  --action-hover: #1d4ed8;
  --action-soft: #eff4ff;
  --border: #e5e7eb;
  --border-strong: #d5dae1;
  --line: var(--border);
  --line-strong: var(--border-strong);
  --surface-muted: #f8fafc;
  border-color: var(--border);
  border-radius: 8px;
  background: #f4f5f7;
  color: #1f2937;
}

#auctionView .section-toolbar h2,
#screenerView .section-toolbar h2 {
  font-size: 17px;
  font-weight: 800;
}

/* Collection auction */
.auction-page-header {
  min-height: 76px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 0;
  background: #f4f5f7;
}

.auction-heading-block,
.auction-header-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auction-heading-block { flex-wrap: wrap; }
.auction-header-actions { margin-left: auto; }

.auction-phase-notice {
  min-height: 28px;
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 0;
  border-radius: 6px;
  background: #f3f4f6;
}

.auction-phase-notice strong,
.auction-phase-notice span:not(.auction-phase-marker),
.auction-phase-notice time {
  font-size: 11px;
  line-height: 1.4;
}

.auction-phase-notice strong { color: inherit; }
.auction-phase-notice time { font-weight: 650; }
.auction-phase-notice[data-phase="observing"] { background: var(--amber-soft); color: #8a5e0a; }
.auction-phase-notice[data-phase="selection"] { background: var(--market-up-soft); color: var(--market-up); }
.auction-phase-notice[data-phase="finalized"] { background: var(--market-down-soft); color: var(--market-down); }
.auction-phase-notice[data-phase="archive"] { background: #eef2f6; color: #596574; }

.auction-phase-marker {
  width: 7px;
  height: 7px;
  box-shadow: none;
}

.auction-header-summary {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 22px;
  border: 0;
  background: transparent;
}

.auction-header-summary > div {
  min-height: 0;
  align-items: flex-end;
  gap: 2px;
  padding: 0;
  border: 0;
}

.auction-header-summary span { font-size: 11px; }
.auction-header-summary strong { font-size: 16px; font-weight: 800; }

.auction-workspace-layout {
  min-height: 620px;
  grid-template-columns: minmax(0, 1fr) 360px;
  margin: 0 14px 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

.auction-dataset-bar {
  padding: 0 14px;
  background: var(--surface);
}

.auction-dataset-segments {
  width: 100%;
  height: 42px;
  overflow: visible;
  border: 0;
  border-radius: 0;
}

.auction-dataset-segments .segment {
  min-width: 0;
  flex: 0 1 auto;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 550;
}

.auction-dataset-segments .segment.active {
  border-bottom-color: var(--action);
  background: transparent;
  color: var(--action);
  font-weight: 700;
}

.auction-dataset-segments strong {
  margin-left: 3px;
  color: #9ca3af;
  font-weight: 500;
}

.auction-dataset-segments .segment.active strong { color: var(--action); }

.auction-expectation-filterbar {
  min-height: 52px;
  padding: 8px 14px;
  background: #fff;
}

.auction-expectation-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auction-expectation-controls > span { color: #9ca3af; font-size: 12px; }
.auction-expectation-controls[hidden] { display: none; }

.auction-expectation-segments {
  height: 32px;
  gap: 2px;
  padding: 2px;
  overflow: visible;
  border: 0;
  border-radius: 8px;
  background: #f3f4f6;
}

.auction-expectation-segments .segment {
  min-width: 58px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
}

.auction-expectation-segments .segment.active {
  background: #fff;
  color: #1f2937;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  font-weight: 700;
}

.auction-expectation-filterbar .search-field { margin-left: auto; }
.auction-expectation-filterbar .search-field input {
  width: min(250px, 25vw);
  height: 34px;
  border-color: var(--border);
  border-radius: 7px;
  background: #fff;
  font-size: 12px;
}

.auction-unified-table-frame {
  min-height: 470px;
  max-height: calc(100vh - 286px);
}

.auction-table {
  min-width: 860px;
  font-size: 12.5px;
}

.auction-table th,
.auction-table td {
  height: 44px;
  padding-right: 12px;
  padding-left: 12px;
  border-right: 0;
  border-bottom-color: #eef0f3;
}

.auction-table th {
  height: 38px;
  background: #f8fafc;
  color: #6b7280;
  font-size: 12px;
}

.auction-table tbody tr:hover td { background: #f8faff; }
.auction-stock-cell { grid-template-columns: minmax(0, 1fr); min-width: 112px; }
.auction-stock-cell > b { display: none; }
.auction-stock-cell strong { font-size: 13px; font-weight: 750; }
.auction-stock-cell small { margin-left: 6px; font-size: 10.5px; }
.auction-stock-cell > span { display: flex; align-items: baseline; gap: 0; }
.auction-context-cell strong { font-size: 12px; }
.auction-volume-ratio { color: #6b7280; }

.auction-evidence-rail {
  border-left-color: var(--border);
  background: #f4f5f7;
}

.auction-evidence-section {
  padding: 12px 14px;
  border-bottom-color: var(--border);
}

.auction-evidence-section .auction-insight-heading h3 { font-size: 14px; font-weight: 750; }
.auction-evidence-section .auction-theme-row { min-height: 43px; border-bottom-style: dashed; }
.auction-evidence-section .auction-theme-row > div:first-child strong { font-size: 13px; }
.auction-evidence-section .auction-amount-trend { height: 128px; position: relative; }
.auction-amount-day > span { background: #c9d6ee; }
.auction-amount-average {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 2;
  border-top: 1.5px dashed #d97706;
  pointer-events: none;
}
.auction-amount-average small {
  position: absolute;
  top: -16px;
  right: 0;
  padding-left: 4px;
  background: #fff;
  color: #b45309;
  font-size: 10px;
}

.auction-news-entry { min-height: 88px; background: #fff; }

/* Smart screener */
.screener-page-heading {
  min-height: 58px;
  border-bottom: 0;
  background: #f4f5f7;
}

#screenerView .screener-strategy-view { padding: 0 14px 14px; }

.screener-stepper {
  min-height: 60px;
  display: flex;
  align-items: center;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

.screener-step {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.screener-step > div { min-width: 0; }
.screener-step strong,
.screener-step small { display: block; white-space: nowrap; }
.screener-step strong { font-size: 13px; }
.screener-step small { margin-top: 2px; overflow: hidden; color: #9ca3af; font-size: 11px; text-overflow: ellipsis; }

.step-marker {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 750;
}

.screener-step[data-state="complete"] .step-marker {
  background: #16a34a;
  color: transparent;
  font-size: 0;
}

.screener-step[data-state="complete"] .step-marker::after { content: "\2713"; color: #fff; font-size: 12px; }
.screener-step[data-state="current"] .step-marker { background: var(--action); color: #fff; }
.screener-step[data-state="current"] small { color: var(--action); }

.step-line {
  height: 2px;
  min-width: 30px;
  flex: 1;
  margin: 0 14px;
  background: #e5e7eb;
}
.step-line.complete { background: #b9dec9; }

.screener-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.screener-overview-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}

.screener-card-heading {
  min-height: 43px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid #eef0f3;
}
.screener-card-heading h3 { margin: 0; font-size: 14px; }
.screener-soft-label { padding: 3px 7px; border-radius: 5px; background: #f3f4f6; color: #6b7280; font-size: 10.5px; }

.screener-regime-body {
  min-height: 90px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px 14px 8px;
}

#screenerView .regime-summary {
  min-height: 66px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid #f3c7c3;
  border-radius: 9px;
  background: var(--market-up-soft);
  text-align: center;
}
#screenerView .regime-summary strong { color: var(--market-up); font-size: 19px; font-weight: 800; }
#screenerView .regime-summary span { color: #6b7280; font-size: 11px; }

#screenerView .regime-evidence {
  min-width: 0;
  gap: 4px;
  padding: 0;
  border: 0;
}
#screenerView .regime-evidence strong { font-size: 12.5px; }
#screenerView .regime-evidence div { max-height: 40px; overflow: hidden; color: #6b7280; font-size: 11.5px; line-height: 1.65; }

#screenerView .regime-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 4px 14px 10px;
  border: 0;
}
#screenerView .regime-option {
  width: auto;
  height: 28px;
  padding: 0 11px;
  border-color: var(--border);
  border-radius: 6px;
  color: #6b7280;
  font-size: 11.5px;
}
#screenerView .regime-option.active { border-color: var(--market-up); background: var(--market-up-soft); color: var(--market-up); }

#screenerView .factor-data-status {
  min-height: 34px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 7px 14px;
  border: 0;
  border-top: 1px solid #eef0f3;
  color: #9ca3af;
  font-size: 10.5px;
}
#screenerView .factor-data-status strong { color: #16a34a; font-size: 11px; }
#screenerView .factor-data-status small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.screener-strategy-summary { min-height: 164px; display: flex; flex-direction: column; padding: 14px 16px; }
.screener-strategy-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.screener-strategy-title > strong { font-size: 16px; }
.screener-strategy-title > span { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.screener-strategy-title b { padding: 2px 7px; border-radius: 5px; background: var(--market-up-soft); color: var(--market-up); font-size: 10.5px; }
.screener-strategy-title b.neutral { background: #f3f4f6; color: #6b7280; }
.screener-strategy-summary p { margin: 10px 0 0; color: #6b7280; font-size: 12px; line-height: 1.75; }
.screener-strategy-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; }

.screener-runbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}
.screener-run-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.screener-pipeline-status { display: flex; gap: 16px; margin-left: auto; color: #6b7280; font-size: 11px; }
.screener-pipeline-status strong { margin-left: 3px; color: #16a34a; font-weight: 650; }

#screenerView .screener-backtest-strip {
  min-height: 62px;
  display: grid;
  grid-template-columns: 18px minmax(360px, auto) minmax(240px, 1fr);
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid #f0dfc1;
  border-radius: 10px 10px 0 0;
  background: #fffaf3;
}
.screener-backtest-strip > .lucide { width: 16px; height: 16px; color: #b45309; }
#screenerView .screener-backtest-strip .dragon-summary { display: flex; border: 0; background: transparent; }
#screenerView .screener-backtest-strip .dragon-metric { min-width: 96px; padding: 2px 16px 2px 0; border: 0; }
#screenerView .screener-backtest-strip .dragon-metric span { font-size: 10.5px; }
#screenerView .screener-backtest-strip .dragon-metric strong { margin-top: 2px; font-size: 15px; }
.screener-backtest-strip > p { margin: 0; color: #9ca3af; font-size: 10.5px; line-height: 1.55; }

#screenerView .screener-results-view,
#screenerView .strategy-tracking-panel {
  margin: 0 14px 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
#screenerView .screener-results-view { margin-top: 0; }
#screenerView .screener-result-frame { min-height: 420px; border: 0; }
#screenerView .screener-result-frame .data-table { font-size: 12.5px; }
#screenerView .screener-result-frame th,
#screenerView .screener-result-frame td { height: 44px; padding-right: 12px; padding-left: 12px; border-right: 0; border-bottom-color: #eef0f3; }
#screenerView .screener-result-frame th { height: 38px; background: #f8fafc; color: #6b7280; font-size: 12px; }
#screenerView .screener-result-frame thead th:nth-child(-n+3) { background: #f8fafc; }

.strategy-drawer {
  width: min(560px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: #fff;
  box-shadow: -12px 0 32px rgba(15, 23, 42, .16);
}
.strategy-drawer[open] { display: flex; flex-direction: column; animation: strategy-drawer-enter 240ms var(--ease-out) both; }
.strategy-drawer::backdrop { background: rgba(15, 23, 42, .38); }
@keyframes strategy-drawer-enter { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }

.strategy-drawer-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.strategy-drawer-header span { color: #9ca3af; font-size: 10.5px; }
.strategy-drawer-header h2 { margin: 3px 0 0; font-size: 16px; }
.strategy-drawer-header .icon-button { width: 38px; height: 38px; }
.strategy-drawer-body { min-height: 0; flex: 1; overflow-y: auto; }

#screenerView .strategy-drawer .strategy-sidebar {
  max-height: 210px;
  padding: 12px 14px;
  overflow-y: auto;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #f8f9fb;
}
#screenerView .strategy-drawer .strategy-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
#screenerView .strategy-drawer .strategy-item { min-height: 64px; padding: 8px 9px; border-radius: 6px; background: #fff; }
#screenerView .strategy-drawer .strategy-workbench { padding: 14px 16px 18px; }
#screenerView .strategy-drawer .strategy-meta-fields { grid-template-columns: 1fr; }
#screenerView .strategy-drawer .strategy-prompt-field textarea { min-height: 110px; }
#screenerView .strategy-drawer .strategy-actions { display: flex; flex-wrap: wrap; }
#screenerView .strategy-drawer .strategy-actions .checkbox-control { width: 100%; margin-bottom: 2px; }
#screenerView .strategy-drawer .form-field.formula-field textarea { min-height: 190px; }

@media (max-width: 1200px) {
  .auction-page-header { align-items: flex-start; flex-direction: column; }
  .auction-header-actions { width: 100%; margin-left: 0; justify-content: space-between; }
  .auction-workspace-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .screener-step small { max-width: 150px; }
  .step-line { margin: 0 8px; }
  #screenerView .screener-backtest-strip { grid-template-columns: 18px minmax(360px, 1fr); }
  .screener-backtest-strip > p { grid-column: 2; }
}

@media (max-width: 900px) {
  .auction-workspace-layout { grid-template-columns: 1fr; }
  .auction-evidence-rail { border-top: 1px solid var(--border); border-left: 0; }
  .screener-overview-grid { grid-template-columns: 1fr; }
  .screener-stepper { align-items: flex-start; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .screener-step { align-items: flex-start; }
  .step-line { display: none; }
}

@media (max-width: 720px) {
  #auctionView,
  #screenerView { border-radius: 0; }
  .auction-page-header { min-height: 0; padding: 10px 12px; }
  .auction-heading-block { align-items: flex-start; flex-direction: column; gap: 8px; }
  .auction-phase-notice { max-width: 100%; flex-wrap: wrap; }
  .auction-phase-notice span:not(.auction-phase-marker) { flex: 1 1 calc(100% - 16px); }
  .auction-header-summary { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
  .auction-header-summary > div { align-items: flex-start; }
  .auction-workspace-layout { margin: 0 8px 8px; border-radius: 8px; }
  .auction-dataset-bar { overflow-x: auto; padding: 0 10px; }
  .auction-dataset-segments { min-width: 430px; }
  .auction-dataset-segments .segment { min-height: 44px; padding: 0 11px; }
  .auction-expectation-filterbar { align-items: stretch; flex-direction: column; padding: 8px 10px; }
  .auction-expectation-controls { align-items: flex-start; flex-direction: column; gap: 6px; }
  .auction-expectation-segments { width: 100%; height: 42px; overflow-x: auto; }
  .auction-expectation-segments .segment { min-height: 38px; flex: 1 0 auto; }
  .auction-expectation-filterbar .search-field { width: 100%; margin-left: 0; }
  .auction-expectation-filterbar .search-field input { width: 100%; height: 44px; font-size: 16px; }
  .auction-unified-table-frame { min-height: 360px; max-height: none; }

  .screener-page-heading { min-height: 54px; padding: 9px 12px; }
  #screenerView .screener-strategy-view { padding: 0 8px 8px; }
  .screener-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 12px; }
  .screener-step { min-height: 46px; }
  .screener-step small { max-width: calc(50vw - 64px); }
  .screener-overview-grid { gap: 8px; margin-top: 8px; }
  .screener-regime-body { grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 10px; }
  #screenerView .regime-selector { padding: 4px 10px 10px; }
  #screenerView .regime-option { min-height: 36px; flex: 1 0 calc(33.333% - 5px); padding: 0 4px; }
  #screenerView .factor-data-status { padding: 8px 10px; }
  .screener-strategy-summary { min-height: 150px; padding: 12px; }
  .screener-strategy-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .screener-strategy-actions .button { min-width: 0; min-height: 42px; padding: 0 7px; }
  .screener-runbar { align-items: stretch; flex-direction: column; margin-top: 8px; padding: 10px; }
  .screener-run-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .screener-run-actions .button { min-height: 42px; justify-content: center; }
  .screener-pipeline-status { justify-content: space-between; margin-left: 0; padding-top: 5px; border-top: 1px solid #eef0f3; }
  #screenerView .screener-backtest-strip { grid-template-columns: 16px minmax(0, 1fr); gap: 10px; margin-top: 8px; padding: 10px; }
  #screenerView .screener-backtest-strip .dragon-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #screenerView .screener-backtest-strip .dragon-metric { min-width: 0; padding: 5px 8px 5px 0; }
  .screener-backtest-strip > p { grid-column: 1 / -1; }
  #screenerView .screener-results-view,
  #screenerView .strategy-tracking-panel { margin: 0 8px 8px; border-radius: 8px; }
  .strategy-drawer { width: 100vw; }
  #screenerView .strategy-drawer .strategy-list { grid-template-columns: 1fr; }
  #screenerView .strategy-drawer .strategy-sidebar { max-height: 190px; }
  #screenerView .strategy-drawer .strategy-actions .button { min-height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  .strategy-drawer[open] { animation: none; }
  .auction-table tbody tr td,
  #screenerView .screener-result-frame tbody tr td { transition: none; }
}

html,
body {
  background: var(--canvas);
  color: var(--text-primary);
}

body {
  grid-template-columns: 216px minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr) 28px;
}

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

.app-header {
  min-height: 64px;
  height: 64px;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 16px;
  padding: 0 16px 0 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 1px 0 rgba(22, 34, 46, .03);
  backdrop-filter: saturate(150%) blur(10px);
}

.brand-block {
  gap: 10px;
}

.brand-block .brand-mark,
.brand-block .brand-logo {
  width: 38px;
  height: 38px;
}

.brand-block .brand-mark {
  flex-basis: 38px;
  border: 0;
  background: transparent;
}

.brand-block h1 {
  font-size: 18px;
  font-weight: 760;
}

.market-tape {
  display: none;
}

.header-actions {
  grid-column: 2;
  justify-self: end;
  gap: 7px;
}

.header-date-group {
  height: 38px;
  padding: 2px 3px;
  border-color: var(--border);
  border-radius: 7px;
  background: var(--surface-muted);
}

.header-date-group .date-input {
  width: 132px;
  height: 32px;
  font-size: 12.5px;
}

.header-date-group .icon-button {
  width: 30px;
  min-height: 30px;
}

.button,
.icon-button,
.date-input,
.search-field input,
.form-field input,
.form-field select,
.form-field textarea {
  border-color: var(--border-strong);
  border-radius: 6px;
}

.button,
.icon-button {
  min-height: 36px;
  box-shadow: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 13px;
  color: #334150;
  font-size: 13px;
  font-weight: 620;
}

.button:hover,
.icon-button:hover {
  border-color: #94b5d8;
  background: #f8fbff;
  color: var(--action-hover);
  box-shadow: none;
}

.button.primary {
  border-color: var(--action);
  background: var(--action);
}

.button.primary:hover {
  border-color: var(--action-hover);
  background: var(--action-hover);
}

.icon-button {
  width: 36px;
  color: #445363;
}

.icon-button .lucide,
.button .lucide {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

.command-button {
  min-height: 36px;
}

.account-role-badge,
.account-button {
  min-height: 34px;
}

.module-nav {
  width: 216px;
  height: calc(100vh - 64px);
  top: 64px;
  padding: 8px 10px 12px;
  border-right-color: var(--border);
  background: #fbfcfd;
}

.nav-brand {
  min-height: 36px;
  padding: 0 10px;
  color: var(--text-tertiary);
  font-size: 10.5px;
  letter-spacing: 0;
}

.nav-group + .nav-group {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid #edf0f3;
}

.nav-group-label {
  height: 24px;
  padding: 0 10px;
  color: var(--text-tertiary);
  font-size: 10.5px;
  font-weight: 680;
}

.module-tab {
  min-height: 40px;
  gap: 11px;
  padding: 0 11px;
  border-radius: 6px;
  color: #4c5967;
  font-size: 13px;
  font-weight: 610;
}

.module-tab .lucide {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  stroke-width: 1.7;
}

.module-tab:hover {
  background: #f0f3f6;
  color: var(--text-primary);
}

.module-tab.active {
  position: relative;
  background: var(--action-soft);
  color: var(--action);
}

.module-tab.active::before {
  content: "";
  width: 3px;
  position: absolute;
  inset: 8px auto 8px 0;
  border-radius: 0 3px 3px 0;
  background: var(--action);
}

.sidebar-collapse-button {
  min-height: 38px;
  margin-top: auto;
  border-top: 1px solid #edf0f3;
  border-radius: 0;
  color: var(--text-tertiary);
}

.app-main {
  padding: 18px 18px 24px;
}

.status-bar {
  height: 28px;
  min-height: 28px;
  border-top-color: var(--border);
  background: #fbfcfd;
  color: var(--text-tertiary);
  font-size: 10.5px;
}

.overview-strip {
  min-height: 82px;
  grid-template-columns: minmax(230px, 1.45fr) repeat(5, minmax(105px, .78fr)) minmax(190px, 1.1fr);
  border-color: var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.sentiment-block,
.metric {
  padding: 11px 15px;
  border-right-color: var(--border);
}

.sentiment-gauge {
  width: 52px;
  height: 52px;
  flex-basis: 52px;
}

.sentiment-gauge span {
  font-size: 17px;
}

.metric-label {
  color: var(--text-secondary);
  font-size: 11px;
}

.sentiment-text {
  font-size: 16px;
  font-weight: 760;
}

.metric-value {
  font-size: 20px;
  font-weight: 760;
}

.metric-value.small {
  font-size: 14px;
}

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

body[data-active-view="screenerView"] .workspace-view,
body[data-active-view="mentorView"] .workspace-view,
body[data-active-view="heavenView"] .workspace-view,
body[data-active-view="reviewWorkspaceView"] .workspace-view {
  margin-top: 0;
}

.workspace-view {
  margin-top: 14px;
  overflow: hidden;
  border-color: var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.section-toolbar {
  min-height: 58px;
  padding: 10px 14px;
  border-bottom-color: var(--border);
  background: var(--surface);
}

.section-title-group {
  gap: 9px;
  min-width: 0;
}

.section-toolbar h2,
.section-title-group h2 {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 770;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 11.5px;
}

.count-badge {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: var(--market-up-soft);
  color: var(--market-up);
  font-size: 11.5px;
  font-weight: 720;
}

.toolbar-controls {
  gap: 8px;
}

.segmented {
  min-height: 36px;
  border-color: var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
}

.segment {
  min-height: 34px;
  padding: 0 13px;
  border-color: var(--border);
  color: #425160;
  font-size: 12.5px;
}

.segment.active {
  background: var(--action);
  color: #fff;
}

.search-field input {
  height: 36px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12.5px;
}

.table-frame {
  border-color: var(--border);
  border-radius: 0;
  background: var(--surface);
}

.data-table {
  color: #263340;
  font-size: 13px;
}

.data-table th,
.data-table td {
  height: 42px;
  padding: 8px 11px;
  border-right: 0;
  border-bottom: 1px solid #e8edf1;
  line-height: 1.4;
}

.data-table th {
  height: 38px;
  background: #f4f7f9;
  color: #526273;
  font-size: 11.5px;
  font-weight: 700;
}

.data-table tbody tr:hover td {
  background: #f6faff;
}

.data-table tbody tr.selected td {
  background: #edf5ff;
}

.empty-state {
  min-height: 170px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.inline-notice {
  border-radius: 6px;
  font-size: 12px;
}

.workspace-heading h3,
.rail-heading h3,
.mini-section-heading h4 {
  color: var(--text-primary);
  font-weight: 740;
}

dialog {
  border-color: var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(27, 38, 49, .48);
  backdrop-filter: blur(2px);
}

.dialog-header {
  min-height: 62px;
  border-bottom-color: var(--border);
}

.form-field > span {
  color: #334150;
  font-size: 12.5px;
  font-weight: 670;
}

/* Market workspaces */
.main-grid {
  grid-template-columns: minmax(0, 1fr) 286px;
  min-height: 540px;
}

.main-grid > .table-frame {
  border-right: 1px solid var(--border);
}

.insight-rail {
  background: var(--surface-subtle);
}

.rail-section {
  padding: 15px 14px;
  border-bottom-color: var(--border);
}

.rail-heading {
  margin-bottom: 11px;
}

.mini-row {
  min-height: 36px;
  border-color: var(--border);
  border-radius: 5px;
  box-shadow: none;
}

.sector-mini-row {
  min-height: 28px;
}

.phase-table-frame {
  min-height: 530px;
  border: 0;
}

.performance-cards {
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--border);
}

.performance-card {
  min-height: 124px;
  padding: 15px 16px;
  border-color: var(--border);
  background: var(--surface);
}

.performance-rate strong {
  font-size: 27px;
}

.market-breadth-panel {
  padding: 16px;
  border-bottom-color: var(--border);
  background: var(--surface-subtle);
}

.breadth-metrics > div {
  border-color: var(--border);
}

.sentiment-cycle-summary {
  grid-template-columns: minmax(270px, 1.25fr) repeat(3, minmax(160px, 1fr));
  border-bottom-color: var(--border);
}

.sentiment-cycle-current,
.sentiment-cycle-state {
  min-height: 104px;
  padding: 15px 17px;
  border-right-color: var(--border);
}

.sentiment-cycle-score-marker strong {
  font-size: 30px;
}

.sentiment-cycle-analysis {
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .75fr);
  border-bottom-color: var(--border);
}

.sentiment-trend-panel,
.sentiment-components-panel {
  padding: 16px;
}

.sentiment-trend-panel {
  border-right-color: var(--border);
}

.sentiment-chart-shell {
  height: 290px;
}

.sentiment-component-item {
  border-bottom-color: var(--border);
}

.sentiment-history-frame {
  border: 0;
}

.sentiment-history-table th,
.sentiment-history-table td {
  text-align: center;
}

.sentiment-history-groups th {
  background: #eef3f6;
}

.ladder-board {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 18px 20px;
}

.ladder-level {
  border-color: var(--border);
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(22, 34, 46, .04);
}

.rotation-history-panel {
  border-bottom-color: var(--border);
}

.rotation-history-heading {
  min-height: 58px;
  padding: 11px 14px;
}

.rotation-history {
  border-top-color: var(--border);
}

.rotation-day {
  padding: 11px 8px 13px;
  border-right-color: var(--border);
  background: var(--surface-subtle);
}

.rotation-day:nth-child(odd) {
  background: #f6f8fa;
}

.rotation-day-sector {
  border-color: #e7ebef;
  border-radius: 4px;
  background: #fff;
}

/* Market discovery */
.market-feature-summary {
  border-bottom-color: var(--border);
}

.market-feature-summary > div {
  min-height: 68px;
  padding: 11px 14px;
  border-right-color: var(--border);
}

.market-feature-summary span {
  font-size: 11px;
}

.market-feature-summary strong {
  font-size: 18px;
}

.market-feature-filterbar,
.dragon-filterbar {
  min-height: 54px;
  padding: 8px 14px;
  border-bottom-color: var(--border);
  background: var(--surface-subtle);
}

#auctionView,
#screenerView {
  --action: #1769c2;
  --action-hover: #10569f;
  --action-soft: #eaf2fb;
  --border: #dfe4e9;
  --border-strong: #cbd3dc;
  border-color: var(--border);
  background: var(--surface);
}

.auction-page-header,
.screener-page-heading {
  min-height: 62px;
  padding: 10px 14px;
  background: var(--surface);
}

.auction-workspace-layout {
  min-height: 620px;
  grid-template-columns: minmax(0, 1fr) 340px;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.auction-evidence-rail {
  border-left-color: var(--border);
  background: var(--surface-subtle);
}

.auction-evidence-section {
  border-bottom-color: var(--border);
}

.auction-table th,
.auction-table td {
  border-bottom-color: #e8edf1;
}

.auction-table th {
  background: #f4f7f9;
}

.auction-phase-notice {
  border-radius: 5px;
}

.theme-library-layout {
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 680px;
}

.theme-directory-panel {
  border-right-color: var(--border);
  background: var(--surface-subtle);
}

.theme-directory-heading,
.theme-members-heading {
  min-height: 48px;
  padding: 9px 13px;
  border-bottom-color: var(--border);
}

.theme-directory-item {
  min-height: 60px;
  padding: 9px 13px;
  border-bottom-color: #e7ebef;
}

.theme-directory-item:hover {
  background: #f1f6fb;
}

.theme-directory-item.active {
  background: #eaf2fb;
  box-shadow: inset 3px 0 var(--action);
}

.theme-detail-heading {
  min-height: 78px;
  border-bottom-color: var(--border);
}

.theme-detail-metrics,
.theme-detail-metrics > div,
.theme-chart-shell {
  border-color: var(--border);
}

.theme-chart-shell {
  height: 310px;
  padding: 10px 14px;
}

.dragon-summary {
  border-bottom-color: var(--border);
}

.dragon-metric {
  border-right-color: var(--border);
}

.dragon-card-stage {
  border-bottom-color: var(--border);
  background: var(--surface-subtle);
}

.dragon-stage-heading {
  min-height: 50px;
  padding: 9px 14px;
}

.dragon-trader-detail {
  min-height: 310px;
}

.trader-profile {
  border-bottom-color: var(--border);
}

/* Intelligent tools */
.screener-mode-tabs {
  min-height: 50px;
  align-items: center;
  padding: 0 14px;
  border-bottom-color: var(--border);
  background: var(--surface);
}

.screener-mode-tabs button {
  min-height: 48px;
  border-bottom-width: 2px;
  color: var(--text-secondary);
  font-size: 13px;
}

.screener-mode-tabs button.active {
  border-bottom-color: var(--action);
  color: var(--action);
}

#screenerView .screener-strategy-view {
  padding: 14px;
  background: var(--canvas);
}

.screener-stepper,
.screener-overview-card,
.screener-runbar,
#screenerView .screener-results-view,
#screenerView .strategy-tracking-panel,
.curated-screener-panel,
.quant-screener-panel {
  border-color: var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow-soft);
}

.screener-stepper {
  min-height: 64px;
}

.screener-overview-card {
  border-radius: 7px;
}

.screener-card-heading {
  border-bottom-color: var(--border);
}

.screener-runbar {
  min-height: 60px;
}

#screenerView .screener-results-view,
#screenerView .strategy-tracking-panel {
  margin: 0 14px 14px;
}

.curated-screener-panel,
.quant-screener-panel {
  min-height: 590px;
  margin: 14px;
}

.curated-screener-panel {
  height: min(720px, calc(100vh - 220px));
  min-height: 600px;
}

.curated-library-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.curated-strategy-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.curated-library-pane,
.quant-summary-pane {
  border-color: var(--border);
  background: var(--surface-subtle);
}

.curated-strategy-card,
.quant-rule-row,
.quant-summary-block {
  border-color: var(--border);
  border-radius: 5px;
  box-shadow: none;
}

.curated-strategy-card.active {
  border-color: #9bbce0;
  background: #edf5ff;
  box-shadow: inset 3px 0 var(--action);
}

.quant-universe-grid {
  border-color: var(--border);
  background: var(--surface-subtle);
}

.quant-rule-row select,
.quant-rule-row input {
  border-color: var(--border-strong);
}

.mentor-layout {
  height: calc(100vh - 110px);
  min-height: 670px;
  grid-template-columns: 320px minmax(0, 1fr);
  background: var(--surface);
}

.mentor-sidebar {
  border-right-color: var(--border);
  background: var(--surface-subtle);
}

.mentor-directory-heading,
.mentor-chat-header,
.mentor-quick-prompts,
.mentor-chat-form {
  border-color: var(--border);
}

.mentor-option {
  border-bottom-color: #e7ebef;
}

.mentor-option:hover {
  background: #f1f6fb;
}

.mentor-option.active {
  background: #eaf2fb;
}

.mentor-chat-panel {
  background: var(--surface);
}

.mentor-chat-header {
  min-height: 102px;
  padding: 14px 18px;
}

.mentor-messages {
  padding: 20px;
  background: #fbfcfd;
}

.mentor-chat-form {
  padding: 12px 18px;
}

/* Review workspace */
.review-workspace {
  grid-template-columns: minmax(360px, .95fr) minmax(520px, 1.05fr);
  background: var(--surface);
}

.workspace-section {
  border-color: var(--border);
  background: var(--surface);
}

.workspace-heading {
  min-height: 54px;
  padding: 10px 16px;
  border-bottom-color: var(--border);
}

.workspace-table-frame,
.trade-log-table-frame {
  border: 0;
}

.journal-form {
  padding: 15px 16px 16px;
}

.journal-form textarea {
  min-height: 104px;
  padding: 10px;
  border-color: var(--border-strong);
  background: #fff;
  font-size: 13px;
  line-height: 1.65;
}

.trade-journal-section,
.notes-history-section {
  border-top-color: var(--border);
}

.trade-log-summary {
  border-bottom-color: var(--border);
}

/* Keep Wentian distinctive while aligning its outer frame */
#heavenView {
  border-color: #ded9ce;
  box-shadow: var(--shadow-soft);
}

#heavenView .heaven-toolbar {
  min-height: 66px;
  padding: 12px 20px;
}

#heavenView .heaven-tabs {
  min-height: 54px;
  padding: 0 20px;
}

#heavenView .heaven-proverb {
  padding: 10px 20px;
}

#heavenView .heaven-panel {
  padding-right: 20px;
  padding-left: 20px;
}

#heavenView .heaven-controls {
  min-height: 96px;
  gap: 16px;
}

.heaven-trend-empty {
  min-height: 340px;
}

/* Dialogs and overlays */
.global-search-dialog,
.assistant-dialog,
.settings-dialog,
.stock-dialog,
.account-settings-dialog,
.heaven-reading-dialog {
  border-radius: 9px;
}

.global-search-dialog {
  max-width: 700px;
}

.assistant-dialog {
  max-width: 820px;
}

.assistant-dialog .assistant-messages {
  background: #fbfcfd;
}

.account-dropdown {
  border-color: var(--border);
  border-radius: 7px;
  box-shadow: 0 14px 35px rgba(22, 34, 46, .15);
}

@media (min-width: 721px) and (max-width: 1279px) {
  body {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .app-header {
    grid-template-columns: 68px minmax(0, 1fr);
    padding-left: 8px;
  }

  .brand-block h1 {
    display: none;
  }

  .module-nav,
  body.sidebar-collapsed .module-nav {
    width: 68px;
    padding: 8px 7px 12px;
  }

  .nav-brand,
  .nav-group-label,
  .module-tab span,
  .sidebar-collapse-button span {
    display: none;
  }

  .module-tab,
  .sidebar-collapse-button {
    justify-content: center;
    padding: 0;
  }

  .module-tab.active::before {
    inset: 8px auto 8px -7px;
  }

  .overview-strip {
    grid-template-columns: minmax(210px, 1.3fr) repeat(5, minmax(90px, .7fr));
  }

  .overview-strip .metric-wide {
    display: none;
  }

  .auction-workspace-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .mentor-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  html,
  body {
    min-width: 320px;
    width: 100%;
  }

  .app-header {
    width: 100%;
    height: 108px;
    min-height: 108px;
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 8px 10px 0;
    border-bottom-color: var(--border);
    background: rgba(255, 255, 255, .98);
  }

  .brand-block .brand-mark,
  .brand-block .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-block .brand-mark {
    flex-basis: 34px;
  }

  .brand-block h1 {
    display: block;
    font-size: 16px;
  }

  .header-date-group .date-input {
    width: 112px;
    flex: 1;
    font-size: 11.5px;
  }

  .header-date-group .icon-button {
    width: 30px;
    min-width: 30px;
  }

  .header-menu-button {
    display: grid;
  }

  .header-command-group {
    top: 104px;
    right: 10px;
    width: 210px;
    padding: 7px;
    border-color: var(--border);
    border-radius: 8px;
  }

  .module-nav,
  body.sidebar-collapsed .module-nav {
    width: 100%;
    height: calc(64px + env(safe-area-inset-bottom));
    min-height: 64px;
    inset: auto 0 0;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 4px 4px max(4px, env(safe-area-inset-bottom));
    border-top-color: var(--border);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -6px 20px rgba(22, 34, 46, .08);
    backdrop-filter: saturate(150%) blur(10px);
  }

  .module-nav .module-tab,
  body.sidebar-collapsed .module-nav .module-tab {
    min-height: 56px;
    gap: 3px;
    border-radius: 6px;
    font-size: 10px;
  }

  .module-nav .module-tab .lucide {
    width: 20px;
    height: 20px;
  }

  .module-nav .module-tab.active::before,
  .module-nav .module-tab.mobile-active::before {
    display: none;
  }

  .module-nav .module-tab.active,
  .module-nav .module-tab.mobile-active {
    background: #eef5fc;
    color: var(--action);
  }

  .app-main {
    width: 100%;
    min-height: calc(100dvh - 176px);
    padding: 10px 8px 20px;
  }

  .mobile-market-selector:not([hidden]) {
    height: 44px;
    margin-bottom: 10px;
    border-color: var(--border);
    border-radius: 7px;
    box-shadow: var(--shadow-soft);
  }

  .mobile-market-selector select {
    font-size: 13px;
  }

  .overview-strip {
    min-height: 182px;
    grid-template-columns: 1.2fr 1fr 1fr;
    grid-template-rows: 64px 64px 54px;
    margin-bottom: 10px;
    border-radius: 7px;
  }

  .sentiment-block,
  .metric {
    min-height: 0;
    padding: 8px 10px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .sentiment-block {
    grid-column: 1;
    grid-row: 1 / 3;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
  }

  .sentiment-gauge {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .sentiment-gauge::before {
    inset: 5px;
  }

  .sentiment-gauge span {
    font-size: 15px;
  }

  .sentiment-text {
    margin-top: 2px;
    font-size: 14px;
  }

  .overview-strip .metric:nth-of-type(2) { grid-column: 3; grid-row: 1; border-right: 0; }
  .overview-strip .metric:nth-of-type(4) { grid-column: 3; grid-row: 2; border-right: 0; }
  .overview-strip .metric:nth-of-type(5) { grid-column: 1 / 2; grid-row: 3; border-bottom: 0; }
  .overview-strip .metric:nth-of-type(6) { grid-column: 2 / 4; grid-row: 3; border-right: 0; border-bottom: 0; }

  .metric {
    gap: 2px;
  }

  .metric-label {
    font-size: 10.5px;
  }

  .metric-value {
    font-size: 16px;
  }

  .metric-value.small {
    font-size: 12px;
  }

  .workspace-view,
  body[data-active-view="screenerView"] .workspace-view,
  body[data-active-view="mentorView"] .workspace-view,
  body[data-active-view="heavenView"] .workspace-view,
  body[data-active-view="reviewWorkspaceView"] .workspace-view {
    margin-top: 0;
    border-radius: 7px;
  }

  .section-toolbar {
    min-height: 58px;
    align-items: flex-start;
    padding: 11px 13px;
  }

  .section-title-group {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .section-toolbar h2,
  .section-title-group h2 {
    font-size: 18px;
  }

  .section-subtitle {
    width: 100%;
    font-size: 11px;
  }

  .toolbar-controls {
    width: 100%;
    align-items: stretch;
    flex-wrap: wrap;
  }

  .button,
  .icon-button {
    min-height: 42px;
  }

  .search-field input,
  .form-field input,
  .form-field select {
    min-height: 44px;
    font-size: 16px;
  }

  .segmented {
    min-height: 42px;
  }

  .segment {
    min-height: 40px;
    padding: 0 10px;
  }

  .data-table {
    font-size: 12.5px;
  }

  .data-table th,
  .data-table td {
    height: 44px;
    padding: 8px 10px;
  }

  .data-table th {
    font-size: 11.5px;
  }

  .main-grid {
    display: block;
    min-height: 0;
  }

  .main-grid > .table-frame {
    min-height: 460px;
    border-right: 0;
  }

  .insight-rail {
    display: grid;
    grid-template-columns: 1fr;
    border-top: 1px solid var(--border);
  }

  .phase-table-frame {
    min-height: 480px;
  }

  .performance-cards {
    grid-template-columns: 1fr 1fr;
  }

  .performance-card {
    min-height: 118px;
    padding: 13px;
  }

  .sentiment-cycle-summary {
    grid-template-columns: 1fr 1fr;
  }

  .sentiment-cycle-current,
  .sentiment-cycle-state {
    min-height: 98px;
    padding: 13px;
  }

  .sentiment-cycle-current {
    grid-column: 1 / -1;
  }

  .sentiment-cycle-state:last-child {
    grid-column: 1 / -1;
  }

  .sentiment-cycle-analysis {
    grid-template-columns: 1fr;
  }

  .sentiment-trend-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sentiment-chart-shell {
    height: 260px;
  }

  .ladder-board {
    padding: 12px 8px 14px;
  }

  .rotation-history-heading {
    padding: 10px 12px;
  }

  .market-feature-summary {
    grid-template-columns: 1fr 1fr;
  }

  .market-feature-summary > div {
    min-height: 62px;
  }

  .market-feature-filterbar,
  .dragon-filterbar {
    align-items: stretch;
    flex-direction: column;
    padding: 9px 12px;
  }

  .market-feature-filterbar .search-field,
  .market-feature-filterbar .search-field input,
  .dragon-search-field,
  .dragon-search-field input {
    width: 100%;
  }

  .auction-page-header {
    padding: 11px 12px;
  }

  .auction-workspace-layout {
    display: block;
    margin: 0;
    border-radius: 0;
  }

  .auction-dataset-bar {
    padding: 0 10px;
  }

  .auction-dataset-segments {
    min-width: 430px;
  }

  .auction-expectation-filterbar {
    padding: 9px 10px;
  }

  .theme-library-layout {
    display: block;
    min-height: 0;
  }

  .theme-directory-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .theme-directory {
    max-height: 300px;
  }

  .theme-chart-shell {
    height: 250px;
  }

  .screener-mode-tabs {
    min-height: 50px;
    padding: 0 4px;
  }

  .screener-mode-tabs button {
    min-width: 0;
    min-height: 48px;
    flex: 1;
    padding: 0 4px;
    font-size: 12px;
  }

  #screenerView .screener-strategy-view {
    padding: 8px;
  }

  .curated-screener-panel,
  .quant-screener-panel {
    height: auto;
    min-height: 0;
    margin: 8px;
  }

  .curated-library-pane {
    display: block;
    overflow: visible;
  }

  .curated-strategy-list {
    max-height: 380px;
    overflow-y: auto;
  }

  .quant-universe-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mentor-layout {
    height: calc(100dvh - 258px - env(safe-area-inset-bottom));
    min-height: 510px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 56px minmax(0, 1fr);
    overflow: hidden;
  }

  .mentor-chat-panel {
    min-height: 0;
    height: 100%;
  }

  #mentorView > .section-toolbar {
    min-height: 66px;
    align-items: center;
    flex-direction: row;
  }

  #mentorView > .section-toolbar .section-title-group {
    flex: 1;
  }

  .mentor-messages {
    padding: 14px 12px;
  }

  .mentor-empty-state {
    min-height: 100%;
    padding: 10px;
  }

  .mentor-empty-state strong {
    font-size: 16px;
  }

  .mentor-empty-state p {
    display: none;
  }

  .review-workspace {
    display: block;
  }

  .workspace-section {
    min-width: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .watchlist-section .workspace-table-frame {
    min-height: 0;
    max-height: 360px;
  }

  .watchlist-section .empty-state {
    min-height: 160px;
  }

  .workspace-heading {
    min-height: 52px;
    padding: 9px 13px;
  }

  .journal-form {
    padding: 13px;
  }

  #heavenView .heaven-toolbar {
    min-height: 62px;
    padding: 10px 14px;
  }

  #heavenView .heaven-tabs {
    min-height: 52px;
    padding: 0 14px;
  }

  #heavenView .heaven-proverb {
    padding: 9px 14px;
  }

  #heavenView .heaven-panel {
    padding-right: 14px;
    padding-left: 14px;
  }

  #heavenView .heaven-controls {
    align-items: stretch;
    flex-direction: column;
    min-height: 0;
    padding: 14px 0;
  }

  .heaven-trend-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
  }

  .heaven-trend-empty {
    min-height: 330px;
  }

  .assistant-dialog,
  .settings-dialog,
  .stock-dialog,
  .account-settings-dialog,
  .heaven-reading-dialog {
    width: calc(100vw - 16px);
    max-width: none;
    max-height: calc(100dvh - 20px);
    border-radius: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-view.active-view.view-entering,
  .module-tab,
  .button,
  .icon-button {
    animation: none;
    transition: none;
  }
}
