/* Markets page — Attio draft (html.at-done, ?tbl=attio-full; 2026-10-25). Loaded by markets/index.html; the menus and
   the Period chip come from js/markets-attio.js (.mka on #mk3). Measured spec: .claude/skills/attio-style.
   Attio's dashboard grammar: white page, widgets = r12 cards with a 1px hairline and no shadow, 14/600 widget titles,
   28px r8 controls, segmented tracks r10. Uses Attio's radii, so scripts/square_corners.py excludes this file. */

/* tokens: the page's own variables point at the Attio ones, so every renderer picks them up */
html.at-done .mk3.mka {
  --page: var(--a-bg); --bg: var(--a-bg); --bg2: var(--a-bg); --in: var(--a-fill);
  --rule: var(--a-line); --rule2: var(--a-line); --text: var(--a-ink); --sub: var(--a-label); --faint: var(--a-mute);
  --hover: var(--a-hover); --acc: var(--a-blue); --acc2: var(--a-blue); --acc-soft: rgba(38,109,240,.08);
  --seg-bg: rgba(0,0,0,.04); --seg-on: #fff; --card-sh: none;
  color: var(--a-ink); font: 500 14px/20px Inter, system-ui, sans-serif; letter-spacing: -0.07px;
}
html.at-done[data-theme="dark"] .mk3.mka { --seg-bg: rgba(255,255,255,.05); --seg-on: rgba(255,255,255,.10); }
html.at-shell.at-done .app-shell > main:has(> .mk3.mka), html.at-shell.at-done .app-shell > main:has(.mk3.mka) { background: var(--a-bg) !important; }
html.at-done .mk3.mka .mk3-wrap { padding: 0 16px 48px; }
html.at-done .mk3.mka .mk3-ph { display: none; }   /* the page-name row already says Markets */

/* ── chapter row: Attio tabs (28px, active = faint fill + hairline ring) + the Period chip on the right ── */
html.at-done .mk3.mka .mk3-cnav { position: sticky; top: 49px; z-index: 30; margin: 0 -16px 16px; padding: 0 12px; height: 48px; display: flex; align-items: center; gap: 8px;
  background: var(--a-bg); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 1px solid var(--a-line); }
