/* VeriMemory — visual system.
 *
 * An editorial product surface, not a dashboard. The rules it holds itself to:
 *
 *   Paper, not chrome.      Warm off-white ground, hairline rules, no shadows
 *                           except where something genuinely floats above the
 *                           page (the drawer, a toast). Nothing glows.
 *   Type does the work.     A serif for headings, a sans for interface text.
 *                           Hierarchy comes from size, weight and space rather
 *                           than from boxes, badges or colour.
 *   Colour means something. Ink for text, one restrained green for verified,
 *                           one muted red for integrity failure. A reader who
 *                           sees colour is being told something specific.
 *   Square-ish surfaces.    2px radius. Rounded cards read as consumer app;
 *                           hard corners read as record.
 *
 * Committed to a single light palette. The brief specifies warm cream, and a
 * dark variant of an editorial paper surface would be a different design rather
 * than the same one inverted — so `color-scheme` is declared light, which keeps
 * form controls and scrollbars in step instead of leaving them to the host.
 */

:root {
  color-scheme: light;

  --paper: #faf8f4;
  --paper-raised: #fffefb;
  --paper-sunk: #f4f1eb;
  --ink: #16150f;
  --ink-soft: #3b3a33;
  --ink-muted: #6f6d63;
  --ink-faint: #9a9890;
  --rule: #e6e1d7;
  --rule-strong: #d5cfc2;

  --verified: #2f6f5e;
  --verified-bg: #edf3f0;
  --alarm: #9c3b23;
  --alarm-bg: #f8efeb;
  --warn: #8a6a24;
  --warn-bg: #f8f2e4;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --measure: 68ch;
  --page: 62rem;
  --radius: 2px;

  --step: 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* The masthead is sticky and 60px tall, so anything scrolled to — a skip-link
   * target, a focused field further down a long form — otherwise arrives
   * underneath it. Reserving its height keeps the destination visible, and keeps
   * a control from being covered at the moment it is about to be used. */
  scroll-padding-top: 76px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.85rem);
  line-height: 1.12;
}

h2 {
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem);
  line-height: 1.2;
}

h3 {
  font-size: 1.08rem;
  line-height: 1.3;
}

p {
  margin: 0;
}

a {
  color: var(--ink);
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: currentColor;
}

/* One focus treatment everywhere, always visible. A keyboard user must never
   have to guess where they are. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 1px;
}

::selection {
  background: #e8e2d2;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1rem;
  z-index: 100;
}

.skip:focus {
  left: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ masthead */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--rule);
}

.masthead-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 clamp(1.1rem, 4vw, 2.5rem);
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  flex-shrink: 0;
}

.wordmark::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 0.42rem;
  border-radius: 50%;
  background: var(--verified);
  vertical-align: 0.28em;
}

.nav {
  display: flex;
  gap: 0.3rem;
  margin-right: auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav a {
  padding: 0.4rem 0.7rem;
  font-size: 0.895rem;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: color var(--step), background var(--step);
}

.nav a:hover {
  color: var(--ink);
  background: var(--paper-sunk);
}

.nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 550;
  background: var(--paper-sunk);
}

.settings-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  font: inherit;
  font-size: 0.84rem;
  color: var(--ink-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}

.settings-button:hover {
  color: var(--ink);
  border-color: var(--rule);
}

.conn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
  flex-shrink: 0;
}

.conn-dot[data-state="ok"] {
  background: var(--verified);
}

.conn-dot[data-state="down"] {
  background: var(--alarm);
}

/* ---------------------------------------------------------------------- page */

.main {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(2.2rem, 5vw, 4.25rem) clamp(1.1rem, 4vw, 2.5rem) 7rem;
}

.main:focus {
  outline: none;
}

