/* ═══════════════════════════════════════
   WHALE PANEL — DESIGN SYSTEM
═══════════════════════════════════════ */
:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface2: #f8f9fa;
  --border: rgba(0,0,0,0.07);
  --border2: rgba(0,0,0,0.12);
  --primary: #0066ff;
  --primary-dim: rgba(0,102,255,0.1);
  --green: #16a34a;
  --green-dim: rgba(22,163,74,0.12);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.12);
  --amber: #d97706;
  --amber-dim: rgba(217,119,6,0.12);
  --text: #111827;
  --text2: #6b7280;
  --text3: #9ca3af;
  --mono: 'JetBrains Mono', 'Courier New', monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --header-h: 52px;
  --sidebar-w: 300px;
  --rsidebar-w: 300px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  overflow-x: hidden;
}

body.compact { --compact: 1; }

/* ═══════════════════════════════════════
   STICKY HEADER
═══════════════════════════════════════ */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-center { flex: 1; display: flex; align-items: center; gap: 14px; justify-content: center; }
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
}
.logo span { color: var(--primary); }

.hdr-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-sim { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(217,119,6,0.3); }
.badge-live { background: rgba(220,38,38,0.1); color: var(--red); border: 1px solid rgba(220,38,38,0.3); }
.badge-profile { background: var(--primary-dim); color: var(--primary); border: 1px solid rgba(0,102,255,0.2); font-weight: 500; text-transform: none; font-size: 11px; }

.hdr-sync { font-size: 11px; color: var(--text3); font-family: var(--mono); }

.hdr-exchanges { display: flex; gap: 6px; align-items: center; }
.exch-dot {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  transition: 0.2s;
}
.exch-dot.online { background: var(--green-dim); color: var(--green); border-color: rgba(22,163,74,0.3); }
.exch-dot.offline { background: var(--red-dim); color: var(--red); border-color: rgba(220,38,38,0.3); }

.hdr-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  cursor: pointer;
  transition: 0.15s;
}
.hdr-btn:hover { background: var(--border); color: var(--text); }
.hdr-btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.hdr-btn-primary:hover { background: #0052cc; }

/* ═══════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════ */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
  padding-top: var(--header-h);
}

/* ═══════════════════════════════════════
   LEFT SIDEBAR
═══════════════════════════════════════ */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border2);
  overflow-y: auto;
  scrollbar-gutter: stable;
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sb-block {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.sb-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Sidebar tabs */
.sb-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface2);
  padding: 3px;
  border-radius: var(--radius-sm);
}
.sb-tab {
  flex: 1;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text2);
  border-radius: 4px;
  cursor: pointer;
  transition: 0.15s;
}
.sb-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.sb-tab:hover:not(.active) { color: var(--text); }

/* Profile card */
.profile-card {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px;
}
.profile-card-top { display: flex; align-items: baseline; gap: 6px; margin-bottom: 6px; }
.profile-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.profile-card-ver { font-size: 10px; color: var(--text3); font-family: var(--mono); }
.profile-card-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.pc-badge {
  font-size: 9px; font-weight: 700; padding: 2px 6px;
  border-radius: 3px; text-transform: uppercase; letter-spacing: 0.4px;
}
.pc-active { background: var(--green-dim); color: var(--green); }
.pc-default { background: var(--amber-dim); color: var(--amber); }
.pc-sim { background: var(--amber-dim); color: var(--amber); }
.pc-live { background: var(--red-dim); color: var(--red); }
.profile-card-desc { font-size: 11px; color: var(--text2); margin-bottom: 10px; line-height: 1.4; }
.profile-card-actions { display: flex; flex-direction: column; gap: 6px; }

/* Sidebar buttons */
.sb-btn-primary {
  width: 100%; padding: 8px 12px; font-size: 12px; font-weight: 600;
  background: var(--primary); color: #fff; border: none;
  border-radius: var(--radius-sm); cursor: pointer; transition: 0.15s;
}
.sb-btn-primary:hover { background: #0052cc; }
.sb-btn-ghost {
  width: 100%; padding: 7px 12px; font-size: 11px; font-weight: 500;
  background: transparent; color: var(--text2);
  border: 1px solid var(--border2); border-radius: var(--radius-sm);
  cursor: pointer; transition: 0.15s;
}
.sb-btn-ghost:hover { background: var(--surface2); color: var(--text); }

/* Quick toggles */
.quick-toggles { display: flex; flex-direction: column; gap: 2px; }
.qt-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px; border-radius: var(--radius-sm);
  cursor: pointer; transition: 0.15s;
}
.qt-row:hover { background: var(--surface2); }
.qt-label { font-size: 12px; color: var(--text); font-weight: 500; }

/* Asset tabs in sidebar */
.sb-asset-tabs { display: flex; gap: 4px; }
.sb-asset-tabs .mini-tab {
  font-size: 10px; padding: 3px 8px; border-radius: 4px;
  border: 1px solid var(--border2); background: transparent;
  color: var(--text2); cursor: pointer; font-weight: 600;
}
.sb-asset-tabs .mini-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ═══════════════════════════════════════
   MAIN CONTENT
