:root {
  --bg: #0c100d;
  --bg-2: #090c0a;
  --panel: #191b17;
  --panel-strong: #20211c;
  --panel-soft: rgba(255, 179, 71, 0.055);
  --surface: #131612;
  --surface-2: #20231e;
  --surface-3: #292c26;
  --line: rgba(236, 226, 207, 0.15);
  --line-soft: rgba(236, 226, 207, 0.085);
  --text: #f5f1e8;
  --text-2: #d8d2c6;
  --muted: #9d998f;
  --muted-2: #6f726b;
  --accent: #ffb347;
  --accent-strong: #ffd08a;
  --accent-deep: #5e421d;
  --danger: #ff6f7d;
  --warn: #ffb347;
  --good: #7ed6a1;
  --blue: #7fc8df;
  --up: #7ed6a1;
  --down: #ff6f7d;
  --up-soft: rgba(126, 214, 161, 0.1);
  --up-line: rgba(126, 214, 161, 0.26);
  --down-soft: rgba(255, 111, 125, 0.1);
  --down-line: rgba(255, 111, 125, 0.26);
  --accent-soft: rgba(255, 179, 71, 0.1);
  --accent-line: rgba(255, 179, 71, 0.3);
  --soft: rgba(255, 179, 71, 0.08);
  --glass: #191b17;
  --glass-border: rgba(236, 226, 207, 0.14);
  --radius: 8px;
  --radius-sm: 7px;
  --radius-xs: 6px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.46);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.22);
  --space-2xs: 4px;
  --space-xs: 6px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --z-sticky: 3;
  --z-modal-backdrop: 20;
  --z-modal: 21;
  --z-toast: 30;
  --z-tooltip: 31;
}

/* Account portfolio summary */
.account-equity-item {
  position: relative;
  justify-content: start;
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: var(--space-xs) calc(var(--space-sm) + 18px) var(--space-xs) var(--space-sm);
  color: inherit;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  box-shadow: none;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  transition: background 150ms ease, box-shadow 150ms ease;
}

.account-equity-item::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--space-sm);
  width: 6px;
  height: 6px;
  border-top: 1px solid var(--muted-2);
  border-right: 1px solid var(--muted-2);
  transform: translateY(-50%) rotate(45deg);
  transition: border-color 150ms ease, transform 150ms ease;
}

.account-equity-item:hover {
  color: inherit;
  background: rgba(255, 179, 71, 0.055);
  border-color: var(--line-soft);
}

.account-equity-item:hover::after {
  border-color: var(--accent);
  transform: translate(2px, -50%) rotate(45deg);
}

.account-equity-item:active {
  transform: none;
  background: rgba(255, 179, 71, 0.09);
}

.account-equity-item:focus-visible {
  z-index: 2;
  outline: 1px solid var(--accent);
  outline-offset: -2px;
}

.portfolio-summary-backdrop {
  z-index: calc(var(--z-modal-backdrop) + 2);
}

.portfolio-summary-modal {
  width: min(720px, 100%);
  max-height: min(820px, calc(100vh - 24px));
  border-color: rgba(255, 179, 71, 0.24);
}

.portfolio-summary-head {
  align-items: center;
}

.portfolio-summary-title-wrap,
.portfolio-summary-head-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.portfolio-summary-title-wrap {
  min-width: 0;
}

.portfolio-summary-title-icon {
  flex: 0 0 auto;
}

.portfolio-summary-head-actions {
  flex: 0 0 auto;
  gap: var(--space-xs);
}

.portfolio-summary-refresh.is-loading svg {
  animation: portfolio-summary-spin 800ms linear infinite;
}

.portfolio-summary-body {
  min-height: 340px;
  overflow: auto;
  overscroll-behavior: contain;
}

.portfolio-summary-loading {
  display: grid;
  gap: var(--space-sm);
}

.portfolio-summary-skeleton,
.portfolio-summary-skeleton-grid span {
  position: relative;
  overflow: hidden;
  background: #20231e;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
}

.portfolio-summary-skeleton::after,
.portfolio-summary-skeleton-grid span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 18%, rgba(255, 255, 255, 0.055) 48%, transparent 78%);
  transform: translateX(-100%);
  animation: portfolio-summary-shimmer 1.25s ease-in-out infinite;
}

.portfolio-summary-skeleton.hero {
  min-height: 126px;
}

.portfolio-summary-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
}

.portfolio-summary-skeleton-grid span {
  min-height: 82px;
}

.portfolio-summary-content {
  display: grid;
  gap: var(--space-sm);
}

.portfolio-summary-content[hidden],
.portfolio-summary-loading[hidden],
.portfolio-summary-error[hidden],
.portfolio-sharpe-content[hidden],
.portfolio-sharpe-empty[hidden] {
  display: none;
}

.portfolio-summary-content section {
  padding: 0;
  background: #151814;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.portfolio-summary-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(190px, 0.8fr);
  overflow: hidden;
}

.portfolio-summary-primary,
.portfolio-summary-invested {
  display: grid;
  align-content: center;
  gap: var(--space-xs);
  min-height: 126px;
  padding: var(--space-md);
}

.portfolio-summary-primary {
  background: linear-gradient(135deg, rgba(255, 179, 71, 0.12), rgba(255, 179, 71, 0.025));
  border-right: 1px solid var(--line-soft);
}

.portfolio-summary-primary > span,
.portfolio-summary-invested > span,
.portfolio-sharpe-primary > span,
.portfolio-summary-metric > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.portfolio-summary-primary strong,
.portfolio-summary-invested strong,
.portfolio-sharpe-primary strong,
.portfolio-summary-metric strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.portfolio-summary-primary strong {
  color: var(--accent-strong);
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1;
}

.portfolio-summary-invested strong {
  font-size: 17px;
  font-weight: 740;
}

.portfolio-summary-primary small,
.portfolio-summary-invested small,
.portfolio-sharpe-primary small,
.portfolio-summary-metric small {
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.35;
}

.portfolio-summary-section {
  overflow: hidden;
}

.portfolio-summary-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 34px;
  padding: 0 var(--space-sm);
  background: #20221d;
  border-bottom: 1px solid var(--line-soft);
}

.portfolio-summary-section-head > span {
  color: var(--text);
  font-size: 10px;
  font-weight: 760;
}

.portfolio-summary-section-head > small {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
}

.portfolio-summary-metrics {
  display: grid;
}

.portfolio-summary-metrics-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portfolio-summary-metrics-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portfolio-summary-metric {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 72px;
  padding: var(--space-sm);
  border-right: 1px solid var(--line-soft);
}

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

.portfolio-summary-metric strong {
  font-size: 13px;
  font-weight: 730;
}

.portfolio-summary-metric strong.tone-good,
.portfolio-sharpe-primary strong.tone-good {
  color: var(--good);
}

.portfolio-summary-metric strong.tone-danger,
.portfolio-sharpe-primary strong.tone-danger {
  color: var(--danger);
}

.portfolio-sharpe-content {
  display: grid;
  grid-template-columns: minmax(180px, 0.72fr) minmax(0, 1.28fr);
}

.portfolio-sharpe-primary {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 92px;
  padding: var(--space-sm) var(--space-md);
  background: rgba(126, 214, 161, 0.045);
  border-right: 1px solid var(--line-soft);
}

.portfolio-sharpe-primary strong {
  color: var(--good);
  font-size: 26px;
  font-weight: 780;
  line-height: 1;
}

.portfolio-sharpe-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portfolio-sharpe-metrics .portfolio-summary-metric {
  min-height: 92px;
}

.portfolio-sharpe-empty {
  padding: var(--space-lg) var(--space-md);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.portfolio-summary-footnote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 0 2px;
  color: var(--muted-2);
  font-size: 8px;
}

.portfolio-summary-footnote time {
  font-family: var(--mono);
}

.portfolio-summary-error {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--space-sm);
  min-height: 300px;
  padding: var(--space-lg);
  text-align: center;
}

.portfolio-summary-error-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--danger);
  background: rgba(255, 111, 125, 0.08);
  border: 1px solid rgba(255, 111, 125, 0.28);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 800;
}

.portfolio-summary-error strong {
  color: var(--text);
  font-size: 13px;
}

.portfolio-summary-error p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

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

@keyframes portfolio-summary-shimmer {
  to { transform: translateX(100%); }
}

