/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:       #1e2025;
  --bg2:      #262830;
  --bg3:      #2e3038;
  --border:   #3a3d47;
  --text:     #ffffff;
  --muted:    #8b8fa8;
  --accent:   #38bdf8;
  --accent2:  #0ea5e9;
  --green:    #22c55e;
  --red:      #ef4444;
  --yellow:   #f59e0b;
  --radius:   8px;
  --sidebar:  220px;
  /* set live by app.js from dashboard config */
  --stat-size: 1.6rem;
}
html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; font-size: 14px; }
input, select, textarea { font-family: inherit; font-size: 14px; background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 8px 12px; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }
select option { background: var(--bg2); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--muted); }

/* === LAYOUT === */
#app { display: flex; height: 100vh; overflow: hidden; }

/* SIDEBAR */
#sidebar {
  width: var(--sidebar); min-width: var(--sidebar);
  background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
  padding: 16px 0; gap: 2px; z-index: 10;
}
.sidebar-logo {
  padding: 4px 16px 16px; font-size: 13px; font-weight: 700; color: var(--accent);
  letter-spacing: .5px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.sidebar-logo span { display: block; font-size: 10px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.sidebar-note { font-size: 11px; color: var(--muted); margin-top: 8px; cursor: pointer; border-radius: 4px; padding: 3px 0; line-height: 1.4; transition: color .15s; }
.sidebar-note:hover { color: var(--text); }
.sidebar-note-placeholder { opacity: .4; font-style: italic; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: var(--text);
  border-radius: 0; border: none; background: none; width: 100%;
  text-align: left; transition: all .15s; font-size: 13px;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--bg3); color: var(--accent); border-left-color: var(--accent); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-section { padding: 10px 16px 4px; font-size: 10px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }

/* MAIN CONTENT */
#main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.tab-pane { display: none; padding: 28px; flex: 1; }
.tab-pane.active { display: block; }
.page-header { margin-bottom: 24px; }
.page-header h1 { margin-bottom: 4px; }
.page-header p { color: var(--muted); font-size: 13px; }

/* === CARDS === */
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.card-sm { padding: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: none; font-weight: 500; transition: all .15s; }
.btn-primary { background: var(--accent); color: #0a0f1e; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg3); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: rgba(239,68,68,.1); }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ═══════════════════════════════════════════
   EXCEL-LIKE SPREADSHEET (Data tab)
═══════════════════════════════════════════ */

/* Toolbar */
.xls-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.scanner-import-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 4px;
  background: var(--bg2); border: 1px dashed var(--border);
  border-radius: var(--radius); cursor: default;
  transition: border-color .2s, background .2s;
}
.scanner-import-bar.drag-over {
  border-color: var(--accent); background: rgba(56,189,248,.06);
}

.xls-search-wrap {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
}

/* Scrollable grid container */
/* Formula bar */
.xls-formula-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
}
.xls-fx-label {
  font-size: 13px; color: var(--accent); font-style: italic;
  font-weight: 700; flex-shrink: 0; width: 18px; text-align: center;
}
.xls-formula-input {
  flex: 1; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 8px; font-size: 13px;
  color: var(--text); font-family: 'Courier New', monospace;
  outline: none;
}
.xls-formula-input:focus { border-color: var(--accent); }

.xls-wrap {
  overflow-x: auto; overflow-y: auto;
  max-height: calc(100vh - 210px);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Table */
.xls-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
  table-layout: auto;
}

/* ── Header row ── */
.xls-table thead { position: sticky; top: 0; z-index: 20; }
.xls-corner {
  background: var(--bg3); border: 1px solid var(--border);
  width: 42px; min-width: 42px;
}
.xls-col-hdr {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 5px 10px;
  font-size: 12px; font-weight: 700;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  min-width: 90px;
  letter-spacing: .3px;
}
.xls-col-hdr:hover { background: var(--bg3); color: var(--accent); }
.xls-sort-arrow { margin-left: 4px; font-size: 9px; color: var(--accent); }
.xls-add-col-btn {
  background: var(--bg2); border: 1px solid var(--border);
  width: 32px; min-width: 32px; text-align: center;
  cursor: pointer; color: var(--muted); font-size: 16px;
  font-weight: 700; padding: 4px;
}
.xls-add-col-btn:hover { color: var(--accent); background: var(--bg3); }
.xls-del-hdr {
  background: var(--bg2); border: 1px solid var(--border);
  width: 28px; min-width: 28px;
}

/* ── Data rows ── */
.xls-row { background: var(--card); }
.xls-row:nth-child(even) { background: var(--bg); }
.xls-row:hover { background: rgba(56,189,248,.04) !important; }
.xls-row-active { background: rgba(56,189,248,.07) !important; }

/* Row number column */
.xls-row-num {
  background: var(--bg2); border: 1px solid var(--border);
  width: 42px; min-width: 42px;
  text-align: right; padding: 0 8px 0 4px;
  font-size: 11px; color: var(--muted);
  user-select: none; white-space: nowrap;
  position: sticky; left: 0; z-index: 5;
}
.xls-row-num-empty { color: var(--border); }

/* Data cells */
.xls-cell {
  padding: 0; border: 1px solid var(--border);
  min-width: 90px;
}
.xls-input {
  border: none; background: transparent;
  width: 100%; min-width: 80px;
  padding: 5px 8px; font-size: 13px;
  color: var(--text); font-family: inherit;
  outline: none; cursor: default;
  box-sizing: border-box;
}
.xls-input:focus {
  background: rgba(56,189,248,.09);
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  cursor: text; z-index: 1; position: relative;
}
.xls-empty-input { color: transparent; }
.xls-empty-input:focus { color: var(--text); }
.xls-empty-row .xls-row-num { color: var(--border); }

/* Delete column */
.xls-del-col {
  width: 28px; min-width: 28px;
  border: 1px solid var(--border);
  text-align: center; padding: 0;
  background: transparent;
}
.xls-del-btn {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 14px;
  padding: 4px 5px; line-height: 1; opacity: 0;
}
.xls-row:hover .xls-del-btn { opacity: .5; }
.xls-del-btn:hover { color: var(--red); opacity: 1 !important; }

/* ── Sheet tabs (bottom) ── */
.xls-tabs-row {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--bg2); overflow-x: auto;
  padding: 0 4px;
}
.xls-sheet-tab {
  padding: 7px 16px; border: none; border-top: 2px solid transparent;
  background: none; color: var(--muted); font-size: 12px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.xls-sheet-tab:hover { color: var(--text); }
.xls-sheet-tab.active {
  color: var(--accent); border-top-color: var(--accent);
  background: var(--card);
}
.xls-add-sheet {
  color: var(--muted); font-size: 12px; padding: 7px 12px;
}
.xls-add-sheet:hover { color: var(--accent); }

/* === FORM === */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }

