:root {
  --bg: #f5f7f8;
  --ink: #17212b;
  --muted: #667381;
  --line: #dce3e7;
  --panel: #ffffff;
  --call: #c93737;
  --put: #21835b;
  --accent: #2357a5;
  --strike: #222a33;
  --soft: #eef3f6;
}

* {
  box-sizing: border-box;
}

html,
body,
button,
input,
select,
textarea,
table {
  font-family: "FZHei-B01S", "FZHeiTi", "方正黑体简体", "方正黑体", "SimHei", sans-serif;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 14px 0 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

h2 {
  font-size: 17px;
  font-weight: 700;
}

p,
small {
  color: var(--muted);
}

.status {
  min-width: 116px;
  text-align: right;
}

.status span {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.userbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.userbar a,
.userbar button,
.primary-btn {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  text-decoration: none;
  padding: 8px 12px;
  cursor: pointer;
}

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

.primary-btn:disabled {
  border-color: #d7dde2;
  background: #e9edf0;
  color: #9ca6ae;
  cursor: default;
}

.filters {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  margin-bottom: 3px;
}

.filters-title {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 15px;
  line-height: 30px;
  white-space: nowrap;
}

.filters label {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.filters label:nth-of-type(1) .date-picker {
  width: 152px;
}

.filters label:nth-of-type(2) select {
  width: 105px;
}

.filters label:nth-of-type(3) select {
  width: 235px;
}

.underlying-close {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.underlying-close strong {
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.underlying-chart-panel {
  width: 100%;
  margin: 0 0 3px;
  overflow: hidden;
  background: var(--panel);
}

.underlying-chart-panel canvas {
  display: block;
  width: 100%;
  height: clamp(210px, 29vh, 340px);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.underlying-chart-panel canvas.dragging {
  cursor: grabbing;
}

.filters label:nth-of-type(4) select {
  width: 108px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

select {
  width: 100%;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  padding: 0 10px;
}

input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  padding: 0 10px;
}

select.native-date-select {
  display: none;
}

.date-picker {
  position: relative;
}

.date-trigger {
  width: 100%;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  padding: 0 10px;
  text-align: left;
  cursor: pointer;
}

.calendar-popover {
  position: absolute;
  top: 44px;
  left: 0;
  z-index: 20;
  width: 320px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(23, 33, 43, 0.14);
}

.calendar-head {
  display: grid;
  grid-template-columns: 36px 36px 1fr 36px 36px;
  align-items: center;
  height: 54px;
  border-bottom: 1px solid var(--line);
  color: #767f88;
}

.calendar-head strong {
  text-align: center;
  font-size: 18px;
  font-weight: 500;
}

.calendar-head strong button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  min-width: 58px;
  height: 34px;
  padding: 0 4px;
}

.calendar-head strong button:hover {
  color: #1478df;
}

.calendar-head button,
.calendar-actions button,
.calendar-day {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.calendar-head button {
  height: 100%;
  font-size: 26px;
  color: #a1a9b1;
}

.calendar-week,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0 18px;
}

.calendar-week {
  height: 46px;
  align-items: end;
  color: #333;
  font-size: 17px;
}

.calendar-week span {
  text-align: center;
}

.calendar-grid {
  gap: 5px 0;
  padding-bottom: 20px;
}

.calendar-year-grid,
.calendar-month-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 14px;
  padding: 34px 28px 96px;
}

.calendar-month-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 34px 6px;
  padding: 56px 14px 96px;
}

.calendar-month-grid .calendar-picker-cell {
  width: 100%;
  min-width: 0;
}

.calendar-day {
  width: 34px;
  height: 34px;
  margin: 0 auto;
  border-radius: 50%;
  color: #60666d;
  font-size: 17px;
}

.calendar-picker-cell {
  min-width: 76px;
  height: 46px;
  border: 0;
  background: transparent;
  color: #60666d;
  font: inherit;
  font-size: 17px;
  cursor: pointer;
}

.calendar-picker-cell:hover:not(:disabled) {
  background: #e8f2ff;
}

.calendar-picker-cell.selected-cell {
  background: #1478df;
  color: #fff;
  font-weight: 700;
}

.calendar-picker-cell:disabled {
  color: #c7ccd2;
  cursor: default;
}

.calendar-day:hover:not(:disabled) {
  background: #e8f2ff;
}

.calendar-day:disabled {
  color: #c7ccd2;
  cursor: default;
}

.calendar-day.muted-day {
  color: #c7ccd2;
}

.calendar-day.selected-day {
  background: #1478df;
  color: #fff;
}

.calendar-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.calendar-actions button {
  min-width: 58px;
  height: 34px;
  border: 1px solid #c7ccd2;
  border-radius: 0;
  color: #60666d;
  background: #fff;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.quote-panel .panel-head > div,
.chart-panel .panel-head > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.quote-panel .panel-head p,
.chart-panel .panel-head p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quote-panel .panel-head {
  min-height: 30px;
  padding: 5px 12px;
}

.quote-panel .panel-head h2 {
  font-size: 15px;
}

.quote-panel #quoteSummary {
  display: none;
}

.quote-wrap {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 58vh;
  position: relative;
}

.quote-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px minmax(0, 1fr);
  align-items: start;
}

.quote-side {
  overflow-x: clip;
  overflow-y: visible;
}

.quote-side .side-table {
  will-change: transform;
}

.quote-call-pane {
  border-right: 0;
}

.quote-put-pane {
  border-left: 0;
}

.quote-table {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  white-space: nowrap;
}

.side-table {
  min-width: 820px;
}

.strike-table {
  width: 250px;
}

th,
td {
  height: 34px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
  line-height: 1.2;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f9fbfc;
  color: #52606d;
  font-weight: 700;
}

thead tr:first-child th {
  top: 0;
  font-size: 14px;
  height: 34px;
}

thead tr:nth-child(2) th {
  top: 34px;
  height: 34px;
}

.quote-table thead th {
  background: #2357a5;
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.92);
  border-left: 0;
  border-right: 0;
  box-shadow: none;
}

.call-head {
  color: #ffd7d7;
  background: #2357a5;
}

.put-head {
  color: #c9f1df;
  background: #2357a5;
}

.strike-head,
.strike-cell {
  background: #1f4d8f;
  color: #fff;
  text-align: center;
  font-weight: 700;
  box-shadow: none;
}

.strike-head {
  min-width: 250px;
  width: 250px;
  height: 34px;
  padding: 3px 8px;
  z-index: 8;
  box-shadow: -1px 0 0 #2357a5, 1px 0 0 #2357a5 !important;
}

.strike-head-label {
  background: #1f4d8f;
  color: #fff;
  width: 78px;
  min-width: 78px;
  height: 34px;
  text-align: center;
  vertical-align: middle;
  border-left: 1px solid rgba(255, 255, 255, 0.9) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.9) !important;
}