@media (max-width: 700px) {
  .account-equity-item {
    min-height: 36px;
  }

  .portfolio-summary-modal {
    width: calc(100% - 12px);
    max-height: calc(100vh - max(8px, env(safe-area-inset-top)));
  }

  .portfolio-summary-body {
    min-height: 0;
    padding-bottom: max(var(--space-md), env(safe-area-inset-bottom));
  }

  .portfolio-summary-hero {
    grid-template-columns: 1fr;
  }

  .portfolio-summary-primary,
  .portfolio-summary-invested {
    min-height: 92px;
  }

  .portfolio-summary-primary {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .portfolio-summary-primary strong {
    font-size: 28px;
  }

  .portfolio-summary-metrics-three {
    grid-template-columns: 1fr;
  }

  .portfolio-summary-metrics-three .portfolio-summary-metric {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 52px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .portfolio-summary-metrics-three .portfolio-summary-metric:last-child {
    border-bottom: 0;
  }

  .portfolio-sharpe-content {
    grid-template-columns: 1fr;
  }

  .portfolio-sharpe-primary {
    min-height: 84px;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-summary-refresh.is-loading svg,
  .portfolio-summary-skeleton::after,
  .portfolio-summary-skeleton-grid span::after {
    animation: none;
  }
}

html {
  background: var(--bg);
  scrollbar-gutter: auto;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

html,
body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

[hidden] {
  display: none !important;
}

.ui-tooltip {
  --tooltip-arrow-left: 50%;
  position: fixed;
  z-index: var(--z-tooltip);
  width: max-content;
  max-width: min(320px, calc(100vw - 24px));
  padding: 8px 10px;
  color: var(--text);
  background: linear-gradient(145deg, #2a2d27, #181b17);
  border: 1px solid rgba(255, 208, 138, 0.28);
  border-radius: var(--radius-xs);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  font-size: 11px;
  font-weight: 620;
  line-height: 1.45;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px) scale(0.985);
  transform-origin: center;
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: pre-line;
}

.ui-tooltip::after {
  content: "";
  position: absolute;
  left: var(--tooltip-arrow-left);
  width: 8px;
  height: 8px;
  background: #1b1e1a;
  border: solid rgba(255, 208, 138, 0.28);
  transform: translateX(-50%) rotate(45deg);
}

.ui-tooltip[data-placement="top"]::after {
  bottom: -5px;
  border-width: 0 1px 1px 0;
}

.ui-tooltip[data-placement="bottom"]::after {
  top: -5px;
  border-width: 1px 0 0 1px;
}

.ui-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

[data-tooltip-open="true"]:focus-visible {
  outline-color: var(--accent-strong);
}

body::before {
  background:
    linear-gradient(90deg, rgba(255, 208, 138, 0.018) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 208, 138, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: none;
  opacity: 0.58;
}

main {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: var(--space-sm);
  max-width: 1520px;
  padding: var(--space-md) var(--space-md) 72px;
}

main > .account-card {
  grid-column: 1;
}

main > .forecast-section {
  grid-column: 2;
}

main > .ladder-section,
main > .grids-section,
main > .trade-section,
main > .modal-backdrop {
  grid-column: 1 / -1;
}

.account-card,
.metric,
section,
details.collapsible-section,
.grid-card {
  background: rgba(25, 27, 23, 0.97);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

section,
details.collapsible-section {
  padding: var(--space-md);
}

h2 {
  color: var(--text);
  font-size: 13px;
  font-weight: 760;
}

.section-icon {
  width: 26px;
  height: 26px;
  color: #2e1d07;
  background: var(--accent);
  border: 1px solid rgba(255, 219, 166, 0.42);
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.section-icon svg {
  width: 15px;
  height: 15px;
}

.account-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  align-items: start;
  gap: var(--space-sm) var(--space-md);
  height: auto;
  min-height: 0;
  padding: var(--space-md);
  overflow: hidden;
  color: var(--text);
  background: #1b1c18;
  border-color: rgba(255, 179, 71, 0.28);
}

.account-card::after {
  display: none;
}

.account-card .section-icon {
  color: #2e1d07;
  background: var(--accent);
  box-shadow: none;
}

.account-head {
  gap: var(--space-sm);
  min-width: 0;
}

.account-head h2 {
  color: var(--text);
  font-size: 13px;
}

.account-pill {
  max-width: 170px;
  min-height: 22px;
  padding: 0 var(--space-sm);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 680;
}

.account-actions {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: var(--space-sm);
  min-width: 0;
}

.account-switcher {
  align-self: center;
  gap: 2px;
  margin: 0;
  padding: 2px;
  background: #111410;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.account-switch-link {
  min-width: 48px;
  min-height: 24px;
  padding: 0 var(--space-sm);
  color: var(--muted);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 760;
}

.account-switch-link:hover,
.account-switch-link:focus-visible {
  color: var(--text);
  background: var(--surface-2);
}

.account-switch-link.active {
  color: #2e1d07;
  background: var(--accent);
  border-color: rgba(255, 219, 166, 0.32);
  box-shadow: none;
}

.ws-status {
  position: relative;
  top: auto;
  right: auto;
  z-index: 3;
  flex: 0 0 auto;
  min-width: 9px;
  width: 9px;
  min-height: 9px;
  height: 9px;
  padding: 0;
  border: 1px solid rgba(255, 111, 125, 0.36);
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 111, 125, 0.075), 0 0 12px rgba(255, 111, 125, 0.32);
  appearance: none;
  -webkit-appearance: none;
}

.ws-status.connected {
  background: var(--good);
  border-color: rgba(126, 214, 161, 0.44);
  box-shadow: 0 0 0 3px rgba(126, 214, 161, 0.085), 0 0 12px rgba(126, 214, 161, 0.36);
}

.ws-status.disconnected {
  background: var(--danger);
  border-color: rgba(255, 111, 125, 0.36);
}

.account-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(120px, 1.05fr) minmax(120px, 1.05fr) minmax(210px, 1.55fr) minmax(105px, 0.8fr) minmax(210px, 1.55fr);
  grid-template-areas: "available equity risk leverage fee";
  align-self: stretch;
  gap: 0;
  width: 100%;
  border-top: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  overflow: hidden;
}

.account-item {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 42px;
  padding: var(--space-xs) var(--space-sm);
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.account-item:nth-child(1) { grid-area: available; }
.account-item:nth-child(2) { grid-area: equity; }
.account-item:nth-child(3) { grid-area: risk; }
.account-item:nth-child(4) { grid-area: leverage; }
.account-item:nth-child(5) { grid-area: fee; }

.account-item > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 680;
}

.account-item > span::after {
  display: none;
}

.account-item strong,
.account-item strong .account-equity-current,
.account-item strong .account-equity-snapshot {
  color: var(--text);
}

.account-item strong {
  font-size: 13px;
  font-weight: 760;
}

.account-risk-item {
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  justify-content: start;
  min-height: 42px;
}

.account-risk-item > span {
  align-self: center;
}

.account-risk-item strong {
  color: var(--good);
}

.account-fee-item {
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
}

.account-fee-item,
.account-risk-item {
  flex: none;
}

.account-risk-breakdown,
.account-fee-breakdown {
  color: var(--muted-2);
  font-size: 9px;
  font-weight: 620;
}

.account-item strong.tone-warn,
.account-risk-item strong.tone-warn {
  color: var(--accent);
}

.account-item strong.tone-danger,
.account-risk-item strong.tone-danger {
  color: var(--danger);
}

.forecast-section {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 0;
  padding: var(--space-sm);
  background: #151814;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.forecast-heading {
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  list-style: none;
  cursor: pointer;
  user-select: none;
}

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

.forecast-heading:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.forecast-section:not([open]) .forecast-heading {
  margin-bottom: 0;
}

.forecast-heading-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  min-width: 0;
  flex: 0 0 auto;
}

.forecast-toggle {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-right: 2px;
  border-right: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.forecast-section[open] .forecast-toggle {
  transform: translateY(2px) rotate(225deg);
}

.forecast-title {
  gap: var(--space-sm);
  min-width: 0;
}

.forecast-title h2 {
  font-size: 13px;
}

.forecast-title > div > span {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

.forecast-icon {
  color: #2e1d07;
  background: var(--accent);
  box-shadow: none;
}

.forecast-boundary {
  max-width: none;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.forecast-body {
  grid-template-columns: minmax(240px, 0.74fr) minmax(0, 2.4fr);
  flex: 1 1 auto;
  border-color: var(--line-soft);
}

.forecast-critical {
  grid-template-columns: minmax(0, 1.45fr) minmax(96px, 0.65fr);
  border-color: var(--line-soft);
}

.forecast-primary {
  padding: var(--space-md) var(--space-md) var(--space-sm) 0;
}

.forecast-primary + .forecast-primary {
  padding-left: var(--space-md);
  border-color: var(--line-soft);
}

.forecast-primary > span,
.forecast-metric > span {
  color: var(--muted);
  font-size: 9px;
}

.forecast-primary strong {
  margin-top: var(--space-2xs);
  color: var(--accent);
  font-size: 21px;
  font-weight: 820;
}

.forecast-primary small {
  margin-top: var(--space-2xs);
  color: var(--muted-2);
  font-size: 8px;
}

.forecast-ratio strong {
  color: var(--danger);
}

.forecast-metrics {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-soft);
}

.forecast-metric {
  display: grid;
  align-content: center;
  min-height: 52px;
  padding: var(--space-xs) var(--space-sm);
  border-color: var(--line-soft);
}

.account-card .forecast-metric,
.account-card .forecast-metric:nth-child(3n),
.account-card .forecast-metric:nth-child(4n),
.account-card .forecast-metric:nth-last-child(-n + 3) {
  background: #181b17;
  border: 0;
}

.forecast-metric strong {
  margin-top: 3px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 720;
}

.forecast-metric.loss strong,
.forecast-metric.fee strong {
  color: #ff9a78;
}

.forecast-model {
  padding-top: var(--space-xs);
  color: var(--muted-2);
  font-size: 8px;
}

.forecast-unavailable {
  flex: 1 1 auto;
  min-height: 70px;
  color: var(--muted);
  border-color: var(--line-soft);
}

.account-card .forecast-unavailable {
  min-height: 48px;
}

.ladder-section {
  --ladder-cols: 32px minmax(0, 1fr) auto;
  --ladder-gap: var(--space-xs);
  --ladder-inline: var(--space-sm);
  --ladder-ask: var(--accent);
  --ladder-ask-strong: var(--accent-strong);
  --ladder-ask-soft: var(--accent-soft);
  --ladder-ask-line: var(--accent-line);
  --ladder-bid: var(--blue);
  --ladder-bid-strong: #c5ebf5;
  --ladder-bid-soft: rgba(127, 200, 223, 0.12);
  --ladder-bid-line: rgba(127, 200, 223, 0.3);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md);
}

.ladder-heading {
  display: grid;
  grid-template-columns: minmax(56px, 1fr) max-content minmax(210px, 1fr);
  align-items: center;
  gap: 0;
  min-height: 36px;
  margin-bottom: 0;
  padding: 4px 6px;
  background: #111410;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.ladder-title {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  grid-column: 1;
  grid-row: 1;
  flex: 0 0 auto;
  gap: 0;
  min-width: 32px;
  min-height: 26px;
}

.ladder-title .section-icon {
  width: 32px;
  height: 26px;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.ladder-title .section-icon svg {
  width: 15px;
  height: 15px;
}

.ladder-sync {
  max-width: 220px;
  padding-right: var(--space-sm);
  color: var(--muted-2);
  font-size: 9px;
}

.ladder-spread {
  display: inline-flex;
  align-items: baseline;
  justify-self: center;
  grid-column: 2;
  grid-row: 1;
  gap: 8px;
  min-width: 0;
  max-width: none;
  padding: 0 18px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  font-weight: 620;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ladder-spread[hidden] {
  display: none;
}

.ladder-spread strong {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 780;
  letter-spacing: -0.02em;
}

.ladder-spread em {
  padding-left: 8px;
  color: var(--muted-2);
  border-left: 1px solid var(--line-soft);
  font-size: 9px;
  font-style: normal;
  font-weight: 620;
  letter-spacing: 0;
}

.ladder-spread em::before {
  content: none;
}

.ladder-stats {
  display: flex;
  justify-self: end;
  grid-column: 3;
  grid-row: 1;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 0;
  width: max-content;
  min-width: 0;
  max-width: none;
  padding-left: 0;
  overflow: visible;
  background: transparent;
  scrollbar-width: auto;
  -webkit-overflow-scrolling: auto;
}

.ladder-stat,
.pill {
  min-height: 24px;
  box-shadow: none;
}

.ladder-stat {
  flex: 0 0 102px;
  min-height: 24px;
  height: 24px;
  gap: 6px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-left: 1px solid var(--line-soft);
  border-radius: 0;
  font-size: 10px;
  font-weight: 680;
}

.ladder-stat.close,
.ladder-stat.open {
  color: var(--muted);
  background: transparent;
  border-color: var(--line-soft);
}

.ladder-stat::before {
  width: 5px;
  height: 5px;
}

.ladder-stat.close::before {
  background: var(--up);
}

.ladder-stat.open::before {
  background: var(--down);
}

.ladder-stat strong {
  font-size: 13px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
}

.ladder-stat.close strong {
  color: var(--up);
}

.ladder-stat.open strong {
  color: var(--down);
}

.ladder-current,
.ladder-row {
  display: grid;
  grid-template-columns: var(--ladder-cols);
  column-gap: var(--ladder-gap);
  padding: 0 var(--ladder-inline);
}

.ladder-current {
  position: sticky;
  top: 0;
  z-index: 1;
  align-items: center;
  min-height: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
}

.ladder-current.ask {
  background: rgba(255, 179, 71, 0.035);
  border-bottom-color: var(--line-soft);
  box-shadow: none;
}

.ladder-current.bid {
  background: rgba(255, 255, 255, 0.02);
  border-bottom-color: var(--line-soft);
  box-shadow: none;
}

.ladder-current-main {
  display: contents;
}

.ladder-current-label {
  justify-self: start;
  color: var(--muted);
  font-size: 8px;
  font-weight: 680;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.ladder-current.ask .ladder-current-label {
  color: rgba(255, 179, 71, 0.62);
}

.ladder-current.bid .ladder-current-label {
  color: var(--muted);
}

.ladder-current-qty {
  justify-self: end;
  min-width: 0;
  overflow: visible;
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 560;
  letter-spacing: -0.02em;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.ladder-current strong {
  justify-self: start;
  min-width: 0;
  overflow: visible;
  color: var(--text);
  font-size: 12px;
  font-weight: 740;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ladder-current.ask strong,
.ladder-current.bid strong {
  color: var(--text);
}

.close-summary {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 5px;
  margin-bottom: 0;
  padding: 4px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  background: #111410;
  border-color: var(--line-soft);
  border-radius: var(--radius);
  scrollbar-width: thin;
}

.close-summary-operator {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 14px;
  min-width: 14px;
  width: 14px;
  height: 14px;
  align-self: center;
  color: var(--muted-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 860;
  line-height: 1;
}

.close-summary-operator.equals {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.close-summary-item,
.grid-highlight,
.derived-item,
.preview-metric {
  background: #181b17;
  border-color: var(--line-soft);
  box-shadow: none;
}

.close-summary-item {
  flex: 0 0 auto;
  gap: 2px;
  box-sizing: border-box;
  width: max-content;
  min-width: 80px;
  min-height: 32px;
  overflow: visible;
  padding: 4px 7px;
  border-radius: 5px;
}

button.close-summary-item {
  width: max-content;
  min-height: 32px;
  padding: 4px 7px;
  color: inherit;
  font: inherit;
  text-align: left;
  appearance: none;
}

button.close-summary-item.seed {
  cursor: default;
  transition: background 140ms ease, border-color 140ms ease;
}

button.close-summary-item.seed:hover,
button.close-summary-item.seed:focus-visible {
  background: rgba(255, 179, 71, 0.075);
  border-color: var(--accent-line);
  outline: none;
}

button.close-summary-item.seed:active {
  transform: none;
  background: rgba(255, 179, 71, 0.11);
}

button.close-summary-item.open-unclosed.operable {
  cursor: pointer;
  border-color: var(--accent-line);
}

button.close-summary-item.open-unclosed.operable:hover,
button.close-summary-item.open-unclosed.operable:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

button.close-summary-item:disabled {
  color: inherit;
  opacity: 1;
}

.close-summary-item::before {
  width: 2px;
}

.close-summary-item span,
.grid-highlight-label,
.grid-detail-title,
.preview-metric span {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0;
}

.close-summary-item span {
  font-size: 7px;
  line-height: 1;
}

.close-summary-values {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 6px;
  min-width: min-content;
  font-variant-numeric: tabular-nums;
}

.close-summary-values strong,
.close-summary-item.total strong {
  flex: 0 1 auto;
  min-width: min-content;
  overflow: visible;
  color: var(--text);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-overflow: clip;
  white-space: nowrap;
}

.close-summary-unit {
  margin-left: 2px;
  color: var(--muted-2);
  font-size: 6px;
  font-weight: 560;
  letter-spacing: 0.04em;
  line-height: 1;
  vertical-align: -0.12em;
}

.close-summary-ordinary-recycled .close-summary-unit {
  margin-left: 1px;
  font-size: 5px;
}

.close-summary-values em,
.close-summary-drift {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 7px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.close-summary-item.seed,
.close-summary-item.ordinary {
  gap: 2px;
  font-variant-numeric: tabular-nums;
}

.close-summary-ordinary-recycled {
  grid-template-columns: 8px 8px minmax(min-content, 1fr) auto;
  gap: 1px 3px;
  padding-top: 2px;
  border-top-color: var(--accent-line);
}

.close-summary-ordinary-recycled > span,
.close-summary-ordinary-recycled b,
.close-summary-ordinary-recycled strong,
.close-summary-ordinary-recycled em {
  overflow: visible;
  font-size: 7px;
  text-overflow: clip;
  white-space: nowrap;
}

.close-summary-ordinary-recycled strong {
  min-width: min-content;
  letter-spacing: -0.03em;
}

.close-summary-item.total {
  background: rgba(255, 179, 71, 0.08);
  border-color: var(--accent-line);
}

.close-summary-label {
  flex-wrap: nowrap;
  gap: 6px;
  width: max-content;
  min-width: max-content;
}

.close-summary-drift {
  flex: 0 0 auto;
  width: max-content;
  min-width: max-content;
  max-width: none;
  margin-left: 0;
  overflow: visible;
  text-overflow: clip;
}

.close-summary-drift.warn {
  color: var(--accent);
}

button.close-summary-drift {
  min-height: 14px;
  padding: 1px 4px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 820;
}

button.close-summary-drift:not(:disabled) {
  color: var(--accent);
  cursor: pointer;
}

button.close-summary-drift:not(:disabled):hover {
  color: var(--accent-strong);
  background: rgba(255, 179, 71, 0.16);
  border-color: var(--accent);
}

button.close-summary-drift:disabled {
  cursor: default;
  opacity: 0.72;
}

.ladder-grid {
  background: #0f120f;
  border-color: var(--line-soft);
  border-radius: var(--radius);
}

.ladder-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ladder-panel + .ladder-panel {
  border-color: var(--line-soft);
}

.ladder-rows,
.ladder-empty {
  --ladder-visible-rows: 5;
  --ladder-row-size: 30px;
  min-height: calc(var(--ladder-visible-rows) * var(--ladder-row-size));
}

.ladder-rows {
  max-height: calc(var(--ladder-visible-rows) * var(--ladder-row-size));
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  scrollbar-width: thin;
}

.ladder-rows::-webkit-scrollbar {
  width: 5px;
}

.ladder-rows::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.ladder-row {
  align-items: center;
  min-height: 30px;
  border-color: var(--line-soft);
  transition: background 140ms ease;
}

.ladder-row.close:hover {
  background: var(--up-soft);
}

.ladder-row.open:hover {
  background: var(--down-soft);
}

.order-marker {
  justify-self: start;
}

.order-kind {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 8px;
}

.ladder-price {
  justify-self: start;
  min-width: 0;
  overflow: visible;
  font-size: 12px;
  font-weight: 740;
  letter-spacing: -0.02em;
  text-overflow: clip;
}

.ladder-qty {
  justify-self: end;
  min-width: 0;
  overflow: visible;
  color: var(--muted);
  font-size: 10px;
  font-weight: 560;
  letter-spacing: -0.02em;
  text-align: right;
}

.seed-badge {
  right: -3px;
  bottom: -3px;
  width: 8px;
  height: 8px;
  background: var(--bg-2);
  border-radius: 3px;
  font-size: 6px;
}

.reprice-badge {
  right: -3px;
  bottom: -3px;
  width: 8px;
  height: 8px;
  color: var(--accent);
  background: var(--bg-2);
  border-color: var(--accent-line);
  border-radius: 3px;
  font-size: 6px;
}

.section-heading,
.trade-section > h2 {
  min-height: 26px;
  margin-bottom: var(--space-sm);
}

.section-heading {
  gap: var(--space-sm);
}

.section-heading h2 {
  gap: var(--space-sm);
  min-height: 26px;
}

.grid-list-summary {
  min-height: 30px;
  height: 30px;
  padding: 3px;
  background: #111410;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.grid-summary-coin,
.grid-summary-meta,
.grid-summary-status,
.grid-summary-direction {
  min-height: 22px;
  height: 22px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.grid-list-summary > :not(:first-child) {
  border-left: 1px solid var(--line-soft);
}

.grid-summary-coin {
  gap: var(--space-xs);
  padding: 0 var(--space-sm) 0 2px;
  color: var(--text);
  font-size: 10px;
  font-weight: 820;
  letter-spacing: 0.04em;
}

.grid-summary-coin svg,
.grid-summary-coin .grid-symbol-icon {
  width: 18px;
  height: 18px;
}

.grid-symbol-icon {
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 50%;
}

.grid-summary-coin.missing .grid-symbol-icon {
  display: none;
}

.grid-summary-meta,
.grid-summary-status {
  padding: 0 var(--space-sm);
  font-size: 9px;
}

.grid-summary-status {
  gap: 5px;
  min-width: 30px;
  font-family: var(--mono);
}

button.grid-summary-status {
  min-height: 22px;
  height: 22px;
  margin: 0;
  padding: 0 var(--space-sm);
  color: var(--up);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  box-shadow: none;
}

button.grid-summary-status:hover,
button.grid-summary-status:focus-visible {
  color: var(--up);
  background: var(--surface-2);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

button.grid-summary-status.warn,
button.grid-summary-status.warn:hover,
button.grid-summary-status.warn:focus-visible {
  color: var(--accent-strong);
}

button.grid-summary-status.danger,
button.grid-summary-status.danger:hover,
button.grid-summary-status.danger:focus-visible {
  color: var(--down);
}

button.grid-summary-status.is-expanded {
  min-width: max-content;
  padding: 0 10px;
  font-family: inherit;
  letter-spacing: 0;
}

.grid-summary-status::before {
  width: 4px;
  height: 4px;
}

.grid-summary-direction {
  gap: var(--space-2xs);
  padding: 0 var(--space-sm);
  font-size: 9px;
  font-weight: 720;
}

.grid-summary-direction.long {
  color: var(--up);
}

.grid-summary-direction.short {
  color: var(--down);
}

.grid-inline-range {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  min-width: 0;
  color: var(--text-2);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  letter-spacing: -0.01em;
}

.grid-range-bound {
  flex: 0 1 auto;
  min-width: 0;
}

.grid-range-arrow {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.9em;
  font-weight: 820;
  opacity: 0.78;
}

.grid-list-actions {
  gap: var(--space-xs);
}

.add-grid-inline,
.icon-btn {
  min-height: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
}

.add-grid-inline {
  padding: 0 var(--space-md);
}

.icon-btn {
  width: 34px;
  min-width: 34px;
  color: var(--text-2);
  background: var(--surface-2);
  border-color: var(--line);
}

.icon-btn:hover {
  color: var(--accent);
  background: var(--surface-3);
  border-color: var(--accent-line);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.grid-refresh-button {
  --refresh-visual-size: 30px;
  position: relative;
  isolation: isolate;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.grid-refresh-button::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: -1;
  width: var(--refresh-visual-size);
  height: var(--refresh-visual-size);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transform: translate(-50%, -50%);
  transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}

.grid-refresh-button svg {
  position: relative;
  width: 14px;
  height: 14px;
  transition: color 150ms ease;
}

.grid-refresh-button:hover,
.grid-refresh-button:focus-visible {
  color: var(--accent-strong);
  background: transparent;
  border: 0;
  outline: none;
}

.grid-refresh-button:hover::before,
.grid-refresh-button:focus-visible::before {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.grid-refresh-button:active::before {
  transform: translate(-50%, -50%) scale(0.94);
}

.grid-refresh-button:active {
  transform: none;
}

.grid-refresh-button.refreshing,
.grid-refresh-button.refreshing:disabled {
  color: var(--accent);
  cursor: progress;
  opacity: 1;
}

.grid-refresh-button.refreshing::before {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.grid-refresh-button.refreshing svg {
  animation-duration: 0.72s;
}

.grid-list {
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: var(--space-sm);
}

.grid-card {
  gap: var(--space-sm);
  padding: var(--space-md);
  background: #171a16;
  border-color: var(--line);
}

.grid-card-head {
  gap: var(--space-xs);
}

.grid-card-headline,
.grid-title-row {
  gap: var(--space-xs);
}

.grid-title,
.grid-inline-meta,
.pill {
  border-radius: var(--radius-xs);
}

.grid-title {
  min-height: 26px;
  padding: 0 var(--space-sm);
  color: #2e1d07;
  background: var(--accent);
  border-color: rgba(255, 219, 166, 0.32);
  font-size: 11px;
  letter-spacing: 0;
}

.grid-title-icon {
  width: 13px;
  height: 13px;
}

.grid-inline-meta {
  min-height: 26px;
  padding: 0 var(--space-sm);
  background: var(--surface);
  border-color: var(--line-soft);
  font-size: 10px;
}

.pill {
  padding: 2px var(--space-sm);
  font-size: 9px;
}

.grid-highlights {
  gap: var(--space-xs);
}

.grid-highlight {
  padding: var(--space-sm);
  border-radius: var(--radius-xs);
}

.grid-highlight-value {
  margin-top: 3px;
  font-size: 12px;
}

.grid-highlight-value.val-accent,
.grid-field strong.val-accent,
.grid-field strong.val-warn,
.warning-list li,
.trade-day-stat strong {
  color: var(--accent);
}

.grid-detail-block {
  gap: var(--space-xs);
}

.grid-detail-block + .grid-detail-block {
  padding-top: var(--space-sm);
  border-color: var(--line-soft);
}

.grid-fields,
.grid-fields-compact {
  gap: var(--space-xs) var(--space-md);
}

.grid-field {
  gap: var(--space-2xs);
}

.grid-field-key {
  color: var(--muted);
  font-size: 10px;
}

.grid-field strong {
  font-size: 11px;
  line-height: 1.3;
}

.grid-fields-position {
  --position-grid-columns: repeat(4, minmax(0, 1fr));
  grid-template-columns: var(--position-grid-columns);
  gap: var(--space-xs) var(--space-sm);
}

.grid-fields-position .grid-field-key {
  font-size: 9px;
}

.grid-fields-position .grid-field strong {
  font-size: 10px;
}

.grid-field-take-profit {
  grid-column: span 2;
}

.take-profit-value-btn {
  display: block;
  width: fit-content;
  min-width: 0;
  min-height: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
}

.take-profit-value-btn:hover,
.take-profit-value-btn:focus-visible {
  color: inherit;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.take-profit-value-btn > strong {
  overflow-wrap: normal;
  white-space: nowrap;
  text-wrap: nowrap;
}

.take-profit-value-btn:hover > strong,
.take-profit-value-btn:focus-visible > strong {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.grid-meta-footer {
  gap: var(--space-xs);
  padding-top: 0;
  font-size: 9px;
}

.grid-updated strong {
  font-size: 9px;
}

.window-toggle {
  color: var(--accent);
  text-underline-offset: 3px;
}

.window-toggle:hover {
  color: var(--accent-strong);
}

.window-detail {
  margin-top: 0;
  padding: var(--space-sm);
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  border-radius: var(--radius-xs);
  font-size: 10px;
}

.grid-card-actions {
  gap: var(--space-xs);
  padding-top: var(--space-sm);
  border-color: var(--line-soft);
}

.grid-card-actions button {
  min-height: 34px;
  padding: 0 var(--space-sm);
  border-radius: var(--radius-xs);
  font-size: 10px;
}

button {
  min-height: 38px;
  padding: 0 var(--space-md);
  color: var(--text-2);
  background: var(--surface-2);
  border-color: var(--line);
  border-radius: var(--radius-xs);
  box-shadow: none;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 80ms ease;
}

button:hover {
  color: var(--text);
  background: var(--surface-3);
  border-color: rgba(255, 208, 138, 0.24);
}

button.primary,
.add-grid-inline,
button[data-restart],
button[data-early],
#editEarlyStartBtn {
  color: #2e1d07;
  background: var(--accent);
  border-color: rgba(255, 219, 166, 0.38);
  box-shadow: none;
}

button.primary:hover,
.add-grid-inline:hover,
button[data-restart]:hover,
button[data-early]:hover,
#editEarlyStartBtn:hover {
  color: #201203;
  background: var(--accent-strong);
  border-color: rgba(255, 219, 166, 0.56);
}

button.danger,
button[data-stop],
button[data-delete] {
  color: var(--danger);
  background: var(--down-soft);
  border-color: var(--down-line);
}

.btn-icon {
  width: 15px;
  height: 15px;
}

.trade-section > h2 {
  gap: 0;
}

.trade-heading {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
  min-height: 30px;
  height: 30px;
  max-width: 100%;
  margin-bottom: var(--space-sm);
  padding: 0;
  overflow: hidden;
  background: #111410;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.trade-heading::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.trade-heading .section-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: var(--radius-xs);
  box-shadow: none;
}

.trade-heading .section-icon svg {
  width: 12px;
  height: 12px;
}

.trade-title-text {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 22px;
  padding: 0 10px;
  color: var(--text-2);
  border-left: 1px solid var(--line-soft);
  font-size: 9px;
  font-weight: 760;
  line-height: 1;
}

.trade-fee-rate {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  height: 20px;
  padding: 0 5px;
  color: var(--text-2);
  border-left: 1px solid var(--line-soft);
  font-size: 8px;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}

.trade-profit-toast-stack {
  position: fixed;
  top: calc(env(safe-area-inset-top) + var(--space-lg));
  left: 50%;
  z-index: var(--z-toast);
  display: grid;
  gap: 0;
  width: min(480px, calc(100vw - 32px));
  pointer-events: none;
  transform: translateX(-50%);
}

.trade-profit-toast {
  grid-area: 1 / 1;
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 7px 10px;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  background: #1d211b;
  border: 1px solid var(--up-line);
  border-radius: var(--radius);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  cursor: pointer;
  pointer-events: auto;
  animation: trade-profit-toast-enter 220ms cubic-bezier(0.2, 0.75, 0.28, 1) both;
  transition: margin-bottom 190ms cubic-bezier(0.2, 0.75, 0.28, 1), padding-right 160ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.trade-profit-toast-stack.has-multiple:not(.is-expanded) > .trade-profit-toast {
  cursor: zoom-in;
}

.trade-profit-toast-stack.is-expanded {
  display: flex;
  flex-direction: column-reverse;
}

.trade-profit-toast-stack.is-expanded > .trade-profit-toast {
  grid-area: auto;
}

.trade-profit-toast-stack.is-expanded > .trade-profit-toast + .trade-profit-toast {
  margin-bottom: var(--space-xs);
}

.trade-profit-toast:hover,
.trade-profit-toast:focus-visible {
  background: #23271f;
  border-color: rgba(126, 214, 161, 0.48);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(126, 214, 161, 0.08);
}

.trade-profit-toast:active {
  transform: translateY(1px);
}

.trade-profit-toast.is-leaving {
  pointer-events: none;
  animation: trade-profit-toast-exit 180ms ease both;
}

.trade-profit-toast-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #14251b;
  background: var(--good);
  border: 1px solid rgba(208, 247, 221, 0.34);
  border-radius: var(--radius-xs);
}

.trade-profit-toast-mark svg {
  width: 17px;
  height: 17px;
}

.trade-profit-toast-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.trade-profit-toast-head,
.trade-profit-toast-route {
  display: flex;
  align-items: center;
  min-width: 0;
}

.trade-profit-toast-head {
  gap: var(--space-xs);
}

.trade-profit-toast-label {
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 780;
  white-space: nowrap;
}

.trade-profit-toast-time {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-profit-toast-route {
  gap: var(--space-xs);
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  white-space: nowrap;
}

.trade-profit-toast-route strong {
  color: var(--text-2);
  font-size: 10px;
  font-weight: 680;
}

.trade-profit-toast-arrow {
  color: var(--accent);
  font-family: sans-serif;
  font-style: normal;
}

.trade-profit-toast-pnl {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 3px;
  color: var(--good);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}

.trade-profit-toast-pnl small {
  color: rgba(126, 214, 161, 0.72);
  font-size: 8px;
  font-weight: 700;
}

.trade-profit-toast.trade-open-toast {
  grid-template-columns: 30px minmax(0, 1fr);
  border-color: var(--accent-line);
}

.trade-open-toast:hover,
.trade-open-toast:focus-visible {
  border-color: rgba(255, 179, 71, 0.52);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(255, 179, 71, 0.08);
}

.trade-open-toast .trade-profit-toast-mark {
  color: #2e1d07;
  background: var(--accent);
  border-color: rgba(255, 219, 166, 0.42);
}

.trade-open-toast .trade-profit-toast-label {
  color: var(--accent-strong);
}

.trade-open-toast .trade-profit-toast-route strong {
  color: var(--blue);
}

@keyframes trade-profit-toast-enter {
  from { opacity: 0; transform: translateY(-10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes trade-profit-toast-exit {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(14px); }
}

.trade-day-stats {
  align-self: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 0;
  height: 22px;
  margin-left: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
}

.trade-day-stat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  gap: 2px;
  height: 22px;
  padding: 0 5px;
  overflow: hidden;
  border-left: 1px solid var(--line-soft);
  white-space: nowrap;
}

.trade-day-label {
  color: var(--muted);
  font-family: inherit;
  font-size: 9px;
  font-weight: 680;
}

.trade-day-stat .trade-day-count,
.trade-day-stat .trade-day-pnl {
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  line-height: 1;
}

.trade-day-divider {
  color: var(--muted-2);
  font-size: 8px;
  opacity: 0.7;
}

.trade-day-stat .trade-day-pnl.pnl-positive {
  color: var(--up);
}

.trade-day-stat .trade-day-pnl.pnl-negative {
  color: var(--down);
}

.table-wrap {
  background: #10130f;
  border-color: var(--line-soft);
  border-radius: var(--radius);
}

.trade-wrap {
  height: 214px;
  max-height: 214px;
}

.trade-table-frame {
  width: 100%;
  height: 214px;
  overflow: hidden;
  background: #10130f;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.trade-table-frame .trade-wrap {
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  overflow: auto;
  background: #10130f;
  border: 0;
  border-radius: 0;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: auto;
}

.trade-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.trade-table th {
  z-index: var(--z-sticky);
  height: 30px;
  color: var(--muted);
  background: #20221d;
  border-color: var(--line);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.24);
  font-size: 9px;
  letter-spacing: 0;
}

.trade-table td {
  height: 36px;
  background: #151814;
  font-size: 10px;
}

.trade-table tbody tr:hover td,
.trade-table tbody tr:not(.table-empty):not(.trade-loading):hover td:nth-child(1),
.trade-table tbody tr:not(.table-empty):not(.trade-loading):hover td:nth-child(2) {
  background: #20231e;
}

.trade-table tbody tr:not(.table-empty):not(.trade-loading) td:nth-child(1),
.trade-table tbody tr:not(.table-empty):not(.trade-loading) td:nth-child(2) {
  background: #151814;
}

.time-cell {
  font-size: 9px;
  letter-spacing: 0;
}

.empty-state {
  padding: var(--space-lg);
  background: #10130f;
  border-color: var(--line);
  border-radius: var(--radius);
}

.modal-backdrop {
  z-index: var(--z-modal-backdrop);
  padding: var(--space-md);
  background: rgba(5, 7, 5, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  z-index: var(--z-modal);
  max-height: min(760px, calc(100vh - 24px));
  background: #171a16;
  border-color: var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.modal-head {
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: #20221d;
  border-color: var(--line-soft);
  backdrop-filter: none;
}

.modal-title {
  gap: 2px;
}

.modal-title strong {
  font-size: 14px;
}

.modal-title span {
  color: var(--muted);
  font-size: 10px;
}

.modal-body {
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md) var(--space-md);
}

.ws-status-modal {
  width: min(500px, 100%);
}

.ws-status-hero,
.ws-cache-maintenance {
  border-radius: var(--radius);
}

.ws-status-hero {
  gap: var(--space-md);
  padding: var(--space-md);
  background: #10130f;
  border-color: var(--line);
}

.ws-status-details {
  border-color: var(--line);
  border-radius: var(--radius);
}

.ws-status-details > div {
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: #151814;
  border-color: var(--line-soft);
}

.ws-cache-maintenance {
  gap: var(--space-xs);
  padding: var(--space-md);
  background: rgba(255, 179, 71, 0.075);
}

.ws-status-actions {
  gap: var(--space-xs);
}

.cache-clear-btn {
  color: var(--accent-strong);
  background: rgba(255, 179, 71, 0.08);
  border-color: var(--accent-line);
}

.confirm-backdrop {
  z-index: calc(var(--z-toast) + 2);
  padding: var(--space-md);
  background: rgba(5, 7, 5, 0.84);
}

.confirm-modal {
  width: min(420px, 100%);
  max-height: calc(100vh - 24px);
  background: #171a16;
  border-color: rgba(255, 179, 71, 0.22);
  border-radius: 12px;
}

.confirm-hero {
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-lg) var(--space-md);
}

.confirm-icon {
  width: 40px;
  height: 40px;
  color: #2e1d07;
  background: var(--accent);
  border-color: rgba(255, 208, 138, 0.36);
  border-radius: 10px;
  box-shadow: none;
}

.confirm-icon-svg {
  width: 20px;
  height: 20px;
}

.confirm-copy {
  gap: var(--space-xs);
}

.confirm-kicker {
  color: var(--accent-strong);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.confirm-copy strong {
  font-size: 16px;
}

.confirm-copy p {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.confirm-detail {
  padding: var(--space-sm) var(--space-md);
  background: #10130f;
  border-color: var(--line-soft);
  border-radius: var(--radius-xs);
  font-size: 10px;
}

.confirm-actions {
  gap: var(--space-xs);
  padding: 0 var(--space-lg) var(--space-lg);
}

.confirm-actions button {
  min-width: 108px;
}

.confirm-modal.preview-only .confirm-hero {
  display: none;
}

.confirm-modal.preview-only .confirm-preview {
  margin: var(--space-lg) var(--space-lg) var(--space-md);
  padding: var(--space-md);
}

.confirm-modal.preview-only .confirm-actions {
  padding-top: 0;
}

.confirm-modal.tone-danger {
  border-color: rgba(255, 111, 125, 0.34);
}

.confirm-modal.tone-danger .confirm-icon {
  color: #2b0509;
  background: var(--danger);
  border-color: var(--down-line);
}

.confirm-modal.tone-warn .confirm-icon {
  background: var(--accent-strong);
}

.modal-backdrop.seed-close-detail-backdrop {
  z-index: calc(var(--z-modal-backdrop) + 2);
  align-items: flex-end;
  padding: var(--space-md) var(--space-md) 0;
  background: rgba(5, 7, 5, 0.84);
}

.modal.seed-close-detail-modal {
  width: min(640px, 100%);
  height: 70vh;
  height: 70dvh;
  max-height: 70vh;
  max-height: 70dvh;
  overflow: hidden;
  background: #121512;
  border-color: rgba(236, 226, 207, 0.16);
  border-radius: calc(var(--radius) + var(--space-2xs));
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.52);
}

.seed-close-detail-head,
.seed-close-detail-title-wrap {
  display: flex;
  align-items: center;
}

.seed-close-detail-head {
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: #191c18;
  border-bottom: 1px solid rgba(236, 226, 207, 0.1);
}

.seed-close-detail-title-wrap {
  min-width: 0;
  gap: var(--space-sm);
}

.seed-close-detail-title-wrap .modal-title {
  display: flex;
  align-items: center;
}

.seed-close-detail-title-icon {
  flex: 0 0 auto;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-xs);
}

.seed-close-detail-title-icon svg {
  width: 18px;
  height: 18px;
}

.seed-close-detail-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-xs);
}

.seed-close-detail-head-button.icon-btn {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: var(--radius-xs);
}

.seed-close-detail-head-button.icon-btn svg {
  width: 14px;
  height: 14px;
}

.seed-close-detail-close:focus,
.seed-close-detail-close:focus-visible {
  outline: none;
  box-shadow: none;
}

.seed-close-detail-refresh.is-loading {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.seed-close-detail-refresh.is-loading svg {
  animation: seed-close-detail-refresh-spin 720ms linear infinite;
}

@keyframes seed-close-detail-refresh-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .seed-close-detail-refresh.is-loading svg {
    animation: none;
  }
}

.seed-close-detail-body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--space-md);
  min-height: 0;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  overflow: hidden;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  scrollbar-width: thin;
}

.seed-close-detail-summary {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 0;
  overflow: hidden;
  background: #171a16;
  border: 1px solid rgba(236, 226, 207, 0.1);
  border-radius: var(--radius);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.018);
}

.seed-close-detail-summary > div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-sm);
  min-width: 0;
  min-height: 34px;
  padding: var(--space-xs) var(--space-md);
  background: transparent;
  text-align: center;
}

.seed-close-detail-summary > div + div {
  border-left: 1px solid rgba(236, 226, 207, 0.08);
}

.seed-close-detail-summary span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
}

.seed-close-detail-summary strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seed-close-detail-summary > div:last-child strong {
  color: var(--good);
}

.seed-close-detail-table {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: var(--space-sm);
  height: 100%;
  min-height: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.seed-close-detail-rows {
  display: grid;
  height: 100%;
  gap: var(--space-sm);
  min-height: 0;
  overflow: visible;
}

.seed-close-detail-row {
  display: grid;
  grid-template-columns: minmax(108px, 1.08fr) minmax(96px, 0.92fr) minmax(118px, 1fr);
  gap: var(--space-md);
  align-items: center;
  min-height: 34px;
  padding: 6px var(--space-md);
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  transition: background 140ms ease, color 140ms ease;
}

.seed-close-detail-row:last-child {
  border-bottom: 0;
}

.seed-close-detail-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.seed-close-detail-row > span:first-child {
  color: var(--text-2);
  text-align: left;
}

.seed-close-detail-row > span:last-child {
  color: var(--good);
}

.seed-close-detail-row:hover {
  background: rgba(255, 255, 255, 0.032);
}

.seed-close-detail-price {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.seed-close-detail-price i {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  background: var(--muted-2);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.025);
}

.seed-close-detail-price b {
  min-width: 0;
  overflow-wrap: anywhere;
  font: inherit;
  font-weight: 720;
}

.seed-close-detail-row > span:last-child {
  font-weight: bold;
}

.seed-close-detail-row.is-exchange .seed-close-detail-price,
.seed-close-detail-row.is-exchange > span:nth-child(2) {
  color: var(--accent-strong);
}

.seed-close-detail-row.is-exchange .seed-close-detail-price i {
  background: var(--good);
  box-shadow: 0 0 0 2px rgba(126, 214, 161, 0.08);
  animation: seed-close-detail-exchange-pulse 2.4s ease-in-out infinite;
}

@keyframes seed-close-detail-exchange-pulse {
  0%, 100% {
    opacity: 0.72;
    box-shadow: 0 0 0 2px rgba(126, 214, 161, 0.06);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 0 3px rgba(126, 214, 161, 0.16), 0 0 5px rgba(126, 214, 161, 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .seed-close-detail-row.is-exchange .seed-close-detail-price i {
    animation: none;
  }
}

.seed-close-detail-row.is-filled > span {
  color: var(--muted-2);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: currentColor;
  opacity: 0.72;
}

.seed-close-detail-loading,
.seed-close-detail-empty {
  display: grid;
  place-items: center;
  min-height: 112px;
  padding: var(--space-lg);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.seed-close-detail-side {
  position: relative;
  display: grid;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #151815;
  border: 1px solid rgba(236, 226, 207, 0.1);
  border-radius: var(--radius);
  box-shadow: none;
}

.seed-close-detail-side.is-above,
.seed-close-detail-side.is-below {
  background: #151815;
  border-color: rgba(236, 226, 207, 0.1);
}

.seed-close-detail-side.is-primary::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--accent);
  border-radius: var(--radius) 0 0 var(--radius);
  pointer-events: none;
}

.seed-close-detail-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: 28px;
  padding: var(--space-xs) var(--space-md);
  color: var(--muted);
  background: #181b17;
  border-bottom: 1px solid rgba(236, 226, 207, 0.08);
  font-size: 8px;
}

.seed-close-detail-side-head span {
  color: var(--text-2);
  font-weight: 720;
}

.seed-close-detail-side.is-primary .seed-close-detail-side-head small {
  color: var(--accent-strong);
}

.seed-close-detail-side-rows,
.seed-close-detail-filled-rows {
  min-height: 42px;
  background: #151815;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
  scrollbar-width: thin;
}

.seed-close-detail-side-rows {
  max-height: clamp(76px, 19vh, 180px);
}

.seed-close-detail-side-rows[data-seed-close-table="all"] {
  align-content: start;
  height: 100%;
  max-height: none;
}

.seed-close-detail-side-rows::-webkit-scrollbar,
.seed-close-detail-filled-rows::-webkit-scrollbar {
  width: 5px;
}

.seed-close-detail-side-rows::-webkit-scrollbar-thumb,
.seed-close-detail-filled-rows::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.seed-close-detail-side-empty {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: var(--space-sm);
  color: var(--muted-2);
  font-size: 8px;
}

.seed-close-current-price {
  display: grid;
  grid-template-columns: minmax(24px, 1fr) auto minmax(24px, 1fr);
  gap: var(--space-sm);
  align-items: center;
  min-height: 30px;
  padding: 0 var(--space-md);
  color: var(--accent-strong);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.seed-close-current-price > span {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
  box-shadow: none;
}

.seed-close-current-price > span:last-child {
  background: linear-gradient(90deg, var(--accent), transparent);
}

.seed-close-current-price > div {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-xs);
  min-width: 0;
  white-space: nowrap;
}

.seed-close-current-price small {
  color: var(--accent);
  font-size: 7px;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.seed-close-current-price strong {
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.seed-close-current-price em {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.seed-close-current-price.is-pending {
  opacity: 0.72;
}

.seed-close-detail-filled {
  overflow: hidden;
  background: #151815;
  border: 1px solid rgba(236, 226, 207, 0.1);
  border-radius: var(--radius);
}

.seed-close-detail-filled > summary {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: var(--space-sm);
  align-items: center;
  min-height: 36px;
  padding: var(--space-xs) var(--space-md);
  color: var(--muted);
  cursor: pointer;
  font-size: 8px;
  list-style: none;
  user-select: none;
}

.seed-close-detail-filled > summary::-webkit-details-marker {
  display: none;
}

.seed-close-detail-filled > summary::after {
  content: "⌄";
  color: var(--muted-2);
  font-size: 12px;
  transition: transform 140ms ease;
}

.seed-close-detail-filled[open] > summary::after {
  transform: rotate(180deg);
}

.seed-close-detail-filled > summary span {
  color: var(--text-2);
  font-weight: 720;
}

.seed-close-detail-filled > summary strong {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.seed-close-detail-filled > summary small {
  min-width: 0;
  color: var(--muted-2);
  text-align: right;
}

.seed-close-detail-filled-rows {
  max-height: 150px;
  border-top: 1px solid rgba(236, 226, 207, 0.08);
}

.seed-close-detail-note {
  padding-inline: var(--space-2xs);
  color: var(--muted-2);
  font-size: 8px;
  line-height: 1.4;
  text-align: right;
}

@media (max-width: 560px) {
  .modal.seed-close-detail-modal {
    width: min(100%, calc(100vw - 16px));
    height: 70vh;
    height: 70dvh;
    max-height: 70vh;
    max-height: 70dvh;
    border: 1px solid rgba(236, 226, 207, 0.16);
    border-radius: calc(var(--radius) + var(--space-2xs));
  }

  .modal-backdrop.seed-close-detail-backdrop {
    align-items: flex-end;
    padding: var(--space-sm) var(--space-sm) 0;
  }

  .modal.seed-close-detail-modal .seed-close-detail-head,
  .modal.seed-close-detail-modal .seed-close-detail-body {
    padding-right: var(--space-md);
    padding-left: var(--space-md);
  }

  .seed-close-detail-row {
    grid-template-columns: minmax(82px, 1fr) minmax(76px, 0.9fr) minmax(94px, 1.1fr);
    gap: var(--space-xs);
    padding-inline: var(--space-sm);
    font-size: 9px;
  }

  .seed-close-detail-side-head,
  .seed-close-detail-filled > summary,
  .seed-close-current-price {
    padding-inline: var(--space-sm);
  }

  .seed-close-detail-filled > summary small {
    display: none;
  }
}

.form-grid,
.derived-grid,
.modal-preview {
  gap: var(--space-xs);
}

.create-market-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(156px, 0.65fr);
  grid-template-areas: "coin direction";
  gap: var(--space-xs);
  align-items: end;
}

.create-symbol-field,
.create-direction-field {
  min-width: 0;
}

.create-control-label,
.create-direction-field legend {
  display: block;
  margin: 0 0 var(--space-2xs);
  padding: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.create-symbol-select {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: var(--space-sm);
  height: 52px;
  padding: var(--space-xs) var(--space-sm);
  overflow: hidden;
  background: #111410;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.create-symbol-field:hover .create-symbol-select {
  background: #171a16;
  border-color: rgba(255, 179, 71, 0.34);
}

.create-symbol-field:focus-within .create-symbol-select {
  background: #171a16;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.1);
}

.create-symbol-icon-wrap {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  color: #2e1d07;
  background: var(--accent);
  border: 1px solid rgba(255, 219, 166, 0.42);
  border-radius: var(--radius-xs);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 850;
}

.create-symbol-icon-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.create-symbol-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.create-symbol-copy strong,
.create-symbol-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-symbol-copy strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 820;
  line-height: 1.2;
}

.create-symbol-copy small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.2;
}

.create-select-chevron {
  width: 18px;
  height: 18px;
  color: var(--accent);
  transition: transform 140ms ease;
}

.create-symbol-field:focus-within .create-select-chevron {
  transform: translateY(1px);
}

.create-symbol-select select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.create-direction-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.create-direction-native {
  display: none;
}

.create-direction-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  height: 52px;
  padding: 3px;
  background: #111410;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.create-direction-option {
  display: grid;
  place-content: center;
  gap: 1px;
  min-width: 0;
  min-height: 44px;
  padding: 0 var(--space-2xs);
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  box-shadow: none;
  line-height: 1.1;
}

.create-direction-option span {
  font-size: 11px;
  font-weight: 800;
}

.create-direction-option small {
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.create-direction-option:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: transparent;
}

.create-direction-option[data-grid-direction="LONG"].active {
  color: var(--good);
  background: var(--up-soft);
  border-color: var(--up-line);
}

.create-direction-option[data-grid-direction="SHORT"].active {
  color: var(--danger);
  background: var(--down-soft);
  border-color: var(--down-line);
}

.create-direction-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.create-market-live {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  background: #10130f;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.create-live-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px var(--space-sm);
  min-width: 0;
  padding: var(--space-sm);
}

.create-live-item + .create-live-item {
  border-left: 1px solid var(--line-soft);
}

.create-live-item > span,
.create-live-heading > span {
  color: var(--muted);
  font-size: 9px;
}

.create-live-heading {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  min-width: 0;
}

.create-price-refresh {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  color: var(--muted-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  box-shadow: none;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease, transform 80ms ease;
}

.create-price-refresh::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
}

.create-price-refresh svg {
  width: 12px;
  height: 12px;
}

.create-price-refresh:not(:disabled):hover,
.create-price-refresh:not(:disabled):focus-visible {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.create-price-refresh:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.create-price-refresh:not(:disabled):active {
  transform: scale(0.92);
}

.create-price-refresh:disabled {
  color: var(--muted-2);
  cursor: default;
  opacity: 0.42;
}

.create-price-refresh.is-loading {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  opacity: 1;
}

.create-price-refresh.is-loading svg {
  animation: create-price-refresh-spin 720ms linear infinite;
}

@keyframes create-price-refresh-spin {
  to { transform: rotate(360deg); }
}

.create-live-item strong {
  min-width: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 820;
  overflow-wrap: anywhere;
  text-align: right;
}

.create-live-item small {
  grid-column: 1 / -1;
  color: var(--muted-2);
  font-size: 8px;
  text-align: right;
}

#currentPricePreview {
  color: var(--accent-strong);
}

#currentFundingRatePreview.positive {
  color: var(--accent-strong);
}

#currentFundingRatePreview.negative {
  color: var(--blue);
}

.create-form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "open lower upper"
    "margin leverage count";
}

.edit-modal {
  width: min(460px, 100%);
}

.edit-modal .modal-head {
  padding: var(--space-xs) var(--space-sm);
}

.edit-modal .modal-title {
  gap: 1px;
}

.edit-modal .modal-body {
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm) var(--space-sm);
}

.edit-modal #editCloseBtn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
}

.edit-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "lower upper"
    "open open";
  gap: var(--space-xs);
}

.edit-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  min-height: 16px;
}

.edit-field-hint {
  padding: 1px 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.edit-field-hint.is-lock {
  display: grid;
  place-items: center;
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding: 0;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border-color: var(--line-soft);
}

.edit-field-hint.is-lock svg {
  width: 11px;
  height: 11px;
}

.edit-form-grid label.is-expandable .edit-field-hint {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.edit-form-grid label.is-locked input,
.edit-form-grid input[readonly] {
  color: var(--text-2);
  background: #0d0f0c;
  border-style: dashed;
  cursor: default;
  opacity: 1;
}

.edit-form-grid label.is-locked input:focus,
.edit-form-grid input[readonly]:focus {
  border-color: var(--line);
  background: #0d0f0c;
  box-shadow: none;
}

#editLimitField.is-locked {
  grid-template-columns: minmax(112px, 0.58fr) minmax(0, 1.42fr);
  align-items: center;
  gap: var(--space-sm);
}

#editLimitField.is-locked .edit-field-label {
  justify-content: flex-start;
}

#editLimitField.is-locked input {
  height: 36px;
}

.edit-preview {
  position: relative;
}

.edit-preview-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line-soft);
  border-radius: var(--radius-xs);
}

.edit-preview-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 44px;
  padding: var(--space-xs) var(--space-sm);
  background: #181b17;
}

.edit-preview-item span {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
}

.edit-preview-item strong {
  min-width: 0;
  color: var(--text);
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.edit-preview.is-loading {
  opacity: 0.55;
}

.edit-preview.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  animation: btn-spin 0.8s linear infinite;
}

.edit-risk-preview {
  display: grid;
  gap: 2px;
  padding: var(--space-xs);
  background: #141712;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
}

.edit-risk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.edit-risk-head > span {
  color: var(--text-2);
  font-size: 10px;
  font-weight: 760;
}

.edit-risk-head > small {
  color: var(--muted-2);
  font-size: 8px;
}

.edit-risk-body {
  display: grid;
  grid-template-columns: minmax(145px, 1.35fr) minmax(0, 1.65fr);
  gap: 1px;
  overflow: hidden;
  background: var(--line-soft);
  border-radius: var(--radius-xs);
}

.edit-risk-primary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px var(--space-sm);
  min-height: 58px;
  padding: var(--space-xs) var(--space-sm);
  background: #1b1d18;
}

.edit-risk-primary > span,
.edit-risk-metrics span {
  color: var(--muted);
  font-size: 8px;
}

.edit-risk-primary > strong {
  color: var(--danger);
  font-size: 16px;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.edit-risk-primary > small {
  grid-column: 1 / -1;
  color: var(--muted-2);
  font-size: 8px;
}

.edit-risk-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
}

.edit-risk-metrics > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 58px;
  padding: var(--space-xs) var(--space-sm);
  background: #181b17;
}

