/* ==============================================================================
   ALPHA COPILOT - INSTITUTIONAL HEDGE-FUND TERMINAL DESIGN SYSTEM
   ============================================================================== */

:root {
  --bg-black: #06080d;
  --bg-primary: #0a0d14;
  --bg-surface: #0f141f;
  --bg-surface-elevated: #141b2a;
  --bg-surface-hover: #1a2336;

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-cyan-glow: rgba(56, 189, 248, 0.35);
  --border-green-glow: rgba(0, 230, 118, 0.35);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-faint: #475569;

  --cyan-main: #38bdf8;
  --cyan-bright: #00f2fe;
  --cyan-glow: rgba(56, 189, 248, 0.2);

  --green-main: #00e676;
  --green-dark: #00b0ff;
  --green-glow: rgba(0, 230, 118, 0.15);

  --red-main: #ff1744;
  --red-glow: rgba(255, 23, 68, 0.18);

  --amber-main: #ffab00;
  --purple-main: #a855f7;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 24px rgba(56, 189, 248, 0.25);
  --backdrop-blur: blur(16px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.dark-theme {
  background-color: var(--bg-black);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==============================================================================
   TICKER TAPE (Бегущая строка)
   ============================================================================== */
.ticker-tape-wrap {
  height: 28px;
  background: #040609;
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 101;
}

.ticker-tape-inner {
  display: flex;
  gap: 32px;
  white-space: nowrap;
  animation: marqueeScroll 45s linear infinite;
}

.ticker-tape-inner:hover {
  animation-play-state: paused;
}

@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.tape-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.tape-name {
  color: var(--text-muted);
  font-weight: 600;
}

.tape-val {
  color: var(--text-primary);
  font-weight: 700;
}

.tape-chg.up { color: var(--green-main); }
.tape-chg.down { color: var(--red-main); }

/* ==============================================================================
   HEADER
   ============================================================================== */
.app-header {
  height: 66px;
  background: rgba(10, 13, 20, 0.85);
  backdrop-filter: var(--backdrop-blur);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-orb {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.5);
}

.orb-core {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-name span {
  color: var(--cyan-main);
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

.brand-sub {
  font-size: 0.58rem;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 700;
  font-family: var(--font-mono);
}

.scanner-badge-live {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.25);
  padding: 4px 12px;
  border-radius: var(--radius-xl);
}

.live-ping {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-main);
  box-shadow: 0 0 10px var(--green-main);
  animation: pulsePing 2s infinite;
}

@keyframes pulsePing {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.scanner-status-text {
  display: flex;
  flex-direction: column;
}

.status-top {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--green-main);
  letter-spacing: 0.5px;
}

.status-bot {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: 6px;
  background: rgba(15, 20, 31, 0.7);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--cyan-main);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.tab-counter {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--cyan-main);
  color: #000;
  font-family: var(--font-mono);
}

.tab-pnl-pill {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 230, 118, 0.2);
  color: var(--green-main);
  font-family: var(--font-mono);
}

.system-clock {
  display: flex;
  flex-direction: column;
  text-align: right;
  font-family: var(--font-mono);
}

.clock-label {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.clock-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ==============================================================================
   BUTTONS
   ============================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  font-family: var(--font-sans);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  color: white;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-cyan-glow);
}

.btn-telegram-glow {
  background: linear-gradient(135deg, #0284c7 0%, #229ed9 100%);
  color: white;
  border: 1px solid rgba(34, 158, 217, 0.4);
  box-shadow: 0 0 16px rgba(34, 158, 217, 0.3);
}

.btn-telegram-glow:hover {
  box-shadow: 0 0 24px rgba(34, 158, 217, 0.5);
  transform: translateY(-1px);
}

.btn-telegram-glow.is-connected {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.15);
}

.btn-telegram-glow.is-connected:hover {
  background: rgba(14, 165, 233, 0.25);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.4);
}

.tg-indicator-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00e676;
  box-shadow: 0 0 6px #00e676;
  flex-shrink: 0;
}

.tg-indicator-online.online-pulse {
  animation: tgPulse 2s infinite ease-in-out;
}

@keyframes tgPulse {
  0%, 100% {
    box-shadow: 0 0 6px #00e676;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 12px #00e676, 0 0 4px #ffffff;
    transform: scale(1.25);
  }
}

