@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
  --bg: #090909;
  --panel: #121212;
  --panel-2: #0f0f0f;
  --ink: #f2f2f2;
  --muted: #a8a8a8;
  --line: #2a2a2a;
  --line-strong: #3a3a3a;
  --positive: #d9ffd6;
  --negative: #ffd3d3;
  --section-gap: 34px;
  --section-body-gap: 14px;
  --section-subsection-gap: 22px;
  --section-list-gap: 10px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

body {
  min-height: 100dvh;
}

.shell {
  max-width: 767px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px 14px calc(24px + env(safe-area-inset-bottom, 0px));
}

.hero {
  margin-bottom: 18px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-brand {
  display: flex;
  align-items: center;
  min-height: 40px;
}

.hero-logo-link {
  display: inline-flex;
  align-items: center;
}

.hero-logo {
  display: block;
  width: auto;
  max-width: min(230px, 100%);
  height: 34px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
}

.mode-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  border: 1px solid #232323;
  display: inline-block;
  margin: 0;
  flex: 0 0 auto;
}

.mode-status-dot-green {
  background: #3ee07c;
  box-shadow: 0 0 8px rgba(62, 224, 124, 0.55);
}

.mode-status-dot-red {
  background: #ff5a5a;
  box-shadow: 0 0 8px rgba(255, 90, 90, 0.45);
}

.mode-status-dot-orange {
  background: #ffb35a;
  box-shadow: 0 0 8px rgba(255, 179, 90, 0.45);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hero-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 380px) {
  .hero-logo {
    height: 30px;
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.card,
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.45);
}

.card {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  position: relative;
}

.card.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 9, 0.42);
  border-radius: 16px;
  z-index: 4;
  pointer-events: none;
}

.card.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.88);
  animation: card-spinner 0.9s linear infinite;
  z-index: 5;
  pointer-events: none;
}

@keyframes card-spinner {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: var(--section-body-gap);
}

.section-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

#pnlSectionLabel.is-backtest {
  color: #ff9f9f;
}

.meta-text,
.metric-sub,
.row-label,
.auth-copy,
.auth-label,
.auth-message,
.empty,
.bridge-row span:first-child {
  color: var(--muted);
}

.meta-text,
.metric-sub,
.bridge-row span:first-child,
.row-label,
.empty,
.auth-copy,
.auth-label,
.auth-message {
  font-size: 11px;
  line-height: 1.5;
}

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

.pnl-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: var(--section-body-gap);
}

