/* The shared chart widget's styles (js/chart/): panes, controls, the grid,
   drawings, the levels menu, the quote strip, the symbol search dropdown and
   the tooltip. Loaded by both pages, the desktop's index.html and the
   phone's mobile.html, so there is one look for the one widget.

   Moved out of styles.css on 2026-09-26, in their original order, when the
   phone page began hosting the widget. It reads the colour and type-scale
   tokens each page defines on :root. */

/* A chart widget's handle carries the selected pane's quote instead of a
   title — still the drag handle, so it keeps the handle's cursor and height. */
.quote-strip {
  font-family: 'JetBrains Mono', monospace;
  text-transform: none;
  letter-spacing: 0;
}

.quote-strip .qs-sym { color: var(--text); font-weight: 600; margin-right: 8px; }

.quote-strip .qs-part { margin-right: 6px; }

.quote-strip .qs-ext { margin-left: 8px; color: var(--muted); }

.quote-strip .up { color: var(--gain); }

.quote-strip .down { color: var(--loss); }

.chart-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  z-index: 50;
  display: none;
  white-space: nowrap;
}

/* Two panes (5-minute on the left, 1-minute on the right) side by side in
   one widget, sharing this whole set of rules — see the "Chart" box in
   the Trades tab. */
/* Shell for any trade-chart widget (Trades tab, Drill Down) — same
   flex-column trick .pos-chart-panel uses, so the indicator controls row
   takes its natural height and the pane row claims the rest. */
.chart-widget-panel { display: flex; flex-direction: column; gap: 8px; }

.chart-widget-panel .dual-chart-row { flex: 1 1 auto; min-height: 0; }

/* These panes carry no .chart-legend (unlike the position chart, which
   uses it for cost-basis account lines), so both readouts shift up by its
   row. Keyed off the shared panel class so every such widget matches. */
.chart-widget-panel .chart-ohlc { top: 4px; }

.chart-widget-panel .chart-ind-values { top: 24px; }

.dual-chart-row { display: flex; width: 100%; height: 100%; gap: 8px; }

.dual-chart-row .candle-chart-container { flex: 1 1 0; min-width: 0; }

/* Which pane the controls row above is currently driving. Inset so the
   outline doesn't get clipped by the panel's own overflow, and dashed to
   read as a transient selection rather than a permanent border. */
.candle-chart-container.pane-selected { outline: 2px dashed #8FD1FF; outline-offset: -2px; }

/* The pane paints its own background rather than showing whatever it sits
   on. The session shading (CHART_SESSION_SHADING) darkens regular hours and
   lifts pre-market over it and leaves after-hours as it is, so after-hours
   only reads as after-hours against this colour: the phone's full-screen
   chart sat on the page's near-black and lost it (2026-09-26). */
.candle-chart-container { width: 100%; height: 100%; position: relative; background: var(--panel); }

.chart-lwc { width: 100%; height: 100%; }

/* Sits below the chart's own canvases (z-index 0 < their 1/2) — the
   chart's background is transparent, so a band drawn here for a trading
   session shows through everywhere the library itself doesn't opaquely
   paint (candles, grid lines, text). See CHART_SESSION_SHADING. */
.chart-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }

/* lightweight-charts' own internal canvases carry explicit inline
   z-index (1 and 2); without an explicit z-index here too, this overlay
   can lose the stacking fight against them and paint underneath the
   chart instead of above it, despite coming later in the DOM. */
.chart-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 10; }

.candle-chart-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; font-style: italic; text-align: center; padding: 10px;
  background: var(--panel); z-index: 2;
}

.chart-legend, .chart-ohlc, .chart-ind-values {
  position: absolute; left: 8px; z-index: 1; pointer-events: none;
  font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text);
}

.chart-legend { top: 4px; display: flex; gap: 14px; }

.chart-legend span { display: inline-flex; align-items: center; gap: 4px; }

.chart-legend .swatch { width: 14px; height: 2px; display: inline-block; }

.chart-ohlc { top: 24px; background: rgba(11,14,19,0.55); padding: 3px 8px; border-radius: 3px; }

