:root {
  color-scheme: dark;
  font-family: Arial, sans-serif;
  --tt-bg: #10131a;
  --tt-surface: #151a24;
  --tt-card: #1a1f2a;
  --tt-border: #2a3342;
  --tt-text: #f0f2f8;
  --tt-muted: #9db0cc;
  --tt-accent: #3b82f6;
  --tt-accent-rgb: 59, 130, 246;
  --tt-glow-rgb: 125, 183, 255;
  --tt-glow-soft: rgba(var(--tt-glow-rgb), 0.2);
  --tt-glow-strong: rgba(var(--tt-glow-rgb), 0.32);
  --tt-glow-edge: rgba(var(--tt-accent-rgb), 0.3);
  --tt-good: #2a8f55;
  --tt-bad: #b04545;
  --tt-radius: 12px;
  /* 4-tier glow: none = flat (kebab rows); low < medium < high; hover +1 on interactive cards */
  --glow-shadow-none: none;
  --glow-border-low: rgba(255, 255, 255, 0.08);
  --glow-border-medium: rgba(var(--tt-accent-rgb), 0.22);
  --glow-border-high: rgba(var(--tt-accent-rgb), 0.32);
  --glow-shadow-low:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 14px 34px rgba(0, 0, 0, 0.35),
    0 0 16px rgba(var(--tt-glow-rgb), 0.14);
  --glow-shadow-low-muted:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 10px 24px rgba(0, 0, 0, 0.3);
  --glow-shadow-low-dim:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 10px 30px rgba(7, 16, 34, 0.35),
    0 0 18px rgba(var(--tt-glow-rgb), 0.1);
  --glow-shadow-medium:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 18px 40px rgba(7, 16, 34, 0.52),
    0 0 28px var(--tt-glow-soft);
  --glow-shadow-high:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 22px 48px rgba(7, 16, 34, 0.62),
    0 0 42px var(--tt-glow-strong);
  /* Tab scrollports: must clear --glow-shadow-medium on hover (28px halo + 18px/40px drop) without clipping */
  --tab-panel-glow-inset-x: 38px;
  --tab-panel-glow-inset-y: 34px;
}

body {
  margin: 0;
  background: radial-gradient(1200px 700px at 15% -10%, rgba(var(--tt-accent-rgb), 0.06), transparent 60%), var(--tt-bg);
  color: var(--tt-text);
}

body.app-authenticated {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.app-authenticated .topbar,
body.app-authenticated .legal-footer {
  flex-shrink: 0;
}

.topbar {
  padding: 10px 16px;
  border-bottom: 1px solid #2a3342;
  overflow: visible;
  position: relative;
  z-index: 40;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  max-width: 820px;
  margin: 0 auto;
}

.topbar-title {
  min-width: 0;
}

.topbar h1 {
  margin: 0 0 4px 0;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topbar-logo {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.topbar p {
  margin: 0;
  font-size: 12px;
  color: #9db0cc;
}

body:not(.app-authenticated) #topbar-menu-wrap {
  display: none;
}

body:not(.app-authenticated) .topbar {
  display: none;
}

.topbar-actions {
  position: relative;
  flex-shrink: 0;
  padding-top: 2px;
  z-index: 41;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  margin-top: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #c8d4e8;
}

.icon-btn:hover {
  background: #1e2430;
  border-color: #2a3342;
}

.kebab-svg {
  display: block;
}

.header-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  background: #171c25;
  border: 1px solid #2a3342;
  border-radius: 12px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  z-index: 120;
  padding: 6px 0;
}

.header-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 12px 16px;
  margin: 0;
  min-height: auto;
  font-size: 14px;
  color: #f0f2f8;
  cursor: pointer;
  /* Global `button` uses a blue box-shadow; menu rows should be flat until hover */
  box-shadow: none;
  filter: none;
}

.header-menu-item:hover {
  background: #1e2430;
  box-shadow: none;
}

.header-menu-item:focus-visible {
  outline: 2px solid rgba(var(--tt-accent-rgb), 0.45);
  outline-offset: -2px;
  box-shadow: none;
}

.header-menu-item.menu-danger {
  color: #ffb4be;
  border-top: 1px solid #2a3342;
  margin-top: 4px;
  padding-top: 14px;
}

.container {
  padding: 16px;
  padding-bottom: 76px;
  max-width: 820px;
  margin: 0 auto;
}

body.app-authenticated main.container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.req {
  color: #e88888;
  font-weight: 600;
}

.card {
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border: 1px solid var(--glow-border-low);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--glow-shadow-low);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

.card h3 {
  margin-top: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.full {
  grid-column: 1 / -1;
}

label {
  font-size: 12px;
  color: #b6c3db;
  display: block;
}

input,
select,
textarea,
button {
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  min-height: 42px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #121a28 0%, #0e1522 100%);
  color: #f0f2f8;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

textarea {
  min-height: 70px;
}

button {
  cursor: pointer;
  background: #224f95;
  border-color: #3760a3;
  box-shadow: 0 8px 18px rgba(15, 33, 68, 0.38);
}

button:hover {
  border-color: #4d74b6;
  box-shadow: 0 12px 24px rgba(15, 33, 68, 0.5), 0 0 14px var(--tt-glow-soft);
}

button:active {
  transform: scale(0.99);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: var(--tt-glow-edge);
  box-shadow:
    0 0 0 2px rgba(var(--tt-accent-rgb), 0.16),
    0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

select {
  color-scheme: dark;
}

select option,
select optgroup {
  background-color: #0f1728;
  color: #e6eefc;
}

.row {
  display: flex;
  gap: 8px;
}

.row > * {
  flex: 1;
}

/* Bottom nav only after sign-in (guests use a single sign-in card on Home). */
body:not(.app-authenticated) .tabs {
  display: none;
}

body:not(.app-authenticated) .container {
  padding-top: 24px;
  padding-bottom: 16px;
  max-width: 520px;
}

/* --- Login / subscription gates (centered hero glow, same family as equity / Add Trade) --- */
.gate-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: min(100vh, 720px);
  padding: 8px 0 32px;
  box-sizing: border-box;
}

.gate-card {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 24px 22px 26px;
  border-radius: var(--tt-radius);
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
}

.gate-title {
  margin: 0 0 6px 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gate-sub {
  margin: 0 0 18px 0;
  font-size: 13px;
  line-height: 1.45;
}

.gate-closed-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

a.gate-mailto-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  text-decoration: none;
  box-sizing: border-box;
}

.auth-form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form-stack label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #b6c3db;
}

.auth-form-stack input[type="email"],
.auth-form-stack input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--tt-border);
  background: #1a1f2a;
  color: var(--tt-text);
  font-size: 15px;
}

.auth-form-stack input:focus {
  outline: none;
  border-color: rgba(var(--tt-accent-rgb), 0.55);
  box-shadow: 0 0 0 1px rgba(var(--tt-accent-rgb), 0.25);
}

.auth-submit {
  margin-top: 4px;
  width: 100%;
  min-height: 48px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
}

.gate-switch {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--tt-border);
  border-radius: 10px;
  color: #c8d4e8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.gate-switch:hover {
  border-color: rgba(var(--tt-accent-rgb), 0.45);
  color: #e8edf5;
}

