/* Scoped to the tutor so the rest of the learning workspace keeps its layout. */
.workspace-shell.student-chat-redesign {
  background: #fff;
}

.student-chat-redesign .workspace-main-conversation {
  width: 100%;
  min-width: 0;
}

.student-chat-redesign .ask-conversation {
  width: min(100%, 54rem);
  min-height: calc(100svh - 11rem);
  margin: 0 auto;
  padding: 1.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
}

.student-chat-redesign .ask-conversation.is-empty {
  justify-content: center;
  padding-bottom: clamp(3rem, 12vh, 8rem);
}

.student-chat-redesign .professor-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0 1.75rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: center;
  overflow: visible;
}

.student-chat-redesign .professor-schrodinger {
  width: 6rem;
  align-self: center;
  filter: none;
}

.student-chat-redesign .professor-placeholder {
  display: grid;
  place-items: center;
  width: 3.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid color-mix(in srgb, var(--brand-accent) 15%, white);
  border-radius: 1.1rem;
  background: color-mix(in srgb, var(--brand-accent) 6%, white);
  color: var(--brand-accent-dark);
  font-size: 1.75rem;
  font-weight: 600;
}

.student-chat-redesign .professor-intro .eyebrow {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

.student-chat-redesign .professor-intro h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.045em;
}

