:root {
  --bg-root: #020305;
  --bg-panel: rgba(10, 13, 18, 0.92);
  --bg-panel-alt: rgba(15, 21, 28, 0.92);
  --bg-toolbar: rgba(8, 11, 16, 0.92);
  --border: rgba(47, 58, 72, 0.55);
  --border-strong: rgba(71, 92, 114, 0.7);
  --text-primary: #f2f4f8;
  --text-secondary: #8ea1b5;
  --text-dim: #5f6f82;
  --accent-primary: #f7c948;
  --accent-green: #00e28a;
  --accent-red: #ff5f72;
  --accent-blue: #30a5ff;
  --accent-purple: #9c6dff;
  --shadow-soft: 0 20px 50px -20px rgba(0, 0, 0, 0.65);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition-fast: 180ms ease;
  --transition-slow: 360ms ease;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top left, rgba(18, 24, 33, 0.52), rgba(6, 8, 12, 0.96)),
    #020305;
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 24px 42px 36px;
  background-attachment: fixed;
}

body.intro-active {
  overflow: hidden;
}

/* Intro Overlay ------------------------------------------------------------ */

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 25% 25%, rgba(8, 12, 20, 0.94), rgba(2, 4, 10, 0.98));
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.intro-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(8, 14, 24, 0.92), rgba(2, 4, 10, 0.96));
  filter: blur(12px);
}

.intro-video-stage {
  position: relative;
  z-index: 2;
  width: min(760px, 84vw);
  border-radius: 30px;
  overflow: hidden;
  border: 1px solid rgba(96, 132, 186, 0.28);
  box-shadow:
    0 36px 140px -36px rgba(12, 28, 69, 0.8),
    0 0 90px rgba(54, 94, 171, 0.45);
  background: rgba(6, 10, 18, 0.78);
  animation: intro-stage-float 4.5s ease-in-out infinite alternate;
}

.intro-video {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  filter: saturate(1.08) contrast(1.05);
}

.intro-overlay-meta {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 26px 30px;
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.05), rgba(6, 10, 18, 0.86));
  border-top: 1px solid rgba(76, 102, 140, 0.24);
}

.intro-status {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(209, 221, 236, 0.9);
}

.intro-status-led {
  position: relative;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 18px rgba(247, 201, 72, 0.75);
  animation: intro-led-pulse 1.6s ease-in-out infinite;
}

.intro-progress {
  position: relative;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(36, 48, 72, 0.6);
  overflow: hidden;
}

.intro-progress-bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(60, 212, 255, 0.12), rgba(60, 212, 255, 0.85), rgba(60, 212, 255, 0.12));
  animation: intro-progress-sweep 3s ease-in-out infinite;
}

@keyframes intro-stage-float {
  from {
    transform: translateY(0);
    box-shadow:
      0 36px 140px -36px rgba(12, 28, 69, 0.75),
      0 0 70px rgba(54, 94, 171, 0.32);
  }
  to {
    transform: translateY(-14px);
    box-shadow:
      0 50px 160px -38px rgba(12, 28, 69, 0.9),
      0 0 110px rgba(54, 94, 171, 0.52);
  }
}

@keyframes intro-led-pulse {
  0%, 100% {
    box-shadow: 0 0 18px rgba(247, 201, 72, 0.6);
    opacity: 0.65;
  }
  50% {
    box-shadow: 0 0 26px rgba(247, 201, 72, 0.95);
    opacity: 1;
  }
}

@keyframes intro-progress-sweep {
  0% {
    transform: translateX(-60%);
  }
  100% {
    transform: translateX(60%);
  }
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* Header ----------------------------------------------------------------- */

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(9, 12, 18, 0.92), rgba(18, 24, 35, 0.92));
  border: 1px solid rgba(95, 110, 136, 0.25);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px);
  gap: 24px;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-name {
  font-size: 20px;
  letter-spacing: 0.28em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary);
}

.brand-name .brand-emphasis {
  color: var(--accent-primary);
  letter-spacing: 0.12em;
  margin-left: 8px;
}

.brand-tagline {
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.status-board {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(24, 30, 42, 0.65);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(80, 102, 129, 0.34);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(102, 102, 102, 0.45);
  position: relative;
}

.status-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: transparent;
  transition: background var(--transition-fast);
}

.status-dot.online {
  background: var(--accent-green);
}

