/* Prototype: author profile Calls table, one row per ticker, expandable chronology. */

/* ── Calls table: Ticker / Side / Calls / Mentions / First call / Best call P&L / Status / Chart / Source */
@media (min-width: 721px) {
  .sd3 .sd3-table:has(.sd3-callgroup-head) { min-width: 1040px; }
}
.sd3 .sd3-callgroup-head,
.sd3 #sd2Feed.sd3-callgroup-feed .sd3-row {
  grid-template-columns: 196px 64px 64px 84px 92px 110px minmax(220px, 1fr) 84px 48px;
}
.sd3 .sd3-callgroup { cursor: pointer; }
.sd3 .sd3-callgroup:focus-visible { outline: 2px solid var(--sd3-blue, #58a6ff); outline-offset: -2px; }
.sd3 .sd3-callgroup.is-open { background: var(--sd3-panel-2, #161b22); }
.sd3 .sd3-callgroup .sd3-cell-ticker { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sd3-callgroup-caret {
  flex: none; width: 8px; height: 8px; margin-right: 2px;
  border-right: 2px solid #6e7681; border-bottom: 2px solid #6e7681;
  transform: rotate(-45deg); transition: transform .15s ease;
}
.sd3-callgroup.is-open .sd3-callgroup-caret { transform: rotate(45deg); border-color: #c9d1d9; }
.sd3-callgroup-count {
  min-width: 30px; padding: 3px 8px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
  color: #c9d1d9; font: inherit; font-weight: 700; cursor: pointer;
}
.sd3-callgroup-count:hover, .sd3-callgroup.is-open .sd3-callgroup-count { border-color: rgba(88,166,255,.55); color: #f0f6fc; }
.sd3-callgroup-mentions { color: #c9d1d9; cursor: help; }
.sd3-callgroup-status-cell { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.sd3-callgroup-status { color: #8b949e; }
.sd3-callgroup-status.is-open { color: #58a6ff; font-weight: 700; }
.sd3-callgroup-holds { color: #6e7681; font-size: 11.5px; }
.sd3-callgroup-chartbtn {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.14); border-radius: 6px; background: transparent;
  color: #c9d1d9; font: inherit; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.sd3-callgroup-chartbtn:hover { border-color: rgba(88,166,255,.55); color: #f0f6fc; }
.sd3-callgroup-chartbtn[aria-pressed="true"] { border-color: #58a6ff; background: rgba(88,166,255,.14); color: #f0f6fc; }

/* ── Opened row: chart panel (Chart button) and call chronology (row click), independent */
.sd3-callgroup-chartpanel,
.sd3-callgroup-history { grid-column: 1 / -1; min-width: 0; max-width: 100%; margin: 10px 0 4px; cursor: default; }
.sd3-callgroup-chartpanel[hidden], .sd3-callgroup-history[hidden] { display: none; }
.sd3-callgroup-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sd3-callgroup-panel-title { color: #8b949e; font-size: 12px; font-weight: 700; }
.sd3-callgroup-tickerlink { color: #58a6ff; font-size: 12px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.sd3-callgroup-tickerlink:hover { text-decoration: underline; }

/* ── Calls chart: quote and filters on the left, line coloured by the open call */
.sd3-cc { border: 1px solid var(--sd3-line, rgba(255,255,255,.08)); border-radius: 8px; background: var(--sd3-panel, #0d1117); }
.sd3-cc > .sd3-chart-msg { padding: 60px 12px; }
.sd3-cc-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 12px;
  border-bottom: 1px solid var(--sd3-line, rgba(255,255,255,.08));
}
.sd3-cc-quote { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.sd3-cc-sym { color: #f0f6fc; font-size: 14px; }
.sd3-cc-last { color: #c9d1d9; font-size: 13px; font-weight: 700; }
.sd3-cc-chg { font-size: 12px; font-weight: 700; }
.sd3-cc .pos { color: #3fb950; }
.sd3-cc .neg { color: #f85149; }
.sd3-cc-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sd3-cc-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: transparent;
  color: #c9d1d9; font: inherit; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.sd3-cc-chip:hover { border-color: rgba(255,255,255,.3); color: #f0f6fc; }
.sd3-cc-chip.on { border-color: #f0f6fc; background: rgba(240,246,252,.1); color: #f0f6fc; }
.sd3-cc-chip.is-neutral { margin-left: 8px; }
.sd3-cc-chip-count { color: #8b949e; font-weight: 600; }
.sd3-cc-chip.on .sd3-cc-chip-count { color: #c9d1d9; }
/* marker glyphs: the same shapes and colours as on the chart */
.sd3-cc-chip-glyph, .sd3-cc-tip-glyph { flex: none; width: 0; height: 0; border: 5px solid transparent; }
.sd3-cc-chip.is-all .sd3-cc-chip-glyph { display: none; }
.sd3-cc-chip.is-long .sd3-cc-chip-glyph { border-top: 0; border-bottom: 8px solid #3fb950; }
.sd3-cc-chip.is-short .sd3-cc-chip-glyph { border-bottom: 0; border-top: 8px solid #f85149; }
.sd3-cc-chip.is-short .sd3-cc-chip-glyph.is-avoid { margin-left: -4px; border-top-color: #e3b341; }
.sd3-cc-chip.is-hold .sd3-cc-chip-glyph { border-top: 0; border-bottom: 8px solid #8b949e; }
.sd3-cc-chip.is-neutral .sd3-cc-chip-glyph { width: 8px; height: 8px; border: 0; border-radius: 50%; background: #58a6ff; }
.sd3-cc-plot { position: relative; height: 380px; }
.sd3-cc-badges { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.sd3-cc-badge {
  position: absolute; padding: 1px 6px; border-radius: 4px; white-space: nowrap;
  font-size: 10.5px; font-weight: 800; line-height: 14px; letter-spacing: .02em;
  box-shadow: 0 0 0 2px rgba(13,17,23,.85);
}
.sd3-cc-badge.is-long { background: #3fb950; color: #0d1117; }
.sd3-cc-badge.is-short { background: #f85149; color: #fff; }
.sd3-cc-badge[hidden] { display: none; }
.sd3-cc-legend { margin: 6px 2px 0; color: #6e7681; font-size: 11.5px; line-height: 1.4; }

/* Tooltip: hover reads, click pins it so the post links can be opened */
.sd3-cc-tip {
  position: absolute; z-index: 5; width: max-content; max-width: min(340px, calc(100% - 8px));
  padding: 8px 10px; pointer-events: none;
  border: 1px solid #30363d; border-radius: 8px; background: rgba(13,17,23,.97);
  box-shadow: 0 8px 24px rgba(0,0,0,.45); color: #c9d1d9; font-size: 12px; line-height: 1.4;
}
.sd3-cc-tip[hidden] { display: none; }
.sd3-cc-tip.is-pinned { pointer-events: auto; max-height: 300px; overflow-y: auto; }
.sd3-cc-tip-date { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 4px; color: #8b949e; font-weight: 700; }
.sd3-cc-tip-close { padding: 0 2px; border: 0; background: none; color: #8b949e; font-size: 16px; line-height: 1; cursor: pointer; }
.sd3-cc-tip-close:hover { color: #f0f6fc; }
.sd3-cc-tip-item { padding: 6px 0; border-top: 1px solid rgba(255,255,255,.06); }
.sd3-cc-tip-head { display: flex; align-items: center; gap: 7px; }
.sd3-cc-tip-head b { color: #f0f6fc; }
.sd3-cc-tip-price { margin-left: auto; padding-left: 10px; color: #c9d1d9; }
.sd3-cc-tip-pnl { margin-top: 2px; font-weight: 700; }
.sd3-cc-tip-reason { margin-top: 2px; color: #d29922; font-weight: 700; }
.sd3-cc-tip-text { margin-top: 3px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.sd3-cc-tip.is-pinned .sd3-cc-tip-text { display: block; }
.sd3-cc-tip-link { display: inline-block; margin-top: 4px; color: #58a6ff; font-weight: 700; text-decoration: none; }
.sd3-cc-tip-link:hover { text-decoration: underline; }
.sd3-cc-tip-more, .sd3-cc-tip-hint { margin-top: 4px; color: #6e7681; font-size: 11px; }
.sd3-cc-tip-item.is-entry.side-long .sd3-cc-tip-glyph { border-top: 0; border-bottom: 9px solid #3fb950; }
.sd3-cc-tip-item.is-entry.side-short .sd3-cc-tip-glyph { border-bottom: 0; border-top: 9px solid #f85149; }
.sd3-cc-tip-item.is-avoid .sd3-cc-tip-glyph { border-bottom: 0; border-top: 9px solid #e3b341; }
.sd3-cc-tip-item.is-hold .sd3-cc-tip-glyph,
.sd3-cc-tip-item.is-mention .sd3-cc-tip-glyph { border-top: 0; border-bottom: 7px solid #8b949e; }
.sd3-cc-tip-item.is-hold.side-short .sd3-cc-tip-glyph { border-bottom: 0; border-top: 7px solid #8b949e; }
.sd3-cc-tip-item.is-close .sd3-cc-tip-glyph { width: 9px; height: 9px; border: 0; background: #e6edf3; }
.sd3-cc-tip-item.is-neutral .sd3-cc-tip-glyph { width: 7px; height: 7px; border: 0; border-radius: 50%; background: #8b949e; }
.sd3-cc-tip-item.is-neutral.side-watch .sd3-cc-tip-glyph { background: #58a6ff; }
.sd3-hist-loading { color: #8b949e; padding: 10px 0; }
.sd3-hist-src { display: inline-flex; align-items: center; justify-content: center; }

/* ── Chronology: one table, rows in date order, a summary line per call */
.sd3-tl {
  overflow: hidden; font-size: 12.5px;
  border: 1px solid var(--sd3-line, rgba(255,255,255,.08)); border-radius: 8px; background: var(--sd3-panel, #0d1117);
}
.sd3-tl-head, .sd3-tl-row {
  display: grid; align-items: baseline; gap: 14px; padding: 8px 14px;
  grid-template-columns: 92px 56px 104px 72px minmax(0, 1fr) 24px;
}
.sd3-tl-head {
  color: var(--sd3-muted, #8b949e); background: var(--sd3-panel-2, #161b22);
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase;
}
.sd3-tl-price, .sd3-tl-pnl { text-align: right; white-space: nowrap; }
.sd3-tl-call {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 12px 14px 6px;
  border-top: 1px solid var(--sd3-line, rgba(255,255,255,.08));
}
.sd3-tl-head + .sd3-tl-call { border-top: 0; }
.sd3-tl-call-name { color: #f0f6fc; font-size: 13px; font-weight: 800; }
.sd3-tl-call-name .sd3-side { margin-left: 6px; }
.sd3-tl-call-period { color: #8b949e; font-size: 12px; }
.sd3-tl-call-result { margin-left: auto; color: #8b949e; font-size: 12px; white-space: nowrap; }
.sd3-tl-call-result b { margin-left: 8px; font-size: 14px; font-weight: 800; }
.sd3-tl-row { border-top: 1px solid rgba(255,255,255,.05); color: #c9d1d9; }
.sd3-tl-call + .sd3-tl-row { border-top: 0; }
.sd3-tl-row[hidden] { display: none; }
.sd3-tl-date { color: #8b949e; white-space: nowrap; }
.sd3-tl-event { color: #f0f6fc; font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.sd3-tl-price { color: #c9d1d9; }
.sd3-tl-text { min-width: 0; line-height: 1.4; }
.sd3-tl-reason { color: #f0f6fc; font-weight: 700; }
.sd3-tl-row.is-hold .sd3-tl-event { color: #8b949e; font-weight: 600; }
.sd3-tl-row.is-hold .sd3-tl-text, .sd3-tl-row.is-hold .sd3-tl-price { color: #8b949e; }
.sd3-tl-row.is-hold .sd3-tl-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.sd3-tl .pos { color: #3fb950; }
.sd3-tl .neg { color: #f85149; }
/* Show / hide the middle of a long HOLD run; the label lines up with the Event column. */
.sd3-tl-fold {
  display: flex; align-items: center; gap: 8px; width: 100%; cursor: pointer;
  padding: 7px 14px 7px calc(14px + 92px + 14px);
  border: 0; border-top: 1px solid rgba(255,255,255,.05); background: rgba(255,255,255,.02);
  color: #58a6ff; font: inherit; font-size: 12px; font-weight: 700; text-align: left;
}
.sd3-tl-fold:hover { background: rgba(88,166,255,.07); }
.sd3-tl-fold[hidden] { display: none; }
.sd3-tl-fold-icon {
  flex: none; width: 6px; height: 6px; margin: -3px 2px 0 0;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
.sd3-tl-fold[aria-expanded="true"] .sd3-tl-fold-icon { margin-top: 3px; transform: rotate(-135deg); }
.sd3-tl-fold-hide { display: none; }
.sd3-tl-fold[aria-expanded="true"] .sd3-tl-fold-show { display: none; }
.sd3-tl-fold[aria-expanded="true"] .sd3-tl-fold-hide { display: inline; }

@media (max-width: 720px) {
  /* The opened panel (chart canvas, long theses) must not widen the card. */
  .sd3-table-card #sd2Feed.sd3-callgroup-feed .sd3-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sd3-callgroup-panel-head { flex-wrap: wrap; }
  /* The card has a free slot in its second line (the old theme cell): the Chart button goes there. */
  .sd3-table-card #sd2Feed.sd3-callgroup-feed .sd3-callgroup-chart-cell { grid-area: theme; justify-self: end; align-self: center; }
  .sd3-table-card #sd2Feed.sd3-callgroup-feed .sd3-cell-src { display: none; }
  .sd3-table-card #sd2Feed .sd3-callgroup-status-cell,
  .sd3-table-card #sd2Feed .sd3-callgroup-status { white-space: normal; overflow: visible; text-overflow: clip; }
  .sd3-cc-plot { height: 300px; }
  .sd3-cc-toolbar { padding: 8px; }
  .sd3-cc-chip { padding: 4px 8px; font-size: 11.5px; }
  .sd3-cc-chip.is-neutral { margin-left: 0; }
  /* The shared mobile card hard-codes "MENTIONS"; this column counts calls. */
  .sd3-table-card #sd2Feed.sd3-callgroup-feed .sd3-cell-mentions::after { content: attr(data-mobile-label); }
  .sd3-callgroup-count { border: 0; background: none; padding: 0; min-width: 0; font-size: inherit; }
  .sd3 .sd3-callgroup .sd3-cell-ticker { gap: 4px; }

  .sd3-tl-head { display: none; }
  .sd3-tl-call { padding: 10px 10px 4px; }
  .sd3-tl-call-result { margin-left: 0; }
  .sd3-tl-fold { padding-left: 10px; }
  .sd3-tl-row {
    gap: 4px 10px; padding: 8px 10px;
    grid-template-columns: 88px minmax(0, 1fr) auto auto 22px;
    grid-template-areas: "date event price pnl src" "text text text text text";
  }
  .sd3-tl-date { grid-area: date; }
  .sd3-tl-event { grid-area: event; }
  .sd3-tl-row .sd3-tl-price { grid-area: price; }
  .sd3-tl-row .sd3-tl-pnl { grid-area: pnl; }
  .sd3-tl-text { grid-area: text; }
  .sd3-tl-row > :last-child { grid-area: src; }
}