═══════════════════════════════════════ */
.main-content {
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Views */
.view { display: none; flex-direction: column; gap: 14px; }
.view.active { display: flex; }

/* ═══════════════════════════════════════
   KPI ROW
═══════════════════════════════════════ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.kpi-label { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.kpi-value { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-value.positive { color: var(--green); }
.kpi-value.negative { color: var(--red); }

body.compact .kpi-card { padding: 8px 12px; }
body.compact .kpi-value { font-size: 16px; }

/* ═══════════════════════════════════════
   PANELS
═══════════════════════════════════════ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.panel-header h2 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-dim);
  padding: 2px 8px;
  border-radius: 10px;
}
.panel-btn {
  font-size: 11px; font-weight: 600; padding: 5px 10px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text2); cursor: pointer;
  transition: 0.15s;
}
.panel-btn:hover { background: var(--border); color: var(--text); }

.panel-tabs { display: flex; gap: 2px; }
.ptab {
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text3); cursor: pointer; transition: 0.15s;
}
.ptab.active { background: var(--primary-dim); color: var(--primary); border-color: rgba(0,102,255,0.2); }
.ptab:hover:not(.active) { color: var(--text2); background: var(--surface2); }

body.compact .panel-header { padding: 8px 14px; }

/* ═══════════════════════════════════════
   ACTIVE POSITIONS TABLE
═══════════════════════════════════════ */
.positions-table-wrap { overflow-x: auto; }

.positions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.positions-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.positions-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.positions-table tr:last-child td { border-bottom: none; }
.positions-table tr:hover td { background: var(--surface2); }

body.compact .positions-table td { padding: 6px 12px; }

.side-tag {
  display: inline-block;
  font-size: 10px; font-weight: 700; padding: 2px 7px;
  border-radius: 3px; text-transform: uppercase; letter-spacing: 0.4px;
}
.side-buy { background: var(--green-dim); color: var(--green); }
.side-sell { background: var(--red-dim); color: var(--red); }

.pnl-pos { color: var(--green); font-weight: 600; }
.pnl-neg { color: var(--red); font-weight: 600; }

/* Progress bar SL→TP */
.pos-progress { width: 80px; height: 4px; background: var(--border2); border-radius: 2px; overflow: hidden; }
.pos-progress-fill { height: 100%; border-radius: 2px; background: var(--green); transition: width 0.3s; }
.pos-progress-fill.negative { background: var(--red); }

/* Empty state */
.empty-state {
  padding: 40px 20px;
  text-align: center;
}
.empty-icon { font-size: 32px; margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.empty-hint { font-size: 12px; color: var(--text3); }

/* ═══════════════════════════════════════
   TWO-COL ROW
═══════════════════════════════════════ */
.two-col-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ═══════════════════════════════════════
   PERFORMANCE GRID
═══════════════════════════════════════ */
.perf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
.perf-item {
  padding: 14px 16px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.perf-item:nth-child(3n) { border-right: none; }
.perf-item:nth-last-child(-n+3) { border-bottom: none; }
.perf-label { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.perf-value { font-size: 18px; font-weight: 700; color: var(--text); }

body.compact .perf-item { padding: 10px 14px; }
body.compact .perf-value { font-size: 15px; }

/* ═══════════════════════════════════════
   SIGNAL FORM
═══════════════════════════════════════ */
.signal-form { padding: 14px 16px; }
.signal-form textarea {
  width: 100%; padding: 10px 12px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--mono); font-size: 12px; resize: vertical;
  outline: none; transition: 0.15s;
}
.signal-form textarea:focus { border-color: var(--primary); background: #fff; }
.signal-controls { display: flex; gap: 8px; margin-top: 8px; }
.signal-controls input { flex: 1; }
.signal-btn { background: var(--primary); color: #fff; border: none; padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; font-size: 12px; white-space: nowrap; }
.signal-btn:hover { background: #0052cc; }

.signal-result { margin: 0 16px 14px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 11px; }
.signal-success { background: var(--green-dim); border: 1px solid rgba(22,163,74,0.3); color: var(--green); }
.signal-error { background: var(--red-dim); border: 1px solid rgba(220,38,38,0.3); color: var(--red); }
.signal-processing { background: var(--primary-dim); border: 1px solid rgba(0,102,255,0.2); color: var(--primary); text-align: center; }

/* ═══════════════════════════════════════
   HEATMAP
═══════════════════════════════════════ */
.chart-container { padding: 14px 16px; }
.chart-container canvas { max-height: 160px; }
#tz-info { font-size: 10px; color: var(--text3); text-align: center; margin-top: 6px; }

/* ═══════════════════════════════════════
   HISTORY LIST
═══════════════════════════════════════ */
.history-list { max-height: 280px; overflow-y: auto; }
.history-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  transition: 0.15s;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--surface2); }
.hi-symbol { font-weight: 700; min-width: 70px; }
.hi-price { font-family: var(--mono); color: var(--text2); flex: 1; }
.hi-pnl { font-family: var(--mono); font-weight: 600; min-width: 60px; text-align: right; }
.hi-status { font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 3px; }
.hi-open { background: var(--primary-dim); color: var(--primary); }
.hi-closed { background: var(--surface2); color: var(--text3); }

body.compact .history-item { padding: 6px 14px; }

/* ═══════════════════════════════════════
   MASTERS
═══════════════════════════════════════ */
.copy-form-horizontal { display: flex; gap: 8px; padding: 14px 16px; }
.copy-form-horizontal input { flex: 1; }
.masters-grid { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 6px; }

/* ═══════════════════════════════════════
   ACCOUNTS VIEW
═══════════════════════════════════════ */
.copy-form { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; }

/* ═══════════════════════════════════════
   ALGOS VIEW
═══════════════════════════════════════ */
.algos-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: start;
}

.algos-sidebar { display: flex; flex-direction: column; gap: 10px; }

.profile-actions-list { display: flex; flex-direction: column; gap: 5px; }
.pal-btn {
  width: 100%; padding: 8px 12px; font-size: 12px; font-weight: 500;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text); cursor: pointer;
  text-align: left; transition: 0.15s;
}
.pal-btn:hover { background: var(--border); }
.pal-btn.pal-primary { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.pal-btn.pal-primary:hover { background: #0052cc; }
.pal-btn.pal-danger { color: var(--red); border-color: rgba(220,38,38,0.2); }
.pal-btn.pal-danger:hover { background: var(--red-dim); }

.profile-select-full {
  width: 100%; padding: 9px 10px; font-size: 12px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); color: var(--text); cursor: pointer; outline: none;
}
.profile-select-full:focus { border-color: var(--primary); }

.profile-info-mini { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.pim-row { display: flex; gap: 6px; font-size: 11px; }
.pim-row span:first-child { color: var(--text3); min-width: 55px; }
.pim-row span:last-child { color: var(--text2); }
.pim-desc { font-size: 11px; color: var(--text3); font-style: italic; margin-top: 4px; }

/* Collapsible form sections */
.algos-form-area { display: flex; flex-direction: column; gap: 8px; }

.form-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.fs-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer;
  user-select: none; transition: 0.15s;
}
.fs-header:hover { background: var(--surface2); }
.fs-title { font-size: 13px; font-weight: 700; color: var(--text); }
.fs-summary { flex: 1; font-size: 11px; color: var(--text3); font-family: var(--mono); }
.fs-chevron { font-size: 12px; color: var(--text3); transition: transform 0.2s; }
.form-section.collapsed .fs-chevron { transform: rotate(-90deg); }
.form-section.collapsed .fs-body { display: none; }

.fs-body { padding: 14px 16px; border-top: 1px solid var(--border); }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.form-row:last-child { margin-bottom: 0; }

/* Sticky save bar */
.save-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--amber-dim);
  border: 1px solid rgba(217,119,6,0.3);
  border-radius: var(--radius);
  padding: 10px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
}
.save-bar.visible { display: flex; }
.save-bar-actions { display: flex; gap: 8px; }
.save-bar-actions button {
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  border-radius: var(--radius-sm); cursor: pointer; border: none; transition: 0.15s;
}
.save-bar-actions .sb-btn-ghost {
  background: rgba(217,119,6,0.15); color: var(--amber); border: 1px solid rgba(217,119,6,0.3);
  width: auto;
}
.save-bar-actions .sb-btn-primary {
  background: var(--amber); color: #fff; width: auto;
}

/* ═══════════════════════════════════════
   FORM INPUTS (shared)
═══════════════════════════════════════ */
.input-group-vertical { display: flex; flex-direction: column; gap: 5px; }
.input-group-vertical label {
  font-size: 11px; font-weight: 700; color: var(--text2);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.hint-text { font-size: 10px; color: var(--text3); }

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,102,255,0.08);
}