/* === TABLE === */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th { background: var(--bg3); padding: 10px 12px; text-align: left; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); white-space: nowrap; cursor: pointer; user-select: none; }
th:hover { color: var(--text); }
td { padding: 9px 12px; border-top: 1px solid var(--border); white-space: nowrap; font-size: 13px; }
tr:hover td { background: var(--bg3); }
.col-sticky { position: sticky; left: 0; background: var(--bg2); z-index: 1; }
tr:hover .col-sticky { background: var(--bg3); }
.col-sticky-2 { position: sticky; left: 80px; background: var(--bg2); z-index: 1; }
tr:hover .col-sticky-2 { background: var(--bg3); }

/* === BADGES === */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-blue { background: rgba(56,189,248,.15); color: var(--accent); }
.badge-green { background: rgba(34,197,94,.15); color: var(--green); }
.badge-red { background: rgba(239,68,68,.15); color: var(--red); }
.badge-yellow { background: rgba(245,158,11,.15); color: var(--yellow); }
.badge-muted { background: var(--bg3); color: var(--muted); }

/* === PROGRESS BAR === */
.progress-wrap { background: var(--bg3); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 20px; background: var(--accent); transition: width .4s; }
.progress-bar.green { background: var(--green); }
.progress-bar.red { background: var(--red); }

/* === FILTER BAR === */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 16px; }
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-group label { font-size: 11px; color: var(--muted); }

/* === TRADE CARDS === */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.trade-card { background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid transparent; border-radius: var(--radius); padding: 16px; position: relative; }
.trade-card.win  { border-left-color: var(--green); }
.trade-card.loss { border-left-color: var(--red); }
.trade-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.trade-ticker { font-size: 18px; font-weight: 700; }
.trade-pnl { font-size: 18px; font-weight: 700; }
.trade-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 12px; color: var(--muted); }
.trade-meta span { display: flex; gap: 4px; }
.trade-meta strong { color: var(--text); }
.trade-card-footer { margin-top: 10px; display: flex; gap: 6px; align-items: center; }
.trade-notes { font-size: 12px; color: var(--muted); font-style: italic; background: var(--bg3); border-radius: 6px; padding: 6px 8px; margin-top: 8px; line-height: 1.5; }

/* Grade badges */
.badge-grade-a { background: rgba(34,197,94,.2);  color: var(--green); }
.badge-grade-b { background: rgba(56,189,248,.2); color: var(--accent); }
.badge-grade-c { background: rgba(245,158,11,.2); color: var(--yellow); }
.badge-grade-d { background: rgba(239,68,68,.2);  color: var(--red); }

/* Form section labels */
.form-section-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 2px; grid-column: 1/-1; border-bottom: 1px solid var(--border); padding-bottom: 6px; }