.edit-risk-metrics strong {
  min-width: 0;
  color: var(--text);
  font-size: 10px;
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.edit-risk-error {
  padding: var(--space-sm);
  color: var(--muted);
  background: #181b17;
  border-radius: var(--radius-xs);
  font-size: 9px;
  line-height: 1.45;
}

.edit-risk-preview.is-unavailable .edit-risk-body {
  display: none;
}

.edit-risk-preview.is-loading {
  opacity: 0.58;
}

#editWarnings li {
  padding: var(--space-xs) var(--space-sm);
  font-size: 9px;
  line-height: 1.35;
}

.field-coin { grid-area: coin; }
.field-direction { grid-area: direction; }
.field-open-price { grid-area: open; }
.field-lower-price { grid-area: lower; }
.field-upper-price { grid-area: upper; }
.field-margin { grid-area: margin; }
.field-leverage { grid-area: leverage; }
.field-grid-count { grid-area: count; }

.derived-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

#gridForm > .derived-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modal-preview {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.derived-grid,
.modal-preview {
  gap: 1px;
  padding: 1px;
  overflow: hidden;
  background: var(--line-soft);
  border-radius: var(--radius-xs);
}

label {
  gap: var(--space-2xs);
  color: var(--muted);
  font-size: 10px;
}

