/* Ezra v10 layout + components. Tokens live in ezra-tokens.css.
 * Everything is scoped under .ezra-root so the admin layout's CSS can't leak in
 * (and ours can't leak out). Fixed chart heights + skeletons = no layout shift. */

.ezra-root, .ezra-root * { box-sizing: border-box; }
.ezra-root {
  text-align: left;
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.ezra-root [hidden] { display: none !important; }
/* :where() keeps this base rule at the lowest specificity, so every component's own button styles win */
:where(.ezra-root) button { font: inherit; color: inherit; cursor: pointer; }
/* Host isolation: the admin theme (dashboard/css/style.css) forces heading and link colours with !important under
   body[data-theme-version], and dashboard/css/common.css forces table font sizes with !important. Inside Ezra these
   follow Ezra's own rules: components set --ez-h (headings), --ez-a / --ez-a-hover (links), --ez-tfs (table text),
   never `color` / `font-size` directly on those elements. */
.ezra-root.ezra-root :is(h1, h2, h3, h4, h5, h6) { color: var(--ez-h, currentColor) !important; text-align: var(--ez-ta, inherit) !important; }
.ezra-root.ezra-root a { color: var(--ez-a, var(--p-text)) !important; }
.ezra-root.ezra-root a:hover { color: var(--ez-a-hover, var(--ez-a, var(--p-text))) !important; }
.ezra-root.ezra-root :is(table, thead, tbody, tr, th, td) { font-size: var(--ez-tfs, 1em) !important; }

/* one disabled style for every button (shadcn: opacity .5, not-allowed) */
.ezra-root button:disabled, .ezra-root button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
/* one focus ring: solid --ring (>= 5.8:1 on every surface), 2px + 2px offset, follows the element's own radius */
.ezra-root :focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
/* Scrollbars: slim and themed on every scroll container (Firefox / Chrome 121+ use the standard properties,
   Safari and older Chromium the WebKit pseudo-elements). :where() keeps specificity at zero, so strips that
   hide their bar (scrollbar-width: none / ::-webkit-scrollbar { display: none }) stay hidden. */
:where(.ezra-root, .ezra-root *) { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
:where(.ezra-root, .ezra-root *)::-webkit-scrollbar { width: 8px; height: 8px; }
:where(.ezra-root, .ezra-root *)::-webkit-scrollbar-track { background: transparent; }
:where(.ezra-root, .ezra-root *)::-webkit-scrollbar-corner { background: transparent; }
:where(.ezra-root, .ezra-root *)::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border: 2px solid transparent; background-clip: padding-box; border-radius: var(--r-full); }
:where(.ezra-root, .ezra-root *)::-webkit-scrollbar-thumb:hover,
:where(.ezra-root, .ezra-root *)::-webkit-scrollbar-thumb:active { background: var(--scroll-thumb-hover); background-clip: padding-box; }

/* Native controls follow the theme (color-scheme is set per theme in ezra-tokens.css). */
.ezra-root :where(input[type="checkbox"], input[type="radio"], input[type="range"], progress) { accent-color: var(--p); }
.ezra-root :where(input, textarea, [contenteditable="true"]) { caret-color: var(--p); }
.ezra-root ::selection { background: var(--p2); color: var(--bright); }
.ezra-root::selection { background: var(--p2); color: var(--bright); }
/* select: Ezra field look + a token-coloured chevron instead of the OS control */
.ezra-root select:not([multiple]):not([size]) {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-color: var(--card-2); border: 1px solid var(--border2); border-radius: var(--r-sm); color: var(--text);
  padding-right: 26px; background-image: var(--select-chevron); background-repeat: no-repeat;
  background-position: right 8px center; background-size: 12px 12px; cursor: pointer;
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.ezra-root select:not([multiple]):not([size]):hover:not(:disabled) { border-color: var(--p3); }
.ezra-root select:disabled { cursor: not-allowed; }
.ezra-root select option, .ezra-root select optgroup { background: var(--card-2); color: var(--text); }
/* number inputs: no native spinners (cards carry their own - / + buttons) */
.ezra-root input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.ezra-root input[type="number"]::-webkit-inner-spin-button,
.ezra-root input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* range: 4px rounded track, 16px accent thumb, 24px hit area, ring on keyboard focus (payoff what-if, time scrubber) */
.ezra-root input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 24px; min-height: 24px; margin: 0; padding: 0;
  border: 0; background: transparent; cursor: pointer; touch-action: pan-y;
}
.ezra-root input[type="range"]:focus-visible { outline: none; }
.ezra-root input[type="range"]:disabled { opacity: .5; cursor: not-allowed; }
.ezra-root input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: var(--r-full); background: var(--bg3); box-shadow: inset 0 0 0 1px var(--border2); }
.ezra-root input[type="range"]::-moz-range-track { height: 4px; border-radius: var(--r-full); background: var(--bg3); box-shadow: inset 0 0 0 1px var(--border2); }
.ezra-root input[type="range"]::-moz-range-progress { height: 4px; border-radius: var(--r-full); background: var(--p); }
.ezra-root input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 16px; height: 16px; margin-top: -6px; border: 0; border-radius: var(--r-full);
  background: var(--p); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: box-shadow var(--dur-fast), transform var(--dur-fast);
}
.ezra-root input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border: 0; border-radius: var(--r-full); background: var(--p); box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: box-shadow var(--dur-fast), transform var(--dur-fast);
}
.ezra-root input[type="range"]:hover:not(:disabled)::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--p2); }
.ezra-root input[type="range"]:hover:not(:disabled)::-moz-range-thumb { box-shadow: 0 0 0 4px var(--p2); }
.ezra-root input[type="range"]:active:not(:disabled)::-webkit-slider-thumb { transform: scale(1.1); }
.ezra-root input[type="range"]:active:not(:disabled)::-moz-range-thumb { transform: scale(1.1); }
.ezra-root input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ring); }
.ezra-root input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ring); }
@media (prefers-reduced-motion: reduce) {
  .ezra-root input[type="range"]::-webkit-slider-thumb { transition: none; }
  .ezra-root input[type="range"]::-moz-range-thumb { transition: none; }
}

/* subtle press on buttons and chips (motion: skipped under prefers-reduced-motion) */
@media (prefers-reduced-motion: no-preference) {
.ezra-root :is(.ez-send, .ez-vd-alt, .ez-topsearch, .ez-often-btn):not(:disabled):active { transform: scale(.97); }
}
/* page and view changes: a root cross-fade (only pages that load this file, so Ezra <-> Playgrounds). The
 * view-transition tree hangs off <html>, outside .ezra-root, so --dur only arrives through its fallback. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition { pointer-events: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--dur, 180ms); }
}
.ezra-root a { --ez-a: var(--p-text); text-decoration: none; }
.ezra-root a:hover { text-decoration: underline; }
.ez-num, .ezra-root .ez-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ez-up { color: var(--bull-text); }
.ez-down { color: var(--bear-text); }
.ez-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* first tab stop: on screen only while it has keyboard focus */
.ezra-root .ez-skip {
  --ez-a: var(--bright); --ez-a-hover: var(--bright);
  position: absolute; top: var(--sp-2); left: var(--sp-2); z-index: var(--z-popover); padding: var(--sp-2) var(--sp-3); transform: translateY(-300%);
  border: 1px solid var(--ring); border-radius: var(--r-sm); background: var(--card); font-size: var(--fs-13); font-weight: 600;
}
.ezra-root .ez-skip:focus { transform: none; }

/* ── App shell: history rail · chat · canvas ───────────────────────────── */
/* >= 1600px: three panes (canvas inline, resizable). 1100-1600px: canvas is a
 * slide-over drawer. < 1100px: the rail is a drawer too. < 720px: the canvas is
 * a bottom sheet. Height comes from JS (--ez-app-h, measured below the admin
 * header); focus mode covers the viewport instead. */
.ez-app {
  --rail-w: 272px;
  --canvas-w: 38%;
  position: relative;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: var(--ez-app-h, calc(100vh - 6.25rem));
  min-height: 480px;
  min-height: min(480px, 100dvh);   /* never taller than a phone in landscape */
  overflow: hidden;
  background: var(--bg);
}
.ez-app[data-rail="collapsed"] { --rail-w: 56px; }
.ez-side {
  grid-column: 1; grid-row: 1;
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
}
.ez-main { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
/* One column for the whole conversation, like data tools (TradingView, trading dashboards), not chat
 * apps: question, answer text, cards, charts, tables and the composer share --ez-col, so their edges
 * line up. It follows the space Ezra has (not the screen): 94% of it, small margins, capped at 1440px
 * so huge monitors stay usable. The % resolves against each user's own parent. */
.ez-main { --ez-col: clamp(52rem, 94%, 1440px); }

/* focus mode: Ezra covers the admin header / menu */
body.ezra-focus { overflow: hidden; }
/* Ezra is an app page (like ChatGPT/Claude): no site footer under it, so the page never scrolls */
body.ezra-v10 .footer { display: none; }
body.ezra-focus .header, body.ezra-focus .nav-header, body.ezra-focus .sidebar, body.ezra-focus .deznav,
body.ezra-focus .promo-bar, body.ezra-focus .footer { visibility: hidden; }
/* 1050: above the admin theme's header / sidebar (Bootstrap fixed range), below Ezra's own --z-popover+
 * layers, which live inside .ezra-root. No --z-* token sits in that band, so the literal stays. */
body.ezra-focus .ezra-root { position: fixed; inset: 0; z-index: 1050; overflow: hidden; }
body.ezra-focus .ez-app { height: 100vh; height: 100dvh; margin-top: 0 !important; }

/* ── history rail (<ezra-history>) ──────────────────────────────────────
 * ChatGPT / Claude / Linear pattern: brand row, New chat, search, quick links, a listbox of
 * chats in sticky date sections, an account row with a usage meter, and a 56px icon strip
 * when collapsed (>= 1100px). Rows: mode dot, one-line title, ticker chips, ⋯ menu. */
ezra-history { display: flex; flex-direction: column; flex: 1; min-height: 0; position: relative; }
.ez-side-head { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-2) var(--sp-2) var(--sp-4); min-height: 52px; }
.ez-side-head .ez-brand { flex: 1; min-width: 0; font-size: var(--fs-15); }
.ez-side-head .ez-brand-mark { width: 28px; height: 28px; }
.ez-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--bright); letter-spacing: -.01em; }
.ez-brand-mark {
  width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0;
  background: #000; overflow: hidden;   /* the EZPZ logo's own black field */
  box-shadow: 0 0 0 1px var(--border2);
  color: #fff;   /* the EZPZ logo's own white mark */
}
.ez-brand small { display: block; font-weight: 500; font-size: var(--fs-caption); color: var(--faint); letter-spacing: .02em; }