/* Trade journal summary strip */
.tj-summary { display: flex; gap: 24px; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.tj-summary-item { display: flex; flex-direction: column; gap: 2px; }
.tj-summary-item label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tj-summary-item strong { font-size: 16px; font-weight: 700; }

/* Trade journal edit modal */
.tj-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.tj-modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: min(700px, 95vw); max-height: 90vh; overflow-y: auto; position: relative; }
.tj-modal h2 { margin-bottom: 16px; }
.tj-modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 20px; color: var(--muted); cursor: pointer; line-height: 1; }
.tj-modal-close:hover { color: var(--text); }

/* === CALENDAR === */
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr) 100px; gap: 4px; }
.cal-day-header { text-align: center; font-size: 11px; color: var(--muted); padding: 6px; font-weight: 600; text-transform: uppercase; }
.cal-cell {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; min-height: 80px; font-size: 12px; cursor: default;
  display: flex; flex-direction: column; gap: 3px;
}
.cal-cell.other-month { opacity: .3; }
.cal-cell.today { border-color: var(--accent); }
.cal-cell.has-trades:hover { border-color: var(--muted); }
.cal-date { font-size: 11px; color: var(--muted); font-weight: 600; }
.cal-pnl { font-weight: 700; font-size: 13px; }
.cal-count { font-size: 10px; color: var(--muted); }
.cal-dots { display: flex; gap: 3px; align-items: center; }
.cal-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cal-flag { font-size: 11px; }
.cal-img-badge { font-size: 10px; color: var(--muted); margin-top: 3px; line-height: 1.3; }

/* Calendar day detail modal */
.cal-day-modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: min(640px, 95vw); max-height: 88vh; overflow-y: auto; position: relative; }

/* Screenshot gallery */
.cal-screenshot-gallery { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.cal-screenshot-thumb { position: relative; width: 160px; flex-shrink: 0; }
.cal-screenshot-thumb img { width: 160px; height: 100px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); display: block; transition: opacity .15s; }
.cal-screenshot-thumb img:hover { opacity: .85; }
.cal-screenshot-caption { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-screenshot-delete { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.7); border: none; color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; cursor: pointer; display: none; line-height: 20px; text-align: center; padding: 0; }
.cal-screenshot-thumb:hover .cal-screenshot-delete { display: block; }
.cal-upload-btn { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 18px; font-size: 12px; color: var(--muted); cursor: pointer; background: none; font-family: 'Inter', sans-serif; transition: all .15s; }
.cal-upload-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Screenshot lightbox */
.cal-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 2000; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; cursor: pointer; }
.cal-lightbox img { max-width: 90vw; max-height: 80vh; border-radius: 8px; object-fit: contain; }
.cal-lightbox-caption { color: rgba(255,255,255,.8); font-size: 14px; }

