/* Home dashboard (public/index.html #researchView .ih-home, driven by public/js/home-markets.js).
 * Follows the console palette (--console-fg/--console-bg) so it works in light and dark mode. The
 * color-mode stylesheet forces text/button colours inside #researchView with !important, so rules
 * here are scoped one level deeper and also use !important where they need to win. */
#researchView.research-view { align-items: stretch; padding: 64px 32px 48px !important; }
#researchView .research-form.ih-home {
  --ih-fg: var(--console-fg, #fff);
  --ih-bg: var(--console-bg, #000);
  --ih-muted: color-mix(in srgb, var(--ih-fg) 56%, transparent);
  --ih-faint: color-mix(in srgb, var(--ih-fg) 11%, transparent);
  --ih-hover: color-mix(in srgb, var(--ih-fg) 6%, transparent);
  --ih-up: #16a34a;
  --ih-down: #dc2626;
  --ih-font: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --ih-mono: 'SF Mono', ui-monospace, 'JetBrains Mono', Menlo, monospace;
  max-width: 1320px; width: 100%; margin: 0 auto; padding: 0 !important;
  background: transparent !important; border: 0 !important; border-radius: 0 !important; backdrop-filter: none !important;
  font-family: var(--ih-font); color: var(--ih-fg);
}
html[data-color-mode="dark"] #researchView .ih-home, html:not([data-color-mode="light"]) #researchView .ih-home { --ih-up: #22c55e; --ih-down: #f87171; }

/* Shared text colours (beat color-mode's #researchView span/p/h* override) */
html #researchView#researchView .ih-home :is(h1, h2, h3, p, span, small, b, label, a) { color: inherit; }
html[data-color-mode] #researchView#researchView .ih-home :is(.ih-muted, .ih-desc, .ih-sub, .ih-eyebrow, .ih-source, .ih-empty, small, .ih-name, .ih-th) { color: var(--ih-muted) !important; }
html[data-color-mode] #researchView#researchView .ih-home :is(.ih-up, .ih-up *) { color: var(--ih-up) !important; }
html[data-color-mode] #researchView#researchView .ih-home :is(.ih-down, .ih-down *) { color: var(--ih-down) !important; }

/* Hero */
.ih-hero { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "text state" "search search"; gap: 18px 24px; align-items: end; margin: 8px 0 22px; }
.ih-hero-text { grid-area: text; min-width: 0; }
.ih-eyebrow { margin: 0 0 6px; font-size: 13px; letter-spacing: .01em; }
.ih-title { margin: 0; font-size: clamp(30px, 4vw, 44px); line-height: 1.05; font-weight: 800; letter-spacing: -.03em; }
.ih-title .brand-logo { height: 44px; }
.ih-sub { margin: 8px 0 0; font-size: 15px; }
.ih-market-state { grid-area: state; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--ih-faint); border-radius: 999px; font: 600 11px/1 var(--ih-mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.ih-market-state[hidden] { display: none; }
.ih-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ih-muted); }
.ih-market-state.is-open .ih-dot { background: var(--ih-up); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ih-up) 20%, transparent); animation: ih-pulse 2s ease-in-out infinite; }
@keyframes ih-pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ih-up) 0%, transparent); } }

.ih-search { grid-area: search; position: relative; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border: 1px solid var(--ih-faint); border-radius: 14px; background: color-mix(in srgb, var(--ih-fg) 3%, var(--ih-bg)); transition: border-color .15s; }
.ih-search:focus-within { border-color: color-mix(in srgb, var(--ih-fg) 45%, transparent); }
.ih-search > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ih-muted); stroke-width: 2; stroke-linecap: round; }
html[data-color-mode] #researchView#researchView .ih-search input { flex: 1; min-width: 0; height: 100%; border: 0 !important; outline: none !important; background: transparent !important; color: var(--ih-fg) !important; font: 500 16px var(--ih-font) !important; padding: 0 !important; box-shadow: none !important; }
.ih-search input::-webkit-search-cancel-button { display: none; }
.ih-search kbd { font: 600 11px var(--ih-mono); color: var(--ih-muted); border: 1px solid var(--ih-faint); border-radius: 5px; padding: 2px 6px; }
.ih-search-results { position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; right: 0; padding: 6px; border: 1px solid var(--ih-faint); border-radius: 14px; background: var(--ih-bg); box-shadow: 0 24px 60px rgba(0, 0, 0, .35); max-height: 420px; overflow-y: auto; }
.ih-search-results[hidden] { display: none; }
.ih-result-group { padding: 8px 10px 4px; font: 600 10.5px var(--ih-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ih-muted); }
html[data-color-mode] #researchView#researchView .ih-home .ih-result { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px; border: 0 !important; border-radius: 9px; background: transparent !important; color: var(--ih-fg) !important; text-align: left; cursor: pointer; font: 500 14px var(--ih-font); }
html[data-color-mode] #researchView#researchView .ih-home .ih-result:is(:hover, .is-active) { background: var(--ih-hover) !important; color: var(--ih-fg) !important; }
.ih-result .ih-sym { min-width: 64px; font: 700 13px var(--ih-mono); }
.ih-result .ih-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ih-result .ih-tag { font: 600 10px var(--ih-mono); letter-spacing: .06em; color: var(--ih-muted); border: 1px solid var(--ih-faint); border-radius: 5px; padding: 2px 6px; }

