/* ============================================================
   Foundry Revenue portal — shared styles

   No raw hex, no px font-size, no font name in this file. Every
   value comes from tokens.css. That rule is what keeps a rebrand
   an edit to one file rather than a hunt through the portal.
   ============================================================ */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface-canvas);
  color: var(--color-press-black);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  font-weight: var(--font-weight-light);
  line-height: var(--leading-prose);
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------- skip link */
.skip {
  position: absolute; left: -9999px;
  background: var(--color-press-black); color: var(--color-bone-white);
  padding: var(--spacing-10) var(--spacing-20); border-radius: var(--radius-buttons);
}
.skip:focus { left: var(--spacing-10); top: var(--spacing-10); z-index: 100; }

/* -------------------------------------------------------- wordmark */
/* The lockup, matching the marketing site. The width/height on the tag are the
   DISPLAY size, not the artwork's native 515x148: those attributes are what a
   browser falls back to when this stylesheet has not arrived, and the native
   numbers put a 515px logo across the top of the page. */
.wordmark { display: block; line-height: 0; text-decoration: none; }
.wordmark img {
  display: block;
  height: clamp(24px, 2.8vw, 30px);
  width: auto;
}

/* ------------------------------------------------- the auth pages
   One card, centred, nothing else on the page. A sign-in screen with
   a navigation bar invites a client to wander off before they are in. */
.auth-wrap {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: var(--spacing-25) var(--gutter) var(--spacing-40);
  gap: var(--spacing-30);
}
.auth-head { display: flex; justify-content: space-between; align-items: center; }
.auth-main { display: grid; place-items: center; }

.card {
  width: 100%;
  max-width: 27rem;
  background: var(--surface-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-images);
  box-shadow: var(--shadow-card);
  padding: var(--spacing-40) var(--spacing-30);
}
@media (min-width: 30rem) { .card { padding: var(--spacing-50) var(--spacing-40); } }

.eyebrow {
  display: block;
  font-size: var(--text-caption);
  font-weight: var(--font-weight-w550);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-newsprint-gray);
  margin-bottom: var(--spacing-10);
}

h1 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-title);
  letter-spacing: var(--tracking-mid);
  line-height: 1.05;
  margin: 0 0 var(--spacing-15);
}
h2 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-section);
  letter-spacing: var(--tracking-mid);
  line-height: 1.1;
  margin: 0 0 var(--spacing-15);
}

.lede { color: var(--color-newsprint-gray); margin: 0 0 var(--spacing-25); }
p { margin: 0 0 var(--spacing-20); }
p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------- forms */
.field { margin-bottom: var(--spacing-20); }
label {
  display: block;
  font-size: var(--text-label);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--tracking-caption);
  color: var(--color-slate-verdant);
  margin-bottom: var(--spacing-8);
}
.hint {
  display: block;
  font-size: var(--text-body-sm);
  font-weight: var(--font-weight-light);
  color: var(--color-newsprint-gray);
  margin-top: var(--spacing-8);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], textarea, select {
  width: 100%;
  font: inherit;
  font-size: var(--text-body-sm);
  color: var(--color-press-black);
  background: var(--surface-canvas);
  border: 1px solid var(--rule-firm);
  border-radius: var(--radius-buttons);
  padding: var(--spacing-10) var(--spacing-15);
  min-height: 2.75rem;
}
textarea { min-height: 5rem; resize: vertical; line-height: var(--leading-prose); }
select { appearance: none; background-image: none; }

input:focus-visible, textarea:focus-visible, select:focus-visible,
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--color-accent-edge);
  outline-offset: 2px;
}

