/* ── Semantic color palette ──────────────────────────────────────────────── */
:root {
  --c-healthy:  #16a34a;
  --c-warning:  #d97706;
  --c-danger:   #dc2626;
  --c-active:   #2563eb;
  --c-muted:    #94a3b8;
  --c-neutral:  #64748b;
  --c-selected: #eff6ff;
  --c-bg:       #f9fafb;
  --c-surface:  #ffffff;
  --c-border:   #e2e8f0;
  --c-border2:  #cbd5e1;
  --c-text:     #0f172a;
  --c-text2:    #475569;
  --c-text3:    #94a3b8;
  --c-nav:      #111827;
  --row-h:      34px;
}
.mt5-healthy { color: var(--c-healthy); }
.mt5-warning { color: var(--c-warning); }
.mt5-danger  { color: var(--c-danger);  }
.mt5-active  { color: var(--c-active);  }
.mt5-muted   { color: var(--c-muted);   }

/* ── Page shell ──────────────────────────────────────────────────────────── */
.mt5-page {
  background: var(--c-bg);
  /* Definite height (not just min-height) so the inner grid can own its own
     scrollbar instead of growing the whole page. overflow:hidden keeps the
     page itself from scrolling — only .mt5-grid-scroll scrolls vertically. */
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--c-text);
}

