/* Bixz chat and sign-in (dwai.web.chat, dwai.web.signin). Tokens, fonts and
   the hallmark row come from tokens.css, loaded first.

   One dominant element per answer (total, fact list or table), then the
   struck mark row that proves where it came from, then the assay slip with
   the SQL. Earlier answers step back through the ink, never through opacity. */

html, body { height: 100%; }
body:has(> .app) { overflow: hidden; }
a { color: inherit; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); height: 100%; font-size: 14px; }
.rail {
  background: var(--rail); color: var(--rail-ink); border-right: 1px solid var(--rail-edge);
  display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 12px 10px 10px;
}
.rail :focus-visible, .signin-rail :focus-visible { outline-color: var(--gold); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 18px;
  font: 700 22px/1 var(--font-display); letter-spacing: 0.01em; color: var(--rail-ink); }
.brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }

/* head: brand left, sidebar toggle right; neither scrolls */
.rail-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  min-height: 42px; padding: 0 2px 10px 6px; }
.rail-head .brand { padding: 0; font-size: 18px; }
.rail-head .brand img { width: 24px; height: 24px; }

/* New question: a struck gold disc, then the words */
.new-q {
  flex: none; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px;
  border-radius: var(--r-md); color: var(--rail-ink); font-size: 13.5px; font-weight: 600; text-decoration: none;
  transition: background-color 0.15s var(--ease);
}
.new-q .plus { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: var(--rail); transition: transform 0.2s var(--ease); }
.new-q:hover { background: var(--rail-2); }
.new-q:hover .plus { transform: scale(1.08); }
.new-q-label { white-space: nowrap; }

/* Agents: a quiet rail entry under New question */
.rail-link { flex: none; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px;
  margin-top: 2px; border-radius: var(--r-md); color: var(--rail-ink-2); font-size: 13.5px; font-weight: 500;
  text-decoration: none; transition: background-color 0.15s var(--ease), color 0.15s var(--ease); }
.rail-link svg { flex: none; }
.rail-link:hover { background: var(--rail-2); color: var(--rail-ink); }
.rail-link[aria-current="page"] { background: var(--rail-3); color: var(--rail-ink); }
.conv-agent { display: inline-flex; vertical-align: -2px; margin-right: 6px; color: var(--gold); }

/* recents: the only part that scrolls */
.convs { flex: 1; min-height: 0; overflow-y: auto; margin: 6px -4px 0; padding: 0 4px 10px;
  scrollbar-color: var(--rail-3) transparent; }
.grp { font: 500 11.5px/1 var(--font); color: var(--rail-ink-2); margin: 18px 10px 6px; }
.conv {
  display: flex; align-items: center; width: 100%; gap: 2px; height: 32px; padding: 0 4px 0 10px; margin-bottom: 1px;
  border-radius: var(--r-md); color: var(--rail-ink); font-size: 13.5px;
  transition: background-color 0.15s var(--ease);
}
.conv a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: inherit; text-decoration: none; line-height: 32px; }
.conv a:focus-visible { outline-offset: -2px; }
.conv form { display: contents; }
.conv:hover { background: var(--rail-2); }
.conv[aria-current="true"] { background: var(--rail-3); font-weight: 500; }
.conv .del { display: none; flex: none; width: 26px; height: 26px; border: 0; background: none; color: var(--rail-ink-2);
  padding: 0; cursor: pointer; place-items: center; border-radius: var(--r-sm); }
.conv:hover .del, .conv:focus-within .del { display: grid; }
.conv .del:hover { color: var(--rail-ink); background: var(--rail-3); }
.rail-empty { color: var(--rail-ink-2); padding: 10px; font-size: 13px; line-height: 1.5; margin: 0; }

/* account: one button, its menu opens upward */
.me { flex: none; position: relative; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--rail-2); }
.me > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 6px 8px;
  border-radius: var(--r-md); cursor: pointer; transition: background-color 0.15s var(--ease); }
.me > summary::-webkit-details-marker { display: none; }
.me > summary:hover, .me[open] > summary { background: var(--rail-2); }
.av { width: 30px; height: 30px; border-radius: 50%; background: var(--rail-3); display: grid; place-items: center;
  font: 700 12.5px var(--font-display); color: var(--rail-ink); flex: none; letter-spacing: 0.04em; }