.position-head {
  width: 86px;
  min-width: 86px;
  background: #1f4d8f;
  color: #fff;
  font-size: 12px;
}

.call-position-head {
  color: #ffd7d7;
}

.put-position-head {
  color: #c9f1df;
  box-shadow: 1px 0 0 #2357a5 !important;
}

.call-position-head {
  box-shadow: -1px 0 0 #2357a5 !important;
}

.expiry-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.center-expiry-select {
  width: 146px;
  height: 24px;
  border-color: rgba(255, 255, 255, 0.24);
  border-radius: 4px;
  background: #fff;
  color: var(--strike);
  font-size: 12px;
  font-weight: 700;
  padding: 0 4px;
  text-align: center;
}

.expiry-days {
  display: inline-block;
  min-width: 42px;
  margin-top: 0;
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.chart-actions {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.chart-actions label {
  display: inline;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}

.chart-actions button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.chart-actions button:hover {
  background: #edf5ff;
  border-color: #bdd5f2;
}

.strike-cell {
  min-width: 78px;
  width: 78px;
  height: 34px;
  padding: 0 8px;
  z-index: 3;
  border-left: 1px solid rgba(255, 255, 255, 0.9);
  border-right: 1px solid rgba(255, 255, 255, 0.9);
}

.position-cell {
  min-width: 86px;
  width: 86px;
  height: 34px;
  padding: 0 4px;
  background: #1f4d8f;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.position-stepper {
  display: grid;
  grid-template-columns: 22px minmax(24px, 1fr) 22px;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.position-stepper button {
  width: 22px;
  height: 24px;
  padding: 0;
  border: 1px solid #4f7cbb;
  border-radius: 4px;
  background: #2357a5;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.position-stepper button:hover {
  background: #2f68b6;
  border-color: #7ca2d2;
}

.position-stepper button:disabled {
  color: rgba(255, 255, 255, 0.45);
  background: #365f96;
  border-color: #4b6f9f;
  cursor: default;
}

.position-qty {
  display: block;
  min-width: 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.position-cell .position-buy {
  color: #ff8585;
}

.position-cell .position-sell {
  color: #70dbad;
}

.position-cell .position-flat {
  color: #dbe8f8;
}

.strike-cell span,
.strike-cell small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
}

.strike-cell strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.contract-cell {
  cursor: pointer;
  min-width: 74px;
}

.side-table td,
.side-table th {
  min-width: 76px;
}

.side-table td:nth-child(1),
.side-table td:nth-child(2),
.side-table td:nth-child(9),
.side-table td:nth-child(10),
.side-table th:nth-child(1),
.side-table th:nth-child(2),
.side-table th:nth-child(9),
.side-table th:nth-child(10) {
  min-width: 94px;
}

.quote-sync-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;
  border-top: 1px solid var(--line);
  background: #f9fbfc;
}

.quote-sync-scroll > div {
  height: 1px;
}

.contract-cell.itm-contract {
  background: #fff3e5;
}

.contract-cell.atm-contract {
  background: #fffbe6;
}

.contract-cell.otm-contract {
  background: #eef7ff;
}

.contract-cell:hover {
  background: #edf5ff;
}

.contract-cell.otm-contract:hover {
  background: #fff3e5;
}

.quote-table tbody tr:hover .strike-cell {
  background: #2d64aa;
}

.selected-contract {
  background: #e6f0fb;
  box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent);
}

.quote-side tbody tr.position-long-row td {
  box-shadow: inset 0 3px 0 var(--call), inset 0 -3px 0 var(--call) !important;
}

.quote-call-pane tbody tr.position-long-row td:first-child {
  box-shadow: inset 3px 0 0 var(--call), inset 0 3px 0 var(--call), inset 0 -3px 0 var(--call) !important;
}

.quote-put-pane tbody tr.position-long-row td:last-child {
  box-shadow: inset -3px 0 0 var(--call), inset 0 3px 0 var(--call), inset 0 -3px 0 var(--call) !important;
}

.quote-side tbody tr.position-short-row td {
  box-shadow: inset 0 3px 0 var(--put), inset 0 -3px 0 var(--put) !important;
}

.quote-call-pane tbody tr.position-short-row td:first-child {
  box-shadow: inset 3px 0 0 var(--put), inset 0 3px 0 var(--put), inset 0 -3px 0 var(--put) !important;
}

.quote-put-pane tbody tr.position-short-row td:last-child {
  box-shadow: inset -3px 0 0 var(--put), inset 0 3px 0 var(--put), inset 0 -3px 0 var(--put) !important;
}

.call-position-cell.position-long-cell {
  box-shadow: inset -3px 0 0 var(--call), inset 0 3px 0 var(--call), inset 0 -3px 0 var(--call);
}

.put-position-cell.position-long-cell {
  box-shadow: inset 3px 0 0 var(--call), inset 0 3px 0 var(--call), inset 0 -3px 0 var(--call);
}

.call-position-cell.position-short-cell {
  box-shadow: inset -3px 0 0 var(--put), inset 0 3px 0 var(--put), inset 0 -3px 0 var(--put);
}

.put-position-cell.position-short-cell {
  box-shadow: inset 3px 0 0 var(--put), inset 0 3px 0 var(--put), inset 0 -3px 0 var(--put);
}

.negative {
  color: var(--put);
}

.positive {
  color: var(--call);
}

.strategy-suite {
  --strategy-border: #628ecb;
  --strategy-strong: #2357a5;
  --strategy-tint: #eef5ff;
  margin-top: 10px;
}

.strategy-suite.mode-covered {
  --strategy-border: #c79b4d;
  --strategy-strong: #8b641f;
  --strategy-tint: #fff8e8;
}

.strategy-suite.mode-insurance {
  --strategy-border: #5f9f8d;
  --strategy-strong: #25705c;
  --strategy-tint: #edf8f4;
}

.strategy-tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-left: 0;
}