.status-dot.online::after {
  background: radial-gradient(circle, rgba(0, 226, 138, 0.28), transparent 68%);
}

.status-dot.offline {
  background: var(--accent-red);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.clock {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.32em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(38, 47, 60, 0.5);
  border: 1px solid rgba(80, 102, 129, 0.32);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(63, 81, 107, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  text-transform: uppercase;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
}

.link-button {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.link-button:hover {
  color: var(--accent-primary);
}

/* Buttons ---------------------------------------------------------------- */

.btn {
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast),
    box-shadow var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, #ffd74a, #f7c948);
  color: #0b0d12;
  box-shadow: 0 8px 22px -12px rgba(247, 201, 72, 0.65);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px -12px rgba(247, 201, 72, 0.75);
}

.btn-accent {
  background: transparent;
  border: 1px solid rgba(247, 201, 72, 0.55);
  color: var(--accent-primary);
}

.btn-accent:hover {
  background: rgba(247, 201, 72, 0.08);
}

.btn-outline {
  background: rgba(46, 58, 72, 0.45);
  border: 1px solid rgba(83, 106, 131, 0.4);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: rgba(46, 58, 72, 0.7);
}

.btn[disabled],
.btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

.btn.loading {
  position: relative;
}

.btn.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: rgba(255, 255, 255, 0.85);
  animation: spin 0.65s linear infinite;
}

.btn-compact {
  padding: 8px 14px;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.btn-compact i {
  font-size: 14px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Terminal Layout -------------------------------------------------------- */

.terminal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  gap: 26px;
}

.terminal-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.secondary-column {
  gap: 20px;
}

/* Command Section -------------------------------------------------------- */

.command-section {
  background: rgba(10, 14, 21, 0.92);
  border: 1px solid rgba(76, 98, 125, 0.34);
  border-radius: var(--radius-lg);
  padding: 20px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 18px 36px -36px rgba(0, 0, 0, 0.85);
}

.command-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.command-title {
  font-family: var(--font-mono);
}

.command-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
}

.status-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(100, 120, 150, 0.6);
  box-shadow: 0 0 8px rgba(100, 120, 150, 0.4);
}

.status-led-run {
  background: #48ff98;
  box-shadow: 0 0 8px rgba(72, 255, 152, 0.45);
}

.command-input {
  display: flex;
  align-items: center;
  gap: 12px;
  background: radial-gradient(circle at 20% 20%, rgba(24, 32, 44, 0.6), rgba(14, 19, 28, 0.9));
  border-radius: var(--radius-md);
  border: 1px solid rgba(76, 98, 125, 0.32);
  padding: 18px 20px;
  box-shadow: inset 0 0 24px rgba(4, 6, 10, 0.45);
}

.command-input .prompt {
  font-family: var(--font-mono);
  font-size: 18px;
  letter-spacing: 0.26em;
  color: var(--accent-primary);
}

#search-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

#search-input::placeholder {
  color: rgba(122, 143, 168, 0.45);
}

.command-footer {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.command-keys {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.72);
}

.key-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid rgba(85, 103, 129, 0.5);
  background: rgba(20, 26, 36, 0.75);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

.btn-command {
  padding: 12px 24px;
  letter-spacing: 0.28em;
}

.key-hint {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10px;
  color: rgba(142, 161, 181, 0.6);
}

/* Ticker Strip ----------------------------------------------------------- */

.ticker-strip {
  background: rgba(10, 14, 21, 0.9);
  border: 1px solid rgba(63, 79, 101, 0.34);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ticker-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ticker-strip-title {
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.ticker-strip-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ticker-source {
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.65);
}

.ticker-strip-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.ticker-empty {
  grid-column: 1 / -1;
  padding: 18px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.7);
  border: 1px dashed rgba(63, 79, 101, 0.45);
  border-radius: var(--radius-md);
  background: rgba(14, 19, 28, 0.75);
}

.ticker-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(80, 102, 129, 0.32);
  background: rgba(16, 22, 33, 0.82);
  cursor: pointer;
  transition: transform var(--transition-fast), border var(--transition-fast),
    box-shadow var(--transition-fast);
}

.ticker-tile.active {
  border-color: rgba(247, 201, 72, 0.65);
  box-shadow: 0 18px 40px -30px rgba(247, 201, 72, 0.45);
}

.ticker-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(110, 138, 171, 0.6);
  box-shadow: 0 16px 32px -28px rgba(0, 0, 0, 0.75);
}

