.chat-pro-page {
  --chat-border: rgba(45, 57, 54, 0.14);
  --chat-soft-green: #eef6f1;
  --chat-deep-green: #276c5d;
  --chat-warm: #fbf5ee;
  --chat-coral: #a94f61;
  color: #29222c;
}

/* Chat readability v5: compact history without tiny type or fragile controls. */
.chat-pro-page,
.chat-pro-page button,
.chat-pro-page input,
.chat-pro-page textarea {
  font-family: var(--font-body);
  letter-spacing: 0;
}

.chat-pro-hero h1 {
  font-size: 2.35rem;
  line-height: 1.12;
}

.chat-room-button {
  min-height: 66px;
}

.chat-room-button strong {
  font-size: 0.98rem;
  line-height: 1.28;
}

.chat-room-button small {
  font-size: 0.84rem;
  line-height: 1.35;
}

.chat-contact-search {
  min-height: 44px;
}

.chat-contact-search input {
  font-size: 0.95rem;
}

.chat-contact-button {
  min-height: 58px;
  padding: 7px 8px;
}

.chat-contact-copy strong {
  font-size: 0.94rem;
}

.chat-contact-copy small {
  color: #685f66;
  font-size: 0.8rem;
  line-height: 1.35;
}

.chat-pro-feed .chat-message-copy {
  font-size: 1rem;
  line-height: 1.52;
}

.chat-pro-feed .chat-message time,
.chat-reply-bar small,
.chat-draft-status,
.chat-character-count {
  font-size: 0.8rem;
}

.chat-pro-feed .chat-message button,
.chat-pro-feed .chat-message summary,
.chat-context-toggle,
.chat-emoji-toggle {
  min-height: 42px;
  font-size: 0.88rem;
}

.chat-composer-field textarea {
  font-size: 1rem;
  line-height: 1.5;
}

.chat-room-button:focus-visible,
.chat-contact-button:focus-visible,
.chat-pro-feed button:focus-visible,
.chat-pro-composer button:focus-visible,
.chat-pro-page input:focus-visible,
.chat-pro-page textarea:focus-visible {
  outline: 3px solid rgba(184, 135, 56, 0.62);
  outline-offset: 2px;
}

@media (max-width: 620px) {
  .chat-pro-hero h1 {
    font-size: 2rem;
  }

  .chat-room-button {
    min-height: 64px;
  }

  .chat-room-button strong {
    font-size: 0.9rem;
  }

  .chat-room-button small {
    font-size: 0.78rem;
  }

  .chat-contact-list {
    grid-template-columns: 1fr;
  }
}

.chat-pro-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-pro-hero .chat-page-hero-grid {
  align-items: center;
  padding-top: clamp(34px, 5vw, 58px);
  padding-bottom: clamp(30px, 4vw, 48px);
}

.chat-pro-hero h1 {
  max-width: 780px;
  font-size: clamp(2rem, 4.2vw, 3.65rem);
  line-height: 1.08;
}

.chat-pro-section {
  padding: 24px 0 52px;
}

.chat-pro-layout {
  display: grid;
  grid-template-columns: minmax(205px, 238px) minmax(520px, 1fr) minmax(260px, 310px);
  gap: 16px;
  width: min(1500px, calc(100% - 32px));
  align-items: start;
}

.chat-room-panel,
.chat-pro-shell,
.chat-care-card {
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(35, 30, 38, 0.07);
}

.chat-room-panel,
.chat-context-panel {
  position: sticky;
  top: 86px;
}

.chat-room-panel {
  overflow: hidden;
}

.chat-room-panel-head {
  padding: 18px 16px 13px;
  border-bottom: 1px solid var(--chat-border);
  background: #fffdfb;
}

.chat-room-panel-head h2,
.chat-care-card h2 {
  margin: 2px 0 0;
  color: #3a203d;
  font-size: 1.16rem;
  line-height: 1.25;
}

.chat-room-list {
  display: grid;
  padding: 8px;
}

.chat-room-button {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  width: 100%;
  padding: 10px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #3e3840;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.chat-room-button:hover {
  background: #f7f3ef;
}

.chat-room-button.is-active {
  border-color: rgba(39, 108, 93, 0.2);
  background: var(--chat-soft-green);
}

.chat-room-button > span:nth-child(2) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.chat-room-button strong,
.chat-room-button small {
  overflow-wrap: anywhere;
}

.chat-room-button strong {
  font-size: 0.94rem;
}

.chat-room-button small {
  color: #726a71;
  font-size: 0.78rem;
  line-height: 1.25;
}

.chat-room-mark,
.chat-presence-dot {
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #4a8d7c;
  box-shadow: 0 0 0 4px rgba(74, 141, 124, 0.12);
}

.chat-room-mark.is-voice {
  background: #b88738;
  box-shadow: 0 0 0 4px rgba(184, 135, 56, 0.13);
}

.chat-room-mark.is-support {
  background: #ac5665;
  box-shadow: 0 0 0 4px rgba(172, 86, 101, 0.12);
}

.chat-room-unread {
  min-width: 24px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--chat-coral);
  text-align: center;
  font-size: 0.75rem;
  font-weight: 850;
}

.chat-room-presence {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 13px 16px;
  border-top: 1px solid var(--chat-border);
  color: #665e64;
  background: #fffdfb;
  font-size: 0.82rem;
  line-height: 1.35;
}

