:root {
  --bg-night: #070322;
  --bg-deep: #100a35;
  --bg-panel: rgba(17, 14, 48, 0.82);
  --bg-panel-strong: rgba(22, 19, 57, 0.92);
  --line-soft: rgba(189, 189, 249, 0.16);
  --line-strong: rgba(189, 189, 249, 0.42);
  --text-main: #f5f4ff;
  --text-muted: rgba(233, 227, 255, 0.68);
  --text-soft: rgba(233, 227, 255, 0.86);
  --accent: #8a86ff;
  --accent-bright: #bdbdf9;
  --accent-cyan: #74d8ff;
  --accent-rose: #d4c3fe;
  --success-glow: #61d6a3;
  --warning-glow: #ffb95e;
  --danger-glow: #ff7d95;
  --shadow-panel: 0 28px 60px rgba(4, 5, 18, 0.42);
  --shadow-glow: 0 0 0 1px rgba(189, 189, 249, 0.18), 0 18px 48px rgba(26, 18, 69, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scrollbar-color: rgba(189, 189, 249, 0.55) rgba(10, 8, 31, 0.9);
}

body.app-body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-main);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top, rgba(70, 53, 160, 0.3), transparent 34%),
    radial-gradient(circle at 80% 12%, rgba(116, 216, 255, 0.15), transparent 22%),
    radial-gradient(circle at 20% 20%, rgba(212, 195, 254, 0.14), transparent 28%),
    linear-gradient(180deg, #171136 0%, #070322 58%, #09051e 100%);
  position: relative;
  overflow-x: hidden;
}

body.app-body::before,
body.app-body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
  filter: blur(18px);
}

body.app-body::before {
  top: 12%;
  left: -6rem;
  width: 18rem;
  height: 18rem;
  background: radial-gradient(circle, rgba(116, 216, 255, 0.22), transparent 72%);
}

body.app-body::after {
  right: -7rem;
  bottom: 8%;
  width: 24rem;
  height: 24rem;
  background: radial-gradient(circle, rgba(138, 134, 255, 0.2), transparent 72%);
}

.app-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.app-orb {
  position: absolute;
  border-radius: 999px;
  opacity: 0.5;
  filter: blur(18px);
  animation: float-orb 12s ease-in-out infinite;
}

.orb-1 {
  top: 5rem;
  left: 8%;
  width: 18rem;
  height: 18rem;
  background: radial-gradient(circle, rgba(120, 93, 255, 0.34), transparent 70%);
}

.orb-2 {
  top: 32%;
  right: 10%;
  width: 22rem;
  height: 22rem;
  background: radial-gradient(circle, rgba(116, 216, 255, 0.22), transparent 72%);
  animation-delay: -3s;
}

.orb-3 {
  bottom: 8%;
  left: 50%;
  width: 30rem;
  height: 14rem;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(212, 195, 254, 0.18), transparent 72%);
  animation-delay: -6s;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(189, 189, 249, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(189, 189, 249, 0.04) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 90%);
  opacity: 0.38;
}

.app-frame {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.app-navbar {
  padding: 1rem 0 0;
  background: transparent;
}

.navbar-shell {
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: rgba(8, 6, 28, 0.72);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-glow);
}

.brand-mark {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-main) !important;
}

.page-nav {
  gap: 0.5rem;
  flex-wrap: wrap;
}

.page-nav .nav-link {
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.55rem 1rem !important;
  transition: 180ms ease;
}

.page-nav .nav-link:hover,
.page-nav .nav-link.active {
  color: var(--text-main);
  background: linear-gradient(135deg, rgba(138, 134, 255, 0.22), rgba(116, 216, 255, 0.12));
  box-shadow: inset 0 0 0 1px rgba(189, 189, 249, 0.16);
}

.user-meta {
  color: var(--text-muted) !important;
}

.app-shell {
  position: relative;
  z-index: 1;
  padding-top: 1.25rem !important;
  padding-bottom: 2.5rem !important;
  max-width: 1320px;
}

.page-hero {
  position: relative;
  overflow: hidden;
  padding: 1.75rem;
  border-radius: 32px;
  background:
    radial-gradient(circle at top right, rgba(116, 216, 255, 0.14), transparent 30%),
    linear-gradient(160deg, rgba(25, 20, 68, 0.9), rgba(10, 8, 32, 0.94));
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-panel);
}