.gate-link {
  display: inline-block;
  margin: 0 auto;
  font-size: 13px;
  color: #8fb8ff;
  text-decoration: none;
  text-align: center;
}

.gate-link:hover {
  text-decoration: underline;
}

.auth-alt-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 4px;
}

.auth-alt-row.hidden {
  display: none;
}

/* `.auth-form-stack label { display: flex }` beats `.hidden` otherwise — keep confirm row off in sign-in mode */
.auth-form-stack label.hidden,
.auth-form-stack label[hidden] {
  display: none !important;
}

.auth-alt-row[hidden] {
  display: none !important;
}

/* Google OAuth login card */
.gate-brand {
  text-align: center;
  margin-bottom: 24px;
}

.gate-app-name {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #e8edf5;
}

.gate-app-tagline {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #aabdd4;
  letter-spacing: -0.01em;
}

.gate-app-tagline-sub {
  margin: 0;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.google-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 10px;
  color: #3c4043;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.15s, box-shadow 0.15s;
}

.google-signin-btn:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

.google-logo {
  flex-shrink: 0;
}

.microsoft-signin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  background: #2f2f2f;
  border: 1px solid #505050;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  transition: background 0.15s, box-shadow 0.15s;
}

.microsoft-signin-btn:hover {
  background: #3b3b3b;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}

.microsoft-logo {
  flex-shrink: 0;
}

.gate-hint {
  text-align: center;
  margin-top: 14px;
  margin-bottom: 4px;
  font-size: 12px;
}

.auth-error-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 16px;
  text-align: center;
}

.gate-subscription-intro {
  text-align: center;
  margin-bottom: 8px;
}

.gate-subscription-intro .gate-title {
  margin-bottom: 8px;
}

.plans-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .plans-grid.plans-grid--multi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.plan-card {
  width: 100%;
  box-sizing: border-box;
  padding: 20px 18px 22px;
  border-radius: var(--tt-radius);
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
   min-height: 0;
}

.plan-card--featured {
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

.plan-card--featured:hover {
  border-color: var(--glow-border-high);
  box-shadow: var(--glow-shadow-high);
}

.plan-card--muted {
  opacity: 0.88;
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: var(--glow-shadow-low-dim);
}

.plan-card--muted:hover {
  border-color: var(--glow-border-low);
  box-shadow: var(--glow-shadow-low);
}

.plan-card-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #b8c3d6;
}

.plan-card-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.plan-card-price {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #e8edf5;
}

.plan-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #9db0cc;
  flex: 1;
}

.plan-card .btn-primary,
.plan-card .btn-secondary {
  width: 100%;
  margin-top: 4px;
  min-height: 44px;
}

.plan-card button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.gate-subscription-feedback:not(.hidden) {
  margin-top: 16px;
}

.gate-subscription-feedback {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  box-sizing: border-box;
}

.gate-subscription-feedback--info {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}

.gate-subscription-feedback--error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.gate-subscription-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  margin: 20px auto 0;
}

@media (min-width: 480px) {
  .gate-subscription-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .gate-subscription-actions .btn-secondary {
    flex: 1 1 auto;
    min-width: 140px;
  }
}

body.app-authenticated .gate-screen--wide {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #2a3342;
  background: #171c25;
}

.tab-btn {
  border-radius: 0;
  border: 0;
  border-right: 1px solid #2a3342;
  background: linear-gradient(180deg, #131b2a 0%, #0f1725 100%);
  min-height: 52px;
  padding: 14px 10px;
}

.tab-btn:last-child {
  border-right: 0;
}

.tab-btn.active {
  background: linear-gradient(180deg, #2b5da8 0%, #234c8d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.tab-viewport {
  --tab-index: 0;
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: hidden;
  width: 100%;
  min-height: 0;
}

body.app-authenticated .tab-viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.tab-track {
  display: flex;
  width: 300%;
  min-height: 0;
  flex: 1;
  margin-left: calc(var(--tab-index, 0) * -100%);
  transition: margin-left 0.32s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tab-panel {
  flex: 0 0 calc(100% / 3);
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  padding-inline: var(--tab-panel-glow-inset-x);
  padding-block: var(--tab-panel-glow-inset-y);
}

#tab-analytics.tab-panel {
  padding-top: 10px;
}

.tab-panel.active.tab-panel--refreshing {
  opacity: 0.92;
  filter: grayscale(0.25);
  transition: opacity 0.15s ease, filter 0.15s ease;
}

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

  .tab-panel.active.tab-panel--refreshing {
    transition: none;
  }
}

#analytics-dynamic.analytics-dynamic--refreshing {
  opacity: 0.92;
  filter: grayscale(0.25);
  transition: opacity 0.15s ease, filter 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
  #analytics-dynamic.analytics-dynamic--refreshing {
    transition: none;
  }
}

.muted {
  color: #9db0cc;
  font-size: 12px;
}

.error {
  margin-top: 8px;
  margin-bottom: 10px;
  border: 1px solid #7d2f36;
  background: #34181c;
  color: #ffb4be;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.hidden {
  display: none;
}

.section-title {
  font-weight: 700;
  margin: 8px 0;
  color: #b6c3db;
}

#add-sticky-spacer.active {
  height: 72px;
}

.summary-strip {
  position: static;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  margin-bottom: 10px;
  border-color: rgba(var(--tt-accent-rgb), 0.2);
  box-shadow: var(--glow-shadow-low);
}

.home-section-sep {
  height: 1px;
  margin: 2px 2px 12px;
  background: linear-gradient(
    90deg,
    rgba(var(--tt-accent-rgb), 0.14) 0%,
    rgba(var(--tt-accent-rgb), 0.3) 50%,
    rgba(var(--tt-accent-rgb), 0.14) 100%
  );
}

.summary-period-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-period-header {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.summary-period-label {
  font-size: 11px;
  color: #9db0cc;
  flex: 1;
  min-width: 0;
}

.summary-period-select {
  flex: 0 0 auto;
  width: auto;
  min-width: min(200px, 52vw);
  max-width: 240px;
  margin-top: 0;
  font-size: 14px;
  cursor: pointer;
}

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

.summary-row {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: #9db0cc;
}

.summary-row strong {
  color: #f0f2f8;
  font-size: 16px;
}

#sum-pl.summary-pl-pos {
  color: #4ecf7a;
}

#sum-pl.summary-pl-neg {
  color: #f07171;
}

/* Semantic P/L and KPI tint (analytics, tables, history — not only home #sum-pl) */
.summary-pl-pos {
  color: #4ecf7a;
}

.summary-pl-neg {
  color: #f07171;
}

.summary-pl-be {
  color: #9db0cc;
}

.metric-kpi-pos {
  color: #4ecf7a;
}

.metric-kpi-neg {
  color: #f07171;
}

.metric-kpi-neutral {
  color: #f0f2f8;
}

.analytics-table th.analytics-sort-th {
  user-select: none;
  white-space: nowrap;
  vertical-align: bottom;
  position: relative;
}

.analytics-table th.analytics-sort-th--filter-active .analytics-th-menu-trigger {
  border-bottom-color: rgba(var(--tt-accent-rgb), 0.55);
}

