/* The conversation: header readout, the entries, rendered Markdown, the
 * question boxes and the composer.
 *
 * Every entry is told apart three ways at once — by tint, by icon and by the
 * word above it. Colour alone would fail a colour-blind reader and a greyscale
 * print, and this conversation gets printed.
 */

.chat {
  display: grid;
  /* The single column has to be named. An implicit track is sized to its
   * content, so one long path in the header would stretch the whole
   * conversation past the column it lives in. */
  grid-template-columns: minmax(0, 1fr);
  /* Header, the tab bar of the chats (absent with one chat), the body. */
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  position: relative;
  /* The column is as wide as the separator makes it, and the text is not.
   * Rows run edge to edge, so the tint and the dotted line between two turns
   * stay one unbroken band down the column, while what is written in them is
   * held to the measure and centred once the column outgrows it. This is the
   * inset that does it; the percentage resolves against whichever box uses
   * it, which is always a full-width row. */
  --inset: max(var(--gutter), (100% - var(--measure-max)) / 2);
}

/* -- header -------------------------------------------------------------- */

/* The Vorgang's chats, one tab each, under the header and above the
 * conversation. Absent with a single chat. It scrolls sideways rather than
 * wrapping, so it stays one row however many chats there are. */
.chat-tabs {
  grid-row: 2;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  overflow-x: auto;
}

.chat-tab-list {
  display: flex;
  margin: 0;
  padding: 0 var(--gutter);
  list-style: none;
}

.chat-tab {
  display: flex;
  align-items: center;
  flex: none;
  border-bottom: 3px solid transparent;
}

.chat-tab-current {
  border-bottom-color: var(--blue);
  background: var(--paper);
}

.chat-tab-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  /* The size of the header's own details, not of the conversation. */
  padding: .4rem .15rem .3rem .65rem;
  font-size: .85rem;
  color: var(--anthracite);
  text-decoration: none;
  white-space: nowrap;
}

.chat-tab-link[aria-current="page"] { font-weight: bold; }
.chat-tab:hover { background: var(--tint-input); }

/* The bin, quiet until its tab is under the pointer or open, as in the rail,
 * and never hidden from the keyboard. */
.chat-tab-delete {
  flex: none;
  padding: .25rem .4rem;
  font-size: .85rem;
  color: var(--gray);
  background: none;
  opacity: 0;
}

.chat-tab:hover .chat-tab-delete,
.chat-tab-current .chat-tab-delete,
.chat-tab-delete:focus-visible { opacity: 1; }
.chat-tab-delete:hover { color: var(--red); }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--head-h);
  /* The header is not held to the measure: title and folder sit at the left
   * edge, the readout at the right, so a long title gets the whole column. */
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
}

.chat-title { flex: 1; min-width: 0; }

.chat-path {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin: .35rem 0 0;
  font-family: ui-monospace, monospace;
  font-size: .78rem;
  color: var(--gray);
  overflow: hidden;
  white-space: nowrap;
}

/* A flex container clips its text without an ellipsis; the name's own box
 * can show one. */
.chat-folder { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.art-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  flex: none;
  margin-right: .4rem;
  padding: .05rem .5rem .05rem .35rem;
  font-family: "Uni Stuttgart Sans", Arial, sans-serif;
  font-size: .8rem;
  color: var(--anthracite);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 1em;
}

.art-badge .icon { color: var(--blue); }

.readout {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: none;
  font-size: .85rem;
  color: var(--gray);
}

.readout-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.readout-label { text-transform: uppercase; letter-spacing: .05em; font-size: .72rem; }
.readout-value { font-variant-numeric: tabular-nums; color: var(--anthracite); }

.mcp-trigger {
  padding: .25rem .5rem;
  color: var(--gray);
  background: var(--paper-2);
  font-weight: normal;
  font-size: .85rem;
  border: 1px solid var(--line);
}

/* The gauge never speaks by colour alone: the percentage is written beside it.
 * Three steps rather than a gradient — a smooth green-to-red ramp passes
 * through yellows that fail contrast, and the corporate design has exactly
 * three signal colours. */