/* --------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--spacing-8);
  font: inherit;
  font-size: var(--text-body-sm);
  font-weight: var(--font-weight-w550);
  letter-spacing: var(--tracking-caption);
  border-radius: var(--radius-buttons);
  padding: var(--spacing-10) var(--spacing-25);
  min-height: 2.75rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary {
  background: var(--color-press-black);
  color: var(--color-bone-white);
  border-color: var(--color-press-black);
}
.btn-primary:hover { background: var(--color-slate-verdant); border-color: var(--color-slate-verdant); }
.btn-accent {
  background: var(--color-highlighter-green);
  color: var(--color-accent-ink);
  border-color: var(--color-highlighter-green);
}
.btn-accent:hover { background: var(--color-accent-press); border-color: var(--color-accent-press); }
.btn-quiet {
  background: transparent;
  color: var(--color-press-black);
  border-color: var(--rule-firm);
}
.btn-quiet:hover { border-color: var(--color-press-black); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ----------------------------------------------------------- links */
a { color: var(--color-accent-edge); }
a:hover { color: var(--color-press-black); }
.link-quiet { color: var(--color-newsprint-gray); text-decoration: none; }
.link-quiet:hover { color: var(--color-press-black); text-decoration: underline; }

/* -------------------------------------------------------- messages
   A form that fails silently is a form that gets filled in twice. */
.msg {
  border-radius: var(--radius-buttons);
  padding: var(--spacing-10) var(--spacing-15);
  font-size: var(--text-body-sm);
  margin-bottom: var(--spacing-20);
  display: none;
}
.msg.on { display: block; }
.msg-bad  { background: var(--color-halt-bg); color: var(--color-halt);
            border: 1px solid color-mix(in srgb, var(--color-halt) 25%, transparent); }
.msg-good { background: var(--color-echo-green); color: var(--color-accent-ink);
            border: 1px solid var(--color-shadow-moss); }

/* --------------------------------------------------------- footers */
.auth-foot {
  text-align: center;
  font-size: var(--text-body-sm);
  color: var(--color-newsprint-gray);
}

/* ---------------------------------------------------- signed-in UI */
.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--spacing-20);
  padding: var(--spacing-20) var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-raised);
}
.bar-right { display: flex; align-items: center; gap: var(--spacing-20); }
.whoami { font-size: var(--text-body-sm); color: var(--color-newsprint-gray); }

.page { max-width: var(--page-max-width); margin: 0 auto; padding: var(--spacing-50) var(--gutter) var(--spacing-60); }

.thesis {
  background: var(--surface-sunken);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--color-highlighter-green);
  border-radius: var(--radius-buttons);
  padding: var(--spacing-25) var(--spacing-30);
  margin: var(--spacing-30) 0;
}
.thesis .eyebrow { margin-bottom: var(--spacing-4); }
.thesis .figure {
  font-family: var(--font-display);
  font-size: var(--text-section);
  letter-spacing: var(--tracking-mid);
  line-height: 1.15;
}

.stack { display: grid; gap: var(--spacing-15); }

/* ---------------------------------------------------------- states */
.loading { color: var(--color-newsprint-gray); font-size: var(--text-body-sm); }
[hidden] { display: none !important; }

/* ============================================================
   The client's home
   ============================================================ */

/* ---- the apex ----
   The revenue thesis is the top of the pyramid: the number everything
   underneath is built toward. It gets the most weight on the page, on
   purpose, so a client cannot open this and forget what it is for. */
.apex {
  background: var(--color-press-black);
  color: var(--color-bone-white);
  border-radius: var(--radius-images);
  padding: var(--spacing-40) var(--spacing-30);
  margin-bottom: var(--spacing-50);
}
@media (min-width: 40rem) { .apex { padding: var(--spacing-50); } }

.apex .eyebrow { color: var(--color-shadow-moss); margin-bottom: var(--spacing-15); }
.apex-figure {
  font-family: var(--font-display);
  font-weight: var(--font-weight-regular);
  font-size: clamp(2.25rem, 7vw, 4rem);
  line-height: 1.02;
  letter-spacing: var(--tracking-tight);
  margin: 0;
}
.apex-figure .mark { border-bottom: 3px solid var(--color-highlighter-green); padding-bottom: 2px; }
.apex-plan {
  margin: var(--spacing-30) 0 0;
  padding-top: var(--spacing-25);
  border-top: 1px solid rgba(250, 255, 250, 0.18);
  display: grid;
  gap: var(--spacing-8);
}
.apex-plan-name {
  font-weight: var(--font-weight-w550);
  font-size: var(--text-body);
  letter-spacing: var(--tracking-caption);
}
.apex-plan-blurb { color: var(--color-muted-sage); font-size: var(--text-body-sm); margin: 0; }
.apex-empty { color: var(--color-muted-sage); font-size: var(--text-body-sm); margin: 0; }