.analytics-table th.analytics-sort-th .analytics-th-menu-trigger {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  min-height: auto;
  margin: 0;
  padding: 2px 4px;
  box-sizing: border-box;
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 4px;
  box-shadow: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.analytics-table th.analytics-sort-th .analytics-th-menu-trigger:hover {
  color: var(--tt-accent);
  box-shadow: none;
  transform: none;
}

.analytics-table th.analytics-sort-th .analytics-th-menu-trigger:active {
  transform: none;
  box-shadow: none;
}

.analytics-table th.analytics-sort-th .analytics-th-label {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

.analytics-table th.analytics-sort-th .analytics-th-label-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-table th.analytics-sort-th .sort-caret {
  opacity: 0.65;
  font-size: 0.85em;
  flex-shrink: 0;
}

.trade-head .pl.summary-pl-pos,
.calendar-list .cal-pnl.summary-pl-pos {
  color: #4ecf7a;
}

.trade-head .pl.summary-pl-neg,
.calendar-list .cal-pnl.summary-pl-neg {
  color: #f07171;
}

.trade-head .pl.summary-pl-be,
.calendar-list .cal-pnl.summary-pl-be {
  color: #9db0cc;
}

button.tiny {
  width: auto;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 11px;
  margin-top: 4px;
}

.chip-strip-label {
  font-size: 11px;
  margin: 0 0 6px 0;
  color: #9db0cc;
}

.history-range-hint {
  font-size: 12px;
  font-weight: 400;
}

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.filter-chip {
  flex: 0 0 auto;
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
  background: #1e2430;
  border-color: #3a4a63;
}

.filter-chip.active {
  background: #224f95;
  border-color: #3760a3;
}

.filter-chip--strategy {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tools-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tools-row input[type="file"] {
  min-height: auto;
  padding: 6px;
}

button.secondary {
  background: #2a3342;
  border-color: #4a5870;
}

.side-big {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.side-btn {
  min-height: 52px;
  font-size: 16px;
  font-weight: 700;
}

.side-long.active {
  background: #1a5f3a;
  border-color: #2a8f55;
}

.side-short.active {
  background: #7a2f2f;
  border-color: #b04545;
}

.compact-grid {
  margin-top: 8px;
}

.asset-timeframe-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  gap: 10px;
}

.rr-banner {
  margin: 10px 0;
  padding: 10px;
  background: #0f131a;
  border-radius: 8px;
  border: 1px solid #2a3342;
  font-size: 13px;
  line-height: 1.45;
  color: #c8d4e8;
}

.add-screenshot-block {
  margin: 10px 0 12px;
}

.screenshot-paste-box {
  margin-top: 6px;
  border: 1px dashed #4a5870;
  border-radius: 10px;
  min-height: 56px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #9db0cc;
  background: #111722;
  cursor: text;
}

.screenshot-paste-box.has-image {
  padding: 0;
  min-height: 120px;
  cursor: default;
}

.screenshot-paste-box:focus {
  outline: 2px solid #4a6fa8;
  outline-offset: 2px;
  border-color: #4a6fa8;
}

.screenshot-preview-wrap {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.screenshot-preview-img {
  display: block;
  width: 100%;
  max-height: 320px;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #344056;
}

.screenshot-preview-img.hidden {
  display: none !important;
}

.rr-banner .rr-line {
  display: block;
}

.rr-banner .rr-k {
  color: #9db0cc;
  font-weight: 500;
}

.rr-banner .rr-dot {
  color: #5a6578;
  margin: 0 2px;
}

.rr-banner .rr-val.rr-risk {
  color: #f07171;
  font-weight: 600;
}

.rr-banner .rr-val.rr-rew {
  color: #4ecf7a;
  font-weight: 600;
}

.rr-banner .rr-val.rr-pending {
  color: #9db0cc;
  font-weight: 500;
}

.rr-banner .rr-ratio {
  color: #f0f2f8;
  font-weight: 600;
}

.rr-banner .rr-ratio.rr-ratio-pending {
  color: #9db0cc;
  font-weight: 500;
}

.details-advanced,
.details-notes {
  margin: 12px 0;
}

.details-notes textarea {
  margin-top: 8px;
}

.ind-chips-wrap {
  margin: 12px 0;
}

.ind-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #0f131a;
  border: 1px solid #2a3342;
  border-radius: 12px;
}

.ind-chip.is-na .ind-pill-box {
  opacity: 0.45;
}

.ind-chip-label {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  flex: 1;
  min-width: 140px;
  white-space: nowrap;
}

.ind-auto-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.1;
  color: #cfe2ff;
  border: 1px solid rgba(var(--tt-accent-rgb), 0.35);
  background: rgba(var(--tt-accent-rgb), 0.14);
}

button.ind-auto-badge.ind-auto-toggle {
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.1;
  width: auto;
  min-height: 0;
}

button.ind-auto-badge.ind-auto-toggle.is-overridden {
  color: #ffd9b0;
  border-color: rgba(255, 179, 102, 0.5);
  background: rgba(255, 179, 102, 0.15);
}

.ind-chip.is-pending {
  border-color: rgba(var(--tt-accent-rgb), 0.35);
  box-shadow: 0 0 0 2px rgba(var(--tt-accent-rgb), 0.08);
}

.ind-chip.is-pending .ind-pill-box,
.ind-chip.is-pending .na-pill,
.ind-chip.is-pending .ind-auto-toggle {
  opacity: 0.55;
}

.ind-chip-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Spec-style pill: No (against) | Yes (in favour) */
.ind-pill-box {
  display: inline-flex;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #4a5870;
  background: #151a22;
}

.pill-half {
  min-width: 72px;
  min-height: 40px;
  margin: 0;
  padding: 10px 14px;
  border: 0;
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
  background: #1e2430;
  color: #c8d4e8;
}

.pill-half + .pill-half {
  border-left: 1px solid #3a4a63;
}

.pill-no.active {
  background: #4a2528;
  color: #ffb4be;
}

.pill-yes.active {
  background: #1a3d2a;
  color: #b8f5d0;
}

/* N/A — not counted for this trade */
.na-pill {
  width: 44px;
  min-height: 40px;
  padding: 0;
  border-radius: 999px;
  font-size: 18px;
  line-height: 1;
  background: #2a3342;
  color: #9db0cc;
}

.na-pill.active {
  background: #3d4a5c;
  color: #f0f2f8;
  box-shadow: 0 0 0 2px #5a6a82;
}

#tab-add.tab-panel.active {
  padding-bottom: calc(88px + var(--tab-panel-glow-inset-y));
}

.add-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 52px;
  padding: 10px 16px;
  background: linear-gradient(transparent, #10131a 30%);
  z-index: 6;
}

.log-trade-btn {
  min-height: 52px;
  font-size: 17px;
  font-weight: 700;
}

/* Add Trade shell: low at rest, medium on hover (+1). Featured plan tiles override below. */
.add-trade-card {
  border-color: var(--glow-border-low);
  box-shadow: var(--glow-shadow-low);
}

.add-trade-card:hover {
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

/* Subscription plan cards reuse .add-trade-card in markup — keep medium / high */
.plan-card.plan-card--featured.add-trade-card {
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

.plan-card.plan-card--featured.add-trade-card:hover {
  border-color: var(--glow-border-high);
  box-shadow: var(--glow-shadow-high);
}

.trade-card {
  box-sizing: border-box;
  border-left: 4px solid #2a3342;
  border: 1px solid var(--glow-border-low);
  background: linear-gradient(180deg, #111827 0%, #0c1422 100%);
  box-shadow: var(--glow-shadow-low);
  padding: 10px 12px 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.trade-card:hover {
  transform: translateY(-2px);
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

/* Home history cards: low tier depth-only at rest */
#trades-closed .trade-card {
  box-shadow: var(--glow-shadow-low-muted);
}

#trades-closed .trade-card:hover {
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

.trade-card.win {
  border-left-color: #2a8f55;
}

.trade-card.loss {
  border-left-color: #b04545;
}

.trade-card.be {
  border-left-color: #8a8f9a;
}

.trade-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.pill-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #243044;
  border: 1px solid #3a4a63;
}

/* Trade cards: in favour vs against (N/A omitted); text stays white */
.pill-yes-tag {
  background: #1a3d2a;
  border-color: #2a8f55;
  color: #f0f2f8;
}

.pill-no-tag {
  background: #4a2528;
  border-color: #b04545;
  color: #f0f2f8;
}

.trade-card-open .trade-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.trade-card-open .trade-card-main {
  flex: 1 1 200px;
  min-width: 0;
}

.trade-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.trade-card-closed .trade-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.trade-card-closed .trade-card-main {
  flex: 1 1 200px;
  min-width: 0;
}

.trade-card-closed[data-trade-detail-id] {
  cursor: pointer;
}

.trade-card-actions-history {
  flex: 0 0 auto;
}

#history-show-more,
#analytics-recent-show-more {
  margin-top: 8px;
}

.edit-trade-btn {
  background: #2a3348;
  border-color: #4a5a78;
  color: #e8edf5;
}

.edit-trade-btn:hover {
  background: #343e58;
  border-color: #5a6a88;
}

.btn-remove-trade {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  background: #3a2528;
  border: 1px solid #8a4048;
  color: #f0d6d8;
  border-radius: 8px;
  cursor: pointer;
}

.btn-remove-trade:hover {
  background: #4a3035;
  border-color: #a05058;
}

.modal-panel-scroll {
  max-height: min(88vh, 720px);
  overflow-y: auto;
}

.close-inline-btn {
  width: auto;
  min-width: 56px;
  min-height: 40px;
  margin-top: 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.close-inline-btn.close-tp {
  background: #1a3d2a;
  border-color: #2a8f55;
  color: #f0f2f8;
}

.close-inline-btn.close-tp:hover {
  background: #224f3a;
  border-color: #34a66a;
  color: #f0f2f8;
}

.close-inline-btn.close-sl {
  background: #4a2528;
  border-color: #b04545;
  color: #f0f2f8;
}

.close-inline-btn.close-sl:hover {
  background: #5c3034;
  border-color: #c85858;
  color: #f0f2f8;
}

.close-inline-btn.close-manual {
  background: #224f95;
  border-color: #3760a3;
  color: #f0f2f8;
}

.close-inline-btn.close-manual:hover {
  background: #2a5cb0;
  border-color: #4a7bc4;
  color: #f0f2f8;
}

@media (max-width: 520px) {
  .trade-card-open .trade-card-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .trade-card-closed .trade-card-actions-history {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
}

.modal-pl-box {
  margin: 12px 0 4px;
  padding: 10px 12px;
  background: #0f131a;
  border-radius: 8px;
  border: 1px solid #2a3342;
}

.modal-pl-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  margin-top: 6px;
}

.modal-pl-row:first-child {
  margin-top: 0;
}

.modal-pl-input {
  width: 140px;
  min-height: 32px;
  margin-top: 0;
  padding: 6px 8px;
  text-align: right;
  font-weight: 700;
}

.modal-pl-input:disabled {
  opacity: 0.6;
}

.modal-pl-input[readonly] {
  cursor: default;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 16px;
  z-index: 51;
  border: 1px solid var(--glow-border-medium);
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  box-shadow: var(--glow-shadow-medium);
}

.modal-panel--catalog {
  max-width: 440px;
}

.modal-panel--strategies {
  max-width: 460px;
}

/* Full-screen Edit strategies — split catalog | strategies */
.strategy-setup-view {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 520px at 22% -10%, rgba(var(--tt-accent-rgb), 0.14), transparent 62%),
    radial-gradient(900px 420px at 88% 8%, rgba(var(--tt-accent-rgb), 0.09), transparent 64%),
    var(--tt-bg);
  overflow: hidden;
}

.strategy-setup-view.hidden {
  display: none;
}

.strategy-setup-topbar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--tt-border);
  background: linear-gradient(180deg, var(--tt-surface) 0%, var(--tt-bg) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 12px 24px rgba(0, 0, 0, 0.3),
    0 0 18px rgba(var(--tt-glow-rgb), 0.16);
}

.strategy-setup-title-inline {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
}

.strategy-setup-topbar-spacer {
  width: min(120px, 28vw);
  flex-shrink: 0;
}

.strategy-setup-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--tt-border);
  background: var(--tt-card);
  color: var(--tt-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  width: auto;
}

.strategy-setup-back:hover {
  color: var(--tt-text);
  border-color: #4a5f8a;
  background: #1e2430;
}

.strategy-setup-back-icon {
  font-size: 18px;
  line-height: 1;
}

.strategy-setup-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 28px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.strategy-setup-scroll #strategy-setup-error {
  margin-top: 0;
  margin-bottom: 10px;
}