.gauge {
  position: relative;
  display: inline-block;
  width: 6rem;
  height: .6rem;
  background: var(--soft);
  overflow: hidden;
}

.gauge-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
}

.gauge[data-level="warn"] .gauge-fill { background: var(--orange); }
.gauge[data-level="high"] .gauge-fill { background: var(--red); }

/* The tick sits where the bar turns red, not near it: a mark at eighty and a
 * colour step at eighty-five tell the reader two different things. */
.gauge-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 85%;
  width: 1px;
  background: var(--anthracite);
}

.gauge-figure { font-size: .78rem; color: var(--gray); }

/* The panel grows out of the badge it belongs to. It has to be a popover: the
 * columns clip their overflow, so a panel in normal flow would be cut off at
 * the header's edge — and the top layer brings Esc and click-away with it.
 *
 * The width is fixed because the script has to place the panel before the
 * browser has laid it out; measuring it there returns zero, and the correction
 * a frame later is what used to make it slide in from the right.
 *
 * The top padding is what the pointer crosses on its way down from the badge:
 * a gap there would close the panel halfway. */
.mcp-panel {
  margin: 0;
  padding: 0 .55rem .55rem;
  border: 1px solid var(--line);
  background: var(--paper-2);
  width: 22rem;
  max-width: calc(100vw - 2rem);
  transform-origin: top right;
  transition: opacity .12s ease-out, transform .12s ease-out, display .12s allow-discrete;
}

/* The badge's own face, repeated as the panel's first line and laid out
 * identically, so the panel lands exactly over the badge and what grows is the
 * box around it. */
.mcp-face {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin: 0 0 .5rem;
  padding: .25rem .5rem;
  font-size: .85rem;
  color: var(--gray);
}

.mcp-face .mcp-heading { margin: 0 0 0 auto; }

.mcp-panel:not(:popover-open) { opacity: 0; transform: scale(.96); }

@starting-style {
  .mcp-panel:popover-open { opacity: 0; transform: scale(.96); }
}

@media (prefers-reduced-motion: reduce) {
  .mcp-panel { transition: none; }
  .mcp-panel:not(:popover-open) { opacity: 1; transform: none; }
}

.mcp-heading { font-size: .8rem; text-transform: uppercase; color: var(--gray); }
.mcp-list { list-style: none; margin: 0; padding: 0 .5rem; }
.mcp-item { display: flex; gap: .5rem; padding: .3rem 0; align-items: baseline; }
.mcp-item + .mcp-item { border-top: 1px solid var(--line); }
.mcp-name { font-weight: bold; }
.mcp-text { color: var(--gray); font-size: .85rem; }
.mcp-empty { color: var(--gray); font-size: .85rem; }

/* -- the log ------------------------------------------------------------- */

.chat-scroll {
  grid-area: 1 / 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* Scroll anchoring fights the stick-to-bottom logic when a streamed text
   * node is swapped for rendered markup, and the view jumps. */
  overflow-anchor: none;
  min-height: 0;
  /* Room under the last entry for the composer floating over it, so the end
   * of the conversation can always be scrolled clear of it. The height is
   * the dock's own, measured by `task.js` as it grows. */
  padding: 0 0 calc(var(--dock-h, 9rem) + 1rem);
  scroll-padding-block: 1rem calc(var(--dock-h, 9rem) + 1rem);
}

/* Full bleed: the tint is the boundary between one turn and the next, and a
 * gutter either side would only make the column look narrower than it is. The
 * inset keeps the contents to the measure. */
.entry {
  display: flex;
  gap: .7rem;
  padding: 1.1rem var(--inset);
  /* Dotted, because the boundary between two turns is a hint and not a rule.
   * A solid hairline across a column this wide reads as a table. */
  border-bottom: 1px dotted var(--line-strong);
}

.entry-mark {
  flex: none;
  width: 1.5rem;
  display: flex;
  justify-content: center;
  padding-top: .1rem;
}

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