.ticker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--text-secondary);
}

.ticker-symbol {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 14px;
}

.ticker-price {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--text-primary);
}

.ticker-change {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.ticker-change.positive {
  color: var(--accent-green);
}

.ticker-change.negative {
  color: var(--accent-red);
}

.ticker-meta {
  display: flex;
  gap: 12px;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.75);
}

.ticker-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ticker-meta span i {
  font-size: 12px;
  color: rgba(142, 161, 181, 0.9);
}

/* Analysis Shell --------------------------------------------------------- */

.analysis-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 4px;
  padding: 0;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(9, 12, 18, 0.92), rgba(16, 22, 32, 0.92));
  border: 1px solid rgba(95, 110, 136, 0.32);
  box-shadow: 0 30px 60px -40px rgba(5, 10, 20, 0.9);
  min-height: 360px;
}

.analysis-shell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(14, 19, 28, 0.94);
  border-bottom: 1px solid rgba(80, 102, 129, 0.32);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(90, 105, 126, 0.4);
  box-shadow: inset 0 0 0 1px rgba(90, 105, 126, 0.75);
}

.dot-red {
  background: #ff5f56;
  box-shadow: inset 0 0 0 1px rgba(255, 78, 73, 0.9);
}

.dot-yellow {
  background: #febb2e;
  box-shadow: inset 0 0 0 1px rgba(231, 167, 50, 0.9);
}

.dot-green {
  background: #27c93f;
  box-shadow: inset 0 0 0 1px rgba(46, 156, 62, 0.9);
}

.window-title {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.window-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.window-indicator {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(85, 103, 129, 0.42);
  background: rgba(25, 32, 45, 0.82);
  color: var(--accent-primary);
}

.window-indicator.muted {
  color: var(--text-secondary);
}

.window-indicator.error {
  color: var(--accent-red);
  border-color: rgba(255, 95, 114, 0.5);
  background: rgba(255, 95, 114, 0.12);
}

.analysis-shell > .analysis-body,
.analysis-shell > .analysis-placeholder {
  padding: 26px 32px 32px;
}

.analysis-placeholder {
  max-width: 640px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.analysis-placeholder h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}

.analysis-placeholder p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(198, 209, 224, 0.85);
}

.placeholder-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.placeholder-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(155, 176, 198, 0.85);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.placeholder-list li span {
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: 0.18em;
}

/* Systems Panel -------------------------------------------------------- */

.systems-panel {
  background: rgba(10, 14, 21, 0.92);
  border: 1px solid rgba(63, 79, 101, 0.32);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.systems-panel .panel-subtitle {
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.6);
}

.chat-tabs {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(76, 98, 125, 0.36);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(18, 24, 33, 0.75);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}

.chat-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 16px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.chat-tab.active {
  background: rgba(247, 201, 72, 0.18);
  color: var(--accent-primary);
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.system-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(80, 102, 129, 0.28);
  background: rgba(16, 22, 33, 0.8);
}

.system-label {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.system-value {
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.system-meta {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.72);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(10, 14, 21, 0.92);
  border: 1px solid rgba(63, 79, 101, 0.32);
  border-radius: var(--radius-lg);
  padding: 20px 20px 18px;
  min-height: 320px;
}

.chat-scroller {
  flex: 1;
  min-height: 180px;
  max-height: 340px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 79, 101, 0.32);
  background: rgba(16, 22, 33, 0.72);
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(85, 103, 129, 0.6) transparent;
}

.chat-scroller::-webkit-scrollbar {
  width: 8px;
}

.chat-scroller::-webkit-scrollbar-thumb {
  background: rgba(85, 103, 129, 0.5);
  border-radius: 4px;
}

.chat-placeholder {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.65);
  text-align: center;
}

.chat-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.chat-message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(63, 79, 101, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-primary);
}

.chat-message-avatar.user-avatar {
  background: rgba(247, 201, 72, 0.18);
  color: var(--accent-primary);
}

.chat-message-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.6;
  background: rgba(20, 26, 36, 0.8);
  border-radius: var(--radius-md);
  border: 1px solid rgba(80, 102, 129, 0.28);
  padding: 10px 12px;
  color: rgba(209, 221, 236, 0.88);
}

.chat-message.bot .chat-message-content {
  border-color: rgba(95, 110, 136, 0.4);
}

