/* ------------------------------------------------------------ the price chart
 * components/PriceChart.jsx (round 28: KLineChart, with TradingView's
 * indicators and drawing tools): its head (the timeframe chips, Indicators and,
 * on a phone, Draw), the indicators menu and one indicator's settings, the
 * drawing tools (a column along the chart's left edge on a desktop, a row over
 * the chart behind Draw on a phone) and a word over a plot with no bars.
 * Each pane below the volume's adds its height (--chart-extra, set from
 * script). Built from shell.css's tokens; nothing here is set by a style
 * attribute. After feed.css, before sendit.css. */

.pep-chart { position: relative; display: grid; gap: 10px; min-width: 0; }
.pep-chart-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.pep-chart-head > .pep-chart-tools { flex: 1 1 auto; }
.pep-chart-acts { display: flex; gap: 6px; margin-left: auto; }
.pep-chart-act { display: inline-flex; align-items: center; gap: 6px; }
.pep-chart-act .pep-cico { width: 16px; height: 16px; }
.pep-chart-act[aria-expanded="true"] { border-color: var(--pep-brand); color: var(--pep-brand); }
.pep-chart-drawbtn { display: none; }
.pep-cico { display: block; flex: none; width: 18px; height: 18px; }

.pep-chart-body { display: flex; gap: 6px; min-width: 0; }
.pep-chart-body > .pep-candles-wrap { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.pep-chart .pep-candles { height: calc(420px + var(--chart-extra, 0px)); margin-top: 0; }
.pep-chart-note {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0 16px;
  color: var(--pep-text-3);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
}
.pep-chart-placing {
  position: absolute;
  bottom: 40px;
  left: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 90px);
  margin: 0;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--pep-line);
  border-radius: 999px;
  background: var(--pep-panel-2);
  color: var(--pep-text-2);
  font-size: 12px;
  pointer-events: none;
}
.pep-chart-placing > button { min-height: 28px; padding: 0 10px; font-size: 12px; pointer-events: auto; }

/* While a drawing is placed, the traders' faces step back: a tap meant for a point never opens a face's card. */
.pep-chart.is-placing .pep-cface { opacity: 0.35; pointer-events: none; }

/* The position window's chart takes the height the dialog leaves it. */
.pep-pm-chart .pep-chart { display: flex; flex: 1 1 auto; flex-direction: column; gap: 8px; min-height: 0; }
.pep-pm-chart .pep-chart-body { flex: 1 1 auto; min-height: 140px; }
.pep-pm-chart .pep-chart-body > .pep-candles-wrap { min-height: 140px; }
.pep-pm-chart .pep-chart .pep-candles { height: auto; }

/* ---- the drawing tools */
.pep-draw {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 0;
  border-right: 1px solid var(--pep-line);
}
.pep-draw-group { position: relative; display: flex; align-items: center; }
.pep-draw-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--pep-text-2);
  cursor: pointer;
}
.pep-draw-btn:hover { background: var(--pep-brand-soft); color: var(--pep-text); }
.pep-draw-btn[aria-pressed="true"] { background: var(--pep-brand-soft); color: var(--pep-brand); }
.pep-draw-btn:disabled { background: none; color: var(--pep-text-3); opacity: 0.45; cursor: default; }
.pep-draw-btn.is-sure { color: var(--pep-down); }
.pep-draw-more {
  position: absolute;
  right: -5px;
  bottom: 1px;
  display: grid;
  place-items: center;
  width: 12px;
  height: 14px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--pep-text-3);
  cursor: pointer;
}
.pep-draw-more .pep-cico { width: 10px; height: 10px; }
.pep-draw-more[aria-expanded="true"],
.pep-draw-more:hover { color: var(--pep-text); }
.pep-draw-btn:focus-visible,
.pep-draw-more:focus-visible,
.pep-draw-pick:focus-visible,
.pep-studies-pick:focus-visible,
.pep-studies-icon:focus-visible,
.pep-studies-x:focus-visible { outline: 2px solid var(--pep-brand); outline-offset: 1px; }
.pep-draw-sep { width: 20px; height: 1px; margin: 4px 0; background: var(--pep-line); }
.pep-draw-fly {
  position: absolute;
  top: 0;
  left: calc(100% + 8px);
  z-index: 8;
  display: grid;
  gap: 2px;
  min-width: 210px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--pep-line);
  border-radius: 10px;
  background: var(--pep-panel-2);
  box-shadow: 0 12px 30px rgb(0 0 0 / 45%);
  list-style: none;
}
.pep-draw-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--pep-text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.pep-draw-pick:hover,
.pep-draw-pick[aria-pressed="true"] { background: var(--pep-brand-soft); }
.pep-draw-pick[aria-pressed="true"] { color: var(--pep-brand); }
.pep-draw-note { gap: 8px; padding: 10px; }
.pep-draw-note label { display: grid; gap: 4px; color: var(--pep-text-2); font-size: 12px; }
.pep-draw-note input,
.pep-studies-search,
.pep-studyset-field input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--pep-line);
  border-radius: 8px;
  background: var(--pep-ground);
  color: var(--pep-text);
  font: inherit;
  font-size: 14px;
}