.entry-who {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: .2rem;
}

.entry-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
}

.entry-input { background: var(--tint-input); }
.entry-input .entry-mark, .entry-input .entry-who { color: var(--blue); }

/* The label and what can be done with the message, on one line: the
 * actions at the far end, small and in the entry's own colour, as the counters
 * sit at the end of the working line. They are there to be found, not to be
 * read, and they carry their names as tooltips and for screen readers. */
.entry-who-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .2rem;
}

.entry-who-row .entry-who { margin-bottom: 0; }

.entry-actions {
  display: flex;
  align-items: center;
  gap: .2rem;
  margin-left: auto;
}

.entry-action {
  display: inline-flex;
  align-items: center;
  padding: .15rem;
  color: var(--blue);
  background: none;
  border: 0;
  opacity: .55;
  cursor: pointer;
}

.entry-action .icon { width: 1.1em; height: 1.1em; }
.entry-action:hover, .entry-action:focus-visible { opacity: 1; }

/* While a turn runs, sending again waits, as the send button does. */
body[data-busy="on"] .entry-action-resend { opacity: .25; cursor: not-allowed; }

/* The conversation is printed, and controls on paper are noise. */
@media print {
  .entry-actions { display: none; }
}

/* The answer carries no hue — a wash of colour behind a paragraph of prose
 * costs more in legibility than it buys — but it does carry a grey, lighter
 * than the hairline between the entries, so the thing worth reading is the one
 * surface that is not plain paper. */
.entry-answer { background: var(--paper-2); }
.entry-answer .entry-mark, .entry-answer .entry-who, .entry-answer .entry-action { color: var(--green); }

/* What the agent said on the way to the answer. One bullet per remark, small,
 * untinted, no icon column: these are the asides, and the reader should be
 * able to skip the whole block with one movement of the eye. */
.entry-steps {
  background: var(--paper);
  padding-block: .75rem;
}

.entry-steps .entry-mark { color: var(--gray); }
.entry-steps .entry-who { color: var(--gray); }

.steps {
  margin: 0;
  padding-left: 1.1rem;
  font-size: .88rem;
  color: var(--gray);
}

.steps li {
  margin-bottom: .2rem;
  overflow-wrap: anywhere;
}

.steps li:last-child { margin-bottom: 0; }
.steps .entry-text { white-space: pre-wrap; }

/* A list inside a remark is a list inside a list item, and the browser marks
 * the second level with hollow circles and indents it twice. It is the same
 * kind of thing as the line it sits under, so it is marked the same way. */
.steps .md ul { list-style-type: disc; padding-left: 1.1rem; }
.steps .md ol { padding-left: 1.4rem; }

/* The working line is the last item of the same block, not a box of its own:
 * remarks and "still working" are one thread, and splitting them made a turn
 * look like a sequence of unrelated events. It carries no bullet, because it
 * is a state and not another remark. */
.step-working {
  display: flex;
  align-items: center;
  gap: .4rem;
  list-style: none;
  margin-left: -1.1rem;
  font-style: italic;
}

/* The same grey as its words: the moving bar under the block says it is live. */
.step-working > .icon { color: inherit; }

/* What the wait has cost so far, pushed to the far end of the line. Numbers
 * are tabular so they do not jitter as they climb, and upright because the
 * line around them is italic and a leaning figure is hard to read. */
.step-counts {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-left: auto;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.step-count { display: inline-flex; align-items: center; gap: .25rem; }
.step-count .icon { width: 1.1em; height: 1.1em; }

.entry-question { background: var(--tint-question); }
.entry-question .entry-mark, .entry-question .entry-who { color: var(--orange); }

/* Green, like the answer's own mark: a document the assistant put in front of
 * the reader is a result, not a warning, and the blue it used to carry was the
 * same blue the reader's own input is marked with. */
.entry-notice { background: var(--tint-document); }
.entry-notice .entry-mark, .entry-notice .entry-who { color: var(--green); }

/* A request to copy a file into the office silo. Its own tint and mark,
 * violet, because it is neither a question of the agent's (orange) nor a
 * result (green): it is a change to the staff's own data, asked for. */
.entry-filing { background: var(--tint-filing); }
.entry-filing .entry-mark, .entry-filing .entry-who { color: var(--violet); }
/* The folder glyph carries its weight low in its box, so beside the label it
 * looked dropped where the other marks do not; lifted to sit level with it. */
.entry-filing .entry-mark { padding-top: 0; }
.entry-filing .entry-mark .icon { margin-top: -.1rem; }

.filing-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .3rem .6rem;
  align-items: center;
  margin: .5rem 0 0;
}

