/* ============================================================
   THEORIA — chat interface stylesheet (reference implementation)
   Direction A "Inscription": bone-white on warm black, no colour.
   Pair with conversation.html / welcome.html. See ../DESIGN-HANDOFF.md.
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  /* Surfaces (warm blacks) */
  --ink-0: #0c0b0a;   /* page, main column */
  --ink-1: #100f0e;   /* sidebar, composer, plate interiors */
  --ink-2: #161513;   /* user message plate */

  /* Text (bone whites) */
  --bone-bright: #f2eee6;  /* user text, scripture, h1 */
  --bone:        #e6e1d6;  /* default text, marks, primary fills */
  --bone-dim:    #bdb7ab;  /* inactive archive rows, chips, badge */
  --bone-muted:  #8f8a80;  /* labels, hint text, footers */
  --bone-faint:  #6f6a62;  /* placeholder, untitled */

  /* Rules (bone at alpha) */
  --line-12: rgba(230,225,214,0.12);
  --line-14: rgba(230,225,214,0.14);
  --line-18: rgba(230,225,214,0.18);
  --line-22: rgba(230,225,214,0.22);
  --line-28: rgba(230,225,214,0.28);
  --line-30: rgba(230,225,214,0.30);
  --line-35: rgba(230,225,214,0.35);
  --line-55: rgba(230,225,214,0.55);
  --wash-05: rgba(230,225,214,0.05);
  --wash-08: rgba(230,225,214,0.08);

  /* Type */
  --font-display: 'Marcellus', 'Trajan Pro', Georgia, serif;
  --font-body: 'Spectral', Georgia, 'Times New Roman', serif;

  /* Layout */
  --sidebar-w: 296px;
  --column-w: 760px;
  --header-h: 60px;
  --chamfer: 10px;
  --control: 44px;
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink-0);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--bone); text-decoration: underline; text-decoration-color: var(--line-35); text-underline-offset: 3px; }
a:hover { color: #fff; text-decoration-color: #fff; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
p { margin: 0; }
svg { display: block; }
:focus-visible { outline: 1px solid var(--bone); outline-offset: 2px; }
.t-composer__input:focus-visible { outline: none; }
.t-composer .plate:focus-within { background: var(--line-55); }
/* Scrollbars: thin, bone-on-black */
.t-messages, .t-archive, .t-composer__input { scrollbar-width: thin; scrollbar-color: var(--line-22) transparent; }
.t-messages::-webkit-scrollbar, .t-archive::-webkit-scrollbar, .t-composer__input::-webkit-scrollbar { width: 8px; }
.t-messages::-webkit-scrollbar-thumb, .t-archive::-webkit-scrollbar-thumb, .t-composer__input::-webkit-scrollbar-thumb { background: var(--line-22); }
.t-messages::-webkit-scrollbar-track, .t-archive::-webkit-scrollbar-track, .t-composer__input::-webkit-scrollbar-track { background: transparent; }

/* Small-caps inscription label — every section label, tool name, chip */
.t-label {
  font-family: var(--font-display);
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bone-muted);
}

/* ---------- 3. Ornament ---------- */
/* Film grain: place as the last child of any position:relative surface */
.grain {
  pointer-events: none; position: absolute; inset: 0; opacity: 0.07; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.9 0 0 0 0 0.88 0 0 0 0 0.84 0 0 0 0.55 0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
}
/* Greek-key meander strip, 12px tall, repeats horizontally */
.meander {
  height: 12px; opacity: 0.32; background-repeat: repeat-x; background-position: center;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'><path d='M0 10.5H2.5V1.5H13.5V8.5H6.5V4.5H10.5M13.5 8.5V10.5H16' fill='none' stroke='%23e6e1d6' stroke-width='1'/></svg>");
}
/* Chamfered plate: 1px bone border with two bevelled corners (top-left, bottom-right).
   Two nested boxes because clip-path removes borders on the diagonal. */