.chat-message.user .chat-message-content {
  border-color: rgba(247, 201, 72, 0.4);
  color: rgba(247, 201, 72, 0.92);
}

.chat-message.community .chat-message-content {
  border-color: rgba(95, 110, 136, 0.35);
  color: rgba(209, 221, 236, 0.88);
}

.chat-message-meta {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.7);
  margin-bottom: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-message-meta span {
  color: rgba(122, 143, 168, 0.6);
}

.chat-message.typing .chat-message-content {
  font-style: italic;
  color: rgba(142, 161, 181, 0.8);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(142, 161, 181, 0.8);
  position: relative;
  animation: typing-bounce 1s infinite ease-in-out;
}

.chat-typing-dot::before,
.chat-typing-dot::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(142, 161, 181, 0.6);
  animation: typing-bounce 1s infinite ease-in-out;
}

.chat-typing-dot::before {
  left: -10px;
  animation-delay: -0.2s;
}

.chat-typing-dot::after {
  right: -10px;
  animation-delay: 0.2s;
}

.chat-message.typing .chat-message-content {
  font-style: italic;
  color: rgba(142, 161, 181, 0.8);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(142, 161, 181, 0.8);
  position: relative;
  animation: typing-bounce 1s infinite ease-in-out;
}

.chat-typing-dot::before,
.chat-typing-dot::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(142, 161, 181, 0.6);
  animation: typing-bounce 1s infinite ease-in-out;
}

.chat-typing-dot::before {
  left: -10px;
  animation-delay: -0.2s;
}

.chat-typing-dot::after {
  right: -10px;
  animation-delay: 0.2s;
}

.chat-input-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.chat-input {
  flex: 1;
  resize: none;
  border: 1px solid rgba(76, 98, 125, 0.35);
  border-radius: var(--radius-md);
  background: rgba(16, 22, 33, 0.75);
  color: var(--text-primary);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chat-input::placeholder {
  color: rgba(122, 143, 168, 0.4);
}

.chat-input:disabled {
  opacity: 0.6;
}

.chat-panel .btn-primary {
  align-self: center;
  display: inline-flex;
  gap: 8px;
  padding: 10px 16px;
}

/* Analysis header -------------------------------------------------------- */

.analysis-header {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.instrument-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 24px;
  align-items: center;
}

.instrument-identifiers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.token-symbol {
  font-family: var(--font-mono);
  font-size: 28px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.token-name {
  font-size: 18px;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.instrument-quote {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.quote-price {
  font-size: 32px;
  font-weight: 700;
}

.quote-change {
  font-size: 16px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.quote-change.positive {
  color: var(--accent-green);
}

.quote-change.negative {
  color: var(--accent-red);
}

.instrument-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}

.chain-badge {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(52, 83, 114, 0.4);
  border: 1px solid rgba(80, 102, 129, 0.4);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.address-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(28, 36, 46, 0.6);
  border: 1px solid rgba(63, 79, 101, 0.6);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: background var(--transition-fast), border var(--transition-fast);
}

.address-chip:hover {
  background: rgba(28, 36, 46, 0.85);
  border-color: rgba(102, 129, 161, 0.75);
  color: var(--text-primary);
}

.analysis-timestamp {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.analysis-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(18, 25, 33, 0.75);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(70, 92, 120, 0.32);
}

.result-selector label {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

#result-select {
  background: rgba(12, 18, 26, 0.9);
  border: 1px solid rgba(70, 92, 120, 0.32);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 10px;
}

.analysis-pipeline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(70, 92, 120, 0.28);
  background: rgba(15, 20, 28, 0.6);
  transition: background var(--transition-fast), border var(--transition-fast);
}

.stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(96, 113, 132, 0.45);
}

.stage.active {
  border-color: rgba(247, 201, 72, 0.6);
  background: rgba(247, 201, 72, 0.12);
}

.stage.active .stage-dot {
  background: var(--accent-primary);
}

.stage.done {
  border-color: rgba(0, 226, 138, 0.5);
  background: rgba(0, 226, 138, 0.12);
}

.stage.done .stage-dot {
  background: var(--accent-green);
}

.stage.error {
  border-color: rgba(255, 95, 114, 0.6);
  background: rgba(255, 95, 114, 0.12);
}

.stage.error .stage-dot {
  background: var(--accent-red);
}

.stage-label {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.stage.done .stage-label {
  color: var(--accent-green);
}

.stage.active .stage-label {
  color: var(--accent-primary);
}

.stage.error .stage-label {
  color: var(--accent-red);
}

.llm-tag {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(63, 101, 158, 0.18);
  border: 1px solid rgba(63, 101, 158, 0.45);
  color: #9fb9ff;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Analysis body ---------------------------------------------------------- */

.analysis-body {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.analysis-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.analysis-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(80, 102, 129, 0.32);
  padding: 24px;
  box-shadow: 0 16px 32px -24px rgba(0, 0, 0, 0.65);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-header h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 0;
}

.metric {
  background: rgba(24, 30, 42, 0.68);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid rgba(70, 92, 120, 0.32);
}

.metric dt {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.metric dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text-primary);
}

.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.risk-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: rgba(24, 30, 42, 0.68);
  border-radius: var(--radius-md);
  border: 1px solid rgba(70, 92, 120, 0.32);
}

.risk-label {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.risk-value {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.risk-score {
  display: flex;
  align-items: center;
  gap: 12px;
}

.risk-gauge {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(40, 53, 71, 0.7);
  overflow: hidden;
}

.risk-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
  transition: width var(--transition-slow);
}

.risk-key-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.risk-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: rgba(16, 21, 30, 0.6);
  border-radius: var(--radius-sm);
}

.risk-metric .metric-label {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.risk-metric .metric-value {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-primary);
}

.ai-summary {
  font-size: 15px;
  line-height: 1.7;
  color: rgba(222, 231, 242, 0.88);
}

.ai-detail {
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(20, 26, 36, 0.7);
  border: 1px solid rgba(70, 92, 120, 0.34);
  color: rgba(201, 214, 229, 0.88);
  line-height: 1.7;
  font-size: 14px;
}

.confidence-tag {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-primary);
  background: rgba(247, 201, 72, 0.12);
  border: 1px solid rgba(247, 201, 72, 0.4);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
}

.signals-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  background: rgba(18, 24, 33, 0.82);
}