.me-name { flex: 1; min-width: 0; line-height: 1.25; font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name small { display: block; color: var(--rail-ink-2); font-size: 11.5px; font-weight: 400; }
.me .chev { flex: none; display: grid; color: var(--rail-ink-2); }
.me-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30; min-width: 232px;
  padding: 6px; background: var(--slip); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--lift); }
.me-menu :focus-visible { outline-color: var(--ink); }
.me-who { margin: 0; padding: 8px 10px 6px; color: var(--ink-3); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.me-menu form { margin: 0; }
.mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0;
  border-radius: var(--r-sm); background: none; color: var(--ink); font-size: 14px; text-align: left;
  text-decoration: none; cursor: pointer; }
.mi > span { display: flex; align-items: center; gap: 10px; }
.mi svg { flex: none; color: var(--ink-3); }
.mi:hover { background: var(--ground-2); }
.mi[hidden] { display: none; }

.icon-btn { border: 0; background: transparent; color: var(--rail-ink-2); width: 30px; height: 30px;
  border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; flex: none;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease); }
.icon-btn > span { display: grid; place-items: center; }
.icon-btn:hover { background: var(--rail-2); color: var(--rail-ink); }
.icon-btn[hidden] { display: none; }

/* collapsed (desktop): a narrow strip of icons, like closing a book's spine */
@media (min-width: 901px) {
  :root[data-rail="collapsed"] .app { grid-template-columns: 60px minmax(0, 1fr); }
  :root[data-rail="collapsed"] .rail { padding: 14px 8px 12px; }
  :root[data-rail="collapsed"] .rail-head { justify-content: center; padding: 0 0 8px; }
  :root[data-rail="collapsed"] :is(.rail-head .brand, .new-q-label, .convs, .me-name, .me .chev) { display: none; }
  :root[data-rail="collapsed"] .new-q { justify-content: center; padding: 0; }
  :root[data-rail="collapsed"] .rail-link { justify-content: center; padding: 0; }
  :root[data-rail="collapsed"] .me > summary { justify-content: center; padding: 6px 0; }
  :root[data-rail="collapsed"] .me-menu { right: auto; width: 240px; }
}
:root[data-theme="dark"] .i-moon, :root:not([data-theme="dark"]) .i-sun { display: none; }

.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: 52px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 32px;
  border-bottom: 1px solid var(--line); }
.topbar h1 { font: 600 16px/1.2 var(--font-display); margin: 0; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: 0.005em; }
.topbar .ctx { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
/* data source: a segmented control, the chosen one filled */
.topbar .source { display: inline-flex; flex: none; border: 1.5px solid var(--ink); border-radius: var(--r-sm);
  overflow: hidden; }
.topbar .source form { display: contents; }
.topbar .source .btn { height: 28px; padding: 0 11px; font-size: 12.5px; border: 0; border-radius: 0;
  background: transparent; }
.topbar .source form + form .btn { border-left: 1.5px solid var(--ink); }
.topbar .source .btn:hover { background: var(--ground-2); }
.topbar .source .btn[aria-pressed="true"] { background: var(--ink); color: var(--ground); }
.menu-btn { display: none; }

.feed { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
/* one centred reading column, like a chat */
.feed-inner { max-width: 800px; margin: 0 auto; padding: 28px 24px 40px; }

/* ---------------------------------------------------------------- an answer */
/* you on the right in a bubble, Bixz on the left in plain text */
.turn { display: flex; flex-direction: column; padding-bottom: 32px; }
/* Earlier answers step back through the ink tokens, never opacity: Finance
   re-reads earlier tables, so every line still clears 4.5:1. */
.turn:not(:last-child):not(:hover):not(:focus-within) { --ink: var(--ink-soft); --ink-2: var(--ink-2-soft); }
.q { align-self: flex-end; max-width: min(85%, 600px); margin: 0 0 20px; padding: 10px 16px;
  background: var(--ground-2); border-radius: 18px; font: 400 15px/1.5 var(--font); overflow-wrap: anywhere;
  white-space: pre-wrap; color: var(--ink); }

/* a single value reads as a sentence: label, then the value */
.total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 8px; font-size: 15px; }
.total i { order: -1; font-style: normal; color: var(--ink-2); }
.total i::after { content: ":"; }
.total b { font: 600 17px/1.4 var(--font); color: var(--ink); overflow-wrap: anywhere; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 24px; margin: 0 0 8px; font-size: 14.5px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* tables: one size throughout; rank is weight and rule */
.table-wrap { overflow: auto; max-height: 480px; border: 1px solid var(--line); border-radius: 12px;
  background:
    linear-gradient(to left, var(--ground) 30%, transparent) right center / 48px 100% no-repeat local,
    radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 30%, transparent), transparent) right center / 14px 100% no-repeat scroll; }