.chat-presence-dot {
  width: 8px;
  flex: 0 0 auto;
}

.chat-pro-shell {
  min-width: 0;
  overflow: hidden;
}

.chat-pro-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  min-height: 92px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--chat-border);
  background: #fffdfb;
}

.chat-pro-title {
  min-width: 0;
}

.chat-pro-title h2 {
  margin: 1px 0 3px;
  color: #342739;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.2;
}

.chat-pro-title > p:last-child {
  margin: 0;
  color: #756c73;
  font-size: 0.88rem;
}

.chat-pro-head-tools {
  display: flex;
  gap: 9px;
  align-items: center;
}

.chat-search {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 42px;
  width: min(230px, 25vw);
  padding: 0 10px;
  border: 1px solid rgba(45, 57, 54, 0.16);
  border-radius: 7px;
  color: #6f676e;
  background: #fff;
}

.chat-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: #302a31;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
}

.chat-pro-head .chat-status {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--chat-deep-green);
  white-space: nowrap;
}

.chat-feed-wrap {
  position: relative;
  background:
    linear-gradient(rgba(250, 248, 245, 0.93), rgba(244, 248, 245, 0.94)),
    url("../assets/stage_bg_2.png") center / cover;
}

.chat-pro-feed.chat-messages {
  display: block;
  height: min(61svh, 650px);
  min-height: 480px;
  margin: 0;
  padding: 18px clamp(12px, 2.5vw, 26px) 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.chat-pro-feed .chat-date-separator,
.chat-pro-feed .chat-unread-separator {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 18px 0 12px;
  color: #776e74;
  font-size: 0.78rem;
  font-weight: 800;
}

.chat-pro-feed .chat-date-separator::before,
.chat-pro-feed .chat-date-separator::after,
.chat-pro-feed .chat-unread-separator::before,
.chat-pro-feed .chat-unread-separator::after {
  content: "";
  height: 1px;
  flex: 1;
  background: rgba(45, 57, 54, 0.12);
}

.chat-pro-feed .chat-unread-separator {
  color: var(--chat-coral);
}

.chat-pro-feed .chat-message {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 11px;
  margin: 0 0 10px;
  padding: 13px 14px;
  border: 1px solid rgba(45, 57, 54, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(34, 38, 37, 0.045);
  scroll-margin-top: 20px;
}

.chat-pro-feed .chat-message.is-guide {
  border-left: 4px solid #b88738;
  background: rgba(255, 252, 246, 0.98);
}

.chat-pro-feed .chat-message.is-unread-anchor {
  border-color: rgba(169, 79, 97, 0.42);
}

.chat-pro-feed .chat-avatar-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.92) 0 11%, transparent 12%),
    var(--avatar-color, #b88738);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--avatar-color, #b88738), transparent 78%);
  font-size: 0.92rem;
  font-weight: 900;
  cursor: pointer;
}

.chat-pro-feed .chat-message-body,
.chat-pro-feed .chat-message-head,
.chat-pro-feed .chat-message-author,
.chat-pro-feed .chat-message-foot,
.chat-pro-feed .chat-reactions,
.chat-pro-feed .chat-message-actions {
  min-width: 0;
}

.chat-pro-feed .chat-message-body {
  display: grid;
  gap: 8px;
}

.chat-pro-feed .chat-message-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.chat-pro-feed .chat-message-author {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chat-pro-feed .chat-author-button {
  min-height: 32px;
  padding: 0;
  border: 0;
  color: #352b36;
  background: transparent;
  text-align: left;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.chat-pro-feed .chat-message time {
  flex: 0 0 auto;
  padding-top: 7px;
  color: #80777e;
  font-size: 0.78rem;
}

.chat-pro-feed .chat-role {
  border-radius: 999px;
}

.chat-pro-feed .chat-message-copy {
  margin: 0;
  color: #342e35;
  font-size: 1rem;
  line-height: 1.58;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-pro-feed .chat-reply-reference {
  display: block;
  padding: 7px 10px;
  border-left: 3px solid #6d9c8f;
  color: #625a61;
  background: var(--chat-soft-green);
  font-size: 0.82rem;
  line-height: 1.4;
}

.chat-pro-feed .chat-message-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.chat-pro-feed .chat-reactions,
.chat-pro-feed .chat-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chat-pro-feed .chat-message button,
.chat-pro-feed .chat-message summary {
  min-height: 40px;
  border: 1px solid rgba(45, 57, 54, 0.14);
  border-radius: 7px;
  color: #514951;
  background: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.chat-pro-feed .chat-reaction-button {
  padding: 8px 10px;
}

.chat-pro-feed .chat-reaction-button[aria-pressed="true"] {
  color: #fff;
  border-color: var(--chat-deep-green);
  background: var(--chat-deep-green);
}

.chat-pro-feed details {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-pro-feed summary {
  display: grid;
  place-items: center;
  min-width: 42px;
  padding: 0 9px;
  list-style: none;
}

.chat-pro-feed summary::-webkit-details-marker {
  display: none;
}

.chat-pro-feed .chat-details-menu {
  position: absolute;
  z-index: 8;
  right: 0;
  bottom: calc(100% + 6px);
  display: grid;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(37, 29, 39, 0.16);
}

.chat-pro-feed .chat-details-menu button {
  width: 100%;
  padding: 8px 10px;
  border-color: transparent;
  text-align: left;
}

.chat-pro-feed .chat-details-menu button:hover {
  background: #f5f1ed;
}

.chat-new-messages {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 14px;
  min-height: 42px;
  padding: 8px 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(39, 108, 93, 0.28);
  border-radius: 999px;
  color: #fff;
  background: var(--chat-deep-green);
  box-shadow: 0 8px 22px rgba(35, 74, 65, 0.2);
  font-weight: 850;
  cursor: pointer;
}

.chat-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  padding: 30px;
  color: #6d656b;
  text-align: center;
  pointer-events: none;
}

.chat-empty[hidden],
.chat-reply-bar[hidden],
.chat-new-messages[hidden] {
  display: none;
}

.chat-pro-head .chat-status.is-error {
  background: #9f4b5a;
}

.chat-empty strong {
  color: #3f3640;
  font-size: 1.12rem;
}

.chat-reply-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--chat-border);
  border-left: 4px solid #6d9c8f;
  background: var(--chat-soft-green);
}

.chat-reply-bar > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.chat-reply-bar span,
.chat-reply-bar small {
  color: #6c646a;
  font-size: 0.78rem;
}

.chat-reply-bar small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-reply-bar button,
.chat-dialog-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--chat-border);
  border-radius: 50%;
  color: #544c53;
  background: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.chat-pro-composer.chat-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 14px 16px 8px;
  border-top: 1px solid var(--chat-border);
  background: #fffdfb;
}