.strategy-setup-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

@media (max-width: 800px) {
  .strategy-setup-split {
    grid-template-columns: 1fr;
  }
}

.strategy-panel {
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border: 1px solid var(--glow-border-low);
  border-radius: var(--tt-radius);
  padding: 14px 14px 16px;
  min-height: 120px;
  box-shadow: var(--glow-shadow-low);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.strategy-panel:hover {
  transform: translateY(-2px);
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

.strategy-panel-title {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 700;
}

.strategy-panel-lead {
  margin: 0 0 12px 0;
  line-height: 1.45;
}

.catalog-add-row-main {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.catalog-add-row-main #indicators-add-btn {
  flex: 0 0 auto;
  width: auto;
  min-height: 42px;
}

.catalog-indicator-name-input {
  flex: 1 1 160px;
  min-width: 0;
  margin-top: 0 !important;
}

.catalog-search-row {
  margin-bottom: 10px;
}

.catalog-search-row .strategy-search-input {
  width: 100%;
}

.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.strategy-search-input {
  flex: 1 1 140px;
  min-width: 0;
  margin-top: 0 !important;
  min-height: 40px !important;
  border-color: rgba(var(--tt-accent-rgb), 0.18);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 0 12px rgba(var(--tt-glow-rgb), 0.14);
}

.catalog-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.catalog-add-row .field-input {
  flex: 1;
  margin-top: 0 !important;
}

.strategy-strategies-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.strategy-strategies-head .strategy-panel-title {
  margin: 0;
}

.strategies-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.strategy-empty-panel {
  padding: 14px;
  border-radius: 10px;
  border: 1px dashed var(--tt-border);
  text-align: center;
}

.strategy-empty-panel p {
  margin: 0 0 10px 0;
}

.strategy-card {
  border: 1px solid var(--glow-border-low);
  border-radius: 10px;
  background: linear-gradient(180deg, #111827 0%, #0d1523 100%);
  overflow: hidden;
  box-shadow: var(--glow-shadow-low);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.strategy-card:hover {
  transform: translateY(-2px);
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

.strategy-card--new {
  border-color: #4a5f8a;
}

.strategy-card-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  border: 0;
  background: transparent;
  color: var(--tt-text);
  cursor: pointer;
  font-size: 14px;
}

.strategy-card-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}

.strategy-card-chevron {
  flex-shrink: 0;
  width: 1.25rem;
  transition: transform 0.15s ease;
  color: var(--tt-muted);
  font-size: 12px;
  margin-top: 3px;
}

.strategy-card--expanded .strategy-card-chevron {
  transform: rotate(90deg);
}

.strategy-card-head-text {
  flex: 1;
  min-width: 0;
}

.strategy-card-name {
  font-weight: 600;
  font-size: 15px;
  display: block;
}

.strategy-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.strategy-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--tt-border);
  color: var(--tt-muted);
}

.strategy-badge--default {
  border-color: #8a7040;
  color: #d4a84b;
}

.strategy-badge--last {
  border-color: #3d5280;
  color: #9db0e8;
}

.strategy-card-preview {
  padding: 0 12px 10px 36px;
  font-size: 12px;
  line-height: 1.4;
}

.strategy-card-body {
  padding: 0 12px 14px 36px;
  border-top: 1px solid var(--tt-border);
  background: rgba(0, 0, 0, 0.12);
}

.strategy-card-body.hidden {
  display: none;
}

.strategy-edit-name {
  width: 100%;
  margin-bottom: 10px;
  margin-top: 0;
}

.strategy-chip-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tt-muted);
  margin: 10px 0 6px;
}