.table-wrap:focus-visible { outline-offset: 4px; }
table.res { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.res th {
  position: sticky; top: 0; background: var(--ground); z-index: 1;
  font: 700 11.5px var(--font-display); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3);
  text-align: left; padding: 0; border-bottom: 1.5px solid var(--ink); white-space: nowrap;
}
.res td:first-child, .res th:first-child { position: sticky; left: 0; background: var(--ground); z-index: 2; }
.res thead th:first-child { z-index: 3; }
.res th button { all: unset; display: flex; align-items: center; gap: 5px; padding: 8px 12px; cursor: pointer;
  width: 100%; box-sizing: border-box; }
.res th button svg { opacity: 0.45; }
.res th[aria-sort="ascending"] button svg, .res th[aria-sort="descending"] button svg { opacity: 1; }
.res th button:hover { color: var(--ink); }
.res th button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.res th button[disabled] { cursor: default; }
.res th.n button { justify-content: flex-end; }
.res td { padding: 7px 12px; border-bottom: 1px solid var(--ground-3); white-space: nowrap; }
.res td.n, .res th.n { text-align: right; }
.res tbody tr:hover td { background: var(--ground-2); }
.res tfoot td { position: sticky; bottom: 0; background: var(--ground); border: 0; padding: 9px 12px;
  box-shadow: inset 0 1.5px 0 var(--ink), inset 0 -4px 0 var(--ground), inset 0 -5.5px 0 var(--ink);
  font-weight: 700; }
.res tfoot td:first-child { z-index: 3; }
.res tfoot td.lbl { font: 700 11.5px var(--font-display); letter-spacing: 0.09em; text-transform: uppercase; }

.cap { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 500; max-width: 75ch; }
.cap svg { flex: none; }

/* ---------------------------------------------------------------- the assay */
.assay { margin-top: 8px; }
.hallmark { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; }
.hallmark .sp { flex: 1; }
.hallmark .acts { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.marks .ok svg { color: var(--good); }
.marks .no svg { color: var(--bad); }
/* the answer that just landed strikes its marks in, one cell after another */
.turn[data-fresh] .assay .marks > * { animation: strike 0.45s var(--ease) both; }
.turn[data-fresh] .assay .marks > *:nth-child(2) { animation-delay: 0.07s; }
.turn[data-fresh] .assay .marks > *:nth-child(3) { animation-delay: 0.14s; }
.turn[data-fresh] .assay .marks > *:nth-child(4) { animation-delay: 0.21s; }
@keyframes strike { from { opacity: 0; transform: scale(1.12); filter: blur(2px); } }

.lines { display: flex; flex-wrap: wrap; gap: 2px 20px; margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.lines em { font: 700 11px var(--font-display); font-style: normal; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-3); margin-right: 7px; }
.lines code { font: 12px var(--font-mono); overflow-wrap: anywhere; }

.slip { margin-top: 12px; background: var(--slip); border: 1px solid var(--line); border-radius: var(--r-xs);
  padding: 14px 16px 16px; }
.slip[hidden] { display: none; }
.slip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px -8px 10px 0; }
.slip-head .btn { height: 28px; padding: 0 8px; border-color: transparent; background: transparent; color: var(--ink-3); font-size: 12.5px; }
.slip-head .btn:hover { background: var(--ground-2); color: var(--ink); }
.slip h3 { margin: 0; font: 700 11.5px/1 var(--font-display); letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-3); }
pre.sql { margin: 0; overflow-x: auto; font: 12.5px/1.6 var(--font-mono); color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word; }
pre.sql .kw { color: var(--ink); font-weight: 600; }
.sqlbox { margin-top: 12px; }
.sqlbox summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }

/* buttons that sit on the ground */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--slip); color: var(--ink);
  font-weight: 500; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--slip); }