.chart-ind-values {
  top: 44px; background: rgba(11,14,19,0.55); padding: 3px 8px; border-radius: 3px;
  display: flex; flex-direction: column; gap: 2px;
}

.chart-ind-values:empty { display: none; padding: 0; }

.chart-ind-line { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.chart-ind-line .swatch { width: 14px; height: 0; border-top: 2px solid; flex-shrink: 0; display: inline-block; }

/* Thinner as well as dashed, mirroring the lighter weight the dashed
   family (SMA) is actually drawn at — see CHART_MA_STYLE. */
.chart-ind-line .swatch.dashed { border-top-style: dashed; border-top-width: 1px; }

.chart-ind-value { margin-left: auto; padding-left: 10px; }

.pos-chart-controls-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.pos-chart-timeframes, .pos-chart-indicators { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.pos-chart-tf-btn {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 4px; padding: 5px 11px; font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
}

.pos-chart-tf-btn:hover { color: var(--text); }

.pos-chart-tf-btn.active { background: var(--amber); color: #14100A; border-color: var(--amber); }

.pos-chart-indicator-toggle {
  display: inline-flex; align-items: center; gap: 4px; font-size: 15px; color: var(--muted);
  cursor: pointer; user-select: none; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px;
}

.pos-chart-indicator-toggle.active { color: var(--text); }

.pos-chart-indicator-toggle input { accent-color: var(--amber); cursor: pointer; }

.pos-chart-indicator-toggle .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.pos-chart-indicator-dropdown {
  position: relative; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px;
}

.pos-chart-indicator-dropdown.active { border-color: var(--amber); }

.pos-chart-indicator-btn {
  background: transparent; border: none; color: var(--muted); padding: 0;
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: 'JetBrains Mono', monospace;
}

.pos-chart-indicator-btn:hover { color: var(--text); }

.pos-chart-indicator-btn.active { color: var(--text); }

.pos-chart-indicator-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px; flex-direction: column; gap: 4px; min-width: 132px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.pos-chart-indicator-dropdown.open .pos-chart-indicator-menu { display: flex; }

.pos-chart-indicator-row { display: flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted); padding: 2px 4px; }

.pos-chart-indicator-row input[type="checkbox"] { accent-color: var(--amber); cursor: pointer; }

.pos-chart-indicator-row .swatch { width: 16px; height: 0; border-top: 3px solid; flex-shrink: 0; display: inline-block; }

.pos-chart-indicator-row .swatch.dashed { border-top-style: dashed; border-top-width: 2px; }

/* The show-all checkbox sits inside the pill, first, where VWAP's and
   MACD's do. */
.pos-chart-indicator-fam { display: inline-flex; align-items: center; cursor: pointer; }

.pos-chart-indicator-fam input { accent-color: var(--amber); cursor: pointer; margin: 0; }

.chart-ctl-menu .pos-chart-indicator-dropdown { width: 100%; }

/* An indicator row and the style box that opens beside it. */
.chart-ind-slot { position: relative; }

.chart-ind-swatch {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 18px; padding: 0; cursor: pointer; flex-shrink: 0;
  background: transparent; border: 1px solid transparent; border-radius: 3px;
}

.chart-ind-swatch:hover, .chart-ind-swatch.open { border-color: var(--muted); }

.chart-ind-swatch .swatch { width: 16px; height: 0; display: inline-block; }

.chart-ind-style {
  position: absolute; top: -7px; left: calc(100% + 12px); z-index: 70;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 7px; box-shadow: 0 6px 16px rgba(0,0,0,0.45);
}

/* "Default" puts a line back; it isn't a delete, so no red. */
.chart-ind-style .chart-draw-menu-del:hover:not(:disabled) { color: var(--text); }

.pos-chart-indicator-period {
  width: 46px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 3px; padding: 2px 4px; font-size: 14px; font-family: 'JetBrains Mono', monospace;
  margin-left: auto;
}

.pos-chart-indicator-period:focus { outline: none; border-color: var(--amber); }

/* --- Investments > Watchlists: the chart grid --- */
/* Rows/columns come from the layout dropdown as inline custom properties on
   this element, so resizing the grid is one style write rather than a
   rebuild. Same flex-column-panel trick .chart-widget-panel does for the
   Trades tab's pane row: this claims whatever height the controls row above
   leaves over. */
.chart-grid {
  flex: 1 1 auto; min-height: 0; display: grid; gap: 8px;
  grid-template-columns: repeat(var(--chart-cols, 1), minmax(0, 1fr));
  grid-template-rows: repeat(var(--chart-rows, 1), minmax(0, 1fr));
}

/* Grid items stretch to their cell on their own; the explicit min-*: 0 stops
   a pane's contents (the chart canvas) from forcing the track wider or
   taller than its share. */
.chart-grid .candle-chart-container { min-width: 0; min-height: 0; }

/* A pane double-clicked to fill the widget (chartGridExpand): the grid one
   cell, the other panes hidden and kept, no outline on the one left. */
.chart-grid-expanded > .candle-chart-container:not(.chart-pane-expanded) { display: none; }
.chart-grid-expanded > .candle-chart-container.pane-selected { outline: none; }
.chart-expanded-chip[hidden] { display: none; }
.chart-expanded-chip { color: var(--text); border-color: var(--amber); }

/* Top-left of the pane, with the OHLC and indicator readouts pushed down to
   sit under it (see below). Above the pane's own hint overlay (z-index 2),
   so a pane with no symbol yet still shows the box you type it into. */
.chart-symbol-form {
  position: absolute; top: 4px; left: 8px; z-index: 3;
  display: flex; align-items: center; gap: 6px;
  /* Bounded by the pane, so a long company name is trimmed by its own
     ellipsis instead of running out over the price axis. */
  max-width: calc(100% - 16px);
  /* The form now spans the name as well as the box, and none of that width
     is anything to click — only the input is. Without this the pane's top
     strip would swallow crosshair and drawing clicks that used to reach the
     chart. */
  pointer-events: none;
}

.chart-symbol-form input {
  flex: 0 0 auto; pointer-events: auto;
  width: 82px; background: rgba(11,14,19,0.78); border: 1px solid transparent; color: var(--text);
  border-radius: 3px; padding: 2px 6px; font-size: 13px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace; text-transform: uppercase; letter-spacing: 0.04em;
}

.chart-symbol-form input:hover { border-color: var(--border); }

.chart-symbol-form input:focus { outline: none; border-color: var(--amber); background: var(--bg); }

/* The company name behind the ticker in the box (see chartSetPaneName). A
   caption, not data, so it stays in the UI face and sits back in the muted
   grey — the ticker is the pane's subject and has to stay the loudest thing
   in this corner. Wears the box's own backdrop so it reads over candles,
   collapses to nothing when the catalog has no name to give, and is clipped
   rather than allowed to push across a narrow pane. */
.chart-symbol-name {
  font-size: 12px; color: var(--muted); background: rgba(11,14,19,0.78);
  padding: 2px 6px; border-radius: 3px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; pointer-events: none;
}

.chart-symbol-name:empty { display: none; }

.chart-grid .chart-ohlc { top: 28px; }

.chart-grid .chart-ind-values { top: 48px; }

/* Scroll back to the newest candle. The chart never follows new bars on its
   own any more (see CHART_RIGHT_GAP_BARS), so this is the only thing that
   moves the time axis without also reloading the pane.

   Both offsets are pane geometry the chart only knows at paint time — the
   price axis' width and the time axis' height — so renderMarkerOverlay
   writes them as custom properties on the container every time it repaints.
   The fallbacks are what a default pane measures, so the button is roughly
   right for the frame before the first paint. Above .chart-overlay's
   z-index 10, and the only thing in that stack that takes pointer events. */
.chart-scroll-live {
  position: absolute; z-index: 11;
  right: var(--chart-live-right, 62px);
  bottom: var(--chart-live-bottom, 32px);
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  background: rgba(11,14,19,0.78); border: 1px solid var(--border); color: var(--muted);
  border-radius: 3px; cursor: pointer; line-height: 1;
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  transition: opacity 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.chart-scroll-live:hover { color: var(--text); border-color: var(--amber); }

/* Hidden rather than removed, so it can't reflow anything as it comes and
   goes — and not merely transparent, or it would still swallow clicks meant
   for the candles underneath it. */
.chart-scroll-live.parked { opacity: 0; pointer-events: none; }

/* The symbol behind the chart. Positioned in the pane's own coordinates,
   not the chart's, so it stays put through every pan, zoom and rescale —
   it names the pane, it isn't a thing plotted on it. Sits in the same layer
   as the session shading (below the library's canvases, which paint over it
   wherever there's actually a candle). */
.chart-watermark {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; user-select: none;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; letter-spacing: 0.06em;
  font-size: clamp(28px, 13cqw, 90px); color: rgba(231,235,243,0.07);
}

/* cqw above measures against the pane, so one rule sizes the mark sensibly
   whether it's a 1x1 or one ninth of the widget. */
.chart-grid .candle-chart-container { container-type: inline-size; }

.chart-watermark:empty { display: none; }

/* --- Icon dropdowns shared by the watchlist widget's controls --- */
.chart-ctl-root { position: relative; }

.chart-ctl-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 4px; padding: 4px 8px; font-size: 13px; cursor: pointer;
  font-family: 'JetBrains Mono', monospace; line-height: 1;
}

.chart-ctl-btn:hover { color: var(--text); }

.chart-ctl-btn.active { color: var(--text); border-color: var(--amber); }

.chart-ctl-root.open > .chart-ctl-btn { color: var(--text); border-color: var(--amber); }

.chart-ctl-icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.3; }

/* The trend line reads as the subject of the indicator glyph, so it keeps
   full contrast while the candles behind it sit back. */
.chart-ctl-icon rect, .chart-ctl-icon line { opacity: 0.55; }

.chart-ctl-icon-line { stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.chart-ctl-caret { font-size: 10px; }

.chart-ctl-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 7px; box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  flex-direction: column; gap: 5px; align-items: stretch;
}

.chart-ctl-root.open > .chart-ctl-menu { display: flex; }

/* For the timeframe picker, which lives at the left end of the bottom bar —
   opening downward would put it outside the widget. */
.chart-ctl-root.drop-up > .chart-ctl-menu { top: auto; bottom: calc(100% + 4px); }

/* Inside the indicators menu the EMA/SMA dropdowns can't open downward
   either, or they'd cover the rows under them — they go sideways instead. */
.chart-ctl-menu .pos-chart-indicator-dropdown.expand-right > .pos-chart-indicator-menu {
  top: -7px; left: calc(100% + 5px);
}

.chart-ctl-menu .pos-chart-indicator-toggle { width: 100%; justify-content: flex-start; }

.chart-ctl-menu .pos-chart-indicator-btn { width: 100%; text-align: left; }

/* The grid-layout menu: a 3x3 of cells you sweep to pick how many charts,
   the way a word processor's insert-table control works. */
.chart-layout-cells { display: grid; grid-template-columns: repeat(3, 22px); gap: 4px; }

.chart-layout-cell {
  width: 22px; height: 22px; padding: 0; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 2px;
}

/* Everything inside the block you're currently sweeping over. */
.chart-layout-cell.hot { background: var(--amber); border-color: var(--amber); }

/* The layout actually in force, when you aren't sweeping. */
.chart-layout-cell.current { border-color: var(--amber); }

/* What the panes hold in common, under the grid that says how many there
   are — the two questions you'd answer together when setting a grid up. */
.chart-sync { margin-top: 9px; border-top: 1px solid var(--border); padding-top: 7px; }

.chart-sync-title {
  color: var(--muted); font-family: 'JetBrains Mono', monospace;
  font-size: 12px; letter-spacing: 0.04em; margin-bottom: 4px;
}

.chart-sync-row {
  display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
  color: var(--muted); font-size: 14px; padding: 2px 2px; border-radius: 3px;
}

.chart-sync-row:hover { color: var(--text); background: rgba(255,255,255,0.07); }

.chart-sync-row input[type="checkbox"] { accent-color: var(--amber); cursor: pointer; margin: 0; }

.chart-sync-row:has(input:checked) { color: var(--text); }

/* The data box menu (widget.js, "The data box"): at the right end of the controls row, opening leftward so it stays
   inside the widget. A pane with a box switched off hides it; with the OHLC off, the indicators' box takes its place. */
.chart-databox { margin-left: auto; }
.chart-databox > .chart-ctl-menu { left: auto; right: 0; min-width: 150px; gap: 2px; }
.candle-chart-container.chart-no-ohlc .chart-ohlc,
.candle-chart-container.chart-no-ind .chart-ind-values { display: none; }
.chart-grid .candle-chart-container.chart-no-ohlc .chart-ind-values { top: 28px; }

/* --- Drawings: the dropdown's rows, and the pane's click-catcher --- */
.chart-draw-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: none; border-radius: 3px; padding: 3px 5px;
  cursor: pointer; text-align: left; white-space: nowrap;
  color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 14px;
}

