html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(168, 85, 247, 0.22), transparent 30%),
    linear-gradient(180deg, #0b1020 0%, #0f172a 100%);
}

.page-dark {
  min-height: 100vh;
}

.app-navbar {
  background: rgba(8, 14, 31, 0.72);
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  backdrop-filter: blur(18px);
}

.trend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.14);
  cursor: pointer;
}

.trend-toggle-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.trend-toggle .form-check-input {
  cursor: pointer;
}

.brand-mark {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #8b5cf6);
  box-shadow: 0 0 1.25rem rgba(56, 189, 248, 0.65);
}

.page-pretitle {
  color: #7dd3fc;
}

.hero-stat {
  min-width: 17rem;
  padding: 1rem 1.15rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hero-stat-label,
.detail-label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tblr-secondary);
}

.hero-stat-value {
  display: block;
  margin-top: 0.25rem;
  font-weight: 700;
  font-size: 1.2rem;
}

.hero-stat-meta {
  display: block;
  margin-top: 0.35rem;
  color: var(--tblr-secondary);
  font-size: 0.875rem;
}

.metric-card,
.chart-card,
.card {
  backdrop-filter: blur(16px);
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 1.25rem 3rem rgba(2, 6, 23, 0.28);
}

.card-signal {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.24), rgba(15, 23, 42, 0.78)),
    rgba(15, 23, 42, 0.78);
}

.metric-value {
  margin-top: 0.35rem;
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.metric-subvalue {
  margin-top: 0.5rem;
  margin-bottom: 0.9rem;
  color: var(--tblr-secondary);
}

.signalr-badge {
  min-width: 7rem;
  justify-content: center;
}

.chart-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.chart-shell {
  position: relative;
  height: 22rem;
}

.chart-shell-sm {
  height: 16rem;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--tblr-secondary);
  font-size: 0.875rem;
}

.legend-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  margin-right: 0.45rem;
  border-radius: 999px;
}

.legend-binance {
  background: #38bdf8;
}

.legend-up {
  background: #22c55e;
}

.legend-window {
  background: #f59e0b;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.9rem;
}

.detail-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.detail-item {
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(30, 41, 59, 0.48);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.detail-item strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.05rem;
}

.latency-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  user-select: none;
}

.latency-summary-header:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: -2px;
}

.latency-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
}

.latency-collapse-icon {
  color: var(--tblr-secondary);
  transition: transform 0.2s ease;
}

.latency-card.is-expanded .latency-collapse-icon {
  transform: rotate(90deg);
}

.latency-summary-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem 1rem;
}

.latency-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--tblr-secondary);
  font-size: 0.875rem;
}

.latency-summary-name {
  white-space: nowrap;
}

.latency-card-body {
  padding-top: 0.75rem;
}

.latency-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.latency-tier-1 {
  color: #052e16;
  background: rgba(34, 197, 94, 0.92);
}

.latency-tier-2 {
  color: #082f49;
  background: rgba(56, 189, 248, 0.92);
}

.latency-tier-3 {
  color: #422006;
  background: rgba(250, 204, 21, 0.9);
}

.latency-tier-4 {
  color: #431407;
  background: rgba(251, 146, 60, 0.9);
}

.latency-tier-5 {
  color: #450a0a;
  background: rgba(248, 113, 113, 0.92);
}

.latency-waiting {
  color: #cbd5e1;
  background: rgba(100, 116, 139, 0.18);
}

.snapshot-row-active > td {
  background:
    linear-gradient(90deg, rgba(34, 197, 94, 0.12), rgba(56, 189, 248, 0.06)),
    rgba(15, 23, 42, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 -1px 0 rgba(34, 197, 94, 0.16);
}

.snapshot-row-active .snapshot-window {
  font-weight: 700;
}

.snapshot-live-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 0.5rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #dcfce7;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.24);
}

.trend-flat {
  color: inherit;
}

body[data-trend-mode="market"] .trend-up {
  color: #4ade80;
}

body[data-trend-mode="market"] .trend-down {
  color: #f87171;
}

body[data-trend-mode="inverse"] .trend-up {
  color: #f87171;
}

body[data-trend-mode="inverse"] .trend-down {
  color: #4ade80;
}

.empty-cell {
  text-align: center;
  color: var(--tblr-secondary);
}

@media (max-width: 992px) {
  .hero-stat {
    min-width: 0;
  }

  .chart-card .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .latency-summary-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .latency-summary-list {
    justify-content: flex-start;
  }
}