.btn-action-glow {
  background: linear-gradient(135deg, #059669 0%, #00e676 100%);
  color: #052e16;
  font-weight: 800;
  box-shadow: 0 4px 16px rgba(0, 230, 118, 0.35);
}

.btn-action-glow:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.full-width {
  width: 100%;
}

/* ==============================================================================
   MAIN LAYOUT & TABS
   ============================================================================== */
.main-content {
  flex: 1;
  padding: 14px 20px;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* ==============================================================================
   TAB 1: TRADING TERMINAL
   ============================================================================== */
.terminal-layout {
  display: grid;
  grid-template-columns: 320px 1fr 380px;
  gap: 14px;
  height: calc(100vh - 120px);
}

.terminal-col-left, .terminal-col-right {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-title-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title-group h3 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.badge-subtle {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 2px 8px;
  border-radius: 12px;
  font-family: var(--font-mono);
}

.filter-pills-row {
  display: flex;
  gap: 4px;
  background: var(--bg-black);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.pill-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--cyan-main);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Sidebar Setup Filter Chips */
.sidebar-setup-chips {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 2px 0 4px 0;
  scrollbar-width: none;
}

.sidebar-setup-chips::-webkit-scrollbar {
  display: none;
}

.setup-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.setup-chip:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.setup-chip.active {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--cyan-main);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.15);
}

/* Sidebar Search & Sort Row */
.sidebar-search-sort-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-black);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  transition: all 0.2s ease;
}

.search-input-wrap:focus-within {
  border-color: var(--cyan-main);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  outline: none;
  min-width: 0;
}

.btn-clear-search {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}

.btn-clear-search:hover {
  color: var(--text-primary);
}

.custom-sort-select {
  background: var(--bg-black);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-sort-select:hover,
.custom-sort-select:focus {
  border-color: var(--cyan-main);
  color: var(--text-primary);
}

.ticker-list-stream {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}

.ticker-card-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ticker-card-mini:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(2px);
}

.ticker-card-mini.active {
  background: rgba(56, 189, 248, 0.09);
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: inset 0 0 12px rgba(56, 189, 248, 0.05);
}

.ticker-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticker-score-badge {
  font-size: 0.68rem;
  font-weight: 800;
  font-family: var(--font-mono);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ticker-score-badge.approved {
  background: rgba(0, 230, 118, 0.18);
  color: var(--green-main);
  border: 1px solid rgba(0, 230, 118, 0.3);
}

.ticker-score-badge.watchlist {
  background: rgba(255, 171, 0, 0.18);
  color: var(--amber-main);
  border: 1px solid rgba(255, 171, 0, 0.3);
}

.ticker-texts .sym {
  font-size: 0.88rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.ticker-texts .cat {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.ticker-info-right {
  text-align: right;
  font-family: var(--font-mono);
}

.ticker-info-right .price {
  font-size: 0.88rem;
  font-weight: 700;
}

.ticker-info-right .change {
  font-size: 0.72rem;
  font-weight: 700;
}

.top-signal-card {
  background: linear-gradient(180deg, rgba(0, 230, 118, 0.08) 0%, rgba(56, 189, 248, 0.04) 100%);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signal-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.signal-card-meta {
  flex: 1;
}

.signal-card-ticker {
  font-size: 0.95rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.signal-card-name {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: block;
}

.score-badge-neon {
  font-size: 0.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  background: rgba(0, 230, 118, 0.2);
  color: var(--green-main);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(0, 230, 118, 0.4);
}

.signal-summary-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.targets-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  text-align: center;
}

.target-item .t-lbl {
  font-size: 0.6rem;
  color: var(--text-muted);
  display: block;
}

.target-item .t-val {
  font-size: 0.8rem;
  font-weight: 800;
}

.card-action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.btn-action-primary {
  background: var(--green-main);
  color: #062b14;
  border: none;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.btn-action-telegram {
  background: #229ed9;
  color: white;
  border: none;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

/* ==============================================================================
   CENTER COLUMN (TRADINGVIEW & CONTROLS)
   ============================================================================== */
.terminal-col-center {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.chart-glass-header {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(10, 13, 20, 0.65);
  border-bottom: 1px solid var(--border-subtle);
  gap: 10px;
}

.chart-active-asset {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}

.asset-symbol-code {
  font-size: 1.05rem;
  font-weight: 800;
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

.asset-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 1;
}

.asset-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

.asset-price-val {
  font-size: 1.1rem;
  font-weight: 800;
}

.asset-change-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
}

.asset-change-badge.up {
  background: rgba(0, 230, 118, 0.15);
  color: var(--green-main);
}

.asset-change-badge.down {
  background: rgba(255, 23, 68, 0.15);
  color: var(--red-main);
}

.asset-atr-badge {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 1;
}

.chart-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: max-content;
}

/* Calculation Metadata Transparency Strip & Refresh Button */
.calc-meta-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 20, 31, 0.7);
  border: 1px solid var(--border-medium);
  padding: 2px 4px 2px 8px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  flex-shrink: 0;
  white-space: nowrap;
}

.calc-live-ping {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan-bright);
  box-shadow: 0 0 8px var(--cyan-bright);
  animation: pulsePing 2s infinite;
}

.calc-meta-lbl {
  color: var(--text-muted);
  font-weight: 600;
}

.calc-meta-time {
  color: var(--cyan-main);
  font-weight: 700;
}

.calc-meta-sep {
  color: var(--text-faint);
}

.calc-meta-detail {
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-refresh-calc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2) 0%, rgba(2, 132, 199, 0.3) 100%);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: var(--cyan-main);
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-refresh-calc:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.35) 0%, rgba(2, 132, 199, 0.5) 100%);
  color: #fff;
  border-color: var(--cyan-bright);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.btn-refresh-calc.spinning .refresh-spin-svg,
