/* Shared components. Screen-specific rules live in the imported sheets below (one per screen family). */
@import url('./records.css');
@import url('./feeds.css');
@import url('./workspace.css');
@import url('./dealflow.css');
@import url('./ecosystem.css');

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control-height);
  padding: 0 var(--space-4); border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  font-size: var(--text-base); font-weight: 500; text-decoration: none; }
a.button:hover { color: var(--paper); opacity: 1; box-shadow: inset 0 0 0 999px var(--hover-wash); }
.button-secondary { background: var(--paper); color: var(--ink); }
a.button-secondary:hover { color: var(--ink); }
.button-block { width: 100%; }
.text-link { background: transparent; border: 0; padding: 6px 0; color: var(--blue); font-size: var(--text-md);
  text-decoration: underline; text-underline-offset: .2em; align-self: flex-start; }
.text-link:hover { box-shadow: none; color: var(--navy); }

/* States */
.state { min-height: 12rem; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: var(--space-4);
  padding: var(--space-7) var(--space-6); border: var(--border); background: var(--paper); }
.state p { font-size: var(--text-lg); color: var(--muted); }
.state[data-state="loading"] p::after { content: ''; display: inline-block; width: 40px; height: 2px; margin-left: var(--space-3);
  vertical-align: middle; background: var(--sky); animation: qi-pulse 1.2s ease-in-out infinite; }
.state[data-state="error"] p { color: var(--error); }
/* A loading notice that lasts less than a blink is not shown: it appears only if the wait goes on. */
.state[data-state="loading"] { animation: qi-late .2s .18s both; }
@keyframes qi-late { from { opacity: 0; } }
.site-link { color: inherit; text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 3px; }
.site-link:hover, .site-link:focus-visible { text-decoration-color: currentColor; }
.data-table .site-link { white-space: nowrap; }
@keyframes qi-pulse { 50% { opacity: .25; } }
.notice { font-size: var(--text-md); color: var(--muted); padding: 10px 14px; border-left: 2px solid var(--blue); background: var(--surface); }

/* Filters and list head */
.list-head { display: flex; flex-direction: column; gap: 18px; }
.search-field { display: flex; align-items: center; gap: 10px; height: var(--control-height); padding: 0 14px;
  border: 1px solid var(--field); flex: 0 1 320px; min-width: 0; background: var(--paper); }
.search-field:focus-within { outline: 2px solid var(--bright); outline-offset: 2px; }
.search-field svg { flex-shrink: 0; }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; padding: 0; background: transparent;
  font-size: var(--text-base); color: var(--ink); }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3) var(--space-5); }