.lede {
  margin-top: 1rem;
  max-width: var(--measure);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  color: var(--ink-soft);
  line-height: 1.62;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.small {
  font-size: 0.855rem;
}

.muted {
  color: var(--ink-muted);
}

.back {
  display: inline-block;
  margin-bottom: 1.4rem;
  font-size: 0.87rem;
  color: var(--ink-muted);
  text-decoration: none;
}

.back:hover {
  color: var(--ink);
}

.dot-sep {
  color: var(--rule-strong);
  user-select: none;
}

.block {
  margin-top: 3.5rem;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

/* ------------------------------------------------------------------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.15rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--step), border-color var(--step), color var(--step);
}

.button:hover:not(:disabled) {
  background: #322d26;
  border-color: #322d26;
}

.button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.button-quiet {
  color: var(--ink);
  background: transparent;
  border-color: var(--rule-strong);
}

.button-quiet:hover:not(:disabled) {
  background: var(--paper-sunk);
  border-color: var(--ink);
  color: var(--ink);
}

.button-danger {
  color: var(--paper);
  background: var(--alarm);
  border-color: var(--alarm);
}

.button-danger:hover:not(:disabled) {
  background: #822f1c;
  border-color: #822f1c;
}

.link-button {
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  cursor: pointer;
}

.link-button:hover {
  border-bottom-color: var(--ink);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.7rem;
}

/* --------------------------------------------------------------------- trust */

.trust {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.79rem;
  font-weight: 500;
  color: var(--ink-muted);
  white-space: nowrap;
}

.trust::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.trust[data-state="verified"] {
  color: var(--verified);
}

/* The check mark carries the meaning for anyone who cannot separate the hues. */
.trust[data-state="verified"]::before {
  content: "✓";
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  font-size: 0.92em;
  line-height: 1;
}

.trust[data-state="failed"] {
  color: var(--alarm);
}

.trust[data-state="failed"]::before {
  content: "⚠";
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  font-size: 0.92em;
  line-height: 1;
}

.trust[data-state="untrusted"] {
  color: var(--warn);
}

/* A statement about integrity, sitting above the content it qualifies. Bordered
   on the leading edge only: an annotation on the page, not a card on it. */
.assurance {
  margin-top: 1.5rem;
  padding: 0.85rem 1.1rem;
  border-left: 2px solid var(--verified);
  background: var(--verified-bg);
  font-size: 0.9rem;
  color: var(--ink-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.assurance[data-state="failed"] {
  border-left-color: var(--alarm);
  background: var(--alarm-bg);
}

.assurance[data-state="warn"] {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}

.assurance strong {
  color: var(--ink);
}

/* --------------------------------------------------------------- home / hero */

.hero {
  max-width: 36rem;
}

.hero h1 {
  font-size: clamp(2.05rem, 1.4rem + 2.7vw, 3.15rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 2.15rem;
}

/* Overview statistics: facts in the page's own type, deliberately not tiles —
   a number that matters does not need a box around it. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1px;
  margin-top: 2.4rem;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat {
  padding: 1.1rem 1.2rem;
  background: var(--paper-raised);
}

.stat-value {
  display: block;
  font-family: var(--serif);
  font-size: 1.8rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  margin-top: 0.42rem;
  font-size: 0.795rem;
  color: var(--ink-muted);
}

.stat[data-state="verified"] .stat-value {
  color: var(--verified);
}

.stat[data-state="failed"] .stat-value {
  color: var(--alarm);
}

/* --------------------------------------------------------------- memory list */

.memory-list {
  border-top: 1px solid var(--rule);
}

/* Rows, not cards. A list of records reads as a list; fifteen bordered boxes
   read as a dashboard. */
.memory-row {
  display: block;
  width: 100%;
  padding: 1.1rem 0.85rem 1.15rem;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background var(--step);
}

.memory-row:hover {
  background: var(--paper-raised);
}

.memory-row-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.32;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.memory-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.42rem;
  margin-top: 0.38rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.memory-row-preview {
  display: block;
  margin-top: 0.5rem;
  max-width: var(--measure);
  font-size: 0.92rem;
  line-height: 1.58;
  color: var(--ink-soft);
}

.memory-filters {
  display: grid;
  grid-template-columns: minmax(14rem, 2fr) repeat(4, minmax(8rem, 1fr));
  gap: 0.55rem;
  margin: 0.85rem 0 1.1rem;
}

.memory-category-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: .7rem 0 1rem; }
.memory-chip { padding: .42rem .72rem; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; cursor: pointer; font: inherit; font-size: .86rem; }
.memory-chip:hover, .memory-chip:focus-visible { color: var(--ink); border-color: var(--verified); outline: none; }
.memory-correction { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.correction-form { display: grid; gap: .75rem; }

.memory-search {
  min-width: 0;
}

@media (max-width: 720px) {
  .memory-filters {
    grid-template-columns: 1fr 1fr;
  }

  .memory-search {
    grid-column: 1 / -1;
  }
}

.memory-row[data-trust="corrupted"] .memory-row-title,
.memory-row[data-trust="untrusted"] .memory-row-title,
.memory-row[data-trust="missing"] .memory-row-title {
  color: var(--ink-muted);
  font-style: italic;
}

.type-tag {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.memory-row[data-trust="corrupted"] .type-tag {
  color: var(--alarm);
}

/* Project rows on the overview and verify pages. */
.project-list {
  border-top: 1px solid var(--rule);
}

.project-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 0.85rem;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background var(--step);
}

.project-row:hover {
  background: var(--paper-raised);
}

.project-row-main {
  min-width: 0;
  flex: 1;
}

.project-row-name {
  display: block;
  font-family: var(--serif);
  font-size: 1.04rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.project-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.28rem;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.project-row-aside {
  flex-shrink: 0;
  font-size: 0.83rem;
  color: var(--ink-muted);
}

/* ---------------------------------------------------------------------- chat */

/* The conversation and its composer, in that order. The composer being the last
   child is what makes `position: sticky` work at all: stickiness is bounded by
   the containing block, and the thread above the dock is the room it has to
   float in. On a short page its resting position is already on screen, so it
   simply sits in flow under the intro and nothing appears to be pinned. */
.chat {
  display: flex;
  flex-direction: column;
  margin-top: 3.5rem;
}

/* The dock carries its own bottom spacing; the page's usual tail would lift it
   off the viewport edge at the end of a scroll. */
.main:has(> .chat) {
  padding-bottom: 1.6rem;
}

/* Once there is a conversation the intro stops being a title and becomes a
   header. It shrinks rather than disappearing, because the scope line inside it
   — which project is being asked, and how to widen that — stays useful for as
   long as the thread does. */
.chat-intro[data-compact] .lede {
  display: none;
}

.chat-intro[data-compact] h1 {
  font-size: clamp(1.1rem, 1rem + 0.4vw, 1.28rem);
  color: var(--ink-soft);
}

.chat-intro[data-compact] .scope-note {
  margin-top: 0.6rem;
}

.composer-dock {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 1.5rem 0 1.35rem;
  background: var(--paper);
  /* The thread scrolls behind the dock. A hard edge would slice a sentence in
     half, so the paper is blurred upward and the text fades into it. */
  box-shadow: 0 -1.5rem 1.1rem -0.8rem var(--paper);
}

/* ------------------------------------------------------------------ composer */

.ask-form {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
  padding: 0.72rem 0.72rem 0.72rem 1.05rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  transition: border-color var(--step);
}

.composer-shell {
  min-width: 0;
}

.composer-hint {
  margin: 0.42rem 0 0;
  padding: 0 0.2rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.ask-form:focus-within {
  border-color: var(--ink);
}

.ask-input {
  flex: 1;
  min-height: 1.7rem;
  max-height: 40vh;
  padding: 0.3rem 0;
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
  background: none;
  border: 0;
  resize: none;
  overflow-y: auto;
}

.ask-input:focus {
  outline: none;
}

.ask-input::placeholder {
  color: var(--ink-faint);
}

.ask-submit {
  flex-shrink: 0;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}

.ask-submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.35rem;
}

.suggestions[hidden] {
  display: none;
}

.turn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
}

.turn-save-action:empty {
  display: none;
}

.question-actions {
  margin-top: 0.35rem;
  padding-top: 0;
  border-top: 0;
  opacity: 0;
  transition: opacity var(--step);
}

.exchange:hover .question-actions,
.question-actions:focus-within {
  opacity: 1;
}

.edit-message {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: end;
  gap: 0.6rem;
  margin: 0.65rem 0 1rem;
}

.edit-input {
  min-height: 4.5rem;
  padding: 0.7rem 0.8rem;
  font: inherit;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  resize: vertical;
}

.edit-input:focus {
  outline: none;
  border-color: var(--ink);
}

.research-sources {
  margin-top: 1.25rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}

.research-sources summary {
  font-size: 0.87rem;
  color: var(--ink-muted);
  cursor: pointer;
}

.research-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.7rem;
}

.research-source {
  color: var(--ink-soft);
  font-size: 0.87rem;
  line-height: 1.45;
}

.suggestions-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-right: 0.2rem;
}

.suggestion {
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.855rem;
  color: var(--ink-soft);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--step), color var(--step);
}

.suggestion:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
}

.suggestion:disabled {
  opacity: 0.5;
  cursor: default;
}

.scope-note {
  margin-top: 1.1rem;
  font-size: 0.87rem;
  color: var(--ink-muted);
}

.scope-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.8rem;
}