.cal-week-total { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-height: 80px; font-size: 12px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.cal-week-label { font-size: 10px; color: var(--muted); }

/* === GOALS === */
.goal-row { display: flex; flex-direction: column; gap: 8px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.goal-row:last-child { border-bottom: none; }
.goal-top { display: flex; justify-content: space-between; align-items: center; }
.goal-name { font-weight: 600; }
.goal-amounts { display: flex; gap: 12px; font-size: 13px; }

/* === ANALYTICS === */
.analytics-section { margin-bottom: 32px; }
.analytics-section h2 { margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.chart-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.an-section-header { display: flex; justify-content: space-between; align-items: center;
                     margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.an-section-header h2 { margin: 0; border: none; padding: 0; }
/* ── Dashboard clock ── */
.dash-clock { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.dash-clock-time { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1; }
.dash-clock-tz { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.an-streak-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.an-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; cursor: default; }
.an-dot.win     { background: var(--green); }
.an-dot.loss    { background: var(--red); }
.an-dot.scratch { background: var(--border); }

/* Variable Correlation Widget */
.an-corr-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.an-corr-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.an-corr-field-name { font-weight: 600; font-size: 14px; }
.an-corr-badge { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.an-corr-r { font-size: 12px; color: var(--muted); font-family: monospace; }
.an-corr-sample { font-size: 11px; color: var(--muted); margin-left: auto; }
.an-sweet-row { background: rgba(34,197,94,.06); }
.an-sweet-badge { background: rgba(34,197,94,.15); color: #22c55e; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }

/* Multi-Variable Edge Scanner */
.mv-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.mv-filter-row:last-child { border-bottom: none; }
.mv-filter-row .filter-input { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 6px 10px; font-size: 13px; min-width: 130px; }
.mv-filter-row .filter-input:focus { outline: none; border-color: var(--accent); }
.mv-value-inputs { display: flex; gap: 6px; flex-wrap: wrap; }
.mv-value-inputs .filter-input { min-width: 100px; }
.mv-results-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mv-results-header { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 0; background: var(--bg3); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.mv-results-row { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--bg2); }
.mv-results-footer { background: var(--bg3); border-bottom: none; }
.mv-col-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; }
.mv-col-all, .mv-col-match { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mv-col-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.mv-col-sub { font-size: 11px; color: var(--muted); }
.mv-delta { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 8px; }
.mv-delta-pos { background: rgba(34,197,94,.12); color: #22c55e; }
.mv-delta-neg { background: rgba(239,68,68,.12); color: #ef4444; }

/* ── Research Data Tab ── */
.data-tabs-row { display:flex; gap:6px; flex-wrap:wrap; margin-bottom:14px; align-items:center; }
.data-sheet-tab { background:var(--bg2); border:1px solid var(--border); border-radius:6px; padding:6px 14px; font-size:13px; cursor:pointer; color:var(--muted); transition:all .15s; display:flex; align-items:center; gap:8px; }
.data-sheet-tab:hover { border-color:var(--accent); color:var(--text); }
.data-sheet-tab.active { background:var(--accent); border-color:var(--accent); color:#fff; font-weight:600; }
.data-sheet-tab-x { opacity:.6; font-size:15px; line-height:1; padding:0 2px; }
.data-sheet-tab-x:hover { opacity:1; }
.data-sheet-tab.active .data-sheet-tab-x { color:#fff; }
.data-add-tab { border-style:dashed; }
.data-add-tab:hover { border-color:var(--accent); color:var(--accent); }
.data-dataset-bar { display:flex; align-items:center; justify-content:space-between; gap:16px; background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius); padding:14px 18px; margin-bottom:14px; flex-wrap:wrap; }
.data-dataset-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.data-chips { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.data-chip { background:var(--bg2); border:1px solid var(--border); border-radius:20px; padding:6px 14px; font-size:12px; cursor:pointer; color:var(--muted); transition:all .15s; white-space:nowrap; }
.data-chip:hover { border-color:var(--accent); color:var(--accent); background:rgba(56,189,248,.06); }
.data-table { width:100%; border-collapse:collapse; font-size:13px; }
.data-table th { background:var(--bg3); padding:8px 12px; text-align:left; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); border-bottom:1px solid var(--border); user-select:none; white-space:nowrap; cursor:pointer; }
.data-table th:hover { color:var(--text); }
.data-table td { padding:7px 12px; border-bottom:1px solid var(--border); white-space:nowrap; max-width:220px; overflow:hidden; text-overflow:ellipsis; }
.data-table tr:hover td { background:var(--bg3); }
.data-upload-zone { border:2px dashed var(--border); border-radius:var(--radius); padding:64px 40px; text-align:center; cursor:pointer; transition:border-color .2s,background .2s; font-size:16px; color:var(--muted); margin-bottom:20px; }
.data-upload-zone:hover, .data-upload-zone.drag-over { border-color:var(--accent); background:rgba(56,189,248,.04); color:var(--text); }
.data-upload-zone span { font-size:12px; display:block; margin-top:8px; }
.data-empty-hints { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius); padding:18px 22px; }
.data-empty-hints h4 { font-size:11px; font-weight:700; color:var(--muted); margin-bottom:10px; text-transform:uppercase; letter-spacing:.05em; }
.data-empty-hints li { font-size:13px; color:var(--muted); margin-bottom:6px; line-height:1.5; }

/* Trade Review Bar */
.tj-review-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.tj-grade-pills { display: flex; gap: 4px; }
.tj-grade-pill { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 700; cursor: pointer; color: var(--muted); transition: all .15s; }
.tj-grade-pill:hover { border-color: var(--accent); color: var(--accent); }
.tj-emotion-select { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; color: var(--text); padding: 3px 8px; font-size: 11px; cursor: pointer; }
.tj-rules-btn { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 3px 10px; font-size: 11px; cursor: pointer; color: var(--muted); transition: all .15s; white-space: nowrap; }
.tj-rules-btn.rules-yes { background: rgba(34,197,94,.1);  color: #22c55e; border-color: #22c55e; }
.tj-rules-btn.rules-no  { background: rgba(239,68,68,.1);  color: #ef4444; border-color: #ef4444; }
.tj-rules-btn:not(.rules-yes):not(.rules-no):hover { border-color: var(--accent); color: var(--accent); }

/* === RISK MANAGER === */
.rm-edge-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.rm-edge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 14px; }
.rm-edge-stat { display: flex; flex-direction: column; gap: 3px; }
.rm-edge-stat label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rm-edge-stat strong { font-size: 18px; font-weight: 700; }
.rm-confidence { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 12px; border-radius: 20px; font-weight: 600; margin-top: 12px; }
.rm-confidence.reliable     { background: rgba(34,197,94,.12);  color: #22c55e; }
.rm-confidence.emerging     { background: rgba(245,158,11,.12); color: #f59e0b; }
.rm-confidence.insufficient { background: rgba(239,68,68,.1);   color: #ef4444; }
.rm-strat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.rm-strat-card { background: var(--bg2); border: 2px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: all .15s; position: relative; }
.rm-strat-card:hover { border-color: var(--accent); }
.rm-strat-active { border-color: var(--accent) !important; background: rgba(56,189,248,.05); }
.rm-strat-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.rm-strat-tagline { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.4; }
.rm-strat-bet { font-size: 22px; font-weight: 700; color: var(--accent); }
.rm-strat-bet-label { font-size: 11px; color: var(--muted); }
.rm-recommended { position: absolute; top: 12px; right: 12px; background: rgba(34,197,94,.15); color: #22c55e; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .04em; }
.rm-config-panel { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; }
.rm-next-trade { background: var(--bg2); border: 1px solid var(--accent); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.rm-next-amount { font-size: 28px; font-weight: 800; color: var(--accent); }
.rm-hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.rm-sim-controls { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; background: var(--bg3); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.rm-sim-ctrl-group { display: flex; flex-direction: column; }

/* === PLAYBOOK === */
.playbook-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.playbook-card-header { padding: 14px 16px; background: var(--bg3); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.playbook-card-body { padding: 20px; display: none; }
.playbook-card-body.open { display: block; }
.playbook-stats { display: flex; gap: 20px; margin-bottom: 16px; }
.playbook-stat { display: flex; flex-direction: column; gap: 2px; }
.playbook-stat-label { font-size: 11px; color: var(--muted); }
.playbook-stat-val { font-size: 18px; font-weight: 700; }

/* Playbook tabs */
.pb-tab-btn { background: none; border: none; border-bottom: 2px solid transparent;
              padding: 6px 14px; font-size: 13px; color: var(--muted); cursor: pointer; }
.pb-tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

/* Image gallery */
.pb-gallery { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pb-thumb { position: relative; width: 140px; flex-shrink: 0; }
.pb-thumb img { width: 140px; height: 90px; object-fit: cover; border-radius: 6px;
                cursor: pointer; border: 1px solid var(--border); display: block; }
.pb-thumb-caption { font-size: 11px; color: var(--muted); margin-top: 4px;
                    text-align: center; line-height: 1.3; word-break: break-word; }
.pb-thumb-delete { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.7);
                   border: none; color: #fff; border-radius: 50%; width: 20px; height: 20px;
                   font-size: 11px; cursor: pointer; display: none;
                   line-height: 20px; text-align: center; padding: 0; }
.pb-thumb:hover .pb-thumb-delete { display: block; }

/* Add image form */
.pb-add-img-form { background: var(--bg3); border-radius: var(--radius); padding: 14px; margin-top: 10px; }
.or-divider { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0; }

/* Lightbox */
.pb-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 2000;
               display: flex; align-items: center; justify-content: center;
               flex-direction: column; gap: 14px; cursor: pointer; }
.pb-lightbox img { max-width: 90vw; max-height: 80vh; border-radius: 8px; object-fit: contain; }
.pb-lightbox-caption { color: rgba(255,255,255,.8); font-size: 14px; }

/* Setup add/rename modal */
.pb-modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
            padding: 24px; width: min(540px, 95vw); max-height: 90vh;
            overflow-y: auto; position: relative; }

/* === QUANT / AI CHAT === */
.quant-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; height: calc(100vh - 160px); }
.quant-chat { display: flex; flex-direction: column; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px 18px; display: flex; flex-direction: column; gap: 20px; }

/* User message — right-aligned pill */
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #0a0f1e;
  padding: 9px 16px;
  border-radius: 20px 20px 5px 20px;
  max-width: 72%;
  font-size: 13px;
  line-height: 1.6;
  word-wrap: break-word;
}

/* AI message — avatar + body */
.chat-msg.assistant {
  align-self: flex-start;
  display: flex;
  gap: 10px;
  max-width: 100%;
  width: 100%;
  font-size: 13px;
  line-height: 1.65;
}
.chat-msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #0ea5e9 100%);
  color: #0a0f1e;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.chat-msg-body { flex: 1; min-width: 0; }

/* System / greeting message — centered pill */
.chat-msg.system {
  align-self: center;
  background: var(--bg3);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 18px;
  border-radius: 20px;
  max-width: 88%;
  text-align: center;
}

/* Input bar */
.chat-input-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}
.chat-input-row input {
  flex: 1; border-radius: 24px;
  padding: 9px 16px; font-size: 13px;
  background: var(--bg3); border: 1px solid transparent;
  transition: border-color .15s;
}
.chat-input-row input:focus { border-color: rgba(56,189,248,.5); outline: none; }

/* Circular send button */
.chat-send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #0a0f1e;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: opacity .15s, transform .1s;
}
.chat-send-btn:hover { opacity: .85; transform: scale(1.07); }
.chat-send-btn:disabled { opacity: .3; cursor: default; transform: none; }

/* Typing indicator — three bouncing dots */
.chat-typing { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); display: inline-block;
  animation: chatBounce .9s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .17s; }
.chat-typing span:nth-child(3) { animation-delay: .34s; }
@keyframes chatBounce {
  0%, 80%, 100% { transform: translateY(0);    opacity: .35; }
  40%           { transform: translateY(-5px); opacity: 1;   }
}

.quant-sidebar { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.insight-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.insight-card h3 { font-size: 13px; margin-bottom: 8px; }
.insight-value { font-size: 22px; font-weight: 700; color: var(--accent); }
.insight-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* === QUANT MARKDOWN REPORT STYLES === */
.quant-md-h2 { font-size: 16px; font-weight: 700; margin: 16px 0 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border); color: var(--text); }
.quant-md-h3 { font-size: 13px; font-weight: 700; margin: 13px 0 5px; color: var(--text); }
.quant-md-h4 { font-size: 13px; font-weight: 600; margin: 10px 0 4px; color: var(--text); }
.quant-md-code { font-family: monospace; font-size: 12px; background: var(--bg3); border-radius: 3px; padding: 1px 5px; color: var(--accent); }
.quant-md-list { margin: 6px 0 10px 16px; padding: 0; }
.quant-md-list li { font-size: 13px; margin-bottom: 5px; line-height: 1.55; }
.quant-table-wrap { overflow-x: auto; margin: 10px 0 14px; border-radius: var(--radius); border: 1px solid var(--border); }
.quant-md-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.quant-md-table th { background: var(--bg3); font-weight: 600; text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.quant-md-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.quant-md-table tr:last-child td { border-bottom: none; }
.quant-md-table tr:hover td { background: var(--bg3); }
.chat-msg-body p { margin: 4px 0 8px; }
.chat-msg-body p:first-child { margin-top: 0; }
.chat-msg-body p:last-child  { margin-bottom: 0; }

/* === BACKTEST === */
.backtest-results { background: var(--bg3); border-radius: var(--radius); padding: 16px; margin-top: 14px; display: none; }
.backtest-results.show { display: block; }
.backtest-stat-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.backtest-stat-row:last-child { border-bottom: none; }

/* === RISK CALCULATOR WIDGET === */
#risk-calc-btn {
  position: fixed; bottom: 24px; right: 88px; z-index: 9000;
  background: var(--bg2); color: var(--accent);
  border: 1px solid var(--border); border-radius: 50%; width: 52px; height: 52px;
  font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.45);
  cursor: pointer; transition: transform .15s, background .2s;
}
#risk-calc-btn:hover { background: var(--bg3); transform: scale(1.08); }
#risk-calc-panel {
  position: fixed; bottom: 88px; right: 88px; z-index: 9001;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; width: 320px; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  display: none;
}
#risk-calc-panel.open { display: block; }
.calc-tabs { display: flex; gap: 4px; margin-bottom: 14px; background: var(--bg3); padding: 4px; border-radius: 6px; }
.calc-tab { flex: 1; padding: 6px; text-align: center; border-radius: 4px; border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.calc-tab.active { background: var(--bg2); color: var(--text); }
.calc-mode { display: none; }
.calc-mode.active { display: block; }
.calc-result { margin-top: 12px; background: var(--bg3); border-radius: var(--radius); padding: 12px; text-align: center; }
.calc-result .big { font-size: 32px; font-weight: 700; color: var(--accent); }
.calc-result .label { font-size: 12px; color: var(--muted); }
.calc-warning { margin-top: 8px; padding: 8px 12px; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); border-radius: var(--radius); font-size: 12px; color: var(--yellow); display: none; }
.calc-warning.show { display: block; }

/* === WATCHLIST / CHECKLIST === */
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg3); border-radius: var(--radius); border: 1px solid var(--border); }
.checklist-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.checklist-item label { color: var(--text); cursor: pointer; margin: 0; font-size: 14px; flex: 1; }
.checklist-item.checked label { color: var(--muted); text-decoration: line-through; }
.checklist-progress { background: var(--bg3); border-radius: 20px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; font-size: 13px; }

/* === TIME FILTERS === */
.time-filters { display: flex; gap: 6px; margin-bottom: 20px; }
.tf-btn { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.tf-btn:hover { border-color: var(--accent); color: var(--accent); }
.tf-btn.active { background: var(--accent); color: #0a0f1e; border-color: var(--accent); }

/* === SETUP DROPDOWN COLOR === */
.setup-absorption-candle-closure { color: var(--accent); }
.setup-absorption-failed-expansion { color: #818cf8; }
.setup-rally-open { color: var(--green); }
.setup-rally-candle-closure { color: #34d399; }
.setup-rally-failed-expansion { color: var(--yellow); }

/* === SECTION DIVIDER === */
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; margin-top: 24px; }
.section-title:first-child { margin-top: 0; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* === API KEY PROMPT === */
.api-key-prompt { background: rgba(56,189,248,.05); border: 1px solid rgba(56,189,248,.2); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.api-key-prompt h3 { color: var(--accent); margin-bottom: 8px; }
.api-key-prompt p { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.api-key-row { display: flex; gap: 8px; }
.api-key-row input { flex: 1; }

/* === DAILY LOG === */
.daily-log-day { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.daily-log-header { padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; background: var(--bg2); }
.daily-log-header:hover { background: var(--bg3); }
.daily-log-body { padding: 16px; border-top: 1px solid var(--border); display: none; }
.daily-log-body.open { display: block; }
.dl-meta { display: flex; gap: 20px; font-size: 13px; }
.dl-meta span { display: flex; flex-direction: column; gap: 2px; }
.dl-meta label { font-size: 10px; color: var(--muted); text-transform: uppercase; }

/* ═══════════════════════════════════════════════
   DYNAMIC THEME — set by dashboard config via
   data-font and data-density on <html>
═══════════════════════════════════════════════ */

/* ── Font styles ── */
[data-font="rounded"] .card,
[data-font="rounded"] input,
[data-font="rounded"] select,
[data-font="rounded"] button,
[data-font="rounded"] .btn { border-radius: 14px; }

[data-font="classic"] h1,
[data-font="classic"] h2,
[data-font="classic"] h3 { letter-spacing: 0.3px; font-weight: 700; }

[data-font="classic"] body { font-family: 'Georgia', 'Times New Roman', serif; }

/* ── Dashboard density ── */

/* Focused — fewer, larger stats */
[data-density="focused"] { --stat-size: 2rem; }
[data-density="focused"] .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 20px; }
[data-density="focused"] .card { padding: 24px; }
[data-density="focused"] .stat-value { font-size: var(--stat-size); }

/* Balanced — default */
[data-density="balanced"] { --stat-size: 1.6rem; }

/* Data-heavy — max information, tighter layout */
[data-density="data-heavy"] { --stat-size: 1.1rem; }
[data-density="data-heavy"] .stats-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 10px; }
[data-density="data-heavy"] .card { padding: 12px 14px; }
[data-density="data-heavy"] .stat-value { font-size: var(--stat-size); }
[data-density="data-heavy"] body { font-size: 13px; }
[data-density="data-heavy"] h1 { font-size: 18px; }
[data-density="data-heavy"] h2 { font-size: 14px; }

/* ── Emoji / sidebar icon toggle ── */
body[data-emojis="off"] .nav-icon { display: none; }
/* Tighten nav item padding when icons are hidden so labels don't look orphaned */
body[data-emojis="off"] .nav-item { gap: 0; }
/* Also affects the stg-toggle track colour when emojis are on */
body[data-emojis="on"] #stg-emoji-toggle:checked ~ span { background: var(--accent); }

/* ── AI chat suggested-question chips ── */
.suggested-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); color: var(--text); }

/* ── Market Notes accordion ── */
.mn-accordion summary::-webkit-details-marker { display: none; }
.mn-accordion[open] summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: none; }
.mn-accordion summary:hover { background: var(--card-hover, var(--bg3)); }

/* ── Risk Calculator tab mode visibility ── */
.rc-mode { display: none; }
.rc-mode.active { display: block; }

/* ── Risk Calculator market-aware additions ── */
.rc-market-note {
  font-size: 12px; color: var(--muted); background: var(--bg3);
  border-radius: var(--radius); padding: 8px 12px; margin-top: 8px; line-height: 1.6;
}
.rc-lot-breakdown {
  display: none; grid-template-columns: repeat(3,1fr); gap: 8px;
  margin-bottom: 16px;
}
.rc-lot-breakdown > div {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 8px; text-align: center;
}
.rc-lot-breakdown .lot-val { font-size: 20px; font-weight: 700; color: var(--accent); }
.rc-lot-breakdown .lot-lbl {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; margin-top: 3px;
}

/* ── Settings toggle switch ── */
.stg-toggle { cursor: pointer; }
.stg-toggle input { display: none; }
.stg-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background .2s;
}
.stg-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  left: 3px;
  top: 3px;
  transition: transform .2s;
}
.stg-toggle input:checked + .stg-toggle-slider { background: var(--accent); }
.stg-toggle input:checked + .stg-toggle-slider::before { transform: translateX(18px); }

/* ── Settings colour swatches ── */
.stg-sw { transition: transform .1s; }
.stg-sw:hover { transform: scale(1.15); }

/* ════════════════════════════════════════════
   NAV DRAG-AND-DROP REORDER
════════════════════════════════════════════ */

/* Drag handle — permanently hidden */
.nav-drag-handle {
  display: none;
}

/* Section header when draggable */
.nav-section-drag {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: default;
}
.nav-section-drag[draggable="true"] { cursor: default; }

/* Dragging source — faded */
.nav-dragging { opacity: 0.35 !important; }

/* Drop target highlight */
.nav-drag-over {
  background: rgba(56,189,248,.1) !important;
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
  border-radius: var(--radius);
}

/* ════════════════════════════════════════════
   BROKER CONNECTIONS
════════════════════════════════════════════ */
.conn-broker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.broker-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .2s;
}
.broker-card:hover { border-color: var(--accent); }

.broker-card-header { display: flex; align-items: center; gap: 12px; }

.broker-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.broker-status { font-size: 11px; color: var(--muted); margin-top: 2px; }
.broker-status.connected { color: var(--green); }

/* CSV drop zone */
.conn-csv-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(56,189,248,.04);
}
.drop-zone.has-file { border-color: var(--green); }
.drop-zone input[type=file] { display: none; }

.drop-zone-icon { font-size: 28px; display: block; margin-bottom: 8px; }
.drop-zone-text { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.drop-zone-sub  { font-size: 11px; color: var(--muted); }

/* Toast notification */
.conn-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: var(--radius);
  z-index: 9999;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  transition: opacity .3s;
}

.conn-loading { color: var(--muted); font-size: 13px; padding: 12px 0; }

/* AI Performance Analysis */
.conn-analysis-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.conn-report-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 16px;
}

.conn-report-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

.conn-report-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: conn-spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

@keyframes conn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56,189,248,.4); }
  50%       { box-shadow: 0 0 0 6px rgba(56,189,248,0); }
}