/* ---- section headings ---- */
.section { margin-bottom: var(--spacing-50); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--spacing-20); flex-wrap: wrap;
  margin-bottom: var(--spacing-20);
}
.section-head h2 { margin: 0; }
.section-note { font-size: var(--text-body-sm); color: var(--color-newsprint-gray); }

/* ---- progress ----
   A line, not a dashboard. It answers "how far in am I" and stops. */
.progress-track {
  height: 4px; border-radius: var(--radius-round);
  background: var(--color-muted-sage); overflow: hidden; margin-top: var(--spacing-10);
}
.progress-fill {
  height: 100%; background: var(--color-highlighter-green);
  border-radius: var(--radius-round); transition: width .4s ease;
}

/* ---- tasks ---- */
.task {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--spacing-20);
  align-items: start;
  background: var(--surface-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius-images);
  padding: var(--spacing-25);
}
@media (min-width: 40rem) { .task { padding: var(--spacing-30); } }
.task + .task { margin-top: var(--spacing-15); }

.task-n {
  font-family: var(--font-display);
  font-size: 1.75rem;
  line-height: 1;
  color: var(--color-shadow-moss);
  min-width: 1.4em;
}
.task h3 {
  margin: 0 0 var(--spacing-8);
  font-family: var(--font-display);
  font-weight: var(--font-weight-regular);
  font-size: 1.5rem;
  letter-spacing: var(--tracking-mid);
  line-height: 1.15;
}
.task p { margin: 0 0 var(--spacing-20); color: var(--color-newsprint-gray); font-size: var(--text-body-sm); }
.task-foot { display: flex; align-items: center; gap: var(--spacing-15); flex-wrap: wrap; }

.chip {
  display: inline-flex; align-items: center; gap: var(--spacing-8);
  font-size: var(--text-caption);
  font-weight: var(--font-weight-w550);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: var(--spacing-4) var(--spacing-10);
  border-radius: var(--radius-pills);
  border: 1px solid var(--rule-firm);
  color: var(--color-newsprint-gray);
  background: var(--surface-sunken);
}
.chip::before {
  content: ""; width: 6px; height: 6px; border-radius: var(--radius-round);
  background: var(--color-muted-sage);
}
.chip-in_progress { color: var(--color-accent-ink); border-color: var(--color-shadow-moss); background: var(--color-echo-green); }
.chip-in_progress::before { background: var(--color-accent-edge); }
.chip-submitted { color: var(--color-accent-ink); border-color: var(--color-shadow-moss); background: var(--color-echo-green); }
.chip-submitted::before { background: var(--color-highlighter-green); }
.chip-reviewed { color: var(--color-bone-white); background: var(--color-press-black); border-color: var(--color-press-black); }
.chip-reviewed::before { background: var(--color-highlighter-green); }

/* ---- documents ---- */
.doc {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--spacing-20); flex-wrap: wrap;
  padding: var(--spacing-20) 0;
  border-bottom: 1px solid var(--rule);
}
.doc:first-child { border-top: 1px solid var(--rule); }
.doc-title { font-weight: var(--font-weight-medium); }
.doc-meta { font-size: var(--text-body-sm); color: var(--color-newsprint-gray); }

/* ---- empty states ----
   An empty section should say what will fill it and who fills it. A blank
   space makes a client wonder whether something is broken. */
.empty {
  border: 1px dashed var(--rule-firm);
  border-radius: var(--radius-images);
  padding: var(--spacing-30);
  color: var(--color-newsprint-gray);
  font-size: var(--text-body-sm);
}

/* ---- account ---- */
.account {
  border-top: 1px solid var(--rule);
  padding-top: var(--spacing-30);
  margin-top: var(--spacing-60);
}
.account-row {
  display: flex; align-items: flex-end; gap: var(--spacing-15); flex-wrap: wrap;
}
.account-row .field { margin-bottom: 0; flex: 1 1 14rem; }