.plate {
  display: flex; padding: 1px; background: var(--line-30);
  clip-path: polygon(var(--chamfer) 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%, 0 var(--chamfer));
}
.plate__in {
  flex-grow: 1; min-width: 0; background: var(--ink-0);
  clip-path: polygon(calc(var(--chamfer) - 1px) 0, 100% 0, 100% calc(100% - var(--chamfer) + 1px), calc(100% - var(--chamfer) + 1px) 100%, 0 100%, 0 calc(var(--chamfer) - 1px));
}

/* ---------- 4. App shell ---------- */
.t-app {
  position: relative; display: flex; width: 100%; height: 100dvh; min-height: 640px;
  background: var(--ink-0); overflow: hidden;
}

/* ---------- 5. Sidebar: the archive of inquiries ---------- */
.t-sidebar {
  position: relative; width: var(--sidebar-w); flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--ink-1); border-right: 1px solid var(--line-12);
}
.t-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 24px 18px; }
.t-brand__mark { width: 22px; height: 30px; color: var(--bone); }
.t-brand__name {
  font-family: var(--font-display); font-size: 22px; line-height: 1;
  letter-spacing: 0.32em; text-indent: 0.32em; color: var(--bone);
}
.t-motto { display: flex; align-items: center; gap: 10px; width: 100%; }
.t-motto::before, .t-motto::after { content: ""; flex-grow: 1; height: 1px; background: var(--line-18); }
.t-motto span {
  font-family: var(--font-display); font-size: 10.5px; letter-spacing: 0.34em; text-indent: 0.34em;
  color: var(--bone-dim); white-space: nowrap;
}
.t-brand__tagline { font-size: 12.5px; font-style: italic; color: var(--bone-muted); letter-spacing: 0.02em; }
.t-sidebar .meander { margin: 0 20px; }

/* "New inquiry" — a pennon (swallow-tailed banner) */
.pennon-wrap { padding: 18px 20px 8px; }
.pennon {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: var(--control); padding-right: 12px;
  background: var(--bone); color: var(--ink-0);
  font-family: var(--font-display); font-size: 12.5px; letter-spacing: 0.22em; text-indent: 0.22em; text-transform: uppercase;
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%);
}
.pennon:hover { background: #fff; }
.pennon svg { width: 14px; height: 14px; }

.t-archive { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 8px 12px 12px; }
.t-archive ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.t-archive__heading { display: flex; align-items: center; gap: 10px; padding: 6px 8px 8px; }
.t-archive__heading::before, .t-archive__heading::after { content: ""; flex-grow: 1; height: 1px; background: var(--line-14); }
.t-archive__row {
  display: flex; align-items: center; width: 100%; min-height: var(--control); padding: 0 12px;
  border-left: 2px solid transparent; text-align: left;
  font-size: 14.5px; color: var(--bone-dim);
}
.t-archive__row span { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-archive__row:hover { background: var(--wash-05); }
.t-archive__row.is-active { background: var(--wash-08); border-left-color: var(--bone); color: var(--bone-bright); padding-left: 10px; }

.t-account { display: flex; align-items: center; gap: 12px; padding: 16px 20px 20px; border-top: 1px solid var(--line-12); }
.t-account__seal {
  width: 34px; height: 34px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-35); font-family: var(--font-display); font-size: 13px; color: var(--bone);
}
.t-account__name { font-size: 13.5px; color: var(--bone); }
.t-account__anchor { font-size: 11.5px; font-style: italic; color: var(--bone-muted); }

/* ---------- 6. Main column ---------- */
.t-main { position: relative; flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }
.t-watermark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 620px; height: 620px; opacity: 0.035; color: var(--bone); pointer-events: none;
}
.t-header {
  position: relative; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h); padding: 0 28px; border-bottom: 1px solid var(--line-12);
}
.t-main > .meander, .t-composer, .t-sidebar > .meander, .t-brand, .pennon-wrap, .t-account { flex-shrink: 0; }
.t-messages, .t-archive { min-height: 0; }
.t-header__lead { display: flex; align-items: center; gap: 12px; }
.t-header__sep { width: 1px; height: 16px; background: rgba(230,225,214,0.2); }
.t-header__title { font-family: var(--font-display); font-size: 16px; letter-spacing: 0.04em; color: var(--bone); }
.t-header__title.is-untitled { color: var(--bone-faint); }
.t-header__actions { display: flex; align-items: center; gap: 10px; }
.t-main > .meander { margin: 0 28px; }

