/* =============================================================
   ANALYTICS PAGE
   ============================================================= */

   .analytics-page {
    max-width: 1440px;
    margin: 0 auto;
    font-family: 'Inter', system-ui, sans-serif;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
  }
  
  .analytics-page .kpi-value,
  .data-table td {
    font-variant-numeric: tabular-nums;
  }
  
  .positive { color: #059669 !important; }
  .negative { color: #dc2626 !important; }
  .muted    { color: #94a3b8; }
  
  .dot-sep { color: #cbd5e1; margin: 0 6px; }
  
  /* ============ HEADER ============ */
  .analytics-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
  }
  .analytics-header h1 {
    margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -0.025em;
  }
  .analytics-header p { margin: 0; font-size: 14px; color: #64748b; }
  
  .header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  
  .range-presets {
    display: inline-flex; background: #f1f5f9; border-radius: 9px; padding: 3px; gap: 1px;
  }
  .range-btn {
    padding: 7px 12px; border-radius: 7px; font-size: 12px; font-weight: 700;
    color: #64748b; text-decoration: none; transition: all 0.15s; letter-spacing: 0.3px;
  }
  .range-btn:hover { color: #0f172a; }
  .range-btn.active { background: white; color: #0f172a; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
  
  .date-range-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 14px; background: white; border: 1px solid #e2e8f0;
    border-radius: 9px; font-size: 13px; font-weight: 600;
  }
  .btn-primary-export {
    display: inline-flex; align-items: center; gap: 8px;
    background: #0f172a; color: white; padding: 10px 16px;
    border-radius: 9px; font-size: 13px; font-weight: 700;
    text-decoration: none; transition: all 0.15s;
  }
  .btn-primary-export:hover { background: #1e293b; }
  
  /* ============ KPI ROW (auto-fit — 8 across on wide, wraps cleanly) ============ */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 10px; margin-bottom: 12px;
  }
  
  .kpi-card {
    background: white; border: 1px solid #eaeef3; border-radius: 14px;
    padding: 14px 16px 12px;
    display: flex; flex-direction: column; gap: 4px;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .kpi-card:hover { border-color: #d8e0ea; box-shadow: 0 4px 14px rgba(15,23,42,0.04); }
  
  .kpi-top { display: flex; justify-content: space-between; align-items: center; }
  
  .kpi-label {
    font-size: 11px; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.5px;
  }
  .kpi-icon {
    width: 26px; height: 26px; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 800; flex-shrink: 0;
  }
  .kpi-icon.green  { background: #ecfdf5; color: #059669; }
  .kpi-icon.blue   { background: #eff6ff; color: #2563eb; }
  .kpi-icon.purple { background: #f5f3ff; color: #7c3aed; }
  .kpi-icon.orange { background: #fff7ed; color: #ea580c; }
  .kpi-icon.teal   { background: #f0fdfa; color: #0d9488; }
  .kpi-icon.red    { background: #fef2f2; color: #dc2626; }
  
  .kpi-value {
    font-size: 22px; font-weight: 800; color: #0f172a;
    letter-spacing: -0.02em; line-height: 1.15;
    word-break: break-word; margin-top: 2px;
  }
  .kpi-value.positive { color: #059669; }
  .kpi-value.negative { color: #dc2626; }
  .kpi-unit { font-size: 15px; font-weight: 700; color: inherit; margin-left: 1px; }
  
  .kpi-sub { font-size: 11px; color: #94a3b8; font-weight: 600; }
  
  .kpi-change { font-size: 11.5px; font-weight: 700; letter-spacing: 0.1px; }
  .kpi-change.positive { color: #059669; }
  .kpi-change.negative { color: #dc2626; }
  
  .pf-mini-bar {
    display: flex; height: 4px; border-radius: 2px; overflow: hidden;
    background: #f1f5f9; margin-top: 4px;
  }
  .pf-mini-fill { height: 100%; }
  .pf-mini-fill.profit { background: #10b981; }
  .pf-mini-fill.loss   { background: #ef4444; }
  
  /* ============ GRIDS ============ */
  .analytics-grid {
    display: grid; grid-template-columns: 2fr 1fr; gap: 12px; margin-bottom: 12px;
  }
  .analytics-grid-2 {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; margin-top: 12px;
  }
  .analytics-grid-3 {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 12px; margin-bottom: 12px;
  }
  
  /* ============ CHART CARD ============ */
  .chart-card {
    background: white; border: 1px solid #eaeef3; border-radius: 14px;
    padding: 18px 20px 16px; margin-bottom: 12px;
  }
  .chart-card h3 { font-size: 15px; font-weight: 700; color: #0f172a; margin: 0 0 4px; letter-spacing: -0.01em; }
  .chart-subtitle { font-size: 12.5px; color: #64748b; margin: 0 0 4px; font-weight: 500; }
  .chart-subtitle strong { font-weight: 700; color: inherit; }
  
  .chart-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
  }
  .chart-controls { display: flex; align-items: center; gap: 12px; }
  
  .legend-chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 700; color: #64748b;
  }
  .legend-chip::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%; background: #10b981;
  }
  .legend-chip.gray::before { background: #cbd5e1; }
  
  .pill-tag {
    font-size: 11px; font-weight: 700; color: #475569;
    background: #f1f5f9; padding: 4px 10px; border-radius: 6px;
  }
  
  .chart-lg     { height: 300px; }
  .chart-sm     { height: 92px; }
  .chart-radial { height: 215px; }
  .chart-md     { height: 250px; }
  
  .chart-divider { height: 1px; background: #f1f5f9; margin: 14px 0 10px; }
  .subhead-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
  .subhead {
    font-size: 10.5px; font-weight: 800; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.5px;
  }
  
  .empty-chart {
    padding: 40px 16px; text-align: center; color: #94a3b8;
    font-size: 13px; font-weight: 500;
  }
  
  /* ============ WIN RATE PANEL ============ */
  .prev-chip { text-align: center; font-size: 11px; color: #94a3b8; font-weight: 600; margin-top: -6px; }
  .prev-chip strong { color: #475569; }
  
  .stat-split {
    display: flex; flex-direction: column; gap: 10px;
    padding-top: 12px; margin-top: 6px;
    border-top: 1px solid #f1f5f9;
  }
  .stat-split-item { display: flex; align-items: center; gap: 10px; }
  .stat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .stat-dot.green { background: #10b981; }
  .stat-dot.red   { background: #ef4444; }
  .stat-dot.gray  { background: #94a3b8; }
  .stat-split-label {
    display: block; font-size: 10.5px; color: #94a3b8; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
  }
  .stat-split-item strong { font-size: 15px; font-weight: 800; color: #0f172a; }
  
  /* ============ EXPECTANCY EDGE ============ */
  .edge-block {
    border-top: 1px solid #f1f5f9; margin-top: 12px; padding-top: 12px;
    display: flex; flex-direction: column; gap: 8px;
  }
  .edge-title {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 10.5px; font-weight: 800; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.4px;
  }
  .edge-title strong { font-size: 13px; text-transform: none; letter-spacing: 0; }
  .edge-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
  .edge-fill { height: 100%; }
  .edge-fill.win  { background: #10b981; }
  .edge-fill.loss { background: #fca5a5; }
  .edge-legend {
    display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
    font-size: 11px; color: #64748b; font-weight: 600;
  }
  .edge-legend i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 5px; }
  .edge-legend i.g { background: #10b981; }
  .edge-legend i.r { background: #fca5a5; }
  
  /* ============ P&L CALENDAR ============ */
  .cal-wrap { display: flex; gap: 6px; }
  .cal-days {
    display: grid; grid-template-rows: repeat(7, 13px); gap: 3px;
    padding-top: 17px; flex: none;
  }
  .cal-days span {
    font-size: 8.5px; color: #94a3b8; line-height: 13px;
    text-align: right; width: 14px;
  }
  .cal-scroll { flex: 1; overflow-x: auto; padding-bottom: 4px; }
  .cal-months { display: flex; gap: 3px; height: 13px; margin-bottom: 4px; }
  .cal-months span {
    width: 13px; font-size: 9px; color: #94a3b8;
    font-weight: 700; white-space: nowrap; overflow: visible;
  }
  .cal-heat {
    display: grid; grid-template-rows: repeat(7, 13px);
    grid-auto-flow: column; grid-auto-columns: 13px; gap: 3px;
  }
  .cal-cell {
    width: 13px; height: 13px; border-radius: 3px;
    background: #f1f5f9; flex: none;
  }
  .cal-cell.out  { background: transparent; }
  .cal-cell.zero { background: #f8fafc; }
  .cal-cell.pos.lvl-1 { background: #a7f3d0; }
  .cal-cell.pos.lvl-2 { background: #6ee7b7; }
  .cal-cell.pos.lvl-3 { background: #34d399; }
  .cal-cell.pos.lvl-4 { background: #059669; }
  .cal-cell.neg.lvl-1 { background: #fecaca; }
  .cal-cell.neg.lvl-2 { background: #fca5a5; }
  .cal-cell.neg.lvl-3 { background: #f87171; }
  .cal-cell.neg.lvl-4 { background: #dc2626; }
  .cal-cell-mini { width: 11px; height: 11px; }
  .cal-legend { display: inline-flex; align-items: center; gap: 3px; }
  .cal-leg-lbl { font-size: 10px; font-weight: 700; color: #94a3b8; margin: 0 3px; }
  
  /* ============ LONG/SHORT ============ */
  .side-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .side-col {
    background: #f8fafc; border-radius: 12px; padding: 14px;
    display: flex; flex-direction: column; gap: 12px;
  }
  .side-header { display: flex; justify-content: space-between; align-items: center; }
  .side-label { font-size: 12px; font-weight: 800; letter-spacing: 0.3px; }
  .side-label.long  { color: #059669; }
  .side-label.short { color: #dc2626; }
  .side-header strong { font-size: 15px; font-weight: 800; }
  .side-stats { display: flex; gap: 16px; }
  .side-stats > div { display: flex; flex-direction: column; gap: 2px; }
  .side-stats span { font-size: 10px; color: #94a3b8; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
  .side-stats strong { font-size: 13px; font-weight: 700; color: #0f172a; }
  .side-bar { height: 4px; background: #e2e8f0; border-radius: 2px; overflow: hidden; }
  .side-bar-fill { height: 100%; background: #10b981; border-radius: 2px; }
  .side-bar-fill.short { background: #ef4444; }
  
  /* ============ RECORDS ============ */
  .records-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .record {
    background: #f8fafc; border-radius: 10px; padding: 11px 13px;
    display: flex; flex-direction: column; gap: 4px;
  }
  .record-label {
    font-size: 10px; color: #94a3b8; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
  }
  .record strong { font-size: 14px; font-weight: 800; color: #0f172a; }
  
  /* ============ TABLES ============ */
  .table-wrap { overflow-x: auto; margin: 0 -8px; }
  .data-table { width: 100%; border-collapse: collapse; min-width: 640px; }
  .data-table thead th {
    text-align: left; padding: 10px 12px;
    font-size: 10.5px; font-weight: 700; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.4px;
    border-bottom: 1px solid #eaeef3;
    white-space: nowrap; user-select: none;
  }
  .data-table thead th[data-sort] { cursor: pointer; }
  .data-table thead th[data-sort]:hover { color: #0f172a; }
  .data-table thead th[data-sort]::after {
    content: "↕"; margin-left: 5px; font-size: 9px; color: #cbd5e1;
  }
  .data-table thead th[data-sort][data-dir="asc"]::after  { content: "↑"; color: #059669; }
  .data-table thead th[data-sort][data-dir="desc"]::after { content: "↓"; color: #059669; }
  .data-table tbody td { padding: 11px 12px; font-size: 13px; border-bottom: 1px solid #f4f7fa; }
  .data-table tbody tr:last-child td { border-bottom: none; }
  .data-table tbody tr:hover { background: #fafbfd; }
  .data-table tbody tr.row-link { cursor: pointer; }
  .data-table tbody tr.row-link:hover { background: #f1f8f5; }
  .data-table td.positive { color: #059669; font-weight: 700; }
  .data-table td.negative { color: #dc2626; font-weight: 700; }
  .data-table td.muted    { color: #cbd5e1; font-weight: 400; }
  
  .sym-link { font-weight: 800; color: #0f172a; text-decoration: none; }
  .sym-link:hover { color: #059669; }
  .st-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 7px; vertical-align: middle; flex: none;
  }
  
  .win-bar {
    height: 4px; width: 64px; background: #f1f5f9;
    border-radius: 2px; overflow: hidden; margin-bottom: 4px;
  }
  .win-bar span { display: block; height: 100%; background: #10b981; border-radius: 2px; }
  
  /* Monthly table (heatmap tint is applied inline) */
  .monthly-table th, .monthly-table td { text-align: right; }
  .monthly-table th:first-child, .monthly-table .year-cell { text-align: left; }
  .monthly-table .year-cell { color: #0f172a; }
  .monthly-table td.total { background: #f8fafc; border-left: 1px solid #eaeef3; }
  
  /* Side/Result badges */
  .side-badge, .result-badge {
    display: inline-block; padding: 3px 9px; border-radius: 6px;
    font-size: 11px; font-weight: 700;
  }
  .side-badge.long, .side-badge.buy    { background: #ecfdf5; color: #047857; }
  .side-badge.short, .side-badge.sell { background: #fef2f2; color: #b91c1c; }
  .result-badge.win  { background: #ecfdf5; color: #047857; }
  .result-badge.loss { background: #fef2f2; color: #b91c1c; }
  .result-badge.open { background: #f1f5f9; color: #64748b; }
  
  .view-all-link {
    font-size: 12.5px; font-weight: 700; color: #059669; text-decoration: none;
  }
  .view-all-link:hover { color: #047857; }
  
  /* ============ SYMBOL PAGE ============ */
  .timeframe-selector {
    display: inline-flex; background: #f1f5f9; border-radius: 9px; padding: 3px; gap: 1px;
  }
  .timeframe-btn {
    padding: 7px 12px; border-radius: 7px; font-size: 12px; font-weight: 700;
    color: #64748b; text-decoration: none; transition: all 0.15s;
  }
  .timeframe-btn:hover { color: #0f172a; }
  .timeframe-btn.active { background: #fff; color: #0f172a; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

  .show-topbar-right { display: inline-flex; align-items: center; gap: 10px; }

  /* "TradingView" Pine Script download — TradingView's #2962ff hint on hover */
  .tv-export-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 13px; border-radius: 9px; border: 1px solid #cbd5e1;
    background: #fff; color: #1e293b;
    font-size: 12px; font-weight: 700; text-decoration: none;
    transition: all 0.15s; white-space: nowrap;
  }
  .tv-export-btn:hover {
    border-color: #2962ff; color: #2962ff;
    box-shadow: 0 1px 4px rgba(41, 98, 255, 0.15);
  }
  .tv-export-btn svg { flex: none; }

  /* Pine Script import assistant — small centered dialog */
  .pine-modal { position: fixed; inset: 0; z-index: 999; display: flex; align-items: center; justify-content: center; }
  .pine-modal[hidden] { display: none; }
  .pine-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
  .pine-modal__panel {
    position: relative; width: min(440px, calc(100vw - 32px));
    background: #fff; border-radius: 14px; padding: 22px 24px 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    font-size: 13px; line-height: 1.5; color: #1e293b;
  }
  .pine-modal__panel h4 { margin: 0 0 10px; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
  .pine-modal__x {
    position: absolute; top: 10px; right: 12px; border: 0; background: none;
    font-size: 20px; line-height: 1; color: #94a3b8; cursor: pointer; padding: 4px;
  }
  .pine-modal__x:hover { color: #0f172a; }
  .pine-modal__copied {
    display: flex; align-items: center; gap: 6px; margin: 0 0 12px;
    padding: 8px 11px; border-radius: 8px; font-size: 12px; font-weight: 700;
    background: #ecfdf5; color: #059669;
  }
  .pine-modal__empty { margin: 0 0 12px; padding: 8px 11px; border-radius: 8px; font-size: 12px; background: #f1f5f9; color: #64748b; }
  .pine-modal__steps { margin: 0 0 12px; padding-left: 18px; color: #475569; }
  .pine-modal__steps li { margin-bottom: 7px; }
  .pine-modal__steps li:last-child { margin-bottom: 0; }
  .pine-modal__steps strong { color: #0f172a; }
  .pine-kbd {
    display: inline-block; padding: 1px 6px; border-radius: 5px; border: 1px solid #cbd5e1;
    background: #f8fafc; font-family: inherit; font-size: 11px; font-weight: 700; color: #475569;
  }
  .pine-modal__foot {
    margin-top: 12px; padding-top: 10px; border-top: 1px solid #f1f5f9;
    font-size: 11.5px; color: #94a3b8;
  }
  .pine-modal__foot a { color: #2962ff; font-weight: 700; text-decoration: none; }
  .pine-modal__foot a:hover { text-decoration: underline; }
  
  .symbol-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 8px; font-size: 12px; margin-right: 8px;
  }
  .symbol-badge.long  { background: #ecfdf5; color: #059669; }
  .symbol-badge.short { background: #fef2f2; color: #dc2626; }
  
  .card-hint { font-size: 11px; color: #94a3b8; font-weight: 600; margin: 2px 0 0; }
  
  /* P&L distribution strip (server-rendered, zero JS) */
  .dist-chart {
    position: relative; display: flex; gap: 2px;
    height: 120px; margin: 10px 0 4px;
  }
  .dist-chart::before {
    content: ""; position: absolute; left: 0; right: 0; top: 50%;
    height: 1px; background: #e2e8f0;
  }
  .dist-col { flex: 1 1 0; min-width: 2px; position: relative; }
  .dist-col .bar { position: absolute; left: 0; right: 0; }
  .dist-col.pos .bar { bottom: 50%; background: #10b981; border-radius: 2px 2px 0 0; }
  .dist-col.neg .bar { top: 50%; background: #ef4444; border-radius: 0 0 2px 2px; }
  .dist-axis {
    display: flex; justify-content: space-between;
    font-size: 10px; color: #94a3b8; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
  }
  
  .trade-list {
    display: flex; flex-direction: column; gap: 8px;
    max-height: 480px; overflow-y: auto; padding-right: 4px;
  }
  .trade-side { font-size: 10.5px; font-weight: 800; text-transform: uppercase; padding: 2px 8px; border-radius: 6px; }
  .trade-side.long  { background: #ecfdf5; color: #047857; }
  .trade-side.short { background: #fef2f2; color: #b91c1c; }
  .trade-pnl.open { color: #94a3b8; font-weight: 800; }
  
  /* =============================================================
     TRADE ANALYSIS PAGE (analytics#show)
     The root element also carries .trade-show-page, so it inherits
     the whole trades.css design system (tokens, hero, move-card,
     buttons, pills, pager). Only page-specific components live here.
     ============================================================= */
  .trade-show-page.trade-analysis-page { max-width: 1240px; }
  
  /* ---- generic card (chart / compare / symbol / timing / strategy) ---- */
  .trade-analysis-page .an-card {
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius);
    padding: 18px 22px 16px;
    margin-bottom: 12px;
    box-shadow: var(--t-shadow-card);
    /* Nothing inside a card may paint over a neighboring card (an escaped
       excursion marker once drew straight across the next card). overflow
       clipping here is cheap insurance. */
    overflow: hidden;
  }
  .trade-analysis-page .an-card-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px 16px; flex-wrap: wrap; margin-bottom: 14px;
  }
  .trade-analysis-page .an-card-head h3 {
    margin: 0 0 3px; font-size: 15px; font-weight: 700;
    color: var(--t-text-1); letter-spacing: -0.01em;
  }
  .trade-analysis-page .an-mono { font-family: var(--t-mono); }
  .trade-analysis-page .an-card-sub { margin: 0; font-size: 12px; color: var(--t-text-3); font-weight: 500; }
  .trade-analysis-page .an-card-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  
  /* chart legend dot variants (base .legend-chip lives above) */
  .trade-analysis-page .legend-chip.is-entry::before { background: #2563eb; }
  .trade-analysis-page .legend-chip.is-loss::before  { background: #dc2626; }
  
  /* chart sizing + empty state */
  .trade-analysis-page .main-chart    { min-height: 420px; }
  .trade-analysis-page #volume-chart  { min-height: 100px; }
  .trade-analysis-page .an-chart-empty { padding: 44px 16px; text-align: center; color: var(--t-text-3); font-size: 13px; }
  .trade-analysis-page .an-chart-empty p { margin: 0 0 6px; line-height: 1.6; }
  .trade-analysis-page .an-chart-empty strong { color: var(--t-text-2); }
  
  /* ---- best & worst range viz (sits inside a .move-card / .move-body) ---- */
  .trade-analysis-page .an-range-viz    { min-width: 0; }
  .trade-analysis-page .an-range-tagrow { position: relative; height: 24px; }
  .trade-analysis-page .an-range-track {
    position: relative; height: 10px; margin: 6px 8px;
    background: var(--t-surface-3); border-radius: 999px;
  }
  .trade-analysis-page .an-range-zone { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
  .trade-analysis-page .an-range-zone.fav { background: linear-gradient(90deg, rgba(16,185,139,.10), rgba(5,150,105,.22)); }
  .trade-analysis-page .an-range-zone.adv { background: linear-gradient(90deg, rgba(220,38,38,.22), rgba(220,38,38,.10)); }
  
  .trade-analysis-page .move-tag.is-best  { background: var(--t-profit-soft); border-color: var(--t-profit-border); color: var(--t-profit-strong); }
  .trade-analysis-page .move-tag.is-worst { background: var(--t-loss-soft);   border-color: var(--t-loss-border);   color: var(--t-loss-strong); }
  .trade-analysis-page .move-tag.is-best em,
  .trade-analysis-page .move-tag.is-worst em { color: inherit; opacity: .7; }
  .trade-analysis-page .move-marker.is-best  { background: var(--t-profit); }
  .trade-analysis-page .move-marker.is-worst { background: var(--t-loss); }
  /* The key calls the entry point blue — make the marker actually blue,
     matching the legend chip and the candle chart's entry annotation. */
  .trade-analysis-page .move-marker.is-entry { background: #2563eb; }
  
  /* ---- compare grid ("versus your typical trade") ---- */
  .trade-analysis-page .an-cmp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1px; background: var(--t-border-soft);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    overflow: hidden;
  }
  .trade-analysis-page .an-cmp-cell {
    background: var(--t-surface); padding: 14px 16px 12px; min-width: 0;
    display: flex; flex-direction: column; gap: 6px;
  }
  .trade-analysis-page .an-cmp-label {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--t-text-3);
  }
  .trade-analysis-page .an-cmp-value {
    font-family: var(--t-mono); font-size: 19px; font-weight: 800;
    color: var(--t-text-1); letter-spacing: -0.01em; line-height: 1.1;
  }
  .trade-analysis-page .an-cmp-value.is-positive { color: var(--t-profit-strong); }
  .trade-analysis-page .an-cmp-value.is-negative { color: var(--t-loss-strong); }
  .trade-analysis-page .an-cmp-value.is-muted { color: var(--t-text-3); }
  .trade-analysis-page .an-cmp-bars { display: flex; flex-direction: column; gap: 4px; }
  .trade-analysis-page .an-cmp-bar { display: flex; align-items: center; gap: 8px; }
  .trade-analysis-page .an-cmp-bar i {
    font-style: normal; font-size: 9px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--t-text-3);
    width: 66px; text-align: right; flex: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .trade-analysis-page .an-cmp-bar .track {
    flex: 1; height: 6px; background: var(--t-surface-3);
    border-radius: 999px; overflow: hidden;
  }
  .trade-analysis-page .an-cmp-bar b.fill {
    display: block; height: 100%; border-radius: 999px; min-width: 2px;
    background: var(--t-accent);
  }
  .trade-analysis-page .an-cmp-bar b.fill.you.is-positive { background: linear-gradient(90deg, #34d399, var(--t-profit)); }
  .trade-analysis-page .an-cmp-bar b.fill.you.is-negative { background: linear-gradient(90deg, var(--t-loss), #fca5a5); }
  .trade-analysis-page .an-cmp-bar b.fill.base { background: #cbd5e1; }
  .trade-analysis-page .an-pct-track {
    height: 8px; background: var(--t-surface-3);
    border-radius: 999px; overflow: hidden; margin-top: 2px;
  }
  .trade-analysis-page .an-pct-fill {
    display: block; height: 100%; border-radius: 999px;
    background: linear-gradient(90deg, #34d399, var(--t-profit));
  }
  .trade-analysis-page .an-cmp-sub { font-size: 11px; color: var(--t-text-2); font-weight: 600; line-height: 1.5; }
  .trade-analysis-page .an-cmp-sub strong { color: var(--t-text-1); font-weight: 700; }
  
  /* ---- two-column body (symbol card) ---- */
  .trade-analysis-page .an-two-col {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px 40px; align-items: center;
  }
  
  /* symbol P&L distribution strip (reuses .dist-chart / .dist-col above) */
  .trade-analysis-page .dist-col.current .bar { box-shadow: 0 0 0 2px var(--t-accent); border-radius: 3px; }
  .trade-analysis-page .dist-col.zero .bar { background: #cbd5e1; }
  .trade-analysis-page .an-strip { min-width: 0; }
  
  /* ---- weekday performance bars (entry timing card) ---- */
  .trade-analysis-page .an-dow-bars { display: flex; gap: 8px; }
  .trade-analysis-page .an-dow-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
  .trade-analysis-page .an-dow-barzone {
    width: 100%; height: 96px; display: flex; align-items: flex-end; justify-content: center;
    border-bottom: 1px solid var(--t-border-soft);
    border-radius: 6px 6px 0 0; padding: 0 2px;
  }
  .trade-analysis-page .an-dow-bar { width: 100%; max-width: 36px; border-radius: 4px 4px 0 0; min-height: 3px; }
  .trade-analysis-page .an-dow-bar.pos { background: linear-gradient(180deg, #34d399, var(--t-profit)); }
  .trade-analysis-page .an-dow-bar.neg { background: linear-gradient(180deg, var(--t-loss), #fca5a5); }
  .trade-analysis-page .an-dow-bar.zero { background: #e2e8f0; }
  .trade-analysis-page .an-dow-col.is-current .an-dow-barzone { background: var(--t-accent-soft); }
  .trade-analysis-page .an-dow-col.is-current .an-dow-bar { outline: 2px solid var(--t-accent); outline-offset: 2px; }
  .trade-analysis-page .an-dow-lbl {
    font-size: 9.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--t-text-3);
  }
  .trade-analysis-page .an-dow-col.is-current .an-dow-lbl { color: var(--t-accent-strong); }
  .trade-analysis-page .an-dow-caption { margin: 12px 0 0; font-size: 11.5px; color: var(--t-text-2); font-weight: 600; line-height: 1.5; }
  .trade-analysis-page .an-dow-caption strong { color: var(--t-text-1); }
  .trade-analysis-page .an-dow-caption strong.is-positive { color: var(--t-profit-strong); }
  .trade-analysis-page .an-dow-caption strong.is-negative { color: var(--t-loss-strong); }
  
  /* ---- strategy & setup rows ---- */
  .trade-analysis-page .an-rel-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px 16px; padding: 11px 0; flex-wrap: wrap;
    border-bottom: 1px dashed var(--t-border-soft);
  }
  .trade-analysis-page .an-rel-row:last-child { border-bottom: 0; padding-bottom: 2px; }
  .trade-analysis-page .an-rel-who { display: flex; align-items: center; gap: 8px; min-width: 150px; }
  .trade-analysis-page .an-rel-stats {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    font-size: 12px; color: var(--t-text-2); font-weight: 600;
  }
  .trade-analysis-page .an-rel-stats strong { font-family: var(--t-mono); color: var(--t-text-1); }
  .trade-analysis-page .an-rel-stats strong.is-positive { color: var(--t-profit-strong); }
  .trade-analysis-page .an-rel-stats strong.is-negative { color: var(--t-loss-strong); }

  /* ---- symbol analytics (reuses everything above; the root element
       carries the same trade-analysis-page / trade-show-page classes) ---- */
.trade-analysis-page .an-list-scroll {
  max-height: 540px;
  overflow-y: auto;
  border-top: 1px solid var(--t-border-soft);
  border-radius: var(--t-radius-sm);
}
.trade-analysis-page .legend-chip.is-win::before { background: #059669; }

  
  /* ============ RESPONSIVE ============ */
  @media (max-width: 1100px) {
    .analytics-grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  }
  @media (max-width: 1000px) {
    .analytics-grid, .analytics-grid-2 { grid-template-columns: 1fr; }
  }
  @media (max-width: 960px) {
    .trade-analysis-page .an-two-col { grid-template-columns: 1fr; }
  }
  @media (max-width: 640px) {
    .analytics-page { padding: 16px; }
    .records-grid, .side-split { grid-template-columns: 1fr; }
    .cal-days { display: none; }
  
    .trade-analysis-page { padding: 16px; }
    .trade-analysis-page .an-cmp-grid { grid-template-columns: 1fr; }
    .trade-analysis-page .an-dow-barzone { height: 72px; }
    .trade-analysis-page .an-rel-stats { gap: 10px; }
  }
  