:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #687380;
  --line: #d9e0e6;
  --soft-line: #e9eef2;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --red: #d63d3d;
  --green: #16885a;
  --amber: #b7791f;
  --blue: #2563eb;
  --shadow: 0 14px 32px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  padding: 24px 18px;
}

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

.brand-mark {
  display: grid;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
}

.brand-block h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
}

.brand-block p,
.muted {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-section.compact {
  padding-top: 8px;
  border-top: 1px solid var(--soft-line);
}

.section-label {
  color: #45515e;
  font-size: 13px;
  font-weight: 700;
}

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

.library-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 3px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #ffffff;
}

.library-tabs button {
  min-height: 30px;
  border-radius: 6px;
  color: #546170;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.library-tabs button.active {
  color: #ffffff;
  background: var(--accent);
}

.sidebar-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  color: #45515e;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.sidebar-action:hover {
  border-color: #b9c5ce;
  background: #f7fafb;
}

.sidebar-action.active {
  border-color: rgba(15, 118, 110, 0.45);
  color: var(--accent-strong);
  background: #eaf7f5;
}

.sidebar-action strong {
  min-width: 18px;
  border-radius: 999px;
  padding: 1px 6px;
  color: #ffffff;
  background: var(--accent);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.pattern-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pattern-item {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.pattern-item.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: #eaf7f5;
}

.stats-menu-item {
  margin-top: 4px;
}

.pattern-item[disabled] {
  cursor: default;
  opacity: 0.64;
}

.pattern-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pattern-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pattern-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 2px 7px;
  color: #ffffff;
  background: var(--accent);
  font-size: 11px;
}

.pattern-status.planned {
  color: #684b16;
  background: #f6e7bd;
}

.pattern-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.pattern-tags span {
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  padding: 1px 6px;
  color: var(--muted);
  background: #f8fafb;
  font-size: 11px;
}

.pattern-performance {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 8px;
}

.pattern-performance span {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  padding: 3px 6px;
  background: #f8fafb;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.pattern-performance .up {
  border-color: rgba(196, 75, 61, 0.28);
  color: #b43d33;
  background: #fff3f1;
}

.pattern-performance .down {
  border-color: rgba(15, 118, 110, 0.24);
  color: var(--accent-strong);
  background: #edf8f6;
}

.pattern-performance .flat,
.pattern-performance.pending span {
  color: #667381;
  background: #f5f7f8;
}

.detail-pattern-performance {
  margin-top: 0;
  gap: 6px;
}

.detail-pattern-performance span {
  padding: 3px 5px;
  font-size: 11px;
}

.detail-pattern-performance.pending span:only-child {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 5px;
  color: #44505c;
  font-size: 12px;
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  min-height: 96px;
  line-height: 1.5;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 118, 110, 0.16);
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 7px;
  padding: 9px 13px;
  font-weight: 800;
}

.primary-btn {
  color: #ffffff;
  background: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.secondary-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
}

.secondary-btn:hover {
  border-color: #b9c5ce;
  background: #f7fafb;
}

.btn-icon {
  font-size: 16px;
  line-height: 1;
}

.progress-wrap {
  display: grid;
  gap: 7px;
}

.progress-line {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef2;
}

.progress-line span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 160ms ease;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 24px;
}

.workspace-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.workspace-header h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.workspace-header.detail-context {
  align-items: center;
}

.workspace-header.utility-context {
  display: none;
}

.workspace-header.detail-context h2,
.workspace-header.detail-context .pattern-desc {
  display: none;
}

.pattern-desc {
  max-width: 780px;
  margin: 8px 0 0;
  color: #4f5d69;
  font-size: 14px;
  line-height: 1.55;
}

.toolbar,
.stats-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar label {
  width: 104px;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 24px;
  line-height: 1;
}

.panel {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.panel-header h3 {
  margin: 0;
  font-size: 17px;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-height: none;
}

table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #53606c;
  background: #f9fbfc;
  font-size: 12px;
}

td {
  font-size: 13px;
  line-height: 1.45;
}

.stock-cell strong {
  display: block;
  font-size: 14px;
}

.stock-cell span {
  color: var(--muted);
}

.stock-link {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.stock-link:hover strong {
  color: var(--accent);
}

.score-wrap {
  display: grid;
  gap: 6px;
  width: 116px;
}

.score-line {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f4;
}

.score-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.score-number {
  font-weight: 800;
}

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

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

.tag-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.action-text {
  margin-bottom: 2px;
  color: #22303a;
  font-weight: 800;
}

.reason-pill,
.risk-pill {
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
}

.reason-pill {
  color: #0f5b56;
  background: #e7f5f3;
}

.risk-pill {
  color: #7a4b04;
  background: #faedcf;
}

.concept-pill {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.45;
  max-width: 100%;
}

.concept-pill:hover,
.concept-pill:focus-visible {
  color: #0b4c48;
  background: #d4eee9;
  outline: 2px solid rgba(15, 91, 86, 0.16);
  outline-offset: 1px;
}

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

.stats-header {
  align-items: end;
}

.stats-controls label {
  width: 100px;
}

.stats-output {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.stats-block {
  display: grid;
  gap: 14px;
}

.stats-block-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.stats-block-header h3,
.stats-table-title h4 {
  margin: 0;
}

.stats-block-header h3 {
  font-size: 18px;
}

.stats-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
}

.stat-card {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfd;
}

.stat-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 5px;
  font-size: 19px;
}

