/*
 * Stylesheet for the GRCS AI Agent Platform (served as /static/app.css).
 *
 * The rules under "Shared shell" are mirrored by the APP_CSS constant in
 * src/app/html.ts, which is the fallback when this file is not on disk;
 * keep the two in sync by hand if either changes. Everything under "Chat
 * page" is specific to the Marketing Assistant chat built by public/app.js.
 *
 * Branding follows the GRC Solutions brand guidelines (March 2025); the rules
 * for new UI and the approved assets are in docs/brand/README.md. In short:
 * - Core palette only: Maastricht Blue #091a32 (text, header, dark
 *   background), Dodger Blue #1f83ff (icons, focus), Iris Blue #5e2fd3 and
 *   Turquoise Blue #04fae3 (calls to action), the Turquoise-to-Iris gradient
 *   as an accent, and neutral greys. Tints of Iris are the only derived
 *   colours. Red (errors) and amber (development banner) are functional
 *   states, not brand colours.
 * - Type: Segoe UI, the approved Microsoft alternative for internal tools.
 *   Proxima Nova and Greycliff CF are not web-licensed here, and the CSP
 *   allows only same-origin assets. Headings bold, body regular.
 * - Logo: the unmodified white logo from grcsolutions.io, on Maastricht
 *   Blue only, at the 259 x 68 px combination-mark minimum.
 * - Contrast: body text and button labels meet WCAG AA in both schemes.
 *   Dodger Blue is not used for text on white (3.6:1); links and primary
 *   buttons use Iris on light and Turquoise on dark.
 *
 * Colours, radii and type are design tokens on :root so rules never carry
 * raw colours. No external fonts or images: the CSP allows only
 * same-origin assets.
 */

/* ---- Tokens -------------------------------------------------------------- */

:root {
  color-scheme: light dark;
  --font-sans:
    'Segoe UI', 'Segoe UI Variable Text', system-ui, -apple-system, Roboto, 'Helvetica Neue',
    sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, SFMono-Regular, Menlo, monospace;
  --maastricht: #091a32;
  --dodger: #1f83ff;
  --iris: #5e2fd3;
  --turquoise: #04fae3;
  /* The brand gradient: turquoise through blue to iris, blended at 60%. */
  --brand-gradient: linear-gradient(90deg, var(--turquoise), 60%, var(--iris));
  --header-bg: var(--maastricht);
  --header-fg: #ffffff;
  --header-muted: #c3cddb;
  --bg: #f4f6f9;
  --fg: var(--maastricht);
  --heading: var(--maastricht);
  --muted: #4f5d70;
  --border: #d8dee8;
  --surface: #ffffff;
  --surface-2: #edf0f5;
  --accent: var(--iris);
  --accent-fg: #ffffff;
  --link: var(--iris);
  --icon: var(--dodger);
  --user-bubble: #ebe5fa;
  --danger: #b42318;
  /* Functional states for the call brief (ADR 0020); outside the brand palette by rule 2's exception. */
  --danger-bg: #fde8e6;
  --ok: #18794e;
  --ok-bg: #e3f5ec;
  --warn: #8a5300;
  --warn-bg: #fff3d6;
  --focus: var(--dodger);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --shadow: 0 1px 2px rgb(9 26 50 / 6%), 0 6px 24px rgb(9 26 50 / 7%);
  --column: 48rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--maastricht);
    --fg: #eef2f8;
    --heading: #ffffff;
    --muted: #a9b6c9;
    --border: #243a58;
    --surface: #0f2340;
    --surface-2: #172f50;
    --accent: var(--turquoise);
    --accent-fg: var(--maastricht);
    --link: var(--turquoise);
    --icon: var(--turquoise);
    --user-bubble: #251f5e;
    --danger: #ff8a7a;
    --danger-bg: #44181a;
    --ok: #6fdba6;
    --ok-bg: #11392a;
    --warn: #ffc966;
    --warn-bg: #3d2e0b;
    --focus: var(--turquoise);
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 24px rgb(0 0 0 / 30%);
  }
}

