/* The assistant: one column of white cards in the app's own dashboard
   language. The page is as tall as the screen under the navbar and only the
   conversation card scrolls, so the header and the ask box never move. */
.assistant-page {
  display: flex;
  justify-content: center;
  height: calc(100dvh - var(--navbar-height));
  padding: 1.75rem 1rem;

  @media (max-width: 640px) { padding: 0.75rem; }
}
.assistant-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 53.75rem;
  min-height: 0;

  @media (max-width: 640px) { gap: 0.75rem; }
}

.assistant-card {
  padding: 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  background: var(--color-surface);

  @media (max-width: 640px) { padding: 1rem; }
}
.assistant-card__title { margin-bottom: 0.5rem; font-size: 1.375rem; font-weight: 700; }
.assistant-empty { color: var(--color-text); }

/* The green sparkle, the assistant's face. */
.assistant-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid #dceee3;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);

  & svg { width: 50%; height: 50%; }
}
.assistant-avatar--large { width: 4rem; height: 4rem; }

.assistant-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--color-primary);

  & svg { width: 1.125rem; height: 1.125rem; }
  &:hover { color: var(--color-primary-dark); }
}

/* The header: big on a first visit, one line once there's a conversation. */
.assistant-header--first { display: flex; flex-direction: column; gap: 1.25rem; }
.assistant-intro { display: flex; align-items: center; gap: 1.125rem; }
.assistant-intro__who { display: flex; flex-direction: column; gap: 0.25rem; }
.assistant-intro__name { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.assistant-intro__about { color: var(--color-text); }

.assistant-header--compact { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.assistant-header__left { display: flex; align-items: center; gap: 0.875rem; }
.assistant-header__divider { width: 1px; height: 1.25rem; background: var(--color-border); }
.assistant-header__name { font-size: 1.375rem; font-weight: 700; }
.assistant-header__status { font-size: 0.875rem; color: var(--color-muted); @media (max-width: 640px) { display: none; } }

/* First visit: things to ask, and what the assistant knows. */
.assistant-welcome { display: flex; flex: 1; flex-direction: column; gap: 1.25rem; min-height: 0; overflow-y: auto; }
.assistant-questions { display: flex; flex-direction: column; }
.assistant-question {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 0;
  border-top: 1px solid var(--color-hairline);
  font-size: 1.0625rem;
  font-weight: 500;
  text-align: left;
  color: var(--color-ink);

  & svg { flex: none; width: 1.125rem; height: 1.125rem; color: var(--color-primary); }
  &:hover { color: var(--color-primary-dark); }
}
.assistant-questions li:first-child .assistant-question { border-top: 0; }
.assistant-guides { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.assistant-guide {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.75rem;
  border-radius: 999px;
  background: var(--color-raised);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);

  & svg { width: 0.875rem; height: 0.875rem; color: var(--color-muted); }
}

/* The conversation card fills what's left and scrolls on its own. */
.assistant-chat {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1.125rem;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem 1.75rem;

  @media (max-width: 640px) { padding: 0.875rem; gap: 0.875rem; }
}
.assistant-chat[hidden] { display: none; }
.assistant-chat__day {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  color: var(--color-muted);
}
.assistant-messages { display: flex; flex-direction: column; gap: 1.125rem; @media (max-width: 640px) { gap: 0.875rem; } }

.assistant-person { display: flex; justify-content: flex-end; }
.assistant-person__bubble {
  max-width: 29rem;
  padding: 0.75rem 1.125rem;
  border-radius: 1.125rem 1.125rem 0.375rem 1.125rem;
  background: var(--color-primary);
  color: #fff;
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;

  @media (max-width: 640px) { max-width: 85%; }
}

.assistant-turn { display: flex; align-items: flex-start; gap: 0.75rem; @media (max-width: 640px) { gap: 0.5rem; } }
.assistant-turn__answer { display: flex; flex: 1; flex-direction: column; gap: 0.5rem; min-width: 0; }
.assistant-turn__bubble {
  padding: 0.875rem 1.125rem;
  border: 1px solid var(--color-hairline);
  border-radius: 0.375rem 1.125rem 1.125rem 1.125rem;
  background: var(--color-raised);
  font-size: 1rem;
  line-height: 1.6;

  & p { margin-bottom: 0.625rem; }
  & p:last-child, & ul:last-child { margin-bottom: 0; }
  & strong { font-weight: 600; }
  & ul { margin-bottom: 0.625rem; }
  & li { position: relative; margin: 0.25rem 0; padding-left: 1.2em; }
  & li::before { content: "•"; position: absolute; left: 0; color: var(--color-primary); }
}
.assistant-turn__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem 0.5rem;

  @media (max-width: 640px) { flex-direction: column; align-items: flex-start; }
}
.assistant-turn__time { font-size: 0.75rem; color: var(--color-muted); }
.assistant-source {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  background: var(--color-primary-soft);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-primary-dark);

  & svg { flex: none; width: 0.8125rem; height: 0.8125rem; color: var(--color-primary); }
  @media (max-width: 640px) { align-items: flex-start; padding: 0.375rem 0.625rem; line-height: 1.35; }
}