.chart-draw-row:hover { color: var(--text); background: rgba(255,255,255,0.07); }

.chart-draw-row.active { color: var(--amber); font-weight: 700; }

.chart-draw-glyph {
  width: 15px; height: 15px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.4;
}

.chart-draw-clear {
  margin-top: 3px; padding: 6px 5px 1px; background: transparent; cursor: pointer;
  border: none; border-top: 1px solid var(--border); text-align: left; white-space: nowrap;
  color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px;
}

.chart-draw-clear:hover:not(:disabled) { color: var(--loss); }

/* The TA menu's footer: what is analysed for this symbol and when, so the
   menu answers "is this reading current" without another trip. */
.chart-ta-status {
  padding: 6px 10px 2px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--font-note);
  max-width: 260px;
  white-space: normal;
}

.chart-draw-clear:disabled { opacity: 0.45; cursor: default; }

/* Shown only while a drawing tool is armed, and above every other layer in
   the pane (the chart's own canvases, the marker overlay, the >> button) so
   that placing a point can't also start one of the library's pans or land
   on a control. Off the rest of the time, so nothing about an idle pane
   changes. */
.chart-draw-capture { position: absolute; inset: 0; z-index: 12; display: none; cursor: crosshair; }

.candle-chart-container.draw-armed .chart-draw-capture { display: block; }