.chat-composer-field {
  position: relative;
  display: block;
}

.chat-composer-field textarea {
  display: block;
  width: 100%;
  min-height: 58px;
  max-height: 150px;
  resize: vertical;
  padding: 13px 70px 13px 14px;
  border: 1px solid rgba(45, 57, 54, 0.2);
  border-radius: 8px;
  outline: 0;
  color: #302a31;
  background: #fff;
  font: inherit;
  font-size: 1rem;
  line-height: 1.45;
}

.chat-composer-field textarea:focus,
.chat-search:focus-within {
  border-color: #4f8c7c;
  box-shadow: 0 0 0 3px rgba(79, 140, 124, 0.13);
}

.chat-character-count {
  position: absolute;
  right: 10px;
  bottom: 8px;
  color: #81787f;
  font-size: 0.72rem;
}

.chat-send-button {
  min-height: 48px;
  padding-inline: 18px;
}

.chat-draft-status {
  min-height: 20px;
  margin: 0;
  padding: 0 16px 9px;
  color: #777077;
  background: #fffdfb;
  font-size: 0.76rem;
}

.chat-context-panel {
  display: grid;
  gap: 14px;
}

.chat-context-panel .communication-mission-panel {
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(35, 30, 38, 0.07);
}

.chat-context-panel .communication-mission-head {
  display: grid;
}

.chat-context-panel .communication-score-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chat-care-card {
  padding: 18px;
}

.chat-care-card ul {
  display: grid;
  gap: 9px;
  margin: 13px 0 0;
  padding-left: 19px;
  color: #6f676d;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-profile-dialog {
  position: fixed;
  width: min(430px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  color: #302a31;
  background: #fff;
  box-shadow: 0 30px 80px rgba(30, 24, 32, 0.28);
}

.chat-profile-dialog::backdrop {
  background: rgba(26, 20, 28, 0.58);
}

.chat-dialog-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
}

.chat-profile-card {
  display: grid;
  gap: 14px;
  padding: 26px;
}

.chat-profile-card-head {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding-right: 42px;
}