.stat-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.stats-table-title {
  display: grid;
  gap: 4px;
  padding-top: 4px;
}

.stats-table-title.action-title {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.stats-table-title h4 {
  color: #34404b;
  font-size: 14px;
}

.mini-table {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
}

.mini-table table {
  min-width: 760px;
}

.stats-mini-table {
  max-height: none;
}

.stat-stock-link strong {
  color: #1f2933;
}

.stat-stock-link span {
  display: block;
  margin-top: 2px;
}

.backtest-output {
  display: grid;
  gap: 12px;
}

.backtest-summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.backtest-chart-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--soft-line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 12px 14px;
  background: #fbfcfd;
}

.backtest-chart-header strong {
  font-size: 14px;
}

.backtest-chart-header > span {
  text-align: right;
}

.backtest-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.backtest-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.backtest-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--legend-color);
}

.backtest-chart {
  height: 360px;
  border: 1px solid var(--soft-line);
  border-radius: 0 0 8px 8px;
  padding: 8px;
  background: #ffffff;
}

.pattern-performance-panel {
  overflow: hidden;
}

.pattern-backtest-body {
  display: grid;
  gap: 12px;
  padding: 14px 18px 18px;
}

.pattern-backtest-cards {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.pattern-backtest-chart-header {
  margin-top: 2px;
}

.pattern-backtest-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.segmented-control button {
  min-width: 52px;
  min-height: 30px;
  border: 0;
  border-right: 1px solid var(--soft-line);
  padding: 0 10px;
  color: #53606d;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.active {
  color: #ffffff;
  background: var(--accent);
}

.segmented-control button.no-data:not(.active) {
  color: #94a3b8;
  background: #f8fafc;
}

.pattern-backtest-chart {
  height: 300px;
}

.alpha-panel {
  overflow: hidden;
}

.alpha-panel-header {
  align-items: center;
}

.alpha-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.alpha-overview-body {
  display: grid;
  gap: 14px;
  padding: 14px 18px 18px;
}

.alpha-summary-cards {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
}

.alpha-quality-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.alpha-quality-strip.current {
  border-color: rgba(15, 118, 110, 0.24);
}

.alpha-quality-strip.stale,
.alpha-quality-strip.missing {
  border-color: rgba(214, 61, 61, 0.24);
}

.alpha-quality-strip div {
  min-width: 0;
}

.alpha-quality-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.alpha-quality-strip strong {
  display: block;
  margin-top: 4px;
  color: #26323d;
  font-size: 14px;
}

.alpha-quality-strip small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.alpha-decision-board {
  display: grid;
  gap: 12px;
  border: 1px solid var(--soft-line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.alpha-decision-board.strong {
  border-left-color: #d63d3d;
  background: #fff8f6;
}

.alpha-decision-board.watch {
  border-left-color: var(--accent);
  background: #f4fbf9;
}

.alpha-decision-main {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.alpha-decision-main span,
.alpha-decision-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.alpha-decision-main h4 {
  margin: 4px 0 5px;
  color: #26323d;
  font-size: 20px;
}

.alpha-decision-main p,
.alpha-decision-note {
  margin: 0;
  color: #53606d;
  font-size: 13px;
  line-height: 1.45;
}

.alpha-decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.alpha-decision-grid > div {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.alpha-decision-grid > div.strong {
  border-color: rgba(214, 61, 61, 0.28);
}

.alpha-decision-grid > div.watch {
  border-color: rgba(15, 118, 110, 0.26);
}

.alpha-decision-grid strong {
  display: block;
  margin-top: 5px;
  color: #26323d;
  font-size: 15px;
}

.alpha-decision-grid small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.alpha-rank-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.alpha-rank-block {
  display: grid;
  gap: 10px;
}

.alpha-table {
  max-height: none;
}

.alpha-table table {
  min-width: 860px;
}

.alpha-table tr.strong {
  background: #fff6f2;
}

.alpha-table tr.watch {
  background: #eef9f7;
}

.alpha-table tr.neutral {
  background: #ffffff;
}

.factor-panel {
  display: grid;
  gap: 14px;
}

.factor-panel-header {
  align-items: center;
}

.factor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.factor-backtest-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.factor-summary-cards {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.factor-table {
  max-height: none;
}

.factor-table table {
  min-width: 1080px;
}

.factor-table tr.active {
  background: #eef9f7;
}

.factor-name-button {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.factor-name-button strong {
  font-size: 14px;
}

.factor-name-button span {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.factor-name-button em {
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.factor-chart-block {
  display: grid;
  gap: 12px;
}

.factor-backtest-chart {
  height: 320px;
}

.factor-lab-panel {
  display: grid;
  gap: 14px;
}

.factor-lab-panel-header {
  align-items: flex-start;
}

.factor-lab-actions,
.factor-lab-status-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.factor-lab-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.factor-lab-summary-cards {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.factor-lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.factor-lab-table-block,
.factor-lab-detail {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.factor-lab-table table {
  min-width: 1080px;
}

.factor-lab-table tr.active {
  background: #eef9f7;
}

.lab-status,
.lab-warning,
.factor-lab-warning-list span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.lab-status {
  color: #45515e;
  background: #eef2f5;
}

.lab-status.watching {
  color: #0b5f59;
  background: #eaf7f5;
}

.lab-status.accepted {
  color: #ffffff;
  background: var(--green);
}

.lab-status.rejected {
  color: #ffffff;
  background: var(--red);
}

.lab-status.archived {
  color: #ffffff;
  background: #687380;
}

.lab-warning,
.factor-lab-warning-list span {
  margin: 2px 4px 2px 0;
  color: #8a5a10;
  background: #fff7e6;
}

.factor-lab-status-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
  color: #45515e;
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
}

.factor-lab-status-actions button.active {
  border-color: rgba(15, 118, 110, 0.45);
  color: var(--accent-strong);
  background: #eaf7f5;
}

.factor-lab-horizon-grid,
.factor-lab-diagnostics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.factor-lab-horizon-grid > div,
.factor-lab-diagnostics > div {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.factor-lab-horizon-grid span,
.factor-lab-diagnostics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.factor-lab-horizon-grid strong,
.factor-lab-diagnostics strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.factor-lab-horizon-grid small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.factor-lab-warning-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.factor-lab-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 12px;
  align-items: start;
}

.factor-lab-latest-table table {
  min-width: 620px;
}

.factor-lab-correlation-table table {
  min-width: 360px;
}

.strategy-panel {
  display: grid;
  gap: 14px;
}

.strategy-panel-header {
  align-items: flex-start;
}

.strategy-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.strategy-actions label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.strategy-actions input {
  width: 148px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  color: var(--ink);
  background: #ffffff;
}

.strategy-backtest-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.strategy-summary-cards {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.strategy-chart {
  height: 340px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.strategy-chart-wrap {
  position: relative;
}

.strategy-chart-tooltip {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 4px;
  width: min(320px, calc(100% - 16px));
  border: 1px solid rgba(69, 81, 94, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  color: #26323d;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(31, 41, 51, 0.14);
  pointer-events: none;
}

.strategy-chart-tooltip strong {
  font-size: 13px;
}

.strategy-chart-tooltip span,
.strategy-chart-tooltip em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.strategy-chart-tooltip em {
  color: #7a4f14;
}

.strategy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
}

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

.strategy-plan-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--soft-line);
  border-left: 3px solid var(--soft-line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
}

.strategy-plan-item strong {
  display: block;
  font-size: 14px;
}

.strategy-plan-item span {
  color: var(--muted);
  font-size: 12px;
}

.strategy-plan-item.buy {
  border-left-color: var(--red);
}

.strategy-plan-item.sell {
  border-left-color: var(--green);
}

.strategy-plan-item.hold {
  border-left-color: var(--blue);
}

.strategy-plan-item.skip {
  border-left-color: var(--amber);
}

.strategy-holding-table {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}

.holding-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--soft-line);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.holding-status-badge.new {
  color: var(--red);
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(220, 38, 38, 0.08);
}

.holding-status-badge.hold {
  color: var(--blue);
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(37, 99, 235, 0.07);
}

.holding-status-badge.sold {
  color: var(--green);
  border-color: rgba(22, 163, 74, 0.24);
  background: rgba(22, 163, 74, 0.07);
}

.strategy-sold-row {
  background: rgba(22, 163, 74, 0.035);
}

@media (max-width: 1100px) {
  .strategy-grid {
    grid-template-columns: 1fr;
  }
}

.backtest-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(760px, 92vw);
  height: 100vh;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -18px 0 36px rgba(31, 41, 51, 0.16);
}

.backtest-drawer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--soft-line);
  padding: 18px;
}

.backtest-drawer-header h3 {
  margin: 0;
  font-size: 18px;
}

.compact-btn {
  min-height: 32px;
  padding: 0 12px;
}

.backtest-drawer-body {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  padding: 16px 18px 20px;
}

.backtest-detail-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.backtest-detail-cards div {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.backtest-detail-cards span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.backtest-detail-cards strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  word-break: break-word;
}

.backtest-trade-table {
  max-height: none;
}

.backtest-trade-table table {
  min-width: 980px;
}

.expectation-panel {
  display: grid;
  gap: 18px;
}

.expectation-form-header,
.expectation-list-header {
  align-items: end;
}

.expectation-actions,
.expectation-list-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.expectation-list-controls label {
  width: 128px;
}

.expectation-form {
  display: grid;
  grid-template-columns: 1.25fr 160px 160px 1fr;
  gap: 12px;
  padding: 16px 18px 18px;
}

.expectation-full-field {
  grid-column: 1 / -1;
}

.expectation-output,
.expectation-list {
  display: grid;
  gap: 14px;
  padding: 16px 18px 18px;
}

.expectation-source-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px 18px;
}

.expectation-source-item {
  display: grid;
  gap: 6px;
  min-height: 76px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 11px;
  color: inherit;
  background: #fbfcfd;
  text-decoration: none;
}

.expectation-source-item:hover {
  border-color: rgba(15, 118, 110, 0.4);
  background: #eef9f7;
}

.hot-news-source-item {
  border-color: rgba(37, 99, 235, 0.16);
  background: #f8fbff;
}

.hot-news-source-item:hover {
  border-color: rgba(37, 99, 235, 0.34);
  background: #eef5ff;
}

.expectation-source-item strong {
  font-size: 13px;
  line-height: 1.25;
}

.expectation-source-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.expectation-draft-block,
.expectation-event,
.expectation-impact {
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcfd;
}

.expectation-draft-block {
  display: grid;
  gap: 13px;
  padding: 14px;
}

.expectation-draft-title,
.expectation-event-head,
.expectation-impact-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.expectation-draft-title h3,
.expectation-event h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.expectation-status-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 10px;
  color: #0f5b56;
  background: #e7f5f3;
  font-size: 12px;
  font-weight: 900;
}

.expectation-cards {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
}

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

.expectation-rule-list div,
.expectation-event-impacts div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  padding: 8px 10px;
  background: #ffffff;
}

.expectation-rule-list strong,
.expectation-event-impacts strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expectation-rule-list span,
.expectation-event-impacts span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.expectation-impact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.expectation-impact {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 13px;
}

.expectation-impact.strong {
  border-color: rgba(15, 118, 110, 0.34);
  background: #f0faf8;
}

.expectation-impact-head > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.expectation-rank {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.expectation-impact-head strong {
  font-size: 17px;
  line-height: 1.2;
}

.expectation-impact-head em {
  color: #51606d;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.expectation-score,
.expectation-event-score {
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  min-height: 54px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #ffffff;
}

.expectation-score span,
.expectation-event-score span {
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.expectation-score small,
.expectation-event-score small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.expectation-impact p,
.expectation-event-thesis {
  margin: 0;
  color: #34404b;
  font-size: 13px;
  line-height: 1.55;
}

.expectation-meta-line {
  display: grid;
  gap: 5px;
}

.expectation-meta-line span {
  color: #52606d;
  font-size: 12px;
  line-height: 1.4;
}

.expectation-stock-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 2px;
}

.expectation-stock-link {
  display: inline-grid;
  gap: 1px;
  min-width: 116px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  padding: 7px 9px;
  color: #26323d;
  background: #ffffff;
  text-align: left;
}

.expectation-stock-link:hover {
  border-color: rgba(15, 118, 110, 0.4);
  color: var(--accent-strong);
  background: #eef9f7;
}

.expectation-stock-link strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expectation-stock-link span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.expectation-event {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.expectation-event-impacts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.expectation-event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.expectation-event-actions .active-status {
  border-color: rgba(15, 118, 110, 0.42);
  color: var(--accent-strong);
  background: #eaf7f5;
}

.detail-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.detail-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.chart-panel {
  min-height: 600px;
}

.detail-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-company-summary {
  max-width: 980px;
  margin: 7px 0 0;
  color: #34404b;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.favorite-btn {
  min-height: 30px;
  border: 1px solid rgba(183, 121, 31, 0.36);
  border-radius: 999px;
  padding: 0 11px;
  color: #8a5a12;
  background: #fff7e6;
  font-size: 12px;
  font-weight: 900;
}

.favorite-btn[aria-pressed="true"] {
  color: #ffffff;
  background: #b7791f;
}

.favorite-btn:disabled {
  cursor: default;
  opacity: 0.56;
}

.chart-control-stack {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 260px;
}

.chart-mode-control {
  justify-self: end;
}

.chart-mode-control button {
  min-width: 58px;
}

.detail-chart-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  border-top: 1px solid var(--soft-line);
}

.detail-chart-workspace.has-peers {
  grid-template-columns: 224px minmax(0, 1fr);
}

.detail-peer-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--soft-line);
  background: #fbfcfd;
}

.detail-peer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--soft-line);
}

.detail-peer-head strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-peer-list {
  display: grid;
  align-content: start;
  max-height: 540px;
  overflow: auto;
}

.detail-peer-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  width: 100%;
  border-bottom: 1px solid var(--soft-line);
  padding: 9px 11px;
  color: #26323d;
  background: transparent;
  text-align: left;
}

.detail-peer-item:hover,
.detail-peer-item.active {
  background: #eef5f8;
}

.detail-peer-item.active {
  box-shadow: inset 3px 0 0 #2563eb;
}

.detail-peer-name,
.detail-peer-code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-peer-name {
  font-size: 13px;
  font-weight: 900;
}

.detail-peer-code {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-peer-item strong,
.detail-peer-item em,
.detail-peer-item b {
  font-size: 12px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.detail-peer-item b {
  justify-self: end;
  border: 1px solid var(--soft-line);
  border-radius: 999px;
  padding: 1px 7px;
  color: #33424f;
  background: #ffffff;
}

.daily-chart {
  position: relative;
  width: 100%;
  height: 540px;
  padding: 8px 8px 12px;
}

.kline-tooltip {
  position: absolute;
  z-index: 8;
  min-width: 188px;
  max-width: 230px;
  border: 1px solid rgba(31, 41, 51, 0.12);
  border-radius: 8px;
  padding: 10px 11px;
  color: #22303a;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 28px rgba(31, 41, 51, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 0.08s ease, transform 0.08s ease;
}

.kline-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.kline-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.kline-tooltip-head strong {
  font-size: 13px;
}

.kline-tooltip-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 12px;
  font-size: 12px;
  line-height: 1.25;
}

.kline-tooltip-grid span {
  color: var(--muted);
}

.kline-tooltip-grid strong {
  justify-self: end;
  font-variant-numeric: tabular-nums;
}

.ma-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ma-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  padding: 4px 8px;
  color: #43515e;
  background: #fbfcfd;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ma-controls input {
  width: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
}

.ma-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.ma5 {
  background: #e11d48;
}

.ma10 {
  background: #2563eb;
}

.ma20 {
  background: #b7791f;
}

.ma60 {
  background: #6d28d9;
}

.detail-aside {
  display: grid;
  gap: 14px;
  min-width: 0;
  position: sticky;
  top: 18px;
}

.detail-card .panel-header {
  padding: 14px 15px;
}

.detail-card-body {
  display: grid;
  gap: 10px;
  padding: 14px 15px 16px;
}

.memo-form {
  display: grid;
  gap: 8px;
}

.detail-memo-card.floating {
  position: fixed;
  z-index: 10000;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  box-shadow: 0 22px 56px rgba(31, 41, 51, 0.24);
}

.detail-memo-card.floating .detail-card-body {
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.detail-memo-card.dragging {
  user-select: none;
}

.memo-panel-header {
  align-items: start;
}

.memo-window-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.memo-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: #45515e;
  background: #ffffff;
  font-size: 12px;
  font-weight: 900;
  cursor: grab;
}

.memo-drag-handle:hover,
.memo-drag-handle:focus {
  border-color: rgba(15, 118, 110, 0.45);
  color: var(--accent-strong);
  background: #eaf7f5;
  outline: none;
}

.detail-memo-card.dragging .memo-drag-handle {
  cursor: grabbing;
}

.memo-dock-btn {
  display: none;
}

.detail-memo-card.floating .memo-dock-btn {
  display: inline-flex;
}

.memo-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.memo-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.memo-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.memo-item p {
  margin: 0;
  color: #34404b;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

.detail-level-card .detail-card-body {
  gap: 12px;
  padding: 10px 12px 12px;
}

.detail-mini-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfd;
}

.detail-mini-card.matched {
  border-color: rgba(15, 118, 110, 0.38);
  background: #eef9f7;
}

.detail-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-mini-head strong {
  font-size: 14px;
}

.detail-mini-head span {
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
}

.detail-mini-card p {
  margin: 0;
  color: #4f5d69;
  font-size: 13px;
  line-height: 1.5;
}

.pattern-source-link {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
}

.pattern-source-link:hover {
  text-decoration: underline;
}

.detail-aside .detail-mini-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 12px;
}