/* ---- Shared shell (mirrors APP_CSS in src/app/html.ts) ------------------ */

html {
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  padding: 0.5rem;
  background: var(--surface);
}
.skip:focus {
  left: 0.5rem;
  z-index: 10;
}
.top {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 0.875rem 1.5rem;
  background: var(--header-bg);
  color: var(--header-fg);
  flex: none;
}
/* Brand accent: the gradient as a rule under the header, clear of the logo. */
.top::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--brand-gradient);
}
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
/* The logo is never scaled below the brand minimum (259 x 68 px). */
.brand-logo {
  display: block;
  width: 259px;
  height: 68px;
  flex: none;
}
/* The product name sits outside the logo's clear space, after a divider. */
.brand-product {
  margin-left: 2.5rem;
  padding-left: 1.25rem;
  border-left: 1px solid rgb(255 255 255 / 30%);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--header-fg);
}
@media (max-width: 48rem) {
  .brand-product {
    display: none;
  }
}
.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.top button,
.top .button {
  background: transparent;
  border-color: rgb(255 255 255 / 35%);
  color: var(--header-fg);
}
.top button:hover,
.top .button:hover {
  background: rgb(255 255 255 / 10%);
}
.top button[aria-expanded='true'] {
  background: rgb(255 255 255 / 16%);
  border-color: rgb(255 255 255 / 60%);
}
.top :focus-visible {
  outline-color: var(--turquoise);
}
.signout {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin: 0;
}
.signout span {
  color: var(--header-muted);
  font-size: 0.95rem;
}
main {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  box-sizing: border-box;
}
button,
.button {
  font: inherit;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  line-height: 1.3;
}
button:hover,
.button:hover {
  background: var(--surface-2);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}
.primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, black);
  border-color: color-mix(in srgb, var(--accent) 86%, black);
}
h1,
h2,
h3 {
  color: var(--heading);
}
main > h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.5rem 0 0.75rem;
}
.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.ghost:hover {
  background: var(--surface-2);
  color: var(--fg);
}
.sources {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
}
.sources li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.2rem 0.75rem 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--muted);
}
/* A small gradient disc echoing the circular brand icons. */
.sources li::before {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--brand-gradient);
  flex: none;
}
.muted {
  color: var(--muted);
}
.notice {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
[hidden] {
  display: none !important;
}
.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;
}
.dev-banner {
  padding: 0.4rem 1rem;
  background: #fff3cd;
  color: #5c4400;
  border-bottom: 2px solid #d9a400;
  font-size: 0.85rem;
  flex: none;
}

/* ---- Agent catalogue (ADR 0003) ------------------------------------------ */