/* Market tape */
.ih-tape { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.ih-tape-skeleton { grid-column: 1 / -1; padding: 22px; border: 1px dashed var(--ih-faint); border-radius: 14px; color: var(--ih-muted); font-size: 13px; text-align: center; }
html[data-color-mode] #researchView#researchView .ih-home .ih-tick { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 10px; border: 1px solid var(--ih-faint) !important; border-radius: 14px; background: transparent !important; color: var(--ih-fg) !important; text-align: left; cursor: pointer; overflow: hidden; font-family: var(--ih-font); transition: border-color .15s, transform .15s; }
html[data-color-mode] #researchView#researchView .ih-home .ih-tick:hover { background: var(--ih-hover) !important; color: var(--ih-fg) !important; border-color: color-mix(in srgb, var(--ih-fg) 30%, transparent) !important; transform: translateY(-1px); }
.ih-tick-name { font-size: 12px; font-weight: 600; color: var(--ih-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ih-tick-price { font: 700 17px var(--ih-mono); letter-spacing: -.02em; }
.ih-tick-change { font: 600 12px var(--ih-mono); }
.ih-spark { display: block; width: 100%; height: 28px; margin-top: 2px; }
.ih-spark path.line { fill: none; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.ih-spark path.area { stroke: none; opacity: .12; }
.ih-spark .base { stroke: var(--ih-faint); stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.ih-up-stroke { stroke: var(--ih-up); fill: var(--ih-up); }
.ih-down-stroke { stroke: var(--ih-down); fill: var(--ih-down); }

/* Cards and grids */
.ih-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.ih-grid--markets { grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); }
.ih-grid--work { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(260px, .85fr); }
.ih-card { min-width: 0; padding: 18px 18px 16px; border: 1px solid var(--ih-faint); border-radius: 18px; background: color-mix(in srgb, var(--ih-fg) 2%, var(--ih-bg)); }
.ih-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; min-height: 34px; }
.ih-card-head h2, .ih-section-title { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.ih-section-title { margin: 28px 0 12px; font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
html[data-color-mode] #researchView#researchView .ih-home .ih-section-title { color: var(--ih-muted) !important; }
.ih-subtitle { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.ih-desc { margin: 0 0 12px; font-size: 13px; line-height: 1.5; }
.ih-source { margin: 10px 0 0; font-size: 11px; }
.ih-divider { height: 1px; background: var(--ih-faint); margin: 16px 0; }
.ih-empty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 22px 8px; font-size: 13px; text-align: center; }
.ih-empty .loading-spinner { width: 16px; height: 16px; }
.ih-head-actions { display: flex; align-items: center; gap: 8px; }

/* Buttons and inputs */
html[data-color-mode] #researchView#researchView .ih-home .ih-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--ih-faint) !important; border-radius: 9px; background: transparent !important; color: var(--ih-fg) !important; font: 600 13px var(--ih-font); cursor: pointer; white-space: nowrap; }
html[data-color-mode] #researchView#researchView .ih-home .ih-btn:hover:not(:disabled) { background: var(--ih-hover) !important; color: var(--ih-fg) !important; border-color: color-mix(in srgb, var(--ih-fg) 30%, transparent) !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-btn--solid { background: var(--ih-fg) !important; color: var(--ih-bg) !important; border-color: var(--ih-fg) !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-btn--solid:hover:not(:disabled) { background: color-mix(in srgb, var(--ih-fg) 85%, var(--ih-bg)) !important; color: var(--ih-bg) !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-btn--block { width: 100%; height: 40px; margin-top: 10px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-btn--quiet { border-color: transparent !important; color: var(--ih-muted) !important; }
html[data-color-mode] #researchView#researchView .ih-home :is(.ih-input, .ih-select, .ih-add input) { height: 38px; padding: 0 12px !important; border: 1px solid var(--ih-faint) !important; border-radius: 9px !important; background: var(--ih-bg) !important; color: var(--ih-fg) !important; font: 500 13px var(--ih-font) !important; outline: none; box-shadow: none !important; min-width: 0; }
html[data-color-mode] #researchView#researchView .ih-home .ih-select { height: 34px; padding: 0 8px !important; }
html[data-color-mode] #researchView#researchView .ih-home :is(.ih-input, .ih-add input):focus { border-color: color-mix(in srgb, var(--ih-fg) 45%, transparent) !important; }
.ih-add { display: flex; gap: 6px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-add input { width: 120px; height: 32px; text-transform: uppercase; font-family: var(--ih-mono) !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-add button { width: 32px; height: 32px; padding: 0; border: 1px solid var(--ih-faint) !important; border-radius: 9px; background: transparent !important; color: var(--ih-fg) !important; font-size: 18px; cursor: pointer; }
.ih-add.is-error input { border-color: var(--ih-down) !important; }
.ih-connection { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.ih-vs { font: 600 11px var(--ih-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ih-muted); }

/* Segmented control */
.ih-seg { display: inline-flex; padding: 3px; border: 1px solid var(--ih-faint); border-radius: 10px; gap: 2px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-seg button { height: 26px; padding: 0 10px; border: 0 !important; border-radius: 7px; background: transparent !important; color: var(--ih-muted) !important; font: 600 12px var(--ih-font); cursor: pointer; }
html[data-color-mode] #researchView#researchView .ih-home .ih-seg button:hover { background: var(--ih-hover) !important; color: var(--ih-fg) !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-seg button.is-active { background: var(--ih-fg) !important; color: var(--ih-bg) !important; }

/* Tables (watchlist, movers) */
.ih-table { display: flex; flex-direction: column; }
html[data-color-mode] #researchView#researchView .ih-home .ih-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 96px minmax(0, 1fr) 92px; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 6px 8px; border: 0 !important; border-bottom: 1px solid var(--ih-faint) !important; border-radius: 0; background: transparent !important; color: var(--ih-fg) !important; text-align: left; cursor: pointer; font-family: var(--ih-font); }
html[data-color-mode] #researchView#researchView .ih-home .ih-row:last-child { border-bottom: 0 !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-row:hover { background: var(--ih-hover) !important; color: var(--ih-fg) !important; border-radius: 10px; }
.ih-movers .ih-row { grid-template-columns: minmax(0, 1fr) 84px 76px !important; }
.ih-row-id { display: flex; flex-direction: column; min-width: 0; }
.ih-row-id b { font: 700 13.5px var(--ih-mono); }
.ih-row-id small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ih-row .ih-num { font: 600 13.5px var(--ih-mono); text-align: right; }
.ih-pill { justify-self: end; min-width: 76px; padding: 5px 8px; border-radius: 7px; font: 700 12.5px var(--ih-mono); text-align: right; }
.ih-pill.ih-up { background: color-mix(in srgb, var(--ih-up) 13%, transparent); }
.ih-pill.ih-down { background: color-mix(in srgb, var(--ih-down) 13%, transparent); }
.ih-row .ih-spark { height: 30px; margin: 0; }
html[data-color-mode] #researchView#researchView .ih-home .ih-row-remove { width: 22px; height: 22px; padding: 0; margin-left: 6px; border: 0 !important; border-radius: 6px; background: transparent !important; color: var(--ih-muted) !important; font-size: 15px; line-height: 1; cursor: pointer; opacity: 0; }
html[data-color-mode] #researchView#researchView .ih-home .ih-row:hover .ih-row-remove { opacity: 1; }
html[data-color-mode] #researchView#researchView .ih-home .ih-row-remove:hover { background: var(--ih-hover) !important; color: var(--ih-down) !important; }
.ih-row-end { display: flex; align-items: center; justify-content: flex-end; }

/* Canvases grid (cards rendered by canvas-save-load.js with inline legacy styles) */
.ih-canvas-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important; gap: 10px !important; max-height: 420px; overflow-y: auto; padding: 2px; }
html[data-color-mode] #researchView#researchView .ih-canvas-grid > * { background: transparent !important; border: 1px solid var(--ih-faint) !important; border-radius: 12px !important; padding: 12px !important; box-shadow: none !important; }
html[data-color-mode] #researchView#researchView .ih-canvas-grid > *:hover { border-color: color-mix(in srgb, var(--ih-fg) 30%, transparent) !important; }
html[data-color-mode] #researchView#researchView .ih-canvas-grid button { border-radius: 7px !important; }

/* CRM preview + tools */
.ih-crm-preview { min-height: 44px; }
.ih-tool-list { display: flex; flex-direction: column; gap: 6px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-tool { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 1px solid transparent !important; border-radius: 12px; background: transparent !important; color: var(--ih-fg) !important; text-align: left; cursor: pointer; font-family: var(--ih-font); }
html[data-color-mode] #researchView#researchView .ih-home .ih-tool:hover { background: var(--ih-hover) !important; color: var(--ih-fg) !important; border-color: var(--ih-faint) !important; }
.ih-tool > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ih-tool b { font-size: 14px; font-weight: 650; }
.ih-tool small { font-size: 12px; }
.ih-tool-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border: 1px solid var(--ih-faint); border-radius: 10px; }
.ih-tool-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ih-account { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--ih-faint); }

/* Ticker drawer */
.ih-drawer { position: fixed; inset: 0; z-index: 100003; }
.ih-drawer[hidden] { display: none; }
.ih-drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .2s; }
.ih-drawer.is-open .ih-drawer-backdrop { opacity: 1; }
.ih-drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); overflow-y: auto; padding: 22px 24px 32px; background: var(--ih-bg); border-left: 1px solid var(--ih-faint); box-shadow: -30px 0 80px rgba(0, 0, 0, .35); transform: translateX(24px); opacity: 0; transition: transform .25s cubic-bezier(.2, .8, .2, 1), opacity .2s; font-family: var(--ih-font); color: var(--ih-fg); }
.ih-drawer.is-open .ih-drawer-panel { transform: none; opacity: 1; }
.ih-d-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ih-d-sym { font: 700 13px var(--ih-mono); letter-spacing: .04em; color: var(--ih-muted); }
.ih-d-name { margin: 4px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.ih-d-price { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 4px; }
.ih-d-price strong { font: 700 34px var(--ih-mono); letter-spacing: -.03em; }
.ih-d-price span { font: 700 15px var(--ih-mono); }
.ih-d-meta { font-size: 12px; }
.ih-d-chart { position: relative; height: 220px; margin: 14px 0 10px; }
.ih-d-chart svg { width: 100%; height: 100%; display: block; }
.ih-d-chart path.line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.ih-d-chart path.area { stroke: none; opacity: .1; }
.ih-d-chart .ih-hover-line { stroke: var(--ih-muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ih-d-tip { position: absolute; top: 0; padding: 4px 8px; border-radius: 7px; background: var(--ih-fg); color: var(--ih-bg); font: 600 11.5px var(--ih-mono); white-space: nowrap; pointer-events: none; transform: translateX(-50%); }
html[data-color-mode] #researchView#researchView .ih-home .ih-d-tip, html[data-color-mode] .ih-d-tip { color: var(--ih-bg) !important; }
.ih-d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.ih-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; margin: 0 0 18px; }
.ih-stat { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--ih-faint); font-size: 13px; }
.ih-stat dt { color: var(--ih-muted); }
.ih-stat dd { margin: 0; font: 600 13px var(--ih-mono); text-align: right; }
.ih-d-about { font-size: 13.5px; line-height: 1.6; color: color-mix(in srgb, var(--ih-fg) 82%, transparent); }
.ih-d-about h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ih-muted); }
.ih-d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.ih-d-tags span { padding: 4px 9px; border: 1px solid var(--ih-faint); border-radius: 999px; font-size: 12px; }
.ih-drawer :is(.ih-btn, .ih-close) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--ih-faint); border-radius: 9px; background: transparent; color: var(--ih-fg); font: 600 13px var(--ih-font); cursor: pointer; }
.ih-drawer :is(.ih-btn, .ih-close):hover { background: var(--ih-hover); }
.ih-drawer .ih-btn--solid { background: var(--ih-fg); color: var(--ih-bg); border-color: var(--ih-fg); }
.ih-drawer .ih-close { width: 34px; padding: 0; font-size: 18px; }
/* The drawer lives inside #researchView: keep color-mode's button inversion off it. */
html[data-color-mode] #researchView#researchView .ih-drawer button:not(.ih-btn--solid):not(.is-active) { background: transparent !important; color: var(--ih-fg) !important; border-color: var(--ih-faint) !important; }
html[data-color-mode] #researchView#researchView .ih-drawer button:not(.ih-btn--solid):not(.is-active):hover { background: var(--ih-hover) !important; color: var(--ih-fg) !important; }
html[data-color-mode] #researchView#researchView .ih-drawer .ih-btn--solid, html[data-color-mode] #researchView#researchView .ih-drawer .ih-seg button.is-active { background: var(--ih-fg) !important; color: var(--ih-bg) !important; }
html[data-color-mode] #researchView#researchView .ih-drawer :is(p, span, h2, h3, dt, dd, strong, small) { color: inherit !important; }
html[data-color-mode] #researchView#researchView .ih-drawer :is(.ih-d-sym, .ih-d-meta, .ih-stat dt, .ih-d-about h3) { color: var(--ih-muted) !important; }
html[data-color-mode] #researchView#researchView .ih-drawer .ih-d-about p { color: color-mix(in srgb, var(--ih-fg) 82%, transparent) !important; }

/* Entrance */
@media (prefers-reduced-motion: no-preference) {
  .ih-home > * { animation: ih-rise .45s cubic-bezier(.2, .8, .2, 1) backwards; }
  .ih-home > :nth-child(2) { animation-delay: .05s; } .ih-home > :nth-child(3) { animation-delay: .1s; }
  .ih-home > :nth-child(4), .ih-home > :nth-child(5) { animation-delay: .15s; }
  @keyframes ih-rise { from { opacity: 0; transform: translateY(8px); } }
}

/* Responsive */
@media (max-width: 1100px) {
  .ih-grid--work { grid-template-columns: 1fr 1fr; }
  .ih-grid--work .ih-tools { grid-column: 1 / -1; }
  .ih-tool-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}
@media (max-width: 860px) {
  #researchView.research-view { padding: 60px 16px 32px !important; }
  .ih-grid--markets, .ih-grid--work { grid-template-columns: minmax(0, 1fr); }
  .ih-hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "text" "state" "search"; }
  .ih-market-state { justify-self: start; }
  html[data-color-mode] #researchView#researchView .ih-home .ih-row { grid-template-columns: minmax(0, 1fr) 84px 80px; }
  .ih-row .ih-spark { display: none; }
  .ih-tape { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ih-search kbd { display: none; }
}
@media (max-width: 420px) {
  .ih-connection { grid-template-columns: minmax(0, 1fr); }
  .ih-vs { text-align: center; }
  .ih-card-head { flex-wrap: wrap; }
  .ih-stats { grid-template-columns: minmax(0, 1fr); }
}

/* Corner radii: color-mode squares every button in #researchView with !important. */
html[data-color-mode] #researchView#researchView .ih-home .ih-tick { border-radius: 14px !important; }
html[data-color-mode] #researchView#researchView .ih-home :is(.ih-btn, .ih-add button, .ih-add input, .ih-input, .ih-select) { border-radius: 9px !important; }
html[data-color-mode] #researchView#researchView .ih-home :is(.ih-seg button, .ih-result) { border-radius: 7px !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-row { border-radius: 10px !important; }
html[data-color-mode] #researchView#researchView .ih-home :is(.ih-tool) { border-radius: 12px !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-row-remove { border-radius: 6px !important; }
html[data-color-mode] #researchView#researchView .ih-drawer :is(.ih-btn, .ih-close) { border-radius: 9px !important; }
html[data-color-mode] #researchView#researchView .ih-drawer .ih-seg button { border-radius: 7px !important; }

/* Featured chart (defaults to the S&P 500) */
.ih-feature { margin-bottom: 16px; padding: 18px 20px 14px; }
.ih-feature-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ih-feature-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ih-feature-sym { font: 700 12px var(--ih-mono); letter-spacing: .06em; color: var(--ih-muted); }
.ih-feature-name { margin: 2px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.ih-feature .ih-d-price { margin: 6px 0 0; }
.ih-feature .ih-d-price strong { font-size: 30px; }
.ih-feature-chart { height: 260px; margin: 12px 0 0; }
html[data-color-mode] #researchView#researchView .ih-home .ih-feature :is(.ih-feature-sym) { color: var(--ih-muted) !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-tick.is-selected { border-color: var(--ih-fg) !important; box-shadow: inset 0 0 0 1px var(--ih-fg); }
@media (max-width: 860px) { .ih-feature-chart { height: 200px; } .ih-feature .ih-d-price strong { font-size: 24px; } }

/* Home CRM preview: each person opens their CRM record */
.ih-crm-person { display: flex; align-items: center; gap: 10px; padding: 8px 6px; margin: 0 -6px; border-bottom: 1px solid rgba(255,255,255,0.06); border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.ih-crm-person:last-child { border-bottom: none; }
.ih-crm-person:hover, .ih-crm-person:focus-visible { background: var(--ih-hover, rgba(255,255,255,0.05)); outline: none; }

/* Candlestick charts (TradingView Lightweight Charts) */
.ih-tv-legend { position: absolute; top: 2px; left: 4px; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px 12px; font: 500 11px var(--ih-mono); color: var(--ih-muted); pointer-events: none; }
.ih-tv-legend b { font-weight: 600; }
.ih-d-chart .tv-lightweight-charts { position: relative; z-index: 1; }

/* ===== Refined, more professional pass ===== */
#researchView .research-form.ih-home {
  --ih-font: Geist, -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --ih-mono: 'Geist Mono', 'SF Mono', ui-monospace, Menlo, monospace;
  --ih-line: color-mix(in srgb, var(--ih-fg) 9%, transparent);
  --ih-surface: color-mix(in srgb, var(--ih-fg) 2.5%, var(--ih-bg));
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
/* Hero: date, greeting, one-line market read */
.ih-hero { margin: 4px 0 26px; gap: 20px 24px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-eyebrow { margin: 0 0 8px; font: 500 12px var(--ih-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ih-muted) !important; }
.ih-home #personalizedHeader .ih-title { font-size: clamp(26px, 3vw, 36px); font-weight: 700; letter-spacing: -.025em; }
html[data-color-mode] #researchView#researchView .ih-home .ih-summary { margin: 8px 0 0; font-size: 15px; color: var(--ih-muted) !important; }
.ih-summary:empty { display: none; }
.ih-search { height: 50px; border-radius: 12px; border-color: var(--ih-line); background: var(--ih-surface); }

/* Cards: one surface, hairline borders, calmer radii */
.ih-card { border-color: var(--ih-line); border-radius: 16px; background: var(--ih-surface); padding: 20px 20px 18px; }
.ih-card-head { margin-bottom: 14px; }
.ih-card-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -.005em; }
.ih-grid { gap: 18px; margin-bottom: 18px; }
.ih-section-title { margin: 34px 0 14px; font: 500 12px var(--ih-mono); letter-spacing: .1em; }

/* Tape */
.ih-tape { gap: 12px; margin-bottom: 20px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-tick {
  padding: 14px 14px 10px; border-radius: 14px; border-color: var(--ih-line) !important; background: var(--ih-surface) !important;
}
html[data-color-mode] #researchView#researchView .ih-home .ih-tick.is-selected {
  border-color: color-mix(in srgb, var(--ih-fg) 55%, transparent) !important; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ih-fg) 25%, transparent);
}
.ih-tick-name { font-size: 12px; font-weight: 500; }
.ih-tick-price { font: 600 18px var(--ih-font); letter-spacing: -.02em; }
.ih-tick-change { font: 500 12px var(--ih-font); }

/* Featured chart */
.ih-feature { padding: 22px 22px 16px; }
.ih-feature-sym { font: 500 11px var(--ih-mono); letter-spacing: .1em; }
.ih-feature-name { font-size: 18px; font-weight: 600; }
.ih-feature .ih-d-price strong { font: 600 32px var(--ih-font); letter-spacing: -.03em; }
.ih-feature .ih-d-price span { font: 500 15px var(--ih-font); }
.ih-feature-chart { height: 300px; margin-top: 14px; }
@media (max-width: 860px) { .ih-feature-chart { height: 220px; } }

/* Numbers everywhere use the clean tabular sans instead of the old monospace */
.ih-home :is(.ih-price, .ih-chg, .ih-pill, .ih-w-price, .ih-row-price, .ih-d-price, .ih-tv-legend) { font-family: var(--ih-font) !important; font-variant-numeric: tabular-nums; }

/* Workspace: canvas cards match the rest of the page */
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)) !important; gap: 12px !important; }
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid .canvas-card {
  background: var(--ih-bg) !important; border: 1px solid var(--ih-line) !important; border-radius: 14px !important; padding: 16px !important;
  transition: border-color .15s, transform .15s;
}
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid .canvas-card:hover { border-color: color-mix(in srgb, var(--ih-fg) 28%, transparent) !important; transform: translateY(-1px); }
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid .canvas-card > div:first-child > div:first-child { font-weight: 600 !important; font-size: 14.5px !important; }
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid .canvas-load-btn:not(.is-opened) {
  background: var(--ih-fg) !important; color: var(--ih-bg) !important; border: 0 !important; border-radius: 9px !important; font-weight: 600 !important;
}
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid .canvas-card button:not(.canvas-load-btn) {
  background: transparent !important; border: 1px solid var(--ih-line) !important; border-radius: 9px !important; color: var(--ih-muted) !important;
}
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid .canvas-card button.canvas-delete-btn:hover { color: #ef4444 !important; border-color: color-mix(in srgb, #ef4444 40%, transparent) !important; }
/* Watchlist / movers rows: tickers stay mono, prices and changes use the tabular sans */
.ih-row-id b { font: 600 13.5px var(--ih-mono); letter-spacing: .01em; }
.ih-row .ih-num { font: 500 14px var(--ih-font); }
.ih-pill { font: 600 12.5px var(--ih-font); border-radius: 8px; min-width: 72px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-row { min-height: 54px; border-bottom-color: var(--ih-line) !important; }

/* ===== Top: big chart + right rail (canvases, globe, tools) ===== */
.ih-top { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; margin-bottom: 18px; }
.ih-top > .ih-feature { margin-bottom: 0; }
.ih-rail { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ih-rail .ih-card { padding: 16px; }
.ih-rail .ih-card-head { margin-bottom: 10px; min-height: 30px; }
.ih-rail .ih-canvases .ih-desc { display: none; }
.ih-rail .ih-canvases .ih-card-head { flex-wrap: wrap; }
.ih-rail #canvasSortSelect { display: none; }
/* Canvases as a compact list in the rail */
html[data-color-mode] #researchView#researchView .ih-home .ih-rail #myCanvasesGrid { grid-template-columns: 1fr !important; gap: 8px !important; max-height: 320px; overflow-y: auto; }
html[data-color-mode] #researchView#researchView .ih-home .ih-rail #myCanvasesGrid .canvas-card { padding: 12px !important; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-rail #myCanvasesGrid .canvas-card > div:first-child { margin: 0 !important; grid-column: 1; }
html[data-color-mode] #researchView#researchView .ih-home .ih-rail #myCanvasesGrid .canvas-card > div:nth-child(2) { margin: 0 !important; grid-column: 1; }
html[data-color-mode] #researchView#researchView .ih-home .ih-rail #myCanvasesGrid .canvas-card > div:last-child { grid-column: 2; grid-row: 1 / span 2; }
html[data-color-mode] #researchView#researchView .ih-home .ih-rail #myCanvasesGrid .canvas-card button:not(.canvas-load-btn) { display: none !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-rail #myCanvasesGrid .canvas-load-btn { flex: none !important; padding: 7px 14px !important; }

/* Globe card */
html[data-color-mode] #researchView#researchView .ih-home .ih-globe-card {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px !important; text-align: left; cursor: pointer;
  border: 1px solid var(--ih-line) !important; color: var(--ih-fg) !important; font-family: var(--ih-font);
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, #3b82f6 18%, transparent), transparent 60%), var(--ih-surface) !important;
  transition: border-color .15s, transform .15s;
}
html[data-color-mode] #researchView#researchView .ih-home .ih-globe-card:hover { border-color: color-mix(in srgb, var(--ih-fg) 30%, transparent) !important; transform: translateY(-1px); }
.ih-globe-art { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, #3b82f6 22%, transparent); }
.ih-globe-art svg { width: 24px; height: 24px; fill: none; stroke: #60a5fa; stroke-width: 1.6; }
.ih-globe-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ih-globe-text b { font-size: 14.5px; font-weight: 600; }
html[data-color-mode] #researchView#researchView .ih-home .ih-globe-text small { font-size: 12px; color: var(--ih-muted) !important; }
.ih-globe-go { font-size: 18px; color: var(--ih-muted); }

/* Tools: tighter in the rail */
.ih-rail .ih-tools .ih-tool { padding: 8px 6px !important; }

/* Workspace below now just holds People & companies */
.ih-grid--work { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 1100px) { .ih-top { grid-template-columns: minmax(0, 1fr); } }
html[data-color-mode] #researchView#researchView .ih-home .ih-globe-card { border-radius: 16px !important; }
/* The globe card above already opens the world map */
.ih-rail #openWorldMapBtn { display: none !important; }
/* Left column: chart, then watchlist + movers (fills the space beside the rail) */
.ih-main-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.ih-main-col > .ih-grid { margin-bottom: 0; }
.ih-main-col .ih-grid--markets { grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); }
@media (max-width: 1300px) { .ih-main-col .ih-grid--markets { grid-template-columns: minmax(0, 1fr); } }
/* People & companies in the rail: the two person inputs stack */
.ih-rail .ih-connection { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 6px !important; }
.ih-rail .ih-connection .ih-vs { align-self: center; font-size: 11px; }
.ih-rail .ih-research .ih-crm-preview { margin-bottom: 4px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-rail .ih-connection input { flex: none !important; height: 38px !important; width: 100% !important; }

/* Drawing on the featured chart (engine: public/js/chart-draw.js) */
.ih-d-chart .ih-draw-canvas { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 2; }
.ih-feature-chart:not([data-tool="cursor"]) { cursor: crosshair; }
.ih-feature-chart[data-tool="eraser"] { cursor: not-allowed; }
.ih-feature-chart.is-over-drawing[data-tool="cursor"] { cursor: move; }
.ih-feature-chart.is-over-drawing[data-tool="eraser"] { cursor: pointer; }
.ih-draw-tools { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--ih-line); border-radius: 10px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-draw-tools button {
  width: 28px; height: 28px; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center;
  border: 0 !important; border-radius: 7px !important; background: transparent !important; color: var(--ih-muted) !important; cursor: pointer; box-shadow: none !important;
}
html[data-color-mode] #researchView#researchView .ih-home .ih-draw-tools button:hover { background: var(--ih-hover) !important; color: var(--ih-fg) !important; }
html[data-color-mode] #researchView#researchView .ih-home .ih-draw-tools button.is-on { background: color-mix(in srgb, #3b82f6 22%, transparent) !important; color: #60a5fa !important; }
.ih-draw-tools svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* Drawing toolbar: vertical strip on the right side of the chart */
.ih-feature-body { display: flex; align-items: stretch; gap: 10px; margin-top: 14px; }
.ih-feature-body .ih-feature-chart { flex: 1; min-width: 0; margin: 0; }
.ih-feature-body .ih-draw-tools { flex-direction: column; align-self: flex-start; }
/* full screen chart: an icon button */
html[data-color-mode] #researchView#researchView .ih-home .ih-btn.ih-btn-icon { width: 34px; padding: 0; }
html[data-color-mode] #researchView#researchView .ih-home .ih-btn.ih-btn-icon svg { width: 16px; height: 16px; }
/* canvases: the open button is a full screen icon */
html[data-color-mode] #researchView#researchView .ih-home .ih-rail #myCanvasesGrid .canvas-load-btn:not(.is-opened) { width: 34px; height: 34px; padding: 0 !important; display: inline-flex; align-items: center; justify-content: center; }
/* canvases: a plain full screen button (white icon, no white fill), like the featured chart's */
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid .canvas-load-btn:not(.is-opened) { background: transparent !important; border: 1px solid var(--ih-faint) !important; color: var(--ih-fg) !important; border-radius: 9px !important; }
html[data-color-mode] #researchView#researchView .ih-home #myCanvasesGrid .canvas-load-btn:not(.is-opened):hover { background: color-mix(in srgb, var(--ih-fg) 8%, transparent) !important; }

/* People & companies: people and companies side by side, each a grid filling the card */
.ih-crm-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 28px; }
.ih-crm-h { margin: 2px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ih-muted, rgba(255,255,255,.5)); }
.ih-crm-h span { margin-left: 6px; font-weight: 600; opacity: .7; }
.ih-crm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 18px; }
.ih-crm-grid .ih-crm-person { margin: 0; }
html[data-color-mode] #researchView .ih-home .ih-crm-more { margin: 6px 0 2px; padding: 0; border: 0 !important; background: transparent !important; color: var(--ih-muted, rgba(255,255,255,.55)) !important; font-size: 12px; cursor: pointer; box-shadow: none !important; transform: none !important; }
html[data-color-mode] #researchView .ih-home .ih-crm-more:hover { color: var(--ih-fg, #fff) !important; text-decoration: underline; }
.ih-main-col .ih-research .ih-connection { grid-template-columns: 1fr auto 1fr; }

/* watchlist: drag a row to reorder (a grip shows on hover) */
html[data-color-mode] #researchView#researchView .ih-home .ih-watchlist [data-role="ih-watchlist"] { position: relative; }
html[data-color-mode] #researchView#researchView .ih-home .ih-watchlist [data-role="ih-watchlist"] .ih-row { position: relative; transition: transform .18s ease, box-shadow .18s ease; user-select: none; }
html[data-color-mode] #researchView#researchView .ih-home .ih-watchlist [data-role="ih-watchlist"] .ih-row::before { content: ''; position: absolute; left: -6px; top: 50%; width: 6px; height: 14px; margin-top: -7px; opacity: 0; transition: opacity .15s;
  background: radial-gradient(circle, var(--ih-muted) 1.1px, transparent 1.3px) 0 0 / 3px 4.6px; cursor: grab; }
