/* AiFlo UI foundation v1: calm, high-signal research terminal */
:root {
  --bg: #07111f !important;
  --bg2: #0c1829 !important;
  --bg3: #122238 !important;
  --bg4: #1a2d46 !important;
  --border: #20344d !important;
  --text: #f2f6fb !important;
  --text2: #a8b7c9 !important;
  --text3: #71839a !important;
  --red: #ff6472 !important;
  --up-red: #ff6472 !important;
  --green: #39c78a !important;
  --down-green: #39c78a !important;
  --blue: #62a8ff !important;
  --cyan: #63d7df !important;
  --purple: #a98bff !important;
  --orange: #ffb35c !important;
  --yellow: #f4cb67 !important;
  --card-radius: 16px !important;
  --ios-surface: rgba(13, 28, 47, .94) !important;
  --ios-shadow: 0 18px 42px rgba(0, 0, 0, .24) !important;
}

html, body {
  background: var(--bg) !important;
}

body {
  background-image:
    radial-gradient(circle at 8% -12%, rgba(98, 168, 255, .12), transparent 32%),
    radial-gradient(circle at 88% 0%, rgba(99, 215, 223, .07), transparent 26%) !important;
  letter-spacing: .005em;
}

.sidebar {
  width: 248px !important;
  min-width: 248px !important;
  background: rgba(8, 19, 34, .96) !important;
  border-right: 1px solid #1d3048 !important;
  box-shadow: 18px 0 48px rgba(0, 0, 0, .14);
}

.sidebar-logo {
  min-height: 76px;
  padding: 18px 20px !important;
  border-bottom: 1px solid rgba(130, 164, 202, .14);
}

.sidebar-logo .icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #2d6edc, #49c6c3);
  box-shadow: 0 8px 22px rgba(57, 151, 220, .26);
}

.sidebar-logo .title {
  font-size: 17px !important;
  letter-spacing: .08em;
}

.sidebar-logo .subtitle {
  color: #7f9ab7 !important;
  margin-top: 3px;
}

.nav {
  padding: 16px 12px !important;
}

.nav-section {
  color: #627993 !important;
  font-size: 10px !important;
  letter-spacing: .14em;
  padding: 15px 12px 7px !important;
}

.nav-item {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 10px !important;
  color: #9eb1c8 !important;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.nav-item:hover {
  color: #e8f1fb !important;
  background: rgba(98, 168, 255, .09) !important;
  border-color: rgba(98, 168, 255, .12);
}

.nav-item.active {
  color: #f5f9ff !important;
  background: linear-gradient(90deg, rgba(73, 137, 228, .26), rgba(73, 137, 228, .08)) !important;
  border-color: rgba(98, 168, 255, .25) !important;
  box-shadow: inset 3px 0 0 #62a8ff;
}

.nav-icon {
  width: 22px;
  display: inline-grid;
  place-items: center;
  filter: saturate(.65);
  opacity: .82;
}

.main {
  margin-left: 248px !important;
}

.topbar {
  min-height: 70px;
  height: auto !important;
  padding: 14px 30px !important;
  background: rgba(8, 19, 34, .88) !important;
  border-bottom: 1px solid #1d3048 !important;
  backdrop-filter: blur(16px);
}

.topbar-title {
  font-size: 21px !important;
  font-weight: 760 !important;
  letter-spacing: .015em;
}

.content {
  max-width: 1680px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px 52px !important;
}

.card,
.stat-card,
.trade-terminal-card,
.mobile-section-card {
  background: rgba(13, 28, 47, .92) !important;
  border: 1px solid #203852 !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
}

.card {
  padding: 20px !important;
}

.card-header {
  gap: 16px;
  margin-bottom: 16px !important;
}

.card-title {
  color: #eaf2fb !important;
  font-size: 15px !important;
  letter-spacing: .01em;
}

.card-title .dot {
  box-shadow: 0 0 0 4px rgba(98, 168, 255, .12);
}

#aShareIndexCard,
#operatorTrainingCard,
#thsConceptStatusCard,
#sectorRegimeDashboardCard {
  background: rgba(13, 28, 47, .92) !important;
}

.stats-grid-5,
.stats-grid {
  gap: 12px !important;
}

.stat-card {
  min-height: 112px;
  padding: 17px 16px !important;
}

.stat-label {
  color: #8da2ba !important;
  font-size: 11px !important;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 9px;
  font-variant-numeric: tabular-nums;
}

.btn {
  border-radius: 9px !important;
  font-weight: 650 !important;
  letter-spacing: .01em;
}

.btn-primary {
  background: #3f83df !important;
  border-color: #5599f2 !important;
  box-shadow: 0 6px 16px rgba(63, 131, 223, .2);
}

.btn-outline {
  color: #b8cbe0 !important;
  border-color: #2d4968 !important;
  background: rgba(16, 36, 60, .62) !important;
}

.input,
select.input,
input.input {
  color: #eaf2fb !important;
  background: #0c1c30 !important;
  border-color: #29445f !important;
  border-radius: 9px !important;
}

.table-wrap {
  border: 1px solid #203852 !important;
  border-radius: 12px !important;
  background: rgba(7, 17, 31, .3);
}

table th {
  color: #8198b2 !important;
  background: rgba(16, 36, 60, .58) !important;
  font-size: 11px !important;
  letter-spacing: .06em;
}

table td {
  border-color: rgba(45, 73, 104, .55) !important;
}

.tag,
.badge {
  border-radius: 999px !important;
  padding: 4px 9px !important;
  font-weight: 700 !important;
}

.ai-block {
  background: rgba(16, 36, 60, .64) !important;
  border: 1px solid #284563 !important;
  border-radius: 12px !important;
}

.loading,
.text-muted {
  color: #8298b2 !important;
}

.page.active {
  animation: aiflo-page-in .2s ease-out;
}

@keyframes aiflo-page-in {
  from { opacity: .2; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
  .content { padding: 22px 20px 42px !important; }
  .topbar { padding: 12px 20px !important; }
}

@media (max-width: 900px) {
  .main { margin-left: 0 !important; }
  .content { padding: 16px 14px 34px !important; }
  .topbar { min-height: 60px; padding: 10px 14px !important; }
  .topbar-title { font-size: 18px !important; }
  .card { padding: 16px !important; }
  .stat-card { min-height: 96px; padding: 14px !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