/* ============================================================
   Narrow screens
   ------------------------------------------------------------
   The bar is the one thing here that cannot simply reflow: it
   holds a name, a business, and up to three controls, and on a
   phone that is more than a line will take. So the identity
   text steps aside — it is repeated at the top of the page
   anyway — and the controls stay, because they are the part
   you cannot get to another way.
   ============================================================ */

@media (max-width: 34rem) {
  .bar {
    flex-wrap: wrap;
    gap: var(--spacing-10);
    padding: var(--spacing-15) var(--gutter);
  }
  .bar-right { gap: var(--spacing-10); }
  .whoami { display: none; }
  .btn { padding: var(--spacing-8) var(--spacing-15); }

  .task { grid-template-columns: 1fr; gap: var(--spacing-8); }
  .task-n { font-size: 1.25rem; }

  .doc { align-items: flex-start; }

  .section-head { gap: var(--spacing-8); }
}

/* Long words in a client's own text — a business name, a thesis — must not be
   what pushes a phone into sideways scrolling. */
.apex-figure, .task h3, .doc-title, .whoami, h1 { overflow-wrap: break-word; }

/* ============================================================
   The admin side
   ============================================================ */

.queue {
  background: var(--surface-raised);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--color-highlighter-green);
  border-radius: var(--radius-images);
  padding: var(--spacing-25) var(--spacing-30);
}
.queue + .queue { margin-top: var(--spacing-15); }
.queue-head { display: flex; align-items: baseline; gap: var(--spacing-10); flex-wrap: wrap; }
.queue-who { font-weight: var(--font-weight-w550); }
.queue-what { color: var(--color-newsprint-gray); }
.queue-when { font-size: var(--text-body-sm); color: var(--color-newsprint-gray); }
.queue-actions { display: flex; gap: var(--spacing-10); margin-top: var(--spacing-20); flex-wrap: wrap; }

/* ---- the client table ---- */
.rows { border-top: 1px solid var(--rule); }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--spacing-15);
  align-items: center;
  padding: var(--spacing-20) 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
}
.row:hover { background: var(--surface-sunken); }
.row-name { font-weight: var(--font-weight-medium); }
.row-meta { font-size: var(--text-body-sm); color: var(--color-newsprint-gray); }
.row-right { display: flex; align-items: center; gap: var(--spacing-15); }

/* ---- reading a submission ---- */
.answers { border-top: 1px solid var(--rule); }
.ans {
  padding: var(--spacing-20) 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  gap: var(--spacing-8);
}
.ans-code {
  font-size: var(--text-caption);
  font-weight: var(--font-weight-w550);
  letter-spacing: var(--tracking-wide);
  color: var(--color-newsprint-gray);
}
.ans-q { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.25; }
.ans-v {
  white-space: pre-wrap;
  background: var(--surface-sunken);
  border-radius: var(--radius-buttons);
  padding: var(--spacing-15);
}
.ans-v.empty { color: var(--color-newsprint-gray); background: none; padding: 0; font-style: italic; }
.ans-note { font-size: var(--text-body-sm); color: var(--color-newsprint-gray); }

.sec-head {
  margin: var(--spacing-40) 0 var(--spacing-10);
  font-family: var(--font-ui);
  font-size: var(--text-label);
  font-weight: var(--font-weight-w550);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-newsprint-gray);
}

/* ---- tabs ---- */
.tabs { display: flex; gap: var(--spacing-8); flex-wrap: wrap; margin-bottom: var(--spacing-25); }
.tab {
  font: inherit; font-size: var(--text-body-sm); font-weight: var(--font-weight-medium);
  background: none; border: 1px solid var(--rule-firm); color: var(--color-newsprint-gray);
  border-radius: var(--radius-pills); padding: var(--spacing-8) var(--spacing-15); cursor: pointer;
  /* inline-flex and a gap so an unread badge sits beside the label rather
     than jammed against it — "Messages5" was the button with no gap. */
  display: inline-flex; align-items: center; gap: var(--spacing-8);
}
.tab[aria-selected="true"] {
  background: var(--color-press-black); border-color: var(--color-press-black);
  color: var(--color-bone-white);
}

/* ---- upload ---- */
.drop {
  border: 1px dashed var(--rule-firm);
  border-radius: var(--radius-images);
  padding: var(--spacing-25);
  display: grid; gap: var(--spacing-15);
}