.btn-refresh-calc-dossier.spinning .refresh-spin-svg {
  animation: spinRefresh 0.8s linear infinite;
}

@keyframes spinRefresh {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.timeframe-switch-group {
  display: flex;
  gap: 2px;
  background: var(--bg-black);
  padding: 2px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.tf-pill {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
}

.tf-pill.active {
  background: var(--bg-surface-elevated);
  color: var(--cyan-main);
}

.tradingview-embed-box {
  flex: 1;
  width: 100%;
  height: 100%;
}

/* ==============================================================================
   RIGHT COLUMN (DOSSIER & 7 RULES WITH SEGMENTED TABS)
   ============================================================================== */
.dossier-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.dossier-top-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.dossier-title-asset-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dossier-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dossier-audit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--cyan-main);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  cursor: help;
}

.dossier-audit-badge .audit-icon {
  font-size: 0.65rem;
}

.dossier-company-heading {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.dossier-company-name {
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

.dossier-company-ticker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan-light);
  font-weight: 600;
  flex-shrink: 0;
}

.btn-refresh-calc-dossier {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--cyan-main);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-refresh-calc-dossier:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.dossier-meta-subtitle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.66rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: 3px;
}

.calc-live-ping-small {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-main);
  box-shadow: 0 0 6px var(--green-main);
}

.dossier-title h3 {
  font-size: 0.95rem;
  font-weight: 800;
}

.dossier-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.dossier-segmented-nav {
  display: flex;
  background: var(--bg-black);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}

.dossier-seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 4px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.18s ease;
}

.dossier-seg-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.dossier-seg-btn.active {
  background: var(--bg-surface-elevated);
  color: var(--cyan-main);
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

.seg-pill-badge {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 800;
  background: rgba(0, 230, 118, 0.2);
  color: var(--green-main);
  padding: 1px 5px;
  border-radius: 10px;
}

.dossier-tab-content {
  display: none;
}

.dossier-tab-content.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeInFast 0.2s ease-out;
}

