stocks / static /css /trades.css
user
python version
ee446e8
Raw History Blame Contribute Delete
41.4 kB
/* ═══════════════════════════════════════════════════════════════════════ Trades β€” Hero Stats Β· Charts (Win/Loss | Equity | Daily P&L) Β· Calendar ═══════════════════════════════════════════════════════════════════════ */ /* ── Page tabs: Trades | Playbook ── The Playbook moved in from its own page, so it is a tab here; the active one is in ?tab= (see features/trades/tabs.ts). The trades panel restates --trades-layout-offset because the tab bar is now chrome above the full-height layout, which the shared value (page-wrapper padding) does not know about. The mobile tabs further down are a different, nested set and keep their own class. */ .trades-tab-panel--trades { --trades-layout-offset: calc(var(--space-sm) + var(--space-xl) + var(--space-xxl) + var(--space-md)); } .trades-tabs { display: flex; gap: var(--space-xs); margin-bottom: var(--space-md); } .trades-tab { flex: 1; min-height: var(--control-height); padding: 0 var(--space-md); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-muted); font-family: var(--font-sans); font-size: var(--font-sm); font-weight: 600; cursor: pointer; transition: background var(--transition-fast), color var(--transition-fast); } .trades-tab:hover { background: var(--overlay-1); color: var(--text); } .trades-tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); } /* ── Main area: trades layout (left) + stats column (right) ── The status line, stats and summary charts live in a fixed-width right column so the trades panel keeps the full viewport height. */ .trades-area { display: grid; grid-template-columns: minmax(0, 1fr) var(--trades-side-col-width, 300px); gap: var(--space-md); align-items: start; /* The stats-column seam rides the column's own width, so the splitter's size variable and the handle's offset are one property. */ position: relative; } .trades-area > .panel-resize-handle { right: calc(var(--trades-side-col-width, 300px) - 5px); } /* No seam to drag once the column is collapsed into its rail, or when the no-trades state drops the column entirely. */ .trades-area.side-col-collapsed > .panel-resize-handle, .trades-area:has(.hero-stats.hidden) > .panel-resize-handle { display: none; } /* The right column is ONE grid item so the status line + stats stack flush at the top β€” as direct grid items they'd sit below the taller trades panel (the layout spans both rows). */ .trades-side-col { grid-column: 2; grid-row: 1 / -1; display: flex; flex-direction: column; gap: var(--space-sm); min-width: 0; } /* No trades β†’ hero-stats and trades-layout get .hidden together, so collapse the right column away instead of leaving an empty slot. */ .trades-area:has(.hero-stats.hidden) { grid-template-columns: 1fr; } .trades-area:has(.hero-stats.hidden) .trades-side-col { grid-column: auto; grid-row: auto; } /* ── Collapsible right column (desktop) ── A toggle at the top of the stats column collapses it into a slim rail (just the toggle button) so the chart gets the full width. The class is toggled on .trades-area from trades-page.js and persisted in localStorage. Below 900px the layout stacks, so the collapse is desktop-only. */ .trades-side-toggle-row { display: flex; justify-content: flex-end; flex-shrink: 0; } .trades-side-toggle { background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); width: var(--space-xl); height: var(--space-xl); line-height: 1; font-size: var(--font-md); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color var(--transition-fast), color var(--transition-fast); } .trades-side-toggle:hover { border-color: var(--accent); color: var(--text); } @media (width > 900px) { .trades-area.side-col-collapsed { grid-template-columns: minmax(0, 1fr) auto; } .trades-area.side-col-collapsed .trades-side-col { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-width: 0; } .trades-area.side-col-collapsed .hero-stats { display: none; } .trades-area.side-col-collapsed .trades-side-toggle-row { width: 100%; } .trades-area.side-col-collapsed .trades-side-toggle { border-radius: var(--radius-md); } } /* ── Status line (right column header) ── Replaced the control panel that used to sit here: nothing is reported while the data is healthy, so the strip collapses to zero height and the manual-OAuth button only takes up room next to a failed load. */ .trades-status { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; flex-shrink: 0; color: var(--text-dim); } /* Empty message β†’ nothing to show (the reconnect button carries .hidden until a load fails), so the strip takes no vertical space. */ .trades-status #status:empty { display: none; } /* ── Stats column (right): 6 stats + 3 summary charts ── Single elevated container (one border, one radius). A 1px grid gap over the container background renders the internal dividers (same trick as .cal-grid). P&L and Days span both columns; the rest sit in 2 columns; the charts stack below, each full width. */ .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; } .hero-stat { background: var(--bg-elevated); padding: var(--space-sm) var(--space-md); display: flex; flex-direction: column; align-items: center; gap: var(--space-2xs); min-width: 0; } .hero-stat[data-metric="pnl"], .hero-stat[data-metric="days"] { grid-column: 1 / -1; } .hero-chart { grid-column: 1 / -1; background: var(--bg-elevated); min-width: 0; padding: var(--space-sm) var(--space-md); display: flex; flex-direction: column; } .hero-chart .lt-summary-chart { width: 100%; height: 96px; display: block; } /* `.hidden` (common.css, plain display:none) loses to the display rules above because trades.css loads after β€” so restate it with higher specificity. (This also fixes the pre-existing no-trades state where hero-stats / trades-layout never actually hid.) */ .hero-stats.hidden, .hero-chart.hidden, .trades-layout.hidden { display: none; } .hero-label { font-family: var(--font-sans); font-size: var(--font-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; line-height: 1; } .hero-value { font-family: var(--font-sans); font-size: var(--font-lg); font-weight: 700; line-height: 1.1; display: flex; flex-direction: column; align-items: center; gap: 1px; } .hero-value .positive { color: var(--positive); } .hero-value .negative { color: var(--negative); } .hero-main { color: var(--text); } .hero-sub { font-family: var(--font-sans); font-size: var(--font-xs); font-weight: 500; color: var(--text-muted); line-height: 1; } /* P&L stays the visual anchor of the row β€” everything else is dialed back a step so the hierarchy reads P&L first, supporting stats second. */ .hero-stat[data-metric="pnl"] .hero-value { font-size: var(--font-xxl); } .hero-stat[data-metric="wr"] .hero-value { font-size: var(--font-lg); } .hero-stat[data-metric="pf"] .hero-value { font-size: var(--font-lg); } .hero-stat[data-metric="avg"] .hero-value { font-size: var(--font-md); } .hero-stat[data-metric="trades"] .hero-value, .hero-stat[data-metric="days"] .hero-value { font-size: var(--font-lg); color: var(--text); } /* ── Summary chart titles (used inside .hero-chart) ── */ .chart-title { font-family: var(--font-sans); font-size: var(--font-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 var(--space-xs); } /* ═══════════════════════════════════════════════════════════════════════ Trades Layout β€” left column: Calendar (top) + Trades table (below); right column: the trade chart panel (full height). The control panel and stats column live in .trades-area to the right, so this panel keeps all height. ═══════════════════════════════════════════════════════════════════════ */ .trades-layout { display: grid; /* 420px is the fallback width for an unset --trades-calendar-width; the tokens with this value are heights. */ grid-template-columns: minmax(0, var(--trades-calendar-width, 420px)) minmax(0, 1fr); grid-template-rows: var(--trades-calendar-height, auto) 1fr; gap: var(--space-md); /* Same one-property contract as the stats seam: the calendar column's width and the vertical handle's offset both read this token. */ position: relative; /* Definite height (not just min-height) so the calendar (row 1, auto), the trades table (row 2, 1fr) and the full-height chart panel actually stretch to use ALL the free vertical space below the control/stats column β€” the height fills the viewport; `--trades-layout-offset` accounts for the page-wrapper's top+bottom padding (there's no page header on this view). Internal overflow scrolls inside each panel. */ height: calc(var(--viewport-h) - var(--trades-layout-offset)); grid-column: 1; grid-row: 1 / -1; } .trades-layout > .panel-resize-handle { /* Same 420px fallback as .trades-layout: a width, not a token height. */ left: var(--trades-calendar-width, 420px); } /* The row seam is an in-flow grid item pinned to the calendar row's bottom edge, not an absolutely positioned one: `.trades-layout` is the grid, and an abspos child would sit at the grid's static position instead of the calendar's bottom. In flow, `align-self: end` puts it on the seam, and the negative margin straddles it (5px inside the calendar, 5px into the gap) without adding to the row's auto height. */ .trades-calendar-seam { grid-column: 1; grid-row: 1; align-self: end; position: relative; /* Bottom margin, not top: the grid item's margin box is what `align-self: end` pins to the row's bottom edge, so this is the side of the margin that has to go negative to straddle the seam. */ margin-top: 0; margin-bottom: -5px; } .calendar-section { grid-column: 1; grid-row: 1; overflow: hidden; animation: fadeIn 0.2s ease-out; min-width: 0; display: flex; flex-direction: column; } /* Row 2 right column β€” trade chart panel. Sits beside the trades sidebar in the same row, below the full-width calendar. */ .trades-panel { grid-column: 2; grid-row: 1 / -1; display: flex; flex-direction: column; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; min-height: 0; } .trades-sidebar { grid-column: 1; grid-row: 2; min-width: 0; overflow: hidden; display: flex; flex-direction: column; min-height: 0; } .trades-main-cell { display: flex; flex-direction: column; min-height: 0; min-width: 0; flex: 1; padding: var(--space-sm); } /* ── Empty hint (shown when no trade selected) ── */ /* Nothing selected: a one-line prompt, not a 440px empty pane. The chart panel takes the space when a trade is chosen. */ .trades-empty-hint { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: var(--space-md); } .trades-empty-hint p { color: var(--text-muted); font-family: var(--font-sans); font-size: var(--font-sm); margin: 0; } .trades-empty-hint.hidden { display: none; } /* ═══════════════════════════════════════════════════════════════════════ Calendar ═══════════════════════════════════════════════════════════════════════ */ .calendar-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border); flex-shrink: 0; /* A custom range adds a second row of date inputs β€” let the header wrap instead of squeezing the month label. */ flex-wrap: wrap; } .calendar-nav { display: flex; align-items: center; gap: var(--space-sm); } .calendar-month { font-family: var(--font-sans); font-size: var(--font-lg); font-weight: 600; min-width: 140px; text-align: center; } /* 5-column grid: one per weekday (no weekly-stats column β€” those stats live in the summary charts above, freeing width for legible day cells). */ .cal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--border); border-top: 1px solid var(--border); } .cal-day-header { background: var(--bg); padding: var(--space-xs) var(--space-xs-plus); text-align: center; font-size: var(--font-xs); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; } .cal-day-header:last-child { text-align: left; padding-left: var(--space-sm); } /* ── Day cells ── Base component lives in common.css (.cal-day, shared with the scanner calendar; P&L tint + today/selected layering included). Trades-only dimension override: denser 54px cells. */ .cal-day { min-height: 54px; } .cal-day--empty { min-height: 54px; } .day-pnl { font-family: var(--font-sans); font-size: var(--font-md); font-weight: 700; line-height: 1; padding: 1px var(--space-xs); border-radius: var(--radius-sm); white-space: nowrap; /* Always white for legibility β€” the cell background carries the sign. */ color: var(--text); } .day-pnl.positive { color: var(--text); } .day-pnl.negative { color: var(--text); } .day-stats { display: flex; flex-wrap: wrap; gap: var(--space-xs); align-items: center; margin-top: 1px; } .day-trades { font-family: var(--font-sans); font-size: var(--font-xs); color: var(--text-muted); } .day-wins { font-family: var(--font-sans); font-size: var(--font-xs); font-weight: 600; color: var(--text); } .day-losses { font-family: var(--font-sans); font-size: var(--font-xs); font-weight: 600; color: var(--text); } .day-wr { font-family: var(--font-sans); font-size: var(--font-xs); color: var(--text-muted); } /* ═══════════════════════════════════════════════════════════════════════ Trades Table (inside sidebar column) ═══════════════════════════════════════════════════════════════════════ */ .trades-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border); flex-shrink: 0; } .trades-filter-bar { padding: var(--space-xs) var(--space-md); border-bottom: 1px solid var(--border); flex-shrink: 0; } .trades-search-input { width: 100%; padding: var(--space-xs) var(--space-sm); font-size: var(--font-xs); } .trades-count { font-family: var(--font-sans); font-size: var(--font-xs); color: var(--text-muted); } .trades-filter-clear { background: none; border: 1px solid var(--border); color: var(--text-muted); font-size: var(--font-xs); cursor: pointer; padding: 0 5px; margin-left: var(--space-xs); border-radius: var(--radius-sm); line-height: 1.4; vertical-align: middle; transition: border-color var(--transition-fast), color var(--transition-fast); } .trades-filter-clear:hover { border-color: var(--accent); color: var(--text); } /* These two are scoped to .trades-sidebar on purpose. common.css declares `.trades-table-wrap { overflow-x: auto }` and `.trades-table { min-width: 500px }` as shared rules, and both contradict what this page needs. At one class each the page only won because its <link> came later; a scope beats the shared rule on specificity, so the page owns its own layout whatever order the stylesheets load in. The shared copies are deleted wholesale in STY-5.5/STY-Z, and `.results-table-container` β€” the third name in that shared block β€” is the scanner's, not this page's. */ .trades-sidebar .trades-table-wrap { overflow: hidden auto; flex: 1 1 0; min-height: 0; /* Definite width so the table's `width:100%` resolves against the ~340px sidebar column instead of falling back to the table's min-content width, which would let it grow past the sidebar. */ width: 100%; min-width: 0; } .trades-sidebar .trades-table { width: 100%; min-width: 0; font-family: var(--font-sans); font-size: var(--font-sm); /* Fixed layout keeps the table within the ~340px sidebar column so it never needs horizontal scroll; the symbol column truncates with an ellipsis. min-width:0 is the opposite of the shared 500px, which overflowed the sidebar; the phone branch below gives the width back. */ table-layout: fixed; } /* This table scrolls on the page rather than on a card, so its sticky fill is --bg. Cell padding, font and header look are the shared `.data-table` ones. */ .trades-table thead th { background: var(--bg); white-space: nowrap; } .trades-table tbody tr { cursor: pointer; transition: background var(--transition-fast); border-bottom: 1px solid var(--border); } .trades-table tbody tr:hover { background: var(--overlay-1); } .trades-table tbody tr.trade-row--selected { background: var(--overlay-2); } .trades-table td { white-space: nowrap; vertical-align: middle; } /* Symbol cell: ticker, label pills and setup badge share one wrapping row, so a symbol carrying two labels still reads as a single entry. */ .trade-row-sym { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; } /* Fixed-layout column widths as PERCENTAGES summing to exactly 100%. table-layout:fixed does NOT proportionally shrink px column widths that exceed the table's own width β€” it just renders the table wider than its container and the last column gets clipped by .trades-table-wrap's overflow:hidden (this happened for real: 370px of px-widths inside a 359px sidebar silently cut ~11px off the Shares column). Percentages are immune to this β€” they always sum to the table's actual width, whatever that is, so this can't recur even if the sidebar width changes again later. */ .trades-table .th-sym, .trades-table .td-sym { width: 16%; } .trades-table .th-date, .trades-table .td-date { width: 15%; } .trades-table .th-pnl, .trades-table .td-pnl { width: 20%; } /* The numeric headers follow their cells: right-aligned figures need a right-aligned label above them. */ .trades-table .th-pnl, .trades-table .th-entry, .trades-table .th-exit, .trades-table .th-shares { text-align: right; } .trades-table .th-entry, .trades-table .td-entry, .trades-table .th-exit, .trades-table .td-exit { width: 17%; } .trades-table .th-shares, .trades-table .td-shares { width: 15%; } .trades-table .td-sym, .trades-table .td-date, .trades-table .td-pnl, .trades-table .td-entry, .trades-table .td-exit, .trades-table .td-shares { overflow: hidden; text-overflow: ellipsis; } .trades-table .td-sym { font-weight: 600; color: var(--text); } .trades-table .td-date { color: var(--text-muted); font-size: var(--font-xs); } .trades-table .td-pnl { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; } .trades-table .td-entry, .trades-table .td-exit, .trades-table .td-shares { text-align: right; font-family: var(--font-mono); font-size: var(--font-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; } /* ── Trade chart panel (fills .trades-main-cell; the surrounding border, background and radius live one level up on .trades-panel, so this is not a card of its own) ── */ .trade-chart-panel { overflow: hidden; animation: fadeIn 0.2s ease-out; /* Fill the .trades-main-cell completely; the min-height is the real floor for the whole trades-panel row (it and .trades-empty-hint are what the row's height is intrinsically measured from). */ flex: 1; min-height: 440px; display: flex; flex-direction: column; } .trade-chart-panel-header { display: flex; align-items: center; justify-content: space-between; padding: var(--space-sm) var(--space-md); border-bottom: 1px solid var(--border); gap: var(--space-md); /* Anchors the absolutely-positioned meta row inside the sheet. */ position: relative; } .trade-chart-panel-title { font-family: var(--font-sans); font-size: var(--font-sm); font-weight: 700; margin: 0; } /* The date trails the ticker at body weight, not the title's 700. */ .trade-chart-panel-date { color: var(--text-muted); font-weight: 400; } .trade-chart-panel-meta { display: flex; gap: var(--space-md); font-family: var(--font-sans); font-size: var(--font-xs); color: var(--text-muted); } .trade-chart-panel-close { position: absolute; right: var(--space-sm); top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: var(--font-md); padding: var(--space-xs); line-height: 1; border-radius: var(--radius-sm); transition: color var(--transition-fast); } .trade-chart-panel-close:hover { color: var(--text); background: var(--overlay-1); } .trade-chart-panel .tf-selector { border-bottom: 1px solid var(--border); } .trade-chart-panel-inner { flex: 1 1 0; /* Chart gets space FIRST: it must stay comfortable even when the panel row is short (compact charts/calendar above); the legs table below shrinks and scrolls internally instead. */ min-height: 180px; padding: var(--space-sm); } .trade-chart-panel-inner stock-chart-card { width: 100%; height: 100%; /* No `display` here on purpose: this custom element sets its own display internally via `:host` (block) / `:host([fill])` (flex) in chart-card-element.js β€” an external `display: block` here used to fight the [fill] variant's flex column, leaving `.body`/`.chart-container` at height:0 despite this wrapper being sized correctly. */ } /* ── Legs table: entries/exits of the selected trade, below the chart. Clicking a row centers the chart on that bar (see zoomTradeLeg). ── */ .trade-chart-panel-legs { flex: 0 1 auto; /* Legs never steal the chart's space: capped, shrinks first, scrolls internally when the row is short. */ max-height: 160px; min-height: 0; overflow-y: auto; border-top: 1px solid var(--border); padding: var(--space-sm); } .trade-legs-title { font-family: var(--font-sans); font-size: var(--font-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: var(--space-xs); } .trade-legs-table { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: var(--font-xs); } /* The legs table is a shared `.data-table` (cell padding, font and header look come from it); only its row rules are its own. */ .trade-legs-table td { border-bottom: 1px solid var(--border); white-space: nowrap; } .trade-leg-row { cursor: pointer; transition: background var(--transition-fast); } .trade-leg-row:hover { background: var(--overlay-1); } .trade-leg-row.active { background: var(--overlay-2); box-shadow: inset var(--radius-sm) 0 0 var(--accent); } .trade-leg-row:last-child td { border-bottom: none; } .leg-side { font-weight: 600; } .leg-buy .leg-side { color: var(--positive); } .leg-sell .leg-side { color: var(--negative); } /* ── Chart Tooltip ── */ .chart-tooltip { position: fixed; z-index: var(--z-1000); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-xs) var(--space-sm); font-family: var(--font-sans); font-size: var(--font-xs); color: var(--text); pointer-events: none; box-shadow: 0 var(--space-xs) var(--space-sm-plus) color-mix(in srgb, var(--black) 30%, transparent); white-space: nowrap; line-height: 1.4; } .chart-tooltip.hidden { display: none; } /* ── Period selector (calendar header) ── Compact by design: the header row is already occupied by the month nav, so the select drops the .input-field min-width/padding for a single line. */ .calendar-period { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-xs); flex-wrap: wrap; } .calendar-period__label { white-space: nowrap; } .calendar-period__select { min-width: 0; max-width: 140px; padding: var(--space-xs) var(--space-sm); font-size: var(--font-xs); } .calendar-period__select:disabled { opacity: 0.6; cursor: not-allowed; } .calendar-period__indicator { white-space: nowrap; color: var(--text-dim); } .calendar-period__hint { white-space: nowrap; color: var(--text-dim); cursor: help; } .calendar-period__custom { display: flex; align-items: center; gap: var(--space-xs); flex-wrap: wrap; } .calendar-period__custom.hidden { display: none; } .calendar-period__date { min-width: 0; padding: var(--space-xs) var(--space-sm); font-size: var(--font-xs); max-width: 130px; } .btn-xs { padding: var(--space-xs) var(--space-sm); font-size: var(--font-xs); /* 24px is this button's floor; --spinner-size and --space-lg share the value but name a ring box and a spacing step. */ min-height: 24px; } .calendar-period__range { display: flex; align-items: center; gap: var(--space-xs); } .calendar-period__range .input-field { min-width: 0; padding: var(--space-xs) var(--space-sm); font-size: var(--font-xs); } /* ═══════════════════════════════════════════════════════════════════════ Responsive ═══════════════════════════════════════════════════════════════════════ */ @media (width <= 1024px) { .trades-area { grid-template-columns: minmax(0, 1fr) 260px; gap: var(--space-sm); } .trades-layout { /* 360px is the calendar column floor, not a chart width: --chart-min-width has the same value but names a chart. */ grid-template-columns: minmax(min(var(--split-card-min-mobile), 100%), 360px) 1fr; gap: var(--space-sm); } } /* ── Tablet breakpoint (≀1024px): collapse both grids to single column instead of keeping 2 compressed columns down to 768px ── */ @media (width <= 1024px) { .trades-area { grid-template-columns: 1fr; } .trades-side-col { grid-column: auto; grid-row: auto; display: flex; flex-direction: column; gap: var(--space-sm); } /* Collapse is desktop-only; neutralize on tablet/mobile */ .trades-area.side-col-collapsed { grid-template-columns: 1fr; } .trades-area.side-col-collapsed .trades-side-col { grid-column: auto; grid-row: auto; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: var(--space-sm); } .trades-area.side-col-collapsed .hero-stats { display: initial; } .trades-side-toggle-row { display: none; } /* minmax(0, 1fr): a bare 1fr is minmax(auto, 1fr), so the single column grows to the trades table's 500px min-width and pushes the page out of the phone viewport (overflow 128px at 390, 198px at 320). */ .trades-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; gap: var(--space-md); /* Release the definite viewport height from the base rule β€” the stacked single-column layout grows with its content. */ height: auto; min-height: 0; } /* Stacked, every panel is content-sized and there is no fixed space to divide: the seams would chase their own ceiling, so they stand down. splitter.ts gates on the same breakpoint, which also clears any stored size instead of letting it outlive the layout it was measured in. */ .trades-area > .panel-resize-handle, .trades-layout > .panel-resize-handle { display: none; } .calendar-section { grid-column: 1; grid-row: 1; margin-bottom: var(--space-md); } .trades-sidebar { grid-column: 1; grid-row: 2; min-height: 300px; margin-bottom: var(--space-md); } .trades-panel { grid-column: 1; grid-row: 3; min-height: var(--split-card-min); } } /* ── Mobile tabs base styles (desktop/tablet): hidden tabs, content unwrapped ── */ .trades-mobile-tabs { display: none; } .trades-mobile-tab-content { display: contents; } /* Duplicate calendar only for mobile Calendario tab */ #tab-calendario { display: none; } @media (width <= 768px) { /* Mobile: tabs (Resumen | Calendario | Trades) instead of vertical stack. Trade chart opens as modal/bottom-sheet. */ .trades-area { display: flex; flex-direction: column; } .trades-side-col { display: contents; } .hero-stats { grid-template-columns: repeat(3, 1fr); margin-top: var(--space-md); } .hero-stats > * { grid-column: auto; } .hero-stat[data-metric="pnl"], .hero-stat[data-metric="days"] { grid-column: auto; } .hero-chart .lt-summary-chart { height: 64px; } /* Mobile tabs */ .trades-mobile-tabs { display: flex; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: var(--space-md); } .trades-mobile-tab { flex: 1; padding: var(--space-sm) var(--space-md); background: transparent; border: none; color: var(--text-muted); font-family: var(--font-sans); font-size: var(--font-sm); font-weight: 600; cursor: pointer; transition: background var(--transition-fast), color var(--transition-fast); white-space: nowrap; } .trades-mobile-tab:hover { background: var(--overlay-1); color: var(--text); } .trades-mobile-tab.active { background: var(--accent); color: var(--on-accent); } .trades-mobile-tab-content { display: none; } .trades-mobile-tab-content.active { display: block; animation: fadeIn 0.2s ease-out; } /* Allow duplicate calendar to participate in tabs on mobile */ #tab-calendario { display: none; } #tab-calendario.active { display: block; animation: fadeIn 0.2s ease-out; } /* Stack the layout sections as tab content */ .calendar-section, .trades-sidebar, .trades-panel { margin-bottom: 0; min-height: auto; } .trades-sidebar { min-height: 300px; } .trades-panel { min-height: 0; } /* Trade chart panel as bottom-sheet modal on mobile */ .trade-chart-panel { position: fixed; bottom: 0; left: 0; right: 0; z-index: var(--z-100); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: 0 -4px var(--space-lg) color-mix(in srgb, var(--black) 40%, transparent); /* Rounded top corners butted against the physical bottom edge: pad by the home indicator so the sheet keeps its inset look. */ padding-bottom: var(--safe-b); max-height: 85vh; max-height: 85dvh; min-height: auto; flex: none; transform: translateY(100%); /* The top of the scale, and the only site that needs it: the sheet travels the full height of the viewport, so the step below reads as a jump rather than a slide. The scrim below it keeps the faster one -- a fade should be over by the time the panel lands. */ transition: transform var(--transition-slower) ease-out; } .trade-chart-panel.open { transform: translateY(0); } .trade-chart-panel-overlay { position: fixed; inset: 0; background: color-mix(in srgb, var(--black) 50%, transparent); z-index: var(--z-50); opacity: 0; visibility: hidden; transition: opacity var(--transition-slow) ease, visibility var(--transition-slow) ease; } .trade-chart-panel-overlay.open { opacity: 1; visibility: visible; } .trade-chart-panel-inner { max-height: calc(85vh - 180px); max-height: calc(85dvh - 180px); overflow-y: auto; } .trades-main-cell { min-height: 0; padding: 0; } .trades-empty-hint { min-height: 200px; } /* Fix cal-grid: remove overflow-x:auto, use smaller minmax like 480px breakpoint */ .cal-grid { grid-template-columns: repeat(5, minmax(min(42px, 100%), 1fr)); overflow-x: visible; } .cal-day { min-height: 64px; padding: var(--space-xs); } .calendar-month { font-size: var(--font-md); min-width: 100px; } /* Trades table on a phone: the base rules keep it inside the ~340px sidebar with table-layout:fixed and overflow:hidden, which leaves Entry/Exit/Shares at ~50px each and cuts every nowrap cell mid-word β€” no scroll, no ellipsis. Give the table its real minimum width back and let the wrapper scroll, then pin the symbol column so the row identity stays visible while the numbers scroll under it. */ .trades-sidebar .trades-table-wrap { overflow-x: auto; } .trades-sidebar .trades-table { min-width: 500px; } .trades-table .th-sym, .trades-table .td-sym { position: sticky; left: 0; z-index: var(--z-2); } /* A pinned cell has to be opaque or the scrolled columns show through it, and it has to carry the row's own tint so hover and selection still read the same as on the rest of the row. */ .trades-table tbody .td-sym { background: var(--bg-elevated); } .trades-table tbody tr:hover .td-sym { background: var(--overlay-1); } .trades-table tbody tr.trade-row--selected .td-sym { background: var(--overlay-2); } } @media (width <= 480px) { /* The auth gate's manual OAuth fallback is a bare link (16px tall); give it the audit's 28px touch floor. The text keeps its size. */ #auth-manual-hint a { display: inline-flex; align-items: center; min-height: var(--touch-floor); } /* A phone-width header has room for the month nav on one line and the period select on the next; a custom range then needs its two date inputs stacked to keep them tappable. */ .calendar-period { width: 100%; justify-content: flex-start; } .calendar-period__select { max-width: none; } .calendar-period__range { flex-direction: column; align-items: stretch; } /* Three ~110px cells with --font-lg values do not fit a 360px phone, so the stats go to two columns and the headline P&L gets its own full-width row. */ .hero-stats { grid-template-columns: repeat(2, 1fr); } .hero-stat[data-metric="pnl"] { grid-column: 1 / -1; } .hero-stat[data-metric="pnl"] .hero-value { font-size: var(--font-lg); } /* Five 62px columns of 11px micro-metrics make an unreadable grey block that eats half the screen, so below 480px the month becomes a list: one row per day that actually traded β€” day number, PnL, then the counts β€” which is the pattern trading apps use on phones and gives the trades panel back ~200px of height. */ .cal-grid { grid-template-columns: 1fr; gap: 0; } .cal-day-header { display: none; } .cal-day, .cal-day--empty { min-height: 0; } /* Weekday padding and days without a P&L chip carry no information in a single-column list. */ .cal-day--empty, .cal-day:not(:has(.day-pnl)) { display: none; } .cal-day { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm); } .day-num { font-size: var(--font-sm); width: 2.25em; flex-shrink: 0; } .day-pnl { font-size: var(--font-icon); padding: 1px var(--space-xs); margin-left: auto; } .day-stats { gap: var(--space-sm); flex-wrap: nowrap; min-width: 7.5em; justify-content: flex-end; } .day-trades, .day-wins, .day-losses, .day-wr { font-size: var(--font-xs); } .trades-mobile-tab { /* inline-flex so the 28px floor is a hit area rather than a taller line box: the tab is tapped on a phone, where the padding-only height (23px at --font-xs) is under the audit's touch floor. */ display: inline-flex; align-items: center; justify-content: center; min-height: var(--tab-height); font-size: var(--font-xs); padding: var(--space-xs) var(--space-sm); } } /* ── Trade Tags & Playbook Setups ── */ /* The annotations bar sits below the chart surface, not over it: the chart is the thing being read, and two text inputs stacked on top of it hid the candles and the price axis. Only Setup and Notes live here; tags are shown read-only in the trades table and are still persisted per trade. */ .trade-annotations-bar { /* The second elevation comes from the .surface-2 primitive (common.css); the rule keeps the border-top and the layout. */ flex: 0 0 auto; border-top: 1px solid var(--border); } .trade-annotations-fields { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; padding: var(--space-xs) var(--space-md); font-size: var(--font-xs); } .trade-annotations-field { display: flex; align-items: center; gap: var(--space-xs); } .trade-annotations-field--notes { flex: 1 1 100%; margin-top: var(--space-xs); } .trade-annotations-label { color: var(--text-dim); } /* Denser than the shared .input-field so the row reads as a caption strip under the chart rather than a form; 2px/6px and 11px are the measurements this bar already had as inline styles. */ .trade-annotations-input { padding: var(--space-2xs) var(--space-xs-plus); font-size: 11px; } .trade-annotations-field--notes .trade-annotations-input { flex: 1; } .trade-annotations-error { padding: var(--space-xs) var(--space-md); background: var(--bg-secondary); font-size: var(--font-xs); } .trade-annotations-warning { padding: var(--space-xs) var(--space-md); background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--text); font-size: var(--font-xs); display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; border-bottom: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); } .trade-annotations-retry { background: none; border: 1px solid var(--border); color: var(--text); font-size: var(--font-xs); padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-sm); cursor: pointer; } .trade-annotations-retry:hover { border-color: var(--accent); } .trade-tag-pill { display: inline-flex; align-items: center; gap: var(--space-xs); background: var(--bg-tertiary); color: var(--text-primary); padding: 1px var(--space-xs-plus); border-radius: var(--radius-md); font-size: var(--font-xs); margin-right: var(--space-xs); } .trade-tag-pill button { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 0; font-size: var(--font-sm); line-height: 1; } .trade-tag-pill button:hover { color: var(--negative); } .trade-annotate-btn { background: none; border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; padding: 0 var(--space-xs); border-radius: var(--radius-sm); font-size: var(--font-xs); line-height: 1.2; margin-left: auto; } .trade-annotate-btn:hover { border-color: var(--accent); color: var(--text); } /* No trade selected: the chart column is a slim prompt, not a full-height empty pane, so the calendar and the trade list keep the room. */ .trades-panel:has(.trades-empty-hint:not(.hidden)) { flex: 0 0 16rem; align-self: flex-start; } /* Stats open as a full-width block under P&L and win rate, not as a grid cell beside them: the summary spans the grid, and the stats and charts lay out in their own grid so the mini charts keep a readable size. */ .hero-stats > .ui-disclosure { grid-column: 1 / -1; width: 100%; min-width: 0; } .hero-stats > .ui-disclosure > .ui-disclosure__summary { width: 100%; justify-content: space-between; } .hero-stats > .ui-disclosure > .ui-disclosure__body { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(11rem, 100%), 1fr)); gap: var(--space-sm); } .hero-stats > .ui-disclosure > .ui-disclosure__body .hero-chart { grid-column: 1 / -1; } /* Touch screens: the section tabs are at least 36px tall. */ @media (pointer: coarse) { .trades-tab, .trades-mobile-tab { min-height: var(--touch-target-size); } } @media (width <= 600px) { .trades-tab, .trades-mobile-tab { min-height: var(--touch-target-size); } } .auth-gateway--compact { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm); font-size: var(--font-sm); min-height: 0; margin: 0; }
/* ═══════════════════════════════════════════════════════════════════════
Trades β€” Hero Stats Β· Charts (Win/Loss | Equity | Daily P&L) Β· Calendar
═══════════════════════════════════════════════════════════════════════ */
/* ── Page tabs: Trades | Playbook ──
The Playbook moved in from its own page, so it is a tab here; the active
one is in ?tab= (see features/trades/tabs.ts). The trades panel restates
--trades-layout-offset because the tab bar is now chrome above the
full-height layout, which the shared value (page-wrapper padding) does not
know about. The mobile tabs further down are a different, nested set and
keep their own class. */
.trades-tab-panel--trades {
--trades-layout-offset: calc(var(--space-sm) + var(--space-xl) + var(--space-xxl) + var(--space-md));
}
.trades-tabs {
display: flex;
gap: var(--space-xs);
margin-bottom: var(--space-md);
}
.trades-tab {
flex: 1;
min-height: var(--control-height);
padding: 0 var(--space-md);
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: var(--radius-md);
color: var(--text-muted);
font-family: var(--font-sans);
font-size: var(--font-sm);
font-weight: 600;
cursor: pointer;
transition: background var(--transition-fast), color var(--transition-fast);
}
.trades-tab:hover {
background: var(--overlay-1);
color: var(--text);
}
.trades-tab.active {
background: var(--accent);
border-color: var(--accent);
color: var(--on-accent);
}
/* ── Main area: trades layout (left) + stats column (right) ──
The status line, stats and summary charts live in a fixed-width right
column so the trades panel keeps the full viewport height. */
.trades-area {
display: grid;
grid-template-columns: minmax(0, 1fr) var(--trades-side-col-width, 300px);
gap: var(--space-md);
align-items: start;
/* The stats-column seam rides the column's own width, so the splitter's
size variable and the handle's offset are one property. */
position: relative;
}
.trades-area > .panel-resize-handle {
right: calc(var(--trades-side-col-width, 300px) - 5px);
}
/* No seam to drag once the column is collapsed into its rail, or when the
no-trades state drops the column entirely. */
.trades-area.side-col-collapsed > .panel-resize-handle,
.trades-area:has(.hero-stats.hidden) > .panel-resize-handle {
display: none;
}
/* The right column is ONE grid item so the status line + stats stack
flush at the top β€” as direct grid items they'd sit below the taller
trades panel (the layout spans both rows). */
.trades-side-col {
grid-column: 2;
grid-row: 1 / -1;
display: flex;
flex-direction: column;
gap: var(--space-sm);
min-width: 0;
}
/* No trades β†’ hero-stats and trades-layout get .hidden together, so
collapse the right column away instead of leaving an empty slot. */
.trades-area:has(.hero-stats.hidden) {
grid-template-columns: 1fr;
}
.trades-area:has(.hero-stats.hidden) .trades-side-col {
grid-column: auto;
grid-row: auto;
}
/* ── Collapsible right column (desktop) ──
A toggle at the top of the stats column collapses it into a slim rail
(just the toggle button) so the chart gets the full width. The class is
toggled on .trades-area from trades-page.js and persisted in localStorage.
Below 900px the layout stacks, so the collapse is desktop-only. */