body.catalogue main {
  max-width: 72rem;
}
.lead {
  margin: 0 0 1.5rem;
}
.department {
  margin: 0 0 2rem;
}
.department-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
}
.department-head h2 {
  font-size: 1.25rem;
  margin: 0;
}
.access-chip {
  padding: 0.1rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.8rem;
}
.access-chip.granted {
  background: var(--user-bubble);
  border-color: transparent;
  color: var(--fg);
}
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.agent-card {
  position: relative;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease;
}
.agent-card:not(.disabled):hover {
  border-color: var(--accent);
}
/* Access is departmental, so a disabled card is plain text: no link, no focus. */
.agent-card.disabled {
  background: var(--surface-2);
  box-shadow: none;
}
.agent-card.disabled .agent-avatar {
  filter: grayscale(1);
  opacity: 0.5;
}
.agent-card.disabled .agent-name {
  color: var(--muted);
}
.agent-avatar {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  flex: none;
  border-radius: 50%;
}
.agent-text {
  min-width: 0;
}
.agent-name {
  font-size: 1.05rem;
  margin: 0.1rem 0 0.3rem;
}
.agent-link {
  color: inherit;
  text-decoration: none;
}
/* The whole card is the link's hit area; the name stays the accessible label. */
.agent-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}
.agent-link:focus-visible {
  outline: none;
}
.agent-link:focus-visible::after {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.agent-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.925rem;
}
.agent-state {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

/* "What's new": a plain dated list after the departments. */
.whats-new {
  margin: 2rem 0 0;
}
.whats-new h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}
.changes {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.change {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.25rem 1.25rem;
  padding: 0.9rem 1.25rem;
}
.change + .change {
  border-top: 1px solid var(--border);
}
.change-date {
  color: var(--muted);
  font-size: 0.9rem;
  padding-top: 0.15rem;
}
.change-title {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.change-text p {
  margin: 0;
  color: var(--muted);
}
@media (max-width: 40rem) {
  .change {
    grid-template-columns: 1fr;
  }
}

/* "Suggest an agent" (ADR 0002 Amendment 1): a dashed, open slot after the
   departments, inviting rather than competing with the agent cards. */
.suggest {
  margin: 2.5rem 0 1rem;
}
.suggest-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius);
  border: 2px dashed color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--user-bubble) 45%, var(--surface));
}
.suggest-icon {
  display: block;
  flex: none;
  width: 3.5rem;
  height: 3.5rem;
}
.suggest-icon-disc {
  fill: var(--surface);
  stroke: var(--border);
}
.suggest-icon-bulb,
.suggest-icon-base {
  fill: none;
  stroke: var(--icon);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.suggest-text {
  flex: 1 1 18rem;
  min-width: 0;
}
.suggest-text h2 {
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
}
.suggest-text p {
  margin: 0;
  color: var(--muted);
}
.suggest-card .primary {
  flex: none;
  padding: 0.6rem 1.15rem;
}
.suggest-dialog {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  box-sizing: border-box;
  padding: 0 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  box-shadow: var(--shadow);
}
.suggest-dialog::backdrop {
  background: rgb(9 26 50 / 55%);
}
.suggest-dialog .panel-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
}
.suggest-intro {
  margin: 0;
}
.suggest-form input[type='text'] {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: inherit;
}
.suggest-form [aria-invalid='true'] {
  border-color: var(--danger);
}
.suggest-done {
  padding: 0.5rem 0 0;
}
.suggest-done p {
  margin: 0 0 0.75rem;
}
.suggest-thanks {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--heading);
}
.suggest-done .feedback-actions {
  gap: 0.5rem;
}

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

body.chat {
  height: 100dvh;
  overflow: hidden;
}
body.chat main {
  max-width: none;
  padding: 0;
  flex: 1;
  min-height: 0;
  display: flex;
}
.chat-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
}
.chat-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Transcript */

.transcript {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem 1rem 0.5rem;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  .transcript {
    scroll-behavior: auto;
  }
}
.transcript-inner {
  max-width: var(--column);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.empty-state {
  margin: clamp(1rem, 12vh, 6rem) auto 1rem;
  max-width: 40rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.empty-state h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
.empty-state h1::after {
  content: '';
  display: block;
  width: 3.5rem;
  height: 4px;
  margin: 0.6rem auto 0;
  border-radius: 2px;
  background: var(--brand-gradient);
}
.empty-state .purpose {
  margin: 0;
  max-width: 34rem;
}
.empty-state .saved-context-note {
  margin: 0;
  max-width: 34rem;
  font-size: 0.875rem;
}
.empty-state .saved-context-note a {
  color: var(--link);
}
.suggestions {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.6rem;
  width: 100%;
  text-align: left;
}
.suggested {
  width: 100%;
  height: 100%;
  text-align: left;
  white-space: normal;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--fg);
}
.suggested:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--surface);
}

/* Messages */