html[data-color-mode] #researchView#researchView .ih-home .ih-watchlist [data-role="ih-watchlist"] .ih-row:hover::before { opacity: .8; }
html[data-color-mode] #researchView#researchView .ih-home .ih-watchlist [data-role="ih-watchlist"].is-sorting .ih-row { cursor: grabbing; }
html[data-color-mode] #researchView#researchView .ih-home .ih-watchlist [data-role="ih-watchlist"] .ih-row.is-drag { transition: box-shadow .18s ease; z-index: 3; background: var(--ih-hover, rgba(127,127,127,.12)) !important; box-shadow: 0 8px 24px rgba(0,0,0,.35); border-radius: 8px; }

/* the home chart's symbol: click to show any ticker (it becomes the chart that opens by default) */
html[data-color-mode] #researchView#researchView .ih-home .ih-feature-sym { display: flex; align-items: center; gap: 8px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-fsym { padding: 0 !important; border: 0 !important; background: none !important; color: inherit !important; font: inherit; letter-spacing: inherit; cursor: pointer; }
html[data-color-mode] #researchView#researchView .ih-home .ih-fsym span { font-size: .8em; opacity: .6; }
html[data-color-mode] #researchView#researchView .ih-home .ih-fsym:hover { text-decoration: underline; text-underline-offset: 3px; }
html[data-color-mode] #researchView#researchView .ih-home .ih-fsym-form input { width: 230px; height: 26px; padding: 0 8px; border: 1px solid var(--ih-faint); border-radius: 6px; background: transparent; color: var(--ih-fg); font: 600 12px var(--ih-font); text-transform: uppercase; }
