/* QuantStrategies vault viewer, in BST 2's themes. Every colour, the faces (--display, --sans,
   --mono) and the heading weight are custom properties that /theme.css writes from
   qsweb/palette.py, per theme form (--surface-*, --text*, --accent, --t-<type>, --r-<relation>,
   ...); this file only reads them. The short names below (--bg, --fg, --muted, ...) are aliases
   kept so the rules read as before. */

/* Every BST 2 theme's faces, self-hosted (qsweb/brand.py FONT_FACES; SIL Open Font License 1.1,
   each LICENSE beside its files). Latin subset only. A face is fetched only once text is drawn in
   it, so a page downloads just its theme's; until a face arrives the generic family draws. */
@font-face { font-family: "Alata"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/alata/alata-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Audiowide"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/audiowide/audiowide-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/ibm-plex-mono/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/static/fonts/ibm-plex-mono/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/ibm-plex-mono/ibm-plex-mono-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/ibm-plex-mono/ibm-plex-mono-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/jetbrains-mono/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/static/fonts/jetbrains-mono/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/jetbrains-mono/jetbrains-mono-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/jetbrains-mono/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 300; font-display: swap;
  src: url("/static/fonts/roboto/roboto-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/roboto/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/static/fonts/roboto/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/roboto/roboto-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/static/fonts/space-grotesk/space-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/static/fonts/space-grotesk/space-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/static/fonts/space-grotesk/space-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/static/fonts/space-grotesk/space-grotesk-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: var(--surface-page);
  --surface: var(--surface-card);
  --surface-2: var(--surface-panel);
  --fg: var(--text);
  --muted: var(--text-dim);
  --line: var(--border);
  --mark: var(--mark-bg);
  /* BST 2's radii (radius-sm/md/lg) and elevation, the ink its mode's darkest stop. */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(var(--shadow-ink) / .28), 0 1px 1px rgb(var(--shadow-ink) / .16);
  --shadow-2: 0 4px 14px rgb(var(--shadow-ink) / .32), 0 1px 3px rgb(var(--shadow-ink) / .2);
  /* The sticky top bar's height on a wide screen (two rows), for the panes that fill the rest. */
  --topbar-h: 5.6rem;
}

* { box-sizing: border-box; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-fill); }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
/* Classic's backdrop: two faint violet glows (BST 2's hero glows), fixed behind every page. */
body {
  margin: 0; min-height: 100vh; color: var(--fg); font: 15px/1.5 var(--sans);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse 60% 45% at 85% -5%, var(--ambient-1), transparent 70%),
    radial-gradient(ellipse 50% 40% at 5% 105%, var(--ambient-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--link); text-decoration: none; text-underline-offset: 2px; }
/* Links in running text, underlined where a theme's link colour is its text colour (--link-line). */
:is(p, li, td, dd, .prose) > a:not(.wl, .chip, .button) { text-decoration-line: var(--link-line); }
a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
code, pre { font-family: var(--mono); font-size: .86em; }
h1, h2, h3 { font-family: var(--display); font-weight: var(--display-weight); letter-spacing: var(--display-letter); line-height: 1.2; }
h1 { font-size: 1.6rem; margin: .2em 0 .4em; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; margin: .4em 0; }
.lede { color: var(--muted); max-width: 75ch; }
.count { color: var(--muted); font-weight: 500; font-size: .8em; }
.small { font-size: .78rem; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ top bar */
/* BST 2's shell nav laid across the top: the card surface; the seal and wordmark, search,
   mode toggle and logout on the first row; the page links on the second, dim, with the accent
   marking the current page. */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: .3rem .9rem;
  padding: .4rem 1.2rem 0; background: var(--surface); box-shadow: var(--shadow);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.topsearch { margin-left: auto; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--fg); }