label.full-span {
  gap: var(--space-xs);
  font-size: 10px;
}

input,
select {
  height: 36px;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text);
  background: #111410;
  border-color: var(--line);
  border-radius: var(--radius-xs);
  box-shadow: none;
}

select option {
  color: var(--text);
  background: #171a16;
}

input:focus,
select:focus {
  border-color: var(--accent);
  background: #171a16;
  box-shadow: 0 0 0 3px rgba(255, 179, 71, 0.1);
}

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

.form-toggle {
  min-height: 32px;
  padding: var(--space-xs) var(--space-sm);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  cursor: pointer;
}

label.form-toggle input[type="checkbox"] {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  min-width: 28px;
  height: 16px;
  min-height: 16px;
  max-height: 16px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease;
}

label.form-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 140ms ease, background 140ms ease;
}

label.form-toggle input[type="checkbox"]:checked {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

label.form-toggle input[type="checkbox"]:checked::after {
  background: var(--accent);
  transform: translateX(12px);
}

.form-note {
  display: flex;
  align-items: center;
  min-height: 22px;
  color: var(--muted-2);
  font-size: 8px;
  line-height: 1.3;
}

.derived-item,
.preview-metric {
  min-height: 44px;
  padding: var(--space-xs);
  border: 0;
  border-radius: 0;
}

.label {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0;
}

.derived-item .value,
.preview-metric strong,
.value {
  font-size: 10px;
  line-height: 1.2;
}

.preview-metric span {
  margin-bottom: 2px;
}

.message:empty,
.warning-list:empty {
  display: none;
}

.modal-submit-bar {
  position: sticky;
  bottom: calc(-1 * var(--space-md));
  z-index: 2;
  margin: 0 calc(-1 * var(--space-md)) calc(-1 * var(--space-md));
  padding: var(--space-sm) var(--space-md) calc(var(--space-sm) + env(safe-area-inset-bottom));
  background: #20221d;
  border-top: 1px solid var(--line-soft);
}

#gridForm > .actions {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}

#editForm > .modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-sm);
}