/* A drawing's own hit shapes: a trend line's body moves the whole line, an
   end moves that end, and a level moves up and down and nowhere else. The
   cursor is the only thing that says so before you try it, which is why
   each gets its own. */
.chart-overlay [data-draw-drag] { cursor: move; }

.chart-overlay [data-draw-drag="a"], .chart-overlay [data-draw-drag="b"] { cursor: grab; }

.chart-overlay [data-draw-drag="p"] { cursor: ns-resize; }

/* Held for the length of a drag, on <body> rather than on the pane: the
   pointer routinely leaves the chart mid-drag, and the cursor changing to
   whatever it passes over reads as the drag having been dropped. The cursor
   itself is put on <body> from whatever the grabbed shape was wearing (see
   chartDrawDragStart), so a corner keeps its resize arrows and a line its
   closed hand; everything under the pointer inherits that one. */
body.chart-draw-dragging * { cursor: inherit !important; }

/* The right-click style menu. Fixed to the viewport and on <body>, so it can
   overhang the widget it was opened in rather than being clipped by it. */
.chart-draw-menu {
  display: none; position: fixed; z-index: 200;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 7px; box-shadow: 0 6px 16px rgba(0,0,0,0.45);
}

.chart-draw-menu-row {
  display: flex; align-items: center; gap: 5px;
  padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--border);
}