.brand:hover { text-decoration: none; }
/* The seal is the company's logo, drawn in its own colours: never tinted, filtered or faded. */
.brand-seal { display: block; width: 2.5rem; height: auto; flex: none; }
.brand-line { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-family: var(--display); font-weight: var(--display-weight); font-size: .95rem;
  letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; color: var(--fg);
  text-shadow: 0 0 10px var(--glow);
}
.brand-app {
  font-size: .7rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase;
  white-space: nowrap; color: var(--muted);
}
.nav { order: 10; flex: 1 0 100%; display: flex; gap: 2px; flex-wrap: wrap; align-items: center; margin: 0 -.65rem; }
.nav > a, .more > summary {
  color: var(--muted); padding: .3rem .65rem .35rem; border-radius: var(--radius-sm) var(--radius-sm) 0 0; font-size: .86rem; cursor: pointer;
  border-bottom: 2px solid transparent; transition: color 120ms ease, background-color 120ms ease;
}
.nav > a:hover, .more > summary:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
.nav > a.active { color: var(--fg); background: var(--surface-2); font-weight: 600; border-bottom-color: var(--accent); }
.more { position: relative; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: " \25BE"; color: var(--muted); }
.more-menu {
  position: absolute; top: 2.1rem; left: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: .35rem; min-width: 190px; display: grid;
}
.more-menu a { color: var(--fg); padding: .35rem .6rem; border-radius: var(--radius-sm); display: flex; gap: .5rem; align-items: center; }
.more-menu a:hover { background: var(--surface-2); text-decoration: none; }
.topsearch input {
  width: 220px; padding: .4rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--text-mute);
  background: var(--surface-input); color: var(--fg); font: inherit; font-size: .88rem;
}
.topsearch input:hover { border-color: var(--muted); }
/* The theme picker: BST 2's eleven themes and the light/dark/system choice (static/theme.js). */
.theme-picker { display: flex; gap: .35rem; align-items: center; }
.theme-picker select {
  font: inherit; font-size: .82rem; padding: .3rem .45rem; border-radius: var(--radius-sm);
  border: 1px solid var(--text-mute); background: var(--surface-input); color: var(--fg); cursor: pointer;
}
.theme-picker select:hover:not(:disabled) { border-color: var(--accent); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ layout */
.page { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }
.page.wide { max-width: 1600px; }
section { margin: 1.4rem 0; }
.section-title { font-family: var(--sans); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .7rem; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .9rem 1rem; margin: 0 0 1rem;
}
/* A card's title, a step under the page's (BST 2): small capitals, tracked, ruled off. */
.panel-title {
  font-family: var(--sans); font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  color: var(--fg); margin: 0 0 .7rem; padding-bottom: .45rem; border-bottom: 1px solid var(--line);
}
.panel-h1 { font-size: 1.2rem; margin: 0 0 .3rem; }
.panel-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.panel-row { border-bottom: 1px solid var(--line); padding-bottom: .45rem; margin-bottom: .7rem; }
.panel-row .panel-title { margin: 0; padding: 0; border: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------ colour atoms */
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c); flex: none; }
.dot.big { width: .9rem; height: .9rem; margin-right: .5rem; vertical-align: middle; }
.line { display: inline-block; width: 1.1rem; height: 3px; border-radius: 2px; background: var(--c); vertical-align: middle; }
.badge {
  display: inline-block; padding: .08rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .55rem .12rem .45rem;
  border-radius: 999px; font-size: .82rem; line-height: 1.4; color: var(--fg);
  background: color-mix(in srgb, var(--c, var(--muted)) 11%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 35%, transparent);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip .dot { background: var(--c); }
a.chip:hover { text-decoration: none; background: color-mix(in srgb, var(--c) 22%, var(--surface)); }
.chip.plain { --c: var(--muted); padding-left: .55rem; }
.chip.broken, .wl.broken {
  color: var(--warn); border: 1px dashed var(--warn); background: transparent; text-decoration: line-through;
}
.wl.broken { padding: 0 .25rem; border-radius: 4px; }
.chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.rel {
  display: inline-block; font-family: var(--mono); font-size: .78rem; padding: .05rem .45rem; border-radius: 5px;
  color: var(--fg); border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 10%, transparent);
}
.status {
  display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 5px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); text-transform: lowercase;
}
.status-reviewed, .status-final, .status-supported { color: var(--t-study); border-color: color-mix(in srgb, var(--t-study) 40%, transparent); }
.status-specified, .status-registered { color: var(--t-indicator); border-color: color-mix(in srgb, var(--t-indicator) 40%, transparent); }
.status-idea, .status-sketch, .status-draft, .status-open { color: var(--t-hypothesis); border-color: color-mix(in srgb, var(--t-hypothesis) 40%, transparent); }
.flag {
  display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .04em; padding: .02rem .4rem;
  border-radius: 4px; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 50%, transparent);
}

