.ask-page {
  min-height: 100vh;
}
.ask-top {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}
.ask-brand { flex: 1; }
.keys-header-btn { margin-left: auto; }
.ask-top .back {
  color: #8b98a8;
  text-decoration: none;
  margin-top: 0.55rem;
}
.ask-top .back:hover { color: #e7edf4; }
.eyebrow {
  margin: 0;
  color: #3b82f6;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ask-top h1 {
  margin: 0.2rem 0 0;
  font-size: 1.8rem;
}
.ask-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 1.5rem 4rem;
}
.lede, .hint, .crumb { color: #8b98a8; }
.crumb a { color: #3b82f6; text-decoration: none; }
.status { margin: 1rem 0; color: #8b98a8; font-size: 0.95rem; }
.hidden { display: none !important; }
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.login-form label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.login-form input, .composer textarea {
  background: #0f1419;
  border: 1px solid #2a3441;
  color: #e7edf4;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}
.composer textarea {
  display: block;
  width: 100%;
  min-height: 10.5rem;
  resize: vertical;
  line-height: 1.45;
  font-size: 1.05rem;
}
.papers { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
@media (min-width: 800px) { .papers { grid-template-columns: 1fr; } }
.paper-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: left top;
  border-radius: 8px;
  margin-bottom: 0.85rem;
}
.meta { color: #8b98a8; font-size: 0.85rem; margin: 0.25rem 0 0.75rem; }
.thread { display: flex; flex-direction: column; gap: 1rem; margin: 1.25rem 0; }
.bubble-user {
  align-self: flex-end;
  max-width: 36rem;
  background: #3b82f6;
  color: #fff;
  border-radius: 16px;
  padding: 0.8rem 1rem;
}
.bubble-bot {
  max-width: 48rem;
  background: #171d25;
  border: 1px solid #2a3441;
  border-radius: 16px;
  padding: 1rem;
}
.bubble-bot .label {
  color: #3b82f6;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}
.channel-prior {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed #b45309;
}
.channel-prior .label {
  color: #f59e0b;
}
.prior-warning {
  margin: 0 0 0.65rem;
  color: #fbbf24;
  font-size: 0.85rem;
  line-height: 1.4;
}
.prior-msg {
  margin: 0;
  white-space: pre-wrap;
}
.channel-literature {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed #0f766e;
}
.channel-literature .label {
  color: #2dd4bf;
}
.lit-warning {
  margin: 0 0 0.65rem;
  color: #5eead4;
  font-size: 0.85rem;
  line-height: 1.4;
}
.lit-query {
  margin: 0 0 0.65rem;
  color: #8b98a8;
  font-size: 0.8rem;
}
.lit-msg {
  margin: 0;
  white-space: pre-wrap;
}
.lit-records {
  margin: 0.75rem 0 0;
  padding-left: 0;
  list-style: none;
}
.lit-records li {
  margin: 0.35rem 0;
  font-size: 0.85rem;
  color: #c5d0dc;
  line-height: 1.4;
}
.lit-records a { color: #5eead4; }
.lit-n { color: #8b98a8; margin-right: 0.25rem; }
.field-context {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  color: #8b98a8;
  font-size: 0.78rem;
}
.field-context select {
  background: #0f1419;
  border: 1px solid #2a3441;
  color: #e7edf4;
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  font: inherit;
}
.passage {
  background: #0f1419;
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.75rem;
}
.passage .src { color: #8b98a8; font-size: 0.75rem; margin: 0; }
.error { color: #f87171; margin: 0; }
.examples { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.composer { margin-top: 1.5rem; }
.composer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.6rem;
}
@media (max-width: 640px) {
  .composer-row {
    flex-direction: column;
    align-items: stretch;
  }
}
.composer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.thread:not(.show-sources) .passages,
.thread:not(.show-sources) .fallback-msg {
  display: none;
}
.figures {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  margin: 0.75rem 0 0.15rem;
  padding-bottom: 0.2rem;
}
.figure {
  flex: 0 0 auto;
  width: 11rem;
  text-decoration: none;
  color: #8b98a8;
  font-size: 0.75rem;
  cursor: pointer;
}
.figure img {
  display: block;
  width: 11rem;
  height: 8rem;
  object-fit: cover;
  object-position: left top;
  border-radius: 8px;
  border: 1px solid #2a3441;
  background: #0f1419;
}
.figure span {
  display: block;
  margin-top: 0.35rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.figure-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(92vw, 88rem);
  height: min(88vh, 56rem);
  min-width: 22rem;
  min-height: 18rem;
  max-width: 98vw;
  max-height: 96vh;
  resize: both;
  overflow: hidden;
}
.figure-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  flex: 0 0 auto;
}
.figure-zoom-pct { margin: 0 0 0 0.35rem; }
.figure-viewport {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 12rem;
  height: auto;
  background: #0f1419;
  border: 1px solid #2a3441;
  border-radius: 8px;
  cursor: grab;
  overscroll-behavior: contain;
}
.figure-viewport.dragging { cursor: grabbing; }
.figure-viewport img {
  display: block;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.figure-resize-grip {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 14px;
  height: 14px;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    transparent 50%,
    #8b98a8 50%,
    #8b98a8 58%,
    transparent 58%,
    transparent 68%,
    #8b98a8 68%,
    #8b98a8 76%,
    transparent 76%
  );
}
.figure-caption { flex: 0 0 auto; margin: 0.65rem 0 0; }
.thread.show-sources .sources-hint {
  display: none;
}
.sources-hint {
  margin: 0.65rem 0 0;
  color: #8b98a8;
  font-size: 0.85rem;
}
.keys-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  border: 1px dashed #3b82f666;
  background: #152033;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
}
.keys-bar p { margin: 0; color: #e7edf4; }
.login-form select {
  background: #0f1419;
  border: 1px solid #2a3441;
  color: #e7edf4;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
}
.dialog {
  position: fixed;
  inset: 0;
  background: #0f1419cc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 20;
}
.dialog-card {
  width: min(28rem, 100%);
  background: #171d25;
  border: 1px solid #2a3441;
  border-radius: 14px;
  padding: 1.25rem;
}
.dialog-card.figure-dialog {
  width: min(92vw, 88rem);
  height: min(88vh, 56rem);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex: 0 0 auto;
}