.page-hero::after {
  content: "";
  position: absolute;
  top: -3rem;
  right: -1rem;
  width: 12rem;
  height: 12rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(189, 189, 249, 0.22), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.page-hero > * {
  position: relative;
  z-index: 1;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  color: var(--accent-bright);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.section-eyebrow::before {
  content: "";
  width: 2.25rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(189, 189, 249, 0), rgba(189, 189, 249, 0.9));
}

.page-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.96;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: transparent;
  background: linear-gradient(90deg, #f8f7ff 0%, #bdbdf9 48%, #707093 100%);
  background-clip: text;
  -webkit-background-clip: text;
}

.page-lead {
  max-width: 48rem;
  margin: 1rem 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.84rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(189, 189, 249, 0.14);
}

.surface-card,
.card.surface-card,
.card.metric-card,
.card.auth-card {
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(21, 18, 53, 0.9), rgba(11, 9, 34, 0.92));
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}

.card {
  border-color: var(--line-soft);
  background: linear-gradient(180deg, rgba(21, 18, 53, 0.86), rgba(10, 8, 31, 0.9));
  box-shadow: var(--shadow-panel);
  border-radius: 28px;
}

.card-header,
.card-footer {
  background: rgba(255, 255, 255, 0.02) !important;
  border-color: rgba(189, 189, 249, 0.12) !important;
}

.surface-header {
  padding: 1.15rem 1.4rem 0;
}

.surface-header .card-title,
.surface-header span,
.surface-header h2 {
  color: var(--text-main);
}

.metric-card {
  position: relative;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 27px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%);
  pointer-events: none;
}

.metric-card .card-body {
  position: relative;
  padding: 1.5rem;
  text-align: left;
}

.metric-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 1rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1rem, 2vw, 1rem);
  line-height: 1;
  color: var(--text-main);
}

.metric-meta {
  margin-top: 0.85rem;
  color: var(--accent-cyan);
  font-size: 0.88rem;
}

.event-feed {
  max-height: 240px;
  overflow-y: auto;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(8, 7, 23, 0.72);
  border: 1px solid rgba(189, 189, 249, 0.08);
  color: var(--text-soft);
}

.event-feed p:last-child {
  margin-bottom: 0;
}

.table-responsive {
  border-radius: 0 0 28px 28px;
}

.table-scroll-wrap {
  overflow: auto;
  border-radius: 0 0 28px 28px;
  scrollbar-gutter: stable both-edges;
}

.brokers-table-scroll {
  height: 36rem;
  max-height: 70vh;
}

.table-theme {
  margin-bottom: 0;
  color: var(--text-soft);
  --bs-table-color: var(--text-soft);
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(189, 189, 249, 0.08);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-table-hover-bg: rgba(138, 134, 255, 0.1);
}

.table-theme thead th {
  color: var(--accent-bright);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom-width: 1px;
  background: rgba(255, 255, 255, 0.02);
}

.brokers-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
}

.brokers-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(20, 16, 51, 0.96);
  box-shadow: inset 0 -1px 0 rgba(189, 189, 249, 0.14);
}

