/* Message center: two-pane inbox, internal scrolling and a five-row notification viewport. */
.messages-page main > .band-s:first-child {
  padding-top: var(--s32);
  padding-bottom: var(--s32);
}

.messages-page main > .band-page {
  padding-top: var(--s32);
}

.message-inbox {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: clamp(480px, 54vh, 600px);
  min-height: 480px;
  padding: 0;
  overflow: hidden;
}

[data-message-center][data-has-conversations="false"] .message-inbox {
  height: 288px;
  min-height: 288px;
}

[data-message-center][data-has-direct="false"]:not([data-has-conversations="false"]) .message-inbox {
  height: 360px;
  min-height: 360px;
}

.message-inbox-sidebar,
.message-inbox-thread {
  display: grid;
  min-width: 0;
  min-height: 0;
}

.message-inbox-sidebar {
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--hair);
  background: var(--page);
}

.message-inbox-thread {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.message-inbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s16);
  padding: var(--s24);
  border-bottom: 1px solid var(--hair);
  background: var(--card);
}

.message-inbox-head > div {
  min-width: 0;
}

.message-inbox-summary {
  display: grid;
  flex: none;
  justify-items: end;
  gap: var(--s4);
}

.message-inbox-count {
  color: var(--label-2);
  font-size: 13px;
  line-height: 1.38;
  text-align: right;
}

.message-contact-trigger {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  line-height: 1.38;
  cursor: pointer;
}

.message-contact-trigger:hover {
  color: var(--deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message-contact-trigger:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.message-realtime-state {
  margin: 0;
  color: var(--err-ink);
  font-size: 12px;
  line-height: 1.38;
  text-align: right;
}

.message-sidebar-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.message-inbox-list {
  min-height: 0;
  padding: var(--s8);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.message-sidebar-scroll > .message-inbox-list {
  overflow: visible;
  scrollbar-gutter: auto;
}

.message-inbox-list:empty {
  display: none;
}

.message-inbox-state {
  min-height: 0;
  padding: 0 var(--s16) var(--s12);
}

.message-inbox-state:empty {
  display: none;
}

.message-contact-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: var(--s12);
  width: 100%;
  min-height: 64px;
  padding: var(--s12);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--label);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.message-contact-row + .message-contact-row {
  margin-top: var(--s4);
}

.message-contact-row:hover {
  background: rgba(255, 255, 255, .72);
}

.message-contact-row[aria-current="true"] {
  background: var(--card);
  box-shadow: 0 0 0 1px var(--hair);
}

.message-contact-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--brand-0);
  color: var(--deep);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

.message-contact-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-contact-copy,
.message-contact-heading {
  display: flex;
  min-width: 0;
}

.message-contact-copy {
  flex-direction: column;
  gap: var(--s4);
}

.message-contact-heading {
  align-items: center;
  justify-content: space-between;
  gap: var(--s8);
}

.message-contact-heading strong {
  overflow: hidden;
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-contact-time {
  flex: none;
  color: var(--label-3);
  font-size: 12px;
  line-height: 1.38;
}

.message-contact-secondary {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--s8);
}

.message-contact-preview {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--label-2);
  font-size: 15px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-contact-unread {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--s4);
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}

.message-project-section {
  margin: var(--s8);
  padding: var(--s16) var(--s8) var(--s8);
  border-top: 1px solid var(--hair);
}

.message-section-label {
  margin: 0 0 var(--s8);
  padding: 0 var(--s4);
  color: var(--label-2);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.38;
}

.message-project-list {
  display: grid;
  gap: var(--s4);
}

.message-project-row {
  display: grid;
  gap: var(--s4);
  min-height: 56px;
  padding: var(--s12);
  border-radius: var(--r-sm);
  color: var(--label);
  text-decoration: none;
}

.message-project-row:hover {
  background: rgba(255, 255, 255, .72);
}

.message-project-row:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.message-project-row strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-project-row span {
  color: var(--label-2);
  font-size: 12px;
  line-height: 1.38;
}

.message-project-open {
  flex: none;
  color: var(--brand);
  font-size: 13px;
  line-height: 1.38;
  text-decoration: none;
}

