:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee5;
  --brand: #294c7a;
  --brand-strong: #16365c;
  --soft: #edf3fa;
  --logo-ink: #181a19;
  --logo-green: #007a59;
  --logo-red: #c4003d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.chat-home {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #6f7785;
  --line: #dedede;
  --brand: #2e5339;
  --brand-strong: #1f3a28;
  --soft: #eaf0ec;
  --accent: #2e5339;
  --accent-hover: #24422d;
  --accent-tint: #eaf0ec;
  --accent-text: #1f3a28;
  --accent-border: rgba(46, 83, 57, 0.35);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ingestion-page { --ingestion: #2e5339; background: #f7f7f5; }
.ingestion-shell { width: min(980px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0 72px; }
.ingestion-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.ingestion-header h1 { margin: 10px 0 6px; font-size: clamp(28px, 4vw, 42px); }
.ingestion-header p, .ingestion-feed p { color: var(--muted); }
.back-link { color: var(--ingestion); font-weight: 600; text-decoration: none; }
.ingestion-status { color: var(--muted); white-space: nowrap; font-size: 13px; padding-top: 20px; }
#liveDot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3d8b58; margin-right: 6px; }
.ingestion-note { background: #eaf0ec; border-left: 4px solid var(--ingestion); padding: 14px 16px; border-radius: 4px; margin-bottom: 18px; }
.ingestion-feeds { display: grid; gap: 14px; }
.ingestion-feed { background: white; border: 1px solid #dedede; border-radius: 10px; padding: 20px; }
.ingestion-feed.planned { opacity: .7; }
.ingestion-feed-top { display: flex; justify-content: space-between; gap: 16px; }
.ingestion-feed h2 { font-size: 17px; margin-bottom: 4px; }
.feed-state { align-self: flex-start; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 600; background: #eaf0ec; color: #1f3a28; }
.progress-track { height: 8px; background: #edf0ed; border-radius: 20px; overflow: hidden; margin: 18px 0 7px; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--ingestion); transition: width .3s ease; }
.progress-caption { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; }
.progress-caption strong { color: var(--ink); }
.ingestion-feed dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0 0; padding-top: 14px; border-top: 1px solid #eee; }
.ingestion-feed dt { color: var(--muted); font-size: 12px; }.ingestion-feed dd { margin: 2px 0 0; font-weight: 600; }
@media (max-width: 620px) { .ingestion-header { display: block; }.ingestion-status { padding-top: 14px; }.ingestion-feed dl { grid-template-columns: 1fr; } }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
}

.topbar p,
.muted {
  color: var(--muted);
}

nav {
  display: flex;
  gap: 8px;
}

.nav-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 12px;
  text-decoration: none;
}

.nav-link:hover {
  border-color: var(--brand);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  padding: 8px 12px;
}

button:hover {
  border-color: var(--brand);
}

button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.tab.active,
.toolbar button {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

main {
  padding: 20px 28px 28px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.metric strong {
  display: block;
  font-size: 22px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 320px;
}

.members-panel {
  overflow: hidden;
}

.toolbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
}

textarea {
  resize: vertical;
}

.member-list {
  max-height: calc(100vh - 238px);
  overflow: auto;
}

.member-item {
  width: 100%;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 10px 12px;
}

.member-item.active {
  background: var(--soft);
}

.member-item img,
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--soft);
}

.member-name {
  font-weight: 700;
}

.member-meta {
  color: var(--muted);
  font-size: 13px;
}

.detail {
  padding: 18px;
}

.profile-head {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.profile-head .avatar {
  width: 72px;
  height: 72px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.section {
  min-width: 0;
}

.section h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.role-groups {
  display: grid;
  gap: 12px;
}

.role-section {
  display: grid;
  gap: 7px;
}

.role-section h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 8px;
}

.section-head h3 {
  margin: 0;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pager button {
  padding: 5px 8px;
}

.pill-list,
.interest-list,
.contrib-list {
  display: grid;
  gap: 8px;
}

.pill,
.interest,
.contribution {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.pill-type {
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.interest {
  font-size: 14px;
}

.contribution p {
  margin: 6px 0 8px;
}

.contribution a {
  color: var(--brand-strong);
  font-weight: 700;
  text-decoration: none;
}

.search-panel,
.ask-panel {
  grid-column: 1 / -1;
  padding-bottom: 12px;
}

.search-meta {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px 0;
}

.search-panel .contrib-list {
  padding: 12px;
}

.ask-panel {
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
}

.ask-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px minmax(160px, auto) auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.ask-filters label,
.chat-composer label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.scope-chip {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
}

.scope-chip button {
  padding: 3px 7px;
  margin-left: 4px;
}

.ask-filters > button,
.chat-composer button {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.ask-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  min-height: 360px;
  overflow: hidden;
}

.ask-body:has(.ask-member-panel.hidden) {
  grid-template-columns: minmax(0, 1fr) 0;
}

.chat-thread {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  max-height: calc(100vh - 310px);
  overflow: auto;
}

.chat-message {
  display: flex;
}

.user-message {
  justify-content: flex-end;
}

.assistant-message {
  justify-content: flex-start;
}

.message-bubble {
  max-width: min(840px, 86%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.user-message .message-bubble {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.assistant-message .message-bubble {
  display: grid;
  gap: 10px;
}

.message-details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.message-details summary {
  color: var(--brand-strong);
  cursor: pointer;
  font-weight: 700;
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.answer-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}

.answer-box p {
  margin: 0 0 12px;
}

.answer-box p:last-child {
  margin-bottom: 0;
}

.answer-section {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.answer-section:last-child {
  margin-bottom: 0;
}

.answer-section h3 {
  margin: 0;
  color: var(--brand);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mp-name-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent-text, var(--brand-strong));
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0;
  text-decoration: underline;
}

.ask-member-panel {
  border-left: 1px solid var(--line);
  background: #f8fafc;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  transform: translateX(0);
  transition: transform 160ms ease;
  overflow: hidden;
}

.ask-member-panel.hidden {
  display: block;
  transform: translateX(100%);
  pointer-events: none;
  visibility: hidden;
}

.ask-member-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.ask-member-panel-head > div {
  display: grid;
  gap: 2px;
}

.ask-member-panel-head button {
  width: 32px;
  height: 32px;
  padding: 0;
}

.ask-member-cards {
  display: grid;
  gap: 10px;
  align-content: start;
  overflow: auto;
  padding: 12px;
}

.ask-member-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
}

.ask-member-card.pulse {
  animation: cardPulse 900ms ease;
}

.ask-member-card-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.ask-member-card-head img {
  width: 48px;
  height: 48px;
  border: 3px solid var(--line);
  border-radius: 999px;
  object-fit: cover;
  background: #eef2f7;
}

.ask-member-card-head div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ask-member-card-head span {
  color: var(--muted);
  font-size: 12px;
}

.ask-member-card-section {
  display: grid;
  gap: 4px;
}

.ask-member-card a {
  color: var(--brand-strong);
  font-weight: 800;
  text-decoration: none;
}

@keyframes cardPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 74, 122, 0.38);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(47, 74, 122, 0);
  }
}

/* Chat-first homepage */

.chat-home {
  height: 100vh;
  overflow: hidden;
  background: #f7f8fb;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  display: grid;
  gap: 18px;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 24px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.auth-brand {
  display: grid;
  gap: 3px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  border-radius: 8px;
  background: var(--soft);
  padding: 4px;
}

.auth-tabs button {
  border: 0;
  background: transparent;
  font-weight: 800;
}

.auth-tabs button.active {
  background: #fff;
  color: var(--accent-text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-name-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.auth-error {
  border: 1px solid #f3c15f;
  border-radius: 8px;
  background: #fff8e6;
  color: #7a4a00;
  padding: 10px 12px;
}
.auth-notice { margin: 0; padding: 10px 12px; border: 1px solid #b9d8c7; border-radius: 8px; background: var(--green-wash); color: var(--green-deep); font-size: 13px; line-height: 1.45; }
.auth-link-button { border: 0; background: transparent; color: var(--green-deep); text-decoration: underline; font-size: 13px; }
.account-credit { margin: 4px 0; padding: 9px 10px; border: 1px solid #c7ded0; border-radius: 8px; background: var(--green-wash); color: var(--green-deep); font-size: 11px; line-height: 1.4; }

.chat-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 0px;
  height: 100vh;
  min-height: 0;
  transition: grid-template-columns 220ms ease;
}

.chat-shell.rail-open {
  grid-template-columns: 220px minmax(0, 1fr) 320px;
}

.chat-sidebar,
.sources-panel,
.mp-profile-panel {
  background: #fff;
  border-color: var(--line);
}

.chat-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px;
  border-right: 1px solid var(--line);
  min-height: 0;
}

.chat-brand h1 {
  font-size: 22px;
}

.chat-brand p,
.sources-head p {
  color: var(--muted);
  font-size: 13px;
}

.primary-action {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  font-weight: 800;
}

.primary-action:hover,
.home-input-row button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.chat-history {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.chat-history h2 {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.chat-history-list {
  display: grid;
  gap: 6px;
  align-content: start;
  overflow: auto;
}

.chat-history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  border-radius: 8px;
}

.chat-history-item,
.chat-history-edit,
.side-nav {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  text-decoration: none;
}

.chat-history-row:hover,
.chat-history-row.active,
.side-nav:hover {
  background: var(--soft);
}

.chat-history-row .chat-history-item:hover {
  background: transparent;
}

.chat-history-edit {
  padding: 7px 10px;
}

.chat-title-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 2px 5px;
}

.chat-history-item span,
.chat-history-edit span,
.side-nav span {
  color: var(--muted);
  font-size: 12px;
}

.chat-edit-button,
.chat-delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  padding: 0;
}

.chat-history-row:hover .chat-edit-button,
.chat-history-row:hover .chat-delete-button,
.chat-edit-button:focus-visible,
.chat-delete-button:focus-visible {
  opacity: 1;
}

.chat-edit-button:hover,
.chat-delete-button:hover {
  background: rgba(46, 83, 57, 0.12);
  color: var(--accent-text);
}

.side-nav.disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.chat-sidebar-footer {
  position: relative;
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.account-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  left: 0;
  display: grid;
  gap: 5px;
  max-height: 0;
  overflow: hidden;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 42px rgba(23, 34, 29, 0);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: max-height 220ms ease, padding 220ms ease, opacity 160ms ease, transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.account-menu.open {
  max-height: min(70vh, 620px);
  padding: 12px 10px;
  border-color: var(--line);
  box-shadow: 0 18px 42px rgba(23, 34, 29, .16);
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.account-menu-label {
  margin: 0 2px 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.account-menu-logout {
  margin-top: 4px;
}

.account-menu-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.account-menu-trigger:hover,
.account-menu-trigger[aria-expanded="true"] {
  background: var(--soft);
}

.account-chip-details {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.account-menu-chevron {
  color: var(--muted);
  font-size: 17px;
  transition: transform 180ms ease;
}

.account-menu-trigger[aria-expanded="true"] .account-menu-chevron {
  transform: rotate(180deg);
}

.admin-nav {
  display: grid;
  gap: 4px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.admin-nav p {
  margin: 0 10px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-freshness {
  display: grid;
  gap: 2px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.data-freshness strong { color: var(--ink); font-size: 12px; }
.data-freshness.updating strong { color: var(--accent); }
.data-freshness.error { background: #fff5f5; }

.freshness-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
}

.freshness-modal.hidden { display: none; }

.freshness-dialog {
  width: min(480px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 0;
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.24);
}
.freshness-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.freshness-dialog-head h2 { font: 600 18px/1.2 var(--font-sans); }
.freshness-dialog-head button { border: 0; padding: 0 4px; font-size: 24px; line-height: 1; }
.freshness-dialog-content { padding: 20px; }
.freshness-stage { margin-bottom: 16px; color: var(--accent-text); font-weight: 700; }
.freshness-progress { display: grid; gap: 6px; margin: 0 0 18px; padding: 12px; border-radius: 8px; background: var(--soft); }
.freshness-progress div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.freshness-progress progress { width: 100%; height: 9px; accent-color: var(--accent); }
.freshness-progress small { color: var(--muted); }
.freshness-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.freshness-details div { min-width: 0; }
.freshness-details dt { color: var(--muted); font-size: 11px; }
.freshness-details dd { margin: 2px 0 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 600; }
.freshness-error { margin: 16px 0 0; border-radius: 6px; background: #fff5f5; color: #8a1c1c; padding: 10px; font-size: 12px; }

.account-chip {
  display: grid;
  gap: 2px;
  padding: 2px 10px 8px;
}

.account-chip strong {
  font-size: 13px;
}

.account-chip span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-main {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 0;
  min-width: 0;
  min-height: 0;
}

.mobile-chat-topbar {
  display: none;
}

.home-chat-thread {
  display: grid;
  align-content: start;
  gap: 34px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px max(24px, calc((100% - 1040px) / 2)) 176px;
  min-width: 0;
  min-height: 0;
  scrollbar-color: rgba(46, 83, 57, 0.34) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.home-chat-thread::-webkit-scrollbar {
  width: 10px;
}

.home-chat-thread::-webkit-scrollbar-track {
  background: transparent;
}

.home-chat-thread::-webkit-scrollbar-thumb {
  background: rgba(46, 83, 57, 0.28);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

.home-chat-thread::-webkit-scrollbar-thumb:hover {
  background: rgba(46, 83, 57, 0.45);
  border: 3px solid transparent;
  background-clip: content-box;
}

.home-empty {
  align-self: center;
  justify-self: center;
  display: grid;
  gap: 8px;
  max-width: 520px;
  color: var(--muted);
  text-align: center;
}

.home-empty h2 {
  color: var(--ink);
  font-size: 32px;
}

.home-message {
  display: flex;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  padding-block: 2px;
}

.home-message.user {
  justify-content: flex-end;
}

.home-message.assistant {
  justify-content: flex-start;
}

/* Breathing room above the very first message so it doesn't sit flush to the top. */
.home-chat-thread > .home-message:first-child {
  margin-top: 20px;
}

.home-message-content {
  box-sizing: border-box;
  width: min(1040px, 100%);
  max-width: 100%;
  min-width: 0;
}

.home-bubble {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.55;
  margin: -14px 0;
  padding: 13px 15px;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.home-message.user .home-bubble {
  width: auto;
  border-color: transparent;
  border-radius: 18px;
  background: #ececea;
  color: var(--ink);
  box-shadow: none;
}

.home-message.user .home-message-content {
  width: auto;
  max-width: min(760px, 82%);
}

.home-message.assistant .home-bubble,
.home-message.assistant:hover .home-bubble,
.home-message.assistant.selected .home-bubble {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.home-message.assistant.selected .home-message-content {
  box-shadow: inset 2px 0 0 rgba(23, 107, 79, 0.22);
  padding-left: 18px;
}

.home-message:hover .home-bubble {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.home-message.selected .home-bubble {
  border-color: var(--accent-border);
  background: var(--accent-tint);
  color: var(--ink);
  box-shadow: none;
}

.home-message.error .home-bubble {
  border-color: #f3c15f;
  background: #fff8e6;
  color: #7a4a00;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  min-height: 30px;
  padding: 7px 3px 0;
  opacity: 0.55;
  transition: opacity 140ms ease;
}

.message-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  padding: 7px 3px 0;
}

.message-footer-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.message-metadata {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font: 500 11px/1.3 "Inter", system-ui, sans-serif;
  white-space: nowrap;
}

.message-footer .message-actions {
  min-height: 0;
  padding: 0;
}

.message-artifacts {
  display: grid;
  gap: 9px;
  margin: 18px 15px 5px;
}

.message-artifact-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border: 1px solid #d8dadd;
  border-radius: 13px;
  background: #fff;
  padding: 14px 15px;
  box-shadow: 0 1px 2px rgba(17, 24, 39, .035);
  font-family: "Inter", system-ui, sans-serif;
}

.message-artifact-card.failed {
  border-color: #e2c8c8;
  background: #fffafa;
}

.message-artifact-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 9px;
  background: #f1f2f3;
  color: #36393d;
  font-size: 21px;
}

.message-artifact-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.message-artifact-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-artifact-copy > span {
  color: var(--muted);
  font-size: 11px;
}

.message-artifact-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.message-artifact-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.message-artifact-actions a {
  box-sizing: border-box;
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  text-decoration: none;
}

.live-artifact-card {
  display: block;
  overflow: hidden;
  padding: 0;
  border-color: #cbd8d0;
  background: var(--surface);
}

.live-artifact-card.partial { border-color: #d8c58f; }
.live-artifact-card.failed { border-color: #e2bcbc; }
.live-artifact-card.expanded {
  border-color: #9dbdaa;
  box-shadow: 0 14px 36px rgba(23, 73, 51, .11);
}

.live-artifact-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 15px;
  border-bottom: 1px solid #e0e6e1;
  background: var(--surface);
}

.live-artifact-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.live-artifact-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 9px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.live-artifact-state {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f2ec;
  color: var(--green-deep);
  font-weight: 800;
}

.live-artifact-state.updating { background: #edf0f5; color: #465469; }
.live-artifact-state.partial { background: #fff3d6; color: #795515; }
.live-artifact-state.failed { background: #fff0f0; color: #8c2f2f; }

.live-artifact-expand { min-height: 34px; padding: 7px 10px; }
.live-artifact-header-actions { display: flex; align-items: center; gap: 7px; }
.live-artifact-original { min-height: 34px; padding: 7px 10px; white-space: nowrap; }
.live-artifact-original[aria-pressed="true"] { border-color: #9fbbaa; background: #eaf3ed; color: var(--green-deep); }
.live-artifact-inspecting { color: var(--green-deep); font-weight: 800; }

.live-artifact-context {
  padding: 8px 15px 0;
  color: #5f6f65;
  font-size: 10.5px;
  line-height: 1.4;
}

.live-artifact-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 9px;
  padding: 12px 15px 5px;
}

.live-artifact-filter {
  display: grid;
  gap: 4px;
  min-width: 145px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.live-artifact-filter input,
.live-artifact-filter select,
.live-artifact-natural-filter input {
  min-height: 34px;
  border: 1px solid #cbd7cf;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 6px 9px;
  font: 600 12px/1.2 "Inter", system-ui, sans-serif;
}

.live-artifact-filter input:disabled,
.live-artifact-filter select:disabled { opacity: .6; cursor: wait; }

.live-artifact-more-filters {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--green-deep);
  padding: 7px 5px;
  font-size: 11px;
  font-weight: 750;
}

.live-artifact-extra-filters {
  display: contents;
}

.live-artifact-active-view {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 15px 7px;
  color: var(--muted);
  font-size: 10px;
}

.live-artifact-active-view > span:first-child { font-weight: 800; }
.live-artifact-active-view button,
.live-artifact-sort-chip {
  min-height: 25px;
  border: 1px solid #ccdad1;
  border-radius: 999px;
  background: #edf4ef;
  color: var(--green-deep);
  padding: 4px 8px;
  font: 700 10px/1.2 "Inter", system-ui, sans-serif;
}
.live-artifact-active-view button b { margin-left: 3px; }

.live-artifact-column-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 5px 15px 8px;
  color: var(--muted);
  font-size: 9.5px;
}
.live-artifact-column-legend b { color: var(--ink); }

.live-artifact-natural-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 8px;
  align-items: end;
  padding: 7px 15px 12px;
}

.live-artifact-natural-filter label { display: grid; gap: 4px; }
.live-artifact-natural-filter label span { color: var(--muted); font-size: 10px; font-weight: 750; }
.live-artifact-natural-filter small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.live-artifact-table-wrap {
  min-height: 92px;
  overflow: auto;
  border-block: 1px solid #e2e7e3;
  background: #fff;
}

.live-artifact-table-wrap:focus-visible { outline: 3px solid rgba(23, 107, 79, .18); outline-offset: -3px; }
.live-artifact-table { width: 100%; min-width: 680px; border-collapse: collapse; font: 500 12px/1.4 "Inter", system-ui, sans-serif; }
.live-artifact-table th,
.live-artifact-table td { padding: 9px 11px; border-right: 1px solid #e6ebe7; border-bottom: 1px solid #e6ebe7; text-align: left; vertical-align: top; }
.live-artifact-table th:last-child,
.live-artifact-table td:last-child { border-right: 0; }
.live-artifact-table tbody tr:last-child td { border-bottom: 0; }
.live-artifact-table th { position: sticky; top: 0; z-index: 1; background: #eef4f0; color: var(--green-deep); }
.live-artifact-table th button { display: inline-flex; gap: 6px; width: 100%; border: 0; background: transparent; color: inherit; padding: 0; font: 800 11px/1.25 "Inter", system-ui, sans-serif; text-align: left; }
.live-artifact-table th button span { margin-left: auto; color: #76857c; }
.live-artifact-table th button .live-artifact-column-title { display: flex; align-items: center; gap: 6px; margin-left: 0; color: inherit; }
.live-artifact-column-title small {
  border: 1px solid #bfd0c4;
  border-radius: 999px;
  background: #fff;
  color: #4b6556;
  padding: 1px 5px;
  font-size: 8px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.live-artifact-column-title small.derived { border-color: #c8c7dd; color: #545174; }
.live-artifact-empty { color: #9aa39d; }
.live-artifact-table .live-artifact-no-rows { padding: 22px 12px; color: var(--muted); text-align: center; }
.live-artifact-source-link { color: var(--green-deep); overflow-wrap: anywhere; text-underline-offset: 2px; }
.live-artifact-json { white-space: normal; overflow-wrap: anywhere; color: #435047; font: 500 10.5px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
.live-artifact-table tbody tr:nth-child(even) { background: #fafbf9; }
.live-artifact-card:not(.expanded) .live-artifact-table-wrap { max-height: 315px; }
.live-artifact-card.expanded .live-artifact-table-wrap { max-height: min(62vh, 720px); }

.live-artifact-loading { display: grid; min-height: 92px; place-items: center; color: var(--muted); font-size: 12px; }
.live-artifact-lazy { display: grid; min-height: 92px; place-items: center; align-content: center; gap: 8px; color: var(--muted); font-size: 11px; }
.live-artifact-lazy button { border: 0; background: transparent; color: var(--green-deep); font: 800 11px/1.2 "Inter", system-ui, sans-serif; text-decoration: underline; text-underline-offset: 3px; }
.live-artifact-error {
  margin: 10px 15px;
  border: 1px solid #e4c5c5;
  border-radius: 9px;
  background: #fff7f7;
  color: #7c3030;
  padding: 9px 11px;
  font-size: 11px;
}
.live-artifact-error button { border: 0; background: transparent; color: inherit; padding: 0 0 0 5px; font: inherit; font-weight: 800; text-decoration: underline; }
.live-artifact-export-error { margin: 4px 15px 8px; color: #8c2f2f; font-size: 10.5px; }

.live-artifact-component-notice { margin: 11px 15px 2px; border: 1px solid #e2cd99; border-radius: 9px; background: #fff8e5; color: #6f5115; padding: 9px 11px; font-size: 11px; }
.live-artifact-component-notice ul { margin: 5px 0 0; padding-left: 17px; }
.live-artifact-presentation-note {
  margin: 9px 15px 2px;
  border-left: 3px solid #94a89b;
  background: #f5f7f5;
  color: #4b5b51;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.45;
}

.live-artifact-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px;
  color: var(--muted);
  font-size: 10.5px;
}
.live-artifact-footer div { display: flex; flex-wrap: wrap; gap: 7px; }
.live-artifact-footer button { min-height: 31px; padding: 5px 9px; }
.live-artifact-footer a { box-sizing: border-box; display: inline-flex; min-height: 31px; align-items: center; padding: 5px 9px; text-decoration: none; }

.artifact-renderer-slot { display: none; }
.live-chart-component { margin: 0; border-bottom: 1px solid #e2e7e3; }
.live-chart-component.embedded { margin: 10px 15px; overflow: hidden; border: 1px solid #dce5df; border-radius: 10px; }
.live-chart-component figcaption { padding: 9px 11px 0; color: var(--ink); font-size: 11px; font-weight: 800; }
.live-chart-renderer { min-height: 260px; overflow: auto; padding: 12px; background: #fff; }
.live-chart-component.embedded .live-chart-renderer { min-height: 220px; }
.live-chart-card.expanded .live-chart-renderer { min-height: 520px; }
.live-chart-renderer .vega-embed { width: 100%; }
.live-chart-renderer .vega-embed > div { width: 100%; }
.live-artifact-unsupported { opacity: .86; }

/* Artifact workbench ----------------------------------------------------- */
body.artifact-workbench-open { overflow: hidden; }

.live-artifact-card.compact {
  max-width: 100%;
  border-color: #d9e2dc;
  box-shadow: 0 4px 18px rgba(30, 59, 45, .055);
}

.artifact-preview-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 15px 16px 13px;
  background: var(--surface);
}

.artifact-preview-summary {
  display: grid;
  justify-items: end;
  color: var(--muted);
  font: 650 10px/1.1 "Inter", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.artifact-preview-summary strong {
  color: var(--green-deep);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.artifact-preview-table { min-height: 84px; max-height: 230px !important; }
.live-artifact-table.preview { min-width: 600px; }
.live-artifact-table.preview th { padding: 8px 11px; font-size: 10px; }
.live-artifact-table.preview td { max-width: 280px; overflow: hidden; padding: 8px 11px; text-overflow: ellipsis; white-space: nowrap; }

.artifact-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 15px;
  color: var(--muted);
  font: 600 10.5px/1.3 "Inter", system-ui, sans-serif;
}

.artifact-preview-footer .primary-action { min-height: 34px; padding: 7px 13px; }

.live-artifact-card.expanded {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f7f8f5;
  box-shadow: none;
}

.artifact-workbench-header {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  padding: 10px 18px;
  border-bottom: 1px solid #d8e0db;
  background: var(--surface);
}

.artifact-workbench-header > div:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.artifact-workbench-header > div:nth-child(2) small { color: var(--muted); font: 750 9px/1.2 "Inter", system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.artifact-workbench-header > div:nth-child(2) strong { overflow: hidden; color: var(--ink); font: 750 16px/1.3 "Inter", system-ui, sans-serif; text-overflow: ellipsis; white-space: nowrap; }

.artifact-workbench-back,
.artifact-workbench-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid #d2ddd6;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: 650 21px/1 "Inter", system-ui, sans-serif;
}

.artifact-workbench-status,
.artifact-workbench-actions,
.artifact-toolbar-buttons,
.artifact-view-tabs,
.artifact-workbench-footer,
.artifact-workbench-footer > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.artifact-workbench-status { color: var(--muted); font: 650 10.5px/1.2 "Inter", system-ui, sans-serif; }
.artifact-workbench-actions { justify-content: flex-end; }
.artifact-workbench-actions .secondary-action { min-height: 34px; padding: 6px 10px; text-decoration: none; }
.artifact-export-guidance {
  max-width: 205px;
  color: var(--muted);
  font: 600 9.5px/1.3 "Inter", system-ui, sans-serif;
}

.artifact-workbench-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 51px;
  padding: 7px 18px;
  border-bottom: 1px solid #dfe5e1;
  background: #fbfcfa;
}

.artifact-view-tabs { align-self: stretch; }
.artifact-view-tabs button,
.artifact-toolbar-buttons button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #536159;
  padding: 7px 11px;
  font: 750 11px/1.2 "Inter", system-ui, sans-serif;
}
.artifact-view-tabs button[aria-selected="true"] { border-color: #c6d7cc; background: #eaf3ed; color: var(--green-deep); }
.artifact-toolbar-buttons button { border-color: #d2ddd6; background: #fff; }
.artifact-toolbar-buttons button[aria-expanded="true"],
.artifact-toolbar-buttons button[aria-pressed="true"] { border-color: #9fbbaa; background: #eaf3ed; color: var(--green-deep); }

.live-artifact-card.expanded .live-artifact-active-view { padding: 7px 18px; border-bottom: 1px solid #e2e7e3; background: #fff; }

.artifact-workbench-panel {
  position: absolute;
  z-index: 4;
  top: 122px;
  right: 18px;
  width: min(680px, calc(100vw - 36px));
  max-height: min(70vh, 650px);
  overflow: auto;
  border: 1px solid #cbd8d0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(22, 54, 38, .18);
}

.artifact-workbench-panel > header,
.artifact-row-drawer > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid #e1e7e3;
}
.artifact-workbench-panel > header strong { font: 750 13px/1.2 "Inter", system-ui, sans-serif; }
.artifact-workbench-panel > header button,
.artifact-row-drawer > header button { border: 0; background: transparent; color: #65736a; font-size: 20px; }

.artifact-column-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 8px;
  background: #eef1ee;
}
.artifact-column-choices label { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 40px; padding: 8px 10px; background: #fff; font: 650 11px/1.25 "Inter", system-ui, sans-serif; }
.artifact-column-choices small { color: var(--muted); font-size: 8px; text-transform: uppercase; }

.artifact-view-status { padding: 7px 18px; border-bottom: 1px solid #d8e4dc; background: #edf5ef; color: var(--green-deep); font: 700 10.5px/1.3 "Inter", system-ui, sans-serif; }

.artifact-workbench-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.artifact-workbench-main.with-drawer { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); }
.artifact-workbench-content { min-width: 0; min-height: 0; overflow: auto; padding: 16px 18px; }
.live-artifact-card.expanded .live-artifact-table-wrap { max-height: none; height: 100%; border: 1px solid #dbe3de; border-radius: 10px; }
.live-artifact-table.workbench { min-width: max(900px, 100%); }
.live-artifact-table.workbench tbody tr { cursor: pointer; }
.live-artifact-table.workbench tbody tr:hover,
.live-artifact-table.workbench tbody tr:focus { outline: 0; background: #edf5ef; }

.artifact-row-drawer { min-width: 0; overflow: auto; border-left: 1px solid #dbe3de; background: var(--surface); }
.artifact-row-drawer > header > div { display: grid; gap: 2px; }
.artifact-row-drawer > header small { color: var(--muted); font: 750 9px/1.2 "Inter", system-ui, sans-serif; text-transform: uppercase; }
.artifact-row-drawer > header strong { font: 750 12px/1.3 "Inter", system-ui, sans-serif; }
.artifact-row-drawer dl { margin: 0; padding: 5px 15px 24px; }
.artifact-row-drawer dl > div { padding: 11px 0; border-bottom: 1px solid #e7ebe8; }
.artifact-row-drawer dt { display: flex; justify-content: space-between; gap: 8px; color: #65736a; font: 750 9.5px/1.25 "Inter", system-ui, sans-serif; text-transform: uppercase; }
.artifact-row-drawer dt small { font-size: 8px; }
.artifact-row-drawer dd { margin: 5px 0 0; overflow-wrap: anywhere; color: var(--ink); font: 500 11.5px/1.45 "Inter", system-ui, sans-serif; white-space: pre-wrap; }
.artifact-row-drawer a { color: var(--green-deep); font-weight: 700; }

.artifact-workbench-footer {
  justify-content: space-between;
  min-height: 50px;
  padding: 8px 18px;
  border-top: 1px solid #d8e0db;
  background: var(--surface);
  color: var(--muted);
  font: 650 10.5px/1.2 "Inter", system-ui, sans-serif;
}
.artifact-workbench-footer button { min-height: 32px; padding: 5px 10px; }
.live-artifact-card.expanded .live-chart-component.embedded { height: 100%; margin: 0; }
.live-artifact-card.expanded .live-chart-renderer { min-height: 520px; height: 100%; }

.research-progress {
  display: grid;
  gap: 9px;
  padding: 3px 0;
}

.research-progress-summary {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font: 650 14px/1.4 "Inter", system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}

.research-progress-summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 4px;
}

.research-progress-pulse {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(27, 107, 68, .35);
  animation: research-pulse 1.4s ease-out infinite;
}

.research-progress-label {
  min-width: 0;
}

.research-progress-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.research-progress-copy strong { font: inherit; }
.research-progress-copy small {
  overflow: hidden;
  color: var(--muted);
  font: 500 11px/1.35 "Inter", system-ui, sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-elapsed {
  flex: 0 0 auto;
  margin-left: 8px;
  color: var(--muted);
  font: 600 10.5px/1.3 "Inter", system-ui, sans-serif;
  white-space: nowrap;
}

.research-progress-chevron {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin: 0 2px 2px 3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: .62;
  transform: rotate(45deg);
  transition: transform 150ms ease, margin 150ms ease;
}

.research-progress-summary[aria-expanded="true"] .research-progress-chevron {
  margin-bottom: -3px;
  transform: rotate(225deg);
}

.research-progress-details {
  display: grid;
  gap: 5px;
  margin: 0 0 0 3px;
  padding: 2px 0 2px 18px;
  border-left: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
  list-style: none;
  color: var(--muted);
  font: 500 12px/1.4 "Inter", system-ui, sans-serif;
}

.research-progress-details[hidden] {
  display: none;
}

.research-progress-details li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 6px;
}

.research-progress-details li strong { color: var(--ink); font-size: 11px; }
.research-progress-details li span { grid-column: 2; }

.research-progress-details li::before {
  grid-row: 1 / span 2;
  display: inline-block;
  width: 18px;
  content: "✓";
  color: var(--accent);
  font-weight: 800;
}

.research-progress-details li.partial::before { content: "!"; color: #9a6a15; }
.research-progress-details li.failed::before { content: "×"; color: #9a3434; }
.research-progress-details li.waiting::before { content: "·"; color: var(--muted); }

.work-notes {
  max-width: 760px;
  gap: 12px;
}

.work-notes .research-progress-summary {
  width: 100%;
  align-items: flex-start;
  padding: 8px 0;
}

.work-notes .research-progress-pulse {
  margin-top: 18px;
}

.work-notes .research-progress-copy {
  flex: 1 1 auto;
  gap: 3px;
}

.work-notes .work-note-kind {
  color: var(--accent-text);
  font: 750 9px/1.25 "Inter", system-ui, sans-serif;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.work-notes .research-progress-copy strong {
  font: 700 14px/1.42 "Inter", system-ui, sans-serif;
}

.work-notes .research-progress-copy small {
  overflow: visible;
  font: 500 12px/1.45 "Inter", system-ui, sans-serif;
  text-overflow: clip;
  white-space: normal;
}

.work-notes .research-elapsed {
  margin-top: 17px;
}

.work-notes .research-progress-chevron {
  margin-top: 20px;
}

.work-notes .research-progress-summary[aria-expanded="true"] .research-progress-chevron {
  margin-top: 22px;
}

.work-note-history {
  gap: 10px;
  margin-left: 4px;
  padding-left: 20px;
}

.work-note-history li {
  row-gap: 2px;
}

.work-note-history li strong {
  color: var(--ink);
  font: 650 11.5px/1.35 "Inter", system-ui, sans-serif;
}

.work-note-history li span {
  font-size: 11px;
  line-height: 1.4;
}

.work-note-history li.limitation::before {
  content: "•";
  color: #9a6a15;
}

.work-note-limitation .research-progress-pulse {
  background: #9a6a15;
  box-shadow: none;
}

/* Working notes are narrative checkpoints, not a task checklist. The marker
   communicates the current state without implying every internal operation is
   a user-facing step that must be completed. */
.working-notes-stream,
.completed-working-notes-body {
  display: grid;
  gap: 20px;
  max-width: 760px;
  padding: 10px 0 14px;
}

.working-note {
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr);
  gap: 14px;
  color: var(--ink);
}

.working-note-marker {
  width: 7px;
  height: 7px;
  margin-top: 7px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 42%, white);
}

.working-note.latest .working-note-marker,
.working-note.active .working-note-marker {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(27, 107, 68, .3);
  animation: research-pulse 1.4s ease-out infinite;
}

.working-note.limitation .working-note-marker,
.working-note.partial .working-note-marker,
.working-note.failed .working-note-marker {
  background: #9a6a15;
  box-shadow: none;
  animation: none;
}

.working-note strong {
  display: block;
  font: 670 14px/1.45 "Inter", system-ui, sans-serif;
}

.working-note p {
  margin: 3px 0 0;
  color: var(--muted);
  font: 500 12.5px/1.5 "Inter", system-ui, sans-serif;
}

.working-notes-elapsed {
  margin-left: 25px;
  color: var(--muted);
  font: 600 11px/1.35 "Inter", system-ui, sans-serif;
}

.completed-working-notes {
  margin: 0 0 22px;
  padding: 0 0 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
}

.completed-working-notes-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 620 11.5px/1.4 "Inter", system-ui, sans-serif;
}

.completed-working-notes-toggle small {
  font: inherit;
  color: var(--accent-text);
}

.completed-working-notes-toggle .research-progress-chevron { margin: 0 2px 3px; }
.completed-working-notes-toggle[aria-expanded="true"] .research-progress-chevron {
  margin: 3px 2px 0;
  transform: rotate(225deg);
}

.completed-working-notes-body {
  gap: 16px;
  padding: 18px 0 0;
}

.completed-working-notes-body[hidden] { display: none; }

.admin-quality-diagnostics {
  display: grid;
  gap: 6px;
  margin-left: 25px;
  padding: 11px 13px;
  border: 1px dashed color-mix(in srgb, var(--muted) 42%, transparent);
  border-radius: 8px;
  color: var(--muted);
  font: 500 11.5px/1.45 "Inter", system-ui, sans-serif;
}

.admin-quality-diagnostics strong { color: var(--ink); font-size: 12px; }
.admin-quality-diagnostics ul { margin: 0; padding-left: 18px; }

.analysis-source-details {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}

.analysis-source-details div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
}

.analysis-source-details dt {
  color: var(--muted);
  font: 700 10px/1.4 "Inter", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.analysis-source-details dd {
  margin: 0;
  color: var(--ink);
  font: 500 11px/1.45 "Inter", system-ui, sans-serif;
}

.analysis-source-limitations {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 720px) {
  .research-progress-summary { align-items: flex-start; flex-wrap: wrap; }
  .research-elapsed { width: 100%; margin: 1px 0 0 17px; }
  .work-notes .research-elapsed { width: auto; margin: 17px 0 0; }
}

@keyframes research-pulse {
  70% { box-shadow: 0 0 0 7px rgba(27, 107, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(27, 107, 68, 0); }
}

.branch-navigator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font: 700 12px/1 "Inter", system-ui, sans-serif;
}

.branch-navigator button {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
}

.branch-navigator button:not(:disabled):hover,
.branch-navigator button:not(:disabled):focus-visible {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent-text);
  outline: none;
}

.branch-navigator button:disabled { opacity: .35; cursor: default; }

.home-message.user.editing .home-message-content {
  flex: 0 0 min(760px, 88vw);
  width: min(760px, 88vw);
  max-width: none;
}

.edit-question { display: grid; width: 100%; gap: 10px; }

.edit-question textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 160px;
  max-height: 480px;
  resize: vertical;
  overflow-y: auto;
  padding: 14px 15px;
  border: 1px solid var(--accent-border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.55;
}

.edit-question textarea:focus { outline: 2px solid rgba(32, 113, 80, .18); outline-offset: 1px; }

.edit-question-actions { display: flex; justify-content: flex-end; gap: 7px; }

.edit-question-actions button {
  min-height: 31px;
  padding: 6px 10px;
  border-radius: 7px;
  font: 750 12px/1 "Inter", system-ui, sans-serif;
}

.secondary-action { border-color: var(--line); background: var(--surface); color: var(--muted); }
.primary-action { border-color: var(--accent); background: var(--accent); color: #fff; }

.home-message:hover .message-actions,
.home-message.selected .message-actions,
.message-actions:focus-within {
  opacity: 1;
}

.message-action {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 21px;
  font-weight: 500;
  line-height: 1;
}

.message-action:hover,
.message-action:focus-visible {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent-text);
  outline: none;
}

.message-action.message-action-text {
  width: auto;
  min-width: 30px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.home-answer-section {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin-bottom: 16px;
}

.home-bubble p,
.home-bubble li,
.home-bubble h2,
.home-bubble h3 {
  overflow-wrap: anywhere;
}

.home-answer-section:last-child,
.home-bubble p:last-child {
  margin-bottom: 0;
}

.retrieval-events {
  margin: 10px 0 0;
  padding-left: 22px;
  color: var(--muted);
  font-family: "Inter", sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

.retrieval-events li + li {
  margin-top: 5px;
}

.retrieval-events strong {
  color: var(--text);
  text-transform: capitalize;
}

.home-answer-section h3 {
  margin: 0;
  color: var(--accent-text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}

.home-bubble p {
  margin: 0 0 12px;
}

.home-citation {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 900;
  padding: 0 1px;
}

.typed-citation {
  display: inline-flex;
  align-items: center;
  min-width: 24px;
  min-height: 18px;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 5px;
  padding: 0 4px;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 10px;
  font-weight: 900;
  line-height: 16px;
  letter-spacing: 0.02em;
  vertical-align: 1px;
}

.citation-type-contribution { color: #175cd3; background: #eff8ff; }
.citation-type-written-question { color: #6941c6; background: #f4f3ff; }
.citation-type-written-statement { color: #7a2e0e; background: #fff4ed; }
.citation-type-committee-oral-evidence { color: #075985; background: #f0f9ff; }
.citation-type-committee-report,
.citation-type-committee-government-response { color: #365314; background: #f7fee7; }
.citation-type-bill-overview,
.citation-type-bill-document { color: #854d0e; background: #fefce8; }
.citation-type-division { color: #b42318; background: #fef3f2; }
.citation-type-lords-division { color: #9f1239; background: #fff1f2; }
.citation-type-edm { color: #027a48; background: #ecfdf3; }
.citation-type-legislation { color: #b54708; background: #fffaeb; }
.citation-type-profile { color: #0e7090; background: #ecfdff; }
.citation-type-external-web { color: #4338ca; background: #eef2ff; }

.home-composer {
  position: absolute;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  padding: 14px max(24px, calc((100% - 860px) / 2)) 18px;
  background: rgba(247, 248, 251, 0.95);
  border-top: 1px solid var(--line);
  pointer-events: none;
}

.home-composer > * { pointer-events: auto; }

.home-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.home-input-row textarea {
  min-height: 54px;
  resize: none;
}

.chat-home .home-input-row textarea:focus,
.chat-home button:focus-visible,
.chat-home a:focus-visible {
  border-color: var(--accent);
  outline: 3px solid var(--accent-border);
  outline-offset: 2px;
}

.home-input-row button {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 800;
}

.right-rail {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.chat-shell:not(.rail-open) .right-rail {
  border-left: 0;
}

.sources-panel,
.mp-profile-panel {
  position: absolute;
  inset: 0;
  width: 320px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
}

.mp-profile-panel {
  transform: translateX(100%);
  transition: transform 220ms ease;
  z-index: 2;
}

.mp-profile-panel.open {
  transform: translateX(0);
}

.sources-head,
.mp-profile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.sources-head button {
  display: none;
}

.sources-head .rail-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.mp-profile-back {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}

.reopen-sources-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 20;
  writing-mode: vertical-rl;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  padding: 14px 8px;
  cursor: pointer;
  box-shadow: -4px 0 10px rgba(15, 23, 42, 0.08);
}

.reopen-sources-tab.hidden {
  display: none;
}

.mp-profile-content {
  display: grid;
  gap: 18px;
  align-content: start;
  overflow: auto;
  padding: 16px;
}

.mp-profile-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.mp-profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--soft);
}

.mp-profile-card h3 {
  font-size: 18px;
}

.mp-profile-content h4 {
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.sources-content {
  display: grid;
  gap: 18px;
  align-content: start;
  overflow: auto;
  padding: 16px;
}

.sources-content h3 {
  margin-bottom: 10px;
  font-size: 14px;
}

.source-view-tabs {
  position: sticky;
  top: -16px;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: -16px -16px 0;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(8px);
}

.source-view-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.source-view-tabs button.active {
  border-color: #a9c9b7;
  background: var(--green-wash);
  color: var(--green-deep);
}

.source-view-tabs span,
.section-count {
  color: inherit;
  font-variant-numeric: tabular-nums;
  opacity: .72;
}

.research-ledger-note {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.home-source-list,
.mentioned-mp-list {
  display: grid;
  gap: 10px;
}

.home-source-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.source-card-kicker {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.source-contribution-form {
  display: inline-flex;
  width: fit-content;
  margin: 3px 0 1px;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
}

.source-disposition {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
}

.source-disposition.used {
  background: var(--green-soft);
  color: var(--green-deep);
}

.source-disposition.not-used {
  background: var(--surface-muted);
  color: var(--muted);
}

.source-candidate-dot {
  display: inline-block;
  color: var(--muted);
  font-size: 25px;
  line-height: 14px;
}

.source-record-title {
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.home-source-card.selected,
.mentioned-mp-card.selected {
  border-color: var(--accent-border);
  background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.home-source-card.source-card-contribution { border-left: 3px solid #175cd3; }
.home-source-card.source-card-written-question { border-left: 3px solid #6941c6; }
.home-source-card.source-card-written-statement { border-left: 3px solid #7a2e0e; }
.home-source-card.source-card-committee-oral-evidence { border-left: 3px solid #075985; }
.home-source-card.source-card-committee-report,
.home-source-card.source-card-committee-government-response { border-left: 3px solid #365314; }
.home-source-card.source-card-bill-overview,
.home-source-card.source-card-bill-document { border-left: 3px solid #854d0e; }
.home-source-card.source-card-division { border-left: 3px solid #b42318; }
.home-source-card.source-card-lords-division { border-left: 3px solid #9f1239; }
.home-source-card.source-card-edm { border-left: 3px solid #027a48; }
.home-source-card.source-card-legislation { border-left: 3px solid #b54708; }
.home-source-card.source-card-profile { border-left: 3px solid #0e7090; }
.home-source-card.source-card-external-web { border-left: 3px solid #4338ca; }

.answer-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 16px 0 22px;
  overflow-x: auto;
  border: 1px solid #bfd1c6;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 24px rgba(31, 73, 51, 0.07);
  -webkit-overflow-scrolling: touch;
}
.answer-table-wrap:focus-visible {
  outline: 3px solid rgba(39, 110, 68, 0.2);
  outline-offset: 2px;
}
.answer-table {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.52;
}
.answer-table.answer-table-cols-2 { min-width: 560px; }
.answer-table.answer-table-cols-3 { min-width: 720px; }
.answer-table.answer-table-cols-4 { min-width: 880px; }
.answer-table.answer-table-cols-5 { min-width: 1040px; }
.answer-table th,
.answer-table td {
  padding: 12px 14px;
  vertical-align: top;
  border-right: 1px solid #dbe5df;
  border-bottom: 1px solid #dbe5df;
  overflow-wrap: anywhere;
}
.answer-table th:last-child,
.answer-table td:last-child { border-right: 0; }
.answer-table tbody tr:last-child td { border-bottom: 0; }
.answer-table th {
  color: var(--green-dark);
  font-weight: 750;
  letter-spacing: .01em;
  background: #eaf4ed;
}
.answer-table tbody tr:nth-child(even) { background: rgba(239, 247, 242, 0.58); }
.answer-table tbody tr:hover { background: rgba(225, 240, 230, 0.72); }
.answer-table td:first-child { color: var(--green-deep); font-weight: 650; }

.answer-check-status {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted, #5f6368);
}

.answer-evidence-limitations {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  border: 1px solid #e8bf69;
  border-radius: 10px;
  background: #fff8e8;
  color: #70460a;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.45;
}
.answer-evidence-limitations strong { font-size: 13px; }
.answer-evidence-limitations ul { margin: 0; padding-left: 18px; }

@media (max-width: 768px) {
  .answer-table-wrap { margin-inline: 0; border-radius: 10px; }
  .answer-table { font-size: 13px; }
  .answer-table th,
  .answer-table td { padding: 10px 11px; }
}

.source-marker {
  color: var(--accent, var(--brand-strong));
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
}

.home-source-card p {
  margin: 6px 0;
  color: #344054;
  font-size: 13px;
}

.home-source-card a {
  color: var(--brand-strong);
  font-weight: 800;
  text-decoration: none;
}

.mentioned-mp-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.mentioned-mp-card img {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  object-fit: cover;
  background: var(--soft);
}

.mentioned-mp-card div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.mentioned-mp-card span {
  color: var(--muted);
  font-size: 12px;
}

.drawer-backdrop,
.sources-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(15, 23, 42, 0.42);
}

.drawer-backdrop.hidden,
.sources-backdrop.hidden {
  display: none;
}

.citation {
  color: var(--brand-strong);
  font-weight: 800;
  text-decoration: none;
}

.citation.missing {
  color: #9a3412;
}

.warnings {
  display: grid;
  gap: 6px;
  border: 1px solid #f3c15f;
  border-radius: 8px;
  background: #fff8e6;
  color: #7a4a00;
  padding: 10px 12px;
  font-weight: 700;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.source-item p {
  margin: 6px 0 8px;
}

.source-item a {
  color: var(--brand-strong);
  font-weight: 700;
  text-decoration: none;
}

.ask-stats {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  padding-top: 10px;
}

.compact {
  padding: 8px 0;
}

.hidden {
  display: none;
}

/* Authentication can toggle these two top-level workspaces independently.
   Keep the hidden state more specific than responsive layout rules such as
   `.chat-shell { display: grid; }`, which otherwise exposes the empty chat on
   narrow screens while the user is signed out or awaiting verification. */
.auth-screen.hidden,
.chat-shell.hidden {
  display: none;
}

.empty,
.error,
.loading {
  padding: 18px;
  color: var(--muted);
}

/* ── Clusters ─────────────────────────────────────────────────────────────── */

.clusters-panel {
  grid-column: 1 / -1;
  padding-bottom: 12px;
}

.clusters-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.clusters-toolbar input {
  flex: 1;
}

.clusters-toolbar select {
  width: auto;
}

.cluster-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.cluster-empty {
  grid-column: 1 / -1;
  padding: 18px;
  color: var(--muted);
}

.cluster-card {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
}

.cluster-card:hover {
  border-color: var(--brand);
}

.cluster-card.active {
  border-color: var(--brand);
  background: var(--soft);
}

.cluster-label {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 5px;
}

.cluster-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.cluster-bar-track {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.cluster-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 2px;
}

.cluster-detail {
  grid-column: 1 / -1;
  background: var(--soft);
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 18px;
}

.cluster-detail h3 {
  margin-bottom: 5px;
}

.cluster-detail-meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.cluster-detail-desc {
  margin: 0 0 14px;
}

.cluster-detail .contrib-list {
  margin-top: 12px;
}

@media (max-width: 1060px) {
  .cluster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .cluster-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Map ──────────────────────────────────────────────────────────────────── */

.map-panel {
  grid-column: 1 / -1;
  padding: 0;
  overflow: hidden;
}

.map-controls {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.map-filter-wrap {
  position: relative;
  max-width: 480px;
}

.map-filter-wrap input {
  padding-right: 42px;
}

.map-party-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.map-party-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.map-party-controls button {
  padding: 5px 8px;
}

.map-party-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.map-party-option input {
  width: auto;
  margin: 0;
}

.map-filter-clear {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
}

.map-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 12;
  display: grid;
  gap: 4px;
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(23, 32, 42, 0.14);
}

.map-suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
}

.map-suggestion-item:hover {
  background: var(--soft);
}

.map-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 72vh;
}

.map-canvas-wrap {
  position: relative;
  min-height: 72vh;
  background: #1a1a2e;
}

.map-canvas {
  display: block;
  width: 100%;
  height: 72vh;
  background: #1a1a2e;
}

.map-loading {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(8, 12, 24, 0.85);
  color: #f8fafc;
  padding: 9px 14px;
  backdrop-filter: blur(8px);
}

.map-tooltip {
  position: absolute;
  z-index: 9;
  min-width: 180px;
  max-width: 260px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(10, 14, 28, 0.94);
  color: #f8fafc;
  padding: 10px 12px;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.map-tooltip strong {
  display: block;
  margin-bottom: 4px;
}

.map-legend {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 8;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(10, 14, 28, 0.82);
  color: #e5e7eb;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.map-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.map-side-panel {
  width: 300px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 16px;
  overflow: auto;
}

.map-side-head {
  position: relative;
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.map-side-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
}

.map-side-avatar {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--soft);
}

.map-view-profile {
  display: inline-block;
  margin-top: 16px;
  color: var(--brand-strong);
  font-weight: 700;
  text-decoration: none;
}

/* ──────────────────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .ask-filters,
  .chat-composer {
    grid-template-columns: 1fr;
  }

  .ask-body,
  .ask-body:has(.ask-member-panel.hidden) {
    grid-template-columns: 1fr;
  }

  .ask-member-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 360px;
  }

  .member-list {
    max-height: 420px;
  }

  .map-shell {
    grid-template-columns: 1fr;
  }

  .map-side-panel {
    width: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 768px) {
  .drawer-backdrop:not(.hidden),
  .sources-backdrop:not(.hidden) {
    display: block;
  }

  .chat-home {
    height: 100dvh;
  }

  .chat-shell {
    display: grid;
    grid-template-columns: 1fr;
    height: 100dvh;
  }

  .chat-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 45;
    width: min(82vw, 320px);
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 36px rgba(15, 23, 42, 0.18);
  }

  .chat-sidebar.open {
    transform: translateX(0);
  }

  .chat-main {
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100dvh;
  }

  .mobile-chat-topbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }

  .mobile-chat-topbar strong {
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .home-chat-thread {
    padding: 18px 12px;
  }

  .home-empty h2 {
    font-size: 26px;
  }

  .home-bubble {
    max-width: 94%;
  }

  .home-composer {
    padding: 10px 12px 12px;
  }

  .chat-shell.rail-open {
    grid-template-columns: 1fr;
  }

  .right-rail {
    display: contents;
  }

  .sources-panel,
  .mp-profile-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    z-index: 50;
    height: min(70dvh, 620px);
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    transform: translateY(104%);
    transition: transform 180ms ease;
    box-shadow: 0 -18px 40px rgba(15, 23, 42, 0.2);
  }

  .mp-profile-panel {
    z-index: 55;
  }

  .sources-panel.open,
  .mp-profile-panel.open {
    transform: translateY(0);
  }

  .sources-head,
  .mp-profile-head {
    padding: 14px 16px;
  }

  .sources-head button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
  }

  .sources-head .rail-collapse-btn,
  .reopen-sources-tab {
    display: none;
  }

  .sources-content {
    padding: 14px;
  }

  .source-view-tabs {
    top: -14px;
    margin: -14px -14px 0;
    padding: 10px 14px;
  }
}

/* ────────────────────────────────────────────────────────────────────────────
   Hansaid visual refresh
   A quieter parliamentary palette with stronger editorial hierarchy.
   ──────────────────────────────────────────────────────────────────────────── */
:root {
  --canvas: #f4f3ee;
  --surface: #fffefa;
  --surface-muted: #eeeee8;
  --ink: #17221d;
  --muted: #66736d;
  --line: #d9ded8;
  --green: #176b4f;
  --green-deep: #0f4d3b;
  --green-soft: #e1eee7;
  --green-wash: #f1f7f3;
  --shadow-soft: 0 10px 32px rgba(23, 34, 29, .06);
  --shadow-float: 0 20px 55px rgba(23, 34, 29, .12);
  --radius: 12px;
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.01em;
}

h1, h2, h3, h4,
.chat-brand,
.home-empty h2,
.home-bubble,
.freshness-dialog-head h2 {
  font-family: var(--font-sans);
  letter-spacing: -.025em;
}

button, input, select, textarea { border-radius: 8px; }
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--green); }

button, .nav-link, a { transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid rgba(23, 107, 79, .22);
  outline-offset: 2px;
}

.brand-wordmark {
  display: block;
  width: 170px;
  height: auto;
}

.brand-beta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  padding: 2px 7px;
  border: 1px solid rgba(23, 107, 79, .28);
  border-radius: 999px;
  background: rgba(225, 238, 231, .72);
  color: var(--green-deep);
  font: 750 9px/1.15 "Inter", system-ui, sans-serif;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.brand-context {
  color: var(--muted);
  font: 600 12px/1.2 "Inter", system-ui, sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.topbar {
  min-height: 78px;
  padding: 18px clamp(20px, 4vw, 48px);
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .8);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-brand > div { display: grid; justify-items: center; text-align: center; }

.topbar .brand-wordmark { width: 162px; }
.topbar .brand-context { display: inline-block; margin-top: 5px; }
.topbar p { margin-top: 3px; font-size: 13px; }
.topbar nav { align-items: center; gap: 6px; }
.topbar .tab, .topbar .nav-link { border-color: transparent; background: transparent; color: var(--muted); font-weight: 700; text-decoration: none; }
.topbar .tab:hover, .topbar .nav-link:hover { background: var(--green-soft); color: var(--green-deep); }
.topbar .tab.active { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 4px 12px rgba(23, 107, 79, .18); }

body:not(.chat-home) main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 48px; }
.metrics { gap: 10px; margin-bottom: 20px; }
.metric { min-height: 92px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.metric strong { color: var(--green-deep); font: 600 27px/1 var(--font-sans); }
.metric span { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.panel { border-color: var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.toolbar { padding: 14px; background: var(--green-wash); border-bottom-color: var(--line); }
input, select, textarea { min-height: 42px; border-color: #cbd4cd; background: rgba(255, 255, 255, .95); color: var(--ink); }
input::placeholder, textarea::placeholder { color: #8b9690; }
button { border-color: #cbd4cd; background: var(--surface); font-weight: 650; }
button:hover { border-color: var(--green); color: var(--green-deep); }
.tab.active, .toolbar button, .ask-filters > button, .chat-composer button { background: var(--green); border-color: var(--green); color: #fff; }
.member-item { padding: 12px 14px; border-bottom-color: #e8ebe7; }
.member-item:hover, .member-item.active { background: var(--green-wash); }
.member-item img, .avatar { border-radius: 10px; }
.detail { padding: 24px; }
.profile-head { padding-bottom: 20px; border-bottom-color: var(--line); }
.profile-head .avatar { border-radius: 12px; }
.pill, .interest, .contribution, .answer-box, .cluster-card { border-color: var(--line); border-radius: 10px; background: var(--surface); }
.contribution a, .map-view-profile, .back-link { color: var(--green-deep); }

/* Auth */
.chat-home { background: radial-gradient(circle at 14% 18%, rgba(225, 238, 231, .74), transparent 34%), var(--canvas); }
.auth-screen {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  place-items: start center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .05), transparent 50%);
  -webkit-overflow-scrolling: touch;
}
.auth-screen::before {
  content: "";
  position: fixed;
  left: 7vw;
  bottom: 9vh;
  width: min(30vw, 360px);
  aspect-ratio: 1;
  border: 1px solid rgba(23, 107, 79, .16);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(23, 107, 79, .035), 0 0 0 56px rgba(23, 107, 79, .025);
  pointer-events: none;
}
.auth-panel { position: relative; width: min(468px, 100%); gap: 22px; margin-block: auto; padding: 34px; border: 1px solid #d3dbd4; border-radius: 16px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow-float); }
.auth-brand { display: grid; justify-items: center; gap: 6px; text-align: center; }
.auth-brand .brand-wordmark { width: 237px; }
.auth-brand p { margin: 2px 0 0; }
.auth-intro { display: grid; gap: 8px; padding: 22px 0 4px; border-top: 1px solid var(--line); }
.auth-intro h2 { max-width: 380px; font-size: clamp(28px, 5vw, 38px); line-height: 1.02; }
.auth-intro p { max-width: 390px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.auth-tabs { background: var(--surface-muted); border-radius: 10px; }
.auth-tabs button { min-height: 40px; color: var(--muted); }
.auth-tabs button.active { color: var(--green-deep); }
.auth-form { gap: 14px; }
.auth-form label { color: var(--ink); font-size: 12px; letter-spacing: .03em; text-transform: uppercase; }
.auth-form input { margin-top: 2px; }
.auth-form .primary-action { min-height: 46px; margin-top: 4px; font-weight: 800; }
.primary-action { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 5px 14px rgba(23, 107, 79, .15); }
.primary-action:hover, .home-input-row button:hover { background: var(--green-deep); border-color: var(--green-deep); color: #fff; transform: translateY(-1px); }
.auth-error { border-color: #e7c982; background: #fff8e7; }

/* Chat workspace */
.chat-shell { grid-template-columns: 274px minmax(0, 1fr) 0; height: 100dvh; max-height: 100dvh; overflow: hidden; background: var(--canvas); }
.chat-shell.rail-open { grid-template-columns: 274px minmax(0, 1fr) 400px; }
.chat-shell.rail-open.profile-open { grid-template-columns: 274px minmax(0, 1fr) 430px; }
.chat-sidebar { position: relative; grid-template-rows: auto auto auto minmax(0, 1fr); gap: 14px; height: 100dvh; max-height: 100dvh; overflow: hidden; padding: 24px 18px calc(76px + env(safe-area-inset-bottom, 0px)); background: var(--surface-muted); border-right-color: var(--line); }
.chat-sidebar .chat-brand { display: grid; justify-items: center; gap: 5px; width: 100%; padding: 2px 6px 0; }
.chat-sidebar .chat-brand .brand-wordmark { width: 162px; }
.brand-home-button {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}
.brand-home-button:hover,
.brand-home-button:active {
  border: 0;
  background: transparent;
  color: inherit;
  transform: none;
}
.chat-sidebar .primary-action { display: flex; align-items: center; min-height: 43px; text-align: left; padding-left: 14px; }
.tester-access { display: grid; gap: 8px; padding: 12px; border: 1px solid #c7ded0; border-radius: 10px; background: var(--green-wash); }
.tester-access.hidden { display: none; }
.tester-access-head { display: grid; gap: 3px; }
.tester-access-head strong { color: var(--green-deep); overflow-wrap: anywhere; }
.tester-access p, .tester-access small, .tester-access-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.tester-access-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tester-access-actions button { min-height: 30px; padding: 5px 7px; border: 1px solid #a7c7b5; border-radius: 7px; background: var(--surface); color: var(--green-deep); font-size: 11px; font-weight: 700; }
.tester-access-actions button:first-child { background: var(--green); color: #fff; border-color: var(--green); }
.home-composer.tester-exhausted { opacity: .68; }
.chat-history { gap: 9px; min-height: 0; overflow: hidden; }
.chat-history h2 { display: flex; align-items: center; gap: 7px; min-height: 30px; margin: 0 5px; padding: 6px 4px 7px; border-bottom: 1px solid #d4dcd5; color: #6d7972; font: 750 11px/1.35 "Inter", sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.chat-history h2 svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-history-list { min-height: 0; gap: 3px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.chat-history-row { border-radius: 9px; }
.chat-history-row.active { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--green); }
.chat-history-item, .chat-history-edit, .side-nav { border-radius: 9px; padding: 10px 11px; }
.chat-history-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-row:hover, .side-nav:hover { background: rgba(225, 238, 231, .7); }
.chat-history-row.active .chat-history-item strong { color: var(--green-deep); }
.chat-sidebar-footer { position: absolute; z-index: 20; right: 18px; bottom: max(12px, env(safe-area-inset-bottom, 0px)); left: 18px; min-height: 56px; gap: 2px; padding-top: 8px; border-top-color: #d4dcd5; background: var(--surface-muted); }
.chat-sidebar-footer .account-menu { max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; }
.chat-sidebar-footer .account-menu:not(.open) { overflow: hidden; }
.data-freshness { margin-bottom: 8px; padding: 12px; border-color: #d2ddd5; border-radius: 10px; background: var(--green-wash); }
.account-chip { min-height: 47px; padding: 5px 11px 4px; }
.account-chip-details { max-width: calc(100% - 24px); }
.account-chip strong, .account-chip span { line-height: 1.25; }
.side-nav { font-size: 13px; }
.admin-nav { border-top-color: #d4dcd5; }
.admin-nav p { color: #7a867f; }
.chat-main { background: var(--canvas); }
.mobile-chat-topbar { background: rgba(255, 255, 255, .9); }
.home-chat-thread { gap: 29px; padding: 10px max(24px, calc((100% - 1040px) / 2)) 154px; scrollbar-color: rgba(23, 107, 79, .32) transparent; }
.home-empty { width: min(680px, 100%); max-width: 680px; gap: 13px; padding: 30px 24px; text-align: left; }
.home-empty::before { display: none; }
.home-empty h2 { font-size: clamp(36px, 5vw, 54px); line-height: .98; }
.home-empty p { max-width: 530px; color: var(--muted); font-size: 15px; line-height: 1.65; }
.home-landing { width: min(1120px, 100%); margin: 0 auto; padding: 30px 0 12px; }
.home-landing-intro { max-width: 720px; margin-bottom: 24px; }
.home-landing-eyebrow, .home-panel-heading p { margin: 0 0 7px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.home-landing-intro h1 { margin: 0; color: var(--ink); font: 500 clamp(38px, 5vw, 56px)/1 var(--font-sans); letter-spacing: -.035em; }
.home-landing-intro > p:last-child { max-width: 660px; margin: 13px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.home-landing-grid { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 18px; align-items: start; }
.home-suggestion-panel, .briefing-home-compact { min-width: 0; padding: 20px; border: 1px solid #d0dbd3; border-radius: 14px; background: rgba(255, 254, 249, .7); box-shadow: 0 5px 18px rgba(22, 49, 35, .04); }
.home-panel-heading h2 { margin: 0; color: var(--green-deep); font: 600 25px/1.12 var(--font-sans); letter-spacing: -.02em; }
.home-landing .home-suggestions { height: auto; margin-top: 16px; overflow: visible; perspective: none; }
.home-landing .research-suggestions-track { display: grid; grid-auto-rows: auto; gap: 9px; transform: none; transition: none; }
.home-landing .research-suggestion { min-height: 74px; padding: 11px 13px 11px 15px; transform: none !important; opacity: 1 !important; transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease; }
.home-landing .research-suggestion-placeholder { display: block; min-height: 74px; border: 1px solid #e1ebe4; border-radius: 12px; background: rgba(255, 255, 255, .55); animation: suggestion-wait 1.4s ease-in-out infinite alternate; }
@keyframes suggestion-wait { from { opacity: .45; } to { opacity: .9; } }
@media (prefers-reduced-motion: reduce) { .home-landing .research-suggestion-placeholder { animation: none; } }
.home-landing .research-suggestion small { display: block; margin-bottom: 4px; color: var(--green); font-size: 8px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.suggestion-showcase { display: grid; margin-top: 10px; overflow: hidden; }
.home-suggestions { position: relative; height: 269px; overflow: hidden; perspective: 900px; }
.research-suggestions-track { display: grid; grid-auto-rows: 62px; gap: 7px; transform: translateY(-69px); transition: transform 880ms cubic-bezier(.4, 0, .2, 1); will-change: transform; }
.research-suggestion { display: grid; grid-template-columns: minmax(0, 1fr) 20px; align-items: center; gap: 11px; width: 100%; min-height: 62px; padding: 5px 13px 5px 15px; border: 1px solid #cadbd0; border-radius: 12px; background: rgba(255, 255, 255, .74); color: var(--green-deep); font-size: 13px; font-weight: 700; line-height: 1.25; text-align: left; box-shadow: 0 3px 10px rgba(23, 34, 29, .025); transition: background 150ms ease, border-color 150ms ease, transform 880ms cubic-bezier(.4, 0, .2, 1), opacity 700ms ease, box-shadow 150ms ease; }
.research-suggestion:hover, .research-suggestion:focus-visible { border-color: #9fc5af; background: var(--green-soft); box-shadow: 0 5px 14px rgba(23, 34, 29, .07); outline: none; }
.research-suggestion-arrow { color: #7c9a88; font-size: 14px; text-align: right; transition: transform 150ms ease; }
.research-suggestion:hover .research-suggestion-arrow { transform: translate(2px, -2px); }
.research-suggestions-track .research-suggestion:first-child { opacity: .2; transform: rotateX(12deg) scale(.96); transform-origin: center bottom; }
.research-suggestions-cycling .research-suggestions-track { transform: translateY(0); }
.research-suggestions-cycling .research-suggestion:first-child { opacity: 1; transform: rotateX(0) scale(1); }
.research-suggestions-cycling .research-suggestion:last-child { opacity: 0; transform: rotateX(-14deg) scale(.96); transform-origin: center top; }
@media (prefers-reduced-motion: reduce) {
  .research-suggestions-track, .research-suggestion { transition: none; }
}
.home-message { padding-block: 5px; }
.home-bubble { border-radius: 14px; font-size: 16.5px; line-height: 1.64; }
.home-message.user .home-bubble { color: var(--ink); font-family: "Inter", sans-serif; font-size: 14px; font-weight: 600; }
.home-answer-section h3 { color: var(--green); font-size: 12px; letter-spacing: .11em; }
.home-answer-section h2 { margin: 0; color: var(--green-deep); font-size: 22px; line-height: 1.18; }
.home-answer-section.markdown-section { gap: 9px; margin: 19px 0; }
.home-answer-section.markdown-section:first-child { margin-top: 0; }
.home-answer-section.markdown-section-h3 { padding-top: 3px; }
.home-answer-section.markdown-section-h3 h3 { color: var(--green-deep); font: 650 16.5px/1.28 var(--font-sans); letter-spacing: -.015em; text-transform: none; }
.home-answer-section ul { margin: 2px 0 4px; padding-left: 24px; }
.home-answer-section li { margin: 6px 0; padding-left: 3px; }
.home-citation { color: var(--green); }
.typed-citation { border-radius: 5px; }
.home-composer { padding: 22px max(24px, calc((100% - 820px) / 2)) 14px; background: linear-gradient(to top, var(--canvas) 70%, rgba(255, 255, 255, .92) 82%, rgba(255, 255, 255, 0)); border-top: 0; }
.home-input-row { display: flex; flex-direction: column; gap: 0; padding: 8px; border: 1px solid #c5d4ca; border-radius: 16px; background: var(--surface); box-shadow: 0 10px 28px rgba(23, 34, 29, .09); transition: border-color 140ms ease, box-shadow 140ms ease; }
.home-input-row:focus-within { border-color: #8fb6a0; box-shadow: 0 0 0 3px rgba(23, 107, 79, .10), 0 14px 38px rgba(23, 34, 29, .12); }
.home-input-row textarea { width: 100%; min-height: 38px; padding: 3px 6px 5px; border: 0; background: transparent; box-shadow: none; font-size: 15px; line-height: 1.45; }
.home-input-row textarea:focus { outline: 0 !important; }
.composer-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.composer-toolbar-spacer { flex: 1; }
.research-scope-button { display: inline-flex; align-items: center; gap: 7px; min-height: 38px !important; padding: 7px 11px !important; border: 1px solid transparent !important; border-radius: 999px !important; background: transparent !important; color: var(--muted) !important; font: 700 13px/1 "Inter", system-ui, sans-serif !important; box-shadow: none !important; }
.research-scope-button.active, .research-scope-button:hover, .research-scope-button[aria-expanded="true"] { border-color: #cad6ce !important; background: #edf2ee !important; color: var(--green-deep) !important; transform: none !important; }
.source-scope-summary { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 12px; }
.source-scope-summary span { padding: 4px 7px; border: 1px solid #d0d9d2; border-radius: 999px; background: rgba(255,255,255,.66); color: var(--muted); font: 700 10px/1.2 "Inter", sans-serif; }
.source-order-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; color: var(--muted); font: 700 10px/1.2 "Inter", sans-serif; }
.source-order-row select { min-height: 30px; padding: 4px 8px; border: 1px solid #ccd6cf; border-radius: 8px; background: var(--surface); color: var(--ink); font: 650 11px/1.2 "Inter", sans-serif; }
#homeSendButton { align-self: auto; min-width: 68px; min-height: 38px; padding: 0 15px; border-radius: 10px; background: var(--green); border-color: var(--green); color: #fff; font-weight: 800; }
#homeSendButton.stop-action { background: #8e2f3d; border-color: #8e2f3d; }
#homeSendButton.stop-action:hover { background: #742532; border-color: #742532; }
.model-suite-picker { position: relative; }
.model-suite-button { display: inline-flex; align-items: center; gap: 9px; min-height: 38px !important; padding: 7px 12px !important; border: 1px solid transparent !important; border-radius: 999px !important; background: #f0f2ef !important; color: var(--ink) !important; font: 700 13px/1 "Inter", system-ui, sans-serif !important; box-shadow: none !important; }
.model-suite-button:hover, .model-suite-button[aria-expanded="true"] { border-color: #cad6ce !important; background: #e8eee9 !important; transform: none !important; }
.model-suite-button:disabled { opacity: .55; cursor: default; }
.model-suite-chevron { color: var(--muted); font-size: 16px; line-height: .8; transition: transform 140ms ease; }
.model-suite-button[aria-expanded="true"] .model-suite-chevron { transform: rotate(180deg); }
.model-suite-menu { position: absolute; z-index: 80; right: 0; bottom: calc(100% + 10px); display: grid; width: 330px; padding: 8px; border: 1px solid #ccd6cf; border-radius: 16px; background: rgba(255, 255, 255, .98); box-shadow: 0 18px 50px rgba(23, 34, 29, .18); backdrop-filter: blur(12px); }
.model-suite-menu.hidden { display: none; }
.model-suite-option { position: relative; display: grid !important; grid-template-columns: minmax(0, 1fr) auto !important; align-items: center !important; gap: 14px !important; width: 100% !important; min-height: 0 !important; padding: 11px 12px !important; border: 0 !important; border-radius: 11px !important; background: transparent !important; color: var(--ink) !important; text-align: left !important; box-shadow: none !important; }
.model-suite-option:hover, .model-suite-option:focus-visible { background: var(--green-wash) !important; color: var(--green-deep) !important; outline: none !important; transform: none !important; }
.model-suite-option.selected { background: #eef3ef !important; }
.model-suite-option-copy { display: grid; gap: 4px; }
.model-suite-option-copy strong { font: 750 14px/1.2 "Inter", system-ui, sans-serif; }
.model-suite-option-copy small { color: var(--muted); font: 500 11px/1.35 "Inter", system-ui, sans-serif; }
.model-suite-option-check { color: var(--green); font: 800 16px/1 "Inter", system-ui, sans-serif; }
.mode-model-tooltip { position: absolute; z-index: 90; right: calc(100% + 18px); bottom: 0; display: none; gap: 8px; width: 270px; padding: 13px 14px; border: 1px solid #ccd6cf; border-radius: 13px; background: var(--surface); box-shadow: 0 16px 44px rgba(23, 34, 29, .18); color: var(--ink); font: 500 11px/1.35 "Inter", system-ui, sans-serif; }
.model-suite-option:hover .mode-model-tooltip, .model-suite-option:focus-visible .mode-model-tooltip { display: grid; }
.mode-model-tooltip > strong { color: var(--green-deep); font-size: 13px; }
.mode-model-tooltip span { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; }
.mode-model-tooltip b { color: var(--muted); font-weight: 700; }
.right-rail { background: var(--surface-muted); }
.sources-panel, .mp-profile-panel { width: 100%; background: var(--surface-muted); border-left-color: var(--line); }
.mp-profile-panel { isolation: isolate; background: var(--canvas); }
.chat-shell.profile-open .sources-panel { visibility: hidden; pointer-events: none; }
.sources-head, .mp-profile-head { padding: 21px 20px; border-bottom-color: var(--line); }
.sources-head h2 { font-size: 23px; }
.sources-content { padding: 16px; }
.home-source-card, .mentioned-mp-card { border-color: #d2dbd4; border-radius: 10px; background: var(--surface); box-shadow: 0 4px 14px rgba(23,34,29,.04); }
.home-source-card:hover, .mentioned-mp-card:hover { border-color: #a9c9b7; transform: translateY(-1px); }
.freshness-dialog { border-color: #d2dbd4; border-radius: 14px; box-shadow: var(--shadow-float); }

/* Evidence-grounded parliamentary profiles */
.mp-profile-head { justify-content: flex-start; background: rgba(255, 255, 255, .94); }
.mp-profile-head > div { display: grid; gap: 2px; min-width: 0; }
.mp-profile-head > div > span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.mp-profile-head > div > strong { overflow: hidden; color: var(--ink); font-family: var(--font-serif); font-size: 18px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.mp-profile-content { gap: 13px; padding: 16px 18px 28px; }
.mp-profile-card { grid-template-columns: 84px minmax(0, 1fr); justify-items: stretch; align-items: center; column-gap: 20px; row-gap: 14px; padding: 4px 2px 8px; text-align: left; }
.mp-profile-avatar { display: grid; place-items: center; width: 76px; height: 76px; color: #fff; background: var(--green); font-family: var(--font-serif); font-size: 31px; font-weight: 700; }
.mp-profile-identity { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.mp-profile-card h3 { margin: 0; font-size: 22px; line-height: 1.04; }
.mp-profile-identity p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.mp-profile-identity a { color: var(--green-deep); font-size: 11px; font-weight: 800; text-decoration: none; }
.profile-status { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 4px 7px; background: #e5e8e4; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.profile-status.current { background: var(--green-soft); color: var(--green-deep); }
.profile-coverage-note { margin: 0; border: 1px solid #cddbd2; border-radius: 9px; background: var(--green-wash); padding: 9px 11px; color: #4d6156; font-size: 10.5px; line-height: 1.5; }
.profile-section, .profile-disclosure { border: 1px solid #d2dbd4; border-radius: 11px; background: var(--surface); box-shadow: 0 4px 14px rgba(23,34,29,.035); }
.profile-section { display: grid; gap: 10px; padding: 13px; }
.mp-profile-content .profile-section h4, .mp-profile-content .profile-disclosure h4 { margin: 0; color: var(--green-deep); font-size: 10px; letter-spacing: .075em; }
.profile-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.profile-section-heading > span { color: var(--muted); font-size: 9px; text-align: right; }
.profile-coverage-note { margin: 0; padding: 8px 9px; border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.profile-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid #e0e5e1; border-radius: 8px; background: #e0e5e1; }
.profile-stat-grid > div { display: grid; gap: 2px; min-height: 62px; align-content: center; background: var(--surface); padding: 9px; }
.profile-stat-grid strong { color: var(--green-deep); font-family: var(--font-serif); font-size: 21px; }
.profile-stat-grid span { color: var(--muted); font-size: 9px; line-height: 1.35; }
.profile-list, .mp-profile-clusters, .profile-fact-list { display: grid; gap: 7px; }
.profile-list-item { display: grid; gap: 3px; border: 1px solid #e2e7e3; border-radius: 8px; background: var(--surface); padding: 9px; color: inherit; text-decoration: none; }
a.profile-list-item:hover { border-color: #a9c9b7; background: var(--green-wash); }
.profile-list-item strong { color: var(--ink); font-size: 11px; line-height: 1.35; }
.profile-list-item span { color: var(--muted); font-size: 9px; }
.profile-list-item p { margin: 2px 0 0; color: #4d5b53; font-size: 10px; line-height: 1.45; }
.profile-topic { display: grid; gap: 6px; padding: 6px 0; }
.profile-topic + .profile-topic { border-top: 1px solid #e7ebe7; }
.profile-topic > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.profile-topic strong { color: var(--ink); font-size: 11px; }
.profile-topic span { color: var(--muted); font-size: 8.5px; text-align: right; }
.profile-topic p { margin: 0; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.profile-topic-bar { overflow: hidden; height: 4px; border-radius: 999px; background: #e5eae6; }
.profile-topic-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.profile-fact-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e8ece8; padding: 6px 0; }
.profile-fact-list > div:last-child { border-bottom: 0; }
.profile-fact-list span { color: #4d5b53; font-size: 10px; }
.profile-fact-list strong { color: var(--green-deep); font-family: var(--font-serif); font-size: 16px; }
.profile-method-note { margin: 0; color: var(--muted); font-size: 9.5px; line-height: 1.45; }
.profile-disclosure { padding: 0 13px 13px; }
.profile-disclosure summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 0; color: var(--green-deep); font-size: 11px; font-weight: 800; cursor: pointer; }
.profile-disclosure summary span { display: inline-grid; place-items: center; min-width: 21px; height: 21px; border-radius: 999px; background: var(--green-soft); font-size: 9px; }
.profile-disclosure > h4 { margin: 10px 0 7px !important; }
.profile-loading, .profile-error { display: grid; justify-items: center; gap: 10px; padding: 44px 18px; color: var(--muted); text-align: center; }
.profile-loading { grid-template-columns: repeat(3, 7px); justify-content: center; }
.profile-loading i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: profile-pulse 1s ease-in-out infinite alternate; }
.profile-loading i:nth-child(2) { animation-delay: .16s; }
.profile-loading i:nth-child(3) { animation-delay: .32s; }
.profile-loading span { grid-column: 1 / -1; font-size: 11px; }
.profile-error p { margin: 0; font-size: 11px; line-height: 1.45; }
.profile-error button { border: 1px solid var(--green); border-radius: 8px; background: var(--green); padding: 8px 11px; color: #fff; font-weight: 800; }
@keyframes profile-pulse { to { opacity: .25; transform: translateY(-3px); } }

.mentioned-mp-card { grid-template-columns: 38px minmax(0, 1fr) auto; width: 100%; color: inherit; font: inherit; text-align: left; }
.member-avatar-fallback { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--green); color: #fff !important; font-family: var(--font-serif); font-size: 17px !important; font-weight: 800; }
.mentioned-mp-arrow { color: var(--green) !important; font-family: var(--font-serif); font-size: 24px !important; }

/* Operations and research surfaces */
.ingestion-page { background: radial-gradient(circle at 90% 0%, rgba(225,238,231,.62), transparent 32%), var(--canvas); }
.ingestion-shell { width: min(1080px, calc(100% - 48px)); padding: 48px 0 72px; }
.ingestion-header { align-items: end; margin-bottom: 30px; }
.ingestion-header h1 { margin: 4px 0 7px; font-size: clamp(32px, 5vw, 50px); line-height: 1; }
.ingestion-header p, .ingestion-feed p { color: var(--muted); }
.back-link { display: block; margin-bottom: 28px; font-size: 13px; font-weight: 800; }
.ingestion-note { margin-bottom: 20px; padding: 16px 18px; border: 1px solid #c7ded0; border-left: 4px solid var(--green); border-radius: 10px; background: var(--green-wash); color: var(--green-deep); }
.ingestion-feed { padding: 22px; border-color: var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.ingestion-feed h2 { font-size: 22px; }
.feed-state { padding: 5px 10px; background: var(--green-soft); color: var(--green-deep); }
.progress-track { height: 9px; background: #e5eae5; }
.progress-track span { background: var(--green); }
.ingestion-feed dl { border-top-color: #e5e9e5; }

.status { color: var(--green); font-size: 12px; }

@media (max-width: 860px) {
  body:not(.chat-home) main { width: min(100% - 28px, 720px); padding-top: 20px; }
  .topbar { gap: 14px; }
  .topbar nav { flex-wrap: wrap; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


@media (max-width: 768px) {
  .auth-screen {
    scroll-padding-block: max(16px, env(safe-area-inset-top, 0px));
    padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  }
  .auth-screen::before { display: none; }
  .auth-panel { padding: 24px 20px; border-radius: 14px; }
  .chat-shell, .chat-shell.rail-open { grid-template-columns: 1fr; }
  .chat-sidebar {
    position: fixed;
    background: var(--surface-muted);
  }
  .home-chat-thread { padding: 12px 14px 158px; }
  .home-message.assistant .home-message-content {
    width: 100%;
    max-width: 100%;
  }
  .home-message.assistant .home-bubble { max-width: 100%; }
  .message-artifacts { margin-inline: 2px; }
  .message-artifact-card {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }
  .message-artifact-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .live-artifact-card { display: block; }
  .live-artifact-header { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .live-artifact-heading { grid-column: 1 / -1; }
  .live-artifact-meta { justify-content: flex-start; }
  .live-artifact-header-actions { justify-content: flex-end; }
  .live-artifact-controls { display: grid; grid-template-columns: 1fr 1fr; }
  .live-artifact-filter { min-width: 0; }
  .live-artifact-extra-filters { display: contents; }
  .live-artifact-natural-filter { grid-template-columns: 1fr; }
  .live-artifact-natural-filter small { grid-column: 1; }
  .live-artifact-footer { align-items: flex-start; flex-direction: column; }
  .live-artifact-footer div { width: 100%; justify-content: flex-end; }
  .live-chart-renderer { min-height: 220px; padding: 8px; }
  .live-chart-card.expanded .live-chart-renderer { min-height: 360px; }
  .artifact-preview-header { gap: 10px; padding: 13px; }
  .artifact-preview-table { max-height: 205px !important; }
  .artifact-workbench-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 9px;
    min-height: 62px;
    padding: max(8px, env(safe-area-inset-top, 0px)) 10px 8px;
  }
  .artifact-workbench-status { display: none; }
  .artifact-workbench-actions { grid-column: 1 / -1; justify-content: flex-start; overflow-x: auto; padding-left: 45px; }
  .artifact-workbench-actions .artifact-workbench-close { position: absolute; top: max(9px, env(safe-area-inset-top, 0px)); right: 10px; }
  .artifact-workbench-toolbar { align-items: flex-start; flex-direction: column; padding: 8px 10px; }
  .artifact-toolbar-buttons { width: 100%; overflow-x: auto; }
  .artifact-workbench-panel { top: 128px; right: 8px; width: calc(100vw - 16px); max-height: calc(100dvh - 146px); }
  .artifact-column-choices { grid-template-columns: 1fr; }
  .artifact-workbench-main.with-drawer { grid-template-columns: minmax(0, 1fr); }
  .artifact-workbench-content { padding: 10px; }
  .artifact-row-drawer { position: absolute; z-index: 5; inset: auto 0 0; max-height: 72dvh; border-top: 1px solid #cbd8d0; border-left: 0; border-radius: 14px 14px 0 0; box-shadow: 0 -14px 45px rgba(22, 54, 38, .18); }
  .artifact-workbench-footer { padding: 7px 10px max(7px, env(safe-area-inset-bottom, 0px)); }
  .artifact-workbench-footer > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .home-empty { padding: 22px 10px; }
  .home-empty h2 { font-size: 40px; }
  .home-suggestions { height: 269px; min-height: 269px; }
  .home-landing { padding: 18px 0 8px; }
  .home-landing-intro { margin-bottom: 18px; padding-inline: 3px; }
  .home-landing-intro h1 { font-size: 40px; }
  .home-landing-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .home-suggestion-panel, .briefing-home-compact { padding: 16px; }
  .home-landing .home-suggestions { height: auto; min-height: 0; }
  .home-landing .research-suggestion { min-height: 66px; }
  .home-composer { padding: 10px 12px 14px; }
  .model-suite-menu {
    position: fixed;
    right: 12px;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 132px);
    overflow-y: auto;
  }
  .mode-model-tooltip { left: 8px; right: 8px; bottom: calc(100% + 6px); width: auto; }
  .sources-panel, .mp-profile-panel { width: auto; }
  .mp-profile-panel {
    top: 0;
    height: 100dvh;
    max-height: none;
    border-top: 0;
    border-radius: 0;
    background: var(--canvas);
    box-shadow: none;
  }
  .mp-profile-head {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 58px;
    padding: max(10px, env(safe-area-inset-top, 0px)) 14px 10px;
  }
  .mp-profile-back { padding: 7px 10px; font-size: 12px; }
  .mp-profile-content { padding: 14px 14px max(28px, env(safe-area-inset-bottom, 0px)); }
  .mp-profile-card { grid-template-columns: 72px minmax(0, 1fr); column-gap: 16px; }
  .mp-profile-avatar { width: 64px; height: 64px; }
  .ingestion-shell { width: min(100% - 28px, 620px); padding-top: 28px; }
  .ingestion-header { display: block; }
  .ingestion-status { padding-top: 18px; }
}

@media (max-width: 520px) {
  .topbar { padding: 16px; }
  .topbar-brand { align-items: flex-start; }
  .topbar nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .topbar .tab, .topbar .nav-link { flex: 0 0 auto; }
  body:not(.chat-home) main { width: calc(100% - 20px); }
  .metrics { gap: 8px; }
  .metric { min-height: 82px; padding: 12px; }
  .metric strong { font-size: 23px; }
  .metric span { font-size: 10px; }
  .auth-intro h2 { font-size: 32px; }
  #homeSendButton { min-width: 64px; width: auto; }
  .model-suite-button { width: auto; }
}


.export-plan-preview > span {
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .11em;
}

.export-instructions {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}
.export-instructions textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 124px;
  resize: vertical;
  border: 1px solid #cbd6ce;
  border-radius: 10px;
  background: #fff;
  padding: 12px 13px;
  color: var(--ink);
  font: 500 13px/1.55 "Inter", system-ui, sans-serif;
}
.export-instructions textarea:focus { outline: 2px solid rgba(23, 107, 79, .16); border-color: var(--green); }

.export-plan-preview {
  display: grid;
  gap: 9px;
  border: 1px solid #cbded2;
  border-radius: 11px;
  background: var(--green-wash);
  padding: 15px;
}
.export-plan-preview > strong { color: var(--ink); font-size: 15px; }
.export-plan-preview dl { display: grid; gap: 7px; margin: 0; }
.export-plan-preview dl div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; }
.export-plan-preview dt { color: var(--muted); font-size: 11px; }
.export-plan-preview dd { margin: 0; color: var(--ink); font-size: 11px; font-weight: 650; overflow-wrap: anywhere; }

.export-dialog { width: min(860px, calc(100vw - 28px)); }
.export-dialog .freshness-dialog-head > div { display: grid; gap: 2px; }
.export-dialog .freshness-dialog-head p { margin: 0; color: var(--green); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.export-dialog-content { display: grid; gap: 17px; max-height: min(76vh, 720px); overflow-y: auto; }
.export-suggestions { display: grid; gap: 10px; }
.export-suggestions-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.export-suggestions-head > div { display: grid; gap: 3px; }
.export-suggestions-head span { color: var(--green); font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.export-suggestions-head h3 { margin: 0; color: var(--ink); font: 600 18px/1.25 var(--font-sans); }
.export-suggestions-head small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.export-suggestions > p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.export-suggestion-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.export-suggestion-cards.showing-alternatives { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.export-suggestion-cards.hidden,
.export-suggestions-loading.hidden { display: none; }
.export-suggestion-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid #ccd8d0;
  border-radius: 12px;
  background: #fff;
  padding: 13px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(25, 39, 31, .04);
}
.export-suggestion-card:hover { border-color: #87ad98; background: #fbfdfb; }
.export-suggestion-card.selected { border-color: var(--green); background: var(--green-wash); box-shadow: inset 0 0 0 1px var(--green); }
.export-suggestion-card:focus-visible { outline: 2px solid rgba(23, 107, 79, .24); outline-offset: 2px; }
.export-suggestion-tags { display: flex; align-items: center; gap: 6px; min-height: 19px; }
.export-suggestion-tags b,
.export-suggestion-tags em { border-radius: 999px; padding: 3px 7px; font-size: 8px; font-style: normal; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.export-suggestion-tags b { background: #e9eeea; color: var(--ink); }
.export-suggestion-tags em { background: #e7f3ec; color: var(--green); }
.export-suggestion-card > strong { font: 650 16px/1.25 var(--font-sans); }
.export-suggestion-card > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.export-suggestion-card ul { display: grid; gap: 3px; margin: 0; padding-left: 16px; color: var(--ink); font-size: 9px; line-height: 1.35; }
.export-suggestion-card > small { margin-top: auto; border-top: 1px solid #e2e8e3; padding-top: 7px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.export-alternatives-button {
  justify-self: start;
  border: 0;
  background: transparent;
  padding: 2px 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.export-alternatives-button:hover { text-decoration: underline; }
.export-alternatives-button.hidden { display: none; }
.export-suggestion-selection {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #aac5b6;
  border-radius: 11px;
  background: var(--green-wash);
  padding: 11px 12px;
}
.export-suggestion-selection.hidden { display: none; }
.export-suggestion-selection > div { min-width: 0; display: grid; gap: 2px; }
.export-suggestion-selection span { color: var(--green); font-size: 8px; font-weight: 850; letter-spacing: .1em; }
.export-suggestion-selection strong { overflow: hidden; color: var(--ink); font: 650 14px/1.25 var(--font-sans); text-overflow: ellipsis; white-space: nowrap; }
.export-suggestion-selection small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.export-suggestion-selection button { flex: 0 0 auto; width: auto; min-height: 36px; padding: 8px 13px; }
.export-suggestions-loading { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.export-suggestions-loading i { height: 178px; border: 1px solid #e0e6e1; border-radius: 12px; background: linear-gradient(100deg, #f2f4f2 20%, #fafbfa 38%, #f2f4f2 56%); background-size: 220% 100%; animation: exportSuggestionShimmer 1.35s ease-in-out infinite; }
@keyframes exportSuggestionShimmer { to { background-position-x: -220%; } }
.export-custom-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.export-custom-divider::before,
.export-custom-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.export-format-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; border: 0; }
.export-format-picker legend { grid-column: 1 / -1; margin-bottom: 1px; color: var(--ink); font-size: 12px; font-weight: 750; }
.export-format-picker label { position: relative; min-width: 0; }
.export-format-picker input { position: absolute; opacity: 0; pointer-events: none; }
.export-format-picker span {
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 4px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 10px;
  cursor: pointer;
}
.export-format-picker strong { color: var(--ink); font-size: 13px; }
.export-format-picker small { color: var(--muted); font-size: 10px; }
.export-format-picker input:checked + span { border-color: var(--green); background: var(--green-wash); box-shadow: inset 0 0 0 1px var(--green); }
.export-format-picker input:focus-visible + span { outline: 2px solid rgba(23, 107, 79, .22); outline-offset: 2px; }
.export-help { margin: -8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.export-plan-preview > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.export-plan-preview small { color: var(--muted); font-size: 10px; }
.export-plan-preview .export-classification-note { border-top: 1px solid #d4e3d9; padding-top: 9px; color: var(--ink); }
.export-actions { display: flex; justify-content: flex-end; gap: 8px; }
.export-actions button { min-height: 38px; }

@media (max-width: 760px) {
  .export-suggestion-cards.showing-alternatives,
  .export-suggestions-loading { grid-template-columns: minmax(0, 1fr); }
  .export-suggestion-selection { align-items: stretch; flex-direction: column; }
  .export-suggestion-selection button { width: 100%; }
  .export-suggestions-loading i { height: 116px; }
  .export-format-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Engine choice is independent of the legacy research-depth menu. */
.research-engine-select {
  max-width: 145px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--panel);
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.research-engine-select:disabled { opacity: .6; cursor: wait; }
.assistant-internal-control { display: none !important; }

@media (max-width: 520px) {
  .composer-toolbar { flex-wrap: wrap; }
  .research-engine-select { max-width: 130px; }
}

.answer-length-control { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.answer-length-control.hidden { display: none; }

/* Output preferences share the composer without introducing research quality tiers. */
.output-mode-picker { position: relative; }
.output-mode-menu { position: absolute; bottom: calc(100% + 10px); left: 0; z-index: 40;
  width: min(330px, calc(100vw - 48px)); padding: 8px; border: 1px solid var(--border, #d8dce3);
  border-radius: 14px; background: var(--surface, #fff); box-shadow: 0 12px 32px #0002; }
.output-mode-menu p { margin: 8px 10px; font-size: 12px; color: var(--muted, #657080); }
.output-mode-menu button { display: block; width: 100%; text-align: left; padding: 10px;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; }
.output-mode-menu button strong, .output-mode-menu button small { display: block; }
.output-mode-menu button small { margin-top: 3px; color: var(--muted, #657080); }
.output-mode-menu button:hover, .output-mode-menu button[aria-checked="true"] { background: #7385a018; }
.output-mode-menu button:focus-visible { outline: 2px solid #5373bb; outline-offset: -2px; }
button.mp-name-link { font: inherit; font-weight: 600; color: var(--accent-text, var(--brand-strong)); padding: 0; border: 0; border-radius: 0; background: none; text-align: inherit; }
button.mp-name-link:focus-visible { outline: 2px solid #5373bb; outline-offset: 2px; }

/* Member names in party colour (Sam, 28 Nov). Party colours are the chart
   colours darkened to at least 5:1 on white and toned slightly toward the
   Hansaid ink; Lib Dem and SNP are left untoned because toning browned them
   together. The dotted underline is always there, so colour is never the only
   cue and a member's name never reads as an ordinary link. */
:root {
  --party-con: #085a91; --party-lab: #ae1730; --party-ld: #b25f00; --party-green: #3c711d;
  --party-snp: #8a6d00; --party-reform: #0f7180; --party-plaid: #04534d; --party-dup: #94412c;
  --party-sdlp: #2e7031; --party-uup: #306594; --party-alliance: #8a6a00; --party-sf: #2e6138;
  --party-xb: #615c58; --party-bishops: #624984; --party-speaker: #3a423f; --party-ind: #565d6b;
}
.party-con { --party: var(--party-con); } .party-lab { --party: var(--party-lab); } .party-ld { --party: var(--party-ld); }
.party-green { --party: var(--party-green); } .party-snp { --party: var(--party-snp); } .party-reform { --party: var(--party-reform); }
.party-plaid { --party: var(--party-plaid); } .party-dup { --party: var(--party-dup); } .party-sdlp { --party: var(--party-sdlp); }
.party-uup { --party: var(--party-uup); } .party-alliance { --party: var(--party-alliance); } .party-sf { --party: var(--party-sf); }
.party-xb { --party: var(--party-xb); } .party-bishops { --party: var(--party-bishops); } .party-speaker { --party: var(--party-speaker); }
.party-ind, .party-other, .party-none { --party: var(--party-ind); }
button.mp-name-link[class*="party-"] { color: var(--party); }
button.mp-name-link { text-decoration: underline dotted; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
button.mp-name-link[class*="party-"]:focus-visible { outline-color: var(--party); }

.member-card { position: absolute; z-index: 60; width: min(340px, calc(100vw - 32px)); background: var(--panel, #fff);
  color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-float);
  padding: 14px 16px 12px; font-size: 14px; line-height: 1.45; text-align: left; }
.member-card[hidden] { display: none; }
.member-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.member-card-head img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--surface-muted); flex: none; }
.member-card-name { font-weight: 700; font-size: 15px; }
.member-card-party { display: flex; align-items: baseline; gap: 6px; color: var(--muted); }
.member-card-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--party); flex: none; transform: translateY(-1px); }
.member-card dl { margin: 0 0 10px; display: grid; grid-template-columns: 82px 1fr; gap: 3px 10px; }
.member-card dt { color: var(--muted); }
.member-card dd { margin: 0; }
.member-card-links { display: flex; gap: 16px; border-top: 1px solid var(--line); padding-top: 9px; }
.member-card-links a, .member-card-links button { font: inherit; font-weight: 600; color: var(--accent-text); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.member-card-links a:hover, .member-card-links button:hover { text-decoration: underline; }
.member-card-credit { font-size: 11px; color: var(--muted); margin-top: 6px; }
.member-card.member-sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgb(24 38 34 / 18%); }
.member-card.member-sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: -8px auto 12px; }
body.member-sheet-open::after { content: ""; position: fixed; inset: 0; background: rgb(10 14 22 / 28%); z-index: 59; }
@media print { button.mp-name-link { color: inherit; text-decoration: none; } .member-card { display: none; } }
@media (max-width: 620px) {
  .output-mode-menu { position: fixed; left: 12px; right: 12px; bottom: 166px;
    width: auto; max-height: calc(100dvh - 190px); overflow-y: auto; }
  .output-mode-menu button small { white-space: normal; line-height: 1.4; }
}

/* Tester card: credit meter, feedback form, and the sign-in hint. */
.tester-meter { height: 4px; border-radius: 2px; background: var(--line, #dfe5e0); overflow: hidden; }
.tester-meter span { display: block; height: 100%; background: var(--green); }
.tester-access .tester-inline-link { padding: 0; border: 0; background: none; color: var(--green-deep); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.tester-feedback-form { display: grid; gap: 7px; padding-top: 8px; border-top: 1px solid var(--line, #dfe5e0); }
.tester-feedback-form > span { font-size: 12px; font-weight: 600; color: var(--ink); }
.tester-rating { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.tester-rating button { min-height: 30px; border: 1px solid #a7c7b5; border-radius: 6px; background: var(--surface); color: var(--green-deep); font-size: 12px; font-weight: 600; cursor: pointer; }
.tester-rating button[aria-checked="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.tester-feedback-form textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; padding: 7px 8px; border: 1px solid var(--ui-input-line, #c9d3cc); border-radius: 6px; font-family: inherit; font-size: 12px; line-height: 1.45; background: var(--surface); color: var(--ink); }
.tester-access .tester-feedback-thanks { color: var(--green-deep); font-weight: 600; }
.auth-tester-hint { justify-self: center; margin: 4px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

/* --- Specific working notes and the provisional answer draft (Nov 2026) ---
   The draft is greyed with a lighter band travelling down it, its citation
   labels are inert, and the source check's edits appear as struck/added text
   before the checked answer replaces it. */
.working-note-count { color: var(--muted); font-weight: 600; }
.working-note-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.working-note-chips span {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--green-wash, #f1f7f3);
  color: var(--green-deep, #0f4d3b);
  font: 600 11.5px/1.6 "Inter", system-ui, sans-serif;
}
.working-note-quote {
  margin: 6px 0 0;
  padding: 2px 0 2px 10px;
  border-left: 2px solid color-mix(in srgb, var(--line) 80%, transparent);
  color: var(--muted);
  font: italic 400 13px/1.5 Georgia, "Times New Roman", serif;
}
.working-note-quote cite {
  display: block;
  margin-top: 2px;
  font: normal 600 11px/1.4 "Inter", system-ui, sans-serif;
}
.working-notes-earlier {
  justify-self: start;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 12px/1.4 "Inter", system-ui, sans-serif;
  cursor: pointer;
}
.working-notes-earlier:hover { color: var(--ink); text-decoration: underline; }
.working-notes-stream.with-draft { gap: 12px; padding-bottom: 6px; }

.draft-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: 600 11.5px/1.5 "Inter", system-ui, sans-serif;
}
.draft-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #b8bfb9;
}
.draft-status.checking::before { background: #9a6a15; animation: research-pulse 1.4s ease-out infinite; }
.draft-status.verified {
  border-color: color-mix(in srgb, var(--green, #176b4f) 35%, transparent);
  background: var(--green-wash, #f1f7f3);
  color: var(--green-deep, #0f4d3b);
  animation: draft-status-fade .8s ease-in 5s forwards;
}
.draft-status.verified::before { background: var(--green, #176b4f); }
@keyframes draft-status-fade { to { opacity: 0; } }

.answer-draft.provisional {
  color: transparent;
  background: linear-gradient(180deg, #8e9690 0%, #8e9690 42%, #d3d8d4 50%, #8e9690 58%, #8e9690 100%);
  background-size: 100% 260%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: draft-shimmer 2.6s linear infinite;
}
.answer-draft.provisional * { color: inherit !important; }
.draft-cite { font: 600 12px "Inter", system-ui, sans-serif; opacity: .75; }
.answer-draft .claim-removed {
  border-radius: 3px;
  background: #f7e3dc;
  -webkit-text-fill-color: #8a4a3a;
  text-decoration: line-through;
  text-decoration-color: #b4533a;
  animation: claim-removed 2.6s ease-in forwards;
}
.answer-draft .claim-added {
  border-radius: 3px;
  background: #e2efe6;
  -webkit-text-fill-color: var(--ink);
  text-decoration: none;
  animation: claim-added .6s ease-out both;
  transition: background 1.6s;
}
.answer-draft .claim-added.settled { background: transparent; -webkit-text-fill-color: inherit; }
.answer-draft .draft-rewritten { animation: claim-added .8s ease-out both; }
@keyframes draft-shimmer { from { background-position: 0 100%; } to { background-position: 0 0; } }
@keyframes claim-removed { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes claim-added { from { opacity: 0; filter: blur(2px); } }

/* The checked answer replaces the draft: ink sweeps down over the grey. */
.answer-reveal {
  color: transparent;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink) 45%, #8e9690 55%, #8e9690 100%);
  background-size: 100% 300%;
  background-position: 0 0;
  -webkit-background-clip: text;
  background-clip: text;
  animation: answer-reveal 1.1s ease-in-out;
}
.answer-reveal * { color: inherit !important; }
.answer-reveal .home-citation,
.answer-reveal a { -webkit-text-fill-color: var(--green, #176b4f); }
/* Table cells paint their own background over the clipped gradient, so text
   inheriting "transparent" vanished on freshly streamed answers (18 Nov). */
.answer-reveal table, .answer-reveal table * { color: var(--ink) !important; -webkit-text-fill-color: currentColor; }
.answer-reveal table a, .answer-reveal table .home-citation { color: var(--green, #176b4f) !important; -webkit-text-fill-color: var(--green, #176b4f); }
@keyframes answer-reveal { from { background-position: 0 100%; } to { background-position: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .answer-draft.provisional { animation: none; background: none; color: #8e9690; }
  .answer-draft .claim-removed, .answer-draft .claim-added, .answer-draft .draft-rewritten,
  .answer-reveal, .draft-status.verified { animation: none; }
  .answer-reveal { background: none; color: var(--ink); }
}
.source-scope-summary .question-date-scope { display: inline-flex; align-items: center; gap: 6px; }
.source-scope-summary .question-date-scope button { padding: 0 2px; border: 0; background: none; color: var(--accent, #1d5c3f); font: inherit; text-decoration: underline; cursor: pointer; }

/* --- Working notes and answer actions, v2 (17 Nov 2026) ----------------
   Calmer timeline: line icons instead of dots, a slow ring on the active
   step, lighter type, steps that fade in and groups that open smoothly.
   No side rule on the selected answer. Actions are quiet icon buttons. */
.home-message.assistant.selected .home-message-content {
  box-shadow: none;
  padding-left: 0;
}

.working-notes-stream,
.completed-working-notes-body {
  gap: 0;
  padding: 6px 0 10px;
}
.working-notes-stream.with-draft { gap: 0; }

.working-note {
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
}

.working-note-marker,
.working-note.latest .working-note-marker,
.working-note.active .working-note-marker,
.working-note.limitation .working-note-marker,
.working-note.partial .working-note-marker,
.working-note.failed .working-note-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: -2px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--line) 45%, transparent);
  color: var(--muted);
  box-shadow: none;
  animation: none;
}
.working-note-marker .ui-icon { width: 14px; height: 14px; }
.working-note.active .working-note-marker,
.working-note.latest:not(.complete) .working-note-marker {
  background: var(--green-wash, #f1f7f3);
  color: var(--green, #176b4f);
}
.working-note.active .working-note-marker::after,
.working-note.latest:not(.complete) .working-note-marker::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--green, #176b4f) 16%, transparent);
  border-top-color: var(--green, #176b4f);
  animation: note-ring 1.4s linear infinite;
}
.working-note.limitation .working-note-marker,
.working-note.partial .working-note-marker,
.working-note.failed .working-note-marker {
  background: #fbf1e0;
  color: #9a6a15;
}

.working-note strong {
  font: 560 14px/1.5 "Inter", system-ui, sans-serif;
  color: color-mix(in srgb, var(--ink) 78%, var(--muted));
  letter-spacing: -0.005em;
}
.working-note.active strong,
.working-note.latest strong { color: var(--ink); }
.working-note p { margin-top: 2px; font-weight: 450; }
.working-note-count { font-weight: 500; }
.working-note-chips { margin-top: 7px; }
.working-note-chips span { font-weight: 560; }
.working-note-quote {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--line) 22%, transparent);
  color: color-mix(in srgb, var(--ink) 72%, var(--muted));
}

.working-notes-stream .working-note { animation: note-arrive .34s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes note-arrive { from { opacity: 0; transform: translateY(5px); } }
@keyframes note-ring { to { transform: rotate(360deg); } }

.working-notes-elapsed {
  margin: 4px 0 0 36px;
  font: 500 11.5px/1.4 "Inter", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

/* Smoothly opening groups: earlier steps while drafting, and the trail
   under a finished answer. */
.working-notes-collapsible {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows .32s cubic-bezier(.2, .7, .2, 1), opacity .24s ease;
}
.working-notes-collapsible.is-open { grid-template-rows: 1fr; opacity: 1; }
.working-notes-collapsible-inner { min-height: 0; overflow: hidden; display: grid; }

.working-notes-earlier,
.completed-working-notes-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  margin: 0 0 4px;
  padding: 5px 10px 5px 8px;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 999px;
  background: var(--surface, #fffefa);
  color: var(--muted);
  font: 550 12px/1.3 "Inter", system-ui, sans-serif;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.working-notes-earlier:hover,
.completed-working-notes-toggle:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--line) 22%, var(--surface, #fffefa));
  color: var(--ink);
  text-decoration: none;
}
.working-notes-earlier .ui-icon { width: 13px; height: 13px; }
.completed-working-notes-toggle small { color: inherit; font-weight: 500; opacity: .8; }
.working-notes-earlier .research-progress-chevron,
.completed-working-notes-toggle .research-progress-chevron {
  width: 6px;
  height: 6px;
  margin: 0 1px 3px 2px;
  transition: transform .25s ease, margin .25s ease;
}
.working-notes-earlier[aria-expanded="true"] .research-progress-chevron,
.completed-working-notes-toggle[aria-expanded="true"] .research-progress-chevron {
  margin: 3px 1px 0 2px;
  transform: rotate(225deg);
}
.completed-working-notes {
  margin: 0 0 20px;
  padding: 0 0 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.completed-working-notes-body { padding-top: 10px; }

.ui-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Answer actions */
.message-actions {
  gap: 2px;
  opacity: .7;
  transition: opacity .18s ease;
}
.message-action {
  position: relative;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  transition: background .15s ease, color .15s ease;
}
.message-action:hover,
.message-action:focus-visible {
  border-color: transparent;
  background: color-mix(in srgb, var(--line) 42%, transparent);
  color: var(--ink);
}
.message-action:focus-visible { outline: 2px solid color-mix(in srgb, var(--green, #176b4f) 40%, transparent); outline-offset: 1px; }
.message-action:active { transform: scale(.94); }
.message-action.message-action-labelled {
  display: inline-flex;
  gap: 6px;
  width: auto;
  padding: 0 10px 0 8px;
  font: 550 12px/1 "Inter", system-ui, sans-serif;
}
.message-action.message-action-text {
  border-radius: 8px;
  font-weight: 600;
}
.message-action .icon-done { display: none; }
.message-action.copied { color: var(--green, #176b4f); }
.message-action.copied .icon-idle { display: none; }
.message-action.copied .icon-done { display: block; }
.message-action[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font: 550 11px/1.2 "Inter", system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 3px);
  transition: opacity .15s ease, transform .15s ease;
}
.message-action[data-tooltip]:hover::after,
.message-action[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: .35s;
}

@media (hover: none) {
  .message-actions { opacity: 1; }
  .message-action[data-tooltip]::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .working-notes-stream .working-note,
  .working-note.active .working-note-marker::after,
  .working-note.latest:not(.complete) .working-note-marker::after { animation: none; }
  .working-notes-collapsible { transition: none; }
}

/* --- Live workings as a stream of thought (17 Nov 2026) -----------------
   One current thought in full; earlier thoughts recede above it; quotes and
   sources surface beneath. No icons, ticks or step numbers while running.
   The audit list sits behind "Show working". */
.thought-stream {
  display: grid;
  max-width: 760px;
  padding: 6px 0 12px;
}
.thought-stream.with-draft { padding-bottom: 4px; }

.thought-now-slot { position: relative; display: grid; margin-top: 4px; }
.thought-now {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 12px;
  animation: thought-tick-in .45s cubic-bezier(.2, .7, .2, 1) both;
}
.thought-now.is-leaving {
  position: absolute;
  inset: 0 0 auto 0;
  pointer-events: none;
  animation: thought-tick-out .4s cubic-bezier(.4, 0, .6, 1) both;
}
@keyframes thought-tick-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes thought-tick-out { to { opacity: 0; transform: translateY(-14px); } }
@keyframes thought-arrive { from { opacity: 0; transform: translateY(8px); filter: blur(3px); } }

.thought-glow {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #5fb48d, var(--green, #176b4f));
  box-shadow: 0 0 0 0 rgba(23, 107, 79, .25);
  animation: thought-breathe 2.8s ease-in-out infinite;
}
.thought-now.caution .thought-glow { background: radial-gradient(circle at 40% 40%, #e0b25c, #9a6a15); }
@keyframes thought-breathe {
  0%, 100% { transform: scale(.85); box-shadow: 0 0 0 0 rgba(23, 107, 79, .22); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 7px rgba(23, 107, 79, 0); }
}

.thought-body strong {
  display: block;
  color: var(--ink);
  font: 560 15px/1.5 "Inter", system-ui, sans-serif;
  letter-spacing: -0.006em;
}
.thought-count { color: var(--muted); font-weight: 500; }
.thought-detail-slot { display: grid; }
.thought-detail {
  margin: 3px 0 0;
  color: var(--muted);
  font: 450 13px/1.5 "Inter", system-ui, sans-serif;
  animation: thought-arrive .7s ease-out .15s both;
}
.thought-chips { animation: thought-arrive .7s ease-out .3s both; }

.thought-discovery-slot { display: grid; margin-left: 22px; }
.thought-discovery {
  margin-top: 12px;
  animation: thought-surface 1.1s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes thought-surface { from { opacity: 0; transform: translateY(10px) scale(.985); } }

.thought-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 12px 0 0 22px;
  color: var(--muted);
  font: 500 11.5px/1.4 "Inter", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.thought-show-working {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.thought-show-working:hover { color: var(--ink); }
.thought-show-working .research-progress-chevron { width: 5px; height: 5px; margin: 0 0 3px; transition: transform .25s ease, margin .25s ease; }
.thought-show-working[aria-expanded="true"] .research-progress-chevron { margin: 3px 0 0; transform: rotate(225deg); }
.thought-stream > .working-notes-collapsible { margin-left: 22px; }
.thought-stream .completed-working-notes-body { padding-top: 8px; }

/* The current line opens the earlier steps above it. */
.thought-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: calc(100% + 16px);
  margin: -3px -8px;
  padding: 3px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.thought-line:disabled { cursor: default; }
.thought-line[aria-expanded="true"] { background: color-mix(in srgb, var(--line) 22%, transparent); }
.thought-line:focus-visible { outline: 2px solid color-mix(in srgb, var(--green, #176b4f) 40%, transparent); outline-offset: 1px; }
.thought-history-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: var(--muted);
  font: 550 11px/1 "Inter", system-ui, sans-serif;
  opacity: .55;
  transition: opacity .15s ease;
}
.thought-history-hint .research-progress-chevron { width: 5px; height: 5px; margin: 2px 0 0; transform: rotate(225deg); }
.thought-line:focus-visible .thought-history-hint,
.thought-line[aria-expanded="true"] .thought-history-hint { opacity: 1; }
.thought-line[aria-expanded="true"] .thought-history-hint .research-progress-chevron { margin: 0 0 3px; transform: rotate(45deg); }

.thought-stream > .thought-history { margin-left: 22px; }
.thought-history .completed-working-notes-body { padding: 0 0 10px; }
.thought-history .working-note { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .thought-now, .thought-now.is-leaving, .thought-detail, .thought-chips,
  .thought-discovery, .thought-glow { animation: none; transition: none; }
  .thought-now.is-leaving { display: none; }
}

/* Working-note lists: text only, no markers (17 Nov 2026). */
.working-note,
.thought-history .working-note { grid-template-columns: minmax(0, 1fr); gap: 0; }
.thought-history .working-note strong { font-weight: 520; }

/* Interim notices (17 Nov 2026): portrait credits, the AI line under the
   composer and the independence/licence line on the sign-in screen. */
.mentioned-mp-card small.portrait-credit { color: var(--muted); font-size: 10.5px; line-height: 1.3; }
.mp-profile-photo { display: grid; justify-items: center; gap: 3px; margin: 0; }
/* The photo has its own column; the credit stays under it and wraps within it (licence credit kept). */
.mp-profile-photo { width: 100%; min-width: 0; }
.mp-profile-photo .portrait-credit { max-width: 100%; color: var(--muted); font-size: 9.5px; line-height: 1.25; text-align: center; white-space: normal; overflow-wrap: break-word; }
/* 18 Nov: the AI notice lives in the composer's own bottom row, in the space
   left of Send, so the box never grows or shifts for it (Sam: "no clunky
   shunting upwards"). It wraps there on narrow screens. */
.composer-disclaimer { flex: 1 1 auto; min-width: 0; margin: 0; padding-left: 6px; color: var(--muted); font-size: 11.5px; line-height: 1.35; text-align: left; }
@media (max-width: 768px) { .composer-toolbar { flex-wrap: nowrap; } .composer-disclaimer { font-size: 11px; line-height: 1.3; } }
.composer-disclaimer a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.site-notice { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.5; text-align: center; }
.site-notice a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.site-notice a:hover, .composer-disclaimer a:hover { color: var(--green); }

/* Quotations in answers (18 Nov 2026). */
.answer-quote { margin: 10px 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--green, #176b4f); color: var(--ink); font-style: normal; }


/* "Explore in chat" sources as linked chips (release H, 18 Nov 2026). */
.seed-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.seed-source { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 9px; border: 1px solid var(--line, #d0d5dd);
  border-radius: 999px; font-size: 0.82rem; line-height: 1.4; color: inherit; text-decoration: none; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; background: var(--paper, transparent); }
a.seed-source:hover, a.seed-source:focus-visible { text-decoration: underline; }
.composer-seed { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 2px 2px; }
.composer-seed .seed-sources { margin-top: 0; }
.composer-seed-label { font-size: 0.8rem; opacity: 0.75; }
.seed-sources-clear { border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; padding: 2px 6px; color: inherit; opacity: 0.7; }

/* Terms of Use acceptance (shown only while terms are in force). */
.auth-terms-check { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start; font-size: 13px; line-height: 1.45; color: var(--ink); }
.auth-terms-check.hidden { display: none; }
.auth-terms-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--green); }
.auth-terms-check a { color: var(--green); }
#termsDialog .secondary-action { margin-top: 4px; }
.terms-link.hidden { display: none !important; }


/* Early lines from the record while an answer is made (21 Nov 2026). */
.early-lines { margin: 0 0 4px; }
.early-lines-label { margin: 0 0 6px; font-size: 0.78rem; letter-spacing: 0.02em; text-transform: uppercase; opacity: 0.7; }
.early-lines.running .early-lines-label::after { content: " …"; }
.early-lines-debate { margin: 8px 0 2px; font-size: 0.8rem; font-weight: 600; opacity: 0.8; }
.early-line { margin: 0 0 6px; line-height: 1.5; }
.early-line-quote { font-style: italic; opacity: 0.85; }
.early-line-source { font-size: 0.8rem; white-space: nowrap; color: inherit; opacity: 0.75; text-decoration: none; }
a.early-line-source:hover, a.early-line-source:focus-visible { text-decoration: underline; opacity: 1; }
/* Inside the progress panel: aligned with the step text, above the answer. */
.thought-stream > .early-lines { margin: 14px 0 0 22px; }
.completed-working-notes-body > .early-lines { margin: 10px 0 4px; }

/* Tester welcome page: shown once per tester link while Terms of Use are in force. */
.tester-welcome { position: fixed; inset: 0; z-index: 200; background: var(--surface, #fff); }
.tester-welcome.hidden { display: none; }
body.tester-welcome-open { overflow: hidden; }
.tester-welcome-panel { width: min(560px, 100%); }
.tester-welcome-copy { display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.tester-welcome-copy h1 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 600; }
.tester-welcome-copy h2 { margin: 8px 0 0; font-size: 16px; font-weight: 600; }
.tester-welcome-copy p, .tester-welcome-copy li { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); }
.tester-welcome-copy ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.tester-welcome-copy li[hidden] { display: none; }
.tester-welcome-check { padding-top: 4px; }
#testerContinueButton:disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 640px) { .tester-welcome-panel { padding: 22px 18px; } }

/* The new-chat line stays on one line on desktop (Sam trimmed this page). */
.home-empty p { max-width: 640px; }
/* Early lines arrive one at a time; a framing fades in when it is ready (23 Nov 2026). */
@keyframes early-line-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes early-framing-in { from { opacity: 0; } to { opacity: 1; } }
.early-line-item.early-in { animation: early-line-in 0.5s ease-out both; }
.early-line-framing.early-in { animation: early-framing-in 0.6s ease-out both; }
.early-line .early-line-source { white-space: normal; font-size: inherit; font-weight: 600; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .early-line-item.early-in, .early-line-framing.early-in { animation: none; }
}
