.invest-page{max-width:1500px;margin:0 auto;color:#172033}
.invest-topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}
.invest-topbar h1{font-size:24px;font-weight:750;margin:0}
.invest-topbar p{font-size:12px;color:#667085;margin-top:2px}
.invest-actions,.chart-controls,.form-actions,.segmented,.chart-mode-toggle{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.invest-subnav{display:flex;gap:8px;margin:0 0 12px;overflow-x:auto;padding-bottom:2px}
.invest-subnav button{background:#fff;border:1px solid #e3e8ef;white-space:nowrap}
.invest-subnav button.active{background:#1f2937;color:#fff;border-color:#1f2937}
.invest-view{display:none}
.invest-view.active{display:block}
button,select,input{font:inherit}
button{border:0;border-radius:6px;background:#eef2f6;color:#263548;padding:9px 12px;min-height:40px;cursor:pointer}
button[type=submit],.invest-actions button:last-child,.form-actions button:last-child{background:#2563eb;color:#fff}
button.danger{background:#fee4e2;color:#b42318}
.hidden{display:none!important}
.segmented button.active{background:#1f2937;color:#fff}
.chart-mode-toggle{padding:3px;border:1px solid #edf1f5;border-radius:8px;background:#fbfcfe}
.chart-mode-toggle button{min-height:32px;padding:5px 10px;background:transparent;border-radius:6px;font-size:12px}
.chart-mode-toggle button.active{background:#172033;color:#fff}
.metric-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:12px}
.metric,.panel,.cashflow-strip{background:#fff;border:1px solid #e3e8ef;border-radius:8px;box-shadow:0 1px 2px rgba(16,24,40,.04)}
.metric{padding:14px}
.metric span,.cashflow-strip span{display:block;font-size:12px;color:#667085}
.metric strong{display:block;font-size:24px;line-height:1.15;margin-top:6px;word-break:break-word}
.metric small{display:block;color:#667085;margin-top:4px}
.cashflow-strip{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;margin-bottom:12px;overflow:hidden}
.cashflow-strip div{padding:12px 14px;background:#fff}
.cashflow-strip strong{display:block;margin-top:4px;font-size:18px}
.main-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(360px,.8fr);gap:12px;margin-bottom:12px}
.tables-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin-top:12px}
.tables-grid.active{display:grid}
.monthly-panel{margin-top:12px}
.panel{padding:14px}
.panel-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}
.panel-head h2{font-size:15px;font-weight:700;margin:0}
.panel-note{font-size:12px;color:#667085}
.record-open-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.record-open-actions button{background:#fff;border:1px solid #d0d5dd}
.ledger-filters{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin:-2px 0 12px}
.ledger-filters button{min-height:30px;padding:5px 9px;border:1px solid #d0d5dd;background:#fff;border-radius:999px;font-size:12px;color:#344054}
.ledger-filters button.active{background:#172033;color:#fff;border-color:#172033}
.filter-group{display:inline-flex;gap:4px;align-items:center;padding:3px;border:1px solid #edf1f5;border-radius:999px;background:#fbfcfe}
.filter-group button{border-color:transparent;background:transparent}
.equity-chart{position:relative;height:380px;border:1px solid #edf1f5;border-radius:6px;background:#fbfcfe;overflow:hidden}
.eq-scroll{height:100%;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;overscroll-behavior-y:none}
.equity-svg{display:block;width:max-content;min-width:100%;height:100%}
.eq-grid{stroke:#edf1f5;stroke-width:1}
.eq-week-line{stroke:#e4e7ec;stroke-width:1;stroke-dasharray:3 5}
.eq-month-boundary{stroke:#94a3b8;stroke-width:1.5}
.eq-month-label{fill:#475467;font-size:11px;font-weight:750}
.eq-axis{fill:#667085;font-size:11px}
.eq-title{fill:#344054;font-size:12px;font-weight:650}
.eq-area{fill:none}
.eq-capital-area{fill:#e2e8f0;opacity:.38}
.eq-pnl-band{fill:#22c55e;opacity:.34}
.eq-pnl-band.loss{fill:#ef4444}
.eq-line{fill:none;stroke:#2563eb;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.eq-line.profit{stroke:#16a34a}
.eq-capital-line{fill:none;stroke:#64748b;stroke-width:1.5;stroke-dasharray:5 5;stroke-linecap:round;stroke-linejoin:round}
.eq-dot{fill:#fff;stroke:#2563eb;stroke-width:2}
.eq-dot.last{fill:#2563eb}
.eq-zero-line{stroke:#475467;stroke-width:1.25;stroke-dasharray:6 5}
.eq-profit-bar{fill:#16a34a;opacity:.18}
.eq-profit-bar.loss{fill:#dc2626}
.eq-dot,.eq-event{cursor:help;pointer-events:auto}
.eq-dot:hover,.eq-event:hover{stroke-width:3}
.eq-event.trade{fill:#2563eb;stroke:#fff;stroke-width:1.5}
.eq-event.trade.win{fill:#16a34a}
.eq-event.trade.loss{fill:#dc2626}
.eq-lane-label{fill:#98a2b3;font-size:10px;font-weight:650}
.eq-guide{stroke:#98a2b3;stroke-dasharray:4 4}
.eq-active-label{position:absolute;z-index:3;width:188px;padding:8px 10px;border-radius:6px;background:#172033;color:#fff;box-shadow:0 12px 28px rgba(15,23,42,.22);pointer-events:none}
.eq-active-label strong,.eq-active-label span,.eq-active-label small,.eq-active-label em{display:block;line-height:1.35}
.eq-active-label strong{font-size:12px;color:#cbd5e1;font-weight:500}
.eq-active-label span{font-size:13px;font-weight:750}
.eq-active-label small{font-size:11px;color:#e2e8f0}
.eq-active-label em{margin-top:4px;color:#cbd5e1;font-size:11px;font-style:normal}
.empty-chart{height:100%;display:grid;place-items:center;color:#667085;font-size:13px}
.candle-chart{height:430px;border:1px solid #edf1f5;border-radius:6px;background:#fff}
.record-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.record-form.hidden{display:none}
.record-form label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:#667085}
.record-form input,.record-form select,.chart-controls select{border:1px solid #d0d5dd;border-radius:6px;padding:9px 10px;min-height:40px;background:#fff;color:#172033}
.record-form .wide,.record-form .form-actions{grid-column:1/-1}
.form-actions{justify-content:flex-end}
.drawer-backdrop{position:fixed;inset:0;z-index:70;background:rgba(15,23,42,.34)}
.record-drawer{position:fixed;top:0;right:0;bottom:0;z-index:80;width:min(520px,100vw);background:#fff;border-left:1px solid #e3e8ef;box-shadow:-18px 0 48px rgba(15,23,42,.18);padding:16px;overflow:auto}
.record-drawer.hidden,.drawer-backdrop.hidden{display:none}
.toast{position:fixed;right:18px;bottom:18px;z-index:120;max-width:min(360px,calc(100vw - 36px));padding:10px 12px;border-radius:6px;background:#172033;color:#fff;font-size:13px;box-shadow:0 14px 34px rgba(15,23,42,.24)}
.drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}
.drawer-head h2{font-size:18px;font-weight:750;margin:0}
.drawer-head p{font-size:12px;color:#667085;margin:2px 0 0}
.drawer-tabs{margin-bottom:14px}
.table-wrap{overflow:auto}
.ledger-wrap{max-height:690px}
table{width:100%;border-collapse:collapse;font-size:13px}
th,td{text-align:left;border-bottom:1px solid #edf1f5;padding:9px;white-space:nowrap}
th{color:#667085;font-weight:600}
.ledger-table th{position:sticky;top:0;background:#fff;z-index:1}
.ledger-table .snapshot-line td{background:#f8fafc;font-weight:600}
.ledger-table .trade-line td{background:#fffaf0}
.ledger-table td:nth-child(3){white-space:normal;min-width:170px}
.type-tag{display:inline-flex;align-items:center;min-height:22px;padding:2px 8px;border-radius:999px;background:#eef2f6;color:#344054;font-size:12px;font-weight:650}
.type-tag.in{background:#ecfdf3;color:#047857}
.type-tag.out{background:#fef2f2;color:#b42318}
.type-tag.snapshot{background:#eff6ff;color:#1d4ed8}
.type-tag.trade{background:#fff7ed;color:#c2410c}
.record-row{border:1px solid #edf1f5;border-radius:6px;padding:8px;margin-bottom:6px;background:#fbfcfe}
.record-row strong{display:block;font-size:13px}
.record-row span{display:block;font-size:12px;color:#667085;margin-top:2px}
.record-row .row-actions{display:flex;gap:6px;margin-top:8px}
.record-row .row-actions button{min-height:32px;padding:5px 8px;font-size:12px}
.positive{color:#15803d}.negative{color:#dc2626}
@media(max-width:1100px){.metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.main-grid,.tables-grid{grid-template-columns:1fr}}
@media(max-width:760px){
  .invest-page{max-width:none}
  .invest-topbar{align-items:flex-start;flex-direction:column;margin-bottom:12px}
  .invest-topbar h1{font-size:21px}
  .invest-actions,.invest-actions button,.record-open-actions,.record-open-actions button,.chart-controls,.chart-controls select,.chart-controls button{width:100%}
  .invest-subnav{position:sticky;top:0;z-index:12;margin-left:-12px;margin-right:-12px;padding:8px 12px;background:#f3f4f6;border-block:1px solid #e5e7eb}
  .invest-subnav button{flex:1 0 auto}
  .panel{padding:12px}
  .panel-head{align-items:flex-start;flex-direction:column;gap:10px}
  .chart-mode-toggle{width:100%;display:grid;grid-template-columns:1fr 1fr}
  .chart-mode-toggle button{width:100%}
  .metric-grid,.cashflow-strip,.record-form{grid-template-columns:1fr}
  .metric{padding:12px}
  .metric strong{font-size:22px}
  .cashflow-strip div{padding:11px 12px}
  .equity-chart{height:330px}
  .eq-active-label{width:min(188px,calc(100vw - 48px))}
  .candle-chart{height:340px}
  .ledger-filters{flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px}
  .filter-group{flex:0 0 auto}
  .table-wrap{overflow:visible}
  .monthly-table thead,.ledger-table thead{display:none}
  .monthly-table,.monthly-table tbody,.monthly-table tr,.monthly-table td,.ledger-table,.ledger-table tbody,.ledger-table tr,.ledger-table td{display:block;width:100%}
  .monthly-table tr,.ledger-table tr{border:1px solid #e3e8ef;border-radius:8px;background:#fff;margin-bottom:10px;padding:8px;box-shadow:0 1px 2px rgba(16,24,40,.04)}
  .monthly-table td,.ledger-table td{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;border-bottom:1px solid #edf1f5;padding:7px 4px;white-space:normal;text-align:right}
  .monthly-table td:last-child,.ledger-table td:last-child{border-bottom:0}
  .monthly-table td::before,.ledger-table td::before{content:attr(data-label);flex:0 0 auto;color:#667085;font-size:12px;font-weight:650;text-align:left}
  .ledger-table td:nth-child(3){min-width:0}
  .ledger-table .row-actions{justify-content:flex-end}
  .ledger-wrap{max-height:none}
  .record-drawer{width:100vw;padding:14px}
  .drawer-head{position:sticky;top:0;z-index:2;background:#fff;padding-bottom:10px}
  .form-actions{display:grid;grid-template-columns:1fr 1fr}
  .form-actions button{width:100%}
}
