.chart-stage > [data-slot="chart-panel"] { grid-row: 1 / -1; min-width: 0; min-height: 0; height: 100%; }
.chart-panel { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; height: 100%; position: relative; background: var(--ws-chart-bg, #ffffff); color: var(--ws-chart-text, #374151); }
.chart-panel[data-chart-theme="dark"] {
  --ws-chart-bg: #101317;
  --ws-chart-surface: #171b21;
  --ws-chart-text: #dbe4ef;
  --ws-chart-muted: #9aa8b6;
  --ws-chart-border: #33404d;
  --ws-chart-grid: #252c35;
}
.chart-panel .chart-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 10px; min-width: 0; min-height: 34px; padding: 7px 10px; }
.chart-toolbar-left, .chart-toolbar-right, .timeframe-strip, .candle-source-toggle { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.chart-toolbar-left { overflow: hidden; }
.chart-toolbar-right { justify-content: flex-end; }
.crosshair-readout { grid-column: 1 / -1; min-width: 0; }
.chart-nav-btn, .tb-pill { min-height: var(--ws-control-height, 28px); border: 1px solid var(--ws-border); border-radius: 999px; background: var(--ws-bg); color: var(--ws-muted); padding: 4px var(--ws-control-padding-x, 9px); font-size: 11px; line-height: 1; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, opacity 0.15s ease; }
.chart-panel .chart-nav-btn, .chart-panel .tb-pill { border-color: var(--ws-chart-border, #d1d5db); background: var(--ws-chart-bg, #ffffff); color: var(--ws-chart-muted, #6b7280); }
.chart-panel .chart-nav-btn:hover:not(:disabled), .chart-panel .tb-pill:hover:not(:disabled) { border-color: var(--ws-blue, #2962ff); color: var(--ws-chart-text, #374151); }
.chart-panel .chart-nav-btn:focus-visible, .chart-panel .tb-pill:focus-visible, .drawing-toolbar input:focus-visible { outline: none; box-shadow: var(--ws-focus-ring, 0 0 0 2px rgba(41, 98, 255, 0.35)); }
.chart-panel .tb-pill.active { background: var(--ws-blue, #2962ff); border-color: var(--ws-blue, #2962ff); color: white; }
.chart-panel .tb-pill:disabled { opacity: 0.4; }
.chart-panel .tb-pill:disabled:hover { border-color: var(--ws-chart-border, #d1d5db); color: var(--ws-chart-muted, #6b7280); }
.chart-theme-toggle { font-weight: 700; }
.chart-nav-btn { border-radius: var(--ws-radius-sm, 6px); padding: 4px 7px; }
.tb-pill.active { background: var(--ws-blue, #2962ff); border-color: var(--ws-blue, #2962ff); color: white; }
.tb-pill:disabled { opacity: 0.4; cursor: not-allowed; }
.tb-pill:disabled:hover { border-color: var(--ws-border); color: var(--ws-muted); }
.crosshair-readout { color: var(--ws-muted); font-size: 11px; white-space: normal; overflow-wrap: anywhere; }
.chart-panel .crosshair-readout { color: var(--ws-chart-muted, #6b7280); }
.chart-panel .chart-canvas { align-items: stretch; justify-items: stretch; padding: 0; position: relative; }
.chart-paginate { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; border: 1px solid var(--ws-chart-border, #d1d5db); border-radius: 4px; background: rgba(255, 255, 255, 0.7); color: var(--ws-chart-muted, #6b7280); font-size: 18px; line-height: 1; padding: 8px 4px; cursor: pointer; opacity: 0.5; transition: opacity 0.15s; }
.chart-paginate:hover { opacity: 0.9; }
.chart-paginate:disabled { cursor: not-allowed; opacity: 0.3; }
.chart-paginate--left { left: 4px; }
.chart-paginate--right { right: 4px; }
.chart-paginate.loading { animation: chart-paginate-pulse 0.6s ease-in-out infinite; pointer-events: none; }
.chart-paginate.error { color: #ef5350; border-color: #ef5350; opacity: 0.8; }
@keyframes chart-paginate-pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.8; } }
.lightweight-chart-host { width: 100%; height: 100%; min-width: 0; min-height: 0; position: relative; }
.mf-chart-tooltip { border: 1px solid var(--ws-chart-border, #d1d5db); border-radius: 6px; background: var(--ws-chart-surface, #f8fafc); color: var(--ws-chart-text, #374151); font-size: 11px; line-height: 1.35; max-width: min(320px, 70%); padding: 5px 7px; white-space: normal; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10); }
.mf-chart-delta-tooltip { border: 1px solid var(--ws-chart-border, #d1d5db); border-radius: 6px; background: var(--ws-chart-surface, #f8fafc); color: var(--ws-chart-text, #374151); font-size: 11px; line-height: 1.35; max-width: min(280px, 60%); padding: 4px 7px; white-space: nowrap; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); }
.chart-fallback { display: grid; grid-template-rows: 1fr auto; min-width: 0; min-height: 0; width: 100%; height: 100%; border: 1px solid var(--ws-chart-border, #d1d5db); border-radius: 8px; background: var(--ws-chart-surface, #f8fafc); overflow: hidden; }
.chart-fallback__candles { align-content: start; display: grid; gap: 3px; padding: 10px; overflow: auto; }
.candle-row { display: grid; grid-template-columns: 50px repeat(4, minmax(50px, 1fr)); gap: 8px; border-bottom: 1px solid var(--ws-chart-border, #d1d5db); color: var(--ws-chart-muted, #6b7280); font-size: 11px; padding: 3px 0; }
.candle-row[data-source="bybit_live"] { color: var(--ws-green); }
.chart-fallback__overlays { border-top: 1px solid var(--ws-chart-border, #d1d5db); color: var(--ws-chart-muted, #6b7280); font-size: 11px; padding: 8px 10px; }
.chart-empty { display: grid; place-items: center; color: var(--ws-chart-muted, #6b7280); height: 100%; border: 1px dashed var(--ws-chart-border, #d1d5db); border-radius: 8px; }
.overlay-style-popover.hidden, .style-drawer.hidden { display: none; }
.drawing-toolbar { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.drawing-toolbar__tools,
.drawing-toolbar__edit { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; min-width: 0; }
.drawing-toolbar .tb-pill { border-color: #33404d; background: #171b21; color: #dbe4ef; }
.drawing-toolbar .tb-pill:hover:not(:disabled) { border-color: var(--ws-blue, #2962ff); background: #202834; color: #fff; }
.drawing-toolbar .tb-pill.active { border-color: var(--ws-blue, #2962ff); background: var(--ws-blue, #2962ff); color: #fff; }
.drawing-toolbar__style { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: var(--ws-chart-muted, #6b7280); font-size: 11px; }
.drawing-toolbar__style span { max-width: 48px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawing-toolbar__style input { min-height: var(--ws-control-height, 28px); border: 1px solid #33404d; border-radius: var(--ws-radius-sm, 6px); background: #101317; color: #dbe4ef; padding: 2px 6px; font: inherit; font-size: 11px; }
.drawing-toolbar__style input[type="number"] { width: 58px; }
.drawing-toolbar__style input[type="color"] { width: 34px; padding: 2px; }
.drawing-toolbar__style input:disabled { opacity: 0.38; cursor: not-allowed; }
.drawing-toolbar__status { color: var(--ws-chart-muted, #6b7280); font-size: 11px; white-space: nowrap; }
.drawing-toolbar__error { border: 1px solid rgba(244, 67, 54, 0.35); border-radius: 999px; background: rgba(244, 67, 54, 0.10); color: var(--ws-red); font-size: 11px; padding: 4px 8px; }
.style-drawer { position: absolute; top: 42px; right: 12px; width: 260px; border: 1px solid var(--ws-chart-border, #d1d5db); border-radius: var(--ws-radius-md, 8px); background: var(--ws-chart-surface, #f8fafc); color: var(--ws-chart-text, #374151); padding: 12px; z-index: 30; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12); }
.style-drawer__header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.style-drawer p { margin: 8px 0 0; color: var(--ws-chart-muted, #6b7280); font-size: 12px; line-height: 1.35; }

@media (max-width: 760px) {
  .chart-panel .chart-toolbar { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .chart-toolbar-left, .chart-toolbar-right { justify-content: flex-start; }
  .crosshair-readout { grid-column: auto; }
}
