/* Markets (/markets) tables in the Attio look (html.at-done), 2026-10-30 — the same pass as /government and /insiders
   (docs/features/gov-money.md + insiders.md "Attio table polish"). Desktop only: phones keep aiq-phone-markets.css.
   table() in markets-attio-drafts.js marks its desktop tables .mkad-pol and does the sizing:
   - a set width per column, each at least its own header (icon · label · arrow · ⌄ · padding + 8px); the first column
     sized to its longest name (240–340px); the panel's spare width spread over the other columns (each at most 2×),
     the rest blank after the last column; News' headline is the one flexible column (<col class="mkad-fcol">; not
     "flex": Tailwind's .flex turns a <col> into a box); "+ Add column" a 44px "+"; too wide = scrolls in its own box
   - a thin grey type icon before each header label (.mkad-hic)
   This file: headers clip, tint from cell B2 (header + first column white, every other body cell --at-cell; replaces
   the period / sorted-column tint), hover and chart-picked rows on the cells. The valuation table (.gt, a compact
   table beside its chart) gets the tint and clipping but no icons.
   Selectors carry two :not(#_) to beat markets-attio-drafts.css (one :not(#_) + !important). */
html.at-done .mkad { --at-cell: #FAFAFE; }
html.at-done[data-theme="dark"] .mkad { --at-cell: rgba(255,255,255,.018); }

@media (min-width: 768px) {
  /* headers never spill into the next column: the cell clips and the label ends in "…" */
  html.at-done .mkad .mkad-t:is(.mkad-pol, .gt):not(#_):not(#_) > thead > tr > th { overflow: hidden; }
  html.at-done .mkad .mkad-t.mkad-pol .th { min-width: 0; max-width: 100%; }
  html.at-done .mkad .mkad-t.mkad-pol .th .tl { min-width: 0; white-space: nowrap; }
  html.at-done .mkad .mkad-t.mkad-pol .th > :not(.tl) { flex: none; }
  html.at-done .mkad .mkad-t.gt .th0 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html.at-done .mkad .mkad-t .mkad-hic { flex: none; width: 14px; height: 14px; color: var(--a-mute, #9A9CA5); }

  /* tint from B2 */
  html[data-theme] .mkad .mkad-t:is(.mkad-pol, .gt):not(#_):not(#_) > tbody > tr:not(.mkad-g) > td:not(:first-child) { background: var(--at-cell) !important; }
  html[data-theme] .mkad .mkad-t:is(.mkad-pol, .gt):not(#_):not(#_) > tbody > tr:not(.mkad-g) > td:first-child { background: var(--a-bg) !important; }
  html[data-theme] .mkad .mkad-t:is(.mkad-pol, .gt):not(#_):not(#_) > tbody > tr:not(.mkad-g):hover > td { background: #F7F8FD !important; }
  html[data-theme="dark"] .mkad .mkad-t:is(.mkad-pol, .gt):not(#_):not(#_) > tbody > tr:not(.mkad-g):hover > td { background: rgba(255,255,255,.03) !important; }
  html[data-theme] .mkad .mkad-t.mkad-pol:not(#_):not(#_) > tbody > tr.mk-on:not(.mkad-g) > td:is(:first-child, :not(:first-child)) { background: rgba(38,109,240,.05) !important; }
  html[data-theme] .mkad .mkad-t.gt:not(#_):not(#_) > tbody > tr.gsel.on:not(.mkad-g) > td:is(:first-child, :not(:first-child)) { background: rgba(38,109,240,.06) !important; }
  /* the blank after the last column (the "+" column's room, or the empty filler column) stays white, "+" at its left */
  html[data-theme] .mkad .mkad-t.mkad-pol:not(#_):not(#_) > tbody > tr:not(.mkad-g) > td:is(.addc, .mkad-fill) { background: var(--a-bg) !important; }
  html.at-done .mkad .mkad-t.mkad-pol th.addc .addb { width: 44px; }
}

/* a table too wide to fit (Asset classes: 17 calendar years) pins its name column while the rest scrolls; the pinned
   cell stays opaque (the row hover is translucent) with a hairline on its right edge */
html[data-theme] .mkad .mkad-t.mkad-stk:not(#_):not(#_) > :is(thead, tbody) > tr:not(.mkad-g) > :first-child {
  position: sticky; left: 0 !important; z-index: 2; background: var(--a-bg) !important;
  border-right: 0 !important; box-shadow: inset -1px 0 0 var(--a-line, #EEEFF1);   /* the cell's own border + this drew 2px */
}

/* Asset classes: ticked rows → "Add to watchlist" in a bar that sticks to the bottom of the panel */
.mkad .mkad-sel { position: sticky; bottom: 16px; z-index: 5; display: flex; justify-content: center; margin-top: 12px; pointer-events: none; }
.mkad .mkad-sel > div { display: inline-flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; pointer-events: auto;
  background: var(--a-bg); border: 1px solid var(--a-line, #EEEFF1); border-radius: 4px; box-shadow: 0 4px 16px rgba(15,17,21,.08);
  font: 500 13px/20px Inter, system-ui, sans-serif; color: var(--a-ink, inherit); }
.mkad .mkad-sel .x { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--a-mute); cursor: pointer; border-radius: 4px; }
.mkad .mkad-sel .x:hover { background: var(--a-hover, rgba(0,0,0,.04)); }
.mkad .mkad-t td .c0 .pk { margin-right: 10px; }
