/* Chart slot. Agent 2. Tools and chips are 1px-gap grid cells (v2-style), not v1 chrome. */
[data-tile="chart"] .v2-body {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: row;
  background: var(--v2-tile);
}
.v2-chart-tools {
  /* U10: square strip matches kit x-btn 44px (#3). */
  width: 44px;
  flex: 0 0 44px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--v2-line);
  user-select: none;
}
/* U10: in-grid square buttons (not underline tabs). Active = inverted block. */
.v2-chart-tools .v2-btn {
  height: 44px;
  min-height: 44px;
  width: 100%;
  padding: 0;
  flex: 0 0 44px;
  aspect-ratio: 1 / 1;
  border: 0;
  box-shadow: none;
  background: var(--v2-header);
  /* Kit SVG icons — JetBrains ≥12px for any text (Departure has no tool glyphs). */
  font-family: var(--mono);
  font-size: var(--fs-12);
  font-weight: 400;
  letter-spacing: var(--v2-track-label);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.v2-chart-tools .v2-btn .x-ico {
  width: 16px;
  height: 16px;
}
.v2-chart-tools .v2-tool-label {
  display: none;
}
.v2-chart-tools .v2-btn:active,
.v2-chart-tools .v2-btn.pr {
  transform: none;
  box-shadow: none;
}
/* Re-assert .on after the idle fill above: same specificity as .v2-btn.on in shell.css,
   and this sheet loads later, so without these rules active TF/tool buttons stay dark-on-dark. */
.v2-chart-tools .v2-btn.on,
.v2-chart-tools .v2-btn.on:hover {
  background: var(--acc);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}
/* Keep interval labels as 1m / 1h / 1d — uppercase would make 1m look like 1 month. */
.v2-chart-tools .v2-btn[data-tf] {
  text-transform: none;
}
/* Stay-in-drawing lock (double-click a tool). Inverted --bone block — never an underline. */
.v2-chart-tools .v2-btn.sticky {
  background: var(--bone);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}
.v2-chart-tools .v2-btn.sticky.on,
.v2-chart-tools .v2-btn.sticky.on:hover {
  background: var(--acc);
  color: var(--ink);
}
.v2-chart-gap {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--v2-header);
}
/* Timeframes live in the chip row (desktop + phone). Portrait phones also
   park indicator chips here (chart.js placeInd). */
.v2-chart-tfs {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 1px;
  flex: 0 0 auto;
  min-width: 0;
  background: var(--v2-line);
}
.v2-chart-tfs .v2-btn[data-tf] {
  width: auto;
  min-width: 32px;
  height: 24px;
  min-height: 24px;
  padding: 0 6px;
  border: 0;
  box-shadow: none;
  background: var(--v2-tile);
  font-family: var(--pix);
  font-size: var(--fs-pix-label, 12px);
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: var(--v2-track-label);
  -webkit-font-smoothing: none;
  text-transform: none;
}
.v2-chart-tfs .v2-btn[data-tf]:active,
.v2-chart-tfs .v2-btn[data-tf].pr {
  transform: none;
  box-shadow: none;
}
.v2-chart-tfs .v2-btn[data-tf].on,
.v2-chart-tfs .v2-btn[data-tf].on:hover {
  background: var(--acc);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}
/* Overflow tools that do not fit the 44px rail (⋯ → x-ddm).
   Fixed layer so the tile overflow:hidden cannot clip lock/trash. */