button {
  background: var(--primary); color: #fff; border: none;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; font-size: 12px;
  font-family: inherit; transition: 0.15s;
}
button:hover { filter: brightness(1.08); }
button:active { transform: scale(0.98); }

.toggle-row { display: flex; align-items: center; gap: 10px; }
.toggle-label { font-size: 12px; color: var(--text2); }

/* Switch */
.switch { position: relative; display: inline-block; width: 34px; height: 18px; flex-shrink: 0; }
.switch.sm { width: 28px; height: 16px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #d1d5db; border-radius: 18px; transition: 0.2s;
}
.slider:before {
  content: ''; position: absolute;
  height: 12px; width: 12px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch.sm .slider:before { height: 10px; width: 10px; left: 3px; bottom: 3px; }
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(16px); }
.switch.sm input:checked + .slider:before { transform: translateX(12px); }

/* Add pair form */
.add-pair-form { display: flex; gap: 6px; margin-bottom: 10px; }
.add-pair-form input { flex: 1; }
.add-pair-form button { padding: 9px 14px; }

/* Mini list */
.mini-list { display: flex; flex-direction: column; gap: 4px; }
.mini-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px;
}

/* Threshold control */
.threshold-control { display: flex; align-items: center; gap: 6px; }
.threshold-control input { width: 80px; }

/* ═══════════════════════════════════════
   RIGHT SIDEBAR
═══════════════════════════════════════ */
.right-sidebar {
  background: var(--surface);
  border-left: 1px solid var(--border2);
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Alerts panel — fixed height, scrollable inside */
.rs-panel { border: none; border-radius: 0; border-bottom: 1px solid var(--border2); box-shadow: none; display: flex; flex-direction: column; }
.rs-panel:last-child { border-bottom: none; flex: 1; overflow: hidden; }

/* Alerts: compact fixed block */
.rs-panel:first-child { flex-shrink: 0; max-height: 260px; }

/* Feed: takes all remaining space */
.rs-panel:last-child .mini-feed { flex: 1; overflow-y: auto; }

/* Alerts list */
.alerts-list { overflow-y: auto; flex: 1; }
.alert-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 12px; transition: 0.15s;
}
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--surface2); }
.alert-icon { font-size: 14px; flex-shrink: 0; }
.alert-text { flex: 1; line-height: 1.4; color: var(--text2); }
.alert-time { font-size: 10px; color: var(--text3); font-family: var(--mono); }

.alert-risk { border-left: 3px solid var(--red); }
.alert-filter { border-left: 3px solid var(--amber); }
.alert-system { border-left: 3px solid var(--primary); }

/* Feed */
.feed-controls { display: flex; gap: 6px; align-items: center; }
.feed-select {
  font-size: 11px; padding: 4px 8px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text2); cursor: pointer;
}
.live-indicator {
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 4px; background: var(--green-dim);
  color: var(--green); border: 1px solid rgba(22,163,74,0.3);
}

.mini-feed { overflow-y: auto; flex: 1; }
.feed-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  font-size: 11px; transition: 0.15s;
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: var(--surface2); }
.feed-exch { font-size: 9px; font-weight: 700; color: var(--text3); min-width: 50px; }
.feed-symbol { font-weight: 700; min-width: 70px; }
.feed-price { font-family: var(--mono); color: var(--text2); flex: 1; }
.feed-size { font-family: var(--mono); font-weight: 600; color: var(--text); }

/* ═══════════════════════════════════════
   PROFILE PICKER MODAL
═══════════════════════════════════════ */
.pm-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  backdrop-filter: blur(3px); z-index: 7000;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.pm-backdrop.visible { opacity: 1; pointer-events: all; }

.pm-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%);
  z-index: 7001; background: var(--surface); border-radius: 14px;
  width: 420px; max-width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.pm-modal.visible { opacity: 1; pointer-events: all; transform: translate(-50%, -50%); }

.pm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.pm-title { font-size: 15px; font-weight: 700; color: var(--text); }
.pm-close {
  background: none; border: none; font-size: 24px; color: var(--text3);
  cursor: pointer; padding: 0; line-height: 1; width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; transition: 0.15s;
}
.pm-close:hover { background: var(--surface2); color: var(--text); }

.pm-list { max-height: 400px; overflow-y: auto; padding: 8px; }
.pm-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: 0.15s; border: 1px solid transparent;
}
.pm-item:hover { background: var(--surface2); }
.pm-item.active { background: var(--primary-dim); border-color: rgba(0,102,255,0.2); }
.pm-item-info { flex: 1; }
.pm-item-name { font-size: 13px; font-weight: 600; color: var(--text); }
.pm-item-desc { font-size: 11px; color: var(--text3); margin-top: 2px; }
.pm-item-badges { display: flex; gap: 4px; margin-top: 4px; }
.pm-item-badges .pc-badge { font-size: 8px; padding: 2px 5px; }

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  min-width: 240px; max-width: 340px; padding: 11px 14px;
  border-radius: var(--radius); font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  pointer-events: all; opacity: 0; transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.toast-show { opacity: 1; transform: translateY(0); }
