  :root {
    --bg: #0a0b0e;
    --surface: #111318;
    --surface2: #171b22;
    --surface3: #1e2330;
    --border: #252b38;
    --border2: #2e3547;
    --text: #e8eaf0;
    --text2: #8b94a8;
    --text3: #4a5368;
    --green: #00d97e;
    --green-dim: #00d97e22;
    --green-mid: #00d97e44;
    --red: #ff4757;
    --red-dim: #ff475722;
    --red-mid: #ff475744;
    --blue: #4a9eff;
    --blue-dim: #4a9eff15;
    --mono: 'JetBrains Mono', monospace;
    --display: 'Poppins', sans-serif;
    --title: 'Inter', sans-serif;
  }

  /* ── Light (classic) mode ── */
  html.light, body.light {
    --bg: #f0f2f5;
    --surface: #ffffff;
    --surface2: #f7f8fa;
    --surface3: #eef0f4;
    --border: #e2e5ec;
    --border2: #d0d4de;
    --text: #111827;
    --text2: #4b5563;
    --text3: #9ca3af;
    --green: #00b868;
    --green-dim: #00b86815;
    --green-mid: #00b86830;
    --red: #e53e3e;
    --red-dim: #e53e3e15;
    --red-mid: #e53e3e30;
    --blue: #2563eb;
    --blue-dim: #2563eb15;
  }

  /* ── Warm (beige) mode ── */
  html.warm, body.warm {
    --bg: #f2ede8;
    --surface: #faf7f4;
    --surface2: #f5f0eb;
    --surface3: #ede7e0;
    --border: #ddd6ce;
    --border2: #cec6bc;
    --text: #1c1917;
    --text2: #57534e;
    --text3: #a8a29e;
    --green: #059669;
    --green-dim: #05966915;
    --green-mid: #05966930;
    --red: #dc2626;
    --red-dim: #dc262615;
    --red-mid: #dc262630;
    --blue: #2563eb;
    --blue-dim: #2563eb15;
  }

  /* ── Dark mode ── */
  html.dark, body.dark {
    --bg: #13151a;
    --surface: #1a1d25;
    --surface2: #1f2330;
    --surface3: #252b38;
  }

  /* Theme selector */
  /* ── Theme picker inside user menu ── */
  .user-menu-section-label {
    padding: 6px 12px 4px;
    font-size: 10px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; color: var(--text3);
    font-family: var(--title);
  }
  .user-menu-theme-row {
    display: flex; gap: 4px; padding: 2px 8px 6px;
  }
  .user-theme-btn {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    flex: 1; padding: 8px 4px; border-radius: 7px; border: 1px solid var(--border);
    background: var(--surface3); cursor: pointer;
    font-family: var(--title); font-size: 10px; font-weight: 600;
    color: var(--text3); transition: all 0.12s;
  }
  .user-theme-btn:hover { border-color: var(--border2); color: var(--text2); }
  .user-theme-btn.active { border-color: var(--green); color: var(--text); background: var(--surface); }
  .user-theme-btn .dot { width: 14px; height: 14px; border-radius: 50%; }


  * { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--title); }

  html {
    background: var(--bg);
    min-height: 100%;
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--title);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* Keep monospace on numeric / ticker elements */
  .av-row-pnl, .av-sum-value, .av-gap-card-pnl, .day-pnl,
  .sp-pnl-badge, .ticker-sym, .av-ticker-sym, .av-ticker-row .av-row-pnl,
  input[type="number"], input[type="text"].mono,
  .day-cell .pnl, .month-pnl, .streak-val,
  .cm-pnl, .cm-stat-val { font-family: var(--title); }

    body::before {
    content: '';
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
  }

  .app {
    position: relative; z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
  }

  header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
    gap: 12px;
  }

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

  .logo-mark {
    width: 36px; height: 36px;
    background: var(--green);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  }

  .logo h1 { font-family: var(--title); font-size: 26px; font-weight: 700; letter-spacing: -0.6px; line-height: 1.2; }
  .logo span { font-size: 13px; color: var(--text3); letter-spacing: 2.5px; text-transform: uppercase; display: block; margin-top: 1px; white-space: nowrap; }

  .header-nav { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }

  /* ── Hamburger button ── */
  .hamburger-btn {
    width: 36px; height: 36px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    background: transparent; border: 1px solid var(--border);
    border-radius: 8px; cursor: pointer; transition: all 0.15s; flex-shrink: 0;
  }
  .hamburger-btn:hover { border-color: var(--border2); background: var(--surface3); }
  .hamburger-btn span {
    display: block; width: 16px; height: 1.5px;
    background: var(--text2); border-radius: 2px; transition: all 0.2s;
  }

  /* ── Sidebar overlay ── */
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); z-index: 400;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.open { display: block; }

  /* ── Sidebar panel ── */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 260px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 500;
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 32px rgba(0,0,0,0.35);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .sidebar-logo {
    display: flex; align-items: center; gap: 10px;
  }
  .sidebar-logo-mark {
    height: 36px; width: auto;
    object-fit: contain;
    flex-shrink: 0;
  }
  .sidebar-logo-text {
    font-family: var(--title); font-size: 16px; font-weight: 700;
    letter-spacing: -0.4px; color: var(--text);
  }
  .sidebar-close {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border);
    border-radius: 6px; cursor: pointer; color: var(--text3);
    font-size: 14px; transition: all 0.15s;
  }
  .sidebar-close:hover { border-color: var(--border2); color: var(--text); background: var(--surface3); }

  .sidebar-nav {
    flex: 1; overflow-y: auto; padding: 12px 10px;
    display: flex; flex-direction: column; gap: 2px;
  }

  .sidebar-section-label {
    font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text3);
    padding: 10px 10px 4px;
    font-family: var(--title);
  }

  .sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    background: transparent; border: none; cursor: pointer;
    font-family: var(--title); font-size: 13px; font-weight: 500;
    color: var(--text2); text-align: left; width: 100%;
    transition: all 0.12s; position: relative;
  }
  .sidebar-item:hover { background: var(--surface2); color: var(--text); }
  .sidebar-item.active { background: var(--surface2); color: var(--text); }
  .sidebar-item.active::before {
    content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
    width: 3px; background: var(--green); border-radius: 0 2px 2px 0;
  }
  .sidebar-item-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
  .sidebar-item-badge {
    margin-left: auto; font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
    padding: 2px 6px; border-radius: 4px;
    background: var(--surface3); color: var(--text3); border: 1px solid var(--border);
  }

  .sidebar-sub {
    display: flex; flex-direction: column; gap: 1px;
    padding-left: 20px;
  }
  .sidebar-sub-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; border-radius: 6px;
    background: transparent; border: none; cursor: pointer;
    font-family: var(--title); font-size: 12px; font-weight: 500;
    color: var(--text3); text-align: left; width: 100%;
    transition: all 0.12s; position: relative;
  }
  .sidebar-sub-item:hover { background: var(--surface2); color: var(--text2); }
  .sidebar-sub-item.active { color: var(--green); }
  .sidebar-sub-item.active::before {
    content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
    width: 2px; background: var(--green); border-radius: 0 2px 2px 0;
  }

  .sidebar-divider { height: 1px; background: var(--border); margin: 8px 10px; }

  .sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
  }



  .view-toggle {
    display: flex;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
  }

  .view-btn {
    padding: 6px 14px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: var(--text3);
    font-family: var(--title);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .view-btn.active { background: var(--surface3); color: var(--text); border: 1px solid var(--border2); }
  .view-btn:hover:not(.active) { color: var(--text2); }

  /* ── In-calendar Mensual/Anual toggle ── */
  .cal-view-toggle {
    display: flex;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 3px; gap: 2px; flex-shrink: 0;
  }
  .cal-view-btn {
    padding: 5px 14px; border-radius: 5px; border: none;
    background: transparent; color: var(--text3);
    font-family: var(--title); font-size: 11px; font-weight: 600;
    cursor: pointer; transition: all 0.15s;
    letter-spacing: 0.8px; text-transform: uppercase; white-space: nowrap;
  }
  .cal-view-btn.active { background: var(--surface3); color: var(--text); border: 1px solid var(--border2); }
  .cal-view-btn:hover:not(.active) { color: var(--text2); }
  .cal-toggle-sep { width: 1px; background: var(--border); margin: 3px 2px; flex-shrink: 0; }
  .cal-view-btn-hoy { color: var(--green); letter-spacing: 0.5px; }
  .cal-view-btn-hoy:hover { color: #00f090 !important; }

  .btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--title);
    font-size: 12px;
    transition: all 0.15s;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .btn:hover { border-color: var(--border2); color: var(--text); background: var(--surface3); }

  .btn-primary { background: var(--green); border-color: var(--green); color: #000; font-weight: 600; }
  .btn-primary:hover { background: #00f090; border-color: #00f090; color: #000; }

  .nav-btn {
    width: 36px; height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text2);
    border-radius: 6px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    transition: all 0.15s;
  }

  .nav-btn:hover { background: var(--surface3); border-color: var(--border2); color: var(--text); }

  .view-panel { display: none; }
  .view-panel.active { display: block; }
  /* Analysis panel: same max-width/padding as .app for visual consistency */
  #panelAnalysis { max-width: 1400px; margin: -32px auto 0; padding: 0 24px 32px; box-sizing: border-box; }

  /* ════ MONTHLY ════ */
  .month-nav { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
  .account-size-wrap { display: flex; align-items: center; gap: 8px; margin-left: auto; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; }
  .account-size-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text3); font-weight: 600; white-space: nowrap; }
  .account-size-input { background: transparent; border: none; outline: none; color: var(--text); font-family: var(--title); font-size: 14px; font-weight: 700; width: 90px; text-align: right; }
  .account-size-input::placeholder { color: var(--text3); font-weight: 400; }
  .account-size-currency { font-size: 13px; font-weight: 700; color: var(--text3); }

  .month-title { font-family: var(--title); font-size: 32px; font-weight: 800; letter-spacing: -1px; min-width: 260px; }
  .month-title span { color: var(--text3); font-weight: 400; }

  .stats-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 28px; }

  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
  }

  .stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent-color, var(--border2)); }
  .stat-card:hover { border-color: var(--border2); }
  .stat-label { font-size: 10px; color: var(--text3); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px; }
  .stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
  .stat-sub { font-size: 10px; color: var(--text3); margin-top: 4px; }
  .stat-positive { --accent-color: var(--green); }
  .stat-positive .stat-value { color: var(--green); }
  .stat-negative { --accent-color: var(--red); }
  .stat-negative .stat-value { color: var(--red); }

  .calendar-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
  .weekdays { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
  .weekday { padding: 12px; text-align: center; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text3); }
  .weekday.weekend { opacity: 0.5; }
  .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

  .day-cell {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    min-height: 110px;
    padding: 10px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    overflow: hidden;
  }

  .day-cell:nth-child(7n) { border-right: none; }
  .day-cell:hover { background: var(--surface2); }
  .day-cell.empty { background: var(--bg); cursor: default; opacity: 0.3; }

  .day-cell.today .day-num {
    background: var(--green); color: #000; border-radius: 4px;
    width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  }

  .day-cell.positive { background: var(--green-dim); }
  .day-cell.positive::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--green); }
  .day-cell.positive:hover { background: var(--green-mid); }
  .day-cell.negative { background: var(--red-dim); }
  .day-cell.negative::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--red); }
  .day-cell.negative:hover { background: var(--red-mid); }

  .day-num { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
  .day-pnl { font-size: 16px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
  .day-pnl.pos { color: var(--green); }
  .day-pnl.neg { color: var(--red); }

  .day-meta { display: flex; gap: 6px; flex-wrap: wrap; }
  .tag { font-size: 9px; padding: 2px 6px; border-radius: 3px; font-weight: 500; letter-spacing: 0.3px; }
  .tag-trades { background: var(--blue-dim); color: var(--blue); border: 1px solid #4a9eff22; }
  .tag-wr { background: #ffffff08; color: var(--text3); border: 1px solid var(--border); }
  .tag-pct.pos { background: var(--green-dim); color: var(--green); border: 1px solid #00d97e22; }
  .tag-pct.neg { background: var(--red-dim); color: var(--red); border: 1px solid #ff475722; }
  .day-note-icon { position: absolute; bottom: 8px; right: 8px; font-size: 12px; opacity: 0.5; }

  /* ── Weekly recap (Sunday cell) ── */
  .day-cell.sunday-recap-cell {
    cursor: default !important;
  }
  .day-cell.sunday-recap-cell:hover { background: var(--surface2); }

  .week-recap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 5px;
    padding: 6px 4px;
  }
  .week-recap-num {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--text);
  }
  .week-recap-pnl {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1;
  }
  .week-recap-pnl.pos { color: var(--green); }
  .week-recap-pnl.neg { color: var(--red); }
  .week-recap-trades {
    font-size: 10px;
    color: var(--text3);
    font-weight: 500;
  }
  .week-recap-empty {
    opacity: 0.25;
  }

  .streak-badge { position: absolute; top: 8px; right: 8px; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 3px; letter-spacing: 0.5px; }
  .streak-win { background: var(--green-dim); color: var(--green); border: 1px solid #00d97e33; }
  .streak-loss { background: var(--red-dim); color: var(--red); border: 1px solid #ff475733; }

  .analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
  .analysis-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
  .analysis-title { font-family: var(--title); font-size: 10px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--text3); margin-bottom: 16px; }
  .streak-list { display: flex; flex-direction: column; gap: 8px; }

  .streak-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: var(--surface2); border-radius: 6px; border: 1px solid var(--border);
  }

  .streak-info { font-size: 12px; color: var(--text2); }
  .streak-days { font-size: 18px; font-weight: 700; }
  .streak-days.pos { color: var(--green); }
  .streak-days.neg { color: var(--red); }

  .equity-wrap { margin-top: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
  .equity-title { font-family: var(--title); font-size: 10px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--text3); margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
  canvas#equityChart { width: 100% !important; display: block; }

  .weekday-perf { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .wd-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 12px 8px; text-align: center; }
  .wd-name { font-size: 10px; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
  .wd-val { font-size: 13px; font-weight: 700; }

  .empty-prompt { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 60px; color: var(--text3); font-size: 11px; gap: 4px; opacity: 0; transition: opacity 0.15s; }
  .day-cell:hover .empty-prompt { opacity: 1; }
  .empty-prompt-icon { font-size: 18px; }

  /* ════ ANNUAL ════ */
  .year-nav { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }

  .year-title { font-family: var(--title); font-size: 42px; font-weight: 800; letter-spacing: -2px; line-height: 1; }

  .year-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-left: 8px; }

  .year-pill {
    padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border);
    background: var(--surface2); color: var(--text3);
    font-family: var(--title); font-size: 12px; cursor: pointer; transition: all 0.15s; font-weight: 500;
  }

  .year-pill:hover { border-color: var(--border2); color: var(--text2); }
  .year-pill.active { background: var(--green); border-color: var(--green); color: #000; font-weight: 700; }

  .annual-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 28px; }

  .annual-stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; position: relative; overflow: hidden; }
  .annual-stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--accent-color, var(--border2)); }

  .months-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

  .month-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: border-color 0.2s; }
  .month-card:hover { border-color: var(--border2); }

  .month-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background 0.15s;
  }

  .month-card-header:hover { background: var(--surface2); }

  .month-card-name { font-family: var(--title); font-size: 14px; font-weight: 700; letter-spacing: -0.3px; }
  .month-card-pnl { font-size: 13px; font-weight: 700; }
  .month-card-pnl.pos { color: var(--green); }
  .month-card-pnl.neg { color: var(--red); }
  .month-card-pnl.neutral { color: var(--text3); }

  .month-card-meta { font-size: 9px; color: var(--text3); padding: 0 16px 6px; display: flex; gap: 10px; }

  .mini-cal { padding: 8px 10px 10px; }
  .mini-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
  .mini-wd { text-align: center; font-size: 8px; color: var(--text3); padding: 2px 0; letter-spacing: 0.5px; }
  .mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

  .mini-day {
    aspect-ratio: 1;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.1s;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: 500;
    overflow: visible;
  }

  .mini-day:hover { transform: scale(1.35); z-index: 10; }
  .mini-day:hover .mini-tooltip { display: flex; }

  .mini-day.md-empty { background: transparent; cursor: default; pointer-events: none; }
  .mini-day.md-blank { background: var(--surface3); color: var(--text3); }
  .mini-day.md-blank:hover { background: var(--border2); }
  .mini-day.mini-day.md-pos { background: var(--green); opacity: 0.55; }
  .mini-day.md-pos:hover { opacity: 1; }
  .mini-day.md-neg { background: var(--red); opacity: 0.45; }
  .mini-day.md-neg:hover { opacity: 1; }
  .mini-day .md-num { position: absolute; font-size: clamp(7px, 0.85vw, 13px); font-weight: 500;
    line-height: 1; pointer-events: none;
    top: 50%; left: 50%; transform: translate(-50%,-50%);
    white-space: nowrap; z-index: 1; }

  .mini-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface3);
    border: 1px solid var(--border2);
    border-radius: 6px;
    padding: 6px 8px;
    white-space: nowrap;
    font-size: 10px;
    color: var(--text);
    z-index: 200;
    flex-direction: column;
    gap: 2px;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  }

  .mini-tooltip::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 4px solid transparent; border-top-color: var(--border2); }
  .tt-date { color: var(--text3); font-size: 9px; margin-bottom: 2px; }
  .tt-pnl { font-weight: 700; font-size: 12px; }
  .tt-pnl.pos { color: var(--green); }
  .tt-pnl.neg { color: var(--red); }
  .tt-trades { color: var(--text3); font-size: 9px; }

  .month-pnl-bar { height: 3px; margin: 0 10px 8px; background: var(--border); border-radius: 2px; overflow: hidden; }
  .month-pnl-fill { height: 100%; border-radius: 2px; }

  .annual-equity-wrap { margin-top: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
  canvas#annualChart { width: 100% !important; height: 140px !important; }

  /* ── Analysis View ── */
  .analysis-view-header { margin-bottom: 24px; }
  .analysis-view-title { font-family: var(--title); font-size: 32px; font-weight: 800; letter-spacing: -1px; margin-bottom: 6px; }
  .analysis-view-subtitle { font-size: 12px; color: var(--text3); }

  /* ── Analysis filter bar ── */
  .av-filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
    flex-wrap: wrap; }
  /* Each filter: label + custom select wrapper */
  .av-flt { position: relative; display: flex; align-items: center; gap: 0; }
  .av-flt-label { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; font-weight: 700;
    color: var(--text3); padding: 0 8px 0 0; white-space: nowrap; }
  .av-flt-select { appearance: none; -webkit-appearance: none;
    background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
    color: var(--text); font-family: var(--title); font-size: 11px;
    padding: 6px 28px 6px 10px; cursor: pointer; outline: none;
    transition: border-color 0.12s; min-width: 90px; }
  .av-flt-select:hover  { border-color: var(--text2); }
  .av-flt-select:focus  { border-color: var(--green); }
  .av-flt-select.active { border-color: var(--green); color: var(--green); font-weight: 700; }
  .av-flt-arrow { position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
    pointer-events: none; font-size: 9px; color: var(--text3); }
  .av-flt-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; flex-shrink: 0; }
  .av-flt-reset { background: none; border: none; color: var(--text3); font-family: var(--title);
    font-size: 10px; padding: 6px 8px; cursor: pointer; border-radius: 6px; transition: all 0.12s; }
  .av-flt-reset:hover { color: var(--text); background: var(--surface); }
  /* Gap / Price card grids */
  .av-gap-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px;
    background: var(--border); border-radius: 8px; overflow: hidden; }
  .av-gap-card { background: var(--surface); padding: 14px 16px; }
  .av-gap-card-name { font-size: 11px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
  .av-gap-card-pnl  { font-size: 18px; font-weight: 700; letter-spacing: -0.5px; }
  .av-gap-card-pnl.pos { color: var(--green); }
  .av-gap-card-pnl.neg { color: var(--red); }
  .av-gap-card-sub  { font-size: 10px; color: var(--text3); margin-top: 4px; }
  .av-gap-card-bar  { height: 3px; background: var(--border2); border-radius: 2px; margin-top: 8px; overflow: hidden; }
  .av-gap-card-bar-fill { height: 100%; border-radius: 2px; }

  .av-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
  .av-sum-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
  .av-sum-label { font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text3); margin-bottom: 6px; font-weight: 600; }
  .av-sum-value { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
  .av-sum-sub { font-size: 10px; color: var(--text3); margin-top: 3px; }

  .av-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .av-table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
  .av-table-title { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text3); font-weight: 700; margin-bottom: 14px; }

  .av-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center;
    padding: 10px 0; border-bottom: 1px solid var(--border); }
  .av-row:last-child { border-bottom: none; }
  .av-row-name { font-size: 12px; font-weight: 600; color: var(--text); }
  .av-row-sub { font-size: 10px; color: var(--text3); margin-top: 2px; }
  .av-row-trades { font-size: 10px; color: var(--text3); text-align: right; white-space: nowrap; }
  .av-row-wr { font-size: 10px; color: var(--text3); text-align: right; white-space: nowrap; }
  .av-row-pnl { font-size: 13px; font-weight: 700; text-align: right; white-space: nowrap; }
  .av-row-pnl.pos { color: var(--green); }
  .av-row-pnl.neg { color: var(--red); }
  .av-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; margin-top: 6px; overflow: hidden; grid-column: 1/-1; }
  .av-bar-fill { height: 100%; border-radius: 2px; }

  .av-empty { text-align: center; padding: 40px 20px; color: var(--text3); font-size: 12px; line-height: 1.8; }

  .av-meta-section { margin-top: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
  .av-ticker-row { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 4px; gap: 0 16px;
    padding: 10px 0; border-bottom: 1px solid var(--border); align-items: center; }
  .av-ticker-row:last-child { border-bottom: none; }
  .av-ticker-main { display: flex; flex-direction: column; }
  .av-ticker-sym { font-size: 13px; font-weight: 700; color: var(--text); }
  .av-ticker-bar-wrap { grid-column: 1 / -1; height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 6px; }
  .av-meta-row { display: grid; grid-template-columns: 70px 160px 120px 130px 65px 70px 80px 40px; gap: 8px;
    align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
  .av-fetch-btn { background: transparent; border: 1px solid var(--border2); border-radius: 5px;
    color: var(--text3); font-family: var(--title); font-size: 10px; padding: 4px 8px; cursor: pointer;
    transition: all 0.15s; white-space: nowrap; }
  .av-fetch-btn:hover { border-color: var(--green); color: var(--green); }
  .av-fetch-btn.loading { opacity: 0.5; pointer-events: none; }
  .av-fetch-btn.ok { border-color: var(--green); color: var(--green); }
  .av-fetch-btn.err { border-color: var(--red); color: var(--red); }
  .av-api-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; }
  .av-api-label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); white-space: nowrap; font-weight: 600; }
  .av-api-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text);
    font-family: var(--title); font-size: 12px; min-width: 0; }
  .av-api-input::placeholder { color: var(--text3); }
  .av-fetch-all-btn { background: var(--green); color: #000; border: none; border-radius: 6px;
    font-family: var(--title); font-size: 11px; font-weight: 700; padding: 7px 14px; cursor: pointer;
    transition: opacity 0.15s; white-space: nowrap; }
  .av-fetch-all-btn:hover { opacity: 0.85; }
  .av-meta-row:last-child { border-bottom: none; }
  .av-meta-row.header { font-size: 9px; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); padding-bottom: 10px; font-weight: 600; }
  .av-meta-sym { font-size: 12px; font-weight: 700; color: var(--text); }
  .av-meta-input { background: var(--bg); border: 1px solid var(--border); border-radius: 5px; color: var(--text);
    font-family: var(--title); font-size: 11px; padding: 5px 8px; outline: none; width: 100%; box-sizing: border-box; }
  .av-meta-input:focus { border-color: var(--green); }
  .av-meta-input[type=number]::-webkit-inner-spin-button { opacity: 0.4; }

  @media (max-width: 768px) {
    .av-tables { grid-template-columns: 1fr; }
    .av-summary { grid-template-columns: repeat(2,1fr); }
    .av-meta-row { grid-template-columns: 70px 1fr 1fr 1fr; }
  }

  .monthly-summary-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; margin-top: 20px; }

  .msr-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 8px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
  .msr-item:hover { border-color: var(--border2); background: var(--surface2); }
  .msr-name { font-size: 9px; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
  .msr-pnl { font-size: 12px; font-weight: 700; }
  .msr-pnl.pos { color: var(--green); }
  .msr-pnl.neg { color: var(--red); }
  .msr-pnl.neutral { color: var(--text3); }
  .msr-bar-wrap { height: 3px; background: var(--border); border-radius: 2px; margin-top: 6px; overflow: hidden; }
  .msr-bar-fill { height: 100%; border-radius: 2px; }

  /* ════ MODAL ════ */
  .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(4px); z-index: 100; align-items: center; justify-content: center; }
  .modal-overlay.active { display: flex; }

  .modal {
    background: var(--surface); border: 1px solid var(--border2); border-radius: 16px;
    width: 480px; max-width: 95vw; padding: 28px; position: relative;
    animation: slideUp 0.2s ease;
  }

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

  .modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
  .modal-date { font-family: var(--title); font-size: 20px; font-weight: 700; }

  .modal-close { width: 30px; height: 30px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; color: var(--text2); cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
  .modal-close:hover { background: var(--surface3); color: var(--text); }

  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
  .form-group { display: flex; flex-direction: column; gap: 6px; }
  .form-group.full { grid-column: span 2; }

  label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text3); }

  input, textarea {
    background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text); font-family: var(--title); font-size: 13px; padding: 10px 12px;
    transition: border-color 0.15s; outline: none; width: 100%;
  }

  input:focus, textarea:focus { border-color: var(--green); }
  textarea { resize: vertical; min-height: 80px; }
  input::placeholder, textarea::placeholder { color: var(--text3); }

  .modal-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 20px; }
  .modal-actions .btn { height: 36px; display: flex; align-items: center; justify-content: center; padding: 0 16px; }
  .btn-delete { background: var(--red-dim); border-color: var(--red); color: var(--red); margin-right: auto; }
  .btn-delete:hover { background: var(--red-mid); }

  .btn-das { background: #1a1f2e; border-color: var(--amber); color: var(--amber); font-weight: 600; }
  .btn-das:hover { background: #22293a; border-color: #ffb830; color: #ffb830; }
  body.light .btn-das { background: #fffbf0; border-color: #d97706; color: #b45309; }
  body.light .btn-das:hover { background: #fef3c7; border-color: #b45309; color: #92400e; }
  body.warm  .btn-das { background: #fef3e2; border-color: #c2840a; color: #92400e; }
  body.warm  .btn-das:hover { background: #fde8c4; border-color: #92400e; color: #78350f; }

  /* ════ DAS IMPORT MODAL ════ */
  .das-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(6px); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
  .das-overlay.active { display: flex; }

  .das-modal {
    background: var(--surface); border: 1px solid var(--border2); border-radius: 18px;
    width: 720px; max-width: 100%; max-height: 90vh; overflow-y: auto;
    padding: 32px; position: relative; animation: slideUp 0.2s ease;
  }

  .das-modal-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }

  .das-title { font-family: var(--title); font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
  .das-subtitle { font-size: 11px; color: var(--text3); margin-top: 4px; letter-spacing: 0.5px; }

  .das-dropzone {
    border: 2px dashed var(--border2);
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 20px;
    background: var(--bg);
  }

  .das-dropzone:hover, .das-dropzone.drag-over { border-color: var(--amber); background: #1a1600; }

  .das-dropzone-icon { font-size: 36px; margin-bottom: 12px; }
  .das-dropzone-text { font-size: 14px; color: var(--text2); margin-bottom: 6px; }
  .das-dropzone-hint { font-size: 11px; color: var(--text3); }

  /* ── Broker selector ── */
  .broker-selector-wrap {
    margin-bottom: 20px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 18px;
  }
  .broker-selector-label {
    display: flex; align-items: center; gap: 7px;
    font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text2);
    margin-bottom: 10px;
  }
  .broker-selector-icon { font-size: 14px; }
  .broker-selector-row {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  }
  .broker-selector {
    background: var(--bg);
    border: 1px solid var(--border2);
    border-radius: 7px;
    color: var(--text);
    font-family: var(--title);
    font-size: 14px;
    font-weight: 600;
    padding: 9px 14px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    min-width: 220px;
    appearance: auto;
  }
  .broker-selector:focus { border-color: var(--green); }
  .broker-selector option:disabled { color: var(--text3); }
  .broker-hint {
    font-size: 11px;
    color: var(--text3);
    font-family: var(--title);
    transition: color 0.2s;
  }

  .das-formats {
    background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
    padding: 16px 20px; margin-bottom: 20px; font-size: 11px; color: var(--text3); line-height: 1.8;
  }

  .das-formats strong { color: var(--amber); font-weight: 600; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; display: block; margin-bottom: 8px; }

  .das-formats code { background: var(--bg); color: var(--text2); padding: 1px 5px; border-radius: 3px; font-family: var(--title); font-size: 10px; }

  /* Preview table */
  .das-preview { margin-bottom: 20px; }
  .das-preview-title { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--text3); margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
  .das-preview-count { background: var(--green-dim); color: var(--green); border: 1px solid #00d97e33; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 600; }
  .das-preview-count.warn { background: var(--amber-dim, #ffa50220); color: var(--amber); border-color: #ffa50233; }

  .das-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }

  .das-table { width: 100%; border-collapse: collapse; font-size: 11px; }
  .das-table th { padding: 8px 12px; text-align: left; background: var(--surface2); color: var(--text3); font-size: 9px; letter-spacing: 1.5px; text-transform: uppercase; border-bottom: 1px solid var(--border); font-weight: 500; }
  .das-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text2); }
  .das-table tr:last-child td { border-bottom: none; }
  .das-table tr:hover td { background: var(--surface2); }
  .td-pos { color: var(--green) !important; font-weight: 600; }
  .td-neg { color: var(--red) !important; font-weight: 600; }
  .td-date { color: var(--text); font-weight: 500; }

  /* Conflict warning */
  .das-conflict { background: #ffa50211; border: 1px solid #ffa50244; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; font-size: 12px; color: var(--amber); display: none; }
  .das-conflict.visible { display: block; }
  .das-conflict strong { display: block; margin-bottom: 4px; }

  /* Merge options */
  .das-merge-opts { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

  .merge-opt {
    flex: 1; min-width: 140px;
    padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface2); cursor: pointer; transition: all 0.15s; text-align: left;
  }

  .merge-opt:hover { border-color: var(--border2); }
  .merge-opt.selected { border-color: var(--amber); background: #1a1600; }
  .merge-opt-label { font-size: 11px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
  .merge-opt-desc { font-size: 10px; color: var(--text3); line-height: 1.4; }

  .das-error { background: var(--red-dim); border: 1px solid var(--red); border-radius: 8px; padding: 14px 16px; font-size: 12px; color: var(--red); margin-bottom: 16px; display: none; white-space: pre-wrap; }
  .das-error.visible { display: block; }

  .das-actions { display: flex; gap: 8px; justify-content: flex-end; }
  .das-actions .btn-cancel { margin-right: auto; }

  .progress-bar { height: 3px; background: var(--border); border-radius: 2px; margin-top: 12px; overflow: hidden; display: none; }
  .progress-fill { height: 100%; background: var(--amber); border-radius: 2px; width: 0; transition: width 0.3s; }

  .das-success { text-align: center; padding: 20px; display: none; }
  .das-success.visible { display: block; }
  .das-success-icon { font-size: 48px; margin-bottom: 12px; }
  .das-success-text { font-family: var(--title); font-size: 18px; font-weight: 700; margin-bottom: 6px; color: var(--green); }
  .das-success-sub { font-size: 12px; color: var(--text3); }

  .export-hint { text-align: center; padding: 16px; font-size: 11px; color: var(--text3); letter-spacing: 0.5px; }

  @media (max-width: 1100px) {
    .months-grid { grid-template-columns: repeat(2, 1fr); }
    .annual-stats { grid-template-columns: repeat(3, 1fr); }
    .monthly-summary-row { grid-template-columns: repeat(6, 1fr); }
  }

  @media (max-width: 700px) {
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .months-grid { grid-template-columns: 1fr; }
    .analysis-grid { grid-template-columns: 1fr; }
    .month-title { font-size: 22px; min-width: auto; }
    .day-cell { min-height: 70px; padding: 6px; }
    .tag { display: none; }
    .monthly-summary-row { grid-template-columns: repeat(4, 1fr); }
    .annual-stats { grid-template-columns: repeat(2, 1fr); }
  }

  /* ════ DAY DETAIL SIDE PANEL ════ */
  .side-panel-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    z-index: 150;
  }
  .side-panel-backdrop.active { display: block; }

  .side-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 520px; max-width: 100vw;
    background: var(--surface);
    border-left: 1px solid var(--border2);
    z-index: 151;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    overflow: hidden;
  }
  .side-panel.open { transform: translateX(0); }

  .sp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .sp-header-left { display: flex; flex-direction: column; gap: 4px; }
  .sp-date { font-family: var(--title); font-size: 18px; font-weight: 700; }
  .sp-pnl-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 20px; font-weight: 700; letter-spacing: -0.5px;
  }
  .sp-pnl-badge.pos { color: var(--green); }
  .sp-pnl-badge.neg { color: var(--red); }
  .sp-meta { font-size: 11px; color: var(--text3); margin-top: 2px; }
  .sp-close {
    width: 32px; height: 32px; background: var(--surface2);
    border: 1px solid var(--border); border-radius: 6px;
    color: var(--text2); cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; flex-shrink: 0;
  }
  .sp-close:hover { background: var(--surface3); color: var(--text); }

  .sp-body { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
  .sp-body::-webkit-scrollbar { width: 4px; }
  .sp-body::-webkit-scrollbar-track { background: transparent; }
  .sp-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

  .sp-section-title {
    font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
    color: var(--text3); margin-bottom: 10px;
  }

  /* ticker cards */
  .ticker-list { display: flex; flex-direction: column; gap: 8px; }
  .ticker-card {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 16px;
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
    position: relative; overflow: hidden;
  }
  .ticker-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tc-color, var(--border2)); }
  .ticker-card:hover { border-color: var(--border2); background: var(--surface3); }
  .ticker-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .ticker-sym { font-family: var(--title); font-size: 15px; font-weight: 700; letter-spacing: 0.5px; }
  .ticker-pnl { font-size: 16px; font-weight: 700; }
  .ticker-pnl.pos { color: var(--green); }
  .ticker-pnl.neg { color: var(--red); }
  .ticker-stats { display: flex; gap: 10px; flex-wrap: wrap; }
  .ticker-stat { font-size: 10px; color: var(--text3); }
  .ticker-stat span { color: var(--text2); font-weight: 600; }
  .ticker-chevron { font-size: 12px; color: var(--text3); margin-left: 8px; }

  /* trade list (per ticker) */
  .sp-back-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface2); border: 1px solid var(--border);
    color: var(--text2); padding: 6px 12px; border-radius: 6px;
    cursor: pointer; font-family: var(--title); font-size: 11px;
    transition: all 0.15s; letter-spacing: 0.5px; margin-bottom: 4px;
  }
  .sp-back-btn:hover { background: var(--surface3); color: var(--text); }

  .sp-ticker-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
  }
  .sp-ticker-name { font-family: var(--title); font-size: 22px; font-weight: 700; }
  .sp-ticker-pnl { font-size: 18px; font-weight: 700; }
  .sp-ticker-pnl.pos { color: var(--green); }
  .sp-ticker-pnl.neg { color: var(--red); }

  .trade-list { display: flex; flex-direction: column; gap: 8px; }
  .trade-row {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 14px;
    display: grid; grid-template-columns: auto 1fr auto;
    align-items: center; gap: 12px;
  }
  .trade-num {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--surface3); border: 1px solid var(--border2);
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: var(--text3);
    flex-shrink: 0;
  }
  .trade-info { display: flex; flex-direction: column; gap: 4px; }
  .trade-prices { font-size: 12px; color: var(--text2); }
  .trade-prices .entry { color: var(--blue); font-weight: 600; }
  .trade-prices .exit { font-weight: 600; }
  .trade-prices .exit.pos { color: var(--green); }
  .trade-prices .exit.neg { color: var(--red); }
  .trade-meta { font-size: 10px; color: var(--text3); }
  .trade-pnl { font-size: 15px; font-weight: 700; text-align: right; white-space: nowrap; }
  .trade-pnl.pos { color: var(--green); }
  .trade-pnl.neg { color: var(--red); }

  .trade-side-badge {
    display: inline-flex; align-items: center;
    font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 3px;
    letter-spacing: 0.5px; margin-right: 6px;
  }
  .trade-side-badge.long { background: #4a9eff18; color: var(--blue); border: 1px solid #4a9eff33; }
  .trade-side-badge.short { background: #ffa50218; color: var(--amber); border: 1px solid #ffa50233; }

  /* intraday chart */
  .intraday-wrap {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 10px; padding: 16px; margin-top: 4px;
  }
  .intraday-title-row {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
  }
  .intraday-sym-label { font-family: var(--title); font-size: 12px; font-weight: 700; color: var(--text2); }
  .intraday-status { font-size: 10px; color: var(--text3); }
  canvas#intradayChart { width: 100% !important; height: 160px !important; display: block; }

  .chart-legend { display: flex; gap: 14px; margin-top: 8px; }
  .legend-item { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--text3); }
  .legend-dot { width: 8px; height: 8px; border-radius: 50%; }

  .sp-no-data {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 32px; gap: 8px; color: var(--text3); font-size: 12px; text-align: center;
  }
  .sp-no-data-icon { font-size: 28px; opacity: 0.5; }

  /* ════ FULLSCREEN CHART MODAL ════ */
  .chart-modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.92); backdrop-filter: blur(8px);
    z-index: 300; align-items: center; justify-content: center;
    padding: 20px;
  }
  .chart-modal-overlay.active { display: flex; }

  .chart-modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 16px;
    width: 100%; max-width: 1100px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    animation: slideUp 0.2s ease;
    overflow: hidden;
  }

  .cm-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .cm-header-left { display: flex; align-items: center; gap: 16px; }
  .cm-sym { font-family: var(--title); font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
  .cm-date { font-size: 12px; color: var(--text3); }
  .cm-pnl { font-size: 14px; font-weight: 700; }
  .cm-pnl.pos { color: var(--green); }
  .cm-pnl.neg { color: var(--red); }
  .cm-interval-btns { display: flex; gap: 4px; }
  .cm-interval-btn {
    padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border);
    background: transparent; color: var(--text3);
    font-family: var(--title); font-size: 10px; cursor: pointer;
    transition: all 0.15s; letter-spacing: 0.5px;
  }
  .cm-interval-btn.active { background: var(--surface3); color: var(--text); border-color: var(--border2); }
  .cm-interval-btn:hover:not(.active) { color: var(--text2); }

  .cm-body {
    flex: 1; padding: 20px 24px; display: flex; flex-direction: column; gap: 12px;
    overflow: hidden; min-height: 0;
  }
  .cm-chart-area { flex: 1; position: relative; min-height: 0; }
  canvas#chartModalCanvas { width: 100% !important; display: block; cursor: crosshair; }

  .cm-status { font-size: 10px; color: var(--text3); text-align: right; }

  .cm-legend { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
  .cm-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text3); }
  .cm-legend-dot { width: 10px; height: 10px; border-radius: 50%; }
  .cm-legend-line { width: 18px; height: 2px; border-radius: 1px; }

  .cm-trades-row {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding-top: 12px; border-top: 1px solid var(--border);
    flex-shrink: 0;
  }
  .cm-trade-pill {
    display: flex; align-items: center; gap: 6px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 10px; font-size: 11px;
    cursor: pointer; transition: border-color 0.15s;
  }
  .cm-trade-pill:hover { border-color: var(--border2); }
  .cm-trade-pill .pill-num {
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700;
  }
  .cm-trade-pill .pill-entry { color: var(--blue); font-weight: 600; }
  .cm-trade-pill .pill-exit { font-weight: 600; }
  .cm-trade-pill .pill-pnl { font-weight: 700; }
  .cm-trade-pill .pill-pnl.pos { color: var(--green); }
  .cm-trade-pill .pill-pnl.neg { color: var(--red); }

  /* expand button in side panel */
  .intraday-expand-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface3); border: 1px solid var(--border2);
    color: var(--text2); padding: 5px 10px; border-radius: 5px;
    cursor: pointer; font-family: var(--title); font-size: 10px;
    transition: all 0.15s; letter-spacing: 0.3px;
  }
  .intraday-expand-btn:hover { color: var(--text); border-color: var(--green); }
  /* Hide number input spinners */
  input[type="number"]::-webkit-outer-spin-button,
  input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
