/* Company screens and user tools (HISTORY, INSIDERS, SHORTS, BEATS, FILINGS, OWNERS,
   WATCH, PF, DESK embeds, WHATIF, AFFORD, LOAN, COMPOUND). Same tokens and scales as
   style.css and kit.css: spacing 4 8 12 16 24 32, type 11 12 13 14 16 18 24. */

/* ---- A capped table with a side panel: the table hugs, the side takes the rest ---- */
.with-side { padding: 0; }
@media (min-width: 1280px) {
  .with-side.side-hug { grid-template-columns: minmax(0, max-content) minmax(280px, 1fr); }
  .with-side.side-hug > :first-child { max-width: 960px; }
}
.with-side > .side-panel, .with-side > .hist-side { min-width: 0; }
.side-panel, .hist-side {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  border-left: 1px solid var(--rule);
}
.side-title { margin: 0; }
.side-chart { position: relative; height: 200px; min-width: 0; }
.side-chart svg { display: block; }
.side-hover { min-height: 16px; margin: 0; font-size: 11px; font-variant-numeric: tabular-nums; }
.side-note { margin: 0; font-size: 11px; color: var(--dim); line-height: 1.5; }
.side-stats { margin: 0; }
.side-stats dd { gap: 8px; }
.side-empty { margin: 0; color: var(--dim); font-size: 12px; }
@media (max-width: 1279px) {
  .side-panel, .hist-side { border-left: 0; border-top: 1px solid var(--rule); }
  .hist-layout > .hist-side { order: -1; border-top: 0; border-bottom: 1px solid var(--rule); }
}

/* Small bar charts (BEATS, INSIDERS): two series, a zero line, labels under the bars. */
.mb { display: block; width: 100%; height: auto; overflow: visible; }
.mb-grid { stroke: var(--rule); stroke-width: 1; }
.mb-zero { stroke: var(--rule-strong); stroke-width: 1; }
.mb-lab, .mb-ylab { fill: var(--dim); font-family: var(--font); font-size: 10px; }
.mb-a { fill: var(--series-1, hsl(213, 77%, 56%)); }
.mb-b { fill: var(--text-2); opacity: .45; }
.mb-up { fill: var(--up); opacity: .8; }
.mb-down { fill: var(--down); opacity: .8; }
.mb-open { fill: none; stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 2; }
.mb-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; font-size: 11px; color: var(--dim); }
.mb-legend li { display: inline-flex; align-items: center; gap: 6px; }
.mb-sw { display: inline-block; width: 8px; height: 8px; }
.mb-sw.mb-a { background: var(--series-1, hsl(213, 77%, 56%)); }
.mb-sw.mb-b { background: var(--text-2); opacity: .45; }
.mb-sw.mb-up { background: var(--up); }
.mb-sw.mb-down { background: var(--down); }
.mb-sw.mb-open { border: 1px dashed var(--text-2); background: transparent; }

/* ---- HISTORY --------------------------------------------------------------------- */
.hist-main .dt { margin: 0; }
.hist-main .toolbar .ch-dates { padding-right: 0; }