.filing-facts dt {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--violet);
}

.filing-facts dd {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  min-width: 0;
  margin: 0;
}

.filing-path {
  flex: 1;
  min-width: 0;
  padding: .25rem .6rem;
  overflow-wrap: anywhere;
  background: var(--paper);
  border: 1px solid var(--line);
}

/* The place in the silo is what the decision is about; the silo's name is
 * only where it starts, so it sits in a grey box of its own ahead of the path
 * and never breaks. A long path wraps within the box, after a slash where it
 * can, so all of it is visible at once. */
.filing-target .filing-path {
  display: flex;
  padding: 0;
}

.filing-where {
  flex: none;
  padding: .25rem .6rem;
  white-space: nowrap;
  color: var(--anthracite);
  background: var(--soft);
}

.filing-target strong {
  flex: 1;
  min-width: 0;
  padding: .25rem .6rem;
}

.filing-file .filing-path,
.filing-target strong {
  font-family: ui-monospace, monospace;
  font-size: .9rem;
}

.filing-target strong { font-weight: bold; }

.filing-file button {
  flex: none;
  padding: .25rem .7rem;
  font-size: .85rem;
}

.filing-warning,
.filing-outcome {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: .6rem 0 0;
}

.filing-outcome { flex-wrap: wrap; }
.filing-outcome strong { white-space: nowrap; }
.filing-warning { font-weight: bold; color: var(--red); }
.filing-question { margin-top: .7rem; }
.filing-question .qa-text { margin-bottom: .4rem; }
.filing-copied { color: var(--green); }
.filing-rejected, .filing-running { color: var(--gray); }
.filing-failed { color: var(--red); }
.filing-detail { margin: .2rem 0 0; font-size: .9rem; }

@media print {
  .filing-file button, .filing-question .qa-yesno { display: none; }
}

/* A message the assistant proposes to an institute member (teal), and the
 * answer that came back (olive). Both wait on the reader, and neither is the
 * assistant speaking, so each has its own tint and mark. */
.entry-message { background: var(--tint-message); }
.entry-message .entry-mark, .entry-message .entry-who { color: var(--teal); }
.entry-reply { background: var(--tint-reply); }
.entry-reply .entry-mark, .entry-reply .entry-who { color: var(--olive); }

.mm-person { margin: .5rem 0 0; }
.mm-caption {
  margin-right: .5rem;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.entry-message .mm-caption { color: var(--teal); }
.mm-user { color: var(--gray); }

/* The words themselves, as they will be read: on paper, kept as written. */
.mm-message,
.mm-editor {
  margin-top: .4rem;
  padding: .5rem .7rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--paper);
  border: 1px solid var(--line);
}

.mm-editor {
  display: block;
  width: 100%;
  font: inherit;
  resize: vertical;
}

.mm-outcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  margin: .6rem 0 0;
}
.mm-outcome strong { white-space: nowrap; }
.mm-sent { color: var(--green); }
.mm-rejected, .mm-running { color: var(--gray); }
.mm-failed { color: var(--red); }
.mm-note, .mm-detail { margin: .3rem 0 0; font-size: .9rem; }
.mm-note { color: var(--gray); }

.mm-waiting {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .4rem;
  font-style: italic;
}
.mm-waiting button { font-style: normal; padding: .2rem .7rem; font-size: .85rem; }