/* ── Status header ───────────────────────────────────────────────────────── */
.mt5-header {
  background: var(--c-nav);
  color: #e2e8f0;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
.mt5-header-inner { flex: 1; min-width: 0; }
.mt5-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.mt5-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f1f5f9;
}
.mt5-header-meta { font-size: 11px; color: #94a3b8; }
.mt5-conn-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
}
.mt5-conn-live    { background: #14532d; color: #86efac; }
.mt5-conn-watch   { background: #1e3a5f; color: #93c5fd; }
.mt5-conn-unknown { background: #374151; color: #9ca3af; }
.mt5-conn-error   { background: #7f1d1d; color: #fca5a5; }

.mt5-stats-row {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
}
.mt5-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
}
.mt5-stat-time { min-width: 90px; }
.mt5-stat-val {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
  color: #f1f5f9;
}
.mt5-stat-lbl {
  font-size: 9px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.mt5-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.mt5-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #e2e8f0;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.12s;
  white-space: nowrap;
}
.mt5-btn:hover:not(:disabled) { background: rgba(255,255,255,0.15); }
.mt5-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mt5-btn-primary { background: #1d4ed8; border-color: #2563eb; }
.mt5-btn-primary:hover:not(:disabled) { background: #2563eb; }
.mt5-btn-danger { background: #7f1d1d; border-color: #b91c1c; color: #fecaca; }
.mt5-btn-danger:hover:not(:disabled) { background: #991b1b; color: #fee2e2; }
.mt5-btn-watch  { background: #1e3a5f; border-color: #2563eb; color: #93c5fd; }
.mt5-btn-watch:hover:not(:disabled) { background: #1e40af; }
.mt5-btn-watch.active { background: #1e40af; border-color: #60a5fa; color: #bfdbfe; box-shadow: 0 0 0 2px #3b82f680; }
.mt5-btn-sm { padding: 4px 10px; font-size: 11px; }

/* ── Toolbar ─────────────────────────────────────────────────────────────── */
.mt5-toolbar-wrap {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.mt5-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.mt5-search-wrap { position: relative; }
.mt5-search {
  border: 1px solid var(--c-border2);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 13px;
  width: 180px;
  outline: none;
  background: var(--c-bg);
}
.mt5-search:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }

.mt5-view-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.mt5-tab {
  padding: 4px 11px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text2);
  transition: all 0.1s;
}
.mt5-tab:hover { background: var(--c-bg); }
.mt5-tab.active { background: var(--c-nav); color: #f1f5f9; }
.mt5-tab-alert { color: var(--c-active); }
.mt5-tab-warn  { color: var(--c-warning); }
.mt5-tab-high  { color: var(--c-danger); }

.mt5-select {
  border: 1px solid var(--c-border2);
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12px;
  background: var(--c-bg);
  color: var(--c-text);
  cursor: pointer;
}

/* Column visibility menu */
.mt5-col-menu {
  position: absolute;
  z-index: 300;
  background: var(--c-surface);
  border: 1px solid var(--c-border2);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 130px;
}
.mt5-col-menu label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
}

.mt5-result-count {
  font-size: 12px;
  color: var(--c-text3);
  white-space: nowrap;
}

/* ── Grid ────────────────────────────────────────────────────────────────── */
.mt5-grid-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  min-height: 0;   /* allow this flex item to shrink so the inner scroll area is bounded */
}

/* Shared horizontal scroll wrapper — header and body scroll together */
.mt5-grid-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
}

#channel-card-view {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
#channel-card-view.hidden { display: none !important; }

/* Column layout — must match JS ROW_TEMPLATE */
.mt5-grid-header,
.mt5-grid-row {
  display: grid;
  grid-template-columns:
    24px          /* pin       */
    90px          /* symbol    */
    68px          /* type      */
    62px          /* status    */
    72px          /* bid       */
    72px          /* ask       */
    58px          /* spread    */
    62px          /* tick_vol  */
    68px          /* tick age  */
    40px 40px 40px 40px 40px 40px  /* 1m 5m 15m 1h 4h 1d */
    72px          /* warmup    */
    56px          /* zone      */
    68px          /* channels  */
    60px          /* alarms    */
    52px          /* score     */
    1fr           /* reason    */
    60px;         /* actions   */
  align-items: center;
  border-bottom: 1px solid var(--c-border);
  min-width: 1100px;
}

.mt5-grid-header {
  background: #1e293b;
  font-size: 11px;
  font-weight: 700;
  color: #f1f5f9;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 6px;
  height: 32px;
  flex-shrink: 0;
  user-select: none;
  border-bottom: 2px solid #334155;
  position: sticky;
  top: 0;
  z-index: 2;
}
.mt5-col { padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Header cells are never truncated — always show full column title */
.mt5-grid-header .mt5-col { color: #f1f5f9; overflow: visible; white-space: nowrap; }
.mt5-col-pin { text-align: center; }
.mt5-col-actions { text-align: center; }
.mt5-row-clear-btn {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.mt5-row-clear-btn:hover { background: #fee2e2; }

/* Scrollable body */
.mt5-grid-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  outline: none;
}
.mt5-grid-spacer {
  pointer-events: none;
  width: 1px;
}
.mt5-grid-rows {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

/* ── Row ─────────────────────────────────────────────────────────────────── */
.mt5-grid-row {
  height: var(--row-h);
  padding: 0 6px;
  cursor: pointer;
  transition: background 0.08s;
  font-size: 12px;
}
.mt5-grid-row:hover { background: #f0f9ff; }
.mt5-grid-row.selected { background: var(--c-selected); }
.mt5-grid-row.row-pinned { border-left: 2px solid var(--c-active); }
.mt5-grid-row.row-disabled { opacity: 0.45; }
.mt5-grid-row.row-danger   { background: #fff5f5; }
.mt5-grid-row.row-warning  { background: #fffbeb; }
.mt5-grid-row.row-alarm    { background: #eff6ff; }
.mt5-grid-row.row-updating { animation: mt5-pulse 0.6s ease; }

@keyframes mt5-pulse {
  0%   { background: #dbeafe; }
  100% { background: inherit; }
}

/* Signal flicker — green for opportunity, red for breakout */
@keyframes mt5-signal-green {
  0%        { background: inherit; }
  15%, 45%  { background: rgba(34, 197, 94, 0.40); }
  30%, 60%  { background: rgba(34, 197, 94, 0.12); }
  75%, 100% { background: inherit; }
}
@keyframes mt5-signal-red {
  0%        { background: inherit; }
  15%, 45%  { background: rgba(239, 68, 68, 0.40); }
  30%, 60%  { background: rgba(239, 68, 68, 0.12); }
  75%, 100% { background: inherit; }
}
.mt5-grid-row.row-signal-green { animation: mt5-signal-green 1.6s ease-in-out; }
.mt5-grid-row.row-signal-red   { animation: mt5-signal-red   1.6s ease-in-out; }

/* Persistent dot on rows that have a recent signal */
.mt5-signal-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22c55e;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}
.mt5-signal-dot.red { background: #ef4444; }

/* Row cells */
.mt5-pin-icon { cursor: pointer; font-size: 12px; color: var(--c-muted); }
.mt5-pin-icon.pinned { color: var(--c-active); }

.mt5-sym-name {
  font-weight: 600;
  font-size: 12px;
  color: var(--c-text);
}

.mt5-type-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mt5-type-forex     { background: #dbeafe; color: #1e40af; }
.mt5-type-commodity { background: #fef9c3; color: #854d0e; }
.mt5-type-index     { background: #f3e8ff; color: #6b21a8; }
.mt5-type-crypto    { background: #d1fae5; color: #065f46; }
.mt5-type-stock     { background: #fce7f3; color: #9d174d; }
.mt5-type-other     { background: #f1f5f9; color: var(--c-neutral); }

.mt5-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  flex-shrink: 0;
}
.mt5-status-live    { background: var(--c-healthy); box-shadow: 0 0 4px var(--c-healthy); }
.mt5-status-stale   { background: var(--c-warning); }
.mt5-status-error   { background: var(--c-danger); }
.mt5-status-warmup  { background: #a78bfa; }
.mt5-status-unknown { background: var(--c-muted); }

.mt5-price {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  text-align: right;
}
.mt5-price.up   { color: var(--c-healthy); }
.mt5-price.down { color: var(--c-danger);  }

.mt5-spread { text-align: right; font-family: monospace; color: var(--c-neutral); }

.mt5-tick-age { font-size: 11px; color: var(--c-text3); }
.mt5-tick-age.stale  { color: var(--c-warning); font-weight: 600; }
.mt5-tick-age.danger { color: var(--c-danger);  font-weight: 600; }

/* Timeframe status dots (1m/5m/15m…) */
.mt5-tf-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  font-size: 8px;
  text-align: center;
  line-height: 10px;
}
/* Warmed-up / ready (no channel) — neutral blue, NOT green */
.mt5-tf-complete { background: #60a5fa; }
.mt5-tf-running  { background: #a78bfa; }
.mt5-tf-pending  { background: #e2e8f0; }
.mt5-tf-error    { background: var(--c-danger); }
.mt5-tf-na       { background: #f1f5f9; opacity: 0.3; }

/* Active channel found in this timeframe — green + flickering */
.mt5-tf-channel {
  background: var(--c-healthy);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: mt5-tf-channel-pulse 1.3s ease-in-out infinite;
}
@keyframes mt5-tf-channel-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0.7); }
  70%  { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0);   }
  100% { box-shadow: 0 0 0 0   rgba(34, 197, 94, 0);   }
}
/* Active channel that is broken — amber, still flickering to draw attention */
.mt5-tf-channel-broken {
  background: #f59e0b;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: mt5-tf-channel-broken-pulse 1.3s ease-in-out infinite;
}
@keyframes mt5-tf-channel-broken-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(245, 158, 11, 0.7); }
  70%  { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0);   }
  100% { box-shadow: 0 0 0 0   rgba(245, 158, 11, 0);   }
}

/* Warmup progress bar */
.mt5-progress-wrap {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
}
.mt5-progress-bar {
  height: 100%;
  background: var(--c-healthy);
  border-radius: 3px;
  transition: width 0.4s;
}
.mt5-progress-bar.incomplete { background: #a78bfa; }

.mt5-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  text-align: center;
  line-height: 18px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
}
.mt5-badge-ch  { background: #dbeafe; color: #1e40af; }
.mt5-badge-alm { background: #fee2e2; color: #991b1b; }
.mt5-badge-0   { background: #f1f5f9; color: var(--c-muted); }

.mt5-score {
  font-weight: 700;
  font-size: 12px;
  text-align: right;
}
.mt5-score-high { color: var(--c-danger); }
.mt5-score-med  { color: var(--c-warning); }
.mt5-score-low  { color: var(--c-neutral); }

.mt5-reason-text {
  font-size: 11px;
  color: var(--c-text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt5-reason-text.urgent { color: var(--c-danger); font-weight: 600; }

/* ── Admin config modal ──────────────────────────────────────────────────── */
.mt5-admin-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(700px, 95vw);
  max-height: 80vh;
  background: var(--c-surface);
  border: 1px solid var(--c-border2);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  z-index: 2100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mt5-admin-modal.hidden { display: none !important; }
.mt5-admin-modal-hdr {
  background: #1e293b;
  color: #f1f5f9;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.mt5-admin-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}
.mt5-admin-modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.mt5-cfg-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mt5-cfg-table th {
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e293b;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 2px solid #94a3b8;
}
.mt5-cfg-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}
.mt5-cfg-table tr:last-child td { border-bottom: none; }
.mt5-cfg-table tr:hover td { background: #f8fafc; }
.mt5-cfg-tf-checks { display: flex; gap: 10px; flex-wrap: wrap; }
.mt5-cfg-tf-checks label {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; cursor: pointer; user-select: none;
}
.mt5-asset-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.mt5-cfg-section-title {
  margin: 12px 0 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--c-text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mt5-channel-filter-table input,
.mt5-channel-filter-table select {
  width: 100%;
  min-width: 96px;
  border: 1px solid var(--c-border2);
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 11px;
  background: #fff;
  color: var(--c-text);
  box-sizing: border-box;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.mt5-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--c-text2);
}
.mt5-empty-hint { font-size: 12px; color: var(--c-text3); margin-top: 8px; }

/* ── Detail panel ────────────────────────────────────────────────────────── */
.mt5-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 1500;
}
.mt5-overlay.hidden { display: none !important; }
#confirm-overlay { z-index: 2090; }
.mt5-confirm-modal {
  position: fixed;
  z-index: 2100;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  background: var(--c-surface);
  border: 1px solid var(--c-border2);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 16px;
}
.mt5-confirm-modal.hidden { display: none !important; }
.mt5-confirm-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 8px;
}
.mt5-confirm-message {
  font-size: 13px;
  line-height: 1.45;
  color: var(--c-text2);
  margin-bottom: 14px;
}
.mt5-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.mt5-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--c-surface);
  border-left: 1px solid var(--c-border2);
  box-shadow: -8px 0 30px rgba(0,0,0,0.1);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mt5-detail-header {
  background: var(--c-nav);
  color: #f1f5f9;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
}
.mt5-detail-symbol { font-size: 18px; font-weight: 700; margin-right: 6px; }
.mt5-type-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}
.mt5-detail-actions { display: flex; gap: 4px; align-items: center; }
.mt5-detail-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.mt5-detail-close:hover { color: #f1f5f9; background: rgba(255,255,255,0.1); }

.mt5-detail-body { flex: 1; overflow-y: auto; padding: 14px; }
.mt5-detail-section { margin-bottom: 18px; }
.mt5-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text3);
  margin-bottom: 8px;
}
.mt5-tick-row { display: flex; gap: 12px; flex-wrap: wrap; }
.mt5-tick-item { display: flex; flex-direction: column; }
.mt5-tick-lbl { font-size: 10px; color: var(--c-text3); margin-bottom: 2px; }
.mt5-tick-val { font-size: 16px; font-weight: 700; font-family: monospace; }

.mt5-tf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mt5-tf-card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 8px 10px;
}
.mt5-tf-name { font-size: 10px; font-weight: 700; color: var(--c-text2); margin-bottom: 4px; }
.mt5-tf-status-text { font-size: 11px; font-weight: 600; }
.mt5-tf-bars { font-size: 10px; color: var(--c-text3); }

.mt5-detail-row2 { display: flex; gap: 24px; }
.mt5-detail-bignum { font-size: 28px; font-weight: 800; }

.mt5-reasons { display: flex; flex-direction: column; gap: 4px; }
.mt5-reason-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.mt5-meta-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mt5-meta-table td { padding: 4px 0; border-bottom: 1px solid var(--c-border); color: var(--c-text2); }
.mt5-meta-table td:first-child { color: var(--c-text3); width: 110px; }

.mt5-error-text {
  font-size: 11px;
  color: var(--c-danger);
  background: #fff5f5;
  border-radius: 6px;
  padding: 8px;
  font-family: monospace;
  word-break: break-all;
}
.mt5-notes-text { font-size: 12px; color: var(--c-text2); min-height: 20px; }

/* ── Log bar ─────────────────────────────────────────────────────────────── */
.mt5-log-bar {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  flex-shrink: 0;
}
.mt5-log-toggle {
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 11px;
  color: var(--c-text3);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.mt5-log-panel { border-top: 1px solid var(--c-border); max-height: 160px; overflow: hidden; display: flex; flex-direction: column; }
.mt5-log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.mt5-log-title { font-size: 11px; font-weight: 600; color: var(--c-text3); }
.mt5-log-entries { overflow-y: auto; flex: 1; font-family: monospace; font-size: 11px; }
.mt5-log-entry {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 12px;
  border-bottom: 1px solid var(--c-border);
}
.mt5-log-entry:hover { background: var(--c-bg); }
.mt5-log-ts { color: var(--c-text3); flex-shrink: 0; }
.mt5-log-sym { color: var(--c-active); font-weight: 600; flex-shrink: 0; min-width: 60px; }
.mt5-log-msg { color: var(--c-text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt5-log-info  .mt5-log-sym { color: var(--c-active);  }
.mt5-log-warn  .mt5-log-sym { color: var(--c-warning); }
.mt5-log-error .mt5-log-sym { color: var(--c-danger);  }
.mt5-log-error .mt5-log-msg { color: var(--c-danger);  }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt5-col-hidden { display: none !important; }

/* ── AI News Drawer ──────────────────────────────────────────────────────── */
.btn-floating-news {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 30px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 50;
  transition: all 0.2s;
}
.btn-floating-news:hover { background: #334155; transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.2); }

.ai-news-drawer {
  position: fixed;
  top: 0;
  right: -400px;
  width: 380px;
  height: 100vh;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-left: 1px solid #334155;
  box-shadow: -10px 0 30px rgba(0,0,0,0.3);
  z-index: 1000;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  color: #f1f5f9;
}
.ai-news-drawer.open { right: 0; }

.ai-news-header {
  padding: 16px 20px;
  border-bottom: 1px solid #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
}
.ai-news-feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.news-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 14px;
  transition: transform 0.1s;
}
.news-item:hover { transform: translateY(-1px); }

.news-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.news-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
  text-decoration: none;
  margin-bottom: 8px;
  line-height: 1.4;
}
.news-title:hover { text-decoration: underline; color: #60a5fa; }

.news-impact {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  margin-bottom: 8px;
}
.impact-up { background: rgba(40,167,69,0.2); color: #86efac; }
.impact-down { background: rgba(220,53,69,0.2); color: #fca5a5; }
.impact-volatile { background: rgba(255,193,7,0.2); color: #fde047; }
.impact-neutral { background: rgba(255,255,255,0.1); color: #cbd5e1; }

.news-reasoning {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
}
