:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #64748b;
  --line: #d8e0e8;
  --soft: #f4f7fa;
  --panel: #ffffff;
  --accent: #1769aa;
  --accent-soft: #e8f2fb;
  --danger: #b42318;
  --success: #067647;
  --radius: 8px;
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--ink);
  background: #eef2f6;
  font-size: 14px;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.platform-header {
  flex: 0 0 auto;
  color: #fff;
  background: #102a43;
  border-bottom: 1px solid #254766;
}

.header-inner, .platform-shell {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding-left: 16px;
  padding-right: 16px;
}

.header-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-primary { display: flex; align-items: center; gap: 20px; min-width: 0; }
.header-brand { min-width: 0; }
.header-primary .platform-tabs { flex-shrink: 0; }

.eyebrow {
  margin: 0 0 3px;
  color: #7895b2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.platform-header .eyebrow { color: #a9c5de; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 21px; }
h2 { margin-bottom: 0; font-size: 17px; }
h3 { margin-bottom: 0; font-size: 14px; }

.header-actions, .editor-actions, .panel-heading, .result-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; min-width: 0; }
.backtest-period-actions { display: inline-flex; align-items: center; gap: 4px; }
.backtest-period-actions .button { min-width: 52px; padding-left: 7px; padding-right: 7px; }