.strategy-tab {
  position: relative;
  z-index: 0;
  min-width: 126px;
  height: 38px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-bottom-color: var(--strategy-border);
  border-radius: 7px 7px 0 0;
  background: #fff;
  color: #596775;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.strategy-tab[data-strategy-mode="daily"] {
  color: #2357a5;
  box-shadow: inset 0 3px 0 #628ecb;
}

.strategy-tab[data-strategy-mode="covered"] {
  color: #8b641f;
  box-shadow: inset 0 3px 0 #c79b4d;
}

.strategy-tab[data-strategy-mode="insurance"] {
  color: #25705c;
  box-shadow: inset 0 3px 0 #5f9f8d;
}

.strategy-tab:hover {
  background: #f8fafb;
}

.strategy-tab.active {
  z-index: 3;
  height: 41px;
  border-width: 2px;
  border-color: var(--strategy-border);
  border-bottom-color: #fff;
  background: #fff;
  color: var(--strategy-strong);
}

.strategy-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 4px;
  background: #fff;
}

.strategy-tab:focus-visible {
  outline: 2px solid var(--strategy-strong);
  outline-offset: 2px;
}

.strategy-workspace {
  position: relative;
  z-index: 1;
  margin-top: -2px;
  padding: 9px;
  border: 2px solid var(--strategy-border);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.strategy-suite.mode-daily .strategy-workspace {
  border-top-left-radius: 0;
}

.strategy-workspace .combo-panel-horizontal {
  margin-top: 0;
}

.strategy-workspace .covered-toggle {
  margin-left: 8px;
  border-color: var(--strategy-border);
  color: var(--strategy-strong);
}

.strategy-workspace .covered-toggle input {
  accent-color: var(--strategy-strong);
}

.strategy-workspace .covered-controls button {
  color: var(--accent);
}

.covered-toggle[hidden] {
  display: none;
}

.compact-analysis-row {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 2fr);
  gap: 10px;
  margin-top: 10px;
  align-items: stretch;
}

