/* Secondary Ask portal — Perplexity-like, sits on top of the existing workspace. */

.ask-body {
  margin: 0;
  min-height: 100vh;
  background: #f6f7f3;
  color: #171918;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ask-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid #e4e7e1;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 4;
}

.ask-topbar-nav {
  display: flex;
  gap: 1rem;
  font-size: 0.88rem;
}
.ask-topbar-nav a { color: #4d564f; text-decoration: none; }
.ask-topbar-nav a:hover { color: #117744; }

.ask-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}
.ask-stage { min-width: 0; }
.ask-main { min-height: calc(100vh - 56px); }

.ask-history {
  background: #eef1ea;
  border-right: 1px solid #e4e7e1;
  padding: 0.85rem 0.75rem 1.5rem;
  overflow: auto;
}
.ask-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.ask-history-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6a726c;
}
.ask-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.ask-history-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0.3rem;
}
.ask-history-open {
  flex: 1;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.84rem;
  color: #2c332f;
  cursor: pointer;
}
.ask-history-item.is-active .ask-history-open,
.ask-history-open:hover {
  background: #fff;
}
.ask-history-delete {
  border: 0;
  background: transparent;
  color: #8a2b22;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0.3rem 0.35rem;
}
.ask-history-empty {
  color: #6a726c;
  font-size: 0.8rem;
  padding: 0.4rem 0.2rem;
}
.ask-history-toggle {
  display: none;
  border: 1px solid #d8ddd6;
  background: #fff;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.ask-home {
  max-width: 720px;
  margin: 0 auto;
  padding: 12vh 1.25rem 4rem;
  text-align: center;
}

.ask-home h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 560;
  letter-spacing: -0.03em;
}

.ask-home .ask-lede {
  margin: 0 0 1.5rem;
  color: #5c645e;
  font-size: 1rem;
  line-height: 1.5;
}

.ask-composer {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  padding: 0.65rem 0.7rem 0.65rem 0.9rem;
  border: 1px solid #d8ddd6;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(20, 24, 21, 0.06);
  text-align: left;
}

.ask-composer textarea {
  flex: 1;
  border: 0;
  resize: none;
  min-height: 3.2rem;
  max-height: 9rem;
  font: inherit;
  outline: none;
  background: transparent;
}

.ask-composer button {
  border: 0;
  background: #117744;
  color: #fff;
  border-radius: 12px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 560;
  cursor: pointer;
}

.ask-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 1rem;
}

.ask-chip {
  border: 1px solid #d8ddd6;
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  color: #2c332f;
}
.ask-chip:hover { border-color: #117744; }
.ask-chip-danger { color: #8a2b22; border-color: #e4c4bf; }
.ask-chip-danger:hover { border-color: #c45c4a; }
.ask-continue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.ask-thread {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0;
  min-height: calc(100vh - 56px);
}

.ask-thread-main {
  display: flex;
  flex-direction: column;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 6.5rem;
}

.ask-msg {
  max-width: 40rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  line-height: 1.5;
  font-size: 0.95rem;
}
.ask-msg.user {
  margin-left: auto;
  background: #171918;
  color: #f4f6f2;
}
.ask-msg.system {
  background: #fff;
  border: 1px solid #e4e7e1;
}
.ask-msg.pending {
  opacity: 0.92;
}
.ask-msg.thinking {
  color: #5c645e;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.ask-msg.error {
  border-color: #c45c4a;
  color: #7a2e22;
}
.ask-think-dot {
  display: inline-block;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: #117744;
  animation: ask-think 1.1s infinite ease-in-out;
}
.ask-think-dot:nth-child(2) { animation-delay: 0.15s; }
.ask-think-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes ask-think {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
.ask-composer button:disabled,
.ask-composer textarea:disabled {
  opacity: 0.65;
  cursor: wait;
}

.ask-followups { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.65rem; }

.ask-dock {
  position: sticky;
  bottom: 0;
  padding: 0.75rem 1.25rem 1.1rem;
  background: linear-gradient(180deg, transparent, #f6f7f3 30%);
}

.ask-rail {
  border-left: 1px solid #e4e7e1;
  background: #fbfcf9;
  padding: 1rem 1rem 2rem;
  overflow: auto;
}
.ask-rail h2 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: #6a726c; margin: 1rem 0 0.4rem; }
.ask-rail h2:first-child { margin-top: 0; }
.ask-rail ul { margin: 0; padding-left: 1.05rem; }
.ask-rail li { margin: 0.3rem 0; font-size: 0.84rem; }

.ask-scope { margin: 0 0 0.75rem; font-size: 0.84rem; color: #5c645e; }
.ask-scope select { margin-left: 0.35rem; }

.ask-note { font-size: 0.78rem; color: #6a726c; margin: 0.75rem 0 0; }

.ask-continue, .ask-last-visit {
  text-align: left;
  margin: 1rem auto 0;
  max-width: 32rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid #e4e7e1;
  border-radius: 12px;
  background: #fff;
}
.ask-last-visit { max-width: 40rem; margin: 0 0 1rem; font-size: 0.88rem; }
.ask-mini {
  border: 0;
  background: none;
  color: #117744;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
}
.ask-why { margin-top: 0.35rem; color: #5c645e; font-size: 0.8rem; }
.ask-voice {
  border: 1px solid #d8ddd6;
  background: #fff;
  color: #2c332f;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-weight: 560;
  cursor: pointer;
}

.safety-banner,
.discovery-control-banner {
  border: 1px solid #d8ddd6;
  background: #fff;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  margin: 0 0 0.85rem;
  font-size: 0.86rem;
}

.ask-pmid { color: #6a726c; font-size: 0.75rem; }

.ask-attach {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0.35rem 0 0.25rem;
}
.ask-attach input,
.ask-attach textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d8ddd6;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.82rem;
  background: #fff;
}
.ask-attach button {
  align-self: flex-start;
  border: 0;
  background: #117744;
  color: #fff;
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  .ask-shell { grid-template-columns: 1fr; }
  .ask-history {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 280px);
    z-index: 8;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    box-shadow: 12px 0 32px rgba(16, 19, 17, 0.12);
  }
  .ask-history-open .ask-history { transform: translateX(0); }
  .ask-history-toggle { display: inline-flex; }
  .ask-thread { grid-template-columns: 1fr; }
  .ask-rail { border-left: 0; border-top: 1px solid #e4e7e1; }
}