.btn[aria-pressed="true"], .btn.ghost[aria-pressed="true"] { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.btn[hidden], .ask-btn[hidden] { display: none; }
.thumbs { display: inline-flex; gap: 4px; margin-left: 4px; }
.thumbs .btn { width: 30px; padding: 0; }
form.inline { display: inline; margin: 0; }

/* ---------------------------------------------------------------- live */
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px var(--live-soft);
  animation: pulse 1.4s var(--ease) infinite; flex: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }
/* the live status: plain words with a light sweeping across them, no box */
.status { display: inline-flex; align-items: center; gap: 10px; margin: 0; font: 500 14px/1.4 var(--font); }
.status-text { color: var(--ink-2);
  background: linear-gradient(90deg, var(--ink-3) 0 35%, var(--ink) 50%, var(--ink-3) 65% 100%) 100% 0 / 250% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: shimmer 1.8s linear infinite; }
@keyframes shimmer { to { background-position: 0 0; } }
.status-time { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.status-time:empty { display: none; }
.status-note { margin: 6px 0 0 17px; max-width: 60ch; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.status-note[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .status-text { -webkit-text-fill-color: currentColor; background: none; } }
.draft { margin: 12px 0 0; padding: 12px 14px; background: var(--slip); border: 1px solid var(--line);
  border-radius: var(--r-xs); font: 12.5px/1.6 var(--font-mono); color: var(--ink-3); white-space: pre-wrap;
  word-break: break-word; max-height: 220px; overflow: hidden; }
.draft[hidden] { display: none; }
.draft::after { content: ""; display: inline-block; width: 7px; height: 1em; vertical-align: -2px; margin-left: 2px;
  background: var(--live); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* ---------------------------------------------------------------- notices: icon + title + words, never colour alone */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm);
  max-width: 75ch; border: 1px solid var(--line); background: var(--slip); }
.notice svg { flex: none; margin-top: 2px; }
.notice-text { flex: 1; min-width: 0; }
.notice strong { display: block; font: 600 14px var(--font); margin-bottom: 2px; }
.notice p { margin: 0; color: var(--ink-2); }
.notice-act { margin-top: 10px; display: inline-flex; gap: 8px; flex-wrap: wrap; }
.notice.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice.bad svg, .notice.bad strong { color: var(--bad); }
.notice.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.warn svg, .notice.warn strong { color: var(--warn); }
.notice.calm svg { color: var(--ink-3); }
.past-note { color: var(--ink-3); font-size: 13px; margin: 0; max-width: 75ch; }
.past-act { margin-top: 10px; }

/* ---------------------------------------------------------------- composer */
.composer-wrap { flex: none; position: relative; padding: 10px 24px 14px; }
.composer-wrap::before { content: ""; position: absolute; left: 0; right: 14px; bottom: 100%; height: 32px;
  background: linear-gradient(to bottom, transparent, var(--ground)); pointer-events: none; }
.composer {
  max-width: 752px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; padding: 7px 7px 7px 18px;
  border: 1px solid var(--line-strong); border-radius: 20px; background: var(--slip);
  transition: box-shadow 0.25s var(--ease);
}
.composer:focus-within { box-shadow: var(--lift); }
.composer textarea { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; background: transparent;
  overflow-y: hidden;
  font-size: 14.5px; line-height: 1.5; max-height: 200px; padding: 6px 0; }
.composer textarea::placeholder { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-btn { height: 34px; min-width: 72px; padding: 0 14px; border: 0; border-radius: 14px;
  background: var(--rail); color: var(--rail-ink); font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: none;
  transition: background-color 0.18s var(--ease); }
.ask-btn:hover { background: var(--rail-3); }
:root[data-theme="dark"] .ask-btn { background: var(--ink); color: var(--ground); }
:root[data-theme="dark"] .ask-btn:hover { background: var(--ink-2); }
.ask-btn:disabled { opacity: 0.4; cursor: default; }
.ask-btn.stop, :root[data-theme="dark"] .ask-btn.stop { background: var(--live); color: var(--live-ink); }
.hint { max-width: 752px; margin: 8px auto 0; font-size: 12px; color: var(--ink-3); display: flex;
  justify-content: space-between; gap: 12px; }
kbd { font: 11px var(--font-mono); padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: var(--r-xs); background: var(--slip); color: var(--ink-2); }

/* ---------------------------------------------------------------- empty state */
.empty { max-width: 100%; padding-top: max(24px, 7vh); padding-bottom: 20px; }
.empty h2 { font: 700 clamp(24px, 2.4vw, 30px)/1.1 var(--font-display); margin: 0 0 10px; letter-spacing: -0.005em; }
.empty > p:not(.marks) { color: var(--ink-2); margin: 0 0 20px; max-width: 64ch; font-size: 14px; line-height: 1.6; }
.empty > .marks { margin: 0 0 36px; }
.signin-rail .marks, .empty > .marks { display: flex; width: max-content; max-width: 100%; }
.sugg { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 32px;
  border-top: 1.5px solid var(--ink); margin: 0; }
.sugg form { display: contents; }
.sugg button { all: unset; cursor: pointer; padding: 12px 2px; font-size: 13.5px; line-height: 1.5; border-bottom: 1px solid var(--line); color: var(--ink);
  display: flex; align-items: baseline; gap: 10px; }
.sugg button:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.sugg button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------------------------------------------------------------- sign in */
.signin { min-height: 100%; display: grid; grid-template-columns: minmax(340px, 460px) 1fr; }
.signin-rail { background: var(--rail); color: var(--rail-ink); padding: 40px 44px; display: flex; flex-direction: column;
  border-right: 1px solid var(--rail-edge); }
.signin-rail .brand { font-size: 28px; padding: 0; }
.signin-rail .brand img { width: 40px; height: 40px; border-radius: 10px; }
.signin-rail .pitch { margin-top: auto; }
.signin-rail .pitch p:not(.marks) { color: var(--rail-ink); font: 600 22px/1.3 var(--font-display); max-width: 22ch; margin: 0 0 18px; }
.signin-rail .marks { color: var(--rail-ink-2); }
.signin-main { display: grid; place-items: center; padding: 40px 24px; }
.signin form { width: min(380px, 100%); }
.signin h1 { font: 700 36px/1.05 var(--font-display); margin: 0 0 8px; }
.signin .sub { color: var(--ink-2); margin: 0 0 28px; }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font: 700 11.5px var(--font-display); letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 6px; }
.field input { width: 100%; height: 44px; padding: 0 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--slip); outline: 0; transition: border-color 0.15s var(--ease); }
.field input:hover { border-color: var(--ink-3); }
.field input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 12%, transparent); }
.signin .ask-btn { width: 100%; height: 44px; margin-top: 8px; }
.signin .sso-btn { display: flex; }
.signin-or { display: flex; align-items: center; gap: 12px; margin: 22px 0 18px; color: var(--ink-3);
  font: 700 11.5px var(--font-display); letter-spacing: 0.09em; text-transform: uppercase; }