/* Three buttons do not fit beside each other on a phone. */
.entry-message .qa-yesno, .entry-reply .qa-yesno { flex-wrap: wrap; }

/* Handing an answer over starts a turn, so it waits like sending does. */
body[data-busy="on"] .mm-release { opacity: .4; pointer-events: none; }

@media print {
  .entry-message .qa-yesno, .entry-reply .qa-yesno, .mm-waiting button { display: none; }
}

/* The name of the document and the button that opens it, on one line. The
 * button is sized to the box beside it rather than to a full control: it is an
 * offer within a sentence, not the sentence's conclusion. */
.doc-offer {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  margin-top: .5rem;
}

.entry-notice .doc-source {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: .25rem .6rem;
  background: var(--paper);
  border: 1px solid var(--line);
}

.doc-offer button {
  flex: none;
  padding: .25rem .7rem;
  font-size: .85rem;
}

/* Where the button would be, when what was shown can no longer be opened. */
.doc-gone {
  flex: none;
  align-self: center;
  margin: 0;
  font-size: .85rem;
  font-style: italic;
  color: var(--gray);
}

/* While the assistant works, the dotted line under its block becomes a light
 * bar, as on a status LED strip. The spectrum lies fixed across the full
 * width, and a light runs left and right over it, so its colour changes as it
 * moves. It disperses: narrow and slow at the ends, where it turns, and wide
 * and fast in the middle. The bar lies over the entry's border and the bottom
 * of its padding, so the block keeps its height when work starts or stops.
 *
 * ::before is the unlit track, ::after the spectrum seen through a moving
 * mask. The mask is alpha only, so `black` there is no colour of the page. */
.entry-steps.is-working {
  position: relative;
  border-bottom-color: transparent;
}

.entry-steps.is-working::before,
.entry-steps.is-working::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 4px;
  pointer-events: none;
}

.entry-steps.is-working::before { background: var(--soft); }

.entry-steps.is-working::after {
  background: var(--spectrum);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 35%, black 65%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 35%, black 65%, transparent);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  animation: lauflicht 2.4s infinite;
}

/* Out and back in one cycle. Each half accelerates into the middle and slows
 * into the turn, while the light widens and narrows with its speed. */
@keyframes lauflicht {
  0%, 100% {
    -webkit-mask-position: 0% 0; mask-position: 0% 0;
    -webkit-mask-size: 8% 100%; mask-size: 8% 100%;
    animation-timing-function: ease-in;
  }
  25% {
    -webkit-mask-position: 50% 0; mask-position: 50% 0;
    -webkit-mask-size: 34% 100%; mask-size: 34% 100%;
    animation-timing-function: ease-out;
  }
  50% {
    -webkit-mask-position: 100% 0; mask-position: 100% 0;
    -webkit-mask-size: 8% 100%; mask-size: 8% 100%;
    animation-timing-function: ease-in;
  }
  75% {
    -webkit-mask-position: 50% 0; mask-position: 50% 0;
    -webkit-mask-size: 34% 100%; mask-size: 34% 100%;
    animation-timing-function: ease-out;
  }
}

