/* ForQ Studio, in the shared page's shell (MVP apps/web: routes/trail.tsx, index.css) and its tokens
   (MVP packages/design/tokens.cjs). Dark on :root, light under [data-theme="light"]. Colours are
   "r g b" triplets so one token serves every opacity. */
@font-face { font-family: "Inter Variable"; font-style: normal; font-display: swap; font-weight: 100 900; src: url("/assets/inter.woff2") format("woff2-variations"); }
@font-face { font-family: "Inter Tight Variable"; font-style: normal; font-display: swap; font-weight: 100 900; src: url("/assets/inter-tight.woff2") format("woff2-variations"); }

:root {
  color-scheme: dark;
  --page: 13 13 12; --card: 16 16 15; --block: 25 25 24; --chip: 31 31 30; --pill: 31 31 30; --raised: 21 21 20;
  --line: rgba(255,255,255,0.07); --line-strong: rgba(255,255,255,0.12);
  --ink: 244 243 238; --body: 228 227 221; --muted: 165 164 158; --faint: 123 122 117;
  --accent: 74 148 245; --accent-deep: 35 87 179; --warn: 232 176 74; --bad: 240 110 100;
  --glass: var(--chip);
  /* The timeline's marks, checked for colour-blind separation on this surface. */
  --m-learnt: #3987e5; --m-changed: #d95926; --m-reading: #199e70; --m-other: rgb(var(--faint));
  --sans: "Inter Variable", Inter, system-ui, sans-serif;
  --display: "Inter Tight Variable", "Inter Tight", "Inter Variable", system-ui, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: 245 245 247; --card: 255 255 255; --block: 239 238 233; --chip: 230 229 223; --pill: 255 255 255; --raised: 241 240 235;
  --line: rgba(0,0,0,0.08); --line-strong: rgba(0,0,0,0.13);
  --ink: 26 26 25; --body: 43 43 41; --muted: 107 106 101; --faint: 142 141 135;
  --accent: 47 125 232; --accent-deep: 43 100 201; --warn: 183 121 31; --bad: 196 60 50;
  --glass: var(--card);
  --m-learnt: #2a78d6; --m-changed: #eb6834; --m-reading: #1baf7a;
}

* { box-sizing: border-box; }
html { background: rgb(var(--page)); color: rgb(var(--body)); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss03"; }
body { margin: 0; min-height: 100dvh; background: rgb(var(--page)); font-family: var(--sans); font-size: 14.5px; line-height: 1.5; }
::selection { background: rgba(242, 106, 27, 0.35); }
:focus-visible { outline: 2px solid rgb(var(--accent)); outline-offset: 2px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--display); letter-spacing: -0.025em; color: rgb(var(--ink)); }
h2 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
h3 { font-size: 12px; font-weight: 600; color: rgb(var(--faint)); text-transform: uppercase; letter-spacing: 0.04em; margin: 16px 0 6px; }
code { font-size: 12.5px; background: rgb(var(--block)); padding: 1px 5px; border-radius: 6px; }
.muted { color: rgb(var(--muted)); }
.faint { color: rgb(var(--faint)); }
.small { font-size: 12.5px; }
.note { color: rgb(var(--warn)); }
.thin-scroll { scrollbar-width: thin; scrollbar-color: rgb(var(--ink) / 0.14) transparent; }

/* ── The shell ─────────────────────────────────────────────────────────── */
.shell { position: relative; height: 100dvh; overflow: hidden; }
.scroller { position: absolute; inset: 0; overflow-y: auto; }
.column { margin: 0 auto; width: 100%; max-width: 700px; padding: 112px 16px 160px; min-height: 100%; display: flex; flex-direction: column; }
/* The sections that hold tables and a chart take a wider column, clear of the links on the left. */
.shell:not([data-tab="ask"]) .column { max-width: 1040px; padding-bottom: 80px; }
@media (min-width: 900px) and (max-width: 1439px) {
  .shell:not([data-tab="ask"]) .column { margin-left: 188px; max-width: min(1040px, calc(100% - 204px)); }
  .shell:not([data-tab="ask"]):not(.has-drawer) :is(.who-pill, .menu:not(.account-menu), .banner) { left: calc(188px + min(1040px, 100% - 204px) / 2); }
}
.panel { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.mem-timeline { display: flex; flex-direction: column; gap: 14px; padding-bottom: 10px; }

/* Strongest at the edge, fading to nothing: stacked layers, each blurring more over a shorter band. */
.blur { position: absolute; left: 0; right: 0; pointer-events: none; }
.blur.top { top: 0; height: 80px; z-index: 20; }
.blur.bottom { top: -40px; bottom: 0; }
.blur i, .blur b { position: absolute; inset: 0; }
.blur.top i { --dir: to bottom; }
.blur.bottom i { --dir: to top; }
.blur i:nth-child(1) { -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px); -webkit-mask-image: linear-gradient(var(--dir), black 70%, transparent 100%); mask-image: linear-gradient(var(--dir), black 70%, transparent 100%); }
.blur i:nth-child(2) { -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); -webkit-mask-image: linear-gradient(var(--dir), black 55%, transparent 85%); mask-image: linear-gradient(var(--dir), black 55%, transparent 85%); }
.blur i:nth-child(3) { -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); -webkit-mask-image: linear-gradient(var(--dir), black 40%, transparent 70%); mask-image: linear-gradient(var(--dir), black 40%, transparent 70%); }
.blur i:nth-child(4) { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-mask-image: linear-gradient(var(--dir), black 25%, transparent 55%); mask-image: linear-gradient(var(--dir), black 25%, transparent 55%); }
.blur i:nth-child(5) { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); -webkit-mask-image: linear-gradient(var(--dir), black 10%, transparent 40%); mask-image: linear-gradient(var(--dir), black 10%, transparent 40%); }
.blur.top b { background: linear-gradient(to bottom, rgb(var(--page) / 0.8), rgb(var(--page) / 0.4), transparent); }