.signals-column h4 {
  margin: 0 0 14px 0;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.signals-column h4 i {
  font-size: 18px;
  color: var(--accent-primary);
}

.signal-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.signal-list li {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(24, 32, 44, 0.6);
  border: 1px solid rgba(70, 92, 120, 0.28);
  color: rgba(209, 221, 236, 0.88);
  font-size: 14px;
  line-height: 1.5;
}

.signal-list.warning li {
  border-color: rgba(255, 95, 114, 0.32);
  background: rgba(44, 22, 30, 0.55);
}

.recommendation-panel {
  background: linear-gradient(135deg, rgba(26, 32, 44, 0.92), rgba(18, 24, 33, 0.88));
}

.recommendation-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: rgba(0, 226, 138, 0.12);
  border: 1px solid rgba(0, 226, 138, 0.45);
  color: var(--accent-green);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.recommendation-pill.hold {
  background: rgba(247, 201, 72, 0.12);
  border-color: rgba(247, 201, 72, 0.4);
  color: var(--accent-primary);
}

.recommendation-pill.buy {
  background: rgba(0, 226, 138, 0.12);
  border-color: rgba(0, 226, 138, 0.42);
  color: var(--accent-green);
}

.recommendation-pill.avoid {
  background: rgba(255, 95, 114, 0.12);
  border-color: rgba(255, 95, 114, 0.42);
  color: var(--accent-red);
}

.recommendation-reason {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(209, 221, 236, 0.88);
}

.chart-panel {
  background: rgba(14, 20, 30, 0.82);
}

.chart-frame {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 79, 101, 0.34);
  background: radial-gradient(circle at 20% 20%, rgba(12, 16, 25, 0.9), rgba(6, 10, 18, 0.96));
  overflow: hidden;
  height: 420px;
}

.chart-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.chart-iframe.is-visible {
  opacity: 1;
}

.chart-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(209, 221, 236, 0.78);
  font-size: 13px;
  background: linear-gradient(145deg, rgba(10, 16, 26, 0.88), rgba(6, 10, 18, 0.92));
}

.chart-placeholder.hidden {
  display: none;
}

.chart-meta {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.chart-meta .btn {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-meta .btn i {
  font-size: 16px;
}

#dex-chart-open:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#twitter-panel {
  background: rgba(20, 25, 36, 0.75);
}

#twitter-panel p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(209, 221, 236, 0.82);
}

/* AI Token Calls -------------------------------------------------------- */