html.at-done .mk3.mka .mk3-cnav-in { flex: 1 1 auto; min-width: 0; height: 48px; gap: 2px; align-items: center; }
html.at-done .mk3.mka .mk3-cnav a { height: 28px; padding: 0 8px; border-radius: 8px; font: 500 14px/20px Inter, system-ui, sans-serif; color: var(--a-label); }
html.at-done .mk3.mka .mk3-cnav a b, html.at-done .mk3.mka .mk3-cnav a.on::after { display: none; }
html.at-done .mk3.mka .mk3-cnav a:hover:not(.on) { color: var(--a-ink); background: var(--a-hover); }
html.at-done .mk3.mka .mk3-cnav a.on { color: var(--a-ink); font-weight: 500; background: var(--a-side, #FBFBFB); box-shadow: inset 0 0 0 1px var(--a-line); }

/* ── controls: secondary button (28px, r8, Attio's soft outline) ── */
html.at-done .mka .mka-btn, html.at-done .mka-btn { all: unset; box-sizing: border-box; height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 6px;
  border-radius: 8px; background: var(--a-bg); box-shadow: var(--a-btn, inset 0 0 0 1px var(--a-ring)); color: var(--a-ink);
  font: 500 14px/20px Inter, system-ui, sans-serif; letter-spacing: -0.07px; white-space: nowrap; cursor: pointer; flex: none; }
html.at-done .mka .mka-btn:hover { background: var(--a-hover); }
html.at-done .mka .mka-btn:focus-visible { outline: 2px solid var(--a-blue); outline-offset: 1px; }
html.at-done .mka .mka-btn svg { width: 16px; height: 16px; color: var(--a-label); flex: none; }
html.at-done .mka .mka-btn svg.cd { width: 13px; height: 13px; margin-left: -2px; color: var(--a-mute); }
html.at-done .mka .mka-btn .k { color: var(--a-label); }
/* small "<current> ▾" menus inside card heads: 24px, no outline until hover (Attio's ghost) */
html.at-done .mka .mka-btn.mka-sm { height: 26px; padding: 0 6px 0 8px; box-shadow: inset 0 0 0 1px var(--a-ring); font-size: 13px; }
html.at-done .mka .mka-btn.mka-cty { margin-right: auto; }
html.at-done .mka .mka-gone { display: none !important; }
html.at-done .mka .seg[data-mka-per] { display: none !important; }
html.at-done .mka-menu { min-width: 180px; max-height: min(420px, 70vh); overflow-y: auto; z-index: 1200; }
html.at-done .mka-menu .aiq-mi { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; cursor: pointer; }
html.at-done .mka-menu .aiq-mi.on { color: var(--a-blue) !important; }

/* ── section titles: Attio dashboard title 16/600 ── */
html.at-done .mk3.mka .shd { align-items: center; margin: 4px 0 10px; min-height: 28px; }
html.at-done .mk3.mka .shd h2 { font: 600 16px/24px Inter, system-ui, sans-serif; letter-spacing: -0.1px; color: var(--a-ink); }
html.at-done .mk3.mka .shd-date { font: 500 14px/20px Inter, system-ui, sans-serif; color: var(--a-label); }
html.at-done .mk3.mka .shd .lnk { font: 500 13px/20px Inter, system-ui, sans-serif; color: var(--a-label); text-decoration: underline; text-decoration-color: var(--a-line); text-underline-offset: 3px; }
html.at-done .mk3.mka .mk3-sec { margin-bottom: 28px; }
html.at-done .mk3.mka .g { gap: 12px; margin-bottom: 12px; }

/* ── widgets: r12 + 1px hairline, no shadow (beats the draft's "every card goes flat" rule) ── */
html.at-shell.at-done .app-shell > main .mk3.mka .card:not(#_):not(#_) {
  background: var(--a-bg) !important; border: 1px solid var(--a-line) !important; border-radius: 12px !important; box-shadow: none !important; overflow: hidden; }
html.at-done .mk3.mka .chd { min-height: 44px; padding: 0 10px 0 12px; gap: 8px; border-bottom: 0; }
html.at-done .mk3.mka .ct { font: 600 14px/20px Inter, system-ui, sans-serif; letter-spacing: -0.07px; color: var(--a-ink); }
html.at-done .mk3.mka .cm, html.at-done .mk3.mka .src { font: 500 12px/16px Inter, system-ui, sans-serif; color: var(--a-label); }
/* flush tables touch the card's sides; a hairline separates them from the head */
html.at-done .mk3.mka .cb.flush { border-top: 1px solid var(--a-line); }

/* ── segmented controls + in-card tabs: Attio's track (r10, faint fill) with a white r8 thumb ── */
html.at-done .mk3.mka :is(.seg, .tabs) { display: inline-flex; align-self: center; gap: 0; height: 28px; padding: 2px; border: 0; border-radius: 10px; background: var(--seg-bg); flex: none; }
html.at-done .mk3.mka :is(.seg, .tabs) button { height: 24px; padding: 0 8px; border-radius: 8px; font: 500 13px/24px Inter, system-ui, sans-serif; letter-spacing: -0.05px; color: var(--a-label); background: none; box-shadow: none; }
html.at-done .mk3.mka :is(.seg, .tabs) button:hover:not(.on) { color: var(--a-ink); }
html.at-done .mk3.mka :is(.seg, .tabs) button.on { color: var(--a-ink); font-weight: 500; background: var(--seg-on); box-shadow: 0 1px 2px -1px rgba(0,0,0,.04), 0 0 0 1px rgba(0,0,0,.06); }
html.at-done .mk3.mka .tabs button.on::after { display: none; }
html.at-done[data-theme="dark"] .mk3.mka :is(.seg, .tabs) button.on { box-shadow: none; }

/* ── Today index chart: chips + toolbar ── */
html.at-done .mk3.mka .mkx-spot-tools { display: flex; align-items: center; gap: 8px; }

/* ── country card: picker + ghost ‹ › ── */
html.at-done .mk3.mka .cty-bar { padding: 8px 10px 8px 12px; gap: 4px; border-bottom: 1px solid var(--a-line); }
html.at-done .mk3.mka .cty-arrow { order: 2; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--a-mute); font-size: 16px; }
html.at-done .mk3.mka .cty-arrow:hover { background: var(--a-hover); color: var(--a-ink); }
html.at-done .mk3.mka .cty-bar .mka-cty { order: 1; }
html.at-done .mk3.mka .cty-head h3 { font: 600 18px/24px Inter, system-ui, sans-serif; letter-spacing: -0.1px; }
html.at-done .mk3.mka .cty-head .big { font: 600 18px/24px Inter, system-ui, sans-serif; }
html.at-done .mk3.mka .cty-stats .k { font: 500 12px/16px Inter, system-ui, sans-serif; color: var(--a-label); }
html.at-done .mk3.mka .cty-stats .v { font: 500 14px/20px Inter, system-ui, sans-serif; }

/* no bold numbers (Attio keeps 600 for titles only) */
html.at-done .mk3.mka :is(.big, b, strong):not(.ct) { font-weight: 500; }

/* spacing: the chapter row sits straight on the first section */
html.at-done .mk3.mka .mk3-cnav { margin-bottom: 0; }
html.at-done .mk3.mka .mk3-sec { padding-top: 16px; margin-bottom: 16px; }
/* [hidden] loses to the display above (Real | Log only shows for level series) */
html.at-done .mk3.mka :is(.seg, .tabs)[hidden] { display: none !important; }

/* index chips: Attio record chips (r10, hairline, 20px logo); the ticked one gets Attio's blue selection ring.
   With several ticked, the page's inline outline colour (= the line colour) still wins. */
html.at-done .mk3.mka .mkx-chips { gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--a-line); }
html.at-done .mk3.mka .mkx-chip { gap: 8px; padding: 4px 10px 4px 6px; border-radius: 10px; border: 1px solid var(--a-line); box-shadow: none; background: var(--a-bg); }
html.at-done .mk3.mka .mkx-chip:hover { background: var(--a-hover); }
html.at-done .mk3.mka .mkx-chip.on { background: rgba(38,109,240,.05); border-color: var(--a-blue); box-shadow: none; }
html.at-done .mk3.mka .mkx-chip .nm { font: 500 13px/18px Inter, system-ui, sans-serif; }
html.at-done .mk3.mka .mkx-chip :is(.d, .lv) { font: 500 12px/16px Inter, system-ui, sans-serif; }
html.at-done .mk3.mka .mkx-chip .mkx-ib, html.at-done .mk3.mka .mkx-chip img { width: 24px; height: 24px; border-radius: 6px; }