/* ============================================================
   The client's four views
   ============================================================ */

/* The tab strip sits under the apex, because the thesis is not one view among
   four — it is what all four are in service of. */
.views { display: flex; gap: var(--spacing-8); flex-wrap: wrap; margin-bottom: var(--spacing-40); }
.view-tab {
  font: inherit; font-size: var(--text-body-sm); font-weight: var(--font-weight-medium);
  background: none; border: 1px solid var(--rule-firm); color: var(--color-newsprint-gray);
  border-radius: var(--radius-pills); padding: var(--spacing-10) var(--spacing-20); cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--spacing-8);
  min-height: 44px;
}
.view-tab[aria-selected="true"] {
  background: var(--color-press-black); border-color: var(--color-press-black);
  color: var(--color-bone-white);
}
/* One rule for both tab kinds. Scoped to .view-tab alone, the admin's tabs
   silently rendered the number as bare text — the badge was not missing, it
   was never styled, which looks like a different bug entirely. */
.view-tab .count,
.tab .count {
  font-size: var(--text-caption); font-weight: var(--font-weight-w550);
  background: var(--color-highlighter-green); color: var(--color-accent-ink);
  border-radius: var(--radius-round); padding: 1px var(--spacing-8);
  /* A round dot even for a single digit, rather than an oval that grows. */
  min-width: 1.25rem; text-align: center;
}

/* ---- the timeline ----
   A vertical rail, because a month grid answers "what day is it" and a client
   on a staged engagement is asking "what is next and are we behind". */
.rail { display: grid; gap: 0; }
.stop {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--spacing-20);
  padding-bottom: var(--spacing-25);
  position: relative;
}
.stop::before {
  content: ""; position: absolute; left: 7px; top: 22px; bottom: 0;
  width: 2px; background: var(--rule);
}
.stop:last-child::before { display: none; }
/* Four states, read at a glance down the rail. Every dot keeps the same
   black edge so the row of them scans as one line; only the fill changes,
   which is what carries the meaning. */
.stop-dot {
  width: 16px; height: 16px; border-radius: var(--radius-round);
  border: 2px solid var(--color-press-black);
  background: transparent;                    /* upcoming */
  margin-top: 4px; z-index: 1;
}
.stop-in_progress .stop-dot { background: var(--color-highlighter-green); }
.stop-done .stop-dot        { background: var(--color-press-black); }
.stop-missed .stop-dot      { background: var(--color-halt); }
.stop-when {
  font-size: var(--text-caption); font-weight: var(--font-weight-w550);
  letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--color-newsprint-gray);
}
.stop-missed .stop-when { color: var(--color-halt); }
.stop-title { font-weight: var(--font-weight-medium); margin: 2px 0; }
.stop-detail { font-size: var(--text-body-sm); color: var(--color-newsprint-gray); margin: 0; }

/* ---- booking ---- */
/* Calendly's widget.js inserts a bare <iframe> and leaves the sizing to its own
   stylesheet, which we do not load. Without a rule of our own the iframe falls
   back to the browser default of 150px tall and the booking box renders empty.
   A definite height on the box is what lets the iframe's 100% resolve. */
.booking {
  border: 1px solid var(--rule);
  border-radius: var(--radius-images);
  overflow: hidden;
  background: var(--surface-raised);
  height: 700px;
}
.booking iframe { display: block; width: 100%; height: 100%; border: 0; }
@media (max-width: 34rem) { .booking { height: 940px; } }

/* ---- sharing a document ---- */
.share {
  display: grid; gap: var(--spacing-20);
  border: 1px dashed var(--rule-firm);
  border-radius: var(--radius-images);
  padding: var(--spacing-25);
  /* Space above as well as below. This box had a margin underneath it and
     none on top, so the Drive listing ran straight into its dashed edge and
     the two read as one block — when they are opposite directions: what
     TeeJay shares down, and what the client sends back. */
  margin-top: var(--spacing-40);
  margin-bottom: var(--spacing-30);
}
.share-ways { display: flex; gap: var(--spacing-8); flex-wrap: wrap; }
.share-way {
  font: inherit; font-size: var(--text-body-sm); cursor: pointer;
  background: none; border: 1px solid var(--rule-firm); color: var(--color-newsprint-gray);
  border-radius: var(--radius-pills); padding: var(--spacing-8) var(--spacing-15);
}
.share-way[aria-pressed="true"] {
  background: var(--color-echo-green); border-color: var(--color-shadow-moss);
  color: var(--color-accent-ink);
}
.doc-from { font-size: var(--text-caption); font-weight: var(--font-weight-w550);
  letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--color-newsprint-gray); }