.strategy-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.strategy-selected-chips {
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.strategy-chip {
  display: inline-flex;
  box-sizing: border-box;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--tt-border);
  background: var(--tt-bg);
  font-size: 13px;
  cursor: pointer;
  max-width: 100%;
}

.strategy-chip--selected {
  border-color: #6b7cff;
  background: rgba(107, 124, 255, 0.1);
}

.strategy-chip--draggable {
  justify-content: flex-start;
  cursor: grab;
  user-select: none;
  position: relative;
  width: 100%;
  max-width: 100%;
  padding-left: 8px;
}

.strategy-chip-label {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-chip-drag {
  color: var(--tt-muted);
  font-size: 12px;
  width: 12px;
  margin-right: 4px;
  text-align: center;
  opacity: 0.9;
  flex-shrink: 0;
}

.strategy-chip-dragging {
  opacity: 0.6;
}

.strategy-chip--selected.strategy-drop-before::before,
.strategy-chip--selected.strategy-drop-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  border-top: 2px dashed #4a6fa8;
  pointer-events: none;
}

.strategy-chip--selected.strategy-drop-before::before {
  top: -6px;
}

.strategy-chip--selected.strategy-drop-after::after {
  bottom: -6px;
}

.strategy-chip-remove {
  width: auto;
  min-height: 0;
  margin-top: 0;
  border: 0;
  background: transparent;
  color: var(--tt-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  margin-left: 2px;
}

.strategy-chip-remove:hover {
  color: #ffb4be;
}

.strategy-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ind-editor-row.ind-search-hidden {
  display: none;
}

.ind-editor-label {
  cursor: text;
}

.ind-editor-label:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ind-cat-usage {
  font-size: 11px;
  color: var(--tt-muted);
  margin-top: 2px;
}

.ind-editor-actions-row {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}

/* Edit strategies: automation toggles (robot icons + state glow) */
.strategy-setup-view .btn-automation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.strategy-setup-view .btn-automation-toggle-icon {
  flex-shrink: 0;
  display: block;
}

.strategy-setup-view .btn-automation-toggle--icon-only {
  justify-content: center;
  min-width: 40px;
  padding: 8px 10px !important;
}

.strategy-setup-view .btn-automation-toggle--on {
  border-color: rgba(74, 222, 128, 0.42);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.14) 0%, #1e2430 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 0 0 1px rgba(74, 222, 128, 0.12),
    0 0 20px rgba(74, 222, 128, 0.3);
}

.strategy-setup-view .btn-automation-toggle--off {
  border-color: rgba(248, 113, 113, 0.38);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.1) 0%, #1e2430 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 0 0 1px rgba(248, 113, 113, 0.1),
    0 0 18px rgba(248, 113, 113, 0.26);
}

.strategy-setup-view .btn-automation-toggle--on:hover {
  border-color: rgba(74, 222, 128, 0.55);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.2) 0%, #252b38 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(74, 222, 128, 0.18),
    0 0 26px rgba(74, 222, 128, 0.38);
}

.strategy-setup-view .btn-automation-toggle--off:hover {
  border-color: rgba(248, 113, 113, 0.5);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.14) 0%, #252b38 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 0 0 1px rgba(248, 113, 113, 0.14),
    0 0 24px rgba(248, 113, 113, 0.34);
}

.ind-delete-catalog {
  width: 40px;
  min-height: 40px !important;
  padding: 0 !important;
  font-size: 16px;
  border-radius: 8px;
}

.strategy-setup-view .ind-editor-body {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.strategy-setup-view .ind-editor-top {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
}

.strategy-setup-view .ind-inline-rename {
  margin-top: 0;
  font-size: 15px;
  font-weight: 600;
}

.setup-page-card {
  background: var(--tt-card);
  border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius);
  padding: 16px 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.setup-page-card--accent {
  border-color: #3d5280;
  background: linear-gradient(180deg, #1a2230 0%, var(--tt-card) 100%);
}

.setup-page-card-head {
  margin-bottom: 14px;
}

.setup-page-card-title {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--tt-text);
}

.setup-page-card-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.setup-hint-list {
  margin: 0 0 14px 0;
  padding-left: 1.2rem;
}

.setup-hint-list li {
  margin-bottom: 4px;
}

.setup-add-inline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

@media (min-width: 520px) {
  .setup-add-inline {
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
  }

  .setup-add-inline .setup-add-label {
    flex: 1;
    margin-bottom: 0;
  }

  .setup-add-inline #indicators-add-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 100px;
  }
}

.setup-empty-hint {
  margin: 0;
}

.settings-view {
  position: fixed;
  inset: 0;
  z-index: 59;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 520px at 22% -10%, rgba(var(--tt-accent-rgb), 0.14), transparent 62%),
    radial-gradient(900px 420px at 88% 8%, rgba(var(--tt-accent-rgb), 0.09), transparent 64%),
    var(--tt-bg);
  overflow: hidden;
}

.settings-view.hidden {
  display: none;
}

.settings-topbar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--tt-border);
  background: linear-gradient(180deg, var(--tt-surface) 0%, var(--tt-bg) 100%);
}

.settings-title-inline {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
}

.settings-topbar-spacer {
  width: min(120px, 28vw);
  flex-shrink: 0;
}