/* While it writes: three dots, gently bobbing. */
.assistant-thinking { display: flex; align-items: center; gap: 0.75rem; @media (max-width: 640px) { gap: 0.5rem; } }
.assistant-thinking__hint { font-size: 0.8125rem; color: var(--color-muted); }
.assistant-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0;

  & span { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-primary); animation: assistant-dot 1.2s infinite ease-in-out; }
  & span:nth-child(2) { opacity: 0.55; animation-delay: 0.15s; }
  & span:nth-child(3) { opacity: 0.3; animation-delay: 0.3s; }
}
.assistant-dots--bubble {
  padding: 1rem 1.25rem;
  border: 1px solid var(--color-hairline);
  border-radius: 0.375rem 1.125rem 1.125rem 1.125rem;
  background: var(--color-raised);
}
@keyframes assistant-dot {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
}

/* The ask box: a pill to type in and a round green send button. */
.assistant-ask { display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem; @media (max-width: 640px) { padding: 0.75rem; } }
.assistant-ask__row { display: flex; align-items: center; gap: 0.75rem; }
.assistant-ask__form { display: flex; flex: 1; align-items: center; gap: 0.75rem; min-width: 0; }
.assistant-ask__drop { flex: none; }

/* The drop zone beside the send arrow: a dashed pill that lights up when a
   file is dragged over it. On a phone it is just the paperclip. */
.assistant-drop {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 3rem;
  padding: 0 1rem;
  border: 1px dashed var(--color-border-strong);
  border-radius: 1.5rem;
  background: var(--color-raised);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-muted);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;

  & svg { flex: none; width: 1.125rem; height: 1.125rem; }
  &:hover, &.is-over { border-color: var(--color-primary); background: var(--color-primary-soft); color: var(--color-primary-dark); }
  @media (max-width: 640px) { width: 3rem; padding: 0; justify-content: center; & .assistant-drop__label { display: none; } }
}
.assistant-ask__input {
  flex: 1;
  min-height: 3rem;
  max-height: 12.5rem;
  padding: 0.75rem 1.125rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 1.5rem;
  background: var(--color-raised);
  font-size: 1rem;
  line-height: 1.5;
  resize: none;

  &::placeholder { color: var(--color-muted); }
  &:focus { outline: 2px solid var(--color-primary); outline-offset: -1px; border-color: transparent; }
}
.assistant-ask__send {
  display: grid;
  flex: none;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;

  & svg { width: 1.375rem; height: 1.375rem; }
  &:hover { background: var(--color-primary-dark); }
}
.assistant-ask__hint { font-size: 0.8125rem; color: var(--color-muted); @media (max-width: 640px) { display: none; } }
