:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --blue: #3b82f6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0.65rem 0.85rem 1.25rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
}

.tz-label {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85em;
}

.header-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav,
.user-switcher {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.site-nav-sep {
  width: 1px;
  height: 1.15rem;
  background: var(--border);
  margin: 0 0.15rem;
}

a.user-btn {
  text-decoration: none;
  display: inline-block;
  white-space: nowrap;
}

.user-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 0.3rem 0.65rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

span.user-btn {
  cursor: default;
}

.user-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

.user-btn.active {
  color: var(--text);
  border-color: var(--user-color, var(--blue));
  background: color-mix(in srgb, var(--user-color, var(--blue)) 18%, var(--panel));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--user-color, var(--blue)) 35%, transparent);
}

.status {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: right;
}

.status.live { color: var(--green); }
.status.stale { color: #fbbf24; }

/* Asset switcher (mobile tabs) */
.asset-switcher {
  display: none;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: stretch;
  margin: 0 0 0.55rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 70%, var(--bg));
}

.asset-btn {
  flex: 1 1 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.asset-btn-ticker {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

.asset-btn:hover {
  color: var(--text);
  border-color: var(--border);
}

.asset-btn.active {
  color: var(--text);
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 16%, var(--panel));
}

/* Strategy cubes */
.strategy-cubes-section {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 88%, #0a0e14);
}

.strategy-cubes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  margin-bottom: 0.45rem;
}

.strategy-cubes-head-left {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
}

.strategy-cubes-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.strategy-cubes-hint {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.85;
}

.strategy-cubes-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--muted);
}

.strategy-cubes-refresh[hidden] {
  display: none !important;
}

.strategy-cubes-spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-top-color: color-mix(in srgb, var(--text) 75%, var(--accent, #3b82f6));
  border-radius: 50%;
  animation: strategy-cubes-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes strategy-cubes-spin {
  to { transform: rotate(360deg); }
}

.strategy-cubes-section.is-refreshing .strategy-cubes-hero-value {
  opacity: 0.88;
}

.strategy-cube-stat-prefix {
  font-weight: 700;
  color: var(--muted);
  margin-right: 0.15rem;
}

.strategy-cubes-hero {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem 0.75rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  border-radius: 10px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 70%, #0a0e14), color-mix(in srgb, var(--panel) 40%, var(--bg)));
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

@media (max-width: 1100px) {
  .strategy-cubes-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.strategy-cubes-hero-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.strategy-cubes-hero-label {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.strategy-cubes-hero-value {
  font-size: clamp(1.15rem, 2.4vw, 1.65rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.02em;
}

.strategy-cubes-hero-sub {
  font-size: 0.78rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--muted) 80%, var(--text));
}

.strategy-cubes-hero-compose {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.005em;
  color: color-mix(in srgb, var(--muted) 55%, var(--text));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-cubes-hero-minmax {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--muted) 70%, var(--text));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.strategy-cubes-hero-wallets {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.9;
}

.strategy-cubes-totals {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  padding: 0.3rem 0.4rem;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 55%, var(--bg));
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.strategy-cubes-totals-meta {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.01em;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
}

.strategy-cubes-totals-balance {
  font-weight: 750;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.strategy-cubes-totals-period {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.strategy-cubes-totals-label {
  font-size: 0.62rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--muted) 85%, var(--text));
  text-transform: lowercase;
  flex-shrink: 0;
}

.strategy-cubes-totals-vals {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.28rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
}

.strategy-cubes-totals-vals > span {
  white-space: nowrap;
}

.bet-range {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 70%, var(--bg));
}

.strategy-cubes-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
}

.strategy-mode-filter,
.strategy-asset-filter,
.strategy-extra-filters {
  justify-content: flex-start;
  flex: 0 1 auto;
}

.strategy-extra-filters .bet-range-btn {
  padding: 0.28rem 0.42rem;
}

.strategy-cubes-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.strategy-day-filter {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.strategy-day-filter select {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel) 70%, var(--bg));
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 650;
  padding: 0.3rem 0.5rem;
  color-scheme: dark;
  min-height: 1.85rem;
  cursor: pointer;
  max-width: 10.5rem;
}

.strategy-day-filter select:focus {
  outline: none;
  border-color: var(--blue);
}

.bet-range-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
}

.bet-range-btn:hover {
  color: var(--text);
}

.bet-range-btn.active {
  color: var(--text);
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 16%, var(--panel));
}

.strategy-cubes-empty {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.strategy-cubes-filter-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--amber, #eab308);
}