.ez-hist-top { display: flex; flex-direction: column; gap: var(--sp-2); padding: 0 var(--sp-3) var(--sp-2); }
.ez-new { display: flex; width: 100%; justify-content: flex-start; gap: var(--sp-2); padding: 0 var(--sp-2) 0 10px; }   /* .ez-btn */
.ez-new-ico { display: grid; color: var(--p-text); }
.ez-new-label { flex: 1; min-width: 0; text-align: left; }
.ez-hist-searchwrap { position: relative; }
.ez-hist-searchglyph { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); display: grid; pointer-events: none; }
.ez-hist-searchglyph svg { width: 14px; height: 14px; }
.ez-hist-search { display: block; width: 100%; padding: 0 var(--sp-8); -webkit-appearance: none; appearance: none; }   /* .ez-input */
.ez-hist-search::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.ez-hist-searchclear { position: absolute; right: 2px; top: 0; bottom: 0; margin: auto 0; }   /* .ez-iconbtn.is-sm, centred without transform (press scales it) */
.ez-hist-searchclear svg { width: 12px; height: 12px; }
.ez-hist-links { display: flex; flex-direction: column; gap: 2px; }
/* .ez-btn.is-link, held to the rail's row shape, muted and with no underline */
.ezra-root .ez-hist-link {
  display: flex; justify-content: flex-start; gap: 10px; height: 32px; padding: 0 var(--sp-2) 0 10px;
  border-radius: var(--r-sm); color: var(--muted); font-size: var(--fs-13); font-weight: 500; text-align: left; white-space: normal;
  --ez-a: var(--muted); --ez-a-hover: var(--text);
}
.ezra-root .ez-hist-link:hover:not(:disabled) { background: var(--bg3); color: var(--text); text-decoration: none; }
.ezra-root a.ez-btn.is-link.ez-hist-link:hover { background: var(--bg3); text-decoration: none; }   /* the site links are real <a>s */
.ez-hist-link > span:first-child { display: grid; color: var(--faint); transition: color var(--dur-fast) var(--ease); }
.ez-hist-link:hover > span:first-child { color: var(--p-text); }

/* list */
.ez-chats { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--sp-2) var(--sp-3); scrollbar-width: thin; border-top: 1px solid var(--border); }
.ez-hist-list { display: flex; flex-direction: column; transition: opacity var(--dur) var(--ease); }
.ez-chats[aria-busy="true"] .ez-hist-list { opacity: .6; }
.ez-hist-group { position: relative; }
.ez-hist-gh { position: sticky; top: 0; z-index: var(--z-local-1); padding: var(--sp-3) 10px 6px; background: var(--bg2); }   /* .ez-eyebrow */
.ez-hist-status:empty { display: none; }
.ez-hist-skel { padding: var(--sp-3) 10px; }
.ez-hist-skel .ez-skel-line:nth-child(odd) { width: 74%; }
.ez-hist-skel .ez-skel-line:nth-child(even) { width: 58%; }
.ez-hist-empty { padding: var(--sp-6) var(--sp-3); }   /* .ez-empty-state, narrower for the rail */
.ez-hist-empty.ez-error { margin: var(--sp-3) 10px; padding: 10px var(--sp-3); }
.ez-hist-more { display: flex; width: calc(100% - 20px); margin: var(--sp-2) 10px; }   /* .ez-btn.is-sm */

.ez-chat-item {
  position: relative; display: flex; align-items: center; height: 32px; padding: 0 var(--sp-2) 0 10px; flex-shrink: 0;
  border-radius: var(--r-sm); font-size: var(--fs-13); color: var(--muted); cursor: pointer; user-select: none; -webkit-user-select: none;
  scroll-margin-top: 36px; scroll-margin-bottom: var(--sp-2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ez-chat-item:hover { background: var(--bg3); color: var(--text); }
.ez-chat-item:focus-visible { outline-offset: -2px; }
.ez-chat-item[aria-selected="true"] { background: var(--p2); color: var(--bright); font-weight: 500; }
.ez-chat-item[aria-selected="true"]::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: var(--r-full); background: var(--p-text);
}
.ez-chat-body { display: flex; align-items: center; gap: var(--sp-2); flex: 1; min-width: 0; }
.ez-chat-lead { flex: 0 0 12px; display: grid; place-items: center; }
.ez-chat-spin { width: 12px; height: 12px; }   /* .ez-spinner */
.ez-chat-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-hl { background: var(--amber-wash); color: var(--bright); font-weight: 600; border-radius: var(--r-xs); box-shadow: 0 0 0 1px var(--amber-wash); }
.ez-chat-meta { display: inline-flex; align-items: center; gap: var(--sp-1); flex-shrink: 0; transition: opacity var(--dur-fast) var(--ease); }
.ez-chat-meta:empty { display: none; }
.ez-chat-tk {
  font: 600 var(--fs-11) / 16px var(--mono); padding: 0 var(--sp-1); border-radius: var(--r-xs);
  background: var(--border2); color: var(--muted); letter-spacing: .02em;
}
.ez-chat-shared { display: grid; color: var(--faint); }
/* .ez-iconbtn.is-sm; centred with margin, not transform (the shared press scales it) */
.ez-chat-more {
  position: absolute; right: 2px; top: 0; bottom: 0; margin: auto 0;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ez-chat-item:is(:hover, :focus-visible, .is-menu) .ez-chat-more { opacity: 1; pointer-events: auto; }
.ez-chat-item:is(:hover, :focus-visible, .is-menu) .ez-chat-meta { opacity: 0; }
.ez-chat-item:is(:hover, :focus-visible, .is-menu) .ez-chat-title {
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, black calc(100% - 28px), transparent);
}
.ez-chat-item.is-menu { background: var(--bg3); color: var(--text); }
.ez-chat-item.is-menu[aria-selected="true"] { background: var(--p2); }
.ez-chat-item.is-menu .ez-chat-more { background: var(--bg4); color: var(--bright); }
/* touch: no hover, so the ⋯ button stays visible and the chips stay beside it */
@media (pointer: coarse) {
  .ez-chat-item { padding-right: 36px; }
  .ez-chat-more { opacity: 1; pointer-events: auto; }
  .ez-chat-item:is(:hover, :focus-visible, .is-menu) .ez-chat-meta { opacity: 1; }
  .ez-chat-item:is(:hover, :focus-visible, .is-menu) .ez-chat-title { -webkit-mask-image: none; mask-image: none; }
}
/* inline rename: the field (.ez-input) carries the focus look */
.ez-chat-item.is-renaming { padding-left: var(--sp-1); background: transparent; color: var(--bright); cursor: text; }
.ez-chat-item.is-renaming :is(.ez-chat-meta, .ez-chat-more) { display: none; }
.ez-chat-rename { flex: 1; height: var(--ctl-h-sm); padding: 0 var(--sp-2); color: var(--bright); font-weight: 500; }
@media (prefers-reduced-motion: no-preference) {
  .ez-chat-item.is-leaving { opacity: 0; transform: translateX(calc(-1 * var(--sp-2))); pointer-events: none; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .ez-chat-item.is-new { animation: ez-hist-in var(--dur-slow) var(--ease-out); }
  .ez-hist-menu { animation: ez-hist-pop var(--dur-fast) var(--ease-out); transform-origin: top right; }
}
@keyframes ez-hist-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes ez-hist-pop { from { opacity: 0; transform: scale(.96); } }

/* ⋯ menu: .ez-menu[role=menu] > .ez-mi (appended to .ezra-root, placed by lib/popover.js floatTo) */
.ez-hist-menu { display: flex; flex-direction: column; gap: 2px; }
.ez-hist-menu .ez-mi:focus-visible { outline-offset: -2px; }
.ez-hist-mi-ico { display: grid; color: var(--muted); }
.ez-mi.is-danger .ez-hist-mi-ico { color: inherit; }
.ez-hist-mi-label { flex: 1; }

/* Undo toast after a delete: .ez-toast + .ez-toast-action + .ez-toast-count, docked bottom left by the rail */
.ez-toast.ez-undo { left: var(--sp-4); bottom: var(--sp-4); transform: translateY(var(--sp-2)); box-shadow: var(--shadow-pop); }
.ez-toast.ez-undo.is-on { transform: none; pointer-events: auto; }   /* hovering anywhere on it pauses the countdown */
.ez-undo .ez-toast-action:focus-visible { outline-color: var(--bg); outline-offset: 1px; }

/* account row */
.ez-hist-foot { display: flex; flex-direction: column; gap: var(--sp-2); padding: 10px var(--sp-3) var(--sp-3); border-top: 1px solid var(--border); }
.ez-acct { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.ez-acct-av {
  width: 28px; height: 28px; border-radius: var(--r-full); display: grid; place-items: center; flex-shrink: 0;
  background: var(--p2); color: var(--p-text); font-size: var(--fs-12); font-weight: 700;
}
.ez-acct-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-13); font-weight: 600; color: var(--bright); }
.ez-acct-plan {
  flex-shrink: 0; max-width: 50%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 2px var(--sp-2); border-radius: var(--r-full); border: 1px solid var(--p3); background: var(--p1);
  color: var(--p-text); font-size: var(--fs-11); font-weight: 600;
}
.ez-acct-meter { height: 4px; border-radius: var(--r-full); background: var(--bg4); overflow: hidden; }
.ez-acct-fill { display: block; height: 100%; border-radius: inherit; background: var(--p); }
.ez-acct-meter[data-level="high"] .ez-acct-fill { background: var(--amber); }
.ez-acct-meter[data-level="max"] .ez-acct-fill { background: var(--bear); }
.ez-acct-label { display: flex; justify-content: space-between; gap: var(--sp-2); margin-top: 6px; font-size: var(--fs-11); color: var(--faint); }
.ez-acct-label > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ez-acct-label > span + span { flex-shrink: 0; }
/* members: the meter is one link to Usage & credits (ezra-history paintFoot); the head line names the page */
.ez-acct-usage-link { display: block; color: inherit; text-decoration: none; border-radius: var(--r-xs); }
.ez-acct-label.is-head { margin: 0 0 6px; color: var(--muted); font-weight: 600; }
.ez-acct-usage-link:hover .ez-acct-label.is-head { color: var(--text); }
/* "Learn more" + "Buy credits" under the meter (lib/help.js) */
.ez-acct-links { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: 6px; font-size: var(--fs-11); }
.ez-acct-links .ez-learn { --ez-a: var(--faint); --ez-a-hover: var(--muted); color: var(--faint); min-height: 24px; }
.ez-acct-buy { --ez-a: var(--amber-text); --ez-a-hover: var(--amber-text); color: var(--amber-text); border-color: var(--amber-wash); }
/* top bar Help menu (lib/help.js helpMenu) */
.ez-help > .ez-menu { right: 0; top: calc(100% + var(--sp-1)); min-width: 220px; }

/* collapsed rail: icon strip; each button's title is shown by lib/tooltip.js (the one .ez-tip) */
.ez-hist-rail { display: none; flex-direction: column; align-items: center; gap: var(--sp-1); padding: var(--sp-1) 0; }
.ez-hist-railbtn.is-primary { border-color: var(--border2); background: var(--bg3); color: var(--bright); }
.ez-hist-railbtn.is-primary:hover { background: var(--bg4); border-color: var(--p3); }
.ez-hist-raildiv { width: 24px; height: 1px; margin: var(--sp-1) 0; background: var(--border); }
.ez-hist-railnav { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); }
.ezra-root a.ez-hist-railbtn { --ez-a: var(--muted); --ez-a-hover: var(--bright); }
@media (min-width: 1100px) {
  .ez-app[data-rail="collapsed"] :is(.ez-hist-label, .ez-hist-top, .ez-chats, .ez-hist-foot, .ez-hist-collapse) { display: none; }
  .ez-app[data-rail="collapsed"] .ez-hist-rail { display: flex; }
  .ez-app[data-rail="collapsed"] .ez-side-head { justify-content: center; padding: var(--sp-3) 0 var(--sp-2); }
  .ez-app[data-rail="collapsed"] .ez-side-head .ez-brand { flex: 0 0 auto; }
}
@media (max-width: 720px) {
  /* 16px inputs: iOS Safari zooms the page into anything smaller; taller rows for touch */
  .ez-hist-search { height: 36px; }   /* 16px text comes from .ez-input */
  .ez-chat-item { height: 40px; }
  .ez-toast.ez-undo { left: var(--sp-3); right: var(--sp-3); max-width: none; bottom: max(var(--sp-4), calc(var(--sp-2) + env(safe-area-inset-bottom))); justify-content: space-between; }
}