@keyframes fadeInFast {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.data-provenance-box {
  background: rgba(10, 13, 20, 0.7);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.provenance-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--cyan-main);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.provenance-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prov-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.prov-row:last-child {
  border-bottom: none;
}

.prov-row .p-k {
  color: var(--text-muted);
}

.prov-row .p-v {
  color: var(--text-primary);
  font-weight: 600;
}

.prov-row .p-v.green {
  color: var(--green-main);
  font-weight: 700;
}

.score-circle-wrap {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  aspect-ratio: 1 / 1 !important;
  flex-shrink: 0 !important;
  border-radius: 50% !important;
  background: radial-gradient(circle, rgba(0, 230, 118, 0.2) 0%, rgba(10, 15, 25, 0.9) 100%);
  border: 2px solid var(--green-main);
  box-shadow: 0 0 14px rgba(0, 230, 118, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-circle-inner {
  font-family: var(--font-mono);
  text-align: center;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-num {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--green-main);
  letter-spacing: -0.5px;
}

.score-max {
  font-size: 0.52rem;
  color: var(--text-muted);
  opacity: 0.8;
}

/* Playbook Audit Card in Dossier */
.dossier-playbook-card {
  background: rgba(14, 21, 35, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.dossier-pb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dossier-pb-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dossier-pb-icon {
  font-size: 1rem;
}

.dossier-pb-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}

.dossier-pb-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.dossier-pb-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
}

.dossier-pb-badge.passed {
  background: rgba(0, 230, 118, 0.15);
  color: var(--green-main);
  border: 1px solid rgba(0, 230, 118, 0.35);
}

.dossier-pb-badge.warning {
  background: rgba(255, 23, 68, 0.15);
  color: var(--red-main);
  border: 1px solid rgba(255, 23, 68, 0.35);
}

.dossier-pb-rules-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pb-rule-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 6px 8px;
  border-radius: 4px;
}

.pb-bullet {
  font-size: 0.6rem;
  line-height: 1.2;
}

.pb-bullet.green { color: var(--green-main); }
.pb-bullet.red { color: var(--red-main); }
.pb-bullet.amber { color: var(--amber-main); }

.pb-content {
  flex: 1;
}

.pb-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.pb-date-val {
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.pb-item-desc {
  font-size: 0.66rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.rules-dossier-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rule-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.rule-check-item.passed {
  border-left-color: var(--green-main);
}

.rule-check-item.warning {
  border-left-color: var(--amber-main);
}

.rule-check-item.failed {
  border-left-color: var(--red-main);
}

.rule-check-icon {
  font-weight: 800;
  font-size: 0.85rem;
}

.rule-check-content {
  flex: 1;
}

.rule-check-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.rule-check-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.block-sub-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.sr-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sr-pill-card {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
}

.sr-pill-card.support {
  background: rgba(0, 230, 118, 0.07);
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.sr-pill-card.resistance {
  background: rgba(255, 23, 68, 0.07);
  border: 1px solid rgba(255, 23, 68, 0.2);
}

.sr-pill-type {
  font-size: 0.62rem;
  color: var(--text-muted);
}

.sr-pill-price {
  font-size: 1rem;
  font-weight: 800;
}

.sr-pill-card.support .sr-pill-price { color: var(--green-main); }
.sr-pill-card.resistance .sr-pill-price { color: var(--red-main); }

.sr-pill-strength {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.calculator-block {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.calc-field label {
  font-size: 0.68rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 2px;
}

.input-calc {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  outline: none;
}

.calc-output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--cyan-main);
  padding-top: 4px;
}

.calc-total-invested {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.ai-narrative-card {
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.narrative-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--cyan-main);
}

.narrative-body {
  font-size: 0.74rem;
  color: #cbd5e1;
  line-height: 1.45;
}

.dossier-actions-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ==============================================================================
   TAB 2: LUXURY SCREENER TABLE
   ============================================================================== */
.screener-page-wrap, .portfolio-page-wrap, .ai-trainer-wrap {
  max-width: 1540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-top-bar h2 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.page-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.screener-actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-group-pills {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.filter-tag {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.filter-tag.active {
  background: var(--bg-surface-elevated);
  color: var(--cyan-main);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.screener-page-wrap, .portfolio-page-wrap, .ai-trainer-wrap {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screener-table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: hidden; /* Без горизонтального скролла */
  box-shadow: var(--shadow-card);
  width: 100%;
}

.portfolio-positions-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}

.luxury-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  text-align: left;
}

.luxury-table th {
  background: rgba(6, 8, 13, 0.75);
  padding: 10px 8px;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  font-size: 0.72rem;
  user-select: none;
}

.luxury-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  font-size: 0.76rem;
}

/* Кликабельные строки скринера - перенос в терминал графика при клике в любое место строки */
.screener-clickable-row {
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.screener-clickable-row:hover {
  background: rgba(56, 189, 248, 0.08) !important;
}

.screener-clickable-row:active {
  background: rgba(56, 189, 248, 0.16) !important;
}

.screener-clickable-row:hover .ticker-code-link {
  color: var(--cyan-bright);
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

.screener-clickable-row:hover .row-nav-arrow {
  color: var(--cyan-bright);
  transform: translateX(3px);
}

.table-ticker-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ticker-code-link {
  font-weight: 800;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--cyan-main);
  transition: color 0.15s ease;
}

.ticker-subname {
  font-size: 0.65rem;
  color: var(--text-muted);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-market {
  font-size: 0.62rem;
  padding: 2px 5px;
}

.rule-status-pill {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
}

.screener-score-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-badge-neon.warn {
  background: rgba(255, 171, 0, 0.12);
  color: #ffab00;
  border-color: rgba(255, 171, 0, 0.4);
}

.row-nav-arrow {
  font-size: 0.8rem;
  color: var(--text-faint);
  transition: all 0.18s ease;
}

/* ==============================================================================
   TAB 3: PORTFOLIO & EQUITY CURVE
   ============================================================================== */
.portfolio-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-card.gradient-cyan {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1) 0%, rgba(15, 20, 31, 0.7) 100%);
  border-color: rgba(56, 189, 248, 0.3);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.metric-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
}

.metric-footer.up {
  color: var(--green-main);
  font-family: var(--font-mono);
  font-weight: 700;
}

.metric-sub {
  color: var(--text-muted);
}

.equity-chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.equity-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.equity-title-group h3 {
  font-size: 0.95rem;
  font-weight: 800;
}

.equity-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.equity-stats-mini {
  display: flex;
  gap: 16px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

.equity-stats-mini span {
  color: var(--text-muted);
}

.equity-svg-box {
  width: 100%;
  height: 120px;
}

.equity-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pulse-circle {
  animation: pingDot 2s infinite;
}

/* Positions Table Card */
.positions-card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.positions-card-head h3 {
  font-size: 0.95rem;
  font-weight: 800;
}

/* ==============================================================================
   TAB 4: AI TRAINER & RULES CONFIGURATOR
   ============================================================================== */
.trainer-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.trainer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.card-caption {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.caption-num {
  font-size: 1.2rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--cyan-main);
  background: rgba(56, 189, 248, 0.1);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
}

.card-caption h3 {
  font-size: 1rem;
  font-weight: 800;
}

.caption-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.rule-setting-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-black);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
}

.rule-setting-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.r-badge {
  font-size: 0.62rem;
  font-weight: 800;
  font-family: var(--font-mono);
  background: var(--bg-surface-elevated);
  color: var(--cyan-main);
  padding: 2px 6px;
  border-radius: 4px;
}

.r-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row-2 label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.custom-select, .custom-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
}

.slider-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
}

.range-slider {
  flex: 1;
}

.slider-val-box {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--cyan-main);
  background: var(--bg-surface);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-medium);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.playbook-intro {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.playbook-textarea {
  background: var(--bg-black);
  border: 1px solid var(--border-medium);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 12px;
  border-radius: var(--radius-md);
  resize: vertical;
  outline: none;
}

.playbook-textarea:focus {
  border-color: var(--cyan-main);
}

.feedback-learning-card {
  background: rgba(255, 171, 0, 0.08);
  border: 1px dashed rgba(255, 171, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.74rem;
  color: #fed7aa;
}

.feedback-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--amber-main);
}

.playbook-footer-actions {
  display: flex;
  gap: 10px;
}

/* ==============================================================================
   MODALS
   ============================================================================== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: var(--backdrop-blur);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalScaleUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleUp {
  0% { transform: scale(0.95); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.modal-box-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tg-modal-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #229ed9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.modal-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-box-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-instruction {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.form-group-custom {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-custom label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group-custom input {
  background: var(--bg-black);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.notification-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-black);
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.toggle-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.modal-box-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==============================================================================
   INSTITUTIONAL QUANT TRADE DESK MODAL
   ============================================================================== */
.modal-box-position {
  width: 590px;
  max-width: 95vw;
  background: #0a0e17;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 35px rgba(56, 189, 248, 0.12);
  display: flex;
  flex-direction: column;
}

.trade-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(0, 230, 118, 0.15));
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--cyan-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.trade-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.trade-modal-subtitle {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.trade-modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

/* Asset Banner & Direction */
.pos-asset-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
  gap: 10px;
}

.pos-asset-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-asset-symbol {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.pos-asset-cat-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--cyan-main);
  border: 1px solid rgba(56, 189, 248, 0.3);
  text-transform: uppercase;
}

