/* Private Assistant — styles for the private-chat end-user demo.
   Plain CSS, no framework, no external fonts (this app has zero runtime dependencies and the
   browser talks only to its own origin).

   LIGHT FIRST, and warm. The palette below is paper, not screen: every neutral carries a little
   yellow/red, so the greys read as unbleached paper and card stock rather than as the blue-grey a
   default `#f5f5f5` gives you. That single choice does most of the work of making a chat window
   feel like a place to read and write rather than a console — and it is why the borders are warm
   too. A cold hairline on a warm ground is the detail that gives the whole thing away.

   Light is the default because a document-shaped surface reads better on paper than on slate, and
   because the answer people are looking at is prose. The dark scheme below is a warm CHARCOAL for
   the same reason — #262624, not #131316: a blue-black next to terracotta looks like two
   unrelated design systems sharing a window. */

:root {
  --bg: #faf9f5;          /* the page: warm paper */
  --bg-raised: #ffffff;   /* cards and the composer sit ABOVE the page, not below it */
  --bg-sunken: #f2f0e9;   /* rails, code blocks, table heads */
  --bg-hover: #eceae0;
  --border: #e0dcd0;
  --border-soft: #eae7db;
  --text: #1f1e1d;        /* warm near-black; a pure #000 looks like ink on the wrong stock */
  --text-dim: #6b6862;
  --text-faint: #98938a;
  --accent: #c96442;      /* clay */
  --accent-soft: rgba(201, 100, 66, 0.10);
  --user-bubble: #f0ede3;
  --warn: #b3821f;
  --danger: #bd4f3c;
  --ok: #4f7d51;
  --external: #a35682;
  /* Generously rounded, and on a scale rather than two ad-hoc values: the composer is the softest
     shape on the page, cards next, small controls last. Sharp corners are what make a plain-CSS
     app look unfinished. */
  --radius-lg: 24px;      /* the composer */
  --radius: 12px;         /* cards, code blocks, message bubbles */
  --radius-sm: 8px;       /* selects, buttons, list rows */
  --radius-pill: 999px;
  /* Soft, warm, and barely there. A neutral black shadow on a cream ground reads as grime. */
  --shadow-sm: 0 1px 2px rgba(60, 50, 35, 0.05);
  --shadow: 0 2px 10px rgba(60, 50, 35, 0.06), 0 1px 2px rgba(60, 50, 35, 0.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui,
          Roboto, Helvetica, Arial, sans-serif;
  /* A serif, for the one heading that sets the tone. No webfont is loaded — that would mean an
     off-origin request this app deliberately never makes — so this is a stack of faces that are
     already on the machine, ordered so Mac, Windows and Linux each land on something with real
     old-style character rather than falling straight through to Times. */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Hoefler Text",
           Georgia, ui-serif, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #262624;
    --bg-raised: #30302d;
    --bg-sunken: #1f1e1c;
    --bg-hover: #3b3a36;
    --border: #45443f;
    --border-soft: #37362f;
    --text: #f4f2ec;
    --text-dim: #aeaaa0;
    --text-faint: #837e74;
    --accent: #d97757;
    --accent-soft: rgba(217, 119, 87, 0.14);
    --user-bubble: #35342f;
    --warn: #d9a343;
    --danger: #d96a5a;
    --ok: #6fae7d;
    --external: #d17ba8;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only `display: none` in the UA stylesheet, so ANY class rule that sets
   `display` outranks it and the element stays on screen. This app toggles several elements with
   `.hidden` from JS — and two of them (the composer buttons, the activity-rail footer) set
   `display`, so both were visible while "hidden". Making the attribute win everywhere kills the
   whole class of bug instead of patching each selector as it is noticed. */
[hidden] { display: none !important; }

/* The shell does not scroll; its three panes do. Saying so is a backstop, not the fix — the
   actual cause of the page scrolling was an unpositioned containing block (see .msg) and that is
   fixed there. This is here because the failure mode is silent and disproportionate: any
   absolutely-positioned descendant added later, anywhere in a scrolling pane, would drag the
   entire layout up the screen again, and the symptom looks nothing like the cause. */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- the @tools card ------------------------------------------------------------------------
   A reference list, not prose, so it is set as rows rather than a bulleted paragraph: the name and
   the scope are the two things somebody scans for, and they sit on one line where they can be
   compared down the column. The description wraps underneath at reading width. */
.tools { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 12px; }

.tool {
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}
.tool:hover { background: var(--bg-sunken); border-color: var(--border-soft); }

.tool-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }

.tool-name { font-family: var(--mono); font-size: 13px; color: var(--text); background: none; padding: 0; }

/* The scope, set quiet and monospaced — it is an identifier, and it is the string a refusal will
   quote back, so it should look like the thing you will see again rather than like prose. */
.tool-scope {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
  background: var(--bg-sunken);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.tool-warn {
  font-size: 10.5px;
  color: var(--warn);
  border: 1px solid currentColor;
  padding: 0 6px;
  border-radius: var(--radius-pill);
}

/* A tool nobody can call is still worth listing — knowing it was declared and is missing is the
   useful fact — but it should not read as available. */
.tool-unserved .tool-name { color: var(--text-dim); text-decoration: line-through; }

.tool-desc { margin: 3px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-dim); max-width: 62ch; }

.tools-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-faint); max-width: 62ch; }

/* Warm, thin, and out of the way. A default Windows scrollbar is a grey slab that cuts the page in
   half and is the first thing that gives away a hand-built UI. */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

::selection { background: var(--accent-soft); }

/* Focus: visible, and the same everywhere. A keyboard user should never have to hunt, and the ring
   is the accent so it reads as part of the design rather than as the browser's default blue. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Screen-reader-only. NOTE the requirement that comes with it: `position: absolute` needs a
   POSITIONED ANCESTOR, or the box lays out against the initial containing block at its static
   position and extends the document — inside a scrolling pane that means the whole page starts
   scrolling. Apply this only to an element whose container is positioned (see .msg). */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---- layout ------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr) 330px;
  height: 100vh;
}

.layout.rail-hidden { grid-template-columns: 256px minmax(0, 1fr); }
.layout.rail-hidden .rail { display: none; }

/* The child selectors are load-bearing, not stylistic. `.sidebar` and `.rail` set `display: flex`
   in their OWN rules further down this file, at the same specificity as a bare `.rail` here — and
   at equal specificity the later rule wins, so `.rail { display: none }` lost to a declaration
   200 lines below it and neither column ever collapsed. The grid dropped to two tracks while the
   elements stayed in the flow, so on a narrow window they wrapped onto a second row and appeared
   stacked UNDER the conversation instead of being hidden. `.layout > .sidebar` outranks
   `.sidebar` regardless of order, which fixes it where it is written rather than by moving these
   queries to the bottom of the file and hoping nobody moves them back. */