.chat-profile-avatar {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  color: #fff;
  background: var(--avatar-color, #b88738);
  font-size: 1.15rem;
  font-weight: 900;
}

.chat-profile-card h2 {
  margin: 0 0 4px;
  color: #392b3b;
  font-size: 1.35rem;
}

.chat-profile-card p {
  margin: 0;
  color: #6d656b;
  line-height: 1.5;
}

.chat-profile-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.chat-profile-meta span {
  display: grid;
  gap: 3px;
  padding: 10px;
  border-radius: 7px;
  background: #f5f2ef;
  color: #746b72;
  font-size: 0.78rem;
}

.chat-profile-meta strong {
  color: #3e3540;
  font-size: 0.95rem;
}

@media (max-width: 1180px) {
  .chat-pro-layout {
    grid-template-columns: 210px minmax(480px, 1fr);
  }

  .chat-context-panel {
    position: static;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  }
}

@media (max-width: 860px) {
  .chat-pro-layout {
    grid-template-columns: 1fr;
    width: min(100% - 20px, 760px);
  }

  .chat-room-panel,
  .chat-context-panel {
    position: static;
  }

  .chat-room-panel-head,
  .chat-room-presence {
    display: none;
  }

  .chat-room-list {
    grid-template-columns: repeat(3, minmax(158px, 1fr));
    gap: 7px;
    overflow-x: auto;
  }

  .chat-room-button {
    min-width: 158px;
  }

  .chat-context-panel {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .chat-pro-feed.chat-messages {
    height: min(60svh, 620px);
    min-height: 430px;
  }
}

@media (max-width: 620px) {
  .chat-contact-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  .chat-contact-button {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .chat-pro-hero .chat-page-hero-grid {
    gap: 18px;
  }

  .chat-pro-head {
    display: grid;
    gap: 12px;
  }

  .chat-pro-head-tools,
  .chat-search {
    width: 100%;
  }

  .chat-search {
    flex: 1;
  }

  .chat-pro-head .chat-status {
    font-size: 0.74rem;
  }

  .chat-room-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chat-room-button {
    grid-template-columns: 10px minmax(0, 1fr);
    min-width: 0;
    min-height: 70px;
    gap: 7px;
    padding: 8px 6px;
  }

  .chat-room-button strong {
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .chat-room-button small {
    font-size: 0.68rem;
  }

  .chat-room-button .chat-room-unread {
    display: none;
  }

  .chat-pro-feed.chat-messages {
    height: min(57svh, 540px);
    min-height: 400px;
    padding-inline: 9px;
  }

  .chat-pro-feed .chat-message {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 11px 10px;
  }

  .chat-pro-feed .chat-avatar-button {
    width: 40px;
    height: 40px;
  }

  .chat-pro-feed .chat-message-foot {
    display: grid;
  }

  .chat-pro-composer.chat-form {
    grid-template-columns: 1fr;
  }

  .chat-send-button {
    width: 100%;
  }

  .chat-profile-card {
    padding: 22px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-pro-feed.chat-messages {
    scroll-behavior: auto;
  }
}

/* Chat atmosphere v3: calm messenger layout with clear private conversations. */
.chat-pro-page {
  min-height: calc(100svh - 64px);
  background: #f2eef2;
}

.chat-pro-hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(102deg, rgba(19, 28, 31, 0.95), rgba(42, 69, 65, 0.83) 48%, rgba(91, 44, 63, 0.84)),
    url("../assets/stage_bg_3.png") center 43% / cover;
}

.chat-pro-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: rgba(232, 194, 117, 0.48);
}

.chat-pro-hero .section-inner {
  position: relative;
  z-index: 1;
}

.chat-pro-hero p {
  font-size: 1.02rem;
  line-height: 1.65;
}

.chat-pro-section {
  background:
    linear-gradient(180deg, rgba(249, 246, 243, 0.96), rgba(241, 237, 242, 0.98)),
    #f2eef2;
}

.chat-room-panel,
.chat-pro-shell,
.chat-care-card,
.chat-private-context {
  border-color: rgba(53, 54, 51, 0.15);
  background: rgba(255, 253, 251, 0.97);
  box-shadow: 0 18px 44px rgba(48, 34, 48, 0.09);
}

.chat-room-panel-head {
  background:
    linear-gradient(135deg, rgba(248, 239, 232, 0.92), rgba(237, 246, 242, 0.92)),
    #fff;
}

.chat-sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 10px 10px 2px;
  padding: 4px;
  border: 1px solid rgba(53, 54, 51, 0.1);
  border-radius: 7px;
  background: #f3efed;
}

.chat-sidebar-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 5px;
  color: #675f65;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

.chat-sidebar-tabs button.is-active {
  color: #3a2939;
  background: #fff;
  box-shadow: 0 3px 12px rgba(43, 34, 43, 0.08);
}

.chat-sidebar-tabs button:focus-visible,
.chat-room-button:focus-visible,
.chat-contact-button:focus-visible,
.chat-emoji-toggle:focus-visible,
.chat-emoji-grid button:focus-visible,
.chat-pro-feed button:focus-visible,
.chat-send-button:focus-visible {
  outline: 3px solid rgba(40, 124, 104, 0.32);
  outline-offset: 2px;
}

.chat-room-list {
  gap: 2px;
}

.chat-room-button {
  min-height: 68px;
  border-radius: 7px;
}

.chat-room-button.is-active {
  border-color: rgba(47, 116, 98, 0.24);
  background:
    linear-gradient(110deg, rgba(232, 246, 239, 0.94), rgba(250, 245, 238, 0.82)),
    #eef6f1;
  box-shadow: inset 3px 0 #3b8975;
}

.chat-private-panel {
  padding: 9px 8px 8px;
}

.chat-contact-search {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 42px;
  margin: 0 2px 8px;
  padding: 0 10px;
  border: 1px solid rgba(53, 54, 51, 0.16);
  border-radius: 7px;
  color: #716970;
  background: #fff;
}

.chat-contact-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: #352e35;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
}

.chat-contact-list {
  display: grid;
  gap: 3px;
  max-height: 390px;
  overflow: auto;
  scrollbar-width: thin;
}

.chat-contact-button {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 59px;
  width: 100%;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #3f373f;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.chat-contact-button:hover,
.chat-contact-button.is-active {
  border-color: rgba(169, 79, 97, 0.16);
  background: #fbf1f3;
}

.chat-contact-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.86) 0 10%, transparent 11%),
    var(--avatar-color, #b88738);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--avatar-color, #b88738), transparent 80%);
  font-size: 0.84rem;
  font-weight: 900;
}

.chat-contact-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.chat-contact-copy strong,
.chat-contact-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-contact-copy strong {
  font-size: 0.9rem;
}

.chat-contact-copy small {
  color: #746c72;
  font-size: 0.73rem;
}

.chat-contact-history {
  color: #3b8975;
  font-size: 1.3rem;
}

.chat-contact-loading {
  margin: 0;
  padding: 18px 10px;
  color: #746c72;
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: center;
}