.message-project-open:hover {
  color: var(--deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.message-thread-head {
  align-items: center;
}

.message-thread-scroll {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: var(--s8);
  padding: var(--s24);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.message-thread-scroll .review-thread {
  flex: 1;
}

.message-thread-entry {
  display: flex;
  max-width: min(74%, 640px);
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s4);
}

.message-thread-entry.self {
  align-self: flex-end;
  align-items: flex-end;
}

.message-thread-entry .review-bubble {
  width: auto;
  max-width: 100%;
  padding: var(--s12) var(--s16);
  border-radius: var(--r-md);
}

.message-thread-entry.self .review-bubble {
  background: var(--brand-0);
}

.message-thread-entry .review-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}

.message-thread-time {
  padding: 0 var(--s4);
  color: var(--label-3);
  font-size: 12px;
  line-height: 1.38;
}

.message-thread-author {
  padding: 0 var(--s4);
  color: var(--label-2);
  font-size: 12px;
  line-height: 1.38;
}

.message-delivery {
  display: inline-flex;
  align-items: center;
  gap: var(--s4);
  min-height: 20px;
  padding: 0 var(--s4);
  color: var(--label-3);
  font-size: 12px;
  line-height: 1.38;
}

.message-delivery[data-state="pending"],
.message-delivery[data-state="retrying"] {
  color: var(--label-2);
}

.message-delivery[data-state="failed"] {
  color: var(--err-ink);
}

.message-delivery button {
  min-height: 28px;
  padding: 0 var(--s4);
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.message-delivery button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.message-thread-entry.is-pending .review-bubble {
  opacity: .72;
}

.message-thread-entry.is-failed .review-bubble {
  box-shadow: inset 0 0 0 1px rgba(255, 59, 48, .3);
}

.message-inbox .message-composer {
  margin: 0;
  padding: var(--s16) var(--s24) var(--s24);
  border-top: 1px solid var(--hair);
  background: var(--card);
}

.notification-list {
  display: grid;
  max-height: 392px;
  gap: var(--s8);
  padding: 0 var(--s4) 0 0;
  overflow-y: auto;
}

.notice-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  align-items: start;
  gap: var(--s24);
}

.notice-heading {
  align-items: flex-start;
}

.notice-actions {
  display: flex;
  align-items: center;
  gap: var(--s12);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.notice-lead {
  margin: var(--s8) 0 var(--s16);
}

.notice-inbox .notification-list {
  margin-top: 0;
}

.notice-feedback {
  margin: 0;
}

.notice-feedback-form {
  display: grid;
  gap: var(--s16);
  margin-top: var(--s24);
}

.notice-feedback-form .actions {
  margin: 0;
}

.feedback-history {
  display: grid;
  gap: var(--s12);
  margin-top: var(--s24);
  padding-top: var(--s24);
  border-top: 1px solid var(--hair);
}

.feedback-history-head,
.feedback-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s12);
}

.feedback-history-head h3 {
  margin: 0;
}

.feedback-history-list {
  display: grid;
  gap: var(--s8);
}

.feedback-history-row {
  display: grid;
  gap: var(--s8);
  min-width: 0;
  padding: var(--s12) 0;
  border-bottom: 1px solid var(--hair);
}

.feedback-history-row:last-child {
  border-bottom: 0;
}

.feedback-history-title strong {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
}

.feedback-history-status {
  flex: none;
  color: var(--brand);
  font-size: 12px;
  line-height: 1.38;
}

.feedback-history-meta {
  color: var(--label-2);
  font-size: 12px;
  line-height: 1.38;
}

.feedback-history-reply {
  margin: 0;
  padding-left: var(--s12);
  border-left: 2px solid var(--brand-1);
  color: var(--label);
  font-size: 15px;
  line-height: 1.47;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .notice-page-grid {
    grid-template-columns: 1fr;
  }
}

.notification-center > .row {
  justify-content: space-between;
}

.notification-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  align-items: center;
  gap: var(--s16);
  width: 100%;
  height: 72px;
  min-height: 72px;
  padding: var(--s12) var(--s16);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--label);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.notification-row:hover {
  border-color: var(--brand-1);
  background: var(--page);
}

.notification-marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
}

.notification-row.is-unread .notification-marker {
  background: var(--brand);
}

.notification-copy {
  display: grid;
  min-width: 0;
  gap: var(--s4);
}

.notification-copy strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.notification-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4) var(--s12);
  color: var(--label-2);
  font-size: 12px;
  line-height: 1.38;
}

.feedback-support-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--s24);
  border-block: 1px solid var(--hair);
}

.feedback-support-facts > div {
  min-width: 0;
  padding: var(--s16) var(--s24);
}

.feedback-support-facts > div + div {
  border-left: 1px solid var(--hair);
}

.feedback-support-facts span,
.feedback-support-facts strong,
.feedback-support-facts p {
  display: block;
}

.feedback-support-facts span {
  color: var(--label-2);
  font-size: 13px;
  line-height: 1.38;
}

.feedback-support-facts strong {
  margin-top: var(--s4);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}

.feedback-support-facts p {
  margin-top: var(--s4);
  color: var(--label-2);
  font-size: 15px;
  line-height: 1.4;
  text-wrap: pretty;
}