.take-profit-modal {
  width: min(360px, calc(100vw - 24px));
}

.bad-debt-modal {
  width: min(360px, calc(100vw - 24px));
}

.bad-debt-summary {
  gap: var(--space-md);
  padding: var(--space-sm);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  border-radius: var(--radius-xs);
}

.bad-debt-summary-copy {
  gap: var(--space-2xs);
}

.bad-debt-summary-copy span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0;
}

.bad-debt-summary-copy strong {
  color: var(--accent);
  font-size: 16px;
}

.bad-debt-summary-route {
  padding: 4px var(--space-xs);
  color: var(--accent);
  background: #111410;
  border-color: var(--accent-line);
  border-radius: var(--radius-xs);
  font-size: 8px;
}

.bad-debt-fields {
  display: grid;
  gap: var(--space-sm);
}

.bad-debt-fields label {
  display: grid;
  gap: var(--space-2xs);
}

.bad-debt-fields input[readonly] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.bad-debt-guard {
  display: flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  color: var(--muted);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-xs);
  font-size: 9px;
  line-height: 1.2;
}

.bad-debt-actions {
  display: grid;
  grid-template-columns: minmax(84px, 0.65fr) minmax(0, 1.35fr);
}

.bad-debts-badge {
  right: -3px;
  bottom: -3px;
  width: 9px;
  height: 9px;
  color: var(--accent);
  background: var(--bg-2);
  border-color: var(--accent-line);
  border-radius: 3px;
  font-size: 5px;
}