.chat-pro-head {
  min-height: 98px;
  background:
    linear-gradient(105deg, rgba(255, 253, 251, 0.98), rgba(242, 248, 245, 0.95)),
    #fff;
}

.chat-room-identity {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.chat-room-symbol {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(184, 135, 56, 0.28);
  border-radius: 50%;
  color: #9f6f24;
  background: #fff8e9;
  box-shadow: 0 0 0 5px rgba(184, 135, 56, 0.08);
  font-family: Georgia, serif;
  font-size: 1.35rem;
}

.chat-room-symbol.is-private {
  color: #9e465b;
  border-color: rgba(169, 79, 97, 0.28);
  background: #fff2f5;
  box-shadow: 0 0 0 5px rgba(169, 79, 97, 0.07);
}

.chat-pro-title > p:last-child {
  font-size: 0.9rem;
  line-height: 1.42;
}

.chat-feed-wrap {
  background:
    linear-gradient(rgba(247, 245, 241, 0.91), rgba(238, 244, 241, 0.94)),
    url("../assets/stage_bg_1.png") center / cover;
}

.chat-pro-feed.chat-messages {
  padding-top: 22px;
  scrollbar-color: rgba(61, 113, 98, 0.36) transparent;
}

.chat-pro-feed .chat-message {
  width: min(92%, 780px);
  margin-right: auto;
  margin-bottom: 12px;
  border-color: rgba(54, 60, 57, 0.11);
  background: rgba(255, 254, 252, 0.97);
  box-shadow: 0 8px 22px rgba(40, 39, 37, 0.055);
}

.chat-pro-feed .chat-message:hover,
.chat-pro-feed .chat-message:focus-within {
  border-color: rgba(59, 137, 117, 0.24);
  box-shadow: 0 11px 28px rgba(40, 69, 61, 0.09);
}

.chat-pro-feed .chat-message.is-guide {
  border-left-color: #c38a2e;
  background: rgba(255, 251, 242, 0.98);
}

.chat-pro-feed .chat-message.is-own {
  grid-template-columns: minmax(0, 1fr) 46px;
  width: min(86%, 720px);
  margin-right: 0;
  margin-left: auto;
  border-color: rgba(44, 121, 100, 0.18);
  background:
    linear-gradient(135deg, rgba(235, 247, 241, 0.98), rgba(247, 249, 243, 0.98)),
    #eef7f2;
}

.chat-pro-feed .chat-message.is-own .chat-avatar-button {
  grid-column: 2;
  grid-row: 1;
}

.chat-pro-feed .chat-message.is-own .chat-message-body {
  grid-column: 1;
  grid-row: 1;
}

.chat-pro-feed .chat-message-copy {
  color: #332e33;
  font-size: 1.025rem;
  line-height: 1.63;
}

.chat-pro-feed .chat-reply-reference {
  border-left-color: #548d7d;
  border-radius: 0 6px 6px 0;
  background: rgba(228, 242, 235, 0.78);
}

.chat-pro-feed .chat-message button,
.chat-pro-feed .chat-message summary {
  min-height: 42px;
}

.chat-pro-feed .chat-reaction-button {
  color: #554d53;
  background: rgba(255, 255, 255, 0.78);
}

.chat-pro-feed .chat-reaction-button[aria-pressed="true"] {
  border-color: #337a66;
  background: #337a66;
}

.chat-pro-feed .chat-message-actions > button,
.chat-pro-feed .chat-message-actions summary {
  color: #675e65;
  background: rgba(255, 255, 255, 0.62);
}

.chat-pro-composer.chat-form {
  position: relative;
  gap: 11px;
  padding-top: 13px;
  background:
    linear-gradient(105deg, rgba(255, 253, 251, 0.99), rgba(243, 248, 245, 0.98)),
    #fff;
}

.chat-composer-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  align-items: end;
  min-width: 0;
}

.chat-emoji-wrap {
  position: relative;
}

.chat-emoji-toggle {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(53, 54, 51, 0.17);
  border-radius: 8px;
  color: #8c5f2f;
  background: #fff8ed;
  font-size: 1.35rem;
  cursor: pointer;
}

.chat-emoji-toggle[aria-expanded="true"] {
  border-color: rgba(184, 135, 56, 0.42);
  background: #fff1d9;
}

.chat-emoji-picker {
  position: absolute;
  z-index: 30;
  left: 0;
  bottom: calc(100% + 12px);
  width: min(344px, calc(100vw - 40px));
  max-height: min(480px, 68svh);
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(53, 54, 51, 0.17);
  border-radius: 8px;
  color: #3b343b;
  background: #fffdfb;
  box-shadow: 0 22px 54px rgba(38, 29, 39, 0.22);
}

.chat-emoji-picker[hidden],
.chat-private-panel[hidden],
.chat-private-context[hidden],
[data-chat-sidebar-panel][hidden],
[data-chat-recent-section][hidden] {
  display: none;
}

.chat-emoji-picker > header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 0 2px 9px;
  border-bottom: 1px solid rgba(53, 54, 51, 0.1);
}

.chat-emoji-picker > header strong {
  font-size: 0.95rem;
}

.chat-emoji-picker > header button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #665d64;
  background: #f4efec;
  font-size: 1.25rem;
  cursor: pointer;
}

.chat-emoji-section {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.chat-emoji-section > span {
  color: #756b72;
  font-size: 0.75rem;
  font-weight: 850;
}

.chat-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
}