.strategy-filter-reset-inline {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.bet-range-btn.strategy-filter-reset {
  opacity: 0.85;
}

.strategy-cubes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.45rem;
}

.strategy-cubes.is-compact {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.32rem;
}

.strategy-compact-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.strategy-compact-toggle input {
  margin: 0;
  accent-color: var(--blue);
}

.strategy-cube.is-short {
  min-height: 0;
  padding: 0.38rem 0.42rem 0.32rem;
  gap: 0.12rem;
}

.strategy-cube.is-short .strategy-cube-c1,
.strategy-cube.is-short .strategy-cube-c2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.3rem;
  min-width: 0;
}

.strategy-cube.is-short .strategy-cube-c1-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

.strategy-cube.is-short .strategy-cube-name {
  -webkit-line-clamp: 1;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.82rem; /* как обычный name */
}

.strategy-cube.is-short .strategy-cube-wr {
  margin: 0;
  flex: 1 1 auto;
}

.strategy-cube.is-short .strategy-cube-bal {
  font-size: 0.72rem; /* как обычный баланс */
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  flex-shrink: 0;
}

.strategy-cube.is-short .strategy-cube-c3,
.strategy-cube.is-short .strategy-cube-c4,
.strategy-cube.is-short .strategy-cube-c5 {
  font-size: 0.58rem;
  line-height: 1.2;
  color: var(--muted);
  min-width: 0;
}

.strategy-cube.is-short .strategy-cube-c3 .strategy-cube-stat-vals,
.strategy-cube.is-short .strategy-cube-c4 .strategy-cube-stat-vals,
.strategy-cube.is-short .strategy-cube-c5 .strategy-cube-stat-vals {
  font-size: inherit;
}

.strategy-cube.is-short .strategy-pill {
  font-size: 0.58rem;
  padding: 0.05rem 0.28rem;
}

.strategy-cube {
  appearance: none;
  position: relative;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  padding: 0.5rem 0.55rem 0.45rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  min-height: 138px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  --cube-accent: var(--blue);
}

.strategy-cube-spin {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid color-mix(in srgb, var(--border) 65%, transparent);
  border-top-color: color-mix(in srgb, var(--cube-accent) 80%, var(--text));
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.strategy-cube.is-updating .strategy-cube-spin,
.strategy-cubes-section.is-refreshing .strategy-cube-spin {
  opacity: 1;
  animation: strategy-cubes-spin 0.7s linear infinite;
}

.strategy-cube:hover {
  border-color: color-mix(in srgb, var(--cube-accent) 55%, var(--border));
  transform: translateY(-1px);
}

.strategy-cube.active {
  border-color: var(--cube-accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cube-accent) 40%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--cube-accent) 12%, transparent);
  background: color-mix(in srgb, var(--cube-accent) 10%, var(--panel));
}

.strategy-cube-deck {
  position: absolute;
  top: 0.35rem;
  left: 0.4rem;
  right: auto;
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.85;
  pointer-events: none;
  z-index: 1;
}

.strategy-cube.is-hold {
  border-width: 2px;
  border-color: #ffffff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.strategy-cube.is-hold.active {
  border-color: #ffffff;
}

.strategy-cube.is-paused {
  opacity: 0.62;
}

.strategy-cube.is-stopped {
  opacity: 0.42;
  filter: grayscale(0.55);
  border-color: color-mix(in srgb, var(--border) 80%, #6b7280);
  background: color-mix(in srgb, #6b7280 12%, var(--panel));
}

.strategy-cube.is-stopped:hover {
  transform: none;
}

/* Куб «Все ставки» — тот же каркас, чуть иной акцент */
.strategy-cube.is-all-bets {
  --cube-accent: #14b8a6;
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--cube-accent) 14%, var(--panel)) 0%,
      var(--panel) 55%
    );
  border-color: color-mix(in srgb, var(--cube-accent) 40%, var(--border));
}
.strategy-cube.is-all-bets .strategy-cube-wr {
  color: color-mix(in srgb, var(--cube-accent) 55%, var(--muted));
  font-weight: 600;
}
.strategy-cube.is-all-bets.active {
  background:
    linear-gradient(
      145deg,
      color-mix(in srgb, var(--cube-accent) 22%, var(--panel)) 0%,
      color-mix(in srgb, var(--cube-accent) 8%, var(--panel)) 60%
    );
}