/* ------------------------------------------------------------------ home */
.hero { padding: 1rem 0 .5rem; }
.hero h1 { font-size: 2.2rem; margin-bottom: .2rem; }
.bigsearch { display: flex; gap: .5rem; max-width: 640px; margin: 1rem 0; }
.bigsearch input {
  flex: 1; padding: .7rem 1rem; font: inherit; font-size: 1rem; border-radius: var(--radius-md);
  border: 1px solid var(--text-mute); background: var(--surface-input); color: var(--fg);
}
.bigsearch input:hover { border-color: var(--muted); }
/* BST 2's one button: the panel surface, its edge raised to the accent on hover. */
button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-md); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--fg); padding: .4rem .8rem;
  transition: border-color 120ms ease, background-color 120ms ease;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { color: var(--muted); border-style: dashed; cursor: not-allowed; }
/* The page's main action: the accent filled, white text (4.9:1 in both modes). */
.bigsearch button, .login-card button, .capture-form button.primary {
  background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent);
}
.bigsearch button:hover, .login-card button:hover, .capture-form button.primary:hover { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.bigsearch button { padding: .6rem 1.1rem; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-top: 1rem; }
.quick-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem;
  color: var(--fg); box-shadow: var(--shadow); display: grid; gap: .2rem;
}
.quick-card span { color: var(--muted); font-size: .88rem; }
.quick-card:hover { text-decoration: none; border-color: var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.type-card {
  position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: .8rem; align-items: baseline; align-content: start; padding: .9rem 1rem .9rem 1.2rem; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden;
}
.type-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--c); }
.type-card:hover { text-decoration: none; border-color: var(--c); }
.type-count { font-size: 1.8rem; font-weight: 700; color: var(--c); font-variant-numeric: tabular-nums; }
.type-name { font-weight: 650; font-size: 1.05rem; }
.type-blurb { grid-column: 1 / -1; color: var(--muted); font-size: .84rem; margin-top: .3rem; align-self: start; }
.link-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }

/* ------------------------------------------------------------------ node page */
.node-head { border-left: 5px solid var(--c); padding-left: 1rem; margin-bottom: 1.2rem; }
.node-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.node-id { color: var(--muted); }
.aliases { display: flex; gap: .3rem; flex-wrap: wrap; }
.alias { font-size: .82rem; color: var(--muted); background: var(--surface-2); padding: .05rem .5rem; border-radius: 5px; }
.warn { color: var(--warn); }
.node-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 1.4rem; align-items: start; }
.node-side { position: sticky; top: calc(var(--topbar-h) + 1rem); max-height: calc(100vh - var(--topbar-h) - 2rem); overflow-y: auto; padding-right: 2px; }
.fields dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1rem; margin: 0; }
.fields dt { font-family: var(--mono); font-size: .8rem; color: var(--muted); padding-top: .15rem; }
.fields dd { margin: 0; min-width: 0; }
.value { overflow-wrap: anywhere; }
table.mini { border-collapse: collapse; font-size: .82rem; width: 100%; }
table.mini th, table.mini td { border-bottom: 1px solid var(--line); padding: .25rem .5rem; text-align: left; vertical-align: top; }
table.mini thead th { font-family: var(--mono); font-weight: 500; color: var(--muted); font-size: .75rem; background: var(--surface-2); }
table.mini.kv th { font-family: var(--mono); font-weight: 500; color: var(--muted); width: 1%; white-space: nowrap; }
.local-graph { height: 400px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); margin-top: .6rem; }
.local-graph.loading { opacity: .5; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; border-radius: 0; padding: .25rem .6rem; font-size: .82rem; background: transparent; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-fill); color: var(--on-accent); }
.link-group { margin-bottom: .8rem; }
.link-group h3 { margin: 0 0 .35rem; font-size: .9rem; display: flex; gap: .4rem; align-items: center; }
.link-items { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .45rem; }
.link-items li { padding-left: .2rem; }
.arrow { color: var(--muted); margin-right: .3rem; font-size: .9rem; }
.kvs { display: flex; flex-wrap: wrap; gap: .1rem .7rem; font-size: .78rem; color: var(--muted); margin: .15rem 0 0 1.2rem; }
.kvs b { font-weight: 600; font-family: var(--mono); font-size: .72rem; }
.kvs.stack { flex-direction: column; margin: 0; }
.finding, .lnote { font-size: .82rem; margin: .2rem 0 0 1.2rem; padding-left: .6rem; border-left: 2px solid var(--line); }
.finding { border-left-color: var(--t-source); }
.lnote { color: var(--muted); }
.measure-group { margin-bottom: .6rem; }
.chips.sub { margin: .3rem 0 0 1rem; }