.toast.toast-hide { opacity: 0; transform: translateY(10px); }
.toast-success { background: #fff; border-left: 4px solid var(--green); color: var(--text); }
.toast-error { background: #fff; border-left: 4px solid var(--red); color: var(--text); }
.toast-info { background: #fff; border-left: 4px solid var(--primary); color: var(--text); }
.toast-icon { font-size: 15px; flex-shrink: 0; }
.toast-message { flex: 1; line-height: 1.4; }
.toast-close {
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: 16px; padding: 0; line-height: 1;
  flex-shrink: 0; transition: color 0.15s;
}
.toast-close:hover { color: var(--text); transform: none; filter: none; }

/* ═══════════════════════════════════════
   CONFIRM MODAL
═══════════════════════════════════════ */
#modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px); z-index: 8000; opacity: 0;
  pointer-events: none; transition: opacity 0.2s;
}
#modal-backdrop.modal-visible { opacity: 1; pointer-events: all; }

#confirm-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%);
  z-index: 8001; background: var(--surface); border-radius: 14px;
  padding: 24px; width: 360px; max-width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
#confirm-modal.modal-visible { opacity: 1; pointer-events: all; transform: translate(-50%, -50%); }

.modal-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.modal-message { font-size: 13px; color: var(--text2); line-height: 1.5; margin-bottom: 20px; white-space: pre-line; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-actions button {
  padding: 9px 16px; font-size: 12px; border-radius: var(--radius-sm);
  font-weight: 600; cursor: pointer; border: none; transition: 0.15s;
}
.modal-btn-cancel { background: var(--surface2); color: var(--text); }
.modal-btn-cancel:hover { background: var(--border); transform: none; filter: none; }
.modal-btn-discard { background: var(--red-dim); color: var(--red); border: 1px solid rgba(220,38,38,0.25); }
.modal-btn-discard:hover { background: rgba(220,38,38,0.18); transform: none; filter: none; }
.modal-btn-confirm { background: var(--primary); color: white; }
.modal-btn-confirm:hover { background: #0052cc; transform: none; filter: none; }

/* ═══════════════════════════════════════
   UTILITY
═══════════════════════════════════════ */
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

/* ═══════════════════════════════════════
   DIRTY INDICATOR
═══════════════════════════════════════ */
#dirty-indicator {
  display: none; font-size: 9px; font-weight: 700; padding: 2px 7px;
  border-radius: 4px; background: var(--amber-dim); color: var(--amber);
  border: 1px solid rgba(217,119,6,0.4); text-transform: uppercase;
  letter-spacing: 0.5px; animation: dirty-pulse 2s infinite;
}
#dirty-indicator.visible { display: inline-block; }
@keyframes dirty-pulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

/* ═══════════════════════════════════════
   ALERT ZONE (legacy compat)
═══════════════════════════════════════ */
.market-alert {
  padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--primary-dim); border: 1px solid rgba(0,102,255,0.2);
  color: var(--primary); font-size: 12px; font-weight: 500;
  margin-bottom: 6px; animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:none} }

/* ═══════════════════════════════════════
   SCROLLBARS
═══════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 1400px) {
  :root { --rsidebar-w: 260px; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1100px) {
  .app-layout { grid-template-columns: var(--sidebar-w) 1fr; }
  .right-sidebar { display: none; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  :root { --sidebar-w: 220px; }
  .two-col-row { grid-template-columns: 1fr; }
  .algos-layout { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}


/* ═══════════════════════════════════════
   LIVE PRICES WIDGET
═══════════════════════════════════════ */

.prices-live-dot {
  font-size: 10px;
  color: var(--green);
  animation: price-pulse 2s infinite;
}
@keyframes price-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Compact Active Profile ─────────────────────────────── */
.sb-block-profile-compact {
  padding: 8px 14px !important;
}
.profile-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.profile-compact-info {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.profile-compact-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.profile-compact-ver {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  flex-shrink: 0;
}
.profile-compact-btn {
  width: 28px; height: 28px;
  padding: 0;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: 0.15s;
}
.profile-compact-btn:hover {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: rgba(0,102,255,0.3);
}

/* ── Live Prices — bigger & clearer ────────────────────── */
.prices-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.price-row {
  display: flex;
  flex-direction: column;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  cursor: default;
  gap: 3px;
}
.price-row:hover {
  background: var(--surface2);
  border-color: var(--border);
}

/* Top line: symbol + change badge */
.price-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.price-symbol {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}

.price-change {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.price-change.up   { color: var(--green); background: var(--green-dim); }
.price-change.down { color: var(--red);   background: var(--red-dim); }
.price-change.flat { color: var(--text3); background: transparent; }

/* Bottom line: big price + sparkline */
.price-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.price-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  line-height: 1;
}
.price-value.up   { color: var(--green); }
.price-value.down { color: var(--red); }

/* Flash animation when price updates */
.price-row.flash-up {
  animation: flash-green 0.6s ease;
}
.price-row.flash-down {
  animation: flash-red 0.6s ease;
}
@keyframes flash-green {
  0% { background: var(--green-dim); border-color: rgba(22,163,74,0.3); }
  100% { background: transparent; border-color: transparent; }
}
@keyframes flash-red {
  0% { background: var(--red-dim); border-color: rgba(220,38,38,0.3); }
  100% { background: transparent; border-color: transparent; }
}

/* Mini sparkline bar */
.price-bar {
  width: 40px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
}
.price-bar-col {
  flex: 1;
  border-radius: 1px;
  min-height: 2px;
  background: var(--border2);
  transition: height 0.3s;
}
.price-bar-col.up   { background: var(--green); }
.price-bar-col.down { background: var(--red); }


/* ═══════════════════════════════════════
   ACTIVE POSITIONS — PROGRESS BAR v2
═══════════════════════════════════════ */

/* TP level badges in table */
.tp-level {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  display: inline-block;
}
.tp1 { background: rgba(22,163,74,0.12); color: var(--green); }
.tp2 { background: rgba(22,163,74,0.2); color: var(--green); }
.tp3 { background: rgba(22,163,74,0.3); color: #0f7a30; }

/* Progress wrap */
.pos-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 160px;
}

/* Track */
.pos-progress-track {
  position: relative;
  height: 8px;
  background: var(--border2);
  border-radius: 4px;
  overflow: visible;
}

/* Fill */
.pos-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.fill-profit { background: linear-gradient(90deg, #16a34a, #22c55e); }
.fill-loss   { background: linear-gradient(90deg, #dc2626, #ef4444); }

/* Current price cursor (triangle) */
.pos-price-cursor {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--text);
  border-radius: 1px;
  transform: translateX(-50%);
  transition: left 0.5s ease;
}
.pos-price-cursor::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--text);
}

/* TP marker lines */
.pos-tp-marker {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 12px;
  transform: translateX(-50%);
  z-index: 2;
}
.tp1-marker { background: rgba(22,163,74,0.6); }
.tp2-marker { background: rgba(22,163,74,0.8); }
.tp3-marker { background: #16a34a; }

/* Labels row */
.pos-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ppl-sl { color: var(--red); }
.ppl-tp { color: var(--green); }

/* Zone label */
.pos-zone-label {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 1px 6px;
  border-radius: 3px;
  align-self: flex-start;
}
.zone-profit { color: var(--green); background: var(--green-dim); }
.zone-loss   { color: var(--red);   background: var(--red-dim); }
.zone-sl     { color: var(--red);   background: var(--red-dim); }
.zone-tp1    { color: var(--green); background: rgba(22,163,74,0.15); }
.zone-tp2    { color: var(--green); background: rgba(22,163,74,0.22); }
.zone-tp3    { color: #0f7a30;      background: rgba(22,163,74,0.3); }

/* Close position button */
.btn-close-pos {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255,68,68,0.4);
  border-radius: 6px;
  background: rgba(255,68,68,0.08);
  color: #ff6b6b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  letter-spacing: 0.3px;
}
.btn-close-pos:hover {
  background: rgba(255,68,68,0.2);
  border-color: rgba(255,68,68,0.7);
  color: #ff4444;
  transform: scale(1.03);
}
.btn-close-pos:active {
  transform: scale(0.97);
}
.btn-close-pos:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}


/* ═══════════════════════════════════════
   PROFILE EDITING STATUS
═══════════════════════════════════════ */
.profile-editing-status {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.pes-active {
  color: var(--green);
  font-weight: 600;
}
.pes-inactive {
  color: var(--amber);
  font-weight: 600;
}
.pes-hint {
  color: var(--text3);
  font-size: 10px;
}

/* Activate button: grey when already active */
.pal-btn.pal-already-active {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(22,163,74,0.3);
  cursor: default;
}
.pal-btn.pal-already-active:hover {
  transform: none;
  filter: none;
}

/* ═══════════════════════════════════════
   TRADE DETAIL MODAL
═══════════════════════════════════════ */
.td-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.td-modal-overlay.td-visible { opacity: 1; }

.td-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  width: 420px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  transform: translateY(10px);
  transition: transform 0.2s ease;
}
.td-modal-overlay.td-visible .td-modal { transform: translateY(0); }

.td-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.td-title { display: flex; align-items: center; gap: 8px; }

.td-close-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.td-close-btn:hover { background: var(--surface2); color: var(--text1); }

.td-pnl-big {
  font-size: 28px;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  text-align: center;
  padding: 12px 0 20px;
  letter-spacing: -0.5px;
}

.td-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.td-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-radius: 8px;
  transition: background 0.1s;
}
.td-row:hover { background: var(--surface2); }
.td-label {
  font-size: 12px;
  color: var(--text3);
  font-weight: 500;
  min-width: 100px;
}
.td-value {
  font-size: 12px;
  color: var(--text1);
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  text-align: right;
}

.td-tv-btn {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 8px;
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.3);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.td-tv-btn:hover {
  background: rgba(99,102,241,0.22);
  border-color: rgba(99,102,241,0.6);
}

.history-item:hover { background: var(--surface2); border-radius: 8px; }

/* ═══════════════════════════════════════
   MARKET INTELLIGENCE
═══════════════════════════════════════ */

/* Regime badge in Live Prices */
.price-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.regime-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.regime-bullish { background: var(--green-dim); color: var(--green); border: 1px solid rgba(22,163,74,0.3); }
.regime-bearish { background: var(--red-dim); color: var(--red); border: 1px solid rgba(220,38,38,0.3); }
.regime-sideways { background: var(--surface2); color: var(--text3); border: 1px solid var(--border2); }
.regime-unknown { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(217,119,6,0.3); }

.regime-ratio {
  font-size: 9px;
  color: var(--text3);
  font-family: var(--mono);
  padding: 0 2px 2px;
}

/* Hints panel */
.hints-list {
  max-height: 200px;
  overflow-y: auto;
}

.hint-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  line-height: 1.4;
}
.hint-item:last-child { border-bottom: none; }

.hint-icon { font-size: 12px; flex-shrink: 0; margin-top: 1px; }
.hint-text { flex: 1; color: var(--text); }
.hint-time { font-size: 10px; color: var(--text3); font-family: var(--mono); flex-shrink: 0; }

.hint-warning { border-left: 3px solid var(--red); background: rgba(220,38,38,0.03); }
.hint-caution { border-left: 3px solid var(--amber); background: rgba(217,119,6,0.03); }
.hint-info    { border-left: 3px solid var(--primary); background: rgba(0,102,255,0.03); }

/* ═══════════════════════════════════════
   MOBILE — Full Responsive (≤ 640px)
═══════════════════════════════════════ */

/* Hamburger button */
.mob-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.mob-menu-btn span {
  display: block; width: 18px; height: 2px;
  background: var(--text2); border-radius: 2px;
  transition: 0.2s;
}
.mob-menu-btn.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.mob-menu-btn.open span:nth-child(2) { opacity: 0; }
.mob-menu-btn.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Sidebar overlay */
.mob-sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 900;
  backdrop-filter: blur(2px);
}