.pos-asset-curprice {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.45);
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pos-direction-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.55);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  gap: 4px;
}

.pos-dir-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pos-dir-btn .pos-dir-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.15s;
}

.pos-dir-btn.long.active {
  background: rgba(0, 230, 118, 0.18);
  border-color: rgba(0, 230, 118, 0.5);
  color: #00e676;
}

.pos-dir-btn.long.active .pos-dir-dot {
  background: #00e676;
  box-shadow: 0 0 8px #00e676;
}

.pos-dir-btn.short.active {
  background: rgba(255, 23, 68, 0.18);
  border-color: rgba(255, 23, 68, 0.5);
  color: #ff1744;
}

.pos-dir-btn.short.active .pos-dir-dot {
  background: #ff1744;
  box-shadow: 0 0 8px #ff1744;
}

/* Inputs & Affixes */
.pos-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.label-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.label-with-action label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-micro-snap,
.btn-micro-reset {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--cyan-main);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-micro-snap:hover,
.btn-micro-reset:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #ffffff;
}

.input-with-affix {
  display: flex;
  align-items: center;
  background: #06090f;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-with-affix:focus-within {
  border-color: var(--cyan-main);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.input-with-affix input {
  flex: 1;
  width: 100%;
  border: none !important;
  background: transparent !important;
  color: #ffffff !important;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  outline: none;
}

.affix-prefix,
.affix-suffix {
  padding: 0 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  user-select: none;
  flex-shrink: 0;
}

.affix-prefix.rc-red {
  color: var(--red-main);
  font-weight: 700;
}

.affix-prefix.rc-green {
  color: var(--green-main);
  font-weight: 700;
}

/* Volume Section & Chips */
.pos-volume-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-value-indicator {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.pos-value-indicator b {
  color: var(--cyan-bright);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.pos-chips-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pos-chips-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.pos-chips-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.pos-chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pos-chip-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #ffffff;
}

.pos-chip-btn.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--cyan-main);
  color: var(--cyan-bright);
}