.signin-or::before, .signin-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.form-err { color: var(--bad); font-weight: 500; margin: 0 0 16px; display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- narrow screens */
.scrim { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 20; transform: translateX(-102%);
    transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease); }
  .app[data-nav="open"] .rail { transform: none; box-shadow: 12px 0 40px -12px rgba(0, 0, 0, 0.5); }
  .app[data-nav="open"] .scrim { display: block; position: fixed; inset: 0; background: rgba(14, 13, 17, 0.45); z-index: 10; }
  .conv .del { display: grid; }
  .menu-btn { display: grid; color: var(--ink-2); margin-left: -6px; }
  .menu-btn:hover { background: var(--ground-2); color: var(--ink); }
  .topbar { padding: 0 16px; gap: 10px; }
  .topbar h1 { font-size: 17px; }
  .topbar .ctx { display: none; }
  .topbar .source .btn { padding: 0 8px; font-size: 12.5px; }
  .feed-inner { padding: 24px 16px 40px; }
  .res td, .res th button { padding: 8px 10px; font-size: 13.5px; }
  .res th button { font-size: 11px; }
  .hallmark .sp { display: none; }
  .composer-wrap { padding: 12px 12px 12px; }
  .composer textarea { font-size: 16px; }
  .hint { display: none; }
  .empty { padding-top: 16px; }
  .empty > .marks { margin-bottom: 36px; }
  .sugg button { padding: 12px 2px; }
  .sugg { grid-template-columns: minmax(0, 1fr); }
  .signin { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .signin-rail { padding: 20px 24px; border-right: 0; border-bottom: 1px solid var(--rail-edge); }
  .signin-rail .pitch { display: none; }
  .signin-main { place-items: start center; padding: 36px 24px; }
}
@media (max-width: 520px) {
  .marks > * { padding: 5px 8px; letter-spacing: 0.06em; }
  .btn .long { display: none; }
  .empty > .marks { display: grid; width: 100%; }
  .hallmark .acts { gap: 4px; }
  .hallmark .acts .btn { padding: 0 7px; gap: 4px; }
  .hallmark .acts .thumbs .btn { width: 28px; padding: 0; }
  .thumbs { margin-left: 0; }
  .composer-wrap .ask-btn { min-width: 0; padding: 0 13px; }
}