/* Bottom navigation */
.mob-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 60px;
  background: var(--surface);
  border-top: 1px solid var(--border2);
  z-index: 800;
  display: none;
  align-items: stretch;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}
.mob-nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; background: none; border: none;
  color: var(--text3); cursor: pointer;
  font-size: 10px; font-weight: 600;
  padding: 6px 4px; position: relative;
  transition: color 0.15s;
}
.mob-nav-btn.active { color: var(--primary); }
.mob-nav-btn.active .mob-nav-icon { transform: scale(1.15); }
.mob-nav-icon { font-size: 18px; line-height: 1; transition: transform 0.15s; }
.mob-nav-label { font-size: 10px; font-weight: 600; }
.mob-nav-badge {
  position: absolute; top: 6px; right: calc(50% - 14px);
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}

@media (max-width: 640px) {
  /* Show mobile elements */
  .mob-menu-btn { display: flex; }
  .mob-bottom-nav { display: flex; }
  .hdr-hide-mobile { display: none !important; }
  .hdr-profile-hide { display: none !important; }

  /* Header */
  .app-header {
    padding: 0 10px;
    gap: 8px;
  }
  .header-center { display: none; }
  .logo { font-size: 13px; }
  .hdr-exchanges { display: none; }
  .hdr-sync { display: none; }

  /* Layout: single column, no sidebars */
  .app-layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr;
  }

  /* Left sidebar: slide-in drawer */
  .sidebar {
    position: fixed;
    top: var(--header-h); left: 0;
    width: 280px !important;
    height: calc(100vh - var(--header-h));
    z-index: 950;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    overflow-y: auto;
  }
  .sidebar.mob-open { transform: translateX(0); }
  .mob-sidebar-overlay.mob-open { display: block; }

  /* Right sidebar: hidden on mobile */
  .right-sidebar { display: none !important; }

  /* Main content: full width, bottom padding for nav */
  .main-content {
    padding: 10px 10px 72px;
    height: auto;
    overflow-y: visible;
  }

  /* KPI row: 2 columns */
  .kpi-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .kpi-card { padding: 10px 12px; }
  .kpi-value { font-size: 17px; }
  .kpi-label { font-size: 9px; }

  /* Panels */
  .panel-header { padding: 10px 12px; }
  .panel-header h2 { font-size: 12px; }

  /* Active positions table: horizontal scroll */
  .positions-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .positions-table { min-width: 600px; font-size: 11px; }
  .positions-table th, .positions-table td { padding: 7px 8px; }

  /* History list */
  .history-list { max-height: 240px; }
  .history-item { padding: 8px 12px; font-size: 11px; gap: 8px; }

  /* Two-col → single col */
  .two-col-row { grid-template-columns: 1fr !important; gap: 10px; }

  /* Performance grid: 2 cols */
  .perf-grid { grid-template-columns: repeat(2, 1fr); }
  .perf-item { padding: 10px 12px; }
  .perf-value { font-size: 15px; }

  /* ALGOS layout: single col */
  .algos-layout { grid-template-columns: 1fr !important; }
  .algos-sidebar { display: none; } /* hide profile sidebar on mobile */

  /* Form rows: single col */
  .form-row { grid-template-columns: 1fr !important; gap: 10px; }
  .fs-body { padding: 12px; }

  /* Chart */
  .chart-container canvas { max-height: 120px; }

  /* Threshold inputs */
  .input-group { margin-bottom: 8px; }

  /* Trade detail modal */
  .td-modal {
    width: calc(100vw - 20px) !important;
    max-height: 85vh;
    padding: 16px;
    border-radius: 12px;
  }
  .td-pnl-big { font-size: 22px; }

  /* Toast */
  #toast-container {
    bottom: 70px;
    right: 10px;
    left: 10px;
  }
  .toast { min-width: unset; max-width: 100%; }

  /* Confirm modal */
  #confirm-modal {
    width: calc(100vw - 30px);
    padding: 18px;
  }

  /* Profile modal */
  .pm-modal {
    width: calc(100vw - 20px);
    max-height: 80vh;
  }

  /* Save bar */
  .save-bar { flex-direction: column; gap: 8px; padding: 10px 12px; }
  .save-bar-actions { width: 100%; justify-content: flex-end; }

  /* Compact mode off on mobile */
  body.compact .kpi-value { font-size: 15px; }
  body.compact .positions-table td { padding: 6px 8px; }
}