.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--tt-border);
  background: var(--tt-card);
  color: var(--tt-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  width: auto;
}

.settings-back:hover {
  color: var(--tt-text);
  border-color: #4a5f8a;
  background: #1e2430;
}

.settings-back-icon {
  font-size: 18px;
  line-height: 1;
}

.settings-scroll {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.settings-card h3 {
  margin: 0 0 8px;
}

.settings-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.strategy-setup-open .topbar,
body.strategy-setup-open .container,
body.strategy-setup-open .tabs,
body.strategy-setup-open #add-sticky-spacer {
  display: none !important;
}

.trade-detail-view {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: flex;
  flex-direction: column;
  background: var(--tt-bg);
  overflow: hidden;
}

.trade-detail-view.hidden {
  display: none;
}

.trade-detail-topbar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--tt-border);
  background: linear-gradient(180deg, var(--tt-surface) 0%, var(--tt-bg) 100%);
}

.trade-detail-title-inline {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}

.trade-detail-topbar-spacer {
  width: min(120px, 28vw);
}

.trade-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--tt-border);
  background: var(--tt-card);
  color: var(--tt-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  width: auto;
}

.trade-detail-back:hover {
  color: var(--tt-text);
  border-color: #4a5f8a;
  background: #1e2430;
}

.trade-detail-back-icon {
  font-size: 18px;
  line-height: 1;
}

.trade-detail-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.trade-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.trade-detail-stage {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #0b1322 0%, #090f1a 100%);
  display: flex;
  flex-direction: column;
}

.trade-detail-metrics {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin: 10px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 14, 25, 0.72);
  backdrop-filter: blur(4px);
}

.trade-detail-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.trade-detail-metric-label {
  font-size: 11px;
  color: var(--tt-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trade-detail-metric-value {
  font-size: 14px;
  font-weight: 700;
}

.trade-detail-metric-value.is-pos {
  color: #79e2a9;
}

.trade-detail-metric-value.is-neg {
  color: #f39aa3;
}

.trade-detail-metric-value.is-flat {
  color: #c7d2e4;
}

.trade-detail-context {
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding-left: 14px;
}

.trade-detail-section {
  margin-bottom: 18px;
}

.trade-detail-section-title {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tt-muted);
}

.trade-detail-strategy {
  font-size: 18px;
  font-weight: 700;
}

.trade-detail-ind-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trade-detail-ind-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.trade-detail-ind-chip.yes {
  border-color: rgba(47, 150, 94, 0.55);
  background: rgba(47, 150, 94, 0.22);
}

.trade-detail-ind-chip.no {
  border-color: rgba(176, 87, 87, 0.55);
  background: rgba(176, 87, 87, 0.22);
}

.trade-detail-ind-chip.na {
  border-color: rgba(165, 180, 204, 0.4);
  background: rgba(88, 105, 132, 0.22);
}

.trade-detail-times {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

.trade-detail-notes {
  margin-top: 14px;
  padding-top: 2px;
}

.trade-detail-times-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
}

.trade-detail-times-grid div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.trade-detail-times-grid strong {
  font-size: 14px;
}

/* Inner panel above R Result / metrics — matches .trade-detail-metrics frame */
.trade-detail-stage-shot {
  margin: 10px 10px 0 10px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(8, 14, 25, 0.72);
  backdrop-filter: blur(4px);
  overflow: hidden;
}

.trade-detail-stage-shot .trade-detail-screenshot-img {
  display: block;
  width: 100%;
  max-height: min(42vh, 380px);
  object-fit: contain;
  vertical-align: middle;
  border-radius: 8px;
}

.trade-detail-notes-box {
  white-space: pre-wrap;
  line-height: 1.55;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
}

.trade-detail-day-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trade-detail-day-item {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #111827 0%, #0c1422 100%);
  cursor: pointer;
}

.trade-detail-day-item:hover {
  border-color: rgba(var(--tt-accent-rgb), 0.26);
}

body.trade-detail-open .topbar,
body.trade-detail-open .container,
body.trade-detail-open .tabs,
body.trade-detail-open #add-sticky-spacer {
  display: none !important;
}

body.settings-open .topbar,
body.settings-open .container,
body.settings-open .tabs,
body.settings-open #add-sticky-spacer {
  display: none !important;
}

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

  .trade-detail-context {
    border-left: 0;
    padding-left: 0;
  }

  .trade-detail-stage {
    min-height: 320px;
  }

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

  .trade-detail-times-grid {
    grid-template-columns: 1fr;
  }
}

.calendar-list .cal-row[data-trade-detail-id] {
  width: 100%;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.calendar-list .cal-row[data-trade-detail-id]:hover {
  border-color: rgba(var(--tt-accent-rgb), 0.22);
}

.pl-cal-cell[data-cal-date] {
  cursor: pointer;
}

.strategy-setup-view .indicators-editor-list {
  max-height: min(52vh, 440px);
}

.modal-title {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-lead {
  margin: 0 0 12px 0;
  font-size: 13px;
  line-height: 1.5;
}

.modal-bullet-list {
  margin: 0 0 14px 0;
  padding-left: 1.15rem;
  list-style: disc;
}

.modal-bullet-list li {
  margin-bottom: 4px;
}

.kbd-hint {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  font-size: 11px;
  font-weight: 600;
}

.modal-section {
  margin-bottom: 18px;
}

.modal-section:last-of-type {
  margin-bottom: 12px;
}

.modal-section-title {
  margin: 0 0 10px 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tt-muted);
}

.field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tt-text);
  margin-bottom: 10px;
}

.field-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--tt-border);
  background: var(--tt-bg);
  color: var(--tt-text);
  font-size: 15px;
}

.field-input:focus {
  outline: none;
  border-color: #5b7cc9;
  box-shadow: 0 0 0 2px rgba(91, 124, 201, 0.25);
}

.field-hint {
  margin: 4px 0 10px;
  font-size: 12px;
}

.modal-actions button {
  min-height: 44px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid #3d6ab8;
  background: linear-gradient(180deg, #2d5aa8 0%, var(--tt-accent) 100%);
  color: #f5f8ff;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-primary:active {
  filter: brightness(0.96);
}

.btn-text {
  display: inline-block;
  margin: 0 0 14px 0;
  padding: 0;
  border: none;
  background: none;
  color: #8aa8e8;
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.btn-text:hover {
  color: #b8cfff;
}

.btn-compact {
  min-height: 36px !important;
  padding: 4px 12px !important;
  font-size: 12px !important;
}

.small-print {
  font-size: 12px;
  line-height: 1.45;
  margin: 0 0 8px 0;
}

.indicators-editor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  /* Room so dashed drop lines at first/last position aren’t clipped */
  padding: 8px 2px;
  margin: 0;
}

.ind-editor-row {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 12px 12px;
  background: var(--tt-surface);
  border-radius: 10px;
  border: 1px solid var(--tt-border);
  box-shadow: var(--glow-shadow-low);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.ind-editor-row:hover {
  transform: translateY(-1px);
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

/* Dashed insertion line (between rows), not a full-card outline */
.ind-editor-row.ind-drop-before::before,
.ind-editor-row.ind-drop-after::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  height: 0;
  border-top: 2px dashed #4a6fa8;
  pointer-events: none;
  z-index: 1;
}

.ind-editor-row.ind-drop-before::before {
  top: -5px;
}

.ind-editor-row.ind-drop-after::after {
  bottom: -5px;
}

.ind-editor-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ind-editor-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ind-editor-drag {
  flex-shrink: 0;
  width: 40px;
  align-self: center;
  min-height: 44px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 8px;
  background: #252b38;
  color: #9db0cc;
  font-size: 14px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}

.ind-editor-drag:hover {
  background: #2e3545;
  color: #e8edf5;
}

.ind-editor-drag:active {
  cursor: grabbing;
}

.ind-dragging {
  opacity: 0.55;
}

.ind-editor-label {
  font-weight: 600;
  font-size: 15px;
  word-break: break-word;
  line-height: 1.3;
}

.ind-editor-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #2a3342;
  white-space: nowrap;
  font-weight: 600;
}

.ind-editor-badge.is-active {
  background: #1e4d2a;
  color: #b8e8c4;
}

.ind-editor-badge.is-hidden {
  background: #3a2a2a;
  color: #e8b8b8;
}

.ind-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.indicators-rename-panel {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #3d5280;
  background: rgba(45, 90, 168, 0.12);
}

.indicators-rename-panel.hidden {
  display: none;
}

.indicators-rename-heading {
  margin: 0 0 8px 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tt-muted);
}