.msg {
  display: flex;
  flex-direction: column;
}
.msg-user {
  align-items: flex-end;
}
.bubble {
  max-width: 85%;
  background: var(--user-bubble);
  border-radius: var(--radius);
  padding: 0.65rem 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-time {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.turn-agent {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Agent prose: server-sanitised Markdown, or plain streamed text. */

.prose {
  overflow-wrap: anywhere;
}
.prose > :first-child {
  margin-top: 0;
}
.prose > :last-child {
  margin-bottom: 0;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-weight: 600;
  line-height: 1.3;
  margin: 1.25em 0 0.5em;
}
.prose h1 {
  font-size: 1.35rem;
}
.prose h2 {
  font-size: 1.2rem;
}
.prose h3,
.prose h4 {
  font-size: 1.05rem;
}
.prose p,
.prose ul,
.prose ol {
  margin: 0.6em 0;
}
.prose li {
  margin: 0.25em 0;
}
.prose a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
/* A Salesforce record id the server linked (ADR 0021): people are shown by id, never by name. */
.prose a.sf-record {
  font-family: var(--font-mono);
  font-size: 0.85em;
  white-space: nowrap;
}
.prose blockquote {
  margin: 0.75em 0;
  padding: 0.1em 0 0.1em 0.9em;
  border-left: 3px solid var(--icon);
  color: var(--muted);
}
.prose pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}
.prose :not(pre) > code {
  background: var(--surface-2);
  border-radius: 0.3rem;
  padding: 0.1em 0.35em;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.75em 0;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}
.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--surface-2);
  font-weight: 600;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25em 0;
}
.prose-streaming {
  white-space: pre-wrap;
}
.prose-streaming::after {
  content: '';
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.1em;
  vertical-align: -0.15em;
  background: currentColor;
  border-radius: 1px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  to {
    visibility: hidden;
  }
}

/* Live activity: what the agent is doing, shown inside the turn. */

.thinking {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.thinking .shimmer {
  background: linear-gradient(90deg, var(--muted) 0%, var(--fg) 50%, var(--muted) 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
.spinner {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--icon);
  animation: spin 0.9s linear infinite;
  flex: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .thinking .shimmer {
    animation: none;
    color: var(--muted);
  }
  .spinner {
    animation-duration: 2.5s;
  }
  .prose-streaming::after {
    animation: none;
  }
}

.steps {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.92rem;
}
.steps summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  color: var(--muted);
  list-style: none;
}
.steps summary::-webkit-details-marker {
  display: none;
}
.steps summary::after {
  content: '';
  margin-left: auto;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s;
  flex: none;
}
.steps[open] summary::after {
  transform: rotate(-135deg);
}
.steps ol {
  list-style: none;
  margin: 0;
  padding: 0 0.85rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.step {
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  gap: 0.5rem;
  align-items: start;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.step-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.4rem;
  font-size: 0.85rem;
}
.step-done .step-icon::before {
  content: '\2713';
  color: var(--icon);
}
.step-failed .step-icon::before {
  content: '\2717';
  color: var(--danger);
}
.step-stopped .step-icon::before {
  content: '\2013';
}
.step-source {
  font-weight: 600;
  color: var(--fg);
}
.step-failed .step-source {
  color: var(--danger);
}
.step-meta {
  color: var(--muted);
}
.step-meta::before {
  content: ' \00b7 ';
}

/* Composer */

.composer {
  flex: none;
  padding: 0.5rem 1rem 1rem;
  background: linear-gradient(to bottom, transparent, var(--bg) 35%);
}
.composer-inner {
  max-width: var(--column);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.composer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.6rem 0.6rem 0.5rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.composer-card:focus-within {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
}
.composer-card.dragging {
  border-color: var(--accent);
  border-style: dashed;
}
#message-input {
  font: inherit;
  line-height: 1.5;
  padding: 0.35rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  resize: none;
  max-height: 14rem;
  overflow-y: auto;
  width: 100%;
  box-sizing: border-box;
}
#message-input:focus {
  outline: none;
}
#message-input::placeholder {
  color: var(--muted);
}
#message-input:disabled {
  opacity: 0.6;
}
.composer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.composer-hint {
  margin-left: auto;
  font-size: 0.8rem;
}
@media (max-width: 40rem) {
  .composer-hint {
    display: none;
  }
}
.composer-actions .primary {
  padding: 0.45rem 1.1rem;
}
.attachments {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.attachment {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.2rem 0.3rem 0.2rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.85rem;
}
.attachment-thumb {
  width: 1.6rem;
  height: 1.6rem;
  margin-left: -0.4rem;
  object-fit: cover;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}
.attachment-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  cursor: pointer;
}
.attachment-remove:hover,
.attachment-remove:focus-visible {
  color: var(--fg);
  background: var(--border);
}
.stop {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}
.stop:hover {
  background: color-mix(in srgb, var(--fg) 85%, var(--bg));
}
.status {
  margin: 0;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.92rem;
}
.status:empty {
  display: none;
}
.status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.status-row .status {
  flex: 1 1 20rem;
}
.status-row:has(.status:empty) {
  display: none;
}
.error {
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0.5rem 0.85rem;
  margin: 0;
  font-size: 0.92rem;
}
.error::before {
  content: 'Error: ';
  font-weight: 600;
  color: var(--danger);
}