/* ---- WATCH and PF: an add form left, quiet list tools right, row actions right --- */
.add-form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.add-in {
  height: 24px; padding: 0 8px;
  border: 1px solid var(--rule-strong); background: var(--bg);
  color: var(--text); font-family: var(--font); font-size: 12px;
}
.add-in::placeholder { color: var(--faint); }
.add-in:focus { outline: 1px solid var(--accent); outline-offset: 0; }
.add-in[readonly] { color: var(--dim); border-style: dashed; }
.add-sym { width: 240px; text-transform: uppercase; }
.add-sym::placeholder, .add-tk::placeholder { text-transform: none; }
.add-tk { width: 96px; text-transform: uppercase; }
.add-num { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.add-btn { height: 24px; border-color: var(--accent); color: var(--accent); }
.add-btn:hover { color: var(--ink); background: var(--accent); }
.list-tools { display: inline-flex; align-items: center; gap: 4px; }
.quiet {
  padding: 0 4px; border: 0; background: transparent;
  color: var(--dim); font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: .08em;
}
.quiet:hover { color: var(--text); text-decoration: underline; }
.quiet.is-danger { color: var(--down); }
.quiet[hidden] { display: none; }
.clear-ask { margin-right: 4px; color: var(--text-2); font-size: 12px; }
.row-acts { white-space: nowrap; }
.wl-btn.is-text { width: auto; padding: 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.wl-btn[data-act="edit"]:hover { color: var(--accent); }

/* ---- SCREEN: presets row under the title, RUN at the left on every width --------- */
.sc-pad { padding: 8px 10px; }
.toolbar .tag + .seg { margin-left: 0; }
.sc-actions .wi-run { margin-left: 0; }

/* ---- WHATIF: the result's actions sit on the share row ---------------------------- */
.wi-share { align-items: center; }
.wi-share .wi-actions { display: inline-flex; gap: 16px; margin: 0 0 0 auto; }
.wi-body > .wi-actions { display: flex; }
@media (max-width: 639px) { .wi-share .wi-actions { margin-left: 0; flex-basis: 100%; } }

/* ---- AFFORD: the verdict next to the answer, a wage field, a share row ---------- */
@media (min-width: 640px) {
  .buy { grid-template-columns: minmax(0, 640px) minmax(260px, 380px); justify-content: start; }
}
.buy-stats dd .wage-form { justify-content: flex-end; }
.buy-share { margin: 0 0 8px; }

/* ---- LOAN and COMPOUND: the by-year table beside the chart, not under it -------- */
.chart-by-year { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; background: var(--rule-strong); }
@media (min-width: 1024px) {
  .chart-by-year { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); }
  /* The table takes the chart's height and scrolls inside it. */
  .chart-by-year > .by-year { position: relative; min-height: 0; }
  .chart-by-year > .by-year > .panel-body { position: absolute; inset: 23px 0 0; overflow-y: auto; scrollbar-width: thin; }
  .chart-by-year > .by-year thead th { position: sticky; top: 0; background: var(--bg); z-index: 1; }
}

/* ---- Tables: date cells and plain labels in company tables ---------------------- */
.dt td.date { color: var(--text-2); }
.dt tbody tr:hover td { background: var(--panel-2); }
.co-wide .dt td.last { color: var(--text); font-weight: 600; }
.seg-n { margin-left: 6px; color: var(--faint); font-weight: 400; }
.seg-item.is-active .seg-n { color: var(--ink); }
@media (min-width: 640px) { .dt td.wide-name { max-width: 56ch; } }
.dt tbody th { font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-2); }
.bt-next th, .bt-next td { color: var(--dim); border-bottom-color: var(--rule-strong); }
.m-only, .m-only-block { display: none; }
.fil-seg { max-width: 100%; }
.bt-next-line { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--rule); color: var(--text-2); font-size: 12px; }

@media (max-width: 639px) {
  .dt .hide-m { display: none; }
  .m-only { display: inline; }
  .m-only-block { display: block; }
  .co-wide .dt .cell-name { max-width: 12ch; }
  .add-sym { flex: 1 1 160px; width: auto; }
  .pf-form .add-in { flex: 1 1 72px; width: 72px; min-width: 0; }
  .dt tr.hide-m { display: none; }
  .d-only { display: none; }
  .co-wide .dt th { white-space: normal; line-height: 1.2; vertical-align: bottom; padding-bottom: 4px; }
  .co-wide .dt { width: 100%; }
  .hist-layout > .hist-side { order: 0; border-bottom: 0; border-top: 1px solid var(--rule); }
  .side-chart { height: 160px; }
  .toolbar .ch-dates { flex-wrap: wrap; }
  .toolbar .ch-dates input { width: 128px; }
}

/* ---- DESK panels (embed mode): compact, no repeated title, maps scale to fit ------ */
.is-embed .panel-head.is-lead .panel-label { display: none; }
.is-embed .panel-head.is-lead { justify-content: flex-end; }
.is-embed .panel-head.is-lead .panel-meta { flex: 1 1 auto; padding-left: 8px; }
.is-embed .panel-head.is-lead:has(> .panel-meta:empty) { display: none; }
.is-embed .hm-foot { display: none; }
.is-embed .hm-host { min-height: 0; }