.brokers-table th,
.brokers-table td {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brokers-col-group {
  width: 12rem;
}

.brokers-col-email,
.brokers-col-domain {
  width: 22rem;
}

.brokers-col-count {
  width: 7rem;
}

.brokers-col-date {
  width: 10.5rem;
}

.brokers-col-action {
  width: 7.5rem;
}

.account-history-scroll {
  height: 28rem;
  max-height: 60vh;
}

.account-history-table {
  min-width: 1080px;
}

.account-col-subject {
  width: 32rem;
}

.account-col-address {
  width: 18rem;
}

.account-col-timestamp {
  width: 14rem;
}

.sortable-header-cell {
  padding-top: 0;
  padding-bottom: 0;
}

.table-sort-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  padding: 0.9rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.table-sort-button:hover,
.table-sort-button:focus-visible {
  color: #ffffff;
}

.sort-indicator {
  min-width: 0.8rem;
  text-align: center;
  color: var(--accent-cyan);
}

.table-theme tbody td {
  border-top-color: rgba(189, 189, 249, 0.08);
  vertical-align: middle;
}

.table-theme.table-hover > tbody > tr:hover > * {
  color: #9edcff;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  --bs-table-color-type: #a59999;
  --bs-table-bg-type: var(--bs-table-striped-bg);
}

.table-theme a {
  color: #d8d8ff;
  text-decoration: none;
}

.table-theme a:hover {
  color: white;
}

.btn {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.btn-primary,
.btn-warning {
  border: 0;
  color: white;
  background: linear-gradient(135deg, #8786fa 0%, #5fa4ff 100%);
  box-shadow: 0 10px 24px rgba(92, 114, 255, 0.32);
}

.btn-warning:hover,
.btn-primary:hover,
.btn-warning:focus,
.btn-primary:focus {
  color: white;
  background: linear-gradient(135deg, #9d9cff 0%, #74b7ff 100%);
}

.btn-outline-primary,
.btn-outline-light {
  color: var(--text-main);
  border: 1px solid rgba(189, 189, 249, 0.42);
  background: rgba(255, 255, 255, 0.02);
}

.btn-outline-primary:hover,
.btn-outline-light:hover {
  color: white;
  background: rgba(138, 134, 255, 0.18);
  border-color: rgba(189, 189, 249, 0.64);
}

.btn-sm {
  padding-left: 1rem;
  padding-right: 1rem;
}

.app-input,
.form-control,
.form-select {
  color: var(--text-main);
  border-radius: 18px;
  border: 1px solid rgba(189, 189, 249, 0.16);
  background: rgba(7, 6, 23, 0.65);
}

.app-input::placeholder,
.form-control::placeholder {
  color: rgba(233, 227, 255, 0.42);
}

.app-input:focus,
.form-control:focus,
.form-select:focus {
  color: var(--text-main);
  border-color: rgba(116, 216, 255, 0.56);
  background: rgba(10, 8, 31, 0.88);
  box-shadow: 0 0 0 0.18rem rgba(116, 216, 255, 0.14);
}

.form-label,
.text-muted,
.navbar-text,
.small {
  color: var(--text-muted) !important;
}

.alert {
  border-radius: 20px;
  border: 1px solid rgba(255, 125, 149, 0.3);
  background: rgba(78, 18, 38, 0.52);
  color: #ffd8e1;
}

.nav-tabs {
  border-bottom: 0;
  gap: 0.75rem;
}

.nav-tabs .nav-link {
  border: 0;
  border-radius: 999px;
  color: var(--text-muted);
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-link:hover {
  color: white;
  background: linear-gradient(135deg, rgba(135, 134, 250, 0.3), rgba(95, 164, 255, 0.18));
}

.pagination {
  gap: 0.45rem;
  flex-wrap: wrap;
}

.page-link {
  color: var(--text-main);
  border: 1px solid rgba(189, 189, 249, 0.16);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 14px !important;
}

.page-link:hover {
  color: white;
  background: rgba(138, 134, 255, 0.18);
  border-color: rgba(189, 189, 249, 0.42);
}

.page-item.active .page-link {
  border-color: rgba(116, 216, 255, 0.48);
  background: linear-gradient(135deg, rgba(135, 134, 250, 0.7), rgba(95, 164, 255, 0.62));
}

.auth-wrap {
  min-height: calc(100vh - 180px);
  display: flex;
  align-items: center;
}

.auth-card .card-body {
  padding: 2rem;
}

.auth-title {
  margin-bottom: 0.7rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  line-height: 1;
  color: transparent;
  background: linear-gradient(90deg, #ffffff 0%, #c7c5ff 55%, #8f8fd0 100%);
  background-clip: text;
  -webkit-background-clip: text;
}

.auth-copy {
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.data-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-soft);
  border: 1px solid rgba(189, 189, 249, 0.16);
  background: rgba(255, 255, 255, 0.03);
}

.pill-input {
  min-width: 220px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.subtle-separator {
  width: 100%;
  height: 1px;
  margin: 1rem 0;
  background: linear-gradient(90deg, rgba(189, 189, 249, 0), rgba(189, 189, 249, 0.4), rgba(189, 189, 249, 0));
}

@keyframes float-orb {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -18px, 0);
  }
}

@media (max-width: 991.98px) {
  .navbar-shell {
    border-radius: 24px;
  }

  .app-navbar {
    padding-top: 0.75rem;
  }

  .page-hero {
    padding: 1.35rem;
    border-radius: 26px;
  }

  .metric-card .card-body,
  .auth-card .card-body {
    padding: 1.35rem;
  }
}

@media (max-width: 767.98px) {
  .page-title {
    font-size: 2.3rem;
  }

  .pill-input {
    min-width: 100%;
  }

  .brokers-table-scroll {
    height: 28rem;
    max-height: 60vh;
  }

  .account-history-scroll {
    height: 24rem;
    max-height: 56vh;
  }

  .table-theme thead th {
    font-size: 0.72rem;
    letter-spacing: 0.1em;
  }
}
