: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;
  border-top: 1px solid var(--line);
}

.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 "Source Serif 4", Georgia, serif; }
.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: "Source Serif 4", Georgia, serif;
  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;
}

.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-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::before {
  display: inline-block;
  width: 18px;
  content: "✓";
  color: var(--accent);
  font-weight: 800;
}

@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; }

.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; }

.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-review-warnings {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  border: 1px solid #e8bf69;
  border-radius: 10px;
  background: #fff8e8;
  color: #70460a;
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.45;
}
.answer-review-warnings strong { font-size: 13px; }
.answer-review-warnings 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;
}

.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: "Source Serif 4", Georgia, serif;
  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, 254, 250, .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 "Source Serif 4", Georgia, serif; }
.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, 254, 250, .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, 254, 250, .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, 254, 250, .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) 360px; }
.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: #f0f1eb; 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-sidebar .primary-action::before { content: "+"; display: grid; flex: 0 0 24px; place-items: center; width: 24px; height: 24px; margin-right: 10px; border: 1px solid rgba(255,255,255,.58); border-radius: 50%; font: 400 19px/1 "Inter", sans-serif; transform: translateY(-.5px); }
.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: #f0f1eb; }
.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, 254, 250, .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; }
.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, 254, 250, .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 "Source Serif 4", Georgia, serif; 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(244, 243, 238, .92) 82%, rgba(244, 243, 238, 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-summary { display: flex; flex-wrap: wrap; gap: 6px; padding: 1px 4px 7px; }
.research-scope-summary.hidden { display: none; }
.research-scope-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 4px 7px 4px 9px; border: 1px solid #c7d7cd; border-radius: 999px; background: #edf3ef; color: var(--green-deep); font: 700 11px/1.15 "Inter", system-ui, sans-serif; }
.research-scope-chip button { display: grid; place-items: center; width: 17px; height: 17px; padding: 0 !important; border: 0 !important; border-radius: 50% !important; background: transparent !important; color: #60736a !important; font: 700 14px/1 "Inter", sans-serif !important; box-shadow: none !important; }
.research-scope-chip button:hover { background: rgba(23,107,79,.1) !important; transform: none !important; }
.research-scope-picker { position: relative; }
.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; }
.research-scope-panel { position: absolute; z-index: 95; left: 0; bottom: calc(100% + 10px); display: grid; gap: 14px; width: min(390px, calc(100vw - 32px)); padding: 16px; border: 1px solid #cbd6ce; border-radius: 16px; background: rgba(255,254,250,.99); box-shadow: 0 18px 50px rgba(23,34,29,.18); color: var(--ink); font-family: "Inter", system-ui, sans-serif; }
.research-scope-panel.hidden { display: none; }
.research-scope-panel header { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.research-scope-panel header div { display: grid; gap: 4px; }
.research-scope-panel header strong { font-size: 15px; }
.research-scope-panel header span, .research-scope-panel small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.research-scope-panel header button { width: 28px; min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 20px; box-shadow: none; }
.research-scope-field { display: grid; gap: 6px; color: var(--ink); font-size: 11px; font-weight: 750; }
.research-scope-field select, .research-scope-field input { width: 100%; min-height: 38px; padding: 7px 9px; border: 1px solid #ccd6cf; border-radius: 9px; background: var(--surface); color: var(--ink); font: 600 12px/1.2 "Inter", system-ui, sans-serif; }
.research-scope-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.research-house-field { margin: 0; padding: 0; border: 0; }
.research-house-field legend { margin-bottom: 7px; color: var(--ink); font-size: 11px; font-weight: 750; }
.research-house-options { display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 10px; background: #edf0ec; }
.research-house-options button { min-height: 34px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: 700 12px/1 "Inter", sans-serif; box-shadow: none; }
.research-house-options button.active { background: var(--surface); color: var(--green-deep); box-shadow: 0 1px 4px rgba(23,34,29,.10); }
.research-house-options button:hover { transform: none; }
.research-scope-panel footer { display: flex; justify-content: space-between; gap: 12px; padding-top: 2px; }
.research-scope-panel footer button { min-height: 36px; padding: 7px 12px; border-radius: 9px; font-size: 12px; }
.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, 254, 250, .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: #f0f1eb; }
.sources-panel, .mp-profile-panel { width: 360px; background: #f0f1eb; border-left-color: var(--line); }
.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); }

/* 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; }

.admin-grid { gap: 20px !important; }
.admin-panel { padding: 22px !important; border-color: var(--line) !important; border-radius: var(--radius) !important; background: var(--surface) !important; box-shadow: var(--shadow-soft); }
.admin-panel { min-width: 0; overflow: hidden; }
.admin-panel > h2 { font-size: 24px; }
.admin-panel .setting { padding-bottom: 4px; }
.admin-panel table { font-size: 13px; }
.admin-panel th { color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.access-toggle { border-color: #c7ded0 !important; border-radius: 10px !important; background: var(--green-wash) !important; }
.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: 1350px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr) !important; }
}

@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: #f0f1eb;
  }
  .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;
  }
  .home-empty { padding: 22px 10px; }
  .home-empty h2 { font-size: 40px; }
  .home-suggestions { height: 269px; min-height: 269px; }
  .home-composer { padding: 10px 12px 14px; }
  .research-scope-panel { position: fixed; left: 12px; right: 12px; bottom: 92px; width: auto; max-height: calc(100vh - 120px); overflow-y: auto; }
  .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; }
  .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; }
}

/* Signed-in account settings */
.account-settings-view {
  position: absolute;
  z-index: 30;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--canvas);
  scrollbar-color: rgba(23, 107, 79, .28) transparent;
}

.account-settings-shell {
  width: min(980px, calc(100% - 56px));
  margin: 0 auto;
  padding: 52px 0 80px;
}

.account-settings-header {
  display: grid;
  gap: 7px;
  margin-bottom: 38px;
}

.account-settings-header > p {
  margin: 18px 0 0;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
}

.account-settings-header h1 {
  margin: 0;
  color: var(--ink);
  font: 600 clamp(34px, 5vw, 48px)/1.05 "Source Serif 4", Georgia, serif;
  letter-spacing: -.025em;
}

.account-settings-header > span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.account-back-button {
  justify-self: start;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--green-deep);
  font-weight: 700;
}

.account-settings-layout {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 42px;
  align-items: start;
}

.account-settings-nav {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 4px;
}

.account-settings-nav button {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.account-settings-nav button:hover,
.account-settings-nav button.active {
  background: var(--green-wash);
  color: var(--green-deep);
}

.account-settings-nav button.active {
  box-shadow: inset 3px 0 0 var(--green);
}

.account-settings-content,
.account-settings-section {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.account-settings-section.hidden { display: none; }

.account-settings-loading {
  margin: 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
}

.account-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.account-section-heading h2 {
  margin: 0;
  color: var(--ink);
  font: 600 27px/1.15 "Source Serif 4", Georgia, serif;
}

.account-section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.account-card {
  border: 1px solid #d6ddd7;
  border-radius: 14px;
  background: var(--surface);
  padding: 20px;
  box-shadow: 0 6px 20px rgba(23, 34, 29, .035);
}

.account-profile-form {
  display: grid;
  gap: 18px;
}

.account-name-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.account-profile-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.account-profile-form input {
  min-width: 0;
  border-color: #cbd6ce;
  background: #fff;
}

.account-readonly-row,
.account-action-row,
.account-card-actions,
.account-card-title,
.account-usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.account-readonly-row > div,
.account-action-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.account-readonly-row span,
.account-card-title span,
.account-usage-row span {
  color: var(--muted);
  font-size: 11px;
}

.account-readonly-row strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.account-status-badge {
  flex: 0 0 auto;
  border: 1px solid #b8d7c5;
  border-radius: 999px;
  background: var(--green-wash);
  color: var(--green-deep) !important;
  padding: 5px 9px;
  font-weight: 800;
}

.account-status-badge.unverified {
  border-color: #efcc91;
  background: #fff8e6;
  color: #7a4a00 !important;
}

.account-card-note,
.account-action-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.account-card-actions {
  min-height: 38px;
  padding-top: 4px;
}

.account-card-actions button,
.account-action-row button {
  flex: 0 0 auto;
}

.account-inline-status {
  margin: 0;
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 700;
}

.account-inline-status.error { color: #8a1c1c; }

.account-detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.account-detail-list div {
  min-width: 0;
  background: rgba(255, 254, 250, .88);
  padding: 14px 16px;
}

.account-detail-list dt {
  color: var(--muted);
  font-size: 11px;
}

.account-detail-list dd {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.account-action-row strong { font-size: 14px; }

.account-usage-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.account-usage-metrics article {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid #d6ddd7;
  border-radius: 13px;
  background: var(--surface);
  padding: 17px;
}

.account-usage-metrics span {
  color: var(--muted);
  font-size: 11px;
}

.account-usage-metrics strong {
  color: var(--green-deep);
  font: 600 25px/1.1 "Source Serif 4", Georgia, serif;
}

.account-usage-card { padding: 0; overflow: hidden; }
.account-card-title { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.account-recent-usage { display: grid; }

.account-usage-row {
  padding: 13px 18px;
  border-bottom: 1px solid #e3e7e3;
}

.account-usage-row:last-child { border-bottom: 0; }
.account-usage-row > div { display: grid; gap: 3px; }
.account-usage-result { flex: 0 0 auto; text-align: right; }
.account-usage-result strong { color: var(--green-deep); font-size: 13px; }
.account-empty-state { margin: 0; padding: 22px 18px; color: var(--muted); font-size: 13px; }

.output-style-current {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.output-style-current > div { display: grid; gap: 5px; }
.output-style-current > div > span,
.output-style-preview > span,
.export-plan-preview > span {
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .11em;
}
.output-style-current strong { color: var(--ink); font: 600 20px/1.2 "Source Serif 4", Georgia, serif; }
.output-style-current p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.output-style-form { display: grid; gap: 14px; }
.output-style-form > label,
.export-instructions {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}
.output-style-form textarea,
.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;
}
.output-style-form textarea:focus,
.export-instructions textarea:focus { outline: 2px solid rgba(23, 107, 79, .16); border-color: var(--green); }

.output-style-preview,
.export-plan-preview {
  display: grid;
  gap: 9px;
  border: 1px solid #cbded2;
  border-radius: 11px;
  background: var(--green-wash);
  padding: 15px;
}
.output-style-preview > strong,
.export-plan-preview > strong { color: var(--ink); font-size: 15px; }
.output-style-preview dl,
.export-plan-preview dl { display: grid; gap: 7px; margin: 0; }
.output-style-preview dl div,
.export-plan-preview dl div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; }
.output-style-preview dt,
.export-plan-preview dt { color: var(--muted); font-size: 11px; }
.output-style-preview dd,
.export-plan-preview dd { margin: 0; color: var(--ink); font-size: 11px; font-weight: 650; overflow-wrap: anywhere; }
.output-style-preview dd i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 1px solid rgba(0,0,0,.12); border-radius: 50%; vertical-align: -1px; }
.output-style-actions { justify-content: flex-end; }

.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 "Source Serif 4", Georgia, serif; }
.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: repeat(3, minmax(0, 1fr)); gap: 9px; }
.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 "Source Serif 4", Georgia, serif; }
.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-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 "Source Serif 4", Georgia, serif; 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) {
  .account-settings-shell {
    width: min(100% - 28px, 680px);
    padding: 24px 0 60px;
  }
  .account-settings-header { margin-bottom: 24px; }
  .account-settings-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .account-settings-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 4px;
    border-radius: 11px;
    background: #e9ede9;
  }
  .account-settings-nav button { text-align: center; }
  .account-settings-nav button.active { background: var(--surface); box-shadow: 0 1px 4px rgba(23, 34, 29, .08); }
  .account-name-fields,
  .account-detail-list,
  .account-usage-metrics { grid-template-columns: minmax(0, 1fr); }
  .account-action-row { align-items: flex-start; flex-direction: column; }
  .account-action-row button { width: 100%; }
  .export-suggestion-cards,
  .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)); }
}

@media (max-width: 480px) {
  .account-settings-header h1 { font-size: 35px; }
  .account-card { padding: 16px; }
  .account-readonly-row,
  .account-card-actions { align-items: flex-start; flex-direction: column; }
  .account-card-actions button { width: 100%; }
}

/* 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; }

@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; }