.chat-emoji-grid button {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 1.28rem;
  cursor: pointer;
}

.chat-emoji-grid button:hover {
  border-color: rgba(184, 135, 56, 0.18);
  background: #fff3df;
}

.chat-composer-field textarea {
  min-height: 62px;
  border-color: rgba(53, 54, 51, 0.2);
  background: rgba(255, 255, 255, 0.96);
}

.chat-send-button {
  min-height: 50px;
  border-color: #9e4057;
  background: linear-gradient(110deg, #a83f59, #c66b59 58%, #d39b3b);
  box-shadow: 0 8px 20px rgba(159, 64, 85, 0.18);
}

.chat-private-context {
  position: relative;
  overflow: hidden;
  padding: 22px 20px;
  border: 1px solid rgba(169, 79, 97, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 246, 248, 0.98), rgba(241, 248, 244, 0.96)),
    #fff;
}

.chat-private-seal {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  border: 1px solid rgba(169, 79, 97, 0.22);
  border-radius: 50%;
  color: #a0475b;
  background: #fff;
  font-size: 1.4rem;
}

.chat-private-context h2 {
  margin: 4px 0 10px;
  color: #3d2b3d;
  font-size: 1.25rem;
}

.chat-private-context > p:last-child {
  margin: 0;
  color: #6d646b;
  line-height: 1.58;
}

.chat-profile-private {
  width: 100%;
  margin-top: 2px;
}

@media (max-width: 1180px) {
  .chat-contact-list {
    max-height: 310px;
  }
}

@media (max-width: 860px) {
  .chat-room-panel-head {
    display: block;
    padding: 14px 14px 10px;
  }

  .chat-room-panel-head .eyebrow {
    display: none;
  }

  .chat-room-panel-head h2 {
    font-size: 1rem;
  }

  .chat-sidebar-tabs {
    margin-top: 6px;
  }

  .chat-private-panel {
    padding-bottom: 10px;
  }

  .chat-contact-list {
    display: flex;
    max-height: none;
    padding-bottom: 3px;
    overflow-x: auto;
  }

  .chat-contact-button {
    flex: 0 0 205px;
  }

  .chat-room-presence {
    display: flex;
  }
}