/* rendered markdown */
.prose { max-width: 78ch; }
.prose h1 { font-size: 1.4rem; }
.prose h2 { font-size: 1.2rem; margin: 1.6em 0 .5em; padding-bottom: .25em; border-bottom: 1px solid var(--line); }
.prose h3 { font-size: 1.02rem; margin: 1.3em 0 .4em; }
.prose p, .prose li { overflow-wrap: break-word; }
.prose pre { background: var(--surface-input); border: 1px solid var(--line); border-radius: var(--radius-md); padding: .8rem 1rem; overflow-x: auto; line-height: 1.45; }
.prose :not(pre) > code { background: var(--surface-2); padding: .05em .35em; border-radius: 4px; }
.prose table { border-collapse: collapse; font-size: .88rem; display: block; overflow-x: auto; margin: 1em 0; }
.prose th, .prose td { border: 1px solid var(--line); padding: .35rem .6rem; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--line); color: var(--muted); }
a.wl { font-weight: 550; border-bottom: 2px solid color-mix(in srgb, var(--t-indicator) 40%, transparent); }
a.wl:hover { text-decoration: none; }
a.wl[data-type="concept"] { color: var(--t-concept); border-bottom-color: color-mix(in srgb, var(--t-concept) 35%, transparent); }
a.wl[data-type="input"] { color: var(--t-input); border-bottom-color: color-mix(in srgb, var(--t-input) 35%, transparent); }
a.wl[data-type="indicator"] { color: var(--t-indicator); border-bottom-color: color-mix(in srgb, var(--t-indicator) 35%, transparent); }
a.wl[data-type="behavior"] { color: var(--t-behavior); border-bottom-color: color-mix(in srgb, var(--t-behavior) 35%, transparent); }
a.wl[data-type="method"] { color: var(--t-method); border-bottom-color: color-mix(in srgb, var(--t-method) 35%, transparent); }
a.wl[data-type="source"] { color: var(--t-source); border-bottom-color: color-mix(in srgb, var(--t-source) 35%, transparent); }
a.wl[data-type="dataset"] { color: var(--t-dataset); border-bottom-color: color-mix(in srgb, var(--t-dataset) 35%, transparent); }
a.wl[data-type="hypothesis"] { color: var(--t-hypothesis); border-bottom-color: color-mix(in srgb, var(--t-hypothesis) 35%, transparent); }
a.wl[data-type="study"] { color: var(--t-study); border-bottom-color: color-mix(in srgb, var(--t-study) 35%, transparent); }
a.wl[data-type="recipe"] { color: var(--t-recipe); border-bottom-color: color-mix(in srgb, var(--t-recipe) 35%, transparent); }
a.wl[data-type="note"] { color: var(--t-note); border-bottom-color: color-mix(in srgb, var(--t-note) 35%, transparent); }
a.wl[data-type="guide"] { color: var(--t-guide); border-bottom-color: color-mix(in srgb, var(--t-guide) 35%, transparent); }