.chart-panel,
.combo-panel {
  min-width: 0;
}

.compact-analysis-row > .panel {
  min-width: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

.compact-analysis-row > .payoff-panel[hidden] {
  display: none;
}

.compact-analysis-row .payoff-panel,
.compact-analysis-row .backtest-panel {
  background: var(--panel);
}

.compact-analysis-row .panel-head {
  padding: 8px 10px;
}

.compact-analysis-row .panel-head > div {
  min-width: 0;
}

.compact-analysis-row .payoff-panel .panel-head > div,
.compact-analysis-row .backtest-panel .panel-head > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
}

.compact-analysis-row .panel-head h2 {
  font-size: 15px;
}

.compact-analysis-row .panel-head p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.combo-actions {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.combo-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.combo-actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

#clearComboBtn {
  order: 99;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-left: auto;
  color: #c93737;
  border-color: #efbcbc;
  background: #fffafa;
}

.clear-combo-icon::before {
  content: "\E74D";
  font-family: "Segoe MDL2 Assets";
  font-size: 14px;
  font-weight: 400;
}

#clearComboBtn:hover {
  color: #ad2020;
  border-color: #d96b6b;
  background: #fff1f1;
}

.covered-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: #52606d;
  cursor: pointer;
  margin-left: 14px;
}

.insurance-toggle {
  margin-left: 8px;
}

.covered-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.covered-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.covered-controls[hidden] {
  display: none;
}