.filter-set { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.menu-field { position: relative; display: flex; align-items: center; gap: 10px; height: var(--control-height); padding: 0 0 0 14px;
  border: 1px solid var(--ink); background: var(--paper); font-size: var(--text-base); font-weight: 400; color: var(--ink); }
.menu-field:focus-within { outline: 2px solid var(--bright); outline-offset: 2px; }
.menu-field select, .menu-field input { height: 100%; border: 0; outline: none; background: transparent; font-weight: 500; color: var(--ink);
  padding: 0 36px 0 0; appearance: none; -webkit-appearance: none; cursor: pointer; }
.menu-field input { width: 5.5em; padding-right: 14px; cursor: text; text-transform: uppercase; }
.menu-field input::placeholder { text-transform: none; font-weight: 400; }
.menu-field svg { position: absolute; right: 14px; pointer-events: none; }
/* A long tag path (class › domain › sub-domain) is cut, never wider than the page. */
.menu-field { max-width: 100%; min-width: 0; }
.menu-field select { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* A named menu (lot 7f) says its name until a value is chosen, in the weight of the tag menu's « Domain ». */
.menu-field.is-named:not(.is-active) select { font-weight: 400; }
.menu-field.is-active { background: var(--ink); color: var(--paper); }
.menu-field.is-active select, .menu-field.is-active input { color: var(--paper); }
.menu-field.is-active select option { color: var(--ink); }
.chip { height: 40px; padding: 0 var(--space-3); border: 1px solid var(--field); background: var(--paper); color: var(--ink);
  font-size: var(--text-md); font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.count-line { font-size: var(--text-md); color: var(--muted); }
/* Inline list head (Master tabs): filters beside the search on the title's line, the count alone below, on the right. */
/* The tools take the room beside the title and shrink (search first) rather than wrap; they wrap only on a phone. */
.head-tools { flex: 1 1 480px; display: flex; flex-wrap: nowrap; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
/* On the title's line the menus are the tools' own items, sized and shrunk alongside the search. */
.head-tools .filter-set { display: contents; }
.head-tools .search-field { min-width: 160px; }
.list-head.is-inline .filter-row { justify-content: flex-end; }
/* A menu sized by its longest option (tag paths) must not push the search off the title's line. */
.head-tools .menu-field { max-width: 240px; min-width: 0; flex-shrink: 1; }
/* The tag cascade is as wide as the search beside it (owner, 27/11/2026); both shrink alike on a narrow line. */
.head-tools .tag-filter { flex: 0 1 320px; min-width: 160px; }
.head-tools .tag-filter .tag-field { max-width: none; width: 100%; }
.head-tools .menu-field select { min-width: 0; width: 100%; text-overflow: ellipsis; }
/* Tag cascade (Master lists, lot 3): a menu-high trigger, a level-by-level panel under it, the choice as a breadcrumb. */
.tag-filter { position: relative; min-width: 0; }
.tag-field { padding: 0; }
.tag-trigger { display: flex; align-items: center; gap: 10px; width: 100%; height: 100%; min-width: 0; padding: 0 36px 0 14px;
  border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.tag-trigger:focus { outline: none; }
.tag-trigger strong { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-root { flex-shrink: 0; white-space: nowrap; }
.tag-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: min(360px, calc(100vw - 32px)); min-width: 100%;
  max-height: min(440px, 70vh); overflow-y: auto; background: var(--paper); border: 1px solid var(--ink); box-shadow: var(--shadow-menu); }
.tag-level-head { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3);
  border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: var(--paper); }
.tag-level-title { font-size: var(--text-sm); letter-spacing: var(--eyebrow-spacing); text-transform: uppercase; color: var(--blue); font-weight: 500;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-back { display: grid; place-items: center; width: 32px; height: 32px; margin-left: -8px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.tag-back svg { transform: rotate(90deg); }
.tag-search { display: block; padding: var(--space-2) var(--space-3) 0; }
.tag-search input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--field); font: inherit; font-size: var(--text-base); color: var(--ink); background: var(--paper); }
.tag-list { list-style: none; margin: 0; padding: var(--space-1) 0; }
.tag-row { display: flex; align-items: stretch; }
.tag-choose { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-width: 0; min-height: 40px;
  padding: 6px var(--space-3); border: 0; background: transparent; color: var(--ink); font: inherit; font-size: var(--text-base); text-align: left; cursor: pointer; }
.tag-label { min-width: 0; overflow-wrap: anywhere; }
.tag-above { color: var(--muted); }
.tag-count { flex-shrink: 0; color: var(--muted); font-size: var(--text-md); font-variant-numeric: tabular-nums; }
.tag-choose[aria-current] .tag-label { font-weight: 600; }
.tag-opens svg { flex-shrink: 0; transform: rotate(-90deg); }
.tag-open { display: grid; place-items: center; flex: 0 0 40px; border: 0; border-left: 1px solid var(--line-soft); background: transparent; color: var(--ink); cursor: pointer; }
.tag-open svg { transform: rotate(-90deg); }
.tag-choose:hover, .tag-open:hover, .tag-back:hover, .tag-choose:focus-visible, .tag-open:focus-visible, .tag-back:focus-visible { background: var(--hover-wash); }
.tag-pop button:focus-visible { outline: 2px solid var(--bright); outline-offset: -2px; }
.tag-none { padding: var(--space-2) var(--space-3) var(--space-3); font-size: var(--text-md); color: var(--muted); }
.tag-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin-right: auto; font-size: var(--text-md); color: var(--muted); }
.tag-crumbs-label { color: var(--muted); }
.tag-crumb { padding: 0; border: 0; background: none; font: inherit; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.tag-crumb-current { color: var(--ink); font-weight: 500; }
.tag-crumb-sep { color: var(--field); }
.tag-clear { display: inline-flex; align-items: center; gap: 4px; margin-left: var(--space-2); padding: 2px 6px; border: 1px solid var(--line);
  background: var(--paper); font: inherit; color: var(--muted); cursor: pointer; }
.tag-clear svg { width: 10px; height: 10px; }
.tag-crumb:focus-visible, .tag-clear:focus-visible { outline: 2px solid var(--bright); outline-offset: 2px; }

/* Tables */
.table-wrap { max-width: 100%; overflow-x: auto; border: var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-base); font-variant-numeric: tabular-nums; }
.data-table thead tr { background: var(--surface-head); color: var(--muted); text-align: left; }
.data-table th { padding: var(--space-3); font-size: var(--text-sm); font-weight: 500; white-space: nowrap; }
.data-table td { padding: 6px var(--space-3); height: var(--row-height); border-top: 1px solid var(--line-soft); vertical-align: middle;
  transition: box-shadow var(--ease); }
.data-table th:first-child, .data-table td:first-child { padding-left: var(--space-4); }
.data-table th:last-child, .data-table td:last-child { padding-right: var(--space-4); }
.data-table tbody tr { animation: qi-fade .3s ease backwards; }
.data-table tbody tr:hover td { box-shadow: inset 0 0 0 999px var(--row-wash); }
.data-table tbody tr.is-selected td { background: var(--surface); }
/* Figures read down a column: right-aligned, fixed-width digits (the table already sets tabular-nums). */
.data-table th.num, .data-table td.num { text-align: right; white-space: nowrap; }
.cell { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; }
.cell-main { font-size: var(--text-base); line-height: 1.35; }
.cell-sub { font-size: var(--text-sm); color: var(--muted); }
.cell-strong .cell-main { font-weight: 600; }
.row-pick { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; min-height: var(--control-height);
  padding: 0; border: 0; background: transparent; text-align: left; color: var(--ink); }
.row-pick:hover { box-shadow: none; }
.row-pick .cell-main { font-weight: 600; }
/* A first cell with its own link (Domains, lot 7f: the site): the row's selector lies over the whole row, under that link. */
.data-table tr.has-pick-over { position: relative; cursor: pointer; }
.row-pick-over { position: absolute; inset: 0; width: 100%; min-height: 0; }
.row-pick-over:focus-visible { outline: 2px solid var(--bright); outline-offset: -2px; }
.has-pick-over a { position: relative; z-index: 1; }
.has-pick-over td:first-child .cell-main { font-weight: 600; }
a.row-pick { text-decoration: none; }
a.row-pick .cell-main { text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 3px; }
.score { font-weight: 600; }
.score-none { color: var(--muted); font-weight: 400; }
.pagination { align-self: flex-start; }

.feed-controls { border: 0; padding: 0; margin: 0; min-width: 0; }
.feed-phrase { width: 100%; min-height: 120px; padding: var(--space-3); resize: vertical; }
.feed-proof { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--text-sm); }

/* Detail panel (Lists.dc.html aside) */
.detail-panel { border: var(--border); display: flex; flex-direction: column; overflow-wrap: anywhere; background: var(--paper);
  animation: qi-rise .25s ease backwards; }
.detail-panel:focus { outline: 2px solid var(--bright); outline-offset: 2px; }
.panel-head { position: relative; background: var(--surface); padding: 22px var(--space-6); display: flex; flex-direction: column; gap: 10px; }
.panel-kind { font-size: var(--text-sm); color: var(--blue); font-weight: 600; padding-right: var(--control-height); }
.panel-head h2 { font-weight: 500; font-size: var(--title-md); line-height: 1.16; letter-spacing: -.01em; }
.panel-subtitle { font-size: var(--text-base); color: var(--muted); }
.panel-close { position: absolute; top: 10px; right: 10px; width: var(--control-height); height: var(--control-height); padding: 0;
  border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.panel-body { padding: var(--space-5) var(--space-6) var(--space-6); display: flex; flex-direction: column; gap: 22px; }
.facts { display: flex; flex-direction: column; margin: 0; }
.fact { display: flex; justify-content: space-between; gap: var(--space-4); padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: var(--text-base); }
.fact dt { color: var(--muted); flex-shrink: 0; }
.fact dd { margin: 0; font-weight: 500; text-align: right; min-width: 0; }
.panel-actions { display: flex; flex-direction: column; gap: 10px; }
/* Paper aside (lot 4): the tags as paths, one per line, each level a link; the arXiv links at the bottom. */
.fact:has(.tag-paths) { flex-direction: column; gap: var(--space-2); }
.fact:has(.tag-paths) dd { text-align: left; }
.tag-paths { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tag-path { font-weight: 400; overflow-wrap: anywhere; }
.tag-path-link { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.tag-path-link:hover { color: var(--navy); }
.tag-path-sep { color: var(--field); }
.out-link { align-self: flex-start; }

/* Section rules ("Financials", "News" headers in the canvas) */
.rule-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--ink);
  font-size: var(--text-sm); font-weight: 600; }
.item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.item { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-3) 0; border-bottom: 1px solid var(--rule); }
.item-title { font-size: var(--text-base); font-weight: 500; line-height: 1.4; }
.item-meta { font-size: var(--text-sm); color: var(--muted); }
.big-number { font-family: var(--title-font); font-size: var(--title-md); line-height: 1.15; }

@media (max-width: 600px) {
  .table-wrap { border: 0; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border-top: 1px solid var(--line-soft); padding-block: 10px; }
  .data-table td, .data-table td:first-child, .data-table td:last-child { border: 0; padding: 3px 0; height: auto; }
  .data-table td::before { content: attr(data-label); display: block; font-size: var(--text-xs); color: var(--muted); }
  .data-table td:not(:first-child) { display: inline-block; width: auto; min-width: 30%; margin-right: var(--space-4); vertical-align: top; }
  .data-table td:first-child::before { display: none; }
  .data-table td.num { text-align: left; }
  .search-field { flex-basis: 100%; }
  .head-tools { flex-wrap: wrap; }
  /* On a phone the open cascade spans the heading from gutter to gutter, wherever its trigger wrapped to. */
  .list-head.is-inline .page-heading { position: relative; }
  .tag-filter { position: static; }
  .tag-pop { left: 0; right: 0; width: auto; }
  .head-tools { width: 100%; justify-content: flex-start; }
}

/* Native MathML stays inside narrow title/abstract cells; no inline style or font fetch. */
.paper-formula { display: inline-block; max-width: 100%; overflow-x: auto; vertical-align: middle; }
.paper-formula math { font-size: 1em; }
/* A short script written outside $…$ (Si₃N₄): it does not open the title's lines. */
.paper-script { line-height: 0; }