@media (max-width: 1180px) {
  .layout, .layout.rail-hidden { grid-template-columns: 240px minmax(0, 1fr); }
  .layout > .rail { display: none; }
}

@media (max-width: 760px) {
  .layout, .layout.rail-hidden { grid-template-columns: minmax(0, 1fr); }
  .layout > .sidebar { display: none; }
}

/* ---- sidebar ------------------------------------------------------------ */

/* No dividing rule: the sidebar is a different SHADE, which is enough separation and reads as one
   continuous surface. A 1px line down the middle of a warm page is a seam. */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 10px;
  gap: 12px;
  background: var(--bg-sunken);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 0;
}

/* The mark. A `●` is a placeholder that shipped; a drawn spark is the difference between an app
   with an identity and a template with a name typed into it — and it is the same shape as the
   favicon, so the tab and the sidebar agree about what this thing is. Sized in px rather than em
   because it sits next to 14.5px text and should not track the heading scale. */
.brand-mark { display: inline-flex; color: var(--accent); }
.brand-spark { width: 15px; height: 15px; fill: currentColor; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text strong { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-faint); }

/* A navigation row, not a button-shaped object. The `+` carries the accent, which is the only
   colour the sidebar needs — a full accent-filled button here would out-shout the conversation
   the user is actually reading. */
.new-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}

.new-chat > span[aria-hidden] { color: var(--accent); font-size: 16px; line-height: 1; }
.new-chat:hover { background: var(--bg-hover); }

.threads {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 -4px;
  padding: 0 4px;
}

.threads-empty, .rail-empty {
  color: var(--text-faint);
  font-size: 12.5px;
  padding: 8px 8px 0;
  margin: 0;
}

.thread-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13.5px;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.thread-item:hover { background: var(--bg-hover); color: var(--text); }
/* The current conversation is marked by WEIGHT and a plain fill, not by a tint. A coloured row in
   a list of twenty is a highlight; the selected item only needs to stop looking dim. */
.thread-item.active { background: var(--bg-hover); color: var(--text); font-weight: 500; }

.thread-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A search hit inside the conversation: the title, then a line of the words around the hit. */
.thread-item-title.has-snippet { display: flex; flex-direction: column; gap: 2px; }
.thread-item-name, .thread-snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-snippet { font-size: 12px; color: var(--text-faint); font-weight: 400; }
.thread-snippet mark { background: none; color: var(--text); font-weight: 600; }
.thread-search-status { color: var(--text-faint); font-size: 12px; padding: 4px 8px; margin: 0; }

/* The end of a list with older conversations behind it (app.js appendOlder). */
.threads-more {
  flex: none;
  margin: 4px 0 8px;
  padding: 6px 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-faint);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.threads-more:hover, .threads-more:focus-visible { color: var(--text); background: var(--bg-hover); }

/* The turn a search opened the conversation at, marked for a moment. */
.msg.search-hit { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius-sm); }

.thread-del {
  flex: none;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
}

.thread-item:hover .thread-del, .thread-item.active .thread-del { opacity: 1; }
.thread-del:hover { color: var(--danger); background: var(--bg-raised); }

/* ---- login switcher ---------------------------------------------------- */