.strategy-cube-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
  padding-left: 1.05rem; /* место под ▶/⏸/⏹ слева */
  padding-right: 0.85rem; /* место под спиннер справа при обновлении */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.strategy-cube-new-mark {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.32rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  vertical-align: 0.1em;
  color: #fef3c7;
  border: 1px solid color-mix(in srgb, #f59e0b 55%, var(--border));
  background: color-mix(in srgb, #f59e0b 22%, transparent);
}

.strategy-cube.is-all-bets .strategy-cube-name {
  padding-left: 0; /* у «Все ставки» нет deck-иконки */
}

.strategy-cube-wr {
  font-size: 0.68rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--muted) 70%, var(--text));
  letter-spacing: 0.01em;
  line-height: 1.2;
  margin-top: -0.05rem;
}

/* WR thresholds: ≥90 green, 80–89 yellow, <80 red */
.wr-hi { color: var(--green); }
.wr-mid { color: var(--yellow); }
.wr-lo { color: var(--red); }

.strategy-cube-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.strategy-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.strategy-pill.live {
  color: #bbf7d0;
  border-color: color-mix(in srgb, var(--green) 50%, var(--border));
  background: color-mix(in srgb, var(--green) 18%, transparent);
}

.strategy-pill.dry,
.strategy-pill.sim {
  color: #fde68a;
  border-color: color-mix(in srgb, var(--yellow) 45%, var(--border));
  background: color-mix(in srgb, var(--yellow) 12%, transparent);
}


.strategy-pill.skip,
.strategy-pill.wait {
  color: #bfdbfe;
  border-color: color-mix(in srgb, var(--blue) 45%, var(--border));
  background: color-mix(in srgb, var(--blue) 14%, transparent);
}

.strategy-pill.hold {
  color: #bfdbfe;
  border-color: color-mix(in srgb, var(--blue) 50%, var(--border));
  background: color-mix(in srgb, var(--blue) 16%, transparent);
}