.covered-position-label,
.covered-position-unit {
  color: #52606d;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.covered-position-number {
  min-width: 42px;
  color: var(--strategy-strong);
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.covered-controls button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  background: #fff;
  border-color: #b9cbe1;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}

.covered-controls button:hover {
  color: var(--accent);
  background: #edf5ff;
  border-color: var(--accent);
}

.combo-actions button:hover {
  background: #edf5ff;
  border-color: #bdd5f2;
}

.combo-actions button:disabled,
.combo-actions button.disabled-action {
  color: #aeb7c0;
  background: #eef1f4;
  border-color: #d8dee3;
  cursor: default;
}

.chart-panel canvas,
.payoff-panel canvas,
.backtest-panel canvas {
  display: block;
  width: 100%;
}

.compact-analysis-row .chart-panel canvas,
.compact-analysis-row .payoff-panel canvas,
.compact-analysis-row .backtest-panel canvas {
  height: 360px;
  max-width: 100%;
  margin: 0 auto;
}

.compact-analysis-row .chart-panel canvas {
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.payoff-panel,
.backtest-panel {
  margin-top: 14px;
}

.analysis-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  align-items: stretch;
}

.analysis-layout .payoff-panel,
.analysis-layout .backtest-panel {
  margin-top: 0;
  min-width: 0;
  background: var(--panel);
  display: flex;
  flex-direction: column;
}

.payoff-panel canvas,
.backtest-panel canvas {
  height: 440px;
  max-width: 100%;
  margin: 0 auto;
}

.backtest-legend,
.payoff-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  padding: 0 16px 8px;
  color: var(--muted);
  font-size: 12px;
}

.legend-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.legend-row i {
  display: block;
  width: 28px;
  border-top: 2px solid var(--legend-color);
}

.legend-row i.dashed {
  border-top-style: dashed;
}

.legend-row em {
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payoff-segment-row {
  grid-column: 1 / -1;
}

.payoff-segment-row em {
  white-space: normal;
}

.fee-note {
  padding: 0 16px 6px;
  color: var(--muted);
  font-size: 12px;
}

.backtest-stats {
  margin: 0;
  padding: 3px 16px 12px;
  border-top: 1px solid #edf0f3;
  color: #52606d;
  font-size: 13px;
  font-weight: 600;
}

.backtest-strategy-stats {
  display: grid;
  gap: 3px;
  padding: 0 16px 12px;
  color: #c93737;
  font-size: 13px;
  font-weight: 700;
}

.backtest-strategy-stats:empty {
  display: none;
}

.position-list {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
  color: var(--muted);
  font-size: 13px;
  max-height: 520px;
  overflow: auto;
}

.position-list.strategy-empty-prompt {
  color: #c93737;
  font-weight: 700;
}

.combo-panel-horizontal {
  margin-top: 10px;
}

.combo-panel-horizontal .panel-head {
  padding: 6px 10px;
}

.combo-panel-horizontal .position-list {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 6px 10px 8px;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
}

.combo-panel-horizontal .position-item {
  flex: 0 0 210px;
  min-width: 210px;
}

.position-item {
  position: relative;
  display: block;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 30px 6px 8px;
  background: #f9fbfc;
  cursor: pointer;
}

.position-item.position-pending {
  background: #eef6ff;
}

.position-item.position-active {
  background: #fff;
}

.position-item.selected-position {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.position-item span {
  color: var(--accent);
  font-weight: 700;
}

.position-main {
  min-width: 0;
}

.position-item strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.position-item small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  margin-top: 2px;
}

.position-item em {
  display: block;
  color: var(--muted);
  font-style: normal;
  margin-top: 1px;
  font-size: 13px;
  line-height: 1.25;
}

.position-item em b {
  font-weight: 800;
  font-size: 15px;
}

.combo-position-stepper {
  display: grid;
  grid-template-columns: 24px auto 24px;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: 100%;
  margin: 4px auto 0;
}

.position-item .combo-position-stepper em {
  margin: 0;
  text-align: center;
  white-space: nowrap;
  min-width: 78px;
}

.position-item .combo-position-stepper button {
  width: 24px;
  height: 24px;
  background: #fff;
  border-color: #b9cbe1;
  color: var(--accent);
  font-size: 15px;
}

.position-item .combo-position-stepper button:hover {
  background: #edf5ff;
  border-color: var(--accent);
  color: var(--accent);
}

.buy-text {
  color: var(--call) !important;
}

.sell-text {
  color: var(--put) !important;
}

.combo-position-stepper.buy-text em {
  color: var(--call) !important;
}

.combo-position-stepper.sell-text em {
  color: var(--put) !important;
}

.combo-position-stepper em b {
  font-size: 17px;
  line-height: 1;
}

.position-controls {
  display: grid;
  gap: 6px;
  min-width: 112px;
}

.trade-row {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 4px;
  font-weight: 700;
}

.trade-row span {
  text-align: center;
  font-weight: 700;
}

.position-item button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.position-item button:disabled {
  color: #b8c0c8;
  background: #f0f2f4;
  cursor: not-allowed;
}

.position-item button:hover {
  background: #edf5ff;
  border-color: #bdd5f2;
}

.position-item .position-remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-color: transparent;
  background: transparent;
  color: #7c8792;
  font-size: 15px;
}

