/* Price chart workspace: TradingView-inspired line chart using the available price history. */
.price-chart {
  width:100%;
  min-height:400px;
  position:relative;
  overflow:visible;
  border:0;
  border-radius:0;
  background:transparent;
  color:#1f2937;
  box-shadow:none;
}
.chart-price-summary { display:flex; flex:0 0 auto; align-items:baseline; gap:9px; min-width:max-content; }
.chart-price-summary strong { color:#182230; font-size:16px; font-weight:750; letter-spacing:-.02em; white-space:nowrap; }
.chart-price-summary em { padding:2px 5px; border-radius:3px; font-size:10px; font-style:normal; font-weight:750; }
.chart-price-summary em.up { background:#fff1f0; color:#d14545; }
.chart-price-summary em.down { background:#edf4ff; color:#3c6fb3; }
.chart-price-summary em.flat { background:#f1f3f5; color:#667085; }
.chart-market-strip { display:flex; align-items:center; gap:13px; min-height:25px; padding:2px 7px; border-bottom:1px solid #edf0f4; color:#667085; font-size:10px; white-space:nowrap; }
.chart-market-strip strong { color:#344054; font-weight:750; }
.chart-market-strip strong.up { color:#c94848; }
.chart-market-strip strong.down { color:#3972bd; }
.chart-market-meta { color:#7b8492; }
.chart-legend { display:flex; gap:11px; flex-wrap:wrap; align-items:center; min-height:22px; padding:3px 7px 1px 42px; color:#667085; font-size:10px; font-weight:700; }
.chart-legend span { display:inline-flex; align-items:center; gap:5px; white-space:nowrap; }
.chart-legend span::before { content:""; display:inline-block; width:15px; height:2px; border-radius:1px; background:currentColor; }
.chart-legend .legend-price { color:#0f766e; }
.chart-legend .legend-ma7 { color:#d18a1f; }
.chart-legend .legend-ma30 { color:#547da5; }
.chart-legend .legend-rsi { color:#7c3aed; }
.chart-legend .legend-buy { color:#dc2626; }
.chart-legend .legend-sell { color:#2563eb; }
.chart-legend .legend-buy::before { width:0; height:0; border-left:5px solid transparent; border-right:5px solid transparent; border-bottom:9px solid currentColor; background:transparent; }
.chart-legend .legend-sell::before { width:0; height:0; border-left:5px solid transparent; border-right:5px solid transparent; border-top:9px solid currentColor; background:transparent; }
.chart-plot-row { display:flex; align-items:stretch; min-width:0; }
.chart-tool-rail { position:relative; z-index:2; display:flex; flex:0 0 40px; flex-direction:column; align-items:center; gap:0; align-self:stretch; box-sizing:border-box; height:auto; overflow:hidden; padding:0 3px; border-right:1px solid #e8ebf0; background:#fff; }
.chart-tool-rail::-webkit-scrollbar { display:none; }
.chart-tool-rail > button,.chart-emoji-tool summary { display:grid; flex:0 0 27px !important; place-items:center; box-sizing:border-box; width:32px; min-width:32px; min-height:27px !important; max-height:27px; margin:0 !important; padding:0; border:0; border-radius:4px; background:transparent; color:#667085; cursor:pointer; list-style:none; }
.chart-tool-rail > button:hover,.chart-tool-rail > button.active,.chart-emoji-tool[open] summary { background:#edf1f5; color:#182230; }
.chart-tool-rail svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.3; stroke-linecap:round; stroke-linejoin:round; }
.chart-emoji-tool { position:relative; }
.chart-emoji-tool summary { font-size:19px; line-height:1; }
.chart-emoji-popover { position:absolute; z-index:8; top:0; left:34px; display:flex; gap:4px; padding:5px; border:1px solid #d8dee8; border-radius:4px; background:#fff; box-shadow:0 4px 14px rgb(16 24 40 / .14); }
.chart-emoji-popover button { width:30px; height:30px; border:0; border-radius:3px; background:transparent; font-size:17px; cursor:pointer; }
.chart-emoji-popover button:hover { background:#edf1f5; }
.chart-stage { flex:1 1 auto; min-width:0; padding:0; overflow:hidden; }
.price-chart svg { display:block; width:100%; height:clamp(360px,calc(100dvh - 350px),620px); outline:0; cursor:crosshair; user-select:none; }
.price-chart svg.is-panning { cursor:grabbing !important; }
.price-chart.chart-empty svg { filter:blur(2px) saturate(.7); opacity:.7; }
.chart-placeholder { position:absolute; inset:0; display:none; align-items:center; justify-content:center; z-index:4; color:#667085; font-size:14px; font-weight:600; text-align:center; }
.chart-tooltip { position:absolute; display:none; z-index:3; pointer-events:none; padding:7px 9px; border:1px solid rgba(255,255,255,.12); border-radius:3px; background:rgba(25,32,42,.96); color:#f8fafc; font-size:11px; line-height:1.45; white-space:nowrap; box-shadow:0 3px 10px rgba(16,24,40,.16); }
.chart-range-tabs { display:flex; gap:0; align-items:stretch; min-height:31px; margin:0; padding:0 6px; border-bottom:1px solid #e8ebf0; }
.chart-range-label { display:flex; align-items:center; margin-right:2px; color:#7b8492; font-size:10px; font-weight:650; }
.chart-range-tab { min-height:30px; padding:4px 9px; border:0; border-bottom:2px solid transparent; background:transparent; color:#667085; font-size:11px; font-weight:700; cursor:pointer; }
.chart-range-tab:hover { color:#344054; }
.chart-range-tab.active { border-bottom-color:#0f766e; color:#0f766e; }
.chart-load-msg { margin-left:auto; align-self:center; color:#667085; font-size:11px; font-weight:650; }
.chart-analysis-bar { position:relative; z-index:6; display:flex; align-items:center; min-height:30px; padding:2px 6px; border-bottom:1px solid #e8ebf0; background:#fff; }
.chart-player-identity { display:flex; flex:0 0 auto; align-items:center; gap:6px; max-width:240px; min-width:0; margin-right:8px; color:#344054; font-size:12px; font-weight:750; white-space:nowrap; }
.chart-player-season-badge { display:block; flex:0 0 24px; width:24px; height:20px; object-fit:contain; }
.chart-player-season-fallback { max-width:74px; overflow:hidden; color:#7b8492; font-size:9px; font-weight:650; text-overflow:ellipsis; }
.chart-player-name { min-width:0; overflow:hidden; text-overflow:ellipsis; }
.chart-player-identity-strength .strength-badge { display:inline-flex; flex:0 0 24px; align-items:center; justify-content:center; width:24px; min-width:24px; height:15px; margin:0; padding:0; transform:none; }
.chart-analysis-bar .regime-diagnostics { display:flex !important; flex:1 1 auto; align-items:center; gap:5px; min-width:0; margin:0 !important; padding:0 !important; border:0 !important; background:transparent !important; }
.chart-analysis-bar .chart-status-item { display:inline-flex !important; grid-template-columns:none !important; align-items:center; gap:4px; min-height:24px !important; padding:2px 7px !important; border:1px solid #e3e8ef !important; border-radius:12px; box-shadow:none !important; background:#f8fafc !important; white-space:nowrap; }
.chart-analysis-bar .chart-status-item .chart-readout-icon { display:none !important; }
.chart-analysis-bar .chart-status-item > div { display:flex; align-items:center; gap:4px; }
.chart-analysis-bar .chart-status-item span,.chart-analysis-bar .chart-status-item strong,.chart-analysis-bar .chart-status-item em { display:inline !important; margin:0 !important; font-size:10px !important; line-height:1 !important; }
.chart-analysis-bar .chart-status-item span { color:#7b8492 !important; font-weight:600 !important; }
.chart-analysis-bar .chart-status-item strong { color:#344054 !important; font-weight:750 !important; }
.chart-analysis-bar .chart-status-item em { display:none !important; }
.chart-analysis-details { position:relative; flex:0 0 auto; margin-left:5px; }
.chart-analysis-details > summary { min-height:24px; padding:5px 8px; border-radius:3px; color:#667085; font-size:10px; font-weight:700; cursor:pointer; list-style:none; }
.chart-analysis-details > summary::-webkit-details-marker { display:none; }
.chart-analysis-details > summary::after { content:'▾'; margin-left:5px; font-size:9px; }
.chart-analysis-details[open] > summary { background:#edf1f5; color:#182230; }
.chart-analysis-details[open] > summary::after { content:'▴'; }
.chart-analysis-details .chart-insight { position:absolute; top:calc(100% + 4px); right:0; z-index:20; display:grid !important; grid-template-columns:repeat(4,minmax(110px,1fr)); width:560px; margin:0 !important; padding:6px !important; border:1px solid #d8dee8 !important; border-radius:4px; background:#fff !important; box-shadow:0 10px 28px rgb(16 24 40 / .16); }
.chart-analysis-details:not([open]) .chart-insight { display:none !important; }
.chart-analysis-details .chart-metric-item { display:block !important; min-height:0 !important; padding:7px 8px !important; border:0 !important; background:transparent !important; }
.chart-analysis-details .chart-metric-item .chart-readout-icon { display:none !important; }
.chart-analysis-details .chart-metric-item span { font-size:9px !important; }
.chart-analysis-details .chart-metric-item strong { margin-top:3px !important; font-size:11px !important; }
.chart-toolbar { display:flex; flex-wrap:nowrap; align-items:center; gap:4px; min-height:34px; padding:2px 6px; border-bottom:1px solid #e8ebf0; color:#475467; font-size:10px; }
.chart-toolbar button,.chart-menu summary,.chart-type-control select { min-height:26px; padding:3px 7px; border:0; border-radius:3px; background:#fff; color:inherit; font:inherit; }
.chart-toolbar button { cursor:pointer; }
.chart-toolbar button:hover,.chart-toolbar button.active { border-color:#98a2b3; background:#f8fafc; color:#182230; }
.chart-toolbar button:disabled { opacity:.45; cursor:default; }
.chart-toolbar-spacer { flex:1; }
.chart-tool-hint { margin-left:auto; overflow:hidden; color:#778191; font-size:10px; text-overflow:ellipsis; }
.chart-menu { position:relative; }
.chart-menu summary { display:block; cursor:pointer; list-style:none; }
.chart-menu summary::-webkit-details-marker { display:none; }
.chart-menu[open] summary { border-color:#98a2b3; }
.chart-menu-popover { position:absolute; z-index:5; top:calc(100% + 4px); left:0; display:grid; gap:8px; min-width:170px; padding:10px; border:1px solid #d8dee8; border-radius:4px; background:#fff; box-shadow:0 8px 20px rgb(16 24 40 / .14); }
.chart-menu-popover label { display:flex; align-items:center; gap:7px; white-space:nowrap; cursor:pointer; }
.chart-menu-popover input { accent-color:#0f766e; }
.chart-type-control { display:flex; align-items:center; gap:5px; }
.chart-type-control select { padding-right:20px; }
.price-chart:fullscreen { overflow:auto; border:0; border-radius:0; }
.price-chart:fullscreen .chart-stage svg { height:min(62vh,720px); }

:root[data-theme='dark'] .price-chart { background:transparent; color:#e5e7eb; }
:root[data-theme='dark'] .chart-price-summary span,
:root[data-theme='dark'] .chart-legend,
:root[data-theme='dark'] .chart-market-strip { color:#9aa4b2; }
:root[data-theme='dark'] .chart-price-summary strong,
:root[data-theme='dark'] .chart-market-strip { border-bottom-color:#303947; }
:root[data-theme='dark'] .chart-market-strip strong { color:#e5e7eb; }
:root[data-theme='dark'] .chart-market-strip strong.up { color:#fb8c8c; }
:root[data-theme='dark'] .chart-market-strip strong.down { color:#8bb7f0; }
:root[data-theme='dark'] .chart-price-summary em.up { background:#3b2225; color:#fca5a5; }
:root[data-theme='dark'] .chart-price-summary em.down { background:#1e2c40; color:#93c5fd; }
:root[data-theme='dark'] .chart-price-summary em.flat { background:#29313d; color:#cbd5e1; }
:root[data-theme='dark'] .chart-legend .legend-price { color:#5eead4; }
:root[data-theme='dark'] .chart-legend .legend-ma7 { color:#fbbf24; }
:root[data-theme='dark'] .chart-legend .legend-ma30 { color:#93c5fd; }
:root[data-theme='dark'] .chart-legend .legend-rsi { color:#c084fc; }
:root[data-theme='dark'] .chart-legend .legend-buy { color:#fb7185; }
:root[data-theme='dark'] .chart-legend .legend-sell { color:#60a5fa; }
:root[data-theme='dark'] .chart-range-tab { color:#9aa4b2; }
:root[data-theme='dark'] .chart-range-tab.active { color:#5eead4; border-bottom-color:#5eead4; }
:root[data-theme='dark'] .chart-load-msg { color:#9aa4b2; }
:root[data-theme='dark'] .chart-toolbar { border-bottom-color:#303947; color:#cbd5e1; }
:root[data-theme='dark'] .chart-toolbar button,
:root[data-theme='dark'] .chart-menu summary,
:root[data-theme='dark'] .chart-type-control select { border-color:#3b4655; background:#10151d; color:#cbd5e1; }
:root[data-theme='dark'] .chart-toolbar button:hover,
:root[data-theme='dark'] .chart-toolbar button.active { background:#1b2430; color:#f8fafc; }
:root[data-theme='dark'] .chart-menu-popover { border-color:#3b4655; background:#10151d; box-shadow:0 8px 20px rgb(0 0 0 / .35); }
:root[data-theme='dark'] .chart-range-label { color:#9aa4b2; }
:root[data-theme='dark'] .chart-analysis-bar { border-bottom-color:#303947; background:#10151d; }
:root[data-theme='dark'] .chart-player-identity { color:#e5e7eb; }
:root[data-theme='dark'] .chart-player-season-fallback { color:#9aa4b2; }
:root[data-theme='dark'] .chart-analysis-bar .chart-status-item { border-color:#303947 !important; background:#161d27 !important; }
:root[data-theme='dark'] .chart-analysis-bar .chart-status-item strong { color:#e5e7eb !important; }
:root[data-theme='dark'] .chart-analysis-details .chart-insight { border-color:#3b4655 !important; background:#10151d !important; }
:root[data-theme='dark'] .chart-tool-hint { color:#9aa4b2; }
:root[data-theme='dark'] .chart-tool-rail { border-right-color:#303947; background:#10151d; }
:root[data-theme='dark'] .chart-tool-rail > button,
:root[data-theme='dark'] .chart-emoji-tool summary { color:#9aa4b2; }
:root[data-theme='dark'] .chart-tool-rail > button:hover,
:root[data-theme='dark'] .chart-tool-rail > button.active,
:root[data-theme='dark'] .chart-emoji-tool[open] summary { background:#1b2430; color:#f8fafc; }
:root[data-theme='dark'] .chart-emoji-popover { border-color:#3b4655; background:#10151d; }
:root[data-theme='dark'] .chart-emoji-popover button:hover { background:#1b2430; }

@media(max-width:760px) {
  .price-chart { min-height:370px; }
  .chart-price-summary { gap:7px; }
  .chart-price-summary span { font-size:10px; }
  .chart-price-summary strong { font-size:18px; }
  .chart-market-strip { gap:9px; overflow-x:auto; }
  .chart-market-meta { display:none; }
  .chart-legend { gap:8px; padding:3px 6px; font-size:9px; }
  .chart-legend span::before { width:12px; }
  .chart-stage { padding:0 2px 5px; }
  .price-chart svg { height:280px; }
  .chart-range-tabs { padding:0 4px; }
  .chart-analysis-bar { overflow:visible; padding-inline:4px; }
  .chart-player-identity { gap:4px; max-width:172px; margin-right:5px; font-size:11px; }
  .chart-player-season-badge { flex-basis:20px; width:20px; height:18px; }
  .chart-player-season-fallback { max-width:54px; font-size:8px; }
  .chart-player-identity-strength .strength-badge { flex-basis:22px; width:22px; min-width:22px; }
  .chart-analysis-bar .regime-diagnostics { gap:3px; overflow-x:auto; scrollbar-width:none; }
  .chart-analysis-bar .chart-status-item { padding-inline:6px !important; }
  .chart-analysis-bar .chart-status-item span { display:none !important; }
  .chart-analysis-details .chart-insight { right:-2px; grid-template-columns:repeat(2,minmax(0,1fr)); width:min(350px,calc(100vw - 12px)); }
  .chart-toolbar { gap:3px; padding:2px 4px; overflow-x:auto; }
  .chart-toolbar-spacer { display:none; }
  .chart-tool-hint { display:none; }
  .chart-toolbar button,.chart-menu summary,.chart-type-control select { min-height:30px; padding:4px 6px; }
  .chart-plot-row { flex-direction:column; }
  .chart-tool-rail { flex:0 0 auto; flex-direction:row; width:auto; height:26px; overflow-x:auto; overflow-y:hidden; border-right:0; border-bottom:1px solid #e8ebf0; }
  .chart-tool-rail > button,.chart-emoji-tool summary { flex-basis:18px !important; width:22px; min-width:22px; min-height:18px !important; max-height:18px; }
  .chart-tool-rail svg { width:16px; height:16px; }
  .chart-emoji-popover { top:34px; left:0; }
}

/* Calendar-time drawing workspace. Scope SVG sizing to the plot, never tool icons. */
.price-chart {
  --chart-surface:#fff; --chart-text:#344054; --chart-muted:#667085;
  --chart-grid:#edf0f4; --chart-price:#0f766e; --chart-border:#e3e8ef;
  --chart-rsi-bg:#faf8ff; --chart-cross-label:#475467;
}
:root[data-theme='dark'] .price-chart {
  --chart-surface:#10151d; --chart-text:#e2e8f0; --chart-muted:#a5b4c6;
  --chart-grid:#263344; --chart-price:#5eead4; --chart-border:#334155;
  --chart-rsi-bg:#171424; --chart-cross-label:#526278;
}
.price-chart .chart-toolbar { flex-wrap:wrap; gap:4px; min-height:40px; overflow:visible; color:var(--chart-text); border-color:var(--chart-border); }
.price-chart .chart-toolbar button,.price-chart .chart-menu summary { min-height:34px; background:var(--chart-surface); color:var(--chart-text); font-size:11px; }
.price-chart .chart-toolbar button[aria-pressed='true'] { background:var(--chart-grid); }
.price-chart .chart-price-summary strong { color:var(--chart-text); }
.price-chart .chart-menu-popover { background:var(--chart-surface); border-color:var(--chart-border); z-index:12; }
.price-chart .chart-menu-popover small { color:var(--chart-muted); font-size:10px; }
.price-chart .chart-legend { padding:7px 8px 7px 54px; gap:12px; min-height:28px; }
.price-chart .chart-legend [hidden] { display:none; }
.price-chart .chart-observation::before { display:none; }
.price-chart .chart-observation { margin-left:auto; font-weight:400; color:var(--chart-muted); }
.price-chart .chart-tool-rail { flex:0 0 46px; width:46px; gap:4px; padding:5px 3px; background:var(--chart-surface); border-color:var(--chart-border); overflow:visible; }
.price-chart .chart-tool-rail > button { flex:0 0 40px !important; width:40px; min-width:40px; min-height:40px !important; max-height:40px; color:var(--chart-muted); }
.price-chart .chart-tool-rail > button.active { color:var(--chart-price); background:var(--chart-grid); }
.price-chart .chart-tool-rail > button svg { width:21px; height:21px; min-height:0; cursor:inherit; }
.price-chart .chart-stage { position:relative; padding:0; overflow:visible; }
.price-chart .price-chart-canvas { display:block; width:100%; height:clamp(360px,calc(100dvh - 370px),620px); touch-action:none; user-select:none; overflow:hidden; }
.price-chart .price-chart-canvas:focus-visible { outline:2px solid var(--chart-price); outline-offset:-2px; border-radius:3px; }
.price-chart .chart-grid { stroke:var(--chart-grid); stroke-dasharray:2 4; }
.price-chart .chart-axis { fill:var(--chart-muted); font-size:11px; font-variant-numeric:tabular-nums; }
.price-chart .chart-price-line { fill:none; stroke:var(--chart-price); stroke-width:2.4; stroke-linejoin:round; stroke-linecap:round; }
.price-chart .chart-ma7 { fill:none; stroke:#d18a1f; stroke-width:1.3; opacity:.85; }
.price-chart .chart-ma30 { fill:none; stroke:#6790b5; stroke-width:1.3; opacity:.85; }
.price-chart .chart-rsi-line { fill:none; stroke:#a855f7; stroke-width:1.4; }
.price-chart .chart-rsi-guide { stroke:#a855f7; stroke-dasharray:3 4; opacity:.35; }
.price-chart .chart-latest-line { stroke:var(--chart-price); stroke-dasharray:3 4; opacity:.6; }
.price-chart .chart-crosshair { stroke:var(--chart-muted); stroke-dasharray:4 4; opacity:.7; }
.price-chart .chart-cross-date { fill:var(--chart-text); font-size:11px; paint-order:stroke; stroke:var(--chart-surface); stroke-width:5px; stroke-linejoin:round; }
.price-chart .chart-drawing { cursor:move; }
.price-chart .chart-drawing.is-locked { cursor:pointer; }
.price-chart .drawing-hit { fill:none; stroke:transparent; stroke-width:16px; pointer-events:stroke; }
.price-chart .drawing-handle-hit { cursor:crosshair; pointer-events:all; }
.price-chart .drawing-axis-label { cursor:pointer; }
.price-chart .drawing-measure-label { font-size:11px; font-variant-numeric:tabular-nums; }
.price-chart .drawing-label-bg { fill:var(--chart-surface); fill-opacity:.96; stroke:var(--chart-border); }
.price-chart .chart-floating { position:absolute; top:8px; left:8px; z-index:5; display:flex; flex-wrap:wrap; align-items:center; gap:4px; max-width:calc(100% - 16px); padding:5px; border:1px solid var(--chart-border); border-radius:6px; color:var(--chart-text); background:var(--chart-surface); box-shadow:0 3px 10px rgb(16 24 40 / .1); font-size:11px; }
.price-chart .chart-floating[hidden],.price-chart .chart-objects[hidden] { display:none; }
.price-chart .chart-floating strong { padding:0 5px; font-size:11px; }
.price-chart .chart-floating label { display:flex; align-items:center; gap:3px; }
.price-chart .chart-floating button,.price-chart .chart-floating select,.price-chart .chart-floating summary,.price-chart .chart-objects button { min-height:32px; padding:5px 7px; border:0; border-radius:4px; font:inherit; background:var(--chart-surface); color:var(--chart-text); cursor:pointer; }
.price-chart .chart-floating button:hover,.price-chart .chart-floating summary:hover,.price-chart .chart-objects button:hover { background:var(--chart-grid); }
.price-chart button:disabled { opacity:.4; cursor:default; }
.price-chart .chart-floating button[aria-pressed='true'] { background:var(--chart-grid); }
.price-chart .drawing-coordinates { position:relative; }
.price-chart .drawing-coordinates summary { display:flex; align-items:center; list-style:none; }
.price-chart .drawing-coordinate-form { position:absolute; right:0; top:100%; z-index:6; display:grid; grid-template-columns:1fr 1fr; gap:9px; width:300px; max-width:calc(100vw - 60px); padding:12px; background:var(--chart-surface); border:1px solid var(--chart-border); border-radius:6px; box-shadow:0 5px 15px rgb(0 0 0 / .12); }
.price-chart .drawing-coordinate-form label { display:grid; gap:5px; min-width:0; align-content:start; }
.price-chart .drawing-coordinate-form input { width:100%; min-width:0; box-sizing:border-box; height:36px; padding:4px 6px; border:1px solid var(--chart-border); border-radius:4px; font-size:12px; color:var(--chart-text); background:var(--chart-surface); }
.price-chart .drawing-coordinate-form > small { grid-column:1 / -1; color:var(--chart-muted); }
.price-chart .drawing-coordinate-form button { background:var(--chart-grid); }
.price-chart .chart-objects { position:absolute; right:8px; top:8px; z-index:7; width:380px; max-width:calc(100% - 16px); max-height:80%; overflow:auto; padding:10px; box-sizing:border-box; border:1px solid var(--chart-border); border-radius:6px; background:var(--chart-surface); color:var(--chart-text); font-size:11px; box-shadow:0 5px 18px rgb(0 0 0 / .12); }
.price-chart .chart-objects-head { display:flex; align-items:center; justify-content:space-between; }
.price-chart .chart-object-row { display:flex; gap:2px; border-top:1px solid var(--chart-border); align-items:center; }
.price-chart .chart-object-row > button:first-child { flex:1; min-width:0; text-align:left; }
.price-chart .chart-object-row small { display:block; margin-top:4px; color:var(--chart-muted); }
.price-chart .chart-tooltip { font-size:11px; line-height:1.6; max-width:calc(100% - 12px); box-sizing:border-box; white-space:normal; }
.price-chart .chart-footer { display:flex; flex-wrap:wrap; justify-content:space-between; gap:6px 12px; padding:8px; color:var(--chart-muted); font-size:10px; border-top:1px solid var(--chart-border); }
.price-chart .chart-tool-hint { display:block; margin:0; white-space:normal; }
.price-chart:fullscreen { background:var(--chart-surface); padding:12px; box-sizing:border-box; }
.price-chart:fullscreen .price-chart-canvas { height:calc(100dvh - 150px); }
@media(max-width:760px) {
  .price-chart .chart-toolbar { gap:2px; padding:4px; }
  .price-chart .chart-price-summary { flex:1 0 calc(100% - 8px); padding:3px 4px; }
  .price-chart .chart-toolbar button,.price-chart .chart-menu summary { min-height:40px; padding:4px 7px; }
  .price-chart .chart-legend { padding:7px 4px; gap:8px; font-size:10px; }
  .price-chart .chart-observation { flex-basis:100%; }
  .price-chart .chart-tool-rail { flex:0 0 auto; width:100%; height:46px; padding:2px; flex-direction:row; border-bottom:1px solid var(--chart-border); box-sizing:border-box; }
  .price-chart .chart-tool-rail > button { flex-basis:44px !important; min-width:44px; width:44px; min-height:42px !important; max-height:42px; }
  .price-chart .price-chart-canvas { height:390px; }
  .price-chart .chart-floating { position:relative; top:auto; left:auto; margin:4px 0 8px; max-width:100%; box-shadow:none; }
  .price-chart .chart-floating button,.price-chart .chart-floating select,.price-chart .chart-floating summary,.price-chart .chart-objects button { min-height:40px; }
  .price-chart .drawing-coordinates { position:static; }
  .price-chart .drawing-coordinate-form { right:0; top:auto; bottom:100%; width:calc(100% - 26px); }
  .price-chart .drawing-coordinate-form input { font-size:16px; height:40px; }
  .price-chart .chart-footer { font-size:10px; }
}
@media(prefers-reduced-motion:reduce) { .price-chart * { animation:none !important; transition:none !important; } }
.price-chart { --chart-price-label:#fff; }
:root[data-theme='dark'] .price-chart { --chart-price-label:#083b36; }
.price-chart .chart-menu summary { display:flex; align-items:center; box-sizing:border-box; }
@media(max-width:760px) {
  .price-chart .chart-toolbar { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); }
  .price-chart .chart-price-summary { grid-column:1 / -1; }
  .price-chart .chart-toolbar button,.price-chart .chart-menu summary { min-height:44px; padding:4px 2px; text-align:center; justify-content:center; }
  .price-chart .chart-toolbar [data-action='objects'],.price-chart .chart-toolbar [data-action='hide'] { grid-column:span 2; }
}

/* Grouped drawing tools: compact rail, named flyouts, full touch targets. */
.price-chart .chart-tool-rail { z-index:8; }
.price-chart .chart-tool-rail > button > span { display:none; }
.price-chart .chart-tool-group { position:relative; flex:0 0 40px; }
.price-chart .chart-tool-group > summary { display:flex; align-items:center; justify-content:center; position:relative; width:40px; height:40px; box-sizing:border-box; border-radius:4px; color:var(--chart-muted); cursor:pointer; list-style:none; }
.price-chart .chart-tool-group > summary::-webkit-details-marker { display:none; }
.price-chart .chart-tool-group > summary i { position:absolute; right:1px; bottom:2px; font-size:9px; font-style:normal; }
.price-chart .chart-tool-group > summary:hover,.price-chart .chart-tool-group > summary.active,.price-chart .chart-tool-group[open] > summary { background:var(--chart-grid); color:var(--chart-price); }
.price-chart .chart-tool-group svg { width:21px; height:21px; min-height:0; cursor:inherit; flex:0 0 21px; }
.price-chart .chart-tool-menu { position:absolute; top:0; left:44px; width:218px; padding:6px; border:1px solid var(--chart-border); border-radius:6px; background:var(--chart-surface); color:var(--chart-text); box-shadow:0 5px 18px rgb(16 24 40 / .14); }
.price-chart .chart-tool-menu > strong { display:block; padding:8px 10px; font-size:11px; font-weight:600; color:var(--chart-muted); }
.price-chart .chart-tool-menu > button { display:flex; align-items:center; gap:12px; width:100%; min-height:44px; padding:8px 10px; border:0; border-radius:4px; background:transparent; color:var(--chart-text); font:inherit; font-size:12px; text-align:left; cursor:pointer; }
.price-chart .chart-tool-menu > button:hover,.price-chart .chart-tool-menu > button.active { background:var(--chart-grid); color:var(--chart-price); }
.price-chart .drawing-level-label { font-size:11px; paint-order:stroke; stroke:var(--chart-surface); stroke-width:3px; stroke-linejoin:round; }
.price-chart .drawing-note-label { font-size:12px; }
.price-chart .drawing-note-field { grid-column:1 / -1; }
.price-chart .drawing-note-field textarea { width:100%; box-sizing:border-box; min-height:80px; padding:8px; resize:vertical; border:1px solid var(--chart-border); border-radius:4px; background:var(--chart-surface); color:var(--chart-text); font:inherit; font-size:13px; }
.price-chart .drawing-coordinate-form { max-height:310px; overflow:auto; }
@media(max-width:760px) {
  .price-chart .chart-tool-group { position:static; flex:0 0 44px; }
  .price-chart .chart-tool-group > summary { width:44px; height:42px; }
  .price-chart .chart-tool-menu { top:100%; left:4px; width:240px; max-width:calc(100% - 22px); }
  .price-chart .drawing-note-field textarea { font-size:16px; }
}

/* Selection tools live above the plot; detailed editing uses a modal dialog. */
.price-chart .chart-floating { left:50%; top:8px; transform:translateX(-50%); flex-wrap:nowrap; gap:2px; padding:3px 5px; width:max-content; max-width:calc(100% - 12px); margin:0; box-sizing:border-box; }
.price-chart .chart-floating button { display:grid; place-items:center; width:34px; min-width:30px; height:34px; padding:6px; }
.price-chart .chart-floating svg,.price-chart .chart-rail-options svg { width:20px; height:20px; min-height:0; fill:none; stroke:currentColor; stroke-width:1.35; stroke-linecap:round; stroke-linejoin:round; cursor:inherit; }
.price-chart .chart-floating .chart-toolbar-grip { width:18px; min-width:18px; padding:0; cursor:grab; touch-action:none; color:var(--chart-muted); }
.price-chart .chart-floating .chart-toolbar-grip:active { cursor:grabbing; }
.price-chart .chart-floating select { width:58px; min-width:48px; padding:4px; font-size:12px; }
.price-chart .chart-color-control { position:relative; display:grid; place-items:center; width:32px; height:34px; }
.price-chart .chart-color-control input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.price-chart .chart-color-control i { position:absolute; left:5px; right:5px; bottom:1px; height:3px; border-radius:1px; pointer-events:none; }
.price-chart .chart-line-sample { width:19px; border-top:1px solid currentColor; }
.price-chart .chart-edit-divider { height:22px; border-left:1px solid var(--chart-border); margin:0 3px; }
.price-chart .chart-legend [role=button] { cursor:pointer; border-radius:3px; padding:3px 2px; }
.price-chart .chart-legend [role=button]:hover,.price-chart .chart-legend [role=button]:focus-visible { background:var(--chart-grid); outline:1px solid var(--chart-border); }
.price-chart .chart-rail-options { display:flex; flex-direction:column; gap:4px; padding-top:10px; margin-top:8px; border-top:1px solid var(--chart-border); }
.price-chart .chart-rail-options button { display:grid; place-items:center; width:40px; height:40px; padding:8px; border:0; border-radius:4px; color:var(--chart-muted); background:transparent; cursor:pointer; }
.price-chart .chart-rail-options button[aria-pressed=true] { color:var(--chart-price); background:var(--chart-grid); }
.price-chart .drawing-level-label { font-size:12px; font-weight:400; stroke-width:2px; }
.price-chart .chart-context { position:absolute; z-index:10; width:174px; padding:5px; border:1px solid var(--chart-border); border-radius:6px; background:var(--chart-surface); box-shadow:0 5px 18px rgb(16 24 40 / .14); }
.price-chart .chart-context[hidden] { display:none; }
.price-chart .chart-context button { display:block; width:100%; min-height:36px; padding:6px 12px; border:0; border-radius:3px; background:transparent; color:var(--chart-text); font:inherit; font-size:12px; text-align:left; cursor:pointer; }
.price-chart .chart-context button:hover,.price-chart .chart-context button:focus-visible { background:var(--chart-grid); }
.price-chart .chart-settings { width:440px; max-width:calc(100vw - 32px); max-height:calc(100dvh - 48px); box-sizing:border-box; padding:0; border:1px solid var(--chart-border); border-radius:10px; color:var(--chart-text); background:var(--chart-surface); box-shadow:0 16px 60px rgb(16 24 40 / .22); font-size:13px; }
.price-chart .chart-settings::backdrop { background:rgb(15 23 42 / .2); }
.price-chart .chart-settings > header { display:flex; justify-content:space-between; align-items:center; padding:12px 18px; border-bottom:1px solid var(--chart-border); }
.price-chart .chart-settings > header strong { font-size:16px; }
.price-chart .chart-settings button { min-height:36px; padding:6px 14px; border:0; border-radius:5px; background:var(--chart-grid); color:var(--chart-text); cursor:pointer; font:inherit; }
.price-chart .chart-settings > header button { font-size:24px; background:transparent; padding:0 8px; }
.price-chart .chart-settings .drawing-coordinate-form { position:static; display:block; width:auto; max-width:none; max-height:none; margin:0; padding:0; border:0; box-shadow:none; border-radius:0; overflow:visible; }
.price-chart .chart-settings fieldset { display:grid; gap:18px; margin:0; padding:18px; border:0; min-width:0; }
.price-chart .chart-settings-section { display:grid; gap:12px; }
.price-chart .chart-settings-section > strong { font-size:12px; }
.price-chart .chart-settings label { font-size:12px; }
.price-chart .chart-settings-inline,.price-chart .chart-fib-options { display:flex; align-items:center; flex-wrap:wrap; gap:12px 18px; }
.price-chart .chart-settings-inline label,.price-chart .chart-fib-options label,.price-chart .chart-fib-levels label { display:flex; align-items:center; gap:8px; }
.price-chart .chart-fib-levels { display:grid; grid-template-columns:1fr 1fr; gap:10px 24px; }
.price-chart .chart-fib-levels label span { flex:1; font-variant-numeric:tabular-nums; }
.price-chart .chart-settings input[type=checkbox] { width:16px; height:16px; accent-color:#2962ff; flex:0 0 16px; }
.price-chart .chart-settings input[type=color] { width:30px; height:28px; padding:2px; cursor:pointer; }
.price-chart .chart-settings input[type=range] { width:90px; padding:0; }
.price-chart .chart-settings select { min-height:32px; border:1px solid var(--chart-border); border-radius:4px; background:var(--chart-surface); color:var(--chart-text); }
.price-chart .chart-coordinate-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.price-chart .chart-settings small { color:var(--chart-muted); font-size:11px; }
.price-chart .chart-settings footer { display:flex; justify-content:flex-end; gap:8px; padding:12px 18px; border-top:1px solid var(--chart-border); }
.price-chart .chart-settings [type=submit] { background:#2962ff; color:white; }
@media(max-width:760px) {
  .price-chart .chart-tool-rail { height:auto; min-height:46px; flex-wrap:wrap; gap:0; }
  .price-chart .chart-rail-options { flex-direction:row; border:0; border-left:1px solid var(--chart-border); padding:0 0 0 3px; margin:0 0 0 3px; gap:0; }
  .price-chart .chart-rail-options button { width:40px; height:44px; }
  .price-chart .chart-floating { position:absolute; top:8px; left:50%; transform:translateX(-50%); gap:0; padding:2px; }
  .price-chart .chart-floating button { width:34px; min-width:28px; height:40px; min-height:40px; padding:5px; }
  .price-chart .chart-floating .chart-toolbar-grip { width:14px; min-width:14px; }
  .price-chart .chart-floating select { width:50px; min-width:44px; }
  .price-chart .chart-color-control { width:30px; height:40px; }
  .price-chart .chart-floating [data-selected-action=dash] { display:none; }
  .price-chart .chart-edit-divider { margin:0 2px; }
  .price-chart .chart-settings fieldset { padding:14px; }
  .price-chart .chart-settings button,.price-chart .chart-context button { min-height:44px; }
  .price-chart .chart-settings input:not([type=checkbox]):not([type=color]):not([type=range]) { font-size:16px; min-height:42px; }
  .price-chart .chart-fib-levels { gap:12px 16px; }
  .price-chart .drawing-level-label { font-size:11px; }
}

@media(max-width:760px) {
  .price-chart .chart-coordinate-grid { grid-template-columns:1fr; }
  .price-chart .chart-settings > header { position:sticky; top:0; z-index:2; background:var(--chart-surface); }
  .price-chart .chart-settings footer { position:sticky; bottom:0; z-index:2; background:var(--chart-surface); }
}