.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.strategy-meta-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border: 1px solid; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.strategy-meta-badge.kind { color: #0d4f83; background: var(--accent-soft); border-color: #a9cce7; }
.strategy-meta-badge.universe { color: #46627a; background: #e7eef5; border-color: #c8d4df; }
.strategy-meta-badge.status.warning { color: #805b13; background: #fff8e6; border-color: #ead7a5; }
.strategy-meta-badge.status.good { color: var(--success); background: #e9f7ef; border-color: #a8dfc2; }
.strategy-meta-badge.status.danger { color: var(--danger); background: #fff0ee; border-color: #f1b8b2; }
.status-pill, .mode-pill, .result-count {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #e7eef5;
  color: #46627a;
}

.status-pill.ready { color: var(--success); background: #e9f7ef; }
.status-pill.error { color: var(--danger); background: #fff0ee; }
.legacy-link { color: #fff; font-size: 13px; text-decoration: none; }
.legacy-link:hover { text-decoration: underline; }
.platform-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.platform-tab { padding: 6px 12px; color: #c7d9e9; border-radius: 5px; text-decoration: none; font-weight: 700; }
.platform-tab:hover, .platform-tab.is-active { color: #fff; background: #254766; }

.platform-shell { flex: 1 1 auto; min-height: 0; overflow: hidden; padding-top: 12px; padding-bottom: 12px; }
.intro-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  color: #24445e;
  background: var(--accent-soft);
  border: 1px solid #c8deef;
  border-radius: var(--radius);
}
.intro-strip span { margin-left: 8px; color: #557188; }
.intro-note { color: #805b13; font-size: 12px; }
.platform-message {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  width: min(440px, calc(100vw - 32px));
  margin: 0;
  padding: 11px 14px;
  border: 1px solid #ead7a5;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(16 42 67 / 18%);
  background: #fff8e6;
  color: #805b13;
  line-height: 1.45;
}
.platform-message.error { border-color: #f1b8b2; color: var(--danger); background: #fff0ee; }
.platform-message.success { border-color: #a8dfc2; color: var(--success); background: #e9f7ef; }

.platform-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

.panel { min-width: 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-heading { min-width: 0; justify-content: space-between; margin-bottom: 12px; }
.panel-heading > *, .result-heading > * { min-width: 0; }
.editor-heading { align-items: flex-start; }
.mobile-editor-title, .mobile-field-label { display: none; }
.editor-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.strategy-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.strategy-sidebar > .panel-heading,
.strategy-sidebar > label,
.strategy-sidebar > input,
.strategy-sidebar > .strategy-sort-control { flex: 0 0 auto; }
.search-label, label > span, legend { display: block; margin-bottom: 4px; color: #425466; font-size: 12px; font-weight: 700; }
.text-input, .code-input, .document-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b8c6d3;
  border-radius: 5px;
  outline: 0;
}
.text-input { min-height: 34px; padding: 6px 8px; }
.text-input:focus, .code-input:focus, .document-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px #d9ecfa; }
.strategy-sort-control { display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; margin-top: 8px; }
.strategy-sort-control .search-label { flex: 0 0 auto; margin: 0; }
.strategy-sort-options { display: flex; flex: 1; flex-wrap: nowrap; min-width: 0; align-items: center; justify-content: space-between; gap: 1px; }
.strategy-sort-button { white-space: nowrap; min-height: 26px; padding: 2px 2px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; font-size: 11px; font-weight: 700; }
.strategy-sort-button:hover, .strategy-sort-button:focus-visible { color: var(--accent); background: var(--accent-soft); }
.strategy-sort-button.is-active { color: var(--accent); background: var(--accent-soft); }
.strategy-list { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; margin-top: 10px; }
.strategy-item-row { position: relative; display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
.strategy-pagination {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.strategy-list-count { color: var(--muted); font-size: 11px; }
.strategy-pagination .button { min-height: 28px; padding: 3px 8px; font-size: 12px; }
.strategy-item { flex: 1 1 auto; min-width: 0; width: 100%; display: block; padding: 9px; text-align: left; color: var(--ink); background: #fff; border: 1px solid transparent; }
.strategy-item:hover { background: var(--soft); }
.strategy-item.selected { color: #0d4f83; background: var(--accent-soft); border-color: #a9cce7; }
.strategy-item strong, .strategy-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strategy-item strong { padding-right: 29px; }
.strategy-item-row .strategy-item strong { padding-right: 61px; }
.strategy-item-row.is-adopted .strategy-item strong { padding-right: 93px; }
.strategy-item small { display: flex; gap: 8px; margin-top: 3px; color: var(--muted); font-size: 11px; }
.strategy-item .strategy-return.positive { color: var(--success); font-weight: 700; }
.strategy-item .strategy-return.negative { color: var(--danger); font-weight: 700; }
.strategy-bookmark-button { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 5px; font-size: 20px; line-height: 1; }
.strategy-trading-button { position: absolute; top: 6px; right: 38px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--accent); background: transparent; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; font-weight: 700; text-decoration: none; }
.strategy-adoption-indicator { position: absolute; top: 6px; right: 70px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--success); }
.strategy-trading-button:hover { background: var(--accent-soft); }
.strategy-trading-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.strategy-bookmark-button:hover, .strategy-bookmark-button.is-bookmarked { color: #a56b00; background: transparent; }
.strategy-bookmark-button:focus-visible { color: #a56b00; background: transparent; outline: 2px solid var(--accent); outline-offset: 1px; }
.empty-copy { padding: 12px 4px; color: var(--muted); font-size: 13px; }

.workspace-column, .workspace-column > *, .platform-grid > * { min-width: 0; }
.workspace-column { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-height: 0; align-content: start; overflow-y: auto; overscroll-behavior-y: contain; }
.form-grid { display: grid; gap: 8px; }
.form-grid > label, .rule-grid > fieldset, .full-field, .backtest-controls > * { min-width: 0; }
.basic-fields { grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(112px, 132px)); align-items: end; }
.one-field { grid-template-columns: minmax(0, 1fr); margin-top: 8px; }
fieldset { min-width: 0; margin: 12px 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
legend { padding: 0 4px; margin-bottom: 0; }
.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; }
.field-help { margin: 4px 0 6px; color: var(--muted); font-size: 11px; }
.code-input, .definition-preview { padding: 8px; font-family: "D2Coding", "Cascadia Code", monospace; font-size: 12px; line-height: 1.5; }
.code-input { resize: vertical; }
.full-field { display: block; margin-top: 12px; }
.document-input { display: block; padding: 8px; line-height: 1.5; resize: vertical; }
.formula-details { min-width: 0; margin-top: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.formula-details > summary { display: flex; align-items: center; gap: 8px; padding: 9px 10px; color: #425466; cursor: pointer; font-size: 12px; font-weight: 700; }
.formula-details > summary small { color: var(--muted); font-size: 11px; font-weight: 400; }
.formula-details[open] > summary { border-bottom: 1px solid var(--line); }
.formula-details > .form-grid, .formula-details > .rule-grid { margin-right: 10px; margin-left: 10px; }
.formula-details > .rule-grid { margin-bottom: 10px; }
.definition-details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.definition-details summary { color: #425466; cursor: pointer; font-size: 12px; font-weight: 700; }
.definition-preview { max-height: 220px; margin: 8px 0 0; overflow: auto; overflow-wrap: anywhere; color: #29465e; background: #f7fafc; border: 1px solid var(--line); border-radius: 5px; white-space: pre-wrap; }
.editor-actions { flex-wrap: wrap; margin-top: 12px; }
.button { min-height: 32px; padding: 5px 10px; border: 1px solid #9cb0c0; border-radius: 5px; font-weight: 700; }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.secondary { color: #29465e; background: #fff; }
.button.danger { color: var(--danger); background: #fff; border-color: #e5b5b5; }
.button.danger:hover { background: #fff0ee; }
.button:disabled { cursor: not-allowed; opacity: .55; }
.catalog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.syntax-help-dialog { position: fixed; inset: auto; left: 50%; top: 50%; width: min(900px, calc(100vw - 24px)); max-width: 900px; max-height: calc(100vh - 24px); margin: 0; padding: 0; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); transform: translate(-50%, -50%); box-shadow: 0 16px 40px rgb(16 42 67 / 24%); }
.syntax-help-dialog::backdrop { background: rgb(16 42 67 / 48%); }
.syntax-help-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px; cursor: move; user-select: none; touch-action: none; border-bottom: 1px solid var(--line); background: var(--soft); }
.syntax-help-header.is-dragging { cursor: grabbing; }
.syntax-help-header .button { cursor: pointer; touch-action: auto; }
.syntax-help-header .eyebrow { color: var(--muted); }
.syntax-help-body { max-height: calc(100vh - 110px); overflow: auto; padding: 14px 16px 18px; }
.syntax-help-body h3 { margin: 16px 0 6px; color: #29465e; }
.syntax-help-body h3:first-child { margin-top: 0; }
.help-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; }
.syntax-help-table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 12px; }
.syntax-help-table th, .syntax-help-table td { padding: 7px 8px; text-align: left; vertical-align: top; white-space: normal; border-bottom: 1px solid #e7edf2; }
.syntax-help-table th { color: #425466; background: #f6f8fa; font-size: 11px; }
.syntax-help-table tr:last-child td { border-bottom: 0; }
.syntax-help-code { margin: 0; padding: 9px 10px; color: #29465e; background: #f7fafc; border: 1px solid var(--line); border-radius: 5px; line-height: 1.7; }
.syntax-help-example { margin: 0; padding: 10px; overflow-x: auto; color: #29465e; background: #f7fafc; border: 1px solid var(--line); border-radius: 5px; font: 12px/1.6 "D2Coding", "Cascadia Code", monospace; white-space: pre; }

.preview-inputs { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: start; }
.indicator-field { grid-column: 2; }
.available-dates-field { grid-column: 3; }
.json-field { min-width: 0; }
.backtest-controls { display: grid; grid-template-columns: 150px 150px minmax(0, 1fr); gap: 8px; align-items: end; }
.backtest-title-row { display: flex; align-items: center; gap: 6px; }
.backtest-data-note { min-height: 34px; padding: 6px 8px; color: #425466; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; }
.backtest-data-note strong, .backtest-data-note span { display: block; }
.backtest-data-note strong { font-size: 11px; }
.backtest-data-note span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.backtest-help { position: relative; z-index: 3; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px; height: 24px; }
.tooltip-trigger { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; padding: 0; color: #0d4f83; background: var(--accent-soft); border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px #a9cce7; font-size: 15px; font-style: normal; font-weight: 800; line-height: 1; }
.tooltip-trigger:focus-visible { outline: 0; box-shadow: inset 0 0 0 2px var(--accent); }
.backtest-help-tooltip { position: absolute; left: 0; top: calc(100% + 5px); z-index: 20; width: min(520px, calc(100vw - 40px)); max-height: min(360px, calc(100vh - 32px)); padding: 10px 12px; overflow: auto; color: #425466; background: #fff; border: 1px solid #a9cce7; border-radius: 6px; box-shadow: 0 8px 22px rgb(16 42 67 / 18%); font-size: 12px; line-height: 1.5; opacity: 0; pointer-events: none; visibility: hidden; transform: translateY(-3px); transition: opacity .12s ease, transform .12s ease, visibility .12s ease; }
.backtest-tooltip:hover .backtest-help-tooltip, .backtest-tooltip:focus-within .backtest-help-tooltip, .backtest-tooltip.is-open .backtest-help-tooltip { opacity: 1; pointer-events: auto; visibility: visible; transform: translateY(0); }
.backtest-help-tooltip strong { display: block; margin-bottom: 4px; color: #29465e; }
.backtest-help-tooltip p { margin: 0; }
.backtest-help-tooltip > div { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); }
.backtest-help-tooltip > div > span { color: #29465e; font-weight: 700; }
.backtest-help-tooltip ul { margin: 4px 0 0; padding-left: 18px; }
.backtest-history { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.backtest-history-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.trade-heading-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.backtest-history-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.history-item { min-width: 0; padding: 8px; text-align: left; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 5px; }
.history-item:hover, .history-item.selected { color: #0d4f83; background: var(--accent-soft); border-color: #a9cce7; }
.history-item strong, .history-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item strong { font-size: 12px; }
.history-item span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.history-item .history-return { display: inline; margin-top: 0; font-size: inherit; font-weight: 700; }
.history-item .history-return.positive { color: var(--success); }
.history-item .history-return.negative { color: var(--danger); }
.history-item .giveback-value { color: var(--danger); font-weight: 800; }
.backtest-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.backtest-summary > div { min-width: 0; padding: 8px; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; }
.backtest-summary span, .backtest-summary strong { display: block; }
.backtest-summary span { color: var(--muted); font-size: 11px; }
.backtest-summary strong { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.equity-trend-section { min-width: 0; margin-top: 12px; padding: 10px; background: #fbfcfd; border: 1px solid var(--line); border-radius: 5px; }
.equity-trend-section .result-heading { margin-bottom: 4px; }
.equity-trend-section .result-heading .field-help { margin: 0; font-weight: 400; }
.equity-chart-legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 2px; color: var(--muted); font-size: 11px; }
.chart-legend-swatch { display: inline-block; width: 18px; height: 0; margin: 0 4px 3px 0; vertical-align: middle; border-top: 3px solid; }
.chart-legend-equity { border-color: var(--accent); }
.chart-legend-market { border-color: #7b8794; border-top-style: dashed; }
.equity-chart-wrap { width: 100%; min-width: 0; min-height: 300px; overflow: visible; }
.equity-chart-svg { display: block; width: 100%; height: auto; min-height: 250px; overflow: visible; touch-action: none; }
.chart-grid { stroke: #e1e8ed; stroke-width: 1; }
.chart-grid-horizontal { stroke-dasharray: 3 3; }
.chart-grid-vertical { stroke: #edf1f4; stroke-dasharray: 2 4; }
.chart-axis, .chart-tick { stroke: #aebbc5; stroke-width: 1; }
.chart-right-axis, .chart-right-tick { stroke: #9aa9b5; stroke-width: 1; }
.chart-label { fill: var(--muted); font-family: inherit; font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-y-tick { paint-order: stroke; stroke: #fbfcfd; stroke-linejoin: round; stroke-width: 4px; }
.chart-y-right-tick { paint-order: stroke; stroke: #fbfcfd; stroke-linejoin: round; stroke-width: 4px; }
.chart-axis-title { fill: var(--muted); font-family: inherit; font-size: 10px; font-weight: 700; }
.chart-line { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.chart-market-line { fill: none; stroke: #7b8794; stroke-dasharray: 5 4; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; opacity: .72; }
.chart-hit-area { cursor: crosshair; fill: transparent; pointer-events: all; }
.chart-hover-group { pointer-events: none; visibility: hidden; }
.chart-hover-group.is-visible { visibility: visible; }
.chart-hover-line, .chart-hover-horizontal-line { stroke: var(--accent); stroke-dasharray: 4 3; stroke-width: 1; }
.chart-hover-point { fill: #fff; stroke: var(--accent); stroke-width: 2.5; }
.chart-hover-rate-point { fill: #fff; stroke: #7b8794; stroke-width: 2; }
.chart-hover-label-box { fill: var(--accent-soft); fill-opacity: .98; rx: 3; stroke: var(--accent); stroke-width: 1; }
.chart-hover-label-text { fill: #174b60; font-family: inherit; font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 800; pointer-events: none; }
.equity-hover-details { margin-top: 8px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 5px; }
.equity-hover-details > .empty-copy { padding: 3px 0; }
.equity-hover-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.equity-hover-heading strong { color: #29465e; }
.equity-hover-heading span { color: var(--muted); font-size: 11px; }
.equity-hover-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.equity-hover-card { min-width: 0; padding: 7px; background: var(--soft); border: 1px solid var(--line); border-radius: 5px; }
.equity-hover-card h4 { margin: 0 0 5px; color: #425466; font-size: 12px; }
.equity-hover-list { margin: 0; padding-left: 18px; font-size: 12px; }
.equity-hover-list li + li { margin-top: 2px; }
.equity-hover-list .muted { color: var(--muted); }
.equity-hover-table-wrap { max-width: 100%; overflow-x: auto; }
.equity-hover-table { font-size: 11px; }
.equity-hover-table th, .equity-hover-table td { padding: 4px 5px; }
.backtest-result-grid { margin-top: 12px; }
.buy { color: var(--success); font-weight: 700; }
.sell { color: var(--danger); font-weight: 700; }
.result-grid, .result-grid > * { min-width: 0; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.backtest-trades-grid { grid-template-columns: minmax(0, 1fr); }
.result-heading { justify-content: space-between; margin-bottom: 6px; flex-wrap: wrap; }
.table-wrap { max-width: 100%; min-width: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 7px 8px; text-align: left; border-bottom: 1px solid #e7edf2; white-space: nowrap; }
th { color: #425466; background: #f6f8fa; font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
.condition-summary { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1100px) {
  .basic-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backtest-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backtest-data-note { grid-column: 1 / -1; }
  .preview-inputs > label:first-child { grid-column: 1 / -1; }
  .indicator-field, .available-dates-field { grid-column: auto; }
  .backtest-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .backtest-history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .platform-shell { overflow-y: auto; overscroll-behavior-y: contain; }
  .platform-grid { grid-template-columns: minmax(0, 1fr); height: auto; }
  .strategy-sidebar { position: static; height: auto; }
  .workspace-column { overflow: visible; }
  .strategy-list { flex: 0 0 auto; max-height: 220px; }
  .result-grid, .rule-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  html { overflow-x: hidden; }
  body { width: 100%; min-width: 0; max-width: 100%; overflow-x: clip; }
  .header-inner, .platform-shell { padding-left: 10px; padding-right: 10px; }
  .header-inner > *, .intro-strip > * { min-width: 0; max-width: 100%; }
  .panel-heading { flex-wrap: wrap; }
  .editor-heading { flex-direction: row; align-items: center; margin-bottom: 8px; }
  .editor-heading .eyebrow, #editor-title, #editor-mode, #strategy-kind-badge, #universe-badge { display: none; }
  .mobile-editor-title { display: block; font-size: 14px; }
  .desktop-field-label { display: none; }
  .mobile-field-label { display: inline; }
  .editor-heading-actions { width: auto; justify-content: flex-end; gap: 6px; }
  .editor-panel > fieldset { margin: 0; padding: 0; border: 0; }
  .editor-panel > fieldset > legend { display: none; }
  .formula-details > summary small { display: none; }
  .header-actions, .catalog-actions, .strategy-pagination { min-width: 0; flex-wrap: wrap; }
  .editor-actions .button { flex: 1 1 140px; }
  .button { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .strategy-meta-badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  h1, h2, h3, .field-help, .backtest-data-note, .platform-message, .equity-hover-details { overflow-wrap: anywhere; }
  .text-input, .code-input, .document-input { font-size: 16px; }
  /* Safari의 날짜 입력 기본 너비와 입력 시 자동 확대를 방지한다. */
  .text-input[type="date"] { display: block; box-sizing: border-box; width: 100%; inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; overflow: hidden; -webkit-appearance: none; appearance: none; }
  .text-input[type="date"]::-webkit-date-and-time-value { min-width: 0; max-width: 100%; text-align: left; }
  .text-input[type="date"]::-webkit-datetime-edit { min-width: 0; max-width: 100%; padding: 0; }
  .formula-details > summary, .equity-hover-heading { flex-wrap: wrap; }
  .header-inner, .intro-strip { align-items: flex-start; flex-direction: column; }
  .header-inner { padding-top: 10px; padding-bottom: 10px; }
  .header-primary { width: 100%; gap: 10px; }
  .header-primary .platform-tab { padding: 6px 8px; font-size: 13px; }
  .backtest-panel > .panel-heading { align-items: flex-start; flex-direction: column; }
  .backtest-panel > .panel-heading .preview-actions { width: 100%; justify-content: flex-start; }
  .basic-fields { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 6px; }
  .basic-fields > label:first-child { grid-column: 1 / -1; }
  .preview-inputs, .backtest-summary, .backtest-history-list { grid-template-columns: minmax(0, 1fr); }
  .backtest-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .backtest-controls > .backtest-data-note { display: none; }
  .backtest-data-note { grid-column: auto; }
  .preview-inputs > label:first-child { grid-column: auto; }
  .equity-hover-grid { grid-template-columns: minmax(0, 1fr); }
  .backtest-help-tooltip { position: fixed; inset: auto 12px 12px; width: auto; max-height: min(360px, calc(100dvh - 24px)); transform: none; }
  .backtest-tooltip:hover .backtest-help-tooltip, .backtest-tooltip:focus-within .backtest-help-tooltip, .backtest-tooltip.is-open .backtest-help-tooltip { transform: none; }
  .equity-chart-wrap { min-height: 250px; }
  .equity-chart-svg { min-height: 220px; }
  .intro-strip { gap: 6px; padding: 8px 10px; }
  .intro-strip span { display: block; margin: 4px 0 0; font-size: 12px; }
  .platform-message { right: 8px; bottom: 8px; width: calc(100vw - 16px); }
}

/* 스크롤 영역의 너비를 유지하고 이동 중에만 손잡이를 표시한다. */
:where(.strategy-list, .workspace-column, .platform-shell, .table-wrap, .help-table-wrap,
  .definition-preview, .syntax-help-body, .syntax-help-example, .backtest-help-tooltip,
  textarea, dialog) {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
:where(.strategy-list, .workspace-column, .platform-shell, .table-wrap, .help-table-wrap,
  .definition-preview, .syntax-help-body, .syntax-help-example, .backtest-help-tooltip,
  textarea, dialog).scrollbar-active {
  scrollbar-color: #94a3b8 transparent;
}
:where(.strategy-list, .workspace-column, .platform-shell, .table-wrap, .help-table-wrap,
  .definition-preview, .syntax-help-body, .syntax-help-example, .backtest-help-tooltip,
  textarea, dialog)::-webkit-scrollbar { width: 6px; height: 6px; }
:where(.strategy-list, .workspace-column, .platform-shell, .table-wrap, .help-table-wrap,
  .definition-preview, .syntax-help-body, .syntax-help-example, .backtest-help-tooltip,
  textarea, dialog)::-webkit-scrollbar-track { background: transparent; }
:where(.strategy-list, .workspace-column, .platform-shell, .table-wrap, .help-table-wrap,
  .definition-preview, .syntax-help-body, .syntax-help-example, .backtest-help-tooltip,
  textarea, dialog)::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; }
:where(.strategy-list, .workspace-column, .platform-shell, .table-wrap, .help-table-wrap,
  .definition-preview, .syntax-help-body, .syntax-help-example, .backtest-help-tooltip,
  textarea, dialog).scrollbar-active::-webkit-scrollbar-thumb { background: #94a3b8; }
:where(.strategy-list, .workspace-column, .platform-shell, .table-wrap, .help-table-wrap,
  .definition-preview, .syntax-help-body, .syntax-help-example, .backtest-help-tooltip,
  textarea, dialog)::-webkit-scrollbar-corner { background: transparent; }

.chart-legend-etf { border-color: #b46b16; border-top-style: dashed; border-top-width: 1px; opacity: 0.55; }
.chart-etf-line { fill: none; stroke: #b46b16; stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.55; stroke-linecap: round; stroke-linejoin: round; }