.feedback-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr);
  align-items: start;
  gap: var(--s32);
  margin-top: var(--s24);
}

.feedback-workspace > .message-support-form {
  min-width: 0;
  margin-top: 0;
}

.feedback-workspace > .message-support-form + .message-support-form {
  padding-left: var(--s32);
  border-left: 1px solid var(--hair);
}

.message-quick-replies {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s8);
}

.message-quick-replies button {
  flex: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 calc(var(--s8) + var(--s4));
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--label-2);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.message-quick-replies button:hover {
  border-color: var(--brand-1);
  color: var(--brand);
}

.message-composer .searchbar {
  height: auto;
  min-height: 52px;
  padding: 8px var(--s16);
  border-radius: var(--r-md);
}

.message-composer .searchbar textarea {
  width: 100%;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--label);
  font: inherit;
  font-size: 15px;
  line-height: 1.47;
  resize: vertical;
}

.message-contact-dialog {
  width: min(560px, calc(100vw - 32px));
}

.message-contact-search {
  height: 44px;
  margin-top: 0;
}

.message-contact-results {
  display: grid;
  max-height: min(360px, 46vh);
  gap: var(--s4);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.message-contact-results:empty {
  display: none;
}

.message-contact-result {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s12);
  width: 100%;
  min-height: 64px;
  padding: var(--s12);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--label);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.message-contact-result:hover {
  background: var(--page);
}

.message-contact-result:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.message-contact-result-copy {
  display: grid;
  min-width: 0;
  gap: var(--s4);
}

.message-contact-result-copy strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-contact-result-copy span,
.message-contact-result-action {
  color: var(--label-2);
  font-size: 12px;
  line-height: 1.38;
}

.message-contact-result-action {
  color: var(--brand);
  font-weight: 500;
}

.message-contact-empty {
  margin: 0;
  padding: var(--s24);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--label-2);
  font-size: 15px;
  line-height: 1.47;
  text-align: center;
}

.message-support {
  margin-top: var(--s24);
}

.message-support-form {
  margin-top: var(--s24);
}

.message-support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s16);
}

.message-support-form .auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--s8);
  margin-top: var(--s16);
  color: var(--label-2);
  font-size: 13px;
}

.message-support-form .auth-field select,
.message-support-form .auth-field input,
.message-support-form .auth-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--label);
  font: inherit;
  font-size: 15px;
}

.message-support-form .auth-field textarea {
  resize: vertical;
}

.message-support-form .auth-field select:focus,
.message-support-form .auth-field input:focus,
.message-support-form .auth-field textarea:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: 0 0 0 4px var(--brand-0);
}

.message-support-form .actions {
  display: flex;
  gap: var(--s8);
  flex-wrap: wrap;
  margin-top: var(--s24);
}

.message-tutor-answer {
  margin-top: var(--s24);
  padding: var(--s16);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  background: var(--brand-0);
  color: var(--label);
  font-size: 15px;
  line-height: 1.47;
  white-space: pre-wrap;
}

.message-tutor-answer:empty {
  display: none;
}

@media (max-width: 900px) {
  .feedback-workspace {
    grid-template-columns: 1fr;
    gap: var(--s24);
  }

  .feedback-workspace > .message-support-form + .message-support-form {
    padding-top: var(--s24);
    padding-left: 0;
    border-top: 1px solid var(--hair);
    border-left: 0;
  }
}

@media (max-width: 600px) {
  .messages-page main > .band-s:first-child {
    padding-top: var(--s32);
    padding-bottom: var(--s24);
  }

  .messages-page main > .band-page {
    padding-top: var(--s24);
  }

  .message-inbox {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .message-inbox-sidebar {
    height: 320px;
    border-right: 0;
    border-bottom: 1px solid var(--hair);
  }

  .message-inbox-thread {
    height: 560px;
  }

  [data-message-center][data-has-conversations="false"] .message-inbox-sidebar {
    height: 208px;
  }

  [data-message-center][data-has-conversations="false"] .message-inbox-thread {
    height: 240px;
  }

  .message-inbox-head,
  .message-thread-scroll,
  .message-inbox .message-composer {
    padding-right: var(--s16);
    padding-left: var(--s16);
  }

  .feedback-support-facts {
    grid-template-columns: 1fr;
  }

  .notification-row {
    height: auto;
  }

  .notification-copy strong {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
  }

  .feedback-support-facts > div + div {
    border-top: 1px solid var(--hair);
    border-left: 0;
  }

  .message-support-grid {
    grid-template-columns: 1fr;
  }

  .message-composer .searchbar textarea::placeholder {
    font-size: 13px;
    line-height: 1.38;
  }

  .message-support-form .actions .btn,
  .message-support-form .actions .btn-ghost {
    width: 100%;
  }
}