/* ------------------------------------------------------------------ graph page */
main.wide:has(.graph-layout) { padding-bottom: 1rem; }
.graph-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1rem; height: calc(100vh - var(--topbar-h) - 2.4rem); min-height: 520px; }
.graph-controls { overflow-y: auto; margin: 0; }
.graph-controls fieldset { border: 0; padding: 0; margin: .9rem 0 0; }
.graph-controls legend { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .3rem; display: flex; gap: .3rem; align-items: center; width: 100%; }
.graph-controls legend .tiny:first-of-type { margin-left: auto; }
.tiny { font-size: .7rem; padding: .05rem .4rem; text-transform: none; letter-spacing: 0; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .86rem; padding: .12rem 0; cursor: pointer; }
.check .count { margin-left: auto; }
.focus input { width: 100%; padding: .45rem .6rem; border-radius: var(--radius-sm); border: 1px solid var(--text-mute); background: var(--surface-input); color: var(--fg); font: inherit; }
.ctl-row { display: flex; gap: .4rem; margin-top: .5rem; }
.ctl-row button { font-size: .82rem; }
.graph-stage { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
/* Two classes, so it outranks Cytoscape's `.__________cytoscape_container { position: relative }`, which loads later. */
.graph-stage .graph-canvas { position: absolute; inset: 0; }
.graph-tip {
  position: absolute; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--c); border-radius: 8px; padding: .4rem .6rem; box-shadow: var(--shadow);
  display: grid; font-size: .85rem; max-width: 320px;
}
.graph-tip[hidden] { display: none; }
.graph-tip span { color: var(--muted); font-size: .75rem; font-family: var(--mono); }
.graph-loading { position: absolute; inset: auto 1rem 1rem auto; color: var(--muted); font-size: .85rem; background: var(--surface); padding: .3rem .6rem; border-radius: 6px; border: 1px solid var(--line); }
.graph-loading[hidden] { display: none; }

/* ------------------------------------------------------------------ matrix */
table.heat { border-collapse: separate; border-spacing: 3px; font-variant-numeric: tabular-nums; }
table.heat th { font-family: var(--mono); font-weight: 500; font-size: .78rem; color: var(--muted); padding: .3rem .5rem; text-align: center; }
table.heat tbody th { text-align: right; }
table.heat td { min-width: 4.2rem; height: 2.6rem; text-align: center; border-radius: 6px; font-weight: 600; }
/* The shade is classic's violet mixed into the panel; the text is the mode's own, readable on
   the fullest cell in both modes (palette.py, "heat"). */
table.heat td.cell { background: color-mix(in srgb, var(--heat) var(--p), var(--surface-2)); color: var(--fg); cursor: pointer; transition: transform .08s; }
table.heat td.cell.empty { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-weight: 400; cursor: default; }
table.heat td.cell:not(.empty):hover { transform: scale(1.06); }
table.heat td.cell.selected { outline: 3px solid var(--fg); }
table.heat td.total { color: var(--muted); font-weight: 500; font-size: .85rem; }
.cell-detail { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.cell-detail h3 { margin: 0 0 .5rem; font-size: .95rem; font-family: var(--mono); }

/* ------------------------------------------------------------------ recipe board and lists */
.toolbar { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin: 1rem 0; }
.filter { padding: .45rem .7rem; border-radius: var(--radius-sm); border: 1px solid var(--text-mute); background: var(--surface-input); color: var(--fg); font: inherit; min-width: 240px; }
.sort-label { color: var(--muted); font-size: .82rem; }
table.board, table.list { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.board > thead th, table.list > thead th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding: .55rem .7rem; border-bottom: 1px solid var(--line);
}
/* Zebra stripes, as every BST 2 table. */
table.board > tbody > tr:nth-child(even), table.list > tbody > tr:nth-child(even) { background: var(--surface-stripe); }
table.board > tbody > tr > td, table.list > tbody > tr > td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.board > tbody > tr:hover, table.list > tbody > tr:hover { background: var(--surface-2); }
table.list thead th[data-col] { cursor: pointer; user-select: none; white-space: nowrap; }
table.list thead th[data-dir="asc"]::after { content: " \25B2"; }
table.list thead th[data-dir="desc"]::after { content: " \25BC"; }
table.list td { font-size: .88rem; }
.id-link code { color: var(--c); font-weight: 600; }
.rc-name { min-width: 200px; }
.rc-title { font-weight: 650; display: block; margin-bottom: .2rem; }
.rc-shape { min-width: 150px; }
.rc-uses { min-width: 260px; }
.role-row { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); gap: .4rem; align-items: start; margin-bottom: .3rem; }
.role { font-family: var(--mono); font-size: .72rem; color: var(--muted); padding-top: .2rem; text-align: right; }
.rc-pred { min-width: 320px; }
table.board .chip { white-space: normal; text-overflow: clip; }
table.pred { width: auto; }
table.pred th { font-family: var(--sans); font-weight: 500; color: var(--fg); white-space: nowrap; }
table.pred td { white-space: nowrap; }
table.pred td.unit { white-space: normal; min-width: 5rem; max-width: 14rem; color: var(--muted); }
.rc-about { min-width: 180px; }
.net { font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 .3rem; }
.basis { font-size: .7rem; font-weight: 600; border-radius: 4px; padding: .02rem .35rem; }
.basis.prior { color: var(--t-hypothesis); background: color-mix(in srgb, var(--t-hypothesis) 14%, transparent); }
.basis.derived { color: var(--t-study); background: color-mix(in srgb, var(--t-study) 14%, transparent); }
.list-head h1 { display: flex; align-items: center; gap: .3rem; }

