/* Research assistant — Grok-like chat shell (purple MFP brand) */
body.research-page.has-mfp-portal {
  padding-top: 0 !important;
}

body.research-page .research-main {
  background: linear-gradient(180deg, var(--brand-light) 0%, var(--bg) 12rem);
}

body.research-page .research-main > .topbar {
  min-height: 3.25rem;
  padding: 0.85rem 1.5rem;
  box-sizing: border-box;
  align-items: center;
}

body.research-page.mfp-research-open .research-main > .topbar {
  padding-right: 1.5rem;
}

.research-hero {
  margin-bottom: 1rem;
  border-color: var(--border);
  background: linear-gradient(135deg, #fff 0%, var(--brand-light) 100%);
}

.research-demo-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand-ink-on-light);
  border: 1px solid var(--brand-mid);
}

.research-shell,
.mfp-research-chat-root {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 12rem);
  max-height: calc(100vh - 8rem);
  padding: 0;
  overflow: hidden;
  border-color: var(--brand-mid);
  box-shadow: var(--shadow);
}

#mfp-research-rail-body .mfp-research-chat-root {
  min-height: 0;
  max-height: none;
  box-shadow: none;
}

.research-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

.research-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.research-mode {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.research-mode:hover:not(:disabled) {
  border-color: var(--brand-mid);
  background: var(--brand-light);
}

.research-mode.is-active {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.research-mode.is-disabled,
.research-mode:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.research-magazine {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  margin-left: auto;
}

.research-magazine select {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.research-chat {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.research-msg {
  max-width: 42rem;
}

.research-msg--user {
  align-self: flex-end;
  margin-left: auto;
}

.research-msg--user .research-msg-text {
  background: var(--brand-dark);
  color: #fff;
  border-radius: 1rem 1rem 0.25rem 1rem;
  padding: 0.65rem 0.9rem;
}

.research-msg--assistant .research-msg-text {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 1rem 1rem 1rem 0.25rem;
  padding: 0.65rem 0.9rem;
}

.research-msg-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.research-msg-role {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.research-msg-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.research-rationale {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.research-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.research-badge--library { background: #dbeafe; color: #1e40af; }
.research-badge--trends { background: #fce7f3; color: #9d174d; }
.research-badge--images { background: #d1fae5; color: #065f46; }
.research-badge--internet { background: #fef3c7; color: #92400e; }
.research-badge--external { background: #f3f4f6; color: #6b7280; }
.research-badge--stub { background: #fee2e2; color: #991b1b; }

.research-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
  max-width: 36rem;
}

.research-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: #fff;
  box-shadow: 0 1px 2px rgba(69, 56, 160, 0.06);
}

.research-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.research-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.research-card-sub {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.research-card-rationale {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.research-card-thumb-wrap {
  margin-top: 0.5rem;
}

.research-card-thumb {
  width: 100%;
  max-width: 200px;
  border-radius: 8px;
  display: block;
  border: 1px solid var(--border);
}

.research-card-thumb.is-broken {
  display: none;
}

.research-thumb-error {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #b91c1c;
}

.research-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.research-card-actions .btn {
  font-size: 0.78rem;
  padding: 0.3rem 0.55rem;
}

.research-composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: #fff;
  align-items: flex-end;
}

.research-composer textarea {
  flex: 1;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  resize: none;
  min-height: 2.5rem;
  max-height: 8rem;
}

.research-composer textarea:focus {
  outline: 2px solid var(--brand-mid);
  border-color: var(--brand-mid);
}

.research-loading {
  opacity: 0.7;
  font-size: 0.85rem;
  color: var(--muted);
}