.chart-draw-swatch {
  width: 20px; height: 20px; padding: 0; cursor: pointer; border-radius: 3px;
  border: 2px solid transparent;
}

.chart-draw-swatch:hover { border-color: rgba(255,255,255,0.45); }

/* The ring is offset outward so it reads against the swatch's own colour
   whichever of the six it is. */
.chart-draw-swatch.active { border-color: var(--text); outline: 1px solid var(--bg); outline-offset: -3px; }

.chart-draw-opt {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 20px; padding: 0; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
}

.chart-draw-opt:hover { border-color: var(--muted); }

.chart-draw-opt.active { border-color: var(--amber); }

.chart-draw-opt svg { width: 36px; height: 12px; stroke: var(--text); }

.chart-draw-menu-del {
  width: 100%; padding: 3px 5px; background: transparent; border: none; border-radius: 3px;
  text-align: left; cursor: pointer;
  color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px;
}

.chart-draw-menu-del:hover:not(:disabled) { color: var(--loss); background: rgba(255,255,255,0.07); }

/* Locked. Both of these are shown rather than hidden, so the menu says the
   lock is what's in the way instead of quietly losing a row. */
.chart-draw-menu-del:disabled { opacity: 0.45; cursor: default; }

/* A level's own price, editable in place. The menu is where a drawing's
   properties are set, and "which number is this line on" is the first of
   them — a level put down by eye is nearly always meant to sit on a round
   one. color-scheme so the spinner arrows come back dark like the rest. */