.ioc-badge {
  right: -4px;
  bottom: -3px;
  width: 15px;
  height: 9px;
  color: var(--accent);
  background: var(--bg-2);
  border-color: var(--accent-line);
  border-radius: 3px;
  font-size: 5px;
}

.take-profit-actions {
  display: grid;
  grid-template-columns: minmax(84px, 0.65fr) minmax(0, 1.35fr);
}

.warning-list li {
  padding: var(--space-sm);
  background: var(--accent-soft);
  border-color: var(--accent-line);
  border-radius: var(--radius-xs);
  font-size: 10px;
}

.message {
  min-height: 16px;
  font-size: 10px;
}

@media (max-width: 1080px) {
  main {
    grid-template-columns: 1fr;
  }

  main > .account-card,
  main > .forecast-section,
  main > .ladder-section,
  main > .grids-section,
  main > .trade-section,
  main > .modal-backdrop {
    grid-column: 1;
  }

  .account-card {
    min-height: 0;
  }

  .forecast-body {
    grid-template-columns: minmax(230px, 0.7fr) minmax(0, 2.3fr);
  }
}

@media (max-width: 700px) {
  .ui-tooltip {
    max-width: min(300px, calc(100vw - 20px));
    padding: 9px 11px;
    font-size: 12px;
  }

  .trade-profit-toast-stack {
    top: calc(env(safe-area-inset-top) + var(--space-lg));
    right: 60px;
    left: 60px;
    width: auto;
    transform: none;
  }

  .trade-profit-toast {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: var(--space-xs);
    min-height: 54px;
    padding: 6px var(--space-sm);
  }

  .trade-profit-toast-mark {
    width: 28px;
    height: 28px;
  }

  .trade-profit-toast-route {
    gap: var(--space-2xs);
  }

  .trade-profit-toast-pnl {
    font-size: 12px;
  }

  main {
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-xs) 24px;
  }

  section,
  details.collapsible-section,
  .account-card,
  .forecast-section,
  .ladder-section,
  .grid-card {
    padding: var(--space-sm);
    border-radius: var(--radius);
  }

  .section-icon {
    width: 24px;
    height: 24px;
  }

  .account-card {
    display: block;
    gap: var(--space-xs);
  }

  .account-head {
    min-height: 24px;
    padding-right: 174px;
    overflow: hidden;
  }

  .account-pill {
    max-width: 118px;
  }

  .account-actions {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    gap: var(--space-xs);
  }

  .account-switch-link {
    min-width: 42px;
    min-height: 24px;
    padding: 0 var(--space-xs);
  }

  .account-grid {
    margin-top: var(--space-xs);
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "available available equity equity leverage leverage"
      "risk risk risk fee fee fee";
  }

  .account-item {
    min-height: 36px;
    padding: var(--space-xs) var(--space-sm);
  }

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

  .account-risk-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .account-fee-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .account-risk-breakdown,
  .account-fee-breakdown {
    grid-column: 1 / -1;
    white-space: normal;
  }

  .account-risk-breakdown,
  .account-fee-breakdown {
    font-size: 8px;
  }

  .forecast-heading {
    align-items: center;
    margin-bottom: var(--space-xs);
  }

  .account-card .forecast-section {
    margin-top: var(--space-xs);
    padding: var(--space-sm);
    border-radius: var(--radius-xs);
  }

  .forecast-boundary {
    max-width: none;
    padding-top: 0;
  }

  .forecast-body {
    grid-template-columns: 1fr;
  }

  .forecast-critical {
    grid-template-columns: minmax(0, 1.5fr) minmax(84px, 0.62fr);
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .forecast-primary {
    padding: var(--space-sm) var(--space-sm) var(--space-sm) 0;
  }

  .forecast-primary + .forecast-primary {
    padding-left: var(--space-sm);
  }

  .forecast-primary strong {
    font-size: 18px;
  }

  .forecast-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "fills fills position position position position"
      "average average pnl pnl fee fee"
      "equity equity equity mm mm mm";
  }

  .account-card .forecast-metric,
  .account-card .forecast-metric:nth-child(3n),
  .account-card .forecast-metric:nth-child(4n),
  .account-card .forecast-metric:nth-last-child(-n + 3) {
    min-height: 38px;
    padding: var(--space-xs);
    border: 0;
  }

  .forecast-metric:nth-child(1) { grid-area: fills; }
  .forecast-metric:nth-child(2) { grid-area: position; }
  .forecast-metric:nth-child(3) { grid-area: average; }
  .forecast-metric:nth-child(4) { grid-area: pnl; }
  .forecast-metric:nth-child(5) { grid-area: fee; }
  .forecast-metric:nth-child(6) { grid-area: equity; }
  .forecast-metric:nth-child(7) { grid-area: mm; }

  .forecast-metric strong {
    font-size: 9px;
  }

  .forecast-model {
    padding-top: var(--space-2xs);
  }

  .ladder-section {
    --ladder-cols: 28px minmax(0, 1fr) auto;
    --ladder-inline: var(--space-xs);
    gap: var(--space-sm);
  }

  .ladder-heading {
    grid-template-columns: minmax(36px, 1fr) max-content minmax(176px, 1fr);
    gap: 0;
    min-height: 32px;
    margin-bottom: 0;
    padding: 3px 5px;
  }

  .ladder-title {
    min-width: 28px;
    min-height: 24px;
  }

  .ladder-title .section-icon {
    width: 28px;
    height: 24px;
  }

  .ladder-spread {
    gap: 6px;
    padding: 0 10px;
    font-size: 8px;
  }

  .ladder-spread strong {
    font-size: 11px;
  }

  .ladder-spread em {
    padding-left: 6px;
    font-size: 8px;
  }

  .ladder-stats {
    justify-self: end;
    gap: 0;
    width: max-content;
    min-width: 0;
  }

  .ladder-stat {
    flex-basis: 88px;
    min-height: 22px;
    height: 22px;
    padding: 0 8px;
  }

  .ladder-stat strong {
    font-size: 12px;
  }

  .ladder-current {
    min-height: 22px;
    height: 22px;
  }

  .ladder-current strong {
    font-size: 11px;
  }

  .close-summary {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    margin: 0;
    padding: 4px 8px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .close-summary::-webkit-scrollbar {
    height: 4px;
  }

  .close-summary-item,
  .close-summary-item.total,
  .close-summary-item.seed,
  .close-summary-item.ordinary,
  .close-summary-item.open-unclosed,
  .close-summary-item.bad-debts {
    flex: 0 0 auto;
    width: max-content;
    min-width: 72px;
    min-height: 30px;
    padding: 3px 6px;
    grid-column: auto;
  }

  button.close-summary-item {
    min-height: 30px;
    padding: 3px 6px;
  }

  .close-summary-values strong,
  .close-summary-item.total strong {
    font-size: 10px;
  }

  .close-summary-operator {
    flex: 0 0 14px;
    width: 14px;
    height: 14px;
    border: 0;
    background: transparent;
    font-size: 12px;
  }

  .ladder-grid {
    border-radius: var(--radius);
  }

  .ladder-rows,
  .ladder-empty {
    --ladder-row-size: 28px;
  }

  .ladder-row {
    min-height: 28px;
  }

  .ladder-price {
    font-size: 11px;
  }

  .ladder-qty {
    font-size: 9px;
  }

  .section-heading,
  .trade-section > h2 {
    margin-bottom: var(--space-xs);
  }

  .add-grid-inline,
  .icon-btn {
    min-height: 44px;
    height: 44px;
  }

  .grid-refresh-button {
    --refresh-visual-size: 32px;
    width: 44px;
    min-width: 44px;
    padding: 0;
  }

  .grid-list {
    grid-template-columns: 1fr;
    gap: var(--space-xs);
  }

  .grid-card {
    gap: var(--space-xs);
  }

  .grid-highlights {
    gap: var(--space-2xs);
  }

  .grid-highlight {
    padding: var(--space-xs);
  }

  .grid-fields,
  .grid-fields-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-xs);
  }

  .grid-field {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }

  .grid-field-key {
    font-size: 8px;
    line-height: 1.15;
    white-space: normal;
  }

  .grid-field-key::after {
    display: none;
  }

  .grid-field strong {
    font-size: 9px;
    line-height: 1.2;
  }

  .grid-fields-position {
    grid-template-columns: var(--position-grid-columns);
  }

  .grid-card-actions button,
  button {
    min-height: 44px;
  }

  .trade-section {
    overflow: hidden;
  }

  .trade-table-frame {
    height: 190px;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: calc(100% - 24px);
    max-height: 92vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 10px 10px 0 0;
  }

  .modal-head,
  .modal-body {
    padding-right: var(--space-sm);
    padding-left: var(--space-sm);
  }

  .confirm-modal.preview-only .confirm-preview {
    margin: var(--space-sm) var(--space-sm) var(--space-md);
    padding: var(--space-sm);
  }

  .create-market-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(144px, 0.8fr);
  }

  .create-live-item {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 2px;
    min-height: 54px;
    padding: var(--space-xs) var(--space-sm);
  }

  .create-live-item strong,
  .create-live-item small {
    grid-column: auto;
    text-align: left;
  }

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

  .modal-preview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .edit-modal {
    width: 100%;
  }

  input,
  select {
    height: 44px;
    font-size: 16px;
  }

  label.form-toggle input[type="checkbox"] {
    height: 16px;
    min-height: 16px;
    max-height: 16px;
  }

  .modal-submit-bar {
    margin-right: calc(-1 * var(--space-sm));
    margin-left: calc(-1 * var(--space-sm));
    padding-right: var(--space-sm);
    padding-left: var(--space-sm);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ui-tooltip {
    transition: none;
  }
}

