:root {
  --bg: #07100b;
  --panel: #0b1510;
  --raised: #102018;
  --line: #294233;
  --text: #e3ece6;
  --muted: #8fa396;
  --green: #48b878;
  --red: #d86d74;
  --blue: #83aa8e;
  --cyan: #55bd7b;
}

body {
  background: var(--bg);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.site-nav {
  display: flex;
  gap: 6px;
}

.site-nav a {
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-color: var(--line);
  color: var(--text);
  outline: none;
}

.brand-heading {
  margin: 8px 0 2px;
}

.header-brand {
  display: grid;
  grid-template-columns: minmax(330px, 404px) minmax(230px, 280px);
  align-items: end;
  gap: 30px;
  min-width: 0;
}

.brand-primary {
  min-width: 0;
}

.main-logo {
  display: block;
  width: min(404px, 66.5vw);
  height: auto;
}

header .tagline {
  margin-top: 10px;
}

header .product-summary {
  max-width: 280px;
  margin: 0 0 6px;
  padding-left: 24px;
  border-left: 1px solid #31533e;
  color: #a8b9ad;
  font-size: 0.84rem;
  line-height: 1.62;
}

footer p {
  margin: 0 0 8px;
}

.footer-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--text);
  outline: none;
}

.account-button,
.result-heading button,
.modal button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--raised);
  color: var(--text);
  font: 700 0.82rem/1.2 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
}

.account-button:hover,
.result-heading button:hover,
.modal button:hover {
  border-color: var(--green);
}

header {
  background: #09140e;
  gap: 28px;
}

.eyebrow {
  color: #70c58f;
}

.controls input,
.controls select,
.chart-tools button {
  background: #09130d;
  border-color: #294233;
}

.controls .primary {
  background: #3aa568;
  border-color: #3aa568;
  color: #041009;
}

.controls .tools-heading {
  margin-bottom: 18px;
}

.pro-gate-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -6px 0 14px;
  padding: 10px 11px;
  border: 1px solid #806a2a;
  border-radius: 7px;
  background: #211b0c;
  color: #f1d989;
  font-size: 0.76rem;
  font-weight: 750;
}

.pro-gate-note[hidden] { display: none; }
.controls .pro-gate-note button { width: auto; margin: 0; padding: 6px 9px; border-color: #9a7e31; background: transparent; color: #f1d989; font-size: 0.72rem; }

.ticker-combobox {
  position: relative;
  display: flex;
  margin-top: 6px;
  margin-bottom: 14px;
}

.controls .ticker-field > label {
  margin-bottom: 0;
}

.controls .ticker-combobox input {
  margin-top: 0;
  padding-right: 42px;
}

.controls .ticker-combobox #ticker-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 38px;
  height: calc(100% - 2px);
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0 6px 6px 0;
  background: #09130d;
  color: var(--muted);
}

.ticker-options {
  position: absolute;
  z-index: 10;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #09130d;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
  text-transform: none;
  letter-spacing: 0;
}

.ticker-options[hidden] {
  display: none;
}

.controls .ticker-option {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  text-align: left;
}

.controls .ticker-option:hover,
.controls .ticker-option.active {
  background: var(--raised);
}

.ticker-option-symbol {
  min-width: 44px;
  color: var(--text);
}

.ticker-option-name {
  overflow: hidden;
  color: var(--muted);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-coverage {
  margin: -7px 0 15px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.result-heading .range {
  flex: 1;
}

.result-heading button {
  flex: 0 0 auto;
  margin-bottom: 10px;
}

.result-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.saved-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.billing-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 12px;
  margin: 14px 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(16, 32, 24, 0.72);
}

.billing-summary > span,
.billing-summary > small { color: var(--muted); }
.billing-summary > small,
.billing-summary > button { grid-column: 1 / -1; }
.billing-summary > button { margin-top: 8px; }

.billing-plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0 16px;
}

.billing-plans article {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 16, 11, 0.72);
}