/* ------------------------------------------------------------------ search */
.hits { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.snippet { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .1em; }

/* ------------------------------------------------------------------ narrow screens (iPad portrait and below) */
@media (max-width: 1000px) {
  .node-grid { grid-template-columns: 1fr; }
  .node-side { position: static; max-height: none; overflow: visible; }
  .graph-layout { grid-template-columns: 1fr; height: auto; }
  .graph-controls { max-height: 40vh; }
  .graph-stage { height: 70vh; }
}
@media (max-width: 700px) {
  /* On a phone the bar wraps to several rows: it scrolls away with the page instead of covering it. */
  .topbar { position: static; }
  .topsearch { width: 100%; }
  .topsearch input { width: 100%; }
  .two-col, .quick { grid-template-columns: 1fr; }
  .page { padding: 1rem; }
}
table.list .chip { font-size: .74rem; padding: 0 .45rem; }

/* ------------------------------------------------------------------ login */
/* Cytoscape's container rule, also in static/cytoscape.css (see there). */
.__________cytoscape_container { position: relative; }
.logout { margin: 0; }
.logout button { font-size: .85rem; padding: .35rem .7rem; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 1.6rem 1.5rem; display: grid; gap: .9rem;
}
.login-brand { display: grid; justify-items: center; gap: .25rem; text-align: center; margin-bottom: .3rem; }
/* The seal in its own colours, as in the header: never tinted, filtered or faded. */
.login-seal { display: block; width: 7rem; height: auto; margin-bottom: .4rem; }
.login-brand .brand-name { margin: 0; font-size: 1.15rem; }
.login-brand .brand-app { margin: 0; font-size: .78rem; }
.login-card label { display: grid; gap: .35rem; font-size: .9rem; color: var(--muted); }
.login-card input[type="password"] {
  padding: .6rem .8rem; font: inherit; border-radius: var(--radius-sm); border: 1px solid var(--text-mute);
  background: var(--surface-input); color: var(--fg);
}
.login-card button { padding: .6rem 1rem; }
.login-error {
  margin: 0; padding: .5rem .7rem; border-radius: 8px; font-size: .9rem;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

/* ---------------------------------------------------------------- capture */
.capture-tabs { display: inline-flex; margin-bottom: .6rem; }
.capture-tabs a { padding: .3rem .8rem; color: var(--fg); }
.capture-tabs a + a { border-left: 1px solid var(--line); }
.capture-tabs a.on { background: var(--accent-fill); color: var(--on-accent); }
.capture-form { display: grid; gap: .8rem; max-width: 760px; }
.capture-form label { display: grid; gap: .3rem; font-size: .9rem; }
.capture-form input[type="text"], .capture-form textarea {
  padding: .5rem .7rem; font: inherit; border-radius: var(--radius-sm); border: 1px solid var(--text-mute);
  background: var(--surface-input); color: var(--fg); width: 100%;
}
.capture-form textarea { font-family: var(--mono); font-size: .88rem; resize: vertical; }
.capture-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; }
.capture-form .status-pick label { display: inline-flex; gap: .3rem; margin-right: 1rem; }
.capture-form .about-pick { display: grid; gap: .4rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.capture-form .about-pick legend { grid-column: 1 / -1; }
.capture-form .hint { margin: -.4rem 0 0; }
.id-live { font-family: var(--mono); }
.id-live.bad { color: var(--warn); }
.capture-form button.primary { justify-self: start; padding: .6rem 1.1rem; }
.form-errors, .flash {
  padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .92rem;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
.flash { border-color: var(--line); background: var(--surface); }
.form-errors p, .flash p { margin: .2rem 0; }
.form-errors ul, .flash ul { margin: .3rem 0; padding-left: 1.2rem; }
.flash-ok { font-weight: 600; }
.flash-notice { color: var(--warn); }

/* ------------------------------------------------------------------ assistant */
.index-status { font-size: .85rem; color: var(--muted); margin: .2rem 0 1rem; }
.warn-text { color: var(--warn); }
.assist-form { margin-bottom: 1.2rem; }
.assist-result { max-width: 900px; display: grid; gap: .7rem; }
.retrieved { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem .6rem; }
.retrieved li { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; }
.retrieved .reason { font-size: .72rem; color: var(--muted); font-family: var(--mono); }
.retrieved .reason.match { color: var(--link); }
.assist-stream { white-space: pre-wrap; font-size: .95rem; line-height: 1.55; }
.assist-answer { border-top: 1px solid var(--line); padding-top: .4rem; }
.assist-answer:empty { display: none; }
.missing {
  font-size: .72rem; color: var(--warn); border: 1px solid var(--warn); border-radius: 4px; padding: 0 .3rem;
  white-space: nowrap;
}
.assist-error:empty { display: none; }
.node-actions { margin: .4rem 0 0; }
a.button {
  display: inline-block; padding: .35rem .8rem; border-radius: 8px; font-size: .88rem;
  border: 1px solid var(--accent); color: var(--link); background: var(--surface-2);
}
/* Opaque, as every button is: a named theme's art never shows through its words. */
a.button:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); }
/* The page shows and hides its parts with the hidden attribute; display rules above would win. */
.assist-result[hidden], .assist-result [hidden] { display: none; }

/* The Mia brief: the whole text, monospaced, so it can be read before it is copied. */
.mia-brief { width: 100%; min-height: 60vh; font-family: var(--mono); font-size: .82rem;
  line-height: 1.45; background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: .8rem; resize: vertical; }

/* --------------------------------------------------- model-suggested links (suggest.py) */
.nav-badge {
  display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 999px; font-size: .72rem;
  font-weight: 700; text-align: center; background: var(--accent-fill); color: var(--on-accent);
}
.flash-error { color: var(--danger); font-weight: 600; }
form.inline { display: inline; margin: 0; }
.node-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.node-actions button { font-size: .88rem; padding: .35rem .8rem; }
.suggest-job { font-size: .85rem; color: var(--muted); margin: .4rem 0 0; }
a.unreviewed-count { text-decoration: none; }
.stance {
  display: inline-block; font-size: .72rem; font-weight: 600; padding: .02rem .45rem; border-radius: 5px;
  border: 1px solid var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 10%, transparent);
}
.stance-supports { --c: var(--success); }
.stance-contradicts { --c: var(--danger); }
.stance-context { --c: var(--text-dim); }
.origin-tag { font-size: .72rem; font-family: var(--mono); color: var(--muted); }
.origin-tag.unreviewed { color: var(--warn); }
.suggestions { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; }
.suggestion-head .chip { white-space: normal; text-overflow: clip; }
.suggestions li { padding: .5rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-md); }
.suggestions li.unreviewed { border-style: dashed; border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.suggestion-head { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; }
.suggestions .lnote { margin-left: 0; }
.review-state { font-size: .72rem; font-family: var(--mono); color: var(--muted); }
.suggestions li.unreviewed .review-state { color: var(--warn); }
.suggestion-actions { display: flex; gap: .4rem; margin-top: .4rem; }
.suggestion-actions button { font-size: .82rem; padding: .25rem .7rem; }
.line.model { background: none; height: 0; border-top: 2px dashed var(--muted); border-radius: 0; }
.batch-progress { font-size: .9rem; }
.batch-failures { font-size: .85rem; }