@media (max-width: 620px) {
  .chat-pro-hero p {
    font-size: 0.96rem;
  }

  .chat-room-panel-head {
    display: none;
  }

  .chat-room-presence {
    display: none;
  }

  .chat-sidebar-tabs {
    margin-top: 8px;
  }

  .chat-room-identity {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
  }

  .chat-room-symbol {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .chat-pro-feed .chat-message,
  .chat-pro-feed .chat-message.is-own {
    width: 100%;
  }

  .chat-pro-feed .chat-message.is-own {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .chat-pro-composer.chat-form {
    display: grid;
  }

  .chat-composer-main {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .chat-emoji-toggle {
    width: 44px;
    height: 48px;
  }

  .chat-emoji-picker {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-height: 66svh;
  }

  .chat-emoji-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .chat-emoji-grid button {
    min-width: 0;
  }
}

@media (prefers-contrast: more) {
  .chat-pro-page {
    --chat-border: rgba(30, 31, 29, 0.34);
  }

  .chat-pro-feed .chat-message-copy,
  .chat-pro-title > p:last-child,
  .chat-room-button small,
  .chat-contact-copy small {
    color: #292629;
  }
}

/* Chat density v4: persistent members, compact history and a focused workspace. */
.chat-pro-page,
.chat-pro-page button,
.chat-pro-page input,
.chat-pro-page textarea {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.chat-pro-page h1,
.chat-pro-page h2,
.chat-pro-page h3 {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.chat-pro-hero .chat-page-hero-grid {
  min-height: 104px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.chat-pro-hero h1 {
  margin-bottom: 5px;
  font-size: clamp(1.8rem, 3vw, 2.45rem);
  font-weight: 740;
  line-height: 1.08;
}

.chat-pro-hero p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.45;
}

.chat-pro-section {
  padding: 14px 0 26px;
}

.chat-pro-layout {
  grid-template-columns: minmax(230px, 270px) minmax(0, 1fr);
  gap: 14px;
  width: min(1560px, calc(100% - 28px));
  align-items: stretch;
}

.chat-room-panel,
.chat-pro-shell {
  height: max(620px, calc(100svh - 196px));
  max-height: 860px;
}

.chat-room-panel {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-room-panel-head {
  flex: 0 0 auto;
  padding: 13px 14px 10px;
}

.chat-room-panel-head h2 {
  font-size: 1.05rem;
  font-weight: 730;
}

.chat-sidebar-label {
  margin: 0;
  padding: 10px 14px 4px;
  color: #776e74;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-room-list {
  padding: 4px 8px 8px;
}

.chat-room-button {
  min-height: 52px;
  padding: 7px 8px;
}

.chat-room-button strong {
  font-size: 0.88rem;
  font-weight: 720;
}

.chat-room-button small {
  font-size: 0.73rem;
}

.chat-private-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 8px;
  border-top: 1px solid rgba(53, 54, 51, 0.11);
}

.chat-members-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 32px;
  padding: 0 4px 6px;
  color: #423942;
}

.chat-members-head strong {
  font-size: 0.84rem;
  font-weight: 760;
}

.chat-members-head span {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  background: #397c69;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
}

.chat-contact-search {
  flex: 0 0 auto;
  min-height: 40px;
}

.chat-contact-list {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.chat-contact-button {
  min-height: 52px;
  padding: 6px 7px;
}

.chat-contact-copy strong {
  font-size: 0.86rem;
  font-weight: 720;
}

.chat-room-presence {
  flex: 0 0 auto;
  padding: 9px 14px;
  font-size: 0.75rem;
}

.chat-pro-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  min-width: 0;
  min-height: 0;
}

.chat-pro-head {
  min-height: 76px;
  padding: 10px 14px;
}

.chat-room-identity {
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
}

.chat-room-symbol {
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
}

.chat-pro-title h2 {
  margin: 0 0 1px;
  font-size: 1.18rem;
  font-weight: 740;
}

.chat-pro-title .eyebrow {
  display: none;
}

.chat-pro-title > p:last-child {
  font-size: 0.78rem;
}

.chat-pro-head-tools {
  gap: 7px;
}

.chat-search {
  min-height: 40px;
  width: min(250px, 23vw);
}

.chat-pro-head .chat-status {
  padding: 6px 9px;
  font-size: 0.74rem;
}

.chat-context-toggle {
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid rgba(169, 79, 97, 0.2);
  border-radius: 7px;
  color: #754052;
  background: #fff6f7;
  font-size: 0.78rem;
  font-weight: 760;
  cursor: pointer;
}

.chat-feed-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.chat-ai-typing {
  position: absolute;
  z-index: 7;
  left: 18px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(55, 112, 95, 0.2);
  border-radius: 8px;
  color: #3d6257;
  background: rgba(248, 253, 250, 0.97);
  box-shadow: 0 5px 18px rgba(38, 62, 55, 0.12);
  font-size: 0.76rem;
  font-weight: 680;
}

.chat-ai-typing[hidden] {
  display: none;
}

.chat-ai-typing-dots {
  display: inline-flex;
  gap: 3px;
}

.chat-ai-typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #458b76;
  animation: chat-ai-dot 900ms ease-in-out infinite;
}

.chat-ai-typing-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.chat-ai-typing-dots i:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes chat-ai-dot {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.chat-pro-feed.chat-messages {
  height: 100%;
  min-height: 0;
  padding: 10px 18px 16px;
  scroll-behavior: smooth;
}

.chat-history-button {
  position: absolute;
  z-index: 6;
  top: 8px;
  left: 50%;
  min-height: 34px;
  padding: 6px 12px;
  transform: translateX(-50%);
  border: 1px solid rgba(55, 112, 95, 0.22);
  border-radius: 999px;
  color: #356e5e;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 5px 16px rgba(38, 62, 55, 0.12);
  font-size: 0.76rem;
  font-weight: 750;
  cursor: pointer;
}

.chat-history-button[hidden] {
  display: none;
}

.chat-pro-feed .chat-date-separator,
.chat-pro-feed .chat-unread-separator {
  margin: 9px 0 7px;
  font-size: 0.72rem;
}

.chat-pro-feed .chat-message,
.chat-pro-feed .chat-message.is-own {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  width: min(94%, 900px);
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 7px;
  box-shadow: 0 3px 10px rgba(40, 39, 37, 0.045);
}

.chat-pro-feed .chat-message.is-own {
  grid-template-columns: minmax(0, 1fr) 34px;
  width: min(88%, 820px);
}

.chat-pro-feed .chat-avatar-button {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.chat-pro-feed .chat-message-body {
  gap: 4px;
}

.chat-pro-feed .chat-author-button {
  min-height: 24px;
  font-size: 0.82rem;
  font-weight: 740;
}

.chat-pro-feed .chat-role {
  padding: 2px 6px;
  font-size: 0.64rem;
}

.chat-pro-feed .chat-message time {
  padding-top: 4px;
  font-size: 0.7rem;
}

.chat-pro-feed .chat-message-copy {
  font-size: 0.97rem;
  line-height: 1.45;
}

.chat-pro-feed .chat-reply-reference {
  padding: 5px 8px;
  font-size: 0.76rem;
}

.chat-pro-feed .chat-message-foot {
  gap: 5px;
}

.chat-pro-feed .chat-reactions,
.chat-pro-feed .chat-message-actions {
  gap: 4px;
}

.chat-pro-feed .chat-message button,
.chat-pro-feed .chat-message summary {
  min-height: 32px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 720;
}

.chat-pro-feed .chat-reaction-button {
  padding: 4px 7px;
}

.chat-pro-feed summary {
  min-width: 34px;
  min-height: 32px;
  padding: 0 6px;
}

.chat-pro-composer.chat-form {
  padding: 9px 12px 5px;
}

.chat-composer-main {
  grid-template-columns: 42px minmax(0, 1fr);
}

.chat-emoji-toggle {
  width: 42px;
  height: 44px;
}

.chat-composer-field textarea {
  min-height: 50px;
  max-height: 120px;
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 0.97rem;
}

.chat-send-button {
  min-height: 44px;
}

.chat-draft-status {
  min-height: 16px;
  padding-bottom: 4px;
  font-size: 0.7rem;
}

.chat-context-panel {
  position: fixed;
  z-index: 80;
  top: 76px;
  right: 16px;
  bottom: 16px;
  display: grid;
  align-content: start;
  width: min(390px, calc(100% - 32px));
  padding: 12px;
  overflow: auto;
  border: 1px solid rgba(53, 54, 51, 0.17);
  border-radius: 8px;
  background: #f8f5f4;
  box-shadow: 0 24px 70px rgba(31, 24, 32, 0.3);
}

.chat-context-panel[hidden] {
  display: none;
}

.chat-context-head {
  position: sticky;
  z-index: 2;
  top: -12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: -12px -12px 2px;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(53, 54, 51, 0.12);
  background: #fffdfb;
}

.chat-context-head h2 {
  margin: 0;
  font-size: 1rem;
}

.chat-context-head button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(53, 54, 51, 0.15);
  border-radius: 50%;
  color: #5e555c;
  background: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}

.chat-message.is-entering {
  animation: chat-message-enter 240ms ease-out both;
}

@media (hover: hover) and (pointer: fine) {
  .chat-pro-feed .chat-message-foot {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-3px);
    transition: max-height 170ms ease, opacity 150ms ease, transform 170ms ease;
  }

  .chat-pro-feed .chat-message:hover .chat-message-foot,
  .chat-pro-feed .chat-message:focus-within .chat-message-foot {
    max-height: 38px;
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chat-message-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .chat-pro-layout {
    grid-template-columns: 1fr;
  }

  .chat-room-panel,
  .chat-pro-shell {
    height: auto;
    max-height: none;
  }

  .chat-room-panel {
    position: static;
  }

  .chat-sidebar-label {
    display: none;
  }

  .chat-room-list {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    overflow-x: auto;
  }

  .chat-private-panel {
    display: grid;
  }

  .chat-members-head {
    grid-column: 1 / -1;
  }

  .chat-contact-list {
    display: flex;
  }

  .chat-pro-shell {
    min-height: 650px;
  }

  .chat-pro-feed.chat-messages {
    height: min(62svh, 660px);
    min-height: 440px;
  }
}

@media (max-width: 620px) {
  .chat-private-panel {
    height: auto;
  }

  .chat-contact-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    gap: 4px;
    overflow: visible;
  }

  .chat-contact-button {
    width: 100%;
    min-width: 0;
    flex: none;
  }

  .chat-pro-hero .chat-page-hero-grid {
    min-height: 132px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .chat-pro-section {
    padding-top: 9px;
  }

  .chat-pro-layout {
    width: min(100% - 16px, 760px);
    gap: 9px;
  }

  .chat-room-list {
    grid-template-columns: repeat(3, minmax(112px, 1fr));
  }

  .chat-pro-head {
    padding: 9px 10px;
  }

  .chat-pro-head-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .chat-search {
    width: 100%;
  }

  .chat-context-toggle {
    padding-inline: 8px;
  }

  .chat-pro-feed.chat-messages {
    height: 62svh;
    min-height: 430px;
    padding: 8px 7px 12px;
  }

  .chat-pro-feed .chat-message,
  .chat-pro-feed .chat-message.is-own {
    width: 100%;
    padding: 7px 8px;
  }

  .chat-pro-feed .chat-message-foot {
    display: flex;
  }

  .chat-pro-feed .chat-reactions,
  .chat-pro-feed .chat-message-actions {
    flex-wrap: wrap;
  }

  .chat-pro-composer.chat-form {
    padding-inline: 9px;
  }

  .chat-context-panel {
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: calc(100% - 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-message.is-entering {
    animation: none;
  }

  .chat-ai-typing-dots i {
    animation: none;
  }

  .chat-pro-feed .chat-message-foot {
    transition: none;
  }
}

/* Cascade lock: final readable chat density. */
.chat-pro-hero h1 {
  font-size: 2.35rem;
  line-height: 1.12;
}

.chat-room-button {
  min-height: 66px;
}

.chat-room-button strong {
  font-size: 0.98rem;
  line-height: 1.28;
}

.chat-room-button small {
  font-size: 0.84rem;
  line-height: 1.35;
}

.chat-contact-search {
  min-height: 44px;
}

.chat-contact-search input {
  font-size: 0.95rem;
}

.chat-contact-button {
  min-height: 58px;
  padding: 7px 8px;
}

.chat-contact-copy strong {
  font-size: 0.94rem;
}

.chat-contact-copy small {
  color: #685f66;
  font-size: 0.8rem;
  line-height: 1.35;
}

.chat-pro-feed .chat-message-copy {
  font-size: 1rem;
  line-height: 1.52;
}

.chat-pro-feed .chat-message time,
.chat-reply-bar small,
.chat-draft-status,
.chat-character-count {
  font-size: 0.8rem;
}

.chat-pro-feed .chat-message button,
.chat-pro-feed .chat-message summary,
.chat-context-toggle,
.chat-emoji-toggle {
  min-height: 42px;
  font-size: 0.88rem;
}

.chat-composer-field textarea {
  font-size: 1rem;
  line-height: 1.5;
}

@media (max-width: 620px) {
  .chat-pro-hero h1 {
    font-size: 2rem;
  }

  .chat-room-button {
    min-height: 64px;
  }

  .chat-room-button strong {
    font-size: 0.9rem;
  }

  .chat-room-button small {
    font-size: 0.78rem;
  }

  .chat-contact-list {
    grid-template-columns: 1fr;
  }
}