.billing-plans article.featured { border-color: #43885d; box-shadow: inset 0 0 0 1px rgba(85, 189, 123, 0.1); }
.billing-plans article > span { color: var(--green-soft); font-size: 0.76rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.billing-plans strong { margin: 12px 0; font-size: 1.55rem; }
.billing-plans strong i { font-style: normal; }
.billing-plans strong small { color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.billing-plans p { flex: 1; color: var(--muted); font-size: 0.82rem; }
.billing-plans button { width: 100%; }
.billing-terms { color: var(--muted); font-size: 0.72rem; }

@media (max-width: 560px) {
  .billing-plans { grid-template-columns: 1fr; }
}

.modal {
  width: min(560px, calc(100vw - 28px));
  max-height: min(800px, calc(100vh - 28px));
  overflow: auto;
  scrollbar-color: #315f42 #09130d;
  scrollbar-width: thin;
  padding: 34px;
  border: 1px solid #31533e;
  border-radius: 18px;
  background:
    radial-gradient(circle at 8% 0%, rgba(72, 184, 120, 0.11), transparent 34%),
    linear-gradient(155deg, #0d1912 0%, #09130d 100%);
  color: var(--text);
  box-shadow:
    0 32px 100px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(119, 207, 150, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.modal::-webkit-scrollbar {
  width: 10px;
}

.modal::-webkit-scrollbar-track {
  background: #09130d;
}

.modal::-webkit-scrollbar-thumb {
  border: 2px solid #09130d;
  border-radius: 999px;
  background: #315f42;
}

.modal::backdrop {
  background: rgba(1, 6, 3, 0.82);
  backdrop-filter: blur(6px);
}

.modal h2,
.modal h3 {
  margin: 0 0 10px;
}

.modal h2 {
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.modal-copy,
.password-note {
  color: var(--muted);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0 !important;
  border-color: transparent !important;
  border-radius: 50% !important;
  background: rgba(143, 163, 150, 0.08) !important;
  color: var(--muted) !important;
  font-size: 1.25rem !important;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: rgba(143, 163, 150, 0.16) !important;
  color: var(--text) !important;
  outline: none;
}

.auth-intro {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding-right: 34px;
}

.auth-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid #3e7855;
  border-radius: 14px;
  background: linear-gradient(145deg, #1d4a2e, #102b1d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 26px rgba(0, 0, 0, 0.25);
}

.auth-mark img {
  width: 38px;
  height: 38px;
}

.auth-kicker {
  display: block;
  margin-bottom: 5px;
  color: #70c58f;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.auth-intro .modal-copy {
  margin: 0;
  font-size: 0.88rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 26px 0 20px;
  padding: 4px;
  border: 1px solid #243b2d;
  border-radius: 12px;
  background: #07100b;
}

.auth-tabs button {
  min-height: 40px;
  border-color: transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}

.auth-tabs button.active {
  border-color: #315f42;
  background: linear-gradient(180deg, #1a3d28, #153322);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  color: #dff4e6;
}

.account-form label {
  display: block;
  margin: 15px 0;
  color: #b7c8bc;
  font-size: 0.79rem;
  font-weight: 750;
  letter-spacing: 0.015em;
}

.account-form input {
  width: 100%;
  min-height: 48px;
  margin-top: 7px;
  padding: 12px 13px;
  border: 1px solid #304b39;
  border-radius: 10px;
  background: rgba(5, 13, 8, 0.82);
  color: var(--text);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.account-form input:hover {
  border-color: #42634d;
}

.account-form input:focus {
  border-color: #55bd7b;
  background: #08130c;
  box-shadow: 0 0 0 3px rgba(72, 184, 120, 0.16);
  outline: none;
}

.account-form .primary {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  border-color: #50bd79;
  border-radius: 10px;
  background: linear-gradient(180deg, #55bd7b, #3aa568);
  box-shadow: 0 8px 22px rgba(30, 117, 68, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #041009;
  font-size: 0.9rem;
  transition: filter 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.account-form .primary:hover,
.account-form .primary:focus-visible {
  border-color: #69d491;
  box-shadow: 0 10px 26px rgba(30, 117, 68, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  filter: brightness(1.06);
  outline: none;
  transform: translateY(-1px);
}

.account-form .text-button {
  display: block;
  margin: 9px auto 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-weight: 650;
  text-decoration: none;
}

.account-form .text-button:hover,
.account-form .text-button:focus-visible {
  color: #9ed9b2;
  outline: none;
}

#auth-status:not(:empty) {
  min-height: 0;
  margin: 16px 0 0;
  padding: 11px 12px;
  border: 1px solid #365742;
  border-radius: 9px;
  background: rgba(35, 78, 50, 0.35);
  color: #bde8cb;
}

.auth-assurance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 20px 0 0;
  padding-top: 17px;
  border-top: 1px solid rgba(73, 103, 82, 0.45);
  color: #7f9586;
  font-size: 0.75rem;
  text-align: center;
}

.auth-assurance span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(72, 184, 120, 0.13);
  color: #70c58f;
  font-size: 0.68rem;
}

.verification-panel {
  margin: 0 0 18px;
  padding: 12px;
  border: 1px solid #765f24;
  border-radius: 8px;
  background: #241d0b;
  color: #f4d77b;
}

.verification-panel p { margin: 0 0 8px; }
.account-security { margin: 14px 0; }

.turnstile-widget {
  min-height: 65px;
  margin: 14px 0;
}

.account-identity {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 20px;
  color: var(--muted);
}

.account-identity strong {
  color: var(--text);
}

.saved-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saved-results {
  display: grid;
  gap: 8px;
  margin: 10px 0 18px;
}

.saved-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #09130d;
}

.saved-result-summary {
  min-width: 0;
}

.saved-result-summary strong,
.saved-result-summary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-result-summary span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.modal .delete-result {
  color: var(--red);
}

.modal .quiet {
  color: var(--red);
}

.back-button {
  margin-bottom: 18px;
}

.saved-detail-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.saved-detail-metrics div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0f1c15;
}

.saved-detail-metrics span,
.saved-detail-metrics strong {
  display: block;
}

.saved-detail-metrics span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.modal pre {
  overflow: auto;
  max-height: 260px;
  padding: 12px;
  border-radius: 7px;
  background: #07100b;
  color: var(--muted);
  font-size: 0.75rem;
}

.saved-trades {
  max-height: 300px;
  margin-top: 14px;
}

.saved-trades table {
  width: 100%;
  border-collapse: collapse;
}

.saved-trades th,
.saved-trades td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

.saved-trades th:first-child,
.saved-trades td:first-child {
  text-align: left;
}

.small-modal {
  width: min(440px, calc(100vw - 28px));
}

@media (max-width: 1100px) {
  header {
    flex-wrap: wrap;
  }

  .header-brand,
  .header-actions {
    width: 100%;
  }

  .header-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 700px) {
  .header-brand {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  header .product-summary {
    max-width: 520px;
    margin: 0;
    padding: 16px 0 0;
    border-top: 1px solid #31533e;
    border-left: 0;
  }
}

@media (max-width: 620px) {
  .header-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .saved-result-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .saved-result-row .delete-result {
    grid-column: 2;
  }

  .modal {
    padding: 26px 20px;
    border-radius: 14px;
  }

  .auth-intro {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
  }

  .auth-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-form input,
  .account-form .primary {
    transition: none;
  }

  .progress span {
    animation: none;
  }
}

.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;
}

body :focus-visible {
  outline: 3px solid #79cf99 !important;
  outline-offset: 3px !important;
}

.controls button:hover,
.chart-tools button:hover,
.chart-tools button:focus-visible {
  border-color: #61c486;
}

.metric {
  background: #0f1c15;
}

.chart-card,
.table-card {
  background: #0c1711;
}

.notice {
  border-color: #385844;
}

.first-run {
  max-width: 720px;
  padding: clamp(24px, 5vw, 42px);
  border-style: solid;
  background: linear-gradient(145deg, rgba(16, 32, 24, 0.92), rgba(9, 19, 13, 0.82));
}

.workspace.first-run-workspace {
  display: grid;
  place-items: center;
}

.first-run-workspace .first-run {
  width: min(720px, 100%);
}

.first-run h2 { margin: 0 0 16px; color: var(--text); font-size: 1.35rem; }
.first-run ol { margin: 0; padding-left: 21px; color: #c7d4cb; }
.first-run li + li { margin-top: 8px; }
.first-run p { margin: 20px 0 0; color: var(--muted); }

.network-status {
  position: sticky;
  z-index: 100;
  top: 0;
  padding: 10px 20px;
  border-bottom: 1px solid #806a2a;
  background: #211b0c;
  color: #f1d989;
  text-align: center;
  font-size: 0.84rem;
}

.network-status[hidden] { display: none; }

@media (max-width: 560px) {
  .result-heading { display: block; }
  .result-actions { margin-bottom: 10px; }
  .result-actions button { flex: 1; }
}

.chart-tooltip {
  background: rgba(6, 14, 9, 0.97);
  border-color: #466952;
}

.tool-note {
  color: var(--muted);
  font-size: 0.75rem;
  margin: 6px 0 10px;
}

.parameter-summary {
  min-width: 260px;
  white-space: normal !important;
  color: var(--muted);
  font-size: 0.75rem;
}

.load-result {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #102018;
  color: var(--text);
  cursor: pointer;
}

.load-result:hover {
  border-color: var(--green);
}

#trades-table th:first-child,
#trades-table td:first-child {
  text-align: left;
}

.ranking-bars {
  display: grid;
  gap: 7px;
  margin: 18px 0 24px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #09130d;
}

.ranking-bar-row {
  display: grid;
  grid-template-columns: minmax(145px, 220px) minmax(220px, 1fr) 72px;
  align-items: center;
  gap: 10px;
  min-height: 24px;
}

.ranking-bar-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-bar-track {
  position: relative;
  height: 14px;
  border-radius: 3px;
  background: #101c15;
  overflow: hidden;
}

.ranking-zero {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #728779;
  z-index: 2;
}

.ranking-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  min-width: 2px;
  border-radius: 2px;
}

.ranking-bar.positive-bar {
  background: #48b878;
}

.ranking-bar.negative-bar {
  background: #d86d74;
}

.ranking-bar.benchmark-bar {
  background: #4f8fd8;
}

.benchmark-text {
  color: #86baf0 !important;
  font-weight: 700;
}

.benchmark-row {
  background: rgba(79, 143, 216, 0.1);
}

.ranking-bar-value {
  font: 0.73rem ui-monospace, SFMono-Regular, monospace;
  text-align: right;
}

@media (max-width: 700px) {
  .ranking-bar-row {
    grid-template-columns: 110px minmax(150px, 1fr) 62px;
  }
}