.student-chat-redesign .professor-intro .section-copy {
  max-width: none;
  margin: 0.85rem 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.student-chat-redesign .has-conversation .professor-intro {
  flex-direction: row;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0 1.25rem;
  text-align: left;
}

.student-chat-redesign .has-conversation .professor-intro h1 {
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.student-chat-redesign .has-conversation .professor-intro .eyebrow {
  margin-bottom: 0.4rem;
}

.student-chat-redesign .has-conversation .professor-intro .section-copy {
  display: none;
}

.student-chat-redesign .new-conversation {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid #e4e4e7;
  border-radius: 0.75rem;
  background: #fff;
  color: #414148;
  font-size: 0.875rem;
  font-weight: 500;
}

.new-conversation > span { font-size: 1.25rem; }

.student-chat-redesign .conversation-surface {
  display: block;
  flex: 1;
  height: auto;
  min-height: 0;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.student-chat-redesign .conversation-thread {
  display: block;
  height: auto;
  overflow: visible;
}

.student-chat-redesign .conversation-exchange + .conversation-exchange {
  margin-top: 1.75rem;
  border: 0;
}

.student-chat-redesign .conversation-message {
  padding: 0;
  background: transparent;
  overflow-wrap: anywhere;
}

.student-chat-redesign .conversation-message-user {
  display: flex;
  justify-content: flex-end;
  margin: 1rem 0 1.75rem;
}

.conversation-message-user > div {
  max-width: min(85%, 38rem);
  padding: 0.8rem 1.1rem;
  border-radius: 1.35rem 1.35rem 0.4rem 1.35rem;
  background: #f1f1f3;
}

.student-chat-redesign .conversation-question {
  font-size: 1rem;
  line-height: 1.65;
}

.student-chat-redesign .conversation-message-assistant {
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.85rem;
  padding-bottom: 1.25rem;
}

.student-chat-redesign .conversation-avatar-professor {
  width: 2rem;
  height: 2rem;
  background: color-mix(in srgb, var(--brand-accent) 8%, white);
  border: 1px solid color-mix(in srgb, var(--brand-accent) 16%, white);
  color: var(--brand-accent-dark);
  font-size: 0.875rem;
}

.student-chat-redesign .answer-heading {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 2rem;
  padding: 0;
}

.student-chat-redesign .conversation-answer-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: normal;
}

.student-chat-redesign .answer-heading .status-pill {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.student-chat-redesign .status-ready { background: #f4f4f5; color: #606069; }

.student-chat-redesign .answer-text {
  margin: 0.8rem 0 1.25rem;
  padding: 0;
  font-size: 1rem;
  line-height: 1.8;
  color: #27272d;
}

.student-chat-redesign .tutor-sources {
  margin: 0.9rem 0 0;
  padding: 0;
  border: 1px solid #e7e7eb;
  border-radius: 0.85rem;
  background: #fff;
}

.tutor-sources > summary.citation-heading-row {
  display: list-item;
  margin: 0;
  padding: 0.8rem 1rem;
  color: #55555e;
  cursor: pointer;
  font-size: 0.875rem;
}

.tutor-sources > summary span:first-child { color: #34343b; font-size: 0.875rem; font-weight: 600; }
.tutor-sources > summary span:last-child { margin-left: 0.75rem; font-size: 0.8125rem; }
.tutor-sources[open] > summary { border-bottom: 1px solid #eeeef1; }
.student-chat-redesign .tutor-sources ol { padding: 1rem; }
.student-chat-redesign .tutor-sources li { padding: 0; border: 0; border-radius: 0; }
.student-chat-redesign .tutor-sources blockquote { font-size: 0.9375rem; }
.student-chat-redesign .tutor-sources .no-sources { padding: 1rem; font-size: 0.875rem; }

.student-chat-redesign .ask-form.ask-composer {
  gap: 0.65rem;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.student-chat-redesign .has-conversation .ask-composer {
  position: sticky;
  z-index: 2;
  bottom: 0;
  padding-bottom: max(0.75rem, var(--safe-area-bottom));
  box-shadow: 0 -12px 18px #ffffffeb;
}

.composer-input-surface {
  padding: 1rem;
  border: 1px solid #dcdce1;
  border-radius: 1.5rem;
  background: #fafafa;
  box-shadow: 0 3px 14px rgb(17 17 17 / 4%);
  transition: border-color 150ms, box-shadow 150ms;
}

.composer-input-surface:focus-within {
  border-color: #a5a5af;
  box-shadow: 0 3px 16px rgb(17 17 17 / 7%);
}

.student-chat-redesign .ask-composer textarea {
  display: block;
  min-height: 3rem;
  max-height: 11rem;
  margin: 0;
  padding: 0.25rem 0.25rem 0.5rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #27272d;
  font: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: none;
}

.student-chat-redesign .ask-composer textarea:focus { outline: none; }
.student-chat-redesign .ask-composer textarea::placeholder { color: #72727c; }
.student-chat-redesign .ask-actions { flex-direction: row; align-items: center; gap: 0.5rem; padding: 0; }
.student-chat-redesign .ask-actions .composer-course-hint { font-size: 0.8125rem; }
.composer-character-count { margin-left: auto; }

.student-chat-redesign .composer-send {
  width: auto;
  flex: none;
  min-height: 2.75rem;
  padding: 0.6rem 1.2rem;
  border-radius: 1rem;
  background: #26262b;
  border-color: #26262b;
  box-shadow: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.student-chat-redesign .composer-send:hover:not(:disabled) { background: var(--brand-accent-dark); box-shadow: none; }
.student-chat-redesign .composer-send:disabled { background: #e8e8ec; border-color: #e8e8ec; color: #797981; opacity: 1; }

.composer-caption { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding: 0 0.35rem; }
.composer-caption summary, .composer-keyboard-hint { color: #72727c; font-size: 0.75rem; line-height: 1.5; }
.composer-caption summary { cursor: pointer; }
.composer-keyboard-hint { flex-shrink: 0; }
.tutor-context-details .tutor-context-note { max-width: 31rem; margin-top: 0.5rem; font-size: 0.8125rem; }
.student-chat-redesign .tutor-context-overflow { margin: 0; color: #626268; font-size: 0.8125rem; line-height: 1.5; }
.tutor-context-overflow:empty { display: none; }

.tutor-suggestions { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.5rem; }
.tutor-suggestions button { min-height: 2.75rem; padding: 0.65rem 1rem; border: 1px solid #e7e7eb; border-radius: 0.85rem; background: white; color: #55555e; font: inherit; font-size: 0.875rem; }
.tutor-suggestions button:hover, .student-chat-redesign .new-conversation:hover { background: #f5f5f7; border-color: #cfcfd5; }
.student-chat-redesign :is(button, summary):focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 3px; }

.student-chat-redesign .answer-loading { display: flex; align-items: center; gap: 0.75rem; min-height: 2rem; }
.student-chat-redesign .answer-loading p { margin: 0; font-size: 0.875rem; color: #626268; }
.tutor-thinking-dots { display: flex; gap: 0.25rem; }
.tutor-thinking-dots i { width: 0.3rem; height: 0.3rem; border-radius: 50%; background: #777781; animation: tutor-pulse 1.2s ease-in-out infinite; }
.tutor-thinking-dots i:nth-child(2) { animation-delay: 0.15s; }
.tutor-thinking-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes tutor-pulse { 50% { opacity: 0.3; } }

.student-chat-redesign .ask-composer .triage-assignment { margin: 0; padding: 1rem; border: 1px solid #e7e7eb; border-radius: 1rem; box-shadow: none; }
.student-chat-redesign .ask-composer .triage-assignment h3 { font-size: 1rem; }
.student-chat-redesign .ask-composer .triage-assignment p { margin: 0.5rem 0; font-size: 0.875rem; }

@media (max-width: 680px) {
  .student-chat-redesign .ask-conversation { min-height: calc(100svh - 14rem); padding: 1.25rem max(1rem, var(--safe-area-right)) 1rem max(1rem, var(--safe-area-left)); }
  .student-chat-redesign .ask-conversation.is-empty { padding-top: 1.5rem; padding-bottom: 3rem; }
  .student-chat-redesign .professor-schrodinger { width: 4.5rem; }
  .student-chat-redesign .professor-intro .section-copy { max-width: 26rem; }
  .student-chat-redesign .has-conversation .professor-intro { align-items: start; }
  .student-chat-redesign .new-conversation { gap: 0.35rem; padding: 0.5rem; }
  .student-chat-redesign .conversation-message-assistant { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .student-chat-redesign .conversation-avatar-professor { display: none; }
  .conversation-message-user > div { max-width: 92%; }
  .composer-input-surface { padding: 0.8rem; border-radius: 1.25rem; }
  .composer-keyboard-hint { display: none; }
  .tutor-suggestions { gap: 0.5rem; margin-top: 1.25rem; }
  .tutor-suggestions button { font-size: 0.8125rem; }
  .tutor-sources > summary span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tutor-thinking-dots i { animation: none; }
  .composer-input-surface { transition: none; }
}

/* Adapt the redesign to the deployed saved-question and photo-tutor UI. */
.student-chat-redesign.workspace-main-conversation.ask-history-layout {
  display:grid; grid-template-columns:15rem minmax(0,1fr); width:100%; max-width:90rem;
  gap:1.5rem; margin:0 auto; padding:1.5rem; background:white;
}
.student-chat-redesign.ask-history-layout > .ask-conversation.ask-history-main {
  width:100%; max-width:58rem; min-height:0; margin:0 auto; padding:0 1rem; display:flex; flex-direction:column;
}
.student-chat-redesign .ask-conversation.is-empty { justify-content:center; min-height:calc(100svh - 18rem); }
.student-chat-redesign .professor-placeholder { display:grid; place-items:center; flex:none; width:3.5rem; height:3.5rem; border-radius:1.1rem; background:#faf0f3; color:var(--brand-accent-dark); font-size:1.75rem; font-weight:600; }
.student-chat-redesign .professor-intro > div:first-child { padding-bottom:0; }
.student-chat-redesign .has-conversation .professor-intro { padding-bottom:1rem; }
.student-chat-redesign .nomenclature-class { margin:0 0 .75rem; padding:0; border:0; background:transparent; }
.student-chat-redesign .nomenclature-class p { color:#72727c; font-size:.8125rem; }
.student-chat-redesign .ask-history-main > button { align-self:flex-start; margin:0 0 .65rem; padding:.5rem .75rem; border:1px solid #e7e7eb; border-radius:.65rem; background:#fff; color:#55555e; font:inherit; font-size:.8125rem; }
.student-chat-redesign .tutor-followup-policy { margin:0 0 1rem; color:#72727c; font-size:.8125rem; line-height:1.5; }
.student-chat-redesign .conversation-surface { display:grid; grid-template-rows:minmax(10rem,1fr) auto; flex:none; height:clamp(30rem,68dvh,58rem); min-height:0; overflow:hidden; }
.student-chat-redesign .conversation-surface-empty { display:block; height:auto; overflow:visible; }
.student-chat-redesign .conversation-toolbar { display:none; }
.student-chat-redesign .conversation-thread { display:block; position:relative; min-height:0; height:100%; overflow-y:auto; overflow-x:hidden; padding:0 .75rem 1rem 0; scrollbar-width:thin; }
.student-chat-redesign .conversation-thread[hidden] { display:none; }
.student-chat-redesign .has-conversation .ask-composer { position:static; padding-bottom:.5rem; box-shadow:none; max-height:70dvh; overflow-y:auto; }
.student-chat-redesign .conversation-avatar-user,.student-chat-redesign .conversation-message-user .conversation-speaker { display:none; }
.student-chat-redesign .conversation-message-user > div { min-width:0; }
.student-chat-redesign .conversation-message-user .photo-question-summary { max-width:100%; }
.student-chat-redesign .tutor-answer-body,.student-chat-redesign .tutor-answer-paragraph { color:#27272d; font-size:1rem; line-height:1.8; }
.student-chat-redesign .tutor-answer-body { padding:0; }
.student-chat-redesign .tutor-references { margin-top:1rem; border:1px solid #e7e7eb; border-radius:.85rem; background:white; }
.student-chat-redesign .tutor-references > summary { padding:.8rem 1rem; font-size:.875rem; color:#55555e; }
.student-chat-redesign .tutor-composer-tools { margin:.35rem .25rem .75rem; gap:.5rem 1.25rem; }
.student-chat-redesign .tutor-composer-tools > details > summary { font-size:.8125rem; color:#626268; }
.student-chat-redesign .ask-actions { flex-wrap:nowrap; }
.student-chat-redesign .ask-actions > span { flex:1; font-size:.8125rem; }
.student-chat-redesign .ask-actions .composer-send { flex:none; width:auto; min-width:4.5rem; margin:0; }
.student-chat-redesign .composer-caption { flex-wrap:wrap; gap:.35rem 1rem; }
.student-chat-redesign .question-price-preview { flex:1; margin:0; font-size:.75rem; line-height:1.5; color:#626268; }
.student-chat-redesign .composer-keyboard-hint { font-size:.75rem; }
.student-chat-redesign .ask-history-sidebar { align-self:start; background:#f8f8fa; border:1px solid #ededf0; border-radius:1rem; padding:1rem; box-shadow:none; }
.student-chat-redesign .ask-history-sidebar button { border-radius:.65rem; }
.student-chat-redesign .ask-history-sidebar .ask-history-question[aria-current=true] { background:#f1e6eb; }
@media(max-width:900px) {
  .student-chat-redesign.workspace-main-conversation.ask-history-layout { grid-template-columns:minmax(0,1fr); gap:1rem; padding:1rem; }
  .student-chat-redesign.ask-history-layout > .ask-conversation.ask-history-main { padding:0; }
  .student-chat-redesign .ask-conversation.is-empty { min-height:0; padding-top:1rem; }
  .student-chat-redesign .ask-history-sidebar { width:100%; position:static; }
  .student-chat-redesign .conversation-surface { height:72dvh; min-height:28rem; }
  .student-chat-redesign .conversation-surface-empty { height:auto; min-height:0; }
}
@media(max-width:680px) {
  .student-chat-redesign .conversation-thread { padding-right:.2rem; }
  .student-chat-redesign .conversation-message-assistant { grid-template-columns:minmax(0,1fr); }
  .student-chat-redesign .professor-intro h1 { font-size:1.8rem; }
  .student-chat-redesign .has-conversation .professor-intro h1 { font-size:1.2rem; }
  .student-chat-redesign .new-conversation { font-size:.8125rem; }
}

/* Keep mandatory photo review in normal page flow, outside the compact composer. */
.student-chat-redesign .conversation-surface:has(.photo-tutor-review) {
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
}
.student-chat-redesign .ask-form.ask-composer:has(.photo-tutor-review) {
  height: auto;
  max-height: none;
  overflow: visible;
}