/* Risk Management Section */
.pos-risk-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.pos-rh-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pos-rr-badge {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--cyan-bright);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.pos-risk-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pos-risk-card {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-risk-card.sl-card {
  border: 1px solid rgba(255, 23, 68, 0.25);
  background: linear-gradient(180deg, rgba(255, 23, 68, 0.05) 0%, rgba(0, 0, 0, 0.4) 100%);
}

.pos-risk-card.tp-card {
  border: 1px solid rgba(0, 230, 118, 0.25);
  background: linear-gradient(180deg, rgba(0, 230, 118, 0.05) 0%, rgba(0, 0, 0, 0.4) 100%);
}

.pos-rc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pos-rc-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rc-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.rc-bullet.red {
  background: var(--red-main);
  box-shadow: 0 0 6px var(--red-main);
}

.rc-bullet.green {
  background: var(--green-main);
  box-shadow: 0 0 6px var(--green-main);
}

.pos-quick-rr {
  display: flex;
  gap: 3px;
}

.btn-rr-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-rr-chip:hover {
  background: rgba(0, 230, 118, 0.15);
  color: #ffffff;
}

.btn-rr-chip.active {
  background: rgba(0, 230, 118, 0.2);
  border-color: rgba(0, 230, 118, 0.6);
  color: var(--green-main);
}

.pos-rc-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding-top: 2px;
}

/* Deal Summary Bar */
.pos-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(8, 12, 20, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.pos-sum-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pos-sum-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.pos-sum-val {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
}

.pos-sum-val.red {
  color: #ff4d4d;
}

.pos-sum-val.green {
  color: #00e676;
}

.pos-sum-val.cyan {
  color: var(--cyan-bright);
}

.pos-sum-divider {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.08);
}

.btn-confirm-position {
  background: linear-gradient(135deg, #0284c7 0%, #00e676 100%) !important;
  border: none !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35) !important;
  transition: all 0.2s ease !important;
}

.btn-confirm-position:hover {
  box-shadow: 0 6px 20px rgba(0, 230, 118, 0.45) !important;
  transform: translateY(-1px) !important;
}

@media (max-width: 640px) {
  .pos-input-grid,
  .pos-risk-cards {
    grid-template-columns: 1fr;
  }
  .pos-summary-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .pos-sum-divider {
    display: none;
  }
}

/* Utilities */
.green { color: var(--green-main); }
.red { color: var(--red-main); }
.amber { color: var(--amber-main); }
.neon-blue { color: var(--cyan-main); }

/* ==============================================================================
   PORTFOLIO ENHANCEMENTS & EMPTY STATE
   ============================================================================== */
.positions-head-titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.positions-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.positions-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-danger-subtle {
  background: rgba(255, 77, 77, 0.1) !important;
  color: #ff6b6b !important;
  border-color: rgba(255, 77, 77, 0.25) !important;
}

.btn-danger-subtle:hover {
  background: rgba(255, 77, 77, 0.2) !important;
  border-color: #ff4d4d !important;
}

.portfolio-empty-state {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: rgba(13, 17, 24, 0.6);
  border-radius: var(--radius-md);
  margin-top: 16px;
  border: 1px dashed var(--border-medium);
}