.position-item .position-remove:hover {
  color: #c93737;
  background: #fff0f0;
  border-color: #f0c7c7;
}

.legend {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.call-dot {
  background: var(--call);
}

.put-dot {
  background: var(--put);
}

@media (max-width: 980px) {
  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-analysis-row {
    grid-template-columns: minmax(420px, 1.18fr) minmax(620px, 2fr);
    overflow-x: auto;
  }

}

@media (max-width: 560px) {
  .shell {
    width: calc(100vw - 18px);
  }

  .strategy-tabs {
    gap: 3px;
    padding-left: 0;
  }

  .strategy-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 6px;
    font-size: 12px;
  }

  .strategy-workspace {
    padding: 6px;
  }

  .combo-title-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  box-shadow: 0 18px 40px rgba(23, 33, 43, 0.08);
}

.auth-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.auth-form,
.user-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form button,
.form-actions button {
  height: 38px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.form-message {
  min-height: 20px;
  color: var(--call);
  font-size: 13px;
}

.admin-shell {
  width: min(1320px, calc(100vw - 32px));
}

.admin-panel {
  padding: 0;
}

.upload-panel {
  margin-bottom: 14px;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.upload-dropzone {
  min-height: 172px;
  border: 1px dashed #9eb3c7;
  border-radius: 6px;
  background: #f8fbfd;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  outline: none;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.upload-dropzone strong {
  color: var(--ink);
  font-size: 17px;
}

.upload-dropzone.is-dragging,
.upload-dropzone:focus-visible {
  border-color: var(--accent);
  background: #edf5ff;
}

.upload-dropzone .primary-btn {
  margin-top: 8px;
}

.upload-queue {
  display: grid;
  grid-template-rows: minmax(104px, auto) 38px 5px auto;
  gap: 9px;
  align-content: start;
}

.file-list {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  overflow: auto;
  max-height: 150px;
}

.file-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  color: var(--ink);
  border-bottom: 1px solid #edf1f3;
}

.file-list > div:last-child {
  border-bottom: 0;
}

.file-list > div span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}

.upload-progress {
  overflow: hidden;
  border-radius: 3px;
  background: #e8edf1;
}

.upload-progress span {
  display: block;
  width: 38%;
  height: 100%;
  background: var(--accent);
  animation: upload-progress 1.1s ease-in-out infinite alternate;
}

@keyframes upload-progress {
  from { transform: translateX(-15%); }
  to { transform: translateX(185%); }
}

.upload-message {
  color: var(--muted);
}

.upload-result {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.upload-result > div {
  min-height: 72px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-result strong {
  color: var(--accent);
  font-size: 22px;
}

.upload-result span {
  color: var(--muted);
  font-size: 13px;
}

.upload-history-wrap {
  padding: 14px 18px 18px;
  overflow: auto;
}

.upload-history-wrap h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.upload-history td:nth-child(2) {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-admin-panel {
  margin-top: 14px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px;
}

.user-table-wrap {
  overflow: auto;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.user-table th,
.user-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  white-space: nowrap;
}

.user-table th {
  color: var(--muted);
  font-weight: 700;
  background: #f8fafb;
}

.user-table button,
.form-actions button:last-child {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  cursor: pointer;
}

.user-table button:disabled {
  color: #aab3bb;
  background: #f2f4f5;
}

.user-form {
  margin-top: 0;
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.user-form h3 {
  margin: 0;
  font-size: 17px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.state-on {
  color: var(--put);
  font-weight: 700;
}

.state-off {
  color: var(--muted);
}

.site-disclaimer {
  margin-top: 14px;
  padding: 12px 10px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.public-security-record {
  display: flex;
  justify-content: center;
  padding: 2px 10px 14px;
  font-size: 12px;
  line-height: 20px;
}

.public-security-record a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
}

.public-security-record a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.public-security-record img {
  display: block;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

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

  .upload-result {
    grid-template-columns: repeat(3, 1fr);
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .user-form {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 18px;
  }
}