.indicators-rename-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.indicators-rename-row .field-input {
  flex: 1 1 160px;
  margin: 0;
}

.catalog-add-section .indicators-editor-add {
  margin-bottom: 0;
}

.indicators-editor-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.indicators-add-label {
  flex: 1;
  min-width: 160px;
}

.indicators-add-label input {
  width: 100%;
}

.btn-secondary {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #3a4558;
  background: #1e2430;
  color: #e8edf5;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #252b38;
}

.toast {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 12px 20px;
  background: #224f95;
  border-radius: 10px;
  border: 1px solid #3760a3;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

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

.analytics-table th,
.analytics-table td {
  border-bottom: 1px solid #2a3342;
  padding: 8px 6px;
  text-align: left;
}

.calendar-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cal-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  padding: 8px;
  background: #0f131a;
  border-radius: 8px;
  font-size: 13px;
}

.cal-row.win {
  border-left: 3px solid #2a8f55;
}

.cal-row.loss {
  border-left: 3px solid #b04545;
}

.cal-row.be {
  border-left: 3px solid #8a8f9a;
}

.cal-asset {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-date,
.cal-pnl {
  white-space: nowrap;
}

/* Analytics tab */
.analytics-page {
  max-width: 1080px;
  margin: 0 auto;
  padding-bottom: 12px;
}

/* Sticky shell only — transform for hide lives on inner .analytics-toolbar (not on sticky node). */
.analytics-toolbar-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-bottom: 18px;
}

.analytics-toolbar {
  margin-bottom: 0;
  backdrop-filter: blur(10px);
  background: rgba(11, 18, 32, 0.78);
  border-color: var(--glow-border-low);
  box-shadow: var(--glow-shadow-low);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.analytics-toolbar.card:hover {
  transform: none;
  border-color: var(--glow-border-low);
  box-shadow: var(--glow-shadow-low);
}

.analytics-toolbar-sticky.analytics-toolbar-sticky--hidden .analytics-toolbar {
  transform: translateY(-110%);
  opacity: 0;
  pointer-events: none;
}

.analytics-toolbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.analytics-page-title {
  margin: 0 0 4px 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.analytics-toolbar-copy {
  flex: 1 1 200px;
  min-width: 0;
}

.analytics-period-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--tt-muted);
  font-weight: 600;
}

.analytics-toolbar-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 12px;
  align-items: flex-end;
}

.analytics-strategy-compare {
  margin-bottom: 18px;
  padding: 12px 16px;
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border: 1px solid var(--glow-border-low);
  border-radius: var(--tt-radius);
  box-shadow: var(--glow-shadow-low);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.analytics-strategy-compare:hover {
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

.strategy-field select {
  width: 100%;
}

.strategies-editor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.strategies-editor-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius);
  background: var(--tt-surface);
}

.strategies-row-main {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.strategies-star {
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 2px 4px;
  color: var(--tt-muted);
}

.strategies-star.is-default {
  color: #d4a84b;
  text-shadow: 0 0 12px rgba(212, 168, 75, 0.35);
}

.strategies-row-name {
  font-weight: 600;
  font-size: 15px;
}

.strategies-create-section {
  padding: 14px;
  border-radius: var(--tt-radius);
  border: 1px solid var(--tt-border);
  background: var(--tt-bg);
}

.strategies-pick-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(38vh, 260px);
  overflow-y: auto;
  padding: 2px;
  margin: 0 0 12px 0;
}

.strategies-pick-empty {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px dashed var(--tt-border);
  font-size: 13px;
  line-height: 1.45;
}

.strategies-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--tt-border);
  background: var(--tt-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.strategies-pick-item:hover {
  border-color: #4a5f8a;
}

.strategies-pick-item:has(.strategies-pick-cb:checked) {
  border-color: #6b7cff;
  background: rgba(107, 124, 255, 0.09);
}

.strategies-pick-cb {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #7b6cff;
  cursor: pointer;
}

.strategies-pick-label {
  flex: 1;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 500;
  text-align: left;
}

.catalog-hint {
  margin: 0 0 8px 0;
  font-size: 12px;
  line-height: 1.45;
}

.strategy-line {
  font-size: 13px;
  margin-bottom: 6px;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

@media (min-width: 640px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.metric-tile {
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--tt-radius);
  padding: 16px 16px;
  min-height: 88px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--glow-shadow-medium);
}

.metric-tile:hover {
  transform: translateY(-2px);
  border-color: var(--glow-border-high);
  box-shadow: var(--glow-shadow-high);
}

.metric-tile-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 6px;
}

.metric-tile-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.metric-tile-hint {
  font-size: 12px;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.58);
}

.analytics-section {
  margin-bottom: 22px;
  padding: 20px;
  background: linear-gradient(180deg, #111827 0%, #0b1220 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--glow-shadow-medium);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.analytics-section:hover {
  transform: translateY(-2px);
  border-color: var(--glow-border-high);
  box-shadow: var(--glow-shadow-high);
}

.analytics-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.analytics-section-header .analytics-section-title {
  margin-bottom: 0;
}

.analytics-section-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.analytics-section-title {
  margin: 0 0 10px 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.analytics-hero-card {
  border-color: var(--glow-border-medium);
  box-shadow: var(--glow-shadow-medium);
}

.analytics-hero-card:hover {
  border-color: var(--glow-border-high);
  box-shadow: var(--glow-shadow-high);
}

.analytics-insight-line {
  margin: 2px 2px 16px;
  font-size: 13px;
  line-height: 1.45;
}

.analytics-section-sep {
  height: 1px;
  margin: 4px 2px 18px;
  background: linear-gradient(90deg, rgba(157, 176, 204, 0), rgba(157, 176, 204, 0.25), rgba(157, 176, 204, 0));
}

.analytics-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.analytics-diag-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--tt-border);
  font-size: 14px;
}

.analytics-diag-row:last-child {
  border-bottom: none;
}