.empty-icon-wrap {
  font-size: 2.8rem;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.empty-desc {
  max-width: 540px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.empty-action-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 640px;
  width: 100%;
  margin: 8px 0;
  text-align: left;
}

.empty-how-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.how-step {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cyan-glow);
  color: var(--cyan-main);
  font-size: 0.75rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.empty-how-card b {
  display: block;
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-how-card p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.empty-btns-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

/* ==============================================================================
   TOAST NOTIFICATIONS
   ============================================================================== */
.toast-container {
  position: fixed;
  top: 60px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  min-width: 320px;
  max-width: 440px;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-item.success {
  border-left: 4px solid var(--green-main);
}

.toast-item.info {
  border-left: 4px solid var(--cyan-main);
}

.toast-item.error {
  border-left: 4px solid var(--red-main);
}

.toast-item.hide {
  opacity: 0;
  transform: translateX(30px);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==============================================================================
   SCREENER TOOLBAR & SORTABLE HEADERS
   ============================================================================== */
.screener-toolbar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.screener-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-black);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  width: 320px;
  transition: all 0.2s ease;
}

.screener-search-wrap:focus-within {
  border-color: var(--cyan-main);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.screener-search-wrap input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.78rem;
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
}

.screener-sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.screener-count-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--cyan-main);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-xs);
}

.sortable-col {
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

/* ==============================================================================
   RESPONSIVE DESIGN FOR TERMINAL & CHART HEADER
   ============================================================================== */
@media (max-width: 1400px) {
  .asset-tag {
    display: none;
  }
}

@media (max-width: 1250px) {
  .asset-atr-badge {
    display: none;
  }
  .calc-meta-detail,
  .calc-meta-sep {
    display: none;
  }
}

@media (max-width: 1100px) {
  .calc-meta-lbl {
    display: none;
  }
  .terminal-layout {
    grid-template-columns: 280px 1fr 340px;
  }
}

.sortable-col:hover {
  color: var(--cyan-main);
}

.sort-indicator {
  font-size: 0.72rem;
  opacity: 0.6;
  margin-left: 4px;
}

/* ==============================================================================
   GEAR BUTTONS & CONTROLS (HEADER & CHART)
   ============================================================================== */
.btn-icon-gear,
.btn-chart-gear {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.btn-icon-gear:hover,
.btn-chart-gear:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--cyan-main);
  color: var(--cyan-bright);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
  transform: rotate(30deg);
}

.sidebar-top-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-mini-title {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--text-primary);
  white-space: nowrap;
}

.btn-mini-refresh-icon {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-mini-refresh-icon:hover {
  color: var(--cyan-main);
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.sidebar-filter-refresh-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.btn-refresh-watchlist-main {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--cyan-main);
  font-family: var(--font-mono);
  font-size: 0.70rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-refresh-watchlist-main:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--cyan-main);
  color: #fff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
  transform: translateY(-1px);
}

.btn-refresh-watchlist-main:active {
  transform: translateY(0);
}

/* ==============================================================================
   SETTINGS MODAL
   ============================================================================== */
.modal-box-settings {
  max-width: 520px;
}

.settings-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--cyan-main);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.02);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.settings-field-lbl {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
}

.lbl-hint {
  font-size: 0.68rem;
  font-weight: normal;
  color: var(--text-muted);
}

.settings-select {
  background: var(--bg-black);
  border: 1px solid var(--border-medium);
  color: var(--text-primary);
  font-size: 0.8rem;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  outline: none;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.settings-select:focus {
  border-color: var(--cyan-main);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.settings-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.settings-tf-btn {
  background: var(--bg-black);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.settings-tf-btn:hover {
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.settings-tf-btn.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--cyan-main);
  color: var(--cyan-bright);
}

/* Telegram Status Card in Modal */
.tg-status-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 230, 118, 0.08);
  border: 1px solid rgba(0, 230, 118, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.tg-status-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tg-status-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 230, 118, 0.18);
  color: #00e676;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid rgba(0, 230, 118, 0.4);
}

.tg-status-botname {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.tg-status-card-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.settings-tg-quick-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
}

.settings-tg-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-primary);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.74rem;
}

/* ==============================================================================
   MULTI-EXCHANGE PRICE CONSENSUS & ORACLE BADGES
   ============================================================================== */
.price-consensus-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.70rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  user-select: none;
}

.price-consensus-badge.verified {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--green-main);
}

.price-consensus-badge.verified:hover {
  background: rgba(34, 197, 94, 0.22);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.25);
}

.price-consensus-badge.warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
  color: var(--amber-main);
}

.price-consensus-badge.divergence {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
  color: var(--red-main);
  animation: pulse-red-border 1.5s infinite;
}

.consensus-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* Oracle Card in Right Panel */
.oracle-consensus-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.oracle-consensus-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

.oracle-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.oracle-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.oracle-icon {
  font-size: 0.9rem;
}

.oracle-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.oracle-status-pill {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
}

.oracle-status-pill.verified {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green-main);
  border-color: rgba(34, 197, 94, 0.3);
}