/* ---- a client's Drive folder ------------------------------------------
   The rows reuse .doc so the folder and the shared-documents list below it
   read as one thing rather than two systems bolted together. */
.doc-acts { display: flex; gap: var(--spacing-8); flex-shrink: 0; align-items: center; }

/* The viewer. Full-screen deliberately: these are working documents and a
   letter-width PDF in a small modal is unreadable, which defeats the point
   of showing it in the portal at all. */
.doc-viewer {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  background: var(--surface-canvas);
}
.doc-viewer[hidden] { display: none; }
.doc-viewer-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--spacing-15);
  padding: var(--spacing-10) var(--spacing-20);
  border-bottom: 1px solid var(--rule);
  background: var(--surface-raised);
}
.doc-viewer-name {
  font-weight: var(--font-weight-medium);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-viewer-acts { display: flex; gap: var(--spacing-8); flex-shrink: 0; }
/* A definite height, not min-height: a child with height:100% has nothing to
   resolve against otherwise, which is how the booking calendar spent weeks
   rendering at 120x150 on the live site. */
.doc-viewer-body { flex: 1 1 auto; min-height: 0; }
.doc-viewer-body iframe { width: 100%; height: 100%; border: 0; display: block; }

@media (max-width: 640px) {
  .doc-acts { flex-direction: column; align-items: stretch; }
  .doc-viewer-bar { flex-wrap: wrap; }
  .doc-viewer-name { flex: 1 1 100%; }
}

/* ---- the message thread ----------------------------------------------- */
.thread {
  max-height: 55vh; overflow-y: auto;
  border: 1px solid var(--rule); border-radius: var(--radius-images);
  padding: var(--spacing-15); background: var(--surface-raised);
}
.chat { margin-bottom: var(--spacing-15); max-width: 42rem; }
.chat:last-child { margin-bottom: 0; }
.chat-who {
  font-size: var(--text-caption); color: var(--color-newsprint-gray);
  margin-bottom: var(--spacing-4, 4px);
}
.chat-body {
  /* Their newlines are their newlines, and a pasted paragraph should survive
     being sent. pre-wrap keeps both without letting anything be markup. */
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--surface-sunken); border-radius: var(--radius-images);
  padding: var(--spacing-10) var(--spacing-10);
}
.chat-mine { margin-left: auto; }
.chat-mine .chat-who { text-align: right; }
.chat-mine .chat-body { background: var(--color-echo-green); }

.thread-write { margin-top: var(--spacing-15); display: flex; flex-direction: column; gap: var(--spacing-10); }
.thread-write textarea {
  width: 100%; font: inherit; padding: var(--spacing-10) var(--spacing-10);
  border: 1px solid var(--rule-firm); border-radius: var(--radius-images);
  background: var(--surface-raised); color: inherit; resize: vertical;
}
.thread-write .btn { align-self: flex-start; }

.thread-buttons { display: flex; gap: var(--spacing-10); align-items: center; flex-wrap: wrap; }

/* ---- a file on a message --------------------------------------------- */
.chat-clip {
  display: flex; align-items: center; gap: var(--spacing-10);
  flex-wrap: wrap;
  margin-top: var(--spacing-8);
  padding: var(--spacing-10) var(--spacing-10);
  border: 1px solid var(--rule); border-radius: var(--radius-images);
  background: var(--surface-raised);
}
.chat-mine .chat-clip { margin-left: auto; }
.chat-clip-name { font-weight: var(--font-weight-medium); overflow-wrap: anywhere; }
.chat-clip-size { font-size: var(--text-caption); color: var(--color-newsprint-gray); }
.thread-file { font: inherit; font-size: var(--text-body-sm); }