.analytics-loading-card {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.analytics-loading-text {
  margin: 0;
}

.analytics-error-card {
  border-color: #5a3038;
}

.analytics-empty {
  margin: 8px 0 0 0;
  color: rgba(255, 255, 255, 0.64);
}

.analytics-ind-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 560px) {
  .analytics-ind-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.analytics-ind-card {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: 10px;
  padding: 12px;
}

.analytics-ind-card-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
}

.analytics-ind-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  font-size: 13px;
}

.analytics-ind-card-grid .muted {
  display: block;
  font-size: 11px;
  margin-bottom: 2px;
}

.setup-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-card {
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: 10px;
  padding: 12px;
}

.setup-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.setup-chip {
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #182436 0%, #121d2f 100%);
  border: 1px solid #324564;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.setup-chip:hover {
  background: linear-gradient(180deg, #1d2e47 0%, #17273f 100%);
  border-color: #406193;
}

.setup-card-stats {
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 6px;
}

.pl-cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pl-cal-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pl-cal-nav {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--tt-border);
  background: #1e2430;
  color: var(--tt-text);
  font-size: 16px;
  cursor: pointer;
}

.pl-cal-nav:hover {
  background: #252b38;
}

.analytics-table tbody tr td:nth-child(6) {
  font-weight: 600;
}

.analytics-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 900px) {
  .analytics-toolbar-filters {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .analytics-two-col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .analytics-toolbar-filters {
    grid-template-columns: 1fr;
  }
}

.pl-cal-title {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.35;
  min-width: 0;
  text-align: left;
  flex: 1 1 auto;
}

.pl-cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--tt-muted);
  text-align: center;
}

.pl-cal-wd {
  padding: 4px 2px;
}

.pl-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.pl-cal-cell {
  appearance: none;
  margin: 0;
  width: 100%;
  min-height: 72px;
  padding: 6px 4px;
  background: var(--tt-surface);
  border: 1px solid var(--tt-border);
  border-radius: 8px;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  color: var(--tt-text);
}

.pl-cal-cell-win {
  background: linear-gradient(165deg, #1f4d32 0%, #153d28 55%, #122a1d 100%);
  border-color: #2d9f5c;
  box-shadow: inset 0 0 0 1px rgba(80, 200, 130, 0.12);
}

.pl-cal-cell-loss {
  background: linear-gradient(165deg, #5c2528 0%, #452020 55%, #2c1518 100%);
  border-color: #c44a52;
  box-shadow: inset 0 0 0 1px rgba(220, 100, 100, 0.12);
}

.pl-cal-cell-flat {
  background: linear-gradient(165deg, #353a45 0%, #2a2f38 100%);
  border-color: #5a6578;
}

.pl-cal-cell-win .pl-cal-n,
.pl-cal-cell-loss .pl-cal-n,
.pl-cal-cell-flat .pl-cal-n {
  color: rgba(240, 242, 248, 0.82);
}

.pl-cal-cell-empty {
  min-height: 0;
  background: transparent;
  border: none;
}

.pl-cal-day {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}

.pl-cal-pl {
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-cal-n {
  font-size: 10px;
  margin-top: auto;
  padding-top: 4px;
  color: var(--tt-muted);
}

.pl-cal-cell:not(.pl-cal-cell-empty):not(.pl-cal-cell-win):not(.pl-cal-cell-loss):not(.pl-cal-cell-flat) .pl-cal-n {
  color: var(--tt-muted);
}

/* Analytics dashboard MVP upgrades */
.analytics-page {
  max-width: 1080px;
}

.analytics-toolbar-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
  width: min(100%, 760px);
}

.analytics-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.analytics-table-wide th,
.analytics-table-wide td {
  white-space: nowrap;
}

.analytics-column-menu-sort,
.analytics-column-menu-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analytics-column-menu-filter {
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.analytics-sort-dir-row {
  display: flex;
  gap: 6px;
}

.analytics-filter-popover .analytics-sort-dir-btn {
  flex: 1;
  width: auto;
  min-height: 32px;
  margin: 0;
  margin-top: 0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8ecf4;
  box-shadow: none;
}

.analytics-filter-popover .analytics-sort-dir-btn:hover {
  background: rgba(var(--tt-accent-rgb), 0.2);
  border-color: rgba(var(--tt-accent-rgb), 0.45);
  box-shadow: none;
  transform: none;
}

.analytics-filter-popover .analytics-sort-dir-btn:active {
  transform: none;
}

.analytics-filter-popover {
  position: fixed;
  z-index: 9999;
  min-width: 200px;
  background: #151d2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.analytics-filter-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.analytics-filter-label select,
.analytics-filter-label input {
  background: #0e1525;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  color: #fff;
  padding: 5px 8px;
  font-size: 0.85rem;
}

.analytics-filter-actions {
  display: flex;
  gap: 6px;
}

.analytics-filter-actions button {
  flex: 1;
  padding: 5px 10px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.analytics-filter-apply {
  background: var(--tt-accent);
  color: #fff;
}

.analytics-filter-clear {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.analytics-filter-defaults {
  display: flex;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

.analytics-filter-defaults button {
  flex: 1;
  padding: 4px 8px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 500;
}

.analytics-filter-save-default {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
}

.analytics-filter-save-default:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.analytics-filter-reset-default {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.45);
}

.analytics-filter-reset-default:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

.analytics-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.analytics-chart-wrap {
  height: 220px;
  min-height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 10px 6px;
  background: linear-gradient(180deg, rgba(13, 20, 34, 0.9) 0%, rgba(9, 15, 26, 0.92) 100%);
  box-shadow: var(--glow-shadow-medium);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.analytics-chart-wrap:hover {
  border-color: rgba(var(--tt-accent-rgb), 0.28);
  box-shadow: var(--glow-shadow-high);
}

.analytics-hero-card .analytics-chart-wrap {
  height: 250px;
  min-height: 250px;
}

.analytics-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.analytics-seg {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(8, 14, 26, 0.85);
}

.analytics-seg-btn {
  width: auto;
  min-height: 30px;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 6px 10px;
  background: transparent;
  color: #c8d4e8;
  font-size: 12px;
  line-height: 1;
  box-shadow: none;
}

.analytics-seg-btn:hover {
  border: 0;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.06);
}

.analytics-seg-btn.active {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.3), rgba(34, 79, 149, 0.45));
  color: #f5f9ff;
}

.mini-bar-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 126px;
  border: 1px solid var(--tt-border);
  border-radius: 10px;
  padding: 8px;
  overflow-x: auto;
}

.mini-bar-cell {
  min-width: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--tt-muted);
}

.mini-bar {
  width: 12px;
  border-radius: 999px;
  background: #4b6799;
}

.mini-bar.pos {
  background: #2f965e;
}

.mini-bar.neg {
  background: #b05757;
}

@media (max-width: 700px) {
  .container {
    padding: 12px;
    padding-bottom: 80px;
  }
  .row {
    flex-direction: column;
  }
  .summary-metrics {
    grid-template-columns: 1fr;
  }
}

.legal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 10px 0 calc(16px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 12px;
}

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

.legal-footer a:hover {
  color: #b7cfff;
  text-decoration: underline;
}