.login {
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.model-label {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.login-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.select {
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.select:hover { border-color: var(--text-faint); }

.login-blurb { margin: 0; font-size: 11.5px; color: var(--text-dim); }
.login-groups { margin: 0; font-size: 11px; color: var(--text-faint); }
.login-note { margin: 2px 0 0; font-size: 10.5px; color: var(--text-faint); font-style: italic; }

/* The signed-in identity, which replaces the persona switcher when a login is configured. This
   was a monospaced `user:cara.nowak` over a monospaced list of groups — correct, and it made the
   bottom of the sidebar look like the output of a `whoami`. The subject and the groups are both
   still exactly one hover away (see the row's title), which is the right depth for something an
   operator needs occasionally and the person signed in never does. */
.whoami { display: flex; align-items: center; gap: 9px; min-width: 0; }
.whoami-text { min-width: 0; }

/* Initials on the accent, at the size of a favicon rather than a profile page: enough to say
   "this is you", not enough to become the loudest thing in the sidebar. */
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.login-who {
  margin: 0;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.login-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* A button that reads as a link: these are secondary to everything else in the sidebar and should
   not compete with "New conversation" for attention. */
.linkish {
  padding: 0;
  font: inherit;
  font-size: 11.5px;
  color: var(--text-dim);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.linkish:hover { color: var(--accent); }

/* ---- connections ------------------------------------------------------- */
/* A quiet sidebar row, the same weight as a conversation: it is a setting you visit once, not a
   thing competing with "New conversation". */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}
.sidebar-link svg { width: 15px; height: 15px; flex: none; }
.sidebar-link:hover { background: var(--bg-hover); color: var(--text); }

.connections-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 20px 22px 22px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.connections-dialog::backdrop { background: rgba(20, 16, 10, 0.35); }
.connections-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.connections-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.connections-intro { margin: 8px 0 14px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.connections-notice {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  color: var(--ok);
}
.connections-notice[data-kind="error"] { color: var(--danger); }
.connections-list { display: flex; flex-direction: column; gap: 8px; }
.conn-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.conn-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.conn-name { font-size: 14px; font-weight: 550; }
.conn-status { font-size: 12px; color: var(--text-faint); overflow-wrap: anywhere; }
.conn-status.conn-on { color: var(--ok); }
.conn-status.conn-down { color: var(--warn); }
.conn-connect { padding: 6px 12px; font-size: 13px; }
.conn-empty { margin: 0; font-size: 13px; color: var(--text-faint); }
.conn-token { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; }
.conn-help { margin: 0; font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.conn-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); }
.conn-field input {
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.conn-form-actions { display: flex; align-items: center; gap: 12px; }

/* --- the login gate --------------------------------------------------------
   Covers the viewport because it is not a modal over the app: until somebody is signed in there
   is no app behind it to see. */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px 26px 26px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand-centred { justify-content: center; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 5px; }

.field > span {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.field > input {
  padding: 9px 11px;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.field > input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary {
  padding: 9px 14px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.primary:hover { filter: brightness(1.06); }
.primary:disabled { opacity: 0.6; cursor: default; filter: none; }

/* The delegated sign-in is an <a>, because the browser must NAVIGATE to the console rather than
   fetch it. So it needs the two things .primary assumes of a <button>: it is block-level and its
   text is centred. Everything else it inherits. */
.login-sso-button {
  display: block;
  text-align: center;
  text-decoration: none;
}
/* The explanatory line above it is guidance, not the small print .login-note is styled for. */
#login-sso-note {
  font-size: 12.5px;
  font-style: normal;
  color: var(--text-dim);
}

/* Never carries the reason a sign-in failed beyond what the server said: the server deliberately
   does not distinguish an unknown user from a wrong password, and this must not either. */
.login-error {
  margin: 0;
  font-size: 12px;
  color: var(--accent);
}

/* ---- main column ------------------------------------------------------- */

.main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

/* No bottom rule. Claude's header floats on the same surface as the transcript; a divider here
   boxes the conversation in and makes the window feel like a form. */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 22px;
  min-height: 56px;
}

.topbar-title { min-width: 0; }

.topbar h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-meta { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* In the composer it is a quiet text control, not a form field: the border and fill would put a
   second box inside the box you are typing in. `margin-left: auto` is what splits the tool row —
   everything before it sits left, this and the send button sit right. */
.model-select {
  width: auto;
  min-width: 0;
  max-width: 300px;
  margin-left: auto;
  padding: 5px 4px 5px 10px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: none;
  border-color: transparent;
  border-radius: var(--radius-pill);
  box-shadow: none;
  text-overflow: ellipsis;
}

.model-select:hover { background: var(--bg-hover); border-color: transparent; color: var(--text); }
.model-select:focus { color: var(--text); }

.ghost-btn {
  padding: 6px 13px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.ghost-btn:hover { background: var(--bg-hover); color: var(--text); }
/* Pressed is a filled pill rather than an accent OUTLINE: an accent border on a transparent
   button reads as an error state, and this one is on by default. */
.ghost-btn[aria-pressed="true"] {
  color: var(--text);
  background: var(--bg-hover);
  border-color: transparent;
}

/* ---- banner ------------------------------------------------------------ */

.banner {
  margin: 12px 22px 0;
  padding: 10px 13px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--warn);
  background: rgba(217, 163, 67, 0.1);
  color: var(--text);
}

.banner code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg-sunken);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ---- transcript -------------------------------------------------------- */

.transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  /* Prose, so it gets prose leading. 1.6 is right for UI chrome and slightly tight for a
     multi-paragraph answer, which is what most of this column is. */
  font-size: 16px;
  line-height: 1.68;
}

.welcome { margin: auto 0; text-align: center; padding: 20px 0 40px; }
/* The one serif on the page, and the reason the app has a voice at all. Large, light and
   old-style: it says "start writing", where a 26px semibold sans says "form heading". */
.welcome h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
/* Above the heading and in the accent: the greeting is the smaller line, and the question is
   still the thing you read. Reversing that — a huge "Good afternoon, Cara" over a small prompt —
   makes the app about the login rather than about what you came to do. */
.welcome-greeting {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* The sub-paragraph that used to carry the "screened, attributed and recorded" line is gone, so
   the heading now sits straight on top of the starters and has to space itself. */
.welcome h2 + .starters { margin-top: 26px; }

.starters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  max-width: 700px;
  margin: 0 auto;
}

.starter {
  padding: 14px 16px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  text-align: left;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 120ms ease, transform 120ms ease, color 120ms ease;
}

.starter:hover {
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* `position: relative` is not decoration — without it the whole PAGE scrolls.
   `.msg-role` below is hidden with the standard screen-reader-only pattern, which is
   `position: absolute`. An absolutely-positioned box is laid out against its nearest POSITIONED
   ancestor, and there was none: not .msg, not .transcript, not .main. So each label resolved
   against the initial containing block and was placed at its static position measured down the
   DOCUMENT — the third one in a long conversation sat 2,235px below the viewport top, and the
   document grew to hold it. The transcript scrolled correctly the whole time; what scrolled
   underneath it was <html>, dragging the entire app shell up and leaving a void below.
   Measured: html.scrollHeight 2236 -> 900 with this one line. */
.msg { position: relative; max-width: 744px; width: 100%; margin: 0 auto; }

.msg-user {
  display: flex;
  justify-content: flex-end;
}

/* Evenly rounded, because the notched corner is a messaging-app idiom and this is a document.
   The user's turn is the only thing on the page that gets a fill; the answer sits on the page
   itself, which is what keeps a long reply from looking like a receipt. */
.msg-user .msg-body {
  background: var(--user-bubble);
  padding: 11px 16px;
  border-radius: var(--radius-lg);
  max-width: 82%;
  font-size: 15.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-assistant .msg-body { overflow-wrap: anywhere; }

/* "ASSISTANT" over every answer is a label for something already obvious from the layout — the
   user's turn is in a bubble, the answer is not. Kept in the DOM because a screen reader has no
   layout to read it from, and removed from the page because sighted readers do.
   (.sr-only's own rules are duplicated rather than shared: this element is created by app.js with
   a fixed class, so the alternative is a JS change to add a second class.)
   `.msg` MUST stay positioned for this — see the note there. */
.msg-role {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Markdown output */
.msg-body > :first-child { margin-top: 0; }
.msg-body > :last-child { margin-bottom: 0; }
.msg-body p { margin: 0 0 14px; }
.msg-body ul, .msg-body ol { margin: 0 0 14px; padding-left: 24px; }
.msg-body li { margin: 3px 0; }
/* A nested list sits INSIDE its parent <li>, so the 12px meant to separate one list from the
   next paragraph would instead open a gap in the middle of an item. Tighten it: a sub-point
   should read as part of the point above it, not as a block after it. */
.msg-body li > ul, .msg-body li > ol { margin: 3px 0 0; }
/* Headings inside an answer stay SANS. The serif is the app's voice, used once, on the hero — a
   serif on every h2 the model happens to emit would turn a reply into a pastiche of an essay. */
.msg-body h1, .msg-body h2, .msg-body h3 {
  margin: 22px 0 8px;
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.msg-body code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-sunken);
  padding: 2px 5px;
  border-radius: 5px;
}
.msg-body blockquote {
  margin: 0 0 12px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--border);
  color: var(--text-dim);
}
/* The scroll container for a wide table, and the anchor for its copy button. `position:
   relative` scopes the button to the block; the button itself is only revealed on hover, because a
   permanent control on every table competes with the numbers. */
.table-block {
  position: relative;
  margin: 0 0 14px;
  overflow-x: auto;
}

/* The table's own controls, top right: "chart" (when it has a column of figures) and "copy table". */
.table-tools {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
  display: flex;
  gap: 4px;
}
.table-copy {
  padding: 3px 9px;
  font: inherit;
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease;
}

.table-block:hover .table-copy,
.table-tools:focus-within .table-copy,
.table-copy:focus-visible { opacity: 1; }
/* The chart under a table. Drawn in the export's own light colours, so it sits on a light card in
   dark mode too rather than putting dark ink on a dark page. */
.table-chart {
  margin: -6px 0 14px; padding: 8px 10px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
  /* The light theme's own text colours inside the card, so its buttons read on white in dark mode. */
  --text: #1f1e1d; --text-dim: #6b6862; --text-faint: #98938a; --bg-hover: #eceae0;
}
.table-chart-kinds { display: flex; gap: 2px; margin-bottom: 6px; }
.table-chart-kinds [aria-pressed="true"] { color: var(--accent); }
.table-chart-kinds [data-close] { margin-left: auto; }
.table-chart-img { display: block; width: 100%; max-width: 640px; height: auto; }
.table-chart-error { margin: 6px 0 0; font-size: 12.5px; color: var(--text-dim); }
.table-copy:hover { color: var(--text); border-color: var(--text-faint); }

/* No hover, no reveal. On a touch device a hover-only control is simply not there, so it stays
   visible — the cost is a small pill on every table, which is the right trade against a feature
   that cannot be found at all. */
@media (hover: none) {
  .table-copy { opacity: 1; }
}

/* Cells do NOT break inside a word. `.msg-body` sets `overflow-wrap: anywhere` so a pasted URL
   cannot force the column wider than the window — correct for prose, wrong for a table, where it
   broke "£21,870,000" across two lines as "£21,870,0" and "00". A figure split like that does not
   read as a wrapped number, it reads as a different number. The table scrolls in .table-block
   instead, which is the trade every spreadsheet already makes. */
.msg-body th, .msg-body td {
  overflow-wrap: normal;
  word-break: normal;
}

.msg-body table {
  border-collapse: collapse;
  margin: 0 0 12px;
  font-size: 13px;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.msg-body th, .msg-body td {
  border: 1px solid var(--border);
  padding: 5px 9px;
  text-align: left;
}
.msg-body th { background: var(--bg-sunken); font-weight: 600; }
.msg-body hr { border: none; border-top: 1px solid var(--border-soft); margin: 16px 0; }

.code-block {
  position: relative;
  margin: 0 0 14px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border-soft);
}

.code-copy {
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 4px;
  border-radius: 3px;
}

.code-copy:hover { color: var(--text); background: var(--bg-hover); }
/* "preview" sits beside "copy", on the right with it; the accent says it opens something. */
.code-preview { margin-left: auto; color: var(--accent); }

.code-block pre {
  margin: 0;
  padding: 11px 12px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
}

.code-block pre code { background: none; padding: 0; font-size: inherit; }

/* A prose fence wraps instead of scrolling — see the PROSE_FENCES note in app.js for why this is
   split rather than applied to every block. `overflow-x: auto` is kept as the backstop: pre-wrap
   plus break-word still cannot break a 300-character unbroken token (a long URL), and scrolling
   to it beats having it clipped.
   Purely visual: pre-wrap inserts no characters, so the copy button still yields the original. */
.code-block--prose pre {
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* Answer footer: provenance + copy */
.msg-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-faint);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10.5px;
}

.chip-internal { border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.chip-external {
  border-color: color-mix(in srgb, var(--external) 50%, transparent);
  color: var(--external);
}

.copy-msg {
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 4px;
}

.copy-msg:hover { color: var(--text); background: var(--bg-hover); }

/* Listen appears only where this device has a voice of its own (speech.js). */
.listen-btn { display: none; }
body.speech-on .listen-btn { display: inline-block; }
.listen-btn[aria-pressed="true"] { color: var(--accent); }

/* Thumbs on an answer: the same quiet buttons as Copy, and the one chosen keeps its colour. */
.feedback { display: inline-flex; gap: 1px; margin-left: 2px; }
.feedback-btn { display: inline-flex; align-items: center; padding: 3px 5px; }
.feedback-down svg { transform: rotate(180deg); }
.feedback-btn[aria-pressed="true"] { color: var(--accent); }
.feedback-btn[aria-pressed="true"] path { fill: color-mix(in srgb, var(--accent) 25%, transparent); }
.feedback-form { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); font-size: 13px; }
.feedback-form label { display: block; color: var(--text-dim); }
.feedback-form label span { color: var(--text-faint); font-size: 12px; }
.feedback-form textarea { display: block; width: 100%; margin-top: 6px; box-sizing: border-box; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.feedback-form-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.feedback-status { color: var(--text-dim); font-size: 12.5px; }

.thinking {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  color: var(--text-faint);
  font-size: 13px;
}

.thinking i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.2s infinite ease-in-out;
}

.thinking i:nth-child(2) { animation-delay: 0.18s; }
.thinking i:nth-child(3) { animation-delay: 0.36s; }

@keyframes pulse {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .thinking i { animation: none; opacity: 0.6; }
}

/* The bubble while the model node runs: the dots, then "Thinking… 7s". The count is the model's
   own running time (it starts on the runtime's `node started` event), and it is the one honest
   thing to show for a wait the runtime exposes no tokens during. Tabular digits so the seconds
   tick without the text shuffling. */
.thinking-label { margin-left: 8px; color: var(--text-faint); font-size: 13px; }
.thinking-secs { font-variant-numeric: tabular-nums; color: var(--text-dim); }

/* "thought for 12s" under an answer — the accent, because it is the one chip about what the
   assistant did rather than where it ran. `.chip-plain` is the same chip carrying a bare duration
   when the audit trail could not confirm any reasoning: no claim, so no colour. */
.chip-thinking { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.chip-thinking.chip-plain { border-color: var(--border); color: var(--text-dim); }

/* The model's working, above the answer it led to. Collapsed by default and visibly NOT the
   answer: a quiet rule down the side, plain text, smaller and dimmer, scrolling inside its own box
   so a long think never pushes the reply off the screen. */
.working {
  margin: 0 0 10px;
  padding-left: 10px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  font-size: 12.5px;
  color: var(--text-dim);
}
.working summary {
  cursor: pointer;
  list-style: none;
  font-size: 11.5px;
  color: var(--text-faint);
  user-select: none;
}
.working summary::-webkit-details-marker { display: none; }
.working summary::before { content: "▸ "; }
.working[open] summary::before { content: "▾ "; }
.working summary:hover { color: var(--text-dim); }
.working-text {
  margin: 8px 0 0;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.5;
}

.msg-error {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--danger);
  background: rgba(217, 106, 90, 0.1);
  font-size: 13px;
}

.msg-error strong { display: block; margin-bottom: 3px; }
.msg-error .hint { display: block; margin-top: 6px; color: var(--text-dim); font-size: 12.5px; }

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

.composer { padding: 8px 22px 18px; }

/* Tall, soft, and lifted off the page. This is the object the user's eye returns to between every
   turn, so it gets the largest radius and the only real shadow in the app.
   Focus DARKENS the border and deepens the shadow instead of turning it terracotta: an accent
   outline on the element you are typing into reads as a validation error, and it competes with the
   send button, which is the one thing here that should be accent-coloured. */
.composer-form {
  /* The containing block for the @tools picker, which is absolutely positioned above the box. It
     is stated here rather than left to an ancestor on purpose: an unpositioned chain is what let
     an absolute descendant scroll the whole shell once already (see html, body above). */
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  max-width: 744px;
  margin: 0 auto;
  padding: 12px 12px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

/* The control row under the textarea: attach on the left, then the model and send pushed right.
   The model sits next to SEND rather than next to the text because it is a property of the
   message about to leave, and putting it there is what makes "escalate this one question to the
   frontier model" a visible choice at the moment of asking instead of a setting in a header. */
.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-form:focus-within {
  border-color: var(--text-faint);
  box-shadow: 0 4px 18px rgba(60, 50, 35, 0.09), 0 1px 3px rgba(60, 50, 35, 0.06);
}

/* The ring belongs on the composer as a whole, not on the bare textarea inside it — the box IS
   the control as far as the user is concerned. */
.composer-input:focus-visible { outline: none; }

/* ---- the @tools picker ------------------------------------------------------------------------
   A menu that opens UPWARD out of the composer, because the composer is at the bottom of the
   screen and a menu that opened downward would leave the screen. It is styled as the composer's
   own drawer — same raised surface, same radius, the one real shadow in the app — rather than as
   a floating panel: it belongs to the box you are typing in.

   The rows reuse `.tool-scope` and `.tool-warn` from the card above, so a scope chip looks the
   same whether it is met in the menu or in the catalogue. */

.tool-picker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  /* Above the transcript, below the drop overlay (z-index: 50) — a file being dragged over the
     window is the more urgent thing to look at. */
  z-index: 30;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tool-picker-head {
  padding: 9px 12px 7px;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border-soft);
}

/* Capped and scrolled: the catalogue can be longer than the space above the composer, and a menu
   that grows to the top of the window covers the answer being read. */
.tool-picker-list {
  max-height: 268px;
  overflow-y: auto;
  padding: 4px;
}

.tool-option {
  display: block;
  width: 100%;
  padding: 7px 9px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* One highlight for both the keyboard and the mouse: hovering a row IS selecting it (app.js moves
   the active index on mouseenter), so there is never a hover on one row and a caret on another. */
.tool-option.active {
  background: var(--accent-soft);
  border-color: var(--border-soft);
}

.tool-option:disabled {
  cursor: default;
  opacity: 0.65;
}

.tool-option-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.tool-option-name {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
  background: none;
  padding: 0;
}

.tool-option-unserved .tool-option-name { color: var(--text-dim); text-decoration: line-through; }

/* One line, clipped. The full description is a hover away and in the `@tools` card; a menu whose
   rows are three lines tall shows four tools where it could show eight. */
.tool-option-desc {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-picker-empty {
  margin: 0;
  padding: 8px 9px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.tool-picker-foot {
  margin: 0;
  padding: 7px 12px 8px;
  font-size: 11px;
  color: var(--text-faint);
  border-top: 1px solid var(--border-soft);
}

/* ---- drag-and-drop overlay ---- */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  /* Plain rgba first as the fallback: color-mix is well supported now but a browser without it
     would otherwise render a fully transparent overlay, i.e. an invisible affordance. */
  background: rgba(0, 0, 0, 0.55);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  /* Inert to the pointer: the overlay must never become the element the drop lands on, or the
     dragleave/drop bookkeeping starts firing against the overlay instead of the page. */
  pointer-events: none;
}

.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 40px;
  text-align: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.drop-icon { font-size: 24px; }
.drop-card strong { font-size: 15px; }
.drop-sub { font-size: 12.5px; color: var(--text-dim); }

/* ---- attachments ---- */

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 760px;
  margin: 0 auto 8px;
}

/* Thumbnail on an attachment chip. Images only, and only because a filename cannot identify a
   screenshot: "pasted-image-2.png" tells you nothing about which one you pasted, and pasting the
   wrong one is easy and silent. Small enough not to change the chip's height much. */
.attach-chip-thumb {
  width: 26px; height: 26px; flex: none;
  margin: -2px 0 -2px -4px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.attach-chip {
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 6px 4px 10px;
  font-size: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 100%;
}

.attach-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 26ch;
}

.attach-chip-size { color: var(--text-faint); flex: none; }
.attach-chip.over .attach-chip-size { color: var(--warn); }

.attach-chip-del {
  flex: none;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}

.attach-chip-del:hover { color: var(--danger); background: var(--bg-hover); }

.attach-btn {
  flex: none;
  width: 32px; height: 32px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.attach-btn:hover { background: var(--bg-hover); color: var(--text); }
.attach-btn:disabled { color: var(--border); cursor: default; background: none; }

/* Files sent with a user turn, shown on the message bubble so the transcript records what went
   with it rather than only the typed text. */
.msg-files {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
  margin-bottom: 5px;
}

.msg-file {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.msg-file-icon {
  width: 11px;
  height: 11px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.composer-input {
  /* `flex: none` matters now the form is a COLUMN: `flex: 1` would make the textarea absorb all
     the spare height and shove the tool row to the bottom of a tall empty box. It sizes itself
     from its content instead (autosize() in app.js), which is what makes the composer grow
     downward as you type. */
  flex: none;
  width: 100%;
  min-width: 0;
  resize: none;
  border: none;
  outline: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;    /* also stops iOS zooming the page on focus */
  line-height: 1.5;
  padding: 6px 0;
  max-height: 220px;
}

.composer-input::placeholder { color: var(--text-faint); }

.send-btn {
  flex: none;
  width: 32px; height: 32px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  transition: background 120ms ease, opacity 120ms ease;
}

.send-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
/* Faded rather than greyed. A disabled control filled with --border reads as a different control;
   this one reads as the same button, waiting. */
.send-btn:disabled { background: var(--accent); opacity: 0.32; color: #fff; cursor: default; }

/* Streaming: same button, same size and position — only the fill and the glyph change, so the
   control never moves under the cursor as a turn starts and finishes. */
.send-btn.streaming { background: var(--bg-hover); color: var(--text); }
.send-btn.streaming .send-glyph { font-size: 10px; }

.composer-note {
  max-width: 744px;
  margin: 9px auto 0;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

/* Quieter than the keyboard hint above it: this has to be present and legible, not read twice. */
.composer-disclosure {
  max-width: 744px;
  margin: 3px auto 0;
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
}

/* ---- governance rail --------------------------------------------------- */

.rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-sunken);
}

.rail-head { padding: 16px 18px 12px; }
.rail-head h2 { margin: 0 0 3px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-dim); }
.rail-sub { margin: 0; font-size: 11px; color: var(--text-faint); }

.rail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step {
  display: flex;
  gap: 9px;
  font-size: 12.5px;
  line-height: 1.45;
}

.step-dot {
  flex: none;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--text-faint);
}

.step-thread .step-dot { background: var(--accent); }
.step-guardrail .step-dot { background: var(--warn); }
.step-model .step-dot { background: var(--ok); }
.step-external .step-dot { background: var(--external); }
.step-warn .step-dot { background: var(--warn); }
.step-memory .step-dot { background: var(--accent); }
.step-attach .step-dot { background: var(--text-dim); }
.step-titler .step-dot { background: var(--text-faint); }
.step-thinking .step-dot { background: var(--accent); }

.step-label { color: var(--text); }
.step-detail { color: var(--text-faint); font-size: 11.5px; }

.rail-foot {
  border-top: 1px solid var(--border-soft);
  padding: 11px 16px;
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-foot dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.rail-foot dt { color: var(--text-faint); }
.rail-foot dd { margin: 0; font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }

/* ---- document pane ------------------------------------------------------------------------ */
/* On the RIGHT. While it is open the conversation moves over to make room (margin on the layout)
   rather than being covered, the activity rail steps aside, and on narrower screens the
   conversation list does too, so the chat keeps a usable width beside the document. */

:root { --doc-pane-w: clamp(440px, 46vw, 780px); }

.doc-pane {
  position: fixed;
  inset: 0 0 0 auto;
  width: var(--doc-pane-w);
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(40, 32, 20, 0.12);
  animation: doc-pane-in 0.18s ease-out;
}
.doc-pane[hidden] { display: none; }
@keyframes doc-pane-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .doc-pane { animation: none; } }

body.doc-pane-open .layout,
body.doc-pane-open .layout.rail-hidden,
body.artifact-pane-open .layout,
body.artifact-pane-open .layout.rail-hidden { margin-right: var(--doc-pane-w); grid-template-columns: 256px minmax(0, 1fr); }
body.doc-pane-open .layout > .rail,
body.artifact-pane-open .layout > .rail { display: none; }
@media (max-width: 1500px) {
  body.doc-pane-open .layout,
  body.doc-pane-open .layout.rail-hidden,
  body.artifact-pane-open .layout,
  body.artifact-pane-open .layout.rail-hidden { grid-template-columns: minmax(0, 1fr); }
  body.doc-pane-open .layout > .sidebar,
  body.artifact-pane-open .layout > .sidebar { display: none; }
}
@media (max-width: 900px) {
  .doc-pane { width: 100vw; }
  body.doc-pane-open .layout, body.doc-pane-open .layout.rail-hidden,
  body.artifact-pane-open .layout, body.artifact-pane-open .layout.rail-hidden { margin-right: 0; }
}

/* The preview pane (artifact-pane.js) wears the document pane's frame. What it draws sits on white,
   as a page or an image would, in either theme. */
.artifact-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; padding: 6px 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artifact-scripts { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; }
.artifact-scripts[hidden] { display: none; }
.artifact-note { margin: 0; padding: 8px 16px; font-size: 12.5px; color: var(--warn); border-bottom: 1px solid var(--border-soft); }
.artifact-body { flex: 1; min-height: 0; display: flex; padding: 14px; background: var(--bg); }
.artifact-frame { flex: 1; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.artifact-svg { max-width: 100%; max-height: 100%; margin: auto; background: #fff; border-radius: var(--radius-sm); }

.doc-pane-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 10px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.doc-title {
  flex: 1; min-width: 0;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--text);
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 6px 8px;
}
.doc-title:hover { border-color: var(--border); }
.doc-title:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.doc-close {
  width: 32px; height: 32px; flex: none;
  font-size: 22px; line-height: 1; color: var(--text-dim);
  background: none; border: none; border-radius: var(--radius-sm); cursor: pointer;
}
.doc-close:hover { background: var(--bg-hover); color: var(--text); }

.doc-seg { display: inline-flex; flex: none; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-pill); }
.doc-seg button {
  font: inherit; font-size: 12.5px; color: var(--text-dim);
  padding: 4px 12px; border: none; background: none; border-radius: var(--radius-pill); cursor: pointer;
}
.doc-seg button[aria-pressed="true"] { background: var(--text); color: var(--bg-raised); }

.doc-btn {
  flex: none; font: inherit; font-size: 12.5px; color: var(--text);
  padding: 6px 13px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-pill); cursor: pointer;
}
.doc-btn:hover { background: var(--bg-hover); }
.doc-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.doc-btn-primary:hover { background: var(--accent); filter: brightness(0.94); }
.doc-btn-quiet { border-color: transparent; color: var(--text-dim); }
.doc-btn:disabled { opacity: 0.6; cursor: default; }
.doc-link {
  font: inherit; font-size: 12.5px; color: var(--accent);
  background: none; border: none; padding: 0 0 0 10px; cursor: pointer; text-decoration: underline;
}

.doc-template { padding: 10px 16px; border-bottom: 1px solid var(--border-soft); }
.doc-template-ask { background: var(--accent-soft); }
.doc-template-q { margin: 0 0 3px; font-weight: 600; font-size: 14px; }
.doc-template-sub { margin: 0 0 10px; font-size: 12.5px; color: var(--text-dim); }
.doc-template-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-template-line { margin: 0; font-size: 12.5px; color: var(--text-dim); }
.doc-template-error { margin: 8px 0 0; font-size: 12.5px; color: var(--danger); }

.doc-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px 0; }
.design-chip {
  display: inline-block; margin: 2px 0 10px; padding: 2px 10px; font-size: 12px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
}
.doc-style { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.doc-style select {
  font: inherit; font-size: 12.5px; color: var(--text); background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px 8px; cursor: pointer;
}
.sl-chart { width: 100%; height: 100%; display: block; }
.doc-status { font-size: 12px; color: var(--text-faint); }

.doc-pane-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px 16px 16px; }
.doc-edit { display: flex; flex-direction: column; gap: 6px; flex: 0 0 38%; min-height: 160px; }
.doc-edit[hidden] { display: none; }
.doc-edit textarea {
  flex: 1; resize: none; font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.doc-edit textarea:focus { outline: none; border-color: var(--accent); }
.doc-edit-note { margin: 0; font-size: 11.5px; color: var(--text-faint); }

.doc-preview { flex: 1; min-height: 0; overflow-y: auto; background: var(--bg-sunken); border-radius: var(--radius); }
.doc-note { margin: 24px; color: var(--text-dim); font-size: 13px; }
.doc-frame { display: block; width: 100%; height: 100%; min-height: 480px; border: 0; }

/* The deck: each recorded slide drawn at its own proportions, scaling with the pane. */
.deck { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.deck-item { margin: 0; }
.deck-item figcaption { margin-top: 4px; font-size: 11px; color: var(--text-faint); text-align: right; }
.slide {
  position: relative; width: 100%; overflow: hidden;
  container-type: inline-size;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.sl { position: absolute; box-sizing: border-box; }
.sl-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sl-text { display: flex; flex-direction: column; overflow: hidden; }
.sl-p { position: relative; margin: 0; line-height: 1.2; white-space: pre-wrap; overflow-wrap: anywhere; }
.sl-bullet { position: absolute; top: 0; }
.sl-table { width: 100%; border-collapse: collapse; line-height: 1.2; }

/* Above the composer while the pane is open: this conversation is now editing that document. */
.doc-link-bar {
  max-width: 744px; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 12px; font-size: 12.5px; color: var(--text);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius-sm);
}
.doc-link-bar[hidden] { display: none; }
.doc-link-bar-off { background: var(--bg-sunken); border-color: var(--border); color: var(--text-dim); }
.doc-revised { font-size: 12px; color: var(--text-dim); }
.doc-revised[hidden] { display: none; }

/* The conversation list is unreachable, not empty (see loadThreads). */
.threads-empty-warn { color: var(--warn); line-height: 1.45; }

/* ---- conversation list: search, groups, the row menu --------------------- */
/* The row is a div holding two buttons (open, ⋯) rather than one button with another nested in it,
   which HTML does not allow and screen readers announce as one control. */
.thread-search {
  width: 100%;
  margin: 0 0 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.thread-search::placeholder { color: var(--text-faint); }
.thread-group {
  margin: 10px 8px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-faint);
}
.thread-group:first-child { margin-top: 0; }
.thread-item { position: relative; cursor: default; }
.thread-item .thread-item-title {
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.thread-menu-btn {
  flex: none;
  border: none;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
}
.thread-item:hover .thread-menu-btn, .thread-item.active .thread-menu-btn,
.thread-menu-btn:focus-visible { opacity: 1; }
.thread-menu-btn:hover { color: var(--text); background: var(--bg-raised); }
.thread-menu {
  position: absolute;
  top: calc(100% - 2px);
  right: 4px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 130px;
  padding: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.thread-menu button {
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.thread-menu button:hover, .thread-menu button:focus-visible { background: var(--bg-hover); }
.thread-menu button.danger { color: var(--danger); }
.thread-rename {
  flex: 1;
  min-width: 0;
  padding: 2px 6px;
  font: inherit;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--accent);
  border-radius: 6px;
}

/* ---- incognito ---------------------------------------------------------- */
/* Unmistakable without being alarming: a dashed edge on the conversation and a note on the welcome
   screen. It has to read as "a different kind of chat" at a glance, every time. */
.incognito-btn[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
.incognito-btn:disabled { opacity: 0.45; cursor: default; }
.layout.incognito .main { box-shadow: inset 0 0 0 2px var(--text-faint); }
.layout.incognito .topbar { border-bottom-style: dashed; }
.incognito-note {
  max-width: 520px;
  margin: 0 auto 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
  text-align: center;
}

/* ---- versions: regenerate and edit -------------------------------------- */
.version-group { display: contents; }
.version { display: contents; }
.version[hidden] { display: none; }
.version-nav {
  max-width: 744px;
  width: 100%;
  margin: -8px auto 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-faint);
}
.version-nav:empty { display: none; }
.version-nav button {
  padding: 1px 7px;
  font: inherit;
  font-size: 14px;
  color: var(--text-dim);
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.version-nav button:hover:not(:disabled) { color: var(--text); background: var(--bg-hover); }
.version-nav button:disabled { opacity: 0.35; cursor: default; }
/* Edit sits to the left of your last message and appears on hover, as on a phone keyboard's long-press:
   always there, never in the way. */
.msg-user .edit-msg {
  order: -1;
  align-self: flex-end;
  margin-right: 6px;
  padding: 2px 6px;
  font: inherit;
  font-size: 11px;
  color: var(--text-faint);
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
}
.msg-user:hover .edit-msg, .msg-user .edit-msg:focus-visible { opacity: 1; }
.msg-user .edit-msg:hover { color: var(--text); background: var(--bg-hover); }
.retry-btn { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--text); }

/* ---- settings ----------------------------------------------------------- */
.settings-dialog { width: min(560px, calc(100vw - 32px)); }
.settings-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 0 14px;
  border-bottom: 1px solid var(--border-soft);
}
.settings-tabs button {
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
}
.settings-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.settings-body { max-height: min(60vh, 520px); overflow-y: auto; }
.settings-form { display: flex; flex-direction: column; gap: 12px; }
.settings-form[hidden] { display: none; }
.settings-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-dim); }
.settings-field textarea, .settings-field input {
  padding: 8px 10px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
}
.settings-count { align-self: flex-end; font-size: 11px; color: var(--text-faint); }
.settings-note { margin: 0 0 12px; font-size: 12.5px; line-height: 1.5; color: var(--text-dim); }
.settings-form .settings-note { margin: 0; }
.settings-actions { display: flex; align-items: center; gap: 12px; }
.settings-saved { font-size: 12.5px; color: var(--ok); }
.prompt-list, .memory-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.prompt-row, .memory-row {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.prompt-row { align-items: flex-start; justify-content: space-between; }
.prompt-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 13px; }
.prompt-text span {
  color: var(--text-dim);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.prompt-actions { display: flex; gap: 8px; flex: none; }
.memory-row { flex-direction: column; gap: 6px; }
.memory-text { margin: 0; font-size: 13px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.memory-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--text-faint); }
.memory-forget:hover, .memory-forget-all:hover { color: var(--danger); }
.memory-all { display: flex; justify-content: flex-end; font-size: 12.5px; }
.memory-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text); }
.memory-yes {
  padding: 2px 10px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  font: inherit;
  cursor: pointer;
}
.memory-yes:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.memory-yes:disabled { opacity: 0.6; cursor: default; }
.starter-saved { font-family: var(--mono); font-size: 12.5px; }

/* ---- where an answer looked ---------------------------------------------- */
.msg-sources { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--text-faint); }
.chip-source { border-color: color-mix(in srgb, var(--ok) 40%, transparent); color: var(--ok); }
.step-tool .step-dot { background: var(--ok); }

/* ---- email draft ------------------------------------------------------- */
/* A card, not a code block: it is a message waiting to be sent, and the actions say who sends it. */
.email-draft {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
}
.email-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border-soft);
}
.email-head span { font-weight: 400; color: var(--text-faint); }
.email-field {
  display: flex;
  gap: 10px;
  padding: 6px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border-soft);
  overflow-wrap: anywhere;
}
.email-field span { flex: none; width: 56px; color: var(--text-faint); }
.email-body { padding: 12px 14px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
}
.email-btn {
  padding: 5px 12px;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.email-btn:hover { background: var(--bg-hover); }
.email-actions .email-btn:first-child { color: #fff; background: var(--accent); border-color: var(--accent); }
/* Saving to Drafts is offered only where it can work, and then it leads: the other actions step back. */
.email-save, .email-send, .event-add, .jira-create { display: none; }
/* The other act-on-click buttons, each where its agent and connection exist (app.js loadConfig). */
body.send-on .email-actions .email-send,
body.events-on .email-actions .event-add,
body.jira-on .email-actions .jira-create { display: inline-block; color: #fff; background: var(--accent); border-color: var(--accent); }
/* The Outlook panel: Reply on a message being read, Insert into one being written; Outlook's own
   window replaces the links that open a new message elsewhere. */
.outlook-reply, .outlook-insert { display: none; }
body.outlook-read .outlook-reply, body.outlook-compose .outlook-insert { display: inline-block; }
body.outlook-on .email-actions .email-open { display: none; }
body.outlook-read .email-actions [data-reply-email],
body.outlook-compose .email-actions .outlook-insert { order: -1; color: #fff; background: var(--accent); border-color: var(--accent); }
/* A change to the document: Apply and Discard only in the Word panel, where it can be made, and for a
   rewrite of the selected text also in an email being written. */
.doc-apply, .doc-discard { display: none; }
body.word-on .doc-edit .doc-apply, body.word-on .doc-edit .doc-discard,
body.outlook-compose .doc-edit--selection .doc-apply, body.outlook-compose .doc-edit--selection .doc-discard { display: inline-block; }
.doc-edit-body { white-space: normal; }
.doc-edit-body > :first-child { margin-top: 0; }
.doc-edit-body > :last-child { margin-bottom: 0; }
.doc-edit--discarded .doc-edit-body { opacity: 0.5; text-decoration: line-through; }
body.send-on .email-actions .email-send[data-confirm="1"] { background: var(--danger); border-color: var(--danger); }
.email-actions .email-saved { color: var(--ok) !important; background: none !important; border-color: var(--ok) !important; cursor: default; }
.email-actions a.email-saved { cursor: pointer; }
.email-send:disabled, .event-add:disabled, .jira-create:disabled { opacity: 0.7; cursor: progress; }
body.answering :is(.email-send, .event-add, .jira-create, .doc-apply):not(.email-saved) { opacity: 0.5; pointer-events: none; }
body.drafts-on .email-actions .email-save { display: inline-block; order: -1; color: #fff; background: var(--accent); border-color: var(--accent); }
body.drafts-on .email-actions .email-btn:first-child:not(.email-save) { color: var(--text); background: none; border-color: var(--border); }
body.drafts-on .email-actions .email-saved { color: var(--ok); background: none; border-color: var(--ok); cursor: default; }
body.drafts-on .email-actions a.email-saved { cursor: pointer; }
.email-save:disabled { opacity: 0.7; cursor: progress; }
body.answering .email-save:not(.email-saved) { opacity: 0.5; pointer-events: none; }
.email-note { padding: 0 14px 10px; font-size: 12.5px; color: var(--text-dim); }
.email-note[data-kind="error"] { color: var(--danger); }

/* ---- projects ------------------------------------------------------------ */
/* The picker narrows the list and decides where a new conversation starts; the chip says which
   project the open conversation is in, and opens it for editing. */
.project-select {
  width: 100%;
  margin: 0 0 8px;
  font-size: 13px;
}
.thread-project {
  display: inline-flex;
  align-items: center;
  max-width: 220px;
  margin: 2px 6px 0 0;
  padding: 1px 8px;
  font: inherit;
  font-size: 11px;
  line-height: 1.6;
  color: var(--accent);
  background: var(--accent-soft);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.thread-project:hover { text-decoration: underline; }
.thread-project[hidden] { display: none; }
.settings-hint { color: var(--text-faint); font-weight: 400; }

/* ---- code highlighting (app.js highlightCode) ---------------------------- */
/* The page's own tokens, so light and dark follow the theme without a second palette. */
.tk-k { color: var(--accent); }
.tk-s { color: var(--ok); }
.tk-n { color: var(--external); }
.tk-c { color: var(--text-faint); font-style: italic; }
.tk-a { color: var(--warn); }

/* ---- Word / Excel panel (office-host.js) ---------------------------------- */
/* Only drawn when the page is the Office add-in's panel (body.in-office). */
.office-reading {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 760px;
  margin: 0 auto 8px;
  font-size: 12px;
  color: var(--text-faint);
  cursor: pointer;
}
.office-reading span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.office-reading input { margin: 0; flex: none; }
.office-reading:has(input:not(:checked)) span { text-decoration: line-through; }
.office-reading[hidden], .office-menu[hidden] { display: none; }
/* The task buttons: each only where it applies, and the row only when one of them is. */
.office-tasks { display: none; flex-wrap: wrap; gap: 6px; max-width: 760px; margin: 0 auto 8px; }
body.outlook-compose .office-tasks:not([hidden]), body.word-on .office-tasks:not([hidden]) { display: flex; }
.office-task { display: none; }
body.outlook-compose .office-task[data-office-task="draft-email"],
body.word-on .office-task[data-office-task="draft-document"] { display: inline-block; }
.office-task {
  font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text);
}
.office-task:hover { border-color: var(--accent); color: var(--accent); }
.office-menu { flex: none; font-size: 16px; }

/* The panel is narrower than the point where the sidebar is hidden; the menu button brings it
   back over the conversation. */
@media (max-width: 760px) {
  body.in-office.sidebar-open .layout > .sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    z-index: 50;
    box-shadow: 0 0 24px rgba(0, 0, 0, 0.18);
  }
}