.ai-calls-section {
  margin-top: 12px;
}

.ai-calls-panel.loading {
  opacity: 0.7;
}

.ai-calls-header {
  align-items: center;
}

.ai-calls-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-calls-timestamp {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ai-calls-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 20px;
  margin-top: 18px;
}

.ai-calls-current,
.ai-calls-history {
  background: rgba(18, 24, 33, 0.65);
  border: 1px solid rgba(63, 79, 101, 0.38);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ai-calls-history-header h4 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ai-calls-history-list {
  display: flex;
  flex-direction: column;
}

.ai-calls-empty {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(24, 32, 44, 0.55);
  border: 1px dashed rgba(76, 98, 125, 0.45);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
}

.ai-call-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(24, 32, 44, 0.7);
  border-radius: var(--radius-md);
  border: 1px solid rgba(76, 98, 125, 0.4);
  padding: 18px;
}

.ai-call-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(24, 32, 44, 0.55);
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 79, 101, 0.32);
  padding: 16px;
  transition: border var(--transition-fast), background var(--transition-fast);
}

.ai-call-row + .ai-call-row {
  margin-top: 12px;
}

.ai-call-row:hover {
  border-color: rgba(95, 119, 150, 0.55);
  background: rgba(28, 36, 49, 0.65);
}