@media (max-width: 420px) {
  .forecast-title h2 {
    font-size: 12px;
  }

  .forecast-title > div > span,
  .forecast-boundary {
    font-size: 8px;
  }

  .grid-summary-meta {
    max-width: 34vw;
  }

  .grid-summary-meta .grid-inline-direction,
  .grid-summary-meta .grid-inline-dot {
    display: none;
  }

  .create-market-grid {
    grid-template-columns: minmax(0, 1fr) 136px;
  }

  .create-symbol-select {
    grid-template-columns: 30px minmax(0, 1fr) 14px;
    gap: var(--space-xs);
    padding-right: var(--space-xs);
    padding-left: var(--space-xs);
  }

  .create-symbol-icon-wrap {
    width: 30px;
    height: 30px;
  }

  .create-symbol-copy strong {
    font-size: 12px;
  }

  .create-symbol-copy small {
    font-size: 8px;
  }

  .grid-fields-position {
    grid-template-columns: var(--position-grid-columns);
  }
}

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

/* Compact portfolio summary: keep the complete overview visible without a nested scrollbar. */
.modal.portfolio-summary-modal {
  max-height: min(680px, calc(100vh - 20px));
}

.modal.portfolio-summary-modal .portfolio-summary-body {
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  scrollbar-width: none;
}