/* reduced motion: no slides or fades in the rail (canonical controls and the spinner handle themselves) */
@media (prefers-reduced-motion: reduce) {
  .ez-hist-link, .ez-hist-link > span:first-child, .ez-hist-list, .ez-chat-item, .ez-chat-more, .ez-chat-meta { transition: none; }
  .ez-toast.ez-undo, .ez-toast.ez-undo.is-on { transform: none; }
}

/* topbar */
.ez-topbar {
  display: flex; align-items: center; gap: var(--sp-2); height: 52px; padding: 0 var(--sp-3) 0 var(--sp-4); flex-shrink: 0;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.ez-topbar h1 { margin: 0; font-size: var(--fs-14); font-weight: 600; --ez-h: var(--bright); --ez-ta: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.ez-menu-btn { display: none; }
.ez-topsearch {
  display: inline-flex; align-items: center; gap: var(--sp-2); height: var(--ctl-h); padding: 0 var(--sp-2) 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--bg2); color: var(--faint); font-size: var(--fs-13);
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ez-topsearch:hover { border-color: var(--border2); color: var(--text); }
.ez-topsearch > span:first-child { display: grid; }
.ez-badge-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: var(--r-full); background: var(--p); box-shadow: 0 0 0 2px var(--bg); }


/* thread: prose keeps a readable measure, dashboards use the full centre width */
.ez-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scroll-padding-bottom: var(--sp-8); }
/* soft edge above the docked composer: it sits below the scroller, not over it, so the fade is the scroller's
 * own, takes no height, and .ez-thread's end padding keeps the last card clear of it */
.ez-scroll::after {
  content: ''; display: block; position: sticky; bottom: 0; z-index: var(--z-local-3); height: var(--sp-6); margin-top: calc(-1 * var(--sp-6));
  background: linear-gradient(to top, var(--bg), transparent); pointer-events: none;
}
.ez-scroll:has(> .ez-thread.is-empty)::after { content: none; }
@media (prefers-reduced-motion: no-preference) { .ez-scroll { scroll-behavior: smooth; } }
.ez-scroll:focus-visible { outline-offset: -2px; }   /* the thread is focusable (keyboard scrolling); keep its ring inside the pane */
.ez-thread { max-width: 1680px; margin: 0 auto; padding: 24px 28px 40px; }
.ez-thread.is-empty { padding-top: 12px; padding-bottom: 48px; }

/* empty-state fallback (when <ezra-home> is unavailable): layout here, look from .ez-empty-state */
.ez-empty { max-width: 720px; margin: 8vh auto 0; }
.ez-empty h2 { margin: var(--sp-2) 0 0; font-size: var(--fs-28); font-weight: 700; letter-spacing: -.02em; --ez-h: var(--bright); }