.chart-draw-menu-price { display: flex; align-items: center; gap: 5px; }

.chart-draw-menu-price span {
  color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px;
}

.chart-draw-menu-price input {
  flex: 1 1 auto; width: 104px; color-scheme: dark;
  background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
  color: var(--text); padding: 2px 5px;
  font-family: 'JetBrains Mono', monospace; font-size: 14px;
}

.chart-draw-menu-price input:focus { outline: none; border-color: var(--amber); }

.chart-draw-menu-price input:disabled { opacity: 0.5; cursor: default; }

/* The same shape as the sync and timeframe checkbox rows elsewhere, so a
   toggle in this menu reads as one of those rather than as a fourth kind of
   style control. */
.chart-draw-menu-check {
  display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
  padding: 2px 3px; border-radius: 3px;
  color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px;
}

.chart-draw-menu-check:hover { color: var(--text); background: rgba(255,255,255,0.07); }

.chart-draw-menu-check.active { color: var(--text); }

.chart-draw-menu-check input[type="checkbox"] { accent-color: var(--amber); cursor: pointer; margin: 0; }

/* --- The timeframe bar under the panes --- */
.chart-footer { display: flex; align-items: center; gap: 8px; }

.chart-footer .pos-chart-timeframes { flex: 1 1 auto; gap: 4px; }

.chart-footer .pos-chart-tf-btn { padding: 3px 9px; font-size: 13px; }

/* Follow and reset, at the far end of the same bar. They travel together and
   stay pinned to the right whether there are three timeframe buttons on the
   bar or ten — and don't shrink when those wrap. */
.chart-footer-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; margin-left: auto; }

.chart-footer-actions .chart-ctl-btn { padding: 3px 8px; }

.chart-footer-actions .chart-ctl-btn:hover { border-color: var(--amber); }

.chart-tf-pick-row { display: flex; align-items: center; gap: 7px; }

.chart-tf-pick-row input[type="checkbox"] { accent-color: var(--amber); cursor: pointer; margin: 0; }

.chart-tf-pick-name {
  flex: 1 1 auto; text-align: left; background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 14px; padding: 2px 4px;
  border-radius: 3px;
}

.chart-tf-pick-name:hover { color: var(--text); background: rgba(255,255,255,0.07); }

.chart-tf-pick-name.active { color: var(--amber); font-weight: 700; }

#tab-inv-watchlists .candle-chart-hint { font-size: 15px; }

#tab-inv-watchlists .chart-ohlc, #tab-inv-watchlists .chart-ind-values { font-size: 14px; }

/* The position chart itself (hint text, legend/OHLC/indicator-values
   readouts) got a second +1px bump on top of the general Investments-page
   pass above, so it always runs 1px above whatever the other Investments
   widgets (and this rule's own .box-handle/.edge-table siblings above) are
   currently set to — both sides have since moved together through later
   across-the-board bumps, so the relative +1px is what stays true, not
   any specific pixel value. */
#tab-inv-home .candle-chart-hint { font-size: 15px; }

#tab-inv-home .chart-legend, #tab-inv-home .chart-ohlc, #tab-inv-home .chart-ind-values { font-size: 14px; }

