:root {
  --page: #f5f7fa;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --cyan: #0891b2;
  --orange: #b45309;
  --purple: #7c3aed;
  --red: #dc2626;
  --green: #15803d;
  --amber: #d97706;
  --radius: 12px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  color: var(--text);
  background: var(--page);
  font-variant-numeric: tabular-nums;
  font-size: clamp(13px, 0.35vw + 12px, 16px);
}

button,
select {
  font: inherit;
}

button,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

.container {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
}

.site-header {
  height: 70px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.9);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  min-width: 0;
  color: inherit;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand > span:last-child {
  min-width: 0;
}

.brand-mark {
  min-width: 42px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--blue);
  border-radius: 10px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fafb;
}

.tab {
  border: 0;
  border-radius: 7px;
  padding: 7px 14px;
  color: var(--muted);
  background: transparent;
}

.tab.active {
  color: var(--blue);
  background: white;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.08);
  font-weight: 650;
}

.tab:disabled {
  opacity: 0.46;
}

.page-tabs {
  flex: 0 0 auto;
}

.mobile-page-tabs {
  display: none;
}

.page-tabs .tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.page {
  padding-top: 24px;
  padding-bottom: 28px;
}

.placeholder-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 70px);
  box-sizing: border-box;
}

.coming-soon {
  display: grid;
  flex: 1;
  margin: 0;
  color: #c4cad3;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.08em;
  place-items: center;
}

.placeholder-footer {
  width: 100%;
  flex: 0 0 auto;
}

.positions-web-notice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
  text-align: left;
}

.positions-web-notice-copy {
  min-width: 0;
}

.positions-web-notice h1 {
  margin: 0;
  font-size: clamp(22px, 1.4vw + 14px, 28px);
  font-weight: 600;
}

.positions-web-notice .subtitle {
  max-width: 570px;
  margin: 10px 0 0;
  line-height: 1.7;
}

.positions-statistics-entry {
  flex: 0 0 auto;
}

.positions-statistics-entry,
.position-add-button {
  min-height: 40px;
  padding: 0 16px;
  color: #374151;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.positions-statistics-entry:hover,
.position-add-button:hover {
  color: var(--blue);
  background: #f8fafc;
  border-color: #93c5fd;
}

.positions-statistics-entry:active,
.position-add-button:active {
  transform: translateY(1px);
}

.positions-statistics-entry:focus-visible,
.position-add-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.positions-web-products {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.positions-web-product {
  padding: 0;
  overflow: hidden;
  border-top: 3px solid var(--product-color);
}

.positions-web-product > div {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.positions-web-product > div i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: var(--product-color);
  border-radius: 50%;
}

.positions-web-product > div strong {
  font-size: 18px;
  font-weight: 600;
}

.positions-web-product > div span {
  color: var(--muted);
  font-size: 11px;
}

.positions-web-product p {
  min-height: 48px;
  margin: 14px 18px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.position-add-button {
  margin: 0 18px 18px;
}

.mini-program-dialog {
  width: min(420px, calc(100vw - 32px));
}

.mini-program-dialog-body {
  text-align: center;
}

.mini-program-dialog-body img {
  width: min(260px, 80vw);
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 12px;
}

.mini-program-code-error {
  padding: 18px 12px;
  color: #92400e !important;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
}

.positions-page {
  min-height: calc(100vh - 70px);
}

.snapshot {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 32px;
  padding: 20px 24px;
  margin-bottom: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.index-quote {
  width: max-content;
  max-width: 100%;
  justify-self: center;
}

.field-label,
.control label,
.control legend {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  margin-bottom: 7px;
}

.select {
  width: 100%;
  min-height: 40px;
  padding: 0 36px 0 12px;
  color: var(--text);
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  outline: none;
}

.select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.index-point {
  font-weight: 300;
  font-size: 14px;
  line-height: 1.35;
}

.index-value-line {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
}

.index-market-line {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 14px;
}

.index-primary {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}

.index-name {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.index-name-compact {
  display: none;
}

.point-unit {
  margin-left: 3px;
  color: var(--muted);
  font-size: 12px;
}

.index-change {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.25;
  white-space: nowrap;
}

.index-change > span {
  font-weight: 300;
}

.index-change.up {
  color: #dc2626;
}

.index-change.down {
  color: #15803d;
}

.index-change.flat {
  color: #6b7280;
}

.market-update-time {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.quote-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.market-status-text {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
}

.market-delay {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}

.market-delay strong {
  font-weight: 600;
}

.market-delay.delayed strong {
  color: #b45309;
}

.market-delay.stale strong {
  color: var(--red);
}

.card {
  padding: 24px;
  margin-bottom: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.roll-card {
  border-top: 3px solid var(--blue);
}

.roll-card .roll-head h2 {
  font-size: clamp(22px, 1.2vw + 13px, 27px);
}

.roll-card .roll-head .subtitle {
  font-size: 14px;
}

.roll-title-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -8px 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  font-size: inherit;
  font-weight: inherit;
  text-align: left;
  cursor: pointer;
}

.info-mark {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.roll-title-button:hover .info-mark,
.roll-title-button:focus-visible .info-mark {
  color: var(--blue);
}

.current-contracts {
  margin-bottom: 4px;
}

.compact-head {
  margin-bottom: 12px;
}

.section-divider {
  height: 1px;
  margin: 22px 0;
  background: var(--line);
}

.contracts-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.contracts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.contracts-mobile-list {
  display: none;
}

.contract-mobile-card {
  min-width: 0;
  overflow: hidden;
  padding: 13px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.contract-mobile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.contract-mobile-head .contract-name {
  min-width: 0;
}

.contract-mobile-head .contract-name small {
  padding: 2px 5px;
  color: var(--muted);
  background: #eef0f3;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 400;
}

.annualized-inline-help,
.contract-calculation-help,
.contract-expiry-help,
.table-info-button {
  margin: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.table-expiry-help {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin: -10px -8px;
  padding: 0 8px;
  white-space: nowrap;
}

.annualized-result-line {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin: -10px -8px;
  padding: 0 8px;
  color: inherit;
  background: transparent;
  border: 0;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.contract-mobile-metrics .contract-calculation-help {
  min-width: 0;
  min-height: 62px;
  margin: 0;
  padding: 7px 3px;
  color: var(--text);
  font-size: inherit;
}

.contract-calculation-help:hover,
.contract-calculation-help:focus-visible {
  color: var(--blue);
}

.annualized-inline-help {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.table-heading-with-info {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
}

.table-info-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  margin: -8px -8px -8px -4px;
  font-size: 12px;
}

.annualized-inline-help:hover,
.table-info-button:hover {
  color: var(--blue);
}

.contract-mobile-annualized strong {
  font-size: 15px;
  font-weight: 400;
}

.contract-mobile-metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.contract-mobile-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 0 !important;
  overflow: hidden;
  border-radius: 9px;
}

.contract-mobile-metrics > * {
  min-width: 0;
  min-height: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 3px;
  box-sizing: border-box;
  color: var(--text);
  background: #f8fafc;
  border: 0;
  border-left: 1px solid #eef0f3;
  font: inherit;
  text-align: center;
}

.contract-mobile-metrics > :first-child {
  border-left: 0;
}

.contract-mobile-metric span,
.contract-mobile-static-metric > span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
}

.contract-mobile-metric strong,
.contract-mobile-static-metric > strong {
  font-size: clamp(12px, 3.3vw, 14px);
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
}

.contract-mobile-metric i {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.contract-expiry-help {
  cursor: pointer;
}

.contract-mobile-head > .expiry-warning {
  display: block;
  flex: 0 0 auto;
  width: fit-content;
  margin-left: auto;
  white-space: nowrap;
}

.contracts-table th {
  padding: 10px 12px;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
}

.contracts-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.contracts-table td.interactive-data-cell {
  padding: 0;
}

.interactive-data-cell .annualized-result-line,
.interactive-data-cell .table-expiry-help {
  width: 100%;
  min-height: 58px;
  margin: 0;
  padding: 0 12px;
}

.contracts-table th:first-child,
.contracts-table td:first-child {
  text-align: left;
}

.contracts-table tbody tr:last-child td {
  border-bottom: 0;
}

.contract-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.contract-name i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.discount-positive {
  color: var(--green);
}

.discount-negative {
  color: var(--red);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 18px;
}

.card h1,
.card h2 {
  margin: 0;
  font-size: clamp(18px, 1vw + 12px, 21px);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.eyebrow {
  margin: 0 0 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.legend {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.legend button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  color: #374151;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
}

.legend button:hover {
  background: #f3f4f6;
}

.legend button.off {
  opacity: 0.35;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.expiry-warning {
  padding: 1px 5px;
  color: #92400e;
  background: #fffbeb;
  border-radius: 999px;
  font-size: 11px;
}

.annualized-near-expiry {
  color: #b45309;
  font-weight: 600;
}

.chart-wrap {
  position: relative;
  width: 100%;
}

.curve-wrap {
  height: 420px;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.chart {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  touch-action: pan-y;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

.chart text {
  fill: var(--muted);
  font-family: inherit;
  font-size: 12px;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart .zero {
  stroke: #9ca3af;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.chart .series {
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chart .hover-line {
  stroke: #9ca3af;
  stroke-width: 1;
  stroke-dasharray: 4 4;
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.chart .hit-area {
  fill: transparent;
  cursor: crosshair;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  z-index: 2;
}

.chart-tooltip {
  position: absolute;
  min-width: 164px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 8px 25px rgba(17, 24, 39, 0.13);
  pointer-events: none;
  z-index: 5;
  font-size: 12px;
}

.tooltip-date {
  margin-bottom: 6px;
  color: var(--muted);
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 4px;
}

.tooltip-name {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tooltip-name i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.chart-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.controls {
  display: flex;
  align-items: end;
  gap: 28px;
}

.control {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 168px;
}

.control legend {
  padding: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f9fafb;
}

.segmented button {
  min-width: 58px;
  height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.segmented button.active {
  color: white;
  background: var(--blue);
  font-weight: 650;
}

.roll-chart {
  overflow: hidden;
  min-height: 148px;
  margin: 12px 0 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.roll-table-head,
.roll-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.25fr) repeat(3, minmax(130px, 1fr));
  align-items: stretch;
}

.roll-table-head {
  min-height: 38px;
  color: var(--muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.roll-table-head span {
  display: grid;
  place-items: center;
}

.roll-row {
  min-height: 58px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.roll-row:last-child {
  border-bottom: 0;
}

.roll-target-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  white-space: nowrap;
}

.roll-target-name i {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
}

.roll-target-name small {
  padding: 2px 6px;
  color: #4b5563;
  background: #f3f4f6;
  border-radius: 999px;
  font-size: 10px;
}

.roll-table-value {
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 4px;
  color: var(--text);
  background: white;
  border: 0;
  border-left: 1px solid #eef0f3;
  font-size: 16px;
  font-weight: 400;
  white-space: nowrap;
  cursor: pointer;
}

.roll-cell-label {
  display: none;
}

.roll-cell-value {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.roll-annualized-highest {
  color: #111827;
  font-weight: 700;
}

.roll-history {
  color: var(--text);
}

.roll-calculation-button {
  font: inherit;
}

.info-button:hover,
.info-button:focus-visible {
  color: var(--blue);
}

.roll-history-card {
  margin-top: 18px;
  padding: 18px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.roll-history-title {
  display: block;
  font-size: 13px;
  font-weight: 400;
}

.roll-history-chart-wrap {
  height: 230px;
  margin-top: 12px;
}

.roll-history-reference-line-svg {
  fill: none;
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}

.roll-history-references {
  width: 100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.roll-history-reference-head,
.roll-history-reference {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  min-width: 0;
}

.roll-history-reference-head {
  min-height: 24px;
  color: #9ca3af;
  font-size: 10px;
}

.roll-history-reference-head span,
.roll-history-reference span {
  min-width: 0;
  text-align: center;
}

.roll-history-reference {
  min-height: 32px;
  border-top: 1px solid #eef0f3;
}

.roll-history-reference i {
  width: 24px;
  height: 0;
  justify-self: center;
  border-top: 1px dashed;
}

.roll-history-reference span {
  color: #6b7280;
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
}

.roll-history-reference span:first-of-type {
  color: #111827;
  font-size: 12px;
}

.roll-history-explanation {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.65;
}

.empty-state {
  min-height: 148px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
}

.page-error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  font-size: 13px;
}

.page-error button {
  margin-left: auto;
  padding: 5px 10px;
  color: #991b1b;
  background: white;
  border: 1px solid #fca5a5;
  border-radius: 7px;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  color: white;
  background: rgba(17, 24, 39, 0.94);
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.2);
  font-size: 13px;
  transform: translateX(-50%);
}

.toast.error {
  background: rgba(153, 27, 27, 0.95);
}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 11px;
}

#feedback-contact {
  flex: 0 0 auto;
  min-width: 0;
  margin-right: auto;
  color: #374151;
  white-space: nowrap;
}

.feedback-copy {
  min-width: 0;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}

#page-views {
  flex: 0 0 auto;
  white-space: nowrap;
}

#feedback-contact strong {
  color: var(--blue);
  font-size: 12px;
}

.copy-icon {
  position: relative;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  margin-left: 2px;
}

.copy-icon::before,
.copy-icon::after {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid var(--blue);
  border-radius: 2px;
  content: "";
}

.copy-icon::before {
  top: 1px;
  left: 1px;
}

.copy-icon::after {
  right: 1px;
  bottom: 1px;
  background: white;
}

.formula-dialog {
  width: min(420px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  color: var(--text);
  background: white;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(17, 24, 39, 0.22);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}

.formula-dialog::backdrop {
  background: rgba(17, 24, 39, 0.38);
}

.formula-dialog form {
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
}

.formula-dialog-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 9px;
  border-bottom: 1px solid #eef0f3;
}

.formula-dialog-head strong {
  min-width: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.formula-dialog-head button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
}

.formula-dialog-head button:hover {
  background: #f3f4f6;
}

.formula-dialog p {
  margin: 10px 0 0;
  color: #374151;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.65;
}

.formula-dialog-body {
  min-height: 0;
  flex: 1 1 auto;
  padding: 10px 16px;
  overflow-y: auto;
}

.formula-dialog-body > :first-child {
  margin-top: 0;
}

.formula-dialog-footer {
  flex: 0 0 auto;
  padding: 8px 16px 12px;
  background: white;
}

.formula-dialog-confirm {
  width: 100%;
  height: 40px;
  min-height: 40px;
  margin: 0;
  color: white;
  background: var(--blue);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  line-height: 40px;
}

.calculation-dialog {
  width: min(520px, calc(100vw - 32px));
}

.calculation-dialog-formula {
  font-size: 13px;
  font-weight: 400;
  padding: 10px 12px;
  background: #f3f4f6;
  border-radius: 9px;
}

.calculation-dialog-formula.plain {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  white-space: pre-line;
}

.calculation-dialog.plain-detail .formula-dialog-body {
  flex: 0 1 auto;
}

.calculation-dialog-terms {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 0 12px;
  margin: 10px 0 0;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.55;
}

.calculation-dialog-terms dt,
.calculation-dialog-terms dd {
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.calculation-dialog-terms dt {
  color: var(--muted);
}

.calculation-dialog-terms dd {
  color: var(--text);
  overflow-wrap: anywhere;
  text-align: right;
}

.calculation-dialog-terms dt:last-of-type,
.calculation-dialog-terms dd:last-of-type {
  border-bottom: 0;
}

.calculation-dialog-warning {
  margin-top: 12px !important;
  padding: 10px 12px;
  color: #92400e !important;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
}

.calculation-dialog-values {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 0 12px;
  margin: 8px 0 0;
  padding: 0 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.55;
}

.calculation-dialog-values dt {
  padding: 8px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.calculation-dialog-values dd {
  margin: 0;
  padding: 8px 0;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.calculation-dialog-values dt:last-of-type,
.calculation-dialog-values dd:last-of-type {
  border-bottom: 0;
}

.calculation-dialog-result {
  width: auto;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  flex: 0 0 auto;
  margin: 0 16px 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.55;
}

.calculation-dialog-result > :first-child {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.calculation-dialog-result > :last-child {
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
  white-space: nowrap;
}

@media (max-width: 800px) {
  .container {
    width: min(100% - 32px, 1200px);
  }

  .site-header {
    height: 62px;
  }

  .brand small {
    display: none;
  }

  .brand strong {
    font-size: 14px;
  }

  .tabs .tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  .snapshot {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }

  .index-name-full {
    display: none;
  }

  .index-name-compact {
    display: inline;
  }

  .index-quote {
    width: 100%;
    justify-self: stretch;
  }

  .card-head {
    display: block;
  }

  .legend {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .roll-head .controls {
    margin-top: 18px;
  }

  .curve-wrap {
    height: 300px;
  }

  .position-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 14px;
    line-height: 1.45;
  }

  .container {
    width: calc(100% - 24px);
  }

  .header-inner {
    gap: 8px;
  }

  .brand-mark {
    min-width: 38px;
    height: 34px;
    border-radius: 9px;
  }

  .brand strong {
    line-height: 1.15;
  }

  .tabs {
    gap: 1px;
  }

  .tabs .tab:disabled {
    display: none;
  }

  .tabs .tab {
    padding: 6px 7px;
  }

  .desktop-page-tabs {
    display: none;
  }

  .mobile-page-tabs {
    min-height: 58px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    padding:
      5px max(12px, env(safe-area-inset-right))
      max(5px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.96);
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    backdrop-filter: blur(12px);
  }

  .page-tabs .tab {
    min-height: 48px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 12px;
  }

  .mobile-page-tabs.four-page-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .page {
    padding-top: clamp(10px, 3.5vw, 14px);
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .positions-page {
    min-height: calc(100vh - 62px);
  }

  .positions-web-notice {
    margin-top: 4px;
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .positions-statistics-entry {
    width: 100%;
  }

  .positions-web-products {
    grid-template-columns: 1fr;
  }
  .snapshot,
  .card {
    padding: clamp(11px, 3.8vw, 16px);
    border-radius: 12px;
  }

  .snapshot {
    grid-template-columns: 1fr;
    gap: clamp(10px, 3.5vw, 14px);
    margin-bottom: clamp(12px, 4vw, 18px);
  }

  .index-market-line {
    gap: 5px 10px;
  }

  .quote-meta {
    grid-column: auto;
    gap: 6px 9px;
    font-size: clamp(12px, 3.2vw, 13px);
    line-height: 1.4;
  }

  .calculation-dialog-values dd {
    line-height: 1.55;
    overflow-wrap: normal;
    word-break: normal;
  }

  .card h1,
  .card h2 {
    font-size: clamp(17px, 4.8vw, 19px);
    line-height: 1.3;
  }

  .roll-card .roll-head h2 {
    font-size: clamp(19px, 5.5vw, 22px);
    line-height: 1.3;
  }

  .roll-card .roll-head .subtitle {
    font-size: 13px;
    line-height: 1.45;
  }

  .curve-wrap {
    height: clamp(250px, 74vw, 290px);
    margin-left: -8px;
    width: calc(100% + 8px);
  }

  .contracts-table-wrap {
    display: none;
  }

  .contracts-mobile-list {
    display: grid;
    gap: clamp(7px, 2.7vw, 10px);
  }

  .contract-mobile-card {
    padding: clamp(10px, 3.3vw, 13px);
  }

  .contract-mobile-head {
    gap: 8px;
    margin-bottom: clamp(8px, 2.8vw, 12px);
    font-size: clamp(12px, 3.5vw, 14px);
    line-height: 1.3;
  }

  .contract-mobile-metrics {
    gap: clamp(7px, 2.8vw, 10px) clamp(8px, 3vw, 14px);
  }

  .contract-mobile-metrics > div {
    min-width: 0;
  }

  .contract-mobile-static-metric > span,
  .contract-mobile-static-metric > strong {
    overflow-wrap: anywhere;
  }

  .contract-mobile-static-metric > span {
    font-size: 12px;
    line-height: 1.3;
  }

  .contract-mobile-static-metric > strong {
    font-size: clamp(13px, 3.6vw, 14px);
    line-height: 1.3;
  }

  .roll-head .controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(9px, 3vw, 12px);
    margin-top: clamp(13px, 4vw, 18px);
  }

  .control {
    min-width: 0;
  }

  .roll-chart {
    display: grid;
    gap: clamp(7px, 2.7vw, 10px);
    overflow: visible;
    margin-top: clamp(13px, 4vw, 18px);
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  .roll-table-head {
    display: none;
  }

  .roll-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    min-height: 0;
    padding: clamp(10px, 3.3vw, 13px);
    background: white;
    border: 1px solid var(--line);
    border-radius: 10px;
  }

  .roll-row:last-child {
    border-bottom: 1px solid var(--line);
  }

  .roll-target-name {
    grid-column: 1 / -1;
    min-height: 44px;
    gap: 7px;
    padding: 0;
  }

  .roll-table-value {
    min-height: 60px;
    flex-direction: column;
    gap: 7px;
    padding: 7px 3px;
    background: #f8fafc;
    border-left: 1px solid #eef0f3;
    font-size: clamp(13px, 3.6vw, 14px);
  }

  .roll-target-name + .roll-table-value {
    border-left: 0;
    border-radius: 9px 0 0 9px;
  }

  .roll-row > .roll-table-value:last-child {
    border-radius: 0 9px 9px 0;
  }

  .roll-cell-label {
    display: block;
    color: var(--muted);
    font-size: 10px;
    line-height: 14px;
  }

  .roll-cell-value {
    gap: 3px;
    line-height: 1.3;
  }

  .roll-cell-value .info-mark {
    font-size: 11px;
  }

  .roll-history-card {
    padding: clamp(12px, 4vw, 16px);
  }

  .roll-history-chart-wrap {
    height: 200px;
  }

  footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    line-height: 1.35;
  }

  #feedback-contact,
  #page-views {
    min-width: 0;
  }

  #page-views {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 359px) {
  .container {
    width: calc(100% - 16px);
  }

  .header-inner {
    gap: 5px;
  }

  .brand-mark {
    min-width: 34px;
    height: 32px;
    padding: 0 5px;
    font-size: 10px;
  }

  .brand strong {
    font-size: 12px;
  }

  .tabs .tab {
    padding: 5px 6px;
    font-size: 11px;
  }

  .page-tabs .tab {
    padding: 0 4px;
  }

  .snapshot,
  .card {
    padding: 10px;
  }

  .index-point {
    font-size: 14px;
  }

  .contract-mobile-card {
    padding: 11px;
  }

  .contract-mobile-metrics {
    gap: 7px 8px;
  }

  .curve-wrap {
    height: clamp(235px, 75vw, 270px);
  }

  .legend {
    gap: 3px 5px;
  }

  .legend button {
    gap: 5px;
    padding: 4px 5px;
    font-size: 12px;
  }

  .segmented button {
    min-width: 0;
    padding: 0 6px;
    font-size: 12px;
  }

}

/* 模拟滚IC页面保留在功能开关后，启用时复用现有中性金融数据视觉。 */
.roll-simulation-page {
  display: grid;
  gap: 16px;
}

.simulation-intro-card,
.simulation-condition-card,
.simulation-scenario-card,
.simulation-funds-card,
.simulation-chart-card,
.simulation-return-card,
.simulation-year-card {
  padding: 22px 24px;
}

.simulation-intro-card h1,
.simulation-condition-card h2,
.simulation-scenario-card h2,
.simulation-chart-card h2,
.simulation-return-card h2,
.simulation-annual-section h2 {
  margin: 0;
}

.simulation-supported-range {
  color: #9ca3af;
  font-size: 12px;
}

.simulation-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.simulation-form-grid label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: #4b5563;
  font-size: 13px;
}

.simulation-label-with-info {
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.simulation-label-with-info > button {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #2563eb;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.simulation-label-with-info > button.hidden {
  display: none;
}

.simulation-form-grid .simulation-product-field {
  grid-column: 1 / -1;
}

.simulation-form-grid input,
.simulation-form-grid select,
.simulation-input-unit {
  width: 100%;
  height: 44px;
  box-sizing: border-box;
  color: #111827;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}

.simulation-form-grid input,
.simulation-form-grid select {
  padding: 0 12px;
}

.simulation-input-unit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.simulation-input-unit input {
  min-width: 0;
  flex: 1;
  border: 0;
  padding-left: 38px;
  padding-right: 38px;
  text-align: center;
}

.simulation-input-unit i {
  width: 28px;
  position: absolute;
  right: 8px;
  padding: 0;
  color: #6b7280;
  font-style: normal;
  text-align: center;
}

.simulation-form-grid input[type="date"],
.simulation-form-grid select {
  text-align: center;
  text-align-last: center;
}

.simulation-form-help,
.simulation-funds-caption,
.simulation-chart-help {
  margin: 12px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.65;
}

.simulation-primary-button {
  width: 100%;
  height: 44px;
  margin-top: 16px;
  color: #fff;
  background: #2563eb;
  border: 0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.simulation-primary-button:disabled {
  background: #93b4ef;
  cursor: wait;
}

.simulation-loading {
  padding: 18px 12px;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.simulation-error {
  margin-top: 12px;
  padding: 11px 12px;
  color: #b91c1c;
  background: #fef2f2;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.simulation-results {
  display: grid;
  gap: 16px;
}

.simulation-results.hidden,
.simulation-svg-wrap .chart-tooltip.hidden {
  display: none;
}

.simulation-funds-card {
  border-top: 3px solid #2563eb;
}

.simulation-funds-label,
.simulation-funds-value {
  display: block;
}

.simulation-funds-label {
  color: #4b5563;
  font-size: 14px;
}

.simulation-funds-value {
  margin-top: 4px;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.2;
}

.simulation-funds-condition {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 4px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.simulation-funds-condition > span {
  color: #2563eb;
  font-size: 24px;
  font-weight: 700;
}

.simulation-funds-condition > i {
  color: #2563eb;
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
}

.simulation-summary-rows {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  margin: 14px 0 0;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.simulation-summary-rows dt,
.simulation-summary-rows dd {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #eef0f3;
  font-size: 13px;
  line-height: 1.6;
}

.simulation-summary-rows dt {
  color: #6b7280;
}

.simulation-summary-rows dd {
  color: #111827;
  text-align: right;
}

.simulation-summary-rows dt:last-of-type,
.simulation-summary-rows dd:last-of-type {
  border-bottom: 0;
}

.simulation-scenario-row {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: center;
  padding: 0;
  color: #111827;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #eef0f3;
  border-radius: 0;
  font: inherit;
  cursor: pointer;
}

.simulation-scenario-row:last-child {
  border-bottom: 0;
}

.simulation-scenario-row > span,
.simulation-scenario-row > strong {
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
}

.simulation-scenario-row > span {
  color: #6b7280;
  text-align: left;
}

.simulation-scenario-row > span i {
  color: #2563eb;
  font-size: 11px;
  font-style: normal;
}

.simulation-scenario-row > strong {
  font-weight: 400;
  text-align: right;
}

.simulation-scenario-row:hover,
.simulation-scenario-row:focus-visible {
  background: #eff6ff;
}

.simulation-calculation-entry {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 8px 12px;
  box-sizing: border-box;
  color: #374151;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.simulation-calculation-entry > span {
  display: grid;
  gap: 2px;
}

.simulation-calculation-entry strong {
  color: #374151;
  font-size: 13px;
}

.simulation-calculation-entry small {
  color: #6b7280;
  font-size: 11px;
}

.simulation-calculation-entry b {
  color: #2563eb;
  font-size: 12px;
}

.simulation-calculation-entry:hover,
.simulation-calculation-entry:focus-visible {
  background: #eff6ff;
}

.simulation-reserved-funds {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #eef0f3;
}

.simulation-reserved-funds.hidden {
  display: none;
}

.simulation-reserved-funds-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.simulation-reserved-funds-head > span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.simulation-reserved-funds-head strong {
  color: #374151;
  font-size: 13px;
}

.simulation-reserved-funds-head small {
  color: #6b7280;
  font-size: 11px;
  line-height: 1.55;
}

.simulation-reserved-funds-head > button {
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  color: #2563eb;
  background: transparent;
  border: 0;
  font-size: 13px;
  text-align: right;
  cursor: pointer;
}

.simulation-reserved-funds-controls {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 10px;
  margin-top: 10px;
  box-sizing: border-box;
}

.simulation-reserved-funds-controls > * {
  min-width: 0;
  max-width: 100%;
}

.simulation-reserved-funds-controls .simulation-input-unit i {
  width: 48px;
}

.simulation-reserved-funds-controls .simulation-input-unit input {
  padding-right: 56px;
}

#simulation-reserved-funds-submit {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  color: #fff;
  background: #2563eb;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#simulation-reserved-funds-submit:disabled {
  background: #93b4ef;
  cursor: wait;
}

#simulation-reserved-funds-error {
  margin-bottom: 0;
}

.simulation-reserved-funds-unavailable {
  margin: 12px 0 0;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.65;
}

.simulation-risk-warning {
  margin-top: 14px;
  padding: 12px;
  color: #7c2d12;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.7;
}

.simulation-risk-warning strong {
  display: block;
  margin-bottom: 4px;
  color: #9a3412;
  font-size: 13px;
}

.simulation-risk-warning p {
  margin: 0;
}

.simulation-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 8px;
  color: #4b5563;
  font-size: 12px;
}

.simulation-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.simulation-full-legend,
.simulation-low-legend {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.simulation-legend i {
  width: 22px;
  height: 3px;
  border-radius: 999px;
}

.simulation-legend i.full {
  background: #2563eb;
}

.simulation-legend i.low {
  background: #d97706;
}

.simulation-legend b {
  font-weight: 400;
}

.simulation-svg-wrap {
  height: 340px;
  position: relative;
}

#simulation-chart {
  width: 100%;
  height: 340px;
  display: block;
  touch-action: pan-y;
}

.simulation-svg-wrap .chart-tooltip {
  display: grid;
  gap: 3px;
  width: 230px;
  pointer-events: none;
  background: #fff;
}

.simulation-svg-wrap .chart-tooltip strong,
.simulation-svg-wrap .chart-tooltip span {
  display: block;
}

.simulation-termination {
  display: block;
  margin-top: 4px;
  padding: 0;
  color: #b45309;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.simulation-blowup-comparison {
  width: 100%;
  display: grid;
  margin-top: 12px;
  padding: 0;
  overflow: hidden;
  color: #374151;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.simulation-blowup-head,
.simulation-blowup-gap {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
}

.simulation-blowup-head strong {
  color: #374151;
  font-size: 13px;
}

.simulation-blowup-head i {
  color: #2563eb;
  font-size: 12px;
  font-style: normal;
}

.simulation-blowup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #eef0f3;
}

.simulation-blowup-grid > span {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 11px 8px;
  background: #f9fafb;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  text-align: center;
}

.simulation-blowup-grid small,
.simulation-blowup-gap small {
  color: #6b7280;
  font-size: 11px;
}

.simulation-blowup-grid b {
  font-size: 15px;
  word-break: keep-all;
}

.simulation-blowup-gap {
  color: #374151;
  background: #f9fafb;
  border-top: 1px solid #eef0f3;
}

.simulation-blowup-gap b {
  font-size: 16px;
  word-break: keep-all;
}

.simulation-blowup-gap > span {
  display: grid;
  justify-items: end;
  gap: 3px;
}

.simulation-blowup-gap > span i {
  color: #2563eb;
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
}

.simulation-blowup-conclusion {
  display: block;
  padding: 10px 12px 12px;
  color: #9a3412;
  background: #fff7ed;
  border-top: 1px solid #fed7aa;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.65;
}

.simulation-return-grid,
.simulation-annual-metrics,
.simulation-roll-metrics {
  display: grid;
  gap: 10px;
}

.simulation-return-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.simulation-return-grid > div,
.simulation-summary-metric,
.simulation-metric {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 12px 10px;
  box-sizing: border-box;
  color: #111827;
  background: #f9fafb;
  border: 0;
  border-radius: 8px;
  font: inherit;
  text-align: center;
}

.simulation-return-grid span,
.simulation-summary-metric span,
.simulation-metric span {
  color: #6b7280;
  font-size: 12px;
}

.simulation-return-grid strong,
.simulation-summary-metric strong,
.simulation-metric strong {
  overflow-wrap: normal;
  word-break: keep-all;
  font-size: 14px;
}

.simulation-metric:not(.static) {
  cursor: pointer;
}

.simulation-summary-metric {
  cursor: pointer;
}

.simulation-summary-metric:hover,
.simulation-summary-metric:focus-visible,
.simulation-metric:not(.static):hover,
.simulation-metric:not(.static):focus-visible {
  background: #eff6ff;
}

.simulation-equation {
  margin: 12px 0 0;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

.simulation-return-conclusion {
  margin: 12px 0 0;
  padding: 11px 12px;
  color: #374151;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.65;
}

.simulation-annual-section > .card-head {
  margin: 8px 4px 14px;
}

.simulation-year-card {
  margin-bottom: 14px;
  overflow: hidden;
}

.simulation-year-summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0;
  list-style: none;
  cursor: pointer;
}

.simulation-year-summary::-webkit-details-marker {
  display: none;
}

.simulation-year-card[open] .simulation-year-summary {
  padding-bottom: 12px;
  border-bottom: 1px solid #eef0f3;
}

.simulation-year-card h3 {
  margin: 0;
  font-size: 20px;
}

.simulation-year-body {
  display: block;
}

.simulation-year-total,
.simulation-year-cumulative {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 7px;
  padding: 0;
  color: #374151;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.simulation-year-total span {
  color: #6b7280;
  font-size: 12px;
}

.simulation-year-total strong {
  font-size: 15px;
}

.simulation-year-total i {
  min-width: 28px;
  color: #6b7280;
  font-size: 11px;
  font-style: normal;
  text-align: right;
}

.simulation-year-card[open] .simulation-year-total i {
  font-size: 0;
}

.simulation-year-card[open] .simulation-year-total i::after {
  content: "收起";
  font-size: 11px;
}

.simulation-annual-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0;
}

.simulation-annual-calculation {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 14px;
  padding: 0 12px;
  color: #374151;
  background: #f9fafb;
  border: 0;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.simulation-annual-calculation span {
  font-size: 12px;
  font-weight: 600;
}

.simulation-annual-calculation b {
  color: #2563eb;
  font-size: 12px;
}

.simulation-roll-details {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
}

.simulation-roll-details summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  list-style: none;
  background: #f9fafb;
  cursor: pointer;
}

.simulation-roll-details summary::-webkit-details-marker {
  display: none;
}

.simulation-roll-details summary span {
  display: grid;
  gap: 2px;
}

.simulation-roll-details summary strong {
  font-size: 13px;
}

.simulation-roll-details summary small,
.simulation-roll-details summary i {
  color: #6b7280;
  font-size: 11px;
  font-style: normal;
}

.simulation-roll-details[open] summary i {
  font-size: 0;
}

.simulation-roll-details[open] summary i::after {
  content: "收起";
  font-size: 11px;
}

.simulation-roll-entry {
  padding: 14px;
  border-top: 1px solid #eef0f3;
}

.simulation-roll-note {
  margin: 0;
  padding: 10px 14px;
  color: #6b7280;
  border-top: 1px solid #eef0f3;
  font-size: 11px;
  line-height: 1.55;
}

.simulation-roll-entry > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.simulation-roll-entry > header span {
  color: #6b7280;
  font-size: 12px;
}

.simulation-roll-entry > header span small {
  display: block;
  margin-top: 2px;
  color: #9ca3af;
  font-size: 11px;
}

.simulation-roll-entry > header strong {
  font-size: 14px;
}

.simulation-roll-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.simulation-roll-metrics .simulation-metric {
  min-height: 66px;
}

.simulation-roll-metrics .simulation-metric span {
  font-size: 11px;
}

.simulation-roll-metrics .simulation-metric strong {
  font-size: 12px;
}

.simulation-roll-spread {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 7px 10px;
  color: #374151;
  background: #f9fafb;
  border: 0;
  border-radius: 7px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.simulation-roll-spread > span {
  display: grid;
  gap: 2px;
}

.simulation-roll-spread strong {
  font-size: 12px;
}

.simulation-roll-spread small {
  color: #6b7280;
  font-size: 11px;
}

.simulation-roll-spread b {
  flex: none;
  color: #2563eb;
  font-size: 12px;
  text-align: right;
}

.simulation-empty-rolls {
  margin: 0;
  padding: 18px;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

.simulation-year-body > footer {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 0 12px;
  color: #374151;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 13px;
}

.simulation-year-body > footer strong {
  text-align: right;
}

.simulation-year-cumulative {
  width: 100%;
  justify-content: space-between;
}

.simulation-year-cumulative span {
  font-size: 13px;
}

.simulation-methodology {
  display: grid;
  gap: 5px;
  padding: 16px 20px;
  color: #6b7280;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.65;
}

.simulation-methodology strong {
  color: #4b5563;
}

.return-positive {
  color: #dc2626 !important;
}

.return-negative {
  color: #16a34a !important;
}

.return-flat {
  color: #6b7280 !important;
}

.simulation-detail-note {
  color: #6b7280;
  font-size: 13px;
  line-height: 1.65;
}

.simulation-detail-result {
  min-height: 52px;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  color: #111827;
  background: #f9fafb;
  font-size: 13px;
}

.simulation-detail-result span {
  color: #6b7280;
}

.simulation-detail-result strong {
  text-align: right;
}

/* 保证金测算与模拟滚IC复用卡片、表单和弹窗，只补充方向与长表格。 */
.margin-calculation-page {
  display: grid;
  gap: 16px;
}

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

.margin-direction-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  color: #4b5563;
  border: 0;
}

.margin-direction-field legend {
  min-height: 20px;
  margin-bottom: 7px;
  padding: 0;
  font-size: 13px;
}

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

.margin-direction button {
  width: 100%;
  min-width: 0;
  height: 36px;
}

.margin-wan-input input {
  padding-right: 54px;
}

.margin-wan-input i {
  width: 46px;
}

.margin-blowup-point strong {
  color: #111827;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.2;
}

.margin-clickable-rows {
  display: block;
}

.margin-clickable-rows .simulation-scenario-row {
  grid-template-columns: 150px minmax(0, 1fr);
  padding: 0 12px;
}

.margin-clickable-rows .simulation-scenario-row span {
  color: #6b7280;
  text-align: left;
}

.margin-clickable-rows .simulation-scenario-row i,
.margin-pressure-table i {
  color: #2563eb;
  font-style: normal;
  font-weight: 500;
}

.margin-clickable-rows .simulation-scenario-row strong {
  text-align: right;
}

.margin-table-wrap {
  width: 100%;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  -webkit-overflow-scrolling: touch;
}

.margin-pressure-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.margin-pressure-table th,
.margin-pressure-table td {
  height: 44px;
  box-sizing: border-box;
  padding: 8px 12px;
  border-bottom: 1px solid #eef0f3;
  color: #374151;
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.margin-pressure-table th {
  color: #6b7280;
  background: #f9fafb;
  font-weight: 600;
}

.margin-pressure-table th:first-child,
.margin-pressure-table td:first-child {
  text-align: left;
}

.margin-pressure-table tbody tr {
  cursor: pointer;
}

.margin-pressure-table tbody tr:hover {
  background: #f8fafc;
}

.margin-pressure-table tbody tr:last-child td {
  border-bottom: 0;
}

.margin-pressure-table tr.terminal td {
  color: #1d4ed8;
  background: #eff6ff;
  font-weight: 650;
}

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

  .simulation-intro-card,
  .simulation-condition-card,
  .simulation-scenario-card,
  .simulation-funds-card,
  .simulation-chart-card,
  .simulation-return-card,
  .simulation-year-card {
    padding: 18px 16px;
  }

  .simulation-svg-wrap,
  #simulation-chart {
    height: 280px;
  }

  .calculation-dialog-terms,
  .simulation-detail-result {
    grid-template-columns: 105px minmax(0, 1fr);
  }

  .margin-calculation-page .simulation-intro-card,
  .margin-calculation-page .simulation-condition-card,
  .margin-calculation-page .simulation-scenario-card,
  .margin-calculation-page .simulation-funds-card,
  .margin-calculation-page .simulation-chart-card {
    padding: 18px 16px;
  }

  .margin-pressure-table th,
  .margin-pressure-table td {
    padding-right: 5px;
    padding-left: 5px;
    font-size: 10px;
  }

  .margin-pressure-table th {
    white-space: normal;
  }
}

@media (max-width: 380px) {
  .simulation-form-grid {
    grid-template-columns: 1fr;
  }

  .simulation-reserved-funds-controls {
    grid-template-columns: 1fr;
  }

  .simulation-return-grid,
  .simulation-roll-metrics {
    gap: 6px;
  }

  .simulation-return-grid > div,
  .simulation-summary-metric,
  .simulation-metric {
    padding-left: 5px;
    padding-right: 5px;
  }

  .simulation-summary-metric strong {
    font-size: 12px;
  }

  .simulation-roll-metrics .simulation-metric span {
    min-height: 32px;
  }

  .simulation-summary-rows {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .simulation-scenario-row {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .margin-clickable-rows .simulation-scenario-row {
    grid-template-columns: 126px minmax(0, 1fr);
  }
}