/* S&P 500 since 1871 metric list: Attio menu selection (faint fill, r8), no blue side bar */
html.at-done .mk3.mka .lr-list { padding: 4px; }
html.at-done .mk3.mka .lr-list button { height: 30px; padding: 0 8px; border-left: 0; border-radius: 8px; font: 500 13px/20px Inter, system-ui, sans-serif; color: var(--a-label); }
html.at-done .mk3.mka .lr-list button.on { background: var(--a-hover); color: var(--a-ink); }
html.at-done .mk3.mka .lr-list button b { font-weight: 500; }
html.at-done .mk3.mka .lr-list .gh { font: 500 12px/16px Inter, system-ui, sans-serif; letter-spacing: 0; text-transform: none; color: var(--a-label); padding: 10px 8px 4px; }

/* "Open in Chart" in the index side card: secondary, not blue (one-blue rule; Markets has no primary) */
html.at-done .mk3.mka .mkx-side .mkx-btn { height: 28px; border-radius: 8px; background: var(--a-bg); color: var(--a-ink); box-shadow: var(--a-btn, inset 0 0 0 1px var(--a-ring));
  font: 500 14px/28px Inter, system-ui, sans-serif; }
html.at-done .mk3.mka .mkx-side .mkx-btn:hover { background: var(--a-hover); }

/* fallback if a column menu got in first: card tables have fixed columns */
html.at-done .mka :is(.aiq-addcol-th, .aiq-addcol-td, .atc-btn) { display: none !important; }
/* the per-card period toggles the Period chip drives (hidden from the first paint, not only once wired) */
html.at-done .mka :is(#mkx-ir, #rng, #g-rng, #cty-rng, #tm-rng, #sb-rng, #fx-rng) { display: none !important; }