.scope-select {
  max-width: min(20rem, 100%);
  padding: 0.35rem 1.8rem 0.35rem 0.55rem;
  font: inherit;
  font-size: 0.84rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}

/* -------------------------------------------------------------------- answer */

.exchange {
  padding-top: 2.6rem;
  margin-top: 2.6rem;
  border-top: 1px solid var(--rule);
}

.exchange:first-child {
  border-top: 0;
}

/* A turn in a conversation, not a page heading — sized to sit level with the
   reply beneath it rather than to announce a section. */
.question {
  font-size: clamp(1.14rem, 1.02rem + 0.55vw, 1.36rem);
  max-width: var(--measure);
}

.answer {
  margin-top: 1.45rem;
  max-width: var(--measure);
}

/* Prose paragraphs only — direct children. Labels, notes and evidence rows
   nested inside an answer carry their own sizing, and a descendant selector
   here outranked every one of them. */
.answer > p {
  margin-bottom: 1rem;
  font-size: 1.04rem;
  line-height: 1.68;
  color: var(--ink);
}

.answer > p:last-child {
  margin-bottom: 0;
}

.answer { font-family: var(--sans), "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: 1rem; line-height: 1.72; overflow-wrap: anywhere; }
.answer > :where(p, ul, ol, blockquote, pre, .table-scroll) { margin: 0 0 1rem; }
.answer > :where(h2, h3, h4, h5) { margin: 1.65rem 0 .65rem; color: var(--ink); line-height: 1.25; letter-spacing: -.015em; }
.answer > h2 { font-size: 1.28rem; } .answer > h3 { font-size: 1.13rem; } .answer > h4, .answer > h5 { font-size: 1rem; }
.answer ul, .answer ol { padding-left: 1.45rem; } .answer li { margin: .3rem 0; padding-left: .18rem; }
.answer blockquote { padding: .2rem 0 .2rem 1rem; color: var(--ink-soft); border-left: 2px solid var(--verified); }
.inline-code { padding: .12em .35em; font-family: var(--mono); font-size: .88em; background: var(--paper-sunk); border: 1px solid var(--rule); border-radius: 4px; }
.code-block { max-width: 100%; padding: 1rem 1.1rem; overflow-x: auto; color: #e8e6df; background: #1f211e; border-radius: 7px; tab-size: 2; }
.code-block code { font-family: var(--mono); font-size: .84rem; line-height: 1.62; white-space: pre; }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px; }
.answer table { width: 100%; border-collapse: collapse; font-size: .91rem; }
.answer th, .answer td { padding: .65rem .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.answer th { background: var(--paper-sunk); font-weight: 650; } .answer tr:last-child td { border-bottom: 0; }
.answer a { color: var(--verified); text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* Inline citation markers, rendered as buttons so a reader can jump from a
   clause to the memory it rests on. */
.cite {
  display: inline-block;
  min-width: 1.15rem;
  padding: 0 0.2rem;
  margin: 0 0.04rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  vertical-align: 0.26em;
  color: var(--verified);
  background: var(--verified-bg);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.cite:hover {
  color: var(--paper);
  background: var(--verified);
}

.sources {
  margin-top: 1.8rem;
}

/* ------------------------------------------------------- reply supplements */

.answer > .reply-note {
  margin-top: 1.1rem;
  font-size: 0.87rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

/* Reasoning the model did, and gaps it hit. Set apart from the prose so a
   reader can tell at a glance which claims are recorded and which merely follow
   from them, without having to parse a sentence for hedges. */
.aside {
  margin-top: 1.5rem;
  padding: 0.85rem 1.05rem;
  background: var(--paper-sunk);
  border-left: 2px solid var(--rule-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.aside-label {
  margin: 0;
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.aside-list {
  margin: 0.55rem 0 0;
  padding-left: 1.15rem;
  list-style: disc;
}

.aside-list li {
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.aside-list li + li {
  margin-top: 0.35rem;
}

/* Trust, folded away until it is wanted. One line is always visible; opening it
   is what produces the memories. */
.evidence {
  margin-top: 1.7rem;
  padding-top: 1.05rem;
  border-top: 1px solid var(--rule);
}

.evidence > summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.87rem;
  color: var(--ink-muted);
  cursor: pointer;
  list-style: none;
}

.evidence > summary::-webkit-details-marker {
  display: none;
}

/* The disclosure arrow, drawn rather than borrowed, so it turns with the state
   and sits on the baseline of a small label. */
.evidence > summary::after {
  content: "";
  width: 0.38rem;
  height: 0.38rem;
  border-right: 1px solid var(--ink-faint);
  border-bottom: 1px solid var(--ink-faint);
  transform: rotate(-45deg);
  transition: transform var(--step);
}

.evidence[open] > summary::after {
  transform: rotate(45deg);
}

.evidence > summary:hover {
  color: var(--ink);
}

.evidence > summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.evidence-hint {
  margin: 0.75rem 0 0;
  font-size: 0.855rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.evidence .memory-list {
  margin-top: 0.9rem;
}

/* ----------------------------------------------------------- saving in place */

.receipt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  margin-top: 1.35rem;
  padding: 0.7rem 0.9rem;
  background: var(--verified-bg);
  border-left: 2px solid var(--verified);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.receipt-line {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.receipt-hash {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.save-offer {
  margin-top: 1.5rem;
}

.save-composer {
  margin-top: 1.5rem;
  padding: 1.1rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}

.save-input {
  display: block;
  width: 100%;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  resize: vertical;
}

.save-input:focus {
  outline: none;
  border-color: var(--ink);
}

.save-input::placeholder {
  color: var(--ink-faint);
}

.save-project-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.save-project-row .select {
  flex: 1;
  min-width: 12rem;
}

.save-composer .action-row {
  margin-top: 1rem;
}

.save-done {
  margin-top: 1.5rem;
}

.save-done > p {
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--ink);
}

.save-done .receipt {
  margin-top: 0.8rem;
}

/* Where the conversation could go next, offered under the reply. */
.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.7rem;
}

/* ---------------------------------------------------------------------- form */

.form {
  max-width: 40rem;
  margin-top: 2.4rem;
}

.field-group {
  margin-bottom: 1.7rem;
}

.field-group > label,
.field-legend {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.855rem;
  font-weight: 550;
  color: var(--ink);
}

.field-hint {
  display: block;
  margin-top: -0.25rem;
  margin-bottom: 0.55rem;
  font-size: 0.83rem;
  color: var(--ink-muted);
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  font: inherit;
  font-size: 0.96rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  transition: border-color var(--step);
}

.textarea {
  min-height: 8.5rem;
  line-height: 1.62;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--ink);
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--alarm);
}

.field-error {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.83rem;
  color: var(--alarm);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

/* Memory type chooser: radios drawn as a segmented field. Still radios
   underneath, so arrow keys and screen readers behave as expected. */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.type-option {
  position: relative;
  display: block;
  padding: 0.78rem 0.9rem;
  background: var(--paper-raised);
  cursor: pointer;
  transition: background var(--step);
}

.type-option:hover {
  background: var(--paper-sunk);
}

.type-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-option-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 550;
}

.type-option-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--ink-muted);
}

.type-option:has(input:checked) {
  background: var(--ink);
}

.type-option:has(input:checked) .type-option-label {
  color: var(--paper);
}

.type-option:has(input:checked) .type-option-hint {
  color: color-mix(in srgb, var(--paper) 70%, transparent);
}

.type-option:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: -2px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin-top: 2.15rem;
  padding-top: 1.55rem;
  border-top: 1px solid var(--rule);
}

/* -------------------------------------------------------------------- verify */

.verdict {
  padding: 1.85rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.verdict-headline {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.72rem);
  font-weight: 600;
  letter-spacing: -0.012em;
  color: var(--verified);
}

.verdict-headline[data-state="failed"] {
  color: var(--alarm);
}

.verdict-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.verdict-note {
  margin-top: 1.05rem;
  max-width: var(--measure);
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--ink-soft);
}

.failure-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1px;
  margin: 1.55rem 0 0;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.failure-fact {
  padding: 0.85rem 1rem;
  background: var(--paper-raised);
}

.failure-fact dt {
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.failure-fact dd {
  margin: 0.28rem 0 0;
  font-family: var(--serif);
  font-size: 1.18rem;
}

.plan {
  margin-top: 1.85rem;
  padding-top: 1.45rem;
  border-top: 1px solid var(--rule);
}

.plan ol {
  margin: 0.85rem 0 0;
  padding-left: 1.3rem;
  max-width: var(--measure);
  font-size: 0.93rem;
  line-height: 1.62;
  color: var(--ink-soft);
}

.plan li {
  margin-bottom: 0.5rem;
}

/* ------------------------------------------------------------------ timeline */

.timeline {
  border-top: 1px solid var(--rule);
}

.timeline-entry {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  padding: 0.9rem 0.85rem;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background var(--step);
}

.timeline-entry:hover {
  background: var(--paper-raised);
}

.timeline-ordinal {
  flex-shrink: 0;
  width: 2rem;
  padding-top: 0.15rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-faint);
}

.timeline-body {
  min-width: 0;
  flex: 1;
}

.timeline-title {
  display: block;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.24rem;
  font-size: 0.79rem;
  color: var(--ink-muted);
}

.timeline-entry[data-trust="corrupted"] .timeline-title,
.timeline-entry[data-trust="untrusted"] .timeline-title,
.timeline-entry[data-trust="missing"] .timeline-title {
  color: var(--ink-muted);
  font-style: italic;
}

.timeline-entry[data-trust="corrupted"] {
  background: var(--alarm-bg);
}

/* -------------------------------------------------------------------- drawer */

/* Above the masthead, which is sticky at z-index 40. Without this the drawer
   and its scrim paint underneath it: the close button sits at the panel's top
   right, exactly where the masthead band is, so the one control that dismisses
   the dialog is covered by it — and the nav stays clickable through the scrim,
   letting a mouse navigate a page the modal says is not currently in use. The
   focus trap already stops Tab from doing that; this stops the pointer. */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(22, 21, 15, 0.32);
  animation: fade var(--step);
}

.drawer {
  position: fixed;
  z-index: 51;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(37rem, 100%);
  overflow-y: auto;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--paper);
  border-left: 1px solid var(--rule-strong);
  box-shadow: -18px 0 48px -24px rgba(22, 21, 15, 0.28);
  animation: slide var(--step);
}

.drawer:focus {
  outline: none;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes slide {
  from {
    transform: translateX(2.5rem);
    opacity: 0;
  }
}

.drawer-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}

.drawer-close:hover {
  color: var(--ink);
  border-color: var(--rule);
}

.drawer-eyebrow {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.55rem;
}

.drawer h2 {
  max-width: 28ch;
}

.drawer-body {
  margin-top: 1.35rem;
  font-size: 1rem;
  line-height: 1.68;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1.2rem;
}

.tag {
  padding: 0.15rem 0.5rem;
  font-size: 0.775rem;
  color: var(--ink-muted);
  background: var(--paper-sunk);
  border-radius: var(--radius);
}

.fields {
  margin: 1.7rem 0 0;
  border-top: 1px solid var(--rule);
}

.field {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 1rem;
  padding: 0.78rem 0;
  border-bottom: 1px solid var(--rule);
}

.field dt {
  font-size: 0.83rem;
  color: var(--ink-muted);
}

.field dd {
  margin: 0;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

/* The proof, available but not shouted. Collapsed by default: hashes are how
   the claim is kept honest, not what the reader came to read. */
.technical {
  margin-top: 1.9rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.05rem;
}

.technical summary {
  font-size: 0.855rem;
  color: var(--ink-muted);
  cursor: pointer;
}

.technical summary:hover {
  color: var(--ink);
}

.technical[open] summary {
  margin-bottom: 1.05rem;
  color: var(--ink);
}

.kv {
  margin: 0;
}

.kv > div {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.8rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--rule);
}

.kv dt {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.755rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.payload {
  margin: 0.7rem 0 0;
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.745rem;
  line-height: 1.6;
  background: var(--paper-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre;
}

.endpoint-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.endpoint-value {
  font-family: var(--mono);
  font-size: 0.765rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

/* -------------------------------------------------------------------- states */

.notice {
  padding: 1.45rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--rule-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.notice h3 {
  font-size: 1.05rem;
}

.notice p {
  margin-top: 0.6rem;
  max-width: var(--measure);
  font-size: 0.93rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.notice-alarm {
  border-left-color: var(--alarm);
  background: var(--alarm-bg);
}

.notice-alarm h3 {
  color: var(--alarm);
}

.empty {
  padding: 3.1rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
}

.empty h3 {
  font-size: 1.2rem;
}

.empty p {
  margin: 0.7rem auto 0;
  max-width: 46ch;
  font-size: 0.93rem;
  line-height: 1.62;
  color: var(--ink-muted);
}

.empty .action-row {
  justify-content: center;
}

.working {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.895rem;
  color: var(--ink-muted);
}

.spinner {
  width: 0.85rem;
  height: 0.85rem;
  border: 1.5px solid var(--rule-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton-row {
  height: 1rem;
  margin-bottom: 1.4rem;
  background: linear-gradient(90deg, var(--paper-sunk), var(--rule), var(--paper-sunk));
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* A saved-memory confirmation, rendered into a live region so it is announced
   rather than being purely visual. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 1.1rem;
  font-size: 0.885rem;
  color: var(--paper);
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px -16px rgba(22, 21, 15, 0.5);
  animation: rise var(--step);
}

.toast button {
  padding: 0;
  font: inherit;
  color: var(--paper);
  background: none;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--paper) 45%, transparent);
  cursor: pointer;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 0.6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------- print */

@media print {
  .masthead,
  .action-row,
  .composer-dock,
  .ask-form,
  .suggestions,
  .toast {
    display: none;
  }
}

/* -------------------------------------------------------------------- mobile */

/* Mobile is laid out for a thumb rather than scaled down from the desktop: the
   nav becomes its own full-width strip under the wordmark, tap targets grow,
   and the two-column grids collapse instead of squeezing. */
@media (max-width: 640px) {
  .masthead-inner {
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-top: 0.6rem;
  }

  .nav {
    order: 3;
    width: 100%;
    margin: 0 -0.4rem;
    padding: 0.15rem 0.4rem 0.5rem;
    gap: 0.15rem;
  }

  .nav a {
    padding: 0.45rem 0.65rem;
    font-size: 0.9rem;
  }

  .settings-button {
    padding: 0.4rem;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
  }

  .settings-button-label {
    display: none;
  }

  /* Touch targets.
   *
   * Two controls here are painted deliberately small and should stay that way:
   * the settings button drops its label just above and becomes a bare status
   * dot, and .link-button is styled as an inline underlined link rather than a
   * box. Their painted size is right; their tappable size was not — the dot
   * measured 21px, under the 24px floor WCAG 2.5.8 sets.
   *
   * The masthead is already 60px tall, so giving the wordmark and the settings
   * button a 40px box costs nothing visually. .link-button cannot take padding
   * without detaching its underline from the text, so it gets an invisible
   * pseudo-element instead: the hit area grows, the ink does not move. */
  .wordmark {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }

  /* The wordmark's dot is decoration; the settings dot is live status. Side by
   * side at desktop width they read differently because the settings dot sits
   * inside a labelled button. On a phone that label is gone, leaving two
   * identical green dots in one bar where only one of them means anything — so
   * the decorative one steps aside and the surviving dot is always the status. */
  .wordmark::after {
    display: none;
  }

  .link-button {
    position: relative;
  }

  .link-button::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 40px;
    transform: translateY(-50%);
  }

  .field,
  .field-row,
  .kv > div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .verdict {
    padding: 1.25rem;
  }

  .drawer {
    width: 100%;
    border-left: 0;
  }

  .hero-actions .button,
  .form-footer .button {
    flex: 1 1 auto;
  }

  .memory-row,
  .project-row,
  .timeline-entry {
    padding-left: 0.15rem;
    padding-right: 0.15rem;
  }

  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Three stats in two columns leave a fourth cell empty, and an empty cell is
     not blank here: the row paints its gaps by showing a --rule background
     through 1px gaps, so the hole renders as a solid beige block that reads as
     a broken tile. The odd one out spans instead. */
  .stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  /* The dock is pinned above the browser chrome on a phone, where vertical
     space is the scarce thing, so it gives some back. */
  .composer-dock {
    padding: 1rem 0 0.85rem;
  }

  .save-project-row {
    align-items: stretch;
    flex-direction: column;
    gap: 0.3rem;
  }

  .save-project-row .select {
    min-width: 0;
  }
}

@media (min-width: 641px) and (max-width: 900px) {
  .type-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
/* Persistent conversation rail. Chat transcripts are working context; verified
   memory remains a separate server-side product surface. */
.workspace { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 64px); }
.chat-sidebar { border-right: 1px solid var(--line, #ddd8cd); padding: 18px 12px; background: #f2efe8; }
.sidebar-brand { padding: 5px 9px 20px; border-bottom: 1px solid var(--rule); }
.sidebar-collapse { float: right; width: 28px; height: 28px; border: 1px solid var(--rule-strong); border-radius: 5px; background: transparent; color: var(--ink-muted); cursor: pointer; font-size: 1.2rem; line-height: 1; }
.sidebar-collapse:hover, .sidebar-collapse:focus-visible { color: var(--ink); background: var(--paper-raised); }
.sidebar-wordmark { display: block; font-family: var(--serif); font-size: 1.2rem; font-weight: 650; text-decoration: none; }
.sidebar-tagline { display: block; margin-top: 1px; color: var(--ink-faint); font-size: .7rem; }
.sidebar-nav { display: grid; gap: 2px; padding: 14px 0; border-bottom: 1px solid var(--rule-strong); }
.sidebar-nav a { padding: 8px 10px; color: var(--ink-muted); font-size: .88rem; text-decoration: none; border-radius: 5px; }
.sidebar-nav a:hover, .sidebar-nav a[aria-current="page"] { color: var(--ink); background: #e5e0d6; }
.sidebar-nav .sidebar-settings { padding: 8px 10px; border-radius: 5px; font-size: .88rem; }
.sidebar-nav .sidebar-settings:hover,
.sidebar-nav .sidebar-settings:focus-visible { color: var(--ink); background: #e5e0d6; }
.sidebar-conversations { padding-top: 14px; }
.sidebar-footer { margin-top: auto; padding: 16px 8px 2px; border-top: 1px solid var(--rule-strong); }
.sidebar-settings { display: flex; align-items: center; gap: .55rem; width: 100%; padding: 8px 2px; color: var(--ink-muted); background: transparent; border: 0; font: inherit; font-size: .84rem; text-align: left; cursor: pointer; }
.sidebar-settings:hover { color: var(--ink); }
.sidebar-collapsed .workspace { grid-template-columns: 64px minmax(0, 1fr); }
.sidebar-collapsed .chat-sidebar { padding-inline: 10px; }
.sidebar-collapsed .sidebar-brand { padding-inline: 4px; text-align: center; }
.sidebar-collapsed .sidebar-wordmark, .sidebar-collapsed .sidebar-tagline, .sidebar-collapsed .sidebar-nav a, .sidebar-collapsed .sidebar-settings span:not(.conn-dot), .sidebar-collapsed .sidebar-conversations { display: none; }
.sidebar-collapsed .sidebar-collapse { float: none; }
.sidebar-collapsed .sidebar-nav { border-bottom: 0; }
@media (prefers-reduced-motion: no-preference) { .workspace { transition: grid-template-columns .2s ease; } .chat-sidebar { transition: padding .2s ease; } }
.new-chat { width: 100%; justify-content: flex-start; min-height: 2.55rem; border-radius: 6px; }
.chat-search { width: 100%; margin-top: 12px; padding: 8px 9px; border: 1px solid transparent; border-bottom-color: var(--rule-strong); background: transparent; color: var(--ink); }
.chat-search:focus { outline: 0; border-color: var(--rule-strong); background: var(--paper-raised); }
.sidebar-label { margin: 24px 8px 8px; color: #716d64; font-size: .75rem; text-transform: uppercase; }
.chat-list { display: grid; gap: 2px; }
.chat-list-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; }
.chat-link { color: inherit; padding: 9px 10px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 6px; }
.chat-link:hover { background: #ebe7df; }
.chat-link[aria-current="page"] { color: var(--ink); background: #e1ddd4; font-weight: 520; }
.chat-actions { position: relative; }
.chat-actions > summary { list-style: none; }
.chat-actions > summary::-webkit-details-marker { display: none; }
.chat-menu { display: grid; place-items: center; border: 0; background: transparent; cursor: pointer; min-width: 32px; min-height: 32px; }
.chat-actions-menu { position: absolute; z-index: 20; right: 0; top: 34px; width: 150px; padding: 5px; border: 1px solid #d5d0c5; background: #fffefa; box-shadow: 0 8px 24px rgb(47 43 35 / 14%); }
.chat-actions-menu button { display: block; width: 100%; border: 0; padding: 8px; background: transparent; text-align: left; cursor: pointer; }
.chat-actions-menu button:hover { background: #eeeae1; }
.chat-rename { box-sizing: border-box; width: 100%; padding: 7px; border: 1px solid #aaa397; background: white; }
.mobile-chats { display: none; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 8px 0; }
@media (max-width: 760px) {
  .sidebar-collapse { display: none; }
  .workspace { display: block; }
  .mobile-chats { display: inline-flex; }
  .chat-sidebar { display: none; position: fixed; z-index: 55; inset: 60px 0 0 0; overflow-y: auto; border-right: 0; }
  .chat-sidebar.is-open { display: block; }
}

/* Chat workspace override: the assistant is the application, not a document
   inside the application. Other views retain the editorial page layout. */
@media (min-width: 761px) {
  .masthead { display: none; }
  .workspace { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100dvh; align-items: start; }
  .chat-sidebar { position: sticky; top: 0; height: 100dvh; min-height: 100dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .sidebar-footer { margin-top: 1.5rem; }
  .main { min-width: 0; min-height: 100dvh; }
}
.workspace { min-height: 100dvh; }
.main:has(> .chat) { padding: 0; }
.chat {
  width: min(100%, 54rem);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}
.chat-intro {
  display: grid;
  place-content: center;
  min-height: 55vh;
  text-align: center;
}
.assistant-kicker { margin-bottom: .6rem; color: var(--verified); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.chat-intro .lede { max-width: 38rem; margin: .9rem auto 0; }
.chat-intro .scope-note, .chat-intro .action-row { justify-content: center; }
.chat-intro[data-compact] { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-height: auto; padding: .85rem 0; align-items: center; gap: 1rem; text-align: left; border-bottom: 1px solid var(--rule); }
.chat-intro[data-compact] .assistant-kicker { display: none; }
.chat-intro[data-compact] h1 { display: none; }
.chat-intro[data-compact] .scope-note, .chat-intro[data-compact] .action-row { margin: 0; justify-content: flex-end; }
.chat-intro[data-compact] .scope-note { justify-self: start; }
.chat-intro[data-compact] .action-row { justify-self: end; }
.composer-dock { margin-top: auto; padding: 1rem 0 1.25rem; }
.ask-form { padding: .8rem .8rem .8rem 1.1rem; border-radius: 8px; box-shadow: 0 8px 30px rgb(35 31 24 / 7%); }
.ask-submit { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0; border-radius: 50%; }
.suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; width: min(100%, 42rem); margin: 1.2rem auto 0; }
.suggestions-label { display: none; }
.suggestion { min-height: 3.15rem; padding: .65rem .8rem; border-radius: 6px; text-align: left; }
.exchange { padding-top: 1.8rem; margin-top: 1.4rem; border-top: 0; }
.question { width: fit-content; max-width: min(85%, 38rem); margin-left: auto; padding: .72rem .95rem; color: var(--ink); background: #eeeae2; border-radius: 8px 8px 2px 8px; font-family: var(--sans); font-size: .98rem; font-weight: 450; line-height: 1.55; }
.question-actions { justify-content: flex-end; }
.answer { margin-top: 1.55rem; }
.icon-action { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; padding: 0; color: var(--ink-faint); background: transparent; border: 0; border-radius: 5px; font: inherit; font-size: .9rem; cursor: pointer; }
.icon-action:hover { color: var(--ink); background: var(--paper-sunk); }
.answer > .turn-actions { gap: .25rem; margin-top: .65rem; padding-top: 0; border-top: 0; opacity: .7; }
.answer > .turn-actions:hover { opacity: 1; }
.answer > p { color: #24221d; }
.working { color: var(--ink-muted); font-size: .92rem; }
@media (max-width: 760px) {
  .chat-sidebar { overscroll-behavior: contain; }
  .chat { min-height: calc(100dvh - 60px); padding: 0 1rem; }
  .chat-intro { min-height: 48vh; }
  .suggestions { grid-template-columns: 1fr; }
  .question { max-width: 92%; }
}