.modal.portfolio-summary-modal .portfolio-summary-body::-webkit-scrollbar {
  display: none;
}

.modal.portfolio-summary-modal .portfolio-summary-content {
  gap: var(--space-xs);
}

.modal.portfolio-summary-modal .portfolio-summary-primary,
.modal.portfolio-summary-modal .portfolio-summary-invested {
  min-height: 88px;
  padding: var(--space-sm) var(--space-md);
}

.modal.portfolio-summary-modal .portfolio-summary-primary strong {
  font-size: clamp(22px, 4vw, 30px);
}

.modal.portfolio-summary-modal .portfolio-summary-section-head {
  min-height: 28px;
  padding-right: var(--space-sm);
  padding-left: var(--space-sm);
}

.modal.portfolio-summary-modal .portfolio-summary-metric {
  min-height: 56px;
  gap: 3px;
  padding: var(--space-xs) var(--space-sm);
}

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

.modal.portfolio-summary-modal .portfolio-sharpe-primary,
.modal.portfolio-summary-modal .portfolio-sharpe-metrics .portfolio-summary-metric {
  min-height: 68px;
}

.modal.portfolio-summary-modal .portfolio-sharpe-primary {
  padding: var(--space-sm) var(--space-md);
}

.modal.portfolio-summary-modal .portfolio-sharpe-primary strong {
  font-size: 23px;
}

.modal.portfolio-summary-modal .portfolio-summary-footnote {
  min-height: 14px;
  font-size: 8px;
}

@media (max-width: 700px) {
  .modal.portfolio-summary-modal {
    width: calc(100% - 12px);
    max-height: calc(100svh - max(6px, env(safe-area-inset-top)));
  }

  .modal.portfolio-summary-modal .modal-head {
    min-height: 44px;
    padding-top: var(--space-xs);
    padding-bottom: var(--space-xs);
  }

  .modal.portfolio-summary-modal .portfolio-summary-body {
    padding: var(--space-xs) var(--space-sm) max(var(--space-sm), env(safe-area-inset-bottom));
  }

  .modal.portfolio-summary-modal .portfolio-summary-title-icon {
    width: 23px;
    height: 23px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-title-icon svg {
    width: 13px;
    height: 13px;
  }

  .modal.portfolio-summary-modal .modal-title strong {
    font-size: 13px;
  }

  .modal.portfolio-summary-modal .modal-title span {
    font-size: 8px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  }

  .modal.portfolio-summary-modal .portfolio-summary-primary,
  .modal.portfolio-summary-modal .portfolio-summary-invested {
    min-height: 76px;
    padding: var(--space-xs) var(--space-sm);
  }

  .modal.portfolio-summary-modal .portfolio-summary-primary {
    border-right: 1px solid var(--line-soft);
    border-bottom: 0;
  }

  .modal.portfolio-summary-modal .portfolio-summary-primary strong {
    font-size: 20px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-invested strong {
    font-size: 13px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-primary small,
  .modal.portfolio-summary-modal .portfolio-summary-invested small,
  .modal.portfolio-summary-modal .portfolio-summary-metric small,
  .modal.portfolio-summary-modal .portfolio-sharpe-primary small {
    display: none;
  }

  .modal.portfolio-summary-modal .portfolio-summary-section-head {
    min-height: 25px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-metric {
    min-height: 48px;
    padding: var(--space-2xs) var(--space-xs);
  }

  .modal.portfolio-summary-modal .portfolio-summary-metric strong {
    font-size: 10px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-metrics-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .modal.portfolio-summary-modal .portfolio-summary-metrics-three .portfolio-summary-metric {
    grid-template-columns: 1fr;
    min-height: 48px;
    border-right: 1px solid var(--line-soft);
    border-bottom: 0;
  }

  .modal.portfolio-summary-modal .portfolio-summary-metrics-three .portfolio-summary-metric:last-child {
    border-right: 0;
  }

  .modal.portfolio-summary-modal .portfolio-sharpe-content {
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  }

  .modal.portfolio-summary-modal .portfolio-sharpe-primary,
  .modal.portfolio-summary-modal .portfolio-sharpe-metrics .portfolio-summary-metric {
    min-height: 62px;
  }

  .modal.portfolio-summary-modal .portfolio-sharpe-primary {
    border-right: 1px solid var(--line-soft);
    border-bottom: 0;
  }

  .modal.portfolio-summary-modal .portfolio-sharpe-primary strong {
    font-size: 19px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-footnote {
    min-height: 12px;
    font-size: 7px;
  }
}

@media (max-width: 420px), (max-height: 560px) {
  .modal.portfolio-summary-modal .modal-head {
    min-height: 40px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-body {
    padding-top: var(--space-2xs);
  }

  .modal.portfolio-summary-modal .portfolio-summary-primary,
  .modal.portfolio-summary-modal .portfolio-summary-invested {
    min-height: 68px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-primary strong {
    font-size: 18px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-invested strong {
    font-size: 12px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-section-head {
    min-height: 22px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-metric,
  .modal.portfolio-summary-modal .portfolio-summary-metrics-three .portfolio-summary-metric,
  .modal.portfolio-summary-modal .portfolio-sharpe-primary,
  .modal.portfolio-summary-modal .portfolio-sharpe-metrics .portfolio-summary-metric {
    min-height: 42px;
  }

  .modal.portfolio-summary-modal .portfolio-summary-metric strong {
    font-size: 9px;
  }

  .modal.portfolio-summary-modal .portfolio-sharpe-primary strong {
    font-size: 17px;
  }
}

/* POPDEX account overview keeps its denser API detail isolated from ONDO. */
.portfolio-exchange-content {
  display: grid;
  gap: var(--space-xs);
}

.portfolio-exchange-content[hidden] {
  display: none;
}

.portfolio-summary-metrics-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portfolio-popdex-periods {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line-soft);
}

.portfolio-popdex-period {
  min-width: 0;
  overflow: hidden;
  background: #151814;
}

.portfolio-popdex-period-head,
.portfolio-popdex-balance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 42px;
  padding: var(--space-xs) var(--space-sm);
  background: rgba(255, 255, 255, 0.018);
  border-bottom: 1px solid var(--line-soft);
}

.portfolio-popdex-period-head strong,
.portfolio-popdex-balance-head strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 760;
}

.portfolio-popdex-period-head span,
.portfolio-popdex-balance-head span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.35;
  text-align: right;
}

.portfolio-popdex-period-primary {
  border-bottom: 1px solid var(--line-soft);
}

.portfolio-popdex-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portfolio-popdex-detail-grid .portfolio-summary-metric {
  min-width: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.portfolio-popdex-detail-grid .portfolio-summary-metric:nth-child(2n) {
  border-right: 0;
}

.portfolio-popdex-detail-grid .portfolio-summary-metric:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.portfolio-popdex-balances-section > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.portfolio-popdex-balances-section > summary::-webkit-details-marker {
  display: none;
}

.portfolio-popdex-balances-section > summary:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -2px;
}

.portfolio-popdex-balances-section:not([open]) > summary {
  border-bottom: 0;
}

.portfolio-popdex-balances-head-end {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
}

.portfolio-popdex-balances-toggle {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.portfolio-popdex-balances-section[open] .portfolio-popdex-balances-toggle {
  transform: translateY(2px) rotate(225deg);
}

.portfolio-popdex-balances {
  display: grid;
}

.portfolio-popdex-balance {
  min-width: 0;
  border-bottom: 1px solid var(--line-soft);
}

.portfolio-popdex-balance:last-child {
  border-bottom: 0;
}

.portfolio-popdex-balance-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.portfolio-popdex-balance-head > div:last-child {
  justify-items: end;
}

.portfolio-popdex-balance-head > div:last-child strong {
  color: var(--accent-strong);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.portfolio-popdex-balance-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.portfolio-popdex-balance-grid .portfolio-summary-metric:nth-child(2n) {
  border-right: 1px solid var(--line-soft);
}

.portfolio-popdex-balance-grid .portfolio-summary-metric:nth-child(5n) {
  border-right: 0;
}

.portfolio-popdex-balance-grid .portfolio-summary-metric:nth-last-child(-n + 5) {
  border-bottom: 0;
}

body[data-exchange="popdex"] .modal.portfolio-summary-modal {
  width: min(1040px, calc(100% - 24px));
  max-height: calc(100vh * 2 / 3);
  max-height: calc(100svh * 2 / 3);
}

body[data-exchange="popdex"] .modal.portfolio-summary-modal .portfolio-summary-body {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

body[data-exchange="popdex"] .modal.portfolio-summary-modal .portfolio-summary-body::-webkit-scrollbar {
  display: block;
  width: 6px;
}

body[data-exchange="popdex"] .modal.portfolio-summary-modal .portfolio-summary-body::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: var(--radius-xs);
}

@media (max-width: 820px) {
  .portfolio-popdex-periods {
    grid-template-columns: 1fr;
  }

  .portfolio-popdex-period-head span {
    max-width: 68%;
  }

  .portfolio-popdex-balance-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portfolio-popdex-balance-grid .portfolio-summary-metric:nth-child(5n) {
    border-right: 1px solid var(--line-soft);
  }

  .portfolio-popdex-balance-grid .portfolio-summary-metric:nth-child(2n) {
    border-right: 0;
  }

  .portfolio-popdex-balance-grid .portfolio-summary-metric:nth-last-child(-n + 5) {
    border-bottom: 1px solid var(--line-soft);
  }

  .portfolio-popdex-balance-grid .portfolio-summary-metric:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 700px) {
  .portfolio-summary-metrics-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portfolio-summary-metrics-four .portfolio-summary-metric {
    border-bottom: 1px solid var(--line-soft);
  }

  .portfolio-summary-metrics-four .portfolio-summary-metric:nth-child(2n) {
    border-right: 0;
  }

  .portfolio-summary-metrics-four .portfolio-summary-metric:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  body[data-exchange="popdex"] .modal.portfolio-summary-modal {
    width: calc(100% - 12px);
    max-height: calc(100vh * 2 / 3);
    max-height: calc(100svh * 2 / 3);
  }

  body[data-exchange="popdex"] .modal.portfolio-summary-modal .portfolio-summary-body {
    min-height: 0;
    max-height: none;
  }

  body[data-exchange="popdex"] .modal.portfolio-summary-modal .portfolio-popdex-detail-grid .portfolio-summary-metric {
    grid-template-columns: 1fr;
    min-height: 48px;
    border-bottom: 1px solid var(--line-soft);
  }

  body[data-exchange="popdex"] .modal.portfolio-summary-modal .portfolio-popdex-detail-grid .portfolio-summary-metric:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}