/* Tablet (641–900px) */
@media (min-width: 641px) and (max-width: 900px) {
  .app-layout { grid-template-columns: var(--sidebar-w) 1fr !important; }
  .right-sidebar { display: none !important; }
  .main-content { padding: 12px; }
  .kpi-row { grid-template-columns: repeat(3, 1fr) !important; }
  .two-col-row { grid-template-columns: 1fr !important; }
  .perf-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ═══════════════════════════════════════
   TOTAL PNL BANNER
═══════════════════════════════════════ */
.total-pnl-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.tpb-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  min-width: 60px;
}
.tpb-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}
.tpb-value.pnl-pos { color: var(--green); }
.tpb-value.pnl-neg { color: var(--red); }
.tpb-trades {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
  margin-left: auto;
}

/* ═══════════════════════════════════════
   DAILY PNL HISTORY
═══════════════════════════════════════ */
.daily-pnl-list {
  padding: 8px 0;
}
.dpnl-row {
  display: grid;
  grid-template-columns: 100px 1fr 80px 120px;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.dpnl-row:last-child { border-bottom: none; }
.dpnl-row:hover { background: var(--surface2); }
.dpnl-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  font-family: var(--mono);
}
.dpnl-bar-wrap {
  height: 6px;
  background: var(--border2);
  border-radius: 3px;
  overflow: hidden;
}
.dpnl-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.dpnl-bar-pos { background: var(--green); }
.dpnl-bar-neg { background: var(--red); }
.dpnl-pnl {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}
.dpnl-meta {
  font-size: 10px;
  color: var(--text3);
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .dpnl-row {
    grid-template-columns: 90px 1fr 70px;
    gap: 8px;
  }
  .dpnl-meta { display: none; }
  .tpb-value { font-size: 20px; }
}

/* ═══════════════════════════════════════
   ENTRY CONTEXT MODAL
═══════════════════════════════════════ */
.ctx-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); z-index: 8000;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.ctx-backdrop.visible { opacity: 1; pointer-events: all; }

.ctx-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -48%);
  z-index: 8001; background: var(--surface); border-radius: 14px;
  width: 600px; max-width: 90vw; max-height: 80vh;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  display: flex; flex-direction: column;
}
.ctx-modal.visible { opacity: 1; pointer-events: all; transform: translate(-50%, -50%); }

.ctx-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.ctx-title { font-size: 18px; font-weight: 600; color: var(--text); }
.ctx-close {
  background: none; border: none; font-size: 28px; color: var(--text-dim);
  cursor: pointer; line-height: 1; padding: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background 0.15s;
}
.ctx-close:hover { background: var(--hover); }

.ctx-body {
  padding: 24px; overflow-y: auto; flex: 1;
}
.ctx-loading {
  text-align: center; padding: 40px; color: var(--text-dim);
}