/* composer */
.ez-composer-wrap { flex-shrink: 0; padding: 8px 28px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.ez-composer {
  max-width: var(--ez-col, 820px); margin: 0 auto; border: 1px solid var(--border2); border-radius: var(--r-lg); background: var(--card);
  box-shadow: var(--shadow); transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.ez-composer:focus-within { border-color: var(--ring); box-shadow: var(--focus-halo), var(--shadow); }
.ez-composer textarea {
  display: block; width: 100%; resize: none; border: 0; outline: 0; background: transparent; color: var(--bright);
  font: 400 var(--fs-15)/var(--lh-normal) var(--sans); padding: var(--sp-3) var(--sp-4) var(--sp-1); max-height: 220px; min-height: 52px;
}
.ez-composer textarea::placeholder { color: var(--faint); }
/* the composer itself shows focus (border + halo on :focus-within); no second, square ring on the textarea */
.ezra-root .ez-composer textarea:is(:focus, :focus-visible) { outline: none !important; box-shadow: none !important; }
.ez-composer-bar { display: flex; align-items: center; gap: 6px; padding: var(--sp-1) var(--sp-2) var(--sp-2) var(--sp-3); flex-wrap: wrap; }
.ez-composer-bar .ez-spacer { flex: 1; }
.ez-composer-hint { font-size: var(--fs-11); color: var(--faint); }
.ez-count { font-size: var(--fs-11); color: var(--amber-text); }
/* answer style: .ez-btn.is-sm.is-ghost trigger in an .ez-menu-anchor; the .ez-menu opens upwards */
.ez-style-btn { padding: 0 var(--sp-2); }
.ez-style-btn > span { display: inline-grid; }
.ez-style-btn[aria-expanded="true"] { background: var(--bg4); color: var(--bright); }
.ez-style-chev svg { width: 12px; height: 12px; }
.ez-style > .ez-menu { left: 0; bottom: calc(100% + var(--sp-1)); min-width: 180px; }
.ez-style-check { width: 14px; display: inline-grid; color: var(--p-text); }
.ez-style-check svg { width: 14px; height: 14px; }
.ez-send {
  width: 34px; height: 34px; border-radius: var(--r-sm); border: 0; display: grid; place-items: center;
  background: var(--p); color: var(--on-p); transition: background-color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.ez-send:hover { background: var(--p-h); }
.ez-send.is-stop { background: var(--bg4); color: var(--bright); border: 1px solid var(--border2); }
.ez-attach-sel {
  display: inline-flex; align-items: center; gap: 6px; margin: 8px 10px 0; padding: 4px 4px 4px 8px;
  border-radius: var(--r-full); background: var(--p1); border: 1px solid var(--p3); font-size: var(--fs-12); color: var(--p-text); max-width: calc(100% - 20px);
}
.ez-attach-sel span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-attach-sel button { border: 0; background: transparent; width: 24px; height: 24px; margin: -2px 0; display: grid; place-items: center; border-radius: var(--r-full); color: inherit; }
.ez-attach-sel button:hover { background: var(--p2); }
/* files (components/ezra-attach.js, only when attachments are on): "+" menu at the left of the bar,
   a chips row above the textarea, and a drop overlay over the chat column */
.ez-attach > .ez-menu { left: 0; bottom: calc(100% + var(--sp-1)); min-width: 180px; }
.ez-attach-mi-ico { display: inline-grid; color: var(--muted); }
.ez-attach-up { min-width: 220px; }
.ez-attach-up-note { margin: 0; padding: 6px 10px var(--sp-1); color: var(--muted); font-size: var(--fs-13); }
.ez-attach-up a.ez-mi { --ez-a: var(--p-text); text-decoration: none; color: var(--p-text); font-weight: 600; }
.ez-files { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: 10px 10px 0; }
.ez-file {
  position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; max-width: min(260px, 100%);
  height: 56px; padding: 6px 30px 6px 6px; border-radius: var(--r); background: var(--bg3); border: 1px solid var(--border2); font-size: var(--fs-12);
}
.ez-file.has-thumb { width: 56px; padding: 0; overflow: hidden; }
.ez-file-thumb { display: block; width: 100%; height: 100%; }
.ez-file-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ez-file-ico { flex-shrink: 0; width: 42px; height: 42px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--p1); color: var(--p-text); }
.ez-file-ico svg { width: 20px; height: 20px; }
.ez-file-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ez-file-name { color: var(--bright); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-file-meta { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-file[data-state="error"] { border-color: var(--bear-text); background: var(--bear-wash); }
.ez-file[data-state="error"] .ez-file-ico { background: transparent; color: var(--bear-text); }
.ez-file[data-state="error"] .ez-file-meta { color: var(--bear-text); white-space: normal; }
.ez-file[data-state="error"] { height: auto; min-height: 56px; }
.ez-file-spin { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; background: var(--overlay); }
.ez-file:not(.has-thumb) .ez-file-spin { inset: 6px auto 6px 6px; width: 42px; border-radius: var(--r-sm); }
/* .ez-iconbtn on the chip's corner */
.ezra-root .ez-file-x {
  position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; min-width: 0; min-height: 0; border: 0; border-radius: var(--r-full);
  background: var(--bg4); color: var(--text); box-shadow: 0 0 0 1px var(--border2);
}
.ez-file-x svg { width: 12px; height: 12px; }
.ezra-root .ez-file-x:hover { background: var(--bright); color: var(--bg); }
.ez-send:disabled { opacity: .6; cursor: progress; }
.ez-send:disabled:hover { background: var(--p); }
.ez-send .ez-spinner { border-color: currentColor; border-top-color: transparent; }
.ez-dropzone {
  position: absolute; inset: 0; z-index: var(--z-drawer); display: grid; place-items: center; padding: var(--sp-4);
  background: var(--overlay); pointer-events: none;
}
.ez-dropzone-card {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: 28px 36px; max-width: 420px; text-align: center;
  border: 2px dashed var(--p); border-radius: var(--r-lg); background: var(--card); color: var(--bright); box-shadow: var(--shadow-pop);
}
.ez-dropzone-card p { margin: 0; font-size: var(--fs-15); font-weight: 600; }
.ez-dropzone-ico { display: grid; color: var(--p-text); }
.ez-disclaimer { max-width: 880px; margin: 6px auto 0; font-size: var(--fs-11); color: var(--faint); text-align: center; }

/* hero composer: on the empty state ezra-chat moves .ez-composer-wrap into <ezra-home>'s hero slot
   (same node), wider and centred; it docks back at the bottom when a message is sent or a chat opens */
.ez-composer-slash { display: none; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-1); font-size: var(--fs-11); color: var(--faint); white-space: nowrap; }
.ez-composer-wrap.is-hero { padding: 0; background: none; }
.ez-composer-wrap.is-hero .ez-composer { max-width: none; border-radius: var(--r-lg); box-shadow: var(--shadow); }
.ez-composer-wrap.is-hero .ez-composer textarea { min-height: 60px; padding: 16px 18px 6px; font-size: 16px; }
.ez-composer-wrap.is-hero .ez-composer-bar { padding: 6px 10px 10px 12px; }
.ez-composer-wrap.is-hero .ez-composer-hint { display: none; }
.ez-composer-wrap.is-hero .ez-composer-slash.is-hero-hint { display: inline-flex; }
/* the docked composer (bottom of a chat): the same hint right after Style; playgrounds have no hero, so none there */
ezra-chat:not([data-playground]) .ez-composer-wrap:not(.is-hero) .ez-composer-slash.is-dock-hint { display: inline-flex; }
/* ...where it takes the "Enter to send" hint's place, so one row fits; if the row still wraps on a narrow pane,
   Send keeps to the right end */
ezra-chat:not([data-playground]) .ez-composer-wrap:not(.is-hero) .ez-composer-hint { display: none; }
.ez-composer-bar .ez-send { margin-left: auto; }
.ez-composer-wrap.is-hero .ez-disclaimer { max-width: none; margin-top: 8px; }
/* the hero sits near the top: its menus open downwards */
.ez-composer-wrap.is-hero .ez-pbmenu { bottom: auto; top: calc(100% + 8px); z-index: var(--z-popover); }   /* opens down over the strip and cards */
.ez-composer-wrap.is-hero .ez-style > .ez-menu,
.ez-composer-wrap.is-hero .ez-attach > .ez-menu { bottom: auto; top: calc(100% + var(--sp-1)); }
@media (prefers-reduced-motion: reduce) { .ez-composer { transition: none; } }

/* canvas pane: a drawer by default, inline at >= 1600px */
.ez-resizer { display: none; }
.ez-cv-pane {
  position: absolute; z-index: var(--z-drawer); top: 0; right: 0; bottom: 0; width: min(560px, 92%);
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--bg2); border-left: 1px solid var(--border2); box-shadow: var(--shadow-pop);
  transform: translateX(102%); visibility: hidden;
  transition: transform var(--dur-slow) var(--ease), visibility 0s linear var(--dur-slow) var(--ease);
}
.ez-app[data-drawer="open"] .ez-cv-pane { transform: none; visibility: visible; transition: transform var(--dur-slow) var(--ease); }
.ez-scrim { position: absolute; inset: 0; z-index: var(--z-shell); background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease); }
.ez-app[data-drawer="open"] .ez-scrim, .ez-app[data-side="open"] .ez-scrim { opacity: 1; pointer-events: auto; }
@media (min-width: 1600px) {
  .ez-app { grid-template-columns: var(--rail-w) minmax(0, 1fr) 6px clamp(360px, var(--canvas-w), 60%); }
  .ez-resizer { display: block; grid-column: 3; grid-row: 1; position: relative; cursor: col-resize; touch-action: none; background: transparent; border-radius: 0; }
  .ez-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; transform: translateX(-50%); background: var(--border); transition: background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
  .ez-resizer:hover::after, .ez-resizer:focus-visible::after, .ez-app.is-resizing .ez-resizer::after { transform: translateX(-50%) scaleX(3); background: var(--p); }
  .ez-resizer:focus-visible { outline: 0; }
  .ez-cv-pane {
    position: static; grid-column: 4; grid-row: 1; width: auto; z-index: auto;
    border-left: 0; box-shadow: none; transform: none; visibility: visible; transition: none;
  }
  .ez-cv-close { display: none; }
  .ez-app[data-canvas="hidden"] { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .ez-app[data-canvas="hidden"] .ez-cv-pane, .ez-app[data-canvas="hidden"] .ez-resizer { display: none; }
  .ez-scrim { display: none; }
}
.ez-app.is-resizing { cursor: col-resize; user-select: none; }
.ez-app.is-resizing .ez-main, .ez-app.is-resizing .ez-cv-pane { pointer-events: none; }

/* <ezra-canvas> */
ezra-canvas { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ez-cv-head {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px 6px 16px; flex-shrink: 0;
  border-bottom: 1px solid var(--border); background: var(--bg2);
}
.ez-cv-id { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: var(--lh-tight); }
.ez-cv-sym { font: 700 var(--fs-15) var(--mono); color: var(--bright); letter-spacing: .01em; }
ezra-canvas:not([data-has-ticker]) .ez-cv-sym { font: 600 var(--fs-14) var(--sans); }
.ez-cv-name { font-size: var(--fs-12); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-cv-name:empty { display: none; }
.ez-cv-quote { display: flex; flex-direction: column; align-items: flex-end; line-height: var(--lh-tight); }
.ez-cv-price { font-size: var(--fs-17); font-weight: 600; color: var(--bright); }
.ez-cv-chg { font-size: var(--fs-12); font-weight: 600; color: var(--muted); }
.ez-cv-price:empty, .ez-cv-chg:empty { display: none; }
.ez-cv-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }
.ez-cv-chart:empty { display: none; }
.ez-cv-nochart { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border: 1px dashed var(--border2); border-radius: var(--r); font-size: var(--fs-13); color: var(--muted); }
.ezra-root .ez-cv-pinned-note { display: flex; justify-content: flex-start; gap: 8px; width: 100%; height: var(--ctl-h-lg); padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--card-2); color: var(--muted); font-size: var(--fs-13); font-weight: 400; text-align: left; }
.ezra-root .ez-cv-pinned-note:hover:not(:disabled) { background: var(--bg4); border-color: var(--border2); color: var(--text); text-decoration: none; }
.ez-cv-pinned-note b { margin-left: auto; font-size: var(--fs-12); font-weight: 600; color: var(--p-text); }
.ez-cv-pinned-icon { display: inline-grid; place-items: center; color: var(--p-text); }
.ez-cv-pinned-icon svg { width: 14px; height: 14px; }
.ez-cv-levels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ez-cv-level { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: var(--r-xs); border: 1px solid var(--border); background: var(--bg3); font-size: var(--fs-12); color: var(--muted); }
.ez-cv-level b { color: var(--bright); font-weight: 600; }
.ez-cv-level .ez-dot { color: var(--faint); }
.ez-cv-level[data-kind="entry"] .ez-dot { color: var(--p-text); }
.ez-cv-level[data-kind="stop"] .ez-dot, .ez-cv-level[data-kind="resistance"] .ez-dot { color: var(--bear); }
.ez-cv-level[data-kind="target"] .ez-dot, .ez-cv-level[data-kind="support"] .ez-dot { color: var(--bull); }
.ez-cv-level[data-kind="gamma"] .ez-dot { color: var(--amber); }
.ez-cv-level[data-kind="darkpool"] .ez-dot { color: var(--purple); }
.ez-cv-clear { margin-left: auto; height: 26px; }
.ez-cv-label { display: flex; align-items: center; gap: 6px; margin-top: 4px; }   /* .ez-eyebrow */
.ez-cv-label svg { width: 12px; height: 12px; }
.ez-cv-pins { display: flex; flex-direction: column; gap: 12px; }
.ez-cv-pin { border-radius: var(--r); background: transparent; }
.ez-cv-pin.is-dragging { opacity: .45; }
.ez-cv-pin-bar { display: flex; align-items: center; gap: 4px; padding: 0 0 6px; min-height: 28px; }
.ez-cv-pin-title { flex: 1; min-width: 0; font-size: var(--fs-12); font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-cv-grip { cursor: grab; }
.ez-cv-grip:active { cursor: grabbing; }
.ez-cv-empty { margin: auto 0; }   /* .ez-empty-state */
.ez-cv-empty > p { max-width: 34ch; }
.ez-cv-empty-icon { width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; background: var(--bg3); border: 1px solid var(--border); color: var(--p-text); }

/* ── Messages ───────────────────────────────────────────────────────────── */
/* one centred column; the docked composer uses the same width */
.ez-turn { max-width: var(--ez-col, 820px); margin: 0 auto 32px; }
.ez-user { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.ez-user-bubble {
  max-width: min(72ch, 85%); background: var(--bg4); border: 1px solid var(--border); color: var(--bright);
  padding: 8px 14px; border-radius: var(--r-lg) var(--r-lg) var(--r-xs) var(--r-lg); font-size: var(--fs-15); white-space: pre-wrap; word-wrap: break-word;
}
ezra-message { display: block; }
/* files on a question (lib/attach-view.js): above the text, right-aligned; share pages show plain chips */
.ez-user-q { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 0; max-width: min(72ch, 85%); }
.ez-user-q > .ez-user-bubble { max-width: 100%; }
.ez-user:has(.ez-user-q) { align-items: flex-end; }
.ez-ufiles { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }
.ez-ufile {
  display: inline-flex; align-items: center; gap: var(--sp-2); min-width: 0; max-width: 280px; padding: 6px 12px 6px 6px;
  border-radius: var(--r); background: var(--bg3); border: 1px solid var(--border2); color: var(--text); font-size: var(--fs-12); text-decoration: none;
}
a.ez-ufile:hover { border-color: var(--ring); text-decoration: none; }
.ez-ufile.is-image { width: 120px; height: 120px; padding: 0; overflow: hidden; }
.ez-ufile.is-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ez-ufile-ico { flex-shrink: 0; width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--p1); color: var(--p-text); }
.ez-ufile-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ez-ufile-name { color: var(--bright); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-ufile-meta { color: var(--muted); }
.ez-ai { display: flex; flex-direction: column; gap: 14px; }
/* briefing order (ezra-message.js): plan -> verdict -> evidence cards -> prose. Empty slots take no gap. */
.ez-verdict-slot:empty, .ez-ai > ezra-answer:empty { display: none; }
.ez-brief-body { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
/* "On this page": a quiet chip row above a long answer's prose (3+ headings) */
.ez-outline-head { margin: 0 0 6px; }
.ez-outline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ez-outline-item { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-weight: 500; color: var(--muted); cursor: pointer; transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.ez-outline-item:hover { color: var(--bright); border-color: var(--border2); }
.ez-outline-item[aria-current] { color: var(--p-text); border-color: var(--p); }
.ez-prose :is(h1, h2, h3):where(:not(.ez-inline-slot *)) { scroll-margin-top: var(--sp-4); }
.ez-prose :is(h1, h2, h3):focus:where(:not(.ez-inline-slot *)) { outline: none; }
.ez-prose :is(h1, h2, h3):focus-visible:where(:not(.ez-inline-slot *)) { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-xs); }
/* a live answer's verdict and cards fade in once as they land (no movement, so nothing jumps) */
@keyframes ez-settle { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .ez-ai[data-settle] > :is(.ez-verdict-slot, ezra-answer) { animation: ez-settle var(--dur-slow) var(--ease-out); }
}
@media (prefers-reduced-motion: reduce) { .ez-outline-item { transition: none; } }
.ez-ahead { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 24px; }
.ez-avatar {
  width: 26px; height: 26px; border-radius: var(--r-full); display: grid; place-items: center; flex-shrink: 0;
  background: #000; overflow: hidden; box-shadow: 0 0 0 1px var(--border2);   /* the EZPZ logo's own black field; round, like the TV Connector's avatar */
}
.ez-mark-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ez-avatar svg { width: 13px; height: 13px; }
.ez-ahead-name { font-size: var(--fs-13); font-weight: 700; color: var(--bright); margin-right: 4px; }

.ez-fresh { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-11); font-weight: 600; color: var(--muted); white-space: nowrap; }
.ez-fresh .ez-dot { background: var(--closed); }
.ez-fresh[data-state="live"] { color: var(--bull-text); }
.ez-fresh[data-state="live"] .ez-dot { background: var(--live); box-shadow: 0 0 0 0 var(--bull-wash); animation: ez-pulse 2s infinite; }
.ez-fresh[data-state="stale"] { color: var(--amber-text); }
.ez-fresh[data-state="stale"] .ez-dot { background: var(--stale); }
.ez-fresh:is([data-state="asof"], [data-state="closed"]) .ez-dot { background: var(--closed); }   /* a plain snapshot: gray, no alarm */

/* plan stepper */
ezra-plan { display: block; }
.ez-plan { border: 1px solid var(--border); border-radius: var(--r); background: var(--card); overflow: hidden; }   /* .ez-card shell, flat */
.ez-plan-head {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; text-align: left;
  padding: 10px 14px; font-size: var(--fs-13); font-weight: 600; color: var(--text);
}
.ez-plan-head .ez-chev { margin-left: auto; color: var(--faint); transition: transform var(--dur) var(--ease); }
.ez-plan[data-open="true"] .ez-chev { transform: rotate(180deg); }
.ez-plan-meta { font-weight: 500; color: var(--faint); font-size: var(--fs-12); }
.ez-plan-body { padding: 0 14px 12px; }
.ez-steps { list-style: none; margin: 0; padding: 0; position: relative; }
.ez-step { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 4px 0 4px 0; font-size: var(--fs-13); color: var(--muted); }
.ez-step::before { content: ''; position: absolute; left: 8px; top: 22px; bottom: -6px; width: 1px; background: var(--border2); }
.ez-step:last-child::before { display: none; }
.ez-step-icon { width: 17px; height: 17px; border-radius: var(--r-full); flex-shrink: 0; display: grid; place-items: center; margin-top: 2px; border: 1.5px solid var(--border2); background: var(--bg2); position: relative; z-index: var(--z-local-1); }
.ez-step-icon svg { width: 10px; height: 10px; }
.ez-step[data-state="active"] { color: var(--bright); }
.ez-step[data-state="active"] .ez-step-icon { border-color: var(--p); border-top-color: transparent; animation: ez-spin .8s linear infinite; }
.ez-step[data-state="done"] .ez-step-icon { border-color: var(--p); background: var(--p); color: var(--on-p); }
.ez-step[data-state="error"] .ez-step-icon { border-color: var(--bear); background: var(--bear); color: var(--on-p); }
.ez-step[data-state="done"] { color: var(--text); }

/* tool timeline (rail + rows: .ez-timeline / .ez-tool.is-compact in css/ezra-interact.css): each row's icon is a dot
 * on the rail, the same as the steps above (running = spinning ring, done = filled accent, failed = red) */
ezra-tool-card { display: block; }
.ez-plan[data-complete="true"] .ez-plan-head { gap: 6px; }
.ez-tools { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.ez-tool {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg3); border: 1px solid var(--border); font-size: var(--fs-13);
}
.ez-tool-icon {
  position: relative; z-index: var(--z-local-1); width: 16px; height: 16px; display: grid; place-items: center; border-radius: var(--r-full);
  border: 1.5px solid var(--border2); background: var(--bg2); color: var(--on-p);
}
.ez-tool-icon svg { width: 9px; height: 9px; }
.ez-tool[data-state="loading"] .ez-tool-icon { border-color: var(--p); border-top-color: transparent; animation: ez-spin .8s linear infinite; }
.ez-tool[data-state="done"] .ez-tool-icon { border-color: var(--p); background: var(--p); }
.ez-tool[data-state="error"] .ez-tool-icon { border-color: var(--bear); background: var(--bear); }
.ez-tool[data-state="error"] .ez-tool-label { color: var(--bear-text); }
.ez-tool[data-state="empty"] .ez-tool-icon { border-color: var(--border2); background: var(--bg4); color: var(--muted); }   /* found nothing yet: neutral */
.ez-tool[data-state="loading"] .ez-tool-label { color: var(--bright); }
.ez-tool-label { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-tool-sum { display: block; color: var(--faint); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--fs-12); }
.ez-tool-meta { color: var(--faint); font-size: var(--fs-12); white-space: nowrap; font-family: var(--mono); }
.ez-shimmer-text {
  background: linear-gradient(90deg, var(--muted) 0%, var(--bright) 50%, var(--muted) 100%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: ez-shimmer 1.6s linear infinite;
}
@keyframes ez-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* prose: the modern answer reading layout (ChatGPT / Claude): 16px text, ~1.7 leading, a ~720px
 * measure for text (cards, charts and tables keep the wide column), real section headings, accent
 * bullets, and equal-width digits so figures line up and don't jiggle while an answer streams. */
.ez-prose { font-size: var(--fs-prose); line-height: var(--lh-prose); color: var(--text); max-width: none; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; container-type: inline-size; }   /* tables use the column; cards and grids (<ezra-answer>, a sibling) too */
/* long lines in a wide column read easier a size up (follows the column, so also with the workspace open) */
@container (min-width: 1100px) {
  .ez-prose > * { --fs-prose: var(--fs-17); }
  .ez-prose > :is(p, ul, ol, blockquote) { font-size: var(--fs-prose); }
}
.ez-prose > :first-child { margin-top: 0; }
.ez-prose > :last-child { margin-bottom: 0; }
.ez-prose p:where(:not(.ez-inline-slot *)) { margin: 0 0 1em; }
.ez-prose strong:where(:not(.ez-inline-slot *)) { color: var(--bright); font-weight: 600; }
.ez-prose :is(h1, h2, h3, h4, h5, h6):where(:not(.ez-inline-slot *)) { --ez-h: var(--bright); font-weight: 650; letter-spacing: -.01em; line-height: var(--lh-snug); margin: 1.5em 0 .5em; }
.ez-prose h1:where(:not(.ez-inline-slot *)) { font-size: var(--fs-20); } .ez-prose h2:where(:not(.ez-inline-slot *)) { font-size: var(--fs-17); } .ez-prose h3:where(:not(.ez-inline-slot *)), .ez-prose h4:where(:not(.ez-inline-slot *)) { font-size: var(--fs-prose); }
.ez-prose h5:where(:not(.ez-inline-slot *)), .ez-prose h6:where(:not(.ez-inline-slot *)) { font-size: var(--fs-13); letter-spacing: .04em; text-transform: uppercase; --ez-h: var(--muted); }
.ez-prose a:where(:not(.ez-inline-slot *)) { text-decoration: underline; text-decoration-color: var(--p3); text-underline-offset: 2px; }
.ez-prose a:hover:where(:not(.ez-inline-slot *)) { text-decoration-color: currentColor; }
.ez-prose ul:where(:not(.ez-inline-slot *)), .ez-prose ol:where(:not(.ez-inline-slot *)) { margin: 0 0 1em; padding-left: 1.25em; }
.ez-prose li:where(:not(.ez-inline-slot *)) { margin: .4em 0; padding-left: .2em; }
.ez-prose li > p:where(:not(.ez-inline-slot *)) { margin: 0; }                                  /* loose lists read like tight ones */
.ez-prose li > :is(ul, ol):where(:not(.ez-inline-slot *)) { margin: .3em 0 0; }
.ez-prose ul > li:where(:not(.ez-inline-slot *))::marker { color: var(--p-text); }             /* accent bullets */
.ez-prose ol > li:where(:not(.ez-inline-slot *))::marker { color: var(--muted); font-weight: 600; }
.ez-prose code:where(:not(.ez-inline-slot *)) { font-family: var(--mono); font-size: .88em; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 1px 4px; }
.ez-prose pre:where(:not(.ez-inline-slot *)) { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; overflow-x: auto; }
.ez-prose pre code:where(:not(.ez-inline-slot *)) { background: none; border: 0; padding: 0; }
.ez-prose blockquote:where(:not(.ez-inline-slot *)) { margin: 0 0 .9em; padding: 2px 0 2px 12px; border-left: 2px solid var(--p3); color: var(--muted); }
.ez-prose hr:where(:not(.ez-inline-slot *)) { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.ez-md-table { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--border); border-radius: var(--r-sm); }
.ez-md-table table { border-collapse: collapse; width: 100%; --ez-tfs: var(--fs-13); font-variant-numeric: tabular-nums; }
.ez-md-table th, .ez-md-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.ez-md-table :is(th, td)[align="right"] { text-align: right; }
.ez-md-table :is(th, td)[align="center"] { text-align: center; }
.ez-md-table th { color: var(--muted); font-weight: 600; background: var(--bg2); }
/* streaming caret: thin, soft pulse */
.ez-caret {
  display: inline-block; width: 2px; height: 1.05em; margin-left: 4px; vertical-align: -.15em; border-radius: 1px;
  background: var(--p-text); animation: ez-caret-pulse 1.1s var(--ease) infinite;
}
@keyframes ez-caret-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .2; } }
/* Citation pill: small, on the text line (Claude / Perplexity style), set apart from the text so
 * "760.82[2]" never reads as 760.822. Nudged with position/top, so the line box never grows. */
.ez-cite {
  display: inline-grid; place-items: center; box-sizing: border-box; min-width: 18px; height: 17px; line-height: 1; padding: 0 5px; margin: 0 1px 0 5px;
  vertical-align: baseline; position: relative; top: -.12em; border-radius: var(--r-full); border: 1px solid var(--p3); background: var(--p1); color: var(--p-text);
  font: 600 var(--fs-11)/1 var(--sans); font-variant-numeric: tabular-nums; transition: background-color var(--dur-fast) var(--ease);
}
.ez-cite + .ez-cite { margin-left: 2px; }
.ez-cite:hover, .ez-cite[aria-expanded="true"] { background: var(--p2); }
.ez-cite.is-missing { opacity: .55; }

/* ── Answer spec ────────────────────────────────────────────────────────── */
ezra-answer { display: block; }
.ez-answer { display: flex; flex-direction: column; gap: 12px; }
.ez-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; }
.ez-grid > * { grid-column: span var(--span, 12); min-width: 0; }
/* Grids follow the width they get (thread or canvas), not the viewport. */
.ez-answer, .ez-cv-pin-body { container-type: inline-size; }
@container (max-width: 760px) {
  .ez-grid > * { grid-column: span 12; }
  .ez-grid.is-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ez-grid.is-kpis > * { grid-column: auto; }
}
.ez-section { display: flex; flex-direction: column; gap: 12px; }
.ez-section-head h3 { margin: 6px 0 0; font-size: var(--fs-13); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; --ez-h: var(--muted); }
.ez-section-head p { margin: 2px 0 0; font-size: var(--fs-13); color: var(--faint); }
.ez-tabs { display: none; }   /* .ez-seg; the phone chart carousel shows it */

.ez-card-tools .ez-fresh { margin-right: 6px; }
/* Chart heights: each card sets --h = clamp(--ez-chart-min, --ez-chart-cap, <scale px>)
 * (chart-frame.js CHART_HEIGHT / heightCss). The cap keeps the plot inside the visible
 * area: viewport minus the topbar, composer and card chrome; in the <=720px bottom sheet,
 * the sheet (88% of the app) minus its header and the card chrome. */
.ezra-root { --ez-chart-min: 180px; --ez-chart-cap: calc(100vh - 230px); --ez-chart-cap: calc(100dvh - 230px); }
.ez-cv-pane { --ez-chart-cap: calc(100vh - 200px); --ez-chart-cap: calc(100dvh - 200px); }
@media (max-width: 720px) {
  .ezra-root { --ez-chart-cap: calc(100dvh - 210px); }
  .ez-cv-pane { --ez-chart-cap: calc(88dvh - 290px); }
}
@media (max-height: 520px) {          /* phone in landscape: one chart fills the short screen */
  .ezra-root, .ez-cv-pane { --ez-chart-min: 150px; --ez-chart-cap: calc(100dvh - 120px); }
}
.ez-plot { position: relative; width: 100%; height: var(--h, 300px); }
.ez-plot:focus-visible { outline-offset: 4px; }
.ez-tableview { height: var(--h, 300px); overflow: auto; }


@media (prefers-reduced-motion: reduce) {
  .ez-cv-pane, .ez-side, .ez-scrim { transition: none !important; }
  .ez-shimmer-text, .ez-caret, .ez-fresh .ez-dot { animation: none !important; }
  /* spinners hold still as a three-quarter ring */
  .ez-step[data-state="active"] .ez-step-icon, .ez-tool[data-state="loading"] .ez-tool-icon { animation: none !important; }
  .ez-plan-head .ez-chev { transition: none !important; }
}

/* fullscreen */
.ez-card:fullscreen { border-radius: 0; padding: 12px; background: var(--card); overflow: auto; }
.ez-card:fullscreen .ez-plot, .ez-card:fullscreen .ez-tableview, .ez-card:fullscreen .ez-skel { height: calc(100vh - 150px) !important; }

/* ── KPI ────────────────────────────────────────────────────────────────── */
ezra-kpi { display: block; container-type: inline-size; }   /* the value and sparkline follow the card's width */
.ez-kpi {
  position: relative; width: 100%; text-align: left; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto;
  gap: 2px 10px; padding: 12px 14px; height: 100%; min-height: 96px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow);
  transition: border-color var(--dur-fast) var(--ease);
}
.ez-kpi:hover { border-color: var(--border2); }
.ez-kpi-label { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: var(--fs-label); font-weight: 600; color: var(--muted); }
.ez-kpi-label .ez-info { color: var(--faint); opacity: .7; display: inline-grid; }
.ez-kpi-label .ez-info svg { width: 12px; height: 12px; }
/* a number never ellipsizes: it shrinks with the card (container units), from 28px down to 17px */
.ez-kpi-value { font-size: var(--fs-hero); font-size: clamp(var(--fs-17), 11cqi, var(--fs-hero)); font-weight: 700; letter-spacing: -.02em; color: var(--bright); line-height: var(--lh-tight); white-space: nowrap; min-width: 0; }
.ez-kpi-value.is-text { font-size: var(--fs-metric); white-space: normal; overflow-wrap: anywhere; }
.ez-kpi-change { display: inline-flex; align-items: center; gap: 4px; font: 600 var(--fs-13) var(--mono); font-variant-numeric: tabular-nums; }
.ez-kpi-change svg { width: 12px; height: 12px; }
.ez-kpi-change.is-flat { color: var(--faint); }
/* flash on change (ezra-kpi.js): a real change tints the tile up / down for 900ms (--dur-slow x 3.75) with a
 * ▲ / ▼ tick, so colour is never the only cue. Never on a first render; off under reduced motion. */
.ez-kpi-tick { font-size: var(--fs-11); line-height: 1; opacity: 0; }
.ez-kpi-tick:empty { display: none; }
.ez-kpi[data-flash="up"] .ez-kpi-tick { opacity: 1; color: var(--bull-text); }
.ez-kpi[data-flash="down"] .ez-kpi-tick { opacity: 1; color: var(--bear-text); }
@keyframes ez-flash-up { from { background: var(--bull-wash); box-shadow: inset 0 0 0 1px var(--bull); } }
@keyframes ez-flash-down { from { background: var(--bear-wash); box-shadow: inset 0 0 0 1px var(--bear); } }
@media (prefers-reduced-motion: no-preference) {
  .ez-kpi[data-flash="up"] { animation: ez-flash-up calc(var(--dur-slow) * 3.75) var(--ease-out); }
  .ez-kpi[data-flash="down"] { animation: ez-flash-down calc(var(--dur-slow) * 3.75) var(--ease-out); }
}


/* ── Tables (Table, FlowTape, view-as-table) ───────────────────────────── */
.ez-tbl { display: flex; flex-direction: column; min-height: 0; min-width: 0; gap: var(--sp-2); }
.ez-tbl-bar { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
.ez-tbl-search { flex: 0 1 240px; min-width: 0; height: var(--ctl-h-sm); }
.ez-tbl-count { margin-left: auto; font-size: var(--fs-12); color: var(--faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ez-tbl-menu { top: calc(100% + var(--sp-1)); right: 0; min-width: 230px; max-height: 320px; overflow: auto; }
.ez-tbl-menu-row { display: flex; align-items: center; gap: var(--sp-1); }
.ez-tbl-menu-row .ez-mi { flex: 1; min-width: 0; }
.ez-tbl-menu-row .ez-iconbtn[aria-pressed="true"] { color: var(--p-text); }
.ez-tbl-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ez-tbl-check { display: inline-grid; place-items: center; width: 16px; height: 16px; flex-shrink: 0; color: var(--p-text); }
.ez-tbl-menu-reset { margin-top: var(--sp-1); border-top: 1px solid var(--border); border-radius: 0; color: var(--muted); }
.ez-table-wrap { flex: 1 1 auto; min-height: 0; overflow: auto; max-height: var(--maxh, 440px); border-radius: var(--r-sm); -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.ez-table { width: 100%; border-collapse: separate; border-spacing: 0; --ez-tfs: var(--fs-13); }
.ez-table.is-fixed { table-layout: fixed; }
.ez-table.is-fixed td { overflow: hidden; text-overflow: ellipsis; }
.ez-table th {
  position: sticky; top: 0; z-index: var(--z-local-1); background: var(--card); text-align: left; white-space: nowrap;
  --ez-tfs: var(--fs-12); font-weight: 600; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border2);
}
.ez-table th[title] button { text-decoration: underline dotted var(--border2); text-underline-offset: 3px; }
.ez-table th button { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.ez-table th button:hover { color: var(--text); }
.ez-table th[aria-sort] button { color: var(--text); }
.ez-table th .ez-sort { font-size: .75em; opacity: .8; }
.ez-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--text); }
.ez-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.ez-table tbody tr:hover { background: var(--bg3); }
.ez-table tbody tr.ez-gap, .ez-table tbody tr.ez-gap:hover { background: none; }
.ez-table tbody tr.ez-gap td { padding: 0; border: 0; }
.ez-table tbody tr.ez-table-none td { padding: 24px 12px; text-align: center; color: var(--muted); }
/* pinned columns stay put while the rest scrolls sideways */
.ez-table :is(th, td)[data-pin] { position: sticky; background: var(--card); }
.ez-table th[data-pin] { z-index: calc(var(--z-local-1) + 1); }
.ez-table td[data-pin] { z-index: var(--z-local-1); }
.ez-table tbody tr:hover td[data-pin] { background: var(--bg3); }
.ez-table :is(th, td)[data-pin="0"] { left: var(--pin-0, 0); }
.ez-table :is(th, td)[data-pin="1"] { left: var(--pin-1, 0); }
.ez-table :is(th, td)[data-pin="2"] { left: var(--pin-2, 0); }
.ez-table-wrap.is-x :is(th, td)[data-pin] { box-shadow: 1px 0 0 var(--border2); }
/* a tint around the value; the negative margin keeps numbers on the column's edge */
.ez-heat { display: inline-block; margin: -2px -6px; padding: 2px 6px; border-radius: var(--r-xs); }
/* column edge: drag to resize (mouse only; on touch the header stays a clean sort target) */
.ez-col-rz { position: absolute; top: 0; right: 0; bottom: 0; width: 8px; cursor: col-resize; touch-action: none; }
.ez-col-rz::after { content: ""; position: absolute; top: 25%; bottom: 25%; right: 0; width: 2px; border-radius: 1px; background: transparent; transition: background var(--dur-fast) var(--ease); }
.ez-table th:hover .ez-col-rz::after { background: var(--border2); }
.ez-col-rz:hover::after, .ez-col-rz:active::after { background: var(--ring); }
@media (pointer: coarse) { .ez-col-rz { display: none; } }
.ez-table tbody tr.is-click { cursor: pointer; }
.ez-table tbody tr:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.ez-table .is-num { text-align: right; font-variant-numeric: tabular-nums; }
.ez-table .is-center { text-align: center; }
.ez-table th.is-num { text-align: right; }
.ez-table th.is-num button { flex-direction: row-reverse; }
.ez-table td.is-wrap { white-space: normal; min-width: 220px; max-width: 360px; color: var(--muted); }

/* flow tape */
.ez-side-call { color: var(--bull-text); font-weight: 600; }
.ez-side-put { color: var(--bear-text); font-weight: 600; }
.ez-prem { font-weight: 600; color: var(--bright); }
.ez-prem-bar { display: inline-block; height: 3px; border-radius: 2px; background: var(--p3); vertical-align: middle; margin-left: 6px; }

/* ── Regime gauge ───────────────────────────────────────────────────────── */
.ez-regime { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.ez-regime-overall { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-15); font-weight: 600; color: var(--bright); }
.ez-regime-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 48px; gap: 10px; align-items: center; }
/* regime rows are buttons (keyboard access): drop the browser's button chrome, keep the row look */
button.ez-regime-row { width: 100%; margin: 0; padding: var(--sp-1) 0; border: 0; border-radius: var(--r-sm); background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background-color var(--dur-fast) var(--ease); }
button.ez-regime-row:hover { background: var(--bg3); }
.ez-regime-name { font-size: var(--fs-13); font-weight: 600; color: var(--text); }
.ez-regime-label { grid-column: 2 / -1; font-size: var(--fs-12); color: var(--faint); margin-top: -6px; }
.ez-segs { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; position: relative; }
.ez-segs::after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }
.ez-seg-cell { height: 10px; border-radius: 3px; background: var(--bg4); }
.ez-seg-cell.bull { background: var(--bull); }
.ez-seg-cell.bear { background: var(--bear); }
.ez-regime-score { font: 600 var(--fs-12) var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.ez-regime-scale { display: grid; grid-template-columns: 96px minmax(0, 1fr) 48px; gap: 10px; font-size: var(--fs-11); color: var(--faint); }
.ez-regime-scale span:nth-child(2) { display: flex; justify-content: space-between; }

/* ── Strategy card ──────────────────────────────────────────────────────── */
.ez-strat-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 12px; }
.ez-strat-stat { background: var(--card); padding: 8px 12px; }
.ez-strat-stat dt { font-size: var(--fs-11); color: var(--faint); font-weight: 600; }
.ez-strat-stat dd { margin: 2px 0 0; font: 600 var(--fs-15) var(--sans); color: var(--bright); }
.ez-pop-bar { height: 4px; border-radius: 2px; background: var(--bg4); margin-top: 6px; overflow: hidden; }
.ez-pop-bar span { display: block; height: 100%; background: var(--p); border-radius: 2px; }
.ez-leg-buy { color: var(--bull-text); font-weight: 600; text-transform: uppercase; font-size: var(--fs-11); }
.ez-leg-sell { color: var(--bear-text); font-weight: 600; text-transform: uppercase; font-size: var(--fs-11); }
.ez-risk-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--amber-wash); color: var(--amber-text); font-size: var(--fs-12); line-height: var(--lh-snug); }
.ez-risk-note svg { flex-shrink: 0; margin-top: 1px; width: 14px; height: 14px; }
.ez-strat-notes { font-size: var(--fs-13); color: var(--muted); margin: 10px 0 0; }
.ez-payoff-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-12); color: var(--muted); }
.ez-payoff-stats b { font-family: var(--mono); font-weight: 600; }