/* Conversations sidebar */

.sidebar {
  flex: none;
  width: 16rem;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  box-sizing: border-box;
  overflow-y: auto;
}
.new-chat {
  width: 100%;
  text-align: left;
  font-weight: 600;
}
.new-chat::before {
  content: '+';
  display: inline-block;
  width: 1.2rem;
  color: var(--icon);
}
.sidebar-note {
  margin: 0.25rem 0.35rem;
  font-size: 0.8rem;
}
.conversation-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.conversation-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: var(--radius-sm);
}
.conversation-row:hover,
.conversation-row:focus-within {
  background: var(--surface-2);
}
.conversation-item {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
}
.conversation-item:hover {
  background: transparent;
}
.conversation-item[aria-current='true'] {
  background: var(--user-bubble);
  box-shadow: inset 3px 0 0 var(--accent);
}
.conversation-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-time {
  font-size: 0.75rem;
  color: var(--muted);
  flex: none;
}
.running-dot {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--brand-gradient);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .running-dot {
    animation: none;
  }
}
.icon-button {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  opacity: 0;
}
.conversation-row:hover .icon-button,
.conversation-row:focus-within .icon-button,
.icon-button:focus-visible {
  opacity: 1;
}
.icon-button:hover {
  color: var(--danger);
  background: transparent;
}
@media (max-width: 64rem) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18rem, 100%);
    box-shadow: var(--shadow);
    z-index: 20;
  }
}

/* Sources and activity panel */

.side-panel {
  flex: none;
  width: 22rem;
  min-height: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 1rem 1rem;
  box-sizing: border-box;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0 0.5rem;
  position: sticky;
  top: 0;
  background: var(--surface);
}
.panel-head h2,
.activity-panel h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}
.activity-panel h3 {
  margin: 1.25rem 0 0.35rem;
}
.activity {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
}
.activity .step {
  color: var(--fg);
}
.activity .step-label {
  color: var(--muted);
}
.outputs {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9rem;
}
.outputs li {
  padding: 0.2rem 0;
}
.outputs a {
  color: var(--link);
}
@media (max-width: 64rem) {
  .side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(24rem, 100%);
    box-shadow: var(--shadow);
    z-index: 20;
  }
}

/* Panel show and hide controls: inside the panel while it is open, on a
   slim rail at its edge while it is hidden. The header only navigates. */

.panel-rail {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0.3rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.panel-rail-right {
  border-right: none;
  border-left: 1px solid var(--border);
}
.rail-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: transparent;
  border-color: transparent;
  color: var(--icon);
}
.rail-button:hover {
  background: var(--surface-2);
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.sidebar-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0.35rem;
}

/* Response actions: Copy and Rate response under a finished turn */