/* --- The ticker dropdown (see attachSymbolAutocomplete) ------------------
   One element for the whole app, parked on <body> and positioned under
   whichever symbol box has focus. It has to be a fixed-position child of
   the body rather than a sibling of each input: every box that wants it
   sits inside either a GridStack panel that clips its overflow or a chart
   pane's absolutely-positioned form, and a menu rendered in place would be
   cut off by one or the other in most of them.

   Deliberately tight — 18px rows at 11px type, eight of them at most. This
   opens over a chart while you're reading it, and a roomy menu would cover
   the candles it's meant to help you pick. The symbol is mono (it's data),
   the company name is Inter (it's a label), and the name is what gets
   squeezed when the row runs out of width. */
.sym-ac {
  position: fixed; z-index: 3000; display: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
  padding: 2px; box-shadow: 0 6px 18px rgba(0,0,0,0.55);
  max-height: 172px; overflow-y: auto; overscroll-behavior: contain;
}

.sym-ac.open { display: block; }

.sym-ac-row {
  display: flex; align-items: baseline; gap: 7px;
  padding: 1px 6px; border-radius: 3px; cursor: pointer; white-space: nowrap;
}

.sym-ac-sym {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700;
  color: var(--text); letter-spacing: 0.02em; flex: 0 0 auto;
}

.sym-ac-name {
  font-size: 11px; color: var(--muted); flex: 1 1 auto;
  overflow: hidden; text-overflow: ellipsis; text-transform: none; letter-spacing: normal;
}

/* Kind sits right and dim: it only ever settles a tie ("is this the stock
   or the leveraged ETF named after it?"), so it must never be the first
   thing read. */
.sym-ac-kind { font-size: 9.5px; color: var(--border); flex: 0 0 auto; text-transform: uppercase; letter-spacing: 0.06em; }

.sym-ac-row.active { background: rgba(227,162,60,0.16); }

.sym-ac-row.active .sym-ac-sym { color: var(--amber); }

.sym-ac-row.active .sym-ac-name { color: var(--text); }

/* The floating trade chart (right-click a trade > Graph) — see
   js/tabs/trading/trade-graph.js. Chart only: the widget's toolbars are
   hidden, its axes, crosshair and readouts are not. Under the chart's own
   drawing menu (z 200) and above the page. */
.trade-graph-pop {
  position: fixed; z-index: 150; display: flex; flex-direction: column;
  min-width: 360px; min-height: 240px; max-width: 100vw; max-height: 100vh;
  resize: both; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}
.trade-graph-pop[hidden] { display: none; }
.trade-graph-bar {
  flex: 0 0 auto; padding: 5px 10px; cursor: move; user-select: none; touch-action: none;
  color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.trade-graph-pop .chart-widget-panel { flex: 1 1 auto; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
#graph-pop-chart-panel .pos-chart-controls-row,
#graph-pop-chart-panel .chart-footer { display: none; }
.trade-graph-menu:not([hidden]) { display: block; }
.trade-graph-menu { z-index: 400; padding: 3px; min-width: 90px; }

/* A drawing's style menu under a finger (chart/drawings.js, "Moving a drawing
   by touch"): everything in it big enough to hit, and the price box at 16px —
   iOS zooms the whole page in on a field set smaller when it takes focus. The
   overlay takes no text selection or callout, so holding a drawing opens the
   menu rather than the system's. */
@media (pointer: coarse) {
  .chart-overlay { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .chart-draw-menu { padding: 10px; }
  .chart-draw-menu-row { gap: 8px; padding-bottom: 9px; margin-bottom: 9px; }
  .chart-draw-swatch { width: 34px; height: 34px; }
  .chart-draw-opt { width: 58px; height: 34px; }
  .chart-draw-menu-del { padding: 10px 8px; font-size: 15px; }
  .chart-draw-menu-check { padding: 8px 8px; font-size: 15px; gap: 10px; }
  .chart-draw-menu-check input[type="checkbox"] { width: 18px; height: 18px; }
  .chart-draw-menu-price span { font-size: 16px; }
  .chart-draw-menu-price input { font-size: 16px; padding: 6px 8px; width: 120px; }
}

/* A control with nothing to do — the phone's drawing Undo before anything has
   been changed. */
.chart-ctl-btn:disabled { opacity: 0.35; pointer-events: none; }