.ai-call-row-header,
.ai-call-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ai-call-token {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ai-call-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(40, 53, 71, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.ai-call-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ai-call-logo-sm {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.ai-call-logo-fallback {
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent-primary);
}

.ai-call-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-call-symbol {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ai-call-status {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 1px solid rgba(95, 110, 136, 0.35);
  background: rgba(30, 40, 55, 0.7);
  color: var(--text-secondary);
}

.ai-call-status.status-active {
  border-color: rgba(0, 226, 138, 0.45);
  background: rgba(0, 226, 138, 0.12);
  color: var(--accent-green);
}

.ai-call-status.status-take_profit {
  border-color: rgba(247, 201, 72, 0.42);
  background: rgba(247, 201, 72, 0.12);
  color: var(--accent-primary);
}

.ai-call-status.status-stop_loss_triggered {
  border-color: rgba(255, 95, 114, 0.45);
  background: rgba(255, 95, 114, 0.12);
  color: var(--accent-red);
}

.ai-call-status.status-closed {
  border-color: rgba(95, 119, 150, 0.45);
  background: rgba(95, 119, 150, 0.12);
  color: rgba(185, 201, 224, 0.85);
}

.ai-call-contract {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(70, 92, 121, 0.38);
  background: rgba(16, 22, 33, 0.7);
}

.ai-call-contract.ai-call-contract-dense {
  padding: 10px 12px;
  gap: 10px;
}

.ai-call-contract.ai-call-contract-dense .ai-call-action {
  padding: 5px 10px;
  font-size: 10px;
}

.ai-call-contract-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-call-contract-label {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(142, 161, 181, 0.7);
}

.ai-call-contract-code {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  word-break: break-all;
}

.ai-call-contract-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-call-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(95, 110, 136, 0.4);
  background: rgba(18, 24, 33, 0.9);
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.ai-call-action i {
  font-size: 16px;
}

.ai-call-action:hover {
  border-color: rgba(247, 201, 72, 0.45);
  color: var(--accent-primary);
}

.ai-call-action[data-ai-call-action='search'] {
  border-color: rgba(247, 201, 72, 0.4);
  color: var(--accent-primary);
}

.ai-call-action[data-ai-call-action='search']:hover {
  background: rgba(247, 201, 72, 0.12);
}

.ai-call-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.ai-call-metrics.compact {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.ai-call-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(18, 26, 37, 0.75);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 79, 101, 0.36);
  padding: 10px 12px;
}

.ai-call-metric span {
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ai-call-metric strong {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-primary);
}

.ai-call-reason {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(201, 214, 229, 0.85);
}

.ai-call-time {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.ai-call-row-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.ai-call-row-footer .ai-call-reason {
  flex: 1 1 320px;
}

@media (max-width: 1024px) {
  .terminal-grid {
    grid-template-columns: 1fr;
  }

  .terminal-column {
    gap: 18px;
  }

  .ticker-strip-body {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .ai-calls-layout {
    grid-template-columns: 1fr;
  }
}

/* Modals ----------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(0px);
  z-index: 1000;
  transition: backdrop-filter var(--transition-slow), opacity var(--transition-fast);
}

.modal.active {
  display: flex;
  backdrop-filter: blur(12px);
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 16, 0.7);
}

.modal-dialog {
  position: relative;
  z-index: 2;
  background: linear-gradient(135deg, rgba(12, 16, 24, 0.96), rgba(18, 23, 34, 0.96));
  border-radius: var(--radius-lg);
  border: 1px solid rgba(95, 110, 136, 0.4);
  box-shadow: 0 40px 80px -60px rgba(0, 0, 0, 0.9);
  width: min(720px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-wide {
  width: min(960px, 94vw);
}

.modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid rgba(80, 102, 129, 0.32);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 26px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-content {
  padding: 26px;
  overflow-y: auto;
}

.wallet-info-card {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.wallet-header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.wallet-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(47, 63, 86, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}

.wallet-avatar img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 50%;
}

.wallet-user-info h3 {
  margin: 0;
  font-size: 18px;
}

.wallet-email {
  margin: 4px 0 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.wallet-chains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
}

.wallet-chain-card {
  background: rgba(20, 26, 36, 0.72);
  border: 1px solid rgba(63, 79, 101, 0.45);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}

.wallet-chain-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(64, 97, 255, 0.0), rgba(255, 230, 117, 0.0));
  pointer-events: none;
}

.wallet-chain-card.wallet-chain-main::after {
  background: linear-gradient(135deg, rgba(64, 97, 255, 0.22), rgba(255, 230, 117, 0.15));
}

.wallet-chain-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-chain-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(35, 46, 62, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wallet-chain-icon img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

.wallet-chain-name {
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.main-wallet-badge {
  font-size: 10px;
  color: var(--accent-primary);
  margin-left: 6px;
}

.wallet-chain-balance-label,
.wallet-chain-address-label {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.wallet-chain-balance-value {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text-primary);
}

.wallet-chain-address-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-copy-address-small {
  border: none;
  background: rgba(33, 42, 58, 0.8);
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
}

.btn-copy-address-small:hover {
  color: var(--accent-primary);
}

.btn-set-main-wallet,
.btn-refresh-chain {
  border: none;
  background: rgba(33, 42, 58, 0.9);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-set-main-wallet:hover,
.btn-refresh-chain:hover {
  background: rgba(47, 60, 82, 0.95);
  color: var(--text-primary);
}

.main-wallet-indicator {
  font-size: 12px;
  color: var(--accent-primary);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.wallet-subscription-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: rgba(15, 21, 30, 0.72);
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 79, 101, 0.45);
  padding: 20px;
}

.subscription-summary-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.subscription-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subscription-status {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.subscription-status.active {
  background: rgba(0, 226, 138, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(0, 226, 138, 0.45);
}

.subscription-status.inactive {
  background: rgba(255, 95, 114, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(255, 95, 114, 0.45);
}

.subscription-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.summary-item {
  background: rgba(24, 32, 44, 0.6);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-label {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.summary-value {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--text-primary);
}

.subscription-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.subscription-plan-card {
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 79, 101, 0.4);
  background: rgba(22, 28, 38, 0.7);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subscription-plan-card.current-plan {
  border-color: rgba(0, 226, 138, 0.45);
  background: rgba(0, 226, 138, 0.12);
}

.plan-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.plan-heading h5 {
  margin: 0;
  font-size: 16px;
}

.plan-price {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent-primary);
}

.plan-price span {
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.plan-cu {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.plan-description {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(200, 212, 228, 0.85);
}

.btn-subscribe-plan {
  align-self: flex-start;
  border: none;
  background: rgba(42, 54, 70, 0.9);
  color: var(--text-secondary);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
}

.btn-subscribe-plan:hover {
  color: var(--text-primary);
  background: rgba(56, 70, 90, 0.95);
}

.btn-subscribe-plan.current {
  background: rgba(0, 226, 138, 0.14);
  color: var(--accent-green);
  border: 1px solid rgba(0, 226, 138, 0.4);
}

.subscription-api-keys {
  background: rgba(17, 22, 31, 0.65);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 79, 101, 0.4);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.subscription-api-keys-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-generate-api-key {
  border: none;
  background: rgba(42, 54, 70, 0.9);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 8px 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
}

.btn-generate-api-key:hover {
  background: rgba(56, 70, 90, 0.95);
  color: var(--text-primary);
}

.subscription-api-keys-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subscription-api-key {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: rgba(24, 32, 44, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 79, 101, 0.4);
}

.subscription-api-key.revoked {
  opacity: 0.6;
}

.api-key-prefix {
  font-family: var(--font-mono);
  font-size: 14px;
}

.api-key-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.api-key-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-key-status {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.api-key-status.active {
  color: var(--accent-green);
}

.api-key-status.revoked {
  color: var(--accent-red);
}

.btn-revoke-api-key {
  border: none;
  background: rgba(44, 32, 38, 0.7);
  color: var(--accent-red);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-revoke-api-key:hover {
  background: rgba(62, 45, 52, 0.9);
}

.subscription-activity {
  background: rgba(18, 24, 33, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 79, 101, 0.4);
  padding: 18px;
}

.subscription-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subscription-activity-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(22, 30, 42, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 79, 101, 0.4);
  padding: 12px 14px;
}

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(42, 54, 70, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.activity-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.activity-title {
  font-size: 14px;
  color: var(--text-primary);
}

.activity-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.wallet-deposit-section,
.wallet-usage-info {
  background: rgba(18, 24, 33, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 79, 101, 0.4);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-deposit-info-box {
  background: rgba(24, 32, 44, 0.6);
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid rgba(63, 79, 101, 0.4);
  font-size: 13px;
  color: rgba(206, 218, 233, 0.85);
}

.wallet-usage-info ul {
  margin: 0;
  padding-left: 18px;
  color: rgba(206, 218, 233, 0.85);
  font-size: 13px;
  line-height: 1.7;
}

.wallet-loading,
.wallet-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* Payment modal ---------------------------------------------------------- */

.payment-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.payment-description {
  margin: 0;
  font-size: 14px;
  color: rgba(209, 221, 236, 0.88);
}

.payment-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  background: rgba(24, 32, 44, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 79, 101, 0.4);
  padding: 12px;
}

.payment-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}

.payment-row strong {
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.payment-status {
  font-size: 13px;
  color: rgba(209, 221, 236, 0.88);
  background: rgba(24, 32, 44, 0.5);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(63, 79, 101, 0.35);
  padding: 12px;
}

.payment-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Toast ------------------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  min-width: 260px;
  max-width: 360px;
  padding: 16px 18px;
  background: rgba(18, 24, 33, 0.92);
  border-radius: var(--radius-md);
  border: 1px solid rgba(80, 102, 129, 0.45);
  box-shadow: 0 28px 44px -36px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  pointer-events: none;
  z-index: 1200;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(0, 226, 138, 0.45);
  color: var(--accent-green);
}

.toast.error {
  border-color: rgba(255, 95, 114, 0.45);
  color: var(--accent-red);
}

.toast.warning {
  border-color: rgba(247, 201, 72, 0.45);
  color: var(--accent-primary);
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 1280px) {
  body {
    padding: 24px;
  }

  .terminal-header {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .instrument-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .instrument-quote,
  .instrument-meta {
    justify-content: flex-start;
  }

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

@media (max-width: 768px) {
  body {
    padding: 18px;
  }

  .terminal-header {
    padding: 16px;
  }

  .status-board {
    flex-wrap: wrap;
    justify-content: center;
  }

  .analysis-columns {
    gap: 18px;
  }

  .panel {
    padding: 20px;
  }

  .metric-grid,
  .risk-key-metrics,
  .signals-panel {
    grid-template-columns: 1fr;
  }

  .ticker-strip-body {
    grid-template-columns: 1fr;
  }

  .chat-tabs {
    width: 100%;
  }

  .chat-tab {
    flex: 1;
    padding: 8px 12px;
  }

  .ai-call-contract {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-call-contract-actions {
    justify-content: space-between;
  }

  .chart-frame {
    height: 320px;
  }

  .chart-meta {
    justify-content: center;
  }

  .chat-input-row {
    flex-direction: column;
  }

  .chat-panel .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .modal-dialog {
    width: 92vw;
  }
}

@media (max-width: 480px) {
  body {
    padding: 16px 12px;
  }

  .terminal-header {
    gap: 12px;
  }

  .brand-name {
    font-size: 18px;
  }

  .brand-tagline {
    font-size: 11px;
  }

  .stage {
    padding: 6px 8px;
  }

  .stage-label {
    font-size: 10px;
    letter-spacing: 0.12em;
  }
}