.turn-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-top: -0.35rem;
  white-space: normal;
}
.rate-response {
  display: flex;
  gap: 0.15rem;
}
.action-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  line-height: 0;
}
.action-button:hover {
  background: var(--surface-2);
  color: var(--fg);
}
.action-button[aria-pressed='true'] {
  color: var(--accent);
}
.action-button[aria-pressed='true'] .icon {
  fill: color-mix(in srgb, var(--accent) 20%, transparent);
}
.icon {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.rate-thanks {
  font-size: 0.8rem;
  margin-left: 0.35rem;
}

/* Rate conversation: the row at the end of the transcript and its panel */

.conversation-feedback {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0 0.75rem;
  white-space: normal;
}
.conversation-feedback button {
  border-radius: 999px;
  font-size: 0.9rem;
}
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.feedback-question {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem 0.75rem;
  margin: 0;
}
.feedback-question legend {
  /* Float the legend so it sits inside the card rather than on its border. */
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.feedback-question legend + * {
  clear: both;
}
.feedback-question.rating {
  border: 0;
  padding: 0;
}
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  font-size: 0.92rem;
}
.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.choice input {
  accent-color: var(--accent);
  margin: 0;
}
.stars {
  display: flex;
  gap: 0.1rem;
}
.star {
  font-size: 1.75rem;
  line-height: 1;
  color: color-mix(in srgb, var(--muted) 55%, transparent);
  cursor: pointer;
  padding: 0.05rem;
  border-radius: var(--radius-sm);
}
.star.filled {
  color: var(--accent);
}
.stars input:focus-visible + .star {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}
.feedback-label {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: -0.4rem;
}
.feedback-form textarea {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: inherit;
  resize: vertical;
}
.feedback-form .small {
  font-size: 0.8rem;
  margin: -0.4rem 0 0;
}
.feedback-actions {
  display: flex;
  justify-content: flex-end;
}

/* /status: pinned agent versions. */
.status-table {
  border-collapse: collapse;
  width: 100%;
  background: var(--surface);
  font-size: 0.95rem;
}
.status-table th,
.status-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.status-table thead th {
  background: var(--surface-2);
}

/* Saved context (ADR 0010) */
.context-departments ul {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.context-departments a {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
}
.context-departments a[aria-current='page'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}
.context-guidance {
  margin: 1rem 0;
}
.context-guidance h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
.context-guidance ul {
  margin: 0;
  padding-left: 1.25rem;
}
.context-section {
  margin: 1.5rem 0;
}
.context-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
}
.context-head h2 {
  font-size: 1.25rem;
  margin: 0;
}
.context-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.context-entry {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.context-entry-title {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
}
.context-meta {
  margin: 0.1rem 0;
  font-size: 0.92rem;
}
.context-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0.5rem 0 0;
}
.context-entry details {
  margin-top: 0.5rem;
}
.context-entry summary {
  cursor: pointer;
}
.context-entry-actions,
.context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.context-form {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.context-form h2 {
  font-size: 1.25rem;
  margin: 0;
}
.context-form input[type='text'],
.context-form select {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: inherit;
}
.context-choices {
  flex-direction: column;
}
.context-choices .choice input:disabled,
.context-choices .choice:has(input:disabled) {
  cursor: default;
  opacity: 1;
}
.context-form .small {
  font-size: 0.8rem;
  margin: -0.4rem 0 0;
}
#context-error {
  margin: 1rem 0;
}
.context-confirm {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.context-confirm p {
  margin: 0;
}

/* News (ADR 0015) */
body.news main {
  max-width: 56rem;
}
.news-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.news-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.news-chip {
  position: relative;
}
.news-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.news-chip span {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.875rem;
}
.news-chip input:checked + span {
  background: var(--user-bubble);
  border-color: transparent;
  font-weight: 600;
}
.news-chip input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.news-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}
.news-filters select,
.news-filters input {
  font: inherit;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
}
.news-filters input {
  min-width: 14rem;
}
.news-day {
  margin: 0 0 2rem;
}
.news-day-head {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 0 0.75rem;
  padding: 0.4rem 0;
  font-size: 1.1rem;
  background: var(--bg);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.news-count {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.news-story {
  padding: 1rem 1.25rem;
}
.news-story + .news-story {
  border-top: 1px solid var(--border);
}
.news-title {
  margin: 0 0 0.2rem;
  font-size: 1.02rem;
  line-height: 1.35;
}
.news-title a {
  color: var(--heading);
  text-decoration: none;
}
.news-title a:hover {
  text-decoration: underline;
  color: var(--link);
}
.news-meta {
  margin: 0 0 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
}
.news-source {
  font-weight: 600;
  color: var(--fg);
}
.news-badge {
  margin-left: 0.35rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.78rem;
}
.news-summary {
  margin: 0 0 0.5rem;
}
.news-topics {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.35rem;
  padding: 0;
}
.news-topics li {
  padding: 0 0.55rem;
  border-radius: 999px;
  background: var(--user-bubble);
  font-size: 0.78rem;
}
.news-more summary,
.news-more-day summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
}
.news-more ul {
  margin: 0.4rem 0 0.4rem 1.1rem;
  padding: 0;
}
.news-more-day {
  margin-top: 0.6rem;
}
.news-more-day .news-list {
  margin-top: 0.6rem;
}
.news-caveat {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.news-earlier {
  margin: 0 0 1.5rem;
}
.news-footnote {
  font-size: 0.9rem;
}
@media (max-width: 40rem) {
  .news-filters {
    margin-left: 0;
    width: 100%;
  }
  .news-filters select,
  .news-filters input {
    min-width: 0;
    flex: 1 1 100%;
  }
}

/* The News page is streamed: the shell arrives first with this line, then the stories. */
.news-loading {
  color: var(--muted);
  padding: 1rem 0;
}
.news-loading:has(~ .news-loaded) {
  display: none;
}

/* Knowledge: the header menu and the in-page tabs (News, Services, Saved context) */
.nav-menu {
  position: relative;
}
.nav-menu > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-menu > summary::-webkit-details-marker {
  display: none;
}
.nav-menu > summary::after {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.15rem) rotate(45deg);
}
.nav-menu[open] > summary::after {
  transform: translateY(0.1rem) rotate(-135deg);
}
.top .nav-menu > summary:focus-visible {
  outline: 3px solid var(--turquoise);
  outline-offset: 2px;
}
.top .nav-menu-current > summary {
  background: rgb(255 255 255 / 10%);
}
.nav-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 20;
  min-width: 12rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.nav-menu-list a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: 0.35rem;
  color: inherit;
  text-decoration: none;
}
.nav-menu-list a:hover {
  background: var(--surface-2);
}
.nav-menu-list a[aria-current='page'] {
  font-weight: 600;
  background: var(--user-bubble);
}
.top .nav-menu-list a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 0;
}
.knowledge-tabs ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  border-bottom: 1px solid var(--border);
}
.knowledge-tabs a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.knowledge-tabs a:hover {
  color: var(--fg);
}
.knowledge-tabs a[aria-current='page'] {
  color: var(--heading);
  border-bottom-color: var(--accent);
}