/* Stance badge: a small plate with the labarum */
.t-badge { height: 32px; }
.t-badge .plate__in {
  display: flex; align-items: center; gap: 8px; padding: 0 14px;
  font-family: var(--font-display); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--bone-dim);
}
.t-badge svg { width: 13px; height: 13px; }

.icon-btn {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border: 1px solid var(--line-22); color: var(--bone-dim);
}
.icon-btn:hover { border-color: var(--line-55); color: #fff; }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- 7. Messages ---------- */
.t-messages {
  position: relative; flex-grow: 1; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; align-items: center; padding: 36px 40px 6px;
}
.t-column { width: 100%; max-width: var(--column-w); display: flex; flex-direction: column; gap: 34px; margin-top: auto; }
/* Fade under the header so scrolled-away turns dissolve rather than cut */
.t-messages-fade {
  position: absolute; left: var(--sidebar-w); right: 0; top: calc(var(--header-h) + 12px); height: 72px;
  background: linear-gradient(to bottom, var(--ink-0), rgba(12,11,10,0)); pointer-events: none;
}

@keyframes t-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg { animation: t-rise 0.5s ease-out both; }

/* User turn: a chamfered plate, right-aligned */
.msg--user { display: flex; justify-content: flex-end; }
.msg--user .plate { max-width: 560px; }
.msg--user .plate__in { display: flex; flex-direction: column; gap: 8px; padding: 16px 20px 18px; background: var(--ink-2); }
.msg--user .t-text { color: var(--bone-bright); }

/* Assistant turn: seal + content */
.msg--assistant { display: flex; gap: 18px; align-items: flex-start; }
.t-seal { flex-shrink: 0; width: 36px; height: 36px; }
.t-seal .plate__in { display: flex; align-items: center; justify-content: center; color: var(--bone); }
.t-seal svg { width: 22px; height: 22px; }
.msg__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* "Consulted" row — one .t-tool per MCP call */
.t-consulted { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.t-consulted .t-label { margin-right: 4px; }
.t-tool {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border: 1px solid var(--line-18); font-size: 12.5px; color: var(--bone-dim);
}
.t-tool__name { font-family: var(--font-display); font-size: 10px; letter-spacing: 0.1em; color: var(--bone-muted); }

.t-prose { font-size: 16.5px; line-height: 1.65; color: var(--bone); text-wrap: pretty; }
.t-prose em { font-style: italic; }

/* Scripture inset: quotation between two rules */
.t-scripture { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px; border-top: 1px solid var(--line-28); border-bottom: 1px solid var(--line-28); }
.t-scripture__text { font-size: 17px; line-height: 1.6; font-style: italic; color: var(--bone-bright); text-wrap: pretty; }
.t-scripture__ref { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--bone-muted); }

/* Citation chips */
.t-cites { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.chip {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px;
  border: 1px solid var(--line-28); text-decoration: none;
  font-family: var(--font-display); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-dim);
}
.chip:hover { border-color: var(--line-55); color: #fff; }

.t-stance { font-size: 13.5px; line-height: 1.5; font-style: italic; color: var(--bone-muted); }

/* Streaming caret */
@keyframes t-blink { 0%, 45% { opacity: 1; } 50%, 100% { opacity: 0; } }
.caret { display: inline-block; width: 2px; height: 1em; background: var(--bone); vertical-align: -0.15em; margin-left: 2px; animation: t-blink 1.1s steps(1) infinite; }

/* ---------- 8. Composer ---------- */
.t-composer { position: relative; display: flex; flex-direction: column; align-items: center; padding: 14px 40px 26px; }
.t-composer > .plate { width: 100%; max-width: var(--column-w); }
.t-composer .plate__in { display: flex; flex-direction: column; background: var(--ink-1); }
.t-composer__input {
  width: 100%; min-height: 52px; max-height: 240px; padding: 18px 20px 12px; resize: none;
  background: transparent; border: 0; outline: none; color: var(--bone-bright);
  font: inherit; font-size: 16.5px; line-height: 1.5;
}
.t-composer__input::placeholder { color: var(--bone-faint); font-style: italic; }
.t-composer__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 0 12px 12px 20px; }
.t-composer__hint { display: flex; align-items: flex-start; gap: 10px; padding-bottom: 4px; }
.t-composer__hint svg { flex-shrink: 0; width: 14px; height: 14px; margin-top: 2px; color: var(--bone-muted); }
.t-composer__hint p { font-size: 12.5px; line-height: 1.5; font-style: italic; color: var(--bone-muted); max-width: 600px; text-wrap: pretty; }
.send {
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  width: var(--control); height: var(--control); background: var(--bone); color: var(--ink-0);
}
.send:hover { background: #fff; }
.send:disabled { opacity: 0.35; cursor: default; }
.send svg { width: 18px; height: 18px; }

/* ---------- 9. Empty state (welcome.html) ---------- */
.t-rays {
  position: absolute; left: 50%; top: 330px; width: 900px; height: 900px; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg, rgba(230,225,214,0.035) 0deg 2deg, rgba(230,225,214,0) 2deg 15deg);
  -webkit-mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,0) 62%);
  mask-image: radial-gradient(circle, #000 0%, rgba(0,0,0,0) 62%);
  pointer-events: none;
}
.t-hero { position: relative; flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 36px; padding: 0 40px 24px; }
.t-hero__standard { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.t-roundel {
  width: 132px; height: 132px; display: flex; align-items: center; justify-content: center; color: var(--bone);
  border: 1px solid var(--line-28); border-radius: 50%;
  box-shadow: inset 0 0 0 6px var(--ink-0), inset 0 0 0 7px var(--line-18);
}
.t-roundel svg { width: 60px; height: 60px; }
.t-hero__copy { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.t-hero h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 30px; letter-spacing: 0.06em; color: var(--bone-bright); text-align: center; text-wrap: balance; }
.t-hero__sub { font-size: 16px; font-style: italic; color: var(--bone-muted); text-align: center; max-width: 560px; line-height: 1.5; text-wrap: pretty; }
.t-suggest { width: 100%; max-width: 860px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card { text-align: left; }
.card .plate__in { display: flex; flex-direction: column; gap: 10px; min-height: 118px; padding: 18px 20px; }
.card:hover { background: rgba(230,225,214,0.5); }
.card:hover .plate__in { background: var(--ink-2); }
.card__q { font-size: 15.5px; line-height: 1.5; color: var(--bone); text-wrap: pretty; }
.rise   { animation: t-rise 0.7s ease-out both; }
.rise-2 { animation: t-rise 0.7s ease-out 0.15s both; }
.rise-3 { animation: t-rise 0.7s ease-out 0.30s both; }

/* ---------- 10. Responsive ---------- */
@media (max-width: 1100px) {
  .t-suggest { grid-template-columns: repeat(1, minmax(0, 1fr)); max-width: 560px; }
  .card .plate__in { min-height: 0; }
}
@media (max-width: 900px) {
  .t-sidebar { display: none; }            /* wire a drawer toggle here */
  .t-messages-fade { left: 0; }
  .t-messages, .t-composer, .t-hero { padding-left: 20px; padding-right: 20px; }
  .t-header { padding: 0 20px; }
  .t-main > .meander { margin: 0 20px; }
  .t-composer__hint p { display: none; }   /* keep the labarum, drop the sentence */
  .t-watermark { width: 420px; height: 420px; }
}
@media (prefers-reduced-motion: reduce) {
  .msg, .rise, .rise-2, .rise-3 { animation: none; }
  .caret { animation: none; }
}


/* ============================================================
   11. APP APPENDIX (chat/static) — everything above is the approved
   reference stylesheet, verbatim. Only what the wired behaviours need
   is added here; no new colour, no new radii.
   ============================================================ */

/* --- One page, two states: .t-app[data-state="welcome" | "conversation"] --- */
.t-app[data-state="welcome"] .t-messages,
.t-app[data-state="welcome"] .t-messages-fade,
.t-app[data-state="welcome"] .t-watermark,
.t-app[data-state="welcome"] .t-export { display: none; }
.t-app[data-state="conversation"] .t-hero,
.t-app[data-state="conversation"] .t-rays { display: none; }

/* The hero must be allowed to scroll on short viewports; auto margins give
   the same centring as justify-content:center without clipping the top. */
.t-hero { min-height: 0; overflow-y: auto; justify-content: flex-start; }
.t-hero__standard { margin-top: auto; }
.t-suggest { margin-bottom: auto; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Header: drawer toggle (only under 900px) --- */
.t-drawer-toggle { display: none; margin-right: 4px; }
.t-drawer-toggle svg { width: 20px; height: 20px; }

/* --- Account line wraps the full anchor sentence --- */
.t-account__text { min-width: 0; }
.t-account__anchor { line-height: 1.35; }

/* --- Archive rows: untitled, hover-revealed rename/delete, inline edit --- */
.t-archive__row .is-untitled { color: var(--bone-faint); font-style: italic; }
.t-archive__item { position: relative; }
.t-archive__item:hover .t-archive__row { background: var(--wash-05); }
.t-archive__tools { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: none; align-items: center; gap: 4px; }
.t-archive__item:hover .t-archive__tools,
.t-archive__item:focus-within .t-archive__tools { display: flex; }
.t-archive__item:hover .t-archive__row,
.t-archive__item:focus-within .t-archive__row { padding-right: 72px; }
.row-btn {
  display: flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border: 1px solid var(--line-22); color: var(--bone-dim); background: var(--ink-1);
}
.row-btn:hover { border-color: var(--line-55); color: #fff; }
.row-btn svg { width: 14px; height: 14px; }
.t-archive__edit {
  display: none; width: 100%; min-height: var(--control); padding: 0 12px;
  border: 0; border-left: 2px solid var(--bone); background: var(--wash-08);
  color: var(--bone-bright); font: inherit; font-size: 14.5px; outline: none;
}
.t-archive__item.is-editing .t-archive__row,
.t-archive__item.is-editing .t-archive__tools { display: none; }
.t-archive__item.is-editing .t-archive__edit { display: block; }
.t-archive__confirm { display: none; align-items: center; gap: 6px; min-height: var(--control); padding: 0 6px 0 12px; }
.t-archive__confirm .t-label { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-archive__item.is-confirming .t-archive__row,
.t-archive__item.is-confirming .t-archive__tools { display: none; }
.t-archive__item.is-confirming .t-archive__confirm { display: flex; }
.t-archive__empty { padding: 6px 12px; font-size: 13px; font-style: italic; color: var(--bone-faint); }

/* --- Messages: rendered markdown inside an assistant turn --- */
.t-prose-seg { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.t-prose-seg > .t-label { margin-top: 4px; }
ul.t-prose, ol.t-prose { margin: 0; padding-left: 1.4em; }
.t-prose li { margin: 4px 0; padding-left: 0.2em; }
.t-prose li::marker { color: var(--bone-muted); }
.t-prose strong { font-weight: 500; color: var(--bone-bright); }
.t-prose code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 0.88em; padding: 0 5px; border: 1px solid var(--line-18); color: var(--bone-bright); }
.t-prose.t-quote { padding-left: 18px; border-left: 1px solid var(--line-28); font-style: italic; color: var(--bone-dim); }
.t-tool.is-done { border-color: var(--line-28); }

/* --- Error plate: bone rule + italic muted line, no colour --- */
.t-error.plate { background: var(--line-55); width: 100%; }
.t-error .plate__in { padding: 14px 18px; }
.t-error p { font-size: 14.5px; line-height: 1.5; font-style: italic; color: var(--bone-muted); }
.t-notice { flex-shrink: 0; display: flex; justify-content: center; padding: 8px 40px 0; }
.t-notice:empty { display: none; }
.t-notice .plate { max-width: var(--column-w); }

/* --- Cited-source panel --- */
.t-source {
  position: absolute; top: 0; right: 0; bottom: 0; z-index: 6; width: min(440px, 100%);
  display: flex; flex-direction: column; background: var(--ink-1); border-left: 1px solid var(--line-12);
  transform: translateX(100%); visibility: hidden;
  transition: transform 0.25s ease-out, visibility 0s linear 0.25s;
}
.t-source.is-open { transform: none; visibility: visible; transition: transform 0.25s ease-out, visibility 0s; }
.t-source__head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; height: var(--header-h); padding: 0 20px 0 24px; border-bottom: 1px solid var(--line-12); }
.t-source__body { flex-grow: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 24px; scrollbar-width: thin; scrollbar-color: var(--line-22) transparent; }
.t-source__title { font-family: var(--font-display); font-size: 17px; letter-spacing: 0.04em; line-height: 1.3; color: var(--bone-bright); }
.t-source__work { font-size: 13.5px; font-style: italic; color: var(--bone-muted); }
.t-source__work:empty { display: none; }
.t-source__text { font-size: 15.5px; line-height: 1.65; color: var(--bone); white-space: pre-wrap; text-wrap: pretty; }
.t-source__text.is-pending { font-style: italic; color: var(--bone-muted); }
.t-source__ref { padding-top: 6px; border-top: 1px solid var(--line-14); }
.t-source__ref:empty { display: none; }

/* --- Drawer scrim --- */
.t-scrim { display: none; position: absolute; inset: 0; z-index: 4; background: rgba(12,11,10,0.6); }

/* --- Responsive: stacked suggestion cards become compact rows so the hero
       still fits a laptop-height viewport (reference stacks them at <=1100px) --- */
@media (max-width: 1100px) {
  .t-hero { gap: 24px; padding-bottom: 12px; }
  .t-roundel { width: 108px; height: 108px; }
  .t-roundel svg { width: 50px; height: 50px; }
  .t-hero h1 { font-size: 26px; }
  .t-suggest { gap: 10px; }
  .card .plate__in { flex-direction: row; align-items: baseline; gap: 16px; padding: 12px 18px; }
  .card .t-label { flex-shrink: 0; width: 128px; }
  .card__q { font-size: 15px; }
}
@media (max-width: 600px) {
  .card .plate__in { flex-direction: column; gap: 8px; }
  .card .t-label { width: auto; }
}

/* --- Responsive: the sidebar becomes a drawer under 900px --- */
@media (max-width: 900px) {
  .t-app { min-height: 0; }
  .t-drawer-toggle { display: flex; }
  .t-sidebar {
    display: flex; position: absolute; top: 0; bottom: 0; left: 0; z-index: 5;
    width: min(var(--sidebar-w), 86vw); transform: translateX(-100%);
    transition: transform 0.25s ease-out;
  }
  .t-app.is-drawer-open .t-sidebar { transform: none; box-shadow: 12px 0 40px rgba(0,0,0,0.5); }
  .t-app.is-drawer-open .t-scrim { display: block; }
  .t-header__title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .t-header__lead { min-width: 0; }
  .t-badge .plate__in span { display: none; }   /* keep the labarum, drop the word */
  .t-badge .plate__in { padding: 0 10px; }
  .t-hero { gap: 26px; padding-bottom: 16px; }
  .t-roundel { width: 96px; height: 96px; }
  .t-roundel svg { width: 44px; height: 44px; }
  .t-hero h1 { font-size: 24px; }
  .t-hero__sub { font-size: 15px; }
  .t-notice { padding-left: 20px; padding-right: 20px; }
  .msg--user .plate { max-width: 100%; }
  .msg--assistant { gap: 12px; }
}
@media (max-height: 640px) {
  .t-app { min-height: 0; }
  .t-hero { gap: 22px; }
  .t-roundel { width: 96px; height: 96px; }
  .t-roundel svg { width: 44px; height: 44px; }
  .t-rays { top: 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .t-sidebar, .t-source { transition: none; }
}