.detail-aside .detail-mini-card .tag-line {
  display: none;
}

.extreme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.detail-extreme-card .extreme-grid {
  grid-template-columns: repeat(4, minmax(132px, 1fr));
}

.level-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.pattern-level-section {
  display: grid;
  gap: 9px;
  margin-bottom: 4px;
}

.pattern-level-section h4,
.level-column h4 {
  margin: 0;
  color: #34404b;
  font-size: 13px;
}

.pattern-level-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.level-column {
  display: grid;
  align-content: start;
  gap: 8px;
}

.level-row-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 58px;
  gap: 7px;
  border: 1px solid var(--soft-line);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 7px 8px;
  background: #fbfcfd;
  color: inherit;
  text-align: left;
}

button.level-row:hover {
  border-color: #b9c5ce;
  background: #f4f8fa;
}

.level-row.muted-line {
  opacity: 0.48;
  background: #f2f4f6;
}

.level-row.muted-line strong {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.level-row.support {
  border-left-color: var(--green);
}

.level-row.resistance {
  border-left-color: var(--red);
}

.level-row.pattern-level {
  background: #f8fbff;
  border-left-color: var(--blue);
}

.level-row.pattern-level.lower {
  background: #fffaf1;
  border-left-color: var(--amber);
}

.level-row strong,
.level-row span {
  display: block;
}

.level-row > div {
  min-width: 0;
}

.level-row strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-row span {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 3px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.level-row small {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 3px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: #596775;
  font-size: 10px;
  line-height: 1.25;
}

.level-row em {
  color: var(--accent);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.compact-empty {
  padding: 16px;
  font-size: 12px;
}

.extreme-block {
  min-width: 0;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}

.extreme-block span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.extreme-block strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
  line-height: 1.2;
}

.extreme-block em {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

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

.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 8px;
}

.info-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.info-list strong {
  font-size: 13px;
  text-align: right;
}

.detail-tag-section {
  display: grid;
  gap: 7px;
}

.detail-tag-section > strong {
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-header {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-row,
  .stats-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .alpha-rank-grid {
    grid-template-columns: 1fr;
  }

  .factor-lab-layout,
  .factor-lab-detail-grid {
    grid-template-columns: 1fr;
  }

  .factor-lab-horizon-grid,
  .factor-lab-diagnostics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .expectation-impact-grid,
  .expectation-event-impacts {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    grid-template-columns: 1fr;
  }

  .detail-aside {
    position: static;
  }

  .chart-panel {
    min-height: 520px;
  }

  .chart-control-stack {
    justify-items: start;
    min-width: 0;
    width: 100%;
  }

  .detail-chart-workspace {
    grid-template-columns: 1fr;
  }

  .detail-peer-panel {
    border-right: 0;
    border-bottom: 1px solid var(--soft-line);
  }

  .detail-peer-list {
    max-height: 220px;
  }

  .daily-chart {
    height: 460px;
  }

  .detail-extreme-card .extreme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .level-grid {
    grid-template-columns: 1fr;
  }

  .level-row-grid,
  .pattern-level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1500px) and (min-width: 981px) {
  .level-row-grid,
  .pattern-level-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .workspace-header h2 {
    font-size: 24px;
  }

  .toolbar label,
  .stats-controls label,
  .expectation-list-controls label {
    width: calc(50% - 5px);
  }

  .expectation-form {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .expectation-form-header,
  .expectation-list-header,
  .expectation-draft-title,
  .expectation-event-head {
    align-items: stretch;
    flex-direction: column;
  }

  .expectation-actions,
  .expectation-list-controls {
    width: 100%;
  }

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

  .factor-lab-horizon-grid,
  .factor-lab-diagnostics {
    grid-template-columns: 1fr;
  }

  .expectation-source-list {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .secondary-btn,
  .primary-btn {
    width: 100%;
  }

  .daily-chart {
    height: 380px;
  }

  .extreme-grid {
    grid-template-columns: 1fr;
  }

  .level-row-grid,
  .pattern-level-grid {
    grid-template-columns: 1fr;
  }
}

/* Nansen-inspired dark analytics skin */
:root {
  --bg: #05090e;
  --panel: #08131c;
  --panel-raised: #0b1721;
  --panel-soft: #0e1d28;
  --ink: #eef5f7;
  --muted: #8091a3;
  --line: #203544;
  --soft-line: rgba(55, 85, 103, 0.56);
  --accent: #20f2a3;
  --accent-strong: #00d98f;
  --accent-soft: rgba(32, 242, 163, 0.11);
  --red: #ff5c6a;
  --green: #23d0a3;
  --amber: #f5b847;
  --blue: #7c86ff;
  --violet: #b084ff;
  --shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

html {
  color-scheme: dark;
}

body {
  color: var(--ink);
  background:
    linear-gradient(180deg, #071018 0%, #050a10 48%, #04080d 100%);
  letter-spacing: 0;
}

body,
button,
input,
select,
textarea {
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

::selection {
  color: #03100c;
  background: rgba(32, 242, 163, 0.82);
}

.app-shell {
  grid-template-columns: 292px minmax(0, 1fr);
  background: transparent;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  gap: 18px;
  border-right: 1px solid rgba(32, 242, 163, 0.14);
  background: #050b11;
  box-shadow: inset -1px 0 0 rgba(92, 245, 197, 0.04);
}

.sidebar::-webkit-scrollbar,
.detail-peer-list::-webkit-scrollbar,
.memo-list::-webkit-scrollbar,
.mini-table::-webkit-scrollbar,
.backtest-drawer-body::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.sidebar::-webkit-scrollbar-thumb,
.detail-peer-list::-webkit-scrollbar-thumb,
.memo-list::-webkit-scrollbar-thumb,
.mini-table::-webkit-scrollbar-thumb,
.backtest-drawer-body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(82, 119, 140, 0.58);
  background-clip: padding-box;
}

.brand-block {
  align-items: flex-start;
  padding: 4px 4px 18px;
  border-bottom: 1px solid var(--soft-line);
}

.brand-mark {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(32, 242, 163, 0.52);
  color: var(--accent);
  background: #06120f;
  box-shadow: 0 0 0 3px rgba(32, 242, 163, 0.08);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
  inset: 9px;
  border: 1px solid rgba(32, 242, 163, 0.42);
  border-radius: 50%;
}

.brand-mark::after {
  transform: rotate(62deg) scaleX(1.46);
}

.brand-block h1 {
  color: #f5fbfd;
  font-size: 16px;
  letter-spacing: 0;
}

.brand-block p,
.muted,
.pattern-desc,
.detail-company-summary,
.alpha-decision-main p,
.alpha-decision-note,
.expectation-impact p,
.expectation-event-thesis,
.memo-item p,
.detail-mini-card p,
.level-row small {
  color: var(--muted);
}

.section-label,
label,
.stats-table-title h4,
.pattern-level-section h4,
.level-column h4,
.detail-tag-section > strong {
  color: #c7d4dd;
}

.library-tabs,
.segmented-control {
  border-color: var(--soft-line);
  background: #061019;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.015);
}

.library-tabs button,
.segmented-control button {
  color: #8da0ae;
}

.library-tabs button.active,
.segmented-control button.active {
  color: #02130d;
  background: var(--accent);
}

.sidebar-action,
.pattern-item,
.metric,
.panel,
.stat-card,
.mini-table,
.backtest-chart-header,
.backtest-chart,
.alpha-quality-strip,
.alpha-decision-board,
.alpha-decision-grid > div,
.factor-lab-horizon-grid > div,
.factor-lab-diagnostics > div,
.strategy-chart,
.strategy-plan-item,
.backtest-drawer,
.backtest-detail-cards div,
.expectation-source-item,
.expectation-draft-block,
.expectation-event,
.expectation-impact,
.expectation-rule-list div,
.expectation-event-impacts div,
.expectation-stock-link,
.detail-peer-panel,
.detail-peer-item b,
.ma-controls label,
.memo-drag-handle,
.memo-item,
.detail-mini-card,
.level-row,
.extreme-block,
.kline-tooltip,
.strategy-chart-tooltip {
  border-color: var(--soft-line);
  color: var(--ink);
  background: var(--panel);
}

.panel,
.metric,
.stat-card,
.alpha-decision-board,
.expectation-event,
.expectation-impact,
.detail-mini-card {
  box-shadow: var(--shadow);
}

.pattern-item,
.stat-card,
.metric,
.panel,
.detail-mini-card,
.expectation-event,
.expectation-impact,
.strategy-plan-item {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)),
    var(--panel);
}

.pattern-item:hover,
.sidebar-action:hover,
.secondary-btn:hover,
.expectation-source-item:hover,
.expectation-stock-link:hover,
button.level-row:hover,
.detail-peer-item:hover {
  border-color: rgba(32, 242, 163, 0.34);
  color: #f8fdff;
  background: #0d1c27;
}

.pattern-item.active,
.sidebar-action.active,
.factor-table tr.active,
.factor-lab-table tr.active,
.expectation-event-actions .active-status,
.detail-peer-item.active {
  border-color: rgba(32, 242, 163, 0.5);
  color: #f8fdff;
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 rgba(32, 242, 163, 0.9);
}

.pattern-status,
.sidebar-action strong,
.pattern-status.implemented {
  color: #03120d;
  background: var(--accent);
}

.pattern-status.planned,
.lab-warning,
.factor-lab-warning-list span,
.risk-pill {
  color: #ffd891;
  background: rgba(245, 184, 71, 0.14);
}

.pattern-tags span,
.reason-pill,
.risk-pill,
.lab-status,
.expectation-status-badge,
.holding-status-badge,
.factor-name-button em {
  border: 1px solid rgba(84, 116, 137, 0.54);
  color: #9fb0bf;
  background: rgba(9, 22, 32, 0.92);
}

.reason-pill,
.concept-pill,
.lab-status.watching {
  color: var(--accent);
  background: rgba(32, 242, 163, 0.1);
}

.concept-pill:hover,
.concept-pill:focus-visible {
  color: #03120d;
  background: var(--accent);
  outline-color: rgba(32, 242, 163, 0.28);
}

input,
select,
textarea {
  border-color: var(--line);
  color: #e9f2f6;
  background: #07111a;
}

input::placeholder,
textarea::placeholder {
  color: #617486;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(32, 242, 163, 0.72);
  outline: 2px solid rgba(32, 242, 163, 0.16);
}

input[type="checkbox"] {
  accent-color: var(--accent);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.75);
}

.primary-btn,
.secondary-btn,
.favorite-btn,
.factor-lab-status-actions button {
  border: 1px solid transparent;
  box-shadow: none;
}

.primary-btn {
  color: #03120d;
  background: var(--accent);
}

.primary-btn:hover {
  color: #03120d;
  background: #6affca;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.favorite-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.secondary-btn,
.favorite-btn,
.factor-lab-status-actions button {
  border-color: var(--line);
  color: #c8d6df;
  background: #0a1620;
}

.favorite-btn,
.favorite-btn[aria-pressed="true"] {
  border-color: rgba(245, 184, 71, 0.44);
  color: #ffcf75;
  background: rgba(245, 184, 71, 0.1);
}

.progress-line,
.score-line {
  background: #111f2b;
}

.progress-line span,
.score-line span {
  background: linear-gradient(90deg, var(--accent), #7c86ff);
}

.workspace {
  gap: 16px;
  padding: 18px 22px 28px;
  background:
    linear-gradient(180deg, rgba(16, 37, 50, 0.62), rgba(4, 8, 13, 0) 260px);
}

.market-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 54px;
  border: 1px solid rgba(32, 242, 163, 0.18);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(6, 15, 23, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.topbar-identity {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px 12px;
  min-width: 0;
}

.topbar-identity strong {
  color: #f6fbfd;
  font-size: 15px;
}

.topbar-identity > span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-kicker,
.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.workspace-header {
  align-items: end;
  min-height: 74px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 16px;
}

.workspace-header h2 {
  color: #f5fbfd;
  font-size: clamp(24px, 2.2vw, 34px);
  letter-spacing: 0;
}

.panel-header {
  border-bottom-color: var(--soft-line);
  background: rgba(255, 255, 255, 0.012);
}

.panel-header h3,
.detail-mini-head strong,
.detail-peer-name,
.stock-cell strong,
.stat-stock-link strong,
.factor-name-button strong,
.expectation-draft-title h3,
.expectation-event h3,
.expectation-impact-head strong,
.stats-block-header h3,
.alpha-decision-main h4,
.alpha-quality-strip strong,
.alpha-decision-grid strong,
.factor-lab-horizon-grid strong,
.factor-lab-diagnostics strong,
.extreme-block strong,
.info-list strong {
  color: #eef7fb;
}

table {
  color: #dbe8ee;
}

th {
  border-bottom-color: var(--soft-line);
  color: #92a4b4;
  background: #07111a;
}

td {
  border-bottom-color: rgba(55, 85, 103, 0.38);
}

tbody tr:hover {
  background: rgba(32, 242, 163, 0.045);
}

.stock-cell span,
.stock-link span,
.stat-stock-link span,
.detail-peer-code,
.info-list span,
.expectation-source-item span,
.expectation-stock-link span,
.expectation-meta-line span,
.alpha-decision-main span,
.alpha-decision-grid span,
.stat-card span,
.metric span,
.backtest-detail-cards span,
.factor-lab-horizon-grid span,
.factor-lab-diagnostics span,
.extreme-block span,
.kline-tooltip-grid span {
  color: var(--muted);
}

.stock-link:hover strong,
.pattern-source-link,
.detail-mini-head span {
  color: var(--accent);
}

.metric strong,
.stat-card strong {
  color: #f6fbfd;
}

.up,
.pattern-performance .up,
.holding-status-badge.new {
  color: var(--red);
}

.down,
.pattern-performance .down,
.holding-status-badge.sold {
  color: var(--green);
}

.pattern-performance .up,
.alpha-table tr.strong,
.alpha-decision-board.strong,
.alpha-decision-grid > div.strong,
.holding-status-badge.new {
  border-color: rgba(255, 92, 106, 0.3);
  background: rgba(255, 92, 106, 0.085);
}

.pattern-performance .down,
.alpha-table tr.watch,
.alpha-decision-board.watch,
.alpha-decision-grid > div.watch,
.expectation-impact.strong,
.holding-status-badge.sold {
  border-color: rgba(32, 242, 163, 0.3);
  background: rgba(32, 242, 163, 0.08);
}

.pattern-performance .flat,
.pattern-performance.pending span,
.segmented-control button.no-data:not(.active),
.level-row.muted-line {
  color: #728497;
  background: rgba(82, 104, 122, 0.12);
}

.strategy-performance span:not(.up):not(.down):not(.flat),
.strategy-performance .flat {
  border-color: rgba(126, 155, 176, 0.34);
  color: #9fb0bd;
  background: rgba(8, 22, 32, 0.78);
}

.alpha-table tr.neutral {
  background: transparent;
}

.lab-status.accepted {
  color: #03120d;
  background: var(--green);
}

.lab-status.rejected {
  color: #18070a;
  background: var(--red);
}

.lab-status.archived {
  color: #d1dde6;
  background: #314454;
}

.backtest-drawer {
  border-left-color: rgba(32, 242, 163, 0.18);
  background: #061019;
  box-shadow: -22px 0 46px rgba(0, 0, 0, 0.42);
}

.backtest-drawer-header,
.detail-chart-workspace,
.detail-peer-head,
.detail-peer-item,
.info-list div {
  border-color: var(--soft-line);
}

.detail-peer-item.active {
  box-shadow: inset 3px 0 0 var(--blue);
}

.strategy-chart-tooltip,
.kline-tooltip {
  border-color: rgba(32, 242, 163, 0.24);
  background: rgba(7, 17, 26, 0.96);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.38);
}

.strategy-chart-tooltip em {
  color: #ffd891;
}

.ma5 {
  background: #ff4d70;
}

.ma10 {
  background: var(--blue);
}

.ma20 {
  background: var(--amber);
}

.ma60 {
  background: var(--violet);
}

.level-row.support,
.strategy-plan-item.sell {
  border-left-color: var(--green);
}

.level-row.resistance,
.strategy-plan-item.buy {
  border-left-color: var(--red);
}

.level-row.pattern-level,
.strategy-plan-item.hold {
  border-left-color: var(--blue);
}

.level-row.pattern-level.lower,
.strategy-plan-item.skip {
  border-left-color: var(--amber);
}

.level-row em {
  color: var(--accent);
}

.empty {
  color: #7f92a4;
}

.detail-mini-card.matched,
.level-row.pattern-level,
.level-row.pattern-level.lower,
.hot-news-source-item,
.strategy-sold-row,
.holding-status-badge.hold,
.expectation-score,
.expectation-event-score {
  border-color: rgba(32, 242, 163, 0.24);
  color: var(--ink);
  background: rgba(32, 242, 163, 0.07);
}

.factor-lab-status-actions button.active,
.memo-drag-handle:hover,
.memo-drag-handle:focus,
.hot-news-source-item:hover {
  border-color: rgba(32, 242, 163, 0.45);
  color: #03120d;
  background: var(--accent);
  outline: none;
}

.strategy-actions input,
.expectation-list-controls select,
.expectation-form input,
.expectation-form select,
.expectation-form textarea {
  border-color: var(--line);
  color: #e9f2f6;
  background: #07111a;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(32, 242, 163, 0.14);
  }

  .market-topbar,
  .workspace-header {
    align-items: stretch;
    flex-direction: column;
  }

}

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .market-topbar {
    min-height: auto;
  }

  .topbar-identity {
    display: grid;
    gap: 4px;
  }

  .topbar-identity > span:last-child {
    white-space: normal;
  }
}