.v2-chart-more.x-ddm {
  position: fixed;
  z-index: 200;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 160px;
  background: var(--v2-tile);
  border: 1px solid var(--acc);
  box-shadow: 4px 4px 0 var(--acc);
  clip-path: inset(0 0 100% 0);
  pointer-events: auto;
}
.v2-chart-more.x-ddm:not([hidden]) {
  animation: x-pop 160ms steps(4, end) forwards;
}
.v2-chart-more[hidden] {
  display: none;
}
.v2-chart-more .v2-btn {
  width: 100%;
  height: 44px;
  min-height: 44px;
  border: 0;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  gap: 8px;
  background: var(--v2-header);
  font-family: var(--mono);
  font-size: var(--fs-12);
  font-weight: 400;
  letter-spacing: var(--v2-track-label);
  text-transform: uppercase;
}
.v2-chart-more .v2-btn .x-ico {
  width: 16px;
  height: 16px;
  flex: none;
}
.v2-chart-more .v2-tool-label {
  display: inline;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.v2-chart-more .v2-btn.on,
.v2-chart-more .v2-btn.on:hover {
  background: var(--acc);
  color: var(--ink);
  font-weight: 700;
}
.v2-chart-more .v2-btn.sticky {
  background: var(--bone);
  color: var(--ink);
  font-weight: 700;
}
.v2-chart-more .v2-btn.sticky.on,
.v2-chart-more .v2-btn.sticky.on:hover {
  background: var(--acc);
  color: var(--ink);
}
@keyframes x-pop {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
.v2-chart-gutter {
  flex: 0 0 0;
  width: 0;
  background: var(--v2-tile);
  touch-action: none;
}
.v2-chart-edge {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16px;
  z-index: 5;
  touch-action: none;
  pointer-events: none;
}
.v2-chart-main {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: none;
}
.v2-chart-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  flex: 0 0 24px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  gap: 1px;
  overflow: hidden;
  background: var(--v2-line);
  user-select: none;
  touch-action: none;
}
.v2-chart-chips .v2-btn {
  border: 0;
  box-shadow: none;
  background: var(--v2-tile);
  width: 78px;
  height: 24px;
  min-height: 24px;
  letter-spacing: var(--v2-track-label);
  text-transform: uppercase;
}
.v2-chart-chips .v2-btn:active,
.v2-chart-chips .v2-btn.pr {
  transform: none;
  box-shadow: none;
}
/* Same cascade fix as tools: idle chip background must not beat .on rose fill. */
.v2-chart-chips .v2-btn.on,
.v2-chart-chips .v2-btn.on:hover {
  background: var(--acc);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}
.v2-chart-chips .v2-chart-plus {
  width: 44px;
}
.v2-chart-pick {
  position: absolute;
  z-index: 6;
  display: flex;
  flex-direction: column;
  min-width: 148px;
  background: var(--v2-line);
  border: var(--v2-rule) solid var(--v2-rose);
  gap: 1px;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.v2-chart-pick[hidden] {
  display: none;
}
.v2-chart-pick .v2-btn {
  width: 100%;
  height: 30px;
  min-height: 30px;
  border: 0;
  box-shadow: none;
  justify-content: flex-start;
  padding: 0 8px;
  background: var(--v2-tile);
}
.v2-chart-pick .v2-btn:active,
.v2-chart-pick .v2-btn.pr {
  transform: none;
  box-shadow: none;
}
/* Same cascade fix as chips: idle tile fill must not beat .on rose fill. */
.v2-chart-pick .v2-btn.on,
.v2-chart-pick .v2-btn.on:hover {
  background: var(--acc);
  color: var(--ink);
  font-weight: 700;
  box-shadow: none;
}
.v2-chart-ohlc {
  /* Flex grow + min-width 0: same box empty or filled. Legend text cannot wrap a
     second chip row and shift .v2-chart-ov when candles arrive (mobile CLS).
     Phones: 24px in-flow row in mobile.css; portrait strip (#268) overrides.
     Must stay inside the chart tile (▼ was past the edge at 1440). */
  margin-left: auto;
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  height: 24px;
  min-height: 24px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
  font-size: var(--v2-fs);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--v2-muted);
  background: var(--v2-tile);
  touch-action: none;
}
.v2-chart-ohlc-line {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Placeholder digits from paintOhlc(null) keep glyph width; hide until a real bar. */
.v2-chart-ohlc[data-empty],
.v2-chart-ohlc[data-empty] .v2-chart-ohlc-line {
  color: transparent;
}
.v2-chart-pane {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--v2-tile);
  touch-action: none;
  overscroll-behavior: contain;
}
.v2-chart-pane:focus {
  outline: none;
}
.v2-chart-pane:focus-visible {
  outline: 1px solid var(--v2-rose);
  outline-offset: -1px;
  z-index: 2;
}
.v2-chart-cv,
.v2-chart-ov {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  overscroll-behavior: contain;
}
.v2-chart-ov {
  pointer-events: none;
  z-index: 2;
  touch-action: none;
}
/* Portrait phones move this below the legend strip in mobile.css. */
.v2-chart-msg {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  color: var(--v2-muted);
  background: var(--v2-tile);
  letter-spacing: var(--v2-track-label);
  text-transform: uppercase;
  pointer-events: none;
}
.v2-chart-msg[hidden] {
  display: none;
}
.v2-chart-msg .v2-btn {
  height: 26px;
  min-height: 26px;
  border: var(--v2-rule) solid var(--v2-line);
  box-shadow: 2px 2px 0 var(--line);
  pointer-events: auto;
}
/* Coarse pointers only. Fine pointers keep the 26px rule above. Not a page breakpoint. */
@media (pointer: coarse) {
  .v2-chart-msg .v2-btn {
    height: 44px;
    min-height: 44px;
  }
}
.v2-chart-range {
  position: absolute;
  z-index: 4;
  display: none;
  pointer-events: none;
  padding: 4px 6px;
  text-align: center;
  font-family: var(--pix);
  font-size: var(--fs-pix-label, 12px);
  font-weight: 700;
  font-synthesis: none;
  letter-spacing: var(--v2-track-label);
  -webkit-font-smoothing: none;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--acc);
}
.v2-chart-range.on {
  display: block;
}
.v2-chart-range i {
  display: block;
  font-style: normal;
}
.v2-chart-meta {
  margin-left: 4px;
  letter-spacing: var(--v2-track-label);
  text-transform: uppercase;
}
.v2-chart-pane > .tvmark {
  position: absolute;
  left: 10px;
  bottom: 34px;
  width: 22px;
  height: 22px;
  z-index: 4;
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
}
.v2-chart-pane > .tvcredit {
  position: absolute;
  left: 40px;
  bottom: 36px;
  z-index: 4;
  color: var(--v2-muted);
  font-family: var(--pix);
  font-size: var(--fs-pix-label, 12px);
  font-weight: 400;
  font-synthesis: none;
  line-height: 1;
  letter-spacing: var(--v2-track-label);
  -webkit-font-smoothing: none;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}