.oracle-status-pill.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber-main);
  border-color: rgba(245, 158, 11, 0.3);
}

.oracle-status-pill.divergence {
  background: rgba(239, 68, 68, 0.2);
  color: var(--red-main);
  border-color: rgba(239, 68, 68, 0.4);
}

.oracle-sources-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.oracle-source-item {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: center;
}

.oracle-source-item .source-name {
  font-size: 0.64rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.oracle-source-item .source-price {
  font-size: 0.76rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-primary);
}

.oracle-spread-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.70rem;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

.oracle-status-note.green {
  color: var(--green-main);
  font-weight: 600;
}

.oracle-status-note.amber {
  color: var(--amber-main);
  font-weight: 600;
}

.oracle-status-note.red {
  color: var(--red-main);
  font-weight: 700;
}

.oracle-warning-banner {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #fca5a5;
}

@keyframes pulse-red-border {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
  }
}

/* ==============================================================================
   CHART SIGNAL MATCH EVENT BANNER
   ============================================================================== */
.chart-signal-match-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(0, 230, 118, 0.12) 0%, rgba(13, 20, 32, 0.95) 55%, rgba(56, 189, 248, 0.08) 100%);
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.25s ease;
  flex-wrap: wrap;
}

.chart-signal-match-banner.waiting {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12) 0%, rgba(13, 20, 32, 0.95) 55%, rgba(245, 158, 11, 0.05) 100%);
  border-color: rgba(245, 158, 11, 0.35);
}

.match-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.match-pulse-ring {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green-main);
  box-shadow: 0 0 10px var(--green-main);
  animation: matchPulse 1.8s infinite ease-in-out;
  flex-shrink: 0;
}

.chart-signal-match-banner.waiting .match-pulse-ring {
  background: var(--amber-main);
  box-shadow: 0 0 8px var(--amber-main);
  animation: none;
}

@keyframes matchPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 8px var(--green-main);
  }
  50% {
    transform: scale(1.3);
    box-shadow: 0 0 16px var(--green-main), 0 0 4px #ffffff;
  }
}

.match-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.match-status-badge {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green-bright);
}

.chart-signal-match-banner.waiting .match-status-badge {
  color: var(--amber-main);
}

.match-ticker-label {
  font-size: 0.70rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 6px;
  border-radius: 4px;
}

.match-subtitle {
  font-size: 0.70rem;
  color: var(--text-secondary);
}

.match-metrics-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.match-metric {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.mm-lbl {
  color: var(--text-muted);
}

.mm-val {
  color: var(--text-primary);
}

.btn-chart-tg-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #0284c7 0%, #229ed9 100%);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(56, 189, 248, 0.4);
  cursor: pointer;
  box-shadow: 0 0 12px rgba(34, 158, 217, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-chart-tg-send:hover {
  box-shadow: 0 0 20px rgba(34, 158, 217, 0.6);
  transform: translateY(-1px);
}

.btn-chart-tg-send:active {
  transform: translateY(0);
}

.btn-chart-tg-send.sent-success {
  background: linear-gradient(135deg, #059669 0%, #00e676 100%);
  color: #052e16;
  border-color: #00e676;
}

.btn-icon-close-banner {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1;
  padding: 4px 7px;
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-close-banner:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.12);
}

.signal-coincided-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid rgba(0, 230, 118, 0.4);
  color: var(--green-bright);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  animation: pulsePill 2s infinite ease-in-out;
}

@keyframes pulsePill {
  0%, 100% { box-shadow: 0 0 4px rgba(0, 230, 118, 0.3); }
  50% { box-shadow: 0 0 10px rgba(0, 230, 118, 0.6); }
}

/* ==========================================================================
   ADD CUSTOM TICKER FEATURE STYLES
   ========================================================================== */
.btn-add-ticker-main {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-add-ticker-main:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
  color: #fff;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
}

.modal-box-lg {
  max-width: 680px;
  width: 95%;
}

.modal-title-icon-badge {
  font-size: 1.3rem;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-ticker-search-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.form-label-bold {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  display: block;
}

.input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-with-action input {
  flex: 1;
  background: rgba(10, 15, 26, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-xs);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 14px;
  outline: none;
  transition: all 0.2s ease;
}

.input-with-action input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.input-hint {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
}

.quick-tickers-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quick-tickers-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}

.quick-tickers-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.quick-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-add-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xs);
  color: #cbd5e1;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-add-chip:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  transform: translateY(-1px);
}

.add-ticker-empty-prompt {
  padding: 24px 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  margin: 12px 8px;
}

.prompt-icon {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.prompt-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}