/* ── News timeline (<ezra-news-list>) ─────────────────────────────────────
 * time | rail + tone dot | headline, chips, source · age | "Ask Ezra" (on hover / focus; always on touch).
 * Dot: filled within the last hour, hollow before; colour = tone (green / red / gray), spelled out for
 * screen readers in the row and in the legend. */
.ez-news { display: flex; flex-direction: column; container-type: inline-size; }   /* the rows follow the card's width */
.ez-ng { margin: var(--sp-2) 0 2px; font-size: var(--fs-11); font-weight: 600; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--faint); --ez-h: var(--faint); }
.ez-ng:first-child { margin-top: 0; }
.ez-news-list { list-style: none; margin: 0; padding: 0; }
:is(.ez-nr, .ez-nr-dot)[data-tone="pos"] { --nr-tone: var(--bull); }
:is(.ez-nr, .ez-nr-dot)[data-tone="neg"] { --nr-tone: var(--bear); }
:is(.ez-nr, .ez-nr-dot)[data-tone="neu"] { --nr-tone: var(--closed); }
.ez-nr {
  position: relative; display: grid; grid-template-columns: 88px 14px minmax(0, 1fr) auto; column-gap: 10px; align-items: start;
  margin: 0 calc(-1 * var(--sp-2)); padding: 6px var(--sp-2); border-radius: var(--r-sm); transition: background-color var(--dur-fast) var(--ease);
}
.ez-nr:hover, .ez-nr:focus-within { background: var(--bg3); }
.ez-nr-t { font: 500 var(--fs-12)/20px var(--mono); color: var(--muted); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-nr-rail { position: relative; align-self: stretch; }
.ez-nr-rail::after { content: ''; position: absolute; left: 6px; top: 17px; bottom: -12px; width: 2px; border-radius: 1px; background: var(--border2); }
.ez-nr.is-last .ez-nr-rail::after { display: none; }
.ez-nr-dot { display: inline-block; width: 10px; height: 10px; border-radius: var(--r-full); background: var(--nr-tone, var(--closed)); flex-shrink: 0; }
.ez-nr-rail .ez-nr-dot { position: absolute; left: 2px; top: 5px; z-index: var(--z-local-1); }
.ez-nr-dot.is-hollow { background: var(--card); box-shadow: inset 0 0 0 2px var(--nr-tone, var(--closed)); }
.ez-nr:is(:hover, :focus-within) .ez-nr-dot.is-hollow { background: var(--bg3); }
.ez-nr-body { min-width: 0; }
.ez-nr-h { display: block; font-size: var(--fs-14); font-weight: 500; line-height: var(--lh-snug); color: var(--bright); --ez-a: var(--bright); text-decoration: none; overflow-wrap: anywhere; }
a.ez-nr-h:hover { text-decoration: underline; text-underline-offset: 2px; }
.ez-nr-m { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px; font-size: var(--fs-12); color: var(--faint); }
/* ticker chips: .ez-chip.is-ticker.is-sm; live ones are .ez-tk buttons (lib/hovercard.js shows the quote on hover / focus) */
/* "Ask Ezra": .ez-btn.is-sm.is-tinted, one quiet action per row (the Terminal row pattern); it keeps its space so rows never reflow */
.ez-nr-ask { align-self: center; opacity: 0; transition: opacity var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.ez-nr:is(:hover, :focus-within) .ez-nr-ask { opacity: 1; }
@media (hover: none) { .ez-nr-ask { opacity: 1; } }
.ez-news-empty { margin: 0; padding: var(--sp-3) 0; font-size: var(--fs-13); color: var(--muted); }
.ez-news-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: var(--sp-2) 0 0; padding-top: var(--sp-2); border-top: 1px solid var(--border); font-size: var(--fs-12); color: var(--muted); }
.ez-news-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.ez-news-legend .ez-nr-dot { width: 8px; height: 8px; }
@container (max-width: 520px) {
  .ez-nr { grid-template-columns: 14px minmax(0, 1fr); row-gap: 2px; }
  .ez-nr-t { grid-column: 2; grid-row: 1; text-align: left; line-height: 18px; }
  .ez-nr-rail { grid-column: 1; grid-row: 1 / span 3; }
  .ez-nr-body { grid-column: 2; }
  .ez-nr-ask { grid-column: 2; justify-self: start; opacity: 1; margin-top: 4px; }
}
@media (prefers-reduced-motion: reduce) { .ez-nr, .ez-nr-ask { transition: none; } }

/* ── Callouts ───────────────────────────────────────────────────────────── */
ezra-callout { display: block; }
.ez-callout { position: relative; display: flex; gap: 12px; padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--border); background: var(--bg2); font-size: var(--fs-14); line-height: var(--lh-normal); }
.ez-callout-icon { flex-shrink: 0; width: 26px; height: 26px; border-radius: var(--r-sm); display: grid; place-items: center; }
.ez-callout-kicker { margin-bottom: 2px; }   /* .ez-eyebrow; the variants below only tint it */
.ez-callout-text p { margin: 0 0 .5em; } .ez-callout-text p:last-child { margin: 0; }
.ez-callout-text strong { color: var(--bright); }
.ez-callout[data-variant="read"] {
  border: 1px solid transparent;
  background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(135deg, rgba(139,127,240,.75), rgba(56,189,248,.35) 60%, rgba(139,127,240,.15)) border-box;
}
.ez-callout[data-variant="read"]::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(120% 140% at 0% 0%, var(--p1), transparent 60%); pointer-events: none; }
.ez-callout[data-variant="read"] .ez-callout-icon { background: var(--p2); color: var(--p-text); }
.ez-callout[data-variant="read"] .ez-callout-kicker { color: var(--p-text); }
.ez-callout[data-variant="read"] .ez-callout-text { font-style: normal; color: var(--text); }
.ez-callout[data-variant="risk"] { border-left: 3px solid var(--bear); }
.ez-callout[data-variant="risk"] .ez-callout-icon { background: var(--bear-wash); color: var(--bear-text); }
.ez-callout[data-variant="risk"] .ez-callout-kicker { color: var(--bear-text); }
.ez-callout[data-variant="warning"] { border-left: 3px solid var(--amber); background: var(--amber-wash); }
.ez-callout[data-variant="warning"] .ez-callout-icon { background: var(--amber-wash); color: var(--amber-text); }
.ez-callout[data-variant="warning"] .ez-callout-kicker { color: var(--amber-text); }
.ez-callout[data-variant="note"] { background: transparent; border-style: dashed; color: var(--muted); font-size: var(--fs-13); }
.ez-callout[data-variant="note"] .ez-callout-icon { background: var(--bg3); color: var(--faint); }