.strategy-pill.dir-up {
  color: #86efac;
  border-color: color-mix(in srgb, #22c55e 45%, var(--border));
  background: color-mix(in srgb, #22c55e 14%, transparent);
}

.strategy-pill.dir-down {
  color: #fca5a5;
  border-color: color-mix(in srgb, #ef4444 45%, var(--border));
  background: color-mix(in srgb, #ef4444 14%, transparent);
}

.strategy-pill.gtc {
  color: #fde68a;
  border-color: color-mix(in srgb, #f59e0b 50%, var(--border));
  background: color-mix(in srgb, #f59e0b 16%, transparent);
  font-weight: 600;
}

.strategy-pill.syn-tight {
  color: #a5f3fc;
  border-color: color-mix(in srgb, #06b6d4 50%, var(--border));
  background: color-mix(in srgb, #06b6d4 14%, transparent);
  font-weight: 600;
}

.strategy-cube-rule {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.25;
}

.strategy-cube-filters {
  margin-top: 0.25rem;
  font-size: 0.62rem;
  line-height: 1.35;
  color: var(--muted);
  /* все фильтры видны — без обрезки */
  max-height: none;
  overflow: visible;
}

.strategy-cube-filter-line {
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

.strategy-cube.is-short .strategy-cube-filters {
  display: none; /* короткий режим — без фильтров */
}

.strategy-cube-stats {
  margin-top: auto;
  font-size: 0.64rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  line-height: 1.25;
  min-width: 0;
}

.strategy-cube-bal-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.strategy-cube-bal {
  font-size: 0.72rem;
  color: var(--text);
  font-weight: 600;
}

.strategy-cube-bal-mm {
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: color-mix(in srgb, var(--muted) 70%, var(--text));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.strategy-cube-stat-block {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.strategy-cube-stat-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  color: color-mix(in srgb, var(--muted) 85%, var(--text));
  opacity: 0.9;
}

.strategy-cube-stat-vals {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
  font-size: clamp(0.52rem, 2.55vw, 0.66rem);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
  word-break: normal;
}

.strategy-cube-stats .pnl-pos,
.pnl-pos { color: var(--green); }
.strategy-cube-stats .pnl-neg,
.pnl-neg { color: var(--red); }

.strategy-detail {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}

.strategy-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.strategy-detail-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.strategy-detail-close {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.strategy-detail-close:hover {
  color: var(--text);
  border-color: var(--muted);
}

.strategy-detail-meta {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
}

.strategy-detail-filters {
  margin-top: 0.45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.strategy-detail-range {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
}

.strategy-detail-range[hidden] {
  display: none !important;
}

.strategy-detail-range-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.strategy-detail-range-label input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.72rem;
  padding: 0.22rem 0.35rem;
  color-scheme: dark;
}

.strategy-detail-stats {
  margin: 0.4rem 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  font-size: 0.8rem;
}

.strategy-detail-table-wrap {
  overflow: auto;
  max-height: 280px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.strategy-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.strategy-detail-table th,
.strategy-detail-table td {
  padding: 0.28rem 0.45rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.strategy-detail-table th {
  position: sticky;
  top: 0;
  background: #152032;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  z-index: 1;
}

.strategy-detail-table tr.row-bet-win {
  background: rgba(34, 197, 94, 0.10);
}
.strategy-detail-table tr.row-bet-loss {
  background: rgba(239, 68, 68, 0.10);
}
.strategy-detail-table tr.row-bet-open {
  background: rgba(234, 179, 8, 0.06);
}
.strategy-detail-table tr.row-bet-win:hover {
  background: rgba(34, 197, 94, 0.16);
}
.strategy-detail-table tr.row-bet-loss:hover {
  background: rgba(239, 68, 68, 0.16);
}
.strategy-detail-table tr.row-bet-win .col-profit,
.strategy-detail-table tr.row-bet-win .col-roi { color: var(--green); }
.strategy-detail-table tr.row-bet-loss .col-profit,
.strategy-detail-table tr.row-bet-loss .col-roi { color: var(--red); }
.strategy-detail-table tr.row-bet-open .col-status { color: var(--yellow); }

.strategy-detail-table.is-all-bets .col-market {
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  color: color-mix(in srgb, var(--muted) 35%, var(--text));
}

.strategy-detail-table .poly-chart-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0.05rem 0.2rem;
  margin: -0.05rem -0.2rem;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--blue) 45%, transparent);
  text-underline-offset: 2px;
  transition: color 0.12s, background 0.12s, text-decoration-color 0.12s;
}

.strategy-detail-table .poly-chart-btn:hover,
.strategy-detail-table .poly-chart-btn:focus-visible {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  text-decoration-color: var(--blue);
  outline: none;
}

.strategy-detail-table .poly-chart-btn.is-disabled {
  cursor: default;
  text-decoration: none;
  color: inherit;
}

.strategy-detail-table .poly-chart-btn.is-disabled:hover,
.strategy-detail-table .poly-chart-btn.is-disabled:focus-visible {
  color: inherit;
  background: transparent;
}

.strategy-detail-table th.col-poly-hint::after {
  content: ' ↗';
  font-size: 0.65em;
  opacity: 0.45;
}

/* Polymarket chart modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 12, 18, 0.72);
  backdrop-filter: blur(2px);
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-panel {
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.modal-panel-poly {
  width: min(980px, 100%);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
}

.modal-body-poly {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem 0.9rem;
  min-height: 0;
}

.poly-modal-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.poly-modal-frame-wrap {
  position: relative;
  width: 100%;
  height: min(62vh, 520px);
  min-height: 280px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0b1220;
}

.poly-modal-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0b1220;
}

.poly-modal-ext {
  align-self: flex-start;
  font-size: 0.82rem;
  color: #93c5fd;
  text-decoration: none;
}

.poly-modal-ext:hover {
  text-decoration: underline;
}

body.modal-open {
  overflow: hidden;
}

/* Asset panels */
.asset-panels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  width: 100%;
}

.asset-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  padding: 0.65rem 0.75rem 0.75rem;
  min-width: 0;
}

.asset-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.asset-panel-head h2 {
  font-size: 0.95rem;
  font-weight: 700;
}

.asset-ticker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.asset-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.55rem;
}

.metric {
  padding: 0.4rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: color-mix(in srgb, var(--bg) 55%, var(--panel));
  min-width: 0;
}

.metric.metric-wide,
.metric.metric-pct {
  grid-column: 1 / -1;
}

.metric.metric-fail {
  border-color: color-mix(in srgb, var(--red) 45%, var(--border));
  background: color-mix(in srgb, var(--red) 8%, var(--panel));
}

.metric.metric-fail .m-label {
  color: #fca5a5;
}

.m-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.18rem;
}

.m-val {
  display: block;
  font-size: 0.95rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.m-val-small {
  font-size: 0.88rem;
}

.m-val.metric-ok { color: var(--green); }
.m-val.metric-low { color: var(--red); }

.metric-part-fail {
  color: var(--red);
  font-weight: 700;
}

/* p20/p50/p80 vs Open scale */
.pct-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pct-values {
  font-size: 0.82rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  word-break: break-all;
}

.pct-sep {
  color: var(--muted);
  font-weight: 500;
}

.pct-scale {
  position: relative;
  padding: 0.15rem 0 1.55rem;
}

.pct-track {
  position: relative;
  height: 2.85rem;
  margin: 0.15rem 0.35rem 0;
  border-radius: 4px;
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--blue) 22%, transparent) 0%,
      color-mix(in srgb, var(--border) 70%, transparent) 50%,
      color-mix(in srgb, var(--yellow) 18%, transparent) 100%
    );
  border: 1px solid var(--border);
}

.pct-hover-tip {
  display: none;
  position: absolute;
  left: 50%;
  bottom: calc(100% - 0.2rem);
  transform: translateX(-50%);
  z-index: 5;
  min-width: 10.5rem;
  max-width: 16rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 96%, #000);
  box-shadow: 0 6px 18px color-mix(in srgb, #000 35%, transparent);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

.pct-hover-tip-sub {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 500;
}

.pct-scale:hover .pct-hover-tip {
  display: block;
}

.pct-bet-status {
  margin: -0.35rem 0.1rem 0.1rem;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--muted);
}

.pct-bet-status.is-up {
  color: var(--green);
}

.pct-bet-status.is-down {
  color: #fbbf24;
}

.pct-bet-status.is-block {
  color: #fca5a5;
}

.pct-track::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: color-mix(in srgb, var(--muted) 55%, transparent);
  border-radius: 1px;
}

.pct-mark {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 12px;
  margin-top: -6px;
  margin-left: -1px;
  background: var(--muted);
  z-index: 1;
}

.pct-mark i {
  position: absolute;
  top: -1.05rem;
  left: 50%;
  transform: translateX(-50%);
  font-style: normal;
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.pct-mark-p50 {
  background: var(--blue);
  height: 14px;
  margin-top: -7px;
}

.pct-mark-p50 i { color: #93c5fd; }

.pct-open {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.pct-open-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--yellow) 70%, var(--text));
}

.pct-open-label {
  position: absolute;
  top: 0.7rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.pct-open.is-low .pct-open-dot,
.pct-open.is-high .pct-open-dot {
  background: var(--red);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--red) 60%, transparent);
}

.pct-open.is-low .pct-open-label,
.pct-open.is-high .pct-open-label {
  color: #fecaca;
}

footer {
  margin-top: 0.75rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.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;
}

/* Login */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 1.75rem;
  text-align: center;
}

.login-card h1 {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.login-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.login-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.login-form input:focus {
  outline: none;
  border-color: var(--blue);
}

.login-form button {
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.login-form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-error {
  margin-top: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
  font-size: 0.85rem;
}

.login-alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.login-alert-block {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

@media (max-width: 959px) {
  .asset-switcher {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 5;
  }

  .asset-panels[data-mobile-tabs="1"] .asset-panel:not(.is-active) {
    display: none;
  }

  .asset-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .strategy-cubes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .strategy-cube-name {
    font-size: 0.72rem;
    padding-left: 0.95rem;
    padding-right: 0.7rem;
  }

  .strategy-cubes-head {
    align-items: stretch;
  }

  .strategy-cubes-head-left {
    flex-wrap: wrap;
    width: 100%;
  }

  .strategy-cubes-hero {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .strategy-cubes-hero-value {
    font-size: 1.35rem;
  }

  .strategy-cubes-totals {
    width: 100%;
  }

  .strategy-cubes-totals-vals {
    font-size: 0.64rem;
    gap: 0.22rem 0.32rem;
  }

  .strategy-cube-stat-vals {
    font-size: clamp(0.48rem, 3.1vw, 0.6rem);
  }

  .strategy-cubes-filters {
    width: 100%;
    justify-content: stretch;
  }

  .strategy-mode-filter,
  .strategy-asset-filter,
  .strategy-extra-filters {
    width: 100%;
  }

  .strategy-cubes-tools {
    width: 100%;
  }

  .strategy-day-filter {
    flex: 1 1 auto;
  }

  .strategy-day-filter select {
    width: 100%;
    max-width: none;
  }

  .strategy-mode-filter .bet-range-btn,
  .strategy-asset-filter .bet-range-btn {
    flex: 1 1 0;
    text-align: center;
    padding: 0.35rem 0.4rem;
  }

  .strategy-extra-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .strategy-extra-filters .bet-range-btn {
    flex: 0 0 auto;
  }

  .asset-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .pct-values {
    font-size: 0.8rem;
  }

  .pct-track {
    height: 3.1rem;
  }

  .pct-open-label {
    font-size: 0.58rem;
  }

  header {
    flex-direction: column;
    align-items: stretch;
  }

  .header-right {
    align-items: flex-start;
  }

  .status {
    text-align: left;
  }
}