.metric {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric strong,
.value {
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.bridge-meta,
.list-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#pnlTradeList {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

#pnlTradeList .list-item {
  height: 100%;
}

.pnl-card .list-block + .card-head {
  margin-top: var(--section-subsection-gap);
}

.pnl-trade-head-tight {
  margin-top: 0;
}

.chart-card {
  padding-bottom: 0;
}

.chart-head {
  margin-bottom: var(--section-list-gap);
}

.chart-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.chart-copy {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.market-select {
  min-width: 98px;
}

.chart-select {
  appearance: none;
  min-width: 98px;
  height: 32px;
  max-width: 100%;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: var(--panel-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23a8a8a8' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  padding: 0 24px 0 10px;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.chart-select-static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-image: none;
  padding-right: 12px;
  cursor: default;
}

.chart-bt-button {
  appearance: none;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.chart-bt-button:hover,
.chart-bt-button:focus-visible {
  border-color: var(--line-strong);
  background: #151515;
  outline: none;
}

.is-hidden {
  display: none !important;
}

.chart-meta-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  margin-bottom: var(--section-body-gap);
}

.chart-legend {
  display: flex;
  align-items: center;
  min-height: 32px;
  gap: 12px;
  row-gap: 4px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-wrap: wrap;
  width: 100%;
}

.chart-timeframe-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  margin-left: auto;
}

.chart-timeframe-button {
  appearance: none;
  min-width: 44px;
  min-height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.chart-timeframe-button.is-active {
  background: #f2f2f2;
  color: #090909;
}

.chart-range-nav {
  display: grid;
  grid-template-columns: 32px auto 32px;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  align-self: flex-end;
}

.chart-range-label {
  width: 188px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 767px) {
  .chart-range-nav {
    grid-template-columns: 32px 32px;
    gap: 8px;
  }

  .chart-range-label {
    display: none;
  }
}

.chart-nav-button {
  appearance: none;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  padding: 0 0 2px;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

@media (max-width: 767px) {
  .shell {
    min-width: 360px;
  }

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

  #pnlTradeList {
    grid-template-columns: 1fr;
  }
}

.chart-nav-button:disabled {
  cursor: default;
  opacity: 0.38;
}

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

.legend-dot,
.legend-line {
  display: inline-block;
  flex: 0 0 auto;
}

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

.legend-dot-buy {
  background: #9effb2;
}

.legend-dot-sell {
  background: #ff8f8f;
}

.legend-line {
  width: 14px;
  height: 1px;
  background: #5a5a5a;
}

.chart-canvas {
  position: relative;
  height: 340px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #0c0c0c;
  overflow: hidden;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.chart-period-divider {
  stroke: rgba(242, 242, 242, 0.1);
  stroke-width: 1;
}

.chart-axis-text {
  fill: #8a8a8a;
  font-size: 11px;
}

.chart-axis-text-price {
  text-anchor: start;
}

.chart-axis-text-pnl {
  font-size: 9px;
}

.chart-wick {
  stroke: #737373;
  stroke-width: 1.25;
  stroke-linecap: round;
}

.chart-line-path {
  fill: none;
  stroke: #f2f2f2;
  stroke-width: 0.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-macro-trend-line {
  fill: none;
  stroke: rgba(186, 147, 255, 0.95);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
}

.chart-channel-line {
  fill: none;
  stroke-width: 0.8;
  stroke-dasharray: 5 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.78;
}

.chart-channel-upper {
  stroke: #68b8ff;
}

.chart-channel-lower {
  stroke: #78efac;
}

.chart-line-point {
  fill: #f2f2f2;
}

.chart-vwap-point {
  fill: rgba(255, 138, 101, 0.9);
  opacity: 0.95;
}

.chart-vwap-line {
  stroke: rgba(255, 138, 101, 0.9);
  stroke-width: 1;
  stroke-dasharray: 4 6;
  opacity: 0.38;
}

.chart-signal-point {
  fill: #f2f2f2;
  stroke: #090909;
  stroke-width: 1;
}

.chart-signal-point-legacy {
  fill: #f2f2f2;
  stroke: #090909;
  stroke-width: 1;
}

.chart-signal-point-backtest {
  opacity: 0.2;
}

.chart-signal-point-execution-buy {
  fill: #9effb2;
  stroke: #0b2f1d;
  stroke-width: 1.2;
}

.chart-signal-point-execution-sell {
  fill: #ff8f8f;
  stroke: #3b1515;
  stroke-width: 1.2;
}

.chart-current-point {
  fill: #f2f2f2;
}

.chart-current-pulse {
  fill: rgba(242, 242, 242, 0.5);
  transform-box: fill-box;
  transform-origin: center;
}

.chart-current-pulse-once {
  animation: chart-pulse-once 1.2s ease-out 1 forwards;
}

.chart-current-pulse-loop {
  animation: chart-pulse-loop 2s ease-out infinite;
}

.chart-current-line {
  stroke: rgba(242, 242, 242, 0.28);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.chart-current-label {
  fill: #090909;
  font-size: 11px;
  font-weight: 700;
}

.chart-current-label-bg {
  fill: #f2f2f2;
}

.chart-axis-text-price-pct {
  fill: rgba(138, 138, 138, 0.9);
  font-size: 9px;
}

.chart-hover-line {
  stroke: rgba(242, 242, 242, 0.34);
  stroke-width: 1;
}

.chart-hover-layer {
  pointer-events: none;
}

.chart-hover-point {
  fill: #f2f2f2;
}

.chart-hover-label-bg {
  fill: #090909;
  stroke: rgba(242, 242, 242, 0.18);
  stroke-width: 1;
}

.chart-hover-label {
  fill: #f2f2f2;
  font-size: 11px;
  font-weight: 700;
}

@keyframes chart-pulse-once {
  0% {
    transform: scale(0.65);
    opacity: 1;
  }

  70% {
    transform: scale(2.8);
    opacity: 0;
  }

  100% {
    transform: scale(2.8);
    opacity: 0;
  }
}

@keyframes chart-pulse-loop {
  0% {
    transform: scale(0.8);
    opacity: 0.92;
  }

  75% {
    transform: scale(3.1);
    opacity: 0;
  }

  100% {
    transform: scale(3.1);
    opacity: 0;
  }
}


.chart-marker-buy {
  fill: #9effb2;
}

.chart-marker-sell {
  fill: #ff8f8f;
}

.chart-signal-marker {
  cursor: pointer;
}

.chart-signal-marker-backtest {
  opacity: 0.2;
}

.chart-signal-marker-request {
  opacity: 1;
}

/* 예측 SF (V025PL Phase 1, 2026-04-18) — 기존 backtest 반투명(0.2) 그대로 상속.
 * `?` prefix 로 일반 SF 와 구분. 추가 시각 효과 없음 (사용자 요청에 따라 최소화).
 * 예외: faked 로 판정된 예측은 label 에 취소선을 얹어 페이크임을 시각화. */
.chart-signal-marker-predictive-faked .chart-marker-label {
  text-decoration: line-through;
}

/* 2026-04-19: 마커 포커스 시 pill 테두리 — iOS Safari 탭은 :focus 만 트리거
 * 하므로 :focus 와 :focus-visible 모두 적용. 기본 outline 은 제거하고
 * rect stroke 로 표현.
 * 추가: backtest / predictive 마커는 그룹 opacity 0.2 가 걸려 있어 focus
 * stroke 도 반투명이 된다. SVG 에서는 자식 opacity 로 부모 opacity 를
 * 덮을 수 없으므로 focus 상태일 때 그룹 opacity 자체를 1 로 복원. */
.chart-signal-marker:focus {
  outline: none;
}
.chart-signal-marker:focus,
.chart-signal-marker:focus-visible {
  opacity: 1;
}
.chart-signal-marker:focus rect,
.chart-signal-marker:focus-visible rect {
  stroke: #f2f2f2;
  stroke-width: 1.4;
}

.chart-marker-label {
  fill: #090909;
  font-size: 10px;
  font-weight: 950;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.chart-marker-label-legacy {
  fill: #090909;
}

.signal-list {
  display: grid;
  gap: 8px;
  margin-top: var(--section-list-gap);
}

.pnl-card .list-block {
  margin-top: var(--section-list-gap);
}

.pnl-preset-item {
  min-height: 160px;
}

.signal-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.signal-pill-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  gap: 2px;
}

.signal-pill-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  min-height: 18px;
}

.signal-tag-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  vertical-align: middle;
  cursor: pointer;
}

.signal-tag-button-entry {
  color: #9effb2;
}

.signal-tag-button-exit {
  color: #ff8f8f;
}

.signal-tag-button:focus-visible {
  outline: 2px solid #f2f2f2;
  outline-offset: 4px;
  border-radius: 6px;
}

.chart-tag-tooltip {
  position: fixed;
  z-index: 30;
  max-width: min(200px, calc(100vw - 16px));
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid rgba(242, 242, 242, 0.12);
  background: rgba(12, 12, 12, 0.94);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  color: #f2f2f2;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.35;
  pointer-events: none;
  white-space: normal;
  overflow-wrap: anywhere;
  transform: translateX(-50%);
}

.chart-tag-tooltip.is-hidden {
  display: none;
}

.chart-tag-tooltip[data-placement="above"] {
  transform: translate(-50%, calc(-100% - 10px));
}

.chart-tag-tooltip[data-placement="below"] {
  transform: translate(-50%, 10px);
}

.chart-tag-tooltip[data-tone="entry"] {
  color: #9effb2;
  border-color: rgba(158, 255, 178, 0.24);
}

.chart-tag-tooltip[data-tone="exit"] {
  color: #ff8f8f;
  border-color: rgba(255, 143, 143, 0.24);
}

.bridge-row,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row-value {
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
}

.trade-hover-pill {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.trade-hover-pill:hover,
.trade-hover-pill:focus-visible {
  border-color: var(--line-strong);
  background: var(--panel);
  color: #f2f2f2;
}

.date-range {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.date-chunk {
  white-space: nowrap;
}

code {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 11px;
  font-family: inherit;
}

.pill,
.chip,
.auth-button,
.mode-toggle-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill,
.chip,
.mode-toggle-button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
}

.pill,
.chip {
  padding: 6px 10px;
}

.pill-muted {
  color: var(--muted);
}

.pill-dry,
.pill-live {
  background: #f2f2f2;
  color: #090909;
  border-color: #f2f2f2;
}

.mode-toggle-button {
  min-width: 72px;
  min-height: 32px;
  padding: 0 11px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.mode-toggle-button-with-dot {
  gap: 6px;
}

.mode-toggle-button.is-active {
  background: #f2f2f2;
  color: #090909;
}

.list-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-radius: 12px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .market-select:hover,
  .chart-select:hover,
  .chart-nav-button:hover,
  .signal-pill:hover,
  .list-item:hover,
  .mode-toggle-button:hover:not(.is-active),
  .chart-timeframe-button:hover:not(.is-active) {
    border-color: var(--line-strong);
    background-color: var(--panel);
  }

  .auth-button:hover {
    border-color: var(--line-strong);
    background-color: #e8e8e8;
  }

  .auth-button-secondary:hover {
    background-color: var(--panel);
  }
}

.list-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.asset-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 18px;
}

.asset-title .chip {
  line-height: 1;
  min-height: 18px;
  padding-top: 0;
  padding-bottom: 0;
}

.asset-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.market-label {
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  margin-right: 6px;
  letter-spacing: 0.03em;
}

.open-badge {
  color: var(--color-blue, #3b82f6);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.chip-positive,
.chip-negative,
.chip-neutral {
  background: transparent;
}

.chip-positive {
  color: var(--positive);
  border-color: #36513d;
}

.chip-negative {
  color: var(--negative);
  border-color: #5a3535;
}

.chip-neutral {
  color: var(--muted);
  border-color: var(--line-strong);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(14px);
}

.auth-gate.is-hidden {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 18px;
}

.auth-card h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.confirm-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.summary-card {
  max-width: 520px;
  position: relative;
  overflow: hidden;
}

.summary-card.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 9, 0.48);
  border-radius: 16px;
  z-index: 4;
  pointer-events: none;
}

.summary-card.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.88);
  animation: card-spinner 0.9s linear infinite;
  z-index: 5;
  pointer-events: none;
}

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

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

.summary-close {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.summary-close:hover,
.summary-close:focus-visible {
  border-color: var(--line-strong);
  background: #151515;
  outline: none;
}

#backtestSummaryTitle {
  margin: 0;
}

.summary-period {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.summary-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.summary-link-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.auth-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
}

.auth-input:focus {
  outline: none;
  border-color: var(--line-strong);
}

.auth-button {
  position: relative;
  border: 1px solid var(--line-strong);
  background: #f2f2f2;
  color: #090909;
  padding: 11px 14px;
}

.auth-button .button-label {
  transition: opacity 120ms ease;
}

.auth-button[data-loading="true"] {
  pointer-events: none;
}

.auth-button[data-loading="true"] .button-label {
  opacity: 0;
}

.auth-button[data-loading="true"]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: button-spin 0.7s linear infinite;
}

.auth-button-secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

@keyframes button-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.empty {
  padding: 10px 0 4px;
}

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

@media (min-width: 768px) {
  :root {
    --section-gap: 28px;
  }

  .shell {
    width: min(96vw, 1360px);
    max-width: none;
    padding-inline: 20px;
  }

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

  .hero {
    margin-bottom: 22px;
  }

  .card {
    padding: 0;
  }

  .chart-card {
    padding: 0;
  }

  .chart-head {
    margin-bottom: var(--section-list-gap);
  }

  .chart-heading {
    flex: 1 1 auto;
    min-width: 0;
  }

  .chart-copy {
    max-width: 620px;
  }

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

  #pnlTradeList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-canvas {
    height: 560px;
  }

  .chart-legend {
    margin-bottom: 0;
  }

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

@media (min-width: 1200px) {
  .shell {
    width: min(98vw, 1780px);
    max-width: none;
    padding-inline: 18px;
  }

  .chart-card {
    padding: 0;
  }

  .chart-canvas {
    height: 560px;
  }

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