:root {
  --bg-0: #060a12;
  --bg-1: #0f1d32;
  --card: rgba(12, 20, 34, 0.84);
  --line: rgba(123, 170, 224, 0.22);
  --text: #eaf4ff;
  --muted: #9fb4cc;
  --cyan: #4fc9ff;
  --green: #1fd38b;
  --red: #ff6a7a;
  --amber: #ffcc66;
  --purple: #7b5cf5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: "Inter", "Manrope", sans-serif;
  background:
    radial-gradient(65rem 40rem at -10% -10%, #16365a 0%, transparent 60%),
    radial-gradient(50rem 30rem at 110% 0%, #1a2a45 0%, transparent 55%),
    linear-gradient(130deg, var(--bg-0), var(--bg-1));
}

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(to right, rgba(79, 201, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(79, 201, 255, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
}

.container {
  position: relative;
  z-index: 1;
  width: min(1380px, 96vw);
  margin: 0 auto;
  padding: 18px 0 26px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: #87d4ff;
  text-transform: uppercase;
}

.hero h1 {
  margin: 6px 0 0;
  font-family: "Inter", sans-serif;
  font-weight: 800;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
}

.sub {
  margin: 8px 0 0;
  color: var(--muted);
}

.mode-pill {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 10px 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
  min-width: 92px;
  text-align: center;
}

.mode-pill.live {
  color: var(--green);
  border-color: rgba(31, 211, 139, 0.5);
  box-shadow: inset 0 0 24px rgba(31, 211, 139, 0.08);
}

.mode-pill.paper {
  color: var(--amber);
  border-color: rgba(255, 204, 102, 0.45);
  box-shadow: inset 0 0 24px rgba(255, 204, 102, 0.08);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  backdrop-filter: blur(7px);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.kpi strong {
  display: block;
  margin-top: 6px;
  font-size: 1.06rem;
  font-weight: 800;
}

.kpi.pos strong { color: var(--green); }
.kpi.neg strong { color: var(--red); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  backdrop-filter: blur(7px);
  margin-bottom: 14px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.panel h2 {
  margin: 0;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.02rem;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid-three {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(123, 170, 224, 0.16);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 8px 9px;
  border-bottom: 1px solid rgba(123, 170, 224, 0.16);
  white-space: nowrap;
}

th {
  text-align: left;
  color: #b8d7f5;
  background: rgba(7, 14, 26, 0.92);
  position: sticky;
  top: 0;
  z-index: 2;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: rgba(79, 201, 255, 0.08);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "JetBrains Mono", "Space Grotesk", monospace;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid;
  min-width: 62px;
  padding: 2px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.long {
  color: var(--green);
}

.short {
  color: var(--red);
}

.tag.long {
  border-color: rgba(31, 211, 139, 0.45);
  background: rgba(31, 211, 139, 0.1);
}

.tag.short {
  border-color: rgba(255, 106, 122, 0.45);
  background: rgba(255, 106, 122, 0.1);
}

.empty {
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1160px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

/* ── ORDER_FAILED / BLOCKED row styling ── */
.row-failed { background: rgba(255, 106, 122, 0.06) !important; }
.row-blocked { background: rgba(255, 199, 0, 0.04) !important; }
.reason-cell { font-size: 11px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reason-cell.failed { color: #ff6a7a; }
.reason-cell.blocked { color: #ffc700; }

@media (max-width: 760px) {
    align-items: flex-start;
  }

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

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

  th,
  td {
    padding: 8px 7px;
    font-size: 0.82rem;
  }
}

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

.chart-wrap {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(123, 170, 224, 0.16);
  border-radius: 10px;
  background: rgba(7, 14, 26, 0.45);
}

.sparkline {
  width: 100%;
  height: 120px;
  display: block;
}

.ok {
  color: var(--green);
}

.bad {
  color: var(--red);
}

td.pos {
  color: var(--green);
  font-weight: 700;
}

td.neg {
  color: var(--red);
  font-weight: 700;
}

@media (max-width: 1160px) {
  .kpis-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.kpis-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.consistency-note {
  margin: 10px 0 0;
  font-size: 0.86rem;
}
.consistency-note.ok {
  color: var(--green);
}
.consistency-note.warn {
  color: var(--amber);
}
@media (max-width: 1320px) {
  .kpis-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .kpis-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


.blocked-wrap {
  margin-top: 8px;
}

.blocked-title {
  margin: 0;
  color: var(--muted);
}

.blocked-items {
  margin: 4px 0 0;
  font-weight: 700;
  color: #d8e8fb;
}


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

.blocked-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.blocked-badge.session {
  color: #ffd37a;
  border-color: rgba(255, 211, 122, 0.45);
  background: rgba(255, 211, 122, 0.14);
}

.blocked-badge.risk {
  color: #ff93a0;
  border-color: rgba(255, 147, 160, 0.45);
  background: rgba(255, 147, 160, 0.14);
}

.blocked-badge.setup {
  color: #8ed0ff;
  border-color: rgba(142, 208, 255, 0.45);
  background: rgba(142, 208, 255, 0.14);
}

.blocked-badge.ok {
  color: #83e8b7;
  border-color: rgba(131, 232, 183, 0.45);
  background: rgba(131, 232, 183, 0.14);
}

/* ── Progress Bar $100 → $1000 ── */
.progress-panel {
  border-color: rgba(79, 201, 255, 0.3);
}

.progress-container {
  position: relative;
  height: 36px;
  background: rgba(7, 14, 26, 0.7);
  border-radius: 999px;
  border: 1px solid rgba(123, 170, 224, 0.2);
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1fd38b, #4fc9ff, #7b5cf5);
  border-radius: 999px;
  transition: width 0.8s ease;
  min-width: 4px;
}

.progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

.progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.progress-meta strong {
  color: var(--text);
}

.progress-meta .pos { color: var(--green); }
.progress-meta .neg { color: var(--red); }

/* ── Scanner Watchlist ── */
.watchlist-title {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.watchlist-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.watchlist-tag {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(79, 201, 255, 0.3);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #b8d7f5;
  background: rgba(79, 201, 255, 0.08);
  letter-spacing: 0.02em;
}

.amber {
  color: var(--amber);
}

/* ── TradingView Charts ── */
.chart-panel {
  padding-bottom: 8px;
}

.tv-chart {
  width: 100%;
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
}

/* ── Regime Display ── */
.regime-display {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.regime-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid;
  text-align: center;
}

.regime-badge.bull {
  border-color: rgba(31, 211, 139, 0.5);
  background: rgba(31, 211, 139, 0.1);
  color: var(--green);
}

.regime-badge.bear {
  border-color: rgba(255, 106, 122, 0.5);
  background: rgba(255, 106, 122, 0.1);
  color: var(--red);
}

.regime-badge.range {
  border-color: rgba(255, 204, 102, 0.5);
  background: rgba(255, 204, 102, 0.1);
  color: var(--amber);
}

.regime-badge.volatile {
  border-color: rgba(123, 92, 245, 0.5);
  background: rgba(123, 92, 245, 0.1);
  color: #a78bfa;
}

.regime-badge.dead_market,
.regime-badge.dead {
  border-color: rgba(100, 100, 120, 0.4);
  background: rgba(100, 100, 120, 0.1);
  color: #8899aa;
}

.regime-badge.unknown {
  border-color: rgba(159, 180, 204, 0.3);
  background: rgba(159, 180, 204, 0.08);
  color: var(--muted);
}

.regime-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  opacity: 0.7;
}

.regime-value {
  font-size: 1.2rem;
  font-weight: 900;
  font-family: "JetBrains Mono", monospace;
  margin-top: 2px;
}

.regime-meta {
  flex: 1;
}

.regime-meta p {
  margin: 4px 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.regime-meta strong {
  color: var(--text);
}

/* ── Feature Importance Bars ── */
.feature-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.feat-label {
  min-width: 80px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.feat-bar-bg {
  flex: 1;
  height: 16px;
  background: rgba(7, 14, 26, 0.6);
  border-radius: 999px;
  overflow: hidden;
}

.feat-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  border-radius: 999px;
  transition: width 0.6s ease;
}

.feat-val {
  min-width: 44px;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
}

.feat-val.pos { color: var(--green); }
.feat-val.neg { color: var(--red); }

/* ── Live Alerts ── */
.alerts-panel {
  border-color: rgba(255, 204, 102, 0.25);
}

.alerts-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid;
  font-size: 0.86rem;
}

.alert-item.volatility {
  border-color: rgba(123, 92, 245, 0.4);
  background: rgba(123, 92, 245, 0.1);
}

.alert-item.signal {
  border-color: rgba(79, 201, 255, 0.4);
  background: rgba(79, 201, 255, 0.1);
}

.alert-item.risk {
  border-color: rgba(255, 106, 122, 0.4);
  background: rgba(255, 106, 122, 0.1);
}

.alert-item.info {
  border-color: rgba(159, 180, 204, 0.3);
  background: rgba(159, 180, 204, 0.06);
}

.alert-symbol {
  font-weight: 800;
  font-family: "JetBrains Mono", monospace;
  color: var(--cyan);
  min-width: 80px;
}

.alert-msg {
  flex: 1;
  color: var(--text);
}

.alert-conf {
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
  color: var(--green);
  min-width: 44px;
  text-align: right;
}

/* ── Profile Selector ── */
.header-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-direction: column;
}

.profile-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.profile-selector select {
  background: rgba(7, 14, 26, 0.85);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%234fc9ff' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 200px;
  transition: border-color 0.2s;
}

.profile-selector select:hover {
  border-color: rgba(79, 201, 255, 0.5);
}

.profile-selector select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(79, 201, 255, 0.15);
}

.profile-selector select option {
  background: #0f1d32;
  color: var(--text);
  padding: 8px;
}

.profile-desc {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  max-width: 260px;
  line-height: 1.3;
}

@media (max-width: 760px) {
  .header-controls {
    width: 100%;
    align-items: stretch;
  }
  .profile-selector {
    align-items: stretch;
  }
  .profile-selector select {
    width: 100%;
    min-width: unset;
  }
  .profile-desc {
    text-align: left;
  }
}

/* ── Bot Toggle Switch ── */
.bot-toggle { display: flex; align-items: center; gap: 8px; }
.switch-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch-text { font-size: 11px; font-weight: 700; letter-spacing: 1px; padding: 2px 8px; border-radius: 4px; }
.switch-text.on { color: var(--green); background: rgba(31,211,139,0.12); }
.switch-text.off { color: var(--red); background: rgba(255,106,122,0.12); }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255,106,122,0.3); transition: 0.3s; border-radius: 24px; }
.slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; transition: 0.3s; border-radius: 50%; }
.switch input:checked + .slider { background: rgba(31,211,139,0.5); }
.switch input:checked + .slider::before { transform: translateX(20px); }