.ctx-section {
  margin-bottom: 24px;
}
.ctx-section-title {
  font-size: 13px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px;
}
.ctx-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.ctx-field {
  background: var(--bg); padding: 12px; border-radius: 8px;
  border: 1px solid var(--border);
}
.ctx-field-label {
  font-size: 11px; color: var(--text-dim); margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.ctx-field-value {
  font-size: 14px; font-weight: 500; color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.ctx-field-value.regime-bullish { color: #10b981; }
.ctx-field-value.regime-bearish { color: #ef4444; }
.ctx-field-value.regime-sideways { color: #f59e0b; }
.ctx-field-value.regime-unknown { color: var(--text-dim); }

.ctx-filters {
  display: flex; flex-direction: column; gap: 8px;
}
.ctx-filter-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg); border-radius: 6px;
  border: 1px solid var(--border);
}
.ctx-filter-icon {
  font-size: 16px;
}
.ctx-filter-name {
  flex: 1; font-size: 13px; font-weight: 500; color: var(--text);
}
.ctx-filter-status {
  font-size: 11px; padding: 3px 8px; border-radius: 4px;
  font-weight: 600; text-transform: uppercase;
}
.ctx-filter-status.passed {
  background: rgba(16, 185, 129, 0.15); color: #10b981;
}
.ctx-filter-status.blocked {
  background: rgba(239, 68, 68, 0.15); color: #ef4444;
}

.ctx-no-data {
  text-align: center; padding: 20px; color: var(--text-dim);
  font-size: 13px; font-style: italic;
}

@media (max-width: 768px) {
  .ctx-modal { width: calc(100vw - 20px); }
  .ctx-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════
   FILTER ANALYTICS PANEL
═══════════════════════════════════════ */
.analytics-tabs {
  display: flex; gap: 6px; padding: 0 20px 16px;
}

.analytics-table-wrap {
  padding: 0 20px 20px;
}

.analytics-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.analytics-table th {
  text-align: left; padding: 8px 12px;
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
.analytics-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-table tr:hover td { background: var(--hover); }

.wr-bar-wrap {
  display: flex; align-items: center; gap: 8px;
}
.wr-bar {
  height: 6px; border-radius: 3px; background: var(--border);
  flex: 1; overflow: hidden;
}
.wr-bar-fill {
  height: 100%; border-radius: 3px; transition: width 0.4s;
}
.wr-bar-fill.good { background: #10b981; }
.wr-bar-fill.mid  { background: #f59e0b; }
.wr-bar-fill.bad  { background: #ef4444; }

.wr-pct {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px; font-weight: 600; min-width: 42px;
}
.wr-pct.good { color: #10b981; }
.wr-pct.mid  { color: #f59e0b; }
.wr-pct.bad  { color: #ef4444; }

.regime-tag {
  display: inline-block; padding: 3px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
}
.regime-tag.BULLISH { background: rgba(16,185,129,0.15); color: #10b981; }
.regime-tag.BEARISH { background: rgba(239,68,68,0.15);  color: #ef4444; }
.regime-tag.SIDEWAYS{ background: rgba(245,158,11,0.15); color: #f59e0b; }
.regime-tag.UNKNOWN { background: var(--hover); color: var(--text-dim); }


/* ============================================================
   Analytics View Styles
   ============================================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 10px;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 2px solid var(--border);
    background: var(--bg-secondary);
}

.data-table td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--hover);
}

.data-table .mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.data-table .pnl-pos {
    color: #10b981;
    font-weight: 600;
}

.data-table .pnl-neg {
    color: #ef4444;
    font-weight: 600;
}

#view-analytics {
    display: none;
}

#view-analytics.active {
    display: block;
}

/* ─── Scalping tab ─── */
.scalp-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.scalp-chip {
  font-size: 11px; padding: 3px 9px; border-radius: var(--radius-sm);
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text2); white-space: nowrap;
}
.scalp-chip b { color: var(--text); font-weight: 600; }
.scalp-chip.chip-ok { color: var(--green); border-color: rgba(22,163,74,0.35); background: var(--green-dim); }
.scalp-chip.chip-ok b { color: var(--green); }
.scalp-chip.chip-bad { color: var(--red); border-color: rgba(220,38,38,0.3); background: var(--red-dim); }
.scalp-chip.chip-bad b { color: var(--red); }
.scalp-chip.chip-warn { color: var(--amber); border-color: rgba(217,119,6,0.35); background: var(--amber-dim); }
.scalp-chip.chip-warn b { color: var(--amber); }
.scalp-chip.chip-accent { color: var(--primary); border-color: rgba(0,102,255,0.3); background: var(--primary-dim); }
.scalp-chip.chip-accent b { color: var(--primary); }

.scalp-gate {
  margin-top: 12px; font-size: 12px; line-height: 1.5;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--amber-dim); color: var(--amber);
  border: 1px solid rgba(217,119,6,0.35);
}
.scalp-gate.ok { background: var(--green-dim); color: var(--green); border-color: rgba(22,163,74,0.35); }
.scalp-gate b { font-weight: 700; }

/* ═══════════════════════════════════════
   UX POLISH — light theme refinement
   (appended; overrides base rules)
═══════════════════════════════════════ */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface2: #f6f8fb;
  --border: rgba(15,23,42,0.06);
  --border2: rgba(15,23,42,0.11);
  --primary: #2563eb;
  --primary-dim: rgba(37,99,235,0.09);
  --shadow: 0 1px 2px rgba(15,23,42,0.05);
  --shadow-md: 0 6px 18px rgba(15,23,42,0.08);
  --radius: 12px;
}

body { background: var(--bg); }

/* Header — cleaner, softer */
.app-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border2);
  box-shadow: none;
}
.logo { font-size: 15px; letter-spacing: 1px; }
.hdr-btn {
  border-radius: 8px; padding: 6px 12px; font-weight: 600;
  transition: background .15s, box-shadow .15s, transform .1s;
}
.hdr-btn:active { transform: translateY(1px); }
.hdr-btn-primary { box-shadow: 0 2px 8px rgba(37,99,235,0.25); }

/* Sidebar — airier sections */
.sidebar { border-right: 1px solid var(--border2); }
.sb-block { padding: 16px 14px 14px; }
.sb-label { font-size: 10px; letter-spacing: 0.9px; color: var(--text3); }

/* Sidebar tabs — segmented control */
.sb-tabs { background: var(--surface2); border: 1px solid var(--border); padding: 3px; gap: 3px; }
.sb-tab { padding: 7px 4px; font-size: 11px; border-radius: 6px; }
.sb-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

/* Quick toggles — clearer rows */
.qt-row { padding: 8px 9px; border-radius: 8px; }
.qt-row:hover { background: var(--surface2); }
.qt-label { font-weight: 500; }

/* Main content — more breathing room now that the right rail is gone */
.main-content { padding: 20px 22px; gap: 16px; }
.view { gap: 16px; }

/* KPI cards — soft elevation, hover lift */
.kpi-row { gap: 12px; }
.kpi-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: box-shadow .18s, transform .18s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label { letter-spacing: 0.6px; }
.kpi-value { font-size: 21px; }

/* Panels — consistent radius + elevation */
.panel {
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.panel-header h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.2px; }
.panel-count { font-weight: 500; }
.panel-btn { border-radius: 7px; transition: background .15s; }

/* Pills/tabs — segmented */
.panel-tabs, .analytics-tabs { gap: 4px; }
.ptab {
  border-radius: 7px; font-weight: 600;
  transition: background .15s, color .15s, border-color .15s;
}
.ptab.active { background: var(--primary-dim); color: var(--primary); }

/* Buttons */
.sb-btn-primary { border-radius: 8px; box-shadow: 0 2px 8px rgba(37,99,235,0.22); }
.sb-btn-primary:hover { filter: brightness(0.94); }
.sb-btn-ghost { border-radius: 8px; }

/* Inputs — clearer focus state */
input[type="text"], input[type="number"], input[type="password"], select, textarea {
  border-radius: 8px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-dim);
  outline: none;
}
.signal-form textarea:focus { background: var(--surface); }

/* Lists & tables — row hover, calmer dividers */
.mini-item, .history-item, .alert-item, .hint-item {
  border-radius: 8px; transition: background .12s;
}
.mini-item:hover, .history-item:hover { background: var(--surface2); }

/* Empty states */
.empty-state { color: var(--text3); }
.empty-icon { opacity: 0.5; }

/* Scrollbars — slimmer, subtler */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.14); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,0.24); }

/* Live dot pulse */
.prices-live-dot { animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Focus visible — keyboard nav */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* Two-column row — use the freed width gracefully */
.two-col-row { gap: 16px; }

/* ═══════════════════════════════════════
   SIDEBAR NAV — vertical, larger targets
═══════════════════════════════════════ */
.sb-nav-block { padding: 10px 8px; }
.sb-tabs.sb-nav {
  flex-direction: column;
  background: transparent;
  border: none;
  padding: 0;
  gap: 2px;
}
.sb-tabs.sb-nav .sb-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  border-radius: 8px;
  color: var(--text2);
}
.sb-tabs.sb-nav .sb-tab .nav-ico {
  width: 20px;
  font-size: 14px;
  text-align: center;
  opacity: 0.75;
  flex-shrink: 0;
}
.sb-tabs.sb-nav .sb-tab:hover:not(.active) {
  background: var(--surface2);
  color: var(--text);
}
.sb-tabs.sb-nav .sb-tab.active {
  background: var(--primary-dim);
  color: var(--primary);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--primary);
}
.sb-tabs.sb-nav .sb-tab.active .nav-ico { opacity: 1; }

/* ═══════════════════════════════════════
   MODULE STATUS CARDS (Scalp / Grid)
═══════════════════════════════════════ */
.mod-status { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }

/* Stat tiles — replaces the chip walls */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}
.stat-tile {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  min-width: 0;
}
.stat-tile .st-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--text3); margin-bottom: 3px;
}
.stat-tile .st-value {
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat-tile.tile-accent .st-value { color: var(--primary); }
.stat-tile.tile-ok .st-value { color: var(--green); }
.stat-tile.tile-bad .st-value { color: var(--red); }
.stat-tile.tile-warn .st-value { color: var(--amber); }

/* Control bar — toggles left, danger right */
.ctl-bar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ctl-group { display: flex; gap: 8px; flex-wrap: wrap; }
.ctl-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border2); border-radius: 8px;
  background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.ctl-btn:hover { background: var(--surface2); }
.ctl-btn .ctl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); }
.ctl-btn.on { border-color: rgba(22,163,74,0.4); background: var(--green-dim); color: var(--green); }
.ctl-btn.on .ctl-dot { background: var(--green); }
.ctl-btn.off { color: var(--text3); }
.ctl-btn.ctl-danger { border-color: rgba(220,38,38,0.3); background: var(--red-dim); color: var(--red); }
.ctl-btn.ctl-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Notes — gate lines and symbol isolation */
.mod-notes { display: flex; flex-direction: column; gap: 6px; }
.gate-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; line-height: 1.5; padding: 9px 12px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text2);
}
.gate-line.ok { background: var(--green-dim); border-color: rgba(22,163,74,0.3); color: var(--green); }
.gate-line.bad { background: var(--red-dim); border-color: rgba(220,38,38,0.25); color: var(--red); }
.gate-line b { font-weight: 700; }