/* Services (ADR 0016): reuses the News list styles */
.services-facts {
  margin: 0.35rem 0 0.25rem;
  font-size: 0.85rem;
}
.news-topics li.services-other {
  background: var(--surface-2);
}

/* Call brief (ADR 0020): drawn by the server from a present_brief call, every value escaped. */
.brief {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-wrap: normal;
}
.brief section,
.brief-panel {
  margin: 0;
}
.brief-panel,
.brief-call {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  min-width: 0;
}
.prose .brief h3 {
  margin: 0 0 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brief-count {
  background: var(--surface-2);
  color: var(--fg);
  border-radius: 999px;
  padding: 0 0.5rem;
  letter-spacing: 0;
}
.brief-call {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.9rem;
  align-items: center;
}
.brief-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--brand-gradient);
  display: grid;
  place-items: center;
}
.brief-avatar span {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  background: var(--surface);
  color: var(--heading);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.prose .brief-call h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--heading);
}
.brief-role {
  color: var(--muted);
}
.brief-purpose {
  margin-top: 0.3rem;
}
.brief-when {
  align-self: start;
  text-align: right;
  white-space: nowrap;
}
.brief-who .brief-chips {
  margin-top: 0.5rem;
}
.brief-chips,
.brief-row,
.brief-sources,
.brief-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.brief-chip {
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  background: var(--surface-2);
  color: var(--fg);
  white-space: nowrap;
}
.brief-chip-ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.brief-chip-warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.brief-chip-bad {
  background: var(--danger-bg);
  color: var(--danger);
}
.brief-chip-accent {
  background: var(--user-bubble);
  color: var(--fg);
}
.brief-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.6rem;
}
.brief-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brief-k,
.brief-s {
  font-size: 0.75rem;
  color: var(--muted);
}
.brief-v {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.brief-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 0.85rem;
  align-items: start;
}
.brief-tablewrap {
  overflow-x: auto;
}
.prose .brief table {
  display: table;
  margin: 0;
  font-size: 0.88rem;
}
.prose .brief th,
.prose .brief td {
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  padding: 0.5rem 0.5rem 0.5rem 0;
}
.prose .brief th {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}
.prose .brief tr:last-child td {
  border-bottom: 0;
}
.prose .brief .brief-num {
  text-align: right;
  white-space: nowrap;
  padding-right: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.brief-oname {
  font-weight: 600;
}
.brief-osub {
  font-size: 0.75rem;
  color: var(--muted);
}
.prose .brief ul,
.prose .brief ol {
  margin: 0;
}
.prose ul.brief-watch,
.prose ul.brief-services,
.prose ul.brief-signals {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.prose .brief li {
  margin: 0;
}
.brief-watch li {
  border-left: 4px solid var(--warn);
  padding-left: 0.6rem;
  display: flex;
  flex-direction: column;
}
.brief-watch li.brief-risk {
  border-left-color: var(--danger);
}
.brief-watch span,
.brief-services span,
.brief-signals span {
  font-size: 0.82rem;
  color: var(--muted);
}
.brief-services li {
  display: flex;
  flex-direction: column;
}
.brief-signals li {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 0.6rem;
  font-size: 0.9rem;
}
.brief-signals span {
  display: block;
  font-size: 0.75rem;
}
.brief-date {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}
.brief-track {
  /* Two by two; the 1px gap over the border colour draws the dividers. */
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border);
}
.brief-track > div {
  padding: 0.8rem 0.9rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.9rem;
}
.brief-track > .brief-askfor {
  background: var(--user-bubble);
}
.prose .brief-track p {
  margin: 0;
}
.prose .brief-track ol {
  padding-left: 1.1rem;
}
.brief-step {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.prose .brief-track .brief-answer {
  color: var(--muted);
  font-size: 0.85rem;
}
.prose .brief-morehead {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.brief-more {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.brief-more details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.brief-more summary {
  cursor: pointer;
  padding: 0.6rem 0.8rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.brief-more summary small {
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.4rem;
}
.brief-body {
  padding: 0 0.8rem 0.7rem;
  font-size: 0.9rem;
}
.brief-sources {
  font-size: 0.82rem;
  color: var(--muted);
}
.brief-followup {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.brief-followup:hover {
  border-color: var(--accent);
}
.brief-followup:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (max-width: 40rem) {
  .brief-grid {
    grid-template-columns: 1fr;
  }
  .brief-call {
    grid-template-columns: auto 1fr;
  }
  .brief-when {
    grid-column: 1 / -1;
    text-align: left;
  }
  .brief-track {
    grid-template-columns: 1fr;
  }
}