/* The wordmark, as a mask, so it takes the text colour. */
.logo { display: inline-block; height: 25px; width: 67px; background: currentColor; color: rgb(var(--ink)); -webkit-mask: url("/assets/forq-logo.svg") center / contain no-repeat; mask: url("/assets/forq-logo.svg") center / contain no-repeat; }
.shell-logo { position: absolute; left: calc(2rem + env(safe-area-inset-left)); top: 30px; z-index: 30; }

.who-pill { position: absolute; left: 50%; top: 8px; z-index: 30; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; max-width: 42vw; border: 0; background: none; padding: 0; border-radius: 999px; }
.avatar { position: relative; z-index: 1; display: block; width: 46px; height: 46px; border-radius: 12px; overflow: hidden; background: rgb(var(--block)); border: 1px solid var(--line-strong); transform: rotate(-2deg); box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.25); }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar.initial { display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 500; color: rgb(var(--ink)); }
.pill { position: relative; display: inline-flex; align-items: center; gap: 2px; margin-top: -4px; max-width: 100%; white-space: nowrap; border-radius: 999px; background: rgb(var(--pill) / 0.9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); padding: 4px 6px 4px 10px; font-size: 13.5px; font-weight: 500; color: rgb(var(--ink)); box-shadow: inset 0 1px 0 rgb(var(--ink) / 0.12), 0 1px 2px rgb(0 0 0 / 0.1); }
#scope-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* The chevron says the topics open beside the page. */
.pill .chev { flex: none; color: rgb(var(--muted)); }
.shell[data-tab="shared"] .pill .chev { display: none; }
.shell[data-tab="shared"] .pill { padding-right: 10px; }
.drawer .topics { margin-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.drawer .topics h3 { margin: 10px 10px 4px; }

/* The account: the signed-in person's avatar bottom left; it opens the email and Sign out above it. */
.account { position: absolute; left: calc(2rem + env(safe-area-inset-left)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 30; border: 0; background: none; padding: 0; border-radius: 999px; }
.me-avatar { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 999px; overflow: hidden; background: rgb(var(--chip)); border: 1px solid var(--line-strong); font-size: 14px; font-weight: 500; color: rgb(var(--ink)); }
.me-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.menu.account-menu { left: calc(2rem + env(safe-area-inset-left)); top: auto; bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 46px); transform: none; width: min(260px, calc(100vw - 32px)); }
/* Past chats, kept in this browser: under the icon at the top right. */
.drawer .topic .when { flex: none; color: rgb(var(--faint)); font-size: 12.5px; }
.drawer .topics .empty { margin: 6px 10px 10px; }
.who { margin: 6px 10px 4px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.top-right { position: absolute; right: max(1.5rem, env(safe-area-inset-right)); top: 16px; z-index: 30; display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

/* The Studio's sections: links down the left edge, centred between the wordmark's middle (30 + 25/2 = 42.5px down)
   and the account avatar's middle (its 36px sits 1rem up, so 18px above that): the strip reaches 50px short of each. */
/* The links rest as icons; the labels open while the pointer is in the left edge (or a link has focus), and close when it leaves.
   The strip is the whole edge between the wordmark and the avatar, so reaching for it is enough. */
.tabs { position: absolute; left: 0; top: calc(42.5px + 50px); bottom: calc(max(1rem, env(safe-area-inset-bottom)) + 18px + 50px); z-index: 30; display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 4px; padding: 0 56px 0 calc(2rem + env(safe-area-inset-left) - 10px); }
.tabs .label { display: inline-block; max-width: 0; overflow: hidden; opacity: 0; transition: max-width 0.3s var(--ease), opacity 0.2s; }
.tabs .nav-label { opacity: 0; transition: opacity 0.2s; }
.tabs:is(:hover, :focus-within) .label { max-width: 200px; opacity: 1; }
.tabs:is(:hover, :focus-within) .nav-label { opacity: 1; }
.tabs:is(:hover, :focus-within) a { gap: 12px; min-width: 200px; }
.tab-icon.initial { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 999px; background: rgb(var(--chip)); font-size: 12.5px; font-weight: 600; color: rgb(var(--ink)); }
.tabs a { display: inline-flex; align-items: center; gap: 0; border: 2px solid transparent; border-radius: 13px; background: none; padding: 8px 10px; font-size: 17.5px; font-weight: 400; line-height: 1; color: rgb(var(--faint)); text-decoration: none; white-space: nowrap; transition: background-color 0.15s, color 0.15s, gap 0.3s var(--ease), min-width 0.3s var(--ease); }
.tabs a:hover { background: rgb(var(--ink) / 0.05); color: rgb(var(--muted)); }
.tab-icon { flex: none; }
.tab-icon :is(path, circle) { stroke-width: 1.6; }
.tabs a[aria-current="page"] { color: rgb(var(--ink)); }

.round { position: fixed; z-index: 30; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 999px; background: rgb(var(--ink) / 0.05); color: rgb(var(--muted)); transition: background-color 0.15s, color 0.15s; }
.round:hover { background: rgb(var(--ink) / 0.1); color: rgb(var(--ink)); }
.theme { bottom: max(1rem, env(safe-area-inset-bottom)); right: max(1.5rem, env(safe-area-inset-right)); }
/* It shows the palette it switches to. */
.theme .moon { display: none; }
:root[data-theme="light"] .theme .moon { display: block; }
:root[data-theme="light"] .theme .sun { display: none; }

/* The topic chooser, under the pill. */
.menu { position: absolute; left: 50%; top: 92px; z-index: 40; transform: translateX(-50%); width: min(340px, calc(100vw - 32px)); max-height: min(60dvh, 520px); overflow-y: auto; padding: 8px; border-radius: 20px; background: rgb(var(--card)); border: 1px solid var(--line-strong); box-shadow: 0 8px 24px -6px rgb(0 0 0 / 0.3); }
.menu h3 { margin: 10px 10px 4px; }
a.topic { text-decoration: none; }
.topic { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: none; padding: 8px 10px; border-radius: 12px; text-align: left; color: rgb(var(--body)); }
.topic:hover { background: rgb(var(--ink) / 0.05); }
.topic.on { background: rgb(var(--chip)); color: rgb(var(--ink)); }
.topic .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic .n { color: rgb(var(--faint)); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ── The question box ──────────────────────────────────────────────────── */
.dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0 max(1rem, env(safe-area-inset-left), env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)); }
.shell:not([data-tab="ask"]) .dock { display: none; }
.dock-fade { position: absolute; left: 0; right: 0; top: -40px; bottom: 0; pointer-events: none; background: linear-gradient(to top, rgb(var(--page) / 0.9), rgb(var(--page) / 0.4), transparent); }
.glass { position: relative; background: rgb(var(--glass) / 0.8); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); box-shadow: inset 0 0 14px rgb(var(--ink) / 0.04), 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px -6px rgb(0 0 0 / 0.14); }
.composer { margin: 0 auto; width: 100%; max-width: 520px; display: flex; align-items: flex-end; gap: 8px; border: 1px solid transparent; border-radius: 28px; padding: 5px 9px 5px 24px; }
.composer textarea { flex: 1; margin: 3px 0; min-height: 36px; max-height: 160px; resize: none; border: 0; border-radius: 0; background: transparent; padding: 6px 0; font-size: 17px; line-height: 24px; color: rgb(var(--ink)); outline: none; }
.composer textarea::placeholder { font-size: 16px; color: rgb(var(--faint)); }
.send { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; margin-bottom: 3px; padding: 6px; border: 2px solid transparent; border-radius: 999px; background: rgb(var(--ink)); color: rgb(var(--page)); transition: background-color 0.15s; }
.send:hover { background: rgb(var(--ink) / 0.9); }
.send[aria-disabled="true"] { cursor: default; background: rgb(var(--ink) / 0.1); color: rgb(var(--glass)); }
.send:disabled { cursor: not-allowed; opacity: 0.5; }

/* ── Buttons (the shared page's shape: 13px radius, 8px 10px, 14.5px medium) ─ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; border: 2px solid transparent; border-radius: 13px; padding: 8px 10px; font-size: 14.5px; font-weight: 500; line-height: 1; background: rgb(var(--ink) / 0.06); color: rgb(var(--body)); transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
.btn:hover { background: rgb(var(--ink) / 0.1); color: rgb(var(--ink)); }
.btn:disabled { cursor: not-allowed; opacity: 0.5; }
.btn.primary { background: rgb(var(--ink)); color: rgb(var(--page)); }
.btn.primary:hover { background: rgb(var(--ink) / 0.85); color: rgb(var(--page)); }
.btn.outline { background: none; border-color: rgb(var(--accent) / 0.35); color: rgb(var(--accent)); }
.btn.outline:hover { border-color: rgb(var(--accent) / 0.7); background: rgb(var(--accent) / 0.05); color: rgb(var(--accent)); }
.btn.quiet, .btn.ghost { background: none; color: rgb(var(--muted)); }
.btn.quiet:hover, .btn.ghost:hover { background: rgb(var(--ink) / 0.05); color: rgb(var(--ink)); }
.btn.danger { background: rgb(var(--bad) / 0.1); color: rgb(var(--bad)); }
.btn.danger:hover { background: rgb(var(--bad) / 0.18); color: rgb(var(--bad)); }
.btn.sm { padding: 6px 9px; font-size: 13px; border-radius: 11px; }
.btn.icon { padding: 6px; }

input[type="text"], input[type="search"], input[type="email"], input[type="date"], input:not([type]), select, textarea { border: 1px solid var(--line-strong); border-radius: 13px; background: rgb(var(--raised)); padding: 8px 11px; color: rgb(var(--ink)); }
input::placeholder, textarea::placeholder { color: rgb(var(--faint)); }
input[type="file"] { font-size: 13px; color: rgb(var(--muted)); max-width: 260px; }
textarea { width: 100%; resize: vertical; border-radius: 18px; }
label { color: rgb(var(--muted)); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }

/* ── Blocks ────────────────────────────────────────────────────────────── */
.card { border-radius: 28px; background: rgb(var(--raised)); padding: 20px 22px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bar h2 { flex: 1; margin: 0; }
.bar input[type="search"] { flex: 1; min-width: 180px; max-width: 280px; border-radius: 999px; padding-left: 16px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; padding: 16px; border-radius: 20px; background: rgb(var(--block)); }
.form .acts { margin-top: 0; }
.empty { color: rgb(var(--faint)); padding: 12px 4px; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 16px; }
.seg button { border: 0; background: none; border-radius: 13px; padding: 7px 11px; font-size: 13.5px; font-weight: 500; line-height: 1; color: rgb(var(--muted)); }
.seg button:hover { color: rgb(var(--ink)); }
.seg button.on { background: rgb(var(--chip)); color: rgb(var(--ink)); box-shadow: inset 0 1px 0 rgb(var(--ink) / 0.08); }

.tag { display: inline-block; flex-shrink: 0; border-radius: 6px; background: rgb(var(--chip)); padding: 2px 7px; font-size: 11.5px; font-weight: 500; line-height: 1.4; color: rgb(var(--muted)); white-space: nowrap; }
.tag.own { background: rgb(var(--accent) / 0.14); color: rgb(var(--accent)); }
.tag.gone { text-decoration: line-through; }

.rows { display: flex; flex-direction: column; }
.row { display: flex; width: 100%; align-items: flex-start; gap: 10px; border: 0; border-top: 1px solid var(--line); background: none; padding: 11px 8px; text-align: left; color: rgb(var(--body)); border-radius: 0; }
.row:first-child { border-top: 0; }
button.row:hover { background: rgb(var(--ink) / 0.04); border-radius: 14px; }
.row.on { background: rgb(var(--block)); border-radius: 14px; }
.row .text { flex: 1; min-width: 0; }
.row .meta { flex-shrink: 0; color: rgb(var(--faint)); font-size: 12.5px; white-space: nowrap; padding-top: 2px; }
.row .tags { display: inline-flex; gap: 4px; flex-shrink: 0; padding-top: 1px; }
.row .tag { margin-top: 2px; }
.row select { padding: 5px 8px; font-size: 13px; }
.clip { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

/* ── The conversation ──────────────────────────────────────────────────── */
.thread { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.hello { margin: auto 0; padding: 0 8px; text-align: center; }
.hello h1 { font-size: 24px; font-weight: 500; letter-spacing: -0.035em; }
.hello p { margin: 8px auto 0; max-width: 28rem; font-size: 14.5px; color: rgb(var(--muted)); }
.starters { margin-top: 24px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 640px) { .starters { grid-template-columns: 1fr; } }
.starters button { border: 0; border-radius: 18px; background: rgb(var(--raised)); padding: 12px 14px; text-align: left; font-size: 13.5px; line-height: 1.4; color: rgb(var(--body)); transition: background-color 0.15s; }
.starters button:hover { background: rgb(var(--block)); }
.msg { font-size: 16px; line-height: 1.5; white-space: pre-wrap; }
.msg.you { align-self: flex-end; max-width: 80%; margin: 8px 0; border-radius: 22px; background: rgb(var(--accent-deep)); padding: 10px 16px; color: #fff; line-height: 1.45; box-shadow: inset 0 1.5px 0 rgb(var(--ink) / 0.12), 0 1px 2px rgb(0 0 0 / 0.1); }
.msg.forq { align-self: flex-start; max-width: 94%; white-space: normal; display: flex; flex-direction: column; gap: 6px; }
.msg.forq.muted, .msg.forq > .note { align-self: flex-start; border-radius: 22px; background: rgb(var(--block)); padding: 12px 16px; }
.msg.forq.thinking { flex-direction: row; align-items: center; gap: 8px; padding: 6px 0; color: rgb(var(--muted)); }
.thinking-orb { display: block; flex: none; }
/* "Thinking", with a band of light sweeping across it. */
.shimmer { font-size: 16px; font-weight: 400; color: transparent; background: linear-gradient(90deg, rgb(var(--faint)) 0%, rgb(var(--faint)) 35%, rgb(var(--ink)) 50%, rgb(var(--faint)) 65%, rgb(var(--faint)) 100%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; animation: shimmer 2s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0% 0; } }
.answer { align-self: flex-start; white-space: pre-wrap; color: rgb(var(--body)); }
/* Under an answer: the handles it cites, overlapping, and "Show citations", which opens them in the third column. */
.cites-btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; border: 0; border-radius: 999px; background: none; padding: 4px 12px 4px 4px; font-size: 13.5px; font-weight: 500; color: rgb(var(--muted)); transition: background-color 0.15s, color 0.15s; }
.cites-btn:hover { background: rgb(var(--ink) / 0.05); color: rgb(var(--ink)); }
.cites-btn .stack { display: inline-flex; }
.cites-btn .bubble { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 4px; border-radius: 999px; background: rgb(var(--chip)); box-shadow: 0 0 0 2px rgb(var(--page)); font-size: 10.5px; font-weight: 600; color: rgb(var(--accent)); }
.cites-btn .bubble + .bubble { margin-left: -8px; }
/* The first handle sits on top, each next one tucked under the one before. */
.cites-btn .bubble { position: relative; }
.cites-btn .bubble:nth-child(1) { z-index: 5; }
.cites-btn .bubble:nth-child(2) { z-index: 4; }
.cites-btn .bubble:nth-child(3) { z-index: 3; }
.cites-btn .bubble:nth-child(4) { z-index: 2; }
.cites-btn .bubble:nth-child(5) { z-index: 1; }
.cites-btn .bubble.more { color: rgb(var(--muted)); }
.cite-list { margin-top: 10px; gap: 2px; }
.cite-list .row { border-top: 0; border-radius: 14px; padding: 10px 8px; }
/* The handle centred on the first line of text (15px at 1.5 is 22.5px; the handle is 18px), and one width, so the texts line up. */
.cite-list .cite { flex: none; min-width: 30px; margin: 2.25px 0 0; text-align: center; }
.cite-list .cite-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cite-list .clip { font-size: 15px; line-height: 1.5; color: rgb(var(--ink)); }
.cite-list .when { color: rgb(var(--faint)); font-size: 12.5px; }
.msg.forq > h3 { margin: 6px 14px 0; }
.msg.forq > p { margin: 0 14px; }
/* A date an answer names: a faint tint of the handle colour, unbroken across lines. */
.date-ref { border-radius: 4px; background: rgb(var(--accent) / 0.08); padding: 1px 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.cite { display: inline-block; border: 0; border-radius: 6px; background: rgb(var(--accent) / 0.16); padding: 0 5px; margin: 0 1px; font-size: 12px; font-weight: 600; line-height: 1.5; color: rgb(var(--accent)); vertical-align: 1px; }
button.cite:hover { background: rgb(var(--accent) / 0.3); }
.gaps { margin: 0 14px; padding-left: 18px; font-size: 14px; color: rgb(var(--muted)); }
.proposal { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; border-radius: 22px; border: 1px solid rgb(var(--accent) / 0.35); padding: 14px 16px; font-size: 14.5px; }
.proposal .was { border-left: 2px solid var(--line-strong); padding-left: 10px; color: rgb(var(--muted)); text-decoration: line-through; text-decoration-color: rgb(var(--faint)); }
.proposal .acts { margin-top: 0; }
.done { color: rgb(var(--accent)); font-weight: 500; }

/* ── Timeline ──────────────────────────────────────────────────────────── */
.legend { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.legend button { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 13px; background: rgb(var(--block)); padding: 7px 11px; font-size: 13.5px; font-weight: 500; line-height: 1; color: rgb(var(--ink)); }
.legend button[aria-pressed="false"] { background: none; color: rgb(var(--faint)); }
.legend button[aria-pressed="false"] svg { opacity: 0.4; }
.legend svg { width: 12px; height: 12px; }
.chart-wrap { position: relative; overflow-x: auto; padding: 14px 8px; }
#tl-chart svg { display: block; }
#tl-chart text { fill: rgb(var(--muted)); font-size: 11.5px; }
#tl-chart text.lane { fill: rgb(var(--body)); font-size: 12px; }
.grid { stroke: var(--line); stroke-width: 1; }
.axis { stroke: var(--line-strong); stroke-width: 1; }
.mark { stroke: rgb(var(--raised)); stroke-width: 1.5; }
.m-learnt { fill: var(--m-learnt); }
.m-changed { fill: var(--m-changed); }
.m-reading { fill: var(--m-reading); }
.m-other { fill: var(--m-other); }
/* Your own edits wear a ring in the text colour. */
.mark.mine { stroke: rgb(var(--ink)); stroke-width: 2; }
.mark.sel { stroke: rgb(var(--ink)); stroke-width: 3; }
.hit { fill: transparent; cursor: pointer; }
.hit:focus-visible { outline: none; stroke: rgb(var(--accent)); stroke-width: 2; }
.tip { position: absolute; z-index: 5; max-width: 250px; pointer-events: none; border-radius: 12px; background: rgb(var(--chip)); border: 1px solid var(--line-strong); padding: 6px 10px; font-size: 12.5px; color: rgb(var(--ink)); box-shadow: 0 8px 24px -6px rgb(0 0 0 / 0.3); }

/* ── The item, opened ──────────────────────────────────────────────────── */
.drawer { position: absolute; top: 12px; right: 12px; bottom: 12px; z-index: 50; width: min(380px, calc(100vw - 24px)); overflow-y: auto; border-radius: 28px; background: rgb(var(--card)); border: 1px solid var(--line-strong); padding: 20px 22px; box-shadow: 0 16px 48px -12px rgb(0 0 0 / 0.45); }
/* On a wide screen the drawer is a third column: everything else gives it room instead of sitting under it. */
@media (min-width: 900px) {
  .shell { --dw: 0px; }
  /* --lw: how much room the links on the left keep. With the drawer open it gives some up as the window narrows,
     but never less than the icons themselves need. */
  .shell.has-drawer { --dw: 404px; --lw: clamp(104px, (100vw - 404px) * 0.2, 236px); }
  .shell.has-drawer .tabs { padding-right: 16px; }
  .drawer { border: 0; box-shadow: none; }
  .scroller, .blur.top, .dock { right: var(--dw); }
  /* With the drawer open the content starts clear of the links on the left. */
  .shell.has-drawer .scroller, .shell.has-drawer .dock { left: var(--lw); }
  .shell.has-drawer .column, .shell.has-drawer:not([data-tab="ask"]) .column { margin-left: auto; max-width: min(1040px, 100%); }
  .shell.has-drawer[data-tab="ask"] .column { max-width: 700px; }
  /* Everything that gives the drawer room moves together, on one curve. */
  .scroller, .blur.top, .dock, .top-right, .who-pill, .menu, .banner, .theme { transition: left 0.38s var(--ease), right 0.38s var(--ease), background-color 0.15s, color 0.15s; }
  .drawer { animation: drawer-in 0.38s var(--ease); }
  .drawer.closing { animation: drawer-out 0.26s var(--ease) forwards; }
}
.shell { --ease: cubic-bezier(0.32, 0.72, 0, 1); }
@keyframes drawer-in { from { opacity: 0; transform: translateX(24px); } }
@keyframes drawer-out { to { opacity: 0; transform: translateX(24px); } }
@media (min-width: 900px) {
  .top-right { right: calc(max(1.5rem, env(safe-area-inset-right)) + var(--dw)); }
  /* The pill, its menu and notices centre on the content column, not on the page. */
  .who-pill, .menu:not(.account-menu), .banner { left: calc((100% - var(--dw)) / 2); }
  .shell.has-drawer :is(.who-pill, .menu:not(.account-menu), .banner) { left: calc(var(--lw) + (100% - var(--lw) - var(--dw)) / 2); }
  .theme { right: calc(max(1.5rem, env(safe-area-inset-right)) + var(--dw)); }
}

.drawer .head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.drawer .head .x { margin-left: auto; }
.drawer .text { margin: 14px 0 6px; font-size: 16px; line-height: 1.5; color: rgb(var(--ink)); white-space: pre-wrap; }
.quote { margin: 8px 0; border-left: 2px solid var(--line-strong); padding-left: 12px; }
.quote .by { color: rgb(var(--faint)); font-size: 12.5px; }

/* ── Investor view ─────────────────────────────────────────────────────── */
.check { display: flex; align-items: flex-start; gap: 10px; border-top: 1px solid var(--line); padding: 10px 2px; }
.check:first-child { border-top: 0; }
.check .dot { flex-shrink: 0; width: 8px; height: 8px; margin-top: 7px; border-radius: 999px; background: #199e70; }
.check.todo .dot { background: rgb(var(--warn)); }
.check > span:nth-child(2) { flex: 1; }
.domain { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.domain h2 { margin-bottom: 4px; }

.banner { position: absolute; left: 50%; bottom: 96px; z-index: 60; transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); border-radius: 999px; background: rgb(var(--chip)); border: 1px solid var(--line-strong); padding: 8px 16px; font-size: 13.5px; color: rgb(var(--ink)); text-align: center; box-shadow: 0 8px 24px -6px rgb(0 0 0 / 0.3); }
.shell:not([data-tab="ask"]) .banner { bottom: 24px; }
.banner.bad { color: rgb(var(--warn)); border-radius: 18px; }

/* ── Sign in ───────────────────────────────────────────────────────────── */
.signin { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.signin-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; border-radius: 28px; background: rgb(var(--raised)); padding: 28px; }
.signin-card h1 { font-size: 24px; font-weight: 500; letter-spacing: -0.035em; }
.signin-card form { display: flex; flex-direction: column; gap: 8px; }
.signin-card #ob-address { overflow-wrap: anywhere; }

/* ── Narrow screens: the links move under the pill, in a row ───────────── */
@media (max-width: 899px) {
  .shell-logo { display: none; }
  .account { left: 12px; top: 8px; bottom: auto; }
  .menu.account-menu { left: 12px; top: 52px; bottom: auto; }
  .tabs { left: 0; right: 0; top: 84px; transform: none; flex-direction: row; justify-content: flex-start; overflow-x: auto; padding: 0 12px; scrollbar-width: none; }
  .tabs { bottom: auto; padding: 0 12px; }
  .tabs a { padding: 7px 9px; font-size: 13.5px; gap: 6px; min-width: 0; }
  .tabs .label { max-width: none; opacity: 1; }
  .tabs .tab-icon { width: 20px; height: 20px; }
  .tabs .nav-label { opacity: 1; }
  .tabs:is(:hover, :focus-within) a { gap: 6px; min-width: 0; }
  .column { padding-top: 136px; }
  .menu:not(.account-menu) { top: 124px; }
  .top-right { right: 12px; }
  .theme { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* The file picker's own button, drawn as one of the shell's quiet buttons. */
input[type="file"] { font: inherit; font-size: 13.5px; color: rgb(var(--muted)); max-width: 260px; }
input[type="file"]::file-selector-button {
  font: inherit; font-size: 13.5px; font-weight: 500; color: rgb(var(--ink));
  background: rgb(var(--chip)); border: 2px solid transparent; border-radius: 13px;
  padding: 6px 10px; margin-right: 10px; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: rgb(var(--pill)); }

/* Sign in: Google, or a code by email. */
.btn.google { display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; padding: 10px 12px; }
.or { display: flex; align-items: center; gap: 12px; color: rgb(var(--faint)); font-size: 12.5px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* What others shared with you, under the sections; someone who only reads sees nothing else. */
.nav-label { margin: 14px 0 2px; padding: 0 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: rgb(var(--faint)); }
.tabs a[data-owner] .label { text-overflow: ellipsis; }
.tabs:is(:hover, :focus-within) a[data-owner] .label { max-width: 160px; }
.shell.reader .tabs a:not([data-owner]) { display: none; }
.shell.guest .tabs a[data-tab="ask"] { display: inline-flex; }
.shell.reader .nav-label { margin-top: 0; }
.shell[data-tab="shared"] .who-pill { cursor: default; }
@media (max-width: 899px) { .nav-label { margin: 0; align-self: center; white-space: nowrap; } }
.shell.reader:not(.guest) #history { display: none; }
.drawer .head h2 { margin: 0; }

/* The glimpse: the page before sign-in. A first question is written, and the sign-in card stands where its answer will be. */
.shell.glimpse .tabs a, .shell.glimpse #history, .shell.glimpse #newchat, .shell.glimpse #account, .shell.glimpse .who-pill .chev { display: none; }
.shell.glimpse .who-pill { cursor: default; }
.shell.glimpse.asked .dock { display: none; }
.thread > .signin-card { align-self: center; margin: 20px 0 8px; }
.thread > .signin-card .logo { display: none; }
.msg.forq.locked { width: min(100%, 30rem); gap: 10px; padding: 6px 0; filter: blur(3px); }
.msg.forq.locked i { height: 12px; border-radius: 6px; background: rgb(var(--ink) / 0.14); }
.msg.forq.locked i:nth-child(2) { width: 88%; }
.msg.forq.locked i:nth-child(3) { width: 56%; }

/* ── Local Claude Agent SDK harness inside Studio chat ─────────────────── */
.msg.forq.agent-msg { width: 100%; max-width: 96%; gap: 8px; }
.agent-status { display: inline-flex; align-items: center; gap: 8px; padding: 2px 0; color: rgb(var(--muted)); }
.agent-status .shimmer { font-size: 14px; }
.agent-thinking { width: 100%; border-radius: 16px; border: 1px solid var(--line); background: rgb(var(--raised)); padding: 7px 12px; font-size: 13px; color: rgb(var(--faint)); }
.agent-thinking summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; user-select: none; }
.agent-thinking summary::-webkit-details-marker { display: none; }
.agent-thinking summary::after { content: "›"; margin-left: auto; transition: transform 0.15s; }
.agent-thinking[open] summary::after { transform: rotate(90deg); }
.agent-thinking.settled { width: auto; border: 0; background: none; padding: 2px 0; border-radius: 0; }
.agent-thinking.settled summary { display: inline-flex; color: rgb(var(--faint)); }
.agent-thinking.settled summary:hover { color: rgb(var(--muted)); }
.agent-thinking.settled summary::after { margin-left: 2px; }
.agent-thinking.settled .agent-thinking-body { border-left: 2px solid var(--line-strong); padding-left: 12px; }
.agent-thinking-body { margin-top: 6px; max-height: 200px; overflow-y: auto; white-space: pre-wrap; color: rgb(var(--muted)); font-size: 12.5px; line-height: 1.5; }
.agent-trace { width: 100%; border: 0; background: none; border-radius: 0; }
.agent-trace:not(.expanded) { cursor: pointer; }
.agent-trace-head { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 2px 0; text-align: left; font-size: 13px; font-weight: 400; color: rgb(var(--faint)); transition: color 0.15s; }
.agent-trace-head:hover { color: rgb(var(--muted)); }
.agent-trace-chev { margin-left: 2px; flex: none; color: inherit; font-size: 14px; line-height: 1; transition: transform 0.15s; }
.agent-trace.expanded .agent-trace-chev { transform: rotate(90deg); }
.agent-trace-list { display: none; flex-direction: column; gap: 2px; margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--line-strong); max-height: 320px; overflow-y: auto; overscroll-behavior: contain; }
.agent-trace.expanded .agent-trace-list { display: flex; }
.agent-trace-list:has(.agent-step[open]) { max-height: 460px; overflow-y: auto; overscroll-behavior: contain; }
.agent-step { border: 0; background: transparent; padding: 4px 0; font-size: 13px; color: rgb(var(--faint)); transition: opacity 0.15s; }
.agent-step[open] { background: transparent; }
.agent-trace-list:has(.agent-step[open]) > :not([open]) { opacity: 0.35; }
.agent-trace-list:has(.agent-step[open]) > :not([open]):hover { opacity: 0.7; }
.agent-step summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; user-select: none; color: rgb(var(--faint)); }
.agent-step summary::-webkit-details-marker { display: none; }
.agent-dot { width: 6px; height: 6px; flex: none; border-radius: 999px; background: rgb(var(--faint)); }
.agent-dot.running { background: rgb(var(--faint)); animation: agent-pulse 1.2s ease-in-out infinite; }
.agent-dot.ok { display: none; }
.agent-dot.failed { background: rgb(var(--warn)); }
@keyframes agent-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.agent-step-name { font-weight: 500; color: rgb(var(--faint)); flex: none; }
.agent-step-detail { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgb(var(--faint)); }
.agent-step-ms { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; color: rgb(var(--faint)); }
.agent-step-chev { flex: none; color: rgb(var(--faint)); transition: transform 0.15s; }
.agent-step[open] .agent-step-chev { transform: rotate(90deg); }
.agent-preview { margin: 6px 0 4px; padding-left: 12px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; font-family: var(--sans); font-size: 12.5px; line-height: 1.6; color: rgb(var(--faint)); }
.agent-preview .md-p, .agent-preview .md-h, .agent-preview .md-list, .agent-preview .md-quote, .agent-preview strong { color: rgb(var(--faint)); font-size: 12.5px; }
.agent-preview .md-h { margin: 4px 0 -2px; font-weight: 500; }
.agent-preview .md-list { gap: 6px; }
.agent-preview .date-ref { color: rgb(var(--faint)); background: rgb(var(--ink) / 0.05); }
.agent-denied { margin: 0; padding: 4px 0; font-size: 12.5px; color: rgb(var(--faint)); }
.agent-confirm-meta { font-size: 12px; color: rgb(var(--faint)); }
.agent-confirm-text { white-space: pre-wrap; font-size: 15px; line-height: 1.5; color: rgb(var(--ink)); }
.agent-confirm-left { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; color: rgb(var(--faint)); }
.md-body { white-space: normal; display: flex; flex-direction: column; gap: 14px; line-height: 1.65; }
.md-body .md-p { margin: 0; line-height: 1.65; }
.md-body .md-h { margin: 10px 0 -4px; font-family: var(--display); font-size: 16px; font-weight: 600; color: rgb(var(--ink)); letter-spacing: -0.015em; }
.md-body .md-h:first-child { margin-top: 0; }
.md-body .md-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.md-body .md-list li { line-height: 1.6; }
.md-body .md-quote { margin: 0; padding-left: 12px; border-left: 2px solid var(--line-strong); color: rgb(var(--muted)); line-height: 1.6; }
.md-body .md-hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.md-body .md-code { margin: 0; padding: 10px 12px; border-radius: 14px; background: rgb(var(--block)); border: 1px solid var(--line); overflow-x: auto; font-size: 12.5px; line-height: 1.5; }
.md-body .md-code code { background: none; padding: 0; border-radius: 0; font-size: inherit; }
.md-body strong { color: rgb(var(--ink)); font-weight: 600; }
.send.stopping { background: rgb(var(--ink)); color: rgb(var(--page)); cursor: pointer; }

/* ── The model key's field, and the call to add one (the Settings pages are settings.css) ── */
input[type="password"] { border: 1px solid var(--line-strong); border-radius: 13px; background: rgb(var(--raised)); padding: 8px 11px; color: rgb(var(--ink)); }
/* The "changed my mind" form's date: its label sits above the field. */
.drawer .form label { flex-direction: column; align-items: stretch; gap: 4px; }
.msg.forq .add-key { margin-top: 8px; }
.msg.forq > .note + .add-key { display: flex; width: fit-content; }

/* ── First run (studio.js renderFirstRun) ─────────────────────────────── */
.firstrun { display: flex; flex-direction: column; gap: 6px; }
.fr-steps { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: fr; display: grid; gap: 16px; }
.fr-steps li { counter-increment: fr; position: relative; padding-left: 38px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.fr-steps li::before { content: counter(fr); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgb(var(--block)); color: rgb(var(--ink)); font-weight: 600; font-size: 13px; }
.fr-steps h3 { margin: 2px 0 0; font-size: 15px; text-transform: none; letter-spacing: -0.01em; color: rgb(var(--ink)); }
.fr-steps p { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.fr-key { display: flex; flex-direction: column; gap: 6px; }
.fr-url { word-break: break-all; user-select: all; }

/* ── API keys, in the account menu ─────────────────────────────────────── */
.keys-panel { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 10px; }
.key-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.key-row:last-child { border-bottom: 0; padding-bottom: 0; }
.key-name { font-size: 13px; color: rgb(var(--ink)); word-break: break-all; }

/* ── Explore and communities (/explore, /c/<slug>) ─────────────────────── */
.public { min-height: 100dvh; }
.pub-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 860px; margin: 0 auto; padding: 24px 16px 0; }
.pub-home { display: inline-flex; color: rgb(var(--ink)); }
.pub-nav { display: flex; align-items: center; gap: 14px; }
.pub-nav a { color: rgb(var(--muted)); text-decoration: none; font-weight: 500; }
.pub-nav a:hover { color: rgb(var(--ink)); }
.pub-column { max-width: 860px; margin: 0 auto; padding: 40px 16px 120px; display: flex; flex-direction: column; gap: 14px; }
.pub-column a { color: rgb(var(--accent)); text-decoration: none; }
.pub-column a:hover { text-decoration: underline; }
.pub-h1 { font-size: 30px; font-weight: 600; }
.pub-row { align-items: center; }
.pub-row .text { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.pub-title { font-weight: 600; color: rgb(var(--ink)) !important; }
.pub-row .tags { align-items: center; }
.pub-column a.btn { color: rgb(var(--muted)); }
.pub-column a.btn:hover { text-decoration: none; color: rgb(var(--ink)); }
.face { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; overflow: hidden; background: rgb(var(--block)); border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; color: rgb(var(--ink)); }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-actions { margin: 4px 0; }
.pub-start .inline input { flex: 1; min-width: 140px; }
.pub-checks { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 12px; }
.pub-check { display: flex; align-items: center; gap: 8px; }
.pub-composer { margin-top: 8px; }
.community-answers { display: flex; flex-direction: column; gap: 14px; }
.community-answers:empty { display: none; }
.community-turn { display: flex; flex-direction: column; gap: 10px; }
.community-people { display: flex; flex-direction: column; gap: 12px; }
.community-person { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.community-who { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.community-points ul { margin: 6px 0 0; padding-left: 18px; }
.community-reply:empty { display: none; }
.community-reply h3 { font-size: 15px; font-weight: 600; margin: 6px 0 4px; }
.public .banner { position: fixed; bottom: 24px; }