/* Without motion the bar still says "working": the whole spectrum, standing. */
@media (prefers-reduced-motion: reduce) {
  .entry-steps.is-working::after {
    animation: none;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* The service speaking about the conversation rather than in it: no tint, no
 * hue, grey throughout. It is neither an answer nor a failure, and the reader
 * should be able to tell that without reading a word of it. */
.entry-system { background: var(--paper); }
.entry-system .entry-mark, .entry-system .entry-who { color: var(--gray); }
.entry-system .entry-text { color: var(--gray); }

/* The error carries a thick rule down its left edge rather than across its top
 * and bottom. Two errors in a row put four red lines between them, of which the
 * middle two were a double rule with a hair of tint trapped inside; down the
 * side, two errors in a row simply read as two. The padding gives back what the
 * border takes, so the text of every entry starts at the same place. */
.entry-error {
  background: var(--tint-error);
  border-left: 6px solid var(--red);
  padding-left: calc(var(--inset) - 6px);
}

.entry-error .entry-mark { color: var(--red); }

.entry-error .entry-who {
  display: inline-block;
  padding: .1rem .4rem;
  color: var(--paper);
  background: var(--red);
}

/* -- the §C7 report ------------------------------------------------------ */

/* Each section's heading sits above its content, not beside it. The five
 * headings differ in width by half a line — "Ergebnis" against "Fehlt oder ist
 * unklar" — so a `max-content` column put every section's body at the width of
 * the longest label, and a bulleted list behind that gutter read as if it had
 * been indented twice. */
.report { margin: .6rem 0 0; }

.report dt {
  margin-top: .7rem;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: bold;
  color: var(--blue);
}

.report dt:first-child { margin-top: 0; }
.report dd { margin: .15rem 0 0; }

/* -- rendered Markdown --------------------------------------------------- */

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h4, .md h5, .md h6 { font-size: 1.02rem; margin: .8rem 0 .3rem; }
.md ul, .md ol { margin: .4rem 0 .7rem; padding-left: 1.3rem; }
.md li { margin-bottom: .15rem; }
.md blockquote {
  margin: .5rem 0;
  padding-left: .8rem;
  border-left: 4px solid var(--soft);
  color: var(--gray);
}

.md code {
  font-family: ui-monospace, monospace;
  font-size: .92em;
  background: var(--paper-2);
  padding: .05rem .25rem;
}

.md pre {
  margin: .5rem 0;
  padding: .6rem .7rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  overflow-x: auto;
}

.md pre code { background: none; padding: 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: .8rem 0; }

/* A wide table must scroll inside its box rather than stretch the column. */
.md-scroll { overflow-x: auto; margin: .5rem 0; }

.md table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.md th, .md td { border: 1px solid var(--line); padding: .3rem .5rem; text-align: left; }

/* The header row carries the corporate blue. A table in an answer is usually
 * the answer, and its first row should be findable without reading it. */
.md th {
  color: var(--paper);
  background: var(--blue);
  border-color: var(--blue);
}
.md .mitte { text-align: center; }
.md .rechts { text-align: right; }

/* -- questions ----------------------------------------------------------- */

.qa { margin-top: .4rem; }

.qa-block {
  margin: 0 0 .9rem;
  padding: 0;
  border: 0;
}

.qa-header {
  padding: 0;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--orange);
}

.qa-text { font-weight: bold; margin-bottom: .4rem; }

/* The options stack as one boxed list: each row bordered, adjacent rows sharing
 * a line. Separated by gaps they read as loose cards of uneven weight, and an
 * option with a description beside one without looked like a fault. */
.qa-option {
  display: flex;
  gap: .5rem;
  align-items: baseline;
  margin: 0;
  padding: .45rem .6rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: inherit;
  font-size: 1rem;
}

.qa-option + .qa-option { border-top: 0; }
.qa-option:hover { background: var(--paper-2); }
.qa-choices { margin-bottom: .5rem; }

.qa-option input { width: auto; flex: none; }
.qa-label { font-weight: bold; }
.qa-hint { color: var(--gray); font-size: .85rem; }
.qa-custom { margin: .4rem 0 .4rem 1.6rem; width: calc(100% - 1.6rem); }
.qa-yesno { display: flex; gap: .6rem; }
.qa-actions { display: flex; gap: .6rem; align-items: center; }

/* An answered question: the offered options in one row, the chosen one marked
 * by a tick, by weight and by colour, and the rest greyed. */
.qa-settled .qa-block { margin-bottom: .6rem; }
.qa-settled .qa-block:last-child { margin-bottom: 0; }
.qa-settled .qa-text { margin-bottom: .3rem; }

.qa-given {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qa-pick {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .55rem;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--gray);
  font-size: .9rem;
}

.qa-chosen {
  border-color: var(--green);
  color: var(--green);
  font-weight: bold;
}

.qa-unanswered {
  margin: .3rem 0 0;
  font-size: .85rem;
  font-style: italic;
  color: var(--gray);
}

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

/* The composer floats over the bottom of the conversation, held to the same
 * measure as the text above it and centred with it: it belongs to the
 * conversation, and a bar across the full column read as the frame of the
 * window rather than as the place one writes.
 *
 * The dock is the composer and the jump button stacked, laid over the log in
 * the same grid cell. It lets the pointer through wherever it has nothing of
 * its own, so the margins beside the composer still scroll the log. The jump
 * button sits on the composer rather than being measured against the column:
 * measured from the bottom it needed a hand-tuned offset, and the composer
 * grows with what is typed into it. */
.chat-body {
  /* Placed, not flowed: without the tab bar it would take the tab bar's row. */
  grid-row: 3;
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  /* The composer's shape depends on how wide the conversation is, not the
   * window: the separator changes one without the other. */
  container: chat / inline-size;
}

.chat-dock {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: center;
  width: min(100% - 2 * var(--gutter), var(--measure-max));
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .6rem;
  z-index: 5;
  pointer-events: none;
}

.chat-dock > * { pointer-events: auto; }

/* A near-white translucent pane with the conversation blurred behind it, and
 * a hairline round it so the edge holds where the text behind is pale — a
 * hairline and not a shadow, since the corporate design has none. The ground
 * is mixed rather than written, because a hex literal outside the palette is a
 * bug here and a test says so.
 *
 * The one rounded box in the interface besides the status dot: it floats over
 * the conversation rather than belonging to the grid, and the soft corner is
 * what tells it apart from the square entries it passes over. */
.composer {
  align-self: stretch;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1rem;
}

@supports not (backdrop-filter: blur(1px)) {
  .composer { background: var(--paper); }
}

.composer textarea {
  resize: none;
  min-height: 5.4rem;   /* three lines, which is what a first sentence needs */
  max-height: 40vh;
  overflow-y: auto;
}

.composer-actions {
  display: flex;
  /* At the narrowest column, with Abbrechen showing, Senden goes to a line
   * of its own rather than out of sight. */
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin-top: .5rem;
}

.composer-hint {
  margin: 0 auto 0 0;
  font-size: .8rem;
  color: var(--gray);
}

/* What is done to the chat rather than said in it: outlined, so they do not
 * compete with *Senden*. */
.chat-tools { display: flex; gap: .4rem; flex: none; }

.composer-send {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-left: auto;
}

.chat-tool {
  padding: .4rem .6rem;
  font-size: .8rem;
  font-weight: normal;
  color: var(--anthracite);
  background: var(--paper);
  border: 1px solid var(--line-strong);
}

.chat-tool:hover { background: var(--tint-input); }
.chat-tool-danger:hover { color: var(--red); background: var(--tint-error); }

.chat-tool:disabled {
  color: var(--disabled);
  background: var(--paper);
  border-color: var(--line);
  cursor: not-allowed;
}

.jump-latest {
  font-size: .85rem;
  padding: .4rem .7rem;
}

/* Once the column is too narrow for the text to be centred, there is no margin
 * left for the composer to float in, and a box inset by the gutter alone reads
 * as a card that did not quite fit. It becomes a bar instead: full width, flush
 * with the bottom, square, with only a rule along its top edge, and its
 * contents indented by the gutter so the text field lines up with the entries.
 *
 * The width is `--measure-max` plus two `--gutter`s, written out because a
 * container query cannot read custom properties. Change them together. */
@container chat (max-width: calc(1000px + 2.5rem)) {
  /* Narrower: the chat's buttons keep their names, which say more than the
   * keyboard hint, and the hint gives way. */
  .composer-hint { display: none; }

  .chat-dock {
    width: 100%;
    margin-bottom: 0;
  }

  .composer {
    border-width: 1px 0 0;
    border-radius: 0;
    padding: 1rem var(--gutter);
  }

  .jump-latest { margin-right: var(--gutter); }
}

@media (max-width: 640px) {
  .composer-hint { display: none; }
  .chat-head { flex-direction: column; gap: .5rem; padding-block: .6rem; }
}