/* the answer's actions: quiet until hovered, like a chat's message tools */
.assay .hallmark .btn { height: 28px; padding: 0 8px; gap: 5px; border-color: transparent; background: transparent;
  color: var(--ink-3); font-size: 12.5px; }
.assay .hallmark .btn:hover { background: var(--ground-2); color: var(--ink); }
.assay .hallmark .btn[aria-pressed="true"] { background: var(--ground-2); color: var(--ink); border-color: transparent; }
.assay .hallmark .thumbs .btn { width: 28px; padding: 0; }
.assay .hallmark .thumbs { margin-left: 0; }
.thumbs form[hidden] { display: none; }
.assay .hallmark .btn.voted, .assay .hallmark .btn.voted:hover { color: var(--ink); background: transparent;
  cursor: default; opacity: 1; }
.btn.voted svg { fill: currentColor; }
.assay .hallmark .acts { gap: 2px; }

/* ---------------------------------------------------------------- agents */
.feed-inner.wide { max-width: 1040px; }
.topbar .agent-chip { display: inline-flex; align-items: center; gap: 7px; flex: none; height: 30px; padding: 0 11px;
  border: 1.5px solid var(--ink); border-radius: var(--r-sm); font-size: 13px; font-weight: 600; color: var(--ink); }
.topbar .agent-chip small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.topbar .agent-chip.gone { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.topbar > .btn { flex: none; }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.agent-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-content: start;
  column-gap: 12px; padding: 16px 16px 14px; background: var(--slip); border: 1px solid var(--line);
  border-radius: var(--r-md); transition: border-color 0.15s var(--ease), box-shadow 0.2s var(--ease); }
.agent-card:hover, .agent-card:focus-within { border-color: var(--ink-3); box-shadow: var(--lift); }
.agent-card .agent-ico { grid-row: span 2; }
.agent-ico { width: 38px; height: 38px; display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--rail); color: var(--gold); margin: 0; }
.agent-card h2 { margin: 0; font: 600 16px/1.25 var(--font-display); align-self: center; }
/* the whole card is the link; the edit pencil sits above it */
.agent-card h2 a { color: var(--ink); text-decoration: none; }
.agent-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.agent-card h2 a:focus-visible { outline: none; }
.agent-card:has(h2 a:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.agent-edit { position: relative; z-index: 1; grid-column: 3; grid-row: 1; width: 30px; height: 30px; display: grid;
  place-items: center; border-radius: var(--r-sm); color: var(--ink-3); }
.agent-edit:hover { background: var(--ground-2); color: var(--ink); }
.agent-tag { grid-column: 2; justify-self: start; font-size: 11.5px; font-weight: 600; color: var(--warn);
  background: var(--warn-soft); border-radius: var(--r-xs); padding: 1px 6px; margin-top: 4px; }
.agent-desc { grid-column: 1 / -1; margin: 12px 0 10px; color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.agent-tables { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 12px; padding: 0; }
.agent-tables li { font: 400 11.5px/1.6 var(--font-mono); color: var(--ink-2); background: var(--ground);
  border: 1px solid var(--line); border-radius: var(--r-xs); padding: 0 6px; }
.agent-meta { grid-column: 1 / -1; margin: 0; padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-3); }
.empty.agent-empty > p.agent-ico { width: 46px; height: 46px; margin: 0 0 14px; color: var(--gold); }
.agent-empty .agent-tables { margin: -16px 0 28px; }
.agent-draft { display: flex; gap: 8px; align-items: center; color: var(--warn); font-size: 13px; }
@media (max-width: 900px) {
  .topbar .agent-chip small, .topbar > .btn .long { display: none; }
  .agent-grid { grid-template-columns: minmax(0, 1fr); }
}