.iso-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.iso-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text3); margin-right: 4px;
}
.sym-pill {
  font-family: var(--mono); font-size: 11px; padding: 3px 9px;
  border-radius: 20px; border: 1px solid var(--border2);
  background: var(--surface); color: var(--text2); cursor: default;
}
.sym-pill.live {
  border-color: rgba(22,163,74,0.4); background: var(--green-dim);
  color: var(--green); font-weight: 700;
}
.sym-pill.paper { border-style: dashed; color: var(--text3); }

/* ═══════════════════════════════════════
   HEADER SYSTEM NAV (ALGOS/Accounts/Analytics)
═══════════════════════════════════════ */
.hdr-nav {
  display: flex; gap: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 3px;
}
.htab {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px; font-size: 11px; font-weight: 600;
  border: none; background: transparent; color: var(--text2);
  border-radius: 7px; cursor: pointer;
  transition: background .15s, color .15s;
}
.htab:hover { color: var(--text); background: var(--surface); }
.htab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }

@media (max-width: 800px) {
  .htab-lbl { display: none; }
  .htab { padding: 6px 9px; font-size: 14px; }
}

/* Strategy badges on position rows */
.strat-badge {
  display: inline-block; margin-top: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.4px;
  padding: 2px 7px; border-radius: 10px; text-transform: uppercase;
}
.strat-scalping { background: var(--amber-dim); color: var(--amber); }
.strat-grid { background: var(--primary-dim); color: var(--primary); }
.strat-trend { background: var(--green-dim); color: var(--green); }

/* Execution map strip (Monitor) — shows what each module actually executes */
.exec-strip {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 8px 12px; margin: 0 12px 10px;
  background: var(--bg2, #f6f7fb);
  border: 1px solid var(--border, #e5e8f0);
  border-radius: 10px;
}
.exec-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 8px;
  background: var(--card, #fff); border: 1px solid var(--border, #e5e8f0);
  font-size: 11px; cursor: default;
}
.exec-chip .em-ico { font-size: 13px; }
.exec-chip .em-name { font-weight: 700; }
.exec-chip .em-mode {
  font-size: 9px; font-weight: 800; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: 8px;
}
.exec-chip .em-detail { color: var(--text3, #8a90a5); font-size: 10px; }
.exec-chip.em-live .em-mode { background: var(--green-dim, #e4f8ec); color: var(--green, #16a34a); }
.exec-chip.em-paper .em-mode { background: var(--primary-dim, #e8edff); color: var(--primary, #4c6ef5); }
.exec-chip.em-off { opacity: 0.55; }
.exec-chip.em-off .em-mode { background: var(--red-dim, #fdeaea); color: var(--red, #dc2626); }

/* Per-position execution badge */
.exec-badge {
  display: inline-block; margin-top: 4px; margin-left: 4px;
  font-size: 9px; font-weight: 800; letter-spacing: 0.4px;
  padding: 2px 7px; border-radius: 10px;
}
.exec-live { background: var(--green-dim, #e4f8ec); color: var(--green, #16a34a); }
.exec-paper { background: var(--bg2, #eef0f6); color: var(--text3, #8a90a5); }

/* Watchlist — clear labeled cards */
.wl-hint { font-size: 10px; color: var(--text3, #8a90a5); line-height: 1.45; padding: 0 12px 8px; }
.wl-card { padding: 10px 12px; }
.wl-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.wl-sym { font-weight: 700; font-size: 12px; color: var(--primary); }
.wl-head .remove-btn { margin-left: auto; }
.wl-tag { font-size: 9px; font-weight: 800; letter-spacing: .4px; padding: 1px 6px; border-radius: 8px; }
.wl-live { background: var(--green-dim, #e4f8ec); color: var(--green, #16a34a); }
.wl-paper { background: var(--bg2, #eef0f6); color: var(--text3, #8a90a5); }
.wl-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.wl-row:last-child { margin-bottom: 0; }
.wl-label { font-size: 10px; color: var(--text3, #8a90a5); width: 62px; flex: none; }
.wl-row input { flex: 1; min-width: 0; font-size: 12px; }
.wl-set { width: 44px; flex: none; font-size: 11px; }

/* Watchlist card — merged live price header */
.wl-head { margin-bottom: 4px; }
.wl-px { font-size: 12px; font-weight: 700; }
.wl-px.up { color: var(--green, #16a34a); }
.wl-px.down { color: var(--red, #dc2626); }
.wl-chg { font-size: 10px; font-weight: 600; }
.wl-chg.up { color: var(--green, #16a34a); }
.wl-chg.down { color: var(--red, #dc2626); }
.wl-chg.flat { color: var(--text3, #8a90a5); }
.wl-spark { display: inline-flex; align-items: flex-end; margin-left: 2px; }
.wl-spark .price-bar { width: 34px; height: 14px; }
.wl-reg { min-height: 0; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.wl-reg:empty { display: none; }
.wl-unit { font-size: 10px; color: var(--text3, #8a90a5); flex: none; }
.wl-usd { font-size: 10px; color: var(--text3, #8a90a5); padding-left: 68px; margin-top: -2px; }
.wl-usd-empty { color: var(--amber, #d97706); }

/* Price-tick flash on the whole card */
.wl-card.flash-up { animation: flash-green 0.6s ease; }
.wl-card.flash-down { animation: flash-red 0.6s ease; }

/* Exec-map feed health indicators */
.em-ws { font-size: 10px; font-weight: 700; }
.em-ws-ok { color: var(--green, #16a34a); }
.em-ws-stale { color: var(--amber, #d97706); }
.em-ws-down { color: var(--red, #dc2626); }

/* Watchlist card — market line under head, tighter rows */
.wl-mkt {
  display: flex; align-items: center; gap: 8px;
  min-height: 16px; margin-bottom: 6px;
}
.wl-mkt .wl-spark { margin-left: auto; }
.wl-card .wl-label { width: 56px; }
.wl-card .wl-set { width: 38px; padding: 6px 0; }
.wl-card .wl-usd { padding-left: 62px; }

/* Watchlist — static sizing info line (risk-based mode) */
.wl-static { font-size: 12px; font-weight: 600; color: var(--primary); }