.conn-report-body { line-height: 1.65; font-size: 13.5px; }

.conn-report-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin: 18px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.conn-report-heading:first-child { margin-top: 0; }

.conn-report-subheading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 12px 0 4px;
}

.conn-report-list {
  margin: 4px 0 8px 18px;
  color: var(--text);
}
.conn-report-list li { margin-bottom: 3px; }

.conn-report-p { margin: 6px 0; }

/* Analysis chat panel */
.conn-chat-panel {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.conn-chat-msgs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding-right: 4px;
}

.conn-chat-msg {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 92%;
}
.conn-chat-msg.user {
  background: rgba(56,189,248,.12);
  border: 1px solid rgba(56,189,248,.25);
  align-self: flex-end;
  color: var(--text);
}
.conn-chat-msg.assistant {
  background: var(--bg3);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: var(--text);
}

.conn-chat-input-row {
  display: flex;
  gap: 8px;
}
.conn-chat-input-row textarea {
  min-height: 42px;
  max-height: 120px;
  resize: none;
  flex: 1;
}
.conn-chat-input-row button {
  flex-shrink: 0;
  align-self: flex-end;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ════════════════════════════════════════════
   MOBILE RESPONSIVENESS
   768px — tablet / phone landscape
   480px — phone portrait
════════════════════════════════════════════ */

/* Hidden by default (desktop) */
.mobile-header { display: none; }
.nav-overlay   { display: none; }

@media (max-width: 768px) {

  /* ── Mobile top bar ── */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    z-index: 200;
    flex-shrink: 0;
  }
  .hamburger {
    background: none;
    border: none;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
    border-radius: 6px;
    transition: background .15s;
  }
  .hamburger:hover { background: var(--bg3); }
  .mobile-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: .3px;
  }

  /* ── Sidebar becomes a slide-in drawer ── */
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 240px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 300;
    padding-top: 60px; /* clear mobile header */
  }
  #sidebar.open { transform: translateX(0); }

  /* ── Dark overlay behind open sidebar ── */
  .nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
  }
  .nav-overlay.visible {
    opacity: 1;
    pointer-events: all;
  }

  /* ── Main content — full width + clear mobile header ── */
  #app { overflow: hidden; }
  #main { margin-top: 52px; }
  .tab-pane { padding: 16px; }

  /* ── Page headers ── */
  .page-header { margin-bottom: 16px; }
  .page-header h1 { font-size: 18px; }

  /* ── Stat grid — 2 columns on tablet ── */
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* ── Trade cards — single column ── */
  .cards-grid { grid-template-columns: 1fr !important; }

  /* ── Tables — horizontal scroll ── */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Forms — auto-collapse ── */
  .form-grid { grid-template-columns: 1fr !important; }

  /* ── Quant AI layout — stack chat above sidebar ── */
  .quant-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
  .quant-sidebar { max-height: 400px; }

  /* ── Calendar — horizontal scroll on small screens ── */
  .cal-grid { min-width: 560px; }
  .cal-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Risk Manager ── */
  .rm-strat-grid { grid-template-columns: 1fr !important; }
  .rm-sim-controls { flex-direction: column; }
  .rm-next-trade { flex-direction: column; gap: 8px; }
  .rm-edge-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* ── Data tab ── */
  .data-dataset-bar { flex-direction: column; align-items: flex-start; }
  .data-dataset-actions { flex-wrap: wrap; }
  .data-chips { gap: 6px; }

  /* ── Settings ── */
  .stg-grid-2 { grid-template-columns: 1fr !important; }

  /* ── Connections ── */
  .conn-broker-grid { grid-template-columns: 1fr !important; }

  /* ── Buttons — don't clip on small screens ── */
  .btn { white-space: nowrap; }
  .page-header > div:last-child { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 480px) {
  .tab-pane { padding: 12px; }
  .stat-grid { grid-template-columns: 1fr !important; }
  .page-header h1 { font-size: 16px; }
  .data-dataset-actions .btn { font-size: 12px; padding: 6px 10px; }
  .rm-strat-bet { font-size: 18px; }
  .quant-layout { gap: 12px; }
}