/* ---- the indicators menu and one indicator's settings */
.pep-studies,
.pep-studyset {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  border: 1px solid var(--pep-line);
  border-radius: 12px;
  background: var(--pep-panel-2);
  box-shadow: 0 18px 40px rgb(0 0 0 / 50%);
}
.pep-studies { width: 380px; max-height: min(540px, 72vh); }
.pep-studies-head { display: flex; align-items: center; gap: 6px; padding: 10px; border-bottom: 1px solid var(--pep-line); }
.pep-studies-search { flex: 1 1 auto; }
.pep-studies-x,
.pep-studies-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--pep-text-2);
  cursor: pointer;
}
.pep-studies-x:hover,
.pep-studies-icon:hover { background: var(--pep-brand-soft); color: var(--pep-text); }
.pep-studies-lists { overflow-y: auto; padding: 0 6px 8px; overscroll-behavior: contain; }
.pep-studies-sec { padding: 0; }
.pep-studies-h { margin: 10px 8px 4px; color: var(--pep-text-3); font-size: 12px; font-weight: 600; }
.pep-studies-list,
.pep-studies-on { display: grid; gap: 1px; margin: 0; padding: 0; list-style: none; }
.pep-studies-on { padding: 0 6px 6px; border-bottom: 1px solid var(--pep-line); }
.pep-studies-on li { display: flex; align-items: center; gap: 2px; padding-left: 8px; }
.pep-studies-title { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--pep-text); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.pep-studies-pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--pep-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pep-studies-pick b { flex: none; min-width: 46px; font-size: 13px; }
.pep-studies-pick span { min-width: 0; color: var(--pep-text-2); font-size: 13px; }
.pep-studies-pick:hover { background: var(--pep-brand-soft); }
.pep-studies-pick[aria-pressed="true"] b { color: var(--pep-brand); }
.pep-studies-pick[aria-pressed="true"]::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--pep-brand);
}
.pep-studies-none { margin: 0; padding: 14px 8px; font-size: 13px; }
.pep-studies-foot { margin: 0; padding: 8px 12px; border-top: 1px solid var(--pep-line); font-size: 12px; }

.pep-studyset { gap: 12px; width: 320px; padding: 14px; }
.pep-studyset-head { display: grid; gap: 2px; margin: 0; }
.pep-studyset-head b { color: var(--pep-text); font-size: 15px; }
.pep-studyset-head .pep-faint { font-size: 12px; }
.pep-studyset-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pep-studyset-field { display: grid; gap: 4px; color: var(--pep-text-2); font-size: 12px; }
.pep-studyset-none { margin: 0; font-size: 13px; }
.pep-studyset-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pep-studyset-done { border-color: var(--pep-brand); color: var(--pep-brand); }

/* ---- a phone: the drawing tools behind Draw, in a row over the chart; the menus the chart's width */
@media (max-width: 640px) {
  .pep-chart .pep-candles { height: calc(330px + var(--chart-extra, 0px)); }
  /* The head in two rows at most: the chips wrap beside Indicators and Draw, which show their glyphs only. */
  .pep-chart-head { flex-wrap: nowrap; align-items: flex-start; }
  .pep-chart-head > .pep-mchips,
  .pep-chart-head > .pep-chart-tools { flex: 1 1 0; min-width: 0; }
  .pep-chart-act { width: 40px; padding: 0; justify-content: center; }
  .pep-chart-act > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .pep-chart-drawbtn { display: inline-flex; }
  .pep-chart-body { flex-direction: column; }
  .pep-chart .pep-draw { display: none; }
  .pep-chart.is-drawing .pep-draw { display: flex; }
  .pep-draw.is-row {
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0 0 6px;
    border-right: 0;
    border-bottom: 1px solid var(--pep-line);
  }
  .pep-draw.is-row .pep-draw-sep { width: 1px; height: 20px; margin: 0 4px; }
  .pep-draw.is-row .pep-draw-group { position: static; margin-right: 6px; }
  .pep-draw.is-row .pep-draw-more { position: static; width: 14px; height: 32px; margin-left: -2px; }
  .pep-draw.is-row .pep-draw-fly { top: calc(100% + 4px); right: 0; left: 0; min-width: 0; }
  .pep-studies,
  .pep-studyset { left: 0; width: auto; }
  .pep-studyset-fields { grid-template-columns: minmax(0, 1fr); }
}