/* criteria chips */
.ez-criteria { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ez-crit { display: inline-flex; align-items: center; height: 28px; border-radius: var(--r-sm); border: 1px solid var(--border2); background: var(--bg2); font-size: var(--fs-13); overflow: hidden; }
.ez-crit span { padding: 0 8px; color: var(--faint); height: 100%; display: grid; place-items: center; background: var(--bg3); border-right: 1px solid var(--border); }
.ez-crit b { padding: 0 8px; font-weight: 600; color: var(--bright); }
.ez-criteria-uni { font-size: var(--fs-12); color: var(--faint); margin-left: 4px; }

/* sources + followups + actions */
.ez-sources { border-top: 1px solid var(--border); padding-top: 12px; }
.ez-sources-head { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); padding: 0; border: 0; background: transparent; }   /* .ez-eyebrow */
.ez-sources-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; list-style: none; margin: 0; padding: 0; }
.ez-source { display: flex; gap: 8px; align-items: flex-start; padding: 8px 8px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--bg2); font-size: var(--fs-12); min-width: 0; }
.ez-source-n { flex-shrink: 0; font: 600 var(--fs-11) var(--mono); color: var(--p-text); background: var(--p1); border: 1px solid var(--p3); border-radius: var(--r-xs); min-width: 18px; height: 17px; display: grid; place-items: center; }
.ez-source-body { min-width: 0; }
.ez-source-title { --ez-a: var(--text); font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ez-source-meta { color: var(--faint); font-size: var(--fs-11); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ez-source-page { --ez-a: var(--p-text); font-weight: 600; text-decoration: none; }
.ez-source-page:hover, .ez-source-page:focus-visible { text-decoration: underline; }
.ez-source.is-hl { border-color: var(--p3); background: var(--p1); }
.ez-follow { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
/* .ez-btn that wraps: a follow-up can be a long question */
.ez-follow .ez-btn { height: auto; min-height: var(--ctl-h); padding: 6px var(--sp-3); gap: var(--sp-2); justify-content: flex-start; white-space: normal; text-align: left; font-weight: 500; line-height: var(--lh-snug); }
.ez-follow .ez-btn svg { color: var(--p-text); flex-shrink: 0; }
.ez-actions { display: flex; align-items: center; gap: 2px; color: var(--faint); font-size: var(--fs-12); }
.ez-actions .ez-meta { margin-left: var(--sp-1); color: var(--faint); }   /* admin-only answer details (ⓘ) */
/* Export: .ez-menu-anchor > .ez-menu[role=menu] > .ez-mi, opening upwards; keep the hover toolbar up while it is open */
.ez-export > .ez-menu { left: 0; bottom: calc(100% + var(--sp-1)); min-width: 220px; }
@media (hover: hover) and (pointer: fine) { .ez-turn .ez-actions:has(.ez-menu[role="menu"]) { opacity: 1; } }
/* layout for interaction pieces built from canonical components (look: css/ezra-ui.css) */
.ez-hcard-actions > .ez-btn { flex: 1; }                       /* hovercard: Ask Ezra / Open on canvas */
.ez-hcard .ez-empty-state { padding: var(--sp-3) 0; }           /* hovercard: quote unavailable */
.ez-tkac-menu { min-width: 240px; max-width: min(360px, calc(100vw - 16px)); margin: 0; list-style: none; overflow-y: auto; }   /* ticker autocomplete .ez-menu */
.ez-tkac-menu .ez-mi { gap: 10px; }
.ez-tkac-menu .ez-mi.is-active .ez-tkac-sym { color: var(--p-text); }
.ez-st-titlerow .ez-st-name { flex: 1; height: var(--ctl-h-sm); padding: 0 var(--sp-2); font-weight: 600; color: var(--bright); }   /* save-card rename .ez-input */
@media (max-width: 720px) { .ez-st-titlerow .ez-st-name { height: 36px; } }
/* chart overlay pieces (PriceChart) */
.ez-ohlc { position: absolute; left: 10px; top: 6px; z-index: var(--z-local-3); display: flex; gap: 10px; flex-wrap: wrap; font: 500 var(--fs-11) var(--mono); color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums; }
.ez-ohlc b { color: var(--bright); font-weight: 600; }
.ez-bands { position: absolute; inset: 0; pointer-events: none; z-index: var(--z-local-2); overflow: hidden; }
.ez-band { position: absolute; left: 0; display: flex; align-items: flex-start; justify-content: flex-start; padding: 2px 6px; font: 600 var(--fs-11) var(--sans); }
.ez-attrib { display: inline-flex; align-items: center; gap: 4px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1099.98px) {
  .ez-app { grid-template-columns: minmax(0, 1fr); }
  .ez-main { grid-column: 1; }
  .ez-side { position: absolute; z-index: var(--z-drawer); top: 0; bottom: 0; left: 0; width: 280px; transform: translateX(-100%); visibility: hidden; transition: transform var(--dur-slow) var(--ease), visibility 0s linear var(--dur-slow) var(--ease); box-shadow: var(--shadow-pop); }
  .ez-app[data-side="open"] .ez-side { transform: none; visibility: visible; transition: transform var(--dur-slow) var(--ease); }
  .ez-hist-collapse { display: none; }
  .ez-menu-btn { display: inline-grid; }
}
@media (max-width: 720px) {
  .ez-app { height: var(--ez-app-h, calc(100dvh - 5rem)); }
  .ez-thread { padding: 16px 12px 32px; }
  .ez-composer-wrap { padding: 8px 10px max(10px, env(safe-area-inset-bottom)); }
  .ez-composer-bar .ez-seg button { padding: 0 8px; }
  .ez-topbar { padding: 0 10px; gap: 6px; }
  /* canvas becomes a bottom sheet */
  .ez-cv-pane {
    top: auto; left: 0; right: 0; width: auto; height: min(88%, 760px);
    border-left: 0; border-top: 1px solid var(--border2); border-radius: var(--r-lg) var(--r-lg) 0 0; overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(102%);
  }
  .ez-cv-pane::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--border2); margin: 8px auto 0; flex-shrink: 0; }
  .ez-cv-body { padding: 12px 10px; }
  .ez-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .ez-grid > * { grid-column: 1 / -1; }
  .ez-grid.is-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ez-grid.is-kpis > * { grid-column: auto; }
  .ez-kpi { min-height: 88px; padding: 10px 12px; }
  /* swipeable chart tabs */
  .ez-grid.is-charts { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -12px; padding: 0 12px; scrollbar-width: none; }
  .ez-grid.is-charts::-webkit-scrollbar { display: none; }
  .ez-grid.is-charts > * { flex: 0 0 calc(100% - 4px); scroll-snap-align: center; }
  .ez-tabs { display: flex; overflow-x: auto; scrollbar-width: none; }   /* look: .ez-seg */
  .ez-tabs::-webkit-scrollbar { display: none; }
  .ez-tabs button { flex: 1 0 auto; }
  .ez-strat-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ez-regime-row, .ez-regime-scale { grid-template-columns: 78px minmax(0, 1fr) 40px; }
  .ez-user-bubble { max-width: 92%; }
  .ez-user-q { max-width: 92%; }
  .ez-ufile.is-image { width: 88px; height: 88px; }
  .ez-files { gap: 6px; padding: 8px 8px 0; }
  .ez-file { max-width: 100%; }
  .ez-prose { font-size: var(--fs-15); }
  .ez-news .ez-news-row { grid-template-columns: 52px minmax(0, 1fr); gap: 10px; }
  .ez-hide-sm { display: none !important; }
  /* 16px inputs: iOS Safari zooms the page into anything smaller */
  .ez-composer textarea { font-size: 16px; }
}
@media (max-height: 520px) {
  .ez-app { min-height: 0; }
}
.ez-note { margin: 6px 0 0; font-size: var(--fs-13); color: var(--muted); }

/* Custom elements are inline by default: make every Ezra block a block box. */
ezra-grid, ezra-section, ezra-price-chart, ezra-strike-ladder, ezra-flow-tape, ezra-chart, ezra-heatmap,
ezra-regime-gauge, ezra-payoff, ezra-strategy-card, ezra-table, ezra-news-list, ezra-criteria-chips, ezra-chat, ezra-home {
  display: block; min-width: 0;
}